Commit 0b36eb6d authored by “yiyousong”'s avatar “yiyousong”

pref:修改填单报表

parent 8fdb0447
...@@ -2,58 +2,85 @@ ...@@ -2,58 +2,85 @@
<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">
<span>{{ tableSelectedRows.length ? "导出" : "导出全部" }}</span> <span>{{ tableSelectedRows.length ? "导出" : "导出全部" }}</span>
</a-button> </a-button>
<b>填单次数:<i>{{tablePagination.total}}</i></b> <b
<sub>统计时间段:{{BegindAndEndTime[0]}}~{{BegindAndEndTime[1]}}</sub> >填单次数:<i>{{ tablePagination.total }}</i></b
>
<sub
>统计时间段:{{ BegindAndEndTime[0] }}~{{ BegindAndEndTime[1] }}</sub
>
</div> </div>
<span> <span>
<a-space> <a-space>
<!-- <a-input-group compact> --> <!-- <a-input-group compact> -->
<a-select :default-value="1" style="width:25%" @change="changeSearchType"> <a-select
<a-select-option :value="1"> :default-value="1"
按事项 style="width: 25%"
</a-select-option> @change="changeSearchType"
<a-select-option :value="2"> >
按材料 <a-select-option :value="1"> 按事项 </a-select-option>
</a-select-option> <a-select-option :value="2"> 按材料 </a-select-option>
</a-select> </a-select>
<a-input style="width:73%" v-model="searchName" placeholder="请输入评价人姓名或窗口编号搜索">
<a-icon slot="prefix" type="search" />
</a-input>
<!-- </a-input-group> -->
<a-range-picker format="YYYY年MM月DD日" class="range_picker_style" @change="rangePickerChange">
</a-range-picker>
<a-select placeholder="全部状态" @change="changeStatu"> <a-select placeholder="全部状态" @change="changeStatu">
<a-select-option :value="0"> 全部类型 </a-select-option> <a-select-option :value="0"> 全部类型 </a-select-option>
<a-select-option :value="1"> 打印 </a-select-option> <a-select-option :value="1"> 本地打印 </a-select-option>
<a-select-option :value="2"> 在线提交 </a-select-option> <a-select-option :value="2"> 在线提交 </a-select-option>
</a-select> </a-select>
<a-input v-model="searchName" placeholder="请输入名称搜索">
<a-icon slot="prefix" type="search" />
</a-input>
<!-- </a-input-group> -->
<a-range-picker
format="YYYY年MM月DD日"
class="range_picker_style"
v-model="BegindAndEndTime"
@change="rangePickerChange"
>
</a-range-picker>
<a-button type="primary" @click="togetPrintList">搜索</a-button> <a-button type="primary" @click="togetPrintList">搜索</a-button>
<a-button @click="handleReset">重置</a-button>
</a-space> </a-space>
</span> </span>
</div> </div>
<div class="main"> <div class="main">
<a-table size="small" bordered :row-key="(record) => record.id" :row-selection="{ <a-table
size="small"
bordered
:row-key="(record) => record.id"
:row-selection="{
selectedRowKeys: tableSelectedKeys, selectedRowKeys: tableSelectedKeys,
onChange: onSelectChange, onChange: onSelectChange,
}" :scroll="{ y: 590 }" :pagination="tablePagination" @change="pagTableChange" :loading="tableLoading" }"
:columns="tableHeaders" :dataSource="tableSourceData"> :scroll="{ y: 590 }"
:pagination="tablePagination"
@change="pagTableChange"
:loading="tableLoading"
:columns="tableHeaders"
:dataSource="tableSourceData"
>
<!-- 序号 -->
<span slot="index" slot-scope="text, record, index">{{
(tablePagination.current - 1) * tablePagination.pageSize + index + 1
}}</span>
<template slot="事项名称" slot-scope="text, record, index"> <template slot="事项名称" slot-scope="text, record, index">
<div> <div>
{{record.matterName?record.matterName:'--'}} {{ record.matterName ? record.matterName : "--" }}
</div> </div>
<div class="tabFont"> <div class="tabFont">
事项全称:{{record.matterFullName?record.matterFullName:"--"}} 事项全称:{{ record.matterFullName ? record.matterFullName : "--" }}
</div> </div>
</template> </template>
<template slot="材料名称" slot-scope="text, record, index"> <template slot="材料名称" slot-scope="text, record, index">
<div> <div>
{{record.materialName?record.materialName:'--'}} {{ record.materialName ? record.materialName : "--" }}
</div> </div>
<div class="tabFont"> <div class="tabFont">
样表全称:{{record.materialFullName?record.materialFullName:"--"}} 样表全称:{{
record.materialFullName ? record.materialFullName : "--"
}}
</div> </div>
</template> </template>
</a-table> </a-table>
...@@ -64,8 +91,7 @@ ...@@ -64,8 +91,7 @@
<script> <script>
import table from "@/mixins/table"; import table from "@/mixins/table";
import { getPrintList } from "@/api/dataAdmin"; import { getPrintList } from "@/api/dataAdmin";
import { export2Excel } from "@/utils/js/exportExcel";
export default { export default {
mixins: [table], mixins: [table],
name: "fillForm", name: "fillForm",
...@@ -74,11 +100,11 @@ export default { ...@@ -74,11 +100,11 @@ export default {
tableHeaders: [ tableHeaders: [
{ {
title: "序号", title: "序号",
dataIndex: "index",
width: "60px", width: "60px",
key: "index",
align: "center", align: "center",
customRender: (text, record, index) => `${index + 1}`, scopedSlots: {
customRender: "index",
},
}, },
{ {
title: "事项名称", title: "事项名称",
...@@ -101,29 +127,36 @@ export default { ...@@ -101,29 +127,36 @@ export default {
{ {
title: "用户姓名", title: "用户姓名",
align: "center", align: "center",
dataIndex: "idName", customRender: (text) => {
return text.idName ? text.idName : "--";
},
}, },
{ {
title: "身份证号", title: "身份证号",
align: "center", align: "center",
dataIndex: "idCard", customRender: (text) => {
return text.idCard ? text.idCard : "--";
},
}, },
{ {
title: "手机号码", title: "手机号码",
align: "center", align: "center",
dataIndex: "mobile", customRender: (text) => {
return text.mobile ? text.mobile : "--";
},
}, },
{ {
title: "设备名称", title: "设备名称",
align: "center", align: "center",
dataIndex: "deviceName", customRender: (text) => {
return text.deviceName ? text.deviceName : "--";
},
}, },
{ {
title: "结果类型", title: "结果类型",
align: "center", align: "center",
dataIndex: "type",
customRender: (text, record, index) => { customRender: (text, record, index) => {
return text==1?'本地打印':'在线打印' return text == 1 ? "本地打印" : "在线提交";
}, },
}, },
{ {
...@@ -137,26 +170,53 @@ export default { ...@@ -137,26 +170,53 @@ export default {
// dataIndex: "累计耗时", // dataIndex: "累计耗时",
// }, // },
], ],
BegindAndEndTime: [], BegindAndEndTime: [
this.$moment(new Date()).format("YYYY-MM-DD"),
this.$moment(new Date()).format("YYYY-MM-DD"),
],
searchName: undefined, searchName: undefined,
searchType:1, searchType: 1,
siteId:undefined, siteId: JSON.parse(localStorage.getItem("siteId")),
statu:undefined statu: undefined,
tableSelectedKeys: [],
tableSelectedRows: [],
tHeader: [
// 导出的表头名信息
"事项简称",
"事项全称",
"材料简称",
"材料全称",
"用户姓名",
"身份证号码",
"手机号码",
"设备名称",
"结果类型",
"操作时间",
],
filterVal: [
// 导出的表头字段名,需要导出表格字段名
"matterName",
"matterFullName",
"materialName",
"materiaFullName",
"idName",
"idCard",
"mobile",
"deviceName",
"type",
"createTime",
],
}; };
}, },
components: { components: {},
},
mounted() { mounted() {
this.setMoment(); this.setMoment();
this.BegindAndEndTime=[this.$moment(new Date()).format("YYYY-MM-DD"),this.$moment(new Date()).format("YYYY-MM-DD")] this.togetPrintList();
this.siteId = JSON.parse(localStorage.getItem('siteId')) },
this.togetPrintList() watch: {
tablePagination() {
this.togetPrintList();
}, },
watch:{
tablePagination(){
this.togetPrintList()
}
}, },
methods: { methods: {
//导出 //导出
...@@ -164,96 +224,112 @@ export default { ...@@ -164,96 +224,112 @@ export default {
let tableData = []; let tableData = [];
if (this.tableSelectedRows.length == 0) { if (this.tableSelectedRows.length == 0) {
let pramse = { let pramse = {
page:this.tablePagination.current, page: this.tablePagination.current,
size:this.tablePagination.pageSize, size: this.tablePagination.pageSize,
siteId:this.siteId, siteId: this.siteId,
matterName:"%%", matterName: "%%",
materialName:"%%", materialName: "%%",
createTimeStart:this.BegindAndEndTime[0], createTimeStart: this.BegindAndEndTime[0],
createTimeEnd:this.BegindAndEndTime[1], createTimeEnd: this.BegindAndEndTime[1],
} };
if(this.statu && this.statu!=0){ if (this.statu && this.statu != 0) {
pramse.type=this.statu pramse.type = this.statu;
} }
if(this.searchType==1 && this.searchName){ if (this.searchType == 1 && this.searchName) {
pramse.matterName = '%'+this.searchName+'%' pramse.matterName = "%" + this.searchName + "%";
}else if(this.searchName){ } else if (this.searchName) {
pramse.materialName='%'+this.searchName+'%' pramse.materialName = "%" + this.searchName + "%";
} }
getPrintList(pramse).then((res)=>{ getPrintList(pramse).then((res) => {
const{code,data} = res; const { code, data } = res;
if(code == 1){ if (code == 1) {
tableData = JSON.parse(JSON.stringify(data.data)); tableData = JSON.parse(JSON.stringify(data.data));
tableData.forEach(item => { tableData.forEach((item) => {
item.type = item.type==1?"本地打印":"在线打印" item.type = item.type == 1 ? "本地打印" : "在线打印";
}); });
let tableColumns = JSON.parse(JSON.stringify(this.tableHeaders)); let tableColumns = JSON.parse(JSON.stringify(this.tableHeaders));
let newTableData = tableData.map(item => { let newTableData = tableData.map((item) => {
let obj = {}; let obj = {};
for (let key in item) { for (let key in item) {
obj[key] = item[key]; obj[key] = item[key];
} }
return obj; return obj;
}) });
let exprotExcelName = `${this.nowDay} / ${this.nowTime} / ${this.$route['meta']['title'] || '报表信息统计'}`; let exprotExcelName = `${this.nowDay} / ${this.nowTime} / ${
this.$route["meta"]["title"] || "报表信息统计"
}`;
this.exportExcel(tableColumns, newTableData, exprotExcelName); this.exportExcel(tableColumns, newTableData, exprotExcelName);
} }
}) });
} else { } else {
tableData = JSON.parse(JSON.stringify(this.tableSelectedRows)); tableData = JSON.parse(JSON.stringify(this.tableSelectedRows));
tableData.forEach(item => { tableData.forEach((item) => {
item.type = item.type==1?"本地打印":"在线打印" item.type = item.type == 1 ? "本地打印" : "在线打印";
}); });
let tableColumns = JSON.parse(JSON.stringify(this.tableHeaders)); let tableColumns = JSON.parse(JSON.stringify(this.tableHeaders));
let newTableData = tableData.map(item => { let newTableData = tableData.map((item) => {
let obj = {}; let obj = {};
for (let key in item) { for (let key in item) {
obj[key] = item[key]; obj[key] = item[key];
} }
return obj; return obj;
}) });
let exprotExcelName = `${this.nowDay} / ${this.nowTime} / ${this.$route['meta']['title'] || '报表信息统计'}`; let exprotExcelName = `${this.nowDay} / ${this.nowTime} / ${
this.$route["meta"]["title"] || "报表信息统计"
}`;
this.exportExcel(tableColumns, newTableData, exprotExcelName); this.exportExcel(tableColumns, newTableData, exprotExcelName);
} }
}, },
changeStatu(val){ changeStatu(val) {
this.statu = val this.statu = val;
}, },
changeSearchType(val){ changeSearchType(val) {
this.searchType = val this.searchType = val;
}, },
togetPrintList(){ togetPrintList() {
let pramse = { let pramse = {
page:this.tablePagination.current, page: this.tablePagination.current,
size:this.tablePagination.pageSize, size: this.tablePagination.pageSize,
siteId:this.siteId, siteId: this.siteId,
matterName:"%%", matterName: "%%",
materialName:"%%", materialName: "%%",
createTimeStart:this.BegindAndEndTime[0], createTimeStart: this.BegindAndEndTime[0],
createTimeEnd:this.BegindAndEndTime[1], createTimeEnd: this.BegindAndEndTime[1],
} };
if(this.statu && this.statu!=0){ if (this.statu && this.statu != 0) {
pramse.type=this.statu pramse.type = this.statu;
} }
if(this.searchType==1 && this.searchName){ if (this.searchType == 1 && this.searchName) {
pramse.matterName = '%'+this.searchName+'%' pramse.matterName = "%" + this.searchName + "%";
}else if(this.searchName){ } else if (this.searchName) {
pramse.materialName='%'+this.searchName+'%' pramse.materialName = "%" + this.searchName + "%";
} }
getPrintList(pramse).then((res)=>{ getPrintList(pramse).then((res) => {
const{code,data} = res; const { code, data } = res;
if(code==1){ if (code == 1) {
console.log(res); this.tableSourceData = data.data;
this.tableSourceData = data.data this.tablePagination.total = data.total;
this.tablePagination.total = data.total
} }
}) });
}, },
rangePickerChange(val) { rangePickerChange(val) {
this.BegindAndEndTime=[this.$moment(val[0]).format("YYYY-MM-DD"),this.$moment(val[1]).format("YYYY-MM-DD")] this.BegindAndEndTime = [
this.$moment(val[0]).format("YYYY-MM-DD"),
this.$moment(val[1]).format("YYYY-MM-DD"),
];
},
// 重置
handleReset() {
this.BegindAndEndTime = [
this.$moment(new Date()).format("YYYY-MM-DD"),
this.$moment(new Date()).format("YYYY-MM-DD"),
];
this.searchName = undefined;
this.searchType = 1;
this.statu = undefined;
this.tablePagination.current = 1;
this.togetPrintList();
}, },
QueueState(type) { QueueState(type) {
switch (type) { switch (type) {
case 0: case 0:
...@@ -265,7 +341,79 @@ export default { ...@@ -265,7 +341,79 @@ export default {
return "type0"; return "type0";
} }
}, },
// 选中
onSelectChange(keys, rows) {
this.tableSelectedKeys = keys;
const res = new Map();
this.tableSelectedRows = [...this.tableSelectedRows, ...rows]
.filter((v) => {
return !res.has(v.id) && res.set(v.id, 1);
})
.filter((v) => {
return this.tableSelectedKeys.some((val) => v.id == val);
});
},
// 导出
handleExportTable() {
this.btnLoading = true;
let obj = {
1: "本地打印",
2: "在线提交",
};
if (this.tableSelectedKeys.length && this.tableSelectedRows.length) {
this.tableSelectedRows.forEach((item) => {
Object.keys(obj).forEach((keys) => {
if (item.type == keys) {
item.type = obj[keys];
}
});
});
export2Excel(
this.tHeader,
this.filterVal,
this.tableSelectedRows,
"填单记录报表" + this.$moment().format("YYYYMMDDHHmmss")
);
} else {
let pramse = {
page: 1,
size: -1,
siteId: this.siteId,
matterName: "%%",
materialName: "%%",
createTimeStart: this.BegindAndEndTime[0],
createTimeEnd: this.BegindAndEndTime[1],
};
if (this.statu && this.statu != 0) {
pramse.type = this.statu;
}
if (this.searchType == 1 && this.searchName) {
pramse.matterName = "%" + this.searchName + "%";
} else if (this.searchName) {
pramse.materialName = "%" + this.searchName + "%";
}
getPrintList(pramse).then((res) => {
const { code, data } = res;
if (code == 1) {
if (!data.data.length) return;
for (let item of data.data) {
Object.keys(obj).forEach((key) => {
if (item.type == key) {
item.type = obj[key];
}
});
}
export2Excel(
this.tHeader,
this.filterVal,
data.data,
"填单记录报表" + this.$moment().format("YYYYMMDDHHmmss")
);
}
});
}
this.btnLoading = false;
},
}, },
}; };
</script> </script>
...@@ -281,7 +429,7 @@ export default { ...@@ -281,7 +429,7 @@ export default {
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
&>div { & > div {
display: flex; display: flex;
justify-content: flex-start; justify-content: flex-start;
align-items: center; align-items: center;
......
...@@ -477,6 +477,7 @@ export default { ...@@ -477,6 +477,7 @@ export default {
...this.searchForm, ...this.searchForm,
}).then((res) => { }).then((res) => {
let { data } = res.data; let { data } = res.data;
if (!data.length) return;
for (let item of data) { for (let item of data) {
Object.keys(obj).forEach((key) => { Object.keys(obj).forEach((key) => {
if (item.style == key) { if (item.style == key) {
......
...@@ -464,6 +464,7 @@ export default { ...@@ -464,6 +464,7 @@ export default {
...this.searchForm, ...this.searchForm,
}).then((res) => { }).then((res) => {
let { data } = res.data; let { data } = res.data;
if (!data.length) return;
for (let item of data) { for (let item of data) {
Object.keys(obj).forEach((key) => { Object.keys(obj).forEach((key) => {
if (item.style == key) { if (item.style == key) {
......
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