¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <el-dialog :visible.sync="dialogPush" append-to-body :close-on-click-modal="false" @close="recoverPage" title="导åº"> |
| | | <div style="margin-bottom: 10px"> |
| | | <el-radio-group v-model="radio"> |
| | | <el-radio :label="0">éæ©</el-radio> |
| | | <el-radio :label="1">å
¨é¨</el-radio> |
| | | <el-radio :label="2">页ç </el-radio> |
| | | </el-radio-group> |
| | | </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" |
| | | :titles="['æªé屿§', 'å·²é屿§']" |
| | | :data="data"> |
| | | </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 >åæ¶</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | </template> |
| | | |
| | | <script> |
| | | import {exportCode} from '@/api/GetItem' |
| | | export default { |
| | | name: "MasterTransfer", |
| | | props:['visible','tableHeadData','codeClassifyOid','tableData','selectRow'], |
| | | data(){ |
| | | return { |
| | | data: [], |
| | | value: [], |
| | | filterMethod(query, item) { |
| | | return item.label.indexOf(query) > -1; |
| | | }, |
| | | dialogPush:this.visible, |
| | | radio:0, |
| | | tableHeadFindData:[], |
| | | tableExportData:[], |
| | | option:{ |
| | | title: 'ææ¡£æ é¢', |
| | | column: [{ |
| | | label: 'ä¸»æ°æ®', |
| | | prop: 'header', |
| | | children: [] |
| | | }], |
| | | data: [] |
| | | } |
| | | }; |
| | | }, |
| | | watch:{ |
| | | //çå¬åå§å |
| | | visible (){ |
| | | 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 |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | }, |
| | | tableData(){ |
| | | // å°å¼éé¢çtrueæfalseæ¹åä¸ºæ¯æå¦ |
| | | this.option.data = this.tableData.map(obj => { |
| | | for (let prop in obj) { |
| | | if (obj[prop] === "true") { |
| | | obj[prop] = "æ¯"; |
| | | } else if (obj[prop] === "false") { |
| | | obj[prop] = "å¦"; |
| | | } |
| | | } |
| | | return obj; |
| | | }); |
| | | }, |
| | | codeClassifyOid:{ |
| | | handler(newval,oldval){ |
| | | } |
| | | } |
| | | }, |
| | | computed:{ |
| | | |
| | | }, |
| | | mounted() { |
| | | }, |
| | | methods:{ |
| | | //å
³éé¡µé¢ |
| | | recoverPage(){ |
| | | this.$emit('update:visible', false); |
| | | }, |
| | | handleExcel(){ |
| | | // this.$Export.excel({ |
| | | // title: this.option.title, |
| | | // columns: this.option.column, |
| | | // data: this.option.data |
| | | // }); |
| | | if(this.radio === 0){ |
| | | if(this.selectRow.length<=0){ |
| | | this.$message.warning('è¯·éæ©è¦å¯¼åºç模æ¿') |
| | | }else { |
| | | //已鿩å¤é |
| | | const selectList=[] |
| | | //已鿩屿§ |
| | | let exportArr={} |
| | | const ids = this.selectRow.map(item => item.oid).join(',') |
| | | this.selectRow.forEach(item=>{ |
| | | selectList.push( |
| | | item.oid |
| | | ) |
| | | }) |
| | | this.value.map(index => this.tableHeadData[index].prop).forEach((item, index) => { |
| | | exportArr[`attrIdIndexMap[${index}]`] = item |
| | | }) |
| | | exportCode({codeClassifyOid:this.codeClassifyOid,'conditionMap[oid]':ids,...exportArr}).then(res=>{ |
| | | console.log(res) |
| | | }) |
| | | } |
| | | }; |
| | | }, |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | |
| | | </style> |