From 46c673f0bf4a22ae108e90cfcf1bdeb4f0b6a45c Mon Sep 17 00:00:00 2001
From: wangting <675591594@qq.com>
Date: 星期二, 07 五月 2024 17:48:19 +0800
Subject: [PATCH] 添加action,数据联动

---
 Source/ProjectWeb/src/actions/base/AddAction.js                        |    8 ++--
 Source/ProjectWeb/src/components/dynamic-components/dynamic-button.vue |    4 -
 Source/ProjectWeb/src/actions/base/BaseAction.js                       |    9 ++--
 Source/ProjectWeb/src/views/base/UIContentViewerInDialog.vue           |   10 ++--
 Source/ProjectWeb/src/components/dynamic-components/dynamic-custom.vue |    4 +
 Source/ProjectWeb/src/views/base/UIContentArea.vue                     |    2 -
 Source/ProjectWeb/src/components/actions/AddEditDialog.vue             |    4 +
 Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue   |   13 ++++--
 Source/ProjectWeb/src/components/dynamic-components/dynamic-table.vue  |   17 ++++++--
 Source/ProjectWeb/src/components/dynamic-components/dynamic-tree.vue   |   15 +++++--
 Source/ProjectWeb/src/actions/base/EditAction.js                       |   10 ++--
 11 files changed, 58 insertions(+), 38 deletions(-)

