king
2021-10-10 8cdfdd9914d1c4f6cd59176d61869522f51f39e4
2021-10-10
12个文件已修改
6个文件已添加
2166 ■■■■■ 已修改文件
src/menu/components/table/edit-table/columns/editColumn/index.jsx 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/table/edit-table/columns/index.jsx 47 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/table/edit-table/columns/tableIn/customscript/index.jsx 343 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/table/edit-table/columns/tableIn/customscript/index.scss 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/table/edit-table/columns/tableIn/index.jsx 704 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/table/edit-table/columns/tableIn/index.scss 83 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/table/edit-table/columns/tableIn/uniqueform/index.jsx 129 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/table/edit-table/columns/tableIn/uniqueform/index.scss 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/table/edit-table/index.jsx 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/custom/components/table/edit-table/index.jsx 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/custom/components/table/edit-table/index.scss 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/custom/components/table/edit-table/normalTable/index.jsx 496 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/custom/components/table/edit-table/normalTable/index.scss 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/custom/index.jsx 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/actionList/excelInbutton/index.jsx 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/utils.js 230 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/menudesign/index.jsx 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/pcdesign/index.jsx 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
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)
      }
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>
    )
  }
src/menu/components/table/edit-table/columns/tableIn/customscript/index.jsx
New file
@@ -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: '自定义sql语句中,不可出现字符 -- ,注释请用 /*内容*/',
            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表示数据不回滚,如ENT、NNT、FNT、NMNT), 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)
src/menu/components/table/edit-table/columns/tableIn/customscript/index.scss
src/menu/components/table/edit-table/columns/tableIn/index.jsx
New file
@@ -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)
src/menu/components/table/edit-table/columns/tableIn/index.scss
New file
@@ -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;
    }
  }
}
src/menu/components/table/edit-table/columns/tableIn/uniqueform/index.jsx
New file
@@ -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)
src/menu/components/table/edit-table/columns/tableIn/uniqueform/index.scss
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'
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}
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;
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与field转换
    orderfields: {},      // 排序id与field转换
    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>
    )
  }
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;
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) {
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、text、 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>
    }
  }
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   菜单或组件数据源设置
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`)
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({