king
2022-12-19 102be577a7f8df2ae30045d55a1a5fc584f90363
src/templates/zshare/verifycard/index.jsx
@@ -33,7 +33,6 @@
  static propTpyes = {
    btnTab: PropTypes.any,     // 表单标签页(按钮)参数
    config: PropTypes.any,     // 表单标签页参数
    dict: PropTypes.object,    // 字典项
    card: PropTypes.object,    // 按钮信息
    columns: PropTypes.array
  }
@@ -114,7 +113,7 @@
          ) :
          (
            <div style={{color: '#26C281'}}>
              {this.props.dict['model.status.open']}
              启用
              <CheckCircleOutlined style={{marginLeft: '5px'}}/>
            </div>
          )
@@ -150,7 +149,7 @@
          ) :
          (
            <div style={{color: '#26C281'}}>
              {this.props.dict['model.status.open']}
              启用
              <CheckCircleOutlined style={{marginLeft: '5px'}}/>
            </div>
          )
@@ -224,7 +223,7 @@
          ) :
          (
            <div style={{color: '#26C281'}}>
              {this.props.dict['model.status.open']}
              启用
              <CheckCircleOutlined style={{marginLeft: '5px'}}/>
            </div>
          )
@@ -276,7 +275,7 @@
          ) :
          (
            <div style={{color: '#26C281'}}>
              {this.props.dict['model.status.open']}
              启用
              <CheckCircleOutlined style={{marginLeft: '5px'}}/>
            </div>
          )
@@ -288,11 +287,11 @@
        dataIndex: 'operation',
        render: (text, record) =>
          (<div style={{textAlign: 'center'}}>
            <span className="operation-btn" title={this.props.dict['model.edit']} onClick={() => this.handleEdit(record, 'customverify')} style={{color: '#1890ff'}}><EditOutlined /></span>
            <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'customverify')} style={{color: '#8E44AD'}}><SwapOutlined /></span>
            <span className="operation-btn" title="编辑" onClick={() => this.handleEdit(record, 'customverify')} style={{color: '#1890ff'}}><EditOutlined /></span>
            <span className="operation-btn" title="状态切换" onClick={() => this.handleStatus(record, 'customverify')} style={{color: '#8E44AD'}}><SwapOutlined /></span>
            <Popconfirm
              overlayClassName="popover-confirm"
              title={this.props.dict['model.query.delete']}
              title="确定删除吗?"
              onConfirm={() => this.handleDelete(record, 'customverify')
            }>
              <span className="operation-btn" style={{color: '#ff4d4f'}}><DeleteOutlined /></span>
@@ -345,7 +344,7 @@
          ) :
          (
            <div style={{color: '#26C281'}}>
              {this.props.dict['model.status.open']}
              启用
              <CheckCircleOutlined style={{marginLeft: '5px'}}/>
            </div>
          )
@@ -357,11 +356,11 @@
        dataIndex: 'operation',
        render: (text, record) =>
          (<div style={{textAlign: 'center'}}>
            <span className="operation-btn" title={this.props.dict['model.edit']} onClick={() => this.handleEdit(record, 'scripts')} style={{color: '#1890ff'}}><EditOutlined /></span>
            <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'scripts')} style={{color: '#8E44AD'}}><SwapOutlined /></span>
            <span className="operation-btn" title="编辑" onClick={() => this.handleEdit(record, 'scripts')} style={{color: '#1890ff'}}><EditOutlined /></span>
            <span className="operation-btn" title="状态切换" onClick={() => this.handleStatus(record, 'scripts')} style={{color: '#8E44AD'}}><SwapOutlined /></span>
            <Popconfirm
              overlayClassName="popover-confirm"
              title={this.props.dict['model.query.delete']}
              title="确定删除吗?"
              onConfirm={() => this.handleDelete(record, 'scripts')
            }>
              <span className="operation-btn" style={{color: '#ff4d4f'}}><DeleteOutlined /></span>
@@ -412,7 +411,7 @@
          ) :
          (
            <div style={{color: '#26C281'}}>
              {this.props.dict['model.status.open']}
              启用
              <CheckCircleOutlined style={{marginLeft: '5px'}}/>
            </div>
          )
