From 948a8b5fba4baf0a19493ae6d7b8a1dee0d4101a Mon Sep 17 00:00:00 2001
From: wangting <675591594@qq.com>
Date: 星期二, 14 五月 2024 17:01:19 +0800
Subject: [PATCH] 修改action实现机制,配置文档

---
 Source/ProjectWeb/src/components/actions/handlers.js                 |   49 +++++++++------
 Source/ProjectWeb/src/components/actions/base/BaseAction.js          |   15 ++---
 Source/ProjectWeb/src/configDoc/Action/img_edit.png                  |    0 
 Source/ProjectWeb/src/components/actions/AddEditDialog.vue           |    5 +
 Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue |   25 ++++----
 Source/ProjectWeb/src/components/PLT-basic-component/basicForm.vue   |    9 +++
 Source/ProjectWeb/src/configDoc/Action.md                            |   24 +++++++
 7 files changed, 82 insertions(+), 45 deletions(-)

diff --git a/Source/ProjectWeb/src/components/PLT-basic-component/basicForm.vue b/Source/ProjectWeb/src/components/PLT-basic-component/basicForm.vue
index b6db326..ca5e5b4 100644
--- a/Source/ProjectWeb/src/components/PLT-basic-component/basicForm.vue
+++ b/Source/ProjectWeb/src/components/PLT-basic-component/basicForm.vue
@@ -75,6 +75,11 @@
       type: Object,
       default: () => {},
     },
