diff --git a/pages/hrm/resignation_form.vue b/pages/hrm/resignation_form.vue index 6635a82..b93dcb8 100644 --- a/pages/hrm/resignation_form.vue +++ b/pages/hrm/resignation_form.vue @@ -2,16 +2,16 @@ @@ -43,7 +49,8 @@ import {actStateEnum} from "@/utils/enum.js" components: { ticketd_b, ticketd }, data(){ return{ - mode:"add", + saveloading: false, + mode:"show", t_id: null, form:{ reason:"", @@ -78,17 +85,9 @@ import {actStateEnum} from "@/utils/enum.js" }, async onLoad(options) { let that = this; - let userInfo = uni.getStorageSync("userInfo"); - that.form.employee_name = userInfo.name; - that.form.post_name = userInfo.post_name; - that.form.post = userInfo.post; - that.form.belong_dept = userInfo.belong_dept; - that.form.belong_dept_name = userInfo.belong_dept_name; - that.form.id=''; that.mode = options.mode?options.mode:'show'; that.t_id = options.t_id?options.t_id:null; - if(that.mode != "add"){ - if(that.t_id) { + if(that.t_id) { that.form = await that.$api.resignationItem(that.t_id); if(that.form.ticket_.state_.type == 1 && that.form.create_by == uni.getStorageSync("userInfo").id ) { that.mode = "edit"; @@ -96,34 +95,36 @@ import {actStateEnum} from "@/utils/enum.js" that.mode = "show"; } } - }else{ + else{ that.getEmployee(); } }, methods:{ async getEmployee(){ + let res = await this.$api.employeeInfo(); + this.form.employee_name = res.name; + this.form.belong_dept_name = res.belong_dept_name; + this.form.post_name = res.post_name; + this.form.employee = res.id; + this.mode = "add"; + }, + async handleDel(){ let that = this; - let obj = {search:that.form.employee_name,page:0,query:'{name,id}'} - let res = await that.$api.employeeList(obj); - that.form.employee = res[0].id; + await that.$api.resignationDelete(that.form.id) + uni.navigateBack() }, - sealChange(){ - console.log('seal1',this.seal1) - }, - async submit_b_func(id){ + async handleSave(){ let that = this; that.$refs.customForm.validate().then(res => { }).catch(err => { console.log('err', err); }) - let res = await that.$api.resignationCreate(that.form) - that.form.id = res.id; + await that.$api.resignationCreate(that.form) + uni.navigateBack() }, submitSuccess(){ - uni.navigateTo({ - url: "/pages/index/index" - }) + uni.navigateBack() }, } } diff --git a/utils/api.js b/utils/api.js index 8055946..22369d5 100644 --- a/utils/api.js +++ b/utils/api.js @@ -15,6 +15,7 @@ export default { uploadFile:(data ) => http('/file/', 'POST', data),//上传文件 employeeList:(data) => http('/hrm/employee/', 'GET', data), + employeeInfo:() => http('/hrm/employee/info/', 'GET'), getWorkflow: (data) => http('/wf/workflow/', 'GET', data), getTicket:(data) => http('/wf/ticket/', 'GET', data),