From fc7f59bcd94cebfcc3b2a1278984a3bb7b39edaa Mon Sep 17 00:00:00 2001
From: wangting <675591594@qq.com>
Date: 星期二, 22 十月 2024 18:12:20 +0800
Subject: [PATCH] 功能模板树节点操作后局部刷新

---
 /dev/null                                                               |  171 ---------------
 Source/plt-web/plt-web-ui/src/views/system/log/index.vue                |  170 +++++++++++++++
 Source/plt-web/plt-web-ui/src/views/systemModel/businessModel/index.vue |   42 ++-
 Source/plt-web/plt-web-ui/src/views/systemModel/operateType/index.vue   |   35 ++
 Source/plt-web/plt-web-ui/src/api/system/log/logBasic.js                |   20 +
 Source/plt-web/plt-web-ui/src/views/system/log/basicConf.vue            |    2 
 Source/plt-web/plt-web-ui/src/api/system/fileManager/index.vue          |  155 ++++++++++++++
 Source/plt-web/plt-web-ui/src/views/systemModel/mangeModel/index.vue    |   41 ++-
 8 files changed, 429 insertions(+), 207 deletions(-)

diff --git a/Source/plt-web/plt-web-ui/src/api/system/fileManager/index.vue b/Source/plt-web/plt-web-ui/src/api/system/fileManager/index.vue
new file mode 100644
index 0000000..aecd46e
--- /dev/null
+++ b/Source/plt-web/plt-web-ui/src/api/system/fileManager/index.vue
@@ -0,0 +1,155 @@
+<template>
+  <!--鏂囦欢鏌滅鐞�-->
+  <basic-container>
+    <avue-crud
+      ref="fileCrud"
+      :data="tableData"
+      :option="option"
+      :page.sync="page"
+      :table-loading="tableLoading"
+      @on-load="getTableList"
+      @refresh-change="handleRefresh"
+      @search-change="handleSearch"
+      @search-reset="handleReset"
+      @size-change="sizeChange"
+      @current-change="currentChange"
+    >
+      <template slot="menuLeft" slot-scope="scope">
+        <el-button icon="el-icon-download" plain size="small" type="primary" @click="allDelHandler">瀵煎嚭</el-button>
+      </template>
+    </avue-crud>
+  </basic-container>
+</template>
+
+<script>
+import basicOption from "@/util/basic-option";
+import {getLogListByContion} from "@/api/system/log/logBasic";
+
+export default {
+  name: "index",
+  data: function () {
+    return {
+      tableLoading: false,
+      tableData: [],
+      option: {
+        ...basicOption,
+        addBtn:false,
+        editBtn: false,
+        delBtn: false,
+        calcHeight: -60,
+        align:'left',
+        headerAlign:'center',
+        menu:false,
+        searchMenuSpan: 6,
+        searchIcon:false,
+        column: [
+          {
+            label: '鐢ㄦ埛鍚�',
+            prop: 'truename',
+            search:true,
+            searchSpan: 4,
+            searchLabel:'鎿嶄綔鐢ㄦ埛',
+            type:'select',
+            dicUrl:'/api/loginBasicController/getOperatingUsers',
+            sortable:true,
+            width: 150
+          }, {
+            label: '濮撳悕',
+            prop: 'username',
+            sortable:true,
+            width: 150
+          },{
+            label: '鐢ㄦ埛IP',
+            prop: 'userIp',
+            search:true,
+            searchSpan: 4,
+            sortable:true,
+            width: 150
+          },{
+            label: '妯″潡',
+            prop: 'moduleName',
+            sortable:true,
+            overHidden: true,
+          },{
+            label: '鎿嶄綔',
+            prop: 'type',
+            sortable:true,
+            width: 150
+          },{
+            label: '鏃堕棿',
+            prop: 'date',
+            type:'date',
+            search:true,
+            searchOrder: 1,
+            searchSpan: 8,
+            searchRange: true,
+            searchLabel:'鏌ヨ鏃ユ湡',
+            valueFormat:'yyyy-MM-dd',
+            width: 160
+          },{
+            label: '鎻忚堪',
+            prop: 'result',
+            overHidden: true,
+            width:380,
+          },
+        ]
+      },
+      page: {
+        currentPage: 1,
+        pageSize: 50,
+        total: 0,
+        pageSizes: [10, 30, 50, 100],
+      },
+      searchParams: {}
+    }
+  },
+  methods: {
+    // 琛ㄦ牸璇锋眰
+    getTableList() {
+      this.tableLoading = true;
+      getLogListByContion(this.page.currentPage, this.page.pageSize, {'logType':this.$route.query.logType,...this.searchParams}).then(res => {
+        this.tableData = res.data.data;
+        this.page.total = res.data.total;
+        this.tableLoading = false;
+      })
+    },
+
+    // 鎼滅储鏌ヨ
+    handleSearch(params, done) {
+      this.searchParams = {
+        userName:params.truename,
+        ipText:params.userIp,
+        startDate:params.date[0],
+        endDate:params.date[1]
+      };
+
+      this.getTableList();
+      done();
+    },
+
+    // 閲嶇疆鎼滅储鏉′欢
+    handleReset() {
+      this.searchParams = {};
+      this.getTableList();
+    },
+
+    // 鏉℃暟
+    sizeChange(val) {
+      this.page.pageSize = val;
+    },
+
+    // 椤电爜
+    currentChange(val) {
+      this.page.currentPage = val;
+    },
+
+    handleRefresh(){
+      this.getTableList();
+    }
+  }
+}
+</script>
+
+<style scoped>
+
+</style>
diff --git a/Source/plt-web/plt-web-ui/src/api/log/logBasic.js b/Source/plt-web/plt-web-ui/src/api/system/log/logBasic.js
similarity index 63%
rename from Source/plt-web/plt-web-ui/src/api/log/logBasic.js
rename to Source/plt-web/plt-web-ui/src/api/system/log/logBasic.js
index 7125024..47160ae 100644
--- a/Source/plt-web/plt-web-ui/src/api/log/logBasic.js
+++ b/Source/plt-web/plt-web-ui/src/api/system/log/logBasic.js
@@ -24,6 +24,15 @@
   })
 }
 
