From af6486b3629d23e426ce85b87dbc20dfa15b1afe Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 07 十一月 2022 18:50:27 +0800
Subject: [PATCH] 2022-11-07

---
 src/menu/components/table/edit-table/columns/index.jsx |   38 +++++++++++++-------------------------
 1 files changed, 13 insertions(+), 25 deletions(-)

diff --git a/src/menu/components/table/edit-table/columns/index.jsx b/src/menu/components/table/edit-table/columns/index.jsx
index a13f19a..bf073d4 100644
--- a/src/menu/components/table/edit-table/columns/index.jsx
+++ b/src/menu/components/table/edit-table/columns/index.jsx
@@ -8,8 +8,6 @@
 import asyncComponent from '@/utils/asyncComponent'
 import asyncIconComponent from '@/utils/asyncIconComponent'
 import Utils from '@/utils/utils.js'
-import zhCN from '@/locales/zh-CN/model.js'
-import enUS from '@/locales/en-US/model.js'
 import MKEmitter from '@/utils/events.js'
 import './index.scss'
 
@@ -130,8 +128,7 @@
 
     return !is(fromJS(column), fromJS(nextProps.column)) ||
       !is(fromJS(config.columns), fromJS(nextProps.config.columns)) ||
-      !is(fromJS(config.action), fromJS(nextProps.config.action)) ||
-      !is(fromJS(config.search), fromJS(nextProps.config.search))
+      !is(fromJS(config.action), fromJS(nextProps.config.action))
   }
 
   render() {
@@ -184,8 +181,6 @@
   }
 
   state = {
-    dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
-    appType: sessionStorage.getItem('appType'),
     tableId: '',
     data: [{uuid: Utils.getuuid()}],
     refresh: false,    // 寮哄埗鍒锋柊
@@ -246,7 +241,6 @@
     return !is(fromJS(this.state), fromJS(nextState)) ||
       !is(fromJS(config.wrap), fromJS(nextProps.config.wrap)) ||
       !is(fromJS(config.submit), fromJS(nextProps.config.submit)) ||
-      !is(fromJS(config.search), fromJS(nextProps.config.search)) ||
       !is(fromJS(config.action), fromJS(nextProps.config.action)) ||
       config.setting.laypage !== nextProps.config.setting.laypage
   }
@@ -267,11 +261,16 @@
     let _columns = fromJS(this.state.columns).toJS()
     let type = item.subType
 
-    if (item.subType === 'link' || item.subType === 'colspan' || item.subType === 'picture') {
+    if (!['text', 'number', 'textarea', 'custom', 'action', 'formula', 'index'].includes(item.subType)) {
       type = 'text'
     }
 
     let col = { focus: true, uuid: Utils.getuuid(), label: 'label', field: '', type: type, elements: [] }
+    if (col.type === 'action') {
+      col.label = '鎿嶄綔'
+    } else if (col.type === 'index') {
+      col.label = '搴忓彿'
+    }
 
     _columns.splice(hoverIndex, 0, col)
 
@@ -297,6 +296,10 @@
       let config = {...this.props.config, cols: _columns}
       if (btn) {
         config.action = config.action.filter(item => item.uuid !== btn.uuid)
+
+        setTimeout(() => {
+          MKEmitter.emit('revert', config.uuid)
+        }, 200)
       }
 
       this.props.updatecolumn(config)
@@ -400,7 +403,6 @@
   }
 
   deleteCol = (col) => {
-    const { appType } = this.state
     let _columns = fromJS(this.state.columns).toJS()
 
     _columns = _columns.filter(column => column.uuid !== col.uuid)
@@ -410,19 +412,6 @@
     }, () => {
       this.props.updatecolumn({...this.props.config, cols: _columns})
     })
-
-    if (col.type !== 'action' || appType === 'mob') return
-
-    let uuids = []
-    col.elements && col.elements.forEach(c => {
-      if (appType === 'pc' && c.OpenType !== 'popview') return
-
-      uuids.push(c.uuid)
-    })
-
-    if (uuids.length === 0) return
-    
-    MKEmitter.emit('delButtons', uuids)
   }
 
   updateLineMarks = (vals) => {
@@ -546,7 +535,7 @@
 
   render() {
     const { config } = this.props
-    const { fields, card, lineMarks, dict, tableId, visible } = this.state
+    const { fields, card, lineMarks, tableId, visible } = this.state
     const components = {
       header: {
         cell: DragableHeaderCol
@@ -632,7 +621,7 @@
             }}
           />
         </DndProvider>
-        <EditColumn column={card} dict={dict} columns={this.state.columns} fields={fields} submitCol={this.submitCol} cancelCol={this.cancelCol}/>
+        <EditColumn column={card} columns={this.state.columns} fields={fields} submitCol={this.submitCol} cancelCol={this.cancelCol}/>
         <Modal
           wrapClassName="model-table-action-verify-modal"
           title={'缂栬緫'}
@@ -646,7 +635,6 @@
           <TableVerify
             card={config.submit}
             setting={config.setting}
-            dict={dict}
             cols={config.cols}
             columns={config.columns}
             wrappedComponentRef={(inst) => this.verifyRef = inst}

--
Gitblit v1.8.0