@@ -424,11 +423,11 @@
        dataIndex: 'operation',
        render: (text, record) =>
          (<div style={{textAlign: 'center'}}>
            <span className="operation-btn" title={this.props.dict['model.edit']} onClick={() => this.handleEdit(record, 'cbscripts')} style={{color: '#1890ff'}}><EditOutlined /></span>
            <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'cbscripts')} style={{color: '#8E44AD'}}><SwapOutlined /></span>
            <span className="operation-btn" title="编辑" onClick={() => this.handleEdit(record, 'cbscripts')} style={{color: '#1890ff'}}><EditOutlined /></span>
            <span className="operation-btn" title="状态切换" onClick={() => this.handleStatus(record, 'cbscripts')} style={{color: '#8E44AD'}}><SwapOutlined /></span>
            <Popconfirm
              overlayClassName="popover-confirm"
              title={this.props.dict['model.query.delete']}
              title="确定删除吗?"
              onConfirm={() => this.handleDelete(record, 'cbscripts')
            }>
              <span className="operation-btn" style={{color: '#ff4d4f'}}><DeleteOutlined /></span>
@@ -438,7 +437,7 @@
    ],
    orderColumns: [
      {
        title: this.props.dict['header.form.funcvar'],
        title: '函数变量',
        dataIndex: 'fieldName',
        width: '12%',
        render: (text, record) => (`${record.fieldName || ''}(${record.field})`)
@@ -513,7 +512,7 @@
          ) :
          (
            <div style={{color: '#26C281'}}>
              {this.props.dict['model.status.open']}
              启用
              <CheckCircleOutlined style={{marginLeft: '5px'}}/>
            </div>
          )
@@ -525,11 +524,11 @@
        dataIndex: 'operation',
        render: (text, record) =>
          (<div style={{textAlign: 'center'}}>
            <span className="operation-btn" title={this.props.dict['model.edit']} onClick={() => this.handleEdit(record, 'ordercode')} style={{color: '#1890ff'}}><EditOutlined /></span>
            <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'ordercode')} style={{color: '#8E44AD'}}><SwapOutlined /></span>
            <span className="operation-btn" title="编辑" onClick={() => this.handleEdit(record, 'ordercode')} style={{color: '#1890ff'}}><EditOutlined /></span>
            <span className="operation-btn" title="状态切换" onClick={() => this.handleStatus(record, 'ordercode')} style={{color: '#8E44AD'}}><SwapOutlined /></span>
            <Popconfirm
              overlayClassName="popover-confirm"
              title={this.props.dict['model.query.delete']}
              title="确定删除吗?"
              onConfirm={() => this.handleDelete(record, 'ordercode')
            }>
              <span className="operation-btn" style={{color: '#ff4d4f'}}><DeleteOutlined /></span>
