From 73083e2eef00c34c2db62ddea12baa6e44ba1dd6 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 08 二月 2024 00:31:07 +0800
Subject: [PATCH] 2024-02-08

---
 src/tabviews/zshare/mutilform/mkPopSelect/index.jsx |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/tabviews/zshare/mutilform/mkPopSelect/index.jsx b/src/tabviews/zshare/mutilform/mkPopSelect/index.jsx
index a0d02c5..30ef195 100644
--- a/src/tabviews/zshare/mutilform/mkPopSelect/index.jsx
+++ b/src/tabviews/zshare/mutilform/mkPopSelect/index.jsx
@@ -80,6 +80,7 @@
       options: [],
       columns,
       value,
+      showValue: config.showValue,
       placeholder,
       arr_field: arrfield.join(','),
       searchKey: '',
@@ -188,8 +189,17 @@
 
           return item
         })
+
+        let showValue = this.state.showValue
+
+        if (showValue) {
+          if (options.findIndex(item => this.state.value === item.$$uuid) > -1) {
+            showValue = ''
+          }
+        }
   
         this.setState({
+          showValue,
           options: options,
           total: result.total || 0,
           loading: false
@@ -261,7 +271,7 @@
     }
 
     this.props.onChange(val, other)
-    this.setState({value: val}, () => {
+    this.setState({value: val, showValue: ''}, () => {
       if (config.enter === 'tab') {
         MKEmitter.emit('mkFC', 'focus', config.tabUuid)
       } else if (config.enter === 'sub') {
@@ -312,14 +322,14 @@
   }
 
   render() {
-    const { value, config, options, visible, loading, total, pageIndex, pageSize, columns, placeholder } = this.state
+    const { value, showValue, config, options, visible, loading, total, pageIndex, pageSize, columns, placeholder, searchKey } = this.state
     
     return <>
       <Select
         className="mk-pop-select"
         showSearch={!!config.searchKey}
         allowClear
-        value={value}
+        value={showValue || value}
         onSearch={(val) => val && this.searchOption(val)}
         filterOption={false}
         onChange={(val) => this.selectChange(val === undefined ? '' : val)}
@@ -342,7 +352,7 @@
         onCancel={() => this.setState({visible: false})}
         destroyOnClose
       >
-        {config.searchKey ? <Search placeholder={placeholder} onSearch={this.searchOption} enterButton /> : null}
+        {config.searchKey ? <Search placeholder={placeholder} defaultValue={searchKey} onSearch={this.searchOption} enterButton /> : null}
         <Table
           rowKey="$$uuid"
           bordered={true}

--
Gitblit v1.8.0