| | |
| | | <template> |
| | | <el-dialog :visible.sync="dialogPush" append-to-body :close-on-click-modal="false" @close="escHandler" title="导出" style="width: 1550px; margin: auto"> |
| | | <el-dialog :close-on-click-modal="false" :visible.sync="dialogPush" append-to-body style="width: 1550px; margin: auto" |
| | | title="导出" |
| | | @close="escHandler"> |
| | | <div style="margin-bottom: 20px;"> |
| | | <div> |
| | | <span>导出方式:</span> |
| | |
| | | <el-radio :label="1">全部</el-radio> |
| | | <el-radio :label="2">页码</el-radio> |
| | | </el-radio-group> |
| | | <span v-if="radio === 2" style="margin-left: 20px;"><el-input style="width: 150px" v-model="pageExport"></el-input> (输入页码或者页面范围,如:1-10))</span> |
| | | <span v-if="radio === 2" style="margin-left: 20px;"><el-input v-model="pageExport" |
| | | style="width: 150px"></el-input> (输入页码或者页面范围,如:1-10))</span> |
| | | </div> |
| | | </div> |
| | | <div style="text-align: center"> |
| | | <el-transfer |
| | | style="text-align: left; display: inline-block;height: 400px" |
| | | filterable |
| | | :filter-method="filterMethod" |
| | | filter-placeholder="关键词搜索" |
| | | v-model="value" |
| | | :data="data" |
| | | :filter-method="filterMethod" |
| | | :titles="['未选属性', '已选属性']" |
| | | :data="data"> |
| | | filter-placeholder="关键词搜索" |
| | | filterable |
| | | style="text-align: left; display: inline-block;height: 400px"> |
| | | </el-transfer> |
| | | </div> |
| | | <div style="display: flex;justify-content: flex-end;"> |
| | | <el-button size="small" plain type="success" @click="handleExcel">确定</el-button> |
| | | <el-button size="small" plain @click="escHandler">取消</el-button> |
| | | <el-button plain size="small" type="success" @click="handleExcel">确定</el-button> |
| | | <el-button plain size="small" @click="escHandler">取消</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | </template> |
| | |
| | | <script> |
| | | import {exportCode,FindData} from '@/api/GetItem' |
| | | import func from "@/util/func"; |
| | | |
| | | export default { |
| | | name: "MasterTransfer", |
| | | props:['visible','tableHeadData','codeClassifyOid','tableData','selectRow','templateOid','limit'], |
| | |
| | | data: [] |
| | | }, |
| | | exportArr:{}, |
| | | exportArrTwo: {}, |
| | | ids:"" |
| | | }; |
| | | }, |
| | |
| | | //表头数据 用来渲染穿梭框 |
| | | tableHeadData:{ |
| | | handler(newval,oldval){ |
| | | console.log(newval) |
| | | if(newval){ |
| | | // 清空data数组 |
| | | this.data = []; |
| | | //excel表头数据转换 |
| | | this.tableHeadFindData=newval.map(obj => obj.label); |
| | | this.tableHeadFindData.forEach((city, index) => { |
| | |
| | | codeClassifyOid:{ |
| | | handler(newval,oldval){ |
| | | } |
| | | }, |
| | | value: { |
| | | handler(newval, oldval) { |
| | | console.log('value', newval) |
| | | } |
| | | } |
| | | }, |
| | | computed:{ |
| | | |
| | | }, |
| | | computed: {}, |
| | | mounted() { |
| | | }, |
| | | methods:{ |
| | |
| | | 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.downloadFileByBlob(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){ |
| | | this.ids=this.tableData.map(item => item.oid).join(',') |
| | | exportCode({codeClassifyOid:this.codeClassifyOid,...this.exportArr,limit:-1}).then(res=>{ |
| | | 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 === 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) => { |
| | | 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() |
| | | } |
| | | |
| | | }) |
| | | } |
| | | |
| | | } |
| | | }, |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | <style lang="scss" scoped> |
| | | |
| | | </style> |