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

pref:修改填单报表

parent 8fdb0447
......@@ -2,58 +2,85 @@
<div class="callRecord-Container">
<div class="header_box">
<div>
<a-button type="success" @click="toexportTable">
<a-button type="success" @click="handleExportTable">
<span>{{ tableSelectedRows.length ? "导出" : "导出全部" }}</span>
</a-button>
<b>填单次数:<i>{{tablePagination.total}}</i></b>
<sub>统计时间段:{{BegindAndEndTime[0]}}~{{BegindAndEndTime[1]}}</sub>
<b
>填单次数:<i>{{ tablePagination.total }}</i></b
>
<sub
>统计时间段:{{ BegindAndEndTime[0] }}~{{ BegindAndEndTime[1] }}</sub
>
</div>
<span>
<a-space>
<!-- <a-input-group compact> -->
<a-select :default-value="1" style="width:25%" @change="changeSearchType">
<a-select-option :value="1">
按事项
</a-select-option>
<a-select-option :value="2">
按材料
</a-select-option>
<a-select
:default-value="1"
style="width: 25%"
@change="changeSearchType"
>
<a-select-option :value="1"> 按事项 </a-select-option>
<a-select-option :value="2"> 按材料 </a-select-option>
</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-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>
<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 @click="handleReset">重置</a-button>
</a-space>
</span>
</div>
<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,
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">
<div>
{{record.matterName?record.matterName:'--'}}
{{ record.matterName ? record.matterName : "--" }}
</div>
<div class="tabFont">
事项全称:{{record.matterFullName?record.matterFullName:"--"}}
事项全称:{{ record.matterFullName ? record.matterFullName : "--" }}
</div>
</template>
<template slot="材料名称" slot-scope="text, record, index">
<div>
{{record.materialName?record.materialName:'--'}}
{{ record.materialName ? record.materialName : "--" }}
</div>
<div class="tabFont">
样表全称:{{record.materialFullName?record.materialFullName:"--"}}
样表全称:{{
record.materialFullName ? record.materialFullName : "--"
}}
</div>
</template>
</a-table>
......@@ -64,8 +91,7 @@
<script>
import table from "@/mixins/table";
import { getPrintList } from "@/api/dataAdmin";
import { export2Excel } from "@/utils/js/exportExcel";
export default {
mixins: [table],
name: "fillForm",
......@@ -74,11 +100,11 @@ export default {
tableHeaders: [
{
title: "序号",
dataIndex: "index",
width: "60px",
key: "index",
align: "center",
customRender: (text, record, index) => `${index + 1}`,
scopedSlots: {
customRender: "index",
},
},
{
title: "事项名称",
......@@ -101,29 +127,36 @@ export default {
{
title: "用户姓名",
align: "center",
dataIndex: "idName",
customRender: (text) => {
return text.idName ? text.idName : "--";
},
},
{
title: "身份证号",
align: "center",
dataIndex: "idCard",
customRender: (text) => {
return text.idCard ? text.idCard : "--";
},
},
{
title: "手机号码",
align: "center",
dataIndex: "mobile",
customRender: (text) => {
return text.mobile ? text.mobile : "--";
},
},
{
title: "设备名称",
align: "center",
dataIndex: "deviceName",
customRender: (text) => {
return text.deviceName ? text.deviceName : "--";
},
},
{
title: "结果类型",
align: "center",
dataIndex: "type",
customRender: (text, record, index) => {
return text==1?'本地打印':'在线打印'
return text == 1 ? "本地打印" : "在线提交";
},
},
{
......@@ -137,26 +170,53 @@ export default {
// dataIndex: "累计耗时",
// },
],
BegindAndEndTime: [],
BegindAndEndTime: [
this.$moment(new Date()).format("YYYY-MM-DD"),
this.$moment(new Date()).format("YYYY-MM-DD"),
],
searchName: undefined,
searchType:1,
siteId:undefined,
statu:undefined
searchType: 1,
siteId: JSON.parse(localStorage.getItem("siteId")),
statu: undefined,
tableSelectedKeys: [],
tableSelectedRows: [],
tHeader: [
// 导出的表头名信息
"事项简称",
"事项全称",
"材料简称",
"材料全称",
"用户姓名",
"身份证号码",
"手机号码",
"设备名称",
"结果类型",
"操作时间",
],
filterVal: [
// 导出的表头字段名,需要导出表格字段名
"matterName",
"matterFullName",
"materialName",
"materiaFullName",
"idName",
"idCard",
"mobile",
"deviceName",
"type",
"createTime",
],
};
},
components: {
},
components: {},
mounted() {
this.setMoment();
this.BegindAndEndTime=[this.$moment(new Date()).format("YYYY-MM-DD"),this.$moment(new Date()).format("YYYY-MM-DD")]
this.siteId = JSON.parse(localStorage.getItem('siteId'))
this.togetPrintList()
this.togetPrintList();
},
watch: {
tablePagination() {
this.togetPrintList();
},
watch:{
tablePagination(){
this.togetPrintList()
}
},
methods: {
//导出
......@@ -164,96 +224,112 @@ export default {
let tableData = [];
if (this.tableSelectedRows.length == 0) {
let pramse = {
page:this.tablePagination.current,
size:this.tablePagination.pageSize,
siteId:this.siteId,
matterName:"%%",
materialName:"%%",
createTimeStart:this.BegindAndEndTime[0],
createTimeEnd:this.BegindAndEndTime[1],
}
if(this.statu && this.statu!=0){
pramse.type=this.statu
page: this.tablePagination.current,
size: this.tablePagination.pageSize,
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+'%'
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){
getPrintList(pramse).then((res) => {
const { code, data } = res;
if (code == 1) {
tableData = JSON.parse(JSON.stringify(data.data));
tableData.forEach(item => {
item.type = item.type==1?"本地打印":"在线打印"
tableData.forEach((item) => {
item.type = item.type == 1 ? "本地打印" : "在线打印";
});
let tableColumns = JSON.parse(JSON.stringify(this.tableHeaders));
let newTableData = tableData.map(item => {
let newTableData = tableData.map((item) => {
let obj = {};
for (let key in item) {
obj[key] = item[key];
}
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);
}
})
});
} else {
tableData = JSON.parse(JSON.stringify(this.tableSelectedRows));
tableData.forEach(item => {
item.type = item.type==1?"本地打印":"在线打印"
tableData.forEach((item) => {
item.type = item.type == 1 ? "本地打印" : "在线打印";
});
let tableColumns = JSON.parse(JSON.stringify(this.tableHeaders));
let newTableData = tableData.map(item => {
let newTableData = tableData.map((item) => {
let obj = {};
for (let key in item) {
obj[key] = item[key];
}
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);
}
},
changeStatu(val){
this.statu = val
changeStatu(val) {
this.statu = val;
},
changeSearchType(val){
this.searchType = val
changeSearchType(val) {
this.searchType = val;
},
togetPrintList(){
togetPrintList() {
let pramse = {
page:this.tablePagination.current,
size:this.tablePagination.pageSize,
siteId:this.siteId,
matterName:"%%",
materialName:"%%",
createTimeStart:this.BegindAndEndTime[0],
createTimeEnd:this.BegindAndEndTime[1],
}
if(this.statu && this.statu!=0){
pramse.type=this.statu
page: this.tablePagination.current,
size: this.tablePagination.pageSize,
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+'%'
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){
console.log(res);
this.tableSourceData = data.data
this.tablePagination.total = data.total
getPrintList(pramse).then((res) => {
const { code, data } = res;
if (code == 1) {
this.tableSourceData = data.data;
this.tablePagination.total = data.total;
}
})
});
},
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) {
switch (type) {
case 0:
......@@ -265,7 +341,79 @@ export default {
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>
......@@ -281,7 +429,7 @@ export default {
justify-content: space-between;
align-items: center;
&>div {
& > div {
display: flex;
justify-content: flex-start;
align-items: center;
......
......@@ -477,6 +477,7 @@ export default {
...this.searchForm,
}).then((res) => {
let { data } = res.data;
if (!data.length) return;
for (let item of data) {
Object.keys(obj).forEach((key) => {
if (item.style == key) {
......
......@@ -464,6 +464,7 @@ export default {
...this.searchForm,
}).then((res) => {
let { data } = res.data;
if (!data.length) return;
for (let item of data) {
Object.keys(obj).forEach((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