const todo = { template: `
`, mixins: [initTableMixins], data() { return { todoActive: "1", todoList:[], todoLoading: false, pageForm: { pageNumber: 1, pageSize: 10, totalCount: 0 }, status:['草稿', '待处理', '已处理', '已驳回', '已撤回'], waitHandleCount: 0 } }, watch: { todoActive: { async handler(val) { console.log("val--->", val) this.pageForm = { pageNumber: 1, pageSize: 10, totalCount: 0 } this.todoList = [] try{ this.todoLoading = true if(Number(val) === 1) { await this.loadWaitHandle() } else if(Number(val) === 2) { await this.loadCompleteHandle() } else if(Number(val) === 3) { await this.loadMineSendTask() } this.todoLoading = false } catch (e) { this.todoLoading = false } } } }, methods: { async handleClick() { this.todoLoading = true /* const {data, code} = await $.get("/platform/sys/localProcess/todoList", { mode: this.todoActive }) this.todoList = data*/ this.todoLoading = false }, // 加载待处理数据 async loadWaitHandle() { const res = await $.post('/oa/audit/instance/wait/handle') console.log("待处理数据->", res) if(res.code === 0) { this.todoList = res.data this.waitHandleCount = this.todoList.length } }, // 加载已办数据 async loadCompleteHandle() { const res = await $.post('/oa/audit/instance/complete/handle', { ...this.pageForm }) console.log("已处理数据->", res) this.todoList = res.list this.pageForm.pageNumber = res.pageNo this.pageForm.pageSize = res.pageSize this.pageForm.totalCount = res.totalCount }, // 加载我发起的 async loadMineSendTask() { const res = await $.post('/oa/audit/instance/mine/send', { ...this.pageForm }) console.log("我发起数据->", res) this.todoList = res.list this.pageForm.pageNumber = res.pageNo this.pageForm.pageSize = res.pageSize this.pageForm.totalCount = res.totalCount }, // 待处理任务处理 async handleTask(row) { if(this.todoActive === '1') { const urlObj = new URL(row.url) console.log(urlObj) window.location.href = urlObj.pathname + urlObj.search } else { const urlObj = new URL(row.done_url) console.log(urlObj) window.location.href = urlObj.pathname + urlObj.search } } }, created() { this.handleClick() // 待处理 this.loadWaitHandle() } }