From afea443ff88de9580e6023523464ed23e8194a8b Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期六, 28 十月 2023 18:30:53 +0800
Subject: [PATCH] Merge branch 'master' into positec

---
 src/tabviews/custom/components/table/edit-table/normalTable/index.jsx |   53 ++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 48 insertions(+), 5 deletions(-)

diff --git a/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx b/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx
index bd322ed..cdf3368 100644
--- a/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx
+++ b/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx
@@ -15,6 +15,7 @@
 
 const { Paragraph } = Typography
 const MkIcon = asyncComponent(() => import('@/components/mk-icon'))
+const MKPopSelect = asyncComponent(() => import('./mkPopSelect'))
 const CardCellComponent = asyncComponent(() => import('@/tabviews/custom/components/card/cardcellList'))
 
 class CusSwitch extends Component {
@@ -370,6 +371,25 @@
     }, 10)
   }
 
+  onPopChange = (values) => {
+    const { col, record } = this.props
+
+    this.setState({editing: false})
+
+    setTimeout(() => {
+      if (/\$next/.test(col.enter)) {
+        MKEmitter.emit('nextLine', col, record.$$uuid)
+      } else if (col.enter === '$sub') {
+        MKEmitter.emit('subLine', col, record)
+      } else if (col.enter !== '$noAct') {
+        let node = document.getElementById(col.enter + record.$$uuid)
+        node && node.click()
+      }
+    }, 50)
+
+    MKEmitter.emit('changeRecord', col.tableId, {...record, ...values})
+  }
+
   render() {
     let { col, config, record, style, className, ...resProps } = this.props
     const { editing, value, err } = this.state
@@ -445,6 +465,12 @@
 
             return (<td onClick={(e) => e.stopPropagation()} className="editing_table_cell">
               <CusSwitch config={col} defaultValue={_value} autoFocus={true} onChange={this.onSwitchChange} onBlur={this.switchBlur}/>
+            </td>)
+          } else if (col.editType === 'popSelect') {
+            let _value = record[col.field] !== undefined ? record[col.field] : ''
+
+            return (<td onClick={(e) => e.stopPropagation()} className="editing_table_cell">
+              <MKPopSelect mask={true} defaultValue={_value} config={col} BID={record.$$BID} ID={record.$$uuid} onChange={this.onPopChange} blur={() => this.setState({editing: false})}/>
             </td>)
           } else {
             let _value = record[col.field] !== undefined ? record[col.field] : ''
@@ -833,6 +859,23 @@
     MKEmitter.emit('changeRecord', col.tableId, {...record, [col.field]: _val})
   }
 
+  onPopChange = (values) => {
+    const { col, record } = this.props
+
+    setTimeout(() => {
+      if (/\$next/.test(col.enter)) {
+        MKEmitter.emit('nextLine', col, record.$$uuid)
+      } else if (col.enter === '$sub') {
+        MKEmitter.emit('subLine', col, record)
+      } else if (col.enter !== '$noAct') {
+        let node = document.getElementById(col.enter + record.$$uuid)
+        node && node.click()
+      }
+    }, 50)
+
+    MKEmitter.emit('changeRecord', col.tableId, {...record, ...values})
+  }
+
   render() {
     let { col, config, record, style, className, ...resProps } = this.props
     const { err } = this.state
@@ -862,6 +905,10 @@
         } else if (col.editType === 'date') {
           children = (
             <CusDatePicker config={col} value={record[col.field] || null} onChange={this.onDateChange} blur={() => {}}/>
+          )
+        } else if (col.editType === 'popSelect') {
+          children = (
+            <MKPopSelect config={col} defaultValue={record[col.field] || ''} BID={record.$$BID} ID={record.$$uuid} onChange={this.onPopChange}/>
           )
         } else {
           children = (<>
@@ -2030,11 +2077,7 @@
     })
 
     if (err) {
-      notification.warning({
-        top: 92,
-        message: err,
-        duration: 5
-      })
+      message.warning(err)
 
       return null
     }

--
Gitblit v1.8.0