king
2020-03-31 86aab033b5129b00651b716ee70ce871cf670008
2020-03-31
17个文件已修改
3个文件已添加
1333 ■■■■ 已修改文件
src/index.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/commontable/index.jsx 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/managetable/index.jsx 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/rolemanage/index.jsx 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/subtable/index.jsx 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/subtabtable/index.jsx 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/mutilform/index.jsx 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/comtableconfig/index.jsx 82 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/comtableconfig/index.scss 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/formtabconfig/index.jsx 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/formtabconfig/index.scss 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/subtableconfig/index.jsx 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/zshare/createinterface/index.jsx 856 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/zshare/createinterface/mutilform/index.jsx 127 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/zshare/createinterface/mutilform/index.scss 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/zshare/dragelement/actioncard.jsx 81 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/zshare/dragelement/card.jsx 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/zshare/dragelement/index.jsx 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/zshare/tabdragelement/card.jsx 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/zshare/tabdragelement/index.jsx 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/index.js
@@ -10,7 +10,7 @@
import '@/assets/css/viewstyle.scss'
if ((navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i))) {
  window.location.replace(window.location.href.split('build/')[0] + 'index.html')
  window.location.replace(window.location.href.split(/(index.html)+/ig)[0] + 'mob/index.html')
}
const render  = Component => {
src/tabviews/commontable/index.jsx
@@ -633,12 +633,12 @@
        fieldmap.set(item.key, true)
        return {
          reg: new RegExp('@' + _field, 'ig'),
          reg: new RegExp('@' + _field + '@', 'ig'),
          value: item.value
        }
      })
      options.reverse()
      // options.reverse()
      options.forEach(item => {
        _dataresource = _dataresource.replace(item.reg, `'${item.value}'`)
src/tabviews/managetable/index.jsx
@@ -407,12 +407,12 @@
        fieldmap.set(item.key, true)
        return {
          reg: new RegExp('@' + _field, 'ig'),
          reg: new RegExp('@' + _field + '@', 'ig'),
          value: item.value
        }
      })
      options.reverse()
      // options.reverse()
      options.forEach(item => {
        _dataresource = _dataresource.replace(item.reg, `'${item.value}'`)
src/tabviews/rolemanage/index.jsx
@@ -340,13 +340,16 @@
      _keys = Array.from(_keys.keys())
    }
    
    let _LText = _keys.map(key => `select '${key}' as MenuID`)
    _LText = _LText.join(' union all ')
    // let _LText = _keys.map(key => `select '${key}' as MenuID`)
    // _LText = _LText.join(' union all ')
    let param = {
      func: 's_rolemenu_sub',
      RoleID: selectRoleId,
      LText: Utils.formatOptions(_LText)
      // LText: Utils.formatOptions(_LText)
      RoleMenu: _keys.map(key => {
        return {MenuID: key}
      })
    }
    this.setState({
@@ -388,6 +391,15 @@
    this.getMainMenuList()
  }
  /**
   * @description 组件销毁,清除state更新
   */
  componentWillUnmount () {
    this.setState = () => {
      return
    }
  }
  shouldComponentUpdate (nextProps, nextState) {
    return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState))
  }
src/tabviews/subtable/index.jsx
@@ -534,12 +534,12 @@
        fieldmap.set(item.key, true)
        return {
          reg: new RegExp('@' + _field, 'ig'),
          reg: new RegExp('@' + _field + '@', 'ig'),
          value: item.value
        }
      })
      options.reverse()
      // options.reverse()
      options.forEach(item => {
        _dataresource = _dataresource.replace(item.reg, `'${item.value}'`)
src/tabviews/subtabtable/index.jsx
@@ -440,12 +440,12 @@
        fieldmap.set(item.key, true)
        return {
          reg: new RegExp('@' + _field, 'ig'),
          reg: new RegExp('@' + _field + '@', 'ig'),
          value: item.value
        }
      })
      options.reverse()
      // options.reverse()
      options.forEach(item => {
        _dataresource = _dataresource.replace(item.reg, `'${item.value}'`)
src/tabviews/zshare/mutilform/index.jsx
@@ -256,6 +256,20 @@
    }
  }
  handleConfirmPassword = (rule, value, callback, item) => {
    let val = parseFloat(value)
    if (!isNaN(val)) {
      if (typeof(item.min) === 'number' && val < item.min) {
        callback(item.label + '最小值为 ' + item.min)
      } else if (typeof(item.max) === 'number' && val > item.max) {
        callback(item.label + '最大值为 ' + item.max)
      }
    }
    callback()
  }
  getFields() {
    const { getFieldDecorator } = this.props.form
    const { cols } = this.state
@@ -315,8 +329,6 @@
          </Col>
        )
      } else if (item.type === 'number') { // 数字
        let min = (item.min || item.min === 0) ? item.min : -Infinity
        let max = (item.max || item.max === 0) ? item.max : Infinity
        let _initval = item.initval
        let precision = (item.decimal || item.decimal === 0) ? item.decimal : null
@@ -329,12 +341,15 @@
                  {
                    required: true,
                    message: this.props.dict['form.required.input'] + item.label + '!'
                  },
                  {
                    validator: (rule, value, callback) => this.handleConfirmPassword(rule, value, callback, item)
                  }
                ]
              })(
                precision === null ?
                <InputNumber min={min} max={max} disabled={item.readonly === 'true'} onPressEnter={this.handleSubmit} /> :
                <InputNumber min={min} max={max} precision={precision} disabled={item.readonly === 'true'} onPressEnter={this.handleSubmit} />
                <InputNumber disabled={item.readonly === 'true'} onPressEnter={this.handleSubmit} /> :
                <InputNumber precision={precision} disabled={item.readonly === 'true'} onPressEnter={this.handleSubmit} />
                )}
            </Form.Item>
          </Col>
src/templates/comtableconfig/index.jsx
@@ -1063,20 +1063,6 @@
        return
      }
      if (/[^\s]+\s+[^\s]+/ig.test(setting.dataresource) && config.setting.dataresource !== setting.dataresource) {
        let param = {
          func: 's_DataSrc_Save',
          LText: setting.dataresource,
          MenuID: menu.MenuID
        }
        param.LText = Utils.formatOptions(param.LText)
        param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000'
        param.secretkey = Utils.encrypt(param.LText, param.timestamp)
        Api.getLocalConfig(param)
      }
      let _config = {...config, setting: setting}
      let newLText = Utils.formatOptions(Utils.getTableFunc(setting, menu, _config)) // 创建存储过程sql
      let DelText = Utils.formatOptions(Utils.dropfunc(setting.innerFunc))          // 删除存储过程sql
