From fc7f59bcd94cebfcc3b2a1278984a3bb7b39edaa Mon Sep 17 00:00:00 2001 From: wangting <675591594@qq.com> Date: 星期二, 22 十月 2024 18:12:20 +0800 Subject: [PATCH] 功能模板树节点操作后局部刷新 --- Source/plt-web/plt-web-ui/src/views/systemModel/businessModel/index.vue | 145 ++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 115 insertions(+), 30 deletions(-) diff --git a/Source/plt-web/plt-web-ui/src/views/systemModel/businessModel/index.vue b/Source/plt-web/plt-web-ui/src/views/systemModel/businessModel/index.vue index 548091c..cb210be 100644 --- a/Source/plt-web/plt-web-ui/src/views/systemModel/businessModel/index.vue +++ b/Source/plt-web/plt-web-ui/src/views/systemModel/businessModel/index.vue @@ -1,9 +1,9 @@ <template> - <el-container> + <el-container v-loading="createdLoading"> <el-aside> <basic-container> - <div style="max-height: calc(100vh - 170px);overflow: auto"> - <avue-tree :key="refresh" ref="tree" :data="treeData" :option="treeOption" @node-click="nodeClick"> + <div style="max-height: calc(100vh - 150px);overflow: auto"> + <avue-tree :key="refresh" node-key="id" ref="tree" :data="treeData" :option="treeOption" @node-click="nodeClick"> <span slot-scope="{ node, data }" class="el-tree-node__label"> <span style="font-size: 15px"> <i class="el-icon-s-promotion"></i> @@ -17,7 +17,7 @@ <el-main> <basic-container> - <el-form ref="form" :model="form" label-width="85px" style="height: 79vh"> + <el-form ref="form" :model="form" label-width="85px" style="max-height: calc(100vh - 180px);overflow: auto;"> <span v-if="form.childType !== 0"> <el-form-item label="妯″潡鍚嶏細"> <el-input v-model="form.name" placeholder="璇疯緭鍏ユā鍧楀悕"></el-input> @@ -120,9 +120,9 @@ </el-button> </div> <div v-if="form.childType === 0" class="btnBox"> - <el-button icon="el-icon-edit" plain size="small" type="primary">淇敼鍒悕 + <el-button icon="el-icon-edit" plain size="small" type="primary" @click="updataAliasClickHandler">淇敼鍒悕 </el-button> - <el-button icon="el-icon-close" plain size="small" type="danger">鍒犻櫎 + <el-button icon="el-icon-close" plain size="small" type="danger" @click="deleteOperationClickHandler">鍒犻櫎 </el-button> </div> </basic-container> @@ -149,6 +149,9 @@ <el-button type="primary" @click="methodsSaveClickHandler">淇� 瀛�</el-button> </span> </el-dialog> + <!--瀵煎叆 --> + <upload-file ref="upload" :fileType="upFileType" :fileUrl="fileUrl" :tipList="tipList" fileName="files" title="瀵煎叆" + @updata="resetFormValue"></upload-file> </el-container> </template> @@ -160,7 +163,10 @@ updateModel, delModule, exportFunctionSql, - addOperationType + addOperationType, + exportModule, + updateAlias, + delFuncOperation } from "@/api/systemModel/mangeModel/api" import func from "@/util/func"; import basicOption from "@/util/basic-option"; @@ -169,6 +175,10 @@ name: "index", data() { return { + tipList: [], + upFileType: ['xls', 'xlsx'], + fileUrl: 'api/hmSysModConfigController/importModule', + createdLoading: false, lastIndex: null, methodsList: [], methodsData: [], @@ -192,6 +202,7 @@ addStatus: false, editStatus: false, nodeRow: {}, + currentClickNode:null, form: {}, treeData: [], treeOption: { @@ -245,27 +256,29 @@ }, methods: { // 鏍戣鐐瑰嚮 - nodeClick(row) { - console.log(row.childType); + nodeClick(row,node) { this.form = {...row}; this.nodeRow = {...row}; + this.currentClickNode=node; this.addStatus = false; this.editStatus = false; }, // 鏂板鎸夐挳 addClickHandler() { - this.resetFormValue(); + // this.resetFormValue(); + this.defalutName.forEach(key => { + this.form[key] = null; + }) + this.form.isValid = false; this.addStatus = true; this.editStatus = false; }, // 娓呯┖琛ㄥ崟缁戝畾鍊� resetFormValue() { - this.defalutName.forEach(key => { - this.form[key] = null; - }) - this.form.isValid = false; + this.form = {}; + this.refresh = Math.random(); // 鍒锋柊宸︿晶鏍� }, // 鏂板淇濆瓨鎸夐挳 @@ -275,23 +288,23 @@ return } if (this.form.name.length > 128) { - this.$message.error('妯″潡鍚嶉暱搴﹁秴杩�128锛�'); + this.$message.error('妯″潡鍚嶉暱搴︿笉鑳借秴杩�128锛�'); return } if (this.form.remark && this.form.remark.length > 255) { - this.$message.error('鎻忚堪闀垮害瓒呰繃255锛�'); + this.$message.error('鎻忚堪闀垮害涓嶈兘瓒呰繃255锛�'); return } if (this.form.resourceDotNet && this.form.resourceDotNet.length > 255) { - this.$message.error('.NET鏍囪瘑闀垮害涓嶈兘255锛�'); + this.$message.error('.NET鏍囪瘑闀垮害涓嶈兘瓒呰繃255锛�'); return } if (this.form.pathC && this.form.pathC.length > 255) { - this.$message.error('C/S鏍囪瘑闀垮害涓嶈兘255锛�'); + this.$message.error('C/S鏍囪瘑闀垮害涓嶈兘瓒呰繃255锛�'); return } if (this.form.resourceMobile && this.form.resourceMobile.length > 255) { - this.$message.error('Mobile鏍囪瘑闀垮害涓嶈兘255锛�'); + this.$message.error('Mobile鏍囪瘑闀垮害涓嶈兘瓒呰繃255锛�'); return } this.form.parentId = this.form.id; @@ -299,14 +312,15 @@ if (res.data.code === 200) { this.$message.success(res.data.msg); this.addStatus = false; - this.refresh = Math.random(); // 鍒锋柊宸︿晶鏍� + // this.resetFormValue(); + this.form.childType = null; + this.handleRefreshTree('add') } }) }, // 淇敼鎸夐挳 editClickHandler() { - console.log(this.form); this.editStatus = true; this.addStatus = false; }, @@ -342,7 +356,9 @@ if (res.data.code === 200) { this.$message.success(res.data.msg); this.editStatus = false; - this.refresh = Math.random(); // 鍒锋柊宸︿晶鏍� + // this.resetFormValue(); + this.form.childType = null; + this.handleRefreshTree('edit') } }) }, @@ -355,13 +371,11 @@ type: 'warning' }).then(() => { delModule(this.form).then(res => { - console.log(res); if (res.data.code === 200) { this.$message.success(res.data.msg); - this.resetFormValue(); + this.handleRefreshTree('del') this.addStatus = false; this.editStatus = false; - this.refresh = Math.random(); // 鍒锋柊宸︿晶鏍� } }) }).catch(() => { @@ -377,8 +391,6 @@ exportFunctionSql({isFunction: true}).then(res => { func.downloadFileByBlobHandler(res); this.$message.success('瀵煎嚭鎴愬姛'); - }).catch(err => { - this.$message.error(err); }); }, @@ -413,13 +425,11 @@ } }) addOperationType(list).then(res => { - console.log(res) if (res.data.code === 200) { this.methodsVisble = false; this.$message.success(res.data.msg); - this.refresh = Math.random(); // 鍒锋柊宸︿晶鏍� - this.resetFormValue(); this.form.childType = null; + this.handleRefreshTree('add') // 鍒锋柊宸︿晶鏍� } }) }, @@ -438,6 +448,81 @@ } ); }, + + // 淇敼鍒悕 + updataAliasClickHandler() { + const params = { + id: this.form.id, + isValid: this.form.isValid, + alias: this.form.alias + } + updateAlias(params).then(res => { + if (res.data.code === 200) { + this.$message.success(res.data.msg); + this.handleRefreshTree('edit') + } + }) + }, + + // 鍒犻櫎妯″潡涓嬪叧鑱旂殑鎿嶄綔绫诲瀷 + deleteOperationClickHandler() { + this.$confirm('鎮ㄧ‘瀹氳鍒犻櫎鎵�閫夋嫨鐨勬暟鎹悧锛�', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + const params = { + funcId: this.form.funcId, + operId: this.form.operId + } + delFuncOperation(params).then(res => { + console.log(res); + if (res.data.code === 200) { + this.$message.success(res.data.msg); + this.handleRefreshTree('del'); + } + }) + }).catch(() => { + this.$message({ + type: 'info', + message: '宸插彇娑堝垹闄�' + }); + }); + }, + + // 瀵煎嚭 + exportClickHandler() { + this.createdLoading = true; + exportModule().then(res => { + func.downloadFileByBlobHandler(res); + this.createdLoading = false + this.$message.success('瀵煎嚭鎴愬姛'); + }).catch(err => { + this.$message.error(err); + }) + }, + + // 瀵煎叆 + upLoadClickHandler() { + this.$refs.upload.visible = true; + }, + handleRefreshTree(type) { + //type:add\edit\del + if(type=="del"){ + this.$refs.tree.remove(this.currentClickNode); + this.currentClickNode=null; + this.form={}; + }else{ + if (this.currentClickNode) { + let node = this.currentClickNode.parent; + node.loaded = false; + node.expand(); + this.$refs.tree.setCurrentNode(this.currentClickNode); + }else { + this.refresh = Math.random(); // 鍒锋柊宸︿晶鏍� + } + } + } } } </script> -- Gitblit v1.9.3