diff --git a/Source/ProjectWeb/src/actions/base/AddAction.js b/Source/ProjectWeb/src/actions/base/AddAction.js
index 965a7e2..688f26a 100644
--- a/Source/ProjectWeb/src/actions/base/AddAction.js
+++ b/Source/ProjectWeb/src/actions/base/AddAction.js
@@ -17,8 +17,8 @@
   options.sourceData = options.sourceData || {};
 
   callPreEvent(options, doBefore, function (options) {
-    doAdd(options, function () {
-      callPostEvent(options, doAfter, callback);
+    doAdd(options, function (type,formData) {
+      callPostEvent(options, doAfter, callback,type);
     });
   });
 };
@@ -72,9 +72,9 @@
  * @param options 鎸夐挳鐨勯厤缃俊鎭�
  * @param callback 鍥炶皟
  */
-export const doAfter = (options,callback)=> {
+export const doAfter = (options,callback,actionType)=> {
   Vue.prototype.$message.success('鎵ц澧炲姞鍚庣疆浜嬩欢');
   if(callback){
-    callback(options);
+    callback(actionType);
   }
 }
diff --git a/Source/ProjectWeb/src/actions/base/BaseAction.js b/Source/ProjectWeb/src/actions/base/BaseAction.js
index c46ad97..6fbbc0b 100644
--- a/Source/ProjectWeb/src/actions/base/BaseAction.js
+++ b/Source/ProjectWeb/src/actions/base/BaseAction.js
@@ -18,6 +18,7 @@
     values.forEach((item,i) => {
       if(isShow){
         item = item.replace(':', '=');
+        debugger;
         if (item.indexOf('${') > -1) {
           if (item.split('=')[1].indexOf('.') > -1) {
             //initvaluenull=true鍏佽鍒濆鍊间负绌�
@@ -189,16 +190,16 @@
  * @param callback 鍥炶皟锛屽鏋滃瓨鍦ㄥ悗缃簨浠讹紝浼氬湪鎵ц瀹屾垚鍚庢墽琛屽洖璋冿紝鍚﹀垯鐩存帴鍥炶皟
  * @param preEventName 鍚庣疆浜嬩欢鍚嶇О锛岄粯璁� afterevent
  */
-export const callPostEvent = (options,fnTarget,callback,postEventName)=>{
+export const callPostEvent = (options,fnTarget,callback,actionType,postEventName)=>{
   let afterEvent = options.paramVOS[postEventName || 'afterevent'];
   if(afterEvent) {
     let buttonParse = parseEventByUrl(afterEvent,options,false);
     if(validatenull(buttonParse.jsPath)){
-      fnTarget(buttonParse,callback);
+      fnTarget(buttonParse,callback,actionType);
     }else{
       try {
         import("../"+buttonParse.jsPath+".js").then(module => {
-          module[buttonParse.methodName](options,callback);
+          module[buttonParse.methodName](options,callback,actionType);
         })
       } catch (error) {
         Vue.prototype.$message.error('鏈壘鍒板悗缃簨浠舵墽琛宩s');
@@ -206,7 +207,7 @@
     }
   }else{
     if(callback){
-      callback(options);
+      callback(actionType);
     }
   }
 };
diff --git a/Source/ProjectWeb/src/actions/base/EditAction.js b/Source/ProjectWeb/src/actions/base/EditAction.js
index 6dbadff..2c0e519 100644
--- a/Source/ProjectWeb/src/actions/base/EditAction.js
+++ b/Source/ProjectWeb/src/actions/base/EditAction.js
@@ -6,7 +6,7 @@
 import Vue from "vue";
 import AddEditDialog from "@/components/actions/AddEditDialog";
 
-export const doAction = (options) => {
+export const doAction = (options,callback) => {
   const paramVOS = Object.assign({
     getdataurl: '/api/uiDataController/dataFormQuery',
     getdatamethod: 'post',
@@ -42,8 +42,8 @@
     }
   }
   callPreEvent(options, doBefore, function (options) {
-    doAdd(options, function () {
-      callPostEvent(options, doAfter, options.callback);
+    doAdd(options, function (type,formData) {
+      callPostEvent(options, doAfter,type, callback);
     });
   });
 };
@@ -95,9 +95,9 @@
  * @param options 鎸夐挳鐨勯厤缃俊鎭�
  * @param callback 鍥炶皟
  */
-export const doAfter = (options,callback)=> {
+export const doAfter = (options,callback,actionType)=> {
   Vue.prototype.$message.success('鎵ц淇敼鍚庣疆浜嬩欢');
   if(callback){
-    callback(options);
+    callback(actionType);
   }
 }
diff --git a/Source/ProjectWeb/src/components/actions/AddEditDialog.vue b/Source/ProjectWeb/src/components/actions/AddEditDialog.vue
index 165aa34..7e74447 100644
--- a/Source/ProjectWeb/src/components/actions/AddEditDialog.vue
+++ b/Source/ProjectWeb/src/components/actions/AddEditDialog.vue
@@ -172,6 +172,7 @@
       for(let key in this.$refs.uiViewRef.data){
         if(this.$refs.uiViewRef.data[key].type== useDataType){
           this.form=this.$refs.uiViewRef.data[key].data;
+          this.formDefineId=this.$refs.uiViewRef.data[key].DefineVO.id;
           if (this.paramVOS.savebeforeevent) {
             var urlobj = parseEventByUrl(this.paramVOS.savebeforeevent,null,null,'doAction');
             import("../"+urlobj.jsPath+".js").then(module => {
@@ -192,6 +193,7 @@
       let that=this;
       this.$refs.formRef.validate((valid, done) => {
         if (valid) {
+          this.formDefineId=this.paramVOS.form;
           if (this.paramVOS.savebeforeevent) {
             var urlobj = parseEventByUrl(this.paramVOS.savebeforeevent,null,null,'doAction');
             import("../"+urlobj.jsPath+".js").then(module => {
@@ -219,7 +221,7 @@
         formValues.defaultValues.btmname = this.paramVOS.type;
       }
       let datas = {
-        formDefineId: this.paramVOS.form || "",
+        formDefineId: this.formDefineId,
         preEvent: this.paramVOS.preevent,
         afterEvent: this.paramVOS.afterevent,
         beforeServerEvent: this.paramVOS.beforeserverevent,
diff --git a/Source/ProjectWeb/src/components/dynamic-components/dynamic-button.vue b/Source/ProjectWeb/src/components/dynamic-components/dynamic-button.vue
index 58dacf5..0f9ca1a 100644
--- a/Source/ProjectWeb/src/components/dynamic-components/dynamic-button.vue
+++ b/Source/ProjectWeb/src/components/dynamic-components/dynamic-button.vue
@@ -153,9 +153,7 @@
         dataStore: this.dataStore || [],
         sourceData: this.sourceData || {}
       }, function (actionType,data) {
-        if (that.$parent.handleRefresh) {
-          that.$parent.handleRefresh(actionType,data)
-        }
+        that.$emit("afterMethod",actionType,data);
       });
     }
   },
diff --git a/Source/ProjectWeb/src/components/dynamic-components/dynamic-custom.vue b/Source/ProjectWeb/src/components/dynamic-components/dynamic-custom.vue
index 2d6c692..f96eff4 100644
--- a/Source/ProjectWeb/src/components/dynamic-components/dynamic-custom.vue
+++ b/Source/ProjectWeb/src/components/dynamic-components/dynamic-custom.vue
@@ -95,7 +95,9 @@
         //婧愭暟鎹湁鍙樺寲鏃跺彉鏇村綋鍓嶅尯鍩熸暟鎹�
         console.log(this.areasName);
         console.log(newval);
-      }
+      },
+      deep: true,
+      immediate: true
     }
   },
   computed: {},
diff --git a/Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue b/Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue
index 3e6a6b5..1792005 100644
--- a/Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue
+++ b/Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue
@@ -1,7 +1,8 @@
 <template>
   <div :id="'UI-dynamic-'+areasName+componentVO.oid" class="UI-dynamic">
     <dynamic-button v-if="componentVO && componentVO.buttons" :key="areasName+'buttons-'+componentVO.oid"
-                    :componentVO="componentVO" :butttonList="componentVO.buttons" :dataStore="[form]" :sourceData="sourceData" type="form"></dynamic-button>
+                    :componentVO="componentVO" :butttonList="componentVO.buttons" :dataStore="[form]" :sourceData="sourceData"
+                    @afterMethod="handleRefresh" type="form"></dynamic-button>
     <basic-form :key="areasName+'basicForm-'+componentVO.oid"
                 :span="this.componentVO.formDefineVO.columnOneRow?(24/this.componentVO.formDefineVO.columnOneRow) : 12"
                 :formItems="this.componentVO.formDefineVO && this.componentVO.formDefineVO.items"
@@ -92,11 +93,13 @@
           this.$emit("setData", {
             area: this.areasName,
             type:this.componentVO.uiComponentType,
-            btmType:this.currentDefineVO.btmType,
+            currentDefineVO:this.currentDefineVO,
             data:newval
           });
         }
-      }
+      },
+      deep: true,
+      immediate: true
     },
     sourceData: {
       handler(newval) {
@@ -104,7 +107,9 @@
         this.sourceDataMapParams=this.sourceDataMap();
         this.getParams();
         this.handleRefresh();
-      }
+      },
+      deep: true,
+      immediate: true
     }
   },
   created() {
diff --git a/Source/ProjectWeb/src/components/dynamic-components/dynamic-table.vue b/Source/ProjectWeb/src/components/dynamic-components/dynamic-table.vue
index ce6fe70..f5693d6 100644
--- a/Source/ProjectWeb/src/components/dynamic-components/dynamic-table.vue
+++ b/Source/ProjectWeb/src/components/dynamic-components/dynamic-table.vue
@@ -19,12 +19,15 @@
         <dynamic-button :componentVO="componentVO"
                         :key="areasName+'buttons-'+componentVO.oid"
                         :butttonList="componentVO.buttons" :dataStore="selectList" LocationType="top" :sourceData="sourceData"
+                        @afterMethod="handleRefresh"
                         type="table"></dynamic-button>
       </template>
 
       <!--menu鍖哄煙鎸夐挳-->
       <template slot="menu" slot-scope="scope">
-        <dynamic-button :componentVO="componentVO" :butttonList="componentVO.buttons" :scope="scope" :dataStore="selectList" :sourceData="sourceData" LocationType="menu"
+        <dynamic-button :componentVO="componentVO" :butttonList="componentVO.buttons" :scope="scope" :dataStore="selectList" :sourceData="sourceData"
+                        LocationType="menu"
+                        @afterMethod="handleRefresh"
                         type="table"></dynamic-button>
       </template>
     </avue-crud>
@@ -176,11 +179,13 @@
           this.$emit("setData", {
             area: this.areasName,
             type:this.componentVO.uiComponentType,
-            btmType:this.currentDefineVO.btmType,
+            currentDefineVO:this.currentDefineVO,
             data:newval
           });
         }
-      }
+      },
+      deep: true,
+      immediate: true
     },
     'sourceData':{
       handler(newval) {
@@ -189,7 +194,9 @@
           this.getParams();
           this.handleRefresh();
         }
-      }
+      },
+      deep: true,
+      immediate: true
     }
   },
   created() {
@@ -341,7 +348,7 @@
 
       }
     },
-    handleRefresh() {
+    handleRefresh(type) {
       this.onLoad(this.page, this.query);
     }
   }
diff --git a/Source/ProjectWeb/src/components/dynamic-components/dynamic-tree.vue b/Source/ProjectWeb/src/components/dynamic-components/dynamic-tree.vue
index 3d80d3a..0e77ec6 100644
--- a/Source/ProjectWeb/src/components/dynamic-components/dynamic-tree.vue
+++ b/Source/ProjectWeb/src/components/dynamic-components/dynamic-tree.vue
@@ -3,6 +3,7 @@
     <dynamic-button v-if="componentVO.buttons && componentVO.buttons.length>0" :componentVO="componentVO"
                     :key="areasName+'buttons-'+componentVO.oid"
                     :butttonList="componentVO.buttons" :dataStore="checkDatas"
+                    @afterMethod="handleRefresh"
                     :sourceData="sourceData" type="tree" style="margin-bottom: 5px;"></dynamic-button>
     <el-input
       placeholder="杈撳叆鍏抽敭瀛楄繘琛岃繃婊�"
@@ -104,7 +105,9 @@
             dataStore:newval
           });
         }
