Commit 6b202c33 authored by ww-xxy's avatar ww-xxy

优化网络理政报表

parent 2ad54f65
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<a-button :loading="btnLoading" type="success" @click="handleExportTable"> <a-button :loading="btnLoading" type="success" @click="handleExportTable">
<span>{{ tableSelectedRows.length ? "导出" : "导出全部" }}</span> <span>{{ tableSelectedRows.length ? "导出" : "导出全部" }}</span>
</a-button> </a-button>
<div class="ml20">提交次数:{{ numObj ? numObj.count : 0 }}</div> <div class="ml20">提交次数:{{ numObj ? numObj.count : 0 }}</div>
<div class="ml20">回复次数:{{ numObj ? numObj.reply_count : 0 }}</div> <div class="ml20">回复次数:{{ numObj ? numObj.reply_count : 0 }}</div>
</div> </div>
<a-form :model="queryform" layout="inline"> <a-form :model="queryform" layout="inline">
...@@ -29,29 +29,29 @@ ...@@ -29,29 +29,29 @@
<a-button type="primary" @click="getlist">搜索</a-button> <a-button type="primary" @click="getlist">搜索</a-button>
</a-form-item> </a-form-item>
</a-form> </a-form>
</div> </div>
<div class="table-box"> <div class="table-box">
<a-table :dataSource="tabledataSource" :columns="tablecolumns" :pagination="pagination" :scroll="{ y: 590 }" <a-table :dataSource="tabledataSource" :columns="tablecolumns" :pagination="pagination" :scroll="{ y: 590 }"
:row-key="(record) => record.id" @change="changeTablePage" :row-selection="{ :row-key="(record) => record.id" @change="changeTablePage" :row-selection="{
selectedRowKeys: tableSelectedKeys, selectedRowKeys: tableSelectedKeys,
onChange: onSelectChange, onChange: onSelectChange,
}"> }">
<template slot="type" slot-scope="text, record, index"> <template slot="type" slot-scope="text, record, index">
<div>{{typeList.find(item=>record.type).label}}</div> <div>{{typeList.find(item=>record.type).label}}</div>
</template> </template>
<template slot="valid" slot-scope="text, record, index"> <template slot="valid" slot-scope="text, record, index">
<div>{{record.valid == 1 ? '' : ''}}</div> <div>{{record.valid == 1 ? '' : ''}}</div>
</template> </template>
<template slot="secrecy" slot-scope="text, record, index"> <template slot="secrecy" slot-scope="text, record, index">
<div>{{record.secrecy == 1 ? '' : ''}}</div> <div>{{record.secrecy == 1 ? '' : ''}}</div>
</template> </template>
<template slot="status" slot-scope="text, record, index"> <template slot="status" slot-scope="text, record, index">
<div>{{record.status == 1 ? '' : ''}}</div> <div>{{record.status == 1 ? '' : ''}}</div>
</template> </template>
<template slot="操作" slot-scope="text, record, index"> <template slot="操作" slot-scope="text, record, index">
<a-button type="link" @click="detail(record)">详情</a-button> <a-button type="link" @click="detail(record)">详情</a-button>
</template> </template>
</a-table> </a-table>
</div> </div>
<a-drawer title="详情" :visible="visible" width="100%" @close="visible = false"> <a-drawer title="详情" :visible="visible" width="100%" @close="visible = false">
<div class="content-box"> <div class="content-box">
...@@ -134,7 +134,7 @@ ...@@ -134,7 +134,7 @@
import image from '@/components/image/thumbImage' import image from '@/components/image/thumbImage'
import { import {
export2Excel export2Excel
} from "@/utils/js/exportExcel"; } from "@/utils/js/exportExcel";
import moment from 'moment' import moment from 'moment'
export default { export default {
data() { data() {
...@@ -145,7 +145,7 @@ ...@@ -145,7 +145,7 @@
size: 10, size: 10,
source: '', source: '',
keyword: null, keyword: null,
time: [moment().format('yyyy-MM-DD'),moment().format('yyyy-MM-DD')], time: [moment().format('yyyy-MM-DD'),moment().format('yyyy-MM-DD')],
reply:'' reply:''
}, },
deviceList: [{ deviceList: [{
...@@ -165,9 +165,9 @@ ...@@ -165,9 +165,9 @@
title: "序号", title: "序号",
width: "70px", width: "70px",
align: 'center', align: 'center',
customRender: (text, record, index) => customRender: (text, record, index) =>
(this.queryform.page - 1) * this.queryform.size + (this.queryform.page - 1) * this.queryform.size +
index + index +
1, 1,
}, },
...@@ -227,9 +227,9 @@ ...@@ -227,9 +227,9 @@
}, },
{ {
title: "所属部门", title: "所属部门",
dataIndex: "dept_name", dataIndex: "reply_dept",
align: 'center', align: 'center',
customRender: (text, record, index) => `${record.dept_name || '--'}` customRender: (text, record, index) => `${record.reply_dept || '--'}`
}, },
{ {
title: "操作", title: "操作",
...@@ -265,14 +265,14 @@ ...@@ -265,14 +265,14 @@
methods: { methods: {
getlist() { getlist() {
getImpossible(this.queryform).then(res => { getImpossible(this.queryform).then(res => {
this.tabledataSource = res.data.data this.tabledataSource = res.data.data
this.pagination.total = res.data.total this.pagination.total = res.data.total
}) })
}, },
changeTablePage(e) { changeTablePage(e) {
this.queryform.page = e.current this.queryform.page = e.current
this.queryform.size = e.pageSize this.queryform.size = e.pageSize
this.getlist() this.getlist()
}, },
onChange(e) { onChange(e) {
this.queryform.reply = e.target.checked ? 0 : '' this.queryform.reply = e.target.checked ? 0 : ''
...@@ -321,7 +321,7 @@ ...@@ -321,7 +321,7 @@
page: 1, page: 1,
size: -1 size: -1
}) })
); );
data = datas.data.data data = datas.data.data
if (!data.length) return; if (!data.length) return;
for (let item of data) { for (let item of data) {
...@@ -336,7 +336,7 @@ ...@@ -336,7 +336,7 @@
this.tHeader, this.tHeader,
this.filterVal, this.filterVal,
data, data,
"填单记录报表" + this.$moment().format("YYYYMMDDHHmmss") "办不成事报表" + this.$moment().format("YYYYMMDDHHmmss")
); );
this.btnLoading = false; this.btnLoading = false;
}, },
...@@ -347,13 +347,13 @@ ...@@ -347,13 +347,13 @@
.form-box { .form-box {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
margin-bottom: 10px; margin-bottom: 10px;
.num-dv{ .num-dv{
display: flex; display: flex;
align-items: center; align-items: center;
.ml20{ .ml20{
margin-left: 20px; margin-left: 20px;
} }
} }
} }
...@@ -367,25 +367,25 @@ ...@@ -367,25 +367,25 @@
margin-right: 10px; margin-right: 10px;
margin-bottom: 10px; margin-bottom: 10px;
} }
} }
/deep/.ant-spin-container{ /deep/.ant-spin-container{
display: block !important; display: block !important;
} }
/deep/.ant-drawer-body { /deep/.ant-drawer-body {
background: #f7f7f7; background: #f7f7f7;
padding: 15px; padding: 15px;
box-sizing: border-box; box-sizing: border-box;
min-height: calc(100vh - 55px); min-height: calc(100vh - 55px);
} }
/deep/td { /deep/td {
text-align: left; text-align: left;
} }
/deep/.ant-descriptions-item-label{ /deep/.ant-descriptions-item-label{
color: #1890ff; color: #1890ff;
} }
.btn-dv { .btn-dv {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<div class="callRecord-Container"> <div class="callRecord-Container">
<div class="header_box"> <div class="header_box">
<div> <div>
<a-button type="success" @click="toexportTable"> <a-button type="success" @click="handleExportTable" :loading="btnLoading">
<span>{{ tableSelectedRows.length ? "导出" : "导出全部" }}</span> <span>{{ tableSelectedRows.length ? "导出" : "导出全部" }}</span>
</a-button> </a-button>
<b>建议次数:<i>{{JYCount}}</i></b> <b>建议次数:<i>{{JYCount}}</i></b>
...@@ -57,8 +57,38 @@ ...@@ -57,8 +57,38 @@
<script> <script>
import table from "@/mixins/table"; import table from "@/mixins/table";
import FormDetails from "./components/FormDetails.vue"; import FormDetails from "./components/FormDetails.vue";
import {getWLLZList,getWLLZCount,getWLLZInfo} from "@/api/dataAdmin" import {getWLLZList,getWLLZCount,getWLLZInfo} from "@/api/dataAdmin"
import {export2Excel} from "@/utils/js/exportExcel";
const tHeader = [
// 导出的表头名信息
"建议标题",
"建议类型",
"真实姓名",
"联系电话",
"是否公开",
"是否保密",
"提交日期",
"是否回复",
"回复人",
"回复时间",
"所属部门",
]
const filterVal = [
// 导出的表头字段名,需要导出表格字段名
"title",
"type",
"upname",
"upphone",
"valid",
"secrecy",
"create_time",
"status",
"reply_name",
"update_time",
"deptName",
]
export default { export default {
mixins: [table], mixins: [table],
name: "networkForm", name: "networkForm",
...@@ -159,6 +189,7 @@ export default { ...@@ -159,6 +189,7 @@ export default {
timeList:[],// 时间 timeList:[],// 时间
JYCount:0,//建议次数 JYCount:0,//建议次数
HFCount:0,//回复次数 HFCount:0,//回复次数
btnLoading: false,
}; };
}, },
components: { components: {
...@@ -186,66 +217,64 @@ export default { ...@@ -186,66 +217,64 @@ export default {
this.isReply = false this.isReply = false
this.togetWLLZCount() this.togetWLLZCount()
}, },
// 重写导出 // 导出
toexportTable() { async handleExportTable() {
let tableData = []; this.btnLoading = true;
if (this.tableSelectedRows.length == 0) { let obj = {
getWLLZList({ 1: "部门建议",
page:1, 2: "办事建议",
size:-1, 3: "网站建议",
status:this.isReply?0:"", 4: "我要就错",
type:this.nowType, 5: "我要投诉",
device:this.nowDevice, 6: "我要咨询",
keyword:this.searchName, };
time:this.timeList, let data = [];
}).then((res)=>{ if (this.tableSelectedKeys.length && this.tableSelectedRows.length) {
const {code,data} = res; // 深度克隆避免影响页面表格展示
if(code==1){ data = this.$_.cloneDeep(this.tableSelectedRows);
// 改变输出内容 data.forEach((item) => {
data.data.forEach(item => { Object.keys(obj).forEach((keys) => {
item.type = item.type==1?'部门建议':item.type==2?'办事建议':item.type==3?'网站建议':item.type==4?'我要就错':item.type==5?'我要投诉':'我要咨询'; if (item.type == keys) {
item.valid = item.valid==1?'':''; item.type = obj[keys];
item.secrecy = item.secrecy==1?'':''; }
item.status = item.status==1?'':''; });
}); item.valid == 1?item.valid = "":item.valid = ''
item.secrecy == 1?item.secrecy = "":item.secrecy = ''
tableData = JSON.parse(JSON.stringify(data.data)); item.status == 1?item.status = "":item.status = ''
let tableColumns = JSON.parse(JSON.stringify(this.tableHeaders)); });
let newTableData = tableData.map(item => { } else {
let obj = {}; let datas = this.$_.cloneDeep(
for (let key in item) { await getWLLZList({
obj[key] = item[key]; page: 1,
} size: -1,
return obj; status:this.isReply?0:"",
}) type:this.nowType,
let exprotExcelName = `${this.nowDay} / ${this.nowTime} / ${this.$route['meta']['title'] || '报表信息统计'}`; device:this.nowDevice,
this.exportExcel(tableColumns, newTableData, exprotExcelName); keyword:this.searchName,
} time:this.timeList,
}) })
} else { );
data = datas.data.data
tableData = JSON.parse(JSON.stringify(this.tableSelectedRows)); if (!data.length) return;
tableData.forEach(item => { for (let item of data) {
item.type = item.type==1?'部门建议':item.type==2?'办事建议':item.type==3?'网站建议':item.type==4?'我要就错':item.type==5?'我要投诉':'我要咨询'; Object.keys(obj).forEach((key) => {
item.valid = item.valid==1?'':''; if (item.type == key) {
item.secrecy = item.secrecy==1?'':''; item.type = obj[key];
item.status = item.status==1?'':''; }
}); });
item.valid == 1?item.valid = "":item.valid = ''
let tableColumns = JSON.parse(JSON.stringify(this.tableHeaders)); item.secrecy == 1?item.secrecy = "":item.secrecy = ''
let newTableData = tableData.map(item => { item.status == 1?item.status = "":item.status = ''
let obj = {}; }
for (let key in item) { }
obj[key] = item[key]; export2Excel(
} tHeader,
return obj; filterVal,
}) data,
let exprotExcelName = `${this.nowDay} / ${this.nowTime} / ${this.$route['meta']['title'] || '报表信息统计'}`; "网络理政报表" + this.$moment().format("YYYYMMDDHHmmss")
this.exportExcel(tableColumns, newTableData, exprotExcelName); );
} this.btnLoading = false;
},
},
changeReply(e){ changeReply(e){
this.isReply = e.target.checked this.isReply = e.target.checked
}, },
...@@ -294,7 +323,6 @@ export default { ...@@ -294,7 +323,6 @@ export default {
time:this.timeList, time:this.timeList,
} }
getWLLZList(params).then((res)=>{ getWLLZList(params).then((res)=>{
console.log(res);
const {code,data} = res; const {code,data} = res;
if(code==1){ if(code==1){
this.tableSourceData = data.data this.tableSourceData = data.data
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment