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: "初审状态", slot: "audit_state_one", align: 'center', },{ title: "终审状态", slot: "audit_state_two", 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; case "reject" : this.reject(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 == -1){ this.error('已驳回无法执行') return } 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) } }) } public reject(row){ if (row.execute_state == -1){ this.error('无法再次驳回') return } if (row.execute_state){ this.error('已执行无法驳回') return } let self = this; this.$Modal.confirm({ title:"驳回原因", render: function(h) { return h('Input', { props: { value: self.$store.getters.user.name, autofocus: true, placeholder: 'Please enter reject reason...' }, attrs: { type: "textarea", }, on: { input: (val) => { this.value = val; } } }) }, onOk :function() { if (!this.value) { self.error('请输入驳回原因') return; } let data = {reject_reason:this.value}; let url : string = self.$sprintf(Url.REJECT_APPLY, row.id); Request('post', url,data).then((res:any)=>{ console.log(res) if (res.code == 200){ self._getData(); self.success() }else { self.error(res.message) } }) } }) } private async _getData() { let url : string = this.$sprintf(Url.APPLY, 4); 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) } } }