diff --git a/client/src/router/index.js b/client/src/router/index.js index 09b0c32..94cfb0f 100644 --- a/client/src/router/index.js +++ b/client/src/router/index.js @@ -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', diff --git a/client/src/views/supervisionNew/basicGoalDept.vue b/client/src/views/supervisionNew/basicGoalDept.vue index 3168300..acb90e4 100644 --- a/client/src/views/supervisionNew/basicGoalDept.vue +++ b/client/src/views/supervisionNew/basicGoalDept.vue @@ -16,6 +16,11 @@ icon="el-icon-search" @click="handleFilter" >搜索 + 导出 + @@ -27,6 +32,7 @@ stripe highlight-current-row :height="heightTable" + id="myTable" > @@ -37,13 +43,6 @@ - @@ -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); + }, }, }; diff --git a/client/src/views/supervisionNew/statisticsGroup.vue b/client/src/views/supervisionNew/statisticsGroup.vue index c107bca..69de25a 100644 --- a/client/src/views/supervisionNew/statisticsGroup.vue +++ b/client/src/views/supervisionNew/statisticsGroup.vue @@ -1,20 +1,7 @@ - - - - + {{ fileName }} - {{ listQuery.task2__year }}年 1—12月质量目标双月报 + {{ listQuery.task2__year }}年 + - - + + + + + + + + + + + @@ -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{ - 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 { - 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 @@ \ No newline at end of file diff --git a/client/src/views/supervisionNew/taskdo.vue b/client/src/views/supervisionNew/taskdo.vue index 09eb9ad..0db3d7a 100644 --- a/client/src/views/supervisionNew/taskdo.vue +++ b/client/src/views/supervisionNew/taskdo.vue @@ -119,16 +119,7 @@ fixed="right" > - + 导出报表 - + {{ scope.row.goal_name }} @@ -261,6 +258,7 @@ stripe highlight-current-row height="250px" + id="table1" > @@ -281,6 +279,7 @@ stripe highlight-current-row height="250px" + id="table2" > @@ -301,6 +300,7 @@ stripe highlight-current-row height="250px" + id="table3" > @@ -331,6 +331,7 @@ stripe highlight-current-row height="250px" + id="table4" > @@ -358,6 +359,7 @@ stripe highlight-current-row height="250px" + id="table5" > @@ -386,6 +388,7 @@ stripe highlight-current-row height="250px" + id="table6" > @@ -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) {
{{ listQuery.task2__year }}年 1—12月质量目标双月报
{{ listQuery.task2__year }}年