-      }
+      },
+      deep: true,
+      immediate: true
     },
     data:{
       handler(newval) {
@@ -112,11 +115,13 @@
           this.$emit("setData", {
             area: this.areasName,
             type:this.componentVO.uiComponentType,
-            btmType:this.componentVO.treeDefineVO.btmType,
+            currentDefineVO:this.componentVO.treeDefineVO,
             data:newval
           });
         }
-      }
+      },
+      deep: true,
+      immediate: true
     },
     sourceData:{
       handler(newval) {
@@ -124,7 +129,9 @@
         this.sourceDataMapParams=this.sourceDataMap();
         this.getParams();
         this.handleRefresh();
-      }
+      },
+      deep: true,
+      immediate: true
     }
   },
   data() {
diff --git a/Source/ProjectWeb/src/views/base/UIContentArea.vue b/Source/ProjectWeb/src/views/base/UIContentArea.vue
index c9f0c92..a52160e 100644
--- a/Source/ProjectWeb/src/views/base/UIContentArea.vue
+++ b/Source/ProjectWeb/src/views/base/UIContentArea.vue
@@ -205,8 +205,6 @@
           }
         })
         this.newAreasData = newAreasData;
-      }else {
-        this.newAreasData=this.areasData;
       }
     },
     checkDisplayExpression(displayExpressionStr) {
diff --git a/Source/ProjectWeb/src/views/base/UIContentViewerInDialog.vue b/Source/ProjectWeb/src/views/base/UIContentViewerInDialog.vue
index 0bd27af..2b4043b 100644
--- a/Source/ProjectWeb/src/views/base/UIContentViewerInDialog.vue
+++ b/Source/ProjectWeb/src/views/base/UIContentViewerInDialog.vue
@@ -143,22 +143,22 @@
       data:{
         northAreaInDialog:{
           type:'',
-          btmType:'',
+          DefineVO:null,
           data:null
         },
         westAreaInDialog:{
           type:'',
-          btmType:'',
+          DefineVO:null,
           data:null
         },
         centerAreaInDialog:{
           type:'',
-          btmType:'',
+          DefineVO:null,
           data:null
         },
         southAreaInDialog:{
           type:'',
-          btmType:'',
+          DefineVO:null,
           data:null
         }
       },
@@ -202,7 +202,7 @@
       }
     },
     setData(value) {
-      this.data[value.area].btmType = value.btmType;
+      this.data[value.area].DefineVO = value.currentDefineVO;
       this.data[value.area].data = value.data;
       this.data[value.area].type = value.type;
     },

--
Gitblit v1.9.3