@@ -594,17 +593,22 @@
      item.$index = i + 1
    })
    let verifyInter = card.intertype === 'system' || (card.intertype === 'custom' && card.procMode === 'system') ? 'system' : 'inner'
    let verifyInter = card.intertype === 'system' || card.procMode === 'system' ? 'system' : 'inner'
    let activeKey = verifyInter === 'system' || card.intertype === 'inner' ? 'base' : 'tip'
    if (card.callbackType === 'script') {
      activeKey = 'cbScripts'
    }
    this.setState({
      activeKey: verifyInter === 'system' || card.intertype === 'inner' ? 'base' : 'tip',
      activeKey: activeKey,
      verifyInter: verifyInter,
      setting: config.setting || {},
      verify: _verify,
      oriVerify: fromJS(_verify).toJS()
    })
    if (config.Template !== 'FormTab' && (card.intertype === 'inner' || card.intertype === 'outer')) { // 内部或外部接口
    if (config.Template !== 'FormTab' && card.intertype === 'inner') {
      return
    }
@@ -622,7 +626,7 @@
          _fields.push(...group.sublist)
        })
        resolve(_fields)
      } else if (card.modal) {
      } else if (card.modal && card.OpenType === 'pop') {
        _fields = card.modal.fields || []
        resolve(_fields)
      } else if (card.OpenType === 'pop') {
@@ -660,8 +664,8 @@
        resolve(_fields)
      }
    }).then(_fields => {
      let _usefulfields = ['UserName', 'FullName', 'RoleID', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address', 'BillCode', 'BVoucher', 'FIBVoucherDate', 'FiYear', 'ModularDetailCode']
      let _declare = ['@UserName nvarchar(50)', '@FullName nvarchar(50)', '@RoleID nvarchar(512)', '@mk_departmentcode nvarchar(50)', '@mk_organization nvarchar(50)', '@mk_user_type nvarchar(20)', '@mk_nation nvarchar(50)', '@mk_province nvarchar(50)', '@mk_city nvarchar(50)', '@mk_district nvarchar(50)', '@mk_address nvarchar(100)', '@ErrorCode nvarchar(50)', '@retmsg nvarchar(4000)', '@BillCode nvarchar(50)', '@BVoucher nvarchar(50)', '@FIBVoucherDate nvarchar(50)', '@FiYear nvarchar(50)', '@ModularDetailCode nvarchar(50)', '@bid nvarchar(50)']
      let _usefulfields = ['UserName', 'FullName', 'RoleID', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address', 'BillCode', 'BVoucher', 'FIBVoucherDate', 'FiYear', 'ModularDetailCode', 'tbid']
      let _declare = ['@UserName nvarchar(50)', '@FullName nvarchar(50)', '@RoleID nvarchar(512)', '@mk_departmentcode nvarchar(512)', '@mk_organization nvarchar(512)', '@mk_user_type nvarchar(20)', '@mk_nation nvarchar(50)', '@mk_province nvarchar(50)', '@mk_city nvarchar(50)', '@mk_district nvarchar(50)', '@mk_address nvarchar(100)', '@ErrorCode nvarchar(50)', '@retmsg nvarchar(4000)', '@BillCode nvarchar(50)', '@BVoucher nvarchar(50)', '@FIBVoucherDate nvarchar(50)', '@FiYear nvarchar(50)', '@ModularDetailCode nvarchar(50)', '@bid nvarchar(50)', '@tbid nvarchar(50)']
      let _select = ['@UserName=\'\'', '@FullName=\'\'', '@RoleID=\'\'', '@mk_departmentcode=\'\'', '@mk_organization=\'\'', '@mk_user_type=\'\'', '@mk_nation=\'\'', '@mk_province=\'\'', '@mk_city=\'\'', '@mk_district=\'\'', '@mk_address=\'\'', '@ErrorCode=\'\'', '@retmsg=\'\'', '@BillCode=\'\'', '@BVoucher=\'\'', '@FIBVoucherDate=\'\'', '@FiYear=\'\'', '@ModularDetailCode=\'\'', '@bid=\'\'']
      let fieldArr = _usefulfields.map(_f => _f.toLowerCase())
      let hasBid = false
@@ -720,10 +724,8 @@
      let hasColumn = false
      if (columns && columns.length > 0) {
        if (btnTab) { // 表单标签
          if (btnTab.Ot !== 'notRequired' && btnTab.Ot !== 'requiredOnce') {
            hasColumn = true
          }
        } else if (card.Ot !== 'notRequired' && card.Ot !== 'requiredOnce') {
          hasColumn = btnTab.Ot !== 'notRequired'
        } else if (card.Ot !== 'notRequired') {
          hasColumn = true
        }
      }
@@ -823,6 +825,10 @@
          keys.push('bid')
          values.push('@BID@')
        }
        if (!keys.includes('typename')) {
          keys.push('typename')
          values.push('@typename@')
        }
  
        keys = keys.join(', ')
        values = values.join(', ')
@@ -848,11 +854,17 @@
          if (!_arr.includes('submitdate')) {
            _form.push('submitdate=getdate()')
          }
          if (!_arr.includes('submituser')) {
            _form.push('submituser=@username')
          }
          if (!_arr.includes('submitstaff')) {
            _form.push('submitstaff=@fullname')
          }
          if (!_arr.includes('submituserid')) {
            _form.push('submituserid=@userid@')
          }
          if (!_arr.includes('submituser')) {
            _form.push('submituser=@username')
          if (!_arr.includes('typename')) {
            _form.push(`typename=@typename@`)
          }
        } else {
          if (!_arr.includes('modifydate')) {
@@ -861,8 +873,14 @@
          if (!_arr.includes('modifyuser')) {
            _form.push('modifyuser=@username')
          }
          if (!_arr.includes('modifystaff')) {
            _form.push('modifystaff=@fullname')
          }
          if (!_arr.includes('modifyuserid')) {
            _form.push('modifyuserid=@userid@')
          }
          if (!_arr.includes('typename')) {
            _form.push(`typename=@typename@`)
          }
        }
@@ -915,7 +933,7 @@
            _index++
          })
        }
        _defaultsql += `insert into snote (remark,createuserid,CreateUser,CreateStaff) select left('删除表:${card.sql} 数据: ${_msg}${_primaryKey}='+@ID@,200),@userid@,@username,@fullname delete ${card.sql} where ${_primaryKey}${card.Ot !== 'requiredOnce' ? '=@ID@' : ' in (select ID  from dbo.SplitComma(@ID@))'};`
        _defaultsql += `insert into snote (remark,createuserid,CreateUser,CreateStaff,typename) select left('删除表:${card.sql} 数据: ${_msg}${_primaryKey}='+@ID@,200),@userid@,@username,@fullname,@typename@ delete ${card.sql} where ${_primaryKey}${card.Ot !== 'requiredOnce' ? '=@ID@' : ' in (select ID  from dbo.SplitComma(@ID@))'};`
      }
      let _columns = []
