From f9b749d2ae804869b09d035de44ba1ce71214dc1 Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期五, 22 三月 2024 10:01:58 +0800
Subject: [PATCH] top区域和menu区域事件

---
 Source/ProjectWeb/src/components/dynamic-components/dynamic-button.vue     |   35 +++++-
 Source/ProjectWeb/src/components/dynamic-components/dynamic-table-form.vue |    2 
 Source/ProjectWeb/src/views/base/uiDefineVO.js                             |  171 ++++++++++++++++++++++++++++++++++
 Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue       |    1 
 Source/ProjectWeb/src/components/dynamic-components/dynamic-table.vue      |   43 +++++---
 5 files changed, 224 insertions(+), 28 deletions(-)

diff --git a/Source/ProjectWeb/src/components/dynamic-components/dynamic-button.vue b/Source/ProjectWeb/src/components/dynamic-components/dynamic-button.vue
index 1c26a42..fdd3e1a 100644
--- a/Source/ProjectWeb/src/components/dynamic-components/dynamic-button.vue
+++ b/Source/ProjectWeb/src/components/dynamic-components/dynamic-button.vue
@@ -18,7 +18,7 @@
                  :icon="item.paramVOS.webUiButtonIcon ? item.paramVOS.webUiButtonIcon : (item.paramVOS.webUiButtonMethods === 'edit' ? 'el-icon-edit' : (item.paramVOS.webUiButtonMethods === 'delete' ? 'el-icon-delete' : ''))"
                  :type="item.paramVOS.webUiButtonType || 'text'" plain
                  size="small"
-                 @click="buttonClick(item,scope)">
+                 @click="buttonClick(item)">
         {{ item.name }}
       </el-button>
       <!-- 琛ㄦ牸鍐呮寜閽搷浣滃璇濇琛ㄥ崟   -->
@@ -29,7 +29,7 @@
       <el-button v-for="item in basicButtonList"
                  :key="item.oid"
                  :icon="item.paramVOS.webUiButtonIcon"
-                 :type="(item.paramVOS.webUiButtonType !== 'text' ? item.paramVOS.buttonType : 'primary') || 'primary'"
+                 :type="(item.paramVOS.webUiButtonType !== 'text' ? item.paramVOS.webUiButtonType : 'primary') || 'primary'"
                  plain
                  size="small"
                  @click="buttonClick(item)">
@@ -56,6 +56,9 @@
       type: Object,
     },
     butttonList: {
+      type: Array
+    },
+    selectList: {
       type: Array
     }
   },
