From 37e28da53f6d4d7d8abe7626ba28ba7dbe16e7bb Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 08 四月 2024 15:36:01 +0800
Subject: [PATCH] 2024-04-08

---
 src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx |  191 ++++++++++++++++++++++++++++++++---------------
 1 files changed, 129 insertions(+), 62 deletions(-)

diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx
index 7362e15..b754c1e 100644
--- a/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx
+++ b/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx
@@ -9,6 +9,7 @@
 import Utils from '@/utils/utils.js'
 import SettingUtils from './utils.jsx'
 import ColumnForm from './columnform'
+import OtherForm from './otherform'
 import DataSource from './datasource'
 import CustomScript from './customscript'
 import asyncComponent from '@/utils/asyncComponent'
@@ -30,6 +31,8 @@
     verify: {},
     debugId: '',
     activeKey: 'setting',
+    visible: false,
+    line: null,
     searchKey: '',
     excelColumns: [
       {
@@ -68,7 +71,7 @@
         editable: true,
         required: false,
         keyCol: true,
-        width: '8%',
+        width: '10%',
         render: (text) => {
           if (text === 'image') {
             return '鍥剧墖'
@@ -115,50 +118,50 @@
           {value: 'false', text: '鍚�'}
         ]
       },
-      {
-        title: '鍙栫粷瀵瑰��',
-        dataIndex: 'abs',
-        inputType: 'radio',
-        editable: true,
-        required: false,
-        keyVals: ['number'],
-        width: '10%',
-        render: (text, record) => {
-          if (record.type !== 'number') return ''
+      // {
+      //   title: '鍙栫粷瀵瑰��',
+      //   dataIndex: 'abs',
+      //   inputType: 'radio',
+      //   editable: true,
+      //   required: false,
+      //   keyVals: ['number'],
+      //   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 === '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 '鍚�'
-          }
-        },
-        options: [
-          {value: 'true', text: '鏄�'},
-          {value: 'false', text: '鍚�'}
-        ]
-      },
+      //     if (text !== 'false') {
+      //       return '鏄�'
+      //     } else {
+      //       return '鍚�'
+      //     }
+      //   },
+      //   options: [
+      //     {value: 'true', text: '鏄�'},
+      //     {value: 'false', text: '鍚�'}
+      //   ]
+      // },
       {
         title: '灏忔暟浣�',
         dataIndex: 'decimal',
@@ -170,7 +173,56 @@
         keyVals: ['number'],
         width: '12%',
         render: (text, record) => record.type === 'number' ? text : ''
-      }
+      },
+      {
+        title: '鍏朵粬',
+        dataIndex: 'other',
+        required: false,
+        width: '18%',
+        render: (_, record) => {
+          if (record.type === 'number') {
+            let val = ''
+
+            if (record.abs === 'true') {
+              val += '鍙栫粷瀵瑰�硷紱'
+            }
+            if (record.noValue === 'false') {
+              val += '0鍊间笉瀵煎嚭锛�'
+            }
+            if (record.format) {
+              if (record.format === 'thdSeparator') {
+                val += '鏍煎紡鍖栵細鍗冨垎浣嶏紱'
+              } else if (record.format === 'thdSepPm') {
+                val += '鏍煎紡鍖栵細鍗冨垎浣嶏紙璐熷�肩孩鑹诧級锛�'
+              } else if (record.format === 'percent') {
+                val += '鏍煎紡鍖栵細鐧惧垎姣旓紱'
+              }
+            }
+
+            return <div>{val}<EditOutlined className="edit-other" onClick={() => {this.setState({visible: true, line: fromJS(record).toJS()})}} /></div>
+          } else if (record.type === 'text') {
+            let val = ''
+
+            if (record.wrapText === 'true') {
+              val += '鑷姩鎹㈣锛�'
+            }
+            if (record.noValue === 'false') {
+              val += '绌哄�间笉瀵煎嚭锛�'
+            }
+            if (record.textFormat) {
+              if (record.textFormat === 'YYYY-MM-DD') {
+                val += '鏍煎紡鍖栵細YYYY-MM-DD锛�'
+              } else if (record.textFormat === 'YYYY-MM-DD HH:mm:ss') {
+                val += '鏍煎紡鍖栵細YYYY-MM-DD HH:mm:ss锛�'
+              }
+            }
+
+            return <div>{val}<EditOutlined className="edit-other" onClick={() => {this.setState({visible: true, line: fromJS(record).toJS()})}} /></div>
+          }
+
+          return ''
+        }
+      },
     ],
     scriptsColumns: [
       {
@@ -779,27 +831,30 @@
           col.type = 'text'
         }
       }
