From 4d13944afeb0e095dfedaf820a192f844f5f541a Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 15 十月 2021 12:11:01 +0800 Subject: [PATCH] 2021-10-15 --- src/menu/components/share/actioncomponent/formconfig.jsx | 260 +++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 207 insertions(+), 53 deletions(-) diff --git a/src/menu/components/share/actioncomponent/formconfig.jsx b/src/menu/components/share/actioncomponent/formconfig.jsx index b4a2e38..f7ff1d8 100644 --- a/src/menu/components/share/actioncomponent/formconfig.jsx +++ b/src/menu/components/share/actioncomponent/formconfig.jsx @@ -11,7 +11,11 @@ * @param {*} usefulFields 瀛樺偍杩囩▼鍙敤鐨勫紑濮嬪瓧娈� * @param {*} type 鎸夐挳绫诲瀷锛岀敤浜庡尯鍒嗗彲閫夌殑鎵撳紑鏂瑰紡 */ -export function getActionForm (card, functip, setting, usefulFields, type, menulist = [], modules = [], columns = []) { +export function getActionForm (card, functip, config, usefulFields, type, menulist = [], modules = []) { + let appType = sessionStorage.getItem('appType') + let viewType = sessionStorage.getItem('editMenuType') // 寮圭獥 popview + let setting = config.setting || {} + let columns = config.columns || [] let appMenus = [] let opentypes = [ { @@ -44,49 +48,90 @@ } ] + let getTabs = (list) => { + return list.filter(item => { + if (item.type !== 'tabs') return false + + item.children = item.children.map(cell => { + cell.children = getTabs(cell.children) + return cell + }) + return item + }) + } + + if (type === 'editable') { + opentypes = [ + { + value: 'excelIn', + text: Formdict['model.form.excelIn'] + }, { + value: 'excelOut', + text: Formdict['model.form.excelOut'] + } + ] + } + + let tabs = getTabs(JSON.parse(JSON.stringify(modules))) + 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')) + const isApp = ['pc', 'mob'].includes(appType) let funTypes = [ { value: 'changeuser', text: Formdict['header.form.func.changeuser'] }, - { value: 'print', text: '鏍囩鎵撳嵃' } + { value: 'print', text: '鏍囩鎵撳嵃' }, + { value: 'closetab', 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 { + } catch (e) { appMenus = [] } } else { appMenus = [] } + + if (appType === 'mob') { + opentypes = opentypes.filter(item => ['pop', 'prompt', 'exec', 'innerpage', 'funcbutton'].includes(item.value)) + funTypes = [ + { value: 'mkBinding', text: '寮�閫氭壂鐮佺櫥褰�' }, + { value: 'mkUnBinding', text: '鐢ㄦ埛瑙g粦' }, + { value: 'reAuth', text: '閲嶆柊鎺堟潈' }, + { value: 'goBack', text: '杩斿洖' }, + ] + pageTemps = [ + { value: 'linkpage', text: '鍏宠仈鑿滃崟' }, + // { value: 'pay', text: Formdict['model.pay'] }, + { value: 'custom', text: '閾炬帴' } + ] + } else { + pageTemps = [ + { value: 'linkpage', text: '鍏宠仈鑿滃崟' }, + { value: 'billprint', text: '鍗曟嵁鎵撳嵃' }, + { value: 'pay', text: Formdict['model.pay'] }, + { value: 'custom', text: '閾炬帴' } + ] + funTypes = [ + { value: 'changeuser', text: Formdict['header.form.func.changeuser'] }, + ] + opentypes = opentypes.filter(item => item.value !== 'tab') + } } - if (type === 'chart') { + if (type === 'chart' && appType !== 'mob') { opentypes = opentypes.filter(item => item.value === 'excelIn' || item.value === 'excelOut') } let refresh = [] - if (sessionStorage.getItem('editMenuType') === 'popview') { // 寮圭獥鏍囩 + if (viewType === 'popview') { // 寮圭獥鏍囩 opentypes = opentypes.filter(item => item.value !== 'popview' && item.value !== 'funcbutton') refresh.push({ value: 'popclose', @@ -104,10 +149,10 @@ options: opentypes }, { - type: 'radio', + type: 'select', key: 'funcType', label: Formdict['header.form.funcType'], - initVal: card.funcType || (isApp ? 'changeuser' : ''), + initVal: card.funcType || '', required: true, options: funTypes }, @@ -193,36 +238,14 @@ options: pageTemps }, { - type: 'radio', - key: 'open', - label: '閾炬帴鏂瑰紡', - initVal: card.open || 'blank', - required: true, - forbid: sessionStorage.getItem('appType') === 'pc', - options: [{ - value: 'blank', - text: '鏂扮獥鍙�' - }, { - value: 'self', - text: '褰撳墠绐楀彛' - }] - }, - { type: 'select', key: 'linkmenu', label: '鍏宠仈鑿滃崟', initVal: card.linkmenu || '', required: true, + forbid: !isApp, options: appMenus }, - // { - // type: 'select', - // key: 'copyMenuId', - // label: '澶嶅埗鑿滃崟', - // initVal: card.copyMenuId || '', - // required: false, - // options: appMenus - // }, { type: 'textarea', key: 'url', @@ -361,6 +384,9 @@ }, { value: 'mainline', text: '鍒锋柊涓婄骇缁勪欢 - 琛�' + }, { + value: !appType ? 'closetab' : 'goback', + text: !appType ? '鍏抽棴鏍囩' : '杩斿洖锛堜笂涓�涓〉闈級' }, ...refresh] }, @@ -429,7 +455,7 @@ { type: 'radio', key: 'show', - label: "鏄剧ず涓�", + label: '鏄剧ず涓�', initVal: card.show || 'button', required: true, options: [{ @@ -437,14 +463,32 @@ text: '鍥炬爣' }, { value: 'button', - text: '鎸夐挳' + text: '鍥炬爣+鏂囧瓧' }, { value: 'link', - text: '閾炬帴' + text: '鏂囧瓧+鍥炬爣' }] }, { - type: 'select', + type: 'radio', + key: 'swipe', + label: "婊戝姩鏄剧ず", + initVal: card.swipe || 'false', + required: false, + forbid: (type !== 'datacard' || appType !== 'mob'), + options: [{ + value: 'false', + text: '鍚�' + }, { + value: 'left', + text: '宸︽粦' + }, { + value: 'right', + text: '鍙虫粦' + }] + }, + { + type: 'icon', key: 'icon', label: Formdict['model.icon'], initVal: card.icon, @@ -456,6 +500,7 @@ key: 'class', label: Formdict['model.form.color'], initVal: card.class, + tooltip: '姝ら鑹蹭负鎸夐挳鍒濆鍖栭鑹诧紝鍙湪鏍峰紡璋冩暣涓慨鏀广��', required: false, options: [] }, @@ -509,12 +554,32 @@ }] }, { - type: 'mcascader', + type: 'cascader', key: 'syncComponent', - label: '鍚屾鍒锋柊', + label: '鍒锋柊缁勪欢', initVal: card.syncComponent || [], + tooltip: '鎵ц鎴愬姛鍚庯紝闇�瑕佸悓姝ュ埛鏂扮殑缁勪欢', required: false, options: modules + }, + { + type: 'cascader', + key: 'switchTab', + label: '鍒囨崲鏍囩', + initVal: card.switchTab || [], + tooltip: '鎵ц鎴愬姛鍚庯紝闇�瑕佸垏鎹㈢殑鏍囩椤�', + required: false, + options: tabs + }, + { + type: 'cascader', + key: 'refreshTab', + label: '鍒锋柊鑿滃崟', + initVal: card.refreshTab || [], + tooltip: '鎵ц鎴愬姛鍚庢垨鏍囩鍏抽棴鏃讹紝闇�瑕佸悓姝ュ埛鏂扮殑鑿滃崟', + required: false, + forbid: isApp || viewType === 'popview', + options: menulist }, { type: 'select', @@ -523,8 +588,8 @@ tooltip: '绂佺敤鎺у埗瀛楁锛屽彲鏍规嵁鏁版嵁鎺у埗鎸夐挳鏄惁绂佺敤銆�', initVal: card.controlField || '', required: false, - // forbid: card.$type !== 'tableButton', - options: [{label: '鏃�', field: ''}, ...columns] + allowClear: true, + options: columns }, { type: 'text', @@ -532,9 +597,98 @@ label: '鎺у埗鍊�', tooltip: '褰撻�夋嫨鎺у埗瀛楁锛屼笖瀛楁鍊间笌鎺у埗鍊肩浉绛夋椂锛屾寜閽細绂佺敤锛屽涓�肩敤閫楀彿鍒嗛殧銆�', initVal: card.controlVal || '', - // forbid: card.$type !== 'tableButton', required: false - } + }, + { + type: 'cascader', + key: 'linkmenu', + label: Formdict['model.form.linkmenu'], + initVal: card.linkmenu || [], + required: true, + forbid: isApp, + options: menulist + }, + { + type: !appType ? 'cascader' : 'select', + key: 'openmenu', + label: '鎵撳紑鑿滃崟', + tooltip: '鎵ц鎴愬姛鍚庨渶瑕佹墦寮�鐨勮彍鍗曘��', + initVal: card.openmenu || (!appType ? [] : ''), + required: false, + allowClear: true, + options: appType === 'mob' ? [...appMenus, {value: 'goback', text: '杩斿洖'}] : (appType === 'pc' ? appMenus : menulist), + forbid: viewType === 'popview' + }, + { + type: 'text', + key: 'output', + label: '杩斿洖鍊�', + tooltip: '鎵ц鎴愬姛鍚庣殑杩斿洖鍊笺��', + initVal: card.output || '', + required: false, + forbid: viewType === 'popview' + }, + { + type: 'radio', + key: 'open', + label: '鎵撳紑鏂瑰紡', + initVal: card.open || 'blank', + required: true, + forbid: appType !== 'pc', + options: [{ + value: 'blank', + text: '鏂扮獥鍙�' + }, { + value: 'self', + text: '褰撳墠绐楀彛' + }] + }, + { + type: 'radio', + key: 'display', + label: '鏄剧ず鏂瑰紡', + initVal: card.display || 'modal', + required: true, + options: [{ + value: 'modal', + text: '妯℃�佹' + }, { + value: 'drawer', + text: '鎶藉眽' + }] + }, + { + type: 'number', + key: 'ratio', + min: 1, + max: 24, + precision: 0, + label: '姣斾緥', + initVal: card.ratio || 85, + tooltip: '灏忎簬100涓哄搴︼紙鎴栭珮搴︼級鐧惧垎姣旓紝澶т簬100涓哄儚绱犲�笺��', + required: true + }, + { + type: 'radio', + key: 'placement', + label: '鎶藉眽鏂瑰悜', + initVal: card.placement || 'right', + tooltip: '浣跨敤鎶藉眽鏃舵湁鏁堛��', + required: false, + options: [{ + value: 'right', + text: '鍙充晶' + }, { + value: 'left', + text: '宸︿晶' + }, { + value: 'top', + text: '涓婁晶' + }, { + value: 'bottom', + text: '涓嬩晶' + }] + }, ] return forms -- Gitblit v1.8.0