| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Form, Row, Col, Input, Select, InputNumber, Radio, Tooltip, Cascader, Modal } from 'antd' |
| | | import { Form, Row, Col, Input, Select, InputNumber, Radio, Tooltip, Cascader, Modal, Checkbox } from 'antd' |
| | | import { QuestionCircleOutlined } from '@ant-design/icons' |
| | | |
| | | import { getColumnForm } from './formconfig' |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'checkbox') { |
| | | fields.push( |
| | | <Col span={12} key={index}> |
| | | <Form.Item label={item.tooltip ? |
| | | <Tooltip placement="topLeft" title={item.tooltip}> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | {item.label} |
| | | </Tooltip> : item.label |
| | | }> |
| | | {getFieldDecorator(item.key, { |
| | | initialValue: item.initVal |
| | | })( |
| | | <Checkbox.Group> |
| | | {item.options.map(option => <Checkbox key={option.value} value={option.value}>{option.text}</Checkbox>)} |
| | | </Checkbox.Group> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'multiselect') { // 多选 |
| | | fields.push( |
| | | <Col span={12} key={index}> |
| | |
| | | .ant-table-small > .ant-table-content > .ant-table-body { |
| | | margin: 0; |
| | | } |
| | | .ant-table-small > .ant-table-content .ant-table-thead > tr > th { |
| | | background-color: #fafafa!important; |
| | | } |
| | | |
| | | table, tr, th, td { |
| | | border-color: var(--mk-table-border-color)!important; |
| | |
| | | { |
| | | type: 'radio', |
| | | field: 'actionfixed', |
| | | label: '按钮固定', |
| | | initval: wrap.actionfixed || 'false', |
| | | label: '固定按钮', |
| | | initval: wrap.actionfixed !== 'true' ? 'false' : 'true', |
| | | required: false, |
| | | options: [ |
| | | {value: 'true', label: '是'}, |
| | |
| | | ] |
| | | }, |
| | | { |
| | | type: 'checkbox', |
| | | field: 'colfixed', |
| | | label: '固定列', |
| | | initval: wrap.colfixed || [], |
| | | required: false, |
| | | options: [ |
| | | {value: 'first', label: '首列'}, |
| | | {value: 'last', label: '尾列'}, |
| | | ] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'size', |
| | | label: '表格大小', |
| | |
| | | .ant-table-small > .ant-table-content > .ant-table-body { |
| | | margin: 0; |
| | | } |
| | | .ant-table-small > .ant-table-content .ant-table-thead > tr > th { |
| | | background-color: #fafafa!important; |
| | | } |
| | | |
| | | table, tr, th, td { |
| | | border-color: var(--mk-table-border-color)!important; |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Form, Row, Col, Input, Select, InputNumber, Radio, Tooltip, Cascader, Modal } from 'antd' |
| | | import { Form, Row, Col, Input, Select, InputNumber, Radio, Tooltip, Cascader, Modal, Checkbox } from 'antd' |
| | | import { QuestionCircleOutlined } from '@ant-design/icons' |
| | | |
| | | import { getColumnForm } from './formconfig' |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'checkbox') { |
| | | fields.push( |
| | | <Col span={12} key={index}> |
| | | <Form.Item label={item.tooltip ? |
| | | <Tooltip placement="topLeft" title={item.tooltip}> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | {item.label} |
| | | </Tooltip> : item.label |
| | | }> |
| | | {getFieldDecorator(item.key, { |
| | | initialValue: item.initVal |
| | | })( |
| | | <Checkbox.Group> |
| | | {item.options.map(option => <Checkbox key={option.value} value={option.value}>{option.text}</Checkbox>)} |
| | | </Checkbox.Group> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'multiselect') { // 多选 |
| | | fields.push( |
| | | <Col span={12} key={index}> |
| | |
| | | color: var(--mk-table-color); |
| | | } |
| | | } |
| | | .normal-table-columns:not(.ghost) { |
| | | .ant-table-small > .ant-table-content .ant-table-thead > tr > th { |
| | | background-color: #fafafa!important; |
| | | } |
| | | } |
| | | .normal-table-columns.false { |
| | | .ant-pagination { |
| | | display: none; |
| | |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'actionfixed', |
| | | label: '固定按钮', |
| | | initval: wrap.actionfixed !== 'true' ? 'false' : 'true', |
| | | required: false, |
| | | options: [ |
| | | {value: 'true', label: '是'}, |
| | | {value: 'false', label: '否'}, |
| | | ], |
| | | forbid: appType === 'mob' || appType === 'pc' |
| | | }, |
| | | { |
| | | type: 'checkbox', |
| | | field: 'colfixed', |
| | | label: '固定列', |
| | | initval: wrap.colfixed || [], |
| | | required: false, |
| | | options: [ |
| | | {value: 'first', label: '首列'}, |
| | | {value: 'last', label: '尾列'}, |
| | | ], |
| | | forbid: appType === 'mob' || appType === 'pc' |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'tableHeader', |
| | | label: '表头', |
| | | initval: wrap.tableHeader || 'show', |
| | |
| | | {value: 'sign', label: '选中标记'} |
| | | ], |
| | | }, |
| | | // { |
| | | // type: 'radio', |
| | | // field: 'selected', |
| | | // label: '首行选中', |
| | | // initval: wrap.selected || 'false', |
| | | // tooltip: '当按钮执行完成并返回主键值时,默认选中主键值对应行。', |
| | | // required: false, |
| | | // options: [ |
| | | // {value: 'false', label: '无'}, |
| | | // {value: 'init', label: '初始化'}, |
| | | // {value: 'always', label: '数据加载'}, |
| | | // ] |
| | | // }, |
| | | // { |
| | | // type: 'radio', |
| | | // field: 'show', |
| | | // label: '搜索按钮', |
| | | // initval: wrap.show || 'true', |
| | | // tooltip: '搜索条件存在时,可选择是否显示搜索按钮。', |
| | | // required: false, |
| | | // options: [ |
| | | // {value: 'true', label: '显示'}, |
| | | // {value: 'false', label: '隐藏'}, |
| | | // ] |
| | | // }, |
| | | { |
| | | type: 'color', |
| | | field: 'borderColor', |
| | |
| | | {value: 'bottom', label: '向下'}, |
| | | ] |
| | | }, |
| | | // { |
| | | // type: 'color', |
| | | // field: 'color', |
| | | // label: '字体颜色', |
| | | // initval: wrap.color || 'rgba(0, 0, 0, 0.65)', |
| | | // tooltip: '默认值 rgba(0, 0, 0, 0.65)。', |
| | | // required: false |
| | | // }, |
| | | // { |
| | | // type: 'number', |
| | | // field: 'fontSize', |
| | | // label: '字体大小', |
| | | // initval: wrap.fontSize || 14, |
| | | // min: 12, |
| | | // max: 30, |
| | | // precision: 0, |
| | | // required: false |
| | | // }, |
| | | // { |
| | | // type: 'number', |
| | | // field: 'advanceWidth', |
| | | // label: '高级搜索', |
| | | // initval: wrap.advanceWidth || 1000, |
| | | // tooltip: '高级搜索弹窗的宽度,注:当宽度值小于100时表示占窗口的百分比,大于100时表示宽度的绝对值。', |
| | | // min: 10, |
| | | // max: 3000, |
| | | // precision: 0, |
| | | // required: false, |
| | | // forbid: appType === 'mob' |
| | | // }, |
| | | { |
| | | type: 'number', |
| | | field: 'btnlimit', |
| | |
| | | .ant-btn-link:hover { |
| | | opacity: 0.8; |
| | | } |
| | | .button-list.toolbar-button { |
| | | button { |
| | | height: auto; |
| | | min-height: 28px; |
| | | } |
| | | } |
| | | } |
| | | .custom-table-wrap.loading { |
| | | .ant-spin-spinning:not(.view-spin) { |
| | |
| | | min-height: 20px; |
| | | overflow-y: auto; |
| | | |
| | | >.button-list.toolbar-button { |
| | | .button-list.toolbar-button { |
| | | padding: 0; |
| | | line-height: 45px; |
| | | button { |
| | | margin-right: 0px; |
| | | margin-bottom: 0px; |
| | | min-height: 28px; |
| | | height: auto; |
| | | } |
| | | } |
| | | |
| | |
| | | min-height: 20px; |
| | | overflow-y: auto; |
| | | |
| | | >.button-list.toolbar-button { |
| | | .button-list.toolbar-button { |
| | | padding: 0; |
| | | line-height: 45px; |
| | | button { |
| | | margin-right: 0px; |
| | | margin-bottom: 0px; |
| | | min-height: 28px; |
| | | height: auto; |
| | | } |
| | | } |
| | | |
| | |
| | | loading = false |
| | | } |
| | | |
| | | let fixed = '' |
| | | if (setting.colfixed && setting.colfixed.length) { |
| | | if (setting.colfixed.includes('first')) { |
| | | fixed = 'mk-fixed-first-col' |
| | | } |
| | | if (setting.colfixed.includes('last')) { |
| | | fixed += ' mk-fixed-last-col' |
| | | } |
| | | } |
| | | |
| | | return ( |
| | | <div className={`normal-custom-table ${setting.tableHeader || ''} ${height ? 'fixed-height' : ''} ${setting.mode || ''} table-vertical-${setting.vertical || 'middle'} table-col-${columns.length}`} id={tableId}> |
| | | <div className={`normal-custom-table ${setting.tableHeader || ''} ${height ? 'fixed-height' : ''} ${setting.mode || ''} table-vertical-${setting.vertical || 'middle'} table-col-${columns.length} ${fixed}`} id={tableId}> |
| | | {(setting.tableType === 'radio' || setting.tableType === 'checkbox') && data && data.length > 0 ? |
| | | <Switch title="收起" className="main-pickup" checkedChildren="开" unCheckedChildren="关" checked={pickup} onChange={this.pickupChange} /> : null |
| | | } |
| | |
| | | // } |
| | | // } |
| | | } |
| | | .normal-custom-table:not(.ghost) { |
| | | .ant-table-small > .ant-table-content .ant-table-thead > tr > th { |
| | | background-color: #fafafa!important; |
| | | } |
| | | } |
| | | .normal-custom-table:not(.fixed-height) { |
| | | .ant-table-body::-webkit-scrollbar { |
| | | width: 8px; |
| | |
| | | display: none; |
| | | } |
| | | } |
| | | .normal-custom-table.mk-fixed-last-col { |
| | | table { |
| | | .ant-table-thead { |
| | | tr:first-child { |
| | | th:last-child { |
| | | position: sticky !important; |
| | | z-index: 2; |
| | | right: 0px; |
| | | box-shadow: 0 1px 1px #bcbcbc; |
| | | } |
| | | } |
| | | } |
| | | .ant-table-tbody { |
| | | tr { |
| | | td:last-child { |
| | | position: sticky !important; |
| | | z-index: 2; |
| | | right: 0px; |
| | | background: #ffffff; |
| | | box-shadow: 0 1px 1px #bcbcbc; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | .normal-custom-table.mk-fixed-first-col { |
| | | table { |
| | | .ant-table-thead { |
| | | tr:first-child { |
| | | th:first-child { |
| | | position: sticky !important; |
| | | z-index: 2; |
| | | left: 0px; |
| | | } |
| | | th.ant-table-selection-column + th { |
| | | position: sticky !important; |
| | | z-index: 2; |
| | | left: 60px; |
| | | } |
| | | } |
| | | } |
| | | .ant-table-tbody { |
| | | tr { |
| | | td:first-child { |
| | | position: sticky !important; |
| | | z-index: 2; |
| | | left: 0px; |
| | | background: #ffffff; |
| | | } |
| | | td.ant-table-selection-column + td{ |
| | | position: sticky !important; |
| | | z-index: 2; |
| | | left: 60px; |
| | | background: #ffffff; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | .normal-custom-table.ghost { |
| | | .main-pickup { |
| | | display: none; |
| | |
| | | border-bottom: 1px solid #efefef; |
| | | padding-top: 10px; |
| | | } |
| | | >.button-list.toolbar-button { |
| | | .button-list.toolbar-button { |
| | | min-height: 60px; |
| | | padding-right: 60px; |
| | | button { |
| | | margin-right: 0px; |
| | | margin-bottom: 0px; |
| | | min-height: 28px; |
| | | height: auto; |
| | | } |
| | | } |
| | | .ant-modal-mask { |
| | | position: absolute; |
| | | } |
| | | .ant-modal-wrap { |
| | | position: absolute; |
| | | } |
| | | .action-modal .ant-modal { |
| | | top: 40px; |
| | | max-width: 95%; |
| | | .ant-modal-body { |
| | | max-height: calc(100vh - 265px); |
| | | } |
| | | } |
| | | .main-table-box { |
| | |
| | | border-bottom: 1px solid #efefef; |
| | | padding-top: 10px; |
| | | } |
| | | >.button-list.toolbar-button { |
| | | .button-list.toolbar-button { |
| | | padding: 0; |
| | | line-height: 45px; |
| | | float: left; |
| | |
| | | button { |
| | | margin-right: 0px; |
| | | margin-bottom: 0px; |
| | | min-height: 28px; |
| | | height: auto; |
| | | } |
| | | } |
| | | .ant-modal-mask { |
| | | position: absolute; |
| | | } |
| | | .ant-modal-wrap { |
| | | position: absolute; |
| | | } |
| | | .action-modal .ant-modal { |
| | | top: 40px; |
| | | max-width: 95%; |
| | | .ant-modal-body { |
| | | max-height: calc(100vh - 265px); |
| | | } |
| | | } |
| | | .ant-collapse { |
| | | background-color: transparent; |
| | | border-radius: 0px; |
| | | > .ant-collapse-item { |
| | | border: 0; |
| | | >.ant-collapse-header { |
| | | padding: 0; |
| | | .normal-header { |
| | | padding-right: 40px; |
| | | } |
| | | } |
| | | } |
| | | .ant-collapse-item:last-child > .ant-collapse-content { |
| | | border-radius: 0; |
| | | .ant-collapse-content-box { |
| | | padding: 0; |
| | | >.button-list.toolbar-button { |
| | | padding: 0; |
| | | line-height: 45px; |
| | | padding-right: 60px; |
| | | button { |
| | | margin-right: 0px; |
| | | margin-bottom: 0px; |
| | | min-height: 28px; |
| | | height: auto; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | button { |
| | | margin-right: 0px; |
| | | margin-bottom: 0px; |
| | | min-height: 28px; |
| | | height: auto; |
| | | } |
| | | } |
| | | .ant-modal-mask { |
| | | position: absolute; |
| | | } |
| | | .ant-modal-wrap { |
| | | position: absolute; |
| | | } |
| | | .action-modal .ant-modal { |
| | | top: 40px; |
| | | max-width: 95%; |
| | | .ant-modal-body { |
| | | max-height: calc(100vh - 265px); |
| | | } |
| | | } |
| | | .main-table-box { |
| | |
| | | button { |
| | | margin-right: 0px; |
| | | margin-bottom: 0px; |
| | | min-height: 28px; |
| | | height: auto; |
| | | } |
| | | } |
| | | } |
| | |
| | | .ant-btn-link:hover { |
| | | opacity: 0.8; |
| | | } |
| | | .button-list.toolbar-button { |
| | | button { |
| | | height: auto; |
| | | min-height: 28px; |
| | | } |
| | | } |
| | | } |
| | | .custom-page-wrap.loading { |
| | | .ant-spin-spinning:not(.view-spin) { |
| | |
| | | .ant-btn-link:hover { |
| | | opacity: 0.8; |
| | | } |
| | | .button-list.toolbar-button { |
| | | button { |
| | | height: auto; |
| | | min-height: 28px; |
| | | } |
| | | } |
| | | } |
| | | .pop-page-wrap.loading { |
| | | .ant-spin-spinning:not(.view-spin) { |
| | |
| | | .box404 { |
| | | padding-top: 30px; |
| | | } |
| | | .ant-modal-mask { |
| | | position: absolute; |
| | | } |
| | | .ant-modal-wrap { |
| | | position: absolute; |
| | | } |
| | | .action-modal .ant-modal { |
| | | top: 40px; |
| | | max-width: 95%; |
| | | .ant-modal-body { |
| | | max-height: calc(100vh - 265px); |
| | | } |
| | | } |
| | | > .ant-spin { |
| | | position: absolute; |
| | | left: calc(50% - 22px); |
| | |
| | | .box404 { |
| | | padding-top: 30px; |
| | | } |
| | | .ant-modal-mask { |
| | | position: absolute; |
| | | } |
| | | .ant-modal-wrap { |
| | | position: absolute; |
| | | } |
| | | .action-modal .ant-modal { |
| | | top: 40px; |
| | | max-width: 95%; |
| | | .ant-modal-body { |
| | | max-height: calc(100vh - 265px); |
| | | } |
| | | } |
| | | > .ant-spin { |
| | | position: absolute; |
| | | left: calc(50% - 22px); |
| | |
| | | |
| | | state = { |
| | | actions: [], |
| | | mores: null |
| | | mores: null, |
| | | listId: '' |
| | | } |
| | | |
| | | UNSAFE_componentWillMount() { |
| | | const { setting, actions } = this.props |
| | | |
| | | let listId = (() => { |
| | | let uuid = [] |
| | | let options = '0123456789abcdefghigklmnopqrstuv' |
| | | for (let i = 0; i < 32; i++) { |
| | | uuid.push(options.substr(Math.floor(Math.random() * 0x20), 1)) |
| | | } |
| | | return uuid.join('') |
| | | })() |
| | | |
| | | if (!setting.btnlimit || setting.btnlimit >= actions.length) { |
| | | this.setState({actions: actions}) |
| | | this.setState({actions: actions, listId}) |
| | | } else { |
| | | let mores = fromJS(actions).toJS() |
| | | |
| | | this.setState({ |
| | | actions: mores.splice(0, setting.btnlimit), |
| | | mores |
| | | mores, |
| | | listId |
| | | }) |
| | | } |
| | | } |
| | | |
| | | componentDidMount() { |
| | | if (this.buttonRef && this.buttonRef.offsetHeight > 65) { |
| | | this.buttonRef.classList.add('double-line') |
| | | const { actions, listId } = this.state |
| | | |
| | | if (actions.length > 9) { |
| | | let node = document.getElementById(listId) |
| | | |
| | | // const resizeObserver = new ResizeObserver((entries) => { |
| | | |
| | | // }) |
| | | // resizeObserver.observe(node) |
| | | |
| | | let limit = 10 |
| | | let index = 1 |
| | | let check = () => { |
| | | if (node.offsetHeight > 65) { |
| | | node.classList.add('double-line') |
| | | } else if (index < limit) { |
| | | index++ |
| | | setTimeout(() => { |
| | | check() |
| | | }, 100) |
| | | } |
| | | } |
| | | |
| | | node && check() |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { setting, MenuID } = this.props |
| | | const { actions, mores } = this.state |
| | | let fixed = setting.actionfixed && setting.tabType === 'main' // 按钮是否固定在头部 |
| | | const { setting } = this.props |
| | | const { actions, mores, listId } = this.state |
| | | |
| | | if (fixed && MenuID) { |
| | | if (setting.actionfixed === 'true') { |
| | | return ( |
| | | <Affix offsetTop={48}> |
| | | <div className="button-list toolbar-button" ref={ref => this.buttonRef = ref} id={fixed ? MenuID + 'mainaction' : ''}> |
| | | <div className="button-list toolbar-button" id={listId}> |
| | | {this.getButtonList(actions)} |
| | | {mores ? <Dropdown overlay={<div className="mk-button-dropdown-wrap">{this.getButtonList(mores)}</div>} trigger={['hover']}> |
| | | <div className="mk-button-more">更多<DownOutlined/></div> |
| | |
| | | ) |
| | | } else { |
| | | return ( |
| | | <div className="button-list toolbar-button" ref={ref => this.buttonRef = ref} id={fixed ? MenuID + 'mainaction' : ''}> |
| | | <div className="button-list toolbar-button" id={listId}> |
| | | {this.getButtonList(actions)} |
| | | {mores ? <Dropdown overlay={<div className="mk-button-dropdown-wrap">{this.getButtonList(mores)}</div>} trigger={['hover']}> |
| | | <div className="mk-button-more">更多<DownOutlined/></div> |
| | |
| | | uuid: btn.uuid, |
| | | MenuID: btn.uuid, |
| | | ParentId: tab.components[0].uuid, |
| | | enabled: false, |
| | | MenuName: btn.label, |
| | | tables: _config.tables || [], |
| | | Template: 'BaseTable', |
| | |
| | | viewType: 'popview', |
| | | style: { backgroundColor: '#ffffff', backgroundImage: '', paddingTop: '16px', paddingBottom: '40px', paddingLeft: '16px', paddingRight: '16px' } |
| | | } |
| | | |
| | | btn.config.enabled = this.setEnabled(btn.config) |
| | | } else { |
| | | errors.push(tab.label + '中按钮《' + btn.label + '》配置信息丢失') |
| | | } |
| | |
| | | uuid: btn.uuid, |
| | | MenuID: btn.uuid, |
| | | ParentId: tab.components[0].uuid, |
| | | enabled: false, |
| | | MenuName: btn.label, |
| | | tables: _config.tables || [], |
| | | Template: 'BaseTable', |
| | |
| | | viewType: 'popview', |
| | | style: { backgroundColor: '#ffffff', backgroundImage: '', paddingTop: '16px', paddingBottom: '40px', paddingLeft: '16px', paddingRight: '16px' } |
| | | } |
| | | |
| | | btn.config.enabled = this.setEnabled(btn.config) |
| | | } else { |
| | | errors.push(tab.label + '中按钮《' + btn.label + '》配置信息丢失') |
| | | } |
| | |
| | | uuid: btn.uuid, |
| | | MenuID: btn.uuid, |
| | | ParentId: item.uuid, |
| | | enabled: false, |
| | | MenuName: btn.label, |
| | | tables: _config.tables || [], |
| | | Template: 'BaseTable', |
| | |
| | | viewType: 'popview', |
| | | style: { backgroundColor: '#ffffff', backgroundImage: '', paddingTop: '16px', paddingBottom: '40px', paddingLeft: '16px', paddingRight: '16px' } |
| | | } |
| | | |
| | | btn.config.enabled = this.setEnabled(btn.config) |
| | | } else { |
| | | errors.push('主表中按钮《' + btn.label + '》配置信息丢失') |
| | | } |
| | |
| | | uuid: btn.uuid, |
| | | MenuID: btn.uuid, |
| | | ParentId: item.uuid, |
| | | enabled: false, |
| | | MenuName: btn.label, |
| | | tables: _config.tables || [], |
| | | Template: 'BaseTable', |
| | |
| | | viewType: 'popview', |
| | | style: { backgroundColor: '#ffffff', backgroundImage: '', paddingTop: '16px', paddingBottom: '40px', paddingLeft: '16px', paddingRight: '16px' } |
| | | } |
| | | |
| | | btn.config.enabled = this.setEnabled(btn.config) |
| | | } else { |
| | | errors.push('主表中按钮《' + btn.label + '》配置信息丢失') |
| | | } |
| | |
| | | } else { |
| | | this.setPopForm(_resolve, _config, formActions, formTabs, errors) |
| | | } |
| | | } |
| | | |
| | | setEnabled = (config) => { |
| | | let enabled = true |
| | | config.components.forEach(item => { |
| | | if (item.type === 'tabs') { |
| | | item.subtabs.forEach(tab => { |
| | | if (tab.components[0].errors.length > 0) { |
| | | enabled = false |
| | | } |
| | | }) |
| | | } else { |
| | | if (item.errors.length > 0) { |
| | | enabled = false |
| | | } |
| | | } |
| | | }) |
| | | |
| | | return enabled |
| | | } |
| | | |
| | | setPopForm = (_resolve, _config, formActions, formTabs, errors) => { |
| | |
| | | }) |
| | | |
| | | tab.components[0].$tables = getTables(tab.components[0]) |
| | | |
| | | tab.components[0].errors = [] |
| | | let columns = tab.components[0].columns.map(c => c.field) |
| | | if (tab.components[0].setting.interType === 'system' && tab.components[0].setting.execute !== 'false' && !tab.components[0].setting.dataresource) { |
| | | tab.components[0].errors.push({ level: 0, detail: '未设置数据源!'}) |
| | | } else if (tab.components[0].setting.interType === 'system' && tab.components[0].setting.execute === 'false' && tab.components[0].scripts.filter(script => script.status !== 'false').length === 0) { |
| | | tab.components[0].errors.push({ level: 0, detail: '数据源中无可用脚本!'}) |
| | | } else if (!tab.components[0].setting.primaryKey) { |
| | | tab.components[0].errors.push({ level: 0, detail: '未设置主键!'}) |
| | | } else if (!columns.includes(tab.components[0].setting.primaryKey)) { |
| | | tab.components[0].errors.push({ level: 0, detail: '主键已失效!'}) |
| | | } else if (!tab.components[0].setting.supModule) { |
| | | tab.components[0].errors.push({ level: 0, detail: '未设置上级组件!'}) |
| | | } |
| | | }) |
| | | } else { |
| | | item.action.forEach(btn => { |
| | |
| | | }) |
| | | |
| | | item.$tables = getTables(item) |
| | | |
| | | item.errors = [] |
| | | let columns = item.columns.map(c => c.field) |
| | | if (item.setting.interType === 'system' && item.setting.execute !== 'false' && !item.setting.dataresource) { |
| | | item.errors.push({ level: 0, detail: '未设置数据源!'}) |
| | | } else if (item.setting.interType === 'system' && item.setting.execute === 'false' && item.scripts.filter(script => script.status !== 'false').length === 0) { |
| | | item.errors.push({ level: 0, detail: '数据源中无可用脚本!'}) |
| | | } else if (!item.setting.primaryKey) { |
| | | item.errors.push({ level: 0, detail: '未设置主键!'}) |
| | | } else if (!columns.includes(item.setting.primaryKey)) { |
| | | item.errors.push({ level: 0, detail: '主键已失效!'}) |
| | | } else if (!item.setting.supModule) { |
| | | item.errors.push({ level: 0, detail: '未设置上级组件!'}) |
| | | } |
| | | } |
| | | }) |
| | | |
| | |
| | | _card.wrap.doubleClick = '' |
| | | } |
| | | |
| | | _card.errors = [] |
| | | let columns = _card.columns.map(c => c.field) |
| | | if (_card.setting.interType === 'system' && _card.setting.execute !== 'false' && !_card.setting.dataresource) { |
| | | _card.errors.push({ level: 0, detail: '未设置数据源!'}) |
| | | } else if (_card.setting.interType === 'system' && _card.setting.execute === 'false' && _card.scripts.filter(script => script.status !== 'false').length === 0) { |
| | | _card.errors.push({ level: 0, detail: '数据源中无可用脚本!'}) |
| | | } else if (!_card.setting.primaryKey) { |
| | | _card.errors.push({ level: 0, detail: '未设置主键!'}) |
| | | } else if (!columns.includes(_card.setting.primaryKey)) { |
| | | _card.errors.push({ level: 0, detail: '主键已失效!'}) |
| | | } else if (!_card.setting.supModule) { |
| | | _card.errors.push({ level: 0, detail: '未设置上级组件!'}) |
| | | } |
| | | |
| | | _card.action.forEach(cell => { |
| | | if (cell.hidden === 'true') return |
| | | if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) { |
| | | if (!cell.modal || cell.modal.fields.length === 0) { |
| | | _card.errors.push({ level: 0, detail: `按钮“${cell.label}”中表单尚未添加`}) |
| | | } |
| | | } else if (cell.OpenType === 'excelIn' && (!cell.verify || !cell.verify.sheet || !cell.verify.columns || cell.verify.columns.length === 0)) { |
| | | _card.errors.push({ level: 0, detail: `按钮“${cell.label}”中导入列未设置!`}) |
| | | } else if (cell.OpenType === 'excelOut' && (!cell.verify || !cell.verify.columns || cell.verify.columns.length === 0)) { |
| | | _card.errors.push({ level: 0, detail: `按钮“${cell.label}”中导出列未设置!`}) |
| | | } |
| | | }) |
| | | |
| | | _card.cols.forEach(col => { |
| | | if (col.type !== 'action') return |
| | | |
| | | col.elements.forEach(cell => { |
| | | if (cell.hidden === 'true') return |
| | | if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) { |
| | | if (!cell.modal || cell.modal.fields.length === 0) { |
| | | _card.errors.push({ level: 0, detail: `按钮“${cell.label}”中表单尚未添加`}) |
| | | } |
| | | } else if (cell.OpenType === 'excelIn' && (!cell.verify || !cell.verify.sheet || !cell.verify.columns || cell.verify.columns.length === 0)) { |
| | | _card.errors.push({ level: 0, detail: `按钮“${cell.label}”中导入列未设置!`}) |
| | | } else if (cell.OpenType === 'excelOut' && (!cell.verify || !cell.verify.columns || cell.verify.columns.length === 0)) { |
| | | _card.errors.push({ level: 0, detail: `按钮“${cell.label}”中导出列未设置!`}) |
| | | } |
| | | }) |
| | | }) |
| | | |
| | | return _card |
| | | } |
| | | |
| | |
| | | visible: false, |
| | | loading: false |
| | | }) |
| | | res.actionfixed = res.actionfixed === 'true' |
| | | |
| | | this.props.updatesetting({...config, setting: res}) |
| | | }, () => { |
| | |
| | | {config.Template === 'CommonTable' ? <Col span={8}> |
| | | <Form.Item label="按钮固定"> |
| | | {getFieldDecorator('actionfixed', { |
| | | initialValue: setting.actionfixed === 'true' || setting.actionfixed === true ? 'true' : 'false' |
| | | initialValue: setting.actionfixed === 'true' ? 'true' : 'false' |
| | | })( |
| | | <Radio.Group> |
| | | <Radio value="true">是</Radio> |