From d44134d06fc57865bc8995972e9035dbb90fd8b9 Mon Sep 17 00:00:00 2001 From: 田源 <lastanimals@163.com> Date: 星期二, 18 七月 2023 15:19:25 +0800 Subject: [PATCH] 7-18整合代码 --- Source/UBCS-WEB/src/components/Master/MasterTransfer.vue | 54 +++++++++++++++++++++++++++++++++--------------------- Source/UBCS-WEB/src/components/Crud/VciMasterCrud.vue | 2 +- 2 files changed, 34 insertions(+), 22 deletions(-) diff --git a/Source/UBCS-WEB/src/components/Crud/VciMasterCrud.vue b/Source/UBCS-WEB/src/components/Crud/VciMasterCrud.vue index b32f802..1290ecb 100644 --- a/Source/UBCS-WEB/src/components/Crud/VciMasterCrud.vue +++ b/Source/UBCS-WEB/src/components/Crud/VciMasterCrud.vue @@ -77,7 +77,7 @@ <!-- 楂樼骇鏌ヨ--> <advanced-query :options="this.options" :visible.sync="findvisible" @echoContion="echoContion"></advanced-query> <!-- 瀵煎嚭--> - <MasterTransfer :visible.sync="dialogPush" :tableHeadData="tableHeadFindData" :codeClassifyOid="codeClassifyOid"></MasterTransfer> + <MasterTransfer :visible.sync="dialogPush" :tableHeadData="tableHeadFindData" :codeClassifyOid="codeClassifyOid" :tableData="tableData"></MasterTransfer> <!-- 鐩镐技椤�--> <ResembleQueryDialog :codeClassifyOid="codeClassifyOid" :codeRuleOid="this.codeRuleOid" :rowOid="rowOid" :templateOid="templateOid" :visible.sync="similarVisible"></ResembleQueryDialog> diff --git a/Source/UBCS-WEB/src/components/Master/MasterTransfer.vue b/Source/UBCS-WEB/src/components/Master/MasterTransfer.vue index 186a952..9341b92 100644 --- a/Source/UBCS-WEB/src/components/Master/MasterTransfer.vue +++ b/Source/UBCS-WEB/src/components/Master/MasterTransfer.vue @@ -1,6 +1,8 @@ <template> <el-dialog :visible.sync="dialogPush" append-to-body :close-on-click-modal="false" @close="recoverPage" title="瀵煎嚭"> <div style="margin-bottom: 10px"> + <el-button type="success" + @click="handleExcel">涓嬭浇 澶氱骇琛ㄥごexcel</el-button> <el-radio-group v-model="radio"> <el-radio :label="0">閫夋嫨</el-radio> <el-radio :label="1">鍏ㄩ儴</el-radio> @@ -24,7 +26,7 @@ <script> export default { name: "MasterTransfer", - props:['visible','tableHeadData','codeClassifyOid'], + props:['visible','tableHeadData','codeClassifyOid','tableData'], data(){ return { data: [], @@ -43,13 +45,7 @@ prop: 'header', children: [] }], - data: [{ - title1: "娴嬭瘯鏁版嵁1", - title2: "娴嬭瘯鏁版嵁2" - }, { - title1: "娴嬭瘯鏁版嵁2", - title2: "娴嬭瘯鏁版嵁2" - }] + data: [] } }; }, @@ -61,7 +57,9 @@ //琛ㄥご鏁版嵁 鐢ㄦ潵娓叉煋绌挎妗� 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({ @@ -69,13 +67,31 @@ key: index, }); }); - return this.data; + //excel琛ㄦ牸鏁版嵁杞崲 + this.option.column[0].children=newval.map(obj => { + return { + label: obj.label, + prop: obj.prop + } + }) } } }, + tableData(){ + // 灏嗗�奸噷闈㈢殑true鎴杅alse鏀瑰彉涓烘槸鎴栧惁 + 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){ - console.log('daochu',newval,oldval) } } }, @@ -83,23 +99,19 @@ }, mounted() { - this.ExportRend() }, methods:{ //鍏抽棴椤甸潰 recoverPage(){ this.$emit('update:visible', false); }, - //瀵煎嚭琛ㄦ牸鏁版嵁杞崲琛ㄥご淇℃伅 - ExportRend(){ - this.tableExportData=this.tableHeadData.map(obj => { - return { - label: obj.label, - prop: obj.prop - } - }) - console.log(this.tableExportData) - } + handleExcel(){ + this.$Export.excel({ + title: this.option.title, + columns: this.option.column, + data: this.option.data + }); + }, } } </script> -- Gitblit v1.9.3