+//鑾峰彇鎿嶄綔鐢ㄦ埛
+export function getOperatingUsers( params) {
+  return request({
+    url: "/api/loginBasicController/getOperatingUsers",
+    method: "get",
+    params
+  });
+}
+
 export function getLogListByContion(page, limit, params) {
   return request({
     url: "/api/loginBasicController/getLogListByContion",
@@ -35,3 +44,14 @@
     }
   });
 }
+
+// 瀵煎嚭
+export const exportLog = (params) => {
+  return request({
+    url: '/api/loginBasicController/exportLog',
+    method: 'get',
+    headers: {'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'},
+    responseType: 'blob',
+    params
+  })
+}
diff --git a/Source/plt-web/plt-web-ui/src/views/log/index.vue b/Source/plt-web/plt-web-ui/src/views/log/index.vue
deleted file mode 100644
index 3e88d1d..0000000
--- a/Source/plt-web/plt-web-ui/src/views/log/index.vue
+++ /dev/null
@@ -1,171 +0,0 @@
-<template>
-  <basic-container>
-    <avue-crud
-      ref="userCrud"
-      :before-open="beforeOpen"
-      :data="tableData"
-      :option="option"
-      :page.sync="page"
-      :table-loading="tableLoading"
-      @on-load="getTableList"
-      @refresh-change="handleRefresh"
-      @search-change="handleSearch"
-      @search-reset="handleReset"
-      @size-change="sizeChange"
-      @current-change="currentChange"
-      @selection-change="selectChange"
-      @row-click="rowClickHandler"
-      @row-save="rowSaveHandler"
-      @row-update="rowUpdateHandler"
-    >
-      <!-- 閮ㄩ棬澶撮儴鎼滅储鎻掓Ы  -->
-      <template slot-scope="{disabled,size}" slot="pkDepartmentNameSearch">
-        <div style="display: flex;gap: 5px">
-          <el-select v-model="departSearchValue" clearable placeholder="璇烽�夋嫨閮ㄩ棬">
-            <el-option :label="departSearchObj.name" :value="departSearchObj.oid"></el-option>
-          </el-select>
-          <el-button size="small" type="success" @click="dialogDepartSearchHandler">閫夋嫨閮ㄩ棬</el-button>
-        </div>
-      </template>
-
-      <template #menu="{row,index,size}">
-        <el-button icon="el-icon-edit" size="small" type="text" @click.stop="rowEditHandler(row,index)">瀵煎嚭</el-button>
-      </template>
-
-      <template slot="menuLeft" slot-scope="scope">
-        <el-button icon="el-icon-delete" plain size="small" type="danger" @click="allDelHandler">瀵煎嚭</el-button>
-      </template>
-    </avue-crud>
-  </basic-container>
-</template>
-
-<script>
-import basicOption from "@/util/basic-option";
-import {getLogListByContion} from "@/api/log/logBasic";
-import func from "@/util/func";
-
-export default {
-name: "index",
-  data: function () {
-    return {
-      tableLoading: false,
-      tableData: [],
-      option: {
-        ...basicOption,
-        editBtn: false,
-        delBtn: false,
-        calcHeight: -60,
-        column: [
-          {
-            label: '鐢ㄦ埛鍚�',
-            prop: 'truename',
-            search:true,
-            sortable:true,
-          }, {
-            label: '濮撳悕',
-            prop: 'username',
-            search:true,
-            sortable:true,
-          },{
-            label: '鐢ㄦ埛IP',
-            prop: 'userIp',
-            search:true,
-            sortable:true,
-          },{
-            label: '妯″潡',
-            prop: 'moduleName',
-            search:true,
-            sortable:true,
-          },{
-            label: '鎿嶄綔',
-            prop: 'type',
-            search:true,
-            sortable:true,
-          },{
-            label: '鏃堕棿',
-            prop: 'startDate',
-            search:true,
-            sortable:true,
-          },{
-            label: '鎿嶄綔缁撴灉',
-            prop: 'result',
-            search:true,
-            sortable:true,
-          },{
-            label: '鎻忚堪',
-            prop: 'startDate',
-            search:true,
-            sortable:true,
-          },
-        ]
-      },
-      page: {
-        currentPage: 1,
-        pageSize: 50,
-        total: 0,
-        pageSizes: [10, 30, 50, 100],
-      },
-      searchParams: {}
-    }
-  },
-  methods: {
-    // 琛ㄦ牸璇锋眰
-    getTableList() {
-      this.tableLoading = true;
-      getLogListByContion(this.page.currentPage, this.page.pageSize, this.searchParams).then(res => {
-        const data = res.data.data;
-        this.tableData = data;
-        this.page.total = res.data.total;
-        this.tableLoading = false;
-      })
-    },
-
-    // 鎼滅储鏌ヨ
-    handleSearch(params, done) {
-      this.searchParams = {};
-      if(this.departSearchObj && this.departSearchValue){
-        this.searchParams['conditionMap["pkDepartment"]'] = this.departSearchValue;
-      }
-
-      if (!func.isEmptyObject(params)) {
-        for (let key in params) {
-          if (params.hasOwnProperty(key)) {
-            // 鍒ゆ柇濡傛灉 key 鏄� 'pkPersonName'锛屽垯鏀逛负 'pkPerson' 鍒嗗埆涓烘樉绀哄�煎拰淇濆瓨鍊�
-            let newKey = key === 'pkPersonName' ? 'pkPerson' : key;
-            this.searchParams[`conditionMap["${newKey}"]`] = params[key];
-          }
-        }
-      }
-
-      if (func.isEmptyObject(params) && !this.departSearchValue) {
-        this.searchParams = {};
-      }
-
-      this.getTableList();
-      done();
-    },
-
-    // 閲嶇疆鎼滅储鏉′欢
-    handleReset() {
-      this.departSearchObj = {};
-      this.departSearchValue = "";
-      this.searchParams = {};
-      this.getTableList();
-    },
-
-    // 鏉℃暟
-    sizeChange(val) {
-      this.page.pageSize = val;
-    },
-
-    // 椤电爜
-    currentChange(val) {
-      this.page.currentPage = val;
-    },
-  }
-}
-</script>
-
-<style scoped>
-
-</style>
diff --git a/Source/plt-web/plt-web-ui/src/views/log/basicConf.vue b/Source/plt-web/plt-web-ui/src/views/system/log/basicConf.vue
similarity index 97%
rename from Source/plt-web/plt-web-ui/src/views/log/basicConf.vue
rename to Source/plt-web/plt-web-ui/src/views/system/log/basicConf.vue
index bf2c0e4..c2c724d 100644
--- a/Source/plt-web/plt-web-ui/src/views/log/basicConf.vue
+++ b/Source/plt-web/plt-web-ui/src/views/system/log/basicConf.vue
@@ -21,7 +21,7 @@
 </template>
 
 <script>
