| | |
| | | |
| | | this.props.modifyMainMenu(menulist[0] || null) |
| | | this.props.resetEditLevel(false) |
| | | this.props.modifyTabview([]) |
| | | } |
| | | |
| | | exitEdit = () => { |
| | |
| | | MenuID: '1602315375262ikd33ii0nii34pt861o', |
| | | MenuNo: 's_worksflow_roleM', |
| | | MenuName: '关键角色管理', |
| | | }, { |
| | | src: '', |
| | | PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, |
| | | type: 'ManageTable', |
| | | MenuID: '1606794243739c5ihs58lucpskp3r4s2', |
| | | MenuNo: 's_custom_componentsM', |
| | | MenuName: '自定义组件', |
| | | }] |
| | | }, { |
| | | MenuID: 'systemManageViewInterface', |
New file |
| | |
| | | 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 |
| | | } |
| | | ] |
| | | } |
New file |
| | |
| | | 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) |
New file |
| | |
| | | .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; |
| | | } |
| | | } |
| | | } |
| | |
| | | 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> |
| | | ) |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | 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)) |
| | | } |
| | |
| | | }) |
| | | } |
| | | |
| | | updateCol = (col) => { |
| | | |
| | | } |
| | | |
| | | deleteCol = (col) => { |
| | | |
| | | } |
| | | |
| | | render() { |
| | | let components = { |
| | | const { fields } = this.state |
| | | const components = { |
| | | header: { |
| | | cell: DragableHeaderCol |
| | | }, |
| | |
| | | |
| | | 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, |
| | | }) |
| | | } |
| | | }) |
| | |
| | | } |
| | | .ant-table-thead { |
| | | th { |
| | | width: 100px; |
| | | position: relative; |
| | | .ant-table-column-sorter::before { |
| | | position: absolute; |
| | | top: 0; |
| | | right: 0; |
| | | bottom: 0; |
| | | left: 0; |
| | | content: ''; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | if (_curUserConfig) { |
| | | config.setting = {...config.setting, ..._curUserConfig.setting} |
| | | config.easyCode = _curUserConfig.easyCode || config.easyCode || '' |
| | | |
| | | config.action = config.action.map(item => { |
| | |
| | | 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 |
| | |
| | | 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 |
| | |
| | | item.oriOptions = fromJS(item.options).toJS() |
| | | |
| | | // 下级表单控制-字段写入 |
| | | if (item.type === 'select' || item.type === 'radio') { |
| | | if (item.linkSubField && item.linkSubField.length > 0) { |
| | | let _fields = _inputfields.map(_item => _item.field) |
| | | item.linkSubField = item.linkSubField.filter(_item => _fields.includes(_item)) |
| | | item.linkSubField = item.linkSubField.filter(_item => _inputfields.includes(_item)) |
| | | } |
| | | if (item.linkSubField && item.linkSubField.length === 0) { |
| | | item.linkSubField = null |
| | | } |
| | | } else { |
| | | item.linkSubField = null |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | 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] : '' |
| | | }) |
| | |
| | | |
| | | 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] : '' |
| | | }) |
| | |
| | | }) |
| | | |
| | | // 表单切换时,更新关联字段 |
| | | 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) { |
| | |
| | | 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, |
| | |
| | | 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 |
| | |
| | | }) |
| | | |
| | | 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 |
| | |
| | | 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, |
| | |
| | | config.forEach(tab => { |
| | | let _tab = { |
| | | label: tab.label, |
| | | setting: tab.setting, |
| | | action: {}, |
| | | columns: {} |
| | | } |
| | |
| | | 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' |
| | |
| | | |
| | | let _subconfig = { |
| | | label: config.label, |
| | | setting: config.setting, |
| | | action: {}, |
| | | columns: {} |
| | | } |
| | |
| | | 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)) |
| | |
| | | } |
| | | |
| | | 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} |
| | |
| | | |
| | | getFuncNames = (data, funcNames, tableNames) => { |
| | | data.forEach(item => { |
| | | if (item.subfuncs) { |
| | | this.getFuncNames(item.subfuncs, funcNames, tableNames) |
| | | } else { |
| | | // if (item.subfuncs) { |
| | | // this.getFuncNames(item.subfuncs, funcNames, tableNames) |
| | | // return |
| | | // } |
| | | |
| | | if (item.tableName) { |
| | | tableNames.push(item.tableName) |
| | | } |
| | |
| | | |
| | | if (item.callbackFunc) { |
| | | funcNames.push({func: item.callbackFunc, label: item.label || ''}) |
| | | } |
| | | } |
| | | }) |
| | | |
| | |
| | | } |
| | | |
| | | 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 || [] |
| | | } |
| | | } |
| | | // if (_LongParam) { |
| | | // _config.funcs[1].menuNo = _LongParam.tabNo || '' |
| | | // _config.funcs[1].subfuncs = _LongParam.funcs || [] |
| | | // } |
| | | // } |
| | | // resolve() |
| | | // }) |
| | | // } else { |
| | | // resolve() |
| | | // } |
| | | resolve() |
| | | }) |
| | | } else { |
| | | resolve() |
| | | } |
| | | }).then(() => { |
| | | // 保存时删除配置类型,system 、user |
| | | delete _config.type |
| | |
| | | |
| | | getFuncNames = (data, funcNames, tableNames) => { |
| | | data.forEach(item => { |
| | | if (item.subfuncs) { |
| | | this.getFuncNames(item.subfuncs, funcNames, tableNames) |
| | | } else { |
| | | // if (item.subfuncs) { |
| | | // this.getFuncNames(item.subfuncs, funcNames, tableNames) |
| | | // return |
| | | // } |
| | | |
| | | if (item.tableName) { |
| | | tableNames.push(item.tableName) |
| | | } |
| | |
| | | |
| | | if (item.callbackFunc) { |
| | | funcNames.push({func: item.callbackFunc, label: item.label || ''}) |
| | | } |
| | | } |
| | | }) |
| | | |
| | |
| | | } |
| | | |
| | | 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 || [] |
| | | } |
| | | } |
| | | // if (_LongParam) { |
| | | // item.menuNo = _LongParam.tabNo || '' |
| | | // item.subfuncs = _LongParam.funcs || [] |
| | | // } |
| | | // } |
| | | // resolve() |
| | | // }) |
| | | // }) |
| | | |
| | | // deffers.push(deffer) |
| | | // } |
| | | // }) |
| | | |
| | | // if (deffers.length === 0) { |
| | | // resolve() |
| | | // } else { |
| | | // Promise.all(deffers).then(() => { |
| | | // resolve() |
| | | // }) |
| | | // } |
| | | resolve() |
| | | }) |
| | | }) |
| | | |
| | | deffers.push(deffer) |
| | | } |
| | | }) |
| | | |
| | | if (deffers.length === 0) { |
| | | resolve() |
| | | } else { |
| | | Promise.all(deffers).then(() => { |
| | | resolve() |
| | | }) |
| | | } |
| | | }).then(() => { |
| | | // 保存时删除配置类型,system 、user |
| | | delete _config.type |
| | |
| | | originMenu: fromJS(_config).toJS() |
| | | }) |
| | | |
| | | this.props.reloadmenu() |
| | | |
| | | this.submitAction(btnParam, tabParam) |
| | | |
| | | localParam.func = 'sPC_TrdMenu_AddUpt_For_Local' |
| | | delete localParam.LongParam |
| | | delete localParam.PageParam |
| | |
| | | delete localParam.EasyCode |
| | | delete localParam.open_edition |
| | | |
| | | Api.getLocalConfig(localParam) |
| | | this.submitAction(btnParam, tabParam, localParam) |
| | | } else { |
| | | this.setState({ |
| | | menuloading: false, |
| | |
| | | /** |
| | | * @description 保存或修改菜单按钮集 |
| | | */ |
| | | submitAction = (btnParam, tabParam) => { |
| | | submitAction = (btnParam, tabParam, localParam) => { |
| | | const { config } = this.state |
| | | |
| | | new Promise(resolve => { |
| | |
| | | deffers.push(defer) |
| | | } |
| | | |
| | | if (deffers.length === 0) { |
| | | resolve(true) |
| | | } else { |
| | | Promise.all(deffers).then(result => { |
| | | let error = false |
| | | result.forEach(res => { |
| | |
| | | resolve(true) |
| | | } |
| | | }) |
| | | } |
| | | }).then(response => { |
| | | if (response === false) return response |
| | | |
| | |
| | | menucloseloading: false |
| | | }) |
| | | } |
| | | this.props.reloadmenu() |
| | | Api.getLocalConfig(localParam) |
| | | } else { |
| | | this.setState({ |
| | | menuloading: false, |
| | |
| | | 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 => { |
| | |
| | | * @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({ |
| | |
| | | _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({ |
| | |
| | | } |
| | | |
| | | 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 || [] |
| | | } |
| | | } |
| | | // if (_LongParam) { |
| | | // item.menuNo = _LongParam.tabNo |
| | | // item.subfuncs = _LongParam.funcs || [] |
| | | // } |
| | | // } |
| | | // resolve() |
| | | // }) |
| | | // }) |
| | | |
| | | // deffers.push(deffer) |
| | | // } |
| | | // }) |
| | | |
| | | // if (deffers.length === 0) { |
| | | // resolve() |
| | | // } else { |
| | | // Promise.all(deffers).then(() => { |
| | | // resolve() |
| | | // }) |
| | | // } |
| | | resolve() |
| | | }) |
| | | }) |
| | | |
| | | deffers.push(deffer) |
| | | } |
| | | }) |
| | | |
| | | if (deffers.length === 0) { |
| | | resolve() |
| | | } else { |
| | | Promise.all(deffers).then(() => { |
| | | resolve() |
| | | }) |
| | | } |
| | | }).then(() => { |
| | | |
| | | // 保存时删除配置类型,system 、user |
| | | delete _config.type |
| | | delete _config.isAdd |
| | |
| | | |
| | | getFuncNames = (data, funcNames, tableNames) => { |
| | | data.forEach(item => { |
| | | if (item.subfuncs) { |
| | | this.getFuncNames(item.subfuncs, funcNames, tableNames) |
| | | } else { |
| | | // if (item.subfuncs) { |
| | | // this.getFuncNames(item.subfuncs, funcNames, tableNames) |
| | | // return |
| | | // } |
| | | if (item.tableName) { |
| | | tableNames.push(item.tableName) |
| | | } |
| | |
| | | |
| | | if (item.callbackFunc) { |
| | | funcNames.push({func: item.callbackFunc, label: item.label || ''}) |
| | | } |
| | | } |
| | | }) |
| | | |
| | |
| | | } |
| | | |
| | | 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 || [] |
| | | } |
| | | } |
| | | // if (_LongParam) { |
| | | // item.menuNo = _LongParam.tabNo || '' |
| | | // item.subfuncs = _LongParam.funcs || [] |
| | | // } |
| | | // } |
| | | // resolve() |
| | | // }) |
| | | // }) |
| | | |
| | | // deffers.push(deffer) |
| | | // } |
| | | // }) |
| | | |
| | | // if (deffers.length === 0) { |
| | | // resolve() |
| | | // } else { |
| | | // Promise.all(deffers).then(() => { |
| | | // resolve() |
| | | // }) |
| | | // } |
| | | resolve() |
| | | }) |
| | | }) |
| | | |
| | | deffers.push(deffer) |
| | | } |
| | | }) |
| | | |
| | | if (deffers.length === 0) { |
| | | resolve() |
| | | } else { |
| | | Promise.all(deffers).then(() => { |
| | | resolve() |
| | | }) |
| | | } |
| | | }).then(() => { |
| | | // 保存时删除配置类型,system 、user |
| | | delete _config.type |
| | |
| | | }).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) { |
| | |
| | | openEdition: response.open_edition || '', |
| | | originMenu: fromJS(_config).toJS() |
| | | }) |
| | | |
| | | this.props.reloadmenu() |
| | | |
| | | // 存在标签页时 |
| | | if (tabParam.LText) { |
| | |
| | | message: '保存成功', |
| | | duration: 2 |
| | | }) |
| | | |
| | | this.props.reloadmenu() |
| | | Api.getLocalConfig(localParam) |
| | | |
| | | if (this.state.closeVisible) { |
| | | this.props.handleView() |
| | | } else { |
| | |
| | | message: '保存成功', |
| | | duration: 2 |
| | | }) |
| | | |
| | | this.props.reloadmenu() |
| | | Api.getLocalConfig(localParam) |
| | | |
| | | if (this.state.closeVisible) { |
| | | this.props.handleView() |
| | | } else { |
| | |
| | | }) |
| | | } |
| | | } |
| | | |
| | | 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, |
| | |
| | | text: Formdict['header.form.func.changeuser'] |
| | | }, { |
| | | value: 'print', |
| | | text: Formdict['header.form.func.print'] |
| | | text: '标签打印' |
| | | }] |
| | | }, |
| | | { |