From 2bccb9ec7bdefe23292a22bc153463cfa1479a49 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 21 六月 2024 16:25:42 +0800
Subject: [PATCH] 2024-06-21

---
 src/tabviews/custom/components/table/edit-table/normalTable/index.jsx |   78 ++++++++++++++++++++------------------
 1 files changed, 41 insertions(+), 37 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 4aba73f..9529a8e 100644
--- a/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx
+++ b/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx
@@ -1383,7 +1383,8 @@
     allColumns: null,
     checkForms: [],
     allForms: [],
-    reseting: false
+    reseting: false,
+    dict: window.GLOB.dict
   }
 
   timer = null
@@ -1625,7 +1626,7 @@
   }
 
   checkLine = () => {
-    const { edData, forms, checkForms } = this.state
+    const { edData, forms, checkForms, dict } = this.state
 
     let data = edData.filter(item => item.$$uuid === this.blurId)[0]
 
@@ -1668,7 +1669,7 @@
       if (col.type === 'text') {
         let val = record[col.field] !== undefined ? (record[col.field] + '') : ''
         if (col.required === 'true' && !val) {
-          err = `${col.label}涓嶅彲涓虹┖`
+          err = `${col.label}${dict['not_empty'] || '涓嶅彲涓虹┖'}`
         } else if (col.datatype === 'datetime' && !val) {
           val = '1949-10-01'
         }
@@ -1677,27 +1678,27 @@
         let val = record[col.field]
 
         if (col.required === 'true' && !val) {
-          err = `${col.label}涓嶅彲涓�${col.noValue === 'hide' ? '绌�' : '0'}`
+          err = `${col.label}${col.noValue === 'hide' ? (dict['not_empty'] || '涓嶅彲涓虹┖') : dict['not_zero'] || '涓嶅彲涓�0'}`
         } else if (col.noValue === 'hide' && !val) {
           if (col.clearField && checkForms.includes(col.clearField) && !record[col.clearField]) {
-            err = `璇峰~鍐� ${col.label} 鎴� ${col.clearName}`
+            err = `${dict['input_tip'] || '璇峰~鍐� '}${col.label} ${dict['or'] || '鎴�'} ${col.clearName}`
           }
           val = 0
         } else if (!val && val !== 0) {
-          err = `${col.label}涓嶅彲涓虹┖`
+          err = `${col.label}${dict['not_empty'] || '涓嶅彲涓虹┖'}`
         } else {
           val = +val
           if (isNaN(val)) {
-            err = `${col.label}鏁版嵁鏍煎紡閿欒`
+            err = `${col.label} ${dict['data_format'] || '鏁版嵁鏍煎紡閿欒'}`
             return
           }
   
           val = +val.toFixed(col.decimal || 0)
           
           if (typeof(col.max) === 'number' && val > col.max) {
-            err = `${col.label}涓嶅彲澶т簬${col.max}`
+            err = `${col.label}${dict['max_limit'] || ' 涓嶅彲澶т簬 '}${col.max}`
           } else if (typeof(col.min) === 'number' && val < col.min) {
-            err = `${col.label}涓嶅彲灏忎簬${col.min}`
+            err = `${col.label}${dict['less_limit'] || ' 涓嶅彲灏忎簬 '}${col.min}`
           }
         }
 
@@ -2230,7 +2231,7 @@
 
   checkData = () => {
     const { setting } = this.props
-    const { edData, forms, checkForms, selectedRowKeys } = this.state
+    const { edData, forms, checkForms, selectedRowKeys, dict } = this.state
 
     let data = fromJS(edData).toJS()
 
@@ -2244,7 +2245,7 @@
       if (data.length === 0) {
         notification.warning({
           top: 92,
-          message: '璇烽�夋嫨闇�瑕佹彁浜ょ殑鏁版嵁锛�',
+          message: dict['select_row'] || '璇烽�夋嫨闇�瑕佹彁浜ょ殑鏁版嵁锛�',
           duration: 5
         })
         return null
@@ -2254,7 +2255,7 @@
     if (data.length === 0) {
       notification.warning({
         top: 92,
-        message: '鏁版嵁鏈慨鏀癸紝涓嶅彲鎻愪氦锛�',
+        message: dict['un_modified'] || '鏁版嵁鏈慨鏀癸紝涓嶅彲鎻愪氦锛�',
         duration: 5
       })
       return null
@@ -2288,7 +2289,7 @@
         if (col.type === 'text') {
           let val = item[col.field] !== undefined ? (item[col.field] + '') : ''
           if (col.required === 'true' && !val) {
-            line.push(`${col.label}涓嶅彲涓虹┖`)
+            line.push(`${col.label}${dict['not_empty'] || '涓嶅彲涓虹┖'}`)
           } else if (col.datatype === 'datetime' && !val) {
             val = '1949-10-01'
           }
@@ -2296,31 +2297,31 @@
         } else if (col.type === 'number') {
           let val = item[col.field]
           if (col.required === 'true' && !val) {
-            err = `${col.label}涓嶅彲涓�${col.noValue === 'hide' ? '绌�' : '0'}`
+            err = `${col.label}${col.noValue === 'hide' ? (dict['not_empty'] || '涓嶅彲涓虹┖') : dict['not_zero'] || '涓嶅彲涓�0'}`
           } else if (col.noValue === 'hide' && !val) {
             if (col.clearField && checkForms.includes(col.clearField) && !item[col.clearField]) {
-              let msg = `璇峰~鍐� ${col.label} 鎴� ${col.clearName}`
+              let msg = `${dict['input_tip'] || '璇峰~鍐� '}${col.label} ${dict['or'] || '鎴�'} ${col.clearName}`
               if (!line.includes(msg)) {
                 line.push(msg)
               }
             }
             val = 0
           } else if (!val && val !== 0) {
-            line.push(`${col.label}涓嶅彲涓虹┖`)
+            line.push(`${col.label}${dict['not_empty'] || '涓嶅彲涓虹┖'}`)
             return
           } else {
             val = +val
             if (isNaN(val)) {
-              line.push(`${col.label}鏁版嵁鏍煎紡閿欒`)
+              line.push(`${col.label} ${dict['data_format'] || '鏁版嵁鏍煎紡閿欒'}`)
               return
             }
   
             val = +val.toFixed(col.decimal || 0)
             
             if (typeof(col.max) === 'number' && val > col.max) {
-              line.push(`${col.label}涓嶅彲澶т簬${col.max}`)
+              line.push(`${col.label}${dict['max_limit'] || ' 涓嶅彲澶т簬 '}${col.max}`)
             } else if (typeof(col.min) === 'number' && val < col.min) {
-              line.push(`${col.label}涓嶅彲灏忎簬${col.min}`)
+              line.push(`${col.label}${dict['less_limit'] || ' 涓嶅彲灏忎簬 '}${col.min}`)
             }
           }
 
@@ -2329,7 +2330,7 @@
       })
 
       if (line.length > 0) {
-        err += `绗�${Index}琛岋細` + line.join('锛�') + '锛�'
+        err += (dict['line'] ? `${dict['line']} ${Index}锛歚 : `绗�${Index}琛岋細`) + line.join('锛�') + '锛�'
       }
       if (!item.$deleted) {
         Index++
@@ -2353,14 +2354,14 @@
 
   submit = (record) => {
     const { submit, BID, setting } = this.props
-    const { forms } = this.state
+    const { forms, dict } = this.state
 
     this.setState({visible: false, midData: null})
 
     if (setting.supModule && !BID) {
       notification.warning({
         top: 92,
-        message: '闇�瑕佷笂绾т富閿�硷紒',
+        message: dict['sup_key_req'] || '闇�瑕佷笂绾т富閿�硷紒',
         duration: 5
       })
 
@@ -2438,17 +2439,18 @@
 
   execSuccess = (res, record) => {
     const { submit } = this.props
-    const { edData } = this.state
+    const { edData, dict } = this.state
 
     if (res && res.ErrCode === 'S') { // 鎵ц鎴愬姛
       notification.success({
         top: 92,
-        message: res.message || '鎵ц鎴愬姛',
+        message: res.message || dict['exc_success'] || '鎵ц鎴愬姛',
         duration: submit.stime ? submit.stime : 2
       })
     } else if (res && res.ErrCode === 'Y') { // 鎵ц鎴愬姛
       Modal.success({
-        title: res.message || '鎵ц鎴愬姛'
+        title: res.message || dict['exc_success'] || '鎵ц鎴愬姛',
+        okText: dict['got_it'] || '鐭ラ亾浜�'
       })
     } else if (res && res.ErrCode === '-1') { // 瀹屾垚鍚庝笉鎻愮ず
 
@@ -2494,26 +2496,28 @@
 
   execError = (res, record) => {
     const { submit } = this.props
+    const { dict } = this.state
 
     if (res.ErrCode === 'E') {
       Modal.error({
-        title: res.message || '鎵ц澶辫触锛�',
+        title: res.message || dict['exc_fail'] || '鎵ц澶辫触锛�',
+        okText: dict['got_it'] || '鐭ラ亾浜�'
       })
     } else if (res.ErrCode === 'N') {
       notification.error({
         top: 92,
-        message: res.message || '鎵ц澶辫触锛�',
+        message: res.message || dict['exc_fail'] || '鎵ц澶辫触锛�',
         duration: submit.ntime ? submit.ntime : 10
       })
     } else if (res.ErrCode === 'F') {
       notification.error({
         className: 'notification-custom-error',
         top: 92,
-        message: res.message || '鎵ц澶辫触锛�',
+        message: res.message || dict['exc_fail'] || '鎵ц澶辫触锛�',
         duration: submit.ftime ? submit.ftime : 10
       })
     } else if (res.ErrCode === 'NM') {
-      message.error(res.message || '鎵ц澶辫触锛�')
+      message.error(res.message || dict['exc_fail'] || '鎵ц澶辫触锛�')
     }
     
     this.setState({
@@ -2627,7 +2631,7 @@
 
   render() {
     const { setting, lineMarks, submit } = this.props
-    const { edData, columns, loading, pageOptions, selectedRowKeys, visible, midData, reseting } = this.state
+    const { edData, columns, loading, pageOptions, selectedRowKeys, visible, midData, reseting, dict } = this.state
 
     if (reseting) return null
 
@@ -2658,7 +2662,7 @@
         pageSizeOptions: pageOptions,
         showSizeChanger: true,
         total: this.props.total || 0,
-        showTotal: (total, range) => `${range[0]}-${range[1]} 鍏� ${total} 鏉
+        showTotal: (total, range) => `${range[0]}-${range[1]} ${dict['of'] || '鍏�'} ${total} ${dict['items'] || '鏉�'}`
       }
     }
 
@@ -2683,7 +2687,7 @@
     return (
       <>
         {setting.hasSubmit && edData.length > 0 ? <div className="edit-custom-table-btn-wrap" style={submit.wrapStyle}>
-          <Button style={submit.style} onClick={() => setTimeout(() => {this.submit()}, 10)} loading={loading} className="submit-table" type="link">鎻愪氦</Button>
+          <Button style={submit.style} onClick={() => setTimeout(() => {this.submit()}, 10)} loading={loading} className="submit-table" type="link">{dict['submit'] || '鎻愪氦'}</Button>
         </div> : null}
         <div className={`edit-custom-table ${setting.tableHeader || ''} ${setting.parity === 'true' ? 'mk-parity' : ''} ${height ? 'fixed-table-height' : ''} ${setting.mode || ''} table-vertical-${setting.vertical || ''} mk-edit-${setting.editType || 'simple'}`} style={style}>
           <Table
@@ -2707,7 +2711,7 @@
             onChange={this.changeTable}
             pagination={_pagination}
           />
-          {setting.hasSubmit && _data.length > 10 ? <Button style={submit.style} onClick={() => setTimeout(() => {this.submit()}, 10)} loading={loading} className="submit-footer-table" type="link">鎻愪氦</Button> : null}
+          {setting.hasSubmit && _data.length > 10 ? <Button style={submit.style} onClick={() => setTimeout(() => {this.submit()}, 10)} loading={loading} className="submit-footer-table" type="link">{dict['submit'] || '鎻愪氦'}</Button> : null}
         </div>
         <Modal
           className="mk-user-confirm"
@@ -2716,13 +2720,13 @@
           maskClosable={false}
           closable={false}
           footer={[
-            <Button key="cancel" onClick={() => { this.setState({ visible: false, midData: null }) }}>鍙栨秷</Button>,
-            <Button key="refresh" className="table-refresh" onClick={() => { midData && this.updateMutil(midData) }}>鍒锋柊琛ㄦ牸</Button>,
-            <Button key="confirm" type="primary" onClick={() => setTimeout(() => {this.submit()}, 10)}>鎻愪氦鏁版嵁</Button>
+            <Button key="cancel" onClick={() => { this.setState({ visible: false, midData: null }) }}>{dict['cancel'] || '鍙栨秷'}</Button>,
+            <Button key="refresh" className="table-refresh" onClick={() => { midData && this.updateMutil(midData) }}>{dict['refresh'] || '鍒锋柊琛ㄦ牸'}</Button>,
+            <Button key="confirm" type="primary" onClick={() => setTimeout(() => {this.submit()}, 10)}>{dict['submit'] || '鎻愪氦鏁版嵁'}</Button>
           ]}
           destroyOnClose
         >
-          <div><QuestionCircleOutlined />琛ㄦ牸涓湁鏁版嵁灏氭湭鎻愪氦</div>
+          <div><QuestionCircleOutlined />{dict['data_not_sub'] || '琛ㄦ牸涓湁鏁版嵁灏氭湭鎻愪氦'}</div>
         </Modal>
       </>
     )

--
Gitblit v1.8.0