From ef6f1dac56e8e5dd99720897139b7f6487347211 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 26 十月 2023 15:18:48 +0800 Subject: [PATCH] 2023-10-26 --- src/templates/zshare/modalform/index.jsx | 4 src/templates/sharecomponent/tabscomponent/formconfig.jsx | 87 + src/templates/sharecomponent/actioncomponent/formconfig.jsx | 714 +++++++++ src/templates/zshare/formconfig.jsx | 2165 ---------------------------- src/templates/sharecomponent/chartcomponent/chartcompile/index.jsx | 2 src/templates/sharecomponent/chartcomponent/chartcompile/formconfig.jsx | 278 +++ src/templates/zshare/modalform/index.scss | 36 src/templates/sharecomponent/columncomponent/index.jsx | 2 src/menu/components/table/edit-table/columns/editColumn/index.scss | 30 src/templates/sharecomponent/actioncomponent/index.jsx | 2 src/templates/sharecomponent/chartgroupcomponent/formconfig.jsx | 172 ++ src/templates/sharecomponent/cardcomponent/index.jsx | 2 src/templates/sharecomponent/columncomponent/formconfig.jsx | 366 ++++ src/menu/components/table/edit-table/columns/editColumn/index.jsx | 111 + src/templates/sharecomponent/tabscomponent/index.jsx | 2 src/templates/sharecomponent/cardcomponent/formconfig.jsx | 322 ++++ src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx | 144 + src/templates/sharecomponent/chartgroupcomponent/index.jsx | 2 src/templates/sharecomponent/searchcomponent/searchform/index.jsx | 6 19 files changed, 2,212 insertions(+), 2,235 deletions(-) diff --git a/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx b/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx index 9142ee4..da0ea0b 100644 --- a/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx +++ b/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx @@ -201,7 +201,7 @@ }] }, { - type: 'radio', + type: 'select', key: 'editType', label: '缂栬緫绫诲瀷', initVal: card.editType || 'text', @@ -218,6 +218,9 @@ }, { value: 'date', text: '鏃ユ湡锛堝ぉ锛�' + }, { + value: 'popSelect', + text: '閫夋嫨鍣�' }] }, { @@ -319,6 +322,141 @@ required: true, }, { + 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: 'text', key: 'valueField', label: '鍊悸峰瓧娈�', @@ -412,7 +550,7 @@ { type: 'select', key: 'ctrlField', - label: '绂佺敤瀛楁', + label: '绂佹缂栬緫', initVal: card.ctrlField || '', tooltip: '鎺у埗鍗曞厓鏍兼槸鍚﹀彲浠ョ紪杈戙��', allowClear: true, @@ -422,7 +560,7 @@ { type: 'text', key: 'ctrlValue', - label: '绂佺敤鍊�', + label: '绂佹鍊�', initVal: card.ctrlValue || '', tooltip: '澶氫釜鍊肩敤閫楀彿鍒嗛殧銆�', required: false diff --git a/src/menu/components/table/edit-table/columns/editColumn/index.jsx b/src/menu/components/table/edit-table/columns/editColumn/index.jsx index 796a764..baca4f6 100644 --- a/src/menu/components/table/edit-table/columns/editColumn/index.jsx +++ b/src/menu/components/table/edit-table/columns/editColumn/index.jsx @@ -7,11 +7,13 @@ import Api from '@/api' import Utils from '@/utils/utils.js' import { getColumnForm } from './formconfig' +import asyncComponent from '@/utils/asyncComponent' import { formRule } from '@/utils/option.js' import CodeMirror from '@/templates/zshare/codemirror' import EditTable from '@/templates/zshare/modalform/modaleditable' import './index.scss' +const FieldsTable = asyncComponent(() => import('@/templates/zshare/editTable')) const { TextArea } = Input const columnTypeOptions = { @@ -70,11 +72,13 @@ _options.push('editType') if (this.record.editType === 'switch') { - _options.push('enter', 'openVal', 'closeVal', 'openText', 'closeText', 'editField') + _options.push('enter', 'openVal', 'closeVal', 'openText', 'closeText') } else if (this.record.editType === 'date') { _options.push('required', 'precision', 'enter', 'declareType') + } else if (this.record.editType === 'popSelect') { + _options.push('required', 'enter', 'linkSubField', 'columns', 'dataSource', 'primaryKey', 'order', 'showField', 'controlField', 'searchKey', 'popWidth') } else if (this.record.editType === 'select') { - _options.push('required', 'enter', 'resourceType', 'linkSubField', 'editField', 'dropdown') + _options.push('required', 'enter', 'resourceType', 'linkSubField', 'dropdown') if (this.record.resourceType === '0') { _options.push('options') @@ -265,8 +269,8 @@ this.props.form.setFieldsValue({dataSource: resource}) } - changeOptions = (data) => { - this.record.options = data || [] + changeOptions = (data, key) => { + this.record[key] = data || [] } getFields() { @@ -311,6 +315,12 @@ rules = [ { required: item.required, message: '璇烽�夋嫨' + item.label + '!' } ] + + let options = item.options + if (typeof(item.options) === 'string') { + options = this.record[item.options] || [] + } + content = <Select showSearch allowClear={item.allowClear === true} @@ -318,7 +328,7 @@ onChange={(value, option) => {this.typeChange(item.key, value, option)}} getPopupContainer={() => document.getElementById('edit-table-column-winter')} > - {item.options.map((option, i) => + {options.map((option, i) => <Select.Option key={i} datatype={option.datatype || ''} label={option.label || ''} value={(option.value || option.field || option.MenuID)}> {(option.text || option.label || option.MenuName)} </Select.Option> @@ -346,7 +356,6 @@ </Select> } else if (item.type === 'textarea') { span = 24 - className = 'text-area' rules = [ { required: item.required, message: '璇疯緭鍏�' + item.label + '!' } ] @@ -379,9 +388,10 @@ { required: item.required, message: '璇疯緭鍏�' + item.label + '!' } ] span = 24 - className = 'text-area' - extra = <span className="add-resource-empty" onClick={this.handleEmpty}>绌�</span> + if (this.record.editType !== 'popSelect') { + extra = <span className="add-resource-empty" onClick={this.handleEmpty}>绌�</span> + } if (item.placeholder) { extra = <><span className="resource-public-var">{item.placeholder}</span>{extra}</> } @@ -389,7 +399,6 @@ content = <CodeMirror /> } else if (item.type === 'options') { span = 24 - className = 'text-area' let linkSubFields = this.record.linkSubField || [] @@ -404,7 +413,14 @@ columns.push({ title: transfield[field] || field, key: field }) }) - content = <EditTable columns={columns} module="form" onChange={this.changeOptions}/> + content = <EditTable columns={columns} module="form" onChange={(data) => this.changeOptions(data, item.key)}/> + } else if (item.type === 'fields') { + span = 24 + rules = [ + { required: item.required, message: '璇锋坊鍔�' + item.label + '!' } + ] + + content = <FieldsTable indexShow={false} actions={['edit', 'move', 'del', 'add']} columns={item.columns} data={this.record[item.key] || []} onChange={(data) => this.changeOptions(data, item.key)}/> } fields.push( @@ -503,9 +519,9 @@ } } - if (values.dataSource && /\s/.test(values.dataSource)) { + if (values.dataSource) { let error = Utils.verifySql(values.dataSource) - + if (error) { notification.warning({ top: 92, @@ -514,16 +530,17 @@ }) return } + } - this.setState({ - loading: true - }) + if (values.editType === 'select' && values.resourceType === '1' && values.dataSource) { + let _option = Utils.getSelectQueryOptions(values) let sql = `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) - ${values.dataSource}` - - sql = sql.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'1949-10-01 15:00:00'`) - + ${_option.sql}` + + // LoginUID|SessionUid|UserID|Appkey 宸叉浛鎹� + sql = sql.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|time_id)@/ig, `'1949-10-01 15:00:00'`) + let rduri = '' if (window.GLOB.mainSystemApi && values.database === 'sso') { rduri = window.GLOB.mainSystemApi @@ -541,6 +558,62 @@ }) } }) + } else if (values.editType === 'popSelect' && values.dataSource) { + let arrfield = values.columns.map(f => f.field) + + if (values.linkSubField && values.linkSubField.length > 0) { + values.linkSubField.forEach(n => { + if (!arrfield.includes(n)) { + arrfield.push(n) + } + }) + } + + let _datasource = values.dataSource + let sql = '' + + if (/\s/.test(_datasource)) { // 鎷兼帴鍒悕 + _datasource = '(' + _datasource + ') tb' + } + + arrfield = arrfield.join(',') + + let _search = '' + + if (values.searchKey) { + let fields = values.searchKey.split(',').map(field => field + ' like \'%mk%\'') + _search = 'where ' + fields.join(' OR ') + } + + if (values.laypage === 'true') { + sql = `/*system_query*/select top 10 ${arrfield} from (select ${arrfield} ,ROW_NUMBER() over(order by ${values.order}) as rows from ${_datasource} ${_search}) tmptable where rows > 0 order by tmptable.rows ` + } else if (values.order) { + sql = `/*system_query*/select ${arrfield} from (select ${arrfield} ,ROW_NUMBER() over(order by ${values.order}) as rows from ${_datasource} ${_search}) tmptable order by tmptable.rows ` + } else { + sql = `/*system_query*/select ${arrfield} from ${_datasource} ${_search} ` + } + + sql = `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) + ${sql}` + + sql = sql.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') + sql = sql.replace(/@LoginUID@/ig, `'${sessionStorage.getItem('LoginUID') || ''}'`) + sql = sql.replace(/@SessionUid@/ig, `'${localStorage.getItem('SessionUid') || ''}'`) + sql = sql.replace(/@UserID@/ig, `'${sessionStorage.getItem('UserID') || ''}'`) + sql = sql.replace(/@Appkey@/ig, `'${window.GLOB.appkey || ''}'`) + + Api.sDebug(sql).then(result => { + if (result.status || result.ErrCode === '-2') { + this.setState({visible: false, loading: false, formlist: null}) + this.props.submitCol(values) + this.record = null + } else { + this.setState({loading: false}) + Modal.error({ + title: result.message + }) + } + }) } else { this.setState({visible: false, formlist: null}) this.props.submitCol(values) diff --git a/src/menu/components/table/edit-table/columns/editColumn/index.scss b/src/menu/components/table/edit-table/columns/editColumn/index.scss index 05b0e19..82b274d 100644 --- a/src/menu/components/table/edit-table/columns/editColumn/index.scss +++ b/src/menu/components/table/edit-table/columns/editColumn/index.scss @@ -6,15 +6,22 @@ padding-right: 3px; } } - .ant-form-item.text-area { - >.ant-form-item-control-wrapper { - width: 88%; - } - >.ant-form-item-label { - width: 12%; - } - .CodeMirror { - height: 150px; + >.ant-row >.ant-col { + display: inline-block; + vertical-align: top; + float: none; + } + .ant-col-24 { + >.ant-form-item { + >.ant-form-item-label { + width: 12%; + } + >.ant-form-item-control-wrapper { + width: 88%; + } + .CodeMirror { + height: 150px; + } } } .formula-icon { @@ -42,11 +49,6 @@ left: 0px; top: -25px; font-size: 14px; - } - >.ant-row >.ant-col { - display: inline-block; - vertical-align: top; - float: none; } } .formula-fields { diff --git a/src/templates/sharecomponent/actioncomponent/formconfig.jsx b/src/templates/sharecomponent/actioncomponent/formconfig.jsx new file mode 100644 index 0000000..42ef767 --- /dev/null +++ b/src/templates/sharecomponent/actioncomponent/formconfig.jsx @@ -0,0 +1,714 @@ +import { btnClasses } from '@/utils/option.js' + +/** + * @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: '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: '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: 'stringify', + label: '搴忓垪鍖�', + initVal: card.stringify || 'text', + required: false, + options: [{ + value: 'text', + text: 'Text' + }, { + value: 'JSON', + text: 'JSON' + }, { + value: 'qs', + text: 'qs' + }] + }, + { + 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 || 'grid', + 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: '杩涘害鏉�' + }] + } + ] +} \ No newline at end of file diff --git a/src/templates/sharecomponent/actioncomponent/index.jsx b/src/templates/sharecomponent/actioncomponent/index.jsx index 8f66baa..3d65364 100644 --- a/src/templates/sharecomponent/actioncomponent/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/index.jsx @@ -6,7 +6,7 @@ import Api from '@/api' import Utils from '@/utils/utils.js' -import { getActionForm } from '@/templates/zshare/formconfig' +import { getActionForm } from './formconfig' import asyncSpinComponent from '@/utils/asyncSpinComponent' import ActionForm from './actionform' diff --git a/src/templates/sharecomponent/cardcomponent/formconfig.jsx b/src/templates/sharecomponent/cardcomponent/formconfig.jsx new file mode 100644 index 0000000..2ae0ec4 --- /dev/null +++ b/src/templates/sharecomponent/cardcomponent/formconfig.jsx @@ -0,0 +1,322 @@ +/** + * @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 + }, + { + type: 'select', + key: 'supMenu', + label: '涓婄骇鏍囩', + initVal: supMenu, + required: false, + options: menus + }, + { + type: 'mutilselect', + key: 'equalTab', + label: '鍚岀骇鏍囩', + tooltip: '濡傛灉瀛愭爣绛句腑鍚湁鍒锋柊鍚岀骇鏍囩鐨勬寜閽紝鍦ㄦ澶勬坊鍔犻渶瑕佸埛鏂扮殑鏍囩銆�', + initVal: equalTab, + required: false, + options: equalTabs + }, + { + type: 'text', + key: 'foreignKey', + label: '澶栭敭', + tooltip: '澶栭敭鏃ㄥ湪鏍囩椤典腑鎵ц榛樿鍑芥暟锛堟坊鍔狅級鏃讹紝鏇挎崲BID瀛楁', + initVal: card.foreignKey || '', + required: false + }, + { + 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', + 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 diff --git a/src/templates/sharecomponent/cardcomponent/index.jsx b/src/templates/sharecomponent/cardcomponent/index.jsx index 9bf8922..795eb4c 100644 --- a/src/templates/sharecomponent/cardcomponent/index.jsx +++ b/src/templates/sharecomponent/cardcomponent/index.jsx @@ -5,7 +5,7 @@ import { EditOutlined, CloseOutlined, PlusOutlined } from '@ant-design/icons' import Utils from '@/utils/utils.js' -import { getCardDetailForm } from '@/templates/zshare/formconfig' +import { getCardDetailForm } from './formconfig' import MkIcon from '@/components/mk-icon' import DragDetail from './dragdetail' import CardDetailForm from './carddetailform' diff --git a/src/templates/sharecomponent/chartcomponent/chartcompile/formconfig.jsx b/src/templates/sharecomponent/chartcomponent/chartcompile/formconfig.jsx new file mode 100644 index 0000000..9a19c09 --- /dev/null +++ b/src/templates/sharecomponent/chartcomponent/chartcompile/formconfig.jsx @@ -0,0 +1,278 @@ +/** + * @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 + } + ] +} diff --git a/src/templates/sharecomponent/chartcomponent/chartcompile/index.jsx b/src/templates/sharecomponent/chartcomponent/chartcompile/index.jsx index c46a8fc..be87511 100644 --- a/src/templates/sharecomponent/chartcomponent/chartcompile/index.jsx +++ b/src/templates/sharecomponent/chartcomponent/chartcompile/index.jsx @@ -4,7 +4,7 @@ import { Drawer, Form, Button, Col, Row, Select, Radio, Tooltip, Input, InputNumber, Cascader } from 'antd' import { QuestionCircleOutlined, RightOutlined, EditOutlined, LeftOutlined } from '@ant-design/icons' -import { getChartOptionForm } from '@/templates/zshare/formconfig' +import { getChartOptionForm } from './formconfig' import { minkeColorSystem, colorTransform } from '@/utils/option.js' import './index.scss' diff --git a/src/templates/sharecomponent/chartgroupcomponent/formconfig.jsx b/src/templates/sharecomponent/chartgroupcomponent/formconfig.jsx new file mode 100644 index 0000000..4fdfc5b --- /dev/null +++ b/src/templates/sharecomponent/chartgroupcomponent/formconfig.jsx @@ -0,0 +1,172 @@ +/** + * @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 + } + ] +} diff --git a/src/templates/sharecomponent/chartgroupcomponent/index.jsx b/src/templates/sharecomponent/chartgroupcomponent/index.jsx index dcb8f2d..4c90686 100644 --- a/src/templates/sharecomponent/chartgroupcomponent/index.jsx +++ b/src/templates/sharecomponent/chartgroupcomponent/index.jsx @@ -5,7 +5,7 @@ import { DownOutlined, UpOutlined } from '@ant-design/icons' import Utils from '@/utils/utils.js' -import { getChartViewForm } from '@/templates/zshare/formconfig' +import { getChartViewForm } from './formconfig' import ChartForm from './chartform' import DragChartView from './dragchartview' diff --git a/src/templates/sharecomponent/columncomponent/formconfig.jsx b/src/templates/sharecomponent/columncomponent/formconfig.jsx new file mode 100644 index 0000000..ff5fb94 --- /dev/null +++ b/src/templates/sharecomponent/columncomponent/formconfig.jsx @@ -0,0 +1,366 @@ +/** + * @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 + } + ] +} \ No newline at end of file diff --git a/src/templates/sharecomponent/columncomponent/index.jsx b/src/templates/sharecomponent/columncomponent/index.jsx index e8172e2..c44b763 100644 --- a/src/templates/sharecomponent/columncomponent/index.jsx +++ b/src/templates/sharecomponent/columncomponent/index.jsx @@ -4,7 +4,7 @@ import { Modal, notification, Switch, message } from 'antd' import { CopyOutlined } from '@ant-design/icons' -import { getColumnForm } from '@/templates/zshare/formconfig' +import { getColumnForm } from './formconfig' import ColumnForm from './columnform' import ColspanForm from './colspanform' diff --git a/src/templates/sharecomponent/searchcomponent/searchform/index.jsx b/src/templates/sharecomponent/searchcomponent/searchform/index.jsx index 4e27e1d..efd4a13 100644 --- a/src/templates/sharecomponent/searchcomponent/searchform/index.jsx +++ b/src/templates/sharecomponent/searchcomponent/searchform/index.jsx @@ -97,10 +97,10 @@ const searchTypeOptions = { text: ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'inputType', 'advanced', 'query', 'labelwidth'], - select: ['label', 'field', 'resourceType', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced', 'setAll', 'dropdown', 'query', 'labelwidth'], - radio: ['label', 'field', 'resourceType', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced', 'setAll', 'query', 'labelwidth'], + select: ['label', 'field', 'resourceType', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced', 'dropdown', 'query', 'labelwidth'], + radio: ['label', 'field', 'resourceType', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced', 'query', 'labelwidth'], multiselect: ['label', 'field', 'resourceType', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced', 'query', 'labelwidth'], - link: ['label', 'field', 'resourceType', 'initval', 'type', 'linkField', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced', 'setAll', 'dropdown', 'query', 'labelwidth'], + link: ['label', 'field', 'resourceType', 'initval', 'type', 'linkField', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced', 'dropdown', 'query', 'labelwidth'], date: ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced', 'query', 'precision', 'labelwidth'], checkcard: ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'resourceType', 'display', 'width', 'multiple', 'required', 'Hide', 'labelShow', 'advanced', 'query', 'labelwidth'], dateweek: ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced', 'query', 'labelwidth'], diff --git a/src/templates/sharecomponent/tabscomponent/formconfig.jsx b/src/templates/sharecomponent/tabscomponent/formconfig.jsx new file mode 100644 index 0000000..2dc9860 --- /dev/null +++ b/src/templates/sharecomponent/tabscomponent/formconfig.jsx @@ -0,0 +1,87 @@ +/** + * @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 + }, + { + type: 'select', + key: 'supMenu', + label: '涓婄骇鏍囩', + initVal: supMenu, + required: false, + options: menus + }, + { + type: 'mutilselect', + key: 'equalTab', + label: '鍚岀骇鏍囩', + tooltip: '濡傛灉瀛愭爣绛句腑鍚湁鍒锋柊鍚岀骇鏍囩鐨勬寜閽紝鍦ㄦ澶勬坊鍔犻渶瑕佸埛鏂扮殑鏍囩銆�', + initVal: equalTab, + required: false, + options: equalTabs + }, + { + type: 'text', + key: 'foreignKey', + label: '澶栭敭', + tooltip: '澶栭敭鏃ㄥ湪鏍囩椤典腑鎵ц榛樿鍑芥暟锛堟坊鍔狅級鏃讹紝鏇挎崲BID瀛楁', + initVal: card.foreignKey || '', + required: false + }, + { + 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', + options: [{ + value: 'true', + text: '浣跨敤' + }, { + value: 'false', + text: '涓嶄娇鐢�' + }] + } + ] +} \ No newline at end of file diff --git a/src/templates/sharecomponent/tabscomponent/index.jsx b/src/templates/sharecomponent/tabscomponent/index.jsx index 1f0b602..a95725d 100644 --- a/src/templates/sharecomponent/tabscomponent/index.jsx +++ b/src/templates/sharecomponent/tabscomponent/index.jsx @@ -5,7 +5,7 @@ import { QuestionCircleOutlined, ArrowDownOutlined, ArrowUpOutlined, PlusOutlined, DeleteOutlined } from '@ant-design/icons' import Utils from '@/utils/utils.js' -import { getTabForm } from '@/templates/zshare/formconfig' +import { getTabForm } from './formconfig' import TabForm from './tabform' import TabDragElement from './tabdragelement' diff --git a/src/templates/zshare/formconfig.jsx b/src/templates/zshare/formconfig.jsx index a6170ab..7cd8e72 100644 --- a/src/templates/zshare/formconfig.jsx +++ b/src/templates/zshare/formconfig.jsx @@ -1,287 +1,4 @@ import React from 'react' -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: '鍚�' } - ] - } - ] -} - /** * @description 鑾峰彇鎼滅储鏉′欢琛ㄥ崟閰嶇疆淇℃伅 * @param {object} card // 鎼滅储鏉′欢瀵硅薄 @@ -467,19 +184,6 @@ text: '鏁版嵁婧�' }] }, - // { - // type: 'radio', - // key: 'setAll', - // label: '璁剧疆鍏ㄩ儴', - // initVal: card.setAll || 'true', - // options: [{ - // value: 'true', - // text: '鏄�' - // }, { - // value: 'false', - // text: '鍚�' - // }] - // }, { type: 'radio', key: 'display', @@ -1014,1538 +718,6 @@ } /** - * @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: '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: '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: 'stringify', - label: '搴忓垪鍖�', - initVal: card.stringify || 'text', - required: false, - options: [{ - value: 'text', - text: 'Text' - }, { - value: 'JSON', - text: 'JSON' - }, { - value: 'qs', - text: 'qs' - }] - }, - { - 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 || 'grid', - 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 // 鍙啓鍏ヨ〃鍗� @@ -2956,19 +1128,6 @@ text: '16:9' }] }, - // { - // type: 'radio', - // key: 'setAll', - // label: '璁剧疆绌哄��', - // initVal: card.setAll || 'false', - // options: [{ - // value: 'true', - // text: '鏄�' - // }, { - // value: 'false', - // text: '鍚�' - // }] - // }, { type: 'codemirror', key: 'dataSource', @@ -3034,7 +1193,6 @@ {value: 'left', text: '灞呭乏'}, {value: 'center', text: '灞呬腑'}, {value: 'right', text: '灞呭彸'}, - // {value: 'justify', text: 'justify'} ], render: (text, record) => { if (text === 'center') { @@ -4464,328 +2622,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 - }, - { - type: 'select', - key: 'supMenu', - label: '涓婄骇鏍囩', - initVal: supMenu, - required: false, - options: menus - }, - { - type: 'mutilselect', - key: 'equalTab', - label: '鍚岀骇鏍囩', - tooltip: '濡傛灉瀛愭爣绛句腑鍚湁鍒锋柊鍚岀骇鏍囩鐨勬寜閽紝鍦ㄦ澶勬坊鍔犻渶瑕佸埛鏂扮殑鏍囩銆�', - initVal: equalTab, - required: false, - options: equalTabs - }, - { - type: 'text', - key: 'foreignKey', - label: '澶栭敭', - tooltip: '澶栭敭鏃ㄥ湪鏍囩椤典腑鎵ц榛樿鍑芥暟锛堟坊鍔狅級鏃讹紝鏇挎崲BID瀛楁', - initVal: card.foreignKey || '', - required: false - }, - { - 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', - 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 diff --git a/src/templates/zshare/modalform/index.jsx b/src/templates/zshare/modalform/index.jsx index c2a94e3..310bdb6 100644 --- a/src/templates/zshare/modalform/index.jsx +++ b/src/templates/zshare/modalform/index.jsx @@ -745,7 +745,6 @@ { required: item.required, message: '璇疯緭鍏�' + item.label + '!' } ] span = 24 - className = 'text-area' if (this.record.type === 'select' || this.record.type === 'link') { extra = <span className="add-resource-empty" onClick={this.handleEmpty}>绌�</span> @@ -757,7 +756,6 @@ content = <CodeMirror /> } else if (item.type === 'textarea') { span = 24 - className = 'text-msg' rules = [ { required: item.required, message: '璇疯緭鍏�' + item.label + '!' } ] @@ -765,7 +763,6 @@ content = <TextArea rows={item.rows || 4}/> } else if (item.type === 'options') { span = 24 - className = 'text-area' let type = this.record.type let linkSubFields = this.record.linkSubField || [] @@ -836,7 +833,6 @@ } } else if (item.type === 'fields') { span = 24 - className = 'text-area' rules = [ { required: item.required, message: '璇锋坊鍔�' + item.label + '!' } ] diff --git a/src/templates/zshare/modalform/index.scss b/src/templates/zshare/modalform/index.scss index 23d5929..e718410 100644 --- a/src/templates/zshare/modalform/index.scss +++ b/src/templates/zshare/modalform/index.scss @@ -4,23 +4,22 @@ padding-left: 6px!important; padding-bottom: 20px; } - .ant-form-item.text-area { - >.ant-form-item-control-wrapper { - width: 84%; - } - >.ant-form-item-label { - width: 16%; - } - .CodeMirror { - height: 150px; - } + >.ant-row >.ant-col { + display: inline-block; + vertical-align: top; + float: none; } - .ant-form-item.text-msg { - >.ant-form-item-label { - width: 16%; - } - >.ant-form-item-control-wrapper { - width: 84%; + .ant-col-24 { + >.ant-form-item { + >.ant-form-item-label { + width: 16%; + } + >.ant-form-item-control-wrapper { + width: 84%; + } + .CodeMirror { + height: 150px; + } } } .ant-radio-group { @@ -52,10 +51,5 @@ left: 0px; top: -25px; font-size: 14px; - } - >.ant-row >.ant-col { - display: inline-block; - vertical-align: top; - float: none; } } \ No newline at end of file -- Gitblit v1.8.0