-import {getPeroid,savePeriod,deleteLog} from "@/api/log/logBasic";
+import {getPeroid,savePeriod,deleteLog} from "@/api/system/log/logBasic";
 export default {
   name: "basicConf",
   data: function () {
diff --git a/Source/plt-web/plt-web-ui/src/views/system/log/index.vue b/Source/plt-web/plt-web-ui/src/views/system/log/index.vue
new file mode 100644
index 0000000..d025bfa
--- /dev/null
+++ b/Source/plt-web/plt-web-ui/src/views/system/log/index.vue
@@ -0,0 +1,170 @@
+<template>
+  <basic-container>
+    <avue-crud
+      ref="logCrud"
+      :data="tableData"
+      :option="option"
+      :page.sync="page"
+      :table-loading="tableLoading"
+      @on-load="getTableList"
+      @refresh-change="handleRefresh"
+      @search-change="handleSearch"
+      @search-reset="handleReset"
+      @size-change="sizeChange"
+      @current-change="currentChange"
+    >
+      <template slot="menuLeft" slot-scope="scope">
+        <el-button icon="el-icon-download" plain size="small" type="primary" @click="exportClickHandler">瀵煎嚭</el-button>
+      </template>
+    </avue-crud>
+  </basic-container>
+</template>
+
+<script>
+import basicOption from "@/util/basic-option";
+import {getLogListByContion,getOperatingUsers,exportLog} from "@/api/system/log/logBasic";
+import func from "@/util/func";
+
+export default {
+name: "index",
+  data: function () {
+    return {
+      tableLoading: false,
+      tableData: [],
+      option: {
+        ...basicOption,
+        addBtn:false,
+        editBtn: false,
+        delBtn: false,
+        calcHeight: -60,
+        align:'left',
+        headerAlign:'center',
+        menu:false,
+        searchMenuSpan: 6,
+        searchIcon:false,
+        column: [
+          {
+            label: '鐢ㄦ埛鍚�',
+            prop: 'truename',
+            search:true,
+            searchSpan: 4,
+            searchLabel:'鎿嶄綔鐢ㄦ埛',
+            type:'select',
+            dicUrl:'/api/loginBasicController/getOperatingUsers',
+            sortable:true,
+            width: 150
+          }, {
+            label: '濮撳悕',
+            prop: 'username',
+            sortable:true,
+            width: 150
+          },{
+            label: '鐢ㄦ埛IP',
+            prop: 'userIp',
+            search:true,
+            searchSpan: 4,
+            sortable:true,
+            width: 150
+          },{
+            label: '妯″潡',
+            prop: 'moduleName',
+            sortable:true,
+            overHidden: true,
+          },{
+            label: '鎿嶄綔',
+            prop: 'type',
+            sortable:true,
+            width: 150
+          },{
+            label: '鏃堕棿',
+            prop: 'date',
+            type:'date',
+            search:true,
+            searchOrder: 1,
+            searchSpan: 8,
+            searchRange: true,
+            searchLabel:'鏌ヨ鏃ユ湡',
+            valueFormat:'yyyy-MM-dd',
+            width: 160
+          },{
+            label: '鎻忚堪',
+            prop: 'result',
+            overHidden: true,
+            width:380,
+          },
+        ]
+      },
+      page: {
+        currentPage: 1,
+        pageSize: 50,
+        total: 0,
+        pageSizes: [10, 30, 50, 100],
+      },
+      searchParams: {}
+    }
+  },
+  watch: {
+    $route(to, from) {
+      this.getTableList();
+    }
+  },
+  methods: {
+    // 琛ㄦ牸璇锋眰
+    getTableList() {
+      this.tableLoading = true;
+      getLogListByContion(this.page.currentPage, this.page.pageSize, {'logType':this.$route.query.logType,...this.searchParams}).then(res => {
+        this.tableData = res.data.data;
+        this.page.total = res.data.total;
+        this.tableLoading = false;
+      })
+    },
+
+    // 鎼滅储鏌ヨ
+    handleSearch(params, done) {
+      this.searchParams = {
+        userName:params.truename,
+        ipText:params.userIp,
+        startDate:params.date[0],
+        endDate:params.date[1]
+      };
+
+      this.getTableList();
+      done();
+    },
+
+    // 閲嶇疆鎼滅储鏉′欢
+    handleReset() {
+      this.searchParams = {};
+      this.getTableList();
+    },
+
+    // 鏉℃暟
+    sizeChange(val) {
+      this.page.pageSize = val;
+    },
+
+    // 椤电爜
+    currentChange(val) {
+      this.page.currentPage = val;
+    },
+
+    handleRefresh(){
+      this.getTableList();
+    },
+    // 瀵煎嚭
+    exportClickHandler() {
+      const loading = this.$loading({});
+      exportLog().then(res => {
+        func.downloadFileByBlobHandler(res);
+        this.createdLoading = false
+        this.$message.success('瀵煎嚭鎴愬姛');
+        loading.close();
+      })
+    },
+  }
+}
+</script>
+
+<style scoped>
+
+</style>
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 a36c78d..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
@@ -2,8 +2,8 @@
   <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>
@@ -202,6 +202,7 @@
       addStatus: false,
       editStatus: false,
       nodeRow: {},
+      currentClickNode:null,
       form: {},
       treeData: [],
       treeOption: {
@@ -255,9 +256,10 @@
   },
   methods: {
     // 鏍戣鐐瑰嚮
-    nodeClick(row) {
+    nodeClick(row,node) {
       this.form = {...row};
       this.nodeRow = {...row};
+      this.currentClickNode=node;
       this.addStatus = false;
       this.editStatus = false;
     },
@@ -312,7 +314,7 @@
           this.addStatus = false;
           // this.resetFormValue();
           this.form.childType = null;
-          this.refresh = Math.random(); // 鍒锋柊宸︿晶鏍�
+          this.handleRefreshTree('add')
         }
       })
     },
