From 62e2946d9029a40b4406a39275c7863dccbbeadf Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 19 二月 2024 18:21:59 +0800
Subject: [PATCH] 2024-02-19

---
 src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx |  166 +++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 111 insertions(+), 55 deletions(-)

diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx
index f3efa4d..5acaeb6 100644
--- a/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx
+++ b/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx
@@ -1,7 +1,7 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { fromJS } from 'immutable'
-import { Form, Tabs, Row, Col, Button, notification, Modal, message, InputNumber, Spin, Typography, Popconfirm } from 'antd'
+import { Form, Tabs, Row, Col, Button, Input, notification, Modal, message, InputNumber, Spin, Typography, Popconfirm } from 'antd'
 import { EditOutlined, StopOutlined, CheckCircleOutlined, SwapOutlined, DeleteOutlined } from '@ant-design/icons'
 import md5 from 'md5'
 
@@ -16,6 +16,7 @@
 
 const { TabPane } = Tabs
 const { confirm } = Modal
+const { Search } = Input
 const { Paragraph } = Typography
 const EditTable = asyncComponent(() => import('@/templates/zshare/editTable'))
 
@@ -29,6 +30,7 @@
     verify: {},
     debugId: '',
     activeKey: 'setting',
+    searchKey: '',
     excelColumns: [
       {
         title: '瀛楁',
@@ -36,6 +38,8 @@
         inputType: 'input',
         editable: true,
         unique: true,
+        searchable: true,
+        copy: true,
         width: '16%'
       },
       {
@@ -43,6 +47,7 @@
         dataIndex: 'Text',
         inputType: 'input',
         editable: true,
+        searchable: true,
         unique: true,
         width: '16%'
       },
@@ -62,6 +67,7 @@
         inputType: 'select',
         editable: true,
         required: false,
+        keyCol: true,
         width: '12%',
         render: (text) => {
           if (text === 'image') {
@@ -77,35 +83,6 @@
           {value: 'number', text: '鏁板��'},
           {value: 'image', text: '鍥剧墖'}
         ]
-      },
-      {
-        title: '鍙栫粷瀵瑰��',
-        dataIndex: 'abs',
-        inputType: 'radio',
-        editable: true,
-        required: false,
-        width: '12%',
-        render: (text) => {
-          if (text === 'true') {
-            return '鏄�'
-          } else {
-            return '鍚�'
-          }
-        },
-        options: [
-          {value: 'true', text: '鏄�'},
-          {value: 'false', text: '鍚�'}
-        ]
-      },
-      {
-        title: '灏忔暟浣�',
-        dataIndex: 'decimal',
-        inputType: 'number',
-        min: 0,
-        max: 18,
-        editable: true,
-        required: false,
-        width: '12%'
       },
       {
         title: '瀵煎嚭',
@@ -138,6 +115,40 @@
           {value: 'false', text: '鍚�'}
         ]
       },
+      {
+        title: '鍙栫粷瀵瑰��',
+        dataIndex: 'abs',
+        inputType: 'radio',
+        editable: true,
+        required: false,
+        keyVals: ['number'],
+        width: '12%',
+        render: (text, record) => {
+          if (record.type !== 'number') return ''
+
+          if (text === 'true') {
+            return '鏄�'
+          } else {
+            return '鍚�'
+          }
+        },
+        options: [
+          {value: 'true', text: '鏄�'},
+          {value: 'false', text: '鍚�'}
+        ]
+      },
+      {
+        title: '灏忔暟浣�',
+        dataIndex: 'decimal',
+        inputType: 'number',
+        min: 0,
+        max: 18,
+        editable: true,
+        required: false,
+        keyVals: ['number'],
+        width: '12%',
+        render: (text, record) => record.type === 'number' ? text : ''
+      }
     ],
     scriptsColumns: [
       {
@@ -231,6 +242,13 @@
         } else {
           col.type = 'text'
         }
+      }
+
+      if (col.type !== 'number') {
+        col.decimal = ''
+        col.abs = 'false'
+      } else {
+        col.abs = col.abs || 'false'
       }
 
       return col
@@ -344,6 +362,7 @@
     }
 
     this.setState({
+      searchKey: '',
       verify: _verify,
       searches: searches,
       activeKey: card.intertype === 'system' && _verify.dataType === 'custom' ? 'setting' : 'columns'
@@ -491,6 +510,7 @@
   }
 
   handleConfirm = () => {
+    const { card, config } = this.props
     const { activeKey, verify } = this.state
     
     // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭�
@@ -506,6 +526,31 @@
         })
         
         return
