| | |
| | | getPopupContainer={() => document.getElementById('winter')} |
| | | > |
| | | {item.options.map((option, index) => |
| | | <Select.Option key={index} title={option.text || option.label} value={(option.value || option.field)}> |
| | | <Select.Option key={index} title={option.text || option.label} disabled={option.$disabled || false} value={(option.value || option.field)}> |
| | | {(option.text || option.label)} |
| | | </Select.Option> |
| | | )} |
| | |
| | | * @param {*} functip 生成存储过程提示 |
| | | * @param {*} setting 组件配置 |
| | | * @param {*} usefulFields 存储过程可用的开始字段 |
| | | * @param {*} type 按钮类型,用于区分可选的打开方式 |
| | | */ |
| | | export function getActionForm (card, functip, config, usefulFields, modules = [], anchors = [], side) { |
| | | let appType = sessionStorage.getItem('appType') |
| | |
| | | let appMenus = [] |
| | | let menulist = [] |
| | | let type = '' |
| | | let alltype = config.type + '_' + config.subtype |
| | | |
| | | if (card.eleType === 'button') { |
| | | type = 'card' |
| | |
| | | text: '不刷新' |
| | | }, { |
| | | value: 'line', |
| | | text: '刷新行' |
| | | text: '刷新行', |
| | | $disabled: !['table_normaltable', 'table_editable', 'table_basetable', 'card_datacard', 'card_dualdatacard'].includes(alltype) |
| | | }, { |
| | | value: 'grid', |
| | | text: '刷新当前组件' |
| | | }, { |
| | | value: 'line_grid', |
| | | text: '刷新行 / 组件', |
| | | $disabled: !['table_normaltable', 'table_editable', 'table_basetable', 'card_datacard', 'card_dualdatacard'].includes(alltype) |
| | | }, { |
| | | value: 'mainline', |
| | | text: '刷新上级组件 - 行' |
| | |
| | | text: '不刷新' |
| | | }, { |
| | | value: 'line', |
| | | text: '刷新行' |
| | | text: '刷新行', |
| | | $disabled: !['table_normaltable', 'table_editable', 'table_basetable', 'card_datacard', 'card_dualdatacard'].includes(alltype) |
| | | }, { |
| | | value: 'grid', |
| | | text: '刷新当前组件' |
| | | }, { |
| | | value: 'line_grid', |
| | | text: '刷新行 / 组件', |
| | | $disabled: !['table_normaltable', 'table_editable', 'table_basetable', 'card_datacard', 'card_dualdatacard'].includes(alltype) |
| | | }, { |
| | | value: 'mainline', |
| | | text: '刷新上级组件 - 行' |
| | |
| | | required: false, |
| | | forbid: (type !== 'datacard' || appType !== 'mob'), |
| | | options: [{ |
| | | // value: 'false', |
| | | // text: '否' |
| | | // }, { |
| | | value: 'left', |
| | | text: '左滑' |
| | | }, { |
| | |
| | | value: 'grid', |
| | | text: '刷新当前组件' |
| | | }, { |
| | | value: 'line_grid', |
| | | text: '刷新行 / 组件', |
| | | }, { |
| | | value: 'mainline', |
| | | text: '刷新上级组件 - 行' |
| | | }, |
| | |
| | | value: 'grid', |
| | | text: '刷新当前组件' |
| | | }, { |
| | | value: 'line_grid', |
| | | text: '刷新行 / 组件', |
| | | }, { |
| | | value: 'mainline', |
| | | text: '刷新上级组件 - 行' |
| | | }, |
| | |
| | | }) |
| | | }) |
| | | |
| | | editCols.push({ |
| | | field: '$next_' + card.uuid, |
| | | label: card.label + '(下一行)' |
| | | }) |
| | | |
| | | return [ |
| | | { |
| | | type: 'text', |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { fromJS } from 'immutable' |
| | | import { Form, Tabs, Row, Col, Input, Button, Popconfirm, notification, Modal, message, Cascader, Tooltip, InputNumber, Radio, Typography } from 'antd' |
| | | import { Form, Tabs, Row, Col, Input, Button, Popconfirm, notification, Modal, message, Select, Cascader, Tooltip, InputNumber, Radio, Typography } from 'antd' |
| | | import { StopTwoTone, CheckCircleTwoTone, EditOutlined, SwapOutlined, DeleteOutlined, QuestionCircleOutlined } from '@ant-design/icons' |
| | | import moment from 'moment' |
| | | |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { config } = this.props |
| | | const { verify, scriptsColumns, uniqueColumns, activeKey, fields, modules } = this.state |
| | | const formItemLayout = { |
| | | labelCol: { |
| | |
| | | </Form.Item> |
| | | </Col> : null} |
| | | <Col span={8}> |
| | | <Form.Item label={'成功后'}> |
| | | <Radio.Group style={{whiteSpace: 'nowrap'}} value={verify.execSuccess} onChange={(e) => this.onOptionChange(e.target.value, 'execSuccess')}> |
| | | <Radio value="never">不刷新</Radio> |
| | | <Radio value="grid">刷新表格</Radio> |
| | | <Radio value="mainline">上级(行)</Radio> |
| | | </Radio.Group> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="《刷新行》与《刷新行 / 组件》只在数据提交为 修改项 时有效。"> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 成功后 |
| | | </Tooltip> |
| | | }> |
| | | <Select value={verify.execSuccess} onChange={(val) => this.onOptionChange(val, 'execSuccess')}> |
| | | <Select.Option value="never">不刷新</Select.Option> |
| | | <Select.Option value="line" disabled={config.wrap.commit !== 'change'}>刷新行</Select.Option> |
| | | <Select.Option value="grid">刷新组件</Select.Option> |
| | | <Select.Option value="line_grid" disabled={config.wrap.commit !== 'change'}>刷新行 / 组件</Select.Option> |
| | | <Select.Option value="mainline">上级(行)</Select.Option> |
| | | </Select> |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={8}> |
| | | <Form.Item label={'失败后'}> |
| | | <Radio.Group style={{whiteSpace: 'nowrap'}} value={verify.execError} onChange={(e) => this.onOptionChange(e.target.value, 'execError')}> |
| | | <Radio value="never">不刷新</Radio> |
| | | <Radio value="grid">刷新表格</Radio> |
| | | <Radio value="mainline">上级(行)</Radio> |
| | | </Radio.Group> |
| | | <Form.Item label="失败后"> |
| | | <Select value={verify.execError} onChange={(val) => this.onOptionChange(val, 'execError')}> |
| | | <Select.Option value="never">不刷新</Select.Option> |
| | | <Select.Option value="line" disabled={config.wrap.commit !== 'change'}>刷新行</Select.Option> |
| | | <Select.Option value="grid">刷新组件</Select.Option> |
| | | <Select.Option value="line_grid" disabled={config.wrap.commit !== 'change'}>刷新行 / 组件</Select.Option> |
| | | <Select.Option value="mainline">上级(行)</Select.Option> |
| | | </Select> |
| | | </Form.Item> |
| | | </Col> |
| | | {isPop ? <Col span={8}> |
| | | <Form.Item label={'成功后'}> |
| | | <Form.Item label="成功后"> |
| | | <Radio.Group style={{whiteSpace: 'nowrap'}} value={verify.closetab || 'false'} onChange={(e) => this.onOptionChange(e.target.value, 'closetab')}> |
| | | <Radio value="false">标签不关闭</Radio> |
| | | <Radio value="true">标签关闭</Radio> |
| | |
| | | }, i * 10) |
| | | }) |
| | | } else { |
| | | if (position === 'line') { |
| | | if (position === 'line' || position === 'line_grid') { |
| | | if (lines && lines.length === 1) { |
| | | this.loadLinedata(lines[0].$$uuid) |
| | | this.loadLinedata(lines[0].$$uuid, position) |
| | | } else { |
| | | this.loadData(id) |
| | | } |
| | |
| | | } else { |
| | | let supModule = config.setting.supModule |
| | | |
| | | if (position === 'line') { |
| | | if (position === 'line' || position === 'line_grid') { |
| | | if (lines && lines.length === 1) { |
| | | this.loadLinedata(lines[0].$$uuid) |
| | | this.loadLinedata(lines[0].$$uuid, position) |
| | | } else { |
| | | this.loadData(id) |
| | | } |
| | |
| | | /** |
| | | * @description 获取单行数据 |
| | | */ |
| | | async loadLinedata (id) { |
| | | async loadLinedata (id, position) { |
| | | const { config, pageIndex, pageSize, search, BID, BData, orderBy } = this.state |
| | | |
| | | if (config.forbidLine) { |
| | |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | if (position === 'line_grid' && (!result.data || !result.data[0])) { |
| | | this.loadData() |
| | | return |
| | | } |
| | | |
| | | let data = fromJS(this.state.data).toJS() |
| | | let selectedData = fromJS(this.state.selectedData).toJS() |
| | | let selectKeys = fromJS(this.state.selectKeys).toJS() |
| | |
| | | |
| | | let supModule = config.setting.supModule |
| | | |
| | | if (position === 'line') { |
| | | if (position === 'line' || position === 'line_grid') { |
| | | if (lines && lines.length === 1) { |
| | | this.loadLinedata(lines[0].$$parentId || lines[0].$$uuid) |
| | | this.loadLinedata(lines[0].$$parentId || lines[0].$$uuid, position) |
| | | } else { |
| | | this.loadData(id) |
| | | } |
| | |
| | | /** |
| | | * @description 获取单行数据 |
| | | */ |
| | | async loadLinedata (id) { |
| | | async loadLinedata (id, position) { |
| | | const { config, pageIndex, pageSize, search, BID, BData, orderBy } = this.state |
| | | |
| | | if (config.forbidLine) { |
| | |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | if (position === 'line_grid' && (!result.data || !result.data[0])) { |
| | | this.loadData() |
| | | return |
| | | } |
| | | |
| | | let data = fromJS(this.state.data).toJS() |
| | | let selectedData = fromJS(this.state.selectedData).toJS() |
| | | let selectKeys = fromJS(this.state.selectKeys).toJS() |
| | |
| | | /** |
| | | * @description 获取单行数据 |
| | | */ |
| | | async loadmainLinedata (id) { |
| | | async loadLinedata (id, position) { |
| | | const { setting, config, search, orderBy, BID, pageIndex, pageSize, BData } = this.state |
| | | |
| | | if (config.forbidLine) { |
| | |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | if (position === 'line_grid' && (!result.data || !result.data[0])) { |
| | | this.loadmaindata(true, 'false') |
| | | return |
| | | } |
| | | |
| | | let data = fromJS(this.state.data).toJS() |
| | | let selectedData = fromJS(this.state.selectedData).toJS() |
| | | |
| | |
| | | if (!id) { |
| | | this.reloadtable() |
| | | } else { |
| | | this.loadmainLinedata(id) |
| | | this.loadLinedata(id) |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | if (config.uuid !== menuId) return |
| | | |
| | | if (position === 'line') { |
| | | if (position === 'line' || position === 'line_grid') { |
| | | if (lines && lines.length === 1) { |
| | | this.loadmainLinedata(lines[0].$$uuid) |
| | | this.loadLinedata(lines[0].$$uuid, position) |
| | | } else { |
| | | this.reloadtable(btn, id) |
| | | } |
| | |
| | | /** |
| | | * @description 获取单行数据 |
| | | */ |
| | | async loadmainLinedata (id) { |
| | | async loadLinedata (id, position) { |
| | | const { setting, config, search, orderBy, BID, pageIndex, pageSize, BData } = this.state |
| | | |
| | | if (config.forbidLine) { |
| | |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | if (position === 'line_grid' && (!result.data || !result.data[0])) { |
| | | this.loadmaindata(true, 'false') |
| | | return |
| | | } |
| | | |
| | | if (!result.data || !result.data[0]) { |
| | | let data = fromJS(this.state.data).toJS() |
| | | let selectedData = fromJS(this.state.selectedData).toJS() |
| | | |
| | | data = data.filter(item => item.$$uuid !== id) |
| | | selectedData = selectedData.filter(item => item.$$uuid !== id) |
| | | |
| | | MKEmitter.emit('transferData' + setting.tableId, id, 'delete') |
| | | |
| | | this.setState({ |
| | | data, |
| | | selectedData, |
| | | loading: false |
| | | }) |
| | | |
| | | return |
| | | } |
| | | |
| | |
| | | if (!id) { |
| | | this.reloadtable() |
| | | } else { |
| | | this.loadmainLinedata(id) |
| | | this.loadLinedata(id) |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | if (config.uuid !== menuId) return |
| | | |
| | | if (position === 'line') { |
| | | if (position === 'line' || position === 'line_grid') { |
| | | if (lines && lines.length === 1) { |
| | | this.loadmainLinedata(lines[0].$$uuid) |
| | | this.loadLinedata(lines[0].$$uuid, position) |
| | | } else { |
| | | this.reloadtable(btn) |
| | | } |
| | |
| | | timer = null |
| | | focusId = '' |
| | | blurId = '' |
| | | colId = '' |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { setting, fields, columns, BID, colsCtrls } = this.props |
| | |
| | | }, 150) |
| | | } |
| | | |
| | | colFocus = (lineId) => { |
| | | colFocus = (lineId, colId) => { |
| | | this.focusId = lineId |
| | | this.colId = colId |
| | | } |
| | | |
| | | checkLine = () => { |
| | |
| | | } |
| | | |
| | | transferData = (data, type) => { |
| | | const { edData } = this.state |
| | | const { edData, tableId } = this.state |
| | | |
| | | if (type === 'line') { |
| | | if (type === 'delete') { |
| | | |
| | | } else if (type === 'line') { |
| | | let value = '' |
| | | Object.keys(data).sort().forEach(key => { |
| | | if (/^\$/.test(key)) return |
| | |
| | | }) |
| | | } |
| | | |
| | | if (type !== 'line') { |
| | | let index = edData.findIndex(item => !item.$origin && !item.$forbid) |
| | | if (type === 'delete') { |
| | | let _edData = this.state.edData.filter(item => item.$$uuid !== data) |
| | | |
| | | if (index > -1) { |
| | | this.setState({visible: true, midData: data}) |
| | | } else { |
| | | this.updateMutil(data) |
| | | this.setState({edData: _edData, reseting: true}, () => { |
| | | this.setState({reseting: false}) |
| | | |
| | | if (this.focusId) { |
| | | setTimeout(() => { |
| | | MKEmitter.emit('setFocus' + tableId, this.focusId, this.colId) |
| | | }, 10) |
| | | } |
| | | }) |
| | | } else if (type === 'line') { |
| | | let _edData = this.state.edData.map(item => { |
| | | if (item.$$uuid === data.$$uuid) { |
| | |
| | | |
| | | this.setState({edData: _edData, reseting: true}, () => { |
| | | this.setState({reseting: false}) |
| | | |
| | | if (this.focusId) { |
| | | setTimeout(() => { |
| | | MKEmitter.emit('setFocus' + tableId, this.focusId, this.colId) |
| | | }, 10) |
| | | } |
| | | }) |
| | | } else { |
| | | let index = edData.findIndex(item => !item.$origin && !item.$forbid) |
| | | |
| | | if (index > -1) { |
| | | this.setState({visible: true, midData: data}) |
| | | } else { |
| | | this.updateMutil(data) |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | Api.genericInterface(param).then((res) => { |
| | | if (res.status) { |
| | | this.execSuccess(res) |
| | | this.execSuccess(res, record) |
| | | } else { |
| | | this.execError(res) |
| | | this.execError(res, record) |
| | | } |
| | | }, (error) => { |
| | | if (error && error.ErrCode === 'LoginError') return |
| | |
| | | |
| | | Api.genericInterface(param).then((res) => { |
| | | if (res.status) { |
| | | this.execSuccess(res) |
| | | this.execSuccess(res, record) |
| | | } else { |
| | | this.execError(res) |
| | | this.execError(res, record) |
| | | } |
| | | }, (error) => { |
| | | if (error && error.ErrCode === 'LoginError') return |
| | |
| | | } |
| | | } |
| | | |
| | | execSuccess = (res) => { |
| | | execSuccess = (res, record) => { |
| | | const { submit } = this.props |
| | | const { edData } = this.state |
| | | |
| | |
| | | } |
| | | |
| | | if (submit.execSuccess !== 'never') { |
| | | MKEmitter.emit('refreshByButtonResult', submit.$menuId, submit.execSuccess, submit) |
| | | MKEmitter.emit('refreshByButtonResult', submit.$menuId, submit.execSuccess, submit, '', record ? [record] : null) |
| | | } |
| | | |
| | | submit.syncComponentId && MKEmitter.emit('reloadData', submit.syncComponentId) |
| | | } |
| | | |
| | | execError = (res) => { |
| | | execError = (res, record) => { |
| | | const { submit } = this.props |
| | | |
| | | if (res.ErrCode === 'E') { |
| | |
| | | }) |
| | | |
| | | if (submit.execError !== 'never') { |
| | | MKEmitter.emit('refreshByButtonResult', submit.$menuId, submit.execError, submit) |
| | | MKEmitter.emit('refreshByButtonResult', submit.$menuId, submit.execError, submit, '', record ? [record] : null) |
| | | } |
| | | } |
| | | |
| | |
| | | /** |
| | | * @description 获取单行数据 |
| | | */ |
| | | async loadmainLinedata (id) { |
| | | async loadLinedata (id, position) { |
| | | const { setting, config, search, orderBy, BID, pageIndex, pageSize, BData } = this.state |
| | | |
| | | if (config.forbidLine) { |
| | |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | if (position === 'line_grid' && (!result.data || !result.data[0])) { |
| | | this.loadmaindata(true, 'false') |
| | | return |
| | | } |
| | | |
| | | let data = fromJS(this.state.data).toJS() |
| | | let selectedData = fromJS(this.state.selectedData).toJS() |
| | | |
| | |
| | | if (!id) { |
| | | this.reloadtable() |
| | | } else { |
| | | this.loadmainLinedata(id) |
| | | this.loadLinedata(id) |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | if (config.uuid !== menuId) return |
| | | |
| | | if (position === 'line') { |
| | | if (position === 'line' || position === 'line_grid') { |
| | | if (lines && lines.length === 1) { |
| | | this.loadmainLinedata(lines[0].$$uuid) |
| | | this.loadLinedata(lines[0].$$uuid, position) |
| | | } else { |
| | | this.reloadtable(btn, id) |
| | | } |