@@ -356,7 +358,7 @@
           this.editStatus = false;
           // this.resetFormValue();
           this.form.childType = null;
-          this.refresh = Math.random(); // 鍒锋柊宸︿晶鏍�
+          this.handleRefreshTree('edit')
         }
       })
     },
@@ -371,7 +373,7 @@
         delModule(this.form).then(res => {
           if (res.data.code === 200) {
             this.$message.success(res.data.msg);
-            this.resetFormValue();
+            this.handleRefreshTree('del')
             this.addStatus = false;
             this.editStatus = false;
           }
@@ -389,8 +391,6 @@
       exportFunctionSql({isFunction: true}).then(res => {
         func.downloadFileByBlobHandler(res);
         this.$message.success('瀵煎嚭鎴愬姛');
-      }).catch(err => {
-        this.$message.error(err);
       });
     },
 
@@ -425,12 +425,11 @@
         }
       })
       addOperationType(list).then(res => {
-        console.log(res)
         if (res.data.code === 200) {
           this.methodsVisble = false;
           this.$message.success(res.data.msg);
           this.form.childType = null;
-          this.refresh = Math.random(); // 鍒锋柊宸︿晶鏍�
+          this.handleRefreshTree('add') // 鍒锋柊宸︿晶鏍�
         }
       })
     },
