From 8cdfdd9914d1c4f6cd59176d61869522f51f39e4 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期日, 10 十月 2021 13:53:57 +0800
Subject: [PATCH] 2021-10-10

---
 src/menu/components/table/edit-table/columns/tableIn/index.jsx               |  704 +++++++++++++++++++
 src/views/pcdesign/index.jsx                                                 |    2 
 src/tabviews/custom/components/table/edit-table/normalTable/index.jsx        |  496 ++++++++++++-
 src/tabviews/zshare/actionList/excelInbutton/index.jsx                       |   25 
 src/tabviews/custom/components/table/edit-table/normalTable/index.scss       |   23 
 src/tabviews/custom/components/table/edit-table/index.jsx                    |    2 
 src/tabviews/custom/index.jsx                                                |   17 
 src/menu/components/table/edit-table/columns/tableIn/customscript/index.scss |    0 
 src/menu/components/table/edit-table/columns/tableIn/customscript/index.jsx  |  343 +++++++++
 src/menu/components/table/edit-table/columns/tableIn/uniqueform/index.jsx    |  129 +++
 src/menu/components/table/edit-table/columns/editColumn/index.jsx            |   36 
 src/menu/components/table/edit-table/index.jsx                               |    3 
 src/menu/components/table/edit-table/columns/tableIn/uniqueform/index.scss   |    0 
 src/views/menudesign/index.jsx                                               |    2 
 src/menu/components/table/edit-table/columns/tableIn/index.scss              |   83 ++
 src/utils/utils.js                                                           |  230 ++++++
 src/menu/components/table/edit-table/columns/index.jsx                       |   47 +
 src/tabviews/custom/components/table/edit-table/index.scss                   |   24 
 18 files changed, 2,059 insertions(+), 107 deletions(-)

diff --git a/src/menu/components/table/edit-table/columns/editColumn/index.jsx b/src/menu/components/table/edit-table/columns/editColumn/index.jsx
index 17cfbda..df36da4 100644
--- a/src/menu/components/table/edit-table/columns/editColumn/index.jsx
+++ b/src/menu/components/table/edit-table/columns/editColumn/index.jsx
@@ -1,16 +1,16 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { is, fromJS } from 'immutable'
-import { Form, Row, Col, Input, Select, InputNumber, Radio, Tooltip, Icon, Modal } from 'antd'
+import { Form, Row, Col, Input, Select, InputNumber, Radio, Tooltip, Icon, Modal, notification } from 'antd'
 
 import { getColumnForm } from './formconfig'
 import { formRule } from '@/utils/option.js'
 import './index.scss'
 
 const columnTypeOptions = {
-  text: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'textFormat', 'editable', 'blacklist'],
-  number: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'decimal', 'format', 'prefix', 'postfix', 'editable', 'sum', 'blacklist'],
-  textarea: ['label', 'field', 'type', 'Align', 'Hide', 'Width', 'prefix', 'postfix', 'blacklist'],
+  text: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'textFormat', 'editable', 'initval', 'blacklist'],
+  number: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'decimal', 'format', 'prefix', 'postfix', 'editable', 'initval', 'sum', 'blacklist'],
+  textarea: ['label', 'field', 'type', 'Align', 'Hide', 'Width', 'prefix', 'initval', 'postfix', 'blacklist'],
   custom: ['label', 'type', 'Align', 'Hide', 'Width', 'blacklist'],
   action: ['label', 'type', 'Align', 'Width'],
   index: ['label', 'type', 'Align', 'Width']
@@ -44,9 +44,9 @@
 
     if (column.editable === 'true') {
       if (column.type === 'text') {
-        _options.push('required', 'initval', 'enter', 'footEnter')
+        _options.push('required', 'enter', 'footEnter')
       } else if (column.type === 'number') {
-        _options.push('max', 'min', 'initval', 'enter', 'footEnter')
+        _options.push('max', 'min', 'enter', 'footEnter')
       }
     }
 
@@ -78,9 +78,9 @@
 
       if (editable === 'true') {
         if (value === 'text') {
-          _options.push('required', 'initval', 'enter', 'footEnter')
+          _options.push('required', 'enter', 'footEnter')
         } else if (value === 'number') {
-          _options.push('max', 'min', 'initval', 'enter', 'footEnter')
+          _options.push('max', 'min', 'enter', 'footEnter')
         }
       }
 
@@ -117,9 +117,9 @@
 
         if (editable === 'true') {
           if (values.type === 'text') {
-            _options.push('required', 'initval', 'enter', 'footEnter')
+            _options.push('required', 'enter', 'footEnter')
           } else if (values.type === 'number') {
-            _options.push('max', 'min', 'initval', 'enter', 'footEnter')
+            _options.push('max', 'min', 'enter', 'footEnter')
           }
         }
 
@@ -146,9 +146,9 @@
 
       if (value === 'true') {
         if (type === 'text') {
-          _options.push('required', 'initval', 'enter', 'footEnter')
+          _options.push('required', 'enter', 'footEnter')
         } else if (type === 'number') {
-          _options.push('max', 'min', 'initval', 'enter', 'footEnter')
+          _options.push('max', 'min', 'enter', 'footEnter')
         }
       }
 
