From 1e2bd6710762860f1735baef0f61be1d8edb2fe2 Mon Sep 17 00:00:00 2001 From: zhouwx <1175765986@qq.com> Date: 星期二, 12 十一月 2024 11:16:45 +0800 Subject: [PATCH] 责任人 --- src/views/Admin/msgReview.vue | 295 ++++++++++++++++++++++++++++++++++++++--------------------- 1 files changed, 190 insertions(+), 105 deletions(-) diff --git a/src/views/Admin/msgReview.vue b/src/views/Admin/msgReview.vue index 51d274e..c48a9f3 100644 --- a/src/views/Admin/msgReview.vue +++ b/src/views/Admin/msgReview.vue @@ -2,14 +2,14 @@ <div class="inner"> <a-row type="flex" justify="space-between" style="margin-bottom: 20px"> <a-col :span="8"> - <a-radio-group v-model="category"> - <a-radio-button :value="0"> + <a-radio-group v-model="search.searchParams.reviewStatus" @change="getData"> + <a-radio-button :value="null"> 全部 </a-radio-button> - <a-radio-button :value="1"> + <a-radio-button :value="2"> 审核通过 </a-radio-button> - <a-radio-button :value="2"> + <a-radio-button :value="1"> 未审核 </a-radio-button> <a-radio-button :value="3"> @@ -21,108 +21,139 @@ <a-row type="flex" justify="end" :gutter="12"> <a-col :span="8"> <a-range-picker + v-model="timeRange" format="YYYY-MM-DD" :placeholder="['开始时间', '结束时间']" @change="timeChange" - @ok="timeOk" + @ok="onOk" style="width: 100%" /> </a-col> <a-col :span="4"> - <a-button type="primary">查询</a-button> - <a-button style="margin-left: 12px">重置</a-button> + <a-button type="primary" @click="getData" v-preventReClick="1500">查询</a-button> + <a-button style="margin-left: 12px" @click="resetSearch">重置</a-button> </a-col> </a-row> </a-col> </a-row> <div class="table-cont"> - <a-table :columns="columns" :data-source="data" bordered> - <template #level="level"> - <a-tag :color="level === '黄色' ? 'yellow' :level === '橙色'? 'orange':level === '红色'?'red':'blue'"> - {{ level }} - </a-tag> + <a-table :columns="columns" :data-source="data" bordered :rowKey="record=>record.id" :pagination="pagination"> + <template #index="text,record,index"> + {{ index+1 }} </template> - <template #attachment="text"> - <span v-if="text==='无'">无</span> - <a v-else><b><a-icon type="paper-clip" /> {{text}}</b></a> + <template #disasterType="text"> + {{ getRiskName(text) }} + </template> + <template #attachment="attachment"> + <span v-if="attachment===null|| attachment===[]">无</span> + <div v-else> + <a-button @click="viewFile(item)" type="link" v-for="(item,index) in attachment" :key="index"><a-icon type="paper-clip"/>{{item.attachmentName}}</a-button> + </div> </template > - <template #status="status"> + <template #reviewStatus="reviewStatus"> <a-tag - :color="status === 1 ? 'green' : status === 2 ? 'blue' : 'red'" + :color="reviewStatus === 1 ? 'blue' : reviewStatus === 2 ? 'green' : 'red'" > - {{ status==1?'审核通过':status==2?'未审核':'审核驳回' }} + {{ reviewStatus==1?'未审核':reviewStatus==2?'已审核':reviewStatus==3?'审核驳回':'' }} </a-tag> </template> <template #operation="text, record, index"> - <a-button type="link" v-if="record.status == 1 || record.status == 3">查看信息详情</a-button> - <a-button type="primary" v-if="record.status == 2">查看并审核</a-button> + <a-button type="link" v-if="record.reviewStatus == 2 || record.reviewStatus == 3" @click="openDetails(record.id)">查看信息详情</a-button> + <a-button type="primary" v-if="record.reviewStatus == 1" @click="openMod('review',record)">查看并审核</a-button> </template> </a-table> </div> - + <msg-edit-mod ref="msgEdit" @refresh="getData"></msg-edit-mod> + <msg-detail-mod ref="msgDetail"></msg-detail-mod> </div> </template> <script> +import {getReviewDetail, getReviewRecord} from "@/api/review"; +import msgEditMod from '@/views/Admin/components/msgEditMod' +import msgDetailMod from "@/views/Admin/components/msgDetailMod"; +import axios from "axios"; +import Cookies from "js-cookie"; +import {getUserInfo} from "@/util/storage"; + export default { name: 'msgReview', - components: {}, + components: { msgEditMod, msgDetailMod }, data () { return { - category: 0, + userInfo: getUserInfo(), + search:{ + pageIndex: 1, + pageSize: 10, + searchParams:{ + reviewStatus: null, + startTime: '', + endTime: '' + } + }, + timeRange: [], + riskOptions: [ + {name: '地震',value: 1}, + {name: '气象',value: 3}, + {name: '地质灾害',value: 4}, + {name: '水旱',value: 5}, + {name: '森林草原火灾',value: 6} + ], + pagination: { + current: 1, + defaultCurrent: 1, + defaultPageSize: 10, + total: 0, + onChange: ( page, pageSize ) => this.onPageChange(page,pageSize), + showTotal: total => `共 ${total} 条` + }, columns: [ { title: '序号', - dataIndex: 'key', - width: '5%', - }, - { - title: '提交审核时间', - dataIndex: 'time', - width: '15%', + key: 'index', scopedSlots: { - customRender: 'time' - }, //设置定制化表格数据 - }, - { - title: '发布单位', - dataIndex: 'department', - width: '12%', - }, - { - title: '类别', - dataIndex: 'category', - width: '8%', - }, - { - title: '级别', - dataIndex: 'level', - scopedSlots: { - customRender: 'level' - }, //设置定制化表格数据 - width: '8%', - }, - { - title: '信息标题', - dataIndex: 'title', - width: '16%', - }, - { - title: '附件', - dataIndex: 'attachment', - width: '6%', - scopedSlots: { - customRender: 'attachment' + customRender: 'index' }, }, { - title: '审核情况', - dataIndex: 'status', - width: '10%', + title: '提交审核时间', + key: 'gmtReviewSubmit', + dataIndex: 'gmtReviewSubmit', + }, + { + title: '发布单位', + key: 'publishingUnit', + dataIndex: 'publishingUnit', + }, + { + title: '灾种', + dataIndex: 'disasterType', + key: 'disasterType', scopedSlots: { - customRender: 'status' + customRender: 'disasterType' + }, //设置定制化表格数据 + }, + { + title: '信息标题', + key: 'title', + dataIndex: 'title', + }, + { + title: '附件', + key: 'attachment', + dataIndex: 'attachment', + scopedSlots: { + customRender: 'attachment' + }, + width: '15%' + }, + { + title: '审核情况', + dataIndex: 'reviewStatus', + scopedSlots: { + customRender: 'reviewStatus' }, //设置定制化表格数据 }, { @@ -133,53 +164,107 @@ }, }, ], - data: [ - { - key: 1, - id:1001, - time: '2023-05-02 15:30', - department: '自治区预警中心', - category: '气象', - level: '黄色', - title: '全疆高温红色预警', - attachment: '1', - status: 1 - }, - { - key: 2, - id:1002, - time: '2023-05-02 15:30', - department: '自治区预警中心', - category: '气象', - level: '橙色', - title: '全疆高温红色预警', - attachment: '1', - status: 2 - }, - { - key: 3, - id:1003, - time: '2023-05-02 15:30', - department: '自治区预警中心', - category: '气象', - level: '橙色', - title: '全疆高温红色预警', - attachment: '1', - status: 3 - } - ] + data: [] + } + }, + mounted() { + if(getUserInfo().role.id == 1){ + this.columns = this.columns.filter(i=>i.dataIndex !== 'operation') } }, created() { const t = this + if(t.$route.query){ + t.search.searchParams.reviewStatus = t.$route.query.type + } + t.getData() }, methods:{ - timeChange(date, dateString) { - console.log(date, dateString); + async getData(){ + const t = this + const res = await getReviewRecord(this.search) + if(res.data.code == 100){ + t.data = res.data.data + t.pagination.total = res.data.total + }else{ + this.$message.error(res.data.msg) + } }, - timeOk(value) { - console.log('timeOk: ', value); + + resetSearch(){ + const t = this + t.search = { + pageIndex: 1, + pageSize: 10, + searchParams:{ + reviewStatus: null, + startTime: '', + endTime: '' + } + } + t.timeRange = [] + t.getData() }, + + timeChange(value, dateString) { + const t = this + if(dateString){ + t.search.searchParams.startTime = value[0].format('YYYY-MM-DD 00:00:00') + t.search.searchParams.endTime = value[1].format('YYYY-MM-DD 23:59:59') + } + }, + + onPageChange(page, pageSize) { + const t= this + t.pagination.current = page + t.search.pageIndex = page + t.getData() + }, + + viewFile(item){ + const t = this + const { baseUrl } = require('../../../config/env.' + process.env.NODE_ENV) + axios.get(baseUrl + item.attachment,{headers:{'Content-Type': 'application/json','tk': `${Cookies.get('resTk')}`,'uid':`${Cookies.get('resUid')}`},responseType: 'blob'}).then(res=>{ + if (res) { + const link = document.createElement('a') + let blob = new Blob([res.data],{type: res.data.type}) + link.style.display = "none"; + link.href = URL.createObjectURL(blob); // 创建URL + window.open(link.href) + // link.setAttribute("download", item.attachmentName); + // document.body.appendChild(link); + // link.click(); + // document.body.removeChild(link); + } else { + this.$message.error('获取文件失败') + } + }) + }, + + openMod(type,data){ + const t = this + getReviewDetail(data.id).then(res=>{ + if(res.data.code == 100){ + t.$refs.msgEdit.openMod(type,res.data.data) + }else{ + this.$message.error(res.data.msg) + } + }) + }, + + openDetails(id){ + const t = this + t.$refs.msgDetail.getDetails(id) + t.$refs.msgDetail.visible = true + }, + + onOk(value) { + console.log('onOk: ', value); + }, + getRiskName(disasterType){ + return this.riskOptions.find(i => i.value === disasterType)?.name; + } + } } </script> -- Gitblit v1.9.2