From 25bf481493bcf18fca79e4d250f9c91dedf832e5 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 02 四月 2024 15:15:58 +0800
Subject: [PATCH] 2024-04-02

---
 src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx |  127 ++++++++++++++++++++++--------------------
 1 files changed, 66 insertions(+), 61 deletions(-)

diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx
index 11c9431..7362e15 100644
--- a/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx
+++ b/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx
@@ -68,7 +68,7 @@
         editable: true,
         required: false,
         keyCol: true,
-        width: '12%',
+        width: '8%',
         render: (text) => {
           if (text === 'image') {
             return '鍥剧墖'
@@ -90,7 +90,7 @@
         inputType: 'radio',
         editable: true,
         required: false,
-        width: '12%',
+        width: '10%',
         render: (text) => {
           if (text !== 'false') {
             return '鏄�'
@@ -122,11 +122,33 @@
         editable: true,
         required: false,
         keyVals: ['number'],
-        width: '12%',
+        width: '10%',
         render: (text, record) => {
           if (record.type !== 'number') return ''
 
           if (text === 'true') {
+            return '鏄�'
+          } else {
+            return '鍚�'
+          }
+        },
+        options: [
+          {value: 'true', text: '鏄�'},
+          {value: 'false', text: '鍚�'}
+        ]
+      },
+      {
+        title: '0鍊煎鍑�',
+        dataIndex: 'noValue',
+        inputType: 'radio',
+        editable: true,
+        required: false,
+        keyVals: ['number'],
+        width: '10%',
+        render: (text, record) => {
+          if (record.type !== 'number') return ''
+
+          if (text !== 'false') {
             return '鏄�'
           } else {
             return '鍚�'
@@ -205,12 +227,12 @@
         dataIndex: 'operation',
         render: (text, record) =>
           (<div style={{textAlign: 'center'}}>
-            <span className="operation-btn" title="缂栬緫" onClick={() => this.handleEdit(record, 'scripts')} style={{color: '#1890ff'}}><EditOutlined /></span>
-            <span className="operation-btn" title="鐘舵�佸垏鎹�" onClick={() => this.handleStatus(record, 'scripts')} style={{color: '#8E44AD'}}><SwapOutlined /></span>
+            <span className="operation-btn" title="缂栬緫" onClick={() => this.handleEdit(record)} style={{color: '#1890ff'}}><EditOutlined /></span>
+            <span className="operation-btn" title="鐘舵�佸垏鎹�" onClick={() => this.handleStatus(record)} style={{color: '#8E44AD'}}><SwapOutlined /></span>
             <Popconfirm
               overlayClassName="popover-confirm"
               title="纭畾鍒犻櫎鍚�?"
-              onConfirm={() => this.handleDelete(record, 'scripts')
+              onConfirm={() => this.handleDelete(record)
             }>
               <span className="operation-btn" style={{color: '#ff4d4f'}}><DeleteOutlined /></span>
             </Popconfirm>
@@ -235,6 +257,7 @@
       col.type = col.type || 'text'
       col.output = col.output || 'true'
       col.required = col.required || 'false'
+      col.noValue = col.noValue || 'true'
 
       if (!['text', 'image', 'number'].includes(col.type)) {
         if (/^Decimal/ig.test(col.type)) {
@@ -369,14 +392,9 @@
     })
   }
 
-  handleEdit = (record, type) => {
-    let node = null
-
-    if (type === 'scripts') {
-      this.scriptsForm.edit(record)
-      node = document.getElementById('mk-exout-script')
-    }
-
+  handleEdit = (record) => {
+    this.scriptsForm.edit(record)
+    let node = document.getElementById('mk-exout-script')
 
     if (node && node.scrollTop) {
       let inter = Math.ceil(node.scrollTop / 10)
@@ -392,19 +410,17 @@
     }
   }
 
-  handleStatus = (record, type) => {
+  handleStatus = (record) => {
     let verify = JSON.parse(JSON.stringify(this.state.verify))
     record.status = record.status === 'false' ? 'true' : 'false'
 
-    if (type === 'scripts') {
-      verify.scripts = verify.scripts.map(item => {
-        if (item.uuid === record.uuid) {
-          return record
-        } else {
-          return item
-        }
-      })
-    }
+    verify.scripts = verify.scripts.map(item => {
+      if (item.uuid === record.uuid) {
+        return record
+      } else {
+        return item
+      }
+    })
 
     this.setState({
       verify: verify
@@ -436,38 +452,12 @@
     })
   }
 
-  handleDelete = (record, type) => {
-    const { verify } = this.state
+  handleDelete = (record) => {
+    let verify = JSON.parse(JSON.stringify(this.state.verify))
 
-    verify.columns = verify.columns.filter(item => item.uuid !== record.uuid)
+    verify.scripts = verify.scripts.filter(item => item.uuid !== record.uuid)
 
     this.setState({ verify: verify })
-  }
-
-  handleUpDown = (record, type, direction) => {
-    let verify = JSON.parse(JSON.stringify(this.state.verify))
-    let index = 0
-
-    verify.columns = verify.columns.filter((item, i) => {
-      if (item.uuid === record.uuid) {
-        index = i
-      }
-
-      return item.uuid !== record.uuid
-    })
-    if ((index === 0 && direction === 'up') || (index === verify.columns.length && direction === 'down')) {
-      return
-    }
-
-    if (direction === 'up') {
-      verify.columns.splice(index - 1, 0, record)
-    } else {
-      verify.columns.splice(index + 1, 0, record)
-    }
-
-    this.setState({
-      verify: verify
-    })
   }
 
   showError = (errorType) => {
@@ -603,7 +593,7 @@
                 loading: false
               })
               reject()
-            }, verify.scripts)
+            }, verify.scripts, 'submit')
           })
         })
       } else if (activeKey === 'columns') {
@@ -622,7 +612,7 @@
               loading: false
             })
             reject()
-          }, verify.scripts)
+          }, verify.scripts, 'submit')
         }
       } else if (activeKey === 'scripts') {
         this.setState({loading: true})
@@ -636,7 +626,7 @@
             loading: false
           })
           reject()
-        }, verify.scripts)
+        }, verify.scripts, 'submit')
       } else {
         resolve(verify)
       }
@@ -779,6 +769,7 @@
       col.type = col.type || 'text'
       col.output = col.output || 'true'
       col.required = col.required || 'false'
+      col.noValue = col.noValue || 'true'
       col.Width = col.Width || 20
 
       if (!['text', 'image', 'number'].includes(col.type)) {
@@ -932,7 +923,7 @@
     }
   }
 
-  sqlverify = (_resolve, _reject, scripts) => {
+  sqlverify = (_resolve, _reject, scripts, type) => {
     const { searches, verify, debugId } = this.state
 
     if (verify.dataType !== 'custom') {
@@ -954,10 +945,24 @@
         this.setState({debugId: _debugId})
         _resolve()
       } else {
-        _reject()
-        Modal.error({
-          title: result.message
-        })
+        if (type === 'submit') {
+          Modal.confirm({
+            title: result.message,
+            okText: '鐭ラ亾浜�',
+            cancelText: '寮哄埗淇濆瓨',
+            onOk: () => {
+              _reject()
+            },
+            onCancel() {
+              _resolve()
+            }
+          })
+        } else {
+          _reject()
+          Modal.error({
+            title: result.message
+          })
+        }
       }
     })
   }

--
Gitblit v1.8.0