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 | 2556 +++++++++++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 2,137 insertions(+), 419 deletions(-) diff --git a/src/templates/zshare/formconfig.jsx b/src/templates/zshare/formconfig.jsx index 8ea25d1..a9fa640 100644 --- a/src/templates/zshare/formconfig.jsx +++ b/src/templates/zshare/formconfig.jsx @@ -1,18 +1,308 @@ -import zhCN from '@/locales/zh-CN/comtable.js' -import enUS from '@/locales/en-US/comtable.js' +import zhCN from '@/locales/zh-CN/model.js' +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 鑾峰彇鏍戝舰椤甸潰璁剧疆琛ㄥ崟閰嶇疆淇℃伅 + * @param {object} setting // 鑿滃崟鍏ㄥ眬璁剧疆淇℃伅 + * @param {array} usefulFields // 鍙敤寮�濮嬪瓧绗� + * @param {string} MenuID // 鑿滃崟ID + */ +export function getTreeSettingForm (setting, usefulFields = [], MenuID) { + let str = '^(' + usefulFields.join('|') + ')' + let _patten = new RegExp(str + formRule.func.innerPattern + '$', 'g') + + return [ + { + type: 'text', + key: 'tableName', + label: '琛ㄥ悕', + initVal: setting.tableName || '', + required: true, + readonly: false, + rules: [ + { + max: formRule.input.max, + message: formRule.input.message + } + ] + }, + { + type: 'text', + key: 'title', + label: '鏍囬', + initVal: setting.title || '', + required: true, + readonly: false, + rules: [ + { + max: formRule.input.max, + message: formRule.input.message + } + ] + }, + { + type: 'radio', + key: 'interType', + label: Formdict['header.form.intertype'], + initVal: setting.interType || 'inner', + required: false, + readonly: false, + options: [ + { value: 'inner', text: Formdict['model.interface.inner'] }, + { value: 'outer', text: Formdict['model.interface.outer'] } + ] + }, + { + type: 'radio', + key: 'sysInterface', + label: Formdict['header.form.sysInterface'], + initVal: setting.sysInterface || 'false', + required: false, + readonly: false, + options: [ + { value: 'true', text: Formdict['model.true'] }, + { value: 'false', text: Formdict['model.false'] } + ] + }, + { + type: 'text', + key: 'interface', + label: Formdict['header.form.interface'], + initVal: setting.sysInterface === 'true' ? (window.GLOB.mainSystemApi || '') : (setting.interface || ''), + required: true, + readonly: setting.sysInterface === 'true', + rules: [ + { + max: formRule.input.max, + message: formRule.input.message + } + ] + }, + { + type: 'text', + key: 'outerFunc', + label: Formdict['header.form.outerFunc'], + initVal: setting.outerFunc || '', + required: false, + readonly: false, + rules: [ + { + pattern: formRule.func.pattern, + message: formRule.func.message + }, { + max: formRule.func.max, + message: formRule.func.maxMessage + } + ] + }, + { + type: 'text', + key: 'innerFunc', + label: Formdict['header.form.innerFunc'], + initVal: setting.innerFunc || '', + tooltip: '寮�澶村彲鐢ㄥ瓧绗︼細' + usefulFields.join(', '), + placement: 'bottomLeft', + required: false, + readonly: false, + rules: [ + { + pattern: _patten, + message: formRule.func.innerMessage + }, { + max: formRule.func.max, + message: formRule.func.maxMessage + } + ] + }, + { + type: 'datasource', + key: 'dataresource', + label: '鏁版嵁婧�', + initVal: setting.dataresource || '', + tooltip: '浣跨敤绯荤粺鍑芥暟鏃讹紝闇�濉啓鏁版嵁婧愩�傛敞锛氭暟鎹潈闄愭浛鎹㈢ $@ -> /* 鎴� \'\'銆� @$ -> */ 鎴� \'\'', + help: '鏁版嵁ID锛�' + MenuID, + required: false, + readonly: false, + rules: [ + { + pattern: _patten, + message: formRule.func.innerMessage + }, { + max: formRule.func.max, + message: formRule.func.maxMessage + } + ] + }, + { + type: 'text', + key: 'valueField', + label: 'Value', + initVal: setting.valueField || '', + tooltip: '鏁版嵁鍊煎瓧娈点��', + required: true, + readonly: false, + rules: [ + { + pattern: formRule.field.pattern, + message: formRule.field.message + }, { + max: formRule.field.max, + message: formRule.field.maxMessage + } + ] + }, + { + type: 'text', + key: 'labelField', + label: 'Label', + initVal: setting.labelField || '', + tooltip: '鏄剧ず鏂囧瓧瀛楁銆�', + required: true, + readonly: false, + rules: [ + { + pattern: formRule.field.pattern, + message: formRule.field.message + }, { + max: formRule.field.max, + message: formRule.field.maxMessage + } + ] + }, + { + type: 'text', + key: 'parentField', + label: 'Parent', + initVal: setting.parentField || '', + tooltip: '鐖剁骇瀛楁銆�', + required: true, + readonly: false, + rules: [ + { + pattern: formRule.field.pattern, + message: formRule.field.message + }, { + max: formRule.field.max, + message: formRule.field.maxMessage + } + ] + }, + { + type: 'text', + key: 'order', + label: '鎺掑簭', + initVal: setting.order || '', + placeholder: 'ID asc, UID desc', + required: true, + readonly: false, + rules: [ + { + max: formRule.input.max, + message: formRule.input.message + } + ] + }, + { + type: 'text', + key: 'mark', + label: '椤剁骇鏍囪瘑', + initVal: setting.mark || '', + tooltip: '鐖剁骇瀛楁鍊间笌椤剁骇鏍囪瘑鐩稿悓鏃讹紝瑙嗕负椤剁骇鑺傜偣銆�', + required: false, + readonly: false, + rules: [ + { + max: formRule.input.max, + message: formRule.input.message + } + ] + }, + { + type: 'number', + key: 'width', + min: 2, + max: 12, + label: '瀹藉害', + tooltip: '鏍呮牸甯冨眬锛屾瘡琛岀瓑鍒嗕负24鍒楋紝鏍戝舰姣斾緥鍙缃负2-12锛堟渶澶�50%锛�', + initVal: setting.width || 5, + required: true + }, + { + type: 'radio', + key: 'searchable', + label: '鎼滅储', + initVal: setting.searchable || 'true', + required: false, + readonly: false, + options: [ + { value: 'true', text: '鏄剧ず' }, + { value: 'false', text: '闅愯棌' } + ] + }, + { + type: 'radio', + key: 'default', + label: '榛樿sql', + initVal: setting.default || 'true', + required: false, + readonly: false, + options: [ + { value: 'true', text: '鎵ц' }, + { value: 'false', text: '涓嶆墽琛�' } + ] + }, + { + type: 'radio', + key: 'showIcon', + label: '鏄剧ず鍥炬爣', + initVal: setting.showIcon || 'false', + required: false, + readonly: false, + options: [ + { value: 'true', text: Formdict['model.true'] }, + { value: 'false', text: Formdict['model.false'] } + ] + }, + { + type: 'radio', + key: 'showLine', + label: '鏄剧ず鍒嗗壊绾�', + initVal: setting.showLine || 'false', + required: false, + readonly: false, + options: [ + { value: 'true', text: Formdict['model.true'] }, + { value: 'false', text: Formdict['model.false'] } + ] + } + ] +} /** * @description 鑾峰彇鎼滅储鏉′欢琛ㄥ崟閰嶇疆淇℃伅 - * @param {*} card + * @param {object} card // 鎼滅储鏉′欢瀵硅薄 + * @param {Array} linkableFields // 鍙叧鑱斿瓧娈� */ -export function getSearchForm (card, roleList) { +export function getSearchForm (card, linkableFields) { + let roleList = sessionStorage.getItem('sysRoles') + if (roleList) { + try { + roleList = JSON.parse(roleList) + } catch { + roleList = [] + } + } else { + roleList = [] + } + return [ { type: 'text', key: 'label', - label: Formdict['header.form.name'], + label: Formdict['model.name'], initVal: card.label || '', required: true, readonly: false @@ -20,9 +310,8 @@ { type: 'text', key: 'field', - label: Formdict['header.form.field'], + label: Formdict['model.form.field'], initVal: card.field || '', - tooltip: '瀛楁鍚嶅彲浠ヤ娇鐢ㄩ�楀彿鍒嗛殧锛岃繘琛屽瀛楁缁煎悎鎼滅储锛屾敞锛氱患鍚堟悳绱粎鍦ㄦ枃鏈被鍨嬫椂鏈夋晥', tooltipClass: 'middle', required: true, readonly: false @@ -30,39 +319,51 @@ { type: 'select', key: 'type', - label: Formdict['header.form.type'], + label: Formdict['model.form.type'], initVal: card.type, required: true, options: [{ value: 'text', - text: Formdict['header.form.text'] + text: Formdict['model.form.text'] }, { value: 'select', - text: Formdict['header.form.select'] + text: Formdict['model.form.select'] }, { value: 'multiselect', - text: Formdict['header.form.multiselect'] + text: Formdict['model.form.multiselect'] }, { value: 'link', - text: Formdict['header.form.link'] + text: Formdict['model.form.link'] }, { value: 'date', - text: Formdict['header.form.dateday'] + text: Formdict['model.form.dateday'] }, { value: 'dateweek', - text: Formdict['header.form.dateweek'] + text: Formdict['model.form.dateweek'] }, { value: 'datemonth', - text: Formdict['header.form.datemonth'] + text: Formdict['model.form.datemonth'] }, { value: 'daterange', - text: Formdict['header.form.daterange'] + text: Formdict['model.form.daterange'] + }, { + value: 'group', + text: Formdict['model.form.dategroup'] }] + }, + { + type: 'text', + key: 'datefield', + label: '鏃堕棿瀛楁', + initVal: card.datefield || '', + required: true, + readonly: false }, { type: 'text', key: 'initval', label: Formdict['header.form.initval'], + tooltip: '绫诲瀷涓轰笅鎷夎彍鍗曟椂锛屽垵濮嬪�煎簲涓烘暟鎹殑Value鍊硷紙浣跨敤鏁版嵁婧愭椂锛屽簲涓恒�婂�悸峰瓧娈点�嬬殑鍊硷級', initVal: card.initval, required: false }, @@ -84,13 +385,13 @@ type: 'radio', key: 'setAll', label: Formdict['header.form.setAll'], - initVal: card.setAll || 'false', + initVal: card.setAll || 'true', options: [{ value: 'true', - text: Formdict['header.form.true'] + text: Formdict['model.true'] }, { value: 'false', - text: Formdict['header.form.false'] + text: Formdict['model.false'] }] }, { @@ -110,12 +411,40 @@ readonly: false }, { - type: 'text', + type: 'checkbox', + key: 'items', + label: '閫夐」', + initVal: card.items || ['day', 'week', 'month', 'quarter', 'year', 'customized'], + required: true, + readonly: false, + options: [{ + value: 'day', + label: '鏃�' + }, { + value: 'week', + label: '鍛�' + }, { + value: 'month', + label: '鏈�' + }, { + value: 'quarter', + label: '瀛�' + }, { + value: 'year', + label: '骞�' + }, { + value: 'customized', + label: '鑷�' + }] + }, + { + type: 'select', key: 'linkField', label: Formdict['header.form.linkField'], initVal: card.linkField || '', required: true, - readonly: false + readonly: false, + options: linkableFields }, { type: 'text', @@ -177,20 +506,20 @@ text: '>=' }] }, - { - type: 'select', - key: 'display', - label: Formdict['header.form.display'], - initVal: card.display || 'dropdown', - required: true, - options: [{ - value: 'dropdown', - text: Formdict['header.form.dropdown'] - }, { - value: 'button', - text: Formdict['header.form.button'] - }] - }, + // { + // type: 'select', + // key: 'display', + // label: Formdict['header.form.display'], + // initVal: card.display || 'dropdown', + // required: true, + // options: [{ + // value: 'dropdown', + // text: Formdict['header.form.dropdown'] + // // }, { + // // value: 'button', + // // text: Formdict['header.form.button'] + // }] + // }, { type: 'radio', key: 'database', @@ -205,35 +534,67 @@ }] }, { - type: 'radio', - key: 'required', - label: Formdict['header.form.field.required'], - initVal: card.required || 'false', - options: [{ - value: 'true', - text: Formdict['header.form.true'] - }, { - value: 'false', - text: Formdict['header.form.false'] - }] - }, - { type: 'number', key: 'ratio', min: 1, max: 24, label: Formdict['header.form.ratio'], - tooltip: '姣忚鍒嗕负24浠斤紝姣斾緥鍙缃负1-24', + tooltip: '鏍呮牸甯冨眬锛屾瘡琛岀瓑鍒嗕负24鍒椼��', initVal: card.ratio, required: false }, { - type: 'select', - key: 'quick', - label: Formdict['header.form.quickadd'], - initVal: '', - required: false, - options: [] + type: 'radio', + key: 'required', + label: Formdict['model.required'], + initVal: card.required || 'false', + options: [{ + value: 'true', + text: Formdict['model.true'] + }, { + value: 'false', + text: Formdict['model.false'] + }] + }, + { + type: 'radio', + key: 'Hide', + label: Formdict['model.hidden'], + initVal: card.Hide || 'false', + options: [{ + value: 'true', + text: Formdict['model.true'] + }, { + value: 'false', + text: Formdict['model.false'] + }] + }, + { + type: 'radio', + key: 'transfer', + label: '浼犻��', + initVal: card.transfer || 'false', + tooltip: '鏁版嵁鏌ヨ鏃讹紝绫诲瀷瀛楁鏄惁浣滀负鍙傛暟浼犻�掞紝绫诲瀷瀛楁瀵瑰簲鍊间负 {"鏃�": "day", "鍛�": "week", "鏈�": "month", "瀛�": "quarter", "骞�": "year", "鑷畾涔�": "customized"}銆�', + options: [{ + value: 'true', + text: Formdict['model.true'] + }, { + value: 'false', + text: Formdict['model.false'] + }] + }, + { + type: 'radio', + key: 'labelShow', + label: '鏄剧ず鍚嶇О', + initVal: card.labelShow || 'true', + options: [{ + value: 'true', + text: Formdict['model.true'] + }, { + value: 'false', + text: Formdict['model.false'] + }] }, { type: 'multiselect', @@ -251,61 +612,86 @@ * @param {*} card 缂栬緫鎸夐挳 * @param {*} functip 鐢熸垚瀛樺偍杩囩▼鎻愮ず * @param {*} config 椤甸潰閰嶇疆 - * @param {*} permFuncField 瀛樺偍杩囩▼鍙敤鐨勫紑濮嬪瓧娈� + * @param {*} usefulFields 瀛樺偍杩囩▼鍙敤鐨勫紑濮嬪瓧娈� + * @param {*} type 鎸夐挳绫诲瀷锛岀敤浜庡尯鍒嗗彲閫夌殑鎵撳紑鏂瑰紡 */ -export function getActionForm (card, functip, config, permFuncField) { - return [ +export function getActionForm (card, functip, config, usefulFields, type, menulist = [], printTemps = []) { + let opentypes = [ { - type: 'text', - key: 'label', - label: Formdict['header.form.name'], - initVal: card.label, - required: true, - readonly: false - }, + value: 'pop', + text: Formdict['model.form.popform'] + }, { + value: 'prompt', + text: Formdict['model.form.prompt'] + }, { + value: 'exec', + text: Formdict['model.form.exec'] + }, { + value: 'excelIn', + text: Formdict['model.form.excelIn'] + }, { + value: 'excelOut', + text: Formdict['model.form.excelOut'] + }, { + value: 'popview', + text: Formdict['model.form.popview'] + }, { + value: 'tab', + text: Formdict['model.form.tab'] + }, { + value: 'innerpage', + text: Formdict['model.form.newpage'] + }, { + value: 'funcbutton', + text: Formdict['model.form.funcbutton'] + } + ] + + // 鏍囩绫诲瀷锛屼富琛ㄦ墠浼氬瓨鍦ㄨ〃鍗曟爣绛鹃〉 + let tabTems = [{ + value: 'FormTab', + text: '琛ㄥ崟鏍囩椤�' + }] + if (type === 'subtable') { + tabTems = [] + } + + if (card.execSuccess === 'view' || card.execSuccess === 'refresh') { // refresh涓鸿〃鍗曟爣绛鹃〉 + card.execSuccess = 'grid' + } + if (card.execError === 'view' || card.execSuccess === 'refresh') { + card.execError = 'grid' + } + if (card.popClose === 'view') { + card.popClose = 'grid' + } + + let refresh = [] + + if (type === 'subtable') { // 瀛愯〃椤甸潰锛屽彲璁剧疆鍒锋柊涓昏〃鍙婂悓绾ф爣绛� + if (card.focus) { + card.popClose = 'maingrid' + } + refresh.push({ + value: 'maingrid', + text: Formdict['header.form.refresh.maingrid'] + }, { + value: 'equaltab', + text: Formdict['header.form.refresh.equaltab'] + }) + } + + return [ { type: 'select', key: 'OpenType', label: Formdict['header.form.openType'], initVal: card.OpenType, required: true, - options: [{ - value: 'pop', - text: Formdict['header.form.popform'] - }, { - value: 'prompt', - text: Formdict['header.form.prompt'] - }, { - value: 'exec', - text: Formdict['header.form.exec'] - }, { - value: 'excelIn', - text: Formdict['header.form.excelIn'] - }, { - value: 'excelOut', - text: Formdict['header.form.excelOut'] - }, { - value: 'popview', - text: Formdict['header.form.popview'] - }, { - value: 'tab', - text: Formdict['header.form.tab'] - }, { - value: 'blank', - text: Formdict['header.form.blank'] - }, { - value: 'innerpage', - text: Formdict['header.form.newpage.inner'] - }, { - value: 'outerpage', - text: Formdict['header.form.newpage.outer'] - }, { - value: 'funcbutton', - text: Formdict['header.form.funcbutton'] - }] + options: opentypes }, { - type: 'select', + type: 'radio', key: 'funcType', label: Formdict['header.form.funcType'], initVal: card.funcType || '', @@ -315,37 +701,93 @@ text: Formdict['header.form.func.changeuser'] }, { value: 'print', - text: Formdict['header.form.func.print'] + text: '鏍囩鎵撳嵃' }] }, { type: 'select', key: 'execMode', - label: Formdict['header.form.execMode'], + label: Formdict['model.form.execMode'], initVal: card.execMode || 'exec', required: true, options: [{ value: 'exec', - text: Formdict['header.form.exec'] + text: Formdict['model.form.exec'] }, { value: 'prompt', - text: Formdict['header.form.prompt'] + text: Formdict['model.form.prompt'] }, { value: 'pop', - text: Formdict['header.form.popform'] + text: Formdict['model.form.popform'] }] }, { - type: 'select', - key: 'tabType', - label: Formdict['header.form.tabType'], - initVal: card.tabType || 'SubTable', + type: 'radio', + key: 'intertype', + 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: 'SubTable', - text: Formdict['header.menu.tab.subtable'] + value: 'system', + text: '绯荤粺鍑芥暟' + }, { + value: 'inner', + text: '鍐呴儴鍑芥暟' }] }, + { + type: 'radio', + key: 'sqlType', + label: Formdict['header.form.action.type'], + initVal: card.sqlType || '', + required: true, + options: [] + }, + { + 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', + key: 'innerFunc', + label: Formdict['header.form.innerFunc'], + initVal: card.innerFunc || '', + tooltip: functip, + fields: usefulFields, + tooltipClass: 'middle', + 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: 'linkTab', @@ -357,45 +799,40 @@ { type: 'select', key: 'pageTemplate', - label: Formdict['header.form.newpage.type'], + label: Formdict['model.form.newpage.type'], initVal: card.pageTemplate || '', required: true, options: [{ - value: 'print', - text: Formdict['header.menu.printTemplate'] + // value: 'print', + // text: '鏍囩鎵撳嵃妯℃澘' + // }, { + // value: 'billprintTemp', + // text: '鍗曟嵁鎵撳嵃妯℃澘' + // }, { + value: 'billprint', + text: '鍗曟嵁鎵撳嵃' + }, { + value: 'pay', + text: Formdict['model.pay'] + }, { + value: 'custom', + text: Formdict['header.form.custom'] }] + }, + { + type: 'select', + key: 'printTemp', + label: '鎵撳嵃妯℃澘', + initVal: card.printTemp || '', + required: true, + options: printTemps }, { type: 'text', key: 'url', - label: Formdict['header.form.newpage.url'], + label: Formdict['model.pageUrl'], initVal: card.url || '', required: true - }, - { - type: 'radio', - key: 'intertype', - label: Formdict['header.form.intertype'], - initVal: card.intertype || 'inner', - required: true, - options: [{ - value: 'inner', - text: Formdict['header.form.interface.inner'] - }, { - value: 'outer', - text: Formdict['header.form.interface.outer'] - }] - }, - { - type: 'text', - key: 'innerFunc', - label: Formdict['header.form.innerFunc'], - initVal: card.innerFunc || '', - tooltip: functip, - fields: permFuncField, - tooltipClass: 'middle', - required: false, - readonly: false }, { type: 'radio', @@ -405,10 +842,10 @@ required: true, options: [{ value: 'true', - text: Formdict['header.form.true'] + text: Formdict['model.true'] }, { value: 'false', - text: Formdict['header.form.false'] + text: Formdict['model.false'] }] }, { @@ -420,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', @@ -436,7 +932,7 @@ readonly: false }, { - type: 'select', + type: 'radio', key: 'position', label: Formdict['header.form.position'], initVal: card.position || 'toolbar', @@ -460,46 +956,57 @@ { type: 'select', key: 'tabTemplate', - label: '鏍囩妯℃澘', - initVal: card.tabTemplate || 'FormTab', + label: '鏍囩绫诲瀷', + initVal: card.tabTemplate || '', required: true, - options: [{ - value: 'FormTab', - text: '甯︽爣绛捐〃鍗�' - }] + options: [ + { + value: 'ThdMenu', + text: Formdict['model.menu.level3'] + }, + ...tabTems + ] }, { - type: 'select', + type: 'cascader', + key: 'linkmenu', + label: Formdict['model.form.linkmenu'], + initVal: card.linkmenu || [], + required: true, + options: menulist + }, + { + type: 'radio', key: 'afterExecSuccess', label: Formdict['header.form.afterExecSuccess'], initVal: card.afterExecSuccess || 'close', required: true, options: [{ value: 'close', - text: Formdict['header.close'] + text: Formdict['model.close'] }, { value: 'notclose', - text: Formdict['header.notclose'] + text: Formdict['model.notclose'] }] }, { - type: 'select', + type: 'radio', key: 'afterExecError', label: Formdict['header.form.afterExecError'], initVal: card.afterExecError || 'notclose', required: true, options: [{ value: 'close', - text: Formdict['header.close'] + text: Formdict['model.close'] }, { value: 'notclose', - text: Formdict['header.notclose'] + text: Formdict['model.notclose'] }] }, { - type: 'select', + type: refresh.length === 0 ? 'radio' : 'select', key: 'execSuccess', - label: Formdict['header.form.execSuccess'], + label: Formdict['model.form.afterSuccess'], initVal: card.execSuccess || 'never', required: true, options: [{ @@ -508,15 +1015,13 @@ }, { value: 'grid', text: Formdict['header.form.refresh.grid'] - }, { - value: 'view', - text: Formdict['header.form.refresh.view'] - }] + }, + ...refresh] }, { - type: 'select', + type: refresh.length === 0 ? 'radio' : 'select', key: 'execError', - label: Formdict['header.form.execError'], + label: Formdict['model.form.afterError'], initVal: card.execError || 'never', required: true, options: [{ @@ -525,13 +1030,11 @@ }, { value: 'grid', text: Formdict['header.form.refresh.grid'] - }, { - value: 'view', - text: Formdict['header.form.refresh.view'] - }] + }, + ...refresh] }, { - type: 'select', + type: refresh.length === 0 ? 'radio' : 'select', key: 'popClose', label: Formdict['header.form.popClose'], initVal: card.popClose || 'never', @@ -542,15 +1045,27 @@ }, { value: 'grid', text: Formdict['header.form.refresh.grid'] + }, + ...refresh] + }, + { + type: 'radio', + key: 'resetPageIndex', + label: '鍒锋柊鏃�', + initVal: card.resetPageIndex || 'true', + required: false, + options: [{ + value: 'true', + text: '閲嶇疆椤电爜' }, { - value: 'view', - text: Formdict['header.form.refresh.view'] + value: 'false', + text: '涓嶉噸缃�' }] }, { type: 'select', key: 'icon', - label: Formdict['header.form.icon'], + label: Formdict['model.icon'], initVal: card.icon, required: false, options: [] @@ -558,34 +1073,31 @@ { type: 'select', key: 'class', - label: Formdict['header.form.class'], + label: Formdict['model.form.color'], initVal: card.class, required: false, options: [] }, { + type: 'radio', + key: 'joint', + label: Formdict['model.form.paramJoint'], + initVal: card.joint || 'true', + required: false, + options: [{ + value: 'true', + text: Formdict['model.true'] + }, { + value: 'false', + text: Formdict['model.false'] + }] + }, + { type: 'text', key: 'sheet', - label: Formdict['header.form.tablename'], + label: Formdict['model.form.tablename'], initVal: card.sheet || config.setting.tableName || '', required: true - }, - { - type: 'text', - key: 'sql', - label: Formdict['header.form.tablename'], - initVal: card.sql || config.setting.tableName || '', - tooltip: Formdict['header.form.actionhelp.tablename'], - required: false - }, - { - type: 'select', - key: 'sqlType', - label: Formdict['header.form.action.type'], - initVal: card.sqlType || '', - tooltip: Formdict['header.form.actionhelp.sqlType'], - required: false, - options: [] }, { type: 'radio', @@ -595,10 +1107,24 @@ required: false, options: [{ value: 'true', - text: Formdict['header.form.true'] + text: Formdict['model.true'] }, { value: 'false', - text: Formdict['header.form.false'] + text: Formdict['model.false'] + }] + }, + { + type: 'radio', + key: 'search', + label: '鎼滅储鏉′欢', + initVal: card.search || 'false', + required: false, + options: [{ + value: 'true', + text: '蹇呭~' + }, { + value: 'false', + text: '闈炲繀濉�' }] } ] @@ -606,21 +1132,37 @@ /** * @description 鑾峰彇鏄剧ず鍒楄〃鍗曢厤缃俊鎭� - * @param {*} card + * @param {object} card // 鎼滅储鏉′欢瀵硅薄 + * @param {Array} menulist // 鑿滃崟鍒楄〃-鐢ㄤ簬瀛楁閫忚 */ -export function getColumnForm (card, roleList = [], menulist = []) { +export function getColumnForm (card, menulist = [], fields = []) { + let roleList = sessionStorage.getItem('sysRoles') + if (roleList) { + try { + roleList = JSON.parse(roleList) + } catch { + roleList = [] + } + } else { + roleList = [] + } + + if (!card.linkurl && (!card.linkmenu || card.linkmenu.length === 0)) { + card.perspective = '' + } + return [ { type: 'text', key: 'label', - label: Formdict['header.form.name'], + label: Formdict['model.name'], initVal: card.label, required: true }, { type: 'text', key: 'field', - label: Formdict['header.form.field'], + label: Formdict['model.form.field'], initVal: card.field, required: true, readonly: false @@ -628,67 +1170,36 @@ { type: 'select', key: 'type', - label: Formdict['header.form.type'], + label: Formdict['model.form.type'], initVal: card.type, required: true, options: [{ value: 'text', - text: Formdict['header.form.text'] + text: Formdict['model.form.text'] }, { value: 'number', - text: Formdict['header.form.number'] + text: Formdict['model.form.number'] }, { value: 'picture', - text: Formdict['header.form.picture'] + text: Formdict['model.form.picture'] + }, { + value: 'link', + text: Formdict['model.form.href'] }, { value: 'textarea', - text: Formdict['header.form.textarea'] + text: Formdict['model.form.textarea'] + }, { + value: 'index', + text: '搴忓彿' }] }, { - type: 'select', - key: 'Align', - label: Formdict['header.form.align'], - initVal: card.Align, - required: true, - options: [{ - value: 'left', - text: Formdict['header.form.alignLeft'] - }, { - value: 'right', - text: Formdict['header.form.alignRight'] - }, { - value: 'center', - text: Formdict['header.form.alignCenter'] - }] - }, - { - type: 'radio', - key: 'Hide', - label: Formdict['header.form.Hide'], - initVal: card.Hide, - required: true, - options: [{ - value: 'true', - text: Formdict['header.form.true'] - }, { - value: 'false', - text: Formdict['header.form.false'] - }] - }, - { - type: 'radio', - key: 'IsSort', - label: Formdict['header.form.IsSort'], - initVal: card.IsSort, - required: true, - options: [{ - value: 'true', - text: Formdict['header.form.true'] - }, { - value: 'false', - text: Formdict['header.form.false'] - }] + type: 'text', + key: 'nameField', + label: Formdict['model.name'] + Formdict['model.form.field'], + initVal: card.nameField, + required: false, + readonly: false }, { type: 'number', @@ -696,9 +1207,98 @@ min: 1, max: 1000, decimal: 0, - label: Formdict['header.form.columnWidth'], + label: Formdict['model.form.columnWidth'], initVal: card.Width, required: true + }, + { + type: 'radio', + key: 'joint', + label: Formdict['model.form.paramJoint'], + initVal: card.joint || 'true', + required: true, + options: [{ + value: 'true', + text: Formdict['model.true'] + }, { + value: 'false', + text: Formdict['model.false'] + }] + }, + { + type: 'radio', + key: 'Hide', + label: Formdict['model.hidden'], + initVal: card.Hide || 'false', + required: true, + options: [{ + value: 'true', + text: Formdict['model.true'] + }, { + value: 'false', + text: Formdict['model.false'] + }] + }, + { + type: 'radio', + key: 'IsSort', + label: Formdict['model.sort'], + initVal: card.IsSort || 'true', + required: true, + options: [{ + value: 'true', + text: Formdict['model.true'] + }, { + value: 'false', + text: Formdict['model.false'] + }] + }, + { + type: 'radio', + key: 'Align', + label: Formdict['model.form.align'], + initVal: card.Align || 'left', + required: true, + options: [{ + value: 'left', + text: Formdict['model.form.alignLeft'] + }, { + value: 'center', + text: Formdict['model.form.alignCenter'] + }, { + value: 'right', + text: Formdict['model.form.alignRight'] + }] + }, + { + type: 'radio', + key: 'rowspan', + label: '琛屽悎骞�', + initVal: card.rowspan || 'false', + tooltip: '鐩搁偦琛屼俊鎭浉鍚屾椂锛屽崟鍏冩牸鍚堝苟銆�', + required: false, + options: [{ + value: 'true', + text: Formdict['model.true'] + }, { + value: 'false', + text: Formdict['model.false'] + }] + }, + { + type: 'radio', + key: 'sum', + label: '鏄剧ず鍚堣', + initVal: card.sum || 'false', + tooltip: '鍚堣淇℃伅鍙湪浣跨敤绯荤粺鏁版嵁婧愶紝涓斿綋鍓嶅垪鏈殣钘忔椂鏈夋晥銆�', + required: false, + options: [{ + value: 'true', + text: Formdict['model.true'] + }, { + value: 'false', + text: Formdict['model.false'] + }] }, { type: 'number', @@ -711,16 +1311,46 @@ required: true }, { + type: 'number', + key: 'fieldlength', + label: Formdict['model.form.field'] + Formdict['model.length'], + initVal: card.fieldlength || (card.type === 'text' ? 50 : 512), + required: true + }, + { type: 'select', key: 'format', label: Formdict['header.form.format'], initVal: card.format || '', options: [{ value: '', - text: Formdict['header.form.empty'] + text: Formdict['model.empty'] }, { value: 'thdSeparator', text: Formdict['header.form.thdSeparator'] + }, { + value: 'percent', + text: '鐧惧垎姣�' + }, { + value: 'abs', + text: '缁濆鍊�' + }], + required: false + }, + { + type: 'select', + key: 'textFormat', + label: Formdict['header.form.format'], + initVal: card.textFormat || '', + options: [{ + value: '', + text: Formdict['model.empty'] + }, { + value: 'YYYY-MM-DD', + text: 'YYYY-MM-DD' + }, { + value: 'YYYY-MM-DD HH:mm:ss', + text: 'YYYY-MM-DD HH:mm:ss' }], required: false }, @@ -742,76 +1372,6 @@ readonly: false }, { - type: 'select', - key: 'match', - label: Formdict['header.form.match'], - initVal: card.match || '', - options: [{ - value: '', - text: Formdict['header.form.empty'] - }, { - value: '>', - text: '>' - }, { - value: '<', - text: '<' - }, { - value: '>=', - text: '>=' - }, { - value: '<=', - text: '<=' - }], - required: false - }, - { - type: 'text', - key: 'matchVal', - min: -Infinity, - max: Infinity, - decimal: 0, - label: Formdict['header.form.matchVal'], - initVal: card.matchVal || '', - required: false, - readonly: false - }, - { - type: 'select', - key: 'color', - label: Formdict['header.form.color'], - initVal: card.color || '', - options: [{ - value: '', - text: Formdict['header.form.empty'] - }, { - value: 'red', - text: '绾㈣壊锛堝唴瀹癸級' - }, { - value: 'redbg', - text: '绾㈣壊锛堣儗鏅級' - }, { - value: 'orange', - text: '姗欒壊锛堝唴瀹癸級' - }, { - value: 'orangebg', - text: '姗欒壊锛堣儗鏅級' - }, { - value: 'green', - text: '缁胯壊锛堝唴瀹癸級' - }, { - value: 'greenbg', - text: '缁胯壊锛堣儗鏅級' - }], - required: false - }, - { - type: 'number', - key: 'fieldlength', - label: Formdict['header.form.field.length'], - initVal: card.fieldlength || (card.type === 'text' ? 50 : 512), - required: false - }, - { type: 'number', key: 'maxHeight', min: 1, @@ -831,11 +1391,214 @@ required: false, options: [{ value: 'true', - text: Formdict['header.form.true'] + text: Formdict['model.true'] }, { value: 'false', - text: Formdict['header.form.false'] + text: Formdict['model.false'] }] + }, + { + type: 'radio', + key: 'perspective', + label: '瀛楁閫忚', + initVal: card.perspective || '', + options: [{ + value: '', + text: '鏃�' + }, { + value: 'linkmenu', + text: '鑿滃崟' + }, { + value: 'linkurl', + text: '閾炬帴' + }] + }, + { + type: 'cascader', + key: 'linkmenu', + label: Formdict['model.menu'], + initVal: card.linkmenu || [], + required: true, + options: menulist + }, + { + type: 'textarea', + key: 'linkurl', + label: '閾炬帴鍦板潃', + initVal: card.linkurl || '', + required: true + }, + { + type: 'multiselect', + key: 'linkfields', + label: '鍏宠仈瀛楁', + initVal: card.linkfields || [], + required: false, + options: fields + }, + { + type: 'multiselect', + key: 'blacklist', + label: Formdict['header.form.blacklist'], + initVal: card.blacklist || [], + required: false, + options: roleList + } + ] +} + +/** + * @description 鑾峰彇鍥捐〃瑙嗗浘澶栭儴閰嶇疆琛ㄥ崟 + * @param {object} card // 鎼滅储鏉′欢瀵硅薄 + * @param {Array} columns // 鏄剧ず鍒� + * @param {Array} actions // 鎸夐挳缁別xcel + * @param {Array} extraActions // 甯歌鎸夐挳 + */ +export function getChartViewForm (card, _columns, actions, extraActions) { + let roleList = sessionStorage.getItem('sysRoles') + if (roleList) { + try { + roleList = JSON.parse(roleList) + } catch { + roleList = [] + } + } else { + roleList = [] + } + + let _charts = [{ + value: 'line', + text: '鎶樼嚎鍥�' + }, { + value: 'bar', + text: '鏌辩姸鍥�' + }, { + value: 'pie', + text: '楗煎浘' + }, { + value: 'card', + text: '鍗$墖' + }] + + if (card.chartType === 'table') { + _charts = [{ + value: 'table', + text: '琛ㄦ牸' + }] + } + + return [ + { + type: 'text', + key: 'title', + label: Formdict['header.form.title'], + initVal: card.title, + required: false + }, + { + type: 'select', + key: 'chartType', + label: '鍥捐〃绫诲瀷', + initVal: card.chartType, + required: true, + readonly: card.chartType === 'table', + options: _charts + }, + { + type: 'number', + key: 'height', + min: 100, + max: 1000, + decimal: 0, + label: '楂樺害', + initVal: card.height || 400, + required: true + }, + { + type: 'radio', + key: 'Hide', + label: Formdict['model.hidden'], + initVal: card.Hide, + required: true, + options: [{ + value: 'true', + text: Formdict['model.true'] + }, { + value: 'false', + text: Formdict['model.false'] + }] + }, + { + type: 'number', + key: 'width', + min: 1, + max: 24, + decimal: 0, + label: '鍥捐〃瀹藉害', + tooltip: '鏍呮牸甯冨眬锛屾瘡琛岀瓑鍒嗕负24鍒椼��', + initVal: card.width || 24, + required: true + }, + { + type: 'number', + key: 'cardWidth', + min: 1, + max: 24, + decimal: 0, + label: '鍗$墖瀹藉害', + tooltip: '鏍呮牸甯冨眬锛屾瘡琛岀瓑鍒嗕负24鍒椼��', + initVal: card.cardWidth || 6, + hidden: true, + required: true + }, + { + type: 'select', + key: 'bgfield', + label: '鑳屾櫙鎺у埗', + initVal: card.bgfield || '', + required: false, + readonly: false, + hidden: true, + options: _columns + }, + { + type: 'radio', + key: 'border', + label: '杈规', + initVal: card.border || 'show', + required: false, + hidden: true, + options: [{ + value: 'show', + text: '鏄剧ず' + }, { + value: 'hidden', + text: '闅愯棌' + }] + }, + { + type: 'radio', + key: 'switch', + label: '鏁版嵁鍒囨崲', + initVal: card.switch || 'true', + required: false, + hidden: true, + options: [{ + value: 'true', + text: '鏄�' + }, { + value: 'false', + text: '鍚�' + }] + }, + { + type: 'select', + key: 'extraAction', + label: '鎵╁睍鍗$墖', + initVal: card.extraAction || '', + tooltip: '缁戝畾涓嶉�夎鐨勬寜閽紝鍗$墖灏鹃儴浼氬鍔犲姛鑳藉崱鐗�', + required: false, + options: extraActions }, { type: 'multiselect', @@ -846,22 +1609,324 @@ options: roleList }, { - type: 'cascader', - key: 'linkmenu', - label: Formdict['header.form.linkmenu'], - initVal: card.linkmenu || [], + type: 'multiselect', + key: 'actions', + label: '鎵╁睍鎸夐挳', + initVal: card.actions || [], + tooltip: '鍙粦瀹氬凡鏈夌殑excel瀵煎叆銆佸鍑烘寜閽�', required: false, - options: menulist + options: actions + } + ] +} + +/** + * @description 鑾峰彇鍥捐〃瑙嗗浘閰嶇疆琛ㄥ崟 + * @param {object} card // 鍥捐〃瀵硅薄 + * @param {Array} columns // 鏄剧ず鍒� + * @param {String} setting // 椤甸潰璁剧疆 + */ +export function getChartOptionForm (card, columns, setting) { + let shapes = [] + + if (card.chartType === 'line') { + shapes = [ + { field: 'smooth', label: 'smooth' }, + { field: 'line', label: 'line' }, + { field: 'dot', label: 'dot' }, + { field: 'dash', label: 'dash' }, + { field: 'hv', label: 'hv' }, + { field: 'vh', label: 'vh' }, + { field: 'hvh', label: 'hvh' }, + { field: 'vhv', label: 'vhv' } + ] + } else if (card.chartType === 'bar') { + shapes = [ + { field: 'rect', label: 'rect' }, + { field: 'hollow-rect', label: 'hollow-rect' }, + { field: 'line', label: 'line' }, + { field: 'tick', label: 'tick' }, + { field: 'funnel', label: 'funnel' }, + { field: 'pyramid', label: 'pyramid' } + ] + } else if (card.chartType === 'pie') { + shapes = [ + { field: 'pie', label: '楗煎浘' }, + { field: 'ring', label: '鐜浘' } + ] + } + + return [ + { + type: 'radio', + key: 'datatype', + label: '鏁版嵁绫诲瀷', + initVal: card.datatype || 'query', + tooltip: '缁熻鍥捐〃閫傜敤浜庤〃鏍间笉鍒嗛〉锛屼笖鏁版嵁闇�瑕佽浆鎹�', + required: false, + 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'] } + ] + }, + { + type: 'select', + key: 'Xaxis', + label: card.chartType === 'pie' ? 'Text' : 'X-杞�', + initVal: card.Xaxis || '', + required: true, + options: columns.filter(col => col.type === 'text') + }, + { + type: 'select', + key: 'Yaxis', + label: card.chartType === 'pie' ? 'Value' : 'Y-杞�', + initVal: card.chartType === 'pie' ? card.Yaxis || '' : card.Yaxis || [], + multi: card.chartType !== 'pie', + hidden: card.datatype === 'statistics', + required: true, + options: columns.filter(col => col.type === 'number') + }, + { + type: 'select', + key: 'InfoType', + label: '绫诲瀷', + initVal: card.InfoType || '', + forbid: !['line', 'bar'].includes(card.chartType), + hidden: card.datatype !== 'statistics', + required: true, + options: columns.filter(col => col.type === 'text') + }, + { + type: 'select', + key: 'InfoValue', + label: '鍊�', + initVal: card.InfoValue || '', + forbid: !['line', 'bar'].includes(card.chartType), + hidden: card.datatype !== 'statistics', + required: true, + options: columns.filter(col => col.type === 'number') + }, + { + type: 'select', + key: 'legend', + label: '鍥句緥浣嶇疆', + initVal: card.legend || 'bottom', + required: false, + options: [ + { field: 'top', label: 'top' }, + { field: 'top-left', label: 'top-left' }, + { field: 'top-right', label: 'top-right' }, + { field: 'right', label: 'right' }, + { field: 'right-top', label: 'right-top' }, + { field: 'right-bottom', label: 'right-bottom' }, + { field: 'left', label: 'left' }, + { field: 'left-top', label: 'left-top' }, + { field: 'left-bottom', label: 'left-bottom' }, + { field: 'bottom', label: 'bottom' }, + { field: 'bottom-left', label: 'bottom-left' }, + { field: 'bottom-right', label: 'bottom-right' }, + { field: 'hidden', label: 'hidden' } + ] + }, + { + type: 'select', + key: 'shape', + label: '褰㈢姸', + initVal: card.shape || (shapes[0] && shapes[0].field), + required: false, + forbid: !['line', 'bar', 'pie'].includes(card.chartType), + options: shapes + }, + { + type: 'radio', + key: 'tooltip', + label: '鎻愮ず淇℃伅', + initVal: card.tooltip || 'true', + required: false, + options: [{ + value: 'true', + text: '鏄剧ず' + }, { + value: 'false', + text: '闅愯棌' + }] + }, + { + type: 'radio', + key: 'coordinate', + label: '鍧愭爣', + initVal: card.coordinate || 'angle', + required: false, + forbid: !['line', 'bar'].includes(card.chartType), + options: [{ + value: 'angle', + text: '浜岀淮鍧愭爣' + }, { + value: 'polar', + text: '鏋佸潗鏍�' + }] + }, + { + type: 'radio', + key: 'point', + label: '鐐瑰浘', + initVal: card.point || 'false', + required: false, + forbid: !['line'].includes(card.chartType), + options: [{ + value: 'true', + text: '鏄剧ず' + }, { + value: 'false', + text: '闅愯棌' + }] + }, + { + type: 'radio', + key: 'transpose', + label: '鍙樻崲', + initVal: card.transpose || 'false', + required: false, + forbid: !['line', 'bar'].includes(card.chartType), + options: [{ + value: 'true', + text: Formdict['model.true'] + }, { + value: 'false', + text: Formdict['model.false'] + }] + }, + { + type: 'radio', + key: 'pieshow', + label: '鏄剧ず鍊�', + initVal: card.pieshow || 'percent', + required: false, + forbid: !['pie'].includes(card.chartType), + options: [{ + value: 'percent', + text: '鐧惧垎姣�' + }, { + value: 'value', + text: '鏁板��' + }] + }, + { + type: 'radio', + key: 'label', + label: '鏍囨敞-鍊�', + initVal: card.label || (card.chartType === 'pie' ? 'true' : 'false'), + required: false, + forbid: !['pie', 'bar', 'line'].includes(card.chartType), + options: [{ + value: 'true', + text: '鏄剧ず' + }, { + value: 'false', + text: '闅愯棌' + }] + }, { + type: 'radio', + key: 'labelLayout', + label: '鏍囩甯冨眬', + initVal: card.labelLayout || 'normal', + required: false, + forbid: !['pie'].includes(card.chartType), + options: [{ + value: 'normal', + text: '甯歌' + }, { + value: 'overlap', + text: '闃查噸鍙�' + }] + }, { + type: 'radio', + key: 'adjust', + label: '澶氭煴鎺掑垪', + initVal: card.adjust || 'dodge', + required: false, + forbid: !['bar'].includes(card.chartType), + options: [{ + value: 'dodge', + text: '鍒嗙粍' + }, { + value: 'stack', + text: '鍫嗗彔' + }] + }, { + type: 'radio', + key: 'repeat', + label: '閲嶅鏁版嵁', + initVal: card.repeat || 'unrepeat', + required: false, + options: [{ + value: 'unrepeat', + text: '鍘婚噸' + }, { + value: 'average', + text: '骞冲潎' + }, { + value: 'cumsum', + text: '绱姞' + }] + }, { + type: 'number', + key: 'InfoDefNumber', + label: '灞曠ず鏁�', + tooltip: '榛樿鏄剧ず绫诲瀷鏁伴噺', + min: 1, + max: 50, + decimal: 0, + initVal: card.InfoDefNumber || 5, + forbid: !['line', 'bar'].includes(card.chartType), + hidden: card.datatype !== 'statistics', + required: true + }, { + type: 'number', + key: 'barSize', + label: '鏌卞舰瀹藉害', + tooltip: '绌哄�兼椂锛屽搴﹁嚜閫傚簲銆�', + min: 5, + max: 100, + decimal: 0, + initVal: card.barSize, + forbid: !['bar'].includes(card.chartType), + required: false } ] } /** * @description 鑾峰彇琛ㄥ崟閰嶇疆淇℃伅 - * @param {*} card - * @param {*} inputfields + * @param {*} card // 琛ㄥ崟瀵硅薄 + * @param {*} inputfields // 鍙叧鑱旇〃鍗� + * @param {*} tabfields // 鍙垏鎹㈣〃鍗� + * @param {*} linkableFields // 鍙叧鑱旇〃鍗� + * @param {*} linksupFields // 涓婄骇琛ㄥ崟 + * @param {*} subtable // 鏄惁涓哄瓙琛ㄨ〃鍗� */ -export function getModalForm (card, inputfields, linkableFields, linksupFields, subtable = false, roleList = []) { +export function getModalForm (card, inputfields = [], tabfields = [], linkableFields, linksupFields, subtable = false) { + let roleList = sessionStorage.getItem('sysRoles') + if (roleList) { + try { + roleList = JSON.parse(roleList) + roleList = roleList.map(role => { + return { + uuid: role.uuid, + field: role.value, + label: role.text + } + }) + } catch { + roleList = [] + } + } else { + roleList = [] + } + let _openType = [] let _fieldlength = 50 @@ -872,15 +1937,17 @@ }) } - if (card.type === 'textarea' || card.type === 'fileupload' || card.type === 'multiselect') { + if (['fileupload', 'multiselect', 'checkbox'].includes(card.type)) { _fieldlength = 512 + } else if (['textarea', 'brafteditor'].includes(card.type)) { + _fieldlength = 8000 } return [ { type: 'text', key: 'label', - label: Formdict['header.form.name'], + label: Formdict['model.name'], initVal: card.label, required: true, readonly: false @@ -888,7 +1955,7 @@ { type: 'text', key: 'field', - label: Formdict['header.form.field'], + label: Formdict['model.form.field'], initVal: card.field || '', required: true, readonly: false @@ -896,42 +1963,66 @@ { type: 'select', key: 'type', - label: Formdict['header.form.type'], + label: Formdict['model.form.type'], initVal: card.type, required: true, options: [{ value: 'text', - text: Formdict['header.form.text'] + text: Formdict['model.form.text'] }, { value: 'number', - text: Formdict['header.form.number'] + text: Formdict['model.form.number'] }, { value: 'select', - text: Formdict['header.form.select'] + text: Formdict['model.form.select'] }, { value: 'multiselect', - text: Formdict['header.form.multiselect'] + text: Formdict['model.form.multiselect'] }, { value: 'link', - text: Formdict['header.form.link'] + text: Formdict['model.form.link'] + }, { + value: 'switch', + text: '寮�鍏�' + }, { + value: 'checkbox', + text: '澶氶�夋' + }, { + value: 'radio', + text: '鍗曢�夋' + }, { + value: 'checkcard', + text: '閫夐」鍗�' }, { value: 'fileupload', text: Formdict['header.form.fileupload'] }, { value: 'date', - text: Formdict['header.form.dateday'] + text: Formdict['model.form.dateday'] }, { value: 'datemonth', - text: Formdict['header.form.datemonth'] + text: Formdict['model.form.datemonth'] }, { value: 'datetime', - text: Formdict['header.form.datetime'] + text: Formdict['model.form.datetime'] }, { value: 'textarea', - text: Formdict['header.form.textarea'] + text: Formdict['model.form.textarea'] + }, { + value: 'color', + text: Formdict['model.form.color'] + }, { + value: 'brafteditor', + text: '瀵屾枃鏈�' }, { value: 'funcvar', text: Formdict['header.form.funcvar'] + }, { + value: 'hint', + text: '鎻愮ず' + }, { + value: 'split', + text: '鍒嗛殧绾�' }, ..._openType] }, @@ -939,7 +2030,44 @@ type: 'text', key: 'initval', label: Formdict['header.form.initval'], + tooltip: '涓嬫媺澶氶�変笌澶氶�夋锛屾坊鍔犲涓垵濮嬪�艰浣跨敤鈥�,鈥濆彿鍒嗛殧銆傛敞锛氫笅鎷夐�夋嫨銆佽仈鍔ㄨ彍鍗曟垨鍗曢�夋涓�$first琛ㄧず閫夋嫨绗竴椤�', initVal: card.initval || '', + required: false + }, + { + type: 'textarea', + key: 'message', + label: '鎻愮ず淇℃伅', + initVal: card.message || '', + required: true, + readonly: false + }, + { + type: 'text', + key: 'openVal', + label: '寮�鍚��', + initVal: card.openVal || '', + required: false + }, + { + type: 'text', + key: 'closeVal', + label: '鍏抽棴鍊�', + initVal: card.closeVal || '', + required: false + }, + { + type: 'text', + key: 'openText', + label: '寮�鍚彁绀�', + initVal: card.openText || '', + required: false + }, + { + type: 'text', + key: 'closeText', + label: '鍏抽棴鎻愮ず', + initVal: card.closeText || '', required: false }, { @@ -958,30 +2086,99 @@ }, { type: 'radio', - key: 'setAll', - label: Formdict['header.form.setAll'], - initVal: card.setAll || 'false', + key: 'display', + label: '鏄剧ず', + initVal: card.display || 'text', + required: true, options: [{ - value: 'true', - text: Formdict['header.form.true'] + value: 'text', + text: '鏂囨湰' }, { - value: 'false', - text: Formdict['header.form.false'] + value: 'picture', + text: '鍥剧墖' }] }, { - type: 'textarea', - key: 'dataSource', - label: Formdict['header.form.datasource'], - initVal: card.dataSource || '', + type: 'number', + key: 'width', + min: 1, + max: 24, + precision: 0, + label: '鍗$墖瀹藉害', + initVal: card.width || 4, + tooltip: '鏍呮牸甯冨眬锛屾瘡琛岀瓑鍒嗕负24鍒椼��', + required: true + }, + { + type: 'text', + key: 'cardValField', + label: Formdict['header.form.valueField'], + initVal: card.cardValField || 'Value', + required: true, + readonly: false + }, + { + type: 'text', + key: 'urlField', + label: '鍦板潃瀛楁', + initVal: card.urlField || '', + required: true, + readonly: false + }, + { + type: 'radio', + key: 'ratio', + label: '鍥剧墖姣斾緥', + initVal: card.ratio || '1:1', + required: true, + options: [{ + value: '1:1', + text: '1:1' + }, { + value: '3:2', + text: '3:2' + }, { + value: '4:3', + text: '4:3' + }, { + value: '16:9', + 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: 'fields', + key: 'fields', + label: '瀛楁闆�', + initVal: card.fields || [], required: true, readonly: false }, { type: 'options', key: 'options', - label: '', + label: '閫夐」', initVal: card.options || [], + required: true, + readonly: false + }, + { + type: 'codemirror', + key: 'dataSource', + label: Formdict['header.form.datasource'], + initVal: card.dataSource || '', required: true, readonly: false }, @@ -1032,8 +2229,25 @@ }] }, { + type: 'radio', + key: 'multiple', + label: '鍙閫�', + initVal: card.multiple || 'false', + required: true, + options: [{ + value: 'true', + text: '鏄�' + }, { + value: 'false', + text: '鍚�' + }] + }, + { type: 'number', key: 'decimal', + min: 0, + max: 18, + precision: 0, label: Formdict['header.form.decimal'], initVal: card.decimal || 0, required: true @@ -1042,15 +2256,94 @@ type: 'number', key: 'min', label: '鏈�灏忓��', - initVal: card.min || '', + initVal: card.min || card.min === 0 ? card.min : '', required: false }, { type: 'number', key: 'max', label: '鏈�澶у��', - initVal: card.max || '', + initVal: card.max || card.max === 0 ? card.max : '', required: false + }, + { + 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, + required: false + }, + { + type: 'number', + key: 'maxRows', + min: 2, + max: 100, + precision: 0, + label: Formdict['header.form.maxRows'], + initVal: card.maxRows || 6, + required: false + }, + { + type: 'select', + key: 'regular', + label: Formdict['header.form.regular'], + initVal: card.regular || '', + options: [{ + value: '', + text: Formdict['model.empty'] + }, { + value: 'number', + text: Formdict['model.form.number'] + }, { + value: 'letter', + text: Formdict['header.form.letter'] + }, { + value: 'letter&number', + text: Formdict['header.form.letter&number'] + }] + }, + { + type: 'select', + key: 'fileType', + label: '鏄剧ず鏂瑰紡', + initVal: card.fileType || 'text', + options: [{ + value: 'picture', + text: '鍥炬枃淇℃伅' + }, { + value: 'picture-card', + text: '鍥剧墖鍗�' + }, { + value: 'text', + text: '鏂囦欢' + }] + }, + { + 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', @@ -1059,36 +2352,36 @@ initVal: card.readonly || 'false', options: [{ value: 'true', - text: Formdict['header.form.true'] + text: Formdict['model.true'] }, { value: 'false', - text: Formdict['header.form.false'] + text: Formdict['model.false'] }] }, { type: 'radio', key: 'required', - label: Formdict['header.form.field.required'], + label: Formdict['model.required'], initVal: card.required || 'true', options: [{ value: 'true', - text: Formdict['header.form.true'] + text: Formdict['model.true'] }, { value: 'false', - text: Formdict['header.form.false'] + text: Formdict['model.false'] }] }, { type: 'radio', key: 'hidden', - label: Formdict['header.form.field.ishidden'], + label: Formdict['model.hidden'], initVal: card.hidden || 'false', options: [{ value: 'true', - text: Formdict['header.form.true'] + text: Formdict['model.true'] }, { value: 'false', - text: Formdict['header.form.false'] + text: Formdict['model.false'] }] }, { @@ -1112,51 +2405,103 @@ initVal: card.readin || 'true', options: [{ value: 'true', - text: Formdict['header.form.true'] + text: Formdict['model.true'] }, { value: 'false', - text: Formdict['header.form.false'] + text: Formdict['model.false'] + }] + }, + { + type: 'radio', + key: 'writein', + label: '鎵ц杩愮畻', + tooltip: '琛ㄥ崟鎻愪氦鏃讹紝鏄惁灏嗚瀛楁鍊煎啓鍏ラ粯璁ql璇彞涓��', + initVal: card.writein || 'true', + options: [{ + value: 'true', + text: Formdict['model.true'] + }, { + value: 'false', + text: Formdict['model.false'] + }] + }, + { + type: 'radio', + key: 'declareType', + label: '鏁版嵁绫诲瀷', + tooltip: '澹版槑鍙橀噺鏃剁殑绫诲瀷锛屾椂闂存牸寮廳atetime鎴栨枃鏈牸寮弉varchar(50)銆�', + initVal: card.declareType || 'datetime', + options: [{ + value: 'datetime', + text: 'datetime' + }, { + value: 'nvarchar(50)', + text: 'nvarchar(50)' }] }, { type: 'number', - key: 'fieldlength', - label: Formdict['header.form.field.length'], - tooltip: '鏂囨湰銆佷笅鎷夋銆佹棩鏈熺瓑瀛楁榛樿闀垮害涓�50锛屽琛屾枃鏈笌鏂囦欢涓婁紶瀛楁榛樿闀垮害涓�512', - initVal: card.fieldlength || _fieldlength, - required: false + 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: 'maxRows', - label: Formdict['header.form.maxRows'], - initVal: card.maxRows || 6, - required: false + key: 'labelwidth', + min: 1, + max: 100, + precision: 1, + label: '鍚嶇О瀹藉害', + initVal: card.labelwidth || 33.3, + tooltip: '鍚嶇О鍗犳嵁琛ㄥ崟瀹藉害鐨勭櫨鍒嗘瘮銆傛敞锛氬瓨鍦ㄥ鍒楄〃鍗曟椂锛屽綋鍓嶈〃鍗曞鏋滄兂瑕佸崰鎹暣琛屽彲鍙傜収浠ヤ笅姣斾緥锛屼袱鍒楋紙16.2锛夈�佷笁鍒楋紙10.5锛夈�佸洓鍒楋紙7.7锛�', + required: true }, { - type: 'select', - key: 'regular', - label: Formdict['header.form.regular'], - initVal: card.regular || '', + type: 'text', + key: 'suffix', + label: '鍚庣紑鍚�', + tooltip: '鍙互涓婁紶鏂囦欢鐨勫悗缂�鍚嶏紝澶氫釜绫诲瀷鐢ㄩ�楀彿鍒嗛殧锛岀┖鍊兼椂涓嶆牎楠屻��', + initVal: card.suffix || '', + required: false, + readonly: false + }, + { + type: 'radio', + key: 'encryption', + label: '鍔犲瘑浼犺緭', + initVal: card.type === 'brafteditor' ? (card.encryption || 'true') : (card.encryption || 'false'), options: [{ - value: '', - text: Formdict['header.form.empty'] + value: 'true', + text: Formdict['model.true'] }, { - value: 'number', - text: Formdict['header.form.number'] + value: 'false', + text: Formdict['model.false'] + }] + }, + { + type: 'radio', + key: 'interception', + label: '鎴彇绌烘牸', + initVal: card.interception || 'false', + tooltip: '鎻愪氦鏃讹紝鏄惁鎴彇棣栧熬鐨勭┖鐧藉瓧绗︺��', + options: [{ + value: 'true', + text: Formdict['model.true'] }, { - value: 'letter', - text: Formdict['header.form.letter'] - }, { - value: 'letter&number', - text: Formdict['header.form.letter&number'] + value: 'false', + text: Formdict['model.false'] }] }, { type: 'select', key: 'supField', label: '涓婄骇琛ㄥ崟', - tooltip: '涓婄骇琛ㄥ崟涓轰笅鎷夐�夋嫨鎴栧叧鑱旇彍鍗曪紝璁剧疆涓婄骇琛ㄥ崟鍚庯紝璇ヨ〃鍗曞彈鎺т簬涓婄骇鑿滃崟锛屾敞锛氬彈鎺у叧绯诲湪璇ヨ〃鍗曢殣钘忔椂澶辨晥銆�', + tooltip: '涓婄骇琛ㄥ崟涓轰笅鎷夐�夋嫨銆佽仈鍔ㄨ彍鍗曘�佸崟閫夋鍙婂閫夋锛屾坊鍔犲悗璇ヨ〃鍗曟樉绀哄強闅愯棌灏嗗彈涓婄骇琛ㄥ崟鎺у埗锛屾敞锛氬彈鎺у叧绯诲湪璇ヨ〃鍗曢殣钘忔椂澶辨晥銆�', initVal: card.supField || '', required: false, readonly: false, @@ -1166,48 +2511,67 @@ type: 'text', key: 'supvalue', label: '鏄剧ず鍊�', - tooltip: '閫夋嫨涓婄骇琛ㄥ崟鍚庯紝濉啓鏄剧ず鍊硷紝鍙湁涓婄骇琛ㄥ崟鍊间笌鏄剧ず鍊肩浉鍚屾椂锛岃琛ㄥ崟鎵嶄細鏄剧ず锛屾敞锛氬涓�肩敤閫楀彿鍒嗛殧銆�', + tooltip: '璇峰~鍐欐樉绀哄�硷紝鍙湁涓婄骇琛ㄥ崟鍊间笌鏄剧ず鍊肩浉鍚屾椂锛岃琛ㄥ崟鎵嶄細鏄剧ず锛屾敞锛氬涓�肩敤閫楀彿鍒嗛殧銆�', initVal: card.supvalue || '', required: true, readonly: false }, { + type: 'text', + key: 'tooltip', + label: '鎮诞鎻愮ず', + tooltip: '榧犳爣鎮诞浜庢彁绀烘枃瀛椾笂鏂规椂锛屾樉绀烘彁绀轰俊鎭��', + initVal: card.tooltip || '', + required: false + }, + { + type: 'text', + key: 'extra', + label: '搴曢儴鎻愮ず', + tooltip: '鏄剧ず浜庤〃鍗曞簳閮ㄣ��', + initVal: card.extra || '', + required: false + }, + { + type: 'text', + key: 'emptyText', + label: '绌哄�兼枃鏈�', + tooltip: '绌哄�肩殑鎻愮ず鏂囨湰锛岄�夋嫨璁剧疆绌哄�兼椂鏈夋晥锛岄粯璁ゅ�间负銆婄┖銆嬨��', + initVal: card.emptyText || '', + required: false + }, + { + type: 'radio', + key: 'enter', + label: '鍥炶溅浜嬩欢', + initVal: (card.type === 'text' || card.type === 'number') ? (card.enter || 'sub') : (card.enter || 'false'), + tooltip: '鐐瑰嚮Enter閿紝鎴栨枃鏈被琛ㄥ崟杈撳叆鍥炶溅绗︺��', + options: [{ + value: 'sub', + text: '鎻愪氦' + }, { + value: 'tab', + text: '鍒囨崲' + }, { + value: 'false', + text: '鏃犲姩浣�' + }] + }, + { type: 'select', - key: 'quick', - label: Formdict['header.form.quickadd'], - initVal: '', - required: false, - options: [] + key: 'tabField', + label: '鍒囨崲瀛楁', + initVal: card.tabField || '', + options: tabfields, + required: false }, { type: 'multiselect', key: 'linkSubField', - label: Formdict['header.form.linkForm'], + label: Formdict['model.form.linkform'], + tooltip: '鍦ㄥ垏鎹㈤�夐」鏃朵細鎶婁俊鎭嚜鍔ㄥ~鍏ュ叧鑱旂殑琛ㄥ崟锛堟枃鏈垨鏁板瓧琛ㄥ崟锛変腑銆�', initVal: card.linkSubField || [], options: inputfields - }, - { - type: 'select', - key: 'fileType', - label: '鏄剧ず鏂瑰紡', - initVal: card.fileType || 'text', - options: [{ - value: 'picture', - text: '鍥炬枃淇℃伅' - }, { - value: 'picture-card', - text: '鍥剧墖鍗�' - }, { - value: 'text', - text: '鏂囦欢' - }] - }, - { - type: 'number', - key: 'maxfile', - label: '鏈�澶ф枃浠舵暟', - initVal: card.maxfile || '', - required: false }, { type: 'multiselect', @@ -1218,4 +2582,358 @@ options: roleList } ] +} + +/** + * @description 鑾峰彇瀛愯彍鍗曞熀鏈俊鎭〃鍗曢厤缃俊鎭� + * @param {object} card // 鏍囩閰嶇疆淇℃伅 + * @param {string} supMenu // 涓婄骇鑿滃崟ID + * @param {array} menus // 鍙�夌殑涓婄骇鑿滃崟鍒楄〃 + * @param {array} equalTab // 鍚岀骇鑿滃崟IDs + * @param {array} equalTabs // 鍙�夌殑鍚岀骇鑿滃崟鍒楄〃 + * @param {string} type // 鑿滃崟绫诲瀷锛屼富琛ㄦ垨鏍戝舰缁撴瀯 + */ +export function getTabForm (card, supMenu, menus, equalTab, equalTabs, type) { + return [ + { + type: 'text', + key: 'label', + label: Formdict['header.menu.tabName'], + 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: 'linkTab', + label: Formdict['header.form.linkTab'], + initVal: card.linkTab || '', + required: false, + options: [] + }, + { + type: 'select', + 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' + }, + { + type: 'select', + key: 'supMenu', + label: Formdict['header.form.supTab'], + initVal: supMenu, + required: false, + options: menus, + forbid: type === 'CalendarPage' + }, + { + type: 'mutilselect', + key: 'equalTab', + label: Formdict['header.form.equalTab'], + tooltip: '濡傛灉瀛愭爣绛句腑鍚湁鍒锋柊鍚岀骇鏍囩鐨勬寜閽紝鍦ㄦ澶勬坊鍔犻渶瑕佸埛鏂扮殑鏍囩銆�', + initVal: equalTab, + required: false, + options: equalTabs, + forbid: type === 'CalendarPage' + }, + { + type: 'text', + key: 'foreignKey', + label: '澶栭敭', + tooltip: '澶栭敭鏃ㄥ湪鏍囩椤典腑鎵ц榛樿鍑芥暟锛堟坊鍔狅級鏃讹紝鏇挎崲BID瀛楁', + initVal: card.foreignKey || '', + required: false, + forbid: type === 'CalendarPage' + }, + { + type: 'number', + key: 'level', + label: '鏄剧ず绾у埆', + tooltip: '鏍囩鏄剧ず鎺у埗锛岄�夋嫨鎸囧畾绾у埆鏃舵樉绀烘爣绛撅紝绾у埆涓虹┖鏃跺缁堟樉绀恒��', + initVal: card.level, + min: 0, + max: 10, + required: false, + forbid: type !== 'TreePage', + }, + { + type: 'radio', + key: 'searchPass', + label: '涓昏〃鎼滅储', + initVal: card.searchPass || 'false', + tooltip: '浣跨敤涓昏〃鎼滅储鏉′欢鏃讹紝涓昏〃鐨勬悳绱㈡潯浠朵細浼犲叆瀛愯〃涓��', + required: false, + forbid: type !== 'CommonTable' && type !== 'CalendarPage', + options: [{ + value: 'true', + text: '浣跨敤' + }, { + value: 'false', + text: '涓嶄娇鐢�' + }] + } + ] +} + +/** + * @description 鑾峰彇鍗$墖璇︽儏琛ㄥ崟閰嶇疆淇℃伅 + * @param {object} card // 鏍囩閰嶇疆淇℃伅 + * @param {array} _columns // 鏄剧ず鍒� + * @param {string} _type // 绫诲瀷锛屽崱鐗囩殑閮ㄤ綅 + * @param {array} _actions // 鎸夐挳鍒楄〃 + */ +export function getCardDetailForm (card, _columns, _type, _actions = []) { + let actions = '' + if (_type === 'bottom') { + actions = card.actions ? card.actions.map(cell => cell.value) : [] + } else if (_type === 'header') { + _actions.unshift({ + value: '', + text: '绌�' + }) + actions = card.actions[0] ? card.actions[0].value : '' + } + return [ + { + type: 'radio', + key: 'datatype', + label: '鏁版嵁绫诲瀷', + initVal: card.datatype || 'dynamic', + required: true, + forbid: !['detail', 'header'].includes(_type), + options: [{ + value: 'dynamic', + text: '鍔ㄦ��' + }, { + value: 'static', + text: '闈欐��' + }] + }, + { + type: 'radio', + key: 'type', + label: '绫诲瀷', + initVal: card.type || 'picture', + required: true, + forbid: !['avatar'].includes(_type), + options: [{ + value: 'picture', + text: '鍥剧墖' + }, { + value: 'icon', + text: '鍥炬爣' + }] + }, + { + type: 'text', + key: 'content', + label: '鍐呭', + initVal: card.content || '', + required: _type !== 'header', + forbid: !['detail', 'header'].includes(_type), + }, + { + type: 'select', + key: 'field', + label: '瀛楁', + initVal: card.field || '', + required: true, + forbid: !['detail', 'header', 'avatar'].includes(_type), + options: _columns + }, + { + type: 'number', + key: 'fontSize', + min: 12, + max: 50, + label: '瀛椾綋澶у皬', + initVal: card.fontSize || 14, + required: true, + forbid: !['detail'].includes(_type) + }, + { + type: 'select', + key: 'fontWeight', + label: '瀛椾綋绮楃粏', + initVal: card.fontWeight || 'normal', + required: true, + forbid: !['detail'].includes(_type), + options: [{ + value: 'normal', + text: '姝e父' + }, { + value: 'bold', + text: 'bold' + }, { + value: 'bolder', + text: 'bolder' + }, { + value: 'lighter', + text: 'lighter' + }, { + value: '100', + text: '100' + }, { + value: '200', + text: '200' + }, { + value: '300', + text: '300' + }, { + value: '400', + text: '400' + }, { + value: '500', + text: '500' + }, { + value: '600', + text: '600' + }, { + value: '700', + text: '700' + }, { + value: '800', + text: '800' + }, { + value: '900', + text: '900' + }] + }, + { + type: 'number', + key: 'width', + min: 10, + max: 100, + precision: 1, + label: '瀹藉害(%)', + initVal: card.width || 100, + required: true, + forbid: !['detail', 'avatar'].includes(_type) + }, + { + type: 'number', + key: 'height', + min: 1, + max: 10, + label: '楂樺害(琛�)', + initVal: card.height || 1, + required: true, + forbid: !['detail'].includes(_type) + }, + { + type: 'radio', + key: 'radius', + label: '鍦嗚', + initVal: card.radius || 'true', + required: false, + forbid: !['avatar'].includes(_type), + options: [{ + value: 'true', + text: '鏈�' + }, { + value: 'false', + text: '鏃�' + }] + }, + { + type: 'number', + key: 'size', + label: '瀛椾綋澶у皬', + initVal: card.size || 28, + min: 12, + max: 500, + required: false, + hidden: true, + forbid: !['avatar'].includes(_type) + }, + { + type: 'radio', + key: 'align', + label: '瀵归綈', + initVal: card.align || 'left', + required: false, + forbid: !['detail'].includes(_type), + options: [{ + value: 'left', + text: '宸�' + }, { + value: 'align-center', + text: '灞呬腑' + }, { + value: 'align-right', + text: '鍙�' + }] + }, + { + type: _type === 'bottom' ? 'multiselect' : 'select', + key: 'actions', + label: '鎸夐挳缁�', + tooltip: '', + initVal: actions, + required: false, + forbid: !['header', 'bottom'].includes(_type), + options: _actions + }, + { + type: 'radio', + key: 'show', + label: '鏄剧ず', + initVal: card.show || 'icon', + required: false, + forbid: !['bottom', 'header'].includes(_type), + options: [{ + value: 'icon', + text: '鍥炬爣' + }, { + value: 'text', + text: '鏂囧瓧' + }, { + value: 'all', + text: '鍏ㄩ儴' + }] + }, + { + type: 'radio', + key: 'display', + label: '鏄剧ず', + initVal: card.display || 'inline', + required: false, + forbid: !['avatar'].includes(_type), + options: [{ + value: 'block', + text: '鏁磋' + }, { + value: 'inline', + text: '鑷姩' + }] + }, + ] } \ No newline at end of file -- Gitblit v1.8.0