+    uploadattachment:{
+      //鏄惁鏄剧ず涓婁紶闄勪欢
+      type:Boolean,
+      default:false
+    },
   },
   data() {
     return {
@@ -225,6 +230,10 @@
         this.subitemName = col.field;
       }else if(col.type === 'upload'){
         console.log('col',col)
+      }else if(col.type=="multiFile"){
+        if(this.uploadattachment == "false" || this.uploadattachment == false){
+          col.display=false
+        }
       }
       if (col.type === "select") {
         if(col.data && col.data.length>0){
diff --git a/Source/ProjectWeb/src/components/actions/AddEditDialog.vue b/Source/ProjectWeb/src/components/actions/AddEditDialog.vue
index 552c258..233e001 100644
--- a/Source/ProjectWeb/src/components/actions/AddEditDialog.vue
+++ b/Source/ProjectWeb/src/components/actions/AddEditDialog.vue
@@ -17,6 +17,7 @@
                 :formItems="formItems"
                 :formData="form"
                 :initValue="paramVOS.initvalue"
+                :uploadattachment="paramVOS.uploadattachment || false"
                 @getFormData="getFormData">
     </basic-form>
     <ui-view ref="uiViewRef" v-else-if="paramVOS.context"
@@ -176,7 +177,7 @@
           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 => {
+            import(`./${urlobj.jsPath}.js`).then(module => {
               module[urlobj.methodName]({
                 paramVOS: this.paramVOS,
                 dataStore: this.dataStore,
@@ -197,7 +198,7 @@
           this.formDefineId=this.paramVOS.form;
           if (this.paramVOS.savebeforeevent) {
             var urlobj = parseEventByUrl(this.paramVOS.savebeforeevent,null,null,'doAction');
-            import("../"+urlobj.jsPath+".js").then(module => {
+            import(`./${urlobj.jsPath}.js`).then(module => {
               module[urlobj.methodName]({
                 paramVOS: this.paramVOS,
                 dataStore: this.dataStore,
diff --git a/Source/ProjectWeb/src/components/actions/base/BaseAction.js b/Source/ProjectWeb/src/components/actions/base/BaseAction.js
index b560c29..1c336ee 100644
--- a/Source/ProjectWeb/src/components/actions/base/BaseAction.js
+++ b/Source/ProjectWeb/src/components/actions/base/BaseAction.js
@@ -1,6 +1,6 @@
 import {validatenull} from "@/util/validate";
 import Vue from 'vue';
-import {handlers} from '../handlers';
+import {handlerAction} from '../handlers';
 
 /**
  * 鎸夐挳鐨勫熀纭�鏈嶅姟
@@ -61,15 +61,12 @@
   }
   if (button.url && button.url != 'null') {
     //鏈夐厤缃產ction璺緞锛屼娇鐢ㄨ矾寰勫搴旂殑js
-    import("../" + button.url + ".js").then(module => {
+    import(`../${button.url}`).then(module => {
       module.doAction(options, callback);
     })
   } else {
-    if (handlers[button.actionVO.id.toLowerCase()]) {
-      handlers[button.actionVO.id.toLowerCase()]()
-    } else {
-      Vue.prototype.$message.error('鏈壘鍒板搴攁ction锛岃閲嶆柊閰嶇疆鎸夐挳锛�');
-    }
+    //鎵ц閫氱敤action
+    handlerAction(button.actionVO.id.toLowerCase(),options, callback)
   }
 };
 
@@ -151,7 +148,7 @@
       fnTarget(buttonParse,callback);
     }else{
       try {
-        import("../"+buttonParse.jsPath+".js").then(module => {
+        import(`../${buttonParse.jsPath}.js`).then(module => {
           module[buttonParse.methodName](options,callback);
         })
       } catch (error) {
@@ -179,7 +176,7 @@
       fnTarget(buttonParse,callback,actionType);
     }else{
       try {
-        import("../"+buttonParse.jsPath+".js").then(module => {
+        import(`../${buttonParse.jsPath}.js`).then(module => {
           module[buttonParse.methodName](options,callback,actionType);
         })
       } catch (error) {
diff --git a/Source/ProjectWeb/src/components/actions/handlers.js b/Source/ProjectWeb/src/components/actions/handlers.js
index d6cd036..6380539 100644
--- a/Source/ProjectWeb/src/components/actions/handlers.js
+++ b/Source/ProjectWeb/src/components/actions/handlers.js
@@ -1,22 +1,31 @@
 //棰勭疆action
-export const handlers = {
-  //鏌ョ湅
-  view: () => {import("@/components/actions/base/ViewAction").then(module => {
-    module.doAction(options,callback);
-  })},
-  //鍒涘缓
-  add: () => {import("@/components/actions/base/AddAction").then(module => {
-    module.doAction(options,callback);
-  })},
-  //淇敼
-  edit: () =>  {import("@/components/actions/base/EditAction").then(module => {
-    module.doAction(options,callback);
-  })},
-  //鍒犻櫎
-  delete: () =>  {import("@/components/actions/base/DeleteAction").then(module => {
-    module.doAction(options,callback);
-  })},  //鍒犻櫎
-  del: () =>  {import("@/components/actions/base/DeleteAction").then(module => {
-    module.doAction(options,callback);
-  })},
+import Vue from "vue";
+
+export const handlerAction=function (type,options, callback) {
+  const handlers = {
+    //鏌ョ湅
+    view: () => {import("@/components/actions/base/ViewAction").then(module => {
+      module.doAction(options,callback);
+    })},
+    //鍒涘缓
+    add: () => {import("@/components/actions/base/AddAction").then(module => {
+      module.doAction(options,callback);
+    })},
+    //淇敼
+    edit: () =>  {import("@/components/actions/base/EditAction").then(module => {
+      module.doAction(options,callback);
+    })},
+    //鍒犻櫎
+    delete: () =>  {import("@/components/actions/base/DeleteAction").then(module => {
+      module.doAction(options,callback);
+    })},  //鍒犻櫎
+    del: () =>  {import("@/components/actions/base/DeleteAction").then(module => {
+      module.doAction(options,callback);
+    })},
+  };
+  if (handlers[type]) {
+    handlers[type]()
+  } else {
+    Vue.prototype.$message.error('鏈壘鍒板搴攁ction锛岃閲嶆柊閰嶇疆鎸夐挳锛�');
+  }
 };
diff --git a/Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue b/Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue
index e08c6b3..4cadbbc 100644
--- a/Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue
+++ b/Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue
@@ -10,6 +10,7 @@
                 :isEdit="canEdit"
                 :formData="form"
                 :initValue="paramVOS.initvalue"
+                :uploadattachment="paramVOS.uploadattachment || false"
                 @getFormData="getFormData">
     </basic-form>
   </div>
@@ -160,18 +161,6 @@
         dataForm(this.params, this.paramVOS.getdataurl, this.paramVOS.getdatamethod).then(res => {
           this.form = res.data.obj.data;
           this.loading = false;
-          this.$emit("setDataStore", {
-            area: this.areasName,
-            type: this.componentVO.uiComponentType,
-            btmType: this.currentDefineVO.btmType,
-            dataStore: [this.form]
-          });
-          this.$emit("setData", {
-            area: this.areasName,
-            type: this.componentVO.uiComponentType,
-            currentDefineVO: this.currentDefineVO,
-            data: this.form
-          });
         }).catch(error => {
           this.loading = false;
         });
@@ -183,6 +172,18 @@
     },
     getFormData(form) {
       this.form = form;
+      this.$emit("setDataStore", {
+        area: this.areasName,
+        type: this.componentVO.uiComponentType,
+        btmType: this.currentDefineVO.btmType,
+        dataStore: [this.form]
+      });
+      this.$emit("setData", {
+        area: this.areasName,
+        type: this.componentVO.uiComponentType,
+        currentDefineVO: this.currentDefineVO,
+        data: this.form
+      });
     }
   }
 }
diff --git a/Source/ProjectWeb/src/configDoc/Action.md b/Source/ProjectWeb/src/configDoc/Action.md
index 4ab6656..47a5102 100644
--- a/Source/ProjectWeb/src/configDoc/Action.md
+++ b/Source/ProjectWeb/src/configDoc/Action.md
@@ -6,13 +6,33 @@
 
 鍙傛暟鍙湪鍙傛暟鍒楄〃閰嶇疆锛屼篃鍙湪鎸夐挳浣跨敤鏃堕厤缃�傚弬鏁颁俊鎭細
 >* type锛氬垱寤虹晫闈㈢殑涓氬姟绫诲瀷锛屽繀濉�
->* context锛氬垱寤虹晫闈㈢殑UI涓婁笅鏂囷紝鏈塮orm鍙傛暟鏃惰鍊兼棤鏁堛�傝嫢UI涓婁笅鏂囦粎閰嶆湁琛ㄥ崟灞曠ず锛屽垯娣诲姞寮圭獥浼氶粯璁ゆ湁淇濆瓨鎸夐挳
 >* form锛氭坊鍔犵殑琛ㄥ崟瀵硅薄锛屽繀椤昏閰嶇疆form鎴栬�卌ontext锛屼紭鍏堜娇鐢╢orm
+>* context锛氬垱寤虹晫闈㈢殑UI涓婁笅鏂囷紝鏈塮orm鍙傛暟鏃惰鍊兼棤鏁堛�傝嫢UI涓婁笅鏂囦粎閰嶆湁琛ㄥ崟灞曠ず锛屽垯娣诲姞寮圭獥浼氶粯璁ゆ湁淇濆瓨鎸夐挳
+>* useDataType锛氫娇鐢║I涓婁笅鏂囦腑鐨勫摢涓被鍨嬫暟鎹�,鍊兼湁form銆乼ree銆乼able銆乀reeTable锛屼笉濉椂榛樿涓篺orm
 >* initvalue锛氳〃鍗曢璁緑alue锛岄潪蹇呭~銆傛牸寮忕ず渚嬶細rootoid=root.${oid}&rootname=root.${name}&name=${name}銆乻ourceoid=sourceData.${oid}&sourcename=sourceData.${name}&oid=${oid}&name=${name}
 >* needselect锛氭槸鍚﹀繀椤婚�夋嫨鏁版嵁锛屼笌initvalue閰嶅悎浣跨敤銆�   
   鍊间负false鏃跺厑璁竔nitvalue瀵瑰簲鐨勫睘鎬у�间负绌恒��    
   鍊间负true鎴栬�呮湭閰嶇疆鍙傛暟鍒欏繀椤绘湁涓婁笅鏂囩殑sourceData鎴杁ataStore锛岀敤浠ヤ笌initvalue寤虹珛鏄犲皠鍏崇郴
-
+>* url: 鍒涘缓鐣岄潰鐨勪繚瀛樻寜閽姹傝矾寰勶紝榛樿'uiDataController/addSave'
+>* method: 鍒涘缓鐣岄潰鐨勪繚瀛樻寜閽姹傝矾寰勭被鍨嬶紝榛樿'post'
+>* uploadfileurl: 鏈夋枃浠朵笂浼犳椂鍙厤缃紝榛樿'vciFileUploadController/uploadFile'
+>* accept锛氭湁鏂囦欢涓婁紶鏃跺彲閰嶇疆
+>* exts锛氭湁鏂囦欢涓婁紶鏃跺彲閰嶇疆
+>* uploadattachment锛氭湁闄勪欢涓婁紶鏃堕』閰嶇疆锛屾槸鍚︽樉绀轰笂浼犻檮浠讹紝榛樿false
+>* preevent锛氬脊绐楀墠缃簨浠讹紝閰嶇疆鍓嶇疆浜嬩欢鐨刯s鍦板潃锛屽"preevent.js"銆佲�渪xx/preevent.js鈥濓紝鏂囦欢鏀惧湪src/components/actions涓�>* preevent锛氬脊绐楀墠缃簨浠讹紝閰嶇疆鍓嶇疆浜嬩欢鐨刯s鍦板潃锛屽"preevent.js"銆佲�渪xx/preevent.js鈥濓紝鏂囦欢鏀惧湪src/components/actions涓�
+>* afterevent锛氬脊绐楀悗缃簨浠讹紝閰嶇疆鍚庣疆浜嬩欢鐨刯s鍦板潃锛屽"afterevent.js"銆佲�渪xx/afterevent.js鈥濓紝鏂囦欢鏀惧湪src/components/actions涓�
+>*
 ### edit锛屼慨鏀�
+![Action/img_edit.png](Action/img_edit.png)
+>* type锛氫慨鏀圭晫闈㈢殑涓氬姟绫诲瀷锛屽繀濉�
+>* form锛氫慨鏀圭殑琛ㄥ崟瀵硅薄锛屽繀椤昏閰嶇疆form鎴栬�卌ontext锛屼紭鍏堜娇鐢╢orm
+>* context锛氫慨鏀圭晫闈㈢殑UI涓婁笅鏂囷紝鏈塮orm鍙傛暟鏃惰鍊兼棤鏁堛�傝嫢UI涓婁笅鏂囦粎閰嶆湁琛ㄥ崟灞曠ず锛屽垯淇敼寮圭獥浼氶粯璁ゆ湁淇濆瓨鎸夐挳
+>* useDataType锛氫娇鐢║I涓婁笅鏂囦腑鐨勫摢涓被鍨嬫暟鎹�,鍊兼湁form銆乼ree銆乼able銆乀reeTable锛屼笉濉椂榛樿涓篺orm
+>* initvalue锛氳〃鍗曢璁緑alue锛岄潪蹇呭~銆傛牸寮忕ず渚嬶細rootoid=root.${oid}&rootname=root.${name}&name=${name}銆乻ourceoid=sourceData.${oid}&sourcename=sourceData.${name}&oid=${oid}&name=${name}
+>* needselect锛氭槸鍚﹀繀椤婚�夋嫨鏁版嵁锛屼笌initvalue閰嶅悎浣跨敤銆�   
+   鍊间负false鏃跺厑璁竔nitvalue瀵瑰簲鐨勫睘鎬у�间负绌恒��    
+   鍊间负true鎴栬�呮湭閰嶇疆鍙傛暟鍒欏繀椤绘湁涓婁笅鏂囩殑sourceData鎴杁ataStore锛岀敤浠ヤ笌initvalue寤虹珛鏄犲皠鍏崇郴
+
 ### del锛屽垹闄�
+
 ### view锛屾煡鐪�
diff --git a/Source/ProjectWeb/src/configDoc/Action/img_edit.png b/Source/ProjectWeb/src/configDoc/Action/img_edit.png
new file mode 100644
index 0000000..de52bd7
--- /dev/null
+++ b/Source/ProjectWeb/src/configDoc/Action/img_edit.png
Binary files differ

--
Gitblit v1.9.3