+      if (col.type === 'text' && col.format) {
+        delete col.format
+      } else if (col.type === 'number' && col.textFormat) {
+        delete col.textFormat
+      }
 
       return col
     })
-    // if (columns[0] && !['image', 'text', 'number'].includes(columns[0].type)) {
-    //   columns = columns.map(col => {
-    //     let _cell = {
-    //       uuid: Utils.getuuid(),
-    //       Column: col.Column,
-    //       Text: col.Text,
-    //       Width: 20,
-    //       abs: 'false',
-    //       output: col.output || 'true',
-    //       required: col.required || 'false',
-    //       type: 'text',
-    //     }
-
-    //     return _cell
-    //   })
-    // }
 
     this.setState({verify: {...verify, columns}})
+  }
+
+  lineSubmit = () => {
+    const { line, verify } = this.state
+
+    let columns = verify.columns.map(col => {
+      if (col.uuid === line.uuid) {
+        return line
+      }
+
+      return col
+    })
+
+    this.setState({verify: {...verify, columns}, line: null, visible: false})
   }
 
   // 鏍囩鍒囨崲
@@ -988,7 +1043,7 @@
 
   render() {
     const { card } = this.props
-    const { verify, excelColumns, scriptsColumns, activeKey, loading, searches, searchKey } = this.state
+    const { verify, excelColumns, scriptsColumns, activeKey, loading, searches, searchKey, visible, line } = this.state
     const formItemLayout = {
       labelCol: {
         xs: { span: 24 },
@@ -1021,7 +1076,7 @@
             <Button className="excel-col-add mk-red" title="娓呯┖Excel鍒�" onClick={this.clearField}>
               娓呯┖Excel鍒�
             </Button>
-            <div style={{color: '#959595', fontSize: '13px', paddingLeft: '10px'}}>濡傞渶瀵煎嚭搴忓彿锛岃浣跨敤瀛楁 $Index锛涙暟鍊肩被鍨嬪鍑烘椂鍙彇缁濆鍊间互鍙婅缃皬鏁颁綅锛涘鍑轰负鍚︽椂锛屼笉浣跨敤琛屼俊鎭紱绾㈣壊鏍囬瀵煎嚭鏃跺垪澶存枃瀛椾负绾㈣壊銆�</div>
+            <div style={{color: '#959595', fontSize: '13px', paddingLeft: '10px'}}>濡傞渶瀵煎嚭搴忓彿锛岃浣跨敤瀛楁 $Index锛涘鍑轰负鍚︽椂锛屼笉浣跨敤琛屼俊鎭紙鏂囨湰涓虹┖锛屾暟鍊间负0锛夛紱绾㈣壊鏍囬瀵煎嚭鏃跺垪澶存枃瀛椾负绾㈣壊銆�</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={
@@ -1140,6 +1195,18 @@
             </Form>
           </TabPane>
         </Tabs>
+        <Modal
+          title=""
+          visible={visible}
+          width={1000}
+          maskClosable={false}
+          closable={false}
+          onOk={this.lineSubmit}
+          onCancel={() => {this.setState({visible: false, line: null})}}
+          destroyOnClose
+        >
+          <OtherForm line={line} onChange={(values) => this.setState({line: values})}/>
+        </Modal>
       </div>
     )
   }

--
Gitblit v1.8.0