From 1b2642c615001b3435a9e99e478517a917f656af Mon Sep 17 00:00:00 2001
From: yuxc <yuxc@vci-tech.com>
Date: 星期五, 26 四月 2024 17:27:11 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
Source/ProjectWeb/src/actions/base/BaseAction.js | 45 ++++++++++++++++++++++++++++-----------------
1 files changed, 28 insertions(+), 17 deletions(-)
diff --git a/Source/ProjectWeb/src/actions/base/BaseAction.js b/Source/ProjectWeb/src/actions/base/BaseAction.js
index e2583fe..93c5db0 100644
--- a/Source/ProjectWeb/src/actions/base/BaseAction.js
+++ b/Source/ProjectWeb/src/actions/base/BaseAction.js
@@ -1,4 +1,5 @@
import {validatenull} from "@/util/validate";
+import Vue from 'vue';
/**
* 鎸夐挳鐨勫熀纭�鏈嶅姟
@@ -8,24 +9,38 @@
* action閫氱敤鍏ュ彛
*/
export const doAction = (button,options) => {
- debugger;
+ options.paramVOS['title']=replaceFreeMarker(options.paramVOS.title,options.dataStore,options.sourceData);
+
if(button.url && button.url!='null'){
- let buttonParse = parseEventByUrl(button.url,options,false);
- import("../"+buttonParse.jsPath).then(module => {
+ //鏈夐厤缃產ction璺緞锛屼娇鐢ㄨ矾寰勫搴旂殑js
+ import("../"+button.url+".js").then(module => {
module.doAction(options);
})
}else {
+ //閫氱敤action
const handlers = {
+ //鏌ョ湅
+ view: () => {},
+ //鍒涘缓
add: () => {import("@/actions/base/AddAction").then(module => {
module.doAction(options);
})},
- edit: () => {},
- delete: () => {},
+ //淇敼
+ edit: () => {import("@/actions/base/EditAction").then(module => {
+ module.doAction(options);
+ })},
+ //鍒犻櫎
+ delete: () => {import("@/actions/base/DeleteAction").then(module => {
+ module.doAction(options);
+ })},
};
- if(handlers[button.actionVO.id]){
- handlers[button.actionVO.id]()
+ if(validatenull(options.paramVOS.context)) {
+ options.paramVOS.context = options.paramVOS.content;
+ }
+ if(handlers[button.actionVO.id.toLowerCase()]){
+ handlers[button.actionVO.id.toLowerCase()]()
}else{
- this.$message.error('鏈壘鍒板搴攁ction锛岃閲嶆柊閰嶇疆鎸夐挳锛�');
+ Vue.prototype.$message.error('鏈壘鍒板搴攁ction锛岃閲嶆柊閰嶇疆鎸夐挳锛�');
}
}
@@ -102,9 +117,7 @@
* @param preEventName 鍓嶇疆浜嬩欢鍚嶇О锛岄粯璁eforeevent
*/
export const callPreEvent = (options,fnTarget,callback,preEventName) => {
- const params = paramLow(options.paramVOS);
- options.paramVOS = params;
- let beforeEvent = params[preEventName || 'beforeevent'];
+ let beforeEvent = options.paramVOS[preEventName || 'beforeevent'];
if(beforeEvent) {
let buttonParse = parseEventByUrl(beforeEvent,options,true);
if(validatenull(buttonParse.jsPath)){
@@ -115,7 +128,7 @@
module[buttonParse.methodName](options,callback);
})
} catch (error) {
- this.$message.error('鏈壘鍒板墠缃簨浠舵墽琛宩s');
+ Vue.prototype.$message.error('鏈壘鍒板墠缃簨浠舵墽琛宩s');
}
}
}else{
@@ -132,9 +145,7 @@
* @param preEventName 鍚庣疆浜嬩欢鍚嶇О锛岄粯璁� afterevent
*/
export const callPostEvent = (options,fnTarget,callback,postEventName)=>{
- const params = paramLow(options.paramVOS);
- options.paramVOS = params;
- let afterEvent = params[postEventName || 'afterevent'];
+ let afterEvent = options.paramVOS[postEventName || 'afterevent'];
if(afterEvent) {
let buttonParse = parseEventByUrl(afterEvent,options,false);
if(validatenull(buttonParse.jsPath)){
@@ -145,7 +156,7 @@
module[buttonParse.methodName](options,callback);
})
} catch (error) {
- this.$message.error('鏈壘鍒板悗缃簨浠舵墽琛宩s');
+ Vue.prototype.$message.error('鏈壘鍒板悗缃簨浠舵墽琛宩s');
}
}
}else{
@@ -182,7 +193,7 @@
let paramArray = url.substring(url.indexOf("?") + 1).split("&");
paramArray.forEach(_item=>{
if (_item.indexOf("=") < 0) {
- this.$message.error(isBefore?"鍓嶇疆浜嬩欢":"鍚庣疆浜嬩欢" + "鐨勫弬鏁伴厤缃敊璇紝闇�瑕佽xxx=yyy&zzz=a鐨勬柟寮�");
+ Vue.prototype.$message.error(isBefore?"鍓嶇疆浜嬩欢":"鍚庣疆浜嬩欢" + "鐨勫弬鏁伴厤缃敊璇紝闇�瑕佽xxx=yyy&zzz=a鐨勬柟寮�");
return true;
}
params[_item.split("=")[0]] = _item.split("=")[1];
--
Gitblit v1.9.3