king
2020-03-17 5c8860f3cd8921e7eb0da7749628e9dc669b3203
src/tabviews/tableshare/actionList/index.jsx
@@ -28,8 +28,9 @@
    ContainerId: PropTypes.any,       // tab页面ID,用于弹窗控制
    refreshdata: PropTypes.func,      // 执行完成后数据刷新
    triggerPopview: PropTypes.func,   // 弹窗标签页触发
    getexceloutparam: PropTypes.func,  // 获取excel导出数据
    gettableselected: PropTypes.func  // 获取表格中数据
    getexceloutparam: PropTypes.func, // 获取excel导出数据
    gettableselected: PropTypes.func, // 获取表格中数据
    permRoles: PropTypes.any          // 用户权限列表
  }
  state = {
@@ -234,36 +235,56 @@
    }
    let printlist = []
    let templates = []
    let templates = [btn.verify.Template]
    this.setState({loadingUuid: btn.uuid})
    new Promise(resolve => {
      if (btn.intertype === 'inner' && !btn.innerFunc) {
        formdata.TemplateID = btn.verify.Template
        templates.push(btn.verify.Template)
        if (btn.Ot === 'notRequired') {
          printlist.push(formdata)
          if (formdata.printCount && typeof(formdata.printCount) === 'number' && formdata.printCount > 1) {
            for (let i = 0; i < formdata.printCount; i++) {
              printlist.push(JSON.parse(JSON.stringify(formdata)))
            }
          } else {
            printlist.push(formdata)
          }
        } else {
          printlist = data.map(cell => {
          data.forEach(cell => {
            let _cell = {...cell, ...formdata}
            return _cell
            if (formdata.printCount && typeof(formdata.printCount) === 'number' && formdata.printCount > 1) {
              for (let i = 0; i < formdata.printCount; i++) {
                printlist.push(JSON.parse(JSON.stringify(_cell)))
              }
            } else {
              printlist.push(_cell)
            }
          })
        }
        resolve('getTemp')
      } else {
        this.getprintdata(btn, data, formdata, formlist).then(result => {
          printlist = result.list.map(item => {
            if (item.TemplateID) {
              templates.push(item.TemplateID)
            } else {
              item.TemplateID = btn.verify.Template
            }
            return item
          })
          result.list.forEach(item => {
            let _cell = item.data
            if (_cell.TemplateID) {
              templates.push(_cell.TemplateID)
            } else {
              _cell.TemplateID = btn.verify.Template
            }
            if (item.count && typeof(item.count) === 'number' && item.count > 1) {
              for (let i = 0; i < item.count; i++) {
                printlist.push(JSON.parse(JSON.stringify(_cell)))
              }
            } else {
              printlist.push(_cell)
            }
          })
          resolve(result.next)
        })
      }
@@ -280,8 +301,8 @@
            ID: tempId
          }
    
          if (options.cloudServiceApi) {
            param.rduri = options.cloudServiceApi.replace('dostars', 'dostar')
          if (window.GLOB.mainSystemApi) { // 从单点登录服务器取打印配置信息
            param.rduri = window.GLOB.mainSystemApi
          }
    
          Api.getLocalConfig(param).then(result => {
@@ -389,7 +410,9 @@
            let errorMsg = ''
            result.forEach(res => {
              if (res.status) {
                _list.push(res.data)
                res.data.forEach(_item => {
                  _list.push({data: _item, count: res.printCount})
                })
              } else {
                errorMsg = res
              }
@@ -471,8 +494,12 @@
      return Api.genericInterface(res)
    }).then(response => {
      if (!response) return
      // 回调请求
      if (response.status) {
        response.data.forEach(_item => {
          _list.push({data: _item, count: response.printCount})
        })
        // 一次请求成功,进行下一项请求
        if (params.length === 0) {
          _resolve({next: 'getTemp', list: _list})
@@ -494,7 +521,9 @@
    Api.genericInterface(param).then(res => {
      if (res.status) {
        _list.push(res.data)
        res.data.forEach(_item => {
          _list.push({data: _item, count: res.printCount})
        })
        if (params.length === 0) {
          _resolve({next: 'getTemp', list: _list})
@@ -526,11 +555,17 @@
        error = '打印模板解析错误!'
      } else {
        let control = configParam.elements.map(element => {
          let _field = element.field
          if (_field === 'other_field') {
            _field = element.cusfield || ''
          }
          let item = {
            Name: element.name || '',
            Type: element.type,
            Value: element.value || '',
            Field: element.field || '',
            Field: _field,
            Left: element.left,
            Top: element.top,
            Width: element.width,
@@ -1333,6 +1368,38 @@
            btnloading: false
          })
        } else {
          if (_LongParam.groups.length > 0) {
            _LongParam.groups.forEach(group => {
              group.sublist = group.sublist.filter(cell => {
                if (!cell.blacklist || cell.blacklist.length === 0) return true
                let _black = cell.blacklist.filter(v => {
                  return this.props.permRoles.indexOf(v) !== -1
                })
                if (_black.length > 0) {
                  return false
                } else {
                  return true
                }
              })
            })
          } else {
            _LongParam.fields = _LongParam.fields.filter(cell => {
              if (!cell.blacklist || cell.blacklist.length === 0) return true
              let _black = cell.blacklist.filter(v => {
                return this.props.permRoles.indexOf(v) !== -1
              })
              if (_black.length > 0) {
                return false
              } else {
                return true
              }
            })
          }
          this.setState({
            configMap: {...configMap, [action.uuid]: _LongParam},
            execAction: {..._LongParam, ...execAction}