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