From 57da72c823fab94a3ec6fadab2bc75173c8a03b1 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 01 十二月 2020 13:45:25 +0800 Subject: [PATCH] 2020-12-01 --- src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx | 292 ++++++++++++ src/components/header/index.jsx | 1 src/templates/zshare/formconfig.jsx | 2 src/templates/calendarconfig/index.jsx | 76 +- src/templates/comtableconfig/index.jsx | 148 +++--- src/templates/subtableconfig/index.jsx | 152 +++--- src/templates/treepageconfig/index.jsx | 124 ++-- /dev/null | 40 - src/tabviews/zshare/mutilform/index.jsx | 20 src/menu/components/table/normal-table/columns/editColumn/index.jsx | 336 ++++++++++++++ src/tabviews/zshare/verifycard/index.jsx | 11 src/templates/sharecomponent/actioncomponent/index.jsx | 2 src/components/sidemenu/config.jsx | 7 src/menu/components/table/normal-table/columns/index.scss | 10 src/tabviews/subtable/index.jsx | 2 src/menu/components/table/normal-table/columns/editColumn/index.scss | 19 src/tabviews/commontable/index.jsx | 1 src/menu/components/table/normal-table/columns/index.jsx | 94 +++ src/tabviews/zshare/verifycard/tabcard/index.jsx | 96 --- 19 files changed, 1,011 insertions(+), 422 deletions(-) diff --git a/src/components/header/index.jsx b/src/components/header/index.jsx index 9b0daf0..ebe4961 100644 --- a/src/components/header/index.jsx +++ b/src/components/header/index.jsx @@ -567,6 +567,7 @@ this.props.modifyMainMenu(menulist[0] || null) this.props.resetEditLevel(false) + this.props.modifyTabview([]) } exitEdit = () => { diff --git a/src/components/sidemenu/config.jsx b/src/components/sidemenu/config.jsx index 688344c..c7b95af 100644 --- a/src/components/sidemenu/config.jsx +++ b/src/components/sidemenu/config.jsx @@ -90,6 +90,13 @@ MenuID: '1602315375262ikd33ii0nii34pt861o', MenuNo: 's_worksflow_roleM', MenuName: '鍏抽敭瑙掕壊绠$悊', + }, { + src: '', + PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, + type: 'ManageTable', + MenuID: '1606794243739c5ihs58lucpskp3r4s2', + MenuNo: 's_custom_componentsM', + MenuName: '鑷畾涔夌粍浠�', }] }, { MenuID: 'systemManageViewInterface', diff --git a/src/menu/components/table/normal-table/columns/cusSwitch/index.jsx b/src/menu/components/table/normal-table/columns/cusSwitch/index.jsx deleted file mode 100644 index 82cd954..0000000 --- a/src/menu/components/table/normal-table/columns/cusSwitch/index.jsx +++ /dev/null @@ -1,54 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -// import { is, fromJS } from 'immutable' -import { Switch } from 'antd' - -import './index.scss' - -class ColorSketch extends Component { - static propTpyes = { - defaultValue: PropTypes.any, - value: PropTypes.any, - onChange: PropTypes.func - } - state = { - status: true, - } - - UNSAFE_componentWillMount () { - const { defaultValue, value } = this.props - let initVal = 'true' - - if (this.props['data-__meta']) { - initVal = this.props['data-__meta'].initialValue - } else if (defaultValue) { - initVal = defaultValue - } else if (value) { - initVal = value - } - - if (initVal === 'false') { - initVal = false - } else { - initVal = true - } - - this.setState({status: initVal}) - } - - changeStatus = (val) => { - this.setState({ status: val }, () => { - let _val = val ? 'true' : 'false' - this.props.onChange && this.props.onChange(_val) - }) - } - - render() { - const { status } = this.state - return ( - <Switch checkedChildren="鏄�" unCheckedChildren="鍚�" checked={status} onChange={this.changeStatus} /> - ) - } -} - -export default ColorSketch \ No newline at end of file diff --git a/src/menu/components/table/normal-table/columns/cusSwitch/index.scss b/src/menu/components/table/normal-table/columns/cusSwitch/index.scss deleted file mode 100644 index 96900ce..0000000 --- a/src/menu/components/table/normal-table/columns/cusSwitch/index.scss +++ /dev/null @@ -1,40 +0,0 @@ -.color-sketch-block { - height: 25px; - width: 100%; - - .color-sketch-block-box { - display: inline-block; - width: calc(100% - 160px); - height: 100%; - border-radius: 2px; - background: #ffffff url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAMUlEQVQ4T2NkYGAQYcAP3uCTZhw1gGGYhAGBZIA/nYDCgBDAm9BGDWAAJyRCgLaBCAAgXwixzAS0pgAAAABJRU5ErkJggg==') left center; - } - .color-sketch-block-inner { - display: inline-block; - cursor: pointer; - border-radius: 2px; - box-shadow: 0 0 0 1px rgba(0, 0, 0, .1); - width: 100%; - height: 100%; - } - .color-sketch-value { - display: inline-block; - width: 160px; - padding-left: 10px; - height: 25px; - line-height: 25px; - vertical-align: top; - white-space: nowrap; - overflow: visible; - } -} - -.color-sketch-popover { - z-index: 1090!important; - .ant-popover-inner-content { - padding: 0; - .sketch-picker { - width: 250px!important; - } - } -} \ No newline at end of file diff --git a/src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx b/src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx new file mode 100644 index 0000000..3d816a0 --- /dev/null +++ b/src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx @@ -0,0 +1,292 @@ +import zhCN from '@/locales/zh-CN/model.js' +import enUS from '@/locales/en-US/model.js' + +const Formdict = localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS + +/** + * @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 { + roleList = [] + } + } else { + roleList = [] + } + + return [ + { + type: 'text', + key: 'label', + label: '鍒楀ご鏂囧瓧', + initVal: card.label, + required: true + }, + { + type: 'select', + key: 'type', + label: Formdict['model.form.type'], + initVal: card.type, + required: true, + options: [{ + value: 'text', + text: Formdict['model.form.text'] + }, { + 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'] + }] + }, + { + type: 'select', + key: 'field', + label: Formdict['model.form.field'], + initVal: card.field, + required: true, + options: fields + }, + { + type: 'number', + key: 'Width', + min: 1, + max: 1000, + decimal: 0, + label: Formdict['model.form.columnWidth'], + initVal: card.Width, + required: true + }, + { + type: 'radio', + key: 'joint', + label: Formdict['model.form.paramJoint'], + initVal: card.joint || 'true', + required: true, + options: [{ + value: 'true', + text: Formdict['model.true'] + }, { + value: 'false', + text: Formdict['model.false'] + }] + }, + { + type: 'radio', + key: 'Hide', + label: Formdict['model.hidden'], + initVal: card.Hide || 'false', + required: true, + options: [{ + value: 'true', + text: Formdict['model.true'] + }, { + value: 'false', + text: Formdict['model.false'] + }] + }, + { + type: 'radio', + key: 'IsSort', + label: Formdict['model.sort'], + initVal: card.IsSort || 'true', + required: true, + options: [{ + value: 'true', + text: Formdict['model.true'] + }, { + value: 'false', + text: Formdict['model.false'] + }] + }, + { + type: 'radio', + key: 'Align', + label: Formdict['model.form.align'], + initVal: card.Align || 'left', + required: true, + options: [{ + value: 'left', + text: Formdict['model.form.alignLeft'] + }, { + value: 'center', + text: Formdict['model.form.alignCenter'] + }, { + value: 'right', + text: Formdict['model.form.alignRight'] + }] + }, + { + type: 'radio', + key: 'rowspan', + label: '琛屽悎骞�', + initVal: card.rowspan || 'false', + tooltip: '鐩搁偦琛屼俊鎭浉鍚屾椂锛屽崟鍏冩牸鍚堝苟銆傛敞锛氫负闃叉琛ㄦ牸淇℃伅閿欎贡锛岃鍚堝苟鍙兘娣诲姞涓�涓瓧娈点��', + required: false, + options: [{ + value: 'true', + text: Formdict['model.true'] + }, { + value: 'false', + text: Formdict['model.false'] + }] + }, + { + type: 'radio', + key: 'sum', + label: '鏄剧ず鍚堣', + initVal: card.sum || 'false', + tooltip: '鍚堣淇℃伅鍙湪浣跨敤绯荤粺鏁版嵁婧愶紝涓斿綋鍓嶅垪鏈殣钘忔椂鏈夋晥銆�', + required: false, + options: [{ + value: 'true', + text: Formdict['model.true'] + }, { + value: 'false', + text: Formdict['model.false'] + }] + }, + { + type: 'number', + key: 'decimal', + min: 0, + max: 18, + decimal: 0, + label: Formdict['header.form.decimal'], + initVal: card.decimal || 0, + required: true + }, + { + type: 'number', + key: 'fieldlength', + label: Formdict['model.form.field'] + Formdict['model.length'], + initVal: card.fieldlength || (card.type === 'text' ? 50 : 512), + required: true + }, + { + type: 'select', + key: 'format', + label: Formdict['header.form.format'], + initVal: card.format || '', + options: [{ + value: '', + text: Formdict['model.empty'] + }, { + value: 'thdSeparator', + text: Formdict['header.form.thdSeparator'] + }, { + value: 'percent', + text: '鐧惧垎姣�' + }], + required: false + }, + { + type: 'select', + key: 'textFormat', + label: Formdict['header.form.format'], + initVal: card.textFormat || '', + options: [{ + value: '', + text: Formdict['model.empty'] + }, { + value: 'YYYY-MM-DD', + text: 'YYYY-MM-DD' + }, { + value: 'YYYY-MM-DD HH:mm:ss', + text: 'YYYY-MM-DD HH:mm:ss' + }], + required: false + }, + { + type: 'text', + key: 'prefix', + label: Formdict['header.form.prefix'], + initVal: card.prefix || '', + required: false, + readonly: false + }, + { + type: 'text', + key: 'postfix', + label: Formdict['header.form.postfix'], + initVal: card.postfix || '', + tooltipClass: 'middle', + required: false, + readonly: false + }, + { + type: 'number', + key: 'maxHeight', + min: 1, + max: 1000, + decimal: 0, + label: '鏈�澶ч珮搴�', + tooltip: '鍥剧墖鍦ㄨ〃鏍间腑鏄剧ず鐨勬渶澶ч珮搴�', + tooltipClass: 'middle', + initVal: card.maxHeight || 128, + required: true + }, + { + 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 || 'linkmenu', + options: [{ + value: 'linkmenu', + text: '鑿滃崟' + }, { + value: 'linkurl', + text: '閾炬帴' + }] + }, + { + type: 'cascader', + key: 'linkmenu', + label: Formdict['model.menu'], + initVal: card.linkmenu || [], + required: false, + options: menulist + }, + { + type: 'text', + key: 'linkurl', + label: '閾炬帴鍦板潃', + initVal: card.linkurl || '', + required: false + }, + { + type: 'multiselect', + key: 'blacklist', + label: Formdict['header.form.blacklist'], + initVal: card.blacklist || [], + required: false, + options: roleList + } + ] +} diff --git a/src/menu/components/table/normal-table/columns/editColumn/index.jsx b/src/menu/components/table/normal-table/columns/editColumn/index.jsx new file mode 100644 index 0000000..5ab0873 --- /dev/null +++ b/src/menu/components/table/normal-table/columns/editColumn/index.jsx @@ -0,0 +1,336 @@ +import React, {Component} from 'react' +import PropTypes from 'prop-types' +import { fromJS } from 'immutable' +import { Form, Row, Col, Input, Select, InputNumber, Radio, Tooltip, Icon, Cascader, Modal } from 'antd' + +import { getColumnForm } from './formconfig' +import { formRule } from '@/utils/option.js' +import './index.scss' + +const columnTypeOptions = { + text: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'textFormat', 'fieldlength', 'blacklist', 'perspective', 'rowspan'], + number: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'decimal', 'format', 'prefix', 'postfix', 'blacklist', 'perspective', 'sum'], + link: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'joint', 'Width', 'fieldlength', 'blacklist'], + textarea: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'fieldlength', 'blacklist'], + picture: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'fieldlength', 'blacklist', 'scale', 'maxHeight'] +} + +class MainSearch extends Component { + static propTpyes = { + dict: PropTypes.object, // 瀛楀吀椤� + column: PropTypes.object, + fields: PropTypes.array, + updateCol: PropTypes.func, // 鎻愪氦浜嬩欢 + deleteCol: PropTypes.func // 鍙栨秷鏃跺垹闄や簨浠� + } + + state = { + visible: false, + formlist: null + } + + /** + * @description 鍒濇娣诲姞鐨勬樉绀哄垪鍏冪礌锛岃仛鐒︽彁绀烘枃瀛� + */ + componentDidMount () { + if (this.props.column.focus) { + this.editColumn() + } + } + + editColumn = () => { + let menulist = sessionStorage.getItem('fstMenuList') + if (menulist) { + try { + menulist = JSON.parse(menulist) + } catch { + menulist = [] + } + } else { + menulist = [] + } + + this.setState({ + visible: true, + formlist: getColumnForm(this.props.column, menulist, this.props.fields) + }, () => { + if (this.props.column.focus) { + try { + let _form = document.getElementById('label') + _form.select() + } catch { + console.warn('琛ㄥ崟focus澶辫触锛�') + } + } + }) + } + + typeChange = (key, value, option) => { + if (key === 'type') { + let _options = fromJS(columnTypeOptions[value]).toJS() + + if (value === 'text' || value === 'number') { + _options.push('linkmenu') + } + + let fieldlength = 50 + + if (value !== 'text') { + fieldlength = 512 + } + + this.setState({ + type: value, + formlist: this.state.formlist.map(item => { + item.hidden = !_options.includes(item.key) + + return item + }) + }, () => { + if (this.props.form.getFieldValue('fieldlength') !== undefined) { + this.props.form.setFieldsValue({fieldlength: fieldlength}) + } else if (this.props.form.getFieldValue('perspective') !== undefined) { + this.props.form.setFieldsValue({perspective: 'linkmenu'}) + } + }) + } else if (key === 'field') { + this.props.form.setFieldsValue({label: option.props.children}) + } 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 !== 'linkurl') { + _options.push('linkmenu') + } else { + _options.push('linkurl') + } + + this.setState({ + formlist: this.state.formlist.map(item => { + item.hidden = !_options.includes(item.key) + + return item + }) + }) + } + } + + getFields() { + const { getFieldDecorator } = this.props.form + const { formlist } = this.state + const fields = [] + + if (!formlist) return null + + formlist.forEach((item, index) => { + if (item.hidden) return + + if (item.type === 'text') { // 鏂囨湰鎼滅储 + let rules = [] + if (item.key !== 'linkurl') { + rules = [{ + max: formRule.input.max, + message: formRule.input.message + }] + } + fields.push( + <Col span={12} key={index}> + <Form.Item label={item.tooltip ? + <Tooltip placement="topLeft" overlayClassName={item.tooltipClass} 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 + '!' + }, + ...rules + ] + })(<Input placeholder="" autoComplete="off" disabled={item.readonly} onPressEnter={this.handleSubmit} />)} + </Form.Item> + </Col> + ) + } else if (item.type === 'number') { + fields.push( + <Col span={12} key={index}> + <Form.Item label={item.tooltip ? + <Tooltip placement="topLeft" overlayClassName={item.tooltipClass} 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 + '!' + } + ] + })(item.unlimit ? <InputNumber /> : + <InputNumber min={item.min} max={item.max} precision={item.decimal} />)} + </Form.Item> + </Col> + ) + } else if (item.type === 'select') { // 涓嬫媺鎼滅储 + 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 + '!' + } + ] + })( + <Select + showSearch + filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} + onChange={(value, option) => {this.typeChange(item.key, value, option)}} + getPopupContainer={() => document.getElementById('columnwinter')} + > + {item.options.map((option, index) => + <Select.Option key={index} value={option.value || option.field}> + {option.text || option.label} + </Select.Option> + )} + </Select> + )} + </Form.Item> + </Col> + ) + } else if (item.type === 'radio') { + fields.push( + <Col span={12} key={index}> + <Form.Item label={item.tooltip ? + <Tooltip placement="topLeft" overlayClassName={item.tooltipClass} 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.select'] + item.label + '!' + } + ] + })( + <Radio.Group onChange={(e) => {this.changeRadio(item.key, e.target.value)}}> + { + item.options.map(option => { + return ( + <Radio key={option.value} value={option.value}>{option.text}</Radio> + ) + }) + } + </Radio.Group> + )} + </Form.Item> + </Col> + ) + } else if (item.type === 'multiselect') { // 澶氶�� + fields.push( + <Col span={12} key={index}> + <Form.Item label={item.label}> + {getFieldDecorator(item.key, { + initialValue: item.initVal || [] + })( + <Select + showSearch + mode="multiple" + filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} + > + {item.options.map((option, i) => + <Select.Option id={i} key={i} value={option.value}>{option.text}</Select.Option> + )} + </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 || [] + })( + <Cascader + options={item.options} + placeholder="" + getPopupContainer={() => document.getElementById('columnwinter')} + /> + )} + </Form.Item> + </Col> + ) + } + }) + return fields + } + + handleSubmit = () => { + // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� + this.props.form.validateFieldsAndScroll((err, values) => { + if (!err) { + this.setState({visible: false, formlist: null}) + this.props.updateCol(values) + } + }) + } + + editModalCancel = () => { + this.setState({visible: false, formlist: null}) + + if (this.props.column.focus) { + this.props.deleteCol() + } + } + + render() { + const { visible } = this.state + const formItemLayout = { + labelCol: { + xs: { span: 24 }, + sm: { span: 6 } + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 18 } + } + } + return ( + <div style={{display: 'inline-block'}}> + <Icon className="edit" title="缂栬緫" type="edit" onClick={this.editColumn} /> + <Modal + title="鏄剧ず鍒楃紪杈�" + visible={visible} + width={800} + maskClosable={false} + onOk={this.handleSubmit} + onCancel={this.editModalCancel} + destroyOnClose + > + <Form {...formItemLayout} className="commontable-column-form" id="columnwinter"> + <Row gutter={24}>{this.getFields()}</Row> + </Form> + </Modal> + </div> + ) + } +} + +export default Form.create()(MainSearch) \ No newline at end of file diff --git a/src/menu/components/table/normal-table/columns/editColumn/index.scss b/src/menu/components/table/normal-table/columns/editColumn/index.scss new file mode 100644 index 0000000..fcf59ac --- /dev/null +++ b/src/menu/components/table/normal-table/columns/editColumn/index.scss @@ -0,0 +1,19 @@ +.commontable-column-form { + min-height: 190px; + .ant-form-item { + .ant-input-number { + width: 100%; + } + } + .anticon-question-circle { + color: #c49f47; + position: relative; + left: -3px; + } + .ant-cascader-menus { + padding: 5px 0px; + .ant-cascader-menu:last-child { + padding-right: 3px; + } + } +} diff --git a/src/menu/components/table/normal-table/columns/index.jsx b/src/menu/components/table/normal-table/columns/index.jsx index 9ca8013..8a5d67c 100644 --- a/src/menu/components/table/normal-table/columns/index.jsx +++ b/src/menu/components/table/normal-table/columns/index.jsx @@ -2,21 +2,56 @@ import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' import { DndProvider, DragSource, DropTarget } from 'react-dnd' -import { Table, Form } from 'antd' +import { Table, Form, Popover, Icon } from 'antd' +import asyncIconComponent from '@/utils/asyncIconComponent' import Utils from '@/utils/utils.js' +import zhCN from '@/locales/zh-CN/model.js' +import enUS from '@/locales/en-US/model.js' import './index.scss' +const coldict = localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS +const EditColumn = asyncIconComponent(() => import('./editColumn')) + class HeaderCol extends Component { + updateCol = (values) => { + const { column } = this.props + this.props.updateCol({...column, ...values}) + } + + deleteCol = () => { + this.props.deleteCol(this.props.column) + } + render() { - const { connectDragSource, connectDropTarget, moveCol, index, ...restProps } = this.props + const { connectDragSource, connectDropTarget, moveCol, updateCol, deleteCol, index, column, fields, children, ...restProps } = this.props if (index !== undefined) { return connectDragSource( - connectDropTarget(<th {...restProps} index={index} style={{ cursor: 'move' }}/>), + connectDropTarget(<th {...restProps} index={index} style={{ cursor: 'move' }}> + <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ + <div className="mk-popover-control"> + <EditColumn column={column} dict={coldict} fields={fields} updateCol={this.updateCol} deleteCol={this.deleteCol}/> + <Icon className="close" title="delete" type="delete" onClick={this.deleteCol} /> + </div> + } trigger="hover"> + {children} + </Popover> + </th>), ) } else { - return (<th {...restProps} index={index}/>) + return ( + <th {...restProps}> + <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ + <div className="mk-popover-control"> + <EditColumn column={column} dict={coldict} fields={fields} updateCol={this.updateCol} deleteCol={this.deleteCol}/> + <Icon className="close" title="delete" type="delete" onClick={this.deleteCol} /> + </div> + } trigger="hover"> + {children} + </Popover> + </th> + ) } } } @@ -81,20 +116,24 @@ state = { data: [{uuid: Utils.getuuid()}], - columns: [] + columns: [], + fields: [] } UNSAFE_componentWillMount () { this.setState({ - columns: fromJS(this.props.config.cols).toJS() + columns: fromJS(this.props.config.cols).toJS(), + fields: fromJS(this.props.config.columns).toJS() }) } - // UNSAFE_componentWillReceiveProps (nextProps) { - // if (!is(fromJS(this.state.data), fromJS(nextProps.data))) { - // this.setState({data: nextProps.data}) - // } - // } + UNSAFE_componentWillReceiveProps (nextProps) { + if (!is(fromJS(this.state.columns), fromJS(nextProps.config.cols))) { + this.setState({columns: fromJS(nextProps.config.cols).toJS()}) + } else if (!is(fromJS(this.state.fields), fromJS(nextProps.config.columns))) { + this.setState({fields: fromJS(nextProps.config.columns).toJS()}) + } + } shouldComponentUpdate (nextProps, nextState) { return !is(fromJS(this.state), fromJS(nextState)) } @@ -111,8 +150,17 @@ }) } + updateCol = (col) => { + + } + + deleteCol = (col) => { + + } + render() { - let components = { + const { fields } = this.state + const components = { header: { cell: DragableHeaderCol }, @@ -123,28 +171,36 @@ const columns = this.state.columns.map((col, index) => { return { - ...col, title: col.label, dataIndex: col.field, align: 'right', sorter: col.IsSort === 'true', onCell: () => ({ - column: col + column: col, + fields: fields }), children: col.subcols && col.subcols.length > 0 ? col.subcols.map(cell => ({ align: 'left', title: cell.label, key: cell.uuid, - width: 120, onCell: () => ({ - column: cell + column: cell, + fields: fields }), + onHeaderCell: () => ({ + column: cell, + fields: fields, + updateCol: this.updateCol, + deleteCol: this.deleteCol, + }) })) : null, - onHeaderCell: column => ({ + onHeaderCell: () => ({ index, - key: column.uuid, - title: column.label, + column: col, + fields: fields, moveCol: this.moveCol, + updateCol: this.updateCol, + deleteCol: this.deleteCol, }) } }) diff --git a/src/menu/components/table/normal-table/columns/index.scss b/src/menu/components/table/normal-table/columns/index.scss index 7bf3269..dc02829 100644 --- a/src/menu/components/table/normal-table/columns/index.scss +++ b/src/menu/components/table/normal-table/columns/index.scss @@ -5,7 +5,15 @@ } .ant-table-thead { th { - width: 100px; + position: relative; + .ant-table-column-sorter::before { + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + content: ''; + } } } } diff --git a/src/tabviews/commontable/index.jsx b/src/tabviews/commontable/index.jsx index 5f3e6cb..d5e7747 100644 --- a/src/tabviews/commontable/index.jsx +++ b/src/tabviews/commontable/index.jsx @@ -240,7 +240,6 @@ } if (_curUserConfig) { - config.setting = {...config.setting, ..._curUserConfig.setting} config.easyCode = _curUserConfig.easyCode || config.easyCode || '' config.action = config.action.map(item => { diff --git a/src/tabviews/subtable/index.jsx b/src/tabviews/subtable/index.jsx index 0f73c96..6a9bdbd 100644 --- a/src/tabviews/subtable/index.jsx +++ b/src/tabviews/subtable/index.jsx @@ -197,8 +197,6 @@ let chartId = config.charts[0] ? config.charts[0].uuid : '' if (userConfig) { - config.setting.tableType = userConfig.setting.tableType - config.action = config.action.map(item => { if (userConfig.action[item.uuid]) { delete userConfig.action[item.uuid].label diff --git a/src/tabviews/zshare/mutilform/index.jsx b/src/tabviews/zshare/mutilform/index.jsx index 0fcddd3..2767199 100644 --- a/src/tabviews/zshare/mutilform/index.jsx +++ b/src/tabviews/zshare/mutilform/index.jsx @@ -85,7 +85,7 @@ formlist = action.fields } - let _inputfields = formlist.filter(item => item.type === 'text' || item.type === 'number') // 鐢ㄤ簬杩囨护涓嬫媺鑿滃崟鍏宠仈琛ㄥ崟 + let _inputfields = formlist.filter(item => (item.type === 'text' || item.type === 'number') && item.field) // 鐢ㄤ簬杩囨护涓嬫媺鑿滃崟鍏宠仈琛ㄥ崟 formlist = formlist.map(item => { if (item.type === 'title') return item @@ -135,9 +135,15 @@ item.oriOptions = fromJS(item.options).toJS() // 涓嬬骇琛ㄥ崟鎺у埗-瀛楁鍐欏叆 - if (item.linkSubField && item.linkSubField.length > 0) { - let _fields = _inputfields.map(_item => _item.field) - item.linkSubField = item.linkSubField.filter(_item => _fields.includes(_item)) + if (item.type === 'select' || item.type === 'radio') { + if (item.linkSubField && item.linkSubField.length > 0) { + item.linkSubField = item.linkSubField.filter(_item => _inputfields.includes(_item)) + } + if (item.linkSubField && item.linkSubField.length === 0) { + item.linkSubField = null + } + } else { + item.linkSubField = null } } @@ -422,7 +428,7 @@ if (item.type === 'link') { _cell.ParentID = cell[item.linkField] === undefined ? '' : cell[item.linkField] - } else if ((item.type === 'select' || item.type === 'radio') && item.linkSubField && item.linkSubField.length > 0) { + } else if (item.linkSubField) { item.linkSubField.forEach(_field => { _cell[_field] = (cell[_field] || cell[_field] === 0) ? cell[_field] : '' }) @@ -519,7 +525,7 @@ if (item.type === 'link') { _cell.ParentID = cell[item.linkField] === undefined ? '' : cell[item.linkField] - } else if ((item.type === 'select' || item.type === 'radio') && item.linkSubField && item.linkSubField.length > 0) { + } else if (item.linkSubField) { item.linkSubField.forEach(_field => { _cell[_field] = (cell[_field] || cell[_field] === 0) ? cell[_field] : '' }) @@ -600,7 +606,7 @@ }) // 琛ㄥ崟鍒囨崲鏃讹紝鏇存柊鍏宠仈瀛楁 - if ((_field.type === 'select' || _field.type === 'radio') && _field.linkSubField && _field.linkSubField.length > 0) { + if (_field.linkSubField) { let _data = _field.options.filter(op => op.Value === value)[0] if (_data) { diff --git a/src/tabviews/zshare/verifycard/index.jsx b/src/tabviews/zshare/verifycard/index.jsx index a8d1db8..0678cf7 100644 --- a/src/tabviews/zshare/verifycard/index.jsx +++ b/src/tabviews/zshare/verifycard/index.jsx @@ -40,11 +40,6 @@ type: 'main', label: MenuName + '(涓昏〃)', easyCode: config.easyCode || '', - setting: { - actionfixed: config.setting.actionfixed, - columnfixed: config.setting.columnfixed, - tableType: config.setting.tableType - }, action: config.action.map(item => { let _item = { uuid: item.uuid, @@ -126,7 +121,7 @@ subconfig.action = subconfig.action.filter(item => permAction[item.uuid]) subconfig.columns = subconfig.columns.filter(col => { - if (!col.field || !col.blacklist || col.blacklist.length === 0 || subconfig.setting.primaryKey === col.field) return true + if (!col.field || !col.blacklist || col.blacklist.length === 0) return true let _black = col.blacklist.filter(v => { return permRoles.indexOf(v) !== -1 @@ -140,8 +135,6 @@ }) if (subUserConfig) { - subconfig.setting.tableType = subUserConfig.setting.tableType - subconfig.action = subconfig.action.map(item => { if (subUserConfig.action[item.uuid]) { delete subUserConfig.action[item.uuid].label @@ -232,7 +225,6 @@ uuid: res.tab.uuid, linkTab: res.tab.linkTab, label: res.tab.label, - setting: {tableType: subconfig.setting.tableType}, action: subconfig.action.map(item => { let _item = { uuid: item.uuid, @@ -295,7 +287,6 @@ config.forEach(tab => { let _tab = { label: tab.label, - setting: tab.setting, action: {}, columns: {} } diff --git a/src/tabviews/zshare/verifycard/tabcard/index.jsx b/src/tabviews/zshare/verifycard/tabcard/index.jsx index e560fe3..9893c14 100644 --- a/src/tabviews/zshare/verifycard/tabcard/index.jsx +++ b/src/tabviews/zshare/verifycard/tabcard/index.jsx @@ -1,6 +1,6 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import { Form, Tabs, Row, Col, Radio, Table, Icon, Select, notification, Input } from 'antd' +import { Form, Tabs, Row, Col, Table, Icon, notification, Input } from 'antd' import ActionForm from './actionform' import ColumnForm from './columnform' @@ -174,7 +174,6 @@ let _subconfig = { label: config.label, - setting: config.setting, action: {}, columns: {} } @@ -456,66 +455,6 @@ this.props.handleconfig(_config.uuid, _subconfig) } - handleConfirm = () => { - const { config } = this.state - // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� - return new Promise((resolve, reject) => { - this.props.form.validateFieldsAndScroll((err, values) => { - if (!err) { - let _config = {} - _config.setting = values - _config.action = config.action.map(item => { - return { - uuid: item.uuid, - shortcut: item.shortcut || '', - printer: item.printer || '' - } - }) - - resolve(_config) - } - }) - }) - } - - changebtnfix = (e) => { - let val = e.target.value - const { config } = this.props - let subconfig = JSON.parse(JSON.stringify(this.state.subconfig)) - - subconfig.setting.actionfixed = val === 'true' - - this.setState({ - subconfig: subconfig - }) - this.props.handleconfig(config.uuid, subconfig) - } - - changecolfix = (e) => { - let val = e.target.value - const { config } = this.props - let subconfig = JSON.parse(JSON.stringify(this.state.subconfig)) - - subconfig.setting.columnfixed = val === 'true' - - this.setState({ - subconfig: subconfig - }) - this.props.handleconfig(config.uuid, subconfig) - } - - changecheckbox = (val) => { - const { config } = this.props - let subconfig = JSON.parse(JSON.stringify(this.state.subconfig)) - - subconfig.setting.tableType = val - - this.setState({ - subconfig: subconfig - }) - this.props.handleconfig(config.uuid, subconfig) - } - changeEasyCode = ({ target: { value } }) => { const { config } = this.props let subconfig = JSON.parse(JSON.stringify(this.state.subconfig)) @@ -543,43 +482,18 @@ } return ( - <Tabs defaultActiveKey="1" tabPosition="left" className="verify-card-box-vertical-tab"> - <TabPane tab="鍩虹璁剧疆" key="1"> + <Tabs defaultActiveKey="action" tabPosition="left" className="verify-card-box-vertical-tab"> + {config.type === 'main' ? <TabPane tab="鍩虹璁剧疆" key="1"> <Form {...formItemLayout}> <Row gutter={24}> - {config.type === 'main' ? <Col span={9}> + <Col span={9}> <Form.Item label="鍔╄鐮�"> <Input defaultValue={config.easyCode} placeholder="" autoComplete="off" onChange={this.changeEasyCode}/> </Form.Item> - </Col> : null} - <Col span={9}> - <Form.Item label="琛ㄦ牸灞炴��"> - <Select defaultValue={config.setting.tableType} onChange={this.changecheckbox}> - <Select.Option value="">涓嶅彲閫�</Select.Option> - <Select.Option value="radio">鍗曢��</Select.Option> - <Select.Option value="checkbox">澶氶��</Select.Option> - </Select> - </Form.Item> </Col> - {config.type === 'main' ? <Col span={9}> - <Form.Item label="鍥哄畾鎸夐挳"> - <Radio.Group defaultValue={config.setting.actionfixed ? 'true' : 'false'} onChange={this.changebtnfix}> - <Radio value="true">鏄�</Radio> - <Radio value="false">鍚�</Radio> - </Radio.Group> - </Form.Item> - </Col> : null} - {config.type === 'main' ? <Col span={9}> - <Form.Item label="鍥哄畾琛ㄥご"> - <Radio.Group defaultValue={config.setting.columnfixed ? 'true' : 'false'} onChange={this.changecolfix}> - <Radio value="true">鏄�</Radio> - <Radio value="false">鍚�</Radio> - </Radio.Group> - </Form.Item> - </Col> : null} </Row> </Form> - </TabPane> + </TabPane> : null} <TabPane tab="鎸夐挳璁剧疆" key="action"> <ActionForm dict={this.props.dict} diff --git a/src/templates/calendarconfig/index.jsx b/src/templates/calendarconfig/index.jsx index 5929c3f..e0e78ea 100644 --- a/src/templates/calendarconfig/index.jsx +++ b/src/templates/calendarconfig/index.jsx @@ -230,19 +230,20 @@ getFuncNames = (data, funcNames, tableNames) => { data.forEach(item => { - if (item.subfuncs) { - this.getFuncNames(item.subfuncs, funcNames, tableNames) - } else { - if (item.tableName) { - tableNames.push(item.tableName) - } - if (item.innerFunc) { - funcNames.push({func: item.innerFunc, label: item.label || ''}) - } + // if (item.subfuncs) { + // this.getFuncNames(item.subfuncs, funcNames, tableNames) + // return + // } - if (item.callbackFunc) { - funcNames.push({func: item.callbackFunc, label: item.label || ''}) - } + if (item.tableName) { + tableNames.push(item.tableName) + } + if (item.innerFunc) { + funcNames.push({func: item.innerFunc, label: item.label || ''}) + } + + if (item.callbackFunc) { + funcNames.push({func: item.callbackFunc, label: item.label || ''}) } }) @@ -322,33 +323,34 @@ } new Promise(resolve => { - if (_config.tab) { - Api.getSystemConfig({ - func: 'sPC_Get_LongParam', - MenuID: _config.tab.linkTab - }).then(result => { - if (result.status && result.LongParam) { - let _LongParam = '' + // if (_config.tab) { + // Api.getSystemConfig({ + // func: 'sPC_Get_LongParam', + // MenuID: _config.tab.linkTab + // }).then(result => { + // if (result.status && result.LongParam) { + // let _LongParam = '' - if (result.LongParam) { - try { - _LongParam = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) - } catch (e) { - console.warn('Parse Failure') - _LongParam = '' - } - } + // if (result.LongParam) { + // try { + // _LongParam = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) + // } catch (e) { + // console.warn('Parse Failure') + // _LongParam = '' + // } + // } - if (_LongParam) { - _config.funcs[1].menuNo = _LongParam.tabNo || '' - _config.funcs[1].subfuncs = _LongParam.funcs || [] - } - } - resolve() - }) - } else { - resolve() - } + // if (_LongParam) { + // _config.funcs[1].menuNo = _LongParam.tabNo || '' + // _config.funcs[1].subfuncs = _LongParam.funcs || [] + // } + // } + // resolve() + // }) + // } else { + // resolve() + // } + resolve() }).then(() => { // 淇濆瓨鏃跺垹闄ら厤缃被鍨嬶紝system 銆乽ser delete _config.type diff --git a/src/templates/comtableconfig/index.jsx b/src/templates/comtableconfig/index.jsx index d637149..e7643b1 100644 --- a/src/templates/comtableconfig/index.jsx +++ b/src/templates/comtableconfig/index.jsx @@ -205,19 +205,20 @@ getFuncNames = (data, funcNames, tableNames) => { data.forEach(item => { - if (item.subfuncs) { - this.getFuncNames(item.subfuncs, funcNames, tableNames) - } else { - if (item.tableName) { - tableNames.push(item.tableName) - } - if (item.innerFunc) { - funcNames.push({func: item.innerFunc, label: item.label || ''}) - } + // if (item.subfuncs) { + // this.getFuncNames(item.subfuncs, funcNames, tableNames) + // return + // } + + if (item.tableName) { + tableNames.push(item.tableName) + } + if (item.innerFunc) { + funcNames.push({func: item.innerFunc, label: item.label || ''}) + } - if (item.callbackFunc) { - funcNames.push({func: item.callbackFunc, label: item.label || ''}) - } + if (item.callbackFunc) { + funcNames.push({func: item.callbackFunc, label: item.label || ''}) } }) @@ -355,46 +356,47 @@ } new Promise(resolve => { - let deffers = [] - _config.funcs.forEach(item => { - if (item.type === 'tab') { - let deffer = new Promise(resolve => { - Api.getSystemConfig({ - func: 'sPC_Get_LongParam', - MenuID: item.linkTab - }).then(result => { - if (result.status && result.LongParam) { - let _LongParam = '' + // let deffers = [] + // _config.funcs.forEach(item => { + // if (item.type === 'tab') { + // let deffer = new Promise(resolve => { + // Api.getSystemConfig({ + // func: 'sPC_Get_LongParam', + // MenuID: item.linkTab + // }).then(result => { + // if (result.status && result.LongParam) { + // let _LongParam = '' - if (result.LongParam) { - try { - _LongParam = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) - } catch (e) { - console.warn('Parse Failure') - _LongParam = '' - } - } + // if (result.LongParam) { + // try { + // _LongParam = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) + // } catch (e) { + // console.warn('Parse Failure') + // _LongParam = '' + // } + // } - if (_LongParam) { - item.menuNo = _LongParam.tabNo || '' - item.subfuncs = _LongParam.funcs || [] - } - } - resolve() - }) - }) + // if (_LongParam) { + // item.menuNo = _LongParam.tabNo || '' + // item.subfuncs = _LongParam.funcs || [] + // } + // } + // resolve() + // }) + // }) - deffers.push(deffer) - } - }) + // deffers.push(deffer) + // } + // }) - if (deffers.length === 0) { - resolve() - } else { - Promise.all(deffers).then(() => { - resolve() - }) - } + // if (deffers.length === 0) { + // resolve() + // } else { + // Promise.all(deffers).then(() => { + // resolve() + // }) + // } + resolve() }).then(() => { // 淇濆瓨鏃跺垹闄ら厤缃被鍨嬶紝system 銆乽ser delete _config.type @@ -623,10 +625,6 @@ originMenu: fromJS(_config).toJS() }) - this.props.reloadmenu() - - this.submitAction(btnParam, tabParam) - localParam.func = 'sPC_TrdMenu_AddUpt_For_Local' delete localParam.LongParam delete localParam.PageParam @@ -635,7 +633,7 @@ delete localParam.EasyCode delete localParam.open_edition - Api.getLocalConfig(localParam) + this.submitAction(btnParam, tabParam, localParam) } else { this.setState({ menuloading: false, @@ -655,7 +653,7 @@ /** * @description 淇濆瓨鎴栦慨鏀硅彍鍗曟寜閽泦 */ - submitAction = (btnParam, tabParam) => { + submitAction = (btnParam, tabParam, localParam) => { const { config } = this.state new Promise(resolve => { @@ -682,29 +680,25 @@ deffers.push(defer) } - if (deffers.length === 0) { - resolve(true) - } else { - Promise.all(deffers).then(result => { - let error = false - result.forEach(res => { - if (!res.status) { - error = res - } - }) - - if (error) { - notification.warning({ - top: 92, - message: error.message, - duration: 5 - }) - resolve(false) - } else { - resolve(true) + Promise.all(deffers).then(result => { + let error = false + result.forEach(res => { + if (!res.status) { + error = res } }) - } + + if (error) { + notification.warning({ + top: 92, + message: error.message, + duration: 5 + }) + resolve(false) + } else { + resolve(true) + } + }) }).then(response => { if (response === false) return response @@ -822,6 +816,8 @@ menucloseloading: false }) } + this.props.reloadmenu() + Api.getLocalConfig(localParam) } else { this.setState({ menuloading: false, @@ -1194,7 +1190,7 @@ const { menu } = this.props const { activeKey, config, chartview } = this.state - const confActions = config.action.filter(_action => !_action.origin && ['pop', 'popview', 'blank', 'tab'].includes(_action.OpenType)) + const confActions = config.action.filter(_action => !_action.origin && (['pop', 'popview', 'blank'].includes(_action.OpenType) || (_action.OpenType === 'tab' && _action.tabTemplate === 'FormTab'))) let configTabs = [] config.tabgroups.forEach(group => { diff --git a/src/templates/sharecomponent/actioncomponent/index.jsx b/src/templates/sharecomponent/actioncomponent/index.jsx index 7b6ec62..639af29 100644 --- a/src/templates/sharecomponent/actioncomponent/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/index.jsx @@ -839,7 +839,7 @@ * @description 鎸夐挳鍙屽嚮瑙﹀彂瀛愰厤缃� */ btnDoubleClick = (element) => { - if (!element.origin && (element.OpenType === 'pop' || element.OpenType === 'popview' || element.OpenType === 'blank')) { + if (!element.origin && (element.OpenType === 'pop' || element.OpenType === 'popview' || element.OpenType === 'blank' || (element.OpenType === 'tab' && element.tabTemplate === 'FormTab'))) { this.props.setSubConfig(element) } else { notification.warning({ diff --git a/src/templates/subtableconfig/index.jsx b/src/templates/subtableconfig/index.jsx index eb3f3da..5a2cebe 100644 --- a/src/templates/subtableconfig/index.jsx +++ b/src/templates/subtableconfig/index.jsx @@ -275,49 +275,49 @@ _config.enabled = false } - _config.funcs = [] + // _config.funcs = [] - _config.funcs.push({ - type: 'view', - subtype: 'view', - uuid: _config.uuid, - intertype: _config.setting.interType || 'system', - interface: _config.setting.interface || '', - tableName: _config.setting.tableName || '', - innerFunc: _config.setting.innerFunc || '', - outerFunc: _config.setting.outerFunc || '' - }) + // _config.funcs.push({ + // type: 'view', + // subtype: 'view', + // uuid: _config.uuid, + // intertype: _config.setting.interType || 'system', + // interface: _config.setting.interface || '', + // tableName: _config.setting.tableName || '', + // innerFunc: _config.setting.innerFunc || '', + // outerFunc: _config.setting.outerFunc || '' + // }) - _config.action.forEach(item => { - let tablename = item.OpenType === 'excelIn' ? (item.sheet || '') : (item.sql || '') + // _config.action.forEach(item => { + // let tablename = item.OpenType === 'excelIn' ? (item.sheet || '') : (item.sql || '') - if (item.OpenType === 'excelOut' && item.intertype === 'system') { - tablename = _config.setting.tableName || '' - } + // if (item.OpenType === 'excelOut' && item.intertype === 'system') { + // tablename = _config.setting.tableName || '' + // } - if (item.OpenType === 'popview') { - _config.funcs.push({ - type: 'tab', - subtype: 'btn', - uuid: item.uuid, - label: item.label, - linkTab: item.linkTab - }) - } else { - _config.funcs.push({ - type: 'button', - subtype: 'btn', - uuid: item.uuid, - label: item.label, - tableName: tablename, - intertype: item.intertype, - interface: item.interface || '', - innerFunc: item.innerFunc || '', - outerFunc: item.outerFunc || '', - callbackFunc: item.callbackFunc || '' - }) - } - }) + // if (item.OpenType === 'popview') { + // _config.funcs.push({ + // type: 'tab', + // subtype: 'btn', + // uuid: item.uuid, + // label: item.label, + // linkTab: item.linkTab + // }) + // } else { + // _config.funcs.push({ + // type: 'button', + // subtype: 'btn', + // uuid: item.uuid, + // label: item.label, + // tableName: tablename, + // intertype: item.intertype, + // interface: item.interface || '', + // innerFunc: item.innerFunc || '', + // outerFunc: item.outerFunc || '', + // callbackFunc: item.callbackFunc || '' + // }) + // } + // }) if (this.state.closeVisible) { // 鏄剧ず鍏抽棴瀵硅瘽妗嗘椂锛屾ā鎬佹涓繚瀛樻寜閽紝鏄剧ず淇濆瓨涓姸鎬� this.setState({ @@ -330,48 +330,48 @@ } new Promise(resolve => { - let deffers = [] - _config.funcs.forEach(item => { - if (item.type === 'tab') { - let deffer = new Promise(resolve => { - Api.getSystemConfig({ - func: 'sPC_Get_LongParam', - MenuID: item.linkTab - }).then(result => { - if (result.status && result.LongParam) { - let _LongParam = '' + // let deffers = [] + // _config.funcs.forEach(item => { + // if (item.type === 'tab') { + // let deffer = new Promise(resolve => { + // Api.getSystemConfig({ + // func: 'sPC_Get_LongParam', + // MenuID: item.linkTab + // }).then(result => { + // if (result.status && result.LongParam) { + // let _LongParam = '' - if (result.LongParam) { - try { - _LongParam = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) - } catch (e) { - console.warn('Parse Failure') - _LongParam = '' - } - } + // if (result.LongParam) { + // try { + // _LongParam = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) + // } catch (e) { + // console.warn('Parse Failure') + // _LongParam = '' + // } + // } - if (_LongParam) { - item.menuNo = _LongParam.tabNo - item.subfuncs = _LongParam.funcs || [] - } - } - resolve() - }) - }) + // if (_LongParam) { + // item.menuNo = _LongParam.tabNo + // item.subfuncs = _LongParam.funcs || [] + // } + // } + // resolve() + // }) + // }) - deffers.push(deffer) - } - }) + // deffers.push(deffer) + // } + // }) - if (deffers.length === 0) { - resolve() - } else { - Promise.all(deffers).then(() => { - resolve() - }) - } + // if (deffers.length === 0) { + // resolve() + // } else { + // Promise.all(deffers).then(() => { + // resolve() + // }) + // } + resolve() }).then(() => { - // 淇濆瓨鏃跺垹闄ら厤缃被鍨嬶紝system 銆乽ser delete _config.type delete _config.isAdd diff --git a/src/templates/treepageconfig/index.jsx b/src/templates/treepageconfig/index.jsx index 4b887e6..24d2716 100644 --- a/src/templates/treepageconfig/index.jsx +++ b/src/templates/treepageconfig/index.jsx @@ -166,19 +166,19 @@ getFuncNames = (data, funcNames, tableNames) => { data.forEach(item => { - if (item.subfuncs) { - this.getFuncNames(item.subfuncs, funcNames, tableNames) - } else { - if (item.tableName) { - tableNames.push(item.tableName) - } - if (item.innerFunc) { - funcNames.push({func: item.innerFunc, label: item.label || ''}) - } + // if (item.subfuncs) { + // this.getFuncNames(item.subfuncs, funcNames, tableNames) + // return + // } + if (item.tableName) { + tableNames.push(item.tableName) + } + if (item.innerFunc) { + funcNames.push({func: item.innerFunc, label: item.label || ''}) + } - if (item.callbackFunc) { - funcNames.push({func: item.callbackFunc, label: item.label || ''}) - } + if (item.callbackFunc) { + funcNames.push({func: item.callbackFunc, label: item.label || ''}) } }) @@ -267,46 +267,47 @@ } new Promise(resolve => { - let deffers = [] - _config.funcs.forEach(item => { - if (item.type === 'tab') { - let deffer = new Promise(resolve => { - Api.getSystemConfig({ - func: 'sPC_Get_LongParam', - MenuID: item.linkTab - }).then(result => { - if (result.status && result.LongParam) { - let _LongParam = '' + // let deffers = [] + // _config.funcs.forEach(item => { + // if (item.type === 'tab') { + // let deffer = new Promise(resolve => { + // Api.getSystemConfig({ + // func: 'sPC_Get_LongParam', + // MenuID: item.linkTab + // }).then(result => { + // if (result.status && result.LongParam) { + // let _LongParam = '' - if (result.LongParam) { - try { - _LongParam = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) - } catch (e) { - console.warn('Parse Failure') - _LongParam = '' - } - } + // if (result.LongParam) { + // try { + // _LongParam = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) + // } catch (e) { + // console.warn('Parse Failure') + // _LongParam = '' + // } + // } - if (_LongParam) { - item.menuNo = _LongParam.tabNo || '' - item.subfuncs = _LongParam.funcs || [] - } - } - resolve() - }) - }) + // if (_LongParam) { + // item.menuNo = _LongParam.tabNo || '' + // item.subfuncs = _LongParam.funcs || [] + // } + // } + // resolve() + // }) + // }) - deffers.push(deffer) - } - }) + // deffers.push(deffer) + // } + // }) - if (deffers.length === 0) { - resolve() - } else { - Promise.all(deffers).then(() => { - resolve() - }) - } + // if (deffers.length === 0) { + // resolve() + // } else { + // Promise.all(deffers).then(() => { + // resolve() + // }) + // } + resolve() }).then(() => { // 淇濆瓨鏃跺垹闄ら厤缃被鍨嬶紝system 銆乽ser delete _config.type @@ -437,6 +438,13 @@ }).then(resp => { if (resp === false) return let localParam = fromJS(param).toJS() + localParam.func = 'sPC_TrdMenu_AddUpt_For_Local' + delete localParam.LongParam + delete localParam.PageParam + delete localParam.Template + delete localParam.Sort + delete localParam.EasyCode + delete localParam.open_edition Api.getSystemConfig(param).then(response => { if (response.status) { @@ -446,8 +454,6 @@ originMenu: fromJS(_config).toJS() }) - this.props.reloadmenu() - // 瀛樺湪鏍囩椤垫椂 if (tabParam.LText) { Api.getSystemConfig(tabParam).then(result => { @@ -457,6 +463,10 @@ message: '淇濆瓨鎴愬姛', duration: 2 }) + + this.props.reloadmenu() + Api.getLocalConfig(localParam) + if (this.state.closeVisible) { this.props.handleView() } else { @@ -483,6 +493,10 @@ message: '淇濆瓨鎴愬姛', duration: 2 }) + + this.props.reloadmenu() + Api.getLocalConfig(localParam) + if (this.state.closeVisible) { this.props.handleView() } else { @@ -492,16 +506,6 @@ }) } } - - localParam.func = 'sPC_TrdMenu_AddUpt_For_Local' - delete localParam.LongParam - delete localParam.PageParam - delete localParam.Template - delete localParam.Sort - delete localParam.EasyCode - delete localParam.open_edition - - Api.getLocalConfig(localParam) } else { this.setState({ menuloading: false, diff --git a/src/templates/zshare/formconfig.jsx b/src/templates/zshare/formconfig.jsx index 8bde153..b50d21e 100644 --- a/src/templates/zshare/formconfig.jsx +++ b/src/templates/zshare/formconfig.jsx @@ -697,7 +697,7 @@ text: Formdict['header.form.func.changeuser'] }, { value: 'print', - text: Formdict['header.form.func.print'] + text: '鏍囩鎵撳嵃' }] }, { -- Gitblit v1.8.0