feat:hrm-新增模块 人员需求 人员交接 人员请假
This commit is contained in:
parent
2dd582217a
commit
e2ed0e0e0d
|
|
@ -0,0 +1,223 @@
|
||||||
|
<!-- 人员交接 -->
|
||||||
|
<template>
|
||||||
|
<view class="container">
|
||||||
|
<scroll-view scroll-y style="padding-bottom: 180rpx;background-color: #fff;">
|
||||||
|
<uni-forms v-model="form" label-width="190rpx" ref="customForm" :rules="customRules">
|
||||||
|
<ticketd :ticket_="form.ticket_"></ticketd>
|
||||||
|
<uni-forms-item label="需求部门" required name="dept_need">
|
||||||
|
<uni-data-picker
|
||||||
|
v-model="form.dept_need"
|
||||||
|
:localdata="group"
|
||||||
|
:disabled="mode === 'show'"
|
||||||
|
:map="{ text: 'label', value: 'value', children: 'children' }"
|
||||||
|
:show-all-levels="false"
|
||||||
|
clearable
|
||||||
|
placeholder="请选择部门"
|
||||||
|
/>
|
||||||
|
</uni-forms-item>
|
||||||
|
|
||||||
|
<!-- 日期 -->
|
||||||
|
<uni-forms-item label="日期" required name="join_date">
|
||||||
|
<uni-datetime-picker
|
||||||
|
type="date"
|
||||||
|
:clear-icon="false"
|
||||||
|
v-model="form.join_date"
|
||||||
|
/>
|
||||||
|
</uni-forms-item>
|
||||||
|
</uni-forms>
|
||||||
|
</scroll-view>
|
||||||
|
<!-- 人员列表 -->
|
||||||
|
<view class="person-list">
|
||||||
|
<view
|
||||||
|
class="person-card"
|
||||||
|
v-for="(item, index) in form.person"
|
||||||
|
:key="index"
|
||||||
|
>
|
||||||
|
<uni-forms :modelValue="item">
|
||||||
|
<uni-forms-item label="姓名" required>
|
||||||
|
<uni-easyinput v-model="item.name" placeholder="请输入姓名" />
|
||||||
|
</uni-forms-item>
|
||||||
|
|
||||||
|
<uni-forms-item label="性别" required>
|
||||||
|
<uni-data-select
|
||||||
|
v-model="item.gender"
|
||||||
|
:localdata="genderList"
|
||||||
|
placeholder="请选择"
|
||||||
|
/>
|
||||||
|
</uni-forms-item>
|
||||||
|
|
||||||
|
<uni-forms-item label="身份证号" required label-width="190rpx">
|
||||||
|
<uni-easyinput v-model="item.IDcard" />
|
||||||
|
</uni-forms-item>
|
||||||
|
|
||||||
|
<uni-forms-item label="手机号" required>
|
||||||
|
<uni-easyinput v-model="item.phone" />
|
||||||
|
</uni-forms-item>
|
||||||
|
|
||||||
|
<uni-forms-item label="备注">
|
||||||
|
<uni-easyinput v-model="item.note" />
|
||||||
|
</uni-forms-item>
|
||||||
|
|
||||||
|
<!-- 岗位(条件显示) -->
|
||||||
|
<uni-forms-item
|
||||||
|
v-if="showPost"
|
||||||
|
label="岗位"
|
||||||
|
required
|
||||||
|
>
|
||||||
|
<uni-data-select
|
||||||
|
v-model="item.post"
|
||||||
|
:localdata="postList"
|
||||||
|
placeholder="请选择岗位"
|
||||||
|
/>
|
||||||
|
</uni-forms-item>
|
||||||
|
|
||||||
|
<!-- 删除 -->
|
||||||
|
<button
|
||||||
|
v-if="mode !== 'show'"
|
||||||
|
class="del-btn"
|
||||||
|
@click="removePerson(index)"
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</button>
|
||||||
|
|
||||||
|
</uni-forms>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 新增人员 -->
|
||||||
|
<button
|
||||||
|
v-if="mode !== 'show'"
|
||||||
|
type="primary"
|
||||||
|
style="margin-bottom: 20rpx"
|
||||||
|
@click="addPerson"
|
||||||
|
>
|
||||||
|
新增人员
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<!-- 底部操作 -->
|
||||||
|
<view class="footer_fixed">
|
||||||
|
<button v-if="mode=='edit'" size="mini" @click="handleDel" :loading="saveLoading" :disabled="saveLoading" type="warn">
|
||||||
|
删除
|
||||||
|
</button>
|
||||||
|
<button v-if="mode!='show'" size="mini" @click="handleSave" :loading="saveLoading" :disabled="saveLoading" type="primary">
|
||||||
|
提交审批
|
||||||
|
</button>
|
||||||
|
<ticketd_b :workflow_key="'wf_empjoin'" v-if="form.ticket_ && mode == 'show'" :t_id="form.id" :ticket_="form.ticket_"
|
||||||
|
:ticket_data="ticket_data" @success="()=>{uni.navigateBack()}" ref="ticketd_b"></ticketd_b>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
import { genTree } from "@/utils/verificate";
|
||||||
|
import ticketd_b from "../wf/ticketd_b.vue"
|
||||||
|
import ticketd from "../wf/ticketd.vue"
|
||||||
|
export default {
|
||||||
|
components: { ticketd_b, ticketd },
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
mode: 'show',
|
||||||
|
t_id: null,
|
||||||
|
saveLoading: false,
|
||||||
|
ticket_data:{},
|
||||||
|
form: {
|
||||||
|
dept_need: '',
|
||||||
|
join_date: '',
|
||||||
|
person: [],
|
||||||
|
},
|
||||||
|
group: [],
|
||||||
|
postList: [],
|
||||||
|
ticket_data:{},
|
||||||
|
genderList: [
|
||||||
|
{ text: '男', value: 1 },
|
||||||
|
{ text: '女', value: 2 }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
showPost() {
|
||||||
|
const stateName = this.form?.ticket_?.state_?.name
|
||||||
|
return ['交接部门负责人', '结束'].includes(stateName)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
'form.person'(val){
|
||||||
|
this.ticket_data.person = val
|
||||||
|
},
|
||||||
|
},
|
||||||
|
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) {
|
||||||
|
const res = await that.$api.empjoinItem(that.t_id);
|
||||||
|
this.form = res
|
||||||
|
if(that.form.ticket_.state_.type == 1 && that.form.create_by == uni.getStorageSync("userInfo").id ) {
|
||||||
|
that.mode = "edit";
|
||||||
|
}else{
|
||||||
|
that.mode = "show";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.getGroup();
|
||||||
|
this.getPost();
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
addPerson() {
|
||||||
|
this.form.person.push({
|
||||||
|
name: '',
|
||||||
|
gender: '',
|
||||||
|
IDcard: '',
|
||||||
|
phone: '',
|
||||||
|
note: '',
|
||||||
|
post: ''
|
||||||
|
})
|
||||||
|
},
|
||||||
|
removePerson(index) {
|
||||||
|
this.form.person.splice(index, 1)
|
||||||
|
},
|
||||||
|
async getGroup() {
|
||||||
|
const res = await this.$api.deptList({ page: 0 })
|
||||||
|
this.group = genTree(res);
|
||||||
|
},
|
||||||
|
async getPost(){
|
||||||
|
const res = await this.$api.postList({ page: 0 })
|
||||||
|
this.postList = res.map(item =>({
|
||||||
|
text: item.name,
|
||||||
|
value: item.id
|
||||||
|
}))
|
||||||
|
|
||||||
|
},
|
||||||
|
async handleSave() {
|
||||||
|
await this.$api.empjoinCreate(this.form)
|
||||||
|
uni.showToast({ title: '提交成功' })
|
||||||
|
uni.navigateBack()
|
||||||
|
},
|
||||||
|
async handleDel(){
|
||||||
|
let that = this;
|
||||||
|
await that.$api.empjoinDelete(that.form.id)
|
||||||
|
uni.navigateBack()
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</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;
|
||||||
|
}
|
||||||
|
.del-btn {
|
||||||
|
height: 56rpx;
|
||||||
|
line-height: 56rpx;
|
||||||
|
padding: 0 20rpx;
|
||||||
|
font-size: 24rpx;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -16,53 +16,57 @@
|
||||||
<span v-else>{{form.post_name}}</span>
|
<span v-else>{{form.post_name}}</span>
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
<uni-forms-item label="需求人数" required>
|
<uni-forms-item label="需求人数" required>
|
||||||
<uni-number-box v-model="form.start_km" v-if="mode!='show'"></uni-number-box>
|
<uni-number-box v-model="form.count_need" :min="0" v-if="mode!='show'"></uni-number-box>
|
||||||
<span v-else>{{form.start_km}}</span>
|
<span v-else>{{form.count_need}}</span>
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
<uni-forms-item label="工资报酬" required>
|
<uni-forms-item label="工资报酬" required>
|
||||||
<uni-number-box v-model="form.start_km" v-if="mode!='show'"></uni-number-box>
|
<uni-number-box v-model="form.salary" :min="0" v-if="mode!='show'"></uni-number-box>
|
||||||
<span v-else>{{form.start_km}}</span>
|
<span v-else>{{form.salary}}</span>
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
<uni-forms-item label="性别要求" required>
|
<uni-forms-item label="性别要求" required>
|
||||||
<uni-data-checkbox v-model="form.type" :localdata="hobby" :disabled="mode=='show'"></uni-data-checkbox>
|
<uni-data-checkbox
|
||||||
|
v-model="form.gender"
|
||||||
|
:localdata="genderList"
|
||||||
|
v-if="mode!='show'"/>
|
||||||
|
<span v-else>{{ getLabel(genderList, form.gender) }}</span>
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
<uni-forms-item label="学历要求" required>
|
<uni-forms-item label="学历要求" required>
|
||||||
<uni-data-select
|
<uni-data-select
|
||||||
v-if="mode!='show'"
|
v-if="mode!='show'"
|
||||||
v-model="form.vehreg"
|
v-model="form.education"
|
||||||
:localdata="vehRegList"
|
:localdata="educationList"
|
||||||
:disabled="mode=='show'"
|
:disabled="mode=='show'"
|
||||||
@change="vehregChange"
|
@change="educationChange"
|
||||||
></uni-data-select>
|
></uni-data-select>
|
||||||
<span v-else>{{form.vehreg_name}}</span>
|
<span v-else>{{getLabel(educationList,form.education) }}</span>
|
||||||
</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.arrival_date" v-if="mode!='show'"/>
|
||||||
<span v-else>{{form.end_date}}</span>
|
<span v-else>{{form.arrival_date}}</span>
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
<uni-forms-item label="申请理由" required>
|
<uni-forms-item label="申请理由" required>
|
||||||
<uni-data-select
|
<uni-data-checkbox v-model="form.reason" :localdata="reasonList" placeholder="请选择申请描述" v-if="mode!='show'"></uni-data-checkbox>
|
||||||
v-if="mode!='show'"
|
<span v-else>{{getLabel(reasonList,form.reason)}}</span>
|
||||||
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>
|
||||||
<uni-forms-item label="职责描述">
|
<uni-forms-item label="职责描述" required>
|
||||||
<uni-easyinput v-model="form.duty" placeholder="请输入职责描述" :disabled="true" v-if="mode!='show'"/>
|
<uni-easyinput v-model="form.duty" placeholder="请输入职责描述" v-if="mode!='show'"/>
|
||||||
<span v-else>{{form.duty}}</span>
|
<span v-else>{{form.duty}}</span>
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
<uni-forms-item label="相关专业及技能要求" required>
|
<uni-forms-item label="相关专业及技能要求">
|
||||||
<textarea placeholder-style="color:#efefef" v-model="form.professional_requirement" placeholder="相关专业及技能要求" v-if="mode!='show'" style="width:100%; border: 2upx solid #e5e5e5;padding: 10upx;"/>
|
<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>
|
<span v-else>{{form.professional_requirement}}</span>
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
</uni-forms>
|
</uni-forms>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
<view class="footer_fixed">
|
<view class="footer_fixed">
|
||||||
<ticketd_b :workflow_key="'wf_empneed'" :title=" '用人需求审批'" :t_id="form.id" :ticket_="form.ticket_"
|
<button v-if="mode=='edit'" size="mini" @click="handleDel" :loading="saveLoading" :disabled="saveLoading" type="warn">
|
||||||
@success="submitSuccess" :submit_b_func="submit_b_func" ref="ticketd_b_start"></ticketd_b>
|
删除
|
||||||
|
</button>
|
||||||
|
<button v-if="mode!='show'" size="mini" @click="handleSave" :loading="saveLoading" :disabled="saveLoading" type="primary">
|
||||||
|
提交审批
|
||||||
|
</button>
|
||||||
|
<ticketd_b :workflow_key="'wf_empneed'" v-if="form.ticket_ && mode == 'show'" :t_id="form.id" :ticket_="form.ticket_"
|
||||||
|
:ticket_data="ticket_data" @success="()=>{uni.navigateBack()}" ref="ticketd_b"></ticketd_b>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -79,38 +83,37 @@ import {actStateEnum} from "@/utils/enum.js"
|
||||||
mode:"show",
|
mode:"show",
|
||||||
t_id: null,
|
t_id: null,
|
||||||
form:{
|
form:{
|
||||||
reason:"",
|
count_need: 0, // 👈 默认 0
|
||||||
employee:"",
|
salary: 0,
|
||||||
end_date:"",
|
|
||||||
},
|
|
||||||
ticket_data:{
|
|
||||||
handle_date:""
|
|
||||||
},
|
},
|
||||||
|
ticket_data:{},
|
||||||
userInfo:{},
|
userInfo:{},
|
||||||
type:0,
|
type:0,
|
||||||
hobby: [
|
genderList: [
|
||||||
{text: '男',value: 1},
|
{text: '男',value: 1},
|
||||||
{text: '女',value: 2},
|
{text: '女',value: 2},
|
||||||
{text: '不限',value: 0},
|
{text: '不限',value: 0},
|
||||||
],
|
],
|
||||||
|
educationList: [
|
||||||
|
{ value: 0, text: '不限' },
|
||||||
|
{ value: 1, text: '高中/中专' },
|
||||||
|
{ value: 2, text: '大专' },
|
||||||
|
{ value: 3, text: '本科' },
|
||||||
|
{ value: 4, text: '硕士及以上' }
|
||||||
|
],
|
||||||
reasonList:[
|
reasonList:[
|
||||||
{text: '省级平台',value: '省级平台'},
|
{ value: 0, text: '新增人员' },
|
||||||
{text: '市级平台',value: '市级平台'},
|
{ value: 1, text: '高中该岗原人员离职或辞职或辞退需补充' },
|
||||||
|
{ value: 2, text: '其他原因' },
|
||||||
],
|
],
|
||||||
header:"",
|
header:"",
|
||||||
customRules: {
|
customRules: {
|
||||||
filename: {
|
count_need: {
|
||||||
rules: [{
|
rules: [{
|
||||||
required: true,
|
required: true,
|
||||||
errorMessage: '姓名不能为空'
|
errorMessage: '不能为空'
|
||||||
}]
|
}]
|
||||||
},
|
}
|
||||||
age: {
|
|
||||||
rules: [{
|
|
||||||
required: true,
|
|
||||||
errorMessage: '年龄不能为空'
|
|
||||||
}]
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -119,7 +122,9 @@ import {actStateEnum} from "@/utils/enum.js"
|
||||||
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.t_id) {
|
if(that.t_id) {
|
||||||
that.form = await that.$api.resignationItem(that.t_id);
|
const res = await that.$api.empneedItem(that.t_id);
|
||||||
|
this.form = res
|
||||||
|
await this.fillNames()
|
||||||
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";
|
||||||
}else{
|
}else{
|
||||||
|
|
@ -131,24 +136,45 @@ import {actStateEnum} from "@/utils/enum.js"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods:{
|
methods:{
|
||||||
|
async fillNames(){
|
||||||
|
const employee = await this.$api.employeeInfo()
|
||||||
|
this.form.employee_name = employee.name
|
||||||
|
this.form.belong_dept_name = employee.belong_dept_name
|
||||||
|
this.form.post_name = employee.post_name
|
||||||
|
},
|
||||||
async getEmployee(){
|
async getEmployee(){
|
||||||
let res = await this.$api.employeeInfo();
|
let res = await this.$api.employeeInfo();
|
||||||
this.form.employee_name = res.name;
|
this.form.employee_name = res.name;
|
||||||
|
this.form.dept_need = res.belong_dept;
|
||||||
|
this.form.post_need = res.post;
|
||||||
this.form.belong_dept_name = res.belong_dept_name;
|
this.form.belong_dept_name = res.belong_dept_name;
|
||||||
this.form.post_name = res.post_name;
|
this.form.post_name = res.post_name;
|
||||||
this.form.employee = res.id;
|
this.form.employee = res.id;
|
||||||
this.mode = "add";
|
this.mode = "add";
|
||||||
},
|
},
|
||||||
async submit_b_func(id){
|
async handleDel(){
|
||||||
let that = this;
|
let that = this;
|
||||||
if (that.mode != 'show') {
|
await that.$api.empneedDelete(that.form.id)
|
||||||
if(that.form.id) {
|
uni.navigateBack()
|
||||||
await that.$api.resignationUpdate(that.form.id, that.form);
|
},
|
||||||
}else{
|
async handleSave(){
|
||||||
let res = await that.$api.resignationCreate(that.form);
|
let that = this;
|
||||||
that.form.id = res.id;
|
that.$refs.customForm.validate().then(res => {
|
||||||
}
|
|
||||||
}
|
}).catch(err => {
|
||||||
|
console.log('err', err);
|
||||||
|
})
|
||||||
|
await that.$api.empneedCreate(that.form)
|
||||||
|
uni.navigateBack()
|
||||||
|
},
|
||||||
|
getLabel(list, value) {
|
||||||
|
if (!list || value === undefined || value === null) return ''
|
||||||
|
const item = list.find(i => String(i.value) === String(value))
|
||||||
|
return item ? item.text : ''
|
||||||
|
},
|
||||||
|
educationChange(val) {
|
||||||
|
const item = this.educationList.find(i => i.value === val)
|
||||||
|
this.form.education_name = item ? item.text : ''
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,186 @@
|
||||||
|
<!-- 请假申请 -->
|
||||||
|
<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="请假时长(一天8h计算)" required>
|
||||||
|
<uni-number-box v-model="form.hour" :min="0" v-if="mode!='show'"></uni-number-box>
|
||||||
|
<span v-else>{{form.hour}}小时</span>
|
||||||
|
</uni-forms-item>
|
||||||
|
<uni-forms-item label="开始日期" required>
|
||||||
|
<uni-datetime-picker type="datetime" :clear-icon="false" v-model="form.start_date" v-if="mode!='show'"/>
|
||||||
|
<span v-else>{{form.start_date}}</span>
|
||||||
|
</uni-forms-item>
|
||||||
|
<uni-forms-item label="结束日期" required>
|
||||||
|
<uni-datetime-picker type="datetime" :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.leave_type"
|
||||||
|
:localdata="leaveList"
|
||||||
|
:disabled="mode=='show'"
|
||||||
|
@change="leaveChange"
|
||||||
|
></uni-data-select>
|
||||||
|
<span v-else>{{getLabel(leaveList,form.leave_type) }}</span>
|
||||||
|
</uni-forms-item>
|
||||||
|
|
||||||
|
<uni-forms-item label-width="100" label="请假事由" required>
|
||||||
|
<textarea placeholder-style="color:#efefef" v-model="form.reason" placeholder="" style="width:100%; border: 2upx solid #e5e5e5;padding: 10upx;"/>
|
||||||
|
</uni-forms-item>
|
||||||
|
<uni-forms-item label="上传附件" v-if="showUpload">
|
||||||
|
<xtUpload v-model="form.file" xtype="path" :disabled="mode=='show'"></xtUpload>
|
||||||
|
</uni-forms-item>
|
||||||
|
</uni-forms>
|
||||||
|
</scroll-view>
|
||||||
|
<view class="footer_fixed">
|
||||||
|
<button v-if="mode=='edit'" size="mini" @click="handleDel" :loading="saveLoading" :disabled="saveLoading" type="warn">
|
||||||
|
删除
|
||||||
|
</button>
|
||||||
|
<button v-if="mode!='show'" size="mini" @click="handleSave" :loading="saveLoading" :disabled="saveLoading" type="primary">
|
||||||
|
提交审批
|
||||||
|
</button>
|
||||||
|
<ticketd_b :workflow_key="'wf_leave'" v-if="form.ticket_ && mode == 'show'" :t_id="form.id" :ticket_="form.ticket_"
|
||||||
|
:ticket_data="ticket_data" @success="()=>{uni.navigateBack()}" ref="ticketd_b"></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:{},
|
||||||
|
ticket_data:{},
|
||||||
|
userInfo:{},
|
||||||
|
type:0,
|
||||||
|
leaveList: [
|
||||||
|
{ value: 10, text: '事假' },
|
||||||
|
{ value: 20, text: '病假' },
|
||||||
|
{ value: 30, text: '婚假' },
|
||||||
|
{ value: 40, text: '丧假' },
|
||||||
|
{ value: 50, text: '公假' },
|
||||||
|
{ value: 60, text: '工伤' },
|
||||||
|
{ value: 70, text: '产假' },
|
||||||
|
{ value: 80, text: '护理假' },
|
||||||
|
{ value: 90, text: '其他' }
|
||||||
|
],
|
||||||
|
customRules: {
|
||||||
|
start_date: {
|
||||||
|
rules: [{
|
||||||
|
required: true,
|
||||||
|
errorMessage: '不能为空'
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
end_date: {
|
||||||
|
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) {
|
||||||
|
const res = await that.$api.leaveItem(that.t_id);
|
||||||
|
this.form = res
|
||||||
|
await this.fillNames()
|
||||||
|
if(that.form.ticket_.state_.type == 1 && that.form.create_by == uni.getStorageSync("userInfo").id ) {
|
||||||
|
that.mode = "edit";
|
||||||
|
}else{
|
||||||
|
that.mode = "show";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
that.fillNames();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
showUpload() {
|
||||||
|
return [20, 30, 40, 70].includes(this.form.leave_type)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods:{
|
||||||
|
async fillNames(){
|
||||||
|
const employee = await this.$api.employeeInfo()
|
||||||
|
this.form.employee_name = employee.name
|
||||||
|
this.form.belong_dept_name = employee.belong_dept_name
|
||||||
|
this.form.post_name = employee.post_name
|
||||||
|
this.form.employee = employee.id;
|
||||||
|
this.mode = "add";
|
||||||
|
},
|
||||||
|
async handleDel(){
|
||||||
|
let that = this;
|
||||||
|
await that.$api.leaveDelete(that.form.id)
|
||||||
|
uni.navigateBack()
|
||||||
|
},
|
||||||
|
async handleSave(){
|
||||||
|
let that = this;
|
||||||
|
that.$refs.customForm.validate().then(res => {
|
||||||
|
|
||||||
|
}).catch(err => {
|
||||||
|
console.log('err', err);
|
||||||
|
})
|
||||||
|
await that.$api.leaveCreate(that.form)
|
||||||
|
uni.navigateBack()
|
||||||
|
},
|
||||||
|
getLabel(list, value) {
|
||||||
|
if (!list || value === undefined || value === null) return ''
|
||||||
|
const item = list.find(i => String(i.value) === String(value))
|
||||||
|
return item ? item.text : ''
|
||||||
|
},
|
||||||
|
leaveChange(val) {
|
||||||
|
const map = {
|
||||||
|
10: '事假',
|
||||||
|
20: '病假',
|
||||||
|
30: '婚假',
|
||||||
|
40: '丧假',
|
||||||
|
50: '公假',
|
||||||
|
60: '工伤',
|
||||||
|
70: '产假',
|
||||||
|
80: '护理假',
|
||||||
|
90: '其他',
|
||||||
|
}
|
||||||
|
this.form.leave_type_name = map[val] || ''
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
}
|
||||||
|
</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>
|
||||||
23
utils/api.js
23
utils/api.js
|
|
@ -83,6 +83,24 @@ export default {
|
||||||
resignationCreate:(data) => http(`/hrm/resignation/`, 'POST' , data),
|
resignationCreate:(data) => http(`/hrm/resignation/`, 'POST' , data),
|
||||||
resignationItem:(id,data) => http(`/hrm/resignation/${id}/`, 'GET', data),
|
resignationItem:(id,data) => http(`/hrm/resignation/${id}/`, 'GET', data),
|
||||||
resignationDelete:(id) => http(`/hrm/resignation/${id}/`, 'DELETE'),
|
resignationDelete:(id) => http(`/hrm/resignation/${id}/`, 'DELETE'),
|
||||||
|
//人员需求申请
|
||||||
|
empneedList:(data) => http(`/hrm/empneed/`, 'GET' , data),
|
||||||
|
empneedCreate:(data) => http(`/hrm/empneed/`, 'POST' , data),
|
||||||
|
empneedItem:(id,data) => http(`/hrm/empneed/${id}/`, 'GET', data),
|
||||||
|
empneedDelete:(id) => http(`/hrm/empneed/${id}/`, 'DELETE'),
|
||||||
|
empneedUpdate:(id,data) => http(`/hrm/empneed/${id}/`, 'PUT', data),
|
||||||
|
//人员请假申请
|
||||||
|
leaveList:(data) => http(`/hrm/leave/`, 'GET' , data),
|
||||||
|
leaveCreate:(data) => http(`/hrm/leave/`, 'POST' , data),
|
||||||
|
leaveItem:(id,data) => http(`/hrm/leave/${id}/`, 'GET', data),
|
||||||
|
leaveDelete:(id) => http(`/hrm/leave/${id}/`, 'DELETE'),
|
||||||
|
leaveUpdate:(id,data) => http(`/hrm/leave/${id}/`, 'PUT', data),
|
||||||
|
//人员交接申请
|
||||||
|
empjoinList:(data) => http(`/hrm/empjoin/`, 'GET' , data),
|
||||||
|
empjoinCreate:(data) => http(`/hrm/empjoin/`, 'POST' , data),
|
||||||
|
empjoinItem:(id,data) => http(`/hrm/empjoin/${id}/`, 'GET', data),
|
||||||
|
empjoinDelete:(id) => http(`/hrm/empjoin/${id}/`, 'DELETE'),
|
||||||
|
empjoinUpdate:(id,data) => http(`/hrm/empjoin/${id}/`, 'PUT', data),
|
||||||
//供应商审核
|
//供应商审核
|
||||||
supplierauditCreate:(data) => http(`/pum/supplieraudit/`, 'POST' , data),
|
supplierauditCreate:(data) => http(`/pum/supplieraudit/`, 'POST' , data),
|
||||||
supplierauditItem:(id,data) => http(`/pum/supplieraudit/${id}/`, 'GET', data),
|
supplierauditItem:(id,data) => http(`/pum/supplieraudit/${id}/`, 'GET', data),
|
||||||
|
|
@ -91,4 +109,9 @@ export default {
|
||||||
repairCreate:(data) => http(`/em/repair/`, 'POST' , data),
|
repairCreate:(data) => http(`/em/repair/`, 'POST' , data),
|
||||||
repairItem:(id,data) => http(`/em/repair/${id}/`, 'GET', data),
|
repairItem:(id,data) => http(`/em/repair/${id}/`, 'GET', data),
|
||||||
repairDelete:(id) => http(`/em/repair/${id}/`, 'DELETE'),
|
repairDelete:(id) => http(`/em/repair/${id}/`, 'DELETE'),
|
||||||
|
//部门列表
|
||||||
|
deptList:(data) => http(`/system/dept/`, 'GET' , data),
|
||||||
|
//岗位列表
|
||||||
|
postList:(data) => http(`/system/post/`, 'GET' , data),
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,46 @@
|
||||||
|
|
||||||
|
//验证手机号
|
||||||
|
export function verifyPhone(rule, value, callback) {
|
||||||
|
let reg = /^[1][3, 4, 5, 6, 7, 8, 9][0-9]{9}$/
|
||||||
|
if(!reg.test(value)){
|
||||||
|
return callback(new Error('请输入正确的手机号码'))
|
||||||
|
}
|
||||||
|
callback()
|
||||||
|
}
|
||||||
|
|
||||||
|
//车牌号码
|
||||||
|
export function verifyCars(rule, value, callback) {
|
||||||
|
let reg = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-HJ-NP-Z][A-HJ-NP-Z0-9]{4,5}[A-HJ-NP-Z0-9挂学警港澳]$/
|
||||||
|
if(!reg.test(value)){
|
||||||
|
return callback(new Error('请输入正确的车牌号码'))
|
||||||
|
}
|
||||||
|
callback()
|
||||||
|
}
|
||||||
|
export function genTree(data) {
|
||||||
|
const result = []
|
||||||
|
if (!Array.isArray(data)) {
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
data.forEach(item => {
|
||||||
|
delete item.children
|
||||||
|
})
|
||||||
|
const map = {}
|
||||||
|
data.forEach(item => {
|
||||||
|
item.label = item.name
|
||||||
|
item.parentId = item.parent
|
||||||
|
if(item.fullname){
|
||||||
|
item.label = item.fullname
|
||||||
|
}
|
||||||
|
item.value = item.id
|
||||||
|
map[item.id] = item
|
||||||
|
})
|
||||||
|
data.forEach(item => {
|
||||||
|
const parent = map[item.parent]
|
||||||
|
if (parent) {
|
||||||
|
(parent.children || (parent.children = [])).push(item)
|
||||||
|
} else {
|
||||||
|
result.push(item)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return result
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue