From ae46c8e640ed64abd7605b289554377e0cdc0cb7 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 04 十月 2023 22:10:30 +0800
Subject: [PATCH] 2023-10-04

---
 src/tabviews/custom/components/table/edit-table/normalTable/index.jsx |  101 +++++++++++++++++++++++++++++++++-----------------
 1 files changed, 67 insertions(+), 34 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 b7e5af0..5f5eb04 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,9 +441,7 @@
           let func = new Function('data', col.formula)
           content = func([record])
         } catch (e) {
-          if (window.GLOB.debugger === true) {
-            console.warn(e)
-          }
+          console.warn(e)
           content = ''
         }
       } else {
@@ -456,10 +455,8 @@
             // eslint-disable-next-line
             content = eval(content)
           } catch (e) {
-            if (window.GLOB.debugger === true) {
-              console.info(content)
-              console.warn(e)
-            }
+            console.info(content)
+            console.warn(e)
             content = ''
           }
         }
@@ -849,9 +846,7 @@
           let func = new Function('data', col.formula)
           content = func([record])
         } catch (e) {
-          if (window.GLOB.debugger === true) {
-            console.warn(e)
-          }
+          console.warn(e)
           content = ''
         }
       } else {
@@ -865,10 +860,8 @@
             // eslint-disable-next-line
             content = eval(content)
           } catch (e) {
-            if (window.GLOB.debugger === true) {
-              console.info(content)
-              console.warn(e)
-            }
+            console.info(content)
+            console.warn(e)
             content = ''
           }
         }
@@ -947,6 +940,7 @@
     pageSize: 10,         // 姣忛〉鏁版嵁鏉℃暟
     columns: null,        // 鏄剧ず鍒�
     forms: [],
+    signForms: [],
     orderfields: {},      // 鎺掑簭id涓巉ield杞崲
     loading: false,
     pageOptions: [],
@@ -963,6 +957,7 @@
     let deForms = []
     let _forms = {}
     let hasBid = false
+    let signForms = []
 
     let getColumns = (cols) => {
       return cols.map(item => {
@@ -974,6 +969,8 @@
         } else {
           if (item.editable === 'true') {
             _forms[item.field] = item
+
+            signForms.push(item.field)
 
             if (item.ctrlField) {
               item.ctrlValue = item.ctrlValue.split(',')
@@ -1046,6 +1043,7 @@
 
     this.setState({
       forms,
+      signForms,
       pageSize: setting.pageSize || 10,
       pageOptions,
       columns: _columns,
@@ -1108,10 +1106,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 +1477,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 +1509,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,12 +1702,12 @@
     if (submit.intertype === 'system') { // 绯荤粺瀛樺偍杩囩▼
       param.func = 'sPC_TableData_InUpDe'
       
-      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
 
@@ -1700,6 +1728,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) {
@@ -1722,12 +1755,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') { // 瀹屾垚鍚庝笉鎻愮ず
 
@@ -1763,23 +1796,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