From 6afdec0062dacbded57e166230eb22cc55ced0c1 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期六, 08 五月 2021 14:30:21 +0800 Subject: [PATCH] 2021-05-08 --- src/templates/zshare/formconfig.jsx | 303 +++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 239 insertions(+), 64 deletions(-) diff --git a/src/templates/zshare/formconfig.jsx b/src/templates/zshare/formconfig.jsx index 32401b9..a9fa640 100644 --- a/src/templates/zshare/formconfig.jsx +++ b/src/templates/zshare/formconfig.jsx @@ -2,7 +2,7 @@ import enUS from '@/locales/en-US/model.js' import { formRule } from '@/utils/option.js' -const Formdict = localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS +const Formdict = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS /** * @description 鑾峰彇鏍戝舰椤甸潰璁剧疆琛ㄥ崟閰嶇疆淇℃伅 @@ -385,7 +385,7 @@ type: 'radio', key: 'setAll', label: Formdict['header.form.setAll'], - initVal: card.setAll || 'false', + initVal: card.setAll || 'true', options: [{ value: 'true', text: Formdict['model.true'] @@ -667,7 +667,11 @@ } let refresh = [] + if (type === 'subtable') { // 瀛愯〃椤甸潰锛屽彲璁剧疆鍒锋柊涓昏〃鍙婂悓绾ф爣绛� + if (card.focus) { + card.popClose = 'maingrid' + } refresh.push({ value: 'maingrid', text: Formdict['header.form.refresh.maingrid'] @@ -687,7 +691,7 @@ options: opentypes }, { - type: 'select', + type: 'radio', key: 'funcType', label: Formdict['header.form.funcType'], initVal: card.funcType || '', @@ -723,19 +727,24 @@ label: Formdict['header.form.intertype'], initVal: card.intertype || 'system', required: true, + options: [] + }, + { + type: 'radio', + key: 'procMode', + label: '鍙傛暟澶勭悊', + initVal: card.procMode || 'system', + required: true, options: [{ value: 'system', - text: Formdict['model.interface.system'] + text: '绯荤粺鍑芥暟' }, { value: 'inner', - text: Formdict['model.interface.inner'] - }, { - value: 'outer', - text: Formdict['model.interface.outer'] + text: '鍐呴儴鍑芥暟' }] }, { - type: 'select', + type: 'radio', key: 'sqlType', label: Formdict['header.form.action.type'], initVal: card.sqlType || '', @@ -744,18 +753,18 @@ }, { type: 'text', - key: 'sql', - label: Formdict['model.form.tablename'], - initVal: card.sql || config.setting.tableName || '', - required: true - }, - { - type: 'text', key: 'label', label: '鎸夐挳鍚嶇О', initVal: card.label, required: true, readonly: false + }, + { + type: 'text', + key: 'sql', + label: Formdict['model.form.tablename'], + initVal: card.sql || config.setting.tableName || '', + required: true }, { type: 'text', @@ -768,17 +777,17 @@ required: card.intertype === 'inner', readonly: false }, - { - type: 'select', - key: 'tabType', - label: Formdict['model.form.tabType'], - initVal: card.tabType || 'SubTable', - required: true, - options: [{ - value: 'SubTable', - text: Formdict['model.menu.tab.subtable'] - }] - }, + // { + // type: 'select', + // key: 'tabType', + // label: Formdict['model.form.tabType'], + // initVal: card.tabType || 'SubTable', + // required: true, + // options: [{ + // value: 'SubTable', + // text: Formdict['model.menu.tab.subtable'] + // }] + // }, { type: 'select', key: 'linkTab', @@ -821,7 +830,7 @@ { type: 'text', key: 'url', - label: Formdict['model.form.newpage.url'], + label: Formdict['model.pageUrl'], initVal: card.url || '', required: true }, @@ -848,12 +857,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', @@ -864,7 +932,7 @@ readonly: false }, { - type: 'select', + type: 'radio', key: 'position', label: Formdict['header.form.position'], initVal: card.position || 'toolbar', @@ -1067,7 +1135,7 @@ * @param {object} card // 鎼滅储鏉′欢瀵硅薄 * @param {Array} menulist // 鑿滃崟鍒楄〃-鐢ㄤ簬瀛楁閫忚 */ -export function getColumnForm (card, menulist = []) { +export function getColumnForm (card, menulist = [], fields = []) { let roleList = sessionStorage.getItem('sysRoles') if (roleList) { try { @@ -1077,6 +1145,10 @@ } } else { roleList = [] + } + + if (!card.linkurl && (!card.linkmenu || card.linkmenu.length === 0)) { + card.perspective = '' } return [ @@ -1116,6 +1188,9 @@ }, { value: 'textarea', text: Formdict['model.form.textarea'] + }, { + value: 'index', + text: '搴忓彿' }] }, { @@ -1326,8 +1401,11 @@ type: 'radio', key: 'perspective', label: '瀛楁閫忚', - initVal: card.perspective || 'linkmenu', + initVal: card.perspective || '', options: [{ + value: '', + text: '鏃�' + }, { value: 'linkmenu', text: '鑿滃崟' }, { @@ -1340,15 +1418,23 @@ key: 'linkmenu', label: Formdict['model.menu'], initVal: card.linkmenu || [], - required: false, + required: true, options: menulist }, { - type: 'text', + type: 'textarea', key: 'linkurl', label: '閾炬帴鍦板潃', initVal: card.linkurl || '', - required: false + required: true + }, + { + type: 'multiselect', + key: 'linkfields', + label: '鍏宠仈瀛楁', + initVal: card.linkfields || [], + required: false, + options: fields }, { type: 'multiselect', @@ -1851,8 +1937,10 @@ }) } - if (card.type === 'textarea' || card.type === 'fileupload' || card.type === 'multiselect' || card.type === 'checkbox') { + if (['fileupload', 'multiselect', 'checkbox'].includes(card.type)) { _fieldlength = 512 + } else if (['textarea', 'brafteditor'].includes(card.type)) { + _fieldlength = 8000 } return [ @@ -1921,14 +2009,20 @@ value: 'textarea', text: Formdict['model.form.textarea'] }, { - value: 'hint', - text: '鎻愮ず' - }, { value: 'color', text: Formdict['model.form.color'] }, { + value: 'brafteditor', + text: '瀵屾枃鏈�' + }, { value: 'funcvar', text: Formdict['header.form.funcvar'] + }, { + value: 'hint', + text: '鎻愮ず' + }, { + value: 'split', + text: '鍒嗛殧绾�' }, ..._openType] }, @@ -1936,7 +2030,7 @@ type: 'text', key: 'initval', label: Formdict['header.form.initval'], - tooltip: '涓嬫媺澶氶�変笌澶氶�夋锛屾坊鍔犲涓垵濮嬪�艰浣跨敤鈥�,鈥濆彿鍒嗛殧銆�', + tooltip: '涓嬫媺澶氶�変笌澶氶�夋锛屾坊鍔犲涓垵濮嬪�艰浣跨敤鈥�,鈥濆彿鍒嗛殧銆傛敞锛氫笅鎷夐�夋嫨銆佽仈鍔ㄨ彍鍗曟垨鍗曢�夋涓�$first琛ㄧず閫夋嫨绗竴椤�', initVal: card.initval || '', required: false }, @@ -1953,14 +2047,28 @@ key: 'openVal', label: '寮�鍚��', initVal: card.openVal || '', - required: true + required: false }, { type: 'text', key: 'closeVal', label: '鍏抽棴鍊�', initVal: card.closeVal || '', - required: true + required: false + }, + { + type: 'text', + key: 'openText', + label: '寮�鍚彁绀�', + initVal: card.openText || '', + required: false + }, + { + type: 'text', + key: 'closeText', + label: '鍏抽棴鎻愮ず', + initVal: card.closeText || '', + required: false }, { type: 'radio', @@ -1993,6 +2101,9 @@ { type: 'number', key: 'width', + min: 1, + max: 24, + precision: 0, label: '鍗$墖瀹藉害', initVal: card.width || 4, tooltip: '鏍呮牸甯冨眬锛屾瘡琛岀瓑鍒嗕负24鍒椼��', @@ -2134,6 +2245,9 @@ { type: 'number', key: 'decimal', + min: 0, + max: 18, + precision: 0, label: Formdict['header.form.decimal'], initVal: card.decimal || 0, required: true @@ -2155,6 +2269,9 @@ { type: 'number', key: 'fieldlength', + min: 1, + max: 1000000, + precision: 0, label: Formdict['model.form.field'] + Formdict['model.length'], tooltip: '鏂囨湰銆佷笅鎷夋銆佹棩鏈熺瓑瀛楁榛樿闀垮害涓�50锛屽琛屾枃鏈笌鏂囦欢涓婁紶瀛楁榛樿闀垮害涓�512', initVal: card.fieldlength || _fieldlength, @@ -2163,6 +2280,9 @@ { type: 'number', key: 'maxRows', + min: 2, + max: 100, + precision: 0, label: Formdict['header.form.maxRows'], initVal: card.maxRows || 6, required: false @@ -2205,9 +2325,25 @@ { type: 'number', key: 'maxfile', + min: 1, + max: 1000000, + precision: 0, label: '鏈�澶ф枃浠舵暟', initVal: card.maxfile || '', required: false + }, + { + type: 'radio', + key: 'hidelabel', + label: '闅愯棌鍚嶇О', + initVal: card.hidelabel || 'false', + options: [{ + value: 'true', + text: Formdict['model.true'] + }, { + value: 'false', + text: Formdict['model.false'] + }] }, { type: 'radio', @@ -2291,23 +2427,54 @@ }, { type: 'radio', - key: 'entireLine', - label: '鍗犳嵁鏁磋', - initVal: card.entireLine || 'false', - required: false, + key: 'declareType', + label: '鏁版嵁绫诲瀷', + tooltip: '澹版槑鍙橀噺鏃剁殑绫诲瀷锛屾椂闂存牸寮廳atetime鎴栨枃鏈牸寮弉varchar(50)銆�', + initVal: card.declareType || 'datetime', options: [{ - value: 'true', - text: '鏄�' + value: 'datetime', + text: 'datetime' }, { - value: 'false', - text: '鍚�' + value: 'nvarchar(50)', + text: 'nvarchar(50)' }] + }, + { + type: 'number', + key: 'span', + min: 1, + max: 24, + precision: 0, + label: '琛ㄥ崟瀹藉害', + initVal: card.span || (['textarea', 'hint', 'checkcard', 'brafteditor'].includes(card.type) ? 24 : 12), + tooltip: '鏍呮牸甯冨眬鏁磋24绛夊垎銆�', + required: true + }, + { + type: 'number', + key: 'labelwidth', + min: 1, + max: 100, + precision: 1, + label: '鍚嶇О瀹藉害', + initVal: card.labelwidth || 33.3, + tooltip: '鍚嶇О鍗犳嵁琛ㄥ崟瀹藉害鐨勭櫨鍒嗘瘮銆傛敞锛氬瓨鍦ㄥ鍒楄〃鍗曟椂锛屽綋鍓嶈〃鍗曞鏋滄兂瑕佸崰鎹暣琛屽彲鍙傜収浠ヤ笅姣斾緥锛屼袱鍒楋紙16.2锛夈�佷笁鍒楋紙10.5锛夈�佸洓鍒楋紙7.7锛�', + required: true + }, + { + type: 'text', + key: 'suffix', + label: '鍚庣紑鍚�', + tooltip: '鍙互涓婁紶鏂囦欢鐨勫悗缂�鍚嶏紝澶氫釜绫诲瀷鐢ㄩ�楀彿鍒嗛殧锛岀┖鍊兼椂涓嶆牎楠屻��', + initVal: card.suffix || '', + required: false, + readonly: false }, { type: 'radio', key: 'encryption', label: '鍔犲瘑浼犺緭', - initVal: card.encryption || 'false', + initVal: card.type === 'brafteditor' ? (card.encryption || 'true') : (card.encryption || 'false'), options: [{ value: 'true', text: Formdict['model.true'] @@ -2319,7 +2486,7 @@ { type: 'radio', key: 'interception', - label: '鎴彇', + label: '鎴彇绌烘牸', initVal: card.interception || 'false', tooltip: '鎻愪氦鏃讹紝鏄惁鎴彇棣栧熬鐨勭┖鐧藉瓧绗︺��', options: [{ @@ -2355,6 +2522,14 @@ label: '鎮诞鎻愮ず', tooltip: '榧犳爣鎮诞浜庢彁绀烘枃瀛椾笂鏂规椂锛屾樉绀烘彁绀轰俊鎭��', initVal: card.tooltip || '', + required: false + }, + { + type: 'text', + key: 'extra', + label: '搴曢儴鎻愮ず', + tooltip: '鏄剧ず浜庤〃鍗曞簳閮ㄣ��', + initVal: card.extra || '', required: false }, { @@ -2427,17 +2602,17 @@ initVal: card.label || '', required: true }, - { - type: 'select', - key: 'type', - label: Formdict['model.form.tabType'], - initVal: card.type || 'SubTable', - required: true, - options: [{ - value: 'SubTable', - text: Formdict['model.menu.tab.subtable'] - }] - }, + // { + // type: 'select', + // key: 'type', + // label: Formdict['model.form.tabType'], + // initVal: card.type || 'SubTable', + // required: true, + // options: [{ + // value: 'SubTable', + // text: Formdict['model.menu.tab.subtable'] + // }] + // }, { type: 'select', key: 'linkTab', -- Gitblit v1.8.0