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/templates/zshare/formconfig.jsx | 350 ++++++++++++++++++++++++++++++--------------------------- 1 files changed, 184 insertions(+), 166 deletions(-) diff --git a/src/templates/zshare/formconfig.jsx b/src/templates/zshare/formconfig.jsx index ff31f6c..dfcd692 100644 --- a/src/templates/zshare/formconfig.jsx +++ b/src/templates/zshare/formconfig.jsx @@ -1,6 +1,6 @@ import zhCN from '@/locales/zh-CN/model.js' import enUS from '@/locales/en-US/model.js' -import { formRule } from '@/utils/option.js' +import { formRule, btnClasses } from '@/utils/option.js' const Formdict = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS @@ -364,23 +364,30 @@ } } + let options = card.options || [] + if (['select', 'link'].includes(card.type) && card.setAll === 'true') { // 鍏煎 + options.unshift({ + key: 'empty', + Value: '', + Text: '鍏ㄩ儴', + ParentID: '' + }) + } + return [ { type: 'text', key: 'label', label: Formdict['model.name'], initVal: card.label || '', - required: true, - readonly: false + required: true }, { type: 'text', key: 'field', label: Formdict['model.form.field'], initVal: card.field || '', - tooltipClass: 'middle', - required: true, - readonly: false + required: true }, { type: 'select', @@ -395,8 +402,7 @@ key: 'datefield', label: '鏃堕棿瀛楁', initVal: card.datefield || '', - required: true, - readonly: false + required: true }, { type: 'text', @@ -409,7 +415,7 @@ { type: 'radio', key: 'resourceType', - label: Formdict['header.form.resourceType'], + label: '閫夐」鏉ユ簮', initVal: card.resourceType || '0', required: true, options: [{ @@ -420,19 +426,19 @@ text: Formdict['header.form.datasource'] }] }, - { - type: 'radio', - key: 'setAll', - label: Formdict['header.form.setAll'], - initVal: card.setAll || 'true', - options: [{ - value: 'true', - text: Formdict['model.true'] - }, { - value: 'false', - text: Formdict['model.false'] - }] - }, + // { + // type: 'radio', + // key: 'setAll', + // label: '璁剧疆鍏ㄩ儴', + // initVal: card.setAll || 'true', + // options: [{ + // value: 'true', + // text: Formdict['model.true'] + // }, { + // value: 'false', + // text: Formdict['model.false'] + // }] + // }, { type: 'radio', key: 'display', @@ -461,18 +467,16 @@ { type: 'text', key: 'cardValField', - label: Formdict['header.form.valueField'], + label: '鍊悸峰瓧娈�', initVal: card.cardValField || 'Value', - required: true, - readonly: false + required: true }, { type: 'text', key: 'urlField', label: '鍦板潃瀛楁', initVal: card.urlField || '', - required: true, - readonly: false + required: true }, { type: 'radio', @@ -499,24 +503,21 @@ key: 'fields', label: '瀛楁闆�', initVal: card.fields || [], - required: true, - readonly: false + required: true }, { type: 'textarea', key: 'dataSource', label: Formdict['header.form.datasource'], initVal: card.dataSource || '', - required: true, - readonly: false + required: true }, { type: 'options', key: 'options', label: '閫夐」', - initVal: card.options || [], - required: true, - readonly: false + initVal: options, + required: true }, { type: 'checkbox', @@ -524,7 +525,6 @@ label: '閫夐」', initVal: card.items || ['day', 'week', 'month', 'quarter', 'year', 'customized'], required: true, - readonly: false, options: [{ value: 'day', label: '鏃�' @@ -546,42 +546,53 @@ }] }, { + type: 'radio', + key: 'multiple', + label: '閫夋嫨褰㈠紡', + initVal: card.multiple || 'false', + required: true, + options: [{ + value: 'false', + text: '鍗曢��' + }, { + value: 'true', + text: '澶氶��' + }] + }, + { type: 'select', key: 'linkField', - label: Formdict['header.form.linkField'], + label: '鍏宠仈瀛楁', initVal: card.linkField || '', required: true, - readonly: false, + allowClear: true, options: linkableFields }, { type: 'text', key: 'valueField', - label: Formdict['header.form.valueField'], + label: '鍊悸峰瓧娈�', initVal: card.valueField || '', - required: true, - readonly: false + required: true }, { type: 'text', key: 'valueText', - label: Formdict['header.form.valueText'], + label: '鏂囨湰路瀛楁', initVal: card.valueText || '', - required: true, - readonly: false + required: true }, { type: 'text', key: 'orderBy', - label: Formdict['header.form.orderBy'], + label: '鎺掑簭路瀛楁', initVal: card.orderBy || '', - required: false, - readonly: false + required: false }, { type: 'select', key: 'orderType', - label: Formdict['header.form.orderType'], + label: '鎺掑簭鏂瑰紡', initVal: card.orderType || 'asc', options: [{ value: 'asc', @@ -617,14 +628,14 @@ { type: 'radio', key: 'database', - label: Formdict['header.form.database'], + label: '鏁版嵁搴�', initVal: card.database || 'local', options: [{ value: 'local', - text: Formdict['header.form.database.local'] + text: '鏈湴' }, { value: 'sso', - text: Formdict['header.form.database.sso'] + text: '绯荤粺' }] }, { @@ -637,20 +648,6 @@ initVal: card.ratio || 6, forbid: appType === 'mob', required: false - }, - { - type: 'radio', - key: 'multiple', - label: '鍙閫�', - initVal: card.multiple || 'false', - required: true, - options: [{ - value: 'true', - text: '鏄�' - }, { - value: 'false', - text: '鍚�' - }] }, { type: 'radio', @@ -820,7 +817,7 @@ * @param {*} usefulFields 瀛樺偍杩囩▼鍙敤鐨勫紑濮嬪瓧娈� * @param {*} type 鎸夐挳绫诲瀷锛岀敤浜庡尯鍒嗗彲閫夌殑鎵撳紑鏂瑰紡 */ -export function getActionForm (card, config, usefulFields, type, menulist = [], printTemps = []) { +export function getActionForm (card, config, usefulFields, type, menulist = [], printTemps = [], tabs = []) { let columns = (config.columns || []).filter(col => col.field) let opentypes = [ @@ -864,6 +861,11 @@ card.popClose = 'grid' } + if (card.OpenType === 'outerpage') { + card.pageTemplate = 'custom' + card.OpenType = 'innerpage' + } + let refresh = [] if (type === 'subtable') { // 瀛愯〃椤甸潰锛屽彲璁剧疆鍒锋柊涓昏〃鍙婂悓绾ф爣绛� @@ -872,10 +874,10 @@ } refresh.push({ value: 'maingrid', - text: Formdict['header.form.refresh.maingrid'] + text: '鍒锋柊涓昏〃锛堣锛�' }, { value: 'equaltab', - text: Formdict['header.form.refresh.equaltab'] + text: '鍒锋柊鍚岀骇鏍囩' }) } @@ -898,12 +900,12 @@ { type: 'select', key: 'funcType', - label: Formdict['header.form.funcType'], + label: '鍔熻兘绫诲瀷', initVal: card.funcType || '', required: true, options: [{ value: 'changeuser', - text: Formdict['header.form.func.changeuser'] + text: '鍒囨崲鐢ㄦ埛' }, { value: 'print', text: '鏍囩鎵撳嵃' @@ -981,7 +983,6 @@ initVal: card.innerFunc || '', tooltip: `鍑芥暟鍚嶇О闇�浠�${usefulFields.join(', ')}绛夊瓧绗﹀紑濮嬨�俙, fields: usefulFields, - tooltipClass: 'middle', required: card.intertype === 'inner', readonly: false }, @@ -991,7 +992,13 @@ label: '鍏宠仈鏍囩', initVal: card.linkTab || '', required: false, - options: [] + options: [ + { + value: '', + text: '鏂板缓' + }, + ...tabs + ] }, { type: 'select', @@ -1131,7 +1138,7 @@ { type: 'radio', key: 'position', - label: Formdict['header.form.position'], + label: '鏄剧ず浣嶇疆', initVal: card.position || 'toolbar', required: true, options: [{ @@ -1234,12 +1241,11 @@ }] }, { - type: 'select', + type: 'icon', key: 'icon', label: Formdict['model.icon'], initVal: card.icon, - required: false, - options: [] + required: false }, { type: 'select', @@ -1247,7 +1253,7 @@ label: Formdict['model.form.color'], initVal: card.class, required: false, - options: [] + options: btnClasses }, { type: 'cascader', @@ -1290,7 +1296,7 @@ { type: 'radio', key: 'pagination', - label: Formdict['header.form.pagination'], + label: '鍒嗛〉', initVal: card.pagination || 'false', required: false, options: [{ @@ -1333,7 +1339,7 @@ type: 'number', key: 'ratio', min: 1, - max: 24, + max: 3000, precision: 0, label: '姣斾緥', initVal: card.ratio || 85, @@ -1345,7 +1351,6 @@ key: 'placement', label: '鎶藉眽鏂瑰悜', initVal: card.placement || 'right', - tooltip: '浣跨敤鎶藉眽鏃舵湁鏁堛��', required: false, options: [{ value: 'right', @@ -1362,13 +1367,26 @@ }] }, { + type: 'radio', + key: 'clickouter', + label: '鐐瑰嚮钂欏眰', + initVal: card.clickouter || 'unclose', + required: false, + options: [{ + value: 'unclose', + text: '涓嶅叧闂�' + }, { + value: 'close', + text: '鍏抽棴' + }] + }, + { type: 'text', key: 'preFunc', label: '鍓嶇疆鍑芥暟', initVal: card.preFunc || '', tooltip: `鍑芥暟鍚嶇О闇�浠�${usefulFields.join(', ')}绛夊瓧绗﹀紑濮嬶紱鍓嶇疆鍑芥暟鎵ц瀹屾垚鍚庯紝缁撴灉浼氫紶鍏ュ唴閮ㄥ嚱鏁颁腑锛屾鏃跺唴閮ㄥ嚱鏁颁細寮傛鎵ц锛涘綋鍓嶇疆鍑芥暟杩斿洖涓璄rrCode绛変簬-1鏃讹紝灏嗕笉鍐嶆墽琛屽唴閮ㄥ嚱鏁般�俙, fields: usefulFields, - tooltipClass: 'middle', required: false, readonly: false }, @@ -1606,7 +1624,7 @@ text: Formdict['model.empty'] }, { value: 'thdSeparator', - text: Formdict['header.form.thdSeparator'] + text: '鍗冨垎浣�' }, { value: 'percent', text: '鐧惧垎姣�' @@ -1665,8 +1683,8 @@ { type: 'radio', key: 'scale', - label: Formdict['header.form.clickscale'], - initVal: card.scale || 'false', + label: '鐐瑰嚮缂╂斁', + initVal: card.scale || 'true', required: false, options: [{ value: 'true', @@ -1946,8 +1964,8 @@ readonly: !(setting.laypage === 'false'), forbid: !['line', 'bar'].includes(card.chartType), options: [ - { value: 'query', text: Formdict['header.form.query'] }, - { value: 'statistics', text: Formdict['header.form.statistics'] } + { value: 'query', text: '鏌ヨ' }, + { value: 'statistics', text: '缁熻' } ] }, { @@ -2268,7 +2286,7 @@ text: '鍒嗛殧绾�' }, { value: 'linkMain', - text: Formdict['header.form.linkMain'] + text: '鍏宠仈涓昏〃' }] let _fieldlength = 50 @@ -2334,6 +2352,23 @@ _fieldlength = 8000 } + let options = card.options || [] + if (['select', 'radio', 'link'].includes(card.type) && card.setAll === 'true') { // 鍏煎 + options.unshift({ + key: 'empty', + Value: '', + Text: card.emptyText || '绌�', + ParentID: '' + }) + } + + let initval = card.initval || '' + if (card.type === 'switch') { + initval = card.initval === true + } else if (card.type === 'number') { + initval = card.initval || 0 + } + return [ { type: 'text', @@ -2363,8 +2398,7 @@ type: 'text', key: 'initval', label: Formdict['header.form.initval'], - tooltip: '涓嬫媺澶氶�変笌澶氶�夋锛屾坊鍔犲涓垵濮嬪�艰浣跨敤鈥�,鈥濆彿鍒嗛殧銆傛敞锛氫笅鎷夐�夋嫨銆佽仈鍔ㄨ彍鍗曟垨鍗曢�夋涓�$first琛ㄧず閫夋嫨绗竴椤�', - initVal: card.initval || '', + initVal: initval, required: false }, { @@ -2394,21 +2428,19 @@ key: 'openText', label: '寮�鍚彁绀�', initVal: card.openText || '', - required: false, - forbid: appType === 'mob' + required: false }, { type: 'text', key: 'closeText', label: '鍏抽棴鎻愮ず', initVal: card.closeText || '', - required: false, - forbid: appType === 'mob' + required: false }, { type: 'radio', key: 'resourceType', - label: Formdict['header.form.resourceType'], + label: '閫夐」鏉ユ簮', initVal: card.resourceType || '0', required: true, options: [{ @@ -2447,7 +2479,7 @@ { type: 'text', key: 'cardValField', - label: Formdict['header.form.valueField'], + label: '鍊悸峰瓧娈�', initVal: card.cardValField || 'Value', required: true, readonly: false @@ -2480,19 +2512,19 @@ text: '16:9' }] }, - { - type: 'radio', - key: 'setAll', - label: '璁剧疆绌哄��', - initVal: card.setAll || 'false', - options: [{ - value: 'true', - text: Formdict['model.true'] - }, { - value: 'false', - text: Formdict['model.false'] - }] - }, + // { + // type: 'radio', + // key: 'setAll', + // label: '璁剧疆绌哄��', + // initVal: card.setAll || 'false', + // options: [{ + // value: 'true', + // text: Formdict['model.true'] + // }, { + // value: 'false', + // text: Formdict['model.false'] + // }] + // }, { type: 'fields', key: 'fields', @@ -2505,7 +2537,7 @@ type: 'options', key: 'options', label: '閫夐」', - initVal: card.options || [], + initVal: options, required: true, readonly: false }, @@ -2518,18 +2550,33 @@ readonly: false }, { + type: 'radio', + key: 'multiple', + label: '閫夋嫨褰㈠紡', + initVal: card.multiple || 'false', + required: true, + options: [{ + value: 'false', + text: '鍗曢��' + }, { + value: 'true', + text: '澶氶��' + }] + }, + { type: 'select', key: 'linkField', - label: Formdict['header.form.linkField'], + label: '鍏宠仈瀛楁', initVal: card.linkField || '', required: true, readonly: false, + allowClear: true, options: linkableFields }, { type: 'text', key: 'valueField', - label: Formdict['header.form.valueField'], + label: '鍊悸峰瓧娈�', initVal: card.valueField || '', required: true, readonly: false @@ -2537,7 +2584,7 @@ { type: 'text', key: 'valueText', - label: Formdict['header.form.valueText'], + label: '鏂囨湰路瀛楁', initVal: card.valueText || '', required: true, readonly: false @@ -2545,7 +2592,7 @@ { type: 'text', key: 'orderBy', - label: Formdict['header.form.orderBy'], + label: '鎺掑簭路瀛楁', initVal: card.orderBy || '', required: false, readonly: false @@ -2553,7 +2600,7 @@ { type: 'select', key: 'orderType', - label: Formdict['header.form.orderType'], + label: '鎺掑簭鏂瑰紡', initVal: card.orderType || 'asc', options: [{ value: 'asc', @@ -2571,20 +2618,6 @@ tooltip: '璁剧疆绂佺敤瀛楁锛屼笖瀛楁鍊间负true鏃讹紝閫夐」涓嶅彲閫夈��', required: false, readonly: false - }, - { - type: 'radio', - key: 'multiple', - label: '鍙閫�', - initVal: card.multiple || 'false', - required: true, - options: [{ - value: 'true', - text: '鏄�' - }, { - value: 'false', - text: '鍚�' - }] }, { type: 'number', @@ -2714,10 +2747,10 @@ type: 'number', key: 'fieldlength', min: 1, - max: 1000000, + max: 100000, precision: 0, label: Formdict['model.form.field'] + Formdict['model.length'], - tooltip: '鏂囨湰銆佷笅鎷夋銆佹棩鏈熺瓑瀛楁榛樿闀垮害涓�50锛屽琛屾枃鏈笌鏂囦欢涓婁紶瀛楁榛樿闀垮害涓�512', + // tooltip: '鏂囨湰銆佷笅鎷夋銆佹棩鏈熺瓑瀛楁榛樿闀垮害涓�50锛屽琛屾枃鏈笌鏂囦欢涓婁紶瀛楁榛樿闀垮害涓�512', initVal: card.fieldlength || _fieldlength, required: false }, @@ -2727,7 +2760,7 @@ min: 1, max: 100, precision: 0, - label: appType === 'mob' ? '琛屾暟' : Formdict['header.form.maxRows'], + label: appType === 'mob' ? '琛屾暟' : '鏈�澶ц鏁�', tooltip: appType === 'mob' ? '琛屾暟涓虹┖鏃讹紝楂樺害鑷�傚簲' : '', initVal: card.maxRows || (appType === 'mob' ? '' : 6), required: false @@ -2735,7 +2768,7 @@ { type: 'select', key: 'regular', - label: Formdict['header.form.regular'], + label: '姝e垯鏍¢獙', initVal: card.regular || '', options: [{ value: '', @@ -2748,7 +2781,7 @@ text: Formdict['header.form.letter'] }, { value: 'letter&number', - text: Formdict['header.form.letter&number'] + text: '瀛楁瘝+鏁板瓧' }, { value: 'phone', text: '鎵嬫満鍙�' @@ -2800,7 +2833,7 @@ { type: 'radio', key: 'readonly', - label: Formdict['header.form.readonly'], + label: '鍙', initVal: card.readonly || 'false', options: [{ value: 'true', @@ -2839,14 +2872,14 @@ { type: 'radio', key: 'database', - label: Formdict['header.form.database'], + label: '鏁版嵁搴�', initVal: card.database || 'local', options: [{ value: 'local', - text: Formdict['header.form.database.local'] + text: '鏈湴' }, { value: 'sso', - text: Formdict['header.form.database.sso'] + text: '绯荤粺' }] }, { @@ -2883,7 +2916,7 @@ { type: 'radio', key: 'readin', - label: Formdict['header.form.readin'], + label: '鑷姩濉厖', tooltip: '鏄惁灏嗚〃鏍奸�変腑鐨勬暟鎹嚜鍔ㄥ~鍏呭埌琛ㄥ崟锛堝瓧娈电浉鍚岋級', initVal: card.readin || 'true', options: [{ @@ -3167,10 +3200,11 @@ type: 'select', key: 'supField', label: '涓婄骇琛ㄥ崟', - tooltip: '涓婄骇琛ㄥ崟涓轰笅鎷夐�夋嫨銆佽仈鍔ㄨ彍鍗曘�佸崟閫夋鍙婂閫夋锛屾坊鍔犲悗璇ヨ〃鍗曟樉绀哄強闅愯棌灏嗗彈涓婄骇琛ㄥ崟鎺у埗锛屾敞锛氬彈鎺у叧绯诲湪璇ヨ〃鍗曢殣钘忔椂澶辨晥銆�', + tooltip: '璇ヨ〃鍗曟樉绀烘垨闅愯棌鍙椾笂绾ц〃鍗曟帶鍒躲��', initVal: card.supField || '', required: false, readonly: false, + allowClear: true, options: linksupFields }, { @@ -3179,7 +3213,7 @@ label: '鏄剧ず鍊�', tooltip: '璇峰~鍐欐樉绀哄�硷紝鍙湁涓婄骇琛ㄥ崟鍊间笌鏄剧ず鍊肩浉鍚屾椂锛岃琛ㄥ崟鎵嶄細鏄剧ず锛屾敞锛�1銆佸涓�肩敤閫楀彿鍒嗛殧锛�2銆佷笂绾ц〃鍗曞垵濮嬪�间负$first鏃舵殏鏈鐞嗐��', initVal: card.supvalue || '', - required: true, + required: false, readonly: false }, { @@ -3208,14 +3242,14 @@ initVal: card.placeholder || '', required: false }, - { - type: 'text', - key: 'emptyText', - label: '绌哄�兼枃鏈�', - tooltip: '绌哄�肩殑鎻愮ず鏂囨湰锛岄�夋嫨璁剧疆绌哄�兼椂鏈夋晥锛岄粯璁ゅ�间负銆婄┖銆嬨��', - initVal: card.emptyText || '', - required: false - }, + // { + // type: 'text', + // key: 'emptyText', + // label: '绌哄�兼枃鏈�', + // tooltip: '绌哄�肩殑鎻愮ず鏂囨湰锛岄�夋嫨璁剧疆绌哄�兼椂鏈夋晥锛岄粯璁ゅ�间负銆婄┖銆嬨��', + // initVal: card.emptyText || '', + // required: false + // }, { type: 'radio', key: 'enter', @@ -3244,8 +3278,8 @@ { type: 'multiselect', key: 'linkSubField', - label: Formdict['model.form.linkform'], - tooltip: '鍦ㄥ垏鎹㈤�夐」鏃朵細鎶婁俊鎭嚜鍔ㄥ~鍏ュ叧鑱旂殑琛ㄥ崟锛堟枃鏈垨鏁板瓧琛ㄥ崟锛変腑銆傛敞锛氫娇鐢ㄩ�夐」鍗′笖璁句负鍙閫夋椂鏃犳晥銆�', + label: '濉厖琛ㄥ崟', + tooltip: '鍦ㄥ垏鎹㈤�夐」鏃朵細鎶婁俊鎭嚜鍔ㄥ~鍏ュ叧鑱旂殑琛ㄥ崟锛堟枃鏈垨鏁板瓧琛ㄥ崟锛変腑銆�', initVal: card.linkSubField || [], options: inputfields }, @@ -3309,27 +3343,11 @@ options: [] }, { - type: 'select', + type: 'icon', key: 'icon', label: Formdict['model.icon'], initVal: card.icon || '', required: false, - options: [{ - value: '', - text: Formdict['model.empty'] - }, { - value: 'table', - text: 'table' - }, { - value: 'bar-chart', - text: 'bar-chart' - }, { - value: 'pie-chart', - text: 'pie-chart' - }, { - value: 'line-chart', - text: 'line-chart' - }], forbid: type === 'CalendarPage' }, { -- Gitblit v1.8.0