| | |
| | | data: [] |
| | | }, |
| | | exportArr:{}, |
| | | exportArrTwo:{}, |
| | | ids:"" |
| | | }; |
| | | }, |
| | |
| | | this.dialogPush = this.visible; |
| | | }, |
| | | //表头数据 用来渲染穿梭框 |
| | | tableHeadData:{ |
| | | handler(newval,oldval){ |
| | | console.log(newval) |
| | | if(newval){ |
| | | //excel表头数据转换 |
| | | this.tableHeadFindData=newval.map(obj => obj.label); |
| | | this.tableHeadFindData.forEach((city, index) => { |
| | | this.data.push({ |
| | | label: city, |
| | | key: index, |
| | | }); |
| | | }); |
| | | //excel表格数据转换 |
| | | this.option.column[0].children=newval.map(obj => { |
| | | return { |
| | | label: obj.label, |
| | | prop: obj.prop |
| | | } |
| | | }) |
| | | } |
| | | tableHeadData: { |
| | | handler(newval, oldval) { |
| | | if (newval) { |
| | | // 清空data数组 |
| | | this.data = []; |
| | | // excel表头数据转换 |
| | | this.tableHeadFindData = newval.map(obj => obj.label); |
| | | this.tableHeadFindData.forEach((city, index) => { |
| | | this.data.push({ |
| | | label: city, |
| | | key: index, |
| | | }); |
| | | }); |
| | | // excel表格数据转换 |
| | | this.option.column[0].children = newval.map(obj => { |
| | | return { |
| | | label: obj.label, |
| | | prop: obj.prop |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | }, |
| | | }, |
| | | tableData(){ |
| | | // 将值里面的true或false改变为是或否 |
| | | this.option.data = this.tableData.map(obj => { |
| | |
| | | codeClassifyOid:{ |
| | | handler(newval,oldval){ |
| | | } |
| | | }, |
| | | value:{ |
| | | handler(newval,oldval){ |
| | | console.log('value',newval) |
| | | } |
| | | } |
| | | }, |
| | | computed:{ |
| | |
| | | escHandler(){ |
| | | this.$emit('update:visible', false); |
| | | this.value=[]; |
| | | this.radio=0 |
| | | }, |
| | | //关闭页面 |
| | | recoverPage(){ |
| | | this.$emit('update:visible', false); |
| | | }, |
| | | handleExcel(){ |
| | | if(this.value <= 0){ |
| | | this.$message.warning('请选择属性') |
| | | }else { |
| | | this.value.map(index => this.tableHeadData[index].prop).forEach((item, index) => { |
| | | this.exportArr[`attrIdIndexMap[${index}]`] = item |
| | | }) |
| | |
| | | const selectList=[] |
| | | //已选择属性 |
| | | let exportArr={} |
| | | const ids = this.selectRow.map(item => item.oid).join(',') |
| | | this.ids = this.selectRow.map(item => item.oid).join(',') |
| | | this.selectRow.forEach(item=>{ |
| | | selectList.push( |
| | | item.oid |
| | | ) |
| | | }) |
| | | exportCode({codeClassifyOid:this.codeClassifyOid,'conditionMap[oid]':this.ids,...this.exportArr}).then(res=>{ |
| | | if(this.value <= 0){ |
| | | this.tableHeadData.map(item => item.prop) |
| | | .forEach((prop, index) => { |
| | | this.exportArrTwo[`attrIdIndexMap[${index}]`] = prop; |
| | | }); |
| | | exportCode({codeClassifyOid:this.codeClassifyOid,'conditionMap[oid]':this.ids,...this.exportArrTwo,limit:-1}).then(res=>{ |
| | | // console.log('res',res) |
| | | if(res){ |
| | | func.downloadFileByBlobHandler(res); |
| | | this.escHandler() |
| | | } |
| | | }) |
| | | }else { |
| | | |
| | | exportCode({codeClassifyOid:this.codeClassifyOid,'conditionMap[oid]':this.ids,...this.exportArr}).then(res=>{ |
| | | // console.log('res',res) |
| | | if(res){ |
| | | func.downloadFileByBlobHandler(res); |
| | | this.escHandler() |
| | | } |
| | | }) |
| | | |
| | | } |
| | | } |
| | | }else if(this.radio === 1){ |
| | | if(this.value <= 0){ |
| | | this.tableHeadData.map(item => item.prop) |
| | | .forEach((prop, index) => { |
| | | this.exportArrTwo[`attrIdIndexMap[${index}]`] = prop; |
| | | }); |
| | | exportCode({codeClassifyOid:this.codeClassifyOid,...this.exportArrTwo,limit:-1}).then(res=>{ |
| | | // console.log('res',res) |
| | | if(res){ |
| | | func.downloadFileByBlob(res); |
| | | func.downloadFileByBlobHandler(res); |
| | | this.escHandler() |
| | | } |
| | | }) |
| | | |
| | | }else { |
| | | exportCode({codeClassifyOid:this.codeClassifyOid,...this.exportArr,limit:-1}).then(res=>{ |
| | | // console.log('res',res) |
| | | if(res){ |
| | | func.downloadFileByBlobHandler(res); |
| | | this.escHandler() |
| | | } |
| | | }) |
| | | } |
| | | }else if(this.radio === 1){ |
| | | this.ids=this.tableData.map(item => item.oid).join(',') |
| | | exportCode({codeClassifyOid:this.codeClassifyOid,...this.exportArr,limit:-1}).then(res=>{ |
| | | // console.log('res',res) |
| | | if(res){ |
| | | func.downloadFileByBlob(res); |
| | | this.escHandler() |
| | | } |
| | | }) |
| | | }else if(this.radio === 2){ |
| | | const input = this.pageExport.trim(); |
| | | let start, end; |
| | |
| | | return; |
| | | } |
| | | } |
| | | exportCode({ codeClassifyOid: this.codeClassifyOid, ...this.exportArr, limit: this.limit, page: start, endPage: end }).then((res) => { |
| | | // console.log('res',res) |
| | | if (res) { |
| | | func.downloadFileByBlob(res); |
| | | this.escHandler() |
| | | } |
| | | }); |
| | | if(this.value >=1 ){ |
| | | exportCode({ codeClassifyOid: this.codeClassifyOid, ...this.exportArr, limit: this.limit, page: start, endPage: end }).then((res) => { |
| | | // console.log('res',res) |
| | | if (res) { |
| | | func.downloadFileByBlobHandler(res); |
| | | this.escHandler() |
| | | } |
| | | }); |
| | | }else { |
| | | this.tableHeadData.map(item => item.prop) |
| | | .forEach((prop, index) => { |
| | | this.exportArrTwo[`attrIdIndexMap[${index}]`] = prop; |
| | | }); |
| | | exportCode({codeClassifyOid:this.codeClassifyOid,...this.exportArrTwo,limit:this.limit,page: start, endPage: end}).then(res=>{ |
| | | // console.log('res',res) |
| | | if(res){ |
| | | func.downloadFileByBlobHandler(res); |
| | | this.escHandler() |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | }, |
| | | } |
| | | } |