From 2388f6ea547f53b20a4b9b64efc8aa6dc33e013b Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 06 十一月 2023 15:23:54 +0800 Subject: [PATCH] 2023-11-06 --- src/tabviews/custom/components/table/edit-table/index.jsx | 24 ++++- src/menu/components/share/actioncomponent/actionform/index.jsx | 2 src/tabviews/custom/components/table/base-table/index.jsx | 13 ++- src/menu/components/table/edit-table/columns/tableIn/index.jsx | 38 ++++++--- src/menu/components/share/actioncomponent/formconfig.jsx | 25 ++++- src/tabviews/custom/components/card/double-data-card/index.jsx | 11 ++ src/tabviews/custom/components/table/normal-table/index.jsx | 13 ++- src/tabviews/custom/components/card/data-card/index.jsx | 15 ++- src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx | 5 + src/tabviews/custom/components/table/edit-table/normalTable/index.jsx | 58 ++++++++++---- 10 files changed, 144 insertions(+), 60 deletions(-) diff --git a/src/menu/components/share/actioncomponent/actionform/index.jsx b/src/menu/components/share/actioncomponent/actionform/index.jsx index c02a963..69a6138 100644 --- a/src/menu/components/share/actioncomponent/actionform/index.jsx +++ b/src/menu/components/share/actioncomponent/actionform/index.jsx @@ -874,7 +874,7 @@ 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> )} diff --git a/src/menu/components/share/actioncomponent/formconfig.jsx b/src/menu/components/share/actioncomponent/formconfig.jsx index 0169f0f..20df933 100644 --- a/src/menu/components/share/actioncomponent/formconfig.jsx +++ b/src/menu/components/share/actioncomponent/formconfig.jsx @@ -7,7 +7,6 @@ * @param {*} functip 鐢熸垚瀛樺偍杩囩▼鎻愮ず * @param {*} setting 缁勪欢閰嶇疆 * @param {*} usefulFields 瀛樺偍杩囩▼鍙敤鐨勫紑濮嬪瓧娈� - * @param {*} type 鎸夐挳绫诲瀷锛岀敤浜庡尯鍒嗗彲閫夌殑鎵撳紑鏂瑰紡 */ export function getActionForm (card, functip, config, usefulFields, modules = [], anchors = [], side) { let appType = sessionStorage.getItem('appType') @@ -17,6 +16,7 @@ let appMenus = [] let menulist = [] let type = '' + let alltype = config.type + '_' + config.subtype if (card.eleType === 'button') { type = 'card' @@ -610,10 +610,15 @@ 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: '鍒锋柊涓婄骇缁勪欢 - 琛�' @@ -633,10 +638,15 @@ 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: '鍒锋柊涓婄骇缁勪欢 - 琛�' @@ -712,9 +722,6 @@ required: false, forbid: (type !== 'datacard' || appType !== 'mob'), options: [{ - // value: 'false', - // text: '鍚�' - // }, { value: 'left', text: '宸︽粦' }, { @@ -1725,6 +1732,9 @@ value: 'grid', text: '鍒锋柊褰撳墠缁勪欢' }, { + value: 'line_grid', + text: '鍒锋柊琛� / 缁勪欢', + }, { value: 'mainline', text: '鍒锋柊涓婄骇缁勪欢 - 琛�' }, @@ -1747,6 +1757,9 @@ value: 'grid', text: '鍒锋柊褰撳墠缁勪欢' }, { + value: 'line_grid', + text: '鍒锋柊琛� / 缁勪欢', + }, { value: 'mainline', text: '鍒锋柊涓婄骇缁勪欢 - 琛�' }, diff --git a/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx b/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx index 0c32473..9f4eb5c 100644 --- a/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx +++ b/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx @@ -88,6 +88,11 @@ }) }) + editCols.push({ + field: '$next_' + card.uuid, + label: card.label + '锛堜笅涓�琛岋級' + }) + return [ { type: 'text', diff --git a/src/menu/components/table/edit-table/columns/tableIn/index.jsx b/src/menu/components/table/edit-table/columns/tableIn/index.jsx index ec97661..ff8d86f 100644 --- a/src/menu/components/table/edit-table/columns/tableIn/index.jsx +++ b/src/menu/components/table/edit-table/columns/tableIn/index.jsx @@ -1,7 +1,7 @@ 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' @@ -498,6 +498,7 @@ } render() { + const { config } = this.props const { verify, scriptsColumns, uniqueColumns, activeKey, fields, modules } = this.state const formItemLayout = { labelCol: { @@ -552,25 +553,34 @@ </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> diff --git a/src/tabviews/custom/components/card/data-card/index.jsx b/src/tabviews/custom/components/card/data-card/index.jsx index 9cc9fcd..55ada26 100644 --- a/src/tabviews/custom/components/card/data-card/index.jsx +++ b/src/tabviews/custom/components/card/data-card/index.jsx @@ -398,9 +398,9 @@ }, 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) } @@ -417,9 +417,9 @@ } 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) } @@ -870,7 +870,7 @@ /** * @description 鑾峰彇鍗曡鏁版嵁 */ - async loadLinedata (id) { + async loadLinedata (id, position) { const { config, pageIndex, pageSize, search, BID, BData, orderBy } = this.state if (config.forbidLine) { @@ -902,6 +902,11 @@ 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() diff --git a/src/tabviews/custom/components/card/double-data-card/index.jsx b/src/tabviews/custom/components/card/double-data-card/index.jsx index bda5137..a7f73d6 100644 --- a/src/tabviews/custom/components/card/double-data-card/index.jsx +++ b/src/tabviews/custom/components/card/double-data-card/index.jsx @@ -336,9 +336,9 @@ 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) } @@ -771,7 +771,7 @@ /** * @description 鑾峰彇鍗曡鏁版嵁 */ - async loadLinedata (id) { + async loadLinedata (id, position) { const { config, pageIndex, pageSize, search, BID, BData, orderBy } = this.state if (config.forbidLine) { @@ -803,6 +803,11 @@ 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() diff --git a/src/tabviews/custom/components/table/base-table/index.jsx b/src/tabviews/custom/components/table/base-table/index.jsx index 91cbbff..538a792 100644 --- a/src/tabviews/custom/components/table/base-table/index.jsx +++ b/src/tabviews/custom/components/table/base-table/index.jsx @@ -261,7 +261,7 @@ /** * @description 鑾峰彇鍗曡鏁版嵁 */ - async loadmainLinedata (id) { + async loadLinedata (id, position) { const { setting, config, search, orderBy, BID, pageIndex, pageSize, BData } = this.state if (config.forbidLine) { @@ -289,6 +289,11 @@ 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() @@ -547,7 +552,7 @@ if (!id) { this.reloadtable() } else { - this.loadmainLinedata(id) + this.loadLinedata(id) } } @@ -578,9 +583,9 @@ 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) } diff --git a/src/tabviews/custom/components/table/edit-table/index.jsx b/src/tabviews/custom/components/table/edit-table/index.jsx index bcc54c6..6cc0650 100644 --- a/src/tabviews/custom/components/table/edit-table/index.jsx +++ b/src/tabviews/custom/components/table/edit-table/index.jsx @@ -388,7 +388,7 @@ /** * @description 鑾峰彇鍗曡鏁版嵁 */ - async loadmainLinedata (id) { + async loadLinedata (id, position) { const { setting, config, search, orderBy, BID, pageIndex, pageSize, BData } = this.state if (config.forbidLine) { @@ -416,11 +416,25 @@ 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 } @@ -560,7 +574,7 @@ if (!id) { this.reloadtable() } else { - this.loadmainLinedata(id) + this.loadLinedata(id) } } @@ -592,9 +606,9 @@ 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) } diff --git a/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx b/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx index 4c039a7..fcdad35 100644 --- a/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx +++ b/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx @@ -1345,6 +1345,7 @@ timer = null focusId = '' blurId = '' + colId = '' UNSAFE_componentWillMount () { const { setting, fields, columns, BID, colsCtrls } = this.props @@ -1562,8 +1563,9 @@ }, 150) } - colFocus = (lineId) => { + colFocus = (lineId, colId) => { this.focusId = lineId + this.colId = colId } checkLine = () => { @@ -1705,9 +1707,11 @@ } 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 @@ -1725,14 +1729,18 @@ }) } - 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) { @@ -1744,7 +1752,21 @@ 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) + } } } @@ -2298,9 +2320,9 @@ 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 @@ -2317,9 +2339,9 @@ 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 @@ -2329,7 +2351,7 @@ } } - execSuccess = (res) => { + execSuccess = (res, record) => { const { submit } = this.props const { edData } = this.state @@ -2379,13 +2401,13 @@ } 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') { @@ -2414,7 +2436,7 @@ }) if (submit.execError !== 'never') { - MKEmitter.emit('refreshByButtonResult', submit.$menuId, submit.execError, submit) + MKEmitter.emit('refreshByButtonResult', submit.$menuId, submit.execError, submit, '', record ? [record] : null) } } diff --git a/src/tabviews/custom/components/table/normal-table/index.jsx b/src/tabviews/custom/components/table/normal-table/index.jsx index 97af3a8..136a42c 100644 --- a/src/tabviews/custom/components/table/normal-table/index.jsx +++ b/src/tabviews/custom/components/table/normal-table/index.jsx @@ -539,7 +539,7 @@ /** * @description 鑾峰彇鍗曡鏁版嵁 */ - async loadmainLinedata (id) { + async loadLinedata (id, position) { const { setting, config, search, orderBy, BID, pageIndex, pageSize, BData } = this.state if (config.forbidLine) { @@ -567,6 +567,11 @@ 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() @@ -743,7 +748,7 @@ if (!id) { this.reloadtable() } else { - this.loadmainLinedata(id) + this.loadLinedata(id) } } @@ -774,9 +779,9 @@ 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) } -- Gitblit v1.8.0