From 74f42024805abe7850dbeeb03dae48a0d9ef0b79 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 05 二月 2020 13:10:17 +0800
Subject: [PATCH] 2020-02-05

---
 src/templates/tableshare/verifycard/index.jsx |  195 +++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 167 insertions(+), 28 deletions(-)

diff --git a/src/templates/tableshare/verifycard/index.jsx b/src/templates/tableshare/verifycard/index.jsx
index c0bc55c..5a0a790 100644
--- a/src/templates/tableshare/verifycard/index.jsx
+++ b/src/templates/tableshare/verifycard/index.jsx
@@ -34,12 +34,30 @@
       {
         title: '瀛楁鍚�',
         dataIndex: 'field',
-        width: '55%'
+        width: '45%'
       },
       {
         title: '鎶ラ敊缂栫爜',
         dataIndex: 'errorCode',
-        width: '20%'
+        width: '15%'
+      },
+      {
+        title: '鐘舵��',
+        dataIndex: 'status',
+        width: '15%',
+        render: (text, record) => record.status === 'false' ?
+          (
+            <div>
+              {this.props.dict['header.form.status.forbidden']}
+              <Icon style={{marginLeft: '5px'}} type="stop" theme="twoTone" twoToneColor="#ff4d4f" />
+            </div>
+          ) :
+          (
+            <div>
+              {this.props.dict['header.form.status.open']}
+              <Icon style={{marginLeft: '5px'}} type="check-circle" theme="twoTone" twoToneColor="#52c41a" />
+            </div>
+          )
       },
       {
         title: '鎿嶄綔',
@@ -48,12 +66,18 @@
         dataIndex: 'operation',
         render: (text, record) =>
           (<div>
-            <span className="operation-btn" onClick={() => this.handleEdit(record, 'unique')} style={{color: '#1890ff'}}><Icon type="edit" /></span>
-            <Popconfirm title="纭畾鍒犻櫎鍚�?" onConfirm={() => this.handleDelete(record, 'unique')}>
+            <span className="operation-btn" title={this.props.dict['header.edit']} onClick={() => this.handleEdit(record, 'unique')} style={{color: '#1890ff'}}><Icon type="edit" /></span>
+            <Popconfirm
+              title={this.props.dict['header.form.query.delete']}
+              okText={this.props.dict['header.confirm']}
+              cancelText={this.props.dict['header.cancel']}
+              onConfirm={() => this.handleDelete(record, 'unique')
+            }>
               <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span>
             </Popconfirm>
-            <span className="operation-btn" onClick={() => this.handleUpDown(record, 'unique', 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span>
-            <span className="operation-btn" onClick={() => this.handleUpDown(record, 'unique', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span>
+            <span className="operation-btn" title={this.props.dict['header.form.up']} onClick={() => this.handleUpDown(record, 'unique', 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span>
+            <span className="operation-btn" title={this.props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'unique', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span>
+            <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'unique')} style={{color: '#8E44AD'}}><Icon type="swap" /></span>
           </div>)
       }
     ],
@@ -61,22 +85,40 @@
       {
         title: 'SQL',
         dataIndex: 'sql',
-        width: '50%'
+        width: '45%'
       },
       {
         title: '缁撴灉澶勭悊',
         dataIndex: 'resultName',
-        width: '10%'
+        width: '9%'
       },
       {
         title: '鎻愮ず淇℃伅',
         dataIndex: 'errmsg',
-        width: '15%'
+        width: '13%'
       },
       {
         title: '鎶ラ敊缂栫爜',
         dataIndex: 'errorCode',
-        width: '10%'
+        width: '9%'
+      },
+      {
+        title: '鐘舵��',
+        dataIndex: 'status',
+        width: '9%',
+        render: (text, record) => record.status === 'false' ?
+          (
+            <div>
+              {this.props.dict['header.form.status.forbidden']}
+              <Icon style={{marginLeft: '5px'}} type="stop" theme="twoTone" twoToneColor="#ff4d4f" />
+            </div>
+          ) :
+          (
+            <div>
+              {this.props.dict['header.form.status.open']}
+              <Icon style={{marginLeft: '5px'}} type="check-circle" theme="twoTone" twoToneColor="#52c41a" />
+            </div>
+          )
       },
       {
         title: '鎿嶄綔',
@@ -85,12 +127,18 @@
         dataIndex: 'operation',
         render: (text, record) =>
           (<div>
-            <span className="operation-btn" onClick={() => this.handleEdit(record, 'customverify')} style={{color: '#1890ff'}}><Icon type="edit" /></span>
-            <Popconfirm title="纭畾鍒犻櫎鍚�?" onConfirm={() => this.handleDelete(record, 'customverify')}>
+            <span className="operation-btn" title={this.props.dict['header.edit']} onClick={() => this.handleEdit(record, 'customverify')} style={{color: '#1890ff'}}><Icon type="edit" /></span>
+            <Popconfirm
+              title={this.props.dict['header.form.query.delete']}
+              okText={this.props.dict['header.confirm']}
+              cancelText={this.props.dict['header.cancel']}
+              onConfirm={() => this.handleDelete(record, 'customverify')
+            }>
               <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span>
             </Popconfirm>
-            <span className="operation-btn" onClick={() => this.handleUpDown(record, 'customverify', 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span>
-            <span className="operation-btn" onClick={() => this.handleUpDown(record, 'customverify', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span>
+            <span className="operation-btn" title={this.props.dict['header.form.up']} onClick={() => this.handleUpDown(record, 'customverify', 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span>
+            <span className="operation-btn" title={this.props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'customverify', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span>
+            <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'customverify')} style={{color: '#8E44AD'}}><Icon type="swap" /></span>
           </div>)
       }
     ],
@@ -98,7 +146,25 @@
       {
         title: 'SQL',
         dataIndex: 'sql',
-        width: '80%'
+        width: '70%'
+      },
+      {
+        title: '鐘舵��',
+        dataIndex: 'status',
+        width: '10%',
+        render: (text, record) => record.status === 'false' ?
+          (
+            <div>
+              {this.props.dict['header.form.status.forbidden']}
+              <Icon style={{marginLeft: '5px'}} type="stop" theme="twoTone" twoToneColor="#ff4d4f" />
+            </div>
+          ) :
+          (
+            <div>
+              {this.props.dict['header.form.status.open']}
+              <Icon style={{marginLeft: '5px'}} type="check-circle" theme="twoTone" twoToneColor="#52c41a" />
+            </div>
+          )
       },
       {
         title: '鎿嶄綔',
@@ -107,12 +173,18 @@
         dataIndex: 'operation',
         render: (text, record) =>
           (<div>
-            <span className="operation-btn" onClick={() => this.handleEdit(record, 'scripts')} style={{color: '#1890ff'}}><Icon type="edit" /></span>
-            <Popconfirm title="纭畾鍒犻櫎鍚�?" onConfirm={() => this.handleDelete(record, 'scripts')}>
+            <span className="operation-btn" title={this.props.dict['header.edit']} onClick={() => this.handleEdit(record, 'scripts')} style={{color: '#1890ff'}}><Icon type="edit" /></span>
+            <Popconfirm
+              title={this.props.dict['header.form.query.delete']}
+              okText={this.props.dict['header.confirm']}
+              cancelText={this.props.dict['header.cancel']}
+              onConfirm={() => this.handleDelete(record, 'scripts')
+            }>
               <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span>
             </Popconfirm>
-            <span className="operation-btn" onClick={() => this.handleUpDown(record, 'scripts', 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span>
-            <span className="operation-btn" onClick={() => this.handleUpDown(record, 'scripts', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span>
+            <span className="operation-btn" title={this.props.dict['header.form.up']} onClick={() => this.handleUpDown(record, 'scripts', 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span>
+            <span className="operation-btn" title={this.props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'scripts', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span>
+            <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'scripts')} style={{color: '#8E44AD'}}><Icon type="swap" /></span>
           </div>)
       }
     ],
@@ -120,28 +192,28 @@
       {
         title: '鍑芥暟鍙橀噺',
         dataIndex: 'fieldName',
-        width: '15%',
+        width: '13%',
         render: (text, record) => (`${record.fieldName || ''}(${record.field})`)
       },
       {
         title: '绫诲瀷',
         dataIndex: 'billType',
-        width: '10%',
+        width: '8%',
       },
       {
         title: '鍑瘉绫诲瀷',
         dataIndex: 'ModularCodeName',
-        width: '13%'
+        width: '11%'
       },
       {
         title: '鍑瘉鏍囪瘑',
         dataIndex: 'ModularDetailCode',
-        width: '13%'
+        width: '11%'
       },
       {
         title: '鍏宠仈瀛楁',
         dataIndex: 'linkFieldName',
-        width: '13%',
+        width: '12%',
         render: (text, record) => (record.linkField ? `${record.linkFieldName || ''}(${record.linkField})` : '')
       },
       {
@@ -168,18 +240,42 @@
         }
       },
       {
+        title: '鐘舵��',
+        dataIndex: 'status',
+        width: '9%',
+        render: (text, record) => record.status === 'false' ?
+          (
+            <div>
+              {this.props.dict['header.form.status.forbidden']}
+              <Icon style={{marginLeft: '5px'}} type="stop" theme="twoTone" twoToneColor="#ff4d4f" />
+            </div>
+          ) :
+          (
+            <div>
+              {this.props.dict['header.form.status.open']}
+              <Icon style={{marginLeft: '5px'}} type="check-circle" theme="twoTone" twoToneColor="#52c41a" />
+            </div>
+          )
+      },
+      {
         title: '鎿嶄綔',
         align: 'center',
         width: '15%',
         dataIndex: 'operation',
         render: (text, record) =>
           (<div>
-            <span className="operation-btn" onClick={() => this.handleEdit(record, 'ordercode')} style={{color: '#1890ff'}}><Icon type="edit" /></span>
-            <Popconfirm title="纭畾鍒犻櫎鍚�?" onConfirm={() => this.handleDelete(record, 'ordercode')}>
+            <span className="operation-btn" title={this.props.dict['header.edit']} onClick={() => this.handleEdit(record, 'ordercode')} style={{color: '#1890ff'}}><Icon type="edit" /></span>
+            <Popconfirm
+              title={this.props.dict['header.form.query.delete']}
+              okText={this.props.dict['header.confirm']}
+              cancelText={this.props.dict['header.cancel']}
+              onConfirm={() => this.handleDelete(record, 'ordercode')
+            }>
               <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span>
             </Popconfirm>
-            <span className="operation-btn" onClick={() => this.handleUpDown(record, 'ordercode', 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span>
-            <span className="operation-btn" onClick={() => this.handleUpDown(record, 'ordercode', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span>
+            <span className="operation-btn" title={this.props.dict['header.form.up']} onClick={() => this.handleUpDown(record, 'ordercode', 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span>
+            <span className="operation-btn" title={this.props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'ordercode', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span>
+            <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'ordercode')} style={{color: '#8E44AD'}}><Icon type="swap" /></span>
           </div>)
       }
     ]
@@ -492,6 +588,49 @@
     }
   }
 
+  handleStatus = (record, type) => {
+    let verify = JSON.parse(JSON.stringify(this.state.verify))
+    record.status = record.status === 'false' ? 'true' : 'false'
+
+    if (type === 'customverify') {
+      verify.customverifys = verify.customverifys.map(item => {
+        if (item.uuid === record.uuid) {
+          return record
+        } else {
+          return item
+        }
+      })
+    } else if (type === 'unique') {
+      verify.uniques = verify.uniques.map(item => {
+        if (item.uuid === record.uuid) {
+          return record
+        } else {
+          return item
+        }
+      })
+    } else if (type === 'ordercode') {
+      verify.billcodes = verify.billcodes.map(item => {
+        if (item.uuid === record.uuid) {
+          return record
+        } else {
+          return item
+        }   
+      })
+    } else if (type === 'scripts') {
+      verify.scripts = verify.scripts.map(item => {
+        if (item.uuid === record.uuid) {
+          return record
+        } else {
+          return item
+        }
+      })
+    }
+
+    this.setState({
+      verify: verify
+    })
+  }
+
   handleUpDown = (record, type, direction) => {
     let verify = JSON.parse(JSON.stringify(this.state.verify))
     let index = 0

--
Gitblit v1.8.0