refetchDialog.vue 8.33 KB
<!-- 重取明细 -->
<template>
  <baseDialog :dialog-config="dialogConfig"
              :is-show.sync="dialogShow"
              class="accountDailog"
              @handleClick="handleAddConfirm">
    <div class="tipFont">重新获取银行明细与回单,需等待15分钟,且接口限制单次获取上限1000条,请谨慎选择筛选条件!</div>
    <div class="add-dialog">
      <glsx-combi-form class="edit-form-container"
                       ref="editFormRef"
                       label-width="150px"
                       default-width="400px"
                       :form-ref="handleFormRef"
                       :form-obj="infoForm"
                       :form-data="editFormData"
                       :form-rules="formRules">
      </glsx-combi-form>
    </div>
    <!-- <span class="dialog-footer">
      <el-button size="small"
                 @click="dialogShow = false">取 消</el-button>
      <el-button size="small"
                 type="primary"
                 @click="handleSelect">确 定</el-button>
    </span> -->
  </baseDialog>
</template>

<script>
import { nbcbAccDetailConfig, nbcbAccDetailRefetch } from '@api/theAssetData'
import { Util, deepClone } from '@/common/util'
export default {
  name: 'RefetchDialog',
  data() {
    return {
      userInfo: this.$store.state.d2admin.user.info,
      infoForm: {
        accNameList: [],
        bankType: '',
        bankAcc: '',
        transactionTime: ''
      },
      dialogConfig: {
        title: '重取明细',
        width: '720px'
        // isShowFooter: false
      },
      config: {
        // isShowFooter: false
      },
      handleFormRef: 'handleFormRef',
      formRules: {
        transactionTime: [{ required: true, message: '请选择交易时间', trigger: 'change' }],
      },
      editFormData: [{
        label: '单位名称',
        name: 'accNameList',
        type: 'select',
        isClear: true,
        multiple: true,
        collapseTags: true,
        optionList: [],
        optionId: 'confId',
        optionLabel: 'confValue',
        optionsName: 'accNameList'
      }, {
        label: '银行类别',
        name: 'bankType',
        type: 'select',
        isClear: true,
        optionList: [],
        optionId: 'confId',
        optionLabel: 'confValue',
        optionsName: 'bankTypeList'
      }, {
        label: '本方账号',
        name: 'bankAcc',
        type: 'select',
        isClear: true,
        optionList: [],
        optionId: 'confId',
        optionLabel: 'confValue',
        optionsName: 'bankAccList'
      }, {
        label: '交易时间',
        name: 'transactionTime',
        type: 'datePicker',
        isClear: true,
        pickerOptions: 'beforeRangePickerOptions'
      }],
      baseData: {
        accNameList: [],
        bankTypeList: [],
        bankAccList: []
      }
    }
  },

  props: {
    visible: {
      type: Boolean,
      default: false
    }
    // paramsObj: {
    //   type: Object,
    //   default: {}
    // }
  },
  watch: {
  },
  computed: {
    dialogShow: {
      get() {
        return this.visible
      },
      set(newVal) {
        this.$emit('dialogClose', { flag: newVal, attrName: 'visible' })
      }
    }
  },

  mounted() {
    this.nbcbAccDetailConfig()
    // this.getOptionsList()
  },

  methods: {
    getOptionsList() {
      this.editFormData.forEach((item, index) => {
        if (item.type === 'select') {
          // if (
          //   this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this.showFormData[index].optionLabel] !== '全部' && item.label != '单位名称'
          // ) {
          //   const temp = {}
          //   temp[this.showFormData[index].optionId] = ''
          //   temp[this.showFormData[index].optionLabel] = '全部'
          //   this.baseData[item.optionsName].unshift(temp)
          // }
          this.$set(
            this.editFormData[index],
            'optionList',
            this.baseData[item.optionsName]
          )
        }
      })
    },

    // 财资数据筛选项列表
    nbcbAccDetailConfig() {
      nbcbAccDetailConfig({}).then(res => {
        for (var key in res) {
          if (this.baseData[key]) {
            this.baseData[key] = res[key]
            this.baseData[key] = this.baseData[key].map(item => {
              return {
                confId: item,
                confValue: item
              }
            })
          }
        }
        this.getOptionsList()
      })
    },

    handleAddConfirm() {
      this.$refs.editFormRef.$refs[this.handleFormRef].validate(valid => {
        if (valid) {
          var params = deepClone(this.infoForm)
          if (params.accNameList.length == 0 && params.bankType == '' && params.bankAcc == '') {
            // this.notice.warningTips('请选择除日期外的任意一个或多个条件!')
            this.$message({
              message: "请选择除日期外的任意一个或多个条件!",
              type: "warning",
              showClose: true
            })
            return
          }
          if (params.transactionTime) {
            params.transTimeStart = Util.dateFormate(params.transactionTime[0], 'YYYY-MM-DD')
            params.transTimeEnd = Util.dateFormate(params.transactionTime[1], 'YYYY-MM-DD')
          } else {
            delete params.transTimeStart
            delete params.transTimeEnd
          }
          this.$confirm('请确认是否要执行当前操作?', '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning',
            closeOnClickModal: false
          }).then(() => {
            nbcbAccDetailRefetch(params).then(res => {
              this.notice.okTips()
              this.dialogShow = true
            })
          }).catch(err => {
            console.log(err)
          })
        }
      })
    }

  }
}
</script>
<style lang="scss" scoped>
.add-dialog {
  margin: 20px 0;

  .reject-input {
    ::v-deep .el-textarea__inner {
      height: 70px;
    }
  }

  .el-textarea .el-input__count {
    right: 90px;
    bottom: -10px;
    font-size: 12px;
    color: #999999;
  }

  .tips {
    color: #999999;
  }

  .down-cla {
    width: 56px;
    height: 32px;
    font-family: PingFangSC-Regular;
    font-weight: 400;
    font-size: 14px;
    color: #185efe;
    text-align: right;
    line-height: 32px;
    padding-left: 8px;
    // cursor: pointer;
  }

  .upload-file {
    ::v-deep .el-upload-dragger {
      display: flex;
      flex-flow: column;
      justify-content: center;
      align-items: center;
      width: 300px;
      height: 160px;
      background: #f7f7f7;

      .el-icon-upload {
        margin: 0;
      }

      .el-upload__text {
        font-size: 14px;
        color: #000000;
      }

      .item-tips {
        font-size: 12px;
        color: #999999;
        height: 22px;
        line-height: 22px;
      }

      .text-tips {
        font-size: 14px;
      }
    }
  }

  .file-box {
    width: 350px;

    .file-item {
      margin-top: 6px;
      position: relative;
      box-sizing: border-box;
      display: flex;
      justify-content: space-between;
      align-items: center;
      cursor: pointer;

      ::v-deep .el-progress-bar {
        width: 320px;
        background: #ffffff;
        border: 1px solid #f4f6fc;
        border-radius: 4px;

        .el-progress-bar__outer {
          background: transparent;
          border-radius: 4px;

          .el-progress-bar__inner {
            background: #f5f7fa;
            border-radius: 4px;
          }
        }
      }

      ::v-deep .el-image-viewer__wrapper {
        width: 100vw;
        height: 100vh;
      }

      .file-name {
        position: absolute;
        left: 12px;
        top: 6px;
        transform: translateY(-50%);
        color: #333333;
        font-size: 14px;
        max-width: 300px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }

      .image-file {
        z-index: -1;
      }
    }

    .file-item:first-child {
      margin-top: 15px;

      .file-name {
        position: absolute;
        left: 12px;
        top: 15px;
        transform: translateY(-50%);
        color: #333333;
        font-size: 14px;
      }
    }
  }
}
.tipFont {
  margin: 10px 0 0 60px;
  width: 535px;
  height: 22px;
  font-family: PingFangSC-Regular;
  font-weight: 400;
  font-size: 12px;
  color: #eb4e4e;
}
</style>