Blame view

src/views/system/xttz/xttz.vue 5.48 KB
蔡俊立 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
<template>
  <div class="from-clues">
    <!-- 表单部分 -->
    <div class="from-clues-header">
      <el-form :model="ruleForm" @submit.native.prevent label-width="80px">
        <el-row>
          <el-col :span="5">
            <el-form-item label="通知标题">
              <el-input v-model="ruleForm.noticeTitle" @clear="queryClick()" clearable placeholder="通知标题"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="5">
            <el-form-item label="通知状态">
              <el-select v-model="ruleForm.noticeStatus" class="width100" filterable clearable placeholder="请选择通知状态">
                <el-option v-for="item in noticeStatusList" :key="item.value" :label="item.label" :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="14" class="btnColRight">
            <el-form-item>
              <el-button type="primary" native-type="submit" @click="queryClick()">查询</el-button>
              <el-button type="primary" @click="openDialog()">新增</el-button>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </div>
    <!-- 表格 -->
    <div class="from-clues-content">
      <lb-table :page-size="pageData.size" border :current-page.sync="pageData.current" :total="tableData.total"
        @size-change="handleSizeChange" @p-current-change="handleCurrentChange" :column="tableData.columns"
        :data="tableData.data">
      </lb-table>
任超 committed
35
    </div>
蔡俊立 committed
36
    <addDialog ref="addDialog" v-model="isDialog" :isButtonFlag="isButtonFlag" :title="dialogTitle"/>
蔡俊立 committed
37 38 39 40 41
  </div>
</template>
<script>
import table from "@/utils/mixin/table";
import { datas, sendThis } from "./xttzdata";
任超 committed
42
import { getSysNoticeList, deleteSysNotice, publishNotice, unPublishNotice } from "@/api/notice.js"
蔡俊立 committed
43 44 45
import addDialog from "./components/addDialog.vue";
export default {
  name: "xttz",
任超 committed
46
  components: { addDialog },
蔡俊立 committed
47 48 49 50 51 52 53 54
  mixins: [table],
  mounted () {
    sendThis(this);
    this.queryClick()
  },
  data () {
    return {
      isDialog: false,
蔡俊立 committed
55 56
      isButtonFlag: true,
      dialogTitle: '',
蔡俊立 committed
57
      ruleForm: {
任超 committed
58 59
        noticeTitle: '',
        noticeStatus: ''
蔡俊立 committed
60 61
      },
      noticeStatusList: [
任超 committed
62 63
        { "label": '未发布', 'value': '1' },
        { 'label': '已发布', 'value': '2' }
蔡俊立 committed
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
      ],
      tableData: {
        total: 0,
        columns: datas.columns(),
        data: [],
      },
      isDiglog: false
    }
  },
  methods: {
    // 列表渲染接口
    queryClick () {
      this.$startLoading()
      getSysNoticeList({ ...this.ruleForm, ...this.pageData }, { 'target': '#xttzLoading' }).then(res => {
        if (res.code === 200) {
          this.$endLoading()
          let { total, records } = res.result
          this.tableData.total = total;
          this.tableData.data = records
        }
      })
    },
    //打开新增弹窗
蔡俊立 committed
87 88 89 90 91 92 93 94 95 96 97
    openDialog (item) {
      if (item) {
        this.$nextTick(() => {
          this.isButtonFlag = false;
          this.$refs.addDialog.getDetailInfo(item);
          this.dialogTitle = '系统通知详情'
        })
      }else{
        this.isButtonFlag = true;
        this.dialogTitle = '新增系统通知'
      }
蔡俊立 committed
98 99 100
      this.isDialog = true;
    },
    //删除
任超 committed
101
    delNotice (item) {
蔡俊立 committed
102 103 104 105 106 107 108
      this.$confirm('是否确定删除', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        deleteSysNotice({ "bsmNotice": item.bsmNotice }).then(res => {
          if (res.code == 200) {
任超 committed
109 110
            this.$message.success('删除成功')
            this.queryClick();
蔡俊立 committed
111
          } else {
任超 committed
112
            this.$message.error(res.message)
蔡俊立 committed
113 114 115 116 117 118 119 120 121 122
          }
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        });
      });
    },
    //发布
任超 committed
123
    toPublish (item) {
蔡俊立 committed
124 125 126 127 128 129 130
      this.$confirm('是否确定发布', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        publishNotice({ "bsmNotice": item.bsmNotice }).then(res => {
          if (res.code == 200) {
任超 committed
131 132
            this.$message.success('发布成功')
            this.queryClick();
蔡俊立 committed
133
          } else {
任超 committed
134
            this.$message.error(res.message)
蔡俊立 committed
135 136 137 138 139 140 141 142 143 144
          }
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '操作取消'
        });
      });
    },
    //取消发布
任超 committed
145
    toUnPublish (item) {
蔡俊立 committed
146 147 148 149 150 151 152
      this.$confirm('是否确定取消发布', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        unPublishNotice({ "bsmNotice": item.bsmNotice }).then(res => {
          if (res.code == 200) {
任超 committed
153 154
            this.$message.success('删除成功')
            this.queryClick();
蔡俊立 committed
155
          } else {
任超 committed
156
            this.$message.error(res.message)
蔡俊立 committed
157 158 159 160 161 162 163 164 165
          }
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '操作取消'
        });
      });
    },
蔡俊立 committed
166 167 168 169 170 171 172 173 174
    //编辑通知
    editNotice(item) {
      this.$nextTick(() => {
        this.isButtonFlag = true;
        this.$refs.addDialog.getDetailInfo(item);
        this.dialogTitle = '编辑系统通知'
        this.isDialog = true;
      })
    },
任超 committed
175
    downloadFile (item) {
蔡俊立 committed
176 177 178 179 180 181 182 183 184
      const href = item.noticeFileUrl
      window.open(href, '_blank');
    }
  },
};
</script>
<style scoped lang="scss">
@import "~@/styles/public.scss";
</style>