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/EditAction.js |   50 ++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 40 insertions(+), 10 deletions(-)

diff --git a/Source/ProjectWeb/src/actions/base/EditAction.js b/Source/ProjectWeb/src/actions/base/EditAction.js
index 032d045..2c0e519 100644
--- a/Source/ProjectWeb/src/actions/base/EditAction.js
+++ b/Source/ProjectWeb/src/actions/base/EditAction.js
@@ -4,13 +4,13 @@
 import {paramLow,callPreEvent,callPostEvent} from './BaseAction';
 import {validatenull} from "@/util/validate";
 import Vue from "vue";
+import AddEditDialog from "@/components/actions/AddEditDialog";
 
-export const doAction = (options) => {
-  options.paramVOS = paramLow(options.paramVOS)
+export const doAction = (options,callback) => {
   const paramVOS = Object.assign({
-    getdataurl: 'uiDataController/dataFormQuery',
+    getdataurl: '/api/uiDataController/dataFormQuery',
     getdatamethod: 'post',
-    url: 'uiDataController/editSave',
+    url: '/api/uiDataController/editSave',
     method: 'put',
     uploadfileurl: 'vciFileUploadController/uploadFile'
   }, options.paramVOS)
@@ -26,9 +26,24 @@
     Vue.prototype.$message.error("浠呰兘閫夋嫨涓�鏉℃暟鎹潵鎿嶄綔");
     return false;
   }
+
+  if(!validatenull(paramVOS.checknotedit)) {
+    let notedit = paramVOS.checknotedit.split('&');
+    let checknotedit=false;
+    notedit.forEach((item,i)=>{
+      if (options.dataStore[0][item.split('=')[0]] == item.split('=')[1]) {
+        checknotedit=true;
+        return false;
+      }
+    })
+    if (checknotedit) {
+      Vue.prototype.$message.error(replaceFreeMarker(paramVOS.checknoteditmsg,options.dataStore,{}) || "褰撳墠鏁版嵁涓嶅厑璁镐慨鏀�");
+      return false;
+    }
+  }
   callPreEvent(options, doBefore, function (options) {
-    doAdd(options, function () {
-      callPostEvent(options, doAfter, options.callback);
+    doAdd(options, function (type,formData) {
+      callPostEvent(options, doAfter,type, callback);
     });
   });
 };
@@ -44,10 +59,25 @@
     Vue.prototype.$message.error("鎸夐挳閰嶇疆涓嶆纭�");
     return false;
   }
-  Vue.prototype.$message.success('鎵ц'+paramVOS.title);
+  const dialogConstructor = Vue.extend(AddEditDialog);
+  let instance = new dialogConstructor();
+  instance.sourceData = options.sourceData;
+  instance.dataStore = options.dataStore;
+  instance.paramVOS = paramVOS
+
+  instance.type = 'edit';
+  instance.dialogClose = function () {
+    vm.visible = false;
+    document.body.removeChild(vm.$el);
+    instance.$destroy();
+    instance = null;
+  };
   if (callback) {
-    callback(options);
+    instance.saveCallback = callback;
   }
+  let vm = instance.$mount();
+  document.body.appendChild(vm.$el);
+  instance.visible = true;
 }
 /**
  * 鍓嶇疆浜嬩欢
@@ -65,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);
   }
 }

--
Gitblit v1.9.3