feat: 添加离职申请表
This commit is contained in:
parent
48fd229a69
commit
7db573871d
|
|
@ -159,6 +159,33 @@ export default {
|
|||
`${config.API_URL}/hrm/attendance/${id}/`
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
resignation: {
|
||||
list: {
|
||||
name: "离职申请",
|
||||
req: async function(data){
|
||||
return await http.get(
|
||||
`${config.API_URL}/hrm/resignation/`,
|
||||
data
|
||||
);
|
||||
}
|
||||
},
|
||||
item: {
|
||||
name: "离职申请",
|
||||
req: async function(id){
|
||||
return await http.get(
|
||||
`${config.API_URL}/hrm/resignation/${id}/`,
|
||||
);
|
||||
}
|
||||
},
|
||||
create: {
|
||||
name: "新增",
|
||||
req: async function(data){
|
||||
return await http.post(
|
||||
`${config.API_URL}/hrm/resignation/`,
|
||||
data);
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,42 @@
|
|||
<template>
|
||||
<el-container>
|
||||
<el-header>
|
||||
<div class="left-panel">
|
||||
<el-button type="primary" @click="handleAdd">新增</el-button>
|
||||
</div>
|
||||
|
||||
</el-header>
|
||||
<el-main class="nopadding">
|
||||
<scTable
|
||||
ref="table"
|
||||
:apiObj="API.hrm.resignation.list"
|
||||
row-key="id"
|
||||
stripe
|
||||
:query="query"
|
||||
>
|
||||
<el-table-column label="姓名" prop="name" width="200"></el-table-column>
|
||||
<el-table-column label="审批状态" width="200"></el-table-column>
|
||||
<el-table-column label="部门" width="200"></el-table-column>
|
||||
<el-table-column label="岗位" width="200"></el-table-column>
|
||||
<el-table-column label="身份证号" width="300"></el-table-column>
|
||||
<el-table-column label="离职日期" width="200"></el-table-column>
|
||||
<el-table-column label="原因" ></el-table-column>
|
||||
</scTable>
|
||||
</el-main>
|
||||
</el-container>
|
||||
<el-drawer title="离职申请" v-model="drawerVisible" :size="'80%'" destroy-on-close>
|
||||
<resignation-form :mode="mode"></resignation-form>
|
||||
</el-drawer>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import API from '@/api'
|
||||
import resignationForm from './resignation_form.vue'
|
||||
const query = ref({});
|
||||
const drawerVisible = ref(false);
|
||||
const mode = ref('add');
|
||||
const handleAdd = () => {
|
||||
mode.value = 'add';
|
||||
drawerVisible.value = true;
|
||||
}
|
||||
</script>
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
<template>
|
||||
<el-form label-width="80px" :model="formData" style="padding: 20px;">
|
||||
<el-form-item label="员工信息" required>
|
||||
{{ formData.employee_name }}({{ formData.belong_dept_name }} - {{ formData.post_name }})
|
||||
</el-form-item>
|
||||
<el-form-item label="离职日期" required>
|
||||
<el-date-picker
|
||||
v-model="formData.resign_date"
|
||||
type="date"
|
||||
placeholder="预计离职日期"
|
||||
style="width: 100%;"
|
||||
:readonly="mode === 'show'"
|
||||
></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="离职原因" required>
|
||||
<el-input
|
||||
type="textarea"
|
||||
:rows="4"
|
||||
v-model="formData.reason"
|
||||
placeholder="请输入离职原因"
|
||||
:readonly="mode === 'show'"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<ticketd_b
|
||||
:workflow_key="'resignation'"
|
||||
:title="formData.employee_name + '的离职申请'"
|
||||
:t_id="formData.id"
|
||||
:ticket_="formData.ticket_"
|
||||
@success="()=>{$emit('success')}"
|
||||
:submit_b_func="submit_b_func"
|
||||
ref="ticketd_b"
|
||||
></ticketd_b>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref, onMounted, defineProps } from 'vue'
|
||||
import ticketd_b from "@/views/wf/ticketd_b.vue";
|
||||
import ticketd from '@/views/wf/ticketd.vue'
|
||||
import API from '@/api'
|
||||
import TOOL from "@/utils/tool.js";
|
||||
|
||||
const props = defineProps({
|
||||
mode: { type: String, default: 'show' },
|
||||
t_id: { type: String, default: "" },
|
||||
});
|
||||
const formData = ref({});
|
||||
const mode = ref(props.mode);
|
||||
onMounted(async () =>{
|
||||
if(props.t_id){
|
||||
getTid();
|
||||
}else{
|
||||
let res = await API.hrm.employee.read.req();
|
||||
formData.value.employee_name = res.name;
|
||||
formData.value.belong_dept_name = res.belong_dept_name;
|
||||
formData.value.post_name = res.post_name;
|
||||
formData.value.employee = res.id;
|
||||
}
|
||||
})
|
||||
const getTid = async () => {
|
||||
let res = await API.hrm.resignation.item.req(props.t_id);
|
||||
formData.value = res;
|
||||
if(res.ticket_.state_.type == 1 && res.create_by == TOOL.data.get("USER_INFO").id ) {
|
||||
mode.value = "edit";
|
||||
}else{
|
||||
mode.value = "show";
|
||||
}
|
||||
};
|
||||
const submit_b_func = async ()=>{
|
||||
if (mode.value == "add") {
|
||||
await API.hrm.resignation.create.req(formData.value);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Loading…
Reference in New Issue