@@ -460,7 +459,7 @@
       updateAlias(params).then(res => {
         if (res.data.code === 200) {
           this.$message.success(res.data.msg);
-          this.refresh = Math.random(); // 鍒锋柊宸︿晶鏍�
+          this.handleRefreshTree('edit')
         }
       })
     },
@@ -480,7 +479,7 @@
           console.log(res);
           if (res.data.code === 200) {
             this.$message.success(res.data.msg);
-            this.resetFormValue();
+            this.handleRefreshTree('del');
           }
         })
       }).catch(() => {
@@ -506,6 +505,23 @@
     // 瀵煎叆
     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(); // 鍒锋柊宸︿晶鏍�
+        }
+      }
     }
   }
 }
diff --git a/Source/plt-web/plt-web-ui/src/views/systemModel/mangeModel/index.vue b/Source/plt-web/plt-web-ui/src/views/systemModel/mangeModel/index.vue
index ed00511..15cbb86 100644
--- a/Source/plt-web/plt-web-ui/src/views/systemModel/mangeModel/index.vue
+++ b/Source/plt-web/plt-web-ui/src/views/systemModel/mangeModel/index.vue
@@ -2,8 +2,8 @@
   <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>
@@ -202,6 +202,7 @@
       addStatus: false,
       editStatus: false,
       nodeRow: {},
