From 6de5ea0a0c6f06e0321ae41846473118fb85de48 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 20 十月 2022 15:04:24 +0800
Subject: [PATCH] 2022-10-20

---
 src/menu/components/table/base-table/columns/index.jsx |   89 +++++---------------------------------------
 1 files changed, 11 insertions(+), 78 deletions(-)

diff --git a/src/menu/components/table/base-table/columns/index.jsx b/src/menu/components/table/base-table/columns/index.jsx
index 44be56a..5292b18 100644
--- a/src/menu/components/table/base-table/columns/index.jsx
+++ b/src/menu/components/table/base-table/columns/index.jsx
@@ -3,13 +3,11 @@
 import { is, fromJS } from 'immutable'
 import { DndProvider, DragSource, DropTarget } from 'react-dnd'
 import { Table, Popover, Modal, message } from 'antd'
-import { PlusOutlined, FileSyncOutlined, EditOutlined, CopyOutlined, DeleteOutlined, FontColorsOutlined, CloseCircleOutlined, AntDesignOutlined } from '@ant-design/icons'
+import { PlusOutlined, EditOutlined, CopyOutlined, DeleteOutlined, FontColorsOutlined, CloseCircleOutlined, AntDesignOutlined } from '@ant-design/icons'
 
 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'
 
@@ -17,7 +15,6 @@
 const EditColumn = asyncIconComponent(() => import('./editColumn'))
 const MarkColumn = asyncIconComponent(() => import('@/menu/components/share/markcomponent'))
 const CardCellComponent = asyncComponent(() => import('@/menu/components/card/cardcellcomponent'))
-const MobPagination = asyncIconComponent(() => import('@/menu/components/share/mobPagination'))
 const PasteComponent = asyncIconComponent(() => import('@/components/paste'))
 
 class HeaderCol extends Component {
@@ -140,8 +137,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() {
@@ -194,8 +190,6 @@
   }
 
   state = {
-    dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
-    appType: sessionStorage.getItem('appType'),
     tableId: '',
     data: [{uuid: Utils.getuuid()}],
     refresh: false,    // 寮哄埗鍒锋柊
@@ -255,7 +249,6 @@
 
     return !is(fromJS(this.state), fromJS(nextState)) ||
       !is(fromJS(config.wrap), fromJS(nextProps.config.wrap)) ||
-      !is(fromJS(config.search), fromJS(nextProps.config.search)) ||
       !is(fromJS(config.action), fromJS(nextProps.config.action)) ||
       config.setting.laypage !== nextProps.config.setting.laypage
   }
@@ -313,11 +306,10 @@
     cell.uuid = Utils.getuuid()
     cell.focus = true
     
-    MKEmitter.emit('cardAddElement', [this.props.config.uuid, col.uuid], cell)
+    MKEmitter.emit('cardAddElement', col.uuid, cell)
   }
 
   addElement = (col) => {
-    const { config } = this.props
     let column = fromJS(col).toJS()
 
     if (column.type === 'colspan') {
@@ -333,7 +325,7 @@
       let newcard = {uuid: Utils.getuuid(), focus: true, width: 24, eleType: 'text', datatype: 'dynamic', style: {paddingLeft: '4px'}}
   
       // 娉ㄥ唽浜嬩欢-娣诲姞鍏冪礌
-      MKEmitter.emit('cardAddElement', [config.uuid, column.uuid], newcard)
+      MKEmitter.emit('cardAddElement', column.uuid, newcard)
     } else if (column.type === 'action') {
       let newcard = {
         uuid: Utils.getuuid(),
@@ -349,7 +341,7 @@
       }
 
       // 娉ㄥ唽浜嬩欢-娣诲姞鍏冪礌
-      MKEmitter.emit('cardAddElement', [config.uuid, column.uuid], newcard)
+      MKEmitter.emit('cardAddElement', column.uuid, newcard)
     }
   }
 
@@ -408,7 +400,6 @@
   }
 
   deleteCol = (col) => {
-    const { appType } = this.state
     let _columns = fromJS(this.state.columns).toJS()
 
     _columns = this.loopDelCol(_columns, col)
@@ -419,11 +410,11 @@
       this.props.updatecolumn({...this.props.config, cols: _columns})
     })
 
