Blame view

src/views/system/xttz/xttz.vue 5.5 KB
蔡俊立 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
<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>
22
              <el-button type="primary" @click="handleSearch">查询</el-button>
蔡俊立 committed
23 24 25 26 27 28 29 30 31 32 33 34
              <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";
42
import { getSysNoticeList, deleteSysNotice, publishNotice, unPublishNotice } from "@/api/sysNotice.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
    openDialog (item) {
      if (item) {
89
        this.$popupDialog("系统通知详情", "system/xttz/components/addDialog", { ...item, "isButtonFlag": false }, "50%")
任超 committed
90
      } else {
91
        this.$popupDialog("新增系统通知", "system/xttz/components/addDialog", { "isButtonFlag": true }, "50%")
蔡俊立 committed
92
      }
蔡俊立 committed
93 94
    },
    //删除
任超 committed
95
    delNotice (item) {
蔡俊立 committed
96 97 98 99 100 101 102
      this.$confirm('是否确定删除', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        deleteSysNotice({ "bsmNotice": item.bsmNotice }).then(res => {
          if (res.code == 200) {
任超 committed
103 104
            this.$message.success('删除成功')
            this.queryClick();
蔡俊立 committed
105
          } else {
任超 committed
106
            this.$message.error(res.message)
蔡俊立 committed
107 108 109 110 111 112 113 114 115 116
          }
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        });
      });
    },
    //发布
任超 committed
117
    toPublish (item) {
蔡俊立 committed
118 119 120 121 122 123 124
      this.$confirm('是否确定发布', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        publishNotice({ "bsmNotice": item.bsmNotice }).then(res => {
          if (res.code == 200) {
任超 committed
125
            this.$message.success('发布成功')
任超 committed
126
            this.postMessage()
任超 committed
127
            this.queryClick();
蔡俊立 committed
128
          } else {
任超 committed
129
            this.$message.error(res.message)
蔡俊立 committed
130 131 132 133 134 135 136 137 138
          }
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '操作取消'
        });
      });
    },
任超 committed
139 140 141
    postMessage () {
      window.parent.postMessage({ update: true }, '*')
    },
蔡俊立 committed
142
    //取消发布
任超 committed
143
    toUnPublish (item) {
蔡俊立 committed
144 145 146 147 148 149 150
      this.$confirm('是否确定取消发布', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        unPublishNotice({ "bsmNotice": item.bsmNotice }).then(res => {
          if (res.code == 200) {
任超 committed
151
            this.postMessage()
任超 committed
152 153
            this.$message.success('删除成功')
            this.queryClick();
蔡俊立 committed
154
          } else {
任超 committed
155
            this.$message.error(res.message)
蔡俊立 committed
156 157 158 159 160 161 162 163 164
          }
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '操作取消'
        });
      });
    },
蔡俊立 committed
165
    //编辑通知
任超 committed
166
    editNotice (item) {
赵千 committed
167
      this.$popupDialog("系统通知详情", "system/xttz/components/addDialog", { ...item, "isButtonFlag": true, "edit": true }, "50%")
蔡俊立 committed
168
    },
任超 committed
169
    downloadFile (item) {
蔡俊立 committed
170 171 172 173 174 175 176 177 178
      const href = item.noticeFileUrl
      window.open(href, '_blank');
    }
  },
};
</script>
<style scoped lang="scss">
@import "~@/styles/public.scss";
</style>