@@ -1092,7 +1078,28 @@
  }
  /**
   * @description 创建表格接口
   * @description 创建按钮接口(写入)
   */
  btnCreatInterface = () => {
    const { menu } = this.props
    const { config } = this.state
    this.menuformRef.handleConfirm().then(res => {
      this.actionFormRef.handleConfirm().then(result => {
        let _menu = {
          type: 'main',
          MenuID: menu.MenuID,
          menuName: res.menuName,
          menuNo: res.menuNo
        }
        this.refs.btnCreatInterface.triggerInInterface(result, config, _menu)
      })
    })
  }
  /**
   * @description 创建表格接口(读出)
   */
  tableCreatInterface = () => {
    const { menu } = this.props
@@ -1100,20 +1107,6 @@
    this.menuformRef.handleConfirm().then(res => {
      this.settingRef.handleConfirm().then(setting => {
        if (/[^\s]+\s+[^\s]+/ig.test(setting.dataresource) && config.setting.dataresource !== setting.dataresource) {
          let param = {
            func: 's_DataSrc_Save',
            LText: setting.dataresource,
            MenuID: menu.MenuID
          }
          param.LText = Utils.formatOptions(param.LText)
          param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000'
          param.secretkey = Utils.encrypt(param.LText, param.timestamp)
          Api.getLocalConfig(param)
        }
        if (setting.interType !== 'inner' || setting.innerFunc) {
          notification.warning({
            top: 92,
@@ -1131,13 +1124,7 @@
          menuNo: res.menuNo
        }
  
        this.refs.tableCreatInterface.exec(_menu, _config).then(result => {
          if (result === 'success') {
            this.setState({
              config: _config
            })
          }
        })
        this.refs.tableCreatInterface.triggerOutInterface(_menu, _config)
      })
    })
  }
@@ -1203,6 +1190,21 @@
      profileVisible: true,
      card: element
    })
  }
  /**
   * @description 按钮双击触发子配置
   */
  btnDoubleClick = (element) => {
    if (!element.origin && (element.OpenType === 'pop' || element.OpenType === 'popview' || element.OpenType === 'blank' || element.OpenType === 'tab')) {
      this.setSubConfig(element, 'button')
    } else {
      notification.warning({
        top: 92,
        message: '此按钮无子配置项!',
        duration: 10
      })
    }
  }
  /**
@@ -2686,6 +2688,11 @@
      configTabs.push(...this.state.config[group])
    })
    let hasbtncrtinter = false
    if (modaltype === 'actionEdit' && this.state.config.setting.interType === 'inner' && !this.state.config.setting.innerFunc && this.state.config.setting.dataresource) {
      hasbtncrtinter = true
    }
    return (
      <div className="common-table-board">
        <DndProvider backend={HTML5Backend}>
@@ -2863,6 +2870,7 @@
                  copyElement={(val) => this.handleAction(val, 'copy')}
                  deleteMenu={this.deleteElement}
                  profileMenu={this.profileAction}
                  doubleClickCard={this.btnDoubleClick}
                  placeholder={this.state.dict['header.form.action.placeholder']}
                />
              </div>
@@ -2905,6 +2913,7 @@
                      handleList={this.handleList}
                      handleMenu={this.handleTab}
                      deleteMenu={this.deleteElement}
                      doubleClickCard={(tab) => this.setSubConfig(tab, 'tab')}
                      placeholder={this.state.dict['header.form.tab.placeholder']}
                    />
                  </div>)
@@ -2939,6 +2948,7 @@
          maskClosable={false}
          onCancel={this.editModalCancel}
          footer={[
            hasbtncrtinter ? <CreateInterface key="interface" dict={this.state.dict} ref="btnCreatInterface" trigger={this.btnCreatInterface}/> : null,
            modaltype === 'actionEdit' ? <CreateFunc key="create" dict={this.state.dict} ref="btnCreatFunc" trigger={this.creatFunc}/> : null,
            <Button key="cancel" onClick={this.editModalCancel}>{this.state.dict['header.cancel']}</Button>,
            <Button key="confirm" type="primary" onClick={this.handleSubmit}>{this.state.dict['header.confirm']}</Button>
src/templates/comtableconfig/index.scss
@@ -417,6 +417,7 @@
            }
          }
          .ant-tabs-tab {
            cursor: default;
            .edit {
              position: absolute;
              left: 0;
src/templates/formtabconfig/index.jsx
@@ -119,6 +119,7 @@
        })
      })
    }
    console.log(_config)
    if (menu && menu.LongParam && menu.LongParam.columns) {
      columns = menu.LongParam.columns
@@ -631,7 +632,9 @@
    if (modaltype === 'search') {
      this.modalFormRef.handleConfirm().then(res => {
        if (config.setting.primaryKey && config.setting.primaryKey.toLowerCase() === res.field.toLowerCase()) {
        let _config = JSON.parse(JSON.stringify(config))
        if (_config.setting.primaryKey && _config.setting.primaryKey.toLowerCase() === res.field.toLowerCase()) {
          notification.warning({
            top: 92,
            message: '表单中字段名不可与主键重复!',
@@ -657,7 +660,7 @@
        let fieldrepet = false // 字段重复
        if (card.iscopy) {
          _groups = config.groups.map(group => {
          _groups = _config.groups.map(group => {
            let _index = null
            group.sublist.forEach((item, index) => {
              if (item.uuid === card.originUuid) {
@@ -679,7 +682,7 @@
            return group
          })
        } else {
          _groups = config.groups.map(group => {
          _groups = _config.groups.map(group => {
            group.sublist = group.sublist.map(item => {
              if (item.uuid !== res.uuid && item.field === res.field) {
                fieldrepet = true
@@ -708,7 +711,7 @@
        }
        this.setState({
          config: {...config, groups: _groups},
          config: {..._config, groups: _groups},
          optionLibs: optionLibs,
          modaltype: ''
        })
@@ -2055,6 +2058,7 @@
                      handleList={this.handleList}
                      handleMenu={this.handleTab}
                      deleteMenu={this.deleteElement}
                      doubleClickCard={(tab) => this.setSubConfig(tab, 'tab')}
                      placeholder={this.state.dict['header.form.tab.placeholder']}
                    />
                  </div>)
src/templates/formtabconfig/index.scss
@@ -362,6 +362,7 @@
            }
          }
          .ant-tabs-tab {
            cursor: default;
            .edit {
              position: absolute;
              left: 0;
src/templates/subtableconfig/index.jsx
@@ -831,20 +831,6 @@
        return
      }
      if (/[^\s]+\s+[^\s]+/ig.test(setting.dataresource) && config.setting.dataresource !== setting.dataresource) {
        let param = {
          func: 's_DataSrc_Save',
          LText: setting.dataresource,
          MenuID: config.uuid
        }
        param.LText = Utils.formatOptions(param.LText)
        param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000'
        param.secretkey = Utils.encrypt(param.LText, param.timestamp)
        Api.getLocalConfig(param)
      }
      let _config = {...config, setting: setting}
      let newLText = Utils.formatOptions(Utils.getTableFunc(setting, {MenuID: _config.uuid, MenuName: _config.tabName, MenuNo: _config.tabNo}, _config)) // 创建存储过程sql
      let DelText = Utils.formatOptions(Utils.dropfunc(setting.innerFunc))          // 删除存储过程sql
@@ -901,6 +887,21 @@
      profileVisible: true,
      card: element
    })
  }
  /**
   * @description 按钮双击触发子配置
   */
  btnDoubleClick = (element) => {
    if (!element.origin && (element.OpenType === 'pop' || element.OpenType === 'popview' || element.OpenType === 'blank' || element.OpenType === 'tab')) {
      this.setSubConfig(element)
    } else {
      notification.warning({
        top: 92,
        message: '此按钮无子配置项!',
        duration: 10
      })
    }
  }
  /**
@@ -2021,21 +2022,6 @@
    this.menuformRef.handleConfirm().then(res => {
      this.settingRef.handleConfirm().then(setting => {
        if (/[^\s]+\s+[^\s]+/ig.test(setting.dataresource) && config.setting.dataresource !== setting.dataresource) {
          let param = {
            func: 's_DataSrc_Save',
            LText: setting.dataresource,
            MenuID: config.uuid
          }
          param.LText = Utils.formatOptions(param.LText)
          param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000'
          param.secretkey = Utils.encrypt(param.LText, param.timestamp)
          Api.getLocalConfig(param)
        }
        if (setting.interType !== 'inner' || setting.innerFunc) {
          notification.warning({
            top: 92,
@@ -2244,6 +2230,7 @@
                  copyElement={(val) => this.handleAction(val, 'copy')}
                  deleteMenu={this.deleteElement}
                  profileMenu={this.profileAction}
                  doubleClickCard={this.btnDoubleClick}
                  placeholder={this.state.dict['header.form.action.placeholder']}
                />
              </div>
src/templates/zshare/createinterface/index.jsx
@@ -1,8 +1,9 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { Button, notification } from 'antd'
import { Button, notification, Modal } from 'antd'
import moment from 'moment'
import MutilForm from './mutilform'
import Utils from '@/utils/utils.js'
import Api from '@/api'
import './index.scss'
@@ -14,40 +15,23 @@
  }
  state = {
    type: '',
    param: null,
    loading: false,
    visible: false,
    config: null,
    btn: null
  }
  exec = (menu, config) => {
    let _grid = []
    let _fields = []
    let _index = 1
    config.columns.forEach(item => {
      if (!item.field || item.type === 'colspan') return
      let _type = `nvarchar(${item.fieldlength || 50})`
      if (item.type === 'number') {
        _type = `decimal(18,${item.decimal ? item.decimal : 0})`
      } else if (item.type === 'picture' || item.type === 'textarea') {
        _type = `nvarchar(${item.fieldlength || 512})`
      }
      _grid.push(item.field)
      _fields.push(`select '${item.field}' as gridfield,'${_type}' as fieldtype,'${item.label}' as label,'${_index}' as Sort`)
      _index++
    })
  triggerOutInterface = (menu, config) => {
    let _search = []
    _index = 1
    let _index = 1
    if (menu.type !== 'main') {
      if (config.setting.dataresource && /@BID@/ig.test(config.setting.dataresource)) {
        _search.push(`select 'BID' as searchfield,'BID' as label,'0' as Sort,'' as defaultvalue,'required' as DefaultType`)
        _index++
      } else {
        _search.push(`select 'BID' as searchfield,'BID' as label,'0' as Sort,'' as defaultvalue,'' as DefaultType`)
        _index++
      }
    }
@@ -125,10 +109,9 @@
      Menuid: menu.MenuID,
      Menuname: menu.menuName,
      Menuno: menu.menuNo,
      Ltextgridparam: _fields.join(' union all '),
      PageType: 'Y',
      Ltextsearchparam: _search.join(' union all '),
      AppendWhere: config.setting.queryType === 'query' ? searchText.join(' AND ') : '',
      Ltextgrid: _grid.join(','),
      WhereType: config.setting.queryType === 'statistics' ? 'Statistics' : 'query',
      OrderCol: config.setting.order
    }
@@ -136,20 +119,116 @@
    param.Ltextsearchparam = Utils.formatOptions(param.Ltextsearchparam)
    param.AppendWhere = Utils.formatOptions(param.AppendWhere)
    this.setState({
      type: 'out',
      param: param,
      config: config,
      visible: true,
      formlist: [{
        type: 'text',
        key: 'Menuname',
        label: '接口名称',
        initval: menu.menuName,
        required: true
      }, {
        type: 'text',
        key: 'Menuno',
        label: '接口函数',
        initval: menu.menuNo,
        required: true
      }, {
        type: 'radio',
        key: 'PageType',
        label: '是否分页',
        initval: 'Y',
        required: true,
        options: [{
          value: 'Y',
          text: this.props.dict['header.form.true']
        }, {
          value: 'N',
          text: this.props.dict['header.form.false']
        }]
      }, {
        type: 'radio',
        key: 'hidden',
        label: '返回隐藏字段',
        initval: 'N',
        required: true,
        options: [{
          value: 'Y',
          text: this.props.dict['header.form.true']
        }, {
          value: 'N',
          text: this.props.dict['header.form.false']
        }]
      }]
    })
  }
  confirmInterface = () => {
    const { type, param, btn, config } = this.state
    if (type === 'out') {
      this.FormRef.handleConfirm().then(res => {
        this.setState({
          type: '',
          loading: true,
          visible: false,
          config: null,
          param: null
        })
        this.createExecOutInterface({...param, ...res}, config)
      })
    } else {
      this.FormRef.handleConfirm().then(res => {
        this.setState({
          type: '',
          btn: null,
          config: null,
          loading: true,
          visible: false,
          param: null
        })
        this.createBtnInterfaceExec({...param, ...res}, config, btn)
      })
    }
  }
  createExecOutInterface = (param, config) => {
    let _grid = []
    let _fields = []
    let _index = 1
    config.columns.forEach(item => {
      if (!item.field || item.type === 'colspan') return
      if (param.hidden !== 'Y' && item.Hide === 'true') return
      let _type = `nvarchar(${item.fieldlength || 50})`
      if (item.type === 'number') {
        _type = `decimal(18,${item.decimal ? item.decimal : 0})`
      } else if (item.type === 'picture' || item.type === 'textarea') {
        _type = `nvarchar(${item.fieldlength || 512})`
      }
      _grid.push(item.field)
      _fields.push(`select '${item.field}' as gridfield,'${_type}' as fieldtype,'${item.label}' as label,'${_index}' as Sort`)
      _index++
    })
    param.Ltextgrid = _grid.join(',')
    param.Ltextgridparam = _fields.join(' union all ')
    param.Ltextgridparam = Utils.formatOptions(param.Ltextgridparam)
    param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000'
    param.secretkey = Utils.encrypt(param.Ltextgridparam, param.timestamp)
    this.setState({
      loading: true
    })
    delete param.hidden
    return new Promise(resolve => {
      this.createExec(resolve, param)
    })
  }
  createExec = (_resolve, param) => {
    let _mainParam = JSON.parse(JSON.stringify(param))
    new Promise(resolve => {
@@ -190,15 +269,12 @@
      }
    }).then(res => {
      // 结果处理
      if (res === false) {
        _resolve('error')
      } else {
      if (res !== false) {
        notification.success({
          top: 92,
          message: '创建成功',
          duration: 2
        })
        _resolve('success')
      }
      this.setState({
@@ -207,16 +283,702 @@
    })
  }
  triggerInInterface = (btn, config, menu) => {
    let param = {
      func: 's_get_para_for_in',
      Menuid: btn.uuid,
      KunName: menu.menuName + '-' + btn.label,
      KunNo: menu.menuNo + '_' + btn.sqlType,
      Ltextgridparam: '',
      Ltexttableparam: '',
      Ltext: '',
      menuType: menu.type
    }
    this.setState({
      type: 'inner',
      param: param,
      visible: true,
      btn: JSON.parse(JSON.stringify(btn)),
      config: JSON.parse(JSON.stringify(config)),
      formlist: [{
        type: 'text',
        key: 'KunName',
        label: '接口名称',
        initval: param.KunName,
        required: true
      }, {
        type: 'text',
        key: 'KunNo',
        label: '接口函数',
        initval: param.KunNo,
        required: true
      }, {
        type: 'radio',
        key: 'TryType',
        label: '事务',
        initval: 'N',
        required: true,
        options: [{
          value: 'Y',
          text: '需要'
        }, {
          value: 'N',
          text: '不需要'
        }]
      }, {
        type: 'radio',
        key: 'Return',
        label: '回执',
        initval: 'N',
        required: true,
        options: [{
          value: 'Y',
          text: '需要'
        }, {
          value: 'N',
          text: '不需要'
        }]
      }]
    })
  }
  createBtnInterfaceExec = (param, config, btn) => {
    let formlist = []
    let receipt = param.Return === 'Y'
    let _mainParam = null
    delete param.Return
    new Promise(resolve => {
      if (btn.OpenType === 'pop') {
        Api.getSystemConfig({
          func: 'sPC_Get_LongParam',
          MenuID: btn.uuid
        }).then(result => {
          if (result.status && result.LongParam) {
            let _LongParam = ''
            // 解析配置,修改模态框标题名称
            if (result.LongParam) {
              try {
                _LongParam = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam)))
              } catch (e) {
                console.warn('Parse Failure')
                _LongParam = ''
              }
            }
            let fields = []
            if (_LongParam && _LongParam.type === 'Modal') {
              if (_LongParam.groups.length > 0) {
                _LongParam.groups.forEach(group => {
                  fields = [...fields, ...group.sublist]
                })
              } else {
                fields = _LongParam.fields
              }
            }
            if (fields && fields.length > 0) {
              formlist = fields.map(cell => {
                let _fieldlen = cell.fieldlength || 50
                if (cell.type === 'textarea' || cell.type === 'fileupload' || cell.type === 'multiselect') {
                  _fieldlen = cell.fieldlength || 512
                } else if (cell.type === 'number') {
                  _fieldlen = cell.decimal ? cell.decimal : 0
                }
                let _field = {
                  type: cell.type,
                  label: cell.label,
                  readonly: cell.readonly,
                  readin: cell.readin !== 'false',
                  fieldlen: _fieldlen,
                  key: cell.field,
                  required: cell.required === 'true' ? 'required' : '',
                  value: cell.initval || ''
                }
                let _fieldtype = `nvarchar(${_fieldlen})`
                if (_field.type.match(/date/ig)) {
                  _fieldtype = 'datetime'
                } else if (_field.type === 'number') {
                  _fieldtype = `decimal(18,${_fieldlen})`
                }
                _field.fieldtype = _fieldtype
                if (cell.type === 'funcvar') {
                  _field.readin = false
                  _field.value = ''
                }
                return _field
              })
            }
            resolve(true)
          } else if (!result.status) {
            notification.warning({
              top: 92,
              message: result.message,
              duration: 10
            })
            resolve(false)
          } else {
            notification.warning({
              top: 92,
              message: '请完善表单信息!',
              duration: 10
            })
            resolve(false)
          }
        })
      }
    }).then(res => {
      if (res === false) return res
      let _keys = []
      param.Ltexttableparam = formlist.map((item, index) => {
        _keys.push(item.key.toLowerCase())
        return `select '${item.key}' as searchfield,'${item.label}' as label,'${index + 2}' as Sort, '${item.fieldtype}' as fieldtype,'${item.required}' as requiredtype,'${item.value}' as defaultvalue`
      })
      if (param.menuType !== 'main' && !_keys.includes('bid')) {
        param.Ltexttableparam.unshift(`select 'BID' as searchfield,'BID' as label,'0' as Sort,'nvarchar(50)' as fieldtype,'required' as requiredtype,'' as defaultvalue`)
      }
      param.Ltexttableparam = param.Ltexttableparam.join(' union all ')
      if (receipt) {
        let _keys = []
        param.Ltextgridparam = formlist.map((item, index) => {
          _keys.push(item.key.toLowerCase())
          return `select '${item.key}' as gridfield, '${item.fieldtype}' as fieldtype,'${item.label}' as label,'${index + 2}' as Sort`
        })
        if (param.menuType !== 'main' && !_keys.includes('bid')) {
          _keys.push('bid')
          param.Ltextgridparam.unshift(`select 'BID' as gridfield,'nvarchar(50)' as fieldtype,'BID' as label,'0' as Sort`)
        }
        if (!_keys.includes(config.setting.primaryKey.toLowerCase())) {
          _keys.push(config.setting.primaryKey.toLowerCase())
          param.Ltextgridparam.unshift(`select '${config.setting.primaryKey}' as gridfield,'nvarchar(50)' as fieldtype,'${config.setting.primaryKey}' as label,'1' as Sort`)
        }
        if (btn.verify && btn.verify.voucher && btn.verify.voucher.enabled && btn.Ot !== 'notRequired') {
          if (!_keys.includes('bvoucher')) {
            param.Ltextgridparam.unshift(`select 'bvoucher' as gridfield,'nvarchar(50)' as fieldtype,'bvoucher' as label,'30' as Sort`)
          }
          if (!_keys.includes('fibvoucherdate')) {
            param.Ltextgridparam.unshift(`select 'fibvoucherdate' as gridfield,'nvarchar(50)' as fieldtype,'fibvoucherdate' as label,'31' as Sort`)
          }
          if (!_keys.includes('fiyear')) {
            param.Ltextgridparam.unshift(`select 'fiyear' as gridfield,'nvarchar(50)' as fieldtype,'fiyear' as label,'32' as Sort`)
          }
        }
        param.Ltextgridparam = param.Ltextgridparam.join(' union all ')
      }
      let BID = param.menuType !== 'main' ? '@BID@' : ''
      param.Ltextgridparam = Utils.formatOptions(param.Ltextgridparam)
      param.Ltexttableparam = Utils.formatOptions(param.Ltexttableparam)
      param.Ltext = this.getSysDefaultSql(btn, config, formlist, receipt, BID)
      param.Ltext = Utils.formatOptions(param.Ltext)
      param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000'
      param.secretkey = Utils.encrypt(param.Ltext, param.timestamp)
      delete param.menuType
      _mainParam = JSON.parse(JSON.stringify(param))
      return Api.getLocalConfig(param)
    }).then(res => {
      if (res === false) return res
      if (!res.status) {
        notification.warning({
          top: 92,
          message: res.message,
          duration: 10
        })
        return false
      } else {
        return true
      }
    }).then(res => {
      if (res === false) return res
      if (window.GLOB.mainSystemApi) {
        _mainParam.rduri = window.GLOB.mainSystemApi
        return Api.getLocalConfig(_mainParam)
      }
      return 'success'
    }).then(res => {
      if (res === false || res === 'success') return res
      if (!res.status) {
        notification.warning({
          top: 92,
          message: res.message,
          duration: 10
        })
        return false
      } else {
        return 'success'
      }
    }).then(res => {
      if (res === 'success') {
        notification.success({
          top: 92,
          message: '创建成功',
          duration: 2
        })
      }
      this.setState({
        loading: false
      })
    })
  }
  getSysDefaultSql = (btn, config, formlist, receipt, BID) => {
    let setting = config.setting
    let primaryKey = setting.primaryKey || 'id'
    let columns = config.columns.filter(col => !!col.field)
    let verify = btn.verify || {}
    // 需要声明的变量集
    let _vars = ['tbid', 'errorcode', 'retmsg', 'billcode', 'bvoucher', 'fibvoucherdate', 'fiyear', 'username', 'fullname', 'modulardetailcode']
    // 系统变量声明与设置初始值
    let _sql = `Declare @tbid nvarchar(50),@ErrorCode nvarchar(50),@retmsg nvarchar(4000),@BillCode nvarchar(50),@BVoucher nvarchar(50),@FIBVoucherDate nvarchar(50), @FiYear nvarchar(50), @UserName nvarchar(50),@FullName nvarchar(50),@ModularDetailCode nvarchar(50)
      `
    let _initvars = [] // 已赋值字段集
    let _initfields = []
    let _initcolumnfields = []
    let _declarefields = []
    // 获取字段键值对
    formlist.forEach(form => {
      let _key = form.key.toLowerCase()
      if (!_initvars.includes(_key)) {
        _initvars.push(_key)
        _initfields.push(`@${_key}=@${_key}@`)
      }
      if (!_vars.includes(_key)) {
        _vars.push(_key)
        let _type = `nvarchar(${form.fieldlen})`
        if (form.type.match(/date/ig)) {
          _type = 'datetime'
        } else if (form.type === 'number') {
          _type = `decimal(18,${form.fieldlen})`
        }
        _declarefields.push(`@${_key} ${_type}`)
      }
    })
    // 添加数据中字段,表单值优先(按钮不选行时跳过)
    if (btn.Ot !== 'notRequired') {
      columns.forEach(col => {
        let _key = col.field.toLowerCase()
        if (!_initvars.includes(_key)) {
          _initvars.push(_key)
          _initcolumnfields.push(`@${_key}=${_key}`)
        }
        if (!_vars.includes(_key)) {
          _vars.push(_key)
          let _type = `nvarchar(${col.fieldlength || 50})`
          if (col.type === 'number') {
            let _length = col.decimal ? col.decimal : 0
            _type = `decimal(18,${_length})`
          } else if (col.type === 'picture' || col.type === 'textarea') {
            _type = `nvarchar(${col.fieldlength || 512})`
          }
          _declarefields.push(`@${_key} ${_type}`)
        }
      })
    }
    // 变量声明
    _declarefields = _declarefields.join(',')
    if (_declarefields) {
      _sql += `,${_declarefields}
        `
    }
    // 变量赋值
    if (_initfields.length > 0) {
      _sql += `select ${_initfields.join(',')}
        `
    }
    if (_initcolumnfields.length > 0) {
      _sql += `select ${_initcolumnfields.join(',')} from ${setting.dataresource} where ${primaryKey}=@ID@
        `
    }
    // 去除禁用的验证
    if (verify.contrasts) {
      verify.contrasts = verify.contrasts.filter(item => item.status !== 'false')
    }
    if (verify.uniques) {
      verify.uniques = verify.uniques.filter(item => item.status !== 'false')
    }
    if (verify.customverifys) {
      verify.customverifys = verify.customverifys.filter(item => item.status !== 'false')
    }
    if (verify.billcodes) {
      verify.billcodes = verify.billcodes.filter(item => item.status !== 'false')
    }
    if (verify.scripts) {
      verify.scripts = verify.scripts.filter(item => item.status !== 'false')
    }
    // 初始化凭证及用户信息字段
    _sql += `select @BVoucher='',@FIBVoucherDate='',@FiYear='',@ErrorCode='',@retmsg=''
      `
    // 启用账期验证
    if (verify.accountdate === 'true') {
      _sql += `exec s_FIBVoucherDateCheck @ErrorCode=@ErrorCode OUTPUT,@retmsg=@retmsg OUTPUT
        if @ErrorCode!=''
          GOTO aaa
        `
    }
    // 失效验证,添加数据时不用
    if (btn.sqlType !== 'insert' && verify.invalid === 'true') {
      let datasource = setting.dataresource
      if (/\s/.test(datasource)) { // 拼接别名
        datasource = '(' + datasource + ') tb'
      }
      _sql += `select @tbid='', @ErrorCode='',@retmsg=''
        select @tbid=${primaryKey} from ${datasource} where ${primaryKey} =@${primaryKey}@
        If @tbid=''
        Begin
          select @ErrorCode='E',@retmsg='数据已失效'
          goto aaa
        end
        `
    }
    // 比较验证
    if (verify.contrasts && verify.contrasts.length > 0) {
      verify.contrasts.forEach(item => {
        _sql += `If ${item.frontfield} ${item.operator} ${item.backfield}
          Begin
            select @ErrorCode='${item.errorCode}',@retmsg='${item.errmsg}'
              goto aaa
          end
          `
      })
    }
    // 唯一性验证,必须存在表单(表单存在时,主键均为单值),必须填写数据源
    if (formlist.length > 0 && verify.uniques && verify.uniques.length > 0) {
      verify.uniques.forEach(item => {
        let _fieldValue = []                     // 表单键值对field=value
        let _value = []                          // 表单值,用于错误提示
        let _labels = item.fieldlabel.split(',') // 表单提示文字
        item.field.split(',').forEach((_field, index) => {
          _fieldValue.push(`${_field}=@${_field}@`)
          _value.push(`${_labels[index] || ''}:'+@${_field}@+'`)
        })
        let _verifyType = ''
        if (item.verifyType === 'logic') {
          _verifyType = ' and deleted=0'
        }
        _sql += `select @tbid='', @ErrorCode='',@retmsg=''
          select @tbid='X' from ${btn.sql} where ${_fieldValue.join(' and ')} and ${primaryKey} !=@${primaryKey}@${_verifyType}
          If @tbid!=''
          Begin
            select @ErrorCode='${item.errorCode}',@retmsg='${_value.join(', ')} 已存在'
            goto aaa
          end
          `
      })
    }
    // 自定义验证
    if (verify.customverifys && verify.customverifys.length > 0) {
      verify.customverifys.forEach(item => {
        _sql += `select @tbid='', @ErrorCode='',@retmsg=''
          select top 1 @tbid='X' from (${item.sql}) a
          If @tbid ${item.result === 'true' ? '!=' : '='}''
          Begin
            select @ErrorCode='${item.errorCode}',@retmsg='${item.errmsg}'
            goto aaa
          end
          `
      })
    }
    // 单号生成,使用上级id(BID)或列表数据,声明变量(检验)
    if (verify.billcodes && verify.billcodes.length > 0) {
      verify.billcodes.forEach(item => {
        let _ModularDetailCode = ''
        let _lpline = ''
        if (item.TypeCharOne === 'Lp') {
          if (item.linkField === 'BID' && BID) { // 替换bid
            _lpline = `set @ModularDetailCode= 'Lp'+ right('${btn.uuid}'+@BID@,48)`
          } else {
            _lpline = `set @ModularDetailCode= 'Lp'+ right('${btn.uuid}'+@${item.linkField}@,48)`
          }
          _ModularDetailCode = '@ModularDetailCode'
        } else if (item.TypeCharOne === 'BN') {
          _ModularDetailCode = `'${item.TypeCharOne + '@' + item.linkField}@'`
        } else {
          _ModularDetailCode = `'${item.ModularDetailCode}'`
        }
        let _declare = ''
        let _key = item.field.toLowerCase()
        if (!_vars.includes(_key)) {
          _declare = `Declare @${_key} nvarchar(50)`
          _vars.push(_key)
        }
        _sql += `${_declare}
          select @BillCode='', @${_key}='', @ModularDetailCode=''
          ${_lpline}
          exec s_get_BillCode
            @ModularDetailCode=${_ModularDetailCode},
            @Type=${item.Type},
            @TypeCharOne='${item.TypeCharOne}',
            @TypeCharTwo ='${item.TypeCharTwo}',
            @BillCode =@BillCode output,
            @ErrorCode =@ErrorCode output,
            @retmsg=@retmsg output
          if @ErrorCode!=''
            goto aaa
          set @${_key}=@BillCode
          `
      })
    }
    let hasvoucher = false
    // 凭证-显示列中选取,必须选行
    if (verify.voucher && verify.voucher.enabled && btn.Ot !== 'notRequired') {
      let _voucher = verify.voucher
      hasvoucher = true
      _sql += `exec s_BVoucher_Create
          @Bill =@${_voucher.linkField}@',
          @BVoucherType ='${_voucher.BVoucherType}',
          @VoucherTypeOne ='${_voucher.VoucherTypeOne}',
          @VoucherTypeTwo ='${_voucher.VoucherTypeTwo}',
          @Type =${_voucher.Type},
          @BVoucher =@BVoucher OUTPUT ,
          @FIBVoucherDate =@FIBVoucherDate OUTPUT ,
          @FiYear =@FiYear OUTPUT ,
          @ErrorCode =@ErrorCode OUTPUT,
          @retmsg=@retmsg OUTPUT
        if @ErrorCode!=''
          GOTO aaa
        `
    }
    let _actionType = null
    let receiptKeys = [] // 回执字段
    if (verify.default !== 'false') { // 判断是否使用默认sql
      _actionType = btn.sqlType
    }
    formlist.forEach(item => {
      receiptKeys.push(item.key.toLowerCase())
    })
    if (!receiptKeys.includes(primaryKey)) {
      receiptKeys.push(primaryKey)
    }
    if (!receiptKeys.includes('bid') && BID) {
      receiptKeys.push('bid')
    }
    // 用于取用户信息
    let _user = `select @UserName=UserName,@FullName=FullName from SUsers where UID=@UserID@
      `
    // 添加、修改、逻辑删除、物理删除
    if (_actionType === 'insert') {
      let keys = []
      let values = []
      formlist.forEach(item => {
        keys.push(item.key.toLowerCase())
        values.push('@' + item.key + '@')
      })
      if (!keys.includes(primaryKey)) {
        keys.push(primaryKey)
        values.push(`@${primaryKey}@`)
      }
      if (!keys.includes('createuserid')) {
        keys.push('createuserid')
        values.push('@userid@')
      }
      if (!keys.includes('createuser')) {
        keys.push('createuser')
        values.push('@username')
      }
      if (!keys.includes('createstaff')) {
        keys.push('createstaff')
        values.push('@fullname')
      }
      if (!keys.includes('bid') && BID) {
        keys.push('bid')
        values.push('@BID@')
      }
      keys = keys.join(',')
      values = values.join(',')
      _sql += _user
      _sql += `insert into ${btn.sql} (${keys}) select ${values};`
    } else if (_actionType === 'update') {
      let _form = []
      let _arr = []
      formlist.forEach(item => {
        _arr.push(item.key.toLowerCase())
        _form.push(item.key + `=@${item.key}@`)
      })
      if (!_arr.includes('modifydate')) {
        _form.push('modifydate=getdate()')
      }
      if (!_arr.includes('modifyuserid')) {
        _form.push('modifyuserid=@userid@')
      }
      if (hasvoucher) {
        if (!_arr.includes('bvoucher')) {
          _arr.push('bvoucher')
          receiptKeys.push('bvoucher')
          _form.push('BVoucher=@BVoucher')
        }
        if (!_arr.includes('fibvoucherdate')) {
          _arr.push('fibvoucherdate')
          receiptKeys.push('fibvoucherdate')
          _form.push('FIBVoucherDate=@FIBVoucherDate')
        }
        if (!_arr.includes('fiyear')) {
          _arr.push('fiyear')
          receiptKeys.push('fiyear')
          _form.push('FiYear=@FiYear')
        }
      }
      if (!_arr.includes(primaryKey)) {
        _arr.push(primaryKey)
      }
      _form = _form.join(',')
      _sql += `update ${btn.sql} set ${_form} where ${primaryKey}=@${primaryKey}@;`
    } else if (_actionType === 'LogicDelete') { // 逻辑删除
      _sql += `update ${btn.sql} set deleted=1,modifydate=getdate(),modifyuserid=@userid@ where ${primaryKey}=@${primaryKey}@;`
    } else if (_actionType === 'delete') {      // 物理删除
      let _msg = ''
      if (columns.length > 0) {
        let _index = 0
        columns.forEach(col => {
          if (col.Hide !== 'true' && _index < 4) {
            _msg += col.label + `=@${col.field}@,`
            _index++
          }
        })
      }
      _sql += _user
      _sql += `insert into snote (remark,createuserid,CreateUser,CreateStaff) select '删除表:${btn.sql} 数据: ${_msg}${primaryKey}='+@${primaryKey}@,@userid@,@username,@fullname delete ${btn.sql} where ${primaryKey}=@${primaryKey}@;`
    }
    // 拼接自定义脚本
    if (verify.scripts && verify.scripts.length > 0) {
      let _scripts = ''
      verify.scripts.forEach(item => {
        _scripts += `
        ${item.sql}`
      })
      _sql += `${_scripts}`
    }
    let _ltext = ''
    if (receipt) {
      _ltext = `select obj_name='data',prm_field='${receiptKeys.join(',')}',str_field='',
            arr_field='',tabid='',parid='',sub_name='',sub_field=''
      select ${receiptKeys.map(key => `@${key}@ as ${key}`).join(',')}
      `
      _ltext = Utils.formatOptions(_ltext)
    }
    _sql += `
      aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg,'${_ltext}' as Ltext`
    console.log(_sql)
    return _sql
  }
  render() {
    return (
      <Button
        className="mk-btn mk-green"
        onClick={this.props.trigger}
        loading={this.state.loading}
      >
        {this.props.dict['header.menu.interface.create']}
      </Button>
      <div style={{display: 'inline-block', marginRight: '8px'}}>
        <Button
          className="mk-btn mk-green"
          onClick={this.props.trigger}
          loading={this.state.loading}
        >
          {this.props.dict['header.menu.interface.create']}
        </Button>
        {/* 接口选项 */}
        <Modal
          title={this.props.dict['header.menu.interface.create']}
          visible={this.state.visible}
          width={500}
          maskClosable={false}
          onOk={this.confirmInterface}
          onCancel={() => {this.setState({visible: false})}}
          destroyOnClose
        >
          <MutilForm
            dict={this.props.dict}
            formlist={this.state.formlist}
            wrappedComponentRef={(inst) => this.FormRef = inst}
          />
        </Modal>
      </div>
    )
  }
}
src/templates/zshare/createinterface/mutilform/index.jsx
New file
@@ -0,0 +1,127 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { Form, Row, Col, Input, Radio, Select } from 'antd'
import './index.scss'
class MainSearch extends Component {
  static propTpyes = {
    formlist: PropTypes.array,    // 按钮信息、表单列表
    dict: PropTypes.object        // 字典项
  }
  state = {
  }
  UNSAFE_componentWillMount () {
  }
  getFields() {
    const { getFieldDecorator } = this.props.form
    const fields = []
    this.props.formlist.forEach((item, index) => {
      if (item.type === 'text') {
        fields.push(
          <Col span={24} key={index}>
            <Form.Item label={item.label}>
              {getFieldDecorator(item.key, {
                initialValue: item.initval,
                rules: [
                  {
                    required: item.required,
                    message: this.props.dict['form.required.input'] + item.label + '!'
                  }
                ]
              })(<Input placeholder="" autoComplete="off"/>)}
            </Form.Item>
          </Col>
        )
      } else if (item.type === 'select') {
        fields.push(
          <Col span={24} key={index}>
            <Form.Item label={item.label}>
              {getFieldDecorator(item.key, {
                initialValue: item.initval,
                rules: [
                  {
                    required: item.required,
                    message: this.props.dict['form.required.select'] + item.label + '!'
                  }
                ]
              })(
                <Select
                  showSearch
                  filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
                >
                  {item.options.map(option =>
                    <Select.Option id={option.key} title={option.Text} key={option.key} value={option.Value}>{option.Text}</Select.Option>
                  )}
                </Select>
              )}
            </Form.Item>
          </Col>
        )
      } else if (item.type === 'radio') {
        fields.push(
          <Col span={24} key={index}>
            <Form.Item label={item.label}>
              {getFieldDecorator(item.key, {
                initialValue: item.initval,
                rules: [
                  {
                    required: item.required,
                    message: this.props.dict['form.required.select'] + item.label + '!'
                  }
                ]
              })(
                <Radio.Group>
                  {item.options.map(op => {
                    return <Radio key={op.value} value={op.value}>{op.text}</Radio>
                  })}
                </Radio.Group>
              )}
            </Form.Item>
          </Col>
        )
      }
    })
    return fields
  }
  handleConfirm = () => {
    // 表单提交时检查输入值是否正确
    return new Promise((resolve, reject) => {
      this.props.form.validateFieldsAndScroll((err, values) => {
        if (!err) {
          resolve(values)
        } else {
          reject(err)
        }
      })
    })
  }
  render() {
    const formItemLayout = {
      labelCol: {
        xs: { span: 24 },
        sm: { span: 8 }
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 16 }
      }
    }
    return (
      <Form {...formItemLayout} className="create-Interface-setting-form">
        <Row gutter={24}>{this.getFields()}</Row>
      </Form>
    )
  }
}
export default Form.create()(MainSearch)
src/templates/zshare/createinterface/mutilform/index.scss
New file
@@ -0,0 +1,6 @@
.create-Interface-setting-form {
  .anticon-question-circle {
    color: #c49f47;
    margin-right: 3px;
  }
}
src/templates/zshare/dragelement/actioncard.jsx
New file
@@ -0,0 +1,81 @@
import React from 'react'
import { useDrag, useDrop } from 'react-dnd'
import { Icon, Button } from 'antd'
import ItemTypes from './itemtypes'
import './index.scss'
const Card = ({ id, type, card, moveCard, findCard, editCard, delCard, copyCard, profileCard, hasDrop, doubleClickCard }) => {
  const originalIndex = findCard(id).index
  const [{ isDragging }, drag] = useDrag({
    item: { type: ItemTypes[type], id, originalIndex },
    collect: monitor => ({
      isDragging: monitor.isDragging(),
    }),
  })
  const [, drop] = useDrop({
    accept: ItemTypes[type],
    canDrop: () => true,
    drop: (item) => {
      if (!item.hasOwnProperty('originalIndex')) {
        hasDrop(card)
      }
    },
    hover({ id: draggedId }) {
      if (!draggedId) return
      if (draggedId !== id) {
        const { index: overIndex } = findCard(id)
        moveCard(draggedId, overIndex)
      }
    },
  })
  const opacity = isDragging ? 0 : 1
  const edit = () => {
    editCard(id)
  }
  const del = () => {
    delCard(id)
  }
  const copy = () => {
    copyCard(id)
  }
  const profile = () => {
    profileCard(id)
  }
  const doubleClick = () => {
    doubleClickCard(id)
  }
  let hasProfile = false
  if (['pop', 'prompt', 'exec'].includes(card.OpenType)) {
    hasProfile = true
  } else if (card.OpenType === 'excelIn' || card.OpenType === 'excelOut') {
    hasProfile = true
  } else if (card.funcType === 'print') {
    hasProfile = true
  }
  return (
    <div className="page-card" style={{ opacity: opacity}}>
      <div ref={node => drag(drop(node))}>
        <Button
          className={'mk-btn mk-' + card.class}
          icon={card.icon}
          key={card.uuid}
          onDoubleClick={doubleClick}
        >
          {card.label}{card.position === 'grid' && <Icon type="table" />}
        </Button>
      </div>
      <Icon className="edit" title="编辑" type="edit" onClick={edit} />
      <Icon className="edit close" title="删除" type="close" onClick={del} />
      <Icon className="edit copy" title="复制" type="copy" onClick={copy} />
      {hasProfile ? <Icon className="edit profile" title="校验规则" type="profile" onClick={profile} /> : null}
    </div>
  )
}
export default Card
src/templates/zshare/dragelement/card.jsx
@@ -1,14 +1,13 @@
import React from 'react'
import { useDrag, useDrop } from 'react-dnd'
import { Icon, Button, Select, DatePicker, Input } from 'antd'
import { Icon, Select, DatePicker, Input } from 'antd'
import moment from 'moment'
import ItemTypes from './itemtypes'
import './index.scss'
const { MonthPicker, WeekPicker, RangePicker } = DatePicker
// const { Paragraph } = Typography
const Card = ({ id, type, card, moveCard, findCard, editCard, delCard, copyCard, profileCard, hasDrop, showfield }) => {
const Card = ({ id, type, card, moveCard, findCard, editCard, delCard, hasDrop, showfield }) => {
  const originalIndex = findCard(id).index
  const [{ isDragging }, drag] = useDrag({
    item: { type: ItemTypes[type], id, originalIndex },
@@ -42,14 +41,6 @@
    delCard(id)
  }
  const copy = () => {
    copyCard(id)
  }
  const profile = () => {
    profileCard(id)
  }
  let _defaultValue = '' // 下拉搜索、时间范围类型,初始值需要预处理
  if (type === 'search' && (card.type === 'multiselect' || card.type === 'select' || card.type === 'link')) {
@@ -72,17 +63,6 @@
      } catch {
        _defaultValue = [null, null]
      }
    }
  }
  let hasProfile = false
  if (type === 'action') {
    if (['pop', 'prompt', 'exec'].includes(card.OpenType)) {
      hasProfile = true
    } else if (card.OpenType === 'excelIn' || card.OpenType === 'excelOut') {
      hasProfile = true
    } else if (card.funcType === 'print') {
      hasProfile = true
    }
  }
@@ -122,15 +102,6 @@
            </div>
          </div> : null
        }
        {type === 'action' ?
          <Button
            className={'mk-btn mk-' + card.class}
            icon={card.icon}
            key={card.uuid}
          >
            {card.label}{card.position === 'grid' && <Icon type="table" />}
          </Button> : null
        }
        {type === 'columns' ?
          <span className="ant-table-header-column">
            <div className="ant-table-column-sorters" title={card.label} style={{textAlign: card.Align}}>
@@ -152,8 +123,6 @@
      </div>
      <Icon className="edit" title="编辑" type="edit" onClick={edit} />
      <Icon className="edit close" title="删除" type="close" onClick={del} />
      {type === 'action' ? <Icon className="edit copy" title="复制" type="copy" onClick={copy} /> : null}
      {hasProfile ? <Icon className="edit profile" title="校验规则" type="profile" onClick={profile} /> : null}
    </div>
  )
}
src/templates/zshare/dragelement/index.jsx
@@ -5,10 +5,11 @@
import { Col, Icon } from 'antd'
import Utils from '@/utils/utils.js'
import Card from './card'
import ActionCard from './actioncard'
import ItemTypes from './itemtypes'
import './index.scss'
const Container = ({list, setting, gridBtn, type, placeholder, handleList, handleMenu, deleteMenu, copyElement, profileMenu, handleGridBtn, showfield }) => {
const Container = ({list, setting, gridBtn, type, placeholder, handleList, handleMenu, deleteMenu, copyElement, profileMenu, handleGridBtn, showfield, doubleClickCard }) => {
  let target = null
  
  const [cards, setCards] = useState(list)
@@ -38,6 +39,11 @@
  const profileCard = id => {
    const { card } = findCard(id)
    profileMenu(card)
  }
  const doubleClickBtn = id => {
    const { card } = findCard(id)
    doubleClickCard(card)
  }
  const delCard = id => {
@@ -203,7 +209,7 @@
  return (
    <div ref={drop} className="ant-row">
      {type === 'action' && cards.map(card => (
        <Card
        <ActionCard
          key={card.uuid}
          id={`${card.uuid}`}
          type={type}
@@ -215,6 +221,7 @@
          profileCard={profileCard}
          findCard={findCard}
          hasDrop={hasDrop}
          doubleClickCard={doubleClickBtn}
        />
      ))}
      {type === 'search' && cards.map(card => (
src/templates/zshare/tabdragelement/card.jsx
@@ -3,7 +3,7 @@
import { Icon } from 'antd'
import './index.scss'
const Card = ({ id, type, card, moveCard, findCard, editCard, delCard, hasDrop }) => {
const Card = ({ id, type, card, moveCard, findCard, doubleClickCard, hasDrop }) => {
  const originalIndex = findCard(id).index
  const [{ isDragging }, drag] = useDrag({
    item: { type: type, id, originalIndex },
@@ -27,11 +27,16 @@
      }
    },
  })
  const doubleClick = () => {
    doubleClickCard(id)
  }
  const opacity = isDragging ? 0 : 1
  return (
    <div className="page-card" style={{ opacity: opacity}}>
      <div ref={node => drag(drop(node))}>
      <div ref={node => drag(drop(node))} onDoubleClick={doubleClick}>
        {card.icon ? <Icon type={card.icon} /> : null}
        {card.label}
      </div>
src/templates/zshare/tabdragelement/index.jsx
@@ -9,7 +9,7 @@
const { TabPane } = Tabs
const Container = ({list, type, groupId, placeholder, handleList, handleMenu, deleteMenu }) => {
const Container = ({list, type, groupId, placeholder, handleList, handleMenu, deleteMenu, doubleClickCard }) => {
  let target = null
  const [cards, setCards] = useState(list)
  const moveCard = (id, atIndex) => {
@@ -74,6 +74,11 @@
  const edit = (card) => {
    handleMenu(card)
  }
  const doubleClickBab = id => {
    const { card } = findCard(id)
    doubleClickCard(card)
  }
  
  const del = (card) => {
    deleteMenu({card: card, type: type})
@@ -93,6 +98,7 @@
                moveCard={moveCard}
                findCard={findCard}
                hasDrop={hasDrop}
                doubleClickCard={doubleClickBab}
              />
              <Icon className="edit" type="edit" onClick={() => edit(card)} />
              <Icon className="edit close" type="close" onClick={() => del(card)} />