-    if (col.type !== 'action' || appType === 'mob') return
+    if (col.type !== 'action') return
 
     let uuids = []
     col.elements && col.elements.forEach(c => {
-      if (appType === 'pc' && c.OpenType !== 'popview') return
+      if (c.OpenType !== 'popview') return
 
       uuids.push(c.uuid)
     })
@@ -502,61 +493,6 @@
     })
   }
 
-  syncfield = () => {
-    const { fields } = this.state
-    let columns = fromJS(this.state.columns).toJS()
-
-    columns = columns.filter(c => !c.origin)
-
-    let keys = columns.map(col => col.field)
-
-    fields.forEach(item => {
-      if (keys.includes(item.field)) return
-
-      let cell = { uuid: Utils.getuuid(), label: item.label, field: item.field, Align: 'left', Hide: 'false', IsSort: 'true', Width: 120, blacklist: [], postfix: '', prefix: '', linkmenu: [], marks: [], perspective: 'linkmenu' }
-      
-      if (/Nvarchar|date/ig.test(item.datatype)) {
-        cell.type = 'text'
-        cell.rowspan = 'false'
-        cell.textFormat = 'none'
-      } else {
-        cell.type = 'number'
-        cell.format = 'none'
-        cell.sum = 'false'
-        cell.decimal = item.decimal || 0
-        cell.Width = 80
-      }
-
-      columns.push(cell)
-    })
-
-    const _this = this
-
-    confirm({
-      content: '纭畾鍚屾瀛楁闆嗗悧锛�',
-      onOk() {
-        _this.setState({columns}, () => {
-          _this.props.updatecolumn({..._this.props.config, cols: columns})
-        })
-      },
-      onCancel() {}
-    })
-  }
-
-  clear = () => {
-    const _this = this
-
-    confirm({
-      content: '纭畾娓呯┖鏄剧ず鍒楀悧锛�',
-      onOk() {
-        _this.setState({columns: []}, () => {
-          _this.props.updatecolumn({..._this.props.config, cols: []})
-        })
-      },
-      onCancel() {}
-    })
-  }
-
   /**
    * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊锛屾竻闄ゅ揩鎹烽敭璁剧疆
    */
@@ -568,7 +504,7 @@
 
   render() {
     const { config } = this.props
-    const { fields, card, lineMarks, dict, tableId, appType } = this.state
+    const { fields, card, lineMarks, tableId } = this.state
     const components = {
       header: {
         cell: DragableHeaderCol
@@ -585,8 +521,6 @@
         <div className="col-control">
           <CopyOutlined title="澶嶅埗鏄剧ず鍒�" onClick={this.copycolumn} />
           <MarkColumn columns={fields} type="line" marks={lineMarks} onSubmit={this.updateLineMarks} />
-          <FileSyncOutlined title="鍚屾瀛楁闆�" onClick={this.syncfield} />
-          <DeleteOutlined title="娓呯┖鏄剧ず鍒�" onClick={this.clear}/>
         </div>
         <DndProvider>
           <Table
@@ -598,18 +532,17 @@
             dataSource={this.state.data}
             rowSelection={config.wrap.tableType ? { type: 'radio' } : null}
             columns={columns}
-            pagination={appType !== 'mob' ? {
+            pagination={{
               current: 1,
               pageSize: 10,
               pageSizeOptions: ['10', '25', '50', '100', '500', '1000'],
               showSizeChanger: true,
               total: 58,
               showTotal: (total, range) => `${range[0]}-${range[1]} 鍏� ${total} 鏉
-            } : false}
+            }}
           />
-          {appType === 'mob' && config.setting.laypage !== 'fasle' ? <MobPagination /> : null}
         </DndProvider>
-        <EditColumn column={card} dict={dict} fields={fields} submitCol={this.submitCol} cancelCol={this.cancelCol}/>
+        <EditColumn column={card} fields={fields} submitCol={this.submitCol} cancelCol={this.cancelCol}/>
       </div>
     )
   }

--
Gitblit v1.8.0