king
2020-11-10 5df578ff69f6b02e821d59a8883bc75d78695a62
src/templates/sharecomponent/actioncomponent/index.jsx
@@ -43,6 +43,7 @@
    actionlist: null,    // 按钮组
    copying: false,      // 按钮复制中
    visible: false,      // 模态框控制
    printTemps: [],      // 单据打印模板
    profVisible: false   // 验证信息模态框
  }
@@ -67,6 +68,54 @@
    } else if (!is(fromJS(nextProps.config.action), fromJS(this.props.config.action)) && !is(fromJS(nextProps.config.action), fromJS(actionlist))) {
      this.setState({actionlist: fromJS(nextProps.config.action).toJS()})
    }
  }
  componentDidMount () {
    this.getBillPrintTemp()
  }
  getBillPrintTemp = () => {
    let _sql = `select PrintTempNO,Images,PrintTempNO+PrintTempName as PN from sPrintTemplate
    where appkey= @appkey@ and Deleted=0  and typechartwo='web_print'
    union select ID,Images,a.PrintTempNO+PrintTempName as PN
    from (select * from sPrintTemplate where appkey= '' and Deleted=0  and typechartwo='web_print') a
    left join (select PrintTempNO from sPrintTemplate where appkey= @appkey@  and Deleted=0 ) b
    on a.PrintTempNO=b.PrintTempNO
    left join (select Srcid from sPrintTemplate_Log where appkey='' and apicode= @appkey@ and Deleted=0 ) c
    on a.ID=c.Srcid where b.PrintTempNO is null and c.Srcid is null`
    let param = {
      func: 'sPC_Get_SelectedList',
      LText: Utils.formatOptions(_sql),
      obj_name: 'data',
      arr_field: 'PN,PrintTempNO,Images'
    }
    param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
    param.secretkey = Utils.encrypt(param.LText, param.timestamp)
    param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) // 云端数据验证
    Api.getSystemConfig(param).then(res => {
      if (res.status) {
        let temps = res.data.map(temp => {
          return {
            value: temp.PrintTempNO,
            text: temp.PN
          }
        })
        this.setState({
          printTemps: temps
        })
      } else {
        notification.warning({
          top: 92,
          message: res.message,
          duration: 5
        })
      }
    })
  }
  /**
@@ -154,14 +203,14 @@
        this.setState({
          visible: true,
          card: card,
          formlist: getActionForm(card, functip, this.props.config, this.props.usefulFields, this.props.type, menulist)
          formlist: getActionForm(card, functip, this.props.config, this.props.usefulFields, this.props.type, menulist, this.state.printTemps)
        })
      })
    } else {
      this.setState({
        visible: true,
        card: card,
        formlist: getActionForm(card, functip, this.props.config, this.props.usefulFields, this.props.type, menulist)
        formlist: getActionForm(card, functip, this.props.config, this.props.usefulFields, this.props.type, menulist, this.state.printTemps)
      })
    }
  }
@@ -400,7 +449,7 @@
            Align: 'center',
            IsSort: 'false',
            uuid: Utils.getuuid(),
            label: this.state.dict['model.form.column.action'],
            label: this.state.dict['model.operation'],
            type: 'action',
            style: 'button',
            show: 'horizontal',
@@ -621,7 +670,7 @@
            Align: 'center',
            IsSort: 'false',
            uuid: Utils.getuuid(),
            label: this.state.dict['model.form.column.action'],
            label: this.state.dict['model.operation'],
            type: 'action',
            style: 'button',
            show: 'horizontal',
@@ -686,39 +735,13 @@
   * @description 创建按钮存储过程
   */
  creatFunc = () => {
    const { config, menu } = this.props
    const { menu } = this.props
    let _config = fromJS(this.props.config).toJS()
    this.actionFormRef.handleConfirm().then(res => {
      let btn = res         // 按钮信息
      let newLText = ''     // 创建存储过程sql
      let DelText = ''      // 删除存储过程sql
      let _actionlist = fromJS(this.state.actionlist).toJS()
      _actionlist = _actionlist.filter(item => !item.origin || item.uuid === btn.uuid)
      let labelrepet = false
      _actionlist = _actionlist.map(item => {
        if (item.uuid !== btn.uuid && item.label === btn.label) {
          labelrepet = true
        }
        if (item.uuid === btn.uuid) {
          return btn
        } else {
          return item
        }
      })
      if (labelrepet) {
        notification.warning({
          top: 92,
          message: this.state.dict['model.name.exist'] + ' !',
          duration: 5
        })
        return
      }
      // 创建存储过程,必须填写内部函数名
      if (btn.intertype !== 'inner') {
@@ -816,35 +839,7 @@
      }).then(res => {
        if (!res) return
        this.refs.btnCreatFunc.exec(btn.innerFunc, newLText, DelText).then(result => {
          if (result !== 'success') return
          // 判断是否存在操作列
          let _hasGridbtn = _actionlist.filter(act => act.position === 'grid').length > 0
          let _gridBtn = config.gridBtn ? fromJS(config.gridBtn).toJS() : null
          if (_gridBtn) {
            _gridBtn.display = _hasGridbtn
          } else {
            _gridBtn = {
              display: _hasGridbtn,
              Align: 'center',
              IsSort: 'false',
              uuid: Utils.getuuid(),
              label: this.state.dict['model.form.column.action'],
              type: 'action',
              style: 'button',
              show: 'horizontal',
              Width: 120
            }
          }
          this.setState({
            actionlist: _actionlist
          }, () => {
            this.props.updateaction({...config, action: _actionlist, gridBtn: _gridBtn})
          })
        })
        this.refs.btnCreatFunc.exec(btn.innerFunc, newLText, DelText)
      })
    })
  }
