From cb9ade2afd2a367ad767bc605ab7086c695dd010 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 09 十二月 2022 15:53:32 +0800 Subject: [PATCH] 2022-12-09 --- src/menu/components/share/actioncomponent/formconfig.jsx | 1122 ++++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 1,000 insertions(+), 122 deletions(-) diff --git a/src/menu/components/share/actioncomponent/formconfig.jsx b/src/menu/components/share/actioncomponent/formconfig.jsx index 171b5ef..ae79d94 100644 --- a/src/menu/components/share/actioncomponent/formconfig.jsx +++ b/src/menu/components/share/actioncomponent/formconfig.jsx @@ -1,8 +1,5 @@ -import zhCN from '@/locales/zh-CN/model.js' -import enUS from '@/locales/en-US/model.js' -import { btnCustomClasses } from '@/utils/option.js' +import { btnCustomClasses, btnClasses } from '@/utils/option.js' -const Formdict = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS /** * @description 鑾峰彇鎸夐挳琛ㄥ崟閰嶇疆淇℃伅 @@ -12,7 +9,7 @@ * @param {*} usefulFields 瀛樺偍杩囩▼鍙敤鐨勫紑濮嬪瓧娈� * @param {*} type 鎸夐挳绫诲瀷锛岀敤浜庡尯鍒嗗彲閫夌殑鎵撳紑鏂瑰紡 */ -export function getActionForm (card, functip, config, usefulFields, type, menulist = [], modules = []) { +export function getActionForm (card, functip, config, usefulFields, modules = [], anchors = []) { let appType = sessionStorage.getItem('appType') let viewType = sessionStorage.getItem('editMenuType') // 寮圭獥 popview let printTemps = sessionStorage.getItem('printTemps') @@ -20,74 +17,89 @@ let setting = config.setting || {} let columns = config.columns || [] let appMenus = [] + let menulist = [] + let type = '' + + if (card.eleType === 'button') { + type = 'card' + } else if (config.subtype === 'datacard' || config.subtype === 'tablecard') { + type = 'datacard' + } else if (config.type === 'line' || config.type === 'bar' || config.type === 'scatter') { + type = 'chart' + } + let opentypes = [ { value: 'pop', - text: Formdict['model.form.popform'] + text: '寮圭獥锛堣〃鍗曪級' }, { value: 'prompt', - text: Formdict['model.form.prompt'] + text: '鎻愮ず妗�' }, { value: 'exec', - text: Formdict['model.form.exec'] + text: '鐩存帴鎵ц' }, { value: 'excelIn', - text: Formdict['model.form.excelIn'] + text: '瀵煎叆Excel' }, { value: 'excelOut', - text: Formdict['model.form.excelOut'] + text: '瀵煎嚭Excel' }, { value: 'popview', - text: Formdict['model.form.popview'] + text: '寮圭獥锛堟爣绛撅級' }, { value: 'tab', - text: Formdict['model.form.tab'] + text: '鏍囩椤�' }, { value: 'innerpage', - text: Formdict['model.form.newpage'] + text: '鏂伴〉闈�' }, { value: 'funcbutton', - text: Formdict['model.form.funcbutton'] + text: '鍔熻兘鎸夐挳' } ] let getTabs = (list) => { - return list.filter(item => { - if (item.type !== 'tabs') return false + let _list = [] + list.forEach(item => { + if (item.type !== 'tabs') return - item.children = item.children.map(cell => { - cell.children = getTabs(cell.children) - return cell + _list.push({ + value: item.uuid, + label: item.name, + children: item.subtabs.map(cell => { + let children = getTabs(cell.components) + + if (children.length === 0) { + children = null + } + return { + value: cell.uuid, + label: cell.label, + children: children + } + }) }) - return item }) + return _list } - // 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 tabs = getTabs(JSON.parse(JSON.stringify(window.GLOB.customMenu.components))) let pageTemps = [ { value: 'billprint', text: '鍗曟嵁鎵撳嵃' }, - { value: 'pay', text: Formdict['model.pay'] }, - { value: 'custom', text: Formdict['header.form.custom'] } + { value: 'pay', text: '鏀粯' }, + { value: 'custom', text: '鑷畾涔�' } ] const isApp = ['pc', 'mob'].includes(appType) let funTypes = [ - { value: 'changeuser', text: '鍒囨崲鐢ㄦ埛' }, { value: 'print', text: '鏍囩鎵撳嵃' }, + { value: 'refund', text: '閫�娆�' }, { value: 'closetab', text: '鏍囩鍏抽棴' }, + { value: 'changeuser', text: '鍒囨崲鐢ㄦ埛' }, + { value: 'megvii', text: '鏃疯闈㈡澘鏈�' }, + { value: 'filezip', text: '鏂囦欢鍘嬬缉鍖�' }, ] if (isApp) { @@ -101,18 +113,32 @@ } else { appMenus = [] } + } else { + menulist = sessionStorage.getItem('fstMenuList') + if (menulist) { + try { + menulist = JSON.parse(menulist) + } catch (e) { + menulist = [] + } + } else { + menulist = [] + } } if (appType === 'mob') { - opentypes = opentypes.filter(item => ['pop', 'prompt', 'exec', 'innerpage', 'funcbutton'].includes(item.value)) + opentypes = opentypes.filter(item => ['pop', 'prompt', 'exec', 'excelOut', 'innerpage', 'funcbutton'].includes(item.value)) funTypes = [ { value: 'scan', text: '鎵爜' }, - { value: 'logout', text: '閫�鍑�' }, + { value: 'pay', text: '鏀粯' }, + { value: 'refund', text: '閫�娆�' }, + { value: 'resetPwd', text: '淇敼瀵嗙爜'}, { value: 'mkBinding', text: '寮�閫氭壂鐮佺櫥褰�' }, { value: 'mkUnBinding', text: '鐢ㄦ埛瑙g粦' }, { value: 'mkUnsubscribe', text: '娉ㄩ攢璐︽埛' }, { value: 'reAuth', text: '鍒囨崲绯荤粺锛堟竻绌虹紦瀛�-灏忕▼搴忥級' }, + { value: 'copyurl', text: '澶嶅埗閾炬帴鍦板潃' }, + { value: 'logout', text: '閫�鍑�' }, { value: 'goBack', text: '杩斿洖' }, - // { value: 'megvii', text: '鏃疯闈㈡澘鏈�' }, ] pageTemps = [ { value: 'linkpage', text: '鍏宠仈鑿滃崟' }, @@ -121,18 +147,23 @@ } else if (appType === 'pc') { opentypes = opentypes.filter(item => item.value !== 'tab') funTypes = [ + { value: 'refund', text: '閫�娆�' }, { value: 'changeuser', text: '鍒囨崲鐢ㄦ埛' }, ] pageTemps = [ { value: 'linkpage', text: '鍏宠仈鑿滃崟' }, { value: 'billprint', text: '鍗曟嵁鎵撳嵃' }, - { value: 'pay', text: Formdict['model.pay'] }, + { value: 'pay', text: '鏀粯' }, { value: 'custom', text: '閾炬帴' } ] } if (type === 'chart' && appType !== 'mob') { opentypes = opentypes.filter(item => item.value === 'excelIn' || item.value === 'excelOut') + + if (card.OpenType !== 'excelIn' && card.OpenType !== 'excelOut') { // 鎷栨嫿娣诲姞绫诲瀷杞崲 + card.OpenType = 'excelOut' + } } let refresh = [] @@ -151,8 +182,10 @@ if (type === 'card') { opentypes.push({ value: 'form', - text: '琛ㄥ崟锛堝紑鍏虫垨鍕鹃�夋锛�' + text: '琛ㄥ崟' }) + } else if (card.OpenType === 'form') { // 鎷栨嫿娣诲姞绫诲瀷杞崲 + card.OpenType = 'pop' } if (!card.control && card.controlField) { @@ -162,14 +195,44 @@ card.control = '' } + if (card.execSuccess === 'goback') { + card.openmenu = 'goback' + card.execSuccess = 'never' + } + + let closetab = [] + if (!appType && viewType !== 'popview') { + closetab = [{ + value: 'closetab', + text: '鍏抽棴鏍囩' + }] + } + + let formTypes = [] + if (appType === 'mob') { + formTypes = [{ + value: 'scan', + text: '鎵弿' + }] + } else if (card.formType === 'scan') { + card.formType = 'switch' + } + let forms = [ { type: 'select', key: 'OpenType', - label: Formdict['header.form.openType'], + label: '鎵撳紑鏂瑰紡', initVal: card.OpenType, required: true, options: opentypes + }, + { + type: 'text', + key: 'label', + label: '鎸夐挳鍚嶇О', + initVal: card.label, + required: true, }, { type: 'select', @@ -179,16 +242,16 @@ required: true, options: funTypes }, - // { - // type: 'select', - // key: 'subFunc', - // label: '鎺ュ彛鍚嶇О', - // initVal: card.subFunc || '', - // required: true, - // options: [ - // { value: 'login', text: '鐧诲綍' } - // ] - // }, + { + type: 'radio', + key: 'subFunc', + label: '鎺ュ彛鍚嶇О', + initVal: card.subFunc || 'addUser', + required: true, + options: [ + { value: 'addUser', text: '娣诲姞鐢ㄦ埛' }, + ] + }, { type: 'radio', key: 'formType', @@ -201,45 +264,53 @@ }, { value: 'radio', text: '鍕鹃�夋' - }] + }, + ...formTypes] }, { type: 'select', key: 'execMode', - label: Formdict['model.form.execMode'], + label: '鎵ц鏂瑰紡', initVal: card.execMode || 'exec', required: true, options: [{ value: 'exec', - text: Formdict['model.form.exec'] + text: '鐩存帴鎵ц' }, { value: 'prompt', - text: Formdict['model.form.prompt'] + text: '鎻愮ず妗�' }, { value: 'pop', - text: Formdict['model.form.popform'] + text: '寮圭獥锛堣〃鍗曪級' }] }, { type: 'radio', key: 'intertype', - label: Formdict['header.form.intertype'], + label: '鎺ュ彛绫诲瀷', initVal: card.intertype || 'system', required: true, options: [] }, { - type: 'text', - key: 'label', - label: '鎸夐挳鍚嶇О', - initVal: card.label, + type: 'checkbox', + key: 'payType', + label: '鏀粯鏂瑰紡', + initVal: card.payType || [], required: true, + options: [{ + value: 'wxpay', + text: '寰俊' + // }, { + // value: 'alipay', + // text: '鏀粯瀹�' + }] }, { type: 'radio', key: 'procMode', label: '鍙傛暟澶勭悊', - initVal: card.procMode || 'system', + initVal: card.procMode || (card.innerFunc ? 'inner' : 'system'), required: true, options: [{ value: 'system', @@ -247,12 +318,15 @@ }, { value: 'inner', text: '鍐呴儴鍑芥暟' + }, { + value: 'none', + text: '鏃�' }] }, { type: 'radio', key: 'sqlType', - label: Formdict['header.form.action.type'], + label: '鎿嶄綔绫诲瀷', initVal: card.sqlType || '', required: true, options: [] @@ -260,23 +334,32 @@ { type: 'text', key: 'sql', - label: Formdict['model.form.tablename'], + label: '琛ㄥ悕', initVal: card.sql || setting.tableName || '', required: true }, { type: 'text', key: 'innerFunc', - label: Formdict['header.form.innerFunc'], + label: '鍐呴儴鍑芥暟', initVal: card.innerFunc || '', tooltip: functip, fields: usefulFields, required: false, }, { + type: 'text', + key: 'urlkey', + label: '鍦板潃瀛楁', + initVal: card.urlkey || '', + tooltip: '鍥剧墖锛堟枃浠讹級閾炬帴鐨勫瓧娈靛悕銆�', + required: false, + readonly: false + }, + { type: 'select', key: 'pageTemplate', - label: Formdict['model.form.newpage.type'], + label: '椤甸潰绫诲瀷', initVal: card.pageTemplate || '', required: true, options: pageTemps @@ -301,28 +384,32 @@ { type: 'textarea', key: 'url', - label: Formdict['model.pageUrl'], + label: '椤甸潰鍦板潃', initVal: card.url || '', required: true }, { type: 'radio', key: 'sysInterface', - label: Formdict['header.form.sysInterface'], + label: '绯荤粺绫诲瀷', initVal: card.sysInterface || 'false', + tooltip: '涓氬姟绯荤粺鎸囧悓涓�sso涓嬬殑鍏朵粬涓氬姟绯荤粺锛屽閮ㄧ郴缁熸寚涓嶅悓sso涓嬬殑鍏朵粬涓氬姟绯荤粺銆�', required: true, options: [{ - value: 'true', - text: Formdict['model.true'] - }, { value: 'false', - text: Formdict['model.false'] + text: '涓氬姟' + }, { + value: 'true', + text: '鍗曠偣' + }, { + value: 'external', + text: '澶栭儴' }] }, { type: 'text', key: 'outerFunc', - label: Formdict['header.form.outerFunc'], + label: '澶栭儴鍑芥暟', initVal: card.outerFunc || '', required: false, }, @@ -339,6 +426,21 @@ key: 'proInterface', label: '姝e紡鍦板潃', initVal: card.proInterface || '', + tooltip: '姝e紡绯荤粺鎵�浣跨敤鐨勬帴鍙e湴鍧�銆�', + required: false + }, + { + type: 'keyinterface', + key: 'exInterface', + label: '娴嬭瘯鍦板潃', + initVal: card.exInterface || '', + required: true + }, + { + type: 'keyinterface', + key: 'exProInterface', + label: '姝e紡鍦板潃', + initVal: card.exProInterface || '', tooltip: '姝e紡绯荤粺鎵�浣跨敤鐨勬帴鍙e湴鍧�銆�', required: false }, @@ -375,7 +477,7 @@ type: 'radio', key: 'callbackType', label: '鍥炶皟鏂瑰紡', - initVal: card.callbackType || 'script', + initVal: card.callbackType || (card.callbackFunc ? 'func' : 'none'), tooltip: '浣跨敤鍚庡彴鑴氭湰鎵ц鏃讹紝闇�瑕侀厤鍚堣鍒掍换鍔°��', required: true, options: [{ @@ -384,6 +486,12 @@ }, { value: 'default', text: '鍚庡彴鑴氭湰' + }, { + value: 'func', + text: '鍥炶皟鍑芥暟' + }, { + value: 'none', + text: '鏃�' }] }, { @@ -396,14 +504,14 @@ { type: 'text', key: 'callbackFunc', - label: Formdict['header.form.callbackFunc'], + label: '鍥炶皟鍑芥暟', initVal: card.callbackFunc || '', - required: false, + required: true }, { type: 'select', key: 'Ot', - label: Formdict['header.form.isRequired'], + label: '琛岃缃�', initVal: card.Ot || (card.sqlType === 'insert' ? 'notRequired' : 'requiredSgl'), required: true, options: [] @@ -411,13 +519,13 @@ { type: 'select', key: 'execSuccess', - label: Formdict['model.form.afterSuccess'], + label: '鎴愬姛鍚�', initVal: card.execSuccess || 'grid', tooltip: refresh.length ? '鎵ц鍒锋柊婧愮粍浠舵椂锛岃鍦ㄦ簮鎸夐挳涓缃叧闂悗鍒锋柊閭d竴椤癸紝娉細姝ゆ椂浼氬悓姝ュ埛鏂板綋鍓嶇粍浠跺拰涓婄骇缁勪欢-琛屻��' : '閫夋嫨鍒锋柊琛屾椂锛屽鏋滈�夋嫨澶氭潯鏁版嵁浼氬埛鏂拌〃鏍笺�傛敞锛氫笂绾х粍浠跺湪鏁版嵁婧愪腑娣诲姞銆�', required: true, options: [{ value: 'never', - text: Formdict['header.form.refresh.never'] + text: '涓嶅埛鏂�' }, { value: 'line', text: '鍒锋柊琛�' @@ -427,22 +535,20 @@ }, { value: 'mainline', text: '鍒锋柊涓婄骇缁勪欢 - 琛�' - }, { - value: !appType ? 'closetab' : 'goback', - text: !appType ? '鍏抽棴鏍囩' : '杩斿洖锛堜笂涓�涓〉闈級' - }, + }, + ...closetab, ...refresh] }, { type: 'select', key: 'execError', - label: Formdict['model.form.afterError'], + label: '澶辫触鍚�', initVal: card.execError || 'never', tooltip: refresh.length ? '鎵ц鍒锋柊婧愮粍浠舵椂锛岃鍦ㄦ簮鎸夐挳涓缃叧闂悗鍒锋柊閭d竴椤癸紝娉細姝ゆ椂浼氬悓姝ュ埛鏂板綋鍓嶇粍浠跺拰涓婄骇缁勪欢-琛屻��' : '閫夋嫨鍒锋柊琛屾椂锛屽鏋滈�夋嫨澶氭潯鏁版嵁浼氬埛鏂拌〃鏍硷紝娉細涓婄骇缁勪欢鍦ㄦ暟鎹簮涓坊鍔犮��', required: true, options: [{ value: 'never', - text: Formdict['header.form.refresh.never'] + text: '涓嶅埛鏂�' }, { value: 'line', text: '鍒锋柊琛�' @@ -458,12 +564,12 @@ { type: 'select', key: 'popClose', - label: Formdict['header.form.popClose'], + label: '鍏抽棴鍚�', initVal: card.popClose || 'never', required: true, options: [{ value: 'never', - text: Formdict['header.form.refresh.never'] + text: '涓嶅埛鏂�' }, { value: 'grid', text: '鍒锋柊褰撳墠缁勪欢' @@ -537,7 +643,7 @@ { type: 'icon', key: 'icon', - label: Formdict['model.icon'], + label: '鍥炬爣', initVal: card.icon, required: false, forbid: type === 'datacard' && appType === 'mob', // 绉诲姩绔紝婊戝姩鏄剧ず鐨勬寜閽彧鏄剧ず鏂囧瓧 @@ -546,7 +652,7 @@ { type: 'select', key: 'class', - label: Formdict['model.form.color'], + label: '棰滆壊', initVal: card.class, tooltip: '姝ら鑹蹭负鎸夐挳鍒濆鍖栭鑹诧紝鍙湪鏍峰紡璋冩暣涓慨鏀广��', required: false, @@ -556,7 +662,7 @@ { type: 'radio', key: 'color', - label: Formdict['model.form.color'], + label: '棰滆壊', initVal: card.color || 'primary', required: false, forbid: (type !== 'datacard' || appType !== 'mob'), // 绉诲姩绔紝婊戝姩鏄剧ず鐨勬寜閽彧鍙缃浐瀹氶鑹� @@ -580,37 +686,48 @@ { type: 'radio', key: 'joint', - label: Formdict['model.form.paramJoint'], + label: '鎷兼帴鍙傛暟', initVal: card.joint || 'true', required: false, options: [{ value: 'true', - text: Formdict['model.true'] + text: '鏄�' }, { value: 'false', - text: Formdict['model.false'] + text: '鍚�' }] }, { type: 'text', key: 'sheet', - label: Formdict['model.form.tablename'], + label: '琛ㄥ悕', initVal: card.sheet || setting.tableName || '', required: true + }, + { + type: 'cascader', + key: 'syncComponent', + label: '鍒锋柊缁勪欢', + initVal: card.syncComponent || [], + tooltip: '鎵ц鎴愬姛鍚庯紙鎴栧脊绐楁爣绛惧叧闂椂锛夛紝闇�瑕佸悓姝ュ埛鏂扮殑缁勪欢銆傛敞锛氶�夋嫨褰撳墠缁勪欢鐨勪笂绾х粍浠舵棤鏁堬紝鍒锋柊涓婄骇缁勪欢璇烽�夋嫨鎴愬姛鍚庘�滃埛鏂颁笂绾х粍浠� - 琛屸�濄��', + required: false, + options: modules }, { type: 'radio', key: 'pagination', label: '鍒嗛〉', initVal: card.pagination || 'false', + tooltip: '瀵煎嚭鏁版嵁閲忚緝澶ф椂锛�1000+锛夛紝鍙缃垎椤佃姹傛暟鎹��', required: false, options: [{ value: 'true', - text: Formdict['model.true'] + text: '鏄�' }, { value: 'false', - text: Formdict['model.false'] - }] + text: '鍚�' + }], + forbid: appType === 'mob' }, { type: 'radio', @@ -624,25 +741,26 @@ }, { value: 'false', text: '闈炲繀濉�' - }] - }, - { - type: 'cascader', - key: 'syncComponent', - label: '鍒锋柊缁勪欢', - initVal: card.syncComponent || [], - tooltip: '鎵ц鎴愬姛鍚庯紙鎴栧脊绐楁爣绛惧叧闂椂锛夛紝闇�瑕佸悓姝ュ埛鏂扮殑缁勪欢', - required: false, - options: modules + }], + forbid: appType === 'mob' }, { type: 'cascader', key: 'switchTab', label: '鍒囨崲鏍囩', initVal: card.switchTab || [], - tooltip: '鎵ц鎴愬姛鍚庯紝闇�瑕佸垏鎹㈢殑鏍囩椤�', + tooltip: '鎵ц鎴愬姛鍚庯紝闇�瑕佸垏鎹㈢殑鏍囩椤点��' + (appType === 'mob' ? '娉細灏忕▼搴忎腑鏃犳晥' : ''), required: false, options: tabs + }, + { + type: 'cascader', + key: 'anchors', + label: '璺宠浆閿氱偣', + initVal: card.anchors || [], + tooltip: '鎵ц鎴愬姛鍚庯紝闇�瑕佽烦杞殑閿氱偣銆�' + (appType === 'mob' ? '娉細灏忕▼搴忎腑鏃犳晥' : ''), + required: false, + options: anchors }, { type: 'cascader', @@ -660,16 +778,18 @@ label: '鎵撳紑鑿滃崟', tooltip: '鎵ц鎴愬姛鍚庨渶瑕佹墦寮�鐨勮彍鍗曘��', initVal: card.openmenu || (!appType ? [] : ''), + help: appType === 'mob' || appType === 'pc' ? '鍙繑鍥炰笂涓�椤点��' : null, + extendName: 'MenuNo', required: false, allowClear: true, - options: appType === 'mob' ? [...appMenus, {value: 'goback', text: '杩斿洖锛堜笂涓�椤碉級'}] : (appType === 'pc' ? appMenus : menulist), + options: appType === 'mob' || appType === 'pc' ? [...appMenus, {value: 'goback', text: '杩斿洖锛堜笂涓�椤碉級'}] : menulist, forbid: viewType === 'popview' }, { type: 'text', key: 'output', label: '杩斿洖鍊�', - tooltip: '鎵ц鎴愬姛鍚庣殑杩斿洖鍊笺�備緥濡傦細@id', + tooltip: '鎵ц鎴愬姛鍚庣殑杩斿洖鍊笺�傜郴缁熷嚱鏁板彲鎸囧畾杩斿洖鐨勫彉閲忥紙浠绗﹀紑澶达紝杩斿洖id鏃跺彲浣跨敤@id@锛夛紱鑷畾涔夊嚱鏁板彲鎸囧畾杩斿洖瀛楁锛堝id锛夈��', initVal: card.output || '', required: false, forbid: viewType === 'popview' @@ -687,15 +807,13 @@ key: 'open', label: '鎵撳紑鏂瑰紡', initVal: card.open || 'blank', + tooltip: '鑿滃崟鎵撳紑鏂瑰紡銆�', required: true, - forbid: appType !== 'pc', - options: [{ - value: 'blank', - text: '鏂扮獥鍙�' - }, { - value: 'self', - text: '褰撳墠绐楀彛' - }] + forbid: appType !== 'pc' && appType !== 'mob', + options: [ + {value: 'blank', text: appType !== 'mob' ? '鏂扮獥鍙�' : '鏂伴〉闈�'}, + {value: 'self', text: appType !== 'mob' ? '褰撳墠绐楀彛' : '褰撳墠椤甸潰'}, + ] }, { type: 'radio', @@ -719,7 +837,7 @@ precision: 0, label: '姣斾緥', initVal: card.ratio || 85, - tooltip: '灏忎簬100涓哄搴︼紙鎴栭珮搴︼級鐧惧垎姣旓紝澶т簬100涓哄儚绱犲�笺��', + tooltip: '妯℃�佹鎴栨娊灞夌殑瀹藉害锛屽皬浜�100涓虹獥鍙e搴︼紙鎴栭珮搴︼級鐧惧垎姣旓紝澶т簬100涓哄儚绱犲�笺��', required: true }, { @@ -815,7 +933,10 @@ initVal: card.controlField || '', required: true, allowClear: true, - options: columns + options: columns.map(item => ({ + value: item.field, + text: `${item.label}锛�${item.field}锛塦 + })) }, { type: 'text', @@ -832,6 +953,21 @@ required: false }, { + type: 'radio', + key: 'hidden', + label: '闅愯棌', + initVal: card.hidden || 'false', + tooltip: '闅愯棌鍚庢寜閽湪椤甸潰涓笉鏄剧ず锛屼笖涓嶅弬涓庢潈闄愬垎閰嶃��', + required: false, + options: [{ + value: 'false', + text: '鍚�' + }, { + value: 'true', + text: '鏄�' + }] + }, + { type: 'splitLine', key: 'title', label: '琛ㄥ崟', @@ -840,7 +976,7 @@ { type: 'text', key: 'field', - label: Formdict['model.form.field'], + label: '瀛楁', initVal: card.field || '', required: true, readonly: false @@ -891,6 +1027,748 @@ initVal: card.closeText || '', required: false, }, + { + type: 'radio', + key: 'progress', + label: '杩涘害鎻愮ず', + initVal: card.progress || 'number', + required: false, + forbid: appType === 'mob', + options: [{ + value: 'number', + text: '鍓╀綑鏁�' + }, { + value: 'progressbar', + text: '杩涘害鏉�' + }] + } + ] + + return forms +} + +/** + * @description 鑾峰彇鎸夐挳琛ㄥ崟閰嶇疆淇℃伅 + * @param {*} card 缂栬緫鎸夐挳 + * @param {*} functip 鐢熸垚瀛樺偍杩囩▼鎻愮ず + * @param {*} setting 缁勪欢閰嶇疆 + * @param {*} usefulFields 瀛樺偍杩囩▼鍙敤鐨勫紑濮嬪瓧娈� + */ +export function getBaseTableActionForm (card, functip, config, usefulFields, modules) { + let viewType = sessionStorage.getItem('editMenuType') // 寮圭獥 popview + let printTemps = sessionStorage.getItem('printTemps') + printTemps = printTemps ? JSON.parse(printTemps) : [] + let setting = config.setting || {} + let columns = config.columns || [] + + let opentypes = [ + { + value: 'pop', + text: '寮圭獥锛堣〃鍗曪級' + }, { + value: 'prompt', + text: '鎻愮ず妗�' + }, { + value: 'exec', + text: '鐩存帴鎵ц' + }, { + value: 'excelIn', + text: '瀵煎叆Excel' + }, { + value: 'excelOut', + text: '瀵煎嚭Excel' + }, { + value: 'popview', + text: '寮圭獥锛堟爣绛撅級' + }, { + value: 'tab', + text: '鏍囩椤�' + }, { + value: 'innerpage', + text: '鏂伴〉闈�' + }, { + value: 'funcbutton', + text: '鍔熻兘鎸夐挳' + } + ] + + let pageTemps = [ + // { value: 'print', text: '鏍囩鎵撳嵃妯℃澘' }, + // { value: 'billprintTemp', text: '鍗曟嵁鎵撳嵃妯℃澘' }, + { value: 'billprint', text: '鍗曟嵁鎵撳嵃' }, + { value: 'pay', text: '鏀粯' }, + { value: 'custom', text: '鑷畾涔�' } + ] + + let funTypes = [ + { value: 'print', text: '鏍囩鎵撳嵃' }, + { value: 'refund', text: '閫�娆�' }, + { value: 'closetab', text: '鏍囩鍏抽棴' }, + { value: 'changeuser', text: '鍒囨崲鐢ㄦ埛' }, + { value: 'megvii', text: '鏃疯闈㈡澘鏈�' }, + { value: 'filezip', text: '鏂囦欢鍘嬬缉鍖�' }, + ] + + let menulist = sessionStorage.getItem('fstMenuList') + if (menulist) { + try { + menulist = JSON.parse(menulist) + } catch (e) { + menulist = [] + } + } else { + menulist = [] + } + + let refresh = [] + if (viewType === 'popview') { // 寮圭獥鏍囩 + opentypes = opentypes.filter(item => item.value !== 'popview' && item.value !== 'funcbutton') + refresh.push({ + value: 'closepoptab', // 鍏抽棴寮圭獥鏍囩 + text: '鍏抽棴寮圭獥' + }) + } + + if (card.OpenType === 'form') { // 鎷栨嫿娣诲姞绫诲瀷杞崲 + card.OpenType = 'pop' + } + + let forms = [ + { + type: 'select', + key: 'OpenType', + label: '鎵撳紑鏂瑰紡', + initVal: card.OpenType, + required: true, + options: opentypes + }, + { + type: 'text', + key: 'label', + label: '鎸夐挳鍚嶇О', + initVal: card.label, + required: true, + }, + { + type: 'select', + key: 'funcType', + label: '鍔熻兘绫诲瀷', + initVal: card.funcType || '', + required: true, + options: funTypes + }, + { + type: 'radio', + key: 'subFunc', + label: '鎺ュ彛鍚嶇О', + initVal: card.subFunc || 'addUser', + required: true, + options: [ + { value: 'addUser', text: '娣诲姞鐢ㄦ埛' }, + ] + }, + { + type: 'select', + key: 'execMode', + label: '鎵ц鏂瑰紡', + initVal: card.execMode || 'exec', + required: true, + options: [{ + value: 'exec', + text: '鐩存帴鎵ц' + }, { + value: 'prompt', + text: '鎻愮ず妗�' + }, { + value: 'pop', + text: '寮圭獥锛堣〃鍗曪級' + }] + }, + { + type: 'radio', + key: 'intertype', + label: '鎺ュ彛绫诲瀷', + initVal: card.intertype || 'system', + required: true, + options: [] + }, + { + type: 'checkbox', + key: 'payType', + label: '鏀粯鏂瑰紡', + initVal: card.payType || [], + required: true, + options: [{ + value: 'wxpay', + text: '寰俊' + // }, { + // value: 'alipay', + // text: '鏀粯瀹�' + }] + }, + { + type: 'radio', + key: 'procMode', + label: '鍙傛暟澶勭悊', + initVal: card.procMode || (card.innerFunc ? 'inner' : 'system'), + required: true, + options: [{ + value: 'system', + text: '绯荤粺鍑芥暟' + }, { + value: 'inner', + text: '鍐呴儴鍑芥暟' + }, { + value: 'none', + text: '鏃�' + }] + }, + { + type: 'radio', + key: 'sqlType', + label: '鎿嶄綔绫诲瀷', + initVal: card.sqlType || '', + required: true, + options: [] + }, + { + type: 'text', + key: 'sql', + label: '琛ㄥ悕', + initVal: card.sql || setting.tableName || '', + required: true + }, + { + type: 'text', + key: 'innerFunc', + label: '鍐呴儴鍑芥暟', + initVal: card.innerFunc || '', + tooltip: functip, + fields: usefulFields, + required: false, + }, + { + type: 'text', + key: 'urlkey', + label: '鍦板潃瀛楁', + initVal: card.urlkey || '', + tooltip: '鍥剧墖锛堟枃浠讹級閾炬帴鐨勫瓧娈靛悕銆�', + required: false, + readonly: false + }, + { + type: 'select', + key: 'pageTemplate', + label: '椤甸潰绫诲瀷', + initVal: card.pageTemplate || '', + required: true, + options: pageTemps + }, + { + type: 'select', + key: 'printTemp', + label: '鎵撳嵃妯℃澘', + initVal: card.printTemp || '', + required: true, + options: printTemps + }, + { + type: 'cascader', + key: 'linkmenu', + label: '鍏宠仈鑿滃崟', + initVal: card.linkmenu || [], + required: true, + extendName: 'MenuNo', + options: menulist + }, + { + type: 'textarea', + key: 'url', + label: '椤甸潰鍦板潃', + initVal: card.url || '', + required: true + }, + { + type: 'radio', + key: 'sysInterface', + label: '绯荤粺绫诲瀷', + initVal: card.sysInterface || 'false', + tooltip: '涓氬姟绯荤粺鎸囧悓涓�sso涓嬬殑鍏朵粬涓氬姟绯荤粺锛屽閮ㄧ郴缁熸寚涓嶅悓sso涓嬬殑鍏朵粬涓氬姟绯荤粺銆�', + required: true, + options: [{ + value: 'false', + text: '涓氬姟' + }, { + value: 'true', + text: '鍗曠偣' + }, { + value: 'external', + text: '澶栭儴' + }] + }, + { + type: 'text', + key: 'outerFunc', + label: '澶栭儴鍑芥暟', + initVal: card.outerFunc || '', + required: false, + }, + { + type: 'textarea', + key: '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: 'keyinterface', + key: 'exInterface', + label: '娴嬭瘯鍦板潃', + initVal: card.exInterface || '', + required: true + }, + { + type: 'keyinterface', + key: 'exProInterface', + label: '姝e紡鍦板潃', + initVal: card.exProInterface || '', + 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 || (card.callbackFunc ? 'func' : 'none'), + tooltip: '浣跨敤鍚庡彴鑴氭湰鎵ц鏃讹紝闇�瑕侀厤鍚堣鍒掍换鍔°��', + required: true, + options: [{ + value: 'script', + text: '鑷畾涔夎剼鏈�' + }, { + value: 'default', + text: '鍚庡彴鑴氭湰' + }, { + value: 'func', + text: '鍥炶皟鍑芥暟' + }, { + value: 'none', + text: '鏃�' + }] + }, + { + type: 'text', + key: 'cbTable', + label: '鍥炶皟琛ㄥ悕', + initVal: card.cbTable || '', + required: true + }, + { + type: 'text', + key: 'callbackFunc', + label: '鍥炶皟鍑芥暟', + initVal: card.callbackFunc || '', + required: true + }, + { + type: 'select', + key: 'Ot', + label: '琛岃缃�', + initVal: card.Ot || (card.sqlType === 'insert' ? 'notRequired' : 'requiredSgl'), + required: true, + options: [] + }, + { + type: 'select', + key: 'execSuccess', + label: '鎴愬姛鍚�', + initVal: card.execSuccess || 'grid', + tooltip: refresh.length ? '鎵ц鍒锋柊婧愮粍浠舵椂锛岃鍦ㄦ簮鎸夐挳涓缃叧闂悗鍒锋柊閭d竴椤癸紝娉細姝ゆ椂浼氬悓姝ュ埛鏂板綋鍓嶇粍浠跺拰涓婄骇缁勪欢-琛屻��' : '閫夋嫨鍒锋柊琛屾椂锛屽鏋滈�夋嫨澶氭潯鏁版嵁浼氬埛鏂拌〃鏍笺�傛敞锛氫笂绾х粍浠跺湪鏁版嵁婧愪腑娣诲姞銆�', + required: true, + options: [{ + value: 'never', + text: '涓嶅埛鏂�' + }, { + value: 'line', + text: '鍒锋柊琛�' + }, { + value: 'grid', + text: '鍒锋柊褰撳墠缁勪欢' + }, { + value: 'mainline', + text: '鍒锋柊涓婄骇缁勪欢 - 琛�' + }, + ...refresh] + }, + { + type: 'select', + key: 'execError', + label: '澶辫触鍚�', + initVal: card.execError || 'never', + tooltip: refresh.length ? '鎵ц鍒锋柊婧愮粍浠舵椂锛岃鍦ㄦ簮鎸夐挳涓缃叧闂悗鍒锋柊閭d竴椤癸紝娉細姝ゆ椂浼氬悓姝ュ埛鏂板綋鍓嶇粍浠跺拰涓婄骇缁勪欢-琛屻��' : '閫夋嫨鍒锋柊琛屾椂锛屽鏋滈�夋嫨澶氭潯鏁版嵁浼氬埛鏂拌〃鏍硷紝娉細涓婄骇缁勪欢鍦ㄦ暟鎹簮涓坊鍔犮��', + required: true, + options: [{ + value: 'never', + text: '涓嶅埛鏂�' + }, { + value: 'line', + text: '鍒锋柊琛�' + }, { + value: 'grid', + text: '鍒锋柊褰撳墠缁勪欢' + }, { + value: 'mainline', + text: '鍒锋柊涓婄骇缁勪欢 - 琛�' + }, + ...refresh] + }, + { + type: 'select', + key: 'popClose', + label: '鍏抽棴鍚�', + initVal: card.popClose || 'never', + required: true, + options: [{ + value: 'never', + text: '涓嶅埛鏂�' + }, { + value: 'grid', + text: '鍒锋柊褰撳墠缁勪欢' + }, { + value: 'mainline', + text: '鍒锋柊涓婄骇缁勪欢 - 琛�' + }] + }, + { + type: 'radio', + key: 'resetPageIndex', + label: '鍒锋柊鏃�', + initVal: card.resetPageIndex || 'true', + required: false, + options: [{ + value: 'true', + text: '閲嶇疆椤电爜' + }, { + value: 'false', + text: '涓嶉噸缃�' + }] + }, + { + type: 'number', + key: 'width', + min: 1, + max: 24, + precision: 0, + label: '瀹藉害', + initVal: card.width || 12, + tooltip: '鏍呮牸甯冨眬锛屾瘡琛岀瓑鍒嗕负24鍒椼��', + forbid: card.eleType !== 'button', + required: true + }, + { + type: 'radio', + key: 'show', + label: '鏄剧ず涓�', + initVal: card.show || 'button', + required: true, + options: [{ + value: 'icon', + text: '鍥炬爣' + }, { + value: 'button', + text: '鍥炬爣+鏂囧瓧' + }, { + value: 'link', + text: '鏂囧瓧+鍥炬爣' + }] + }, + { + type: 'icon', + key: 'icon', + label: '鍥炬爣', + initVal: card.icon, + required: false, + options: [] + }, + { + type: 'select', + key: 'class', + label: '棰滆壊', + initVal: card.class, + required: false, + options: btnClasses + }, + { + type: 'radio', + key: 'joint', + label: '鎷兼帴鍙傛暟', + initVal: card.joint || 'true', + required: false, + options: [{ + value: 'true', + text: '鏄�' + }, { + value: 'false', + text: '鍚�' + }] + }, + { + type: 'text', + key: 'sheet', + label: '琛ㄥ悕', + initVal: card.sheet || setting.tableName || '', + required: true + }, + { + type: 'cascader', + key: 'syncComponent', + label: '鍒锋柊缁勪欢', + initVal: card.syncComponent || [], + tooltip: '鎵ц鎴愬姛鍚庯紙鎴栧脊绐楁爣绛惧叧闂椂锛夛紝闇�瑕佸悓姝ュ埛鏂扮殑缁勪欢銆傛敞锛氶�夋嫨褰撳墠缁勪欢鐨勪笂绾х粍浠舵棤鏁堬紝鍒锋柊涓婄骇缁勪欢璇烽�夋嫨鎴愬姛鍚庘�滃埛鏂颁笂绾х粍浠� - 琛屸�濄��', + required: false, + options: modules + }, + { + type: 'radio', + key: 'pagination', + label: '鍒嗛〉', + initVal: card.pagination || 'false', + tooltip: '瀵煎嚭鏁版嵁閲忚緝澶ф椂锛�1000+锛夛紝鍙缃垎椤佃姹傛暟鎹��', + required: false, + options: [{ + value: 'true', + text: '鏄�' + }, { + value: 'false', + text: '鍚�' + }] + }, + { + type: 'radio', + key: 'search', + label: '鎼滅储鏉′欢', + initVal: card.search || 'false', + required: false, + options: [{ + value: 'true', + text: '蹇呭~' + }, { + value: 'false', + text: '闈炲繀濉�' + }] + }, + { + type: 'cascader', + key: 'refreshTab', + label: '鍒锋柊鑿滃崟', + initVal: card.refreshTab || [], + tooltip: '鎵ц鎴愬姛鍚庯紙鎴栧姛鑳芥寜閽腑鏍囩鍏抽棴绫诲瀷锛夛紝闇�瑕佸悓姝ュ埛鏂扮殑鑿滃崟', + required: false, + forbid: viewType === 'popview', + options: menulist + }, + { + type: 'cascader', + key: 'openmenu', + label: '鎵撳紑鑿滃崟', + tooltip: '鎵ц鎴愬姛鍚庨渶瑕佹墦寮�鐨勮彍鍗曘��', + initVal: card.openmenu || [], + extendName: 'MenuNo', + required: false, + allowClear: true, + options: menulist, + forbid: viewType === 'popview' + }, + { + type: 'text', + key: 'output', + label: '杩斿洖鍊�', + tooltip: '鎵ц鎴愬姛鍚庣殑杩斿洖鍊笺�傜郴缁熷嚱鏁板彲鎸囧畾杩斿洖鐨勫彉閲忥紙浠绗﹀紑澶达紝杩斿洖id鏃跺彲浣跨敤@id@锛夛紱鑷畾涔夊嚱鏁板彲鎸囧畾杩斿洖瀛楁锛堝id锛夈��', + initVal: card.output || '', + required: false, + forbid: viewType === 'popview' + }, + { + type: 'text', + key: 'tipTitle', + label: '纭鎻愮ず', + initVal: card.tipTitle || '', + tooltip: '娉細寮圭獥锛堣〃鍗曪級鍦ㄦ樉绀轰负鏄惁妗嗘椂鏈夋晥銆�', + required: false + }, + { + 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: 3000, + precision: 0, + label: '姣斾緥', + initVal: card.ratio || 85, + tooltip: '妯℃�佹鎴栨娊灞夌殑瀹藉害锛屽皬浜�100涓虹獥鍙e搴︼紙鎴栭珮搴︼級鐧惧垎姣旓紝澶т簬100涓哄儚绱犲�笺��', + required: true + }, + { + type: 'radio', + key: 'placement', + label: '鎶藉眽鏂瑰悜', + initVal: card.placement || 'right', + required: false, + options: [{ + value: 'right', + text: '鍙充晶' + }, { + value: 'left', + text: '宸︿晶' + }, { + value: 'top', + text: '涓婁晶' + }, { + value: 'bottom', + text: '涓嬩晶' + }] + }, + { + type: 'radio', + key: 'clickouter', + label: '鐐瑰嚮钂欏眰', + initVal: card.clickouter || 'unclose', + required: false, + options: [{ + value: 'unclose', + text: '涓嶅叧闂�' + }, { + value: 'close', + text: '鍏抽棴' + }] + }, + { + type: 'radio', + key: 'control', + label: '鎸夐挳鎺у埗', + initVal: card.control || (card.controlField ? 'disabled' : ''), + tooltip: '褰撻�夋嫨绂佺敤鎴栭殣钘忥紝涓斿瓧娈靛�间笌鎺у埗鍊肩浉绛夋椂锛屾寜閽細闅愯棌鎴栫鐢ㄣ�傚綋閫夋嫨涓婄骇锛屼富琛ㄥ瓧娈靛�间笌鎺у埗鍊肩浉绛夋垨涓昏〃瀛楁鍊间笉瀛樺湪鏃讹紝鎸夐挳浼氶殣钘忋�傛敞锛氬涓�肩敤閫楀彿鍒嗛殧', + required: false, + options: [{ + value: '', + text: '鏃�' + }, { + value: 'disabled', + text: '绂佺敤' + }, { + value: 'hidden', + text: '闅愯棌' + }, { + value: 'parent', + text: '涓婄骇' + }] + }, + { + type: 'select', + key: 'controlField', + label: '鎺у埗瀛楁', + initVal: card.controlField || '', + required: true, + allowClear: true, + options: columns.map(item => ({ + value: item.field, + text: `${item.label}锛�${item.field}锛塦 + })) + }, + { + type: 'text', + key: 'controlVal', + label: '鎺у埗鍊�', + initVal: card.controlVal || '', + required: false + }, + { + type: 'text', + key: 'reason', + label: '绂佺敤鍘熷洜', + initVal: card.reason || '', + required: false + }, + { + type: 'radio', + key: 'hidden', + label: '闅愯棌', + initVal: card.hidden || 'false', + tooltip: '闅愯棌鍚庢寜閽湪椤甸潰涓笉鏄剧ず锛屼笖涓嶅弬涓庢潈闄愬垎閰嶃��', + required: false, + options: [{ + value: 'false', + text: '鍚�' + }, { + value: 'true', + text: '鏄�' + }] + }, + { + type: 'radio', + key: 'progress', + label: '杩涘害鎻愮ず', + initVal: card.progress || 'number', + required: false, + options: [{ + value: 'number', + text: '鍓╀綑鏁�' + }, { + value: 'progressbar', + text: '杩涘害鏉�' + }] + } ] return forms -- Gitblit v1.8.0