From 46f79b491173d284a4900d19e7aecf7509481438 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 21 一月 2022 17:21:25 +0800 Subject: [PATCH] 2022-01-21 --- src/menu/components/share/actioncomponent/formconfig.jsx | 250 ++++++++++++++++++++++++++++++++++++------------- 1 files changed, 181 insertions(+), 69 deletions(-) diff --git a/src/menu/components/share/actioncomponent/formconfig.jsx b/src/menu/components/share/actioncomponent/formconfig.jsx index 559c61c..2516398 100644 --- a/src/menu/components/share/actioncomponent/formconfig.jsx +++ b/src/menu/components/share/actioncomponent/formconfig.jsx @@ -1,5 +1,6 @@ import zhCN from '@/locales/zh-CN/model.js' import enUS from '@/locales/en-US/model.js' +import { btnCustomClasses } from '@/utils/option.js' const Formdict = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS @@ -14,6 +15,8 @@ export function getActionForm (card, functip, config, usefulFields, type, menulist = [], modules = []) { let appType = sessionStorage.getItem('appType') 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 appMenus = [] @@ -82,7 +85,7 @@ const isApp = ['pc', 'mob'].includes(appType) let funTypes = [ - { value: 'changeuser', text: Formdict['header.form.func.changeuser'] }, + { value: 'changeuser', text: '鍒囨崲鐢ㄦ埛' }, { value: 'print', text: '鏍囩鎵撳嵃' }, { value: 'closetab', text: '鏍囩鍏抽棴' }, ] @@ -98,34 +101,32 @@ } else { appMenus = [] } - - if (appType === 'mob') { - opentypes = opentypes.filter(item => ['pop', 'prompt', 'exec', 'innerpage', 'funcbutton'].includes(item.value)) - funTypes = [ - { value: 'scan', text: '鎵爜' }, - { value: 'logout', text: '閫�鍑�' }, - { 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 (appType === 'mob') { + opentypes = opentypes.filter(item => ['pop', 'prompt', 'exec', 'innerpage', 'funcbutton'].includes(item.value)) + funTypes = [ + { value: 'scan', text: '鎵爜' }, + { value: 'logout', text: '閫�鍑�' }, + { value: 'mkBinding', text: '寮�閫氭壂鐮佺櫥褰�' }, + { value: 'mkUnBinding', text: '鐢ㄦ埛瑙g粦' }, + { value: 'reAuth', text: '鍒囨崲绯荤粺锛堟竻绌虹紦瀛�-灏忕▼搴忥級' }, + { value: 'goBack', text: '杩斿洖' }, + ] + pageTemps = [ + { value: 'linkpage', text: '鍏宠仈鑿滃崟' }, + { value: 'custom', text: '閾炬帴' } + ] + } else if (appType === 'pc') { + opentypes = opentypes.filter(item => item.value !== 'tab') + funTypes = [ + { value: 'changeuser', text: '鍒囨崲鐢ㄦ埛' }, + ] + pageTemps = [ + { value: 'linkpage', text: '鍏宠仈鑿滃崟' }, + { value: 'billprint', text: '鍗曟嵁鎵撳嵃' }, + { value: 'pay', text: Formdict['model.pay'] }, + { value: 'custom', text: '閾炬帴' } + ] } if (type === 'chart' && appType !== 'mob') { @@ -136,13 +137,27 @@ if (viewType === 'popview') { // 寮圭獥鏍囩 opentypes = opentypes.filter(item => item.value !== 'popview' && item.value !== 'funcbutton') refresh.push({ - value: 'popclose', + value: 'closepoptab', // 鍏抽棴寮圭獥鏍囩 + text: '鍏抽棴寮圭獥' + }) + refresh.push({ + value: 'popclose', // 鎵ц寮圭獥鍏抽棴鏃剁殑鍒锋柊 text: '鍒锋柊婧愮粍浠�' + }) + } + + if (type === 'card') { + opentypes.push({ + value: 'form', + text: '琛ㄥ崟' }) } if (!card.control && card.controlField) { card.control = 'disabled' + } + if (appType === 'mob' && card.control === 'parent') { + card.control = '' } let forms = [ @@ -157,10 +172,24 @@ { type: 'select', key: 'funcType', - label: Formdict['header.form.funcType'], + label: '鍔熻兘绫诲瀷', initVal: card.funcType || '', required: true, options: funTypes + }, + { + type: 'radio', + key: 'formType', + label: '琛ㄥ崟绫诲瀷', + initVal: card.formType || 'switch', + required: true, + options: [{ + value: 'switch', + text: '寮�鍏�' + }, { + value: 'radio', + text: '鍕鹃�夋' + }] }, { type: 'select', @@ -193,7 +222,6 @@ label: '鎸夐挳鍚嶇О', initVal: card.label, required: true, - readonly: false }, { type: 'radio', @@ -231,9 +259,7 @@ initVal: card.innerFunc || '', tooltip: functip, fields: usefulFields, - tooltipClass: 'middle', required: false, - readonly: false }, { type: 'select', @@ -245,12 +271,19 @@ }, { type: 'select', + key: 'printTemp', + label: '鎵撳嵃妯℃澘', + initVal: card.printTemp || '', + required: true, + options: printTemps + }, + { + type: isApp ? 'select' : 'cascader', key: 'linkmenu', label: '鍏宠仈鑿滃崟', - initVal: card.linkmenu || '', + initVal: card.linkmenu || (isApp ? '' : []), required: true, - forbid: !isApp, - options: appMenus + options: isApp ? appMenus : menulist }, { type: 'textarea', @@ -279,7 +312,6 @@ label: Formdict['header.form.outerFunc'], initVal: card.outerFunc || '', required: false, - readonly: false }, { type: 'textarea', @@ -354,7 +386,6 @@ label: Formdict['header.form.callbackFunc'], initVal: card.callbackFunc || '', required: false, - readonly: false }, { type: 'select', @@ -363,15 +394,6 @@ initVal: card.Ot || (card.sqlType === 'insert' ? 'notRequired' : 'requiredSgl'), required: true, options: [] - }, - { - type: 'cascader', - key: 'linkmenu', - label: Formdict['model.form.linkmenu'], - initVal: card.linkmenu || [], - required: true, - forbid: isApp, - options: menulist }, { type: 'select', @@ -394,7 +416,7 @@ text: '鍒锋柊涓婄骇缁勪欢 - 琛�' }, { value: !appType ? 'closetab' : 'goback', - text: !appType ? '鍏抽棴寮圭獥' : '杩斿洖锛堜笂涓�涓〉闈級' + text: !appType ? '鍏抽棴鏍囩' : '杩斿洖锛堜笂涓�涓〉闈級' }, ...refresh] }, @@ -469,6 +491,7 @@ label: '鏄剧ず涓�', initVal: card.show || 'button', required: true, + forbid: type === 'datacard' && appType === 'mob', // 绉诲姩绔紝婊戝姩鏄剧ず鐨勬寜閽彧鏄剧ず鏂囧瓧 options: [{ value: 'icon', text: '鍥炬爣' @@ -484,13 +507,13 @@ type: 'radio', key: 'swipe', label: "婊戝姩鏄剧ず", - initVal: card.swipe || 'false', + initVal: card.swipe === 'false' ? 'left' : (card.swipe || 'left'), // 绉诲姩绔粎淇濈暀婊戝姩鏄剧ず鎸夐挳 required: false, forbid: (type !== 'datacard' || appType !== 'mob'), options: [{ - value: 'false', - text: '鍚�' - }, { + // value: 'false', + // text: '鍚�' + // }, { value: 'left', text: '宸︽粦' }, { @@ -504,6 +527,7 @@ label: Formdict['model.icon'], initVal: card.icon, required: false, + forbid: type === 'datacard' && appType === 'mob', // 绉诲姩绔紝婊戝姩鏄剧ず鐨勬寜閽彧鏄剧ず鏂囧瓧 options: [] }, { @@ -513,7 +537,32 @@ initVal: card.class, tooltip: '姝ら鑹蹭负鎸夐挳鍒濆鍖栭鑹诧紝鍙湪鏍峰紡璋冩暣涓慨鏀广��', required: false, - options: [] + forbid: type === 'datacard' && appType === 'mob', // 绉诲姩绔紝婊戝姩鏄剧ず鐨勬寜閽笉璁剧疆閫氱敤棰滆壊 + options: btnCustomClasses + }, + { + type: 'radio', + key: 'color', + label: Formdict['model.form.color'], + initVal: card.color || 'primary', + required: false, + forbid: (type !== 'datacard' || appType !== 'mob'), // 绉诲姩绔紝婊戝姩鏄剧ず鐨勬寜閽彧鍙缃浐瀹氶鑹� + options: [{ + value: 'primary', + text: '钃�' + }, { + value: 'danger', + text: '绾�' + }, { + value: 'warning', + text: '姗�' + }, { + value: 'success', + text: '缁�' + }, { + value: 'light', + text: '鐏�' + }] }, { type: 'radio', @@ -539,7 +588,7 @@ { type: 'radio', key: 'pagination', - label: Formdict['header.form.pagination'], + label: '鍒嗛〉', initVal: card.pagination || 'false', required: false, options: [{ @@ -590,15 +639,6 @@ tooltip: '鎵ц鎴愬姛鍚庯紙鎴栧姛鑳芥寜閽腑鏍囩鍏抽棴绫诲瀷锛夛紝闇�瑕佸悓姝ュ埛鏂扮殑鑿滃崟', required: false, forbid: isApp || viewType === 'popview', - options: menulist - }, - { - type: 'cascader', - key: 'linkmenu', - label: Formdict['model.form.linkmenu'], - initVal: card.linkmenu || [], - required: true, - forbid: isApp, options: menulist }, { @@ -654,7 +694,7 @@ type: 'number', key: 'ratio', min: 1, - max: 24, + max: 3000, precision: 0, label: '姣斾緥', initVal: card.ratio || 85, @@ -666,7 +706,6 @@ key: 'placement', label: '鎶藉眽鏂瑰悜', initVal: card.placement || 'right', - tooltip: '浣跨敤鎶藉眽鏃舵湁鏁堛��', required: false, options: [{ value: 'right', @@ -684,10 +723,24 @@ }, { type: 'radio', + key: 'clickouter', + label: '鐐瑰嚮钂欏眰', + initVal: card.clickouter || 'unclose', + required: false, + options: [{ + value: 'unclose', + text: '涓嶅叧闂�' + }, { + value: 'close', + text: '鍏抽棴' + }] + }, + { + type: 'radio', key: 'reload', label: '杩斿洖鍚�', initVal: card.reload || 'false', - tooltip: '鎸夐挳鎴愬姛鍚庤繑鍥炰笂涓�椤甸潰鎴栦娇鐢ㄥ姛鑳芥寜閽�-杩斿洖鍔熻兘鏃讹紝杩斿洖鍚庢槸鍚﹀埛鏂版暟鎹�傛敞锛氬湪鏄庣浜慳pp涓紙搴旂敤妯″紡涓篴pp锛夋湁鏁堛��', + tooltip: '杩斿洖鍚庢槸鍚﹀埛鏂版暟鎹�傛敞锛氬湪鏄庣浜慉PP鎴栧皬绋嬪簭涓湁鏁堛��', forbid: appType !== 'mob', options: [{ value: 'false', @@ -702,6 +755,7 @@ key: 'control', label: '鎸夐挳鎺у埗', initVal: card.control || (card.controlField ? 'disabled' : ''), + tooltip: '褰撻�夋嫨绂佺敤鎴栭殣钘忥紝涓斿瓧娈靛�间笌鎺у埗鍊肩浉绛夋椂锛屾寜閽細闅愯棌鎴栫鐢ㄣ�傚綋閫夋嫨涓婄骇锛屼富琛ㄥ瓧娈靛�间笌鎺у埗鍊肩浉绛夋垨涓昏〃瀛楁鍊间笉瀛樺湪鏃讹紝鎸夐挳浼氶殣钘忋�傛敞锛氬涓�肩敤閫楀彿鍒嗛殧', required: false, options: [{ value: '', @@ -712,13 +766,15 @@ }, { value: 'hidden', text: '闅愯棌' + }, { + value: 'parent', + text: '涓婄骇' }] }, { type: 'select', key: 'controlField', label: '鎺у埗瀛楁', - tooltip: '鎺у埗瀛楁锛屽彲鏍规嵁鏁版嵁鎺у埗鎸夐挳鐨勯殣钘忔垨绂佺敤銆�', initVal: card.controlField || '', required: true, allowClear: true, @@ -728,10 +784,66 @@ type: 'text', key: 'controlVal', label: '鎺у埗鍊�', - tooltip: '褰撻�夋嫨鎺у埗瀛楁锛屼笖瀛楁鍊间笌鎺у埗鍊肩浉绛夋椂锛屾寜閽細闅愯棌鎴栫鐢紝澶氫釜鍊肩敤閫楀彿鍒嗛殧銆�', initVal: card.controlVal || '', required: false }, + { + type: 'splitLine', + key: 'title', + label: '琛ㄥ崟', + initVal: '' + }, + { + type: 'text', + key: 'field', + label: Formdict['model.form.field'], + initVal: card.field || '', + required: true, + readonly: false + }, + { + type: 'radio', + key: 'size', + label: '寮�鍏冲昂瀵�', + initVal: card.size || 'default', + options: [{ + value: 'default', + text: '澶�' + }, { + value: 'small', + text: '灏�' + }] + }, + { + type: 'text', + key: 'openVal', + label: '寮�鍚��', + initVal: card.openVal === undefined ? '' : card.openVal + '', + tooltip: '褰撳紑鍚笌鍏抽棴鍊煎潎涓烘鏁存暟鏃讹紝榛樿杞崲涓篒NT绫诲瀷銆�', + required: false + }, + { + type: 'text', + key: 'closeVal', + label: '鍏抽棴鍊�', + initVal: card.closeVal === undefined ? '' : card.closeVal + '', + tooltip: '褰撳紑鍚笌鍏抽棴鍊煎潎涓烘鏁存暟鏃讹紝榛樿杞崲涓篒NT绫诲瀷銆�', + required: false + }, + { + type: 'text', + key: 'openText', + label: '寮�鍚彁绀�', + initVal: card.openText || '', + required: false, + }, + { + type: 'text', + key: 'closeText', + label: '鍏抽棴鎻愮ず', + initVal: card.closeText || '', + required: false, + }, ] return forms -- Gitblit v1.8.0