From e330c3130c9eb0d7a10e1fe65885e5466263471e Mon Sep 17 00:00:00 2001 From: wangting <675591594@qq.com> Date: 星期二, 14 五月 2024 11:43:26 +0800 Subject: [PATCH] 调整参数,配置文档 --- Source/ProjectWeb/src/components/actions/base/BaseAction.js | 65 ++++++++++---------------------- 1 files changed, 21 insertions(+), 44 deletions(-) diff --git a/Source/ProjectWeb/src/components/actions/base/BaseAction.js b/Source/ProjectWeb/src/components/actions/base/BaseAction.js index 732231c..b560c29 100644 --- a/Source/ProjectWeb/src/components/actions/base/BaseAction.js +++ b/Source/ProjectWeb/src/components/actions/base/BaseAction.js @@ -1,5 +1,6 @@ import {validatenull} from "@/util/validate"; import Vue from 'vue'; +import {handlers} from '../handlers'; /** * 鎸夐挳鐨勫熀纭�鏈嶅姟 @@ -10,30 +11,30 @@ */ export const doAction = (button,options,callback) => { options.paramVOS = paramLow(options.paramVOS) - options.paramVOS['title']=replaceFreeMarker(options.paramVOS.title,options.dataStore,options.sourceData); + options.paramVOS['title'] = replaceFreeMarker(options.paramVOS.title, options.dataStore, options.sourceData); let isShow = true; - if (options.paramVOS['initvalue'] && typeof(options.paramVOS.initvalue)=='string') { + if (options.paramVOS['initvalue'] && typeof (options.paramVOS.initvalue) == 'string') { let values = options.paramVOS['initvalue'].split(';'); let initValues = {} - values.forEach((item,i) => { - if(isShow){ + values.forEach((item, i) => { + if (isShow) { item = item.replace(':', '='); if (item.indexOf('${') > -1) { if (item.split('=')[1].indexOf('.') > -1) { //initvaluenull=true鍏佽鍒濆鍊间负绌� - if ((options.sourceData.length < 1 || !options.sourceData.oid) && options.paramVOS['initvaluenull']!=true && options.paramVOS['initvaluenull']!="true") { + if ((options.sourceData.length < 1 || !options.sourceData.oid) && options.paramVOS['needselect'] != false && options.paramVOS['needselect'] != "false") { isShow = false; Vue.prototype.$message.error("璇峰厛閫夋嫨涓�鏉℃潵婧愭暟鎹�") return false; } let name = item.split('=')[1].split('.')[1].replace('${', '').replace('}', ''); - if(options.sourceData){ + if (options.sourceData) { initValues[item.split('=')[0]] = options.sourceData[name] - }else { - initValues[item.split('=')[0]]="" + } else { + initValues[item.split('=')[0]] = "" } } else { - if (options.dataStore.length < 1 && options.paramVOS['initvaluenull'] != true && options.paramVOS['initvaluenull'] != "true") { + if (options.dataStore.length < 1 && options.paramVOS['needselect'] != false && options.paramVOS['needselect'] != "false") { isShow = false; Vue.prototype.$message.error("璇峰厛閫夋嫨涓�鏉℃暟鎹�"); return false; @@ -48,52 +49,28 @@ } } }) - if(isShow){ + if (isShow) { options.paramVOS['initvalue'] = initValues } } - if(!isShow){ + if (!isShow) { return; } - - if(button.url && button.url!='null'){ + if (validatenull(options.paramVOS.context)) { + options.paramVOS.context = options.paramVOS.content; + } + if (button.url && button.url != 'null') { //鏈夐厤缃產ction璺緞锛屼娇鐢ㄨ矾寰勫搴旂殑js - import("../"+button.url+".js").then(module => { - module.doAction(options,callback); + import("../" + button.url + ".js").then(module => { + module.doAction(options, callback); }) - }else { - //閫氱敤action - const handlers = { - //鏌ョ湅 - view: () => {import("@/components/actions/base/TabViewAction").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(validatenull(options.paramVOS.context)) { - options.paramVOS.context = options.paramVOS.content; - } - if(handlers[button.actionVO.id.toLowerCase()]){ + } else { + if (handlers[button.actionVO.id.toLowerCase()]) { handlers[button.actionVO.id.toLowerCase()]() - }else{ + } else { Vue.prototype.$message.error('鏈壘鍒板搴攁ction锛岃閲嶆柊閰嶇疆鎸夐挳锛�'); } } - }; -- Gitblit v1.9.3