From b9a0e8541f0959db5d848f7b893c8838851ce411 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 09 四月 2020 13:29:49 +0800
Subject: [PATCH] 2020-04-09

---
 src/templates/zshare/verifycard/billcodeform/index.jsx |  104 ++++++++++++++++++++++++++++++++++------------------
 1 files changed, 68 insertions(+), 36 deletions(-)

diff --git a/src/templates/zshare/verifycard/billcodeform/index.jsx b/src/templates/zshare/verifycard/billcodeform/index.jsx
index ee1770f..dd6ec73 100644
--- a/src/templates/zshare/verifycard/billcodeform/index.jsx
+++ b/src/templates/zshare/verifycard/billcodeform/index.jsx
@@ -1,7 +1,8 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { is, fromJS } from 'immutable'
-import { Form, Row, Col, Select, Button, InputNumber } from 'antd'
+import { Form, Row, Col, Select, Button, InputNumber, Input, Tooltip, Icon } from 'antd'
+import { formRule } from '@/utils/option.js'
 import './index.scss'
 
 
@@ -22,7 +23,8 @@
     modularDetail: [],
     funFields: [],
     billFields: [],
-    type: '1'
+    type: '1',
+    TypeCharOne: 'Lp'
   }
 
   UNSAFE_componentWillMount() {
@@ -84,7 +86,8 @@
         type: '2',
         funFields: _funFields,
         editItem: record,
-        modularDetail: _detail
+        modularDetail: _detail,
+        TypeCharOne: record.TypeCharOne
       }, () => {
         this.props.form.setFieldsValue({
           field: record.field,
@@ -98,13 +101,18 @@
         type: '1',
         funFields: _funFields,
         editItem: record,
+        TypeCharOne: record.TypeCharOne
       }, () => {
-        this.props.form.setFieldsValue({
+        let _form = {
           field: record.field,
           TypeCharOne: record.TypeCharOne,
           Type: record.Type,
-          linkField: record.linkField,
-        })
+          linkField: record.linkField
+        }
+        if (record.TypeCharOne === 'Lp') {
+          _form.mark = record.mark || ''
+        }
+        this.props.form.setFieldsValue(_form)
       })
     }
   }
@@ -123,11 +131,13 @@
   TypeCharOneChange = (value) => {
     if (value === 'Y' || value === 'n') {
       this.setState({
-        type: '2'
+        type: '2',
+        TypeCharOne: value
       })
     } else {
       this.setState({
-        type: '1'
+        type: '1',
+        TypeCharOne: value
       })
     }
   }
@@ -181,16 +191,20 @@
             funFields: this.props.fields.filter(field => field.type === 'funcvar' && !_usedfields.includes(field.field)),
           })
         })
-        this.props.form.setFieldsValue({
-          field: '',
-        })
+        let _form = {
+          field: ''
+        }
+        if (this.state.TypeCharOne === 'Lp') {
+          _form.mark = ''
+        }
+        this.props.form.setFieldsValue(_form)
       }
     })
   }
 
   render() {
     const { getFieldDecorator } = this.props.form
-    const { type } = this.state
+    const { type, TypeCharOne } = this.state
     const formItemLayout = {
       labelCol: {
         xs: { span: 24 },
@@ -205,7 +219,7 @@
     return (
       <Form {...formItemLayout} className="verify-form">
         <Row gutter={24}>
-          <Col span={10}>
+          <Col span={7}>
             <Form.Item label={this.props.dict['header.form.funcvar']}>
               {getFieldDecorator('field', {
                 initialValue: '',
@@ -226,7 +240,7 @@
               )}
             </Form.Item>
           </Col>
-          <Col span={10}>
+          <Col span={7}>
             <Form.Item label={'绫诲瀷'}>
               {getFieldDecorator('TypeCharOne', {
                 initialValue: 'Lp',
@@ -246,12 +260,7 @@
               )}
             </Form.Item>
           </Col>
-          <Col span={4} className="add">
-            <Button onClick={this.handleConfirm} type="primary">
-              纭畾
-            </Button>
-          </Col>
-          {type === '1' ? <Col span={10}>
+          {type === '1' ? <Col span={7}>
             <Form.Item label={'鍏宠仈瀛楁'}>
               {getFieldDecorator('linkField', {
                 initialValue: '',
@@ -272,20 +281,7 @@
               )}
             </Form.Item>
           </Col> : null}
-          {type === '1' ? <Col span={10}>
-            <Form.Item label={'浣嶆暟'}>
-              {getFieldDecorator('Type', {
-                initialValue: 4,
-                rules: [
-                  {
-                    required: true,
-                    message: this.props.dict['form.required.input'] + '浣嶆暟!'
-                  }
-                ]
-              })(<InputNumber min={1} max={10} precision={0} />)}
-            </Form.Item>
-          </Col> : null}
-          {type === '2' ? <Col span={10}>
+          {type === '2' ? <Col span={7}>
             <Form.Item label={'鍑瘉绫诲瀷'}>
               {getFieldDecorator('ModularCode', {
                 initialValue: this.props.modular[0] ? this.props.modular[0].ID : '',
@@ -310,7 +306,25 @@
               )}
             </Form.Item>
           </Col> : null}
-          {type === '2' ? <Col span={10}>
+          <Col span={3} className="add">
+            <Button onClick={this.handleConfirm} type="primary">
+              纭畾
+            </Button>
+          </Col>
+          {type === '1' ? <Col span={7}>
+            <Form.Item label={'浣嶆暟'}>
+              {getFieldDecorator('Type', {
+                initialValue: 4,
+                rules: [
+                  {
+                    required: true,
+                    message: this.props.dict['form.required.input'] + '浣嶆暟!'
+                  }
+                ]
+              })(<InputNumber min={1} max={10} precision={0} />)}
+            </Form.Item>
+          </Col> : null}
+          {type === '2' ? <Col span={7}>
             <Form.Item label={'鍑瘉鏍囪瘑'}>
               {getFieldDecorator('ModularDetailCode', {
                 initialValue: this.state.modularDetail[0] ? this.state.modularDetail[0].ModularDetailCode : '',
@@ -326,7 +340,7 @@
                   filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
                 >
                   {this.state.modularDetail.map(option =>
-                    <Select.Option title={option.CodeName} id={option.ModularDetailCode} key={option.ModularDetailCode} value={option.ModularDetailCode}>
+                    <Select.Option style={{whiteSpace: 'unset'}} title={option.CodeName} id={option.ModularDetailCode} key={option.ModularDetailCode} value={option.ModularDetailCode}>
                       {option.CodeName}
                     </Select.Option>
                   )}
@@ -334,6 +348,24 @@
               )}
             </Form.Item>
           </Col> : null}
+          {TypeCharOne === 'Lp' ? <Col span={7}>
+            <Form.Item label={
+              <Tooltip placement="topLeft" title="璇ユ爣璇嗙敤浜庣敓鎴愯鍙疯鍒欙紝涓虹┖鏃朵娇鐢ㄦ寜閽甀D">
+                <Icon type="question-circle" />
+                {'鏍囪瘑'}
+              </Tooltip>
+            }>
+              {getFieldDecorator('mark', {
+                initialValue: '',
+                rules: [
+                  {
+                    pattern: /^[a-zA-Z0-9]*$/ig,
+                    message: formRule.input.letternummsg
+                  }
+                ]
+              })(<Input placeholder="" autoComplete="off" />)}
+            </Form.Item>
+          </Col> : null}
         </Row>
       </Form>
     )

--
Gitblit v1.8.0