From 02b9e988b456c4e7d7f077c613fcc1092d93803f Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 29 九月 2021 19:02:43 +0800 Subject: [PATCH] 2021-09-29 --- src/menu/components/search/main-search/index.jsx | 3 src/menu/components/table/normal-table/columns/editColumn/index.jsx | 4 src/menu/baseScript/index.scss | 1 src/templates/zshare/formconfig.jsx | 2 src/menu/components/table/edit-table/columns/editColumn/index.jsx | 95 +-------------- src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx | 209 ++-------------------------------- src/menu/components/table/edit-table/columns/index.jsx | 4 7 files changed, 27 insertions(+), 291 deletions(-) diff --git a/src/menu/baseScript/index.scss b/src/menu/baseScript/index.scss index 9ff129e..377efe2 100644 --- a/src/menu/baseScript/index.scss +++ b/src/menu/baseScript/index.scss @@ -4,6 +4,5 @@ } .ant-modal-body { min-height: 150px; - // padding-top: 40px; } } \ No newline at end of file diff --git a/src/menu/components/search/main-search/index.jsx b/src/menu/components/search/main-search/index.jsx index 79505bb..dd3f54d 100644 --- a/src/menu/components/search/main-search/index.jsx +++ b/src/menu/components/search/main-search/index.jsx @@ -10,6 +10,7 @@ import enUS from '@/locales/en-US/model.js' import { getSearchForm } from '@/templates/zshare/formconfig' import { resetStyle } from '@/utils/utils-custom.js' +import asyncComponent from '@/utils/asyncComponent' import asyncIconComponent from '@/utils/asyncIconComponent' import DragElement from './dragsearch' import getWrapForm from './options' @@ -19,7 +20,7 @@ const { confirm } = Modal const NormalForm = asyncIconComponent(() => import('@/components/normalform')) -const FieldsComponent = asyncIconComponent(() => import('@/templates/sharecomponent/fieldscomponent')) +const FieldsComponent = asyncComponent(() => import('@/templates/sharecomponent/fieldscomponent')) const SearchForm = asyncIconComponent(() => import('@/templates/sharecomponent/searchcomponent/searchform')) const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) const PasteComponent = asyncIconComponent(() => import('@/menu/components/share/pastecomponent')) 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 e2b4ae1..28c9fc9 100644 --- a/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx +++ b/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx @@ -8,7 +8,6 @@ * @param {object} card // 鎼滅储鏉′欢瀵硅薄 */ export function getColumnForm (card, fields = []) { - let appType = sessionStorage.getItem('appType') let roleList = sessionStorage.getItem('sysRoles') if (roleList) { try { @@ -20,22 +19,8 @@ roleList = [] } - let menulist = [] - - if (appType === 'pc') { - menulist = sessionStorage.getItem('appMenus') - } else if (!appType) { - menulist = sessionStorage.getItem('fstMenuList') - } - - if (menulist) { - try { - menulist = JSON.parse(menulist) - } catch (e) { - menulist = [] - } - } else { - menulist = [] + if (['picture', 'link', 'colspan'].includes(card.type)) { + card.type = 'text' } let options = [{ @@ -45,35 +30,18 @@ value: 'number', text: Formdict['model.form.number'] }, { - value: 'picture', - text: Formdict['model.form.picture'] - }, { - value: 'link', - text: Formdict['model.form.href'] - }, { value: 'textarea', text: Formdict['model.form.textarea'] }, { value: 'custom', text: '鑷畾涔夊垪' }, { - value: 'colspan', - text: '鍚堝苟鍒�' + value: 'action', + text: '鎿嶄綔' }, { value: 'index', text: '搴忓彿' }] - - if (!card.isSub) { - options.push({ - value: 'action', - text: '鎿嶄綔' - }) - } - - if (!card.linkurl && (!card.linkmenu || card.linkmenu.length === 0)) { - card.perspective = '' - } return [ { @@ -100,14 +68,6 @@ options: fields }, { - type: 'select', - key: 'nameField', - label: Formdict['model.name'] + Formdict['model.form.field'], - initVal: card.nameField || '', - required: false, - options: [{uuid: 'empty', field: '', label: '绌�'}, ...fields] - }, - { type: 'number', key: 'Width', min: 20, @@ -116,20 +76,6 @@ label: Formdict['model.form.columnWidth'], initVal: card.Width || 120, required: true - }, - { - type: 'radio', - key: 'joint', - label: Formdict['model.form.paramJoint'], - initVal: card.joint || 'true', - required: true, - options: [{ - value: 'true', - text: Formdict['model.true'] - }, { - value: 'false', - text: Formdict['model.false'] - }] }, { type: 'radio', @@ -149,7 +95,7 @@ type: 'radio', key: 'IsSort', label: Formdict['model.sort'], - initVal: card.IsSort || 'true', + initVal: card.IsSort || 'false', required: true, forbidden: card.isSub, options: [{ @@ -179,32 +125,16 @@ }, { type: 'radio', - key: 'rowspan', - label: '琛屽悎骞�', - initVal: card.rowspan || 'false', - tooltip: '鐩搁偦琛屼俊鎭浉鍚屾椂锛屽崟鍏冩牸鍚堝苟銆�', - required: false, + key: 'editable', + label: '鍙紪杈�', + initVal: card.editable || 'false', + required: true, options: [{ - value: 'true', - text: Formdict['model.true'] - }, { value: 'false', - text: Formdict['model.false'] - }] - }, - { - type: 'radio', - key: 'sum', - label: '鏄剧ず鍚堣', - initVal: card.sum || 'false', - tooltip: '鍚堣淇℃伅鍙湪浣跨敤绯荤粺鏁版嵁婧愭椂鏈夋晥銆�', - required: false, - options: [{ - value: 'true', - text: Formdict['model.true'] + text: '鍚�' }, { - value: 'false', - text: Formdict['model.false'] + value: 'true', + text: '鏄�' }] }, { @@ -266,121 +196,6 @@ initVal: card.postfix || '', required: false, readonly: false - }, - { - 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: 'picSort', - label: '鍥剧墖鎺掑垪', - initVal: card.picSort || '1', - tooltip: '鍚屼竴鍗曞厓鏍煎唴锛屽惈鏈夊寮犲浘鐗囨椂鐨勫垪鏁般��', - required: false, - options: [{ - value: '1', - text: '1' - }, { - value: '2', - text: '2' - }, { - value: '3', - text: '3' - }, { - value: '4', - text: '4' - }] - }, - { - type: 'radio', - key: 'scale', - label: Formdict['header.form.clickscale'], - initVal: card.scale || 'false', - required: false, - options: [{ - value: 'true', - text: Formdict['model.true'] - }, { - value: 'false', - text: Formdict['model.false'] - }] - }, - { - type: 'radio', - key: 'perspective', - label: '瀛楁閫忚', - initVal: card.perspective || '', - options: [{ - value: '', - text: '鏃�' - }, { - value: 'linkmenu', - text: '鑿滃崟' - }, { - value: 'linkurl', - text: '閾炬帴' - }], - forbidden: appType === 'mob' - }, - { - type: appType === 'pc' ? 'select' : 'cascader', - key: 'linkmenu', - label: Formdict['model.menu'], - initVal: card.linkmenu || (appType === 'pc' ? '' : []), - required: true, - options: menulist, - forbidden: appType === 'mob' - }, - { - type: 'textarea', - key: 'linkurl', - label: '閾炬帴鍦板潃', - initVal: card.linkurl || '', - required: true, - forbidden: appType === 'mob' - }, - { - type: 'multiselect', - key: 'linkfields', - label: '鍏宠仈瀛楁', - initVal: card.linkfields || [], - required: false, - options: fields, - forbidden: appType === 'mob' - }, - { - type: 'radio', - key: 'open', - label: '鎵撳紑鏂瑰紡', - initVal: card.open || 'blank', - required: false, - forbid: appType !== 'pc', - options: [ - { value: 'blank', text: '鏂扮獥鍙�' }, - { value: 'self', text: '褰撳墠绐楀彛' } - ] }, { type: 'multiselect', 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 81aed8a..34d33ea 100644 --- a/src/menu/components/table/edit-table/columns/editColumn/index.jsx +++ b/src/menu/components/table/edit-table/columns/editColumn/index.jsx @@ -1,26 +1,22 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Form, Row, Col, Input, Select, InputNumber, Radio, Tooltip, Icon, Cascader, Modal } from 'antd' +import { Form, Row, Col, Input, Select, InputNumber, Radio, Tooltip, Icon, Modal } from 'antd' import { getColumnForm } from './formconfig' import { formRule } from '@/utils/option.js' import './index.scss' -const { TextArea } = Input const columnTypeOptions = { - text: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'textFormat', 'blacklist', 'perspective', 'rowspan'], - number: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'decimal', 'format', 'prefix', 'postfix', 'blacklist', 'perspective', 'sum', 'rowspan'], - link: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'joint', 'Width', 'blacklist', 'nameField'], - textarea: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'blacklist'], - picture: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'blacklist', 'scale', 'lenWidRadio', 'picSort'], - colspan: ['label', 'type', 'Align', 'Hide', 'blacklist'], + text: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'textFormat', 'editable', 'blacklist'], + number: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'decimal', 'format', 'prefix', 'postfix', 'editable', 'blacklist'], + textarea: ['label', 'field', 'type', 'Align', 'Hide', 'Width', 'prefix', 'postfix', 'blacklist'], custom: ['label', 'type', 'Align', 'Hide', 'Width', 'blacklist'], action: ['label', 'type', 'Align', 'Width'], index: ['label', 'type', 'Align', 'Width'] } -class MainSearch extends Component { +class EdiTableColumn extends Component { static propTpyes = { dict: PropTypes.object, // 瀛楀吀椤� visible: PropTypes.bool, @@ -44,13 +40,6 @@ editColumn = (column) => { let formlist = getColumnForm(column, this.props.fields) let _options = fromJS(columnTypeOptions[column.type]).toJS() - if (column.type === 'text' || column.type === 'number') { - if (column.perspective === 'linkmenu') { - _options.push('linkmenu', 'linkfields', 'open') - } else if (column.perspective === 'linkurl') { - _options.push('linkurl', 'linkfields', 'open') - } - } this.setState({ visible: true, @@ -84,11 +73,7 @@ return item }) }, () => { - if (value === 'link' || value === 'textarea' || value === 'picture') { - this.props.form.setFieldsValue({IsSort: 'false'}) - } else if (value === 'text' || value === 'number') { - this.props.form.setFieldsValue({perspective: ''}) - } else if (value === 'action' || value === 'colspan') { + if (value === 'action') { this.props.form.setFieldsValue({Align: 'center'}) } }) @@ -106,7 +91,6 @@ } if (values.type !== this.state.type) { - values.perspective = '' let _options = fromJS(columnTypeOptions[values.type]).toJS() this.setState({ @@ -124,26 +108,6 @@ } } else if (key === 'format' && value === 'percent') { this.props.form.setFieldsValue({postfix: '%'}) - } - } - - changeRadio = (key, value) => { - if (key === 'perspective') { - let _options = fromJS(columnTypeOptions[this.state.type]).toJS() - - if (value === 'linkmenu') { - _options.push('linkmenu', 'linkfields', 'open') - } else if (value === 'linkurl') { - _options.push('linkurl', 'linkfields', 'open') - } - - this.setState({ - formlist: this.state.formlist.map(item => { - item.hidden = !_options.includes(item.key) - - return item - }) - }) } } @@ -255,7 +219,7 @@ } ] })( - <Radio.Group onChange={(e) => {this.changeRadio(item.key, e.target.value)}}> + <Radio.Group> { item.options.map(option => { return ( @@ -285,49 +249,6 @@ )} </Select> )} - </Form.Item> - </Col> - ) - } else if (item.type === 'cascader') { // 澶氶�� - fields.push( - <Col span={12} key={index}> - <Form.Item label={item.label}> - {getFieldDecorator(item.key, { - initialValue: item.initVal || [], - rules: [ - { - required: !!item.required, - message: this.props.dict['form.required.select'] + item.label + '!' - } - ] - })( - <Cascader - options={item.options} - placeholder="" - getPopupContainer={() => document.getElementById('columnwinter')} - /> - )} - </Form.Item> - </Col> - ) - } else if (item.type === 'textarea') { // 鏂囨湰鎼滅储 - fields.push( - <Col span={24} key={index} className="textarea"> - <Form.Item label={item.tooltip ? - <Tooltip placement="topLeft" title={item.tooltip}> - <Icon type="question-circle" /> - {item.label} - </Tooltip> : item.label - }> - {getFieldDecorator(item.key, { - initialValue: item.initVal || '', - rules: [ - { - required: !!item.required, - message: this.props.dict['form.required.input'] + item.label + '!' - } - ] - })(<TextArea rows={2} disabled={item.readonly} onPressEnter={this.handleSubmit} />)} </Form.Item> </Col> ) @@ -385,4 +306,4 @@ } } -export default Form.create()(MainSearch) \ No newline at end of file +export default Form.create()(EdiTableColumn) \ No newline at end of file diff --git a/src/menu/components/table/edit-table/columns/index.jsx b/src/menu/components/table/edit-table/columns/index.jsx index c347313..2acb634 100644 --- a/src/menu/components/table/edit-table/columns/index.jsx +++ b/src/menu/components/table/edit-table/columns/index.jsx @@ -13,7 +13,7 @@ import './index.scss' const { confirm } = Modal -const EditColumn = asyncIconComponent(() => import('./editColumn')) +const EditColumn = asyncComponent(() => import('./editColumn')) const MarkColumn = asyncIconComponent(() => import('@/menu/components/share/markcomponent')) const CardCellComponent = asyncComponent(() => import('@/menu/components/card/cardcellcomponent')) @@ -484,7 +484,7 @@ fields.forEach(item => { if (keys.includes(item.field)) return - let cell = { uuid: Utils.getuuid(), label: item.label, field: item.field, Align: 'left', Hide: 'false', IsSort: 'true', Width: 120, blacklist: [], postfix: '', prefix: '', linkmenu: [], marks: [], perspective: 'linkmenu' } + let cell = { uuid: Utils.getuuid(), label: item.label, field: item.field, Align: 'left', Hide: 'false', IsSort: 'false', Width: 120, blacklist: [], postfix: '', prefix: '', linkmenu: [], marks: [], perspective: 'linkmenu' } if (/Nvarchar/ig.test(item.datatype)) { cell.type = 'text' diff --git a/src/menu/components/table/normal-table/columns/editColumn/index.jsx b/src/menu/components/table/normal-table/columns/editColumn/index.jsx index 81aed8a..0c633a5 100644 --- a/src/menu/components/table/normal-table/columns/editColumn/index.jsx +++ b/src/menu/components/table/normal-table/columns/editColumn/index.jsx @@ -20,7 +20,7 @@ index: ['label', 'type', 'Align', 'Width'] } -class MainSearch extends Component { +class NormalTableColumn extends Component { static propTpyes = { dict: PropTypes.object, // 瀛楀吀椤� visible: PropTypes.bool, @@ -385,4 +385,4 @@ } } -export default Form.create()(MainSearch) \ No newline at end of file +export default Form.create()(NormalTableColumn) \ No newline at end of file diff --git a/src/templates/zshare/formconfig.jsx b/src/templates/zshare/formconfig.jsx index c9c8963..b9f856b 100644 --- a/src/templates/zshare/formconfig.jsx +++ b/src/templates/zshare/formconfig.jsx @@ -1405,7 +1405,7 @@ key: 'preFunc', label: '鍓嶇疆鍑芥暟', initVal: card.preFunc || '', - tooltip: `鍑芥暟鍚嶇О闇�浠�${usefulFields.join(', ')}绛夊瓧绗﹀紑濮嬶紱鍓嶇疆鍑芥暟鎵ц瀹屾垚鍚庯紝缁撴灉浼氫紶鍏ュ唴閮ㄥ嚱鏁颁腑锛屾鏃跺唴閮ㄥ嚱鏁颁細寮傛鎵ц銆俙, + tooltip: `鍑芥暟鍚嶇О闇�浠�${usefulFields.join(', ')}绛夊瓧绗﹀紑濮嬶紱鍓嶇疆鍑芥暟鎵ц瀹屾垚鍚庯紝缁撴灉浼氫紶鍏ュ唴閮ㄥ嚱鏁颁腑锛屾鏃跺唴閮ㄥ嚱鏁颁細寮傛鎵ц锛涘綋鍓嶇疆鍑芥暟杩斿洖涓璄rrCode绛変簬-1鏃讹紝灏嗕笉鍐嶆墽琛屽唴閮ㄥ嚱鏁般�俙, fields: usefulFields, tooltipClass: 'middle', required: false, -- Gitblit v1.8.0