index.js 4.91 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
import Api from '~/service/Api';
import commonFunctions from '~/mixin/commonFunctions.js';
import operationFunc from '~/mixin/operationFunc';

export default {
  mixins: [commonFunctions, operationFunc],
  methods: {
		async handleSearch() {
      if (this.model.gendat == null) {
        this.$notify.error({ title: '错误', message: '查询开始日期必输!' });
        return;
      }
      if (this.model.endgendat == null) {
        this.$notify.error({ title: '错误', message: '查询结束日期必输!' });
        return;
      }
      if(new Date(this.model.gendat).getTime() > new Date(this.model.endgendat).getTime()){
        this.$notify.error({ title: '错误', message: '开始日期应小于结束日期!' });
        return
			} 
			if(new Date(this.model.endgendat).getTime() - new Date(this.model.gendat).getTime() > (731*1000*60*60*24)){
        this.$notify.error({ title: '错误', message: '请将查询条件中时间范围控制在2年内(含)!' });
        return
      } 
      const loading = this.loading();
			let rtnmsg = await Api.post("/business/infack/queryInfack", {
				...this.model,
				pageNum: this.pagination.pageNum,
				pageSize: this.pagination.pageSize
			});
			if (rtnmsg.respCode == SUCCESS) {
				this.tableData = rtnmsg.data.list;
				this.pagination = {
					pageNum: rtnmsg.data.pageNum || 1,
					pageSize: rtnmsg.data.pageSize || 10,
					total: rtnmsg.data.total,
				};
			}
      if(this.activeTab == 'gpi'){
        this.activeTab = 'ack'
      }
			loading.close();
		},
		async handleReset() {
			this.model.extkey = "";
			this.model.sndref = "";
			this.model.flg = "";
			this.model.sta = "";
			this.model.acksrv = "";
			this.model.elcmsgtyp = "";
			this.model.rcvdat = new Date();
			this.model.gendat = new Date((new Date).getTime() - (7 * 24 * 60 * 60 * 1000));
      this.model.endgendat = new Date();
      this.model.uetr = "";
    },
    async batchupdateAck(){
      const loading = this.loading();
			let rtnmsg = await Api.post("/business/infack/batchupdateAck", {
				...this.model,
			});
			if (rtnmsg.respCode == SUCCESS) {
				if(rtnmsg.data.errCod == '000000'){
          this.$notify({
            title: '成功',
            message: '成功更新所有报文状态!',
            type: 'success',
          });
        }else{
          this.$notify({
            title: '提示',
            message: '成功更新:【' + rtnmsg.data.successCnt + "】条," + '失败:【' + rtnmsg.data.failedCnt + '】条,以下为错误信息' +  rtnmsg.data.errMsg,
            type: 'warning',
          });
        }
			}
      loading.close();
      this.handleSearch();
    },

    
		async getGpi(row){
      const loading = this.loading();
			let rtnmsg = await Api.post("/business/infack/infgpi", {
        inr:row.inr,
				...this.model,
			});
			if (rtnmsg.respCode == SUCCESS) {
				if(rtnmsg.data.errCod == 'AAAAAAA'){
          this.$alert('查询成功',
            '提示', {
                confirmButtonText: '确定',
                type: 'success',
            }).then(() =>{
              this.gpiTable.data = rtnmsg.data.rtnInf
              this.activeTab = 'gpi';
              }
            );
        }else{
          this.$notify({
            title: '提示',
            message: rtnmsg.data.errMsg,
            type: 'warning',
          });
        }
			}
			loading.close();
    },
		async updateAck(row){
      const loading = this.loading();
			let rtnmsg = await Api.post("/business/infack/updateAck", {
        inr:row.inr,
				...this.model,
			});
			if (rtnmsg.respCode == SUCCESS) {
				if(rtnmsg.data.errCod == '000000'){
          this.$notify({
            title: '成功',
            message: '更新状态成功! ',
            type: 'success',
          });
        }else{
          this.$notify({
            title: '提示',
            message: rtnmsg.data.errMsg,
            type: 'warning',
          });
        }
			}
      loading.close();
      this.handleSearch();
    },
    async getdbCode(codeType, uil, codeNam) {
      let params = {
        codeType: codeType,
        uil: uil ? uil : 'EN'
      }
      let rtnmsg = await Api.post("/manager/dic/listDicInfo", params)
      if (rtnmsg.respCode === SUCCESS) {
        let curList = rtnmsg.data.map(item => ({
          value: item.codeValue,
          label: item.codeName
        }));
        this.model.dbCodes[codeNam] = curList
      }
    },
    getCodelabel(value, codenam) {
      const codeobj = this.model.dbCodes[codenam].find(obj => obj.value === value)
      return codeobj ? codeobj.label : value;
    },
    
    getLabel(list, value) {
      if (value != '' && Array.isArray(list) && list.length != 0) {
        return !list.find(item => item['value'] == value) ? value : list.find(item => item['value'] == value)['label']
      }
    },
		// async showMessage(){
		// 	const loading = this.loading();
		// 	let rtnmsg = await Api.post("/business/infack/showDocs", this.smhinr);

		// },

}
};