+      }
+
+      if (card.intertype === 'system' && verify.dataType !== 'custom' && verify.columns.length > 0 && config.$c_ds && config.setting.interType === 'system' && config.columns && config.columns.length > 0) {
+        let cols = []
+        let columns = config.columns.map(c => c.field)
+
+        if (config.subtype === 'dualdatacard' && config.subColumns) {
+          config.subColumns.forEach(item => {
+            columns.push(item.field)
+          })
+        }
+
+        verify.columns.forEach(col => {
+          if (col.output === 'false' || col.Column === '$Index') return
+          if (!columns.includes(col.Column)) {
+            cols.push(col.Column)
+          }
+        })
+        if (cols.length) {
+          notification.warning({
+            top: 92,
+            message: `瀵煎嚭鍒楋紙${cols.join('銆�')}锛夊湪瀛楁闆嗕腑涓嶅瓨鍦紒`,
+            duration: 5
+          })
+        }
       }
 
       if (activeKey === 'setting') {
@@ -675,6 +720,8 @@
 
       confirm({
         content: '閮ㄥ垎瀛楁鍚嶇О涓庢樉绀哄垪涓嶄竴鑷达紝鏄惁鏇存柊锛�',
+        okText: '鏇存柊',
+        cancelText: '涓嶆洿鏂�',
         onOk() {
           columns = columns.map(item => {
             let key = item.Column.toLowerCase()
@@ -764,28 +811,32 @@
     const { card } = this.props
     const { activeKey, verify } = this.state
 
-    if (card.intertype !== 'system' || verify.dataType !== 'custom') {
+    if (activeKey === 'setting') {
+      this.settingForm.handleConfirm().then(res => {
+        if (card.intertype !== 'system' || verify.dataType !== 'custom') {
+          this.setState({activeKey: val, verify: {...verify, ...res}})
+        } else {
+          this.setState({
+            verify: {...verify, ...res}
+          }, () => {
+            this.setState({loading: true})
+            this.sqlverify(() => { // 楠岃瘉鎴愬姛
+              this.setState({
+                activeKey: val,
+                loading: false
+              })
+            }, () => {             // 楠岃瘉澶辫触
+              this.setState({
+                activeKey: val,
+                loading: false
+              })
+            }, verify.scripts)
+          })
+        }
+      })
+    } else if (card.intertype !== 'system' || verify.dataType !== 'custom') {
       this.setState({activeKey: val})
       return
-    } else if (activeKey === 'setting') {
-      this.settingForm.handleConfirm().then(res => {
-        this.setState({
-          verify: {...verify, ...res}
-        }, () => {
-          this.setState({loading: true})
-          this.sqlverify(() => { // 楠岃瘉鎴愬姛
-            this.setState({
-              activeKey: val,
-              loading: false
-            })
-          }, () => {             // 楠岃瘉澶辫触
-            this.setState({
-              activeKey: val,
-              loading: false
-            })
-          }, verify.scripts)
-        })
-      })
     } else if (activeKey === 'columns') {
       if (this.columnRef && this.columnRef.state.editingKey) {
         notification.warning({
@@ -927,7 +978,7 @@
 
   render() {
     const { card } = this.props
-    const { verify, excelColumns, scriptsColumns, activeKey, loading, searches } = this.state
+    const { verify, excelColumns, scriptsColumns, activeKey, loading, searches, searchKey } = this.state
     const formItemLayout = {
       labelCol: {
         xs: { span: 24 },
@@ -955,13 +1006,13 @@
           } key="columns">
             <ColumnForm columnChange={this.columnChange}/>
             <Button className="excel-col-add mk-green" title="娣诲姞鏄剧ず鍒楀瓧娈�" onClick={this.columnFieldInput}>
-              鍚屾鏄剧ず鍒�
+              鍚屾瀛楁闆�
             </Button>
             <Button className="excel-col-add mk-red" title="娓呯┖Excel鍒�" onClick={this.clearField}>
               娓呯┖Excel鍒�
             </Button>
-            <div style={{color: '#959595', fontSize: '13px', paddingLeft: '10px'}}>濡傞渶瀵煎嚭搴忓彿锛岃浣跨敤瀛楁 $Index锛涙暟鍊肩被鍨嬪鍑烘椂鍙繘琛屾暟鎹鐞嗭紙鍙栫粷瀵瑰�笺�佷繚鐣欏皬鏁颁綅锛夛紱绾㈣壊鏍囬瀵煎嚭鏃跺垪澶存枃瀛椾负绾㈣壊銆�</div>
-            <EditTable actions={['edit', 'move', 'copy', 'del']} type="excelcolumn" wrappedComponentRef={(inst) => this.columnRef = inst} data={verify.columns} columns={excelColumns} onChange={this.changeColumns}/>
+            <div style={{color: '#959595', fontSize: '13px', paddingLeft: '10px'}}>濡傞渶瀵煎嚭搴忓彿锛岃浣跨敤瀛楁 $Index锛涙暟鍊肩被鍨嬪鍑烘椂鍙彇缁濆鍊间互鍙婅缃皬鏁颁綅锛涘鍑轰负鍚︽椂锛屼笉浣跨敤琛屼俊鎭紱绾㈣壊鏍囬瀵煎嚭鏃跺垪澶存枃瀛椾负绾㈣壊銆�</div>
+            <EditTable actions={['edit', 'move', 'copy', 'del']} type="excelcolumn" searchKey={searchKey} wrappedComponentRef={(inst) => this.columnRef = inst} data={verify.columns} columns={excelColumns} onChange={this.changeColumns}/>
           </TabPane>
           {card.intertype === 'system' ? <TabPane tab={
             <span>
@@ -978,7 +1029,12 @@
             />
             <EditTable actions={['move']} data={verify.scripts} columns={scriptsColumns} onChange={(scripts) => {this.setState({verify: {...verify, scripts}})}}/>
           </TabPane> : null}
-          <TabPane tab="淇℃伅鎻愮ず" key="message">
+          <TabPane tab={
+            <span>
+              淇℃伅鎻愮ず
+              {activeKey === 'columns' ? <span onClick={(e) => {e.stopPropagation()}}><Search className="mk-search-fields" defaultValue={searchKey} allowClear onSearch={(val, e) => {e.stopPropagation();this.setState({searchKey: val})}} /></span> : null}
+            </span>
+          } key="message">
             <Form {...formItemLayout}>
               <Row gutter={24}>
                 <Col offset={6} span={6}>

--
Gitblit v1.8.0