This commit is contained in:
TianyangZhang 2025-11-10 08:52:07 +08:00
commit 24e42930e5
6 changed files with 296 additions and 44 deletions

View File

@ -159,6 +159,41 @@ 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);
}
},
delete: {
name: "删除",
req: async function(id){
return await http.delete(
`${config.API_URL}/hrm/resignation/${id}/`
);
}
},
}
}

View File

@ -0,0 +1,53 @@
<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"
@row-click="(row)=>{t_id=row.id;mode='show';drawerVisible=true;}"
>
<el-table-column label="姓名" prop="employee_name" width="100" show-overflow-tooltip></el-table-column>
<el-table-column label="审批状态" width="200" show-overflow-tooltip>
<template #default="scope">
<el-tag :type="actStateEnum[scope.row.ticket_?.act_state]?.type">
{{ actStateEnum[scope.row.ticket_?.act_state]?.text }}
</el-tag>
<el-tag type="info" effect="plain">{{ scope.row.ticket_?.state_.name }}</el-tag>
</template>
</el-table-column>`
<el-table-column label="部门" prop="belong_dept_name" width="120" show-overflow-tooltip></el-table-column>`
<el-table-column label="岗位" prop="post_name" width="120" show-overflow-tooltip></el-table-column>
<el-table-column label="身份证号" prop="employee_id_number" width="200" show-overflow-tooltip></el-table-column>
<el-table-column label="离职日期" prop="end_date" width="100" show-overflow-tooltip></el-table-column>
<el-table-column label="原因" prop="reason" show-overflow-tooltip></el-table-column>
</scTable>
</el-main>
</el-container>
<el-drawer title="离职申请" v-model="drawerVisible" :size="'80%'" destroy-on-close>
<resignation-form :mode="mode" :t_id="t_id"></resignation-form>
</el-drawer>
</template>
<script setup>
import { ref } from 'vue'
import API from '@/api'
import resignationForm from './resignation_form.vue'
import { actStateEnum, interveneTypeEnum } from "@/utils/enum.js";
const query = ref({});
const drawerVisible = ref(false);
const mode = ref('add');
const t_id = ref(null);
const handleAdd = () => {
mode.value = 'add';
drawerVisible.value = true;
}
</script>

View File

@ -0,0 +1,145 @@
<template>
<el-container>
<el-main class="nopadding">
<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.end_date"
type="date"
placeholder="预计离职日期"
style="width: 100%;"
value-format="YYYY-MM-DD"
:readonly="localMode === 'show'"
></el-date-picker>
</el-form-item>
<el-form-item label="离职原因" required>
<el-input
type="textarea"
:rows="4"
v-model="formData.reason"
placeholder="请输入离职原因"
:readonly="localMode === 'show'"
></el-input>
</el-form-item>
</el-form>
<el-footer>
<el-button type="danger"
v-if="localMode=='edit'"
style="margin-right: 4px;"
@click="handleDel"
>删除</el-button>
<ticketd_b
:workflow_key="'wf_resignation'"
:title="ticketTitle"
:t_id="formData.id"
:ticket_="formData.ticket_"
@success="$emit('success', localMode)"
:submit_b_func="submit_b_func"
ref="ticketd_b"
></ticketd_b>
</el-footer>
</el-main>
<el-aside width="20%" v-if="formData.ticket_">
<ticketd :ticket_="formData.ticket_" @success="$emit('success')"></ticketd>
</el-aside>
</el-container>
</template>
<script>
import ticketd_b from "@/views/wf/ticketd_b.vue";
import ticketd from '@/views/wf/ticketd.vue'
export default {
name: 'ResignationForm',
components: {
ticketd_b,
ticketd
},
props: {
mode: {
type: String,
default: 'show'
},
t_id: {
type: String,
default: ""
}
},
data() {
return {
formData: {
employee_name: ""
},
localMode: this.mode,
ticketTitle: "离职申请"
}
},
watch: {
mode(newVal) {
this.localMode = newVal;
}
},
mounted() {
if (this.t_id) {
this.getTid();
} else {
this.initFormData();
}
},
methods: {
async initFormData() {
try {
let res = await this.$API.hrm.employee.read.req();
this.formData.employee_name = res.name;
this.formData.belong_dept_name = res.belong_dept_name;
this.formData.post_name = res.post_name;
this.formData.employee = res.id;
this.localMode = "add";
} catch (error) {
console.error('初始化表单数据失败:', error);
}
},
async getTid() {
try {
let res = await this.$API.hrm.resignation.item.req(this.t_id);
this.formData = res;
if (res.ticket_ && res.ticket_.state_.type == 1 && res.create_by == this.$TOOL.data.get("USER_INFO").id) {
this.localMode = "edit";
}
} catch (error) {
console.error('获取离职数据失败:', error);
}
},
handleDel() {
this.$confirm(`确定删除吗?`, "提示", {
type: "warning",
})
.then(()=>{
this.$API.hrm.resignation.delete.req(this.formData.id).then(res=>{
this.$message.success("删除成功");
this.$emit('success');
})
})
},
async submit_b_func() {
if (this.localMode == "add") {
try {
let res = await this.$API.hrm.resignation.create.req(this.formData);
this.ticketTitle = this.formData.employee_name + "的离职申请";
this.formData.id = res.id;
return res.id;
} catch (error) {
console.error('提交离职申请失败:', error);
throw error;
}
} else if (this.localMode == "edit") {
this.$message.error("不支持编辑");
throw new Error("不支持编辑");
}
}
}
}
</script>

