king
2024-03-08 2a6a3b7d14e3d4f1dcfc72c3f9fbef8dd20238c2
src/menu/components/share/actioncomponent/index.jsx
@@ -2,11 +2,11 @@
import PropTypes from 'prop-types'
import { is, fromJS } from 'immutable'
import { Modal, notification, Button } from 'antd'
import moment from 'moment'
import Utils, { FuncUtils } from '@/utils/utils.js'
import Utils from '@/utils/utils.js'
import { getActionForm, getBaseTableActionForm } from './formconfig'
import asyncSpinComponent from '@/utils/asyncSpinComponent'
import MKEmitter from '@/utils/events.js'
import ActionForm from './actionform'
import MenuUtils from '@/utils/utils-custom.js'
@@ -136,7 +136,7 @@
  changeBtnStyle = (element) => {
    let _style = element.style ? fromJS(element.style).toJS() : {}
    let options = ['font', 'border', 'background', 'margin', 'padding']
    let options = ['font', 'border', 'background', 'margin', 'padding', 'minHeight']
    this.setState({
      card: element
@@ -206,8 +206,10 @@
        supId = ''
      }
    }
    let menu = window.GLOB.customMenu
    
    let modules = MenuUtils.getSubModules(window.GLOB.customMenu.components, config.uuid, supId)
    let modules = MenuUtils.getSubModules(menu.components, config.uuid, supId, menu.interfaces || null)
    if (config.subtype === 'basetable') {
      delete card.eleType // 区分按钮位置
@@ -218,7 +220,7 @@
        formlist: getBaseTableActionForm(card, functip, config, usefulFields, modules)
      })
    } else {
      let anchors = MenuUtils.getAnchors(window.GLOB.customMenu.components, config.uuid) || []
      let anchors = MenuUtils.getAnchors(menu.components, config.uuid) || []
  
      this.setState({
        visible: true,
@@ -283,12 +285,17 @@
              output: 'true',
              required: 'false',
              type: 'text',
              noValue: 'true',
              uuid: Utils.getuuid()
            }
  
            if (item.type === 'number') {
              cell.type = 'number'
              cell.decimal = item.decimal
              if (item.noValue === 'hide') {
                cell.noValue = 'false'
              }
            }
  
            columns.push(cell)
@@ -407,10 +414,11 @@
            btn.style = item.style || {}
            if (btn.class) {
              if (btn.class !== item.class || btn.show !== item.show || !btn.style.color || (item.focus && !btn.style.color)) {
                if (btn.show === 'icon') {
                  btn.style.color = color[btn.class]
                  btn.style.backgroundColor = 'transparent'
                } else if (btn.class === 'default') {
                // if (btn.show === 'icon') {
                //   btn.style.color = color[btn.class]
                //   btn.style.backgroundColor = 'transparent'
                // }
                if (btn.class === 'default') {
                  btn.style.color = 'rgba(0, 0, 0, 0.65)'
                  btn.style.backgroundColor = '#fff'
                  btn.style.borderColor = '#d9d9d9'
@@ -419,6 +427,7 @@
                  btn.style.color = color[_c]
                  btn.style.backgroundColor = '#fff'
                  btn.style.borderColor = color[_c]
                  btn.style.borderWidth = '1px'
                } else if (btn.class === 'gray') {
                  btn.style.color = 'rgba(0, 0, 0, 0.65)'
                  btn.style.backgroundColor = color[btn.class]
@@ -433,6 +442,8 @@
              btn.style = {}
            }
          }
          btn.updateTime = moment().format('YYYY-MM-DD HH:mm')
          return btn
        } else {
          return item
@@ -505,6 +516,7 @@
      _actionlist = _actionlist.map(item => {
        if (item.uuid === card.uuid) {
          item.verify = res
          item.updateTime = moment().format('YYYY-MM-DD HH:mm')
        }
  
        return item
@@ -523,55 +535,47 @@
   * @description 创建按钮存储过程
   */
  creatFunc = () => {
    const { config } = this.props
    const menu = window.GLOB.customMenu
    let _config = fromJS(this.props.config).toJS()
    this.actionFormRef.handleConfirm().then(res => {
      let btn = res         // 按钮信息
      let newLText = ''     // 创建存储过程sql
      let DelText = ''      // 删除存储过程sql
    return new Promise((resolve) => {
      this.actionFormRef.handleConfirm().then(res => {
        let btn = fromJS(res).toJS()
        let _config = fromJS(config).toJS()
      // 创建存储过程,必须填写内部函数名
      if (btn.intertype !== 'inner') {
        notification.warning({
          top: 92,
          message: '使用内部函数时,才可以创建存储过程!',
          duration: 5
        })
        return
      }
        if (btn.OpenType === 'excelIn') {
          btn.func = btn.innerFunc
          btn.menuNo = menu.MenuNo
          btn.MenuName = menu.MenuName + _config.name
          btn.$type = 'excelIn'
      if (btn.OpenType === 'pop') {
        let _param = {
          funcName: btn.innerFunc,
          name: _config.setting.tableName || '',
          fields: btn.modal ? btn.modal.fields : [],
          menuNo: menu.MenuNo
          resolve(btn)
        } else if (btn.OpenType === 'excelOut') {
          _config.MenuName = menu.MenuName + '-' + _config.name
          _config.menuNo = menu.MenuNo
          _config.MenuID = menu.MenuID
          _config.func = btn.innerFunc
          _config.$type = 'table'
          resolve(_config)
        } else {
          btn.func = btn.innerFunc
          btn.name = _config.setting.tableName || ''
          btn.menuNo = menu.MenuNo
          btn.MenuID = menu.MenuID
          btn.MenuName = menu.MenuName + _config.name
          btn.fields = []
          btn.columns = _config.columns
          btn.primaryKey = _config.setting.primaryKey || 'ID'
          btn.$type = 'btn'
          if (btn.OpenType === 'pop') {
            btn.fields = btn.modal ? btn.modal.fields : []
          }
          resolve(btn)
        }
        newLText = Utils.formatOptions(FuncUtils.getfunc(_param, btn, menu, _config))
        DelText = Utils.formatOptions(FuncUtils.dropfunc(btn.innerFunc))
      } else if (btn.OpenType === 'excelIn') {
        let _param = {
          funcName: btn.innerFunc,
          menuNo: menu.MenuNo
        }
        newLText = Utils.formatOptions(FuncUtils.getexcelInfunc(_param, btn, menu))
        DelText = Utils.formatOptions(FuncUtils.dropfunc(btn.innerFunc))
      } else if (btn.OpenType === 'excelOut') {
        newLText = Utils.formatOptions(FuncUtils.getTableFunc(btn.innerFunc, menu, _config)) // 创建存储过程sql
        DelText = Utils.formatOptions(FuncUtils.dropfunc(btn.innerFunc))
      } else {
        let _param = {
          funcName: btn.innerFunc,
          name: _config.setting.tableName || '',
          fields: '',
          menuNo: menu.MenuNo
        }
        newLText = Utils.formatOptions(FuncUtils.getfunc(_param, btn, menu, _config))
        DelText = Utils.formatOptions(FuncUtils.dropfunc(btn.innerFunc))
      }
      this.refs.btnCreatFunc.exec(btn.innerFunc, newLText, DelText)
      })
    })
  }
@@ -701,12 +705,13 @@
        {/* 编辑按钮:复制、编辑 */}
        <Modal
          title="按钮·编辑"
          wrapClassName="mk-scroll-modal"
          visible={visible}
          width={920}
          maskClosable={false}
          onCancel={this.editModalCancel}
          footer={[
            record && record.intertype === 'inner' ? <CreateFunc key="create" ref="btnCreatFunc" trigger={this.creatFunc}/> : null,
            record && record.intertype === 'inner' ? <CreateFunc key="create" getMsg={this.creatFunc}/> : null,
            <Button key="cancel" onClick={this.editModalCancel}>取消</Button>,
            <Button key="confirm" type="primary" onClick={this.handleSubmit}>确定</Button>
          ]}