From fb64bcf1fab18b33d21470c83f28d4cda8d309ce Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 26 十月 2022 12:15:59 +0800
Subject: [PATCH] 2022-10-26

---
 src/templates/zshare/modalform/index.jsx |   23 +++++++++++++++++++++--
 1 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/src/templates/zshare/modalform/index.jsx b/src/templates/zshare/modalform/index.jsx
index 7b0eb1f..b4354cc 100644
--- a/src/templates/zshare/modalform/index.jsx
+++ b/src/templates/zshare/modalform/index.jsx
@@ -1,7 +1,7 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { fromJS } from 'immutable'
-import { Form, Row, Col, Input, Select, Radio, notification, InputNumber, Tooltip, Checkbox } from 'antd'
+import { Form, Row, Col, Input, Select, Radio, notification, InputNumber, Tooltip, Checkbox, AutoComplete } from 'antd'
 import { QuestionCircleOutlined } from '@ant-design/icons'
 
 import { formRule } from '@/utils/option.js'
@@ -565,6 +565,12 @@
     this.props.form.setFieldsValue({dataSource: resource})
   }
 
+  complete = (key, option) => {
+    let label = option.props.label
+
+    this.props.form.setFieldsValue({label: label})
+  }
+
   getFields() {
     const { getFieldDecorator } = this.props.form
     const { transfield } = this.state
@@ -613,7 +619,20 @@
           })
         }
 
-        content = <Input placeholder="" autoComplete="off" onPressEnter={this.handleSubmit} />
+        if (item.key === 'field' && item.options && item.options.length > 0) {
+          content = <AutoComplete
+            dataSource={item.options.map((cell) => <AutoComplete.Option label={cell.label} value={cell.field} key={cell.uuid}>
+              {cell.field}
+            </AutoComplete.Option>)}
+            filterOption={(input, option) => option.props.children.indexOf(input) > -1}
+            onSelect={this.complete}
+            placeholder=""
+          >
+            <Input placeholder="" autoComplete="off" onPressEnter={this.handleSubmit} />
+          </AutoComplete>
+        } else {
+          content = <Input placeholder="" autoComplete="off" onPressEnter={this.handleSubmit} />
+        }
       } else if (item.type === 'number') {
         rules = [
           { required: item.required, message: '璇疯緭鍏�' + item.label + '!' }

--
Gitblit v1.8.0