From 9675f1491ef23c4c6f69cb83cbf6de3fd6dac61b Mon Sep 17 00:00:00 2001 From: 田源 <lastanimals@163.com> Date: 星期三, 26 七月 2023 17:40:58 +0800 Subject: [PATCH] 主数据导出 --- Source/UBCS-WEB/src/components/Master/MasterTransfer.vue | 26 +++++++++++++++++++++++++- Source/UBCS-WEB/src/api/GetItem.js | 9 ++++++++- Source/UBCS-WEB/src/components/Crud/VciMasterCrud.vue | 2 +- Source/UBCS-WEB/src/components/Master/MasterTree.vue | 8 +++++--- Source/UBCS-WEB/src/components/Tree/attrCrud.vue | 11 +++++++++-- 5 files changed, 48 insertions(+), 8 deletions(-) diff --git a/Source/UBCS-WEB/src/api/GetItem.js b/Source/UBCS-WEB/src/api/GetItem.js index 875a9e8..a1ade96 100644 --- a/Source/UBCS-WEB/src/api/GetItem.js +++ b/Source/UBCS-WEB/src/api/GetItem.js @@ -60,7 +60,14 @@ export function exportCode(data){ return request({ url: 'api/ubcs-code/mdmEngineController/exportCode', - method: 'post', + method: 'excel', + responseType: 'json', // 璁剧疆鍝嶅簲绫诲瀷涓篴rraybuffer + headers: { + 'Content-Type': 'application/vnd.ms-excel', // 璁剧疆璇锋眰澶翠负浜岃繘鍒舵祦绫诲瀷 + // 鍦ㄨ繖閲屽彲浠ヨ缃叾浠栬姹傚ご淇℃伅 + // 渚嬪锛� + // 'Authorization': 'Bearer your-token', + }, params:{ ...data } diff --git a/Source/UBCS-WEB/src/components/Crud/VciMasterCrud.vue b/Source/UBCS-WEB/src/components/Crud/VciMasterCrud.vue index d04c8ff..1449f62 100644 --- a/Source/UBCS-WEB/src/components/Crud/VciMasterCrud.vue +++ b/Source/UBCS-WEB/src/components/Crud/VciMasterCrud.vue @@ -562,7 +562,7 @@ this.$message.warning('閫夋嫨鐨勬暟鎹腑鐘舵�佹棤闇�鍐嶆墽琛屽綋鍓嶆搷浣�'); showMessage = false; } else if (this.selectRow.length >=1 && (disabledCount === this.selectRow.length || releasedCount === this.selectRow.length) || (disabledCount > 0 && releasedCount > 0) && showMessage) { - //disabledCount 鍜� releasedCount 涓换鎰忎竴涓瓑浜� this.selectRow 鏁扮粍鐨勯暱搴� 鍒欒〃绀哄叏閮ㄦ槸鍚屼竴绉嶇姸鎬侊紝杩斿洖 true 濡傛灉disabledCount 鍜� releasedCount 閮藉ぇ浜�0锛屽垯琛ㄧず鏃㈡湁Disabled涔熸湁Released杩斿洖 true + //disabledCount 鍜� releasedCount 涓换鎰忎竴涓瓑浜� this.selectRow 鏁扮粍鐨勯暱搴﹀垯琛ㄧず鍏ㄩ儴鏄悓涓�绉嶇姸鎬侊紝杩斿洖 true 濡傛灉disabledCount 鍜� releasedCount 閮藉ぇ浜�0锛屽垯琛ㄧず鏃㈡湁Disabled涔熸湁Released杩斿洖 true processTS({ templateId: this.templateOid, buttonTypeKey: 'PUBLIC' }).then(res => { if (res.data.records != [] && res.data.code != 200) { this.userName = localStorage.getItem("username"); diff --git a/Source/UBCS-WEB/src/components/Master/MasterTransfer.vue b/Source/UBCS-WEB/src/components/Master/MasterTransfer.vue index ec48494..5af0fcb 100644 --- a/Source/UBCS-WEB/src/components/Master/MasterTransfer.vue +++ b/Source/UBCS-WEB/src/components/Master/MasterTransfer.vue @@ -132,8 +132,32 @@ exportArr[`attrIdIndexMap[${index}]`] = item }) exportCode({codeClassifyOid:this.codeClassifyOid,'conditionMap[oid]':ids,...exportArr}).then(res=>{ - console.log(res) + console.log('res',res) + const filename = '涓嬭浇.xlsx'; // 涓嬭浇鐨勬枃浠跺悕 + const blob = new Blob([res.data], { type: 'application/vnd.ms-excel' }); + const a = document.createElement('a'); + const url = window.URL.createObjectURL(blob); + a.href = url; + a.download = filename; + a.style.display = 'none'; + document.body.appendChild(a); + a.click(); + document.body.removeChild(a); + window.URL.revokeObjectURL(url); + + // const filename = '涓嬭浇.xlsx'; // 涓嬭浇鐨勬枃浠跺悕 + // const blob = new Blob([response.data], { type: 'application/vnd.ms-excel' }); + // + // const url = window.URL.createObjectURL(blob); + // const link = document.createElement('a'); + // link.href = url; + // link.setAttribute('download', filename); + // document.body.appendChild(link); + // link.click(); + // document.body.removeChild(link); + // URL.revokeObjectURL(url); }) + } }; }, diff --git a/Source/UBCS-WEB/src/components/Master/MasterTree.vue b/Source/UBCS-WEB/src/components/Master/MasterTree.vue index 12158d7..0aae92f 100644 --- a/Source/UBCS-WEB/src/components/Master/MasterTree.vue +++ b/Source/UBCS-WEB/src/components/Master/MasterTree.vue @@ -83,10 +83,12 @@ // console.log(this.$route) console.log(this.idData) getTreeList({'conditionMap[id]':this.idData }).then(res=>{ + console.log(res) this.Treedata=res.data + const [firstProperty] = res.data; this.ModifyProperties(this.Treedata, 'text', 'label'); - this.codeClassifyOid=res.data[0].oid; - this.coderuleoid=res.data[0].attributes.coderuleoid; + this.codeClassifyOid=firstProperty.oid; + this.coderuleoid=firstProperty.attributes.coderuleoid; this.$emit("coderuleoid", this.coderuleoid ) }).catch(res=>{ console.log(res) @@ -137,7 +139,7 @@ } this.tableHeadDataFateher = res.data; this.templateOids = res.data.tableDefineVO.oid; - let List = res.data.tableDefineVO.cols[0]; + const [List] = res.data.tableDefineVO.cols; List.forEach(item => { let columnItem = { label: item.title, diff --git a/Source/UBCS-WEB/src/components/Tree/attrCrud.vue b/Source/UBCS-WEB/src/components/Tree/attrCrud.vue index b928062..24b66f7 100644 --- a/Source/UBCS-WEB/src/components/Tree/attrCrud.vue +++ b/Source/UBCS-WEB/src/components/Tree/attrCrud.vue @@ -1588,7 +1588,10 @@ this.isShowformulaEdit = true; }else if(column.property == 'enumString'){ this.enumVisible=true; - this.tableData=JSON.parse(this.CurrentCell.enumString) + if(this.attrSelectList[0].enumString != ""){ + this.tableData=JSON.parse(this.attrSelectList[0].enumString) + return + } }else if(column.property == 'parentCode'){ gridCodeClassifyTemplateAttr({ 'conditionMap[classifyTemplateOid]': this.Formlist[0].oid, @@ -1632,7 +1635,11 @@ this.$message.warning('璇烽�夋嫨涓�鏉℃ā鏉垮睘鎬�') } else if (this.attrSelectList.length === 1) { this.enumVisible = true; - this.tableData=JSON.parse(this.attrSelectList[0].enumString) + if(this.attrSelectList[0].enumString != ""){ + this.tableData=JSON.parse(this.attrSelectList[0].enumString) + return + } + } }, enumBeforeClose(done){ -- Gitblit v1.9.3