Blame view

src/views/system/xttz/xttzview.vue 3.26 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";
任超 committed
34
import { getSysNoticeList, setReadStatus, setAllRead } from "@/api/system.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 63 64 65 66 67 68 69 70 71 72 73 74 75
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: {
    // 列表渲染接口
    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
        }
      })
    },
    //打开新增弹窗
    openDialog (item) {
任超 committed
76 77 78 79 80 81 82 83 84 85 86 87
      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
88
            })
任超 committed
89 90 91
          }
        })
      }
蔡俊立 committed
92 93
    },
    //一键已读
任超 committed
94 95 96 97 98 99 100 101 102
    toReadAll () {
      setAllRead().then(res => {
        if (res.code == 200) {
          this.$message.success('设置成功')
          this.queryClick();
        } else {
          this.$message.error("设置失败")
        }
      })
蔡俊立 committed
103 104 105 106 107 108 109 110 111 112 113
    },
    downloadFile (item) {
      const href = item.noticeFileUrl
      window.open(href, '_blank');
    }
  },
};
</script>
<style scoped lang="scss">
@import "~@/styles/public.scss";
</style>