@@ -856,14 +851,6 @@
    const { config, type, menu } = this.props
    this.actionFormRef.handleConfirm().then(result => {
      if (result.Ot === 'requiredOnce') {
        notification.warning({
          top: 92,
          message: '多行拼接时,不可创建接口!',
          duration: 5
        })
        return
      }
      let _menu = {
        type: type,
        MenuID: menu.MenuID,
@@ -907,11 +894,6 @@
    const { config } = this.props
    const { actionlist, visible, card, dict, copying, profVisible } = this.state
    let hasbtncrtinter = false
    if (card && !card.copyType && config.setting.interType === 'system' && config.setting.dataresource) {
      hasbtncrtinter = true
    }
    return (
      <div className="model-table-action-list" style={config.charts.length > 1 ? {paddingTop: 25} : null}>
        <Tooltip placement="bottomLeft" overlayClassName="middle" title={dict['model.tooltip.action.guide']}>
@@ -935,8 +917,8 @@
          maskClosable={false}
          onCancel={this.editModalCancel}
          footer={[
            hasbtncrtinter ? <CreateInterface key="interface" dict={dict} ref="btnCreatInterface" trigger={this.btnCreatInterface}/> : null,
            card && !card.copyType ? <CreateFunc key="create" dict={dict} ref="btnCreatFunc" trigger={this.creatFunc}/> : null,
            <CreateInterface key="interface" dict={dict} ref="btnCreatInterface" trigger={this.btnCreatInterface}/>,
            <CreateFunc key="create" dict={dict} ref="btnCreatFunc" trigger={this.creatFunc}/>,
            <Button key="cancel" onClick={this.editModalCancel}>{dict['model.cancel']}</Button>,
            <Button key="confirm" type="primary" loading={copying} onClick={this.handleSubmit}>{dict['model.confirm']}</Button>
          ]}
@@ -967,7 +949,6 @@
        >
          {card && !card.execMode && card.OpenType !== 'excelIn' && card.OpenType !== 'excelOut' ?
            <VerifyCard
              floor={this.props.type}
              card={card}
              dict={dict}
              config={config}