Blame view

src/views/system/xttz/xttzview.vue 3.61 KB
蔡俊立 committed
1 2 3 4 5 6 7 8 9 10 11 12 13
<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="19" class="btnColRight">
            <el-form-item>
yangwei committed
14
              <el-button type="primary"  @click="handleSearch">查询</el-button>
蔡俊立 committed
15 16 17 18 19 20 21 22 23 24 25 26 27
              <el-button type="primary" native-type="submit" @click="toReadAll()">一键已读</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>
    </div>
任超 committed
28
    <addDialog ref="addDialog" v-model="isDialog" :isButtonFlag="isButtonFlag" :title="dialogTitle" />
蔡俊立 committed
29 30 31 32 33
  </div>
</template>
<script>
import table from "@/utils/mixin/table";
import { datas, sendThis } from "./xttzviewdata";
34
import { getSysNoticeList, setReadStatus, setAllRead } from "@/api/sysNotice.js"
蔡俊立 committed
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
import addDialog from "./components/addDialog.vue";
export default {
  name: "xttzview",
  components: { addDialog },
  mixins: [table],
  mounted () {
    sendThis(this);
    this.queryClick()
  },
  data () {
    return {
      isDialog: false,
      isButtonFlag: true,
      dialogTitle: '',
      ruleForm: {
        noticeTitle: '',
        noticeStatus: '2'
      },
      tableData: {
        total: 0,
        columns: datas.columns(),
        data: [],
      },
      isDiglog: false
    }
  },
  methods: {
    // 列表渲染接口
yuanbo committed
63 64 65 66
    /**
     * @description: 列表渲染接口
     * @author: renchao
     */
蔡俊立 committed
67 68 69 70 71 72 73 74 75 76 77 78
    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
        }
      })
    },
    //打开新增弹窗
yuanbo committed
79 80 81 82 83
    /**
     * @description: 打开新增弹窗
     * @param {*} item
     * @author: renchao
     */
蔡俊立 committed
84
    openDialog (item) {
任超 committed
85 86 87 88 89 90 91 92 93 94 95 96
      this.$nextTick(() => {
        this.isButtonFlag = false;
        this.$refs.addDialog.getDetailInfo(item);
        this.dialogTitle = '系统通知详情'
        this.isDialog = true;
      })
      let that = this;
      if (item.isRead == 1) {
        setReadStatus({ bsmNotice: item.bsmNotice }).then(res => {
          if (res.code == 200) {
            that.$nextTick(() => {
              item.isRead = 2
蔡俊立 committed
97
            })
任超 committed
98 99 100
          }
        })
      }
蔡俊立 committed
101 102
    },
    //一键已读
yuanbo committed
103 104 105 106
    /**
     * @description: 一键已读
     * @author: renchao
     */
任超 committed
107 108 109 110 111 112 113 114 115
    toReadAll () {
      setAllRead().then(res => {
        if (res.code == 200) {
          this.$message.success('设置成功')
          this.queryClick();
        } else {
          this.$message.error("设置失败")
        }
      })
蔡俊立 committed
116
    },
yuanbo committed
117 118 119 120 121
    /**
     * @description: downloadFile
     * @param {*} item
     * @author: renchao
     */
蔡俊立 committed
122 123 124 125 126 127 128 129 130 131
    downloadFile (item) {
      const href = item.noticeFileUrl
      window.open(href, '_blank');
    }
  },
};
</script>
<style scoped lang="scss">
@import "~@/styles/public.scss";
</style>