From a0867490031ecaa66f5a9b0ad9aa5e5b48de11a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=91=A3=E5=93=B2=E5=A5=87?= <13840175730@139.com> Date: Thu, 2 Jan 2025 11:32:28 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=9D=90=E8=B4=A8=E8=AF=81=E4=BB=B6=E8=B7=9F?= =?UTF-8?q?=E8=B8=AA=E5=A2=9E=E5=8A=A0excel=E5=AF=BC=E5=87=BA=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=202.=E4=BF=AE=E6=AD=A3=E6=9D=90=E8=B4=A8=E8=AF=81?= =?UTF-8?q?=E4=BB=B6=E8=B7=9F=E8=B8=AA=E4=B8=BB=E9=94=AE=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=203.=E4=BC=98=E5=8C=96=E4=BD=9C=E4=B8=9A=E8=AE=A1=E5=88=92?= =?UTF-8?q?=E6=89=A7=E8=A1=8C=E5=88=92=E7=BA=BF=E5=92=8C=E5=88=87=E5=89=B2?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=9D=A1=E4=BB=B6=204.=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E8=BF=9E=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/zl/czzjgz.vue | 55 +++++++++++++------ src/views/zyjhzx/hxianfkui/index.vue | 2 +- .../zyjhzx/hxianpgong/comps/HxianPgd.vue | 2 +- src/views/zyjhzx/qgefkui/index.vue | 2 +- src/views/zyjhzx/qgepgong/comps/QgePgd.vue | 2 +- 5 files changed, 41 insertions(+), 22 deletions(-) diff --git a/src/views/zl/czzjgz.vue b/src/views/zl/czzjgz.vue index 4fccfd4..f804af4 100644 --- a/src/views/zl/czzjgz.vue +++ b/src/views/zl/czzjgz.vue @@ -60,6 +60,7 @@ 查询 + 导出 @@ -134,6 +135,8 @@ import {null2str} from "@/utils/rpkj"; import { getToken } from '@/utils/auth' import { startLoading, endLoading } from '@/utils' import { Message } from 'element-ui' +import * as XLSX from 'xlsx' + export default { name:'Czzjgz', data() { @@ -189,7 +192,7 @@ export default { ], tableColumn: [ - + { type: 'checkbox', width: 40 }, { type: 'seq', width: 40, title: '序号' }, { field: 'DC_CH', @@ -310,15 +313,6 @@ export default { filters: [{ data: { checks: [], sVal: '', sMenu: '', fType1: '', fVal1: '', fMode: 'and', fType2: '', fVal2: '' } }], filterRender: { name: 'FilterCombination' } }, - - - - - - - - - ] } }, @@ -333,7 +327,36 @@ export default { }, methods: { + exportXls(){ + const data=this.$refs.xGrid.getCheckboxRecords() + if (data.length===0){ + this.$message.warning('请先选择要导出excel的数据') + return + } + const {fullColumn:column}=this.$refs.xGrid.getTableColumn() + console.log(column) + const fields={} + for (const item of column) { + const name=item.field; + const value=item.title + fields[name]=value + } + const printData=[] + data.forEach((item,index)=>{ + const _item={} + for (const i in fields) { + _item[fields[i]]=item[i] + } + _item.序号=index+1 + printData.push(_item) + }) + const workBook = XLSX.utils.book_new(); + const sheet = XLSX.utils.json_to_sheet(printData) + XLSX.utils.book_append_sheet(workBook, sheet, "sheetName"); + const date=XEUtils.toDateString(new Date(),'yyyyMMdd') + XLSX.writeFile(workBook, `质量跟踪${date}.xlsx`) + }, cellClickEvent({row}) { this.queryParam.dcch = row.cbbm this.$refs.xDown4.hidePanel() @@ -408,7 +431,6 @@ export default { initBase(){ getPgdBase({}).then(res=>{ - console.log(res.data) this.dictData = res.data this.projectData=res.data.cbbm this.projectData1=res.data.cbbm @@ -523,18 +545,15 @@ export default { }, initList() { - // if (this.queryParam.dcch === '') { - // this.$message.warning('选择船只编号') - // return - // } + if (this.queryParam.dcch === '') { + this.$message.warning('选择船只编号') + return + } czzjList(this.queryParam).then((res) => { - console.log(res.data) this.list = res.data if (this.$refs.xGrid) { this.$refs.xGrid.loadData(this.list) - console.log(this.list) } - }) }, selectChange(row) { diff --git a/src/views/zyjhzx/hxianfkui/index.vue b/src/views/zyjhzx/hxianfkui/index.vue index 89cf7b0..9c6f82e 100644 --- a/src/views/zyjhzx/hxianfkui/index.vue +++ b/src/views/zyjhzx/hxianfkui/index.vue @@ -165,7 +165,7 @@ export default { } getBzryByBz({zyq:this.$route.query.zyq,zt:bzType}).then(res=>{ - res.data=res.data.filter(item=>item.position==='数控'||item.position==='班长') + res.data=res.data.filter(item=>item.position==='数控'||item.position==='龙门'||item.position==='班长') this.workers=res.data this.setWorkers(res.data) const that=this diff --git a/src/views/zyjhzx/hxianpgong/comps/HxianPgd.vue b/src/views/zyjhzx/hxianpgong/comps/HxianPgd.vue index 2d28cdf..9d49fdf 100644 --- a/src/views/zyjhzx/hxianpgong/comps/HxianPgd.vue +++ b/src/views/zyjhzx/hxianpgong/comps/HxianPgd.vue @@ -90,7 +90,7 @@ export default { }) } if (gx==='0'){ - data.zt='2' + data.zt='11' getYdjhByZt(data).then(res => { this.list=res.data this.gridOptions.data = res.data diff --git a/src/views/zyjhzx/qgefkui/index.vue b/src/views/zyjhzx/qgefkui/index.vue index 2d854bc..0d8978a 100644 --- a/src/views/zyjhzx/qgefkui/index.vue +++ b/src/views/zyjhzx/qgefkui/index.vue @@ -166,7 +166,7 @@ export default { this.layer.add(bgGroup) } getBzryByBz({zyq:this.$route.query.zyq,zt:bzType}).then(res => { - res.data=res.data.filter(item=>item.position==='数控'||item.position==='班长') + res.data=res.data.filter(item=>item.position==='数控'||item.position==='龙门'||item.position==='班长') this.workers=res.data this.setWorkers(res.data) const that=this diff --git a/src/views/zyjhzx/qgepgong/comps/QgePgd.vue b/src/views/zyjhzx/qgepgong/comps/QgePgd.vue index 3acd6dc..dc17530 100644 --- a/src/views/zyjhzx/qgepgong/comps/QgePgd.vue +++ b/src/views/zyjhzx/qgepgong/comps/QgePgd.vue @@ -87,7 +87,7 @@ export default { }) } if (gx==='0'){ - data.zt='2' + data.zt='11' getYdjhByZt(data).then(res => { this.list=res.data this.gridOptions.data = res.data