From 973dd90ad4fb5061fbc8db0b2cb8ade7217328bf Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 04 二月 2020 17:18:37 +0800
Subject: [PATCH] 2020-02-04

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

diff --git a/src/templates/tableshare/verifycard/billcodeform/index.jsx b/src/templates/tableshare/verifycard/billcodeform/index.jsx
index 07c3a92..2df33e0 100644
--- a/src/templates/tableshare/verifycard/billcodeform/index.jsx
+++ b/src/templates/tableshare/verifycard/billcodeform/index.jsx
@@ -10,6 +10,7 @@
     floor: PropTypes.any,           // 鏄惁涓哄瓙琛�
     dict: PropTypes.object,         // 瀛楀吀椤�
     fields: PropTypes.array,        // 琛ㄥ崟
+    billcodes: PropTypes.array,     // 琛ㄥ崟
     columns: PropTypes.array,       // 琛ㄥ崟
     modular: PropTypes.array,       // 琛ㄥ崟
     modularDetail: PropTypes.array, // 琛ㄥ崟
@@ -55,9 +56,11 @@
       }
     }
 
+    let _usedfields = this.props.billcodes.map(item => item.field)
+
     this.setState({
       modularDetail: _modularDetail,
-      funFields: this.props.fields.filter(field => field.type === 'funcvar'),
+      funFields: this.props.fields.filter(field => field.type === 'funcvar' && !_usedfields.includes(field.field)),
       billFields: _billFields
     })
   }
@@ -73,6 +76,9 @@
   }
 
   edit = (record) => {
+    let _usedfields = this.props.billcodes.map(item => item.field)
+    let _funFields = this.props.fields.filter(field => field.type === 'funcvar' && (!_usedfields.includes(field.field) || field.field === record.field))
+
     if (record.TypeCharOne === 'Y' || record.TypeCharOne === 'n') {
       let _detail = this.props.modularDetail.filter(item => item.BID === record.ModularCode)
       let _modularDetailCode = ''
@@ -83,25 +89,29 @@
 
       this.setState({
         type: '2',
+        funFields: _funFields,
         editItem: record,
         modularDetail: _detail
-      })
-      this.props.form.setFieldsValue({
-        field: record.field,
-        TypeCharOne: record.TypeCharOne,
-        ModularCode: record.ModularCode,
-        ModularDetailCode: _modularDetailCode,
+      }, () => {
+        this.props.form.setFieldsValue({
+          field: record.field,
+          TypeCharOne: record.TypeCharOne,
+          ModularCode: record.ModularCode,
+          ModularDetailCode: _modularDetailCode,
+        })
       })
     } else {
       this.setState({
         type: '1',
+        funFields: _funFields,
         editItem: record,
-      })
-      this.props.form.setFieldsValue({
-        field: record.field,
-        TypeCharOne: record.TypeCharOne,
-        Type: record.Type,
-        linkField: record.linkField,
+      }, () => {
+        this.props.form.setFieldsValue({
+          field: record.field,
+          TypeCharOne: record.TypeCharOne,
+          Type: record.Type,
+          linkField: record.linkField,
+        })
       })
     }
   }
@@ -170,6 +180,13 @@
         this.props.orderChange(values)
         this.setState({
           editItem: null
+        }, () => {
+
+          let _usedfields = this.props.billcodes.map(item => item.field)
+
+          this.setState({
+            funFields: this.props.fields.filter(field => field.type === 'funcvar' && !_usedfields.includes(field.field)),
+          })
         })
         this.props.form.setFieldsValue({
           field: '',
@@ -195,7 +212,7 @@
     return (
       <Form {...formItemLayout} className="verify-form">
         <Row gutter={24}>
-          <Col span={5}>
+          <Col span={10}>
             <Form.Item label={'鍑芥暟鍙橀噺'}>
               {getFieldDecorator('field', {
                 initialValue: '',
@@ -208,7 +225,7 @@
               })(
                 <Select>
                   {this.state.funFields.map(option =>
-                    <Select.Option id={option.uuid} key={option.uuid} value={option.field}>
+                    <Select.Option title={option.label} id={option.uuid} key={option.uuid} value={option.field}>
                       {option.label}
                     </Select.Option>
                   )}
@@ -216,7 +233,7 @@
               )}
             </Form.Item>
           </Col>
-          <Col span={5}>
+          <Col span={10}>
             <Form.Item label={'绫诲瀷'}>
               {getFieldDecorator('TypeCharOne', {
                 initialValue: 'Lp',
@@ -236,7 +253,12 @@
               )}
             </Form.Item>
           </Col>
-          {type === '1' ? <Col span={5}>
+          <Col span={4} className="add">
+            <Button onClick={this.handleConfirm} type="primary">
+              纭畾
+            </Button>
+          </Col>
+          {type === '1' ? <Col span={10}>
             <Form.Item label={'鍏宠仈瀛楁'}>
               {getFieldDecorator('linkField', {
                 initialValue: '',
@@ -249,7 +271,7 @@
               })(
                 <Select>
                   {this.state.billFields.map(option =>
-                    <Select.Option id={option.uuid} key={option.uuid} value={option.field}>
+                    <Select.Option title={option.label} id={option.uuid} key={option.uuid} value={option.field}>
                       {option.label}
                     </Select.Option>
                   )}
@@ -257,7 +279,7 @@
               )}
             </Form.Item>
           </Col> : null}
-          {type === '1' ? <Col span={5}>
+          {type === '1' ? <Col span={10}>
             <Form.Item label={'浣嶆暟'}>
               {getFieldDecorator('Type', {
                 initialValue: 4,
@@ -270,7 +292,7 @@
               })(<InputNumber min={1} max={10} precision={0} />)}
             </Form.Item>
           </Col> : null}
-          {type === '2' ? <Col span={5}>
+          {type === '2' ? <Col span={10}>
             <Form.Item label={'鍑瘉绫诲瀷'}>
               {getFieldDecorator('ModularCode', {
                 initialValue: this.props.modular[0] ? this.props.modular[0].ID : '',
@@ -287,7 +309,7 @@
                   onChange={(value) => {this.voucherChange(value)}}
                 >
                   {this.props.modular.map(option =>
-                    <Select.Option id={option.ID} key={option.ID} value={option.ID}>
+                    <Select.Option title={option.NameNO} id={option.ID} key={option.ID} value={option.ID}>
                       {option.NameNO}
                     </Select.Option>
                   )}
@@ -295,7 +317,7 @@
               )}
             </Form.Item>
           </Col> : null}
-          {type === '2' ? <Col span={5}>
+          {type === '2' ? <Col span={10}>
             <Form.Item label={'鍑瘉鏍囪瘑'}>
               {getFieldDecorator('ModularDetailCode', {
                 initialValue: this.state.modularDetail[0] ? this.state.modularDetail[0].ModularDetailCode : '',
@@ -311,7 +333,7 @@
                   filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
                 >
                   {this.state.modularDetail.map(option =>
-                    <Select.Option id={option.ModularDetailCode} key={option.ModularDetailCode} value={option.ModularDetailCode}>
+                    <Select.Option title={option.CodeName} id={option.ModularDetailCode} key={option.ModularDetailCode} value={option.ModularDetailCode}>
                       {option.CodeName}
                     </Select.Option>
                   )}
@@ -319,11 +341,6 @@
               )}
             </Form.Item>
           </Col> : null}
-          <Col span={4} className="add">
-            <Button onClick={this.handleConfirm} type="primary">
-              纭畾
-            </Button>
-          </Col>
         </Row>
       </Form>
     )

--
Gitblit v1.8.0