index.js 5.86 KB
Newer Older
fukai committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172
import Api from '~/service/Api';
import { getTrnNameByInr } from "~/service/business/common";
import moment from 'moment';
import Utils from "~/utils"
import commonFunctions from '~/mixin/commonFunctions.js';

export default {
  mixins: [commonFunctions],
  methods: {
    async handleSearch() {
      if(!this.model.recpan.begdat){
        this.$notify.error({ title: '错误', message: '请输入起始日期!' });
        return;
      }
      if(!this.model.recpan.enddat){
        this.$notify.error({ title: '错误', message: '请输入结束日期!' });
        return;
      }
      if(moment(this.model.recpan.begdat).diff(moment(this.model.recpan.enddat), 'days') > 0){
        this.$notify.error({ title: '错误', message: '起始日期不得晚于结束日期!' });
        return;
      }
      if(moment(this.model.recpan.enddat).diff(moment(this.model.recpan.begdat), 'days') > 731){
        this.$notify.error({ title: '错误', message: '请将查询条件中时间范围控制在2年内(含)!' });
        return;
      }
      const loading = this.loading();
      let params = {
        sta: this.model.recpan.sta,
        usrextkey: this.model.recpan.operator,
        bchkeyinr: this.model.recpan.branch,
        begdat: this.model.recpan.begdat + " 00:00:00",
        enddat: this.model.recpan.enddat + " 23:59:59",
        pageNumber: this.pagination.pageIndex,
        pageSize: this.pagination.pageSize,
      };

      let rtnmsg = await Api.post('/Remittance/infejs/list', params);
      if (rtnmsg.respCode == SUCCESS) {
        this.stmData.data = [];
        this.stmData.data = rtnmsg.data.list;
        this.pagination.total = rtnmsg.data.total;
      } else {
        this.$notify.error({ title: '错误', message: '服务请求失败!' });
      }
      loading.close();
    },
    async searchBch() {
      let branchinr = JSON.parse(window.sessionStorage.currentOrg).departmentNumber;
      let rtnmsg = await Api.post('/Remittance/infejs/searchBch',branchinr);
      if (rtnmsg.respCode == SUCCESS) {
        this.bchList = rtnmsg.data;
      } else {
        this.$notify.error({ title: '错误', message: '服务请求失败!' });
      }
    },
    // pageSize改变
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
      this.pagination.pageIndex = 1;
      this.pagination.pageSize = val;
      this.handleSearch();
    },
    // 页码改变
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
      this.pagination.pageIndex = val;
      this.handleSearch();
    },


    selectableFn(row) {
      return true;
    },
    toCptati() {
      // 点击开立,清空从待经办进来的时候带的行参数
      // localStorage.setItem('row_letopn', null)
      // localStorage.setItem('review_letopn',null)
			this.routerPush({
				path: '/business/cptati',
      });
    },
    toPush() {
      this.$confirm("确定处理选中的" + this.multipleSelection.length + "笔数据?", "提示", {
        confirmButtonText: "确认",
        cancelButtonText: "取消",
        type: "warning",
      }).then(async () => {
        const loading = this.loading();
        let params = {}
        params.inrs = this.multipleSelection;
        params.checkPdf = true;
        let rtnmsg = await Api.post("/Remittance/infejs/toPush", params);
        if (rtnmsg.respCode == SUCCESS) {
          this.$notify({title: '成功',message: '人工处理成功,已经到自动处理队列',type: 'success'})
          this.handleSearch();
        } else {
          if(rtnmsg.data.length>0){
            this.$confirm(rtnmsg.respMsg, "提示", {
              confirmButtonText: "确认",
              cancelButtonText: "取消",
              type: "warning",
            }).then(async () => {
              let params2 = {}
              params2.inrs = rtnmsg.data;
              params2.checkPdf = false;
              let rtnmsg2 = await Api.post("/Remittance/infejs/toPush", params2);
              if (rtnmsg2.respCode == SUCCESS) {
                this.$notify({title: '成功',message: '人工处理成功,已经到自动处理队列',type: 'success'})
                this.handleSearch();
              }else{
                this.$notify.error({ title: '错误', message: '推送失败!' });
              }
            });
          }else{
            this.$notify.error({ title: '错误', message: '服务请求失败!' });
          }
        }
        loading.close();
      });
    },
    toLabor() {
      this.$confirm("确定处理选中的" + this.multipleSelection.length + "笔数据?", "提示", {
        confirmButtonText: "确认",
        cancelButtonText: "取消",
        type: "warning",
      }).then(async () => {
        const loading = this.loading();
        let params = {}
        params.inrs = this.multipleSelection;
        let rtnmsg = await Api.post("/Remittance/infejs/toLabor", params);
        if (rtnmsg.respCode == SUCCESS) {
          this.$notify({title: '成功',message: '转人工成功',type: 'success',duration: 1000})
          this.handleSearch();
        } else {
          this.$notify.error({ title: '错误', message: '服务请求失败!' });
        }
        loading.close();
      });
    },
    // 表格多选
    handleSelectionChange(val) {
      this.multipleSelection = val.map((item) => {
        return item.inr
      })
      this.multipleSelectionObj = val.map((item) => {
        return item
      })
      this.multipleStatusSelection = val.map((item) => {
        return item.sta
      })
      this.multipleSelectionRow = val.map((item) => {
        return item
      })[0]
    },
    async handleReset() {
      this.model.recpan = {}
    },
    formatSta(row, column) {
      var result = "";
      Object.keys(this.codeMap).forEach(key => {
        if (row.sta == key) {
          result = this.codeMap[key];
        }
      });
      return result;
    },
    handleSta(){
      this.stadialog = true;
    }
  },
};