@@ -310,9 +310,21 @@
   }
 
   handleSubmit = () => {
+    const { columns, column } = this.props
     // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭�
     this.props.form.validateFieldsAndScroll((err, values) => {
       if (!err) {
+        values.uuid = column.uuid
+        values.marks = column.marks || []
+        
+        if (values.field && columns.filter(col => col.field && col.uuid !== values.uuid && col.field === values.field).length > 0) {
+          notification.warning({
+            top: 92,
+            message: '瀛楁宸叉坊鍔狅紒',
+            duration: 5
+          })
+          return
+        }
         this.setState({visible: false, formlist: null})
         this.props.submitCol(values)
       }
diff --git a/src/menu/components/table/edit-table/columns/index.jsx b/src/menu/components/table/edit-table/columns/index.jsx
index 639a389..569b68d 100644
--- a/src/menu/components/table/edit-table/columns/index.jsx
+++ b/src/menu/components/table/edit-table/columns/index.jsx
@@ -2,7 +2,7 @@
 import PropTypes from 'prop-types'
 import { is, fromJS } from 'immutable'
 import { DndProvider, DragSource, DropTarget } from 'react-dnd'
-import { Table, Popover, Icon, Modal, message } from 'antd'
+import { Table, Popover, Icon, Modal, message, Button } from 'antd'
 
 import asyncComponent from '@/utils/asyncComponent'
 import asyncIconComponent from '@/utils/asyncIconComponent'
@@ -14,6 +14,7 @@
 
 const { confirm } = Modal
 const EditColumn = asyncComponent(() => import('./editColumn'))
+const TableVerify = asyncComponent(() => import('./tableIn'))
 const MarkColumn = asyncIconComponent(() => import('@/menu/components/share/markcomponent'))
 const CardCellComponent = asyncComponent(() => import('@/menu/components/card/cardcellcomponent'))
 
@@ -219,6 +220,7 @@
 
     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
@@ -294,10 +296,6 @@
 
   submitCol = (col) => {
     const { card } = this.state
-
-    col.uuid = card.uuid
-    col.isSub = card.isSub === true
-    col.marks = card.marks || []
     
     if (col.type === 'custom') {
       col.elements = card.type === 'custom' ? (card.elements || []) : []
@@ -449,6 +447,18 @@
     })
   }
 
+  verifySubmit = () => {
+    const { config } = this.props
+    
+    this.verifyRef.handleConfirm().then(res => {
+      this.setState({
+        visible: false
+      }, () => {
+        this.props.updatecolumn({...config, submit: res})
+      })
+    })
+  }
+
   componentDidMount () {
     MKEmitter.addListener('submitStyle', this.getStyle)
   }
@@ -465,7 +475,7 @@
 
   render() {
     const { config } = this.props
-    const { fields, card, lineMarks, dict, tableId } = this.state
+    const { fields, card, lineMarks, dict, tableId, visible } = this.state
     const components = {
       header: {
         cell: DragableHeaderCol
@@ -513,6 +523,13 @@
     return (
       <div className={`edit-table-columns ${config.setting.laypage} ${config.wrap.mode || ''}`} id={tableId}>
         <div className="col-control">
+          <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={
+            <div className="mk-popover-control">
+              <Icon className="edit" title="缂栬緫" type="edit" onClick={() => this.setState({visible: true})} />
+            </div>
+          } trigger="hover">
+            <Button style={{height: '24px', marginRight: '10px', backgroundColor: '#1890ff'}} onDoubleClick={() => this.setState({visible: true})} type="primary">鎻愪氦</Button>
+          </Popover>
           <Icon title="澶嶅埗鏄剧ず鍒�" type="copy" onClick={this.copycolumn} />
           <MarkColumn columns={fields} type="line" marks={lineMarks} onSubmit={this.updateLineMarks} />
           <Icon title="鍚屾瀛楁闆�" type="file-sync" onClick={this.syncfield} />
@@ -539,6 +556,24 @@
           />
         </DndProvider>
         <EditColumn column={card} dict={dict} columns={this.state.columns} fields={fields} submitCol={this.submitCol} cancelCol={this.cancelCol}/>
+        <Modal
+          wrapClassName="model-table-action-verify-modal"
+          title={'缂栬緫'}
+          visible={visible}
+          width={'75vw'}
+          maskClosable={false}
+          onOk={this.verifySubmit}
+          onCancel={() => { this.setState({ visible: false }) }}
+          destroyOnClose
+        >
+          <TableVerify
+            card={config.submit}
+            dict={dict}
+            cols={config.cols}
+            columns={config.columns}
+            wrappedComponentRef={(inst) => this.verifyRef = inst}
+          />
+        </Modal>
       </div>
     )
   }
diff --git a/src/menu/components/table/edit-table/columns/tableIn/customscript/index.jsx b/src/menu/components/table/edit-table/columns/tableIn/customscript/index.jsx
new file mode 100644
index 0000000..eb03544
--- /dev/null
+++ b/src/menu/components/table/edit-table/columns/tableIn/customscript/index.jsx
@@ -0,0 +1,343 @@
+import React, {Component} from 'react'
+import PropTypes from 'prop-types'
+import { Form, Row, Col, Button, notification, Modal, Icon, Tooltip, Radio, Select } from 'antd'
+import moment from 'moment'
+
+import Utils from '@/utils/utils.js'
+import Api from '@/api'
+import CodeMirror from '@/templates/zshare/codemirror'
+import './index.scss'
+
+class CustomForm extends Component {
+  static propTpyes = {
+    dict: PropTypes.object,         // 瀛楀吀椤�
+    btn: PropTypes.object,          // 鎸夐挳淇℃伅
+    scripts: PropTypes.array,       // 鑷畾涔夎剼鏈垪琛�
+    usefulfields: PropTypes.any,    // 鍙敤瀛楁
+    systemScripts: PropTypes.array, // 绯荤粺鑴氭湰
+    scriptsChange: PropTypes.func   // 琛ㄥ崟
+  }
+
+  state = {
+    editItem: null,
+    usefulfields: null,
+    loading: false,
+    verifySql: ''
+  }
+
+  UNSAFE_componentWillMount () {
+    this.resetfield()
+  }
+
+  resetfield = () => {
+    const { btn, usefulfields } = this.props
+    let fields = usefulfields.map(item => item.field)
+
+    fields.push('jskey')
+
+    let _sql = `Declare @${btn.sheet} table (${usefulfields.map(item => item.field + ' ' + item.type).join(',')},jskey nvarchar(50) )
+      Declare @UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@departmentcode nvarchar(50),@organization nvarchar(50),@login_city nvarchar(50),@ErrorCode nvarchar(50), @retmsg nvarchar(4000),@tbid Nvarchar(512)
+      Select @ErrorCode='', @retmsg=''
+    `
+    
+    this.setState({
+      verifySql: _sql,
+      usefulfields: fields.join(', ')
+    })
+  }
+
+  edit = (record) => {
+    this.setState({
+      editItem: record
+    })
+
+    this.props.form.setFieldsValue({
+      sql: record.sql,
+      position: record.position || 'back'
+    })
+  }
+
+  handleConfirm = () => {
+    // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭�
+    this.props.form.validateFieldsAndScroll((err, values) => {
+      if (!err) {
+        values.uuid = this.state.editItem ? this.state.editItem.uuid : ''
+
+        let _quot = values.sql.match(/'{1}/g)
+        let _lparen = values.sql.match(/\({1}/g)
+        let _rparen = values.sql.match(/\){1}/g)
+
+        _quot = _quot ? _quot.length : 0
+        _lparen = _lparen ? _lparen.length : 0
+        _rparen = _rparen ? _rparen.length : 0
+
+        if (_quot % 2 !== 0) {
+          notification.warning({
+            top: 92,
+            message: 'sql涓璡'蹇呴』鎴愬鍑虹幇',
+            duration: 5
+          })
+          return
+        } else if (_lparen !== _rparen) {
+          notification.warning({
+            top: 92,
+            message: 'sql涓�()蹇呴』鎴愬鍑虹幇',
+            duration: 5
+          })
+          return
+        } else if (/--/ig.test(values.sql)) {
+          notification.warning({
+            top: 92,
+            message: '鑷畾涔塻ql璇彞涓紝涓嶅彲鍑虹幇瀛楃 -- 锛屾敞閲婅鐢� /*鍐呭*/',
+            duration: 5
+          })
+          return
+        }
+
+        let error = Utils.verifySql(values.sql, 'customscript')
+
+        if (error) {
+          notification.warning({
+            top: 92,
+            message: 'sql涓笉鍙娇鐢�' + error,
+            duration: 5
+          })
+          return
+        }
+
+        let tail = `
+          aaa:
+        `
+
+        let _initCustomScript = '' // 鍒濆鍖栬剼鏈�
+        let _prevCustomScript = '' // 榛樿sql鍓嶆墽琛岃剼鏈�
+        let _backCustomScript = '' // 榛樿sql鍚庢墽琛岃剼鏈�
+
+        this.props.scripts.forEach(item => {
+          if (item.status === 'false') return
+
+          if (item.position === 'init') {
+            _initCustomScript += `
+            /* 鍒濆鍖栬剼鏈� */
+            ${values.uuid === item.uuid ? values.sql : item.sql}
+            `
+          } else if (item.position === 'front') {
+            _prevCustomScript += `
+            /* 榛樿sql鍓嶈剼鏈� */
+            ${values.uuid === item.uuid ? values.sql : item.sql}
+            `
+          } else {
+            _backCustomScript += `
+            /* 榛樿sql鍚庤剼鏈� */
+            ${values.uuid === item.uuid ? values.sql : item.sql}
+            `
+          }
+        })
+
+        if (!values.uuid) {
+          if (values.position === 'init') {
+            _initCustomScript += `
+            /* 鍒濆鍖栬剼鏈� */
+            ${values.sql}
+            `
+          } else if (values.position === 'front') {
+            _prevCustomScript += `
+            /* 榛樿sql鍓嶈剼鏈� */
+            ${values.sql}
+            `
+          } else {
+            _backCustomScript += `
+            /* 榛樿sql鍚庤剼鏈� */
+            ${values.sql}
+            `
+          }
+        }
+
+        let param = {
+          func: 's_debug_sql',
+          exec_type: 'y',
+          LText: this.state.verifySql + _initCustomScript + _prevCustomScript + _backCustomScript + tail
+        }
+
+        param.LText = param.LText.replace(/@\$|\$@/ig, '')
+
+        // 澶栬仈鏁版嵁搴撴浛鎹�
+        if (window.GLOB.externalDatabase !== null) {
+          param.LText = param.LText.replace(/@db@/ig, window.GLOB.externalDatabase)
+        }
+
+        param.LText = Utils.formatOptions(param.LText)
+        param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
+        param.secretkey = Utils.encrypt('', param.timestamp)
+        
+        this.setState({loading: true})
+        Api.getLocalConfig(param).then(res => {
+          if (res.status) {
+            this.setState({
+              loading: false,
+              editItem: null
+            }, () => {
+              this.props.scriptsChange(values)
+            })
+            this.props.form.setFieldsValue({
+              sql: ''
+            })
+          } else {
+            this.setState({loading: false})
+
+            Modal.error({
+              title: res.message
+            })
+          }
+        })
+      }
+    })
+  }
+
+  handleCancel = () => {
+    this.setState({
+      editItem: null
+    })
+    
+    this.props.form.setFieldsValue({
+      sql: ''
+    })
+  }
+
+  selectScript = (value, option) => {
+    const { usefulfields, btn } = this.props
+
+    let _value = ''
+    if (value === 'default') {
+      let fields = usefulfields.map(col => col.field).join(',')
+      
+      if (fields) {
+        fields = fields + ','
+      }
+
+      let database = btn.sheet.match(/(.*)\.(.*)\.|@db@/ig) || ''
+      let sheet = btn.sheet.replace(/(.*)\.(.*)\.|@db@/ig, '')
+
+      database = database ? (database[0] || '') : ''
+
+      _value = `Insert into ${database}${sheet} (${fields}createuserid,createuser,createstaff,bid)\nSelect ${fields}@userid@,@username,@fullname,@BID@ From @${sheet}`
+    } else {
+      _value = value
+    }
+
+    let _sql = this.props.form.getFieldValue('sql')
+    if (_sql) {
+      _sql = _sql + ` 
+
+      `
+    }
+
+    _sql = _sql.replace(/\s{6}$/, '')
+    _sql = _sql + `/*${option.props.children}*/
+    `
+    _sql = _sql.replace(/\s{4}$/, '')
+    _sql = _sql + _value
+
+    this.props.form.setFieldsValue({
+      sql: _sql
+    })
+  }
+
+  render() {
+    const { systemScripts, btn } = this.props
+    const { usefulfields } = this.state
+    const { getFieldDecorator } = this.props.form
+    const formItemLayout = {
+      labelCol: {
+        xs: { span: 24 },
+        sm: { span: 8 }
+      },
+      wrapperCol: {
+        xs: { span: 24 },
+        sm: { span: 16 }
+      }
+    }
+
+    return (
+      <Form {...formItemLayout} className="verify-form" id="verify-excelin-custom-scripts">
+        <Row gutter={24}>
+          {btn.sheet ? <Col span={8}>
+            <Form.Item label={'琛ㄥ悕'} style={{whiteSpace: 'nowrap', margin: 0}}>
+              {btn.sheet}
+            </Form.Item>
+          </Col> : null}
+          <Col span={10}>
+            <Form.Item label={'鎶ラ敊瀛楁'} style={{margin: 0, whiteSpace: 'nowrap'}}>
+              ErrorCode锛堝鍔犲悗缂�NT琛ㄧず鏁版嵁涓嶅洖婊氾紝濡侲NT銆丯NT銆丗NT銆丯MNT锛�, retmsg
+            </Form.Item>
+          </Col>
+          {usefulfields ? <Col span={24} className="sqlfield">
+            <Form.Item label={'鍙敤瀛楁'}>
+            BID, ID, LoginUID, SessionUid, UserID, Appkey, UserName, FullName, RoleID, departmentcode, organization, login_city, {usefulfields}
+            </Form.Item>
+          </Col> : null}
+          <Col span={8} style={{whiteSpace: 'nowrap'}}>
+            <Form.Item style={{marginBottom: 0}} label={
+              <Tooltip placement="bottomLeft" title={'鑷畾涔夎剼鏈笌榛樿sql浣嶇疆鍏崇郴銆�'}>
+                <Icon type="question-circle" style={{color: '#c49f47', marginRight: '5px'}} />
+                鎵ц浣嶇疆
+              </Tooltip>
+            }>
+              {getFieldDecorator('position', {
+                initialValue: 'front'
+              })(
+                <Radio.Group>
+                  <Radio value="init">鍒濆鍖�</Radio>
+                  <Radio value="front">sql鍓�</Radio>
+                  <Radio value="back">sql鍚�</Radio>
+                </Radio.Group>
+              )}
+            </Form.Item>
+          </Col>
+          <Col span={10}>
+            <Form.Item style={{marginBottom: 0}} label={'蹇嵎娣诲姞'}>
+              <Select
+                showSearch
+                filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
+                onChange={this.selectScript}
+                getPopupContainer={() => document.getElementById('verify-excelin-custom-scripts')}
+              >
+                <Select.Option key="default" value={'default'}>
+                  榛樿sql
+                </Select.Option>
+                {systemScripts.map((option, i) =>
+                  <Select.Option key={i} value={option.value}>
+                    {option.name}
+                  </Select.Option>
+                )}
+              </Select>
+            </Form.Item>
+          </Col>
+          <Col span={6} className="add">
+            <Button onClick={this.handleConfirm} loading={this.state.loading} className="mk-green" style={{marginBottom: 15, marginLeft: 40}}>
+              淇濆瓨
+            </Button>
+            <Button onClick={this.handleCancel} style={{marginBottom: 15, marginLeft: 10}}>
+              鍙栨秷
+            </Button>
+          </Col>
+          <Col span={24} className="sql">
+            <Form.Item label={'sql'}>
+              {getFieldDecorator('sql', {
+                initialValue: '',
+                rules: [
+                  {
+                    required: true,
+                    message: this.props.dict['form.required.input'] + 'sql!'
+                  }
+                ]
+              })(<CodeMirror />)}
+            </Form.Item>
+          </Col>
+        </Row>
+      </Form>
+    )
+  }
+}
+
+export default Form.create()(CustomForm)
\ No newline at end of file
diff --git a/src/menu/components/table/edit-table/columns/tableIn/customscript/index.scss b/src/menu/components/table/edit-table/columns/tableIn/customscript/index.scss
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/menu/components/table/edit-table/columns/tableIn/customscript/index.scss
diff --git a/src/menu/components/table/edit-table/columns/tableIn/index.jsx b/src/menu/components/table/edit-table/columns/tableIn/index.jsx
new file mode 100644
index 0000000..662c798
--- /dev/null
+++ b/src/menu/components/table/edit-table/columns/tableIn/index.jsx
@@ -0,0 +1,704 @@
+import React, {Component} from 'react'
+import PropTypes from 'prop-types'
+import { fromJS } from 'immutable'
+import { Form, Tabs, Row, Col, Input, Button, Table, Popconfirm, Icon, notification, Modal, message, InputNumber, Radio, Typography } from 'antd'
+import moment from 'moment'
+
+import Api from '@/api'
+import Utils from '@/utils/utils.js'
+
+import UniqueForm from './uniqueform'
+import CustomScript from './customscript'
+import asyncComponent from '@/utils/asyncComponent'
+import './index.scss'
+
+const { TabPane } = Tabs
+const { confirm } = Modal
+const { Paragraph } = Typography
+const EditTable = asyncComponent(() => import('@/templates/zshare/editTable'))
+
+class VerifyTableCard extends Component {
+  static propTpyes = {
+    columns: PropTypes.array,  // 鏄剧ず鍒�
+    dict: PropTypes.object,    // 瀛楀吀椤�
+    card: PropTypes.object,
+  }
+
+  state = {
+    verify: {},
+    fields: [],
+    fieldLabel: {},
+    systemScripts: [],
+    activeKey: 'basemsg',
+    uniqueColumns: [
+      {
+        title: '鍒楀悕',
+        dataIndex: 'fieldlabel',
+        width: '20%'
+      },
+      {
+        title: '瀛楁',
+        dataIndex: 'field',
+        width: '25%',
+        editable: true,
+        inputType: 'multiStr',
+        options: []
+      },
+      {
+        title: '鎶ラ敊缂栫爜',
+        dataIndex: 'errorCode',
+        width: '12%',
+        editable: true,
+        inputType: 'select',
+        options: [
+          { value: 'E', text: 'E' },
+          { value: 'N', text: 'N' },
+          { value: 'F', text: 'F' },
+          { value: 'NM', text: 'NM' }
+        ]
+      },
+      {
+        title: '楠岃瘉绫诲瀷',
+        dataIndex: 'verifyType',
+        width: '12%',
+        render: (text, record) => record.verifyType === 'logic' ? '閫昏緫楠岃瘉' : '鐗╃悊楠岃瘉',
+        inputType: 'select',
+        editable: true,
+        options: [
+          { value: 'physical', text: '鐗╃悊楠岃瘉' },
+          { value: 'logic', text: '閫昏緫楠岃瘉' }
+        ]
+      },
+      {
+        title: '鏄惁鍚敤',
+        dataIndex: 'status',
+        width: '12%',
+        editable: true,
+        required: false,
+        inputType: 'switch',
+        render: (text, record) => record.status === 'false' ?
+          (
+            <div>
+              {this.props.dict['model.status.forbidden']}
+              <Icon style={{marginLeft: '5px'}} type="stop" theme="twoTone" twoToneColor="#ff4d4f" />
+            </div>
+          ) :
+          (
+            <div>
+              {this.props.dict['model.status.open']}
+              <Icon style={{marginLeft: '5px'}} type="check-circle" theme="twoTone" twoToneColor="#52c41a" />
+            </div>
+          )
+      },
+    ],
+    scriptsColumns: [
+      {
+        title: 'SQL',
+        dataIndex: 'sql',
+        width: '60%',
+        render: (text) => {
+          let title = text.match(/^\s*\/\*.+\*\//)
+          title = title && title[0] ? title[0] : ''
+          text = title ? text.replace(title, '') : text
+
+          return (
+            <div>
+              {title ? <span style={{color: '#a50'}}>{title}</span> : null}
+              <Paragraph copyable ellipsis={{ rows: 4, expandable: true }}>{text}</Paragraph>
+            </div>
+          )
+        }
+      },
+      {
+        title: '鎵ц浣嶇疆',
+        dataIndex: 'position',
+        width: '10%',
+        render: (text, record) => {
+          let _text = ''
+          if (record.position === 'front') {
+            _text = 'sql鍓�'
+          } else if (record.position === 'init') {
+            _text = '鍒濆鍖�'
+          } else {
+            _text = 'sql鍚�'
+          }
+          return _text
+        }
+      },
+      {
+        title: '鐘舵��',
+        dataIndex: 'status',
+        width: '10%',
+        render: (text, record) => record.status === 'false' ?
+          (
+            <div>
+              {this.props.dict['model.status.forbidden']}
+              <Icon style={{marginLeft: '5px'}} type="stop" theme="twoTone" twoToneColor="#ff4d4f" />
+            </div>
+          ) :
+          (
+            <div>
+              {this.props.dict['model.status.open']}
+              <Icon style={{marginLeft: '5px'}} type="check-circle" theme="twoTone" twoToneColor="#52c41a" />
+            </div>
+          )
+      },
+      {
+        title: '鎿嶄綔',
+        align: 'center',
+        width: '20%',
+        dataIndex: 'operation',
+        render: (text, record) =>
+          (<div>
+            <span className="operation-btn" title={this.props.dict['model.edit']} onClick={() => this.handleEdit(record, 'scripts')} style={{color: '#1890ff'}}><Icon type="edit" /></span>
+            <span className="operation-btn" title={this.props.dict['header.form.up']} onClick={() => this.handleUpDown(record, 'scripts', 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span>
+            <span className="operation-btn" title={this.props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'scripts', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span>
+            <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'scripts')} style={{color: '#8E44AD'}}><Icon type="swap" /></span>
+            <Popconfirm
+              overlayClassName="popover-confirm"
+              title={this.props.dict['model.query.delete']}
+              onConfirm={() => this.handleDelete(record, 'scripts')
+            }>
+              <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span>
+            </Popconfirm>
+          </div>)
+      }
+    ]
+  }
+
+  UNSAFE_componentWillMount() {
+    const { columns, cols, card } = this.props
+    let _verify = fromJS(card).toJS()
+
+    let fieldLabel = {}
+    let _columns = []
+    let _fields = {}
+
+    columns.forEach(col => {
+      fieldLabel[col.field] = col.label
+      _fields[col.field] = col
+    })
+    cols.forEach(col => {
+      if (!col.field || col.type === 'index' || !_fields[col.field]) return
+      
+      _columns.push(_fields[col.field])
+    })
+
+    this.setState({
+      fields: _columns,
+      fieldLabel,
+      verify: _verify
+    }, () => {
+      this.resetUniqueColumns()
+    })
+  }
+
+  componentDidMount () {
+    let _scriptSql = `Select distinct func+Remark as funcname,longparam, s.Sort from聽 s_custom_script s inner join (select OpenID from sapp where ID=@Appkey@) p on s.openid = case when s.appkey='' then s.openid else p.OpenID end order by s.Sort`
+
+    _scriptSql = Utils.formatOptions(_scriptSql)
+
+    let _sParam = {
+      func: 'sPC_Get_SelectedList',
+      LText: _scriptSql,
+      obj_name: 'data',
+      arr_field: 'funcname,longparam'
+    }
+    
+    _sParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
+    _sParam.secretkey = Utils.encrypt(_sParam.LText, _sParam.timestamp)
+
+    _sParam.open_key = Utils.encryptOpenKey(_sParam.secretkey, _sParam.timestamp) // 浜戠鏁版嵁楠岃瘉
+    
+    Api.getSystemConfig(_sParam).then(res => {
+      if (res.status) {
+        this.setState({
+          systemScripts: res.data.map(item => {
+            return {
+              name: item.funcname,
+              value: window.decodeURIComponent(window.atob(item.longparam))
+            }
+          })
+        })
+      } else {
+        notification.warning({
+          top: 92,
+          message: res.message,
+          duration: 5
+        })
+      }
+    })
+  }
+
+  resetUniqueColumns = () => {
+    const { uniqueColumns, fields } = this.state
+
+    let unFields = fromJS(fields).toJS()
+    unFields.unshift({
+      field: 'BID',
+      label: 'BID'
+    })
+
+    this.setState({uniqueColumns: uniqueColumns.map(col => {
+      if (col.dataIndex === 'field') {
+        col.options = unFields
+      }
+
+      return col
+    })})
+  }
+
+  uniqueChange = (values) => {
+    let verify = JSON.parse(JSON.stringify(this.state.verify))
+
+    values.status = 'true'
+    values.uuid = Utils.getuuid()
+    verify.uniques.push(values)
+
+    this.setState({
+      verify: verify
+    })
+  }
+
+  changeUniques = (uniques) => {
+    const { verify, fieldLabel } = this.state
+
+    uniques = uniques.map(item => {
+      item.status = item.status || 'true'
+
+      if (Array.isArray(item.field)) {
+        item.fieldlabel = item.field.map(field => {
+          return fieldLabel[field] || field
+        })
+
+        item.fieldlabel = item.fieldlabel.join(',')
+        item.field = item.field.join(',')
+      }
+
+      return item
+    })
+
+    this.setState({verify: {...verify, uniques}})
+  }
+
+  scriptsChange = (values) => {
+    let verify = JSON.parse(JSON.stringify(this.state.verify))
+
+    if (values.uuid) {
+      verify.scripts = verify.scripts.map(item => {
+        if (item.uuid === values.uuid) {
+          return values
+        } else {
+          return item
+        }
+      })
+    } else {
+      values.uuid = Utils.getuuid()
+      verify.scripts.push(values)
+    }
+
+    this.setState({
+      verify: verify
+    })
+  }
+
+  handleDelete = (record, type) => {
+    const { verify } = this.state
+
+    if (type === 'scripts') {
+      verify.scripts = verify.scripts.filter(item => item.uuid !== record.uuid)
+    } else if (type === 'unique') {
+      verify.uniques = verify.uniques.filter(item => item.uuid !== record.uuid)
+    }
+
+    this.setState({ verify: verify })
+  }
+
+  handleEdit = (record, type) => {
+    if (type === 'scripts') {
+      this.scriptsForm.edit(record)
+    }
+
+    let node = document.getElementById('verify-excel-box-tab').parentNode
+
+    if (node && node.scrollTop) {
+      let inter = Math.ceil(node.scrollTop / 10)
+
+      let timer = setInterval(() => {
+        if (node.scrollTop - inter > 0) {
+          node.scrollTop = node.scrollTop - inter
+        } else {
+          node.scrollTop = 0
+          clearInterval(timer)
+        }
+      }, 10)
+    }
+  }
+
+  handleStatus = (record, type) => {
+    let verify = JSON.parse(JSON.stringify(this.state.verify))
+    record.status = record.status === 'false' ? 'true' : 'false'
+
+    if (type === 'scripts') {
+      verify.scripts = verify.scripts.map(item => {
+        if (item.uuid === record.uuid) {
+          return record
+        } else {
+          return item
+        }
+      })
+    } else if (type === 'unique') {
+      verify.uniques = verify.uniques.map(item => {
+        if (item.uuid === record.uuid) {
+          return record
+        } else {
+          return item
+        }
+      })
+    }
+
+    this.setState({
+      verify: verify
+    })
+  }
+
+  handleUpDown = (record, type, direction) => {
+    let verify = JSON.parse(JSON.stringify(this.state.verify))
+    let index = 0
+
+    if (type === 'unique') {
+      verify.uniques = verify.uniques.filter((item, i) => {
+        if (item.uuid === record.uuid) {
+          index = i
+        }
+
+        return item.uuid !== record.uuid
+      })
+      if ((index === 0 && direction === 'up') || (index === verify.uniques.length && direction === 'down')) {
+        return
+      }
+
+      if (direction === 'up') {
+        verify.uniques.splice(index - 1, 0, record)
+      } else {
+        verify.uniques.splice(index + 1, 0, record)
+      }
+    } else if (type === 'scripts') {
+      verify.scripts = verify.scripts.filter((item, i) => {
+        if (item.uuid === record.uuid) {
+          index = i
+        }
+
+        return item.uuid !== record.uuid
+      })
+      if ((index === 0 && direction === 'up') || (index === verify.scripts.length && direction === 'down')) {
+        return
+      }
+
+      if (direction === 'up') {
+        verify.scripts.splice(index - 1, 0, record)
+      } else {
+        verify.scripts.splice(index + 1, 0, record)
+      }
+    }
+
+    this.setState({
+      verify: verify
+    })
+  }
+
+  handleConfirm = () => {
+    const { verify } = this.state
+    
+    // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭�
+    return new Promise((resolve, reject) => {
+      if (!verify.sheet || (verify.intertype === 'inner' && !verify.innerFunc)) {
+        notification.warning({
+          top: 92,
+          message: '璇峰畬鍠勫熀纭�楠岃瘉淇℃伅!',
+          duration: 5
+        })
+        reject()
+      }
+
+      let _loading = false
+      if (this.scriptsForm && this.scriptsForm.state.editItem) {
+        _loading = true
+        this.setState({activeKey: 'scripts'})
+      } else if (this.scriptsForm && this.scriptsForm.props.form.getFieldValue('sql') && !/^\s+$/.test(this.scriptsForm.props.form.getFieldValue('sql'))) {
+        _loading = true
+        this.setState({activeKey: 'scripts'})
+      }
+
+      if (_loading) {
+        confirm({
+          content: `瀛樺湪鏈繚瀛橀」锛岀‘瀹氭彁浜ゅ悧锛焋,
+          onOk() {
+            resolve(verify)
+          },
+          onCancel() {}
+        })
+      } else {
+        resolve(verify)
+      }
+    })
+  }
+
+  showError = (errorType) => {
+    if (errorType === 'S') {
+      notification.success({
+        top: 92,
+        message: '鎵ц鎴愬姛锛�',
+        duration: 2
+      })
+    } else if (errorType === 'Y') {
+      Modal.success({
+        title: '鎵ц鎴愬姛锛�'
+      })
+    } else if (errorType === 'F') {
+      notification.error({
+        className: 'notification-custom-error',
+        top: 92,
+        message: '鎵ц澶辫触锛�',
+        duration: 10
+      })
+    } else if (errorType === 'N') {
+      notification.error({
+        top: 92,
+        message: '鎵ц澶辫触锛�',
+        duration: 10
+      })
+    } else if (errorType === 'E') {
+      Modal.error({
+        title: '鎵ц澶辫触锛�'
+      })
+    } else if (errorType === 'NM') {
+      message.error('鎵ц澶辫触锛�')
+    }
+  }
+
+  timeChange = (val, type) => {
+    const { verify } = this.state
+
+    this.setState({
+      verify: {...verify, [type]: val}
+    })
+  }
+
+  tabchange = (val) => {
+    const { activeKey, verify } = this.state
+
+    if (activeKey === 'basemsg') {
+      if (!verify.sheet || (verify.intertype === 'inner' && !verify.innerFunc)) {
+        notification.warning({
+          top: 92,
+          message: '璇峰畬鍠勫熀纭�楠岃瘉淇℃伅!',
+          duration: 5
+        })
+        return
+      }
+    }
+    this.setState({activeKey: val})
+  }
+
+  onOptionChange = (value, key) => {
+    const { verify } = this.state
+
+    this.setState({
+      verify: {...verify, [key]: value}
+    })
+  }
+
+  render() {
+    const { verify, scriptsColumns, uniqueColumns, activeKey, fields } = this.state
+    const formItemLayout = {
+      labelCol: {
+        xs: { span: 24 },
+        sm: { span: 8 }
+      },
+      wrapperCol: {
+        xs: { span: 24 },
+        sm: { span: 16 }
+      }
+    }
+
+    return (
+      <div id="verify-excel-box-tab">
+        <Tabs activeKey={activeKey} className="verify-card-box" onChange={this.tabchange}>
+          <TabPane tab="鍩虹楠岃瘉" key="basemsg">
+            <Form {...formItemLayout}>
+              <Row gutter={24}>
+                <Col span={8}>
+                  <Form.Item required label={this.props.dict['model.form.tablename']}>
+                    <Input value={verify.sheet} placeholder="" autoComplete="off" onChange={(e) => this.onOptionChange(e.target.value, 'sheet')}/>
+                  </Form.Item>
+                </Col>
+                <Col span={8}>
+                  <Form.Item required label={'鎺ュ彛绫诲瀷'}>
+                    <Radio.Group value={verify.intertype} onChange={(e) => this.onOptionChange(e.target.value, 'intertype')}>
+                      <Radio value="system">绯荤粺</Radio>
+                      <Radio value="inner">鍐呴儴</Radio>
+                    </Radio.Group>
+                  </Form.Item>
+                </Col>
+                {verify.intertype === 'inner' ? <Col span={8}>
+                  <Form.Item required label="鍐呴儴鎺ュ彛">
+                    <Input value={verify.innerFunc} placeholder="" autoComplete="off" onChange={(e) => this.onOptionChange(e.target.value, 'innerFunc')}/>
+                  </Form.Item>
+                </Col> : null}
+                {verify.intertype === 'system' ? <Col span={8}>
+                  <Form.Item required label={'榛樿sql'}>
+                    <Radio.Group value={verify.default} onChange={(e) => this.onOptionChange(e.target.value, 'default')}>
+                      <Radio value="true">鎵ц</Radio>
+                      <Radio value="false">涓嶆墽琛�</Radio>
+                    </Radio.Group>
+                  </Form.Item>
+                </Col> : null}
+                <Col span={8}>
+                  <Form.Item label={'鎴愬姛鍚�'}>
+                    <Radio.Group style={{whiteSpace: 'nowrap'}} value={verify.execSuccess} onChange={(e) => this.onOptionChange(e.target.value, 'execSuccess')}>
+                      <Radio value="never">涓嶅埛鏂�</Radio>
+                      <Radio value="grid">鍒锋柊琛ㄦ牸</Radio>
+                      <Radio value="mainline">涓婄骇锛堣锛�</Radio>
+                    </Radio.Group>
+                  </Form.Item>
+                </Col>
+                <Col span={8}>
+                  <Form.Item label={'澶辫触鍚�'}>
+                    <Radio.Group style={{whiteSpace: 'nowrap'}} value={verify.execError} onChange={(e) => this.onOptionChange(e.target.value, 'execError')}>
+                      <Radio value="never">涓嶅埛鏂�</Radio>
+                      <Radio value="grid">鍒锋柊琛ㄦ牸</Radio>
+                      <Radio value="mainline">涓婄骇锛堣锛�</Radio>
+                    </Radio.Group>
+                  </Form.Item>
+                </Col>
+              </Row>
+            </Form>
+          </TabPane>
+          <TabPane disabled={verify.intertype !== 'system'} tab={
+            <span>
+              鍞竴鎬ч獙璇�
+              {verify.uniques.length ? <span className="count-tip">{verify.uniques.length}</span> : null}
+            </span>
+          } key="unique">
+            <UniqueForm fields={fields} dict={this.props.dict} uniqueChange={this.uniqueChange}/>
+            <EditTable actions={['edit', 'move', 'del']} data={verify.uniques} columns={uniqueColumns} onChange={this.changeUniques}/>
+          </TabPane>
+          <TabPane disabled={verify.intertype !== 'system'} tab={
+            <span>
+              鑷畾涔夎剼鏈�
+              {verify.scripts.length ? <span className="count-tip">{verify.scripts.length}</span> : null}
+            </span>
+          } key="scripts">
+            <CustomScript
+              dict={this.props.dict}
+              btn={verify}
+              usefulfields={fields}
+              scripts={verify.scripts}
+              systemScripts={this.state.systemScripts}
+              scriptsChange={this.scriptsChange}
+              wrappedComponentRef={(inst) => this.scriptsForm = inst}
+            />
+            <Table
+              bordered
+              rowKey="uuid"
+              className="custom-table"
+              dataSource={verify.scripts}
+              columns={scriptsColumns}
+              pagination={false}
+            />
+          </TabPane>
+          <TabPane tab="淇℃伅鎻愮ず" key="tip">
+            <Form {...formItemLayout}>
+              <Row gutter={24}>
+                <Col offset={6} span={6}>
+                  <Form.Item label={'鎻愮ず缂栫爜'}>
+                    <span className="errorval"> S </span>
+                    <Button onClick={() => {this.showError('S')}} type="primary" size="small">
+                      鏌ョ湅
+                    </Button>
+                  </Form.Item>
+                </Col>
+                <Col span={8}>
+                  <Form.Item label={'鍋滅暀鏃堕棿'}>
+                    <InputNumber defaultValue={verify.stime || 2} min={1} max={10000} precision={0} onChange={(val) => {this.timeChange(val, 'stime')}} />
+                  </Form.Item>
+                </Col>
+              </Row>
+              <Row gutter={24}>
+                <Col offset={6} span={6}>
+                  <Form.Item label={'鎻愮ず缂栫爜'}>
+                    <span className="errorval"> Y </span>
+                    <Button onClick={() => {this.showError('Y')}} type="primary" size="small">
+                      鏌ョ湅
+                    </Button>
+                  </Form.Item>
+                </Col>
+              </Row>
+              <Row gutter={24}>
+                <Col offset={6} span={6}>
+                  <Form.Item label={'鎻愮ず缂栫爜'}>
+                    <span className="errorval"> N </span>
+                    <Button onClick={() => {this.showError('N')}} type="primary" size="small">
+                      鏌ョ湅
+                    </Button>
+                  </Form.Item>
+                </Col>
+                <Col span={8}>
+                  <Form.Item label={'鍋滅暀鏃堕棿'}>
+                    <InputNumber defaultValue={verify.ntime || 10} min={1} max={10000} precision={0} onChange={(val) => {this.timeChange(val, 'ntime')}} />
+                  </Form.Item>
+                </Col>
+              </Row>
+              <Row gutter={24}>
+                <Col offset={6} span={6}>
+                  <Form.Item label={'鎻愮ず缂栫爜'}>
+                    <span className="errorval"> F </span>
+                    <Button onClick={() => {this.showError('F')}} type="primary" size="small">
+                      鏌ョ湅
+                    </Button>
+                  </Form.Item>
+                </Col>
+                <Col span={8}>
+                  <Form.Item label={'鍋滅暀鏃堕棿'}>
+                    <InputNumber defaultValue={verify.ftime || 10} min={1} max={10000} precision={0} onChange={(val) => {this.timeChange(val, 'ftime')}} />
+                  </Form.Item>
+                </Col>
+              </Row>
+              <Row gutter={24}>
+                <Col offset={6} span={6}>
+                  <Form.Item label={'鎻愮ず缂栫爜'}>
+                    <span className="errorval"> E </span>
+                    <Button onClick={() => {this.showError('E')}} type="primary" size="small">
+                      鏌ョ湅
+                    </Button>
+                  </Form.Item>
+                </Col>
+              </Row>
+              <Row gutter={24}>
+                <Col offset={6} span={6}>
+                  <Form.Item label={'鎻愮ず缂栫爜'}>
+                    <span className="errorval"> NM </span>
+                    <Button onClick={() => {this.showError('NM')}} type="primary" size="small">
+                      鏌ョ湅
+                    </Button>
+                  </Form.Item>
+                </Col>
+              </Row>
+              <Row gutter={24}>
+                <Col offset={6} span={6}>
+                  <Form.Item label={'鎻愮ず缂栫爜'}>
+                    <span className="errorval"> -1 </span>
+                    涓嶆彁绀�
+                  </Form.Item>
+                </Col>
+              </Row>
+            </Form>
+          </TabPane>
+        </Tabs>
+      </div>
+    )
+  }
+}
+
+export default Form.create()(VerifyTableCard)
\ No newline at end of file
diff --git a/src/menu/components/table/edit-table/columns/tableIn/index.scss b/src/menu/components/table/edit-table/columns/tableIn/index.scss
new file mode 100644
index 0000000..6394765
--- /dev/null
+++ b/src/menu/components/table/edit-table/columns/tableIn/index.scss
@@ -0,0 +1,83 @@
+.verify-card-box {
+  .ant-tabs-nav-scroll {
+    text-align: center;
+  }
+  .ant-tabs-content {
+    min-height: 40vh;
+  }
+  table tr td {
+    word-wrap: break-word;
+    word-break: break-word;
+  }
+  .ant-input-number {
+    width: 100%;
+  }
+  .count-tip {
+    position: absolute;
+    top: 0px;
+    color: #1890ff;
+    font-size: 12px;
+  }
+  .verify-form {
+    .sql {
+      .ant-col-sm-8 {
+        width: 10.5%;
+      }
+      .ant-col-sm-16 {
+        width: 89.5%;
+        padding-top: 4px;
+      }
+      .CodeMirror {
+        height: 350px;
+      }
+    }
+    .sqlfield {
+      .ant-form-item {
+        margin-bottom: 5px;
+      }
+      .ant-form-item-control {
+        line-height: 24px;
+      }
+      .ant-form-item-label {
+        line-height: 25px;
+      }
+      .ant-form-item-children {
+        line-height: 22px;
+      }
+      .ant-col-sm-8 {
+        width: 10.5%;
+      }
+      .ant-col-sm-16 {
+        width: 89.5%;
+      }
+    }
+  }
+  .custom-table .ant-empty {
+    margin: 20px 8px!important;
+  }
+  .excel-custom-table {
+    position: relative;
+    top: -25px;
+  }
+  .errorval {
+    display: inline-block;
+    width: 30px;
+  }
+  .operation-btn {
+    display: inline-block;
+    font-size: 16px;
+    padding: 0 5px;
+    cursor: pointer;
+  }
+  .ant-tabs-tabpane {
+    position: relative;
+    .excel-col-add {
+      position: relative;
+      float: right;
+      right: -9px;
+      margin-right: 10px;
+      top: 10px;
+      z-index: 1;
+    }
+  }
+}
\ No newline at end of file
diff --git a/src/menu/components/table/edit-table/columns/tableIn/uniqueform/index.jsx b/src/menu/components/table/edit-table/columns/tableIn/uniqueform/index.jsx
new file mode 100644
index 0000000..d9f8038
--- /dev/null
+++ b/src/menu/components/table/edit-table/columns/tableIn/uniqueform/index.jsx
@@ -0,0 +1,129 @@
+import React, {Component} from 'react'
+import PropTypes from 'prop-types'
+import { Form, Row, Col, Select, Button } from 'antd'
+import './index.scss'
+
+
+class UniqueForm extends Component {
+  static propTpyes = {
+    dict: PropTypes.object,       // 瀛楀吀椤�
+    fields: PropTypes.array,      // 琛ㄥ崟瀛楁
+    uniqueChange: PropTypes.func  // 淇敼鍑芥暟
+  }
+
+  handleConfirm = () => {
+    const { fields } = this.props
+    let change = {}
+
+    fields.forEach(col => {
+      change[col.field] = col.label
+    })
+
+    // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭�
+    this.props.form.validateFieldsAndScroll((err, values) => {
+      if (!err) {
+        values.fieldlabel = values.field.map(field => {
+          return change[field] || field
+        })
+
+        values.fieldlabel = values.fieldlabel.join(',')
+        values.field = values.field.join(',')
+
+        this.props.uniqueChange(values)
+        this.props.form.setFieldsValue({
+          field: [],
+        })
+      }
+    })
+  }
+
+  render() {
+    const { getFieldDecorator } = this.props.form
+    const { fields } = this.props
+
+    const formItemLayout = {
+      labelCol: {
+        xs: { span: 24 },
+        sm: { span: 8 }
+      },
+      wrapperCol: {
+        xs: { span: 24 },
+        sm: { span: 16 }
+      }
+    }
+
+    return (
+      <Form {...formItemLayout} className="verify-form" id="verifycard1">
+        <Row gutter={24}>
+          <Col span={7}>
+            <Form.Item label={'鍒楀悕'}>
+              {getFieldDecorator('field', {
+                initialValue: [],
+                rules: [
+                  {
+                    required: true,
+                    message: this.props.dict['form.required.select'] + '鍒楀悕!'
+                  }
+                ]
+              })(
+                <Select
+                  mode="multiple"
+                >
+                  <Select.Option key="bid" value="BID">BID</Select.Option>
+                  {fields.map(item => (
+                    <Select.Option key={item.uuid} value={item.field}>{item.label}</Select.Option>
+                  ))}
+                </Select>
+              )}
+            </Form.Item>
+          </Col>
+          <Col span={7}>
+            <Form.Item label={'鎶ラ敊缂栫爜'}>
+              {getFieldDecorator('errorCode', {
+                initialValue: 'E',
+                rules: [
+                  {
+                    required: true,
+                    message: this.props.dict['form.required.select'] + '鎶ラ敊缂栫爜!'
+                  }
+                ]
+              })(
+                <Select>
+                  <Select.Option value="E"> E </Select.Option>
+                  <Select.Option value="N"> N </Select.Option>
+                  <Select.Option value="F"> F </Select.Option>
+                  <Select.Option value="NM"> NM </Select.Option>
+                </Select>
+              )}
+            </Form.Item>
+          </Col>
+          <Col span={7}>
+            <Form.Item label={'楠岃瘉绫诲瀷'}>
+              {getFieldDecorator('verifyType', {
+                initialValue: 'physical',
+                rules: [
+                  {
+                    required: true,
+                    message: this.props.dict['form.required.select'] + '楠岃瘉绫诲瀷!'
+                  }
+                ]
+              })(
+                <Select>
+                  <Select.Option value="physical"> 鐗╃悊楠岃瘉 </Select.Option>
+                  <Select.Option value="logic"> 閫昏緫楠岃瘉 </Select.Option>
+                </Select>
+              )}
+            </Form.Item>
+          </Col>
+          <Col span={3} className="add">
+            <Button onClick={this.handleConfirm} className="mk-green">
+              娣诲姞
+            </Button>
+          </Col>
+        </Row>
+      </Form>
+    )
+  }
+}
+
+export default Form.create()(UniqueForm)
\ No newline at end of file
diff --git a/src/menu/components/table/edit-table/columns/tableIn/uniqueform/index.scss b/src/menu/components/table/edit-table/columns/tableIn/uniqueform/index.scss
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/menu/components/table/edit-table/columns/tableIn/uniqueform/index.scss
diff --git a/src/menu/components/table/edit-table/index.jsx b/src/menu/components/table/edit-table/index.jsx
index 4a6b04d..addec1d 100644
--- a/src/menu/components/table/edit-table/index.jsx
+++ b/src/menu/components/table/edit-table/index.jsx
@@ -69,6 +69,7 @@
         ],
         scripts: [],
         btnlog: [],
+        submit: {intertype: 'system', default: 'true', innerFunc: '', execSuccess: 'grid', execError: 'never', scripts: [], uniques: []},
         isNew: true
       }
 
@@ -219,7 +220,7 @@
     newcard.uuid = Utils.getuuid()
     newcard.focus = true
     
-    newcard.label = 'label'
+    newcard.label = '瀵煎叆Excel'
     newcard.sqlType = ''
     newcard.Ot = 'requiredSgl'
     newcard.OpenType = 'excelIn'
diff --git a/src/tabviews/custom/components/table/edit-table/index.jsx b/src/tabviews/custom/components/table/edit-table/index.jsx
index 8080bbc..9d6eea6 100644
--- a/src/tabviews/custom/components/table/edit-table/index.jsx
+++ b/src/tabviews/custom/components/table/edit-table/index.jsx
@@ -478,10 +478,12 @@
         />
         <div className={'main-table-box ' + (!actions || actions.length === 0 ? 'no-action' : '')}>
           <MainTable
+            BID={BID}
             setting={setting}
             columns={columns}
             MenuID={config.uuid}
             data={this.state.data}
+            submit={config.submit}
             fields={config.columns}
             total={this.state.total}
             lineMarks={config.lineMarks}
diff --git a/src/tabviews/custom/components/table/edit-table/index.scss b/src/tabviews/custom/components/table/edit-table/index.scss
index b62652b..6a1b8a3 100644
--- a/src/tabviews/custom/components/table/edit-table/index.scss
+++ b/src/tabviews/custom/components/table/edit-table/index.scss
@@ -38,8 +38,17 @@
     .main-pickup {
       position: absolute;
       right: 5px;
-      top: -22px;
+      top: -24px;
       z-index: 2;
+    }
+    .submit-table {
+      position: absolute;
+      z-index: 2;
+      right: 60px;
+      top: -26px;
+      height: 24px;
+      color: #ffffff;
+      background-color: #1890ff;
     }
     .custom-control {
       position: absolute;
@@ -60,8 +69,21 @@
       right: 0px;
       top: 0px;
       z-index: 2;
+      margin-bottom: 4px;
       float: right;
     }
+    .submit-table {
+      float: right;
+      position: relative;
+      z-index: 2;
+      right: 0px;
+      top: 0px;
+      height: 24px;
+      color: #ffffff;
+      background-color: #1890ff;
+      margin-right: 15px;
+      margin-bottom: 2px;
+    }
   }
   .ant-collapse {
     background-color: transparent;
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 dfdbc74..0881563 100644
--- a/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx
+++ b/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx
@@ -1,9 +1,12 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { is, fromJS } from 'immutable'
-import { Table, Typography, Icon, Switch, Input, InputNumber, Tooltip } from 'antd'
+import { Table, Typography, Icon, Switch, Modal, Input, InputNumber, Tooltip, Button, notification, message } from 'antd'
+import moment from 'moment'
 
+import Api from '@/api'
 import asyncComponent from '@/utils/asyncComponent'
+import Utils, { getEditTableSql } from '@/utils/utils.js'
 import MKEmitter from '@/utils/events.js'
 import zhCN from '@/locales/zh-CN/main.js'
 import enUS from '@/locales/en-US/main.js'
@@ -11,6 +14,7 @@
 import './index.scss'
 
 const { Paragraph } = Typography
+const { confirm } = Modal
 const CardCellComponent = asyncComponent(() => import('@/tabviews/custom/components/card/cardcellList'))
 
 class BodyRow extends React.Component {
@@ -203,8 +207,9 @@
       MKEmitter.emit('tdFocus', col.enter + record.$Index)
     }
 
-    let _record = {...record, [col.field]: value}
-    MKEmitter.emit('changeRecord', _record)
+    if (value !== record[col.field]) {
+      MKEmitter.emit('changeRecord', col.tableId, {...record, [col.field]: value})
+    }
   }
 
   focus = () => {
@@ -239,8 +244,9 @@
 
     this.setState({editing: false})
 
-    let _record = {...record, [col.field]: value}
-    MKEmitter.emit('changeRecord', _record)
+    if (value !== record[col.field]) {
+      MKEmitter.emit('changeRecord', col.tableId, {...record, [col.field]: value})
+    }
   }
   
   onChange = (val) => {
@@ -375,6 +381,11 @@
       children = (
         <CardCellComponent data={record} cards={config} elements={col.elements}/>
       )
+    } else if (col.type === 'operation') {
+      style.padding = '0px 5px'
+      children = (
+        <Button type="link" style={{color: 'rgb(255, 77, 79)', backgroundColor: 'transparent'}} onClick={() => MKEmitter.emit('delRecord', col.tableId, {...record})}>鍒犻櫎</Button>
+      )
     }
 
     return (<td className={className} style={style}>{children}</td>)
@@ -389,7 +400,7 @@
     columns: PropTypes.array,        // 琛ㄦ牸鍒�
     lineMarks: PropTypes.any,        // 琛屾爣璁�
     fields: PropTypes.array,         // 缁勪欢瀛楁闆�
-    BData: PropTypes.any,            // 涓昏〃鏁版嵁
+    BID: PropTypes.any,              // 涓昏〃ID
     data: PropTypes.any,             // 琛ㄦ牸鏁版嵁
     total: PropTypes.any,            // 鎬绘暟
     loading: PropTypes.bool,         // 琛ㄦ牸鍔犺浇涓�
@@ -399,24 +410,42 @@
   state = {
     dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
     data: [],
+    edData: [],
+    edColumns: [],
     tableId: '',          // 琛ㄦ牸ID
     pageIndex: 1,         // 鍒濆椤甸潰绱㈠紩
     pageSize: 10,         // 姣忛〉鏁版嵁鏉℃暟
     columns: null,        // 鏄剧ず鍒�
+    fields: [],
     pickup: false,        // 鏀惰捣鏈�夋嫨椤�
-    orderfields: {}       // 鎺掑簭id涓巉ield杞崲
+    orderfields: {},      // 鎺掑簭id涓巉ield杞崲
+    loading: false
   }
 
   UNSAFE_componentWillMount () {
     const { setting, fields, columns, data } = this.props
     let orderfields = {}
     let initEditLine = null
+    let edColumns = []
+    let tableId = (() => {
+      let uuid = []
+      let _options = 'abcdefghigklmnopqrstuv'
+      for (let i = 0; i < 19; i++) {
+        uuid.push(_options.substr(Math.floor(Math.random() * 0x20), 1))
+      }
+      return uuid.join('')
+    }) ()
 
-    let _columns = columns.map(item => {
+    let _columns = []
+    columns.forEach(item => {
+      if (item.Hide === 'true') return
       if (item.type === 'index') {
         item.field = '$Index'
         item.type = 'text'
       }
+
+      item.tableId = tableId
+
       if (!initEditLine && item.editable === 'true') {
         initEditLine = item
       }
@@ -429,7 +458,7 @@
         orderfields[item.uuid] = item.field
       }
 
-      return {
+      let _item = {
         align: item.Align,
         dataIndex: item.uuid,
         title: item.label,
@@ -441,16 +470,26 @@
           config: item.type === 'custom' || item.type === 'action' ? {setting, columns: fields} : null,
         })
       }
+
+      if (item.type !== 'action') {
+        let _copy = fromJS(_item).toJS()
+        _copy.sorter = false
+        edColumns.push(_copy)
+      }
+      _columns.push(_item)
     })
 
-    let tableId = (() => {
-      let uuid = []
-      let _options = 'abcdefghigklmnopqrstuv'
-      for (let i = 0; i < 19; i++) {
-        uuid.push(_options.substr(Math.floor(Math.random() * 0x20), 1))
-      }
-      return uuid.join('')
-    }) ()
+    edColumns.push({
+      align: 'center',
+      dataIndex: 'mkoperation',
+      title: '鎿嶄綔',
+      sorter: false,
+      width: 100,
+      onCell: record => ({
+        record,
+        col: {type: 'operation', tableId: tableId},
+      })
+    })
 
     if (setting.borderColor) { // 杈规棰滆壊
       let style = `#${tableId} table, #${tableId} tr, #${tableId} th, #${tableId} td {border-color: ${setting.borderColor}}`
@@ -462,6 +501,7 @@
     this.setState({
       data,
       columns: _columns,
+      edColumns,
       tableId,
       orderfields,
       initEditLine
@@ -473,8 +513,28 @@
   }
 
   componentDidMount () {
-    MKEmitter.addListener('resetTable', this.resetTable)
+    const { fields, columns } = this.props
+
+    let _fields = []
+
+    let fieldType = {}
+    fields.forEach(item => {
+      fieldType[item.field] = item.datatype
+    })
+
+    columns.forEach(col => {
+      if (!col.field || col.type === 'index') return
+
+      _fields.push({...col, datatype: fieldType[col.field] || 'Nvarchar(50)'})
+    })
+
+    this.setState({
+      fields: _fields,
+    })
+
     MKEmitter.addListener('nextLine', this.nextLine)
+    MKEmitter.addListener('delRecord', this.delRecord)
+    MKEmitter.addListener('resetTable', this.resetTable)
     MKEmitter.addListener('changeRecord', this.changeRecord)
   }
 
@@ -485,8 +545,9 @@
     this.setState = () => {
       return
     }
-    MKEmitter.removeListener('resetTable', this.resetTable)
     MKEmitter.removeListener('nextLine', this.nextLine)
+    MKEmitter.removeListener('delRecord', this.delRecord)
+    MKEmitter.removeListener('resetTable', this.resetTable)
     MKEmitter.removeListener('changeRecord', this.changeRecord)
   }
 
@@ -497,16 +558,88 @@
   }
   
   nextLine = (col, index) => {
-    const { data, initEditLine } = this.state
+    const { setting } = this.props
+    const { edData, initEditLine, tableId } = this.state
+
+    if (col.tableId !== tableId) return
+
     index = +index
 
-    if (index < data.length && initEditLine) {
+    if (index < edData.length && initEditLine) {
       MKEmitter.emit('tdFocus', initEditLine.uuid + (index + 1))
+    } else if (col.footEnter === 'add' && setting.addable === 'true') {
+      setTimeout(() => {
+        this.plusLine(initEditLine)
+      }, 10)
+    } else if (col.footEnter === 'sub') {
+      setTimeout(() => {
+        this.checkData()
+      }, 10)
     }
   }
 
-  changeRecord = (record) => {
-    let _data = this.state.data.map(item => {
+  plusLine = (initEditLine) => {
+    const { edData, fields } = this.state
+
+    let item = {...edData[edData.length - 1]}
+
+    item.key = item.key + 1
+    item.$$uuid = '$new'
+    item.$Index = item.key + 1 + ''
+
+    fields.forEach(col => {
+      item[col.field] = item[col.field] !== undefined ? item[col.field] : ''
+
+      if (col.initval !== '$copy') {
+        item[col.field] = col.initval
+      }
+      if (col.type === 'number') {
+        item[col.field] = +item[col.field]
+        if (isNaN(item[col.field])) {
+          item[col.field] = 0
+        }
+      }
+    })
+
+    this.setState({edData: [...edData, item]}, () => {
+      MKEmitter.emit('tdFocus', initEditLine.uuid + item.$Index)
+    })
+  }
+
+  delRecord = (id, record) => {
+    const { tableId, edData } = this.state
+
+    if (id !== tableId) return
+
+    let _data = []
+
+    if (record.$$uuid === '$new') {
+      _data = edData.filter(item => item.$Index !== record.$Index)
+      _data = _data.map((item, index) => {
+        item.key = index
+        item.$Index = 1 + index + ''
+        return item
+      })
+    } else {
+      _data = edData.map(item => {
+        if (item.$Index === record.$Index) {
+          record.$deleted = true
+          return record
+        } else {
+          return item
+        }
+      })
+    }
+
+    this.setState({edData: _data})
+  }
+
+  changeRecord = (id, record) => {
+    const { tableId } = this.state
+
+    if (id !== tableId) return
+
+    let _data = this.state.edData.map(item => {
       if (item.$Index === record.$Index) {
         return record
       } else {
@@ -514,7 +647,255 @@
       }
     })
 
-    this.setState({data: _data})
+    this.setState({edData: _data})
+  }
+
+  addLine = () => {
+    const { BID } = this.props
+    const { edData, fields } = this.state
+
+    let item = {}
+    if (edData.length > 0) {
+      item = {...edData[edData.length - 1]}
+      item.key = item.key + 1
+      item.$$uuid = '$new'
+      item.$Index = item.key + 1 + ''
+    } else {
+      item.key = 0
+      item.$$uuid = '$new'
+      item.$Index = item.key + 1 + ''
+      item.$$BID = BID || ''
+    }
+
+    fields.forEach(col => {
+      item[col.field] = item[col.field] !== undefined ? item[col.field] : ''
+
+      if (col.initval !== '$copy') {
+        item[col.field] = col.initval
+      }
+      if (col.type === 'number') {
+        item[col.field] = +item[col.field]
+        if (isNaN(item[col.field])) {
+          item[col.field] = 0
+        }
+      }
+    })
+
+    this.setState({edData: [...edData, item]})
+  }
+
+  checkData = () => {
+    const { edData, fields } = this.state
+
+    if (edData.length === 0) {
+      notification.warning({
+        top: 92,
+        message: '鎻愪氦鏁版嵁涓嶅彲涓虹┖锛�',
+        duration: 5
+      })
+      return
+    }
+    let err = ''
+    let data = fromJS(edData).toJS().map(item => {
+      let line = []
+      fields.forEach(col => {
+        if (col.editable !== 'true' || item.$deleted) {
+          if (col.type === 'number') {
+            item[col.field] = +item[col.field]
+            if (isNaN(item[col.field])) {
+              item[col.field] = 0
+            }
+          } else {
+            item[col.field] = item[col.field] !== undefined ? (item[col.field] + '') : ''
+          }
+          return
+        }
+        if (col.type === 'text') {
+          let val = item[col.field] !== undefined ? (item[col.field] + '') : ''
+          if (col.required === 'true' && !val) {
+            line.push(`${col.label}涓嶅彲涓虹┖`)
+          }
+          item[col.field] = val
+        } else if (col.type === 'number') {
+          let val = item[col.field]
+          if (!val && val !== 0) {
+            line.push(`${col.label}涓嶅彲涓虹┖`)
+            return
+          }
+          val = +val
+          if (isNaN(val)) {
+            line.push(`${col.label}鏁版嵁鏍煎紡閿欒`)
+            return
+          }
+
+          val = +val.toFixed(col.decimal || 0)
+          
+          if (typeof(col.max) === 'number' && val > col.max) {
+            line.push(`${col.label}涓嶅彲澶т簬${col.max}`)
+          } else if (typeof(col.min) === 'number' && val < col.min) {
+            line.push(`${col.label}涓嶅彲灏忎簬${col.min}`)
+          }
+
+          item[col.field] = val
+        }
+      })
+
+      if (line.length > 0) {
+        err += `绗�${item.$Index}琛岋細` + line.join('锛�') + '锛�'
+      }
+
+      return item
+    })
+
+    if (err) {
+      notification.warning({
+        top: 92,
+        message: err,
+        duration: 5
+      })
+    } else {
+      this.submit(data)
+    }
+  }
+
+  submit = (data) => {
+    const { submit, BID } = this.props
+    const { fields } = this.state
+
+    let result = getEditTableSql(submit, data, fields)
+
+    let param = {
+      excel_in: result.lines,
+      BID: BID || ''
+    }
+
+    this.setState({
+      loading: true
+    })
+
+    if (submit.intertype === 'system') { // 绯荤粺瀛樺偍杩囩▼
+      param.func = 'sPC_TableData_InUpDe'
+      
+      if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺
+        result.sql = result.sql.replace(/\$@/ig, '/*')
+        result.sql = result.sql.replace(/@\$/ig, '*/')
+        result.bottom = result.bottom.replace(/\$@/ig, '/*')
+        result.bottom = result.bottom.replace(/@\$/ig, '*/')
+      } else {
+        result.sql = result.sql.replace(/@\$|\$@/ig, '')
+        result.bottom = result.bottom.replace(/@\$|\$@/ig, '')
+      }
+      
+      param.excel_in_type = 'true'
+      param.LText1 = Utils.formatOptions(result.insert)
+      param.LText2 = Utils.formatOptions(result.bottom)
+      param.LText = Utils.formatOptions(result.sql)
+      param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
+      param.secretkey = Utils.encrypt(param.LText, param.timestamp)
+
+      param.menuname = submit.logLabel
+
+      if (window.GLOB.probation) {
+        param.s_debug_type = 'Y'
+      }
+
+      Api.genericInterface(param).then((res) => {
+        if (res.status) {
+          this.execSuccess(res)
+        } else {
+          this.execError(res)
+        }
+      }, () => {
+        this.execError({})
+      })
+    } else if (submit.intertype === 'inner' && submit.innerFunc) { // 鑷畾涔夊瓨鍌ㄨ繃绋�
+      param.func = submit.innerFunc
+
+      Api.genericInterface(param).then((res) => {
+        if (res.status) {
+          this.execSuccess(res)
+        } else {
+          this.execError(res)
+        }
+      }, () => {
+        this.execError({})
+      })
+    }
+  }
+
+  execSuccess = (res) => {
+    const { submit } = this.props
+
+    if (res && res.ErrCode === 'S') { // 鎵ц鎴愬姛
+      notification.success({
+        top: 92,
+        message: res.ErrMesg || this.state.dict['main.action.confirm.success'],
+        duration: submit.stime ? submit.stime : 2
+      })
+    } else if (res && res.ErrCode === 'Y') { // 鎵ц鎴愬姛
+      Modal.success({
+        title: res.ErrMesg || this.state.dict['main.action.confirm.success']
+      })
+    } else if (res && res.ErrCode === '-1') { // 瀹屾垚鍚庝笉鎻愮ず
+
+    }
+
+    this.setState({
+      loading: false
+    })
+
+    if (submit.execSuccess !== 'never') {
+      this.repick()
+      MKEmitter.emit('refreshByButtonResult', submit.$menuId, submit.execSuccess, submit)
+    }
+  }
+
+  execError = (res) => {
+    const { submit } = this.props
+
+    if (res.ErrCode === 'E') {
+      Modal.error({
+        title: res.message || res.ErrMesg,
+      })
+    } else if (res.ErrCode === 'N') {
+      notification.error({
+        top: 92,
+        message: res.message || res.ErrMesg,
+        duration: submit.ntime ? submit.ntime : 10
+      })
+    } else if (res.ErrCode === 'F') {
+      notification.error({
+        className: 'notification-custom-error',
+        top: 92,
+        message: res.message || res.ErrMesg,
+        duration: submit.ftime ? submit.ftime : 10
+      })
+    } else if (res.ErrCode === 'NM') {
+      message.error(res.message || res.ErrMesg)
+    }
+    
+    this.setState({
+      loading: false
+    })
+
+    if (submit.execError !== 'never') {
+      this.repick()
+      MKEmitter.emit('refreshByButtonResult', submit.$menuId, submit.execError, submit)
+    }
+  }
+
+  repick = () => {
+    const { data } = this.state
+
+    this.setState({
+      data: [],
+      edData: [],
+      pickup: false,
+    }, () => {
+      this.setState({
+        data: data,
+      })
+    })
   }
 
   changeTable = (pagination, filters, sorter) => {
@@ -522,8 +903,7 @@
 
     this.setState({
       pageIndex: pagination.current,
-      pageSize: pagination.pageSize,
-      pickup: false
+      pageSize: pagination.pageSize
     })
 
     sorter.field = orderfields[sorter.field] || ''
@@ -536,27 +916,54 @@
 
     if (id !== MenuID) return
 
-    if (repage === 'false') {
+    if (repage !== 'false') {
       this.setState({
-        pickup: false
-      })
-    } else {
-      this.setState({
-        pageIndex: 1,
-        pickup: false
+        pageIndex: 1
       })
     }
   }
 
   pickupChange = () => {
-    this.setState({
-      pickup: !this.state.pickup
-    })
+    const { data } = this.state
+
+    let pickup = !this.state.pickup
+
+    if (!pickup && !is(fromJS(data), fromJS(this.state.edData))) {
+      const _this = this
+      confirm({
+        title: '鏁版嵁宸蹭慨鏀癸紝纭畾鏀惧純淇濆瓨鍚楋紵',
+        onOk() {
+          _this.setState({
+            data: [],
+            edData: [],
+            pickup
+          }, () => {
+            _this.setState({
+              data: data,
+              edData: pickup ? fromJS(data).toJS() : []
+            })
+          })
+        },
+        onCancel() {}
+      })
+    } else {
+      this.setState({
+        data: [],
+        edData: [],
+        pickup,
+        loading: false
+      }, () => {
+        this.setState({
+          data: data,
+          edData: pickup ? fromJS(data).toJS() : []
+        })
+      })
+    }
   }
 
   render() {
     const { setting, statFValue, lineMarks } = this.props
-    const { pickup, tableId, data } = this.state
+    const { pickup, tableId, data, edData, columns, edColumns, loading } = this.state
 
     const components = {
       body: {
@@ -566,14 +973,17 @@
     }
 
     // 鏁版嵁鏀惰捣鏃讹紝杩囨护宸查�夋暟鎹�
-    let _data = data || []
+    let _data = data
+    let _columns = columns
 
     if (pickup) {
+      _data = edData
       _data = _data.filter(item => !item.$deleted)
+      _columns = edColumns
     }
-    
+
     let _pagination = false
-    if (setting.laypage !== 'false' && setting.laypage !== false) {
+    if (!pickup && setting.laypage !== 'false' && setting.laypage !== false) {
       _pagination = {
         current: this.state.pageIndex,
         pageSize: this.state.pageSize,
@@ -586,7 +996,7 @@
 
     let _footer = ''
 
-    if (statFValue && statFValue.length > 0) {
+    if (!pickup && statFValue && statFValue.length > 0) {
       _footer = statFValue.map(f => `${f.label}(鍚堣)锛�${f.value}`).join('锛�')
     }
 
@@ -595,12 +1005,13 @@
     return (
       <div className={`edit-custom-table ${pickup ? 'editable' : ''} ${setting.tableHeader || ''} ${height ? 'fixed-height' : ''} ${setting.mode || ''}`} id={tableId}>
         <Switch title="缂栬緫" className="main-pickup" checkedChildren="寮�" unCheckedChildren="鍏�" checked={pickup} onChange={this.pickupChange} />
+        {pickup ? <Button onClick={() => setTimeout(() => {this.checkData()}, 10)} loading={loading} className="submit-table" type="link">鎻愪氦</Button> : null}
         <Table
           components={components}
           style={setting.style}
           size={setting.size || 'middle'}
           bordered={setting.bordered !== 'false'}
-          columns={this.state.columns}
+          columns={_columns}
           dataSource={_data}
           loading={this.props.loading}
           scroll={{ x: '100%', y: height }}
@@ -614,6 +1025,7 @@
           pagination={_pagination}
         />
         {_footer ? <div className={'normal-table-footer ' + (_pagination ? 'pagination' : '')}>{_footer}</div> : null}
+        {pickup && setting.addable === 'true' ? <Button onClick={this.addLine} style={{display: 'block', width: '100%', color: '#26C281'}} icon="plus" type="link"></Button> : null}
       </div>
     )
   }
diff --git a/src/tabviews/custom/components/table/edit-table/normalTable/index.scss b/src/tabviews/custom/components/table/edit-table/normalTable/index.scss
index ea9e278..b31fa58 100644
--- a/src/tabviews/custom/components/table/edit-table/normalTable/index.scss
+++ b/src/tabviews/custom/components/table/edit-table/normalTable/index.scss
@@ -135,21 +135,6 @@
       }
     }
   }
-  // .ant-table-body::-webkit-scrollbar {
-  //   width: 8px;
-  //   height: 10px;
-  // }
-  // ::-webkit-scrollbar-thumb {
-  //   border-radius: 5px;
-  //   box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.13);
-  //   background: rgba(0, 0, 0, 0.13);
-  // }
-  // ::-webkit-scrollbar-track {/*婊氬姩鏉¢噷闈㈣建閬�*/
-  //   box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.05);
-  //   border-radius: 3px;
-  //   border: 1px solid rgba(0, 0, 0, 0.07);
-  //   background: rgba(0, 0, 0, 0);
-  // }
   .fix-header {
     .ant-table-body {
       min-height: unset
@@ -217,7 +202,10 @@
   td.pointer .mk-mask {
     display: block;
   }
-  .ant-pagination {
+  .mk-operation {
+    display: none;
+  }
+  .ant-table-placeholder {
     display: none;
   }
 }
@@ -252,9 +240,6 @@
   }
 }
 .edit-custom-table.ghost {
-  .main-pickup {
-    display: none;
-  }
   .ant-table-thead > tr {
     > th {
       color: inherit;
diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx
index 83da990..2ad0982 100644
--- a/src/tabviews/custom/index.jsx
+++ b/src/tabviews/custom/index.jsx
@@ -527,10 +527,14 @@
         let statFields = []
         let getCols = (cols) => {
           return cols.filter(col => {
-            if (col.blacklist && col.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) {
-              return false
-            } else if (col.Hide === 'true') {
-              return false
+            if (item.subtype !== 'editable') {
+              if (col.blacklist && col.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) {
+                return false
+              } else if (col.Hide === 'true') {
+                return false
+              }
+            } else if (col.blacklist && col.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) {
+              col.Hide = 'true'
             }
             if (col.type === 'number' && col.sum === 'true' && !statFields.includes(col.field)) {
               statFields.push(col)
@@ -724,6 +728,11 @@
           })
           return col.elements.length !== 0
         })
+
+        if (item.subtype === 'editable') {
+          item.submit.logLabel = item.$menuname + '-鎻愪氦'
+          item.submit.$menuId = item.uuid
+        }
       } 
 
       if (item.setting && item.setting.supModule) {
diff --git a/src/tabviews/zshare/actionList/excelInbutton/index.jsx b/src/tabviews/zshare/actionList/excelInbutton/index.jsx
index aff76d3..3d91349 100644
--- a/src/tabviews/zshare/actionList/excelInbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/excelInbutton/index.jsx
@@ -79,21 +79,6 @@
     }
     MKEmitter.removeListener('triggerBtnId', this.actionTrigger)
   }
-
-  /**
-   * @description 鎸夐挳鐘舵�佹敼鍙�
-   */
-  updateStatus = (type) => {
-    if (type === 'start') {
-      this.setState({
-        loading: true
-      })
-    } else if (type === 'over') {
-      this.setState({
-        loading: false
-      })
-    }
-  }
   
   /**
    * @description 瑙﹀彂鎸夐挳鎿嶄綔
@@ -257,7 +242,7 @@
         })
       }
 
-      this.updateStatus('over')
+      this.setState({ loading: false })
       return
     }
 
@@ -267,7 +252,7 @@
         message: '鏈幏鍙栧埌宸ヤ綔琛ㄣ��' + sheetName + '銆嬫暟鎹紒',
         duration: 5
       })
-      this.updateStatus('over')
+      this.setState({ loading: false })
       return
     } else if (data.length * btn.verify.columns.length > 30000) {
       notification.warning({
@@ -285,7 +270,7 @@
         message: result.errors,
         duration: 5
       })
-      this.updateStatus('over')
+      this.setState({ loading: false })
       return
     }
 
@@ -462,7 +447,7 @@
           className={'mk-btn mk-' + btn.class}
           onClick={() => {this.actionTrigger()}}
         >{btn.label}</Button>
-        <ExcelIn btn={btn} triggerExcelIn={() => this.updateStatus('start')} returndata={this.getexceldata} ref="excelIn" />
+        <ExcelIn btn={btn} triggerExcelIn={() => this.setState({ loading: true })} returndata={this.getexceldata} ref="excelIn" />
       </div>
     } else { // icon銆乼ext銆� all 鍗$墖
       let label = ''
@@ -491,7 +476,7 @@
           icon={icon}
           onClick={() => {this.actionTrigger()}}
         >{label}</Button>
-        <ExcelIn btn={btn} triggerExcelIn={() => this.updateStatus('start')} returndata={this.getexceldata} ref="excelIn" />
+        <ExcelIn btn={btn} triggerExcelIn={() => this.setState({ loading: true })} returndata={this.getexceldata} ref="excelIn" />
       </div>
     }
   }
diff --git a/src/utils/utils.js b/src/utils/utils.js
index a64daf8..2a92d14 100644
--- a/src/utils/utils.js
+++ b/src/utils/utils.js
@@ -1075,6 +1075,236 @@
 }
 
 /**
+ * @description 鑾峰彇excel瀵煎叆鍙傛暟
+ * @return {Object} item   鎸夐挳淇℃伅
+ * @return {Array}  data   excel鏁版嵁
+ */
+export function getEditTableSql (verify, data, columns) {
+  let btn = verify
+  let userName = sessionStorage.getItem('User_Name') || ''
+  let fullName = sessionStorage.getItem('Full_Name') || ''
+  let RoleID = sessionStorage.getItem('role_id') || ''
+  let departmentcode = sessionStorage.getItem('departmentcode') || ''
+  let organization = sessionStorage.getItem('organization') || ''
+  let city = sessionStorage.getItem('city') || ''
+  let _sheet = btn.sheet
+  let BID = data[0].$$BID || ''
+
+  if (sessionStorage.getItem('isEditState') === 'true') {
+    userName = sessionStorage.getItem('CloudUserName') || ''
+    fullName = sessionStorage.getItem('CloudFullName') || ''
+  }
+
+  if (window.GLOB.externalDatabase !== null) {
+    _sheet = _sheet.replace(/@db@/ig, window.GLOB.externalDatabase)
+  }
+
+  let database = _sheet.match(/(.*)\.(.*)\./ig)
+  let sheet = _sheet.replace(/(.*)\.(.*)\./ig, '')
+  
+  database = database ? (database[0] || '') : ''
+
+  let getuuid = () => {
+    let uuid = []
+    let timestamp = new Date().getTime()
+    let _options = '0123456789abcdefghigklmnopqrstuv'
+    for (let i = 0; i < 19; i++) {
+      uuid.push(_options.substr(Math.floor(Math.random() * 0x20), 1))
+    }
+    uuid = timestamp + uuid.join('')
+    return uuid
+  }
+
+  // let upId = getuuid()
+
+  let _initCustomScript = '' // 鍒濆鍖栬剼鏈�
+  let _prevCustomScript = '' // 榛樿sql鍓嶆墽琛岃剼鏈�
+  let _backCustomScript = '' // 榛樿sql鍚庢墽琛岃剼鏈�
+
+  if (btn.scripts && btn.intertype === 'system') {
+    btn.scripts.forEach(script => {
+      if (script.status === 'false') return
+
+      if (script.position === 'init') {
+        _initCustomScript += `
+      /* 鑷畾涔夎剼鏈� */
+      ${script.sql}
+      `
+      } else if (script.position === 'front') {
+        _prevCustomScript += `
+      /* 鑷畾涔夎剼鏈� */
+      ${script.sql}
+      `
+      } else {
+        _backCustomScript += `
+      /* 鑷畾涔夎剼鏈� */
+      ${script.sql}
+      `
+      }
+    })
+  }
+
+  // 鎺у埗鍙版墦鍗版暟鎹�
+  let conLtext = []
+
+  let _Ltext = data.map((item, lindex) => {
+    let vals = []
+    let convals = []
+    columns.forEach(col => {
+      let val = item[col.field]
+
+      vals.push(`'${val}'`)
+      convals.push(`'${val}' as ${col.field}`)
+    })
+
+    let key = item.$$uuid
+    let type = 'upt'
+    if (key === '$new') {
+      key = getuuid()
+      type = 'add'
+    } else if (item.$deleted) {
+      type = 'del'
+    }
+
+    vals.push(`'${key}'`)
+    vals.push(`'${type}'`)
+    vals.push(`'${BID}'`)
+
+    convals.push(`'${key}' as jskey`)
+    convals.push(`'${type}' as data_type`)
+    convals.push(`'${BID}' as BID`)
+    conLtext.push(`Select ${convals.join(',')}`)
+
+    return `Select ${vals.join(',')}`
+  })
+
+  let result = []
+  for(let i = 0; i < _Ltext.length; i += 20) {
+    result.push(_Ltext.slice(i, i + 20))
+  }
+
+  let _sql = ''
+  let _sqlInsert = ''
+  let _sqlBottom = ''
+
+  if (btn.intertype === 'system') {
+    let _uniquesql = ''
+    if (btn.uniques && btn.uniques.length > 0) {
+      btn.uniques.forEach(unique => {
+        if (unique.status === 'false') return
+
+        let _fields = unique.field.split(',')
+        let _fields_ = _fields.map(_field => `a.${_field}=b.${_field}`)
+        let _afields = _fields.map(_field => `a.${_field}`)
+        _fields_ = _fields_.join(' and ')
+
+        if (unique.verifyType !== 'physical') {
+          _fields_ += ' and b.deleted=0'
+        }
+
+        _uniquesql += `
+      /* 閲嶅鎬ч獙璇� */
+      Set @tbid=''
+      Select top 1 @tbid=${_fields.join('+\' \'+')} from (select 1 as n,${unique.field} from @${sheet} ) a group by ${unique.field} having sum(n)>1
+      
+      If @tbid!=''
+      Begin
+        select @ErrorCode='${unique.errorCode}',@retmsg=@tbid+' 閲嶅'
+        goto aaa
+      end
+      
+      Set @tbid=''
+      Select top 1 @tbid=${_afields.join('+\' \'+')} from  @${sheet} a Inner join ${sheet} b on ${_fields_}
+      
+      If @tbid!=''
+      Begin
+        select @ErrorCode='${unique.errorCode}',@retmsg=@tbid+' 涓庡凡鏈夋暟鎹噸澶�'
+        goto aaa
+      end
+      `
+      })
+    }
+
+    let declarefields = []
+    let fields = []
+
+    columns.forEach(col => {
+      let key = col.field.toLowerCase()
+      if (key === 'jskey' || key === 'bid' || key === 'data_type') return
+
+      declarefields.push(`${col.field} ${col.datatype}`)
+      fields.push(col.field)
+    })
+
+    fields = fields.join(',')
+
+    let _insert = ''
+    if (btn.default !== 'false') {
+      _insert = `
+      /* 榛樿sql */
+      Insert into ${database}${sheet} (${fields},createuserid,createuser,createstaff,bid) 
+      Select ${fields},@userid@,@username,@fullname,@BID@ From @${sheet}
+      `
+    }
+
+    _sql = `
+      /* 绯荤粺鐢熸垚 */
+      declare @${sheet} table (${declarefields.join(',')},jskey nvarchar(50),data_type nvarchar(50),BID nvarchar(50) )
+      Declare @UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@departmentcode nvarchar(50),@organization nvarchar(50),@login_city nvarchar(50),@ErrorCode nvarchar(50),@retmsg nvarchar(4000),@tbid Nvarchar(512)
+      
+      Select  @ErrorCode='', @retmsg='', @UserName='${userName}', @FullName='${fullName}', @RoleID='${RoleID}', @departmentcode='${departmentcode}', @organization='${organization}', @login_city='${city}'
+      ${_initCustomScript}
+      `
+    _sqlInsert = `Insert into @${sheet} (${fields},jskey,data_type,BID)`
+    _sqlBottom = `
+      /* 榛樿sql */
+      delete tmp_excel_in where upid=@upid@
+      
+      delete tmp_excel_in where datediff(day,createdate,getdate())>15
+      ${_uniquesql}
+      ${_prevCustomScript}
+      ${_insert}
+      ${_backCustomScript}
+      Delete @${sheet}
+      
+      aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg`
+
+    if ((window.GLOB.systemType !== 'production' && options.sysType !== 'cloud') || window.debugger === true) {
+      let fsql = `
+      ${_sql}
+      ${_sqlInsert}
+      
+      /* table鏁版嵁 */
+      ${conLtext.join(' Union all \n')}
+      ${_sqlBottom}
+      `
+      fsql = fsql.replace(/\n\s{8}/ig, '\n')
+      console.info(fsql)
+    }
+  } else { // s_sDataDictb_excelIn 浜戠瀵嗛挜楠岃瘉鍙傛暟
+    _sql = `
+      /* 绯荤粺鐢熸垚 */
+      declare @${sheet} table (jskey nvarchar(50))
+      Declare @UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@departmentcode nvarchar(50),@organization nvarchar(50),@login_city nvarchar(50),@ErrorCode nvarchar(50),@retmsg nvarchar(4000),@tbid Nvarchar(512)
+      
+      Select  @ErrorCode='', @retmsg='', @UserName='${userName}', @FullName='${fullName}', @RoleID='${RoleID}', @departmentcode='${departmentcode}', @organization='${organization}', @login_city='${city}'
+      `
+  }
+
+  return {
+    sql: _sql,
+    lines: result.map((list, index) => {
+      return {
+        Ltext: window.btoa(window.encodeURIComponent(list.join(' Union all '))),
+        Sort: (index + 1) * 10
+      }
+    }),
+    insert: _sqlInsert,
+    bottom: _sqlBottom
+  }
+}
+
+/**
  * @description 浣跨敤绯荤粺鍑芥暟鏃讹紙sPC_TableData_InUpDe 锛夛紝鐢熸垚sql璇彞
  * @return {Object}  btn       鎸夐挳淇℃伅
  * @return {Object}  setting   鑿滃崟鎴栫粍浠舵暟鎹簮璁剧疆
diff --git a/src/views/menudesign/index.jsx b/src/views/menudesign/index.jsx
index ae49cca..57274c6 100644
--- a/src/views/menudesign/index.jsx
+++ b/src/views/menudesign/index.jsx
@@ -433,7 +433,7 @@
             buttons.push(`select '${btn.uuid}' as menuid, '${item.name + '-' + btn.label}' as menuname, '${_sort * 10}' as Sort`)
             _sort++
           })
-        } else if (item.type === 'table' && item.subtype === 'normaltable') {
+        } else if (item.type === 'table' && (item.subtype === 'normaltable' || item.subtype === 'editable')) {
           item.action && item.action.forEach(btn => {
             this.checkBtn(btn)
             buttons.push(`select '${btn.uuid}' as menuid, '${item.name + '-' + btn.label}' as menuname, '${_sort * 10}' as Sort`)
diff --git a/src/views/pcdesign/index.jsx b/src/views/pcdesign/index.jsx
index bd77cc7..f27c627 100644
--- a/src/views/pcdesign/index.jsx
+++ b/src/views/pcdesign/index.jsx
@@ -866,7 +866,7 @@
               title: m.setting.title
             }
           })
-        } else if (item.type === 'table' && item.subtype === 'normaltable') {
+        } else if (item.type === 'table' && (item.subtype === 'normaltable' || item.subtype === 'editable')) {
           item.action && item.action.forEach(btn => {
             this.checkBtn(btn)
             m.children.push({

--
Gitblit v1.8.0