factory_mp/pages/hrm/empneed_form.vue

168 lines
5.2 KiB
Vue

<!-- 离职申请 -->
<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">
<ticketd :ticket_="form.ticket_"></ticketd>
<uni-forms-item label="部门">
<uni-easyinput v-model="form.belong_dept_name" placeholder="请输入岗位" :disabled="true" v-if="mode!='show'"/>
<span v-else>{{form.belong_dept_name}}</span>
</uni-forms-item>
<uni-forms-item label="员工信息">
<span>{{form.employee_name}}</span>
</uni-forms-item>
<uni-forms-item label="需求岗位">
<uni-easyinput v-model="form.post_name" placeholder="请输入需求岗位" :disabled="true" v-if="mode!='show'"/>
<span v-else>{{form.post_name}}</span>
</uni-forms-item>
<uni-forms-item label="需求人数" required>
<uni-number-box v-model="form.start_km" v-if="mode!='show'"></uni-number-box>
<span v-else>{{form.start_km}}</span>
</uni-forms-item>
<uni-forms-item label="工资报酬" required>
<uni-number-box v-model="form.start_km" v-if="mode!='show'"></uni-number-box>
<span v-else>{{form.start_km}}</span>
</uni-forms-item>
<uni-forms-item label="性别要求" required>
<uni-data-checkbox v-model="form.type" :localdata="hobby" :disabled="mode=='show'"></uni-data-checkbox>
</uni-forms-item>
<uni-forms-item label="学历要求" required>
<uni-data-select
v-if="mode!='show'"
v-model="form.vehreg"
:localdata="vehRegList"
:disabled="mode=='show'"
@change="vehregChange"
></uni-data-select>
<span v-else>{{form.vehreg_name}}</span>
</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'"/>
<span v-else>{{form.end_date}}</span>
</uni-forms-item>
<uni-forms-item label="申请理由" required>
<uni-data-select
v-if="mode!='show'"
v-model="form.vehreg"
:localdata="reasonList"
:disabled="mode=='show'"
@change="vehregChange"
></uni-data-select>
<span v-else>{{form.vehreg_name}}</span>
</uni-forms-item>
<uni-forms-item label="职责描述">
<uni-easyinput v-model="form.duty" placeholder="请输入职责描述" :disabled="true" v-if="mode!='show'"/>
<span v-else>{{form.duty}}</span>
</uni-forms-item>
<uni-forms-item label="相关专业及技能要求" required>
<textarea placeholder-style="color:#efefef" v-model="form.professional_requirement" placeholder="相关专业及技能要求" v-if="mode!='show'" style="width:100%; border: 2upx solid #e5e5e5;padding: 10upx;"/>
<span v-else>{{form.professional_requirement}}</span>
</uni-forms-item>
</uni-forms>
</scroll-view>
<view class="footer_fixed">
<ticketd_b :workflow_key="'wf_empneed'" :title=" '用人需求审批'" :t_id="form.id" :ticket_="form.ticket_"
@success="submitSuccess" :submit_b_func="submit_b_func" ref="ticketd_b_start"></ticketd_b>
</view>
</view>
</template>
<script>
import ticketd_b from "../wf/ticketd_b.vue"
import ticketd from "../wf/ticketd.vue"
import {actStateEnum} from "@/utils/enum.js"
export default {
components: { ticketd_b, ticketd },
data(){
return{
saveLoading: false,
mode:"show",
t_id: null,
form:{
reason:"",
employee:"",
end_date:"",
},
ticket_data:{
handle_date:""
},
userInfo:{},
type:0,
hobby: [
{text: '男',value: 1},
{text: '女',value: 2},
{text: '不限',value: 0},
],
reasonList:[
{text: '省级平台',value: '省级平台'},
{text: '市级平台',value: '市级平台'},
],
header:"",
customRules: {
filename: {
rules: [{
required: true,
errorMessage: '姓名不能为空'
}]
},
age: {
rules: [{
required: true,
errorMessage: '年龄不能为空'
}]
},
},
}
},
async onLoad(options) {
let that = this;
that.mode = options.mode?options.mode:'show';
that.t_id = options.t_id?options.t_id:null;
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";
}else{
that.mode = "show";
}
}
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 submit_b_func(id){
let that = this;
if (that.mode != 'show') {
if(that.form.id) {
await that.$api.resignationUpdate(that.form.id, that.form);
}else{
let res = await that.$api.resignationCreate(that.form);
that.form.id = res.id;
}
}
},
}
}
</script>
<style scoped>
.uni-data-checklist .checklist-group .checklist-box{
margin: 10px 0!important;
}
.flex_file_picker>.uni-file-picker__files{
flex-direction: row;
}
.flex_file_picker{
width: 90px;
flex: none;
}
</style>