+      currentClickNode:null,
       form: {},
       treeData: [],
       treeOption: {
@@ -255,10 +256,11 @@
   },
   methods: {
     // 鏍戣鐐瑰嚮
-    nodeClick(row) {
+    nodeClick(row,node) {
       console.log(row.childType);
       this.form = {...row};
       this.nodeRow = {...row};
+      this.currentClickNode = node;
       this.addStatus = false;
       this.editStatus = false;
     },
@@ -313,7 +315,7 @@
           this.addStatus = false;
           // this.resetFormValue();
           this.form.childType = null;
-          this.refresh = Math.random(); // 鍒锋柊宸︿晶鏍�
+          this.handleRefreshTree('add')
         }
       })
     },
@@ -357,7 +359,7 @@
           this.editStatus = false;
           // this.resetFormValue();
           this.form.childType = null;
-          this.refresh = Math.random(); // 鍒锋柊宸︿晶鏍�
+          this.handleRefreshTree('edit')
         }
       })
     },
@@ -372,7 +374,7 @@
         delModule(this.form).then(res => {
           if (res.data.code === 200) {
             this.$message.success(res.data.msg);
-            this.resetFormValue();
+            this.handleRefreshTree('del')
             this.addStatus = false;
             this.editStatus = false;
           }
@@ -461,23 +463,21 @@
       updateAlias(params).then(res => {
         if (res.data.code === 200) {
           this.$message.success(res.data.msg);
-          this.refresh = Math.random(); // 鍒锋柊宸︿晶鏍�
+          this.handleRefreshTree('edit')
         }
       })
     },
 
     // 鍒犻櫎妯″潡涓嬪叧鑱旂殑鎿嶄綔绫诲瀷
     deleteOperationClickHandler() {
-      console.log(this.form);
       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.resetFormValue();
+          this.handleRefreshTree('del');
         }
       })
     },
@@ -489,14 +489,29 @@
         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(); // 鍒锋柊宸︿晶鏍�
+        }
+      }
     }
   }
 }
diff --git a/Source/plt-web/plt-web-ui/src/views/systemModel/operateType/index.vue b/Source/plt-web/plt-web-ui/src/views/systemModel/operateType/index.vue
index cea9234..afbb76d 100644
--- a/Source/plt-web/plt-web-ui/src/views/systemModel/operateType/index.vue
+++ b/Source/plt-web/plt-web-ui/src/views/systemModel/operateType/index.vue
@@ -2,8 +2,8 @@
   <el-container>
     <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;">
           <el-form-item label="鍚嶇О锛�">
             <el-input v-model="form.name" placeholder="璇疯緭鍏ュ悕绉�"></el-input>
           </el-form-item>
@@ -73,6 +73,7 @@
       editStatus:false,
       addStatus: false,
       nodeRow: {},
+      currentClickNode:null,
       form: {},
       treeData: [],
       treeOption: {
@@ -111,10 +112,11 @@
   },
   methods: {
     // 鏍戣鐐瑰嚮
-    nodeClick(row) {
+    nodeClick(row,node) {
       console.log(row);
       this.form = {...row};
       this.nodeRow = {...row};
+      this.currentClickNode=node;
       this.addStatus = false;
       this.editStatus = false;
     },
@@ -173,7 +175,7 @@
       addOperationType(params).then(res => {
         if(res.data.code === 200){
           this.$message.success(res.data.msg);
-          this.refresh = Math.random(); // 鍒锋柊宸︿晶鏍�
+          this.handleRefreshTree('add')
           this.addStatus = false;
         }
       })
@@ -227,7 +229,7 @@
       updateOperationType(params).then(res => {
         if(res.data.code === 200){
           this.$message.success(res.data.msg);
-          this.refresh = Math.random(); // 鍒锋柊宸︿晶鏍�
+          this.handleRefreshTree('edit')
           this.editStatus = false;
         }
       })
@@ -243,7 +245,7 @@
         delOperationType(this.form).then(res => {
           if (res.data.code === 200) {
             this.$message.success(res.data.msg);
-            this.resetFormValue();
+            this.handleRefreshTree('del')
             this.addStatus = false;
             this.editStatus = false;
             this.nodeRow = {};
@@ -262,10 +264,25 @@
       exportFunctionSql({isFunction: false}).then(res => {
         func.downloadFileByBlobHandler(res);
         this.$message.success('瀵煎嚭鎴愬姛');
-      }).catch(err => {
-        this.$message.error(err);
       });
     },
+    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