import { Component, Mixins, Vue, Watch } from 'vue-property-decorator' import Url from "@/utils/Url"; import { State, Getter, Action, Mutation } from "vuex-class"; import HomeParent from "@/views/home/Common/HomeParent"; import { ElTreeDataInterface, ApplyInterface } from "@/views/home/Common/Types"; import CustomPage from "@/components/page.vue"; import {Form, TableColumn} from "view-design"; import {Message, Tree} from "element-ui"; import {Request} from "@/utils/Request"; @Component({ components : { CustomPage } }) export default class Execute extends HomeParent { name: string = "execute"; public Data:ApplyInterface[] = [] public showApplyDialog:boolean = false; public DataDetail:any=[]; public columns: TableColumn[] = [ { title: "unikey", key: "unikey" },{ title: "申请者", key: "creator_account" }, { title: "发放者", key: "send_account" }, { title: "ItemId", key: "item_id" }, { title: "申请时间", key: "create_time" },{ title: "审核时间", key: "audit_time" }, { title: "审核状态", slot: "state", align: 'center', }, { title: "执行状态", slot: "execute_state", align: 'center', }, { title: "操作", slot: "operation", }]; public total: number = 0; public search: { page: number, size: number, keywords?: string } = { page: 1, size: 10, keywords: "" } @Watch("search.page") private _onPageChange(): void { this._getData() } @Watch("search.size") private _onPageSizeChange(): void { this.search.page = 1; this._getData() } public created(): void { this._getData(); } public onDropdownEvent(name: string,row) { switch (name) { case "show" : this.show(row);break; case "execute" : this.execute(row);break; } } public show(row){ let url : string = this.$sprintf(Url.SHOW_APPLY, row.id); Request('get', url).then((res:any)=>{ if (res.code == 200){ this.showApplyDialog = true; this.DataDetail = res.data }else { this.error(res.message) } }) } public execute(row){ if (row.execute_state){ this.error('无法再次执行') return } let url : string = this.$sprintf(Url.EXECUTE_APPLY, row.id); Request('get', url).then((res:any)=>{ if (res.code == 200){ this._getData(); this.success() }else { this.error(res.message) } }) } private async _getData() { let url : string = this.$sprintf(Url.APPLY, 3); const res:any = await Request('get', url,this.search) if (res.code == 200){ this.Data = res.data.data this.total = res.data.total }else { this.error(res.message) } } }