From e358d69fc18870584dd2d9f531910b7838ea27d9 Mon Sep 17 00:00:00 2001
From: wangting <wangting@vci-tech.com>
Date: 星期四, 02 一月 2025 09:58:53 +0800
Subject: [PATCH] 调整行点击后的回调

---
 Source/plt-web/plt-web-ui/src/views/authority/ui/typeAction/index.vue |  302 ++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 241 insertions(+), 61 deletions(-)

diff --git a/Source/plt-web/plt-web-ui/src/views/authority/ui/typeAction/index.vue b/Source/plt-web/plt-web-ui/src/views/authority/ui/typeAction/index.vue
index 308c333..7e2de73 100644
--- a/Source/plt-web/plt-web-ui/src/views/authority/ui/typeAction/index.vue
+++ b/Source/plt-web/plt-web-ui/src/views/authority/ui/typeAction/index.vue
@@ -1,33 +1,18 @@
 <template>
+  <!--绫诲瀷Action-->
   <el-container>
-
     <el-aside>
-      <basic-container>
-        <div ref="TreeBox" style="height: calc(100vh - 144px);!important;">
-          <div class="headerCon">
-            <el-button icon="el-icon-plus" plain size="small" type="primary" @click="addClickHandler">鍒涘缓
-            </el-button>
-            <el-button icon="el-icon-edit" plain size="small" type="primary" @click="editClickHandler">淇敼
-            </el-button>
-            <el-button icon="el-icon-delete" plain size="small" type="danger" @click="delClickHandler">鍒犻櫎
-            </el-button>
-            <el-button icon="el-icon-download" plain size="small" type="primary" @click="exportClickHandler">瀵煎嚭
-            </el-button>
-            <el-button icon="el-icon-upload2" plain size="small" type="primary" @click="uploadClickHandler">瀵煎叆
-            </el-button>
-            <el-button class="smallBtn" plain size="small" type="primary"
-                       @click="checkViewClickHandler">鏌ョ湅浣跨敤鑼冨洿
-            </el-button>
-          </div>
+      <basic-container v-loadng="treeLoading">
+        <div ref="TreeBox" style="height: calc(100vh - 154px);!important;">
           <!-- 宸︿晶鏍�         -->
-          <div style="height:  calc(100vh - 280px);">
+          <div style="height:  calc(100vh - 190px);">
             <avue-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>
-                {{ (node || {}).label }}
-            </span>
-          </span>
+              <span slot-scope="{ node, data }" class="el-tree-node__label">
+               <span>
+                  <i class="el-icon-s-promotion"></i>
+                    {{ (node || {}).label }}
+                </span>
+              </span>
             </avue-tree>
           </div>
         </div>
@@ -36,6 +21,22 @@
 
     <el-main>
       <basic-container>
+        <avue-crud
+          ref="crud"
+          :data="data"
+          :option="option"
+          :table-loading="tableLoading"
+          @refresh-change="handleRefresh"
+          @search-change="handleSearch"
+          @search-reset="handleReset"
+          @selection-change="selectChangeHandler"
+          @row-click="rowClickHandler">
+          <template slot="menuLeft">
+            <el-button v-if="permissionList.addBtn" icon="el-icon-plus" size="small" type="primary" @click="addHandler">娣诲姞</el-button>
+            <el-button v-if="permissionList.delBtn" icon="el-icon-delete" plain size="small" type="danger" @click="delHandler">绉婚櫎</el-button>
+          </template>
+        </avue-crud>
+        <action-dialog ref="actionDialog" :is-muti="true" @updataAction="actionSaveHandler"></action-dialog>
       </basic-container>
     </el-main>
 
@@ -43,8 +44,222 @@
 </template>
 
 <script>
