From 8d66ff34fae5b048a6b7923cc75d34f13a08be9d Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 02 八月 2022 11:42:43 +0800
Subject: [PATCH] Merge branch 'develop'

---
 src/templates/sharecomponent/searchcomponent/searchform/index.jsx |   53 +++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 45 insertions(+), 8 deletions(-)

diff --git a/src/templates/sharecomponent/searchcomponent/searchform/index.jsx b/src/templates/sharecomponent/searchcomponent/searchform/index.jsx
index 2b3e7fd..06d7186 100644
--- a/src/templates/sharecomponent/searchcomponent/searchform/index.jsx
+++ b/src/templates/sharecomponent/searchcomponent/searchform/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, Tooltip, InputNumber, Checkbox, Cascader } from 'antd'
+import { Form, Row, Col, Input, Select, Radio, notification, Tooltip, InputNumber, Checkbox, Cascader, AutoComplete } from 'antd'
 import { QuestionCircleOutlined } from '@ant-design/icons'
 
 import { dateOptions, matchReg, formRule } from '@/utils/option.js'
@@ -119,7 +119,6 @@
     openType: null,          // 鎼滅储鏉′欢鏄剧ず绫诲瀷
     resourceType: null,      // 涓嬫媺鎼滅储鏃讹紝閫夐」鏉ユ簮绫诲瀷
     formlist: null,          // 琛ㄥ崟
-    display: null,
     cFields: [],
     textTooltip: '瀛楁鍚嶅彲浠ヤ娇鐢ㄩ�楀彿鍒嗛殧锛岃繘琛岀患鍚堟悳绱�',
   }
@@ -189,17 +188,28 @@
         shows.push('dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'database')
       }
     } else if (type === 'checkcard') {
+      reRequired.fields = false
       if (this.record.display === 'picture') {
         if (this.record.resourceType === '0') {        // 鑷畾涔夎祫婧�
-          shows.push('options', 'picratio')
+          shows.push('options', 'fields', 'picratio')
         } else if (this.record.resourceType === '1') { // 鏁版嵁婧�
-          shows.push('dataSource', 'cardValField', 'urlField', 'orderBy', 'orderType', 'database', 'picratio')
+          shows.push('dataSource', 'cardValField', 'fields', 'urlField', 'orderBy', 'orderType', 'database', 'picratio')
+        }
+      } else if (this.record.display === 'color') {
+        if (this.record.resourceType === '0') {        // 鑷畾涔夎祫婧�
+          shows.push('options', 'fields')
+        } else if (this.record.resourceType === '1') { // 鏁版嵁婧�
+          shows.push('dataSource', 'cardValField', 'fields', 'orderBy', 'orderType', 'database')
         }
       } else {
+        reRequired.fields = true
         if (this.record.resourceType === '0') {        // 鑷畾涔夎祫婧�
-          shows.push('options', 'fields', 'backgroundColor', 'borderColor')
+          shows.push('options', 'fields', 'selectStyle')
         } else if (this.record.resourceType === '1') { // 鏁版嵁婧�
-          shows.push('dataSource', 'cardValField', 'fields', 'orderBy', 'orderType', 'database', 'backgroundColor', 'borderColor')
+          shows.push('dataSource', 'cardValField', 'fields', 'orderBy', 'orderType', 'database', 'selectStyle')
+        }
+        if (this.record.selectStyle === 'custom') {
+          shows.push('backgroundColor')
         }
       }
       shows.push('linkField')
@@ -419,6 +429,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 { dict } = this.props
@@ -455,7 +471,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.value} key={cell.key}>
+              {cell.text}
+            </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: dict['form.required.input'] + item.label + '!' }
@@ -490,7 +519,7 @@
           { required: item.required, message: dict['form.required.select'] + item.label + '!' }
         ]
 
-        content = <Radio.Group onChange={(e) => {this.optionChange(item.key, e.target.value)}}>
+        content = <Radio.Group style={{whiteSpace: 'nowrap'}} onChange={(e) => {this.optionChange(item.key, e.target.value)}}>
           {item.options.map(option => {
             return (
               <Radio key={option.value} value={option.value}>{option.text}</Radio>
@@ -527,6 +556,10 @@
         span = 24
         className = 'text-area'
 
+        rules = [
+          { required: item.required, message: '璇锋坊鍔�' + item.label + '!' }
+        ]
+
         content = <FieldsTable dict={dict} onChange={this.changeField}/>
       } else if (item.type === 'checkbox') {
         rules = [
@@ -548,6 +581,10 @@
         content = <Cascader options={item.options} placeholder="" />
       } else if (item.type === 'color') {
         className = 'color-form-item'
+        rules = [
+          { required: item.required, message: dict['form.required.select'] + item.label + '!' }
+        ]
+        
         content = <ColorSketch allowClear={true}/>
       }
 

--
Gitblit v1.8.0