feat:导出

This commit is contained in:
shijing 2023-07-14 17:02:05 +08:00
parent 37d908b4bf
commit f40e001947
4 changed files with 377 additions and 446 deletions

View File

@ -280,6 +280,12 @@ export const asyncRoutes = [
meta: { title: '报送任务执行', perms: ['task_view'] },
hidden: true
},
{
path: 'statisticsGroup',
name: 'statisticsGroup',
component: () => import('@/views/supervisionNew/statisticsGroup.vue'),
meta: { title: '部门报告统计'},
},
{
path: 'statistics',
name: 'statistics',

View File

@ -16,6 +16,11 @@
icon="el-icon-search"
@click="handleFilter"
>搜索</el-button>
<el-button
type="primary"
@click="handleExport"
>导出
</el-button>
</div>
</el-card>
<el-card style="margin-top: 6px">
@ -27,6 +32,7 @@
stripe
highlight-current-row
:height="heightTable"
id="myTable"
>
<el-table-column type="index" width="50" />
<el-table-column label="年份" prop="year" width="80"></el-table-column>
@ -37,13 +43,6 @@
<el-table-column label="能力验证满意率(%)" prop="pgoal_4"></el-table-column>
<el-table-column label="客户投诉处理满意率(%)" prop="pgoal_5"></el-table-column>
</el-table>
<!-- <pagination
v-show="dataList.count > 0"
:total="dataList.count"
:page.sync="listQuery.page"
:limit.sync="listQuery.page_size"
@pagination="getList"
/> -->
</el-card>
</div>
</template>
@ -53,6 +52,7 @@
import { getOrgList, getSubOrgList } from "@/api/org";
import checkPermission from "@/utils/permission";
import Pagination from "@/components/Pagination";
import * as XLSX from "xlsx";
export default {
components:{Pagination},
data(){
@ -184,8 +184,12 @@
handleFilter(){
this.getList();
},
handleExport() {
let filename = this.listQuery.year+'部门目标.xlsx'
let table =document.getElementById('myTable');
let workbook = XLSX.utils.table_to_book(table);
XLSX.writeFile(workbook, filename);
},
},
};
</script>

View File

@ -1,20 +1,7 @@
<template>
<div class="app-container">
<el-card>
<el-row :gutter="6">
<el-select
v-model="listQuery.belong_dept"
placeholder="报送部门"
clearable
@change="belongDeptChange"
>
<el-option
v-for="item in orgData"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
<el-row :gutter="6">
<el-date-picker
v-model="listQuery.task2__year"
type="year"
@ -39,10 +26,20 @@
<el-card style="margin-top:10px">
<div ref="print" id="myReport" class="printContainer">
<h3 style="text-align: center;">{{ fileName }}</h3>
<p v-if="fileName!==''" style="text-align: center;">{{ listQuery.task2__year }} 112月质量目标双月报</p>
<p v-if="fileName!==''" style="text-align: center;">{{ listQuery.task2__year }} </p>
<!-- 5个目标值 -->
<el-row id="echartsContainer">
<el-col :span="24" class="chartsWrap">
<div id="main" style="width:1000px;height:300px;margin-left: 10px;"></div>
<el-col class="chartsWrap" style="">
<div id="main" style="width:1800px;height:300px;margin-left: 10px;"></div>
</el-col>
<el-col class="chartsWrap" style="">
<div id="main2" style="width:1800px;height:300px;margin-left: 10px;"></div>
</el-col>
<el-col class="chartsWrap" style="">
<div id="main3" style="width:1800px;height:300px;margin-left: 10px;"></div>
</el-col>
<el-col class="chartsWrap" style="">
<div id="main4" style="width:1800px;height:300px;margin-left: 10px;"></div>
</el-col>
</el-row>
</div>
@ -59,41 +56,195 @@
return {
timeStamp:0,
listQuery:{
belong_dept:'',
task2__year:'',
page:0
},
xaxis:[],
deptName:'',
fileName:'',
tableDatas:[
[],[],[],[],[],[],[],[],[],[],[],[],[]
],
orgData:[],
barChart1:null,
bar1option:{},
barchart2:null,
lineChart1:null,
lineChart2:null,
lineChart3:null,
lineChart4:null,
xAxisData:["1-2月","3-4月","5-6月","7-8月","9-10月","11-12月"],
line1Data:[],
line2Data:[],
line3Data:[],
line4Data:[],
line1Option:{},
line2Option:{},
line3Option:{},
line4Option:{},
};
},
mounted() {
this.getGroup();
this.optionSet();
},
methods: {
// handleFilter(){
// let that = this;
// if(that.listQuery.belong_dept!==''){
// if(that.listQuery.task2__year!==''){
// that.bar1Data = [];
// that.bar2Data = [];
// that.line1Data = [];
// that.line2Data = [];
// that.line3Data = [];
// that.line4Data = [];
// that.fileName = that.deptName;
// that.tableData1 = [];
// that.tableDatas = [ [],[],[],[],[],[],[],[],[],[],[],[],[]];
// getTask2Do(that.listQuery).then(res=>{
// let data = res.data.filter(item=>{
// return item.task2_.type==20
// });
// data.forEach(element => {
// let obj = element;
// if(element.num_issue!==null&&element.num_error!==null&&element.num_issue!==0){
// let rate1 = ((element.num_issue-element.num_error)/element.num_issue).toFixed(4)
// obj.rate1 = Number(rate1)*100
// }else{
// obj.rate1 = ''
// }
// if(element.num_expect!==null&&element.num_issue!==null&&element.num_expect!==0){
// let rate2 = (element.num_issue/element.num_expect).toFixed(4)
// obj.rate2 = Number(rate2)*100
// }
// else{
// obj.rate2 = ''
// }
// if(element.num_pt!==null&&element.num_pt_10!==null&&element.num_pt!==0){
// let rate3 = (element.num_pt_10/element.num_pt).toFixed(4)
// obj.rate3 = Number(rate3)*100
// }
// else{
// obj.rate3 = ''
// }
// if(element.num_complaint!==null&&element.num_complaint_10!==null&&element.num_complaint!==0){
// let rate4 = (element.num_complaint_10/element.num_complaint).toFixed(4)
// obj.rate4 = Number(rate4)*100
// }
// else{
// obj.rate4 = ''
// }
// let ind = element.task2_.cycle-1;
// that.tableData1[ind] = obj;
// });
// for (let i = 0; i < that.tableData1.length; i++) {
// let item = that.tableData1[i];
// if(item!==undefined){
// for(let j = 0; j < that.tableDatas.length; j++){
// that.tableDatas[j][i] =
// j==0?item.num_acc:
// j==1?item.num_issue:
// j==2?item.num_error:
// j==3?item.rate1:
// j==4?item.num_expect:
// j==5?item.num_issue:
// j==6?item.rate2:
// j==7?item.num_pt:
// j==8?item.num_pt_10:
// j==9?item.rate3:
// j==10?item.num_complaint:
// j==11?item.num_complaint_10:
// item.rate4;
// }
// }
// }
// that.timeStamp++;
// for(let k=0;k<that.tableDatas.length;k++){
// let num = 0;
// let num1 = that.tableDatas[k][0]?that.tableDatas[k][0]:0;
// let num2 = that.tableDatas[k][1]?that.tableDatas[k][1]:0;
// let num3 = that.tableDatas[k][2]?that.tableDatas[k][2]:0;
// let num4 = that.tableDatas[k][3]?that.tableDatas[k][3]:0;
// let num5 = that.tableDatas[k][4]?that.tableDatas[k][4]:0;
// let num6 = that.tableDatas[k][5]?that.tableDatas[k][5]:0;
// if(k==3){
// num = ((that.tableDatas[1][7]-that.tableDatas[2][7])/that.tableDatas[1][7]).toFixed(4)
// }else if(k==6){
// num = (that.tableDatas[5][7]/that.tableDatas[4][7]).toFixed(4)
// }else if(k==9){
// num =(that.tableDatas[8][7]/that.tableDatas[7][7]).toFixed(4)
// }else if(k==12){
// num = (that.tableDatas[11][7]/that.tableDatas[10][7]).toFixed(4)
// }else{
// num = Number(num1)+Number(num2)+Number(num3)+Number(num4)+Number(num5)+Number(num6);
// }
// if(num!=='NaN'&&num!==NaN){
// if(k==3||k==6||k==9||k==12){
// // debugger;
// console.log(parseFloat((Number(num)*100)))
// // parseFloat((Number(num)*100).toPrecision(12))
// let numbe = parseFloat((Number(num)*100).toPrecision(12));
// that.tableDatas[k][7] = numbe;
// }else{
// that.tableDatas[k][7] = num;
// }
// }else{
// that.tableDatas[k][7] = ''
// }
// }
// for(let i=0;i<6;i++){
// if(that.tableDatas[1][i]!==undefined){
// that.bar1Data.push(Number(that.tableDatas[1][i]))
// }else{
// that.bar1Data.push(0)
// }
// if(that.tableDatas[4][i]!==undefined){
// that.bar2Data.push(Number(that.tableDatas[4][i]))
// }else{
// that.bar2Data.push(0)
// }
// if(that.tableDatas[3][i]!==undefined){
// that.line1Data.push(Number(that.tableDatas[3][i]))
// }else{
// that.line1Data.push(0)
// }
// if(that.tableDatas[6][i]!==undefined){
// that.line2Data.push(Number(that.tableDatas[6][i]))
// }else{
// that.line2Data.push(0)
// }
// if(that.tableDatas[9][i]!==undefined){
// that.line3Data.push(Number(that.tableDatas[9][i]))
// }else{
// that.line3Data.push(0)
// }
// if(that.tableDatas[12][i]!==undefined){
// that.line4Data.push(Number(that.tableDatas[12][i]))
// }else{
// that.line4Data.push(0)
// }
// }
// that.bar1Option.series[0].data = that.bar1Data;
// that.bar2Option.series[0].data = that.bar2Data;
// that.line1Option.series[0].data = that.line1Data;
// that.line2Option.series[0].data = that.line2Data;
// that.line3Option.series[0].data = that.line3Data;
// that.line4Option.series[0].data = that.line4Data;
// that.barChart1.clear();
// that.barChart1.setOption(that.bar1Option);
// that.barChart2.clear();
// that.barChart2.setOption(that.bar2Option);
// that.lineChart1.clear();
// that.lineChart1.setOption(that.line1Option);
// that.lineChart2.clear();
// that.lineChart2.setOption(that.line2Option);
// that.lineChart3.clear();
// that.lineChart3.setOption(that.line3Option);
// that.lineChart4.clear();
// that.lineChart4.setOption(that.line4Option);
// })
// }else{
// this.$message.warning('请选择时间')
// }
// }else{
// this.$message.warning('请选择部门')
// }
// },
handlePrint() {
this.$PRINT('#myReport');
},
setOption(){
var myChart = echarts.init(document.getElementById('main'));
var myChart2 = echarts.init(document.getElementById('main2'));
var myChart3 = echarts.init(document.getElementById('main3'));
var myChart4 = echarts.init(document.getElementById('main4'));
var option = {
tooltip: {
trigger:"axis",
@ -105,9 +256,20 @@
legend: {
data:['目标值']
},
grid: {
left: '2%',
right: '2%',
bottom: '10%',
top: '2%',
containLabel: true
},
xAxis: {
axisLabel: {
interval: 'auto',
rotate: 80 //设置倾斜角度数值 可设置 正负 两种
},
type: 'category',
data: ["中存","中存","中存","中存","中存","中存"]
data: this.xaxis,
},
color:['#91cc75','#438af4'],
yAxis: {
@ -121,6 +283,7 @@
type: 'bar',
z:"-1",
barGap: '-100%',
barWidth:10,
data: [100, 100, 100, 100, 100, 100],
markLine : {
symbol:"none",
@ -146,388 +309,44 @@
{
name: '及时率',
type: 'bar',
barWidth:10,
data: [95, 92, 96, 90, 91, 98]
}
],
};
// 使用刚指定的配置项和数据显示图表
myChart.setOption(option);
},
methods: {
belongDeptChange(a){
this.fileName = '';
let selectItem = this.orgData.filter(item=>{
return item.id==a
})
this.deptName = selectItem[0].name;
},
optionSet(){
let chartDom3 = document.getElementById('lin1');
this.lineChart1 = echarts.init(chartDom3);
this.line1Option = {
title: {
text: '报告/证书合格率'
},
tooltip: {
trigger: 'axis'
},
legend: {
data: ['报告/证书合格率']
},
grid: {
left: '5%',
right: '7%',
bottom: '3%',
containLabel: true
},
toolbox: {
feature: {
saveAsImage: {}
}
},
xAxis: {
axisTick: {
show: false
},
splitLine: {
show: false,
},
type: 'category',
boundaryGap: false,
data: this.xAxisData
},
yAxis: {
type: 'value'
},
series: [
{
name: '报告/证书合格率',
type: 'line',
stack: 'Total',
data: this.line1Data
}
]
};
let chartDom4 = document.getElementById('lin2');
this.lineChart2 = echarts.init(chartDom4);
this.line2Option = {
title: {
text: '报告/证书及时率'
},
tooltip: {
trigger: 'axis'
},
legend: {
data: ['报告/证书及时率']
},
grid: {
left: '7%',
right: '5%',
bottom: '3%',
containLabel: true
},
toolbox: {
feature: {
saveAsImage: {}
}
},
xAxis: {
axisTick: {
show: false
},
splitLine: {
show: false,
},
type: 'category',
boundaryGap: false,
data: this.xAxisData
},
yAxis: {
type: 'value'
},
series: [
{
name: '报告/证书及时率',
type: 'line',
stack: 'Total',
data: this.line2Data
}
]
};
let chartDom5 = document.getElementById('lin3');
this.lineChart3 = echarts.init(chartDom5);
this.line3Option = {
title: {
text: '能力验证满意率'
},
tooltip: {
trigger: 'axis'
},
legend: {
data: ['能力验证满意率']
},
grid: {
left: '5%',
right: '7%',
bottom: '3%',
containLabel: true
},
toolbox: {
feature: {
saveAsImage: {}
}
},
xAxis: {
axisTick: {
show: false
},
splitLine: {
show: false,
},
type: 'category',
boundaryGap: false,
data: this.xAxisData
},
yAxis: {
type: 'value'
},
series: [
{
name: '能力验证满意率',
type: 'line',
stack: 'Total',
data: this.line3Data
}
]
};
let chartDom6 = document.getElementById('lin4');
this.lineChart4 = echarts.init(chartDom6);
this.line4Option = {
title: {
text: '客户投诉处理满意率'
},
tooltip: {
trigger: 'axis'
},
legend: {
data: ['客户投诉处理满意率']
},
grid: {
left: '7%',
right: '5%',
bottom: '3%',
containLabel: true
},
toolbox: {
feature: {
saveAsImage: {}
}
},
xAxis: {
axisTick: {
show: false
},
splitLine: {
show: false,
},
type: 'category',
boundaryGap: false,
data: this.xAxisData
},
yAxis: {
type: 'value'
},
series: [
{
name: '客户投诉处理满意率',
type: 'line',
stack: 'Total',
data:this.line4Data
}
]
};
},
handleFilter(){
let that = this;
if(that.listQuery.belong_dept!==''){
if(that.listQuery.task2__year!==''){
that.bar1Data = [];
that.bar2Data = [];
that.line1Data = [];
that.line2Data = [];
that.line3Data = [];
that.line4Data = [];
that.fileName = that.deptName;
that.tableData1 = [];
that.tableDatas = [ [],[],[],[],[],[],[],[],[],[],[],[],[]];
getTask2Do(that.listQuery).then(res=>{
let data = res.data.filter(item=>{
return item.task2_.type==20
});
data.forEach(element => {
let obj = element;
if(element.num_issue!==null&&element.num_error!==null&&element.num_issue!==0){
let rate1 = ((element.num_issue-element.num_error)/element.num_issue).toFixed(4)
obj.rate1 = Number(rate1)*100
}else{
obj.rate1 = ''
}
if(element.num_expect!==null&&element.num_issue!==null&&element.num_expect!==0){
let rate2 = (element.num_issue/element.num_expect).toFixed(4)
obj.rate2 = Number(rate2)*100
}
else{
obj.rate2 = ''
}
if(element.num_pt!==null&&element.num_pt_10!==null&&element.num_pt!==0){
let rate3 = (element.num_pt_10/element.num_pt).toFixed(4)
obj.rate3 = Number(rate3)*100
}
else{
obj.rate3 = ''
}
if(element.num_complaint!==null&&element.num_complaint_10!==null&&element.num_complaint!==0){
let rate4 = (element.num_complaint_10/element.num_complaint).toFixed(4)
obj.rate4 = Number(rate4)*100
}
else{
obj.rate4 = ''
}
let ind = element.task2_.cycle-1;
that.tableData1[ind] = obj;
});
for (let i = 0; i < that.tableData1.length; i++) {
let item = that.tableData1[i];
if(item!==undefined){
for(let j = 0; j < that.tableDatas.length; j++){
that.tableDatas[j][i] =
j==0?item.num_acc:
j==1?item.num_issue:
j==2?item.num_error:
j==3?item.rate1:
j==4?item.num_expect:
j==5?item.num_issue:
j==6?item.rate2:
j==7?item.num_pt:
j==8?item.num_pt_10:
j==9?item.rate3:
j==10?item.num_complaint:
j==11?item.num_complaint_10:
item.rate4;
}
}
}
that.timeStamp++;
for(let k=0;k<that.tableDatas.length;k++){
let num = 0;
let num1 = that.tableDatas[k][0]?that.tableDatas[k][0]:0;
let num2 = that.tableDatas[k][1]?that.tableDatas[k][1]:0;
let num3 = that.tableDatas[k][2]?that.tableDatas[k][2]:0;
let num4 = that.tableDatas[k][3]?that.tableDatas[k][3]:0;
let num5 = that.tableDatas[k][4]?that.tableDatas[k][4]:0;
let num6 = that.tableDatas[k][5]?that.tableDatas[k][5]:0;
if(k==3){
num = ((that.tableDatas[1][7]-that.tableDatas[2][7])/that.tableDatas[1][7]).toFixed(4)
}else if(k==6){
num = (that.tableDatas[5][7]/that.tableDatas[4][7]).toFixed(4)
}else if(k==9){
num =(that.tableDatas[8][7]/that.tableDatas[7][7]).toFixed(4)
}else if(k==12){
num = (that.tableDatas[11][7]/that.tableDatas[10][7]).toFixed(4)
}else{
num = Number(num1)+Number(num2)+Number(num3)+Number(num4)+Number(num5)+Number(num6);
}
if(num!=='NaN'&&num!==NaN){
if(k==3||k==6||k==9||k==12){
// debugger;
console.log(parseFloat((Number(num)*100)))
// parseFloat((Number(num)*100).toPrecision(12))
let numbe = parseFloat((Number(num)*100).toPrecision(12));
that.tableDatas[k][7] = numbe;
}else{
that.tableDatas[k][7] = num;
}
}else{
that.tableDatas[k][7] = ''
}
}
for(let i=0;i<6;i++){
if(that.tableDatas[1][i]!==undefined){
that.bar1Data.push(Number(that.tableDatas[1][i]))
}else{
that.bar1Data.push(0)
}
if(that.tableDatas[4][i]!==undefined){
that.bar2Data.push(Number(that.tableDatas[4][i]))
}else{
that.bar2Data.push(0)
}
if(that.tableDatas[3][i]!==undefined){
that.line1Data.push(Number(that.tableDatas[3][i]))
}else{
that.line1Data.push(0)
}
if(that.tableDatas[6][i]!==undefined){
that.line2Data.push(Number(that.tableDatas[6][i]))
}else{
that.line2Data.push(0)
}
if(that.tableDatas[9][i]!==undefined){
that.line3Data.push(Number(that.tableDatas[9][i]))
}else{
that.line3Data.push(0)
}
if(that.tableDatas[12][i]!==undefined){
that.line4Data.push(Number(that.tableDatas[12][i]))
}else{
that.line4Data.push(0)
}
}
that.bar1Option.series[0].data = that.bar1Data;
that.bar2Option.series[0].data = that.bar2Data;
that.line1Option.series[0].data = that.line1Data;
that.line2Option.series[0].data = that.line2Data;
that.line3Option.series[0].data = that.line3Data;
that.line4Option.series[0].data = that.line4Data;
that.barChart1.clear();
that.barChart1.setOption(that.bar1Option);
that.barChart2.clear();
that.barChart2.setOption(that.bar2Option);
that.lineChart1.clear();
that.lineChart1.setOption(that.line1Option);
that.lineChart2.clear();
that.lineChart2.setOption(that.line2Option);
that.lineChart3.clear();
that.lineChart3.setOption(that.line3Option);
that.lineChart4.clear();
that.lineChart4.setOption(that.line4Option);
})
}else{
this.$message.warning('请选择时间')
}
}else{
this.$message.warning('请选择部门')
}
},
handlePrint() {
this.$PRINT('#myReport');
},
myChart2.setOption(option);
myChart3.setOption(option);
myChart4.setOption(option);
},
checkPermission,
getGroup() {
if (this.checkPermission(["record_confirm"])) {
getOrgList({ can_supervision: true }).then((res) => {
this.orgData = res.data;
let data = res.data,xaxis = [];
let arr = data.filter(item=>{
return item.type==26||item.type==28
})
arr.forEach(item=>{
xaxis.push(item.name)
})
this.orgData = arr;
this.xaxis = xaxis;
this.setOption();
});
} else {
getSubOrgList().then((res) => {
this.orgData = res.data;
let data = res.data,xaxis = [];
let arr = data.filter(item=>{
return item.type==26||item.type==28
})
arr.forEach(item=>{
xaxis.push(item.name)
})
this.orgData = arr;
this.xaxis = xaxis;
this.setOption();
});
}
},
@ -536,10 +355,11 @@
</script>
<style>
.printContainer{
width: 1075px;
/* width: 1075px; */
}
#numTable,#echartsContainer{
margin-left: 37px;
/* margin-left: 37px; */
width: 100%;
}
#numTable td{
height: 32px;
@ -557,6 +377,8 @@
.chartsWrap{
/* margin-top: 30px; */
/* padding-top: 50px; */
width: 100%;
overflow-x: scroll;
border-top: 1px solid #eeeeee;
}
</style>

View File

@ -119,16 +119,7 @@
fixed="right"
>
<template slot-scope="scope">
<!-- <el-link
v-if="
scope.row.confirm_rate != 100 &&
checkPermission(['record_confirm'])
"
type="warning"
size="small"
@click="handleConfirmDept(scope)"
>确认</el-link
>
<!--
<el-link
v-if="
scope.row.confirm_rate == 100 &&
@ -139,6 +130,11 @@
@click="handleConfirmFK(scope)"
>反馈</el-link
> -->
<el-link
type="primary"
size="small"
@click.stop="handleExport(scope.row)"
>导出报表</el-link>
<el-link
v-if="
checkPermission(['task2'])
@ -196,9 +192,10 @@
highlight-current-row
max-height="400px"
style="margin-top:2px"
id="tableGoal"
@selection-change="handleSelectRecords"
>
<el-table-column type="selection" align="center" width="55" />
<!-- <el-table-column type="selection" align="center" width="55" /> -->
<el-table-column label="序号" type="index" align="center" width="55" />
<el-table-column label="名称">
<template slot-scope="scope">{{ scope.row.goal_name }}</template>
@ -261,6 +258,7 @@
stripe
highlight-current-row
height="250px"
id="table1"
>
<el-table-column label="序号" type="index" width="50" />
<el-table-column label="报告/证书编号" prop="number"></el-table-column>
@ -281,6 +279,7 @@
stripe
highlight-current-row
height="250px"
id="table2"
>
<el-table-column label="序号" type="index" width="50" />
<el-table-column label="超期报告/证书编号" prop="number"></el-table-column>
@ -301,6 +300,7 @@
stripe
highlight-current-row
height="250px"
id="table3"
>
<el-table-column label="序号" type="index" width="50" />
<el-table-column label="能力验证名称" prop="name"></el-table-column>
@ -331,6 +331,7 @@
stripe
highlight-current-row
height="250px"
id="table4"
>
<el-table-column label="序号" type="index" width="50" />
<el-table-column label="投诉人/机构" prop="complainant"></el-table-column>
@ -358,6 +359,7 @@
stripe
highlight-current-row
height="250px"
id="table5"
>
<el-table-column label="序号" type="index" width="50" />
<el-table-column label="风险事实描述" prop="content"></el-table-column>
@ -386,6 +388,7 @@
stripe
highlight-current-row
height="250px"
id="table6"
>
<el-table-column label="序号" type="index" width="50" />
@ -463,6 +466,8 @@ import Pagination from "@/components/Pagination";
import checkPermission from "@/utils/permission";
import recorddo from "@/views/supervision/recorddo";
import { upUrl, upHeaders } from "@/api/file";
import FileSaver from "file-saver";
import * as XLSX from "xlsx";
export default {
components: { Pagination, recorddo },
data() {
@ -637,19 +642,113 @@ export default {
this.getRiskList();
this.getComplaintList();
this.getOinspectList();
}
},
handleExport(row){
let name = row.belong_dept_.name;
let filename = name+'.xlsx';
this.listQuery = { task2do: row.id };
if(this.task.type==10){
getPgoalDeptList(this.listQuery).then((res) => {
this.recordList = res.data.results;
setTimeout(function(){
let wb = XLSX.utils.table_to_book(document.getElementById('tableGoal'),{row:true})
XLSX.writeFile(wb, filename)
},100)
}).catch((e) => {});
}else if(this.task.type==20){
this.task2doItem = row;
this.task2do = row.id;
this.getPtList();
this.getRcList();
this.getRiskList();
this.getComplaintList();
this.getOinspectList();
setTimeout(function(){
let str = `重大事故,风险识别,应发报告,已发报告,不准确报告,超期报告,能力验证结果,验证结果满意,客户投诉,投诉结果满意,外部监督检查\n`;
str+=row.num_acc+'\t,';
str+=row.num_risk+'\t,';
str+=row.num_expect+'\t,';
str+=row.num_issue+'\t,';
str+=row.num_error+'\t,';
str+=row.num_overdue+'\t,';
str+=row.num_pt+'\t,';
str+=row.num_pt_10+'\t,';
str+=row.num_complaint+'\t,';
str+=row.num_complaint_10+'\t,';
str+=row.num_oinspect+'\t';
let uri = 'data:application/vnd.ms-excel;charset=utf-8,\ufeff' + encodeURIComponent(str);
const link = document.createElement("a");
link.href = uri;
// 对下载的文件命名
link.download = row.belong_dept_.name+"统计.xls";
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
let wb = XLSX.utils.book_new();
let sheet = XLSX.utils.table_to_sheet(document.getElementById('table1'), {row:true});
let sheet2 = XLSX.utils.table_to_sheet(document.getElementById('table2'), {row:true});
let sheet3 = XLSX.utils.table_to_sheet(document.getElementById('table3'), {row:true});
let sheet4 = XLSX.utils.table_to_sheet(document.getElementById('table4'), {row:true});
let sheet5 = XLSX.utils.table_to_sheet(document.getElementById('table5'), {row:true});
let sheet6 = XLSX.utils.table_to_sheet(document.getElementById('table6'), {row:true});
XLSX.utils.book_append_sheet(wb, sheet,'不准确报告')
XLSX.utils.book_append_sheet(wb, sheet2,'超期报告')
XLSX.utils.book_append_sheet(wb, sheet3,'能力验证结果')
XLSX.utils.book_append_sheet(wb, sheet4,'客户投诉')
XLSX.utils.book_append_sheet(wb, sheet5,'风险识别')
XLSX.utils.book_append_sheet(wb, sheet6,'外部监督检查')
let wbout = XLSX.write(wb, { bookType: 'xlsx', bookSST: true, type: 'array' })
try {
FileSaver.saveAs(new Blob([wbout], { type: 'application/octet-stream' }), `${filename}.xlsx`)
} catch (e) {
if (typeof console !== 'undefined') {
console.log(e, wbout)
}
}
return wbout
// let wb = XLSX.utils.table_to_book(document.getElementById('table1'),{row:true})
// let wb2 = XLSX.utils.table_to_book(document.getElementById('table2'),{row:true})
// let wb3 = XLSX.utils.table_to_book(document.getElementById('table3'),{row:true})
// let wb4 = XLSX.utils.table_to_book(document.getElementById('table4'),{row:true})
// let wb5 = XLSX.utils.table_to_book(document.getElementById('table5'),{row:true})
// let wb6 = XLSX.utils.table_to_book(document.getElementById('table6'),{row:true})
// XLSX.writeFile(wb, filename)
// XLSX.writeFile(wb2, filename)
// XLSX.writeFile(wb3, filename)
// XLSX.writeFile(wb4, filename)
// XLSX.writeFile(wb5, filename)
// XLSX.writeFile(wb6, filename)
// let wbout = XLSX.write(wb, { bookType: 'xlsx', bookSST: true, type: 'array' })
// let wbout2 = XLSX.write(wb2, { bookType: 'xlsx', bookSST: true, type: 'array' })
// let wbout3 = XLSX.write(wb3, { bookType: 'xlsx', bookSST: true, type: 'array' })
// let wbout4 = XLSX.write(wb4, { bookType: 'xlsx', bookSST: true, type: 'array' })
// let wbout5 = XLSX.write(wb5, { bookType: 'xlsx', bookSST: true, type: 'array' })
// let wbout6 = XLSX.write(wb6, { bookType: 'xlsx', bookSST: true, type: 'array' })
// try {
// FileSaver.saveAs(new Blob([wbout], { type: 'application/octet-stream' }), filename)
// FileSaver.saveAs(new Blob([wbout2], { type: 'application/octet-stream' }), filename)
// FileSaver.saveAs(new Blob([wbout3], { type: 'application/octet-stream' }), filename)
// FileSaver.saveAs(new Blob([wbout4], { type: 'application/octet-stream' }), filename)
// FileSaver.saveAs(new Blob([wbout5], { type: 'application/octet-stream' }), filename)
// FileSaver.saveAs(new Blob([wbout6], { type: 'application/octet-stream' }), filename)
// } catch (e) { if (typeof console !== 'undefined') console.log(e, wbout)}
// return wbout,wbout2,wbout3,wbout4,wbout5,wbout5
},500)
}
},
getRcList(){
let that = this;
getRcList({task2do:that.task2do,etype:10,page:0}).then((res) => {
if (res.code >= 200) {
that.rcList =res.data;
}
that.rcList =res.data;
});
getRcList({task2do:that.task2do,etype:20,page:0}).then((res) => {
if (res.code >= 200) {
that.rc2List =res.data;
}
that.rc2List =res.data;
});
},
getPtList(){
@ -691,12 +790,12 @@ export default {
}
this.selectRecords = selects;
},
handleConfirmDept(scope){
confirmTaskdept(scope.row.id).then(res=>{
this.getRecordList()
this.gettaskdeptall()
})
},
// handleConfirmDept(scope){
// confirmTaskdept(scope.row.id).then(res=>{
// this.getRecordList()
// this.gettaskdeptall()
// })
// },
//反馈意见
handlePreview(file) {
if ("url" in file) {