From 7b0dbecd1d6155d26ec67be0a47a16264c738c85 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 09 五月 2023 14:48:10 +0800
Subject: [PATCH] 2023-05-09

---
 src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx |   98 +++++++++++++++++++++++++++++-------------------
 1 files changed, 59 insertions(+), 39 deletions(-)

diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx
index 1361104..4580eb7 100644
--- a/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx
+++ b/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx
@@ -23,7 +23,6 @@
 class VerifyCard extends Component {
   static propTpyes = {
     columns: PropTypes.array,  // 鏄剧ず鍒�
-    dict: PropTypes.object,    // 瀛楀吀椤�
     card: PropTypes.object,
   }
 
@@ -33,7 +32,7 @@
     activeKey: 'basemsg',
     excelColumns: [
       {
-        title: this.props.dict['model.form.field'],
+        title: '瀛楁',
         dataIndex: 'Column',
         width: '14%',
         inputType: 'input',
@@ -41,14 +40,14 @@
         editable: true
       },
       {
-        title: this.props.dict['model.name'],
+        title: '鍚嶇О',
         dataIndex: 'Text',
         width: '14%',
         inputType: 'input',
         editable: true
       },
       {
-        title: this.props.dict['model.form.type'],
+        title: '绫诲瀷',
         dataIndex: 'type',
         width: '15%',
         editable: true,
@@ -72,20 +71,20 @@
         ]
       },
       {
-        title: this.props.dict['model.required'],
+        title: '蹇呭~',
         dataIndex: 'required',
         width: '10%',
         editable: true,
         inputType: 'switch',
-        render: (text, record) => record.required === 'true' ? this.props.dict['model.true'] : this.props.dict['model.false']
+        render: (text, record) => record.required === 'true' ? '鏄�' : '鍚�'
       },
       {
-        title: this.props.dict['model.import'],
+        title: '瀵煎叆',
         dataIndex: 'import',
         width: '10%',
         editable: true,
         inputType: 'switch',
-        render: (text, record) => record.import !== 'false' ? this.props.dict['model.true'] : this.props.dict['model.false']
+        render: (text, record) => record.import !== 'false' ? '鏄�' : '鍚�'
       },
       {
         title: '鏈�灏忓��',
@@ -123,7 +122,7 @@
       {
         title: '鎶ラ敊缂栫爜',
         dataIndex: 'errorCode',
-        width: '12%',
+        width: '10%',
         editable: true,
         inputType: 'select',
         options: [
@@ -136,13 +135,24 @@
       {
         title: '楠岃瘉绫诲瀷',
         dataIndex: 'verifyType',
-        width: '12%',
-        render: (text, record) => record.verifyType === 'logic' ? '閫昏緫楠岃瘉' : '鐗╃悊楠岃瘉',
+        width: '14%',
+        render: (text, record) => {
+          let names = {
+            physical: '鐗╃悊楠岃瘉锛堝叏閲忛獙璇侊級',
+            logic: '閫昏緫楠岃瘉锛堝叏閲忛獙璇侊級',
+            physical_temp: '鐗╃悊楠岃瘉锛堜粎涓存椂琛級',
+            logic_temp: '閫昏緫楠岃瘉锛堜粎涓存椂琛級',
+          }
+
+          return names[text] || '鐗╃悊楠岃瘉锛堝叏閲忛獙璇侊級'
+        },
         inputType: 'select',
         editable: true,
         options: [
-          { value: 'physical', text: '鐗╃悊楠岃瘉' },
-          { value: 'logic', text: '閫昏緫楠岃瘉' }
+          { value: 'physical', text: '鐗╃悊楠岃瘉锛堝叏閲忛獙璇侊級' },
+          { value: 'logic', text: '閫昏緫楠岃瘉锛堝叏閲忛獙璇侊級' },
+          { value: 'physical_temp', text: '鐗╃悊楠岃瘉锛堜粎涓存椂琛級' },
+          { value: 'logic_temp', text: '閫昏緫楠岃瘉锛堜粎涓存椂琛級' }
         ]
       },
       {
@@ -224,11 +234,11 @@
         dataIndex: 'operation',
         render: (text, record) =>
           (<div style={{textAlign: 'center'}}>
-            <span className="operation-btn" title={this.props.dict['model.edit']} onClick={() => this.handleEdit(record, 'scripts')} style={{color: '#1890ff'}}><EditOutlined /></span>
-            <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'scripts')} style={{color: '#8E44AD'}}><SwapOutlined /></span>
+            <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>
             <Popconfirm
               overlayClassName="popover-confirm"
-              title={this.props.dict['model.query.delete']}
+              title="纭畾鍒犻櫎鍚�?"
               onConfirm={() => this.handleDelete(record, 'scripts')
             }>
               <span className="operation-btn" style={{color: '#ff4d4f'}}><DeleteOutlined /></span>
@@ -240,15 +250,22 @@
 
   UNSAFE_componentWillMount() {
     const { card } = this.props
-    let _verify = fromJS(card.verify || {range: 1}).toJS()
+    let _verify = fromJS(card.verify || {}).toJS()
     let _columns = _verify.columns || []
+
+    delete _verify.dataresource
 
     // 鏃ф暟鎹吋瀹�
     _columns = _columns.map(col => {
       col.required = col.required || 'true'
       col.type = col.type || 'Nvarchar(50)'
       col.import = col.import || 'true'
-      col.required = col.required || 'true'
+
+      if (col.type === 'text' || col.type === 'image') {
+        col.type = 'Nvarchar(50)'
+      } else if (col.type === 'number') {
+        col.type = 'Decimal(18,2)'
+      }
       
       if (/^Nvarchar/ig.test(col.type)) {
         col.limit = col.type.match(/\d+/)[0]
@@ -260,6 +277,10 @@
 
       return col
     })
+
+    if (!_verify.hasOwnProperty('range')) {
+      _verify.range = 1
+    }
 
     this.setState({
       verify: {
@@ -354,7 +375,7 @@
 
     let _columns = JSON.parse(JSON.stringify(verify.columns))
 
-    let _cols = _columns.map(col => col.Column )
+    let _cols = _columns.map(col => col.Column)
 
     columns.forEach(col => {
       if (col.field && !_cols.includes(col.field)) {
@@ -443,23 +464,14 @@
   changeColumns = (columns) => {
     const { verify } = this.state
 
-    if (columns[0] && (columns[0].type === 'image' || columns[0].type === 'text')) {
-      columns = columns.map(col => {
-        let _cell = {
-          uuid: Utils.getuuid(),
-          Column: col.Column,
-          Text: col.Text,
-          type: 'Nvarchar(50)',
-          limit: '50',
-          import: 'true',
-          required: 'true'
-        }
-
-        return _cell
-      })
-    }
-
     columns = columns.map(col => {
+      col.type = col.type || 'Nvarchar(50)'
+      if (col.type === 'text' || col.type === 'image') {
+        col.type = 'Nvarchar(50)'
+      } else if (col.type === 'number') {
+        col.type = 'Decimal(18,2)'
+      }
+
       if (/^Nvarchar/ig.test(col.type)) {
         col.limit = col.type.match(/\d+/) ? col.type.match(/\d+/)[0] : '20000'
       } else if (/^Decimal/ig.test(col.type)) {
@@ -470,6 +482,9 @@
       } else {
         col.limit = ''
       }
+
+      col.required = col.required || 'true'
+      col.import = col.import || 'true'
 
       return col
     })
@@ -758,13 +773,18 @@
             <Form {...formItemLayout}>
               <Row gutter={24}>
                 <Col span={8}>
-                  <Form.Item label={this.props.dict['model.form.tablename']}>
+                  <Form.Item label={
+                    <Tooltip placement="bottomLeft" title="瀵煎叆鏃跺伐浣滆〃鍚嶄笌excel涓繀椤讳竴鑷达紝娉細宸ヤ綔琛ㄥ悕涓篠heet1涓攅xcel涓粎鏈変竴涓伐浣滆〃鏃朵笉杩涜琛ㄥ悕楠岃瘉銆�">
+                      <QuestionCircleOutlined className="mk-form-tip" />
+                      宸ヤ綔琛�
+                    </Tooltip>
+                  }>
                     {getFieldDecorator('sheet', {
                       initialValue: verify.sheet || '',
                       rules: [
                         {
                           required: true,
-                          message: this.props.dict['form.required.input'] + this.props.dict['model.form.tablename'] + '!'
+                          message: '璇疯緭鍏ュ伐浣滆〃鍚�!'
                         }
                       ]
                     })(<Input placeholder="" autoComplete="off" />)}
@@ -799,7 +819,7 @@
               {verify.columns.length ? <span className="count-tip">{verify.columns.length}</span> : null}
             </span>
           } key="excelcolumn">
-            <ColumnForm dict={this.props.dict} columnChange={this.columnChange}/>
+            <ColumnForm columnChange={this.columnChange}/>
             <Button className="excel-col-add mk-green" title="娣诲姞鏄剧ず鍒楀瓧娈�" onClick={this.columnFieldInput}>
               鍚屾鏄剧ず鍒�
             </Button>
@@ -815,7 +835,7 @@
               {verify.uniques.length ? <span className="count-tip">{verify.uniques.length}</span> : null}
             </span>
           } key="unique">
-            <UniqueForm fields={verify.columns} dict={this.props.dict} uniqueChange={this.uniqueChange}/>
+            <UniqueForm fields={verify.columns} uniqueChange={this.uniqueChange}/>
             <EditTable actions={['edit', 'move', 'del', 'status']} data={verify.uniques} columns={uniqueColumns} onChange={this.changeUniques}/>
           </TabPane> : null}
           {card.intertype === 'system' ? <TabPane tab={

--
Gitblit v1.8.0