feat: resignation_form调整为mixin模式

This commit is contained in:
caoqianming 2025-11-24 15:11:02 +08:00
parent ebf0f0a0ce
commit 9aeda011ce
2 changed files with 34 additions and 32 deletions

View File

@ -2,16 +2,16 @@
<template>
<view class="container">
<scroll-view scroll-y style="padding-bottom: 180rpx;background-color: #fff;">
<uni-forms v-model="form" label-width="150rpx" ref="customForm" :rules="customRules">
<uni-forms v-model="form" label-width="180rpx" ref="customForm" :rules="customRules">
<ticketd :ticket_="form.ticket_"></ticketd>
<uni-forms-item label="姓名" required>
<uni-easyinput v-model="form.employee_name" placeholder="请输入姓名" :disabled="mode=='show'"/>
<uni-forms-item label="姓名">
<uni-easyinput v-model="form.employee_name" placeholder="请输入姓名" :disabled="true"/>
</uni-forms-item>
<uni-forms-item label="部门" required>
<uni-easyinput v-model="form.belong_dept_name" placeholder="请输入岗位" :disabled="mode=='show'"/>
<uni-forms-item label="部门">
<uni-easyinput v-model="form.belong_dept_name" placeholder="请输入岗位" :disabled="true"/>
</uni-forms-item>
<uni-forms-item label="岗位" required>
<uni-easyinput v-model="form.post_name" placeholder="请输入岗位" :disabled="mode=='show'"/>
<uni-forms-item label="岗位">
<uni-easyinput v-model="form.post_name" placeholder="请输入岗位" :disabled="true"/>
</uni-forms-item>
<uni-forms-item label="离职时间" required>
<uni-datetime-picker type="date" :clear-icon="false" v-model="form.end_date" v-if="mode!='show'"/>
@ -29,8 +29,14 @@
</uni-forms>
</scroll-view>
<view class="footer_fixed">
<ticketd_b :workflow_key="'wf_resignation'" :title="form.employee_name + '-离职申请'" :t_id="form.id" :ticket_="form.ticket_"
:ticket_data="ticket_data" @success="submitSuccess" :submit_b_func="submit_b_func" ref="ticketd_b_start"></ticketd_b>
<button v-if="mode=='edit'" size="mini" @click="handleDel" :loading="saveLoading" :disabled="saveloading" type="warn">
删除
</button>
<ticketd_b v-if="form.ticket_" :t_id="form.id" :ticket_="form.ticket_"
:ticket_data="ticket_data" @success="submitSuccess" ref="ticketd_b"></ticketd_b>
<button v-else size="mini" @click="handleSave" :loading="saveLoading" :disabled="saveloading" type="primary">
提交审批
</button>
</view>
</view>
</template>
@ -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,16 +85,8 @@ 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) {
that.form = await that.$api.resignationItem(that.t_id);
if(that.form.ticket_.state_.type == 1 && that.form.create_by == uni.getStorageSync("userInfo").id ) {
@ -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()
},
}
}

View File

@ -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),