feat: resignation_form调整为mixin模式
This commit is contained in:
parent
ebf0f0a0ce
commit
9aeda011ce
|
|
@ -2,16 +2,16 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="container">
|
<view class="container">
|
||||||
<scroll-view scroll-y style="padding-bottom: 180rpx;background-color: #fff;">
|
<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>
|
<ticketd :ticket_="form.ticket_"></ticketd>
|
||||||
<uni-forms-item label="姓名" required>
|
<uni-forms-item label="姓名">
|
||||||
<uni-easyinput v-model="form.employee_name" placeholder="请输入姓名" :disabled="mode=='show'"/>
|
<uni-easyinput v-model="form.employee_name" placeholder="请输入姓名" :disabled="true"/>
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
<uni-forms-item label="部门" required>
|
<uni-forms-item label="部门">
|
||||||
<uni-easyinput v-model="form.belong_dept_name" placeholder="请输入岗位" :disabled="mode=='show'"/>
|
<uni-easyinput v-model="form.belong_dept_name" placeholder="请输入岗位" :disabled="true"/>
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
<uni-forms-item label="岗位" required>
|
<uni-forms-item label="岗位">
|
||||||
<uni-easyinput v-model="form.post_name" placeholder="请输入岗位" :disabled="mode=='show'"/>
|
<uni-easyinput v-model="form.post_name" placeholder="请输入岗位" :disabled="true"/>
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
<uni-forms-item label="离职时间" required>
|
<uni-forms-item label="离职时间" required>
|
||||||
<uni-datetime-picker type="date" :clear-icon="false" v-model="form.end_date" v-if="mode!='show'"/>
|
<uni-datetime-picker type="date" :clear-icon="false" v-model="form.end_date" v-if="mode!='show'"/>
|
||||||
|
|
@ -29,8 +29,14 @@
|
||||||
</uni-forms>
|
</uni-forms>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
<view class="footer_fixed">
|
<view class="footer_fixed">
|
||||||
<ticketd_b :workflow_key="'wf_resignation'" :title="form.employee_name + '-离职申请'" :t_id="form.id" :ticket_="form.ticket_"
|
<button v-if="mode=='edit'" size="mini" @click="handleDel" :loading="saveLoading" :disabled="saveloading" type="warn">
|
||||||
:ticket_data="ticket_data" @success="submitSuccess" :submit_b_func="submit_b_func" ref="ticketd_b_start"></ticketd_b>
|
删除
|
||||||
|
</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>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -43,7 +49,8 @@ import {actStateEnum} from "@/utils/enum.js"
|
||||||
components: { ticketd_b, ticketd },
|
components: { ticketd_b, ticketd },
|
||||||
data(){
|
data(){
|
||||||
return{
|
return{
|
||||||
mode:"add",
|
saveloading: false,
|
||||||
|
mode:"show",
|
||||||
t_id: null,
|
t_id: null,
|
||||||
form:{
|
form:{
|
||||||
reason:"",
|
reason:"",
|
||||||
|
|
@ -78,17 +85,9 @@ import {actStateEnum} from "@/utils/enum.js"
|
||||||
},
|
},
|
||||||
async onLoad(options) {
|
async onLoad(options) {
|
||||||
let that = this;
|
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.mode = options.mode?options.mode:'show';
|
||||||
that.t_id = options.t_id?options.t_id:null;
|
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);
|
that.form = await that.$api.resignationItem(that.t_id);
|
||||||
if(that.form.ticket_.state_.type == 1 && that.form.create_by == uni.getStorageSync("userInfo").id ) {
|
if(that.form.ticket_.state_.type == 1 && that.form.create_by == uni.getStorageSync("userInfo").id ) {
|
||||||
that.mode = "edit";
|
that.mode = "edit";
|
||||||
|
|
@ -96,34 +95,36 @@ import {actStateEnum} from "@/utils/enum.js"
|
||||||
that.mode = "show";
|
that.mode = "show";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
else{
|
||||||
that.getEmployee();
|
that.getEmployee();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods:{
|
methods:{
|
||||||
async getEmployee(){
|
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 that = this;
|
||||||
let obj = {search:that.form.employee_name,page:0,query:'{name,id}'}
|
await that.$api.resignationDelete(that.form.id)
|
||||||
let res = await that.$api.employeeList(obj);
|
uni.navigateBack()
|
||||||
that.form.employee = res[0].id;
|
|
||||||
},
|
},
|
||||||
sealChange(){
|
async handleSave(){
|
||||||
console.log('seal1',this.seal1)
|
|
||||||
},
|
|
||||||
async submit_b_func(id){
|
|
||||||
let that = this;
|
let that = this;
|
||||||
that.$refs.customForm.validate().then(res => {
|
that.$refs.customForm.validate().then(res => {
|
||||||
|
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
console.log('err', err);
|
console.log('err', err);
|
||||||
})
|
})
|
||||||
let res = await that.$api.resignationCreate(that.form)
|
await that.$api.resignationCreate(that.form)
|
||||||
that.form.id = res.id;
|
uni.navigateBack()
|
||||||
},
|
},
|
||||||
submitSuccess(){
|
submitSuccess(){
|
||||||
uni.navigateTo({
|
uni.navigateBack()
|
||||||
url: "/pages/index/index"
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ export default {
|
||||||
uploadFile:(data ) => http('/file/', 'POST', data),//上传文件
|
uploadFile:(data ) => http('/file/', 'POST', data),//上传文件
|
||||||
|
|
||||||
employeeList:(data) => http('/hrm/employee/', 'GET', data),
|
employeeList:(data) => http('/hrm/employee/', 'GET', data),
|
||||||
|
employeeInfo:() => http('/hrm/employee/info/', 'GET'),
|
||||||
|
|
||||||
getWorkflow: (data) => http('/wf/workflow/', 'GET', data),
|
getWorkflow: (data) => http('/wf/workflow/', 'GET', data),
|
||||||
getTicket:(data) => http('/wf/ticket/', 'GET', data),
|
getTicket:(data) => http('/wf/ticket/', 'GET', data),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue