From f6dbdd98a13296455b8efc5dadd6e9e4eaa63693 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 11 九月 2023 18:04:37 +0800 Subject: [PATCH] 2023-09-11 --- src/tabviews/custom/components/table/edit-table/normalTable/index.jsx | 68 ++++++++++++++++++++++++++-------- 1 files changed, 52 insertions(+), 16 deletions(-) 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 10f41bf..4ce4d1b 100644 --- a/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx +++ b/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx @@ -4,6 +4,7 @@ import { Table, Typography, Modal, Input, InputNumber, Button, notification, message, Select } from 'antd' import { EditOutlined, QuestionCircleOutlined } from '@ant-design/icons' import moment from 'moment' +import md5 from 'md5' import Api from '@/api' import asyncComponent from '@/utils/asyncComponent' @@ -947,6 +948,7 @@ pageSize: 10, // 姣忛〉鏁版嵁鏉℃暟 columns: null, // 鏄剧ず鍒� forms: [], + signForms: [], orderfields: {}, // 鎺掑簭id涓巉ield杞崲 loading: false, pageOptions: [], @@ -963,6 +965,7 @@ let deForms = [] let _forms = {} let hasBid = false + let signForms = [] let getColumns = (cols) => { return cols.map(item => { @@ -974,6 +977,8 @@ } else { if (item.editable === 'true') { _forms[item.field] = item + + signForms.push(item.field) if (item.ctrlField) { item.ctrlValue = item.ctrlValue.split(',') @@ -1046,6 +1051,7 @@ this.setState({ forms, + signForms, pageSize: setting.pageSize || 10, pageOptions, columns: _columns, @@ -1108,10 +1114,28 @@ } transferData = (menuid, data, type) => { - const { MenuID } = this.props - const { edData } = this.state + const { MenuID, setting } = this.props + const { edData, signForms } = this.state if (menuid !== MenuID) return + + if (setting.commit !== 'all' && setting.standard !== 'change') { + if (type !== 'line') { + data.forEach(item => { + let value = '' + signForms.forEach(field => { + value += item[field] + }) + item.$sign = md5(value) + }) + } else { + let value = '' + signForms.forEach(field => { + value += data[field] + }) + data.$sign = md5(value) + } + } if (type !== 'line') { let index = edData.findIndex(item => !item.$origin && !item.$forbid) @@ -1461,19 +1485,31 @@ changeRecord = (id, record) => { const { setting } = this.props - const { tableId } = this.state + const { tableId, signForms } = this.state if (id !== tableId) return - let lock = record.$lock + if (!record.$sign) { + record.$origin = false + record.$lock = true + delete record.$forbid + } else { + let value = '' + signForms.forEach(field => { + value += record[field] + }) + + if (record.$sign !== md5(value)) { + record.$origin = false + record.$lock = true + } else { + record.$origin = true + record.$lock = false + } + } let _data = this.state.edData.map(item => { if (item.$$uuid === record.$$uuid) { - record.$origin = false - record.$lock = true - - delete record.$forbid - return record } else { return item @@ -1481,7 +1517,7 @@ }) this.setState({edData: _data}, () => { - if (setting.tableType && setting.hasAction && !lock && this.state.selectedRowKeys.includes(record.$$uuid)) { + if (setting.tableType && setting.hasAction && this.state.selectedRowKeys.includes(record.$$uuid)) { this.selectdata(this.state.selectedRowKeys) } }) @@ -1727,12 +1763,12 @@ if (res && res.ErrCode === 'S') { // 鎵ц鎴愬姛 notification.success({ top: 92, - message: res.ErrMesg || '鎵ц鎴愬姛', + message: res.message || '鎵ц鎴愬姛', duration: submit.stime ? submit.stime : 2 }) } else if (res && res.ErrCode === 'Y') { // 鎵ц鎴愬姛 Modal.success({ - title: res.ErrMesg || '鎵ц鎴愬姛' + title: res.message || '鎵ц鎴愬姛' }) } else if (res && res.ErrCode === '-1') { // 瀹屾垚鍚庝笉鎻愮ず @@ -1768,23 +1804,23 @@ if (res.ErrCode === 'E') { Modal.error({ - title: res.message || res.ErrMesg, + title: res.message || '鎵ц澶辫触锛�', }) } else if (res.ErrCode === 'N') { notification.error({ top: 92, - message: res.message || res.ErrMesg, + message: res.message || '鎵ц澶辫触锛�', duration: submit.ntime ? submit.ntime : 10 }) } else if (res.ErrCode === 'F') { notification.error({ className: 'notification-custom-error', top: 92, - message: res.message || res.ErrMesg, + message: res.message || '鎵ц澶辫触锛�', duration: submit.ftime ? submit.ftime : 10 }) } else if (res.ErrCode === 'NM') { - message.error(res.message || res.ErrMesg) + message.error(res.message || '鎵ц澶辫触锛�') } this.setState({ -- Gitblit v1.8.0