king
2022-12-06 91e232bb0b910f3670bdbccd65cc218d55e1eda9
src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx
@@ -22,7 +22,6 @@
class VerifyCard extends Component {
  static propTpyes = {
    dict: PropTypes.object,    // 字典项
    config: PropTypes.object,
    card: PropTypes.object,
  }
@@ -34,7 +33,7 @@
    defaultscript: '', // 自定义脚本
    excelColumns: [
      {
        title: this.props.dict['model.form.field'],
        title: '字段',
        dataIndex: 'Column',
        inputType: 'input',
        editable: true,
@@ -42,7 +41,7 @@
        width: '17%'
      },
      {
        title: this.props.dict['model.name'],
        title: '名称',
        dataIndex: 'Text',
        inputType: 'input',
        editable: true,
@@ -50,7 +49,7 @@
        width: '17%'
      },
      {
        title: this.props.dict['model.form.columnWidth'],
        title: '列宽',
        dataIndex: 'Width',
        inputType: 'number',
        min: 5,
@@ -187,11 +186,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>
@@ -235,54 +234,118 @@
      defaultscript = `update ${config.setting.tableName || ''} set idefine5= idefine5+1 ,modifydate=getdate(),cdefine5='已导出',modifyuserid=@userid@ ${search}`
    }
    let search = []
    let appType = sessionStorage.getItem('appType')
    let searches = []
    if (config.setting && config.setting.useMSearch === 'true' && window.GLOB.customMenu) {
    if (appType === 'mob') {
      let menu = fromJS(window.GLOB.customMenu).toJS()
      let _search = null
      let filterComponent = (box) => {
        box.components.forEach(item => {
          if (_search) return
      let ms = null
      let search = []
      menu.components.forEach(item => {
        if (item.type === 'topbar' && item.wrap.type !== 'navbar' && item.search) {
          ms = item.search
        } else if (item.type === 'search' && item.wrap.field) {
          search.push({
            type: 'text',
            label: item.wrap.label,
            field: item.wrap.field,
            match: item.wrap.match,
            required: item.wrap.required,
            value: item.wrap.initval || ''
          })
        }
      })
      if (ms) {
        if (ms.setting.type === 'search') {
          search.push({
            type: 'text',
            label: '搜索栏',
            field: ms.setting.field,
            match: ms.setting.match,
            required: ms.setting.required,
            value: ms.setting.initval || ''
          })
        }
        ms.fields.forEach(item => {
          if (item.type === 'range') {
            item.initval = `${item.minValue},${item.maxValue}`
          }
          search.push(item)
        })
        ms.groups.forEach(group => {
          if (group.setting.type === 'search') {
            search.push({
              type: 'text',
              label: group.wrap.name,
              field: group.setting.field,
              match: group.setting.match,
              required: group.setting.required,
              value: group.setting.initval || ''
            })
          }
          group.fields.forEach(item => {
            if (item.type === 'range') {
              item.initval = `${item.minValue},${item.maxValue}`
            }
            search.push(item)
          })
        })
      }
      searches = search
    } else {
      let search = []
  
          if (item.type === 'search') {
            box.slist = [...box.slist, item.search]
          } else if (item.uuid === config.uuid) {
            _search = box.slist.pop()
          } else if (item.type === 'group') {
            item.components.forEach(m => {
              if (m.uuid !== config.uuid) return
      if (config.setting && config.setting.useMSearch === 'true' && window.GLOB.customMenu) {
        let menu = fromJS(window.GLOB.customMenu).toJS()
        let _search = null
        let filterComponent = (box) => {
          box.components.forEach(item => {
            if (_search) return
            if (item.type === 'search') {
              box.slist = [...box.slist, item.search]
            } else if (item.uuid === config.uuid) {
              _search = box.slist.pop()
            })
          } else if (item.type === 'tabs') {
            item.subtabs.forEach(tab => {
              tab.slist = [...box.slist]
              filterComponent(tab)
            })
            } else if (item.type === 'group') {
              item.components.forEach(m => {
                if (m.uuid !== config.uuid) return
                _search = box.slist.pop()
              })
            } else if (item.type === 'tabs') {
              item.subtabs.forEach(tab => {
                tab.slist = [...box.slist]
                filterComponent(tab)
              })
            }
          })
        }
        menu.slist = []
        filterComponent(menu)
        if (_search) {
          search = _search
        } else {
          menu.components.forEach(item => {
            if (item.type !== 'search') return
            search = item.search
          })
        }
      }
      searches = fromJS(config.search || []).toJS()
      if (search.length > 0) {
        let keys = searches.map(item => (item.field ? item.field.toLowerCase() : ''))
        search.forEach(item => {
          if (item.field && !keys.includes(item.field.toLowerCase())) {
            searches.push(item)
          }
        })
      }
      menu.slist = []
      filterComponent(menu)
      if (_search) {
        search = _search
      } else {
        menu.components.forEach(item => {
          if (item.type !== 'search') return
          search = item.search
        })
      }
    }
    let searches = fromJS(config.search || []).toJS()
    if (search.length > 0) {
      let keys = searches.map(item => (item.field ? item.field.toLowerCase() : ''))
      search.forEach(item => {
        if (item.field && !keys.includes(item.field.toLowerCase())) {
          searches.push(item)
        }
      })
    }
    this.setState({
@@ -680,7 +743,8 @@
        param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
        param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${param.timestamp}'`)
        param.LText = param.LText.replace(/\n/g, ' ')
        param.LText = Utils.formatOptions(param.LText)
        param.secretkey = Utils.encrypt('', param.timestamp)
        
@@ -777,7 +841,7 @@
  changeColumns = (columns) => {
    const { verify } = this.state
    if (columns[0] && (columns[0].type !== 'image' && columns[0].type !== 'text' && columns[0].type !== 'number')) {
    if (columns[0] && !['image', 'text', 'number'].includes(columns[0].type)) {
      columns = columns.map(col => {
        let _cell = {
          uuid: Utils.getuuid(),
@@ -785,7 +849,7 @@
          Text: col.Text,
          Width: 20,
          abs: 'false',
          output: 'true',
          output: col.output || 'true',
          type: 'text',
        }
@@ -914,6 +978,11 @@
  sqlverify = (_resolve, _reject, scripts) => {
    const { searches, verify } = this.state
    if (verify.dataType !== 'custom') {
      _resolve()
      return
    }
    let timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
    let sql = SettingUtils.getDebugSql(verify, scripts, searches, Utils, timestamp)
    let param = {
@@ -970,7 +1039,7 @@
              {verify.columns.length ? <span className="count-tip">{verify.columns.length}</span> : null}
            </span>
          } key="columns">
            <ColumnForm dict={this.props.dict} columnChange={this.columnChange}/>
            <ColumnForm columnChange={this.columnChange}/>
            <Button className="excel-col-add mk-green" title="添加显示列字段" onClick={this.columnFieldInput}>
              同步显示列
            </Button>
@@ -1021,7 +1090,7 @@
                      rules: [
                        {
                          required: true,
                          message: this.props.dict['form.required.input'] + 'sql!'
                          message: '请输入sql!'
                        }
                      ]
                    })(<CodeMirror />)}