From 29432c9167e3fcdf83f35d0bb9dbe9acb7c7ffbf Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 22 六月 2021 14:35:23 +0800 Subject: [PATCH] 2021-06-22 --- src/menu/components/share/actioncomponent/formconfig.jsx | 226 +++++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 182 insertions(+), 44 deletions(-) diff --git a/src/menu/components/share/actioncomponent/formconfig.jsx b/src/menu/components/share/actioncomponent/formconfig.jsx index 40b5761..b4a2e38 100644 --- a/src/menu/components/share/actioncomponent/formconfig.jsx +++ b/src/menu/components/share/actioncomponent/formconfig.jsx @@ -1,7 +1,7 @@ import zhCN from '@/locales/zh-CN/model.js' import enUS from '@/locales/en-US/model.js' -const Formdict = localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS +const Formdict = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS /** * @description 鑾峰彇鎸夐挳琛ㄥ崟閰嶇疆淇℃伅 @@ -11,7 +11,8 @@ * @param {*} usefulFields 瀛樺偍杩囩▼鍙敤鐨勫紑濮嬪瓧娈� * @param {*} type 鎸夐挳绫诲瀷锛岀敤浜庡尯鍒嗗彲閫夌殑鎵撳紑鏂瑰紡 */ -export function getActionForm (card, functip, setting, usefulFields, type, menulist = [], modules = []) { +export function getActionForm (card, functip, setting, usefulFields, type, menulist = [], modules = [], columns = []) { + let appMenus = [] let opentypes = [ { value: 'pop', @@ -43,16 +44,53 @@ } ] + let pageTemps = [ + { value: 'billprint', text: '鍗曟嵁鎵撳嵃' }, + { value: 'pay', text: Formdict['model.pay'] }, + { value: 'custom', text: Formdict['header.form.custom'] } + ] + const isApp = ['pc', 'mob'].includes(sessionStorage.getItem('appType')) + + let funTypes = [ + { value: 'changeuser', text: Formdict['header.form.func.changeuser'] }, + { value: 'print', text: '鏍囩鎵撳嵃' } + ] + + if (isApp) { + opentypes = opentypes.filter(item => item.value !== 'tab') + pageTemps = [ + // { value: 'page', text: '鑿滃崟' }, + { value: 'linkpage', text: '鍏宠仈鑿滃崟' }, + { value: 'billprint', text: '鍗曟嵁鎵撳嵃' }, + { value: 'pay', text: Formdict['model.pay'] }, + { value: 'custom', text: '閾炬帴' } + ] + funTypes = [ + { value: 'changeuser', text: Formdict['header.form.func.changeuser'] }, + ] + appMenus = sessionStorage.getItem('appMenus') + if (appMenus) { + try { + appMenus = JSON.parse(appMenus) + appMenus = appMenus.map(item => ({value: item.MenuID, text: item.MenuName})) + } catch { + appMenus = [] + } + } else { + appMenus = [] + } + } + if (type === 'chart') { opentypes = opentypes.filter(item => item.value === 'excelIn' || item.value === 'excelOut') } let refresh = [] if (sessionStorage.getItem('editMenuType') === 'popview') { // 寮圭獥鏍囩 - opentypes = opentypes.filter(item => item.value !== 'popview') + opentypes = opentypes.filter(item => item.value !== 'popview' && item.value !== 'funcbutton') refresh.push({ value: 'popclose', - text: '鏍囩鍏抽棴鍒锋柊' + text: '鏍囩鍒锋柊' }) } @@ -66,18 +104,12 @@ options: opentypes }, { - type: 'select', + type: 'radio', key: 'funcType', label: Formdict['header.form.funcType'], - initVal: card.funcType || 'print', + initVal: card.funcType || (isApp ? 'changeuser' : ''), required: true, - options: [{ - value: 'changeuser', - text: Formdict['header.form.func.changeuser'] - }, { - value: 'print', - text: '鏍囩鎵撳嵃' - }] + options: funTypes }, { type: 'select', @@ -102,23 +134,6 @@ label: Formdict['header.form.intertype'], initVal: card.intertype || 'system', required: true, - options: [{ - value: 'system', - text: '绯荤粺' - }, { - value: 'inner', - text: Formdict['model.interface.inner'] - }, { - value: 'outer', - text: Formdict['model.interface.outer'] - }] - }, - { - type: 'select', - key: 'sqlType', - label: Formdict['header.form.action.type'], - initVal: card.sqlType || '', - required: true, options: [] }, { @@ -128,6 +143,28 @@ initVal: card.label, required: true, readonly: false + }, + { + type: 'radio', + key: 'procMode', + label: '鍙傛暟澶勭悊', + initVal: card.procMode || 'system', + required: true, + options: [{ + value: 'system', + text: '绯荤粺鍑芥暟' + }, { + value: 'inner', + text: '鍐呴儴鍑芥暟' + }] + }, + { + type: 'radio', + key: 'sqlType', + label: Formdict['header.form.action.type'], + initVal: card.sqlType || '', + required: true, + options: [] }, { type: 'text', @@ -153,21 +190,43 @@ label: Formdict['model.form.newpage.type'], initVal: card.pageTemplate || '', required: true, + options: pageTemps + }, + { + type: 'radio', + key: 'open', + label: '閾炬帴鏂瑰紡', + initVal: card.open || 'blank', + required: true, + forbid: sessionStorage.getItem('appType') === 'pc', options: [{ - value: 'billprint', - text: '鍗曟嵁鎵撳嵃' + value: 'blank', + text: '鏂扮獥鍙�' }, { - value: 'pay', - text: Formdict['model.pay'] - }, { - value: 'custom', - text: Formdict['header.form.custom'] + value: 'self', + text: '褰撳墠绐楀彛' }] }, { - type: 'text', + type: 'select', + key: 'linkmenu', + label: '鍏宠仈鑿滃崟', + initVal: card.linkmenu || '', + required: true, + options: appMenus + }, + // { + // type: 'select', + // key: 'copyMenuId', + // label: '澶嶅埗鑿滃崟', + // initVal: card.copyMenuId || '', + // required: false, + // options: appMenus + // }, + { + type: 'textarea', key: 'url', - label: Formdict['model.form.newpage.url'], + label: Formdict['model.pageUrl'], initVal: card.url || '', required: true }, @@ -194,12 +253,71 @@ readonly: false }, { - type: 'text', + type: 'textarea', key: 'interface', - label: Formdict['header.form.interface'], + label: '娴嬭瘯鍦板潃', initVal: card.sysInterface === 'true' ? (window.GLOB.mainSystemApi || '') : (card.interface || ''), required: true, readonly: card.sysInterface === 'true' + }, + { + type: 'textarea', + key: 'proInterface', + label: '姝e紡鍦板潃', + initVal: card.proInterface || '', + tooltip: '姝e紡绯荤粺鎵�浣跨敤鐨勬帴鍙e湴鍧�銆�', + required: false + }, + { + type: 'radio', + key: 'method', + label: '璇锋眰鏂瑰紡', + initVal: card.method || 'post', + required: true, + options: [{ + value: 'get', + text: 'GET' + }, { + value: 'post', + text: 'POST' + }] + }, + { + type: 'radio', + key: 'cross', + label: '璺ㄥ煙璇锋眰', + initVal: card.cross || 'true', + tooltip: '濡傛灉鑷畾涔夋帴鍙d笉鏀寔璺ㄥ煙璇锋眰锛屼細閫氳繃褰撳墠绯荤粺杞彂銆�', + required: false, + options: [{ + value: 'true', + text: '鏀寔' + }, { + value: 'false', + text: '涓嶆敮鎸�' + }] + }, + { + type: 'radio', + key: 'callbackType', + label: '鍥炶皟鏂瑰紡', + initVal: card.callbackType || 'script', + tooltip: '浣跨敤鍚庡彴鑴氭湰鎵ц鏃讹紝闇�瑕侀厤鍚堣鍒掍换鍔°��', + required: true, + options: [{ + value: 'script', + text: '鑷畾涔夎剼鏈�' + }, { + value: 'default', + text: '鍚庡彴鑴氭湰' + }] + }, + { + type: 'text', + key: 'cbTable', + label: '鍥炶皟琛ㄥ悕', + initVal: card.cbTable || '', + required: true }, { type: 'text', @@ -224,6 +342,7 @@ label: Formdict['model.form.linkmenu'], initVal: card.linkmenu || [], required: true, + forbid: isApp, options: menulist }, { @@ -231,7 +350,7 @@ key: 'execSuccess', label: Formdict['model.form.afterSuccess'], initVal: card.execSuccess || 'never', - tooltip: refresh.length ? '鎵ц鏍囩鍏抽棴鍒锋柊鏃讹紝浼氬悓姝ュ埛鏂板綋鍓嶇粍浠跺拰涓婄骇缁勪欢-琛屻��' : '鍒锋柊涓婄骇缁勪欢-琛屾椂锛屼細鍚屾鍒锋柊褰撳墠缁勪欢锛屾敞锛氫笂绾х粍浠跺湪鏁版嵁婧愪腑娣诲姞銆�', + tooltip: refresh.length ? '鎵ц鏍囩鍒锋柊鏃讹紝浼氬悓姝ュ埛鏂板綋鍓嶇粍浠跺拰涓婄骇缁勪欢-琛屻��' : '鍒锋柊涓婄骇缁勪欢-琛屾椂锛屼細鍚屾鍒锋柊褰撳墠缁勪欢锛屾敞锛氫笂绾х粍浠跺湪鏁版嵁婧愪腑娣诲姞銆�', required: true, options: [{ value: 'never', @@ -308,10 +427,10 @@ required: true }, { - type: 'select', + type: 'radio', key: 'show', label: "鏄剧ず涓�", - initVal: card.show || 'icon', + initVal: card.show || 'button', required: true, options: [{ value: 'icon', @@ -396,6 +515,25 @@ initVal: card.syncComponent || [], required: false, options: modules + }, + { + type: 'select', + key: 'controlField', + label: '鎺у埗瀛楁', + tooltip: '绂佺敤鎺у埗瀛楁锛屽彲鏍规嵁鏁版嵁鎺у埗鎸夐挳鏄惁绂佺敤銆�', + initVal: card.controlField || '', + required: false, + // forbid: card.$type !== 'tableButton', + options: [{label: '鏃�', field: ''}, ...columns] + }, + { + type: 'text', + key: 'controlVal', + label: '鎺у埗鍊�', + tooltip: '褰撻�夋嫨鎺у埗瀛楁锛屼笖瀛楁鍊间笌鎺у埗鍊肩浉绛夋椂锛屾寜閽細绂佺敤锛屽涓�肩敤閫楀彿鍒嗛殧銆�', + initVal: card.controlVal || '', + // forbid: card.$type !== 'tableButton', + required: false } ] -- Gitblit v1.8.0