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 | 99 +++++++++++++++++++++++++++++++++---------------- 1 files changed, 66 insertions(+), 33 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 4df974a..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' @@ -440,7 +441,7 @@ let func = new Function('data', col.formula) content = func([record]) } catch (e) { - if (window.debugger) { + if (window.GLOB.debugger === true) { console.warn(e) } content = '' @@ -456,7 +457,7 @@ // eslint-disable-next-line content = eval(content) } catch (e) { - if (window.debugger) { + if (window.GLOB.debugger === true) { console.info(content) console.warn(e) } @@ -849,7 +850,7 @@ let func = new Function('data', col.formula) content = func([record]) } catch (e) { - if (window.debugger) { + if (window.GLOB.debugger === true) { console.warn(e) } content = '' @@ -865,7 +866,7 @@ // eslint-disable-next-line content = eval(content) } catch (e) { - if (window.debugger) { + if (window.GLOB.debugger === true) { console.info(content) console.warn(e) } @@ -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) @@ -1159,7 +1183,7 @@ let mainItems = [] // 浜戠鎴栧崟鐐规暟鎹� let localItems = [] // 鏈湴鏁版嵁 let cache = setting.cache !== 'false' - let debug = window.GLOB.debugger === true || window.debugger === true + let debug = window.GLOB.debugger === true let _sql = `Declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) select @mk_departmentcode='${sessionStorage.getItem('departmentcode') || ''}',@mk_organization='${sessionStorage.getItem('organization') || ''}',@mk_user_type='${sessionStorage.getItem('mk_user_type') || ''}'\n` let _sso = _sql @@ -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) } }) @@ -1674,20 +1710,12 @@ if (submit.intertype === 'system') { // 绯荤粺瀛樺偍杩囩▼ param.func = 'sPC_TableData_InUpDe' - if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 - result.sql = result.sql.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') - result.bottom = result.bottom.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') - } else { - result.sql = result.sql.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') - result.bottom = result.bottom.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') - } - - param.excel_in_type = 'true' - param.LText1 = Utils.formatOptions(result.insert) - param.LText2 = Utils.formatOptions(result.bottom) + delete param.excel_in + + param.exec_type = 'y' param.LText = Utils.formatOptions(result.sql) param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt(param.LText, param.timestamp) + param.secretkey = Utils.encrypt('', param.timestamp) param.menuname = submit.logLabel @@ -1708,6 +1736,11 @@ }) } else if (submit.intertype === 'inner' && submit.innerFunc) { // 鑷畾涔夊瓨鍌ㄨ繃绋� param.func = submit.innerFunc + + if (submit.recordUser === 'true') { + param.username = sessionStorage.getItem('User_Name') || '' + param.fullname = sessionStorage.getItem('Full_Name') || '' + } Api.genericInterface(param).then((res) => { if (res.status) { @@ -1730,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') { // 瀹屾垚鍚庝笉鎻愮ず @@ -1771,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