+import basicOption from "@/util/basic-option";
+import { getBizTree} from "@/api/UI/uiDefine";
+import {getTypeActionByType,savePLTypeAction,delPLTypeActions} from "@/api/authority/ui/typeAction"
+import func from "@/util/func";
+import actionDialog from "@/views/modelingMenu/ui/Aciton/components/dialog"
+import {mapGetters} from "vuex";
+
 export default {
-  name: "index"
+  name: "index",
+  components:{actionDialog},
+  data() {
+    return {
+      treeLoading:false,
+      treeOption: {
+        height: 'auto',
+        defaultExpandAll: true,
+        menu: false,
+        addBtn: false,
+        props: {
+          label: 'text',
+          value: 'oid',
+          children: 'children'
+        }
+      },
+      nodeRow: {},
+      treeData: [],
+      searchParams: {},
+      tableLoading: false,
+      selectList: [],
+      option: {
+        ...basicOption,
+        calcHeight: -35,
+        addBtn: false,
+        editBtn: false,
+        delBtn: false,
+        tip: false,
+        searchMenuSpan: 6,
+        align: 'left',
+        menu:false,
+        column: [
+          {
+            label: '缂栧彿',
+            prop: 'plCode',
+            overHidden: true,
+            search: true
+          },
+          {
+            label: '鍚嶇О',
+            prop: 'plName',
+            overHidden: true,
+            search: true
+          },
+          {
+            label: 'C/S绫昏矾寰�',
+            prop: 'plCSClass',
+            searchLabelWidth:120,
+            overHidden: true,
+          },
+          {
+            label: 'B/S閾炬帴鍦板潃',
+            prop: 'plBSUrl',
+            searchLabelWidth:120,
+            overHidden: true,
+          },
+          {
+            label: '绫诲瀷',
+            prop: 'plTypeType',
+            type: 'select',
+            width:100,
+            dicData: [{
+              label: '涓氬姟绫诲瀷',
+              value: 'business'
+            }, {
+              label: '閾炬帴绫诲瀷',
+              value: 'link'
+            }]
+          },
+          {
+            label: '鎻忚堪',
+            prop: 'plDesc',
+            overHidden: true,
+          },
+        ]
+      },
+      allData: [],
+      data: [],
+    }
+  },
+  computed:{
+    ...mapGetters(["permission"]),
+    permissionList() {
+      return {
+        addBtn: this.vaildData(this.permission[this.$route.query.id].ADD, false),
+        delBtn: this.vaildData(this.permission[this.$route.query.id].DELETE, false),
+      };
+    },
+  },
+  created() {
+    this.getTreeList();
+  },
+  methods: {
+    //鏍戣〃鏌ヨ
+    getTreeList() {
+      this.treeLoading = true;
+      getBizTree().then(res => {
+        this.treeData = [res.data.obj];
+        this.treeLoading = false;
+      }).catch(error => {
+        this.treeLoading = false;
+      })
+    },
+    // 鏍戠偣鍑�
+    nodeClick(row) {
+      if (row.oid) {
+        this.nodeRow = row;
+        this.tableLoading = true;
+        this.getTableList();
+      }
+    },
+    getTableList() {
+      getTypeActionByType({
+        'typeName': this.nodeRow.attributes.name,
+      }).then(res => {
+        this.data = res.data.data;
+        this.allData = res.data.data;
+        this.$refs.crud.clearSelection();
+        this.tableLoading = false;
+      })
+    },
+    // 澶氶��
+    selectChangeHandler(row) {
+      this.selectList = row;
+    },
+    // 琛岀偣鍑�
+    rowClickHandler(row) {
+      func.rowClickHandler(
+        row,
+        this.$refs.crud,
+        this.lastIndex,
+        (newIndex) => {
+          this.lastIndex = newIndex;
+        },
+        () => {
+          this.selectList = [row];
+        }
+      );
+    },
+    handleRefresh() {
+      this.getTableList();
+    },
+    // 鎼滅储鏌ヨ
+    handleSearch(params, done) {
+      const data=this.allData.filter(item=>{
+        if(item.plCode.includes(params.plCode ||'') && item.plName.includes(params.plName || '')){
+          return true;
+        }else {
+          return false;
+        }
+      })
+      this.data=data;
+      done();
+    },
+
+    // 閲嶇疆鎼滅储鏉′欢
+    handleReset() {
+      this.data=this.allData;
+    },
+    //鍒涘缓
+    addHandler() {
+      if (this.nodeRow && this.nodeRow.oid && this.nodeRow.oid!='') {
+        this.$refs.actionDialog.openDialog();
+      } else {
+        this.$message.error('璇烽�夋嫨涓氬姟绫诲瀷');
+      }
+    },
+    // 淇濆瓨action
+    actionSaveHandler(val) {
+      const params = {
+        plTypeName: this.nodeRow.attributes.name,
+        actions:val
+      }
+      savePLTypeAction(params).then(res => {
+        if(res.data.code == 200){
+          this.$message.success(res.data.obj);
+          this.getTableList();
+        }
+      })
+    },
+    delHandler() {
+      if (this.selectList.length <= 0) {
+        this.$message.error('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹�');
+        return;
+      }
+      const params = {
+        typeName: this.nodeRow.attributes.name,
+        typeActionOIds: this.selectList.map(item => item.plOId).join(',')
+      }
+      this.$confirm('鏄惁绉婚櫎閫変腑鐨凙ction锛�', '鎻愮ず', {
+        confirmButtonText: '纭畾',
+        cancelButtonText: '鍙栨秷',
+        type: 'warning'
+      }).then(() => {
+        delPLTypeActions(params).then(res => {
+          if (res.data.code === 200) {
+            this.$message.success('鍒犻櫎鎴愬姛');
+            this.getTableList();
+          }
+        })
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: '宸插彇娑堝垹闄�'
+        });
+      });
+    },
+  }
 }
 </script>
 
@@ -53,40 +268,5 @@
   .el-scrollbar__wrap {
     overflow: auto !important;
   }
-  .headerCon{
-    .el-button{
-      width: 82px;
-    }
-  }
 }
-
-.headerCon {
-  display: flex;
-  flex-wrap: wrap;
-  margin-bottom: 5px;
-
-  .el-button + .el-button {
-    margin-left: 5px;
-  }
-
-  .el-button {
-    margin-top: 5px;
-  }
-}
-
-.headerCon > .el-button:nth-child(4) {
-  margin-left: 0;
-}
-
-.headerCon > .el-button:nth-child(7) {
-  margin-left: 0;
-}
-
-
-.smallBtn {
-  width: 82px;
-  text-align: center;
-  padding-left: 4.5px;
-}
-
 </style>

--
Gitblit v1.9.3