@@ -1175,17 +1193,22 @@
  }
  handleEdit = (record, type) => {
    let node = null
    if (type === 'customverify') {
      this.customForm.edit(record)
      node = document.getElementById('mk-custom-script')
    } else if (type === 'ordercode') {
      this.orderForm.edit(record)
    } else if (type === 'scripts') {
      this.scriptsForm.edit(record)
      node = document.getElementById('mk-normal-script')
    } else if (type === 'cbscripts') {
      this.cbscriptsForm.edit(record)
      node = document.getElementById('mk-callback-script')
    }
    let node = document.getElementById('verify-card-box-tab').parentNode
    // let node = document.getElementById('verify-card-box-tab').parentNode
    if (node && node.scrollTop) {
      let inter = Math.ceil(node.scrollTop / 10)
@@ -1486,7 +1509,7 @@
  render() {
    const { card } = this.props
    const { activeKey, verifyInter, verify, fields, visible, uniqueFields, uniqueColumns, unionFields, onceUniqueColumns, columnsFields, contrastColumns, customColumns, orderColumns, scriptsColumns, cbScriptsColumns, orderModular, orderModularDetail, voucher, voucherDetail, notes, appType } = this.state
    const { activeKey, verifyInter, setting, verify, fields, visible, uniqueFields, uniqueColumns, unionFields, onceUniqueColumns, columnsFields, contrastColumns, customColumns, orderColumns, scriptsColumns, cbScriptsColumns, orderModular, orderModularDetail, voucher, voucherDetail, notes, appType } = this.state
    const formItemLayout = {
      labelCol: {
        xs: { span: 24 },
@@ -1499,15 +1522,16 @@
    }
    return (
      <div id="verify-card-box-tab">
        <Tabs activeKey={activeKey} className="verify-card-box" onChange={this.changeTab}>
      <div>
        {card.label ? <div className="mk-com-name">{card.label} - 验证信息</div> : null}
        <Tabs activeKey={activeKey} className="mk-verify-tabs" onChange={this.changeTab}>
          {verifyInter === 'system' || card.intertype === 'inner' ? <TabPane tab={
            <span>
              基础验证
              {verify.default === 'false' ? <span className="count-tip"><ExclamationOutlined style={{color: 'orange'}}/></span> : null}
            </span>
          } key="base">
            <BaseForm card={card} unionFields={unionFields} verify={verify} notes={notes} onChange={(verify) => this.setState({verify})} wrappedComponentRef={(inst) => this.baseForm = inst}/>
            <BaseForm card={card} unionFields={unionFields} setting={setting} verify={verify} notes={notes} onChange={(verify) => this.setState({verify})} wrappedComponentRef={(inst) => this.baseForm = inst}/>
          </TabPane> : null}
          {verifyInter === 'system' ? <TabPane tab={
            <span>
@@ -1515,7 +1539,7 @@
              {verify.contrasts.length ? <span className="count-tip">{verify.contrasts.length}</span> : null}
            </span>
          } key="contrasts">
            <ContrastForm dict={this.props.dict} contrastChange={this.contrastChange}/>
            <ContrastForm contrastChange={this.contrastChange}/>
            <EditTable actions={['edit', 'move', 'copy', 'del', 'status']} type="contrastverify" data={verify.contrasts} columns={contrastColumns} onChange={(contrasts) => this.setState({verify: {...verify, contrasts}})}/>
          </TabPane> : null}
          {verifyInter === 'system' ? <TabPane tab={
@@ -1523,9 +1547,8 @@
              自定义验证
              {verify.customverifys.length ? <span className="count-tip">{verify.customverifys.length}</span> : null}
            </span>
          } key="customverifys">
          } key="customverifys" id="mk-custom-script">
            <CustomForm
              dict={this.props.dict}
              btn={this.props.card}
              initsql={this.state.initsql}
              usefulfields={this.state.usefulfields}
@@ -1545,7 +1568,6 @@
              btn={this.props.card}
              billcodes={verify.billcodes}
              columns={this.props.columns}
              dict={this.props.dict}
              modular={orderModular}
              modularDetail={orderModularDetail}
              orderChange={this.orderChange}
@@ -1562,7 +1584,6 @@
            <UniqueForm
              btn={card}
              fields={card.Ot !== 'requiredOnce' ? uniqueFields : columnsFields}
              dict={this.props.dict}
              uniqueChange={this.uniqueChange}
            />
            <EditTable actions={['edit', 'move', 'del', 'status']} data={verify.uniques} columns={card.Ot !== 'requiredOnce' ? uniqueColumns : onceUniqueColumns} onChange={this.changeUniques}/>
@@ -1574,7 +1595,6 @@
            </span>
          } key="voucher">
            <VoucherForm
              dict={this.props.dict}
              voucher={voucher}
              columns={this.props.columns}
              voucherobj={verify.voucher}
@@ -1588,7 +1608,7 @@
              自定义脚本
              {verify.scripts.length ? <span className="count-tip">{verify.scripts.length}</span> : null}
            </span>
          } key="scripts">
          } key="scripts" id="mk-normal-script">
            <BorderOutlined className="full-scripts" onClick={() => {
              if (this.scriptsForm && (this.scriptsForm.state.editItem || (this.scriptsForm.props.form.getFieldValue('sql') && !/^\s+$/.test(this.scriptsForm.props.form.getFieldValue('sql'))))) {
                notification.warning({
@@ -1602,7 +1622,6 @@
            }}/>
            <CustomScript
              btn={this.props.card}
              dict={this.props.dict}
              initsql={this.state.initsql}
              customScripts={verify.scripts}
              defaultsql={this.state.defaultsql}
@@ -1613,15 +1632,14 @@
            />
            <EditTable actions={['move']} data={verify.scripts} columns={scriptsColumns} onChange={(scripts) => {this.setState({verify: {...verify, scripts}})}}/>
          </TabPane> : null}
          {card.callbackType === 'script' && card.intertype === 'custom' ? <TabPane tab={
          {card.callbackType === 'script' ? <TabPane tab={
            <span>
              回调脚本
              {verify.cbScripts.length ? <span className="count-tip">{verify.cbScripts.length}</span> : null}
            </span>
          } key="cbScripts">
          } key="cbScripts" id="mk-callback-script">
            <CallBackCustomScript
              btn={this.props.card}
              dict={this.props.dict}
              initsql={this.state.initsql}
              customScripts={verify.cbScripts}
              usefulfields={this.state.usefulfields}
@@ -1743,43 +1761,56 @@
                position = <span style={{color: '#1890ff'}}>sql后</span>
              }
              return (
                <div className={'script-item ' + (this.state.scriptId === item.uuid ? 'active' : '') } key={item.uuid}>
                  <div style={{cursor: 'pointer'}} onClick={() => {
                    this.scriptsFullForm.edit(item)
                    this.setState({scriptId: item.uuid})
                  }}>
                    {title ? <div style={{color: '#a50', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis'}}>{title}</div> : null}
                    <Paragraph copyable={{ text: item.sql }} ellipsis={{ rows: 4 }}>{_text}</Paragraph>
                    <div>{position}{item.status === 'false' ?
                      <span style={{color: '#ff4d4f', marginLeft: '20px'}}>
                        禁用
                        <StopOutlined style={{marginLeft: '5px'}} />
                      </span> :
                      <span style={{color: '#26C281', marginLeft: '20px'}}>
                        启用
                        <CheckCircleOutlined style={{marginLeft: '5px'}}/>
                      </span>}
              if (item.status === 'false') {
                return (
                  <div className="script-item" key={item.uuid}>
                    <div style={{cursor: 'not-allowed'}}>
                      {title ? <div style={{color: '#a50', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis'}}>{title}</div> : null}
                      <Paragraph copyable={{ text: item.sql }} ellipsis={{ rows: 4 }}>{_text}</Paragraph>
                      <div>{position}
                        <span style={{color: '#ff4d4f', marginLeft: '20px'}}>
                          禁用
                          <StopOutlined style={{marginLeft: '5px'}} />
                        </span>
                      </div>
                    </div>
                    <div style={{height: '24px'}}></div>
                  </div>
                )
              } else {
                return (
                  <div className={'script-item ' + (this.state.scriptId === item.uuid ? 'active' : '') } key={item.uuid}>
                    <div style={{cursor: 'pointer'}} onClick={() => {
                      this.scriptsFullForm.edit(item)
                      this.setState({scriptId: item.uuid})
                    }}>
                      {title ? <div style={{color: '#a50', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis'}}>{title}</div> : null}
                      <Paragraph copyable={{ text: item.sql }} ellipsis={{ rows: 4 }}>{_text}</Paragraph>
                      <div>{position}
                        <span style={{color: '#26C281', marginLeft: '20px'}}>
                          启用
                          <CheckCircleOutlined style={{marginLeft: '5px'}}/>
                        </span>
                      </div>
                    </div>
                    <div style={{textAlign: 'right'}}>
                      <span className="operation-btn" onClick={() => this.handleStatus(item, 'scripts')} style={{color: '#8E44AD'}}><SwapOutlined /></span>
                      <Popconfirm
                        overlayClassName="popover-confirm"
                        title="确定删除吗?"
                        onConfirm={() => this.handleDelete(item, 'scripts')
                      }>
                        <span className="operation-btn" style={{color: '#ff4d4f'}}><DeleteOutlined /></span>
                      </Popconfirm>
                    </div>
                  </div>
                  <div style={{textAlign: 'right'}}>
                    <span className="operation-btn" onClick={() => this.handleStatus(item, 'scripts')} style={{color: '#8E44AD'}}><SwapOutlined /></span>
                    <Popconfirm
                      overlayClassName="popover-confirm"
                      title={this.props.dict['model.query.delete']}
                      onConfirm={() => this.handleDelete(item, 'scripts')
                    }>
                      <span className="operation-btn" style={{color: '#ff4d4f'}}><DeleteOutlined /></span>
                    </Popconfirm>
                  </div>
                </div>
              )
                )
              }
            })}
          </div>
          <CustomScript
            type="fullscreen"
            btn={this.props.card}
            dict={this.props.dict}
            initsql={this.state.initsql}
            customScripts={verify.scripts}
            defaultsql={this.state.defaultsql}