@@ -228,15 +231,11 @@
   },
   computed: {
     basicButtonList() {
-      // const basicColumn = this.butttonList.filter(item => item.id !== 'launchworkflow'); // 棣栧厛杩囨护鍑烘潵鍩虹琛ㄥ崟浜嬩欢鐨勬寜閽�
       const basicColumn = this.butttonList;
 
       if (this.type === 'form') {
-
         return basicColumn;
-
       } else if (this.type === 'table') {
-
         const top = basicColumn.filter(item => item.paramVOS.webUiButtonLocation === 'top' || func.isEmpty(item.paramVOS.webUiButtonLocation)); // 杩囨护鍑烘潵琛ㄦ牸涓婇潰鍖哄煙灞曠ず鐨勬寜閽�
         const menu = basicColumn.filter(item => item.paramVOS.webUiButtonLocation === 'menu'); // 杩囨护鍑烘潵鎿嶄綔鏍忓睍绀虹殑鎸夐挳
 
@@ -256,12 +255,30 @@
       }
 
       function handleEdit() {
-        this.visible = true;
-        this.$refs.dynamicForm.form = this.scope.row;
+        const location = item.paramVOS.webUiButtonLocation;
+        if (location === 'menu') {
+          this.visible = true;
+          this.$refs.dynamicForm.form = this.scope.row;
+        } else if (location === 'top' && this.selectList.length === 1) {
+          this.visible = true;
+          this.$refs.dynamicForm.form = this.selectList[0];
+        } else {
+          const messageText = this.selectList.length > 1 ? '鍙兘閫夋嫨涓�鏉℃暟鎹繘琛岀紪杈戯紒' : '璇烽�夋嫨涓�鏉℃暟鎹繘琛岀紪杈戯紒';
+          this.$message.warning(messageText);
+        }
       }
 
       function handleDelete() {
-        this.$message.success('鍒犻櫎鎴愬姛锛�');
+        const location = item.paramVOS.webUiButtonLocation;
+        if (location === 'top') {
+          if (this.selectList.length <= 0) {
+            this.$message.warning('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹紒')
+          } else {
+            this.$message.success('鍒犻櫎鎴愬姛锛�');
+          }
+        } else if (location === 'menu') {
+          this.$message.success('鍒犻櫎鎴愬姛锛�');
+        }
       }
 
       const methodHandlers = {
diff --git a/Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue b/Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue
index d3fcc57..15682f8 100644
--- a/Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue
+++ b/Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue
@@ -59,7 +59,6 @@
     }
   },
   mounted() {
-    // console.log('componentVO--',this.componentVO.tableDefineVO.cols[0])
   },
   computed: {
     option() {
diff --git a/Source/ProjectWeb/src/components/dynamic-components/dynamic-table-form.vue b/Source/ProjectWeb/src/components/dynamic-components/dynamic-table-form.vue
index 226164f..1fe34cf 100644
--- a/Source/ProjectWeb/src/components/dynamic-components/dynamic-table-form.vue
+++ b/Source/ProjectWeb/src/components/dynamic-components/dynamic-table-form.vue
@@ -4,7 +4,7 @@
       <avue-form v-model="form" :option="option" @submit="submitHandler" @reset-change="changeHandler">
         <template v-for="item in slotData" :slot="item.prop + 'Label'">
         <span>
-          <span>{{ item.label }} </span>
+          <span>{{ item.label }}</span>
           <el-tooltip
             v-if="item.keyAttr"
             class="item"
diff --git a/Source/ProjectWeb/src/components/dynamic-components/dynamic-table.vue b/Source/ProjectWeb/src/components/dynamic-components/dynamic-table.vue
index 8da8fb6..eebd67d 100644
--- a/Source/ProjectWeb/src/components/dynamic-components/dynamic-table.vue
+++ b/Source/ProjectWeb/src/components/dynamic-components/dynamic-table.vue
@@ -1,22 +1,23 @@
 <template>
   <div class="UI-dynamic" :id="'UI-dynamic-'+areasName+componentVO.oid">
-    <avue-crud v-model="form"
-               ref="dataTable"
-               :data="tableList"
-               :option="option"
-               :page.sync="page"
-               :table-loading="loading">
-      <!--top鍖哄煙鎸夐挳-->
-      <template slot="menuLeft" slot-scope="scope">
-        <dynamic-button LocationType="top" type="table":butttonList="componentVO.buttons" ></dynamic-button>
-      </template>
+      <avue-crud v-model="form"
+                 ref="dataTable"
+                 :data="tableList"
+                 :option="option"
+                 :page.sync="page"
+                 :table-loading="loading"
+                 @selection-change="selectChange">
+        <!--top鍖哄煙鎸夐挳-->
+        <template slot="menuLeft" slot-scope="scope">
+          <dynamic-button LocationType="top" type="table":butttonList="componentVO.buttons" :selectList="selectList"></dynamic-button>
+        </template>
 
-      <!--menu鍖哄煙鎸夐挳-->
-      <template slot="menu" slot-scope="scope">
-        <dynamic-button :scope="scope" LocationType="menu" type="table":butttonList="componentVO.buttons" ></dynamic-button>
-      </template>
-    </avue-crud>
-  </div>
+        <!--menu鍖哄煙鎸夐挳-->
+        <template slot="menu" slot-scope="scope">
+          <dynamic-button :scope="scope" LocationType="menu" type="table":butttonList="componentVO.buttons" :selectList="selectList"></dynamic-button>
+        </template>
+      </avue-crud>
+    </div>
 </template>
 
 <script>
@@ -48,6 +49,11 @@
       //鎵�鍦ㄥ尯鍩熸槸鍚﹀凡鏄剧ず锛岄拡瀵箃ab鍜宑ollapse
       type: Boolean,
       default: true
+    },
+    dataStore:{
+      //寮圭獥鏃舵寜閽墍灞炲尯鍩熼�変腑鏁版嵁
+      type:Array,
+      default: []
     },
   },
   data() {
@@ -462,12 +468,14 @@
         addBtn: false,
         editBtn: false,
         delBtn: false,
+        selection:true,
         height: '100%',
         calcHeight: 15,
         indexFixed: false,
         menuFixed: false,
         column: [],
       },
+      selectList:[]
     }
   },
   computed: {
@@ -520,6 +528,9 @@
     }
   },
   methods: {
+    selectChange(row){
+      this.selectList = row;
+    }
   }
 }
 </script>