View File

@ -10,12 +10,12 @@
<el-row>
<el-col :span="12">
<el-form-item label="会议名称" prop="title">
<el-input v-model="form.title" clearable placeholder="请输入会议名称" :readonly="mode === 'show'"></el-input>
<el-input v-model="form.title" clearable placeholder="请输入会议名称" :readonly="localMode === 'show'"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="会议室" prop="mroom">
<el-select v-model="form.mroom" placeholder="请选择会议室" @change="mRoomChange" style="width: 100%;" :readonly="mode === 'show'">
<el-select v-model="form.mroom" placeholder="请选择会议室" @change="mRoomChange" style="width: 100%;" :readonly="localMode === 'show'">
<el-option
v-for="item in mRoomList"
:key="item.id"
@ -27,17 +27,17 @@
</el-col>
<el-col :span="12">
<el-form-item label="参会领导" prop="key_participants">
<el-input v-model="form.key_participants" clearable placeholder="请输入参会领导" :readonly="mode === 'show'"></el-input>
<el-input v-model="form.key_participants" clearable placeholder="请输入参会领导" :readonly="localMode === 'show'"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="会议人数" prop="participant_count">
<el-input-number v-model="form.participant_count" clearable style="width: 100%;" :precision="0" :step="1" :min="1" :readonly="mode === 'show'"></el-input-number>
<el-input-number v-model="form.participant_count" clearable style="width: 100%;" :precision="0" :step="1" :min="1" :readonly="localMode === 'show'"></el-input-number>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="会议日期" prop="mdate">
<el-date-picker v-model="form.mdate" type="date" value-format="YYYY-MM-DD" style="width: 100%;" placeholder="请选择会议日期" :readonly="mode === 'show'" @change="mdateChange"></el-date-picker>
<el-date-picker v-model="form.mdate" type="date" value-format="YYYY-MM-DD" style="width: 100%;" placeholder="请选择会议日期" :readonly="localMode === 'show'" @change="mdateChange"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
@ -46,7 +46,7 @@
</el-form-item>
</el-col>
<!-- <el-col :span="24">
<el-form-item label="会议时间段" prop="slots" required v-if="mode != 'show'">
<el-form-item label="会议时间段" prop="slots" required v-if="localMode != 'show'">
<div v-for="(item,$index) in timesList" :key="item.value">
<div v-if="item.isSelect" class="timeBlock selectedTimeBlock" @click="selectTime($index)">{{ item.label }}</div>
<div v-else class="timeBlock" @click="selectTime($index)">{{ item.label }}</div>
@ -97,10 +97,6 @@ export default {
mode: {
type: String,
default: "show",
},
bookingIitem: {
type: Object,
default: null,
},
t_id: {
type: String,
@ -181,6 +177,7 @@ export default {
],
mRoomList: [],
timeselectList: [],
localMode: this.mode,
};
},
mounted() {
@ -190,12 +187,8 @@ export default {
that.getTid();
}
else {
if(that.mode=='add'){
that.form.belong_dept = that.$TOOL.data.get("USER_INFO").belong_dept;
}
else if (that.mode=='edit'||that.mode=='show'){
that.form = that.bookingIitem;
}
that.localMode = "add";
that.form.belong_dept = that.$TOOL.data.get("USER_INFO").belong_dept;
}
},
@ -212,9 +205,9 @@ export default {
that.form = res;
that.handleEidt(that.t_id);
if(res.ticket_.state_.type == 1 && res.create_by == that.$TOOL.data.get("USER_INFO").id ) {
that.$emit("changeMode", "edit");
that.localMode = "edit";
}else{
that.$emit("changeMode", "show");
that.localMode = "show";
}
})
},
@ -263,11 +256,11 @@ export default {
},
async submit_b_func() {
let that = this;
if(that.mode == "add") {
if(that.localMode == "add") {
that.form.belong_dept = that.$TOOL.data.get("USER_INFO").belong_dept;
let res = await that.$API.ofm.mroombooking.create.req(that.form);
that.form.id = res.id;
} else if (that.mode == "edit") {
} else if (that.localMode == "edit") {
await that.$API.ofm.mroombooking.update.req(that.form.id, that.form);
}
},

View File

@ -71,8 +71,6 @@
v-if="limitedVisible"
:mode="mode"
:t_id="t_id"
:bookingIitem="bookingIitem"
@changeMode="(mode)=>{this.mode=mode;}"
@success="handleSuccess"
@closed="handleCancel"
></bookingDialog>
@ -116,7 +114,6 @@ export default {
handleAdd() {
this.mode = "add";
this.t_id = null;
this.bookingIitem = {};
this.limitedVisible = true;
},
handleCancel() {
@ -130,17 +127,15 @@ export default {
let that = this;
that.mode = "show";
that.t_id = row.id;
that.bookingIitem = row;
that.limitedVisible = true;
},
async handleDel(row) {
var id = row.id;
var res = await this.$API.ofm.mroombooking.delete.req(id);
if (res.err_msg) {
this.$message.error(res.err_msg);
} else {
this.$refs.table.refresh();
try {
await this.$API.ofm.mroombooking.checkDelete.req(id);
this.$message.success("删除成功");
this.$refs.table.refresh();
} catch (error) {
}
},
//

View File

@ -2,6 +2,7 @@
<el-container>
<el-header>
<div class="left-panel">
<el-button type="primary" style="margin-right:4px" @click="()=>{dialogVisible=true;}">发起流程</el-button>
<el-segmented
v-model="tvalue"
:options="Object.keys(toptions)"
@ -81,19 +82,16 @@
{{ scope.row.workflow_.name }}
</template>
</el-table-column>
<el-table-column label="所在节点" width="160">
<el-table-column label="节点状态" width="300">
<template #default="scope">
{{ scope.row.state_.name }}
<el-tag :type="actStateEnum[scope.row.act_state]?.type">
{{ actStateEnum[scope.row.act_state]?.text }}
</el-tag>
<el-tag type="info" effect="plain">{{ scope.row.state_.name }}</el-tag>
</template>
</el-table-column>
<el-table-column label="进行状态" prop="sort" width="120">
<template #default="scope">
<el-tag :type="actStateEnum[scope.row.act_state]?.type">
{{ actStateEnum[scope.row.act_state]?.text }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="可处理人" :show-overflow-tooltip="true" min-width="160">
</el-table-column>
<el-table-column label="可处理人" :show-overflow-tooltip="true" width="200">
<template #default="scope">
<span
v-if="
@ -130,13 +128,23 @@
</el-main>
<el-drawer v-model="drawer" size="90%" :show-close="false">
<template #header="{ close, titleId, titleClass }">
<h4 :id="titleId" :class="titleClass">工单详情</h4>
<h4 :id="titleId" :class="titleClass">{{drawerName}}</h4>
<el-button type="danger" @click="close">关闭</el-button>
</template>
<component :is="currentComponent" :ticketId="ticketId" :t_id="t_id" @closed="drawer = false"
@success="()=>{drawer = false; $refs.table.refresh()}"></component>
@success="handleSuccess"></component>
</el-drawer>
</el-container>
<el-dialog v-model="dialogVisible" title="选择流程">
<el-card
v-for="item in wfOptions"
:key="item.id"
:body-style="{ padding: '10px', cursor: 'pointer' }"
style="width: 200px; display: inline-block; margin: 4px; background-color: #f5f7fa;"
shadow="hover"
@click="startTicket(item)"
>{{ item.name }}</el-card>
</el-dialog>
</template>
<script>
@ -147,6 +155,7 @@ export default {
data() {
return {
actStateEnum, interveneTypeEnum,
drawerName: "工单详情",
drawer: false,
tvalue: "待办",
toptions: {
@ -180,7 +189,8 @@ export default {
wfOptions: [],
currentComponent: null,
ticketId: null,
t_id: "",
t_id: null,
dialogVisible: false
};
},
mounted() {
@ -222,12 +232,33 @@ export default {
this.drawer = true;
this.ticketId = row.id;
this.t_id = row.ticket_data.t_id;
this.drawerName = row.title;
const viewPath = row.workflow_.view_path;
// import
this.currentComponent = markRaw(
defineAsyncComponent(() => import(`@/views${viewPath}.vue`))
);
},
startTicket(item) {
this.dialogVisible = false;
this.drawer = true;
this.t_id = null;
this.drawerName = item.name;
const viewPath = item.view_path;
// import
this.currentComponent = markRaw(
defineAsyncComponent(() => import(`@/views${viewPath}.vue`))
);
},
handleSuccess(mode) {
this.drawer = false;
if (mode == "add") {
this.tvalue = "我的";
this.params.category = "owner";
this.query = {};
}
this.$refs.table.refresh()
}
},
};
</script>