index.js 4.54 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 Utils from "~/utils"
import commonFunctions from '~/mixin/commonFunctions.js';
import moment from 'moment'
export default {
	mixins: [commonFunctions],
	methods: {
		//重置
		handleReset() {
			this.model.bchcon = '';
			this.model.trncorco.ownref = '';
			this.model.trncorco.relflg = '';
			this.model.usrcon = '';
			this.model.trncorco.inidatfro = '';
			this.model.trncorco.inidattil = '';
			this.model.atp.cod = '';
			this.model.trncorco.dflg = '1';
			this.model.atptxt = '';
			this.model.searchAllUsers = false;
			this.model.channel = '';
    },
		//查询列表
		async handleSearch() {
			let inidatfro = this.model.trncorco.inidatfro;
			if (!inidatfro) {
				this.$notify.error({
					title: '错误',
					message: '查询开始日期必输!'
				});
				return;
			}
			let inidattil = this.model.trncorco.inidattil;
			if (!inidattil) {
				this.$notify.error({
					title: '错误',
					message: '查询结束日期必输!'
				});
				return;
			}
			let params = {
				ownref: this.model.trncorco.ownref,
				inidatfro: moment(inidatfro).format('YYYY-MM-DD') + ' 00:00:00',
        inidattil: moment(inidattil).format('YYYY-MM-DD') + ' 23:59:59',
        tskcla:this.model.tskcla,
        tsksta:this.model.tsksta,
        // frm:this.model.frm,
        usr:this.model.usr,
				pageNo: this.pagination.pageIndex,
				pageSize: this.pagination.pageSize,
			};
			//查询接口
			const loading = this.loading();
			const res = await Api.post('/public/quesel/manAssignTaskList', params);
			if (res.respCode === SUCCESS) {
				this.stmData.data = res.data.list;
        this.pagination.total = Number(res.data.total);
			}
			loading.close();
		},
		// 领取任务
		async getUnAssignData () {
        const loading = this.loading();
        const res = await Api.post('/public/sptsel/getTask', {});
        if (res.respCode === SUCCESS) {
          this.$notify({
						title: '成功',
						message: '领取任务成功!',
						type: 'success',
          });
        }
        loading.close();
        this.handleSearch();
    },
    async rebackTask(row){
      const loading = this.loading();
      const res = await Api.post('/public/sptsel/rebackTask', {queinr:row.inr});
      if (res.respCode === SUCCESS) {
        this.$notify({
          title: '成功',
          message: '退回分配成功!',
          type: 'success',
        });
      }
      loading.close();
      this.handleSearch();
    },
    unAssignMethod(){
			this.isShowManualAssign = true
    },
    currentChange(num) {
			this.currentPage = num;
			this.getTableData();
		},
		// 手工分配关闭弹框
		closeDialog () {
			this.isShowManualAssign = false
		},
		// 手工分配成功回调,刷新页面
		refresh () {
			this.isShowManualAssign = false
			this.handleSearch();
    },
    
    closeCorDialog () {
			this.isShowCorToQue = false
    },
    refreshC () {
			this.isShowCorToQue = false
			this.handleSearch();
    },
		// pageSize改变
		handleSizeChange(val) {
			this.pagination.pageIndex = 1;
			this.pagination.pageSize = val;
			this.handleSearch();
		},
		// 页码改变
		handleCurrentChange(val) {
			this.pagination.pageIndex = val;
			this.handleSearch();
		},
		selectableFn (row) {
			return 'new|assigned|correct|incoming|waiting'.indexOf(row.status) != -1
		},
		// 表格多选
		handleSelectionChange (val) {
			this.multipleSelection = val.map((item) => {
				return item
			})
			console.log(this.multipleSelection)
    },
    async  getallusers(){
      let res = await Api.post("/public/taskdist/user/getallusers");
      if (res.respCode == SUCCESS) {
        this.userList= res.data 
      }
   },
     //初始化码表
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.dbCodes[codeNam] = curList
  }
}, //表格码表格式化
getCodelabel(value,codenam) {
      const codeobj = this.dbCodes[codenam].find(obj => obj.value === value)
      return codeobj ? codeobj.label : value;
},

    // 机构列表
    async getBranchList() {
      const res = await Api.post("/public/quesel/getBranchList");
      if (res.respCode == SUCCESS) {
        this.bchtypList = res.data.list;
      }
    },

    //格式化机构
    bchFormat(value){
      const codeobj = this.bchtypList.find(obj => obj.inr === value)
      return codeobj ? codeobj.bchname : value;
    }
	},
};