diff --git a/Source/ProjectWeb/src/views/base/uiDefineVO.js b/Source/ProjectWeb/src/views/base/uiDefineVO.js
index 90aee0a..01477f5 100644
--- a/Source/ProjectWeb/src/views/base/uiDefineVO.js
+++ b/Source/ProjectWeb/src/views/base/uiDefineVO.js
@@ -52,7 +52,176 @@
               "pkComponent": "2D6D571B-BB6E-677D-9764-191BC5D5D3F1",
               "pkParentOid": "",
               "url": "RefreshAction"
-            }
+            },
+            {
+              "actionVO": {
+                "actionCls": "",
+                "actionUsedType": "business",
+                "bsUrl": "BaseEditAction#doAction",
+                "createTime": "2013-11-09 10:32:41.000",
+                "creator": "eddieliu",
+                "csClass": "plm.uif.actions.client.EditAction",
+                "description": "淇敼涓氬姟瀵硅薄",
+                "id": "edit",
+                "lastModifier": "developer",
+                "lastModifyTime": "2013-11-09 10:32:41.000",
+                "licensors": null,
+                "name": "淇敼",
+                "oid": "F8534EFE-130B-0CB3-D477-2AC7B19B7DC4"
+              },
+              "areaType": "tab",
+              "authorization": true,
+              "children": null,
+              "createTime": "2022-07-18 17:30:52.000",
+              "creator": "developer",
+              "csUrl": "plm.uif.actions.client.EditAction",
+              "description": "",
+              "displayMode": "textandimage",
+              "hidden": false,
+              "iconPath": "",
+              "id": "edit",
+              "lastModifier": "developer",
+              "lastModifyTime": "2022-07-18 17:30:52.000",
+              "name": "淇敼",
+              "oid": "43F34DC1-C229-359B-AED3-38CA9E7D1534",
+              "orderNum": 1,
+              "paramVOS": {
+                "owner": "true",
+                "context": "CreateAuditQuestionDocume",
+                "type": "document",
+                'webUiButtonLocation': 'top',
+                'webUiButtonMethods': 'edit',
+              },
+              "pkComponent": "E00C3C31-D27F-E3AC-6C2B-1882EE8B6FEE",
+              "pkParentOid": "",
+              "url": "BaseEditAction#doAction"
+            },
+            {
+              "actionVO": {
+                "actionCls": "",
+                "actionUsedType": "business",
+                "bsUrl": "BaseEditAction#doAction",
+                "createTime": "2013-11-09 10:32:41.000",
+                "creator": "eddieliu",
+                "csClass": "plm.uif.actions.client.EditAction",
+                "description": "淇敼涓氬姟瀵硅薄",
+                "id": "edit",
+                "lastModifier": "developer",
+                "lastModifyTime": "2013-11-09 10:32:41.000",
+                "licensors": null,
+                "name": "淇敼",
+                "oid": "F8534EFE-130B-0CB3-D477-2AC7B19B7DC4"
+              },
+              "areaType": "tab",
+              "authorization": true,
+              "children": null,
+              "createTime": "2022-07-18 17:30:52.000",
+              "creator": "developer",
+              "csUrl": "plm.uif.actions.client.EditAction",
+              "description": "",
+              "displayMode": "textandimage",
+              "hidden": false,
+              "iconPath": "",
+              "id": "edit",
+              "lastModifier": "developer",
+              "lastModifyTime": "2022-07-18 17:30:52.000",
+              "name": "淇敼",
+              "oid": "43F34DC1-C229-359B-AED3-38CA9E7D1534",
+              "orderNum": 1,
+              "paramVOS": {
+                "owner": "true",
+                "context": "CreateAuditQuestionDocume",
+                "type": "document",
+                'webUiButtonLocation': 'menu',
+                'webUiButtonMethods': 'edit',
+              },
+              "pkComponent": "E00C3C31-D27F-E3AC-6C2B-1882EE8B6FEE",
+              "pkParentOid": "",
+              "url": "BaseEditAction#doAction"
+            },
+            {
+              "actionVO": {
+                "actionCls": "",
+                "actionUsedType": "business",
+                "bsUrl": "",
+                "createTime": "2021-12-03 15:28:19.000",
+                "creator": "developer",
+                "csClass": "net=VCI.Plugin.631.Actions.dll",
+                "description": "鍒犻櫎宸ヨ壓闂",
+                "id": "deleteprocessquestion",
+                "lastModifier": "developer",
+                "lastModifyTime": "2021-12-03 15:28:19.000",
+                "licensors": null,
+                "name": "鍒犻櫎宸ヨ壓闂",
+                "oid": "FD73DF30-7269-8A85-1B62-B92435000280"
+              },
+              "areaType": "tab",
+              "authorization": true,
+              "children": null,
+              "createTime": "2022-07-18 17:30:52.000",
+              "creator": "developer",
+              "csUrl": "net=VCI.Plugin.631.Actions.dll",
+              "description": "",
+              "displayMode": "textandimage",
+              "hidden": false,
+              "iconPath": "",
+              "id": "deleteprocessquestion",
+              "lastModifier": "developer",
+              "lastModifyTime": "2022-07-18 17:30:52.000",
+              "name": "鍒犻櫎",
+              "oid": "BE973D4A-CB99-10FC-3E31-F3010259F823",
+              "orderNum": 2,
+              "paramVOS": {
+                "owner": "true",
+                'webUiButtonLocation': 'menu',
+                'webUiButtonType': 'text',
+                'webUiButtonMethods': 'delete'
+              },
+              "pkComponent": "E00C3C31-D27F-E3AC-6C2B-1882EE8B6FEE",
+              "pkParentOid": "",
+              "url": ""
+            },
+            {
+              "actionVO": {
+                "actionCls": "",
+                "actionUsedType": "business",
+                "bsUrl": "",
+                "createTime": "2021-12-03 15:28:19.000",
+                "creator": "developer",
+                "csClass": "net=VCI.Plugin.631.Actions.dll",
+                "description": "鍒犻櫎宸ヨ壓闂",
+                "id": "deleteprocessquestion",
+                "lastModifier": "developer",
+                "lastModifyTime": "2021-12-03 15:28:19.000",
+                "licensors": null,
+                "name": "鍒犻櫎宸ヨ壓闂",
+                "oid": "FD73DF30-7269-8A85-1B62-B92435000280"
+              },
+              "areaType": "tab",
+              "authorization": true,
+              "children": null,
+              "createTime": "2022-07-18 17:30:52.000",
+              "creator": "developer",
+              "csUrl": "net=VCI.Plugin.631.Actions.dll",
+              "description": "",
+              "displayMode": "textandimage",
+              "hidden": false,
+              "iconPath": "",
+              "id": "deleteprocessquestion",
+              "lastModifier": "developer",
+              "lastModifyTime": "2022-07-18 17:30:52.000",
+              "name": "鍒犻櫎",
+              "oid": "BE973D4A-CB99-10FC-3E31-F3010259F823",
+              "orderNum": 2,
+              "paramVOS": {
+                "owner": "true",
+                'webUiButtonLocation': 'top',
+                'webUiButtonMethods': 'delete'
+              },
+              "pkComponent": "E00C3C31-D27F-E3AC-6C2B-1882EE8B6FEE",
+              "pkParentOid": "",
+              "url": ""
+            },
           ],
           "checkInBy": null,
           "checkInTime": null,

--
Gitblit v1.9.3