From 10f5efae1624c89d9a8f04ac331e07c895ea282a Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期六, 25 五月 2024 18:22:58 +0800 Subject: [PATCH] 2024-05-25 --- src/templates/zshare/formconfig.jsx | 2802 ++++++++++++---------------------------------------------- 1 files changed, 601 insertions(+), 2,201 deletions(-) diff --git a/src/templates/zshare/formconfig.jsx b/src/templates/zshare/formconfig.jsx index bd96bbb..621dd29 100644 --- a/src/templates/zshare/formconfig.jsx +++ b/src/templates/zshare/formconfig.jsx @@ -1,286 +1,4 @@ -import { formRule, btnClasses } from '@/utils/option.js' - -/** - * @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') - let rules = [{ - max: formRule.func.max, - message: formRule.func.maxMessage - }] - - if (usefulFields.length > 0) { - rules.push({ - pattern: _patten, - message: formRule.func.innerMessage - }) - } - - 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: '鎺ュ彛绫诲瀷', - initVal: setting.interType || 'inner', - required: false, - readonly: false, - options: [ - { value: 'inner', text: '鍐呴儴' }, - { value: 'outer', text: '澶栭儴' } - ] - }, - { - type: 'radio', - key: 'sysInterface', - label: '绯荤粺鎺ュ彛', - initVal: setting.sysInterface || 'false', - tooltip: '鍗曠偣鐧诲綍绯荤粺', - required: false, - readonly: false, - options: [ - { value: 'true', text: '鏄�' }, - { value: 'false', text: '鍚�' } - ] - }, - { - type: 'text', - key: 'interface', - label: '鎺ュ彛鍦板潃', - 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: '澶栭儴鍑芥暟', - 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: '鍐呴儴鍑芥暟', - initVal: setting.innerFunc || '', - tooltip: usefulFields.length ? '寮�澶村彲鐢ㄥ瓧绗︼細' + usefulFields.join(', ') : '', - placement: 'bottomLeft', - required: false, - readonly: false, - rules: rules - }, - { - 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: '鏄�' }, - { value: 'false', text: '鍚�' } - ] - }, - { - type: 'radio', - key: 'showLine', - label: '鏄剧ず鍒嗗壊绾�', - initVal: setting.showLine || 'false', - required: false, - readonly: false, - options: [ - { value: 'true', text: '鏄�' }, - { value: 'false', text: '鍚�' } - ] - } - ] -} - +import React from 'react' /** * @description 鑾峰彇鎼滅储鏉′欢琛ㄥ崟閰嶇疆淇℃伅 * @param {object} card // 鎼滅储鏉′欢瀵硅薄 @@ -356,8 +74,14 @@ value: 'group', text: '鏃ユ湡锛堢粍鍚堬級' }, { + value: 'range', + text: '鏁板�硷紙鍖洪棿锛�' + }, { value: 'switch', text: '寮�鍏�' + }, { + value: 'radio', + text: '鍗曢�夋' }, { value: 'check', text: '鍕鹃�夋' @@ -367,7 +91,7 @@ if (card.focus) { if (['text', 'multiselect'].includes(card.type)) { card.match = 'like' - } else if (['select', 'link', 'checkcard'].includes(card.type)) { + } else if (['select', 'link', 'checkcard', 'radio'].includes(card.type)) { card.match = '=' } else if (card.type === 'date') { card.match = '>=' @@ -384,6 +108,30 @@ Text: '鍏ㄩ儴', ParentID: '' }) + } + + let muloptions = [{ + value: 'false', + text: '鍗曢��' + }, { + value: 'true', + text: '澶氶��' + }, { + value: 'dropdown', + text: '涓嬫媺鑿滃崟' + }] + + if (appType !== '') { + muloptions = [{ + value: 'false', + text: '鍗曢��' + }, { + value: 'true', + text: '澶氶��' + }] + if (card.multiple === 'dropdown') { + card.multiple = 'false' + } } return [ @@ -421,7 +169,6 @@ type: 'text', key: 'initval', label: '鍒濆鍊�', - tooltip: '绫诲瀷涓轰笅鎷夎彍鍗曟椂锛屽垵濮嬪�煎簲涓烘暟鎹殑Value鍊硷紙浣跨敤鏁版嵁婧愭椂锛屽簲涓恒�婂�悸峰瓧娈点�嬬殑鍊硷級;绫诲瀷涓烘暟鍊硷紙鍖洪棿锛夋椂锛屽垵濮嬪�间娇鐢ㄩ�楀彿鎷兼帴锛屼緥濡� 3,10', initVal: card.initval, required: false }, @@ -439,19 +186,6 @@ text: '鏁版嵁婧�' }] }, - // { - // type: 'radio', - // key: 'setAll', - // label: '璁剧疆鍏ㄩ儴', - // initVal: card.setAll || 'true', - // options: [{ - // value: 'true', - // text: '鏄�' - // }, { - // value: 'false', - // text: '鍚�' - // }] - // }, { type: 'radio', key: 'display', @@ -472,12 +206,12 @@ { type: 'number', key: 'width', - min: 1, + min: 0, max: 24, precision: 0, label: '鍏冪礌瀹藉害', - initVal: card.width || 4, - tooltip: '鏍呮牸甯冨眬锛屾瘡琛岀瓑鍒嗕负24鍒椼��', + initVal: card.width === 0 ? 0 : (card.width || 4), + tooltip: '鏍呮牸甯冨眬锛屾瘡琛岀瓑鍒嗕负24鍒椼�傛敞锛氬綋瀹藉害涓�0鏃讹紝鍏冪礌鏍规嵁鍐呭鑷�傚簲', required: true }, { @@ -522,18 +256,81 @@ }] }, { - type: 'fields', - key: 'fields', - label: '瀛楁闆�', - initVal: card.fields || [], - required: true - }, - { type: 'codemirror', key: 'dataSource', label: '鏁版嵁婧�', initVal: card.dataSource || '', + tooltip: '鏁版嵁鏉冮檺鏇挎崲绗� $@ -> /* 鎴� \'\'銆� @$ -> */ 鎴� \'\'', + placeholder: '绯荤粺鍙橀噺锛歮k_departmentcode銆乵k_organization銆乵k_user_type銆�', required: true + }, + { + type: 'fields', + key: 'fields', + label: '瀛楁闆�', + initVal: card.fields || [], + required: true, + columns: [ + { + title: '瀛楁鍚�', + dataIndex: 'field', + inputType: 'input', + editable: true, + unique: true, + strict: true, + forbids: ['value', 'parentid', 'pid'], + initval: 'field', + rules: [{ + pattern: /^[\u4E00-\u9FA50-9a-zA-Z_-]*$/ig, + message: '璇蜂娇鐢ㄦ暟瀛椼�佸瓧姣嶃�佹眽瀛椾互鍙奯-' + }], + width: '20%' + }, + { + title: '瀛椾綋棰滆壊', + dataIndex: 'color', + inputType: 'color', + editable: true, + initval: 'rgba(0, 0, 0, 0.85)', + width: '20%', + render: (text, record) => { + return <span style={{color: text}}>绀轰緥</span> + } + }, + { + title: '瀛椾綋澶у皬', + dataIndex: 'fontSize', + inputType: 'number', + min: 12, + max: 50, + editable: true, + initval: 14, + width: '20%', + }, + { + title: '瀵归綈鏂瑰紡', + dataIndex: 'align', + inputType: 'select', + editable: true, + width: '20%', + initval: 'left', + options: [ + {value: 'left', text: '灞呭乏'}, + {value: 'center', text: '灞呬腑'}, + {value: 'right', text: '灞呭彸'}, + // {value: 'justify', text: 'justify'} + ], + render: (text, record) => { + if (text === 'center') { + return '灞呬腑' + } else if (text === 'right') { + return '灞呭彸' + } else { + return '灞呭乏' + } + } + } + ] }, { type: 'options', @@ -573,14 +370,18 @@ key: 'multiple', label: '閫夋嫨褰㈠紡', initVal: card.multiple || 'false', + // tooltip: appType === '' ? '浣跨敤涓嬫媺鑿滃崟鏃讹紝閫夐」浼氫緷鎹� pid 缁勭粐鏁版嵁鐨勪笂涓嬬骇鍏崇郴锛屼簩绾ч�夐」浼氫笅鎷夊睍绀恒�傛敞锛�1銆佹樉绀轰负鏂囨湰鏃舵湁鏁堬紱2銆佷娇鐢ㄦ暟鎹簮璇疯繑鍥� pid 瀛楁銆�' : '', required: true, - options: [{ - value: 'false', - text: '鍗曢��' - }, { - value: 'true', - text: '澶氶��' - }] + options: muloptions + }, + { + type: 'text', + key: 'parentField', + label: '涓婄骇瀛楁', + initVal: card.parentField || '', + tooltip: '鐢ㄤ簬缁勭粐鏁版嵁涓婁笅绾у叧绯伙紝璇锋敞鎰忓~鍐欓《绾ф爣璇嗐��', + required: true, + readonly: false }, { type: 'select', @@ -613,7 +414,7 @@ required: false }, { - type: 'select', + type: 'radio', key: 'orderType', label: '鎺掑簭鏂瑰紡', initVal: card.orderType || 'asc', @@ -667,6 +468,15 @@ initVal: card.labelwidth || 33.3, tooltip: '鍚嶇О鍗犳嵁鎼滅储鏉′欢瀹藉害鐨勭櫨鍒嗘瘮銆傛敞锛氬瓨鍦ㄥ鍒楁悳绱㈡椂锛屽綋鍓嶆悳绱㈠鏋滄兂瑕佸崰鎹暣琛屽彲鍙傜収浠ヤ笅姣斾緥锛屼袱鍒楋紙16.5锛夈�佷笁鍒楋紙10.8锛夈�佸洓鍒楋紙8锛�', required: true, + forbid: appType === 'mob' + }, + { + type: 'text', + key: 'dateShift', + label: '鏃ユ湡鍋忕Щ', + initVal: card.dateShift || '', + tooltip: '鍙互濉叆涓婄骇瀛楁锛岀敤浜庢帶鍒跺垵濮嬪�硷紝渚嬪锛氫笂绾у瓧娈靛�间负2023-12-10锛屽垵濮嬪�间负鏈湀锛屽垯鍒濆鍖洪棿涓� 2023-12-01 ~ 2023-12-31銆�', + required: false, forbid: appType === 'mob' }, { @@ -826,6 +636,20 @@ }, { type: 'radio', + key: 'border', + label: '杈规', + initVal: card.border || 'show', + required: false, + options: [{ + value: 'show', + text: '鏄剧ず' + }, { + value: 'hide', + text: '闅愯棌' + }] + }, + { + type: 'radio', key: 'selectStyle', label: '閫変腑鏁堟灉', tooltip: '鑳屾櫙鍙婃枃瀛楀彉鍖栨椂浼氫娇鐢ㄧ郴缁熻壊銆�', @@ -886,6 +710,14 @@ required: true }, { + type: 'text', + key: 'mark', + label: '椤剁骇鏍囪瘑', + initVal: card.mark || '', + tooltip: '涓婄骇瀛楁(pid)涓庨《绾ф爣璇嗙浉鍚屾椂锛岃涓洪《绾ц妭鐐广��', + required: false + }, + { type: 'multiselect', key: 'blacklist', label: '榛戝悕鍗�', @@ -898,1529 +730,9 @@ } /** - * @description 鑾峰彇鎸夐挳琛ㄥ崟閰嶇疆淇℃伅 - * @param {*} card 缂栬緫鎸夐挳 - * @param {*} config 椤甸潰閰嶇疆 - * @param {*} usefulFields 瀛樺偍杩囩▼鍙敤鐨勫紑濮嬪瓧娈� - * @param {*} type 鎸夐挳绫诲瀷锛岀敤浜庡尯鍒嗗彲閫夌殑鎵撳紑鏂瑰紡 - */ -export function getActionForm (card, config, usefulFields, type, menulist = [], printTemps = [], tabs = []) { - let columns = (config.columns || []).filter(col => col.field) - - let opentypes = [ - { - value: 'pop', - text: '寮圭獥锛堣〃鍗曪級' - }, { - value: 'prompt', - text: '鎻愮ず妗�' - }, { - value: 'exec', - text: '鐩存帴鎵ц' - }, { - value: 'excelIn', - text: '瀵煎叆Excel' - }, { - value: 'excelOut', - text: '瀵煎嚭Excel' - }, { - value: 'popview', - text: '寮圭獥锛堟爣绛撅級' - }, { - value: 'tab', - text: '鏍囩椤�' - }, { - value: 'innerpage', - text: '鏂伴〉闈�' - }, { - value: 'funcbutton', - text: '鍔熻兘鎸夐挳' - } - ] - - if (card.execSuccess === 'view' || card.execSuccess === 'refresh') { // refresh涓鸿〃鍗曟爣绛鹃〉 - card.execSuccess = 'grid' - } - if (card.execError === 'view' || card.execError === 'refresh') { - card.execError = 'grid' - } - if (card.popClose === 'view') { - card.popClose = 'grid' - } - - if (card.OpenType === 'outerpage') { - card.pageTemplate = 'custom' - card.OpenType = 'innerpage' - } - - let refresh = [] - - if (type === 'subtable') { // 瀛愯〃椤甸潰锛屽彲璁剧疆鍒锋柊涓昏〃鍙婂悓绾ф爣绛� - if (card.focus) { - card.popClose = 'maingrid' - } - refresh.push({ - value: 'maingrid', - text: '鍒锋柊涓昏〃锛堣锛�' - }, { - value: 'equaltab', - text: '鍒锋柊鍚岀骇鏍囩' - }) - } else if (card.execSuccess === 'maingrid') { - card.execSuccess = 'grid' - } - - if (card.OpenType === 'blank') { - card.OpenType = 'tab' - } - if (!card.control && card.controlField) { - card.control = 'disabled' - } - - if (card.intertype === 'outer' && !card.procMode && !card.innerFunc) { // 鍏煎澶栭儴鍑芥暟鐩翠紶绫诲瀷 - card.procMode = 'none' - } - - return [ - { - type: 'select', - key: 'OpenType', - label: '鎵撳紑鏂瑰紡', - initVal: card.OpenType, - required: true, - options: opentypes - }, - { - type: 'text', - key: 'label', - label: '鎸夐挳鍚嶇О', - initVal: card.label, - required: true, - readonly: false - }, - { - type: 'select', - key: 'funcType', - label: '鍔熻兘绫诲瀷', - initVal: card.funcType || '', - required: true, - options: [{ - value: 'print', - text: '鏍囩鎵撳嵃' - }, { - value: 'refund', - text: '閫�娆�' - }, { - value: 'changeuser', - text: '鍒囨崲鐢ㄦ埛' - }, { - value: 'closetab', - text: '鏍囩鍏抽棴' - }, { - value: 'megvii', - text: '鏃疯闈㈡澘鏈�' - }, { - value: 'filezip', - text: '鏂囦欢鍘嬬缉鍖�' - }] - }, - { // 鏃疯闈㈡澘鏈烘帴鍙� 寰呮墿灞� - type: 'radio', - key: 'subFunc', - label: '鎺ュ彛鍚嶇О', - initVal: card.subFunc || 'addUser', - required: true, - options: [ - { value: 'addUser', text: '娣诲姞鐢ㄦ埛' }, - ] - }, - { - type: 'select', - key: 'execMode', - label: '鎵ц鏂瑰紡', - initVal: card.execMode || 'exec', - required: true, - options: [{ - value: 'exec', - text: '鐩存帴鎵ц' - }, { - value: 'prompt', - text: '鎻愮ず妗�' - }, { - value: 'pop', - text: '寮圭獥锛堣〃鍗曪級' - }] - }, - { - type: 'radio', - key: 'intertype', - label: '鎺ュ彛绫诲瀷', - initVal: card.intertype || 'system', - required: true, - options: [] - }, - { - type: 'radio', - key: 'procMode', - label: '鍙傛暟澶勭悊', - initVal: card.procMode || (card.innerFunc ? 'inner' : 'system'), - tooltip: '褰撹繑鍥炲�煎瓨鍦� mk_ex_invoke 涓斿�间负 false 鏃讹紝涓嶄細璋冪敤澶栭儴鎺ュ彛銆�', - required: true, - options: [{ - value: 'system', - text: '绯荤粺鍑芥暟' - }, { - value: 'inner', - text: '鍐呴儴鍑芥暟' - }, { - value: 'none', - text: '鏃�' - }] - }, - { - type: 'radio', - key: 'sqlType', - label: '鎿嶄綔绫诲瀷', - initVal: card.sqlType || '', - required: true, - options: [] - }, - { - type: 'text', - key: 'sql', - label: '琛ㄥ悕', - initVal: card.sql || config.setting.tableName || '', - required: true - }, - { - type: 'text', - key: 'innerFunc', - label: '鍐呴儴鍑芥暟', - initVal: card.innerFunc || '', - tooltip: usefulFields.length ? `鍑芥暟鍚嶇О闇�浠�${usefulFields.join(', ')}绛夊瓧绗﹀紑濮嬨�俙 : '', - fields: usefulFields, - required: card.intertype === 'inner', - readonly: false - }, - { - type: 'text', - key: 'urlkey', - label: '鍦板潃瀛楁', - initVal: card.urlkey || '', - tooltip: '鍥剧墖锛堟枃浠讹級閾炬帴鐨勫瓧娈靛悕銆�', - required: false, - readonly: false - }, - { - type: 'select', - key: 'linkTab', - label: '鍏宠仈鏍囩', - initVal: card.linkTab || '', - required: false, - options: [ - { - value: '', - text: '鏂板缓' - }, - ...tabs - ] - }, - { - type: 'select', - key: 'pageTemplate', - label: '椤甸潰绫诲瀷', - initVal: card.pageTemplate || '', - required: true, - options: [{ - // value: 'print', - // text: '鏍囩鎵撳嵃妯℃澘' - // }, { - // value: 'billprintTemp', - // text: '鍗曟嵁鎵撳嵃妯℃澘' - // }, { - value: 'billprint', - text: '鍗曟嵁鎵撳嵃' - }, { - value: 'pay', - text: '鏀粯' - }, { - value: 'custom', - text: '鑷畾涔�' - }] - }, - { - type: 'select', - key: 'printTemp', - label: '鎵撳嵃妯℃澘', - initVal: card.printTemp || '', - required: true, - options: printTemps - }, - { - type: 'text', - key: 'url', - label: '椤甸潰鍦板潃', - initVal: card.url || '', - required: true - }, - { - type: 'radio', - key: 'sysInterface', - label: '绯荤粺鎺ュ彛', - initVal: card.sysInterface || 'false', - tooltip: '鍗曠偣鐧诲綍绯荤粺', - required: true, - options: [{ - value: 'true', - text: '鏄�' - }, { - value: 'false', - text: '鍚�' - }] - }, - { - type: 'text', - key: 'outerFunc', - label: '澶栭儴鍑芥暟', - initVal: card.outerFunc || '', - required: false, - readonly: false - }, - { - type: 'textarea', - key: 'interface', - label: '娴嬭瘯鍦板潃', - initVal: card.sysInterface === 'true' ? (window.GLOB.mainSystemApi || '') : (card.interface || ''), - required: true, - readonly: card.sysInterface === 'true' - }, - { - type: 'textarea', - key: 'proInterface', - label: '姝e紡鍦板潃', - initVal: card.proInterface || '', - tooltip: '姝e紡绯荤粺鎵�浣跨敤鐨勬帴鍙e湴鍧�銆�', - required: false - }, - { - type: 'radio', - key: 'method', - label: '璇锋眰鏂瑰紡', - initVal: card.method || 'post', - required: true, - options: [{ - value: 'get', - text: 'GET' - }, { - value: 'post', - text: 'POST' - }] - }, - { - type: 'radio', - key: 'cross', - label: '璺ㄥ煙璇锋眰', - initVal: card.cross || 'true', - tooltip: '濡傛灉鑷畾涔夋帴鍙d笉鏀寔璺ㄥ煙璇锋眰锛屼細閫氳繃褰撳墠绯荤粺杞彂銆�', - required: false, - options: [{ - value: 'true', - text: '鏀寔' - }, { - value: 'false', - text: '涓嶆敮鎸�' - }] - }, - { - type: 'radio', - key: 'callbackType', - label: '鍥炶皟鏂瑰紡', - initVal: card.callbackType || (card.callbackFunc ? 'func' : 'none'), - tooltip: '浣跨敤鍚庡彴鑴氭湰鎵ц鏃讹紝闇�瑕侀厤鍚堣鍒掍换鍔°��', - required: true, - options: [{ - value: 'script', - text: '鑷畾涔夎剼鏈�' - }, { - value: 'default', - text: '鍚庡彴鑴氭湰' - }, { - value: 'func', - text: '鍥炶皟鍑芥暟' - }, { - value: 'none', - text: '鏃�' - }] - }, - { - type: 'text', - key: 'cbTable', - label: '鍥炶皟琛ㄥ悕', - initVal: card.cbTable || '', - required: true - }, - { - type: 'text', - key: 'callbackFunc', - label: '鍥炶皟鍑芥暟', - initVal: card.callbackFunc || '', - required: true, - readonly: false - }, - { - type: 'radio', - key: 'position', - label: '鏄剧ず浣嶇疆', - initVal: card.position || 'toolbar', - required: true, - options: [{ - value: 'toolbar', - text: '宸ュ叿鏍�' - }, { - value: 'grid', - text: '琛ㄦ牸' - }] - }, - { - type: 'select', - key: 'Ot', - label: '琛岃缃�', - initVal: card.Ot || 'requiredSgl', - required: true, - options: [] - }, - { - type: 'cascader', - key: 'linkmenu', - label: '鍏宠仈鑿滃崟', - initVal: card.linkmenu || [], - required: true, - options: menulist - }, - { - type: 'cascader', - key: 'refreshTab', - label: '鍒锋柊鏍囩', - initVal: card.refreshTab || [], - required: false, - options: menulist - }, - { - type: refresh.length === 0 ? 'radio' : 'select', - key: 'execSuccess', - label: '鎴愬姛鍚�', - initVal: card.execSuccess || 'grid', - tooltip: '閫夋嫨鍒锋柊琛屾椂锛屽鏋滈�夋嫨澶氭潯鏁版嵁浼氬埛鏂拌〃鏍笺�傚闇�璇煶鎾姤璇蜂互@speak@寮�澶达紝鎾姤鍐呭鎴栨枃浠舵斁缃簬<<>>涓��', - required: true, - options: [{ - value: 'never', - text: '涓嶅埛鏂�' - }, { - value: 'line', - text: '鍒锋柊琛�' - }, { - value: 'grid', - text: '鍒锋柊琛ㄦ牸' - }, - ...refresh] - }, - { - type: refresh.length === 0 ? 'radio' : 'select', - key: 'execError', - label: '澶辫触鍚�', - initVal: card.execError || 'never', - tooltip: '閫夋嫨鍒锋柊琛屾椂锛屽鏋滈�夋嫨澶氭潯鏁版嵁浼氬埛鏂拌〃鏍笺�傚闇�璇煶鎾姤璇蜂互@speak@寮�澶达紝鎾姤鍐呭鎴栨枃浠舵斁缃簬<<>>涓��', - required: true, - options: [{ - value: 'never', - text: '涓嶅埛鏂�' - }, { - value: 'line', - text: '鍒锋柊琛�' - }, { - value: 'grid', - text: '鍒锋柊琛ㄦ牸' - }, - ...refresh] - }, - { - type: refresh.length === 0 ? 'radio' : 'select', - key: 'popClose', - label: '鍏抽棴鍚�', - initVal: card.popClose || 'never', - required: true, - options: [{ - value: 'never', - text: '涓嶅埛鏂�' - }, { - value: 'grid', - text: '鍒锋柊琛ㄦ牸' - }, - ...refresh] - }, - { - type: 'radio', - key: 'resetPageIndex', - label: '鍒锋柊鏃�', - initVal: card.resetPageIndex || 'true', - required: false, - options: [{ - value: 'true', - text: '閲嶇疆椤电爜' - }, { - value: 'false', - text: '涓嶉噸缃�' - }] - }, - { - type: 'icon', - key: 'icon', - label: '鍥炬爣', - initVal: card.icon, - required: false - }, - { - type: 'select', - key: 'class', - label: '棰滆壊', - initVal: card.class, - required: false, - options: btnClasses - }, - { - type: 'cascader', - key: 'openmenu', - label: '鎵撳紑鑿滃崟', - initVal: card.openmenu || [], - tooltip: '鎵ц鎴愬姛鍚庨渶瑕佹墦寮�鐨勮彍鍗曘��', - required: false, - options: menulist - }, - { - type: 'text', - key: 'output', - label: '杩斿洖鍊�', - tooltip: '鎵ц鎴愬姛鍚庣殑杩斿洖鍊笺�傜郴缁熷嚱鏁板彲鎸囧畾杩斿洖鐨勫彉閲忥紙浠绗﹀紑澶达紝杩斿洖id鏃跺彲浣跨敤@id@锛夛紱鑷畾涔夊嚱鏁板彲鎸囧畾杩斿洖瀛楁锛堝id锛夈��', - initVal: card.output || '', - required: false - }, - { - type: 'text', - key: 'tipTitle', - label: '纭鎻愮ず', - initVal: card.tipTitle || '', - tooltip: '娉細寮圭獥锛堣〃鍗曪級鍦ㄦ樉绀轰负鏄惁妗嗘椂鏈夋晥銆�', - required: false - }, - { - type: 'radio', - key: 'joint', - label: '鎷兼帴鍙傛暟', - initVal: card.joint || 'true', - required: false, - options: [{ - value: 'true', - text: '鏄�' - }, { - value: 'false', - text: '鍚�' - }] - }, - { - type: 'text', - key: 'sheet', - label: '琛ㄥ悕', - initVal: card.sheet || config.setting.tableName || '', - required: true - }, - { - type: 'radio', - key: 'pagination', - label: '鍒嗛〉', - initVal: card.pagination || 'false', - required: false, - options: [{ - value: 'true', - text: '鏄�' - }, { - value: 'false', - text: '鍚�' - }] - }, - { - type: 'radio', - key: 'search', - label: '鎼滅储鏉′欢', - initVal: card.search || 'false', - required: false, - options: [{ - value: 'true', - text: '蹇呭~' - }, { - value: 'false', - text: '闈炲繀濉�' - }] - }, - { - type: 'radio', - key: 'display', - label: '鏄剧ず鏂瑰紡', - initVal: card.display || 'modal', - required: true, - options: [{ - value: 'modal', - text: '妯℃�佹' - }, { - value: 'drawer', - text: '鎶藉眽' - }] - }, - { - type: 'number', - key: 'ratio', - min: 1, - max: 3000, - precision: 0, - label: '姣斾緥', - initVal: card.ratio || 85, - tooltip: '妯℃�佹鎴栨娊灞夌殑瀹藉害锛屽皬浜�100涓虹獥鍙e搴︼紙鎴栭珮搴︼級鐧惧垎姣旓紝澶т簬100涓哄儚绱犲�笺��', - required: true - }, - { - type: 'radio', - key: 'placement', - label: '寮瑰嚭鏂瑰悜', - initVal: card.placement || 'right', - required: false, - options: [{ - value: 'right', - text: '鍙充晶' - }, { - value: 'left', - text: '宸︿晶' - }, { - value: 'top', - text: '涓婁晶' - }, { - value: 'bottom', - text: '涓嬩晶' - }] - }, - { - type: 'radio', - key: 'clickouter', - label: '鐐瑰嚮钂欏眰', - initVal: card.clickouter || 'unclose', - required: false, - options: [{ - value: 'unclose', - text: '涓嶅叧闂�' - }, { - value: 'close', - text: '鍏抽棴' - }] - }, - { - type: 'radio', - key: 'control', - label: '鎸夐挳鎺у埗', - initVal: card.control || '', - required: false, - options: [{ - value: '', - text: '鏃�' - }, { - value: 'disabled', - text: '绂佺敤' - }, { - value: 'hidden', - text: '闅愯棌' - }] - }, - { - type: 'select', - key: 'controlField', - label: '鎺у埗瀛楁', - tooltip: '鎺у埗瀛楁锛屽彲鏍规嵁鏁版嵁鎺у埗鎸夐挳鐨勯殣钘忔垨绂佺敤銆�', - initVal: card.controlField || '', - required: true, - options: columns - }, - { - type: 'text', - key: 'controlVal', - label: '鎺у埗鍊�', - tooltip: '褰撻�夋嫨鎺у埗瀛楁锛屼笖瀛楁鍊间笌鎺у埗鍊肩浉绛夋椂锛屾寜閽細闅愯棌鎴栫鐢紝澶氫釜鍊肩敤閫楀彿鍒嗛殧銆�', - initVal: card.controlVal || '', - required: false - }, - { - type: 'text', - key: 'reason', - label: '绂佺敤鍘熷洜', - initVal: card.reason || '', - required: false - }, - { - type: 'radio', - key: 'hidden', - label: '闅愯棌', - initVal: card.hidden || 'false', - tooltip: '闅愯棌鍚庢寜閽湪椤甸潰涓笉鏄剧ず锛屼笖涓嶅弬涓庢潈闄愬垎閰嶃��', - required: false, - options: [{ - value: 'false', - text: '鍚�' - }, { - value: 'true', - text: '鏄�' - }] - }, - { - type: 'radio', - key: 'progress', - label: '杩涘害鎻愮ず', - initVal: card.progress || 'number', - required: false, - options: [{ - value: 'number', - text: '鍓╀綑鏁�' - }, { - value: 'progressbar', - text: '杩涘害鏉�' - }] - } - ] -} - -/** - * @description 鑾峰彇鏄剧ず鍒楄〃鍗曢厤缃俊鎭� - * @param {object} card // 鎼滅储鏉′欢瀵硅薄 - * @param {Array} menulist // 鑿滃崟鍒楄〃-鐢ㄤ簬瀛楁閫忚 - */ -export function getColumnForm (card, menulist = [], fields = []) { - let roleList = sessionStorage.getItem('sysRoles') - if (roleList) { - try { - roleList = JSON.parse(roleList) - } catch (e) { - roleList = [] - } - } else { - roleList = [] - } - - if (!card.linkurl && (!card.linkmenu || card.linkmenu.length === 0)) { - card.perspective = '' - } - - return [ - { - type: 'text', - key: 'label', - label: '鍚嶇О', - initVal: card.label, - required: true - }, - { - type: 'text', - key: 'field', - label: '瀛楁', - initVal: card.field, - required: true, - readonly: false - }, - { - type: 'select', - key: 'type', - label: '绫诲瀷', - initVal: card.type, - required: true, - options: [{ - value: 'text', - text: '鏂囨湰' - }, { - value: 'number', - text: '鏁板瓧' - }, { - value: 'picture', - text: '鍥剧墖' - }, { - value: 'video', - text: '瑙嗛' - }, { - value: 'link', - text: '閾炬帴' - }, { - value: 'textarea', - text: '澶氳鏂囨湰' - }, { - value: 'index', - text: '搴忓彿' - }] - }, - { - type: 'text', - key: 'nameField', - label: '鍚嶇О瀛楁', - initVal: card.nameField, - required: false, - readonly: false - }, - { - type: 'number', - key: 'Width', - min: 1, - max: 1000, - decimal: 0, - label: '鍒楀', - initVal: card.Width, - required: true - }, - { - type: 'radio', - key: 'joint', - label: '鎷兼帴鍙傛暟', - initVal: card.joint || 'true', - required: true, - options: [{ - value: 'true', - text: '鏄�' - }, { - value: 'false', - text: '鍚�' - }] - }, - { - type: 'radio', - key: 'Hide', - label: '闅愯棌', - initVal: card.Hide || 'false', - required: true, - options: [{ - value: 'true', - text: '鏄�' - }, { - value: 'false', - text: '鍚�' - }] - }, - { - type: 'radio', - key: 'IsSort', - label: '鎺掑簭', - initVal: card.IsSort || 'true', - required: true, - options: [{ - value: 'true', - text: '鏄�' - }, { - value: 'false', - text: '鍚�' - }] - }, - { - type: 'radio', - key: 'Align', - label: '瀵归綈鏂瑰紡', - initVal: card.Align || 'left', - required: true, - options: [{ - value: 'left', - text: '宸﹀榻�' - }, { - value: 'center', - text: '灞呬腑' - }, { - value: 'right', - text: '鍙冲榻�' - }] - }, - { - type: 'number', - key: 'startTime', - precision: 0, - label: '寮�濮嬫椂闂�', - initVal: card.startTime || 0, - tooltip: '瑙嗛寮�濮嬫挱鏀剧殑鏃堕棿锛岀敤浜庤皟鏁磋棰戝垵濮嬪寲灞曠ず鐨勭晫闈€��', - required: false - }, - { - type: 'select', - key: 'aspectRatio', - label: '闀垮姣�', - initVal: card.aspectRatio || '16:9', - required: true, - options: [ - { value: '4:3', text: '4:3' }, - { value: '16:9', text: '16:9' } - ] - }, - { - type: 'radio', - key: 'rowspan', - label: '琛屽悎骞�', - initVal: card.rowspan || 'false', - tooltip: '鐩搁偦琛屼俊鎭浉鍚屾椂锛屽崟鍏冩牸鍚堝苟銆�', - required: false, - options: [{ - value: 'true', - text: '鏄�' - }, { - value: 'false', - text: '鍚�' - }] - }, - { - type: 'radio', - key: 'sum', - label: '鏄剧ず鍚堣', - initVal: card.sum || 'false', - tooltip: '鍚堣淇℃伅鍙湪浣跨敤绯荤粺鏁版嵁婧愶紝涓斿綋鍓嶅垪鏈殣钘忔椂鏈夋晥銆�', - required: false, - options: [{ - value: 'true', - text: '鏄�' - }, { - value: 'false', - text: '鍚�' - }] - }, - { - type: 'number', - key: 'decimal', - min: 0, - max: 18, - decimal: 0, - label: '灏忔暟浣�', - initVal: card.decimal || 0, - required: true - }, - { - type: 'number', - key: 'fieldlength', - label: '瀛楁闀垮害', - initVal: card.fieldlength || (card.type === 'text' ? 50 : 512), - required: true - }, - { - type: 'select', - key: 'format', - label: '鏍煎紡鍖�', - initVal: card.format || 'none', - options: [{ - value: 'none', - text: '鏃�' - }, { - value: 'thdSeparator', - text: '鍗冨垎浣�' - }, { - value: 'percent', - text: '鐧惧垎姣�' - }, { - value: 'abs', - text: '缁濆鍊�' - }], - required: false - }, - { - type: 'select', - key: 'textFormat', - label: '鏍煎紡鍖�', - initVal: card.textFormat || 'none', - options: [{ - value: 'none', - text: '鏃�' - }, { - value: 'encryption', - text: '鍔犲瘑' - }, { - value: 'YYYY-MM-DD', - text: 'YYYY-MM-DD' - }, { - value: 'YYYY-MM-DD HH:mm:ss', - text: 'YYYY-MM-DD HH:mm:ss' - }], - required: false - }, - { - type: 'text', - key: 'prefix', - label: '鍓嶇紑', - initVal: card.prefix || '', - required: false, - readonly: false - }, - { - type: 'text', - key: 'postfix', - label: '鍚庣紑', - initVal: card.postfix || '', - tooltipClass: 'middle', - required: false, - readonly: false - }, - { - type: 'number', - key: 'span', - min: 1, - max: 24, - precision: 0, - label: '鍥剧墖瀹藉害', - initVal: card.span || 24, - tooltip: '鏍呮牸甯冨眬锛岀瓑鍒嗕负24浠姐��', - required: true - }, - { - type: 'select', - key: 'lenWidRadio', - label: '闀垮姣�', - initVal: card.lenWidRadio || '1:1', - required: true, - options: [ - { value: '1:1', text: '1:1' }, - { value: '4:3', text: '4:3' }, - { value: '3:2', text: '3:2' }, - { value: '16:9', text: '16:9' }, - { value: '2:1', text: '2:1' }, - { value: '3:1', text: '3:1' }, - { value: '4:1', text: '4:1' }, - { value: '5:1', text: '5:1' }, - { value: '6:1', text: '6:1' }, - { value: '7:1', text: '7:1' }, - { value: '8:1', text: '8:1' }, - { value: '9:1', text: '9:1' }, - { value: '10:1', text: '10:1' }, - { value: '3:4', text: '3:4' }, - { value: '2:3', text: '2:3' }, - { value: '9:16', text: '9:16' }, - ] - }, - { - type: 'radio', - key: 'scale', - label: '鐐瑰嚮缂╂斁', - initVal: card.scale || 'true', - required: false, - options: [{ - value: 'true', - text: '鏄�' - }, { - value: 'false', - text: '鍚�' - }] - }, - { - type: 'radio', - key: 'perspective', - label: '瀛楁閫忚', - initVal: card.perspective || '', - options: [{ - value: '', - text: '鏃�' - }, { - value: 'linkmenu', - text: '鑿滃崟' - }, { - value: 'linkurl', - text: '閾炬帴' - }] - }, - { - type: 'cascader', - key: 'linkmenu', - label: '鑿滃崟', - 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: '榛戝悕鍗�', - 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 (e) { - 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: '鏍囬', - 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: '闅愯棌', - initVal: card.Hide, - required: true, - options: [{ - value: 'true', - text: '鏄�' - }, { - value: 'false', - text: '鍚�' - }] - }, - { - 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', - key: 'blacklist', - label: '榛戝悕鍗�', - initVal: card.blacklist || [], - required: false, - options: roleList - }, - { - type: 'multiselect', - key: 'actions', - label: '鎵╁睍鎸夐挳', - initVal: card.actions || [], - tooltip: '鍙粦瀹氬凡鏈夌殑excel瀵煎叆銆佸鍑烘寜閽�', - required: false, - 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: '鏌ヨ' }, - { value: 'statistics', text: '缁熻' } - ] - }, - { - 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: '鏄�' - }, { - value: 'false', - text: '鍚�' - }] - }, - { - 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 {*} tabfields // 鍙垏鎹㈣〃鍗� - * @param {*} linkableFields // 鍙叧鑱旇〃鍗� - * @param {*} linksupFields // 涓婄骇琛ㄥ崟 */ -export function getModalForm (card, inputfields = [], tabfields = [], linkableFields, linksupFields, columns = []) { +export function getModalForm (card, fields, columns = []) { let appType = sessionStorage.getItem('appType') let roleList = sessionStorage.getItem('sysRoles') if (roleList) { @@ -2455,6 +767,64 @@ } } else { msgTemps = [] + } + + let inputfields = [] + let tabfields = [] + let linkableFields = [] + let linksupFields = [] + + fields.forEach(item => { + if (!item.field || card.field === item.field) return + + if (['text', 'number', 'textarea', 'select'].includes(item.type)) { + inputfields.push({ + field: item.field, + label: item.label + }) + } + if (item.hidden !== 'true' && ['text', 'number', 'select', 'link'].includes(item.type)) { + tabfields.push({ + field: item.field, + label: item.label + }) + } + + if (['switch', 'check', 'popSelect'].includes(item.type)) { + linksupFields.push({ + field: item.field, + label: item.label + }) + } + + if (['select', 'link', 'radio', 'checkcard', 'multiselect'].includes(item.type)) { + linksupFields.push({ + field: item.field, + label: item.label + }) + } + + if (['select', 'link', 'radio', 'popSelect'].includes(item.type) || (item.type === 'checkcard' && item.multiple !== 'true')) { + linkableFields.push({ + field: item.field, + label: item.label + '-琛ㄥ崟' + }) + } + }) + + let _fields = linkableFields.map(cell => cell.field) + columns.forEach(col => { + if (col.field && !_fields.includes(col.field)) { + linkableFields.push({ + field: col.field, + label: col.label + '-鏄剧ず鍒�' + }) + } + }) + + if (card.linkSubField && card.linkSubField.length > 0) { + let fields = inputfields.map(item => item.field) + card.linkSubField = card.linkSubField.filter(item => fields.includes(item)) } inputfields = inputfields.map((item, index) => { @@ -2496,6 +866,9 @@ }, { value: 'link', text: '鑱斿姩鑿滃崟' + }, { + value: 'popSelect', + text: '閫夋嫨鍣�' }, { value: 'switch', text: '寮�鍏�' @@ -2769,12 +1142,12 @@ { type: 'number', key: 'width', - min: 1, + min: 0, max: 24, precision: 0, label: '鍏冪礌瀹藉害', - initVal: card.width || 4, - tooltip: '鏍呮牸甯冨眬锛屾瘡琛岀瓑鍒嗕负24鍒椼��', + initVal: card.width === 0 ? 0 : (card.width || 4), + tooltip: '鏍呮牸甯冨眬锛屾瘡琛岀瓑鍒嗕负24鍒椼�傛敞锛氬綋瀹藉害涓�0鏃讹紝鍏冪礌鏍规嵁鍐呭鑷�傚簲', required: true }, { @@ -2820,26 +1193,218 @@ text: '16:9' }] }, - // { - // type: 'radio', - // key: 'setAll', - // label: '璁剧疆绌哄��', - // initVal: card.setAll || 'false', - // options: [{ - // value: 'true', - // text: '鏄�' - // }, { - // value: 'false', - // text: '鍚�' - // }] - // }, + { + type: 'codemirror', + key: 'dataSource', + label: '鏁版嵁婧�', + initVal: card.dataSource || '', + tooltip: '鏁版嵁鏉冮檺鏇挎崲绗� $@ -> /* 鎴� \'\'銆� @$ -> */ 鎴� \'\'', + placeholder: '绯荤粺鍙橀噺锛歮k_departmentcode銆乵k_organization銆乵k_user_type銆傚叕鍏卞�硷細@ID@銆丂BID@銆�', + required: true, + readonly: false + }, { type: 'fields', key: 'fields', label: '瀛楁闆�', initVal: card.fields || [], required: true, - readonly: false + readonly: false, + columns: [ + { + title: '瀛楁鍚�', + dataIndex: 'field', + inputType: 'input', + editable: true, + unique: true, + strict: true, + forbids: ['value', 'parentid', 'pid'], + initval: 'field', + rules: [{ + pattern: /^[\u4E00-\u9FA50-9a-zA-Z_-]*$/ig, + message: '璇蜂娇鐢ㄦ暟瀛椼�佸瓧姣嶃�佹眽瀛椾互鍙奯-' + }], + width: '20%' + }, + { + title: '瀛椾綋棰滆壊', + dataIndex: 'color', + inputType: 'color', + editable: true, + initval: 'rgba(0, 0, 0, 0.85)', + width: '20%', + render: (text, record) => { + return <span style={{color: text}}>绀轰緥</span> + } + }, + { + title: '瀛椾綋澶у皬', + dataIndex: 'fontSize', + inputType: 'number', + min: 12, + max: 50, + editable: true, + initval: 14, + width: '20%', + }, + { + title: '瀵归綈鏂瑰紡', + dataIndex: 'align', + inputType: 'select', + editable: true, + width: '20%', + initval: 'left', + options: [ + {value: 'left', text: '灞呭乏'}, + {value: 'center', text: '灞呬腑'}, + {value: 'right', text: '灞呭彸'}, + ], + render: (text, record) => { + if (text === 'center') { + return '灞呬腑' + } else if (text === 'right') { + return '灞呭彸' + } else { + return '灞呭乏' + } + } + } + ] + }, + { + type: 'fields', + key: 'columns', + label: '瀛楁闆�', + initVal: card.columns || [], + required: true, + readonly: false, + columns: [ + { + title: '鍚嶇О', + dataIndex: 'label', + inputType: 'input', + editable: true, + initval: 'label', + width: '20%' + }, + { + title: '瀛楁', + dataIndex: 'field', + inputType: 'input', + editable: true, + unique: true, + strict: true, + copy: true, + initval: 'field', + rules: [{ + pattern: /^[\u4E00-\u9FA50-9a-zA-Z_-]*$/ig, + message: '璇蜂娇鐢ㄦ暟瀛椼�佸瓧姣嶃�佹眽瀛椾互鍙奯-' + }], + width: '20%' + }, + { + title: '闅愯棌', + dataIndex: 'Hide', + inputType: 'radio', + editable: true, + width: '20%', + initval: 'false', + options: [ + {value: 'true', text: '鏄�'}, + {value: 'false', text: '鍚�'}, + ], + render: (text, record) => { + if (text === 'true') { + return '鏄�' + } else { + return '鍚�' + } + } + }, + { + title: '鎺掑簭', + dataIndex: 'IsSort', + inputType: 'radio', + editable: true, + width: '20%', + initval: 'false', + options: [ + {value: 'true', text: '鏄�'}, + {value: 'false', text: '鍚�'}, + ], + render: (text, record) => { + if (text === 'true') { + return '鏄�' + } else { + return '鍚�' + } + } + }, + { + title: '鍒楀', + dataIndex: 'Width', + inputType: 'number', + editable: true, + width: '20%', + initval: 120 + } + ] + }, + { + type: 'select', + key: 'primaryKey', + label: '涓婚敭', + initVal: card.primaryKey || '', + required: true, + readonly: false, + options: 'columns' + }, + { + type: 'text', + key: 'order', + label: '榛樿鎺掑簭', + initVal: card.order || '', + placeholder: 'ID asc', + required: true + }, + { + type: 'select', + key: 'showField', + label: '鏄剧ず瀛楁', + initVal: card.showField || '', + tooltip: '鐢ㄤ簬鎺у埗閫夋嫨妗嗕腑鐨勬樉绀哄唴瀹广��', + required: true, + options: 'columns' + }, + { + type: 'select', + key: 'controlField', + label: '绂佺敤瀛楁', + initVal: card.controlField || '', + tooltip: '鐢ㄤ簬鎺у埗琛屾暟鎹槸鍚﹀彲閫夋嫨銆傚瓧娈靛�间负true鏃讹紝閫夐」涓嶅彲閫夈��', + required: false, + allowClear: true, + options: 'columns' + }, + { + type: 'text', + key: 'searchKey', + label: '鎼滅储瀛楁', + initVal: card.searchKey || '', + tooltip: '澶氫釜鍊艰鐢ㄩ�楀彿鍒嗛殧銆�', + required: false, + rules: [{ + pattern: /^[0-9a-zA-Z,_-]*$/ig, + message: '瀛楁鍚嶅彧鍏佽鍖呭惈鏁板瓧銆佸瓧姣嶄互鍙奯-', + }] + }, + { + type: 'number', + key: 'popWidth', + label: '寮圭獥瀹藉害', + initVal: card.popWidth || 60, + tooltip: '灏忎簬100鏃朵负鐧惧垎鐜囷紝澶т簬100鏃朵负缁濆鍊笺��', + required: true }, { type: 'options', @@ -2850,12 +1415,33 @@ readonly: false }, { - type: 'codemirror', - key: 'dataSource', - label: '鏁版嵁婧�', - initVal: card.dataSource || '', - required: true, - readonly: false + type: 'radio', + key: 'laypage', + label: '鍒嗛〉', + initVal: card.laypage || 'true', + required: false, + options: [{ + value: 'true', + text: '鏄�' + }, { + value: 'false', + text: '鍚�' + }] + }, + { + type: 'radio', + key: 'onload', + label: '鍒濆鍖�', + initVal: card.onload || 'true', + tooltip: '褰撴病鏈夎缃悳绱㈠瓧娈垫椂锛屽垵濮嬪寲鍔犺浇鏁版嵁銆�', + required: false, + options: [{ + value: 'true', + text: '鍔犺浇' + }, { + value: 'false', + text: '涓嶅姞杞�' + }] }, { type: 'radio', @@ -2914,7 +1500,7 @@ readonly: false }, { - type: 'select', + type: 'radio', key: 'orderType', label: '鎺掑簭鏂瑰紡', initVal: card.orderType || 'asc', @@ -2997,7 +1583,20 @@ }, { value: '-90', text: '鍓�90澶�' + }, { + value: 'custom', + text: '鑷畾涔�' }] + }, + { + type: 'text', + key: 'minDateField', + label: '鏈�灏忓�硷紙瀛楁锛�', + initVal: card.minDateField || '', + tooltip: '鏈�灏忓�煎搴斿瓧娈碉紝涔熷彲鑷畾涔夊浐瀹氬�硷紝鏍煎紡涓篩YYY-MM-DD銆�', + required: true, + readonly: false, + options: columns }, { type: 'select', @@ -3047,7 +1646,20 @@ }, { value: '-90', text: '鍓�90澶�' + }, { + value: 'custom', + text: '鑷畾涔�' }] + }, + { + type: 'text', + key: 'maxDateField', + label: '鏈�澶у�硷紙瀛楁锛�', + initVal: card.maxDateField || '', + tooltip: '鏈�澶у�煎搴斿瓧娈碉紝涔熷彲鑷畾涔夊浐瀹氬�硷紝鏍煎紡涓篩YYY-MM-DD銆�', + required: true, + readonly: false, + options: columns }, { type: 'radio', @@ -3086,7 +1698,7 @@ type: 'text', key: 'separator', label: '杩炴帴绗�', - initVal: card.separator === undefined ? '/' : card.separator, + initVal: card.separator === undefined ? ',' : card.separator, tooltip: '琛ㄥ崟鎻愪氦鏃朵俊鎭箣闂寸殑杩炴帴绗︺�傛敞锛氳繛鎺ョ涓虹┖鏃讹紝鍒濆鍖栨椂濉厖鍏朵粬琛ㄥ崟鏃犳晥銆�', required: false, readonly: false @@ -3236,6 +1848,19 @@ }, { type: 'radio', + key: 'notZero', + label: "涓嶅彲涓�0", + initVal: card.notZero || 'false', + options: [{ + value: 'true', + text: '鏄�' + }, { + value: 'false', + text: '鍚�' + }] + }, + { + type: 'radio', key: 'database', label: '鏁版嵁搴�', initVal: card.database || 'local', @@ -3307,6 +1932,21 @@ }, { value: 'false', text: '鍚�' + }] + }, + { + type: 'radio', + key: 'format', + label: '鏍煎紡鍖�', + tooltip: '浣跨敤鍗冨垎浣嶆椂锛屾暟鍊煎皢浠ュ崈鍒嗕綅鏍煎紡鏄剧ず锛屾彁浜ゆ椂涓哄師鏁板�笺��', + initVal: card.format || '', + forbid: appType === 'mob', + options: [{ + value: '', + text: '鏃�' + }, { + value: 'thdSeparator', + text: '鍗冨垎浣�' }] }, { @@ -3403,6 +2043,36 @@ }, { type: 'radio', + key: 'border', + label: '杈规', + initVal: card.border || 'show', + required: false, + options: [{ + value: 'show', + text: '鏄剧ず' + }, { + value: 'hide', + text: '闅愯棌' + }] + }, + { + type: 'radio', + key: 'checkAll', + label: '鍏ㄩ��', + initVal: card.checkAll || 'hide', + tooltip: '鍙閫夌殑閫夐」鍗℃槸鍚︽樉绀哄叏閫夊紑鍏筹紝娉細褰撻�夐」澶т簬3涓椂鏈夋晥銆�', + required: false, + forbid: appType !== '', + options: [{ + value: 'hide', + text: '闅愯棌' + }, { + value: 'show', + text: '鏄剧ず' + }] + }, + { + type: 'radio', key: 'selectStyle', label: '閫変腑鏁堟灉', tooltip: '鑳屾櫙鍙婃枃瀛楀彉鍖栨椂浼氫娇鐢ㄧ郴缁熻壊銆�', @@ -3476,6 +2146,7 @@ key: 'inputType', label: '鍔犲瘑鏄剧ず', initVal: card.inputType || 'text', + tooltip: '杈撳叆妗嗗唴瀹逛互 ****** 鏄剧ず銆�', required: false, options: [{ value: 'text', @@ -3486,18 +2157,36 @@ }] }, { - type: 'radio', + type: 'select', key: 'interception', - label: '鎴彇绌烘牸', + label: '鏂囨湰棰勫鐞�', initVal: card.interception || 'true', - tooltip: '鎻愪氦鏃讹紝鏄惁鎴彇棣栧熬鐨勭┖鐧藉瓧绗︺��', + tooltip: '鎻愪氦鏃剁殑鏂囨湰澶勭悊鏂瑰紡銆傛敞锛氬叏瑙掕浆鍗婅鏃朵細鍘婚櫎棣栧熬绌烘牸', options: [{ - value: 'true', - text: '鏄�' - }, { value: 'false', - text: '鍚�' + text: '鏃�' + }, { + value: 'true', + text: '鍘绘帀棣栧熬绌烘牸' + // }, { + // value: 'char', + // text: '鍏ㄨ杞崐瑙�' + }, { + value: 'charTure', + text: '鍏ㄨ杞崐瑙�' + }, { + value: 'func', + text: '鑷畾涔夊嚱鏁�' }] + }, + { + type: 'textarea', + key: 'func', + label: '鍑芥暟', + initVal: card.func || '', + tooltip: '鍑芥暟鏈変袱涓叆鍙�(value, data)锛岀涓�涓负褰撳墠琛ㄥ崟鍊硷紝绗簩涓负琛ㄥ崟鎵�鏈夊瓧娈�-鍊肩殑瀵硅薄锛岃杩斿洖澶勭悊鍚庣殑鍊笺��', + rows: 2, + required: true }, { type: 'textarea', @@ -3731,7 +2420,7 @@ type: 'radio', key: 'constant', label: 'Unicode甯搁噺', - tooltip: '浣跨敤鏃跺皢鍦ㄦ彁浜ゅ唴瀹瑰墠鍔犱笂 N锛屼唬琛ㄥ瓨鍏ユ暟鎹簱鏃朵互 Unicode 鏍煎紡瀛樺偍銆�', + tooltip: `浣跨敤鏃跺皢鍦ㄦ彁浜ゅ唴瀹瑰墠鍔犱笂 N锛屼唬琛ㄥ瓨鍏ユ暟鎹簱鏃朵互 Unicode 鏍煎紡瀛樺偍銆備緥濡傦細@nvarchar=N'脴W30041'銆俙, initVal: card.constant || 'false', options: [{ value: 'true', @@ -3740,6 +2429,23 @@ value: 'false', text: '涓嶄娇鐢�' }] + }, + { + type: 'radio', + key: 'mkfocus', + label: '鑱氱劍鏃�', + initVal: card.mkfocus || 'def', + options: [{ + value: 'def', + text: '榛樿' + }, { + value: 'check', + text: '鍏ㄩ��' + }, { + value: 'clear', + text: '娓呯┖' + }], + forbid: appType !== 'mob' }, { type: 'radio', @@ -3871,13 +2577,33 @@ readonly: false }, { + type: 'radio', + key: 'opacity', + label: '鏄惁鍙', + initVal: card.opacity || 'true', + tooltip: '涓嶅彲瑙佹椂浠呯敤浣滆〃鍗曞垎闅旓紝涓嶆樉绀哄悕绉般��', + required: false, + forbid: appType === 'mob', + options: [{ + value: 'true', + text: '鍙' + }, { + value: 'false', + text: '涓嶅彲瑙�' + }] + }, + { type: 'text', key: 'regularExtra', label: '姝e垯鎵╁睍绗�', initVal: card.regularExtra || '', tooltip: '姝e垯楠岃瘉鏃跺厑璁告坊鍔犵殑鑷畾涔夊瓧绗︼紝鍖呮嫭~!@#$%^&*()_+:;{}<>,.-', required: false, - readonly: false + readonly: false, + rules: [{ + pattern: /^[~!@#$%^&*()_+:;{}<>,.-]*$/, + message: '鎵╁睍绗﹀寘鎷瑍!@#$%^&*()_+:;{}<>,.-' + }] }, { type: 'text', @@ -3943,7 +2669,7 @@ key: 'enter', label: '鍥炶溅浜嬩欢', initVal: (card.type === 'text' || card.type === 'number') ? (card.enter || 'sub') : (card.enter || 'false'), - tooltip: '鐐瑰嚮Enter閿紝鎴栨枃鏈被琛ㄥ崟杈撳叆鍥炶溅绗︺��', + tooltip: '1銆佺偣鍑籈nter閿垨鏂囨湰绫昏〃鍗曡緭鍏ュ洖杞︾锛�2銆佷笅鎷夐�夋嫨銆佹椂闂淬�佸紑鍏崇殑閫夐」鍒囨崲銆�', options: [{ value: 'sub', text: '鎻愪氦' @@ -3967,9 +2693,10 @@ type: 'multiselect', key: 'linkSubField', label: '濉厖琛ㄥ崟', - tooltip: '鍦ㄥ垏鎹㈤�夐」鏃朵細鎶婁俊鎭嚜鍔ㄥ~鍏ュ叧鑱旂殑琛ㄥ崟锛堟枃鏈垨鏁板瓧琛ㄥ崟锛変腑銆�', + tooltip: '鍦ㄥ垏鎹㈤�夐」鏃朵細鎶婁俊鎭嚜鍔ㄥ~鍏ュ叧鑱旂殑琛ㄥ崟锛堟枃鏈垨鏁板瓧琛ㄥ崟锛変腑锛屽紑鍏充細灏嗘彁绀烘枃鏈~鍏ユ琛ㄥ崟锛屾枃浠朵笂浼犱細灏嗗師鏂囦欢鍚嶅~鍏ユ琛ㄥ崟銆�', initVal: card.linkSubField || [], - options: inputfields + options: inputfields, + allowClear: true }, // { // type: 'number', @@ -4028,332 +2755,5 @@ options: roleList, forbid: appType === 'mob' } - ] -} - -/** - * @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: '鏍囩鍚嶇О', - initVal: card.label || '', - required: true - }, - { - type: 'select', - key: 'linkTab', - label: '鍏宠仈鏍囩', - initVal: card.linkTab || '', - required: false, - options: [] - }, - { - type: 'icon', - key: 'icon', - label: '鍥炬爣', - initVal: card.icon || '', - required: false, - forbid: type === 'CalendarPage' - }, - { - type: 'select', - key: 'supMenu', - label: '涓婄骇鏍囩', - initVal: supMenu, - required: false, - options: menus, - forbid: type === 'CalendarPage' - }, - { - type: 'mutilselect', - key: 'equalTab', - label: '鍚岀骇鏍囩', - 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