feat(wms): 新增部门管理模块并重构审批流程
- 新增部门管理模块,包括部门树形结构的增删改查功能 - 重构审批流程,使用任务审批模式替代原有简单审批 - 调整请假和外出申请页面,适配新的审批流程 - 移除不必要的审批部门显示和申请类型筛选 - 更新状态显示逻辑,支持多级审批状态展示
This commit is contained in:
66
klp-ui/src/api/wms/approvalTask.js
Normal file
66
klp-ui/src/api/wms/approvalTask.js
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询审批任务列表
|
||||||
|
export function listApprovalTask(query) {
|
||||||
|
return request({
|
||||||
|
url: '/wms/approvalTask/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询审批任务详细
|
||||||
|
export function getApprovalTask(taskId) {
|
||||||
|
return request({
|
||||||
|
url: '/wms/approvalTask/' + taskId,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增审批任务
|
||||||
|
export function addApprovalTask(data) {
|
||||||
|
return request({
|
||||||
|
url: '/wms/approvalTask',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改审批任务
|
||||||
|
export function updateApprovalTask(data) {
|
||||||
|
return request({
|
||||||
|
url: '/wms/approvalTask',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除审批任务
|
||||||
|
export function delApprovalTask(taskId) {
|
||||||
|
return request({
|
||||||
|
url: '/wms/approvalTask/' + taskId,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 任务审批通过
|
||||||
|
export function resolveApprovalTask(taskId) {
|
||||||
|
return request({
|
||||||
|
url: '/wms/approval/approve',
|
||||||
|
method: 'post',
|
||||||
|
params: {
|
||||||
|
taskId: taskId
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 任务审批驳回
|
||||||
|
export function rejectApprovalTask(taskId) {
|
||||||
|
return request({
|
||||||
|
url: '/wms/approval/reject',
|
||||||
|
method: 'post',
|
||||||
|
params: {
|
||||||
|
taskId: taskId
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
44
klp-ui/src/api/wms/dept.js
Normal file
44
klp-ui/src/api/wms/dept.js
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询WMS系统部门(树形结构)列表
|
||||||
|
export function listDept(query) {
|
||||||
|
return request({
|
||||||
|
url: '/wms/dept/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询WMS系统部门(树形结构)详细
|
||||||
|
export function getDept(deptId) {
|
||||||
|
return request({
|
||||||
|
url: '/wms/dept/' + deptId,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增WMS系统部门(树形结构)
|
||||||
|
export function addDept(data) {
|
||||||
|
return request({
|
||||||
|
url: '/wms/dept',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改WMS系统部门(树形结构)
|
||||||
|
export function updateDept(data) {
|
||||||
|
return request({
|
||||||
|
url: '/wms/dept',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除WMS系统部门(树形结构)
|
||||||
|
export function delDept(deptId) {
|
||||||
|
return request({
|
||||||
|
url: '/wms/dept/' + deptId,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -8,10 +8,10 @@
|
|||||||
</template>
|
</template>
|
||||||
<!-- 左侧是新增表单 -->
|
<!-- 左侧是新增表单 -->
|
||||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px" v-loading="loading">
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px" v-loading="loading">
|
||||||
<el-form-item label="审批部门" prop="applicantDeptName">
|
<el-form-item label="审批部门" prop="deptId">
|
||||||
<el-select v-model="form.applicantDeptName" placeholder="请选择审批部门" filterable @change="getDeptLeader">
|
<el-select v-model="form.deptId" placeholder="请选择审批部门" filterable @change="getDeptLeader">
|
||||||
<el-option v-for="item in deptOptions" :key="item.deptId"
|
<el-option v-for="item in deptOptions" :key="item.deptId"
|
||||||
:label="item.deptName + '(' + (item.leader || '无负责人') + ')'" :value="item.deptName"></el-option>
|
:label="item.deptName + '(' + (item.leaderNickName || '无负责人') + ')'" :value="item.deptId"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="外出类型" prop="outType">
|
<el-form-item label="外出类型" prop="outType">
|
||||||
@@ -64,13 +64,13 @@
|
|||||||
<el-button style="float: right;" icon="el-icon-refresh" @click="getList">刷新</el-button>
|
<el-button style="float: right;" icon="el-icon-refresh" @click="getList">刷新</el-button>
|
||||||
</template>
|
</template>
|
||||||
<el-table v-loading="loading" :data="leaveRequestList">
|
<el-table v-loading="loading" :data="leaveRequestList">
|
||||||
<el-table-column prop="approvalStatus" label="审批状态" align="center">
|
<!-- <el-table-column prop="approvalStatus" label="审批状态" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-tag :type="getStatusTagType(scope.row.approvalStatus)">
|
<el-tag :type="getStatusTagType(scope.row.approvalStatus)">
|
||||||
{{ getStatusText(scope.row.approvalStatus) }}
|
{{ getStatusText(scope.row.approvalStatus) }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column> -->
|
||||||
<el-table-column label="外出类型" align="center" prop="outType">
|
<el-table-column label="外出类型" align="center" prop="outType">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<dict-tag :options="dict.type.hrm_out_type" :value="scope.row.outType" />
|
<dict-tag :options="dict.type.hrm_out_type" :value="scope.row.outType" />
|
||||||
@@ -81,7 +81,15 @@
|
|||||||
<dict-tag :options="dict.type.hrm_leave_employee" :value="scope.row.applicantName" />
|
<dict-tag :options="dict.type.hrm_leave_employee" :value="scope.row.applicantName" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="审批人" align="center" prop="approverName"></el-table-column>
|
<el-table-column label="审批情况" align="center" prop="approverName">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<!-- 每行一个,不要出现换行,将英文映射成中文 -->
|
||||||
|
<el-tag v-for="task in scope.row.tasks" :key="task.taskId" :type="getTaskStatusTagType(task.taskStatus)" style="margin-right: 8px;">
|
||||||
|
<!-- taskStatus包括pending, approved, rejected, 根据状态设置不同的标签类型 -->
|
||||||
|
{{ task.approverName }} {{ getTaskStatusText(task.taskStatus) }}
|
||||||
|
</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="开始时间" align="center" prop="startTime" width="120">
|
<el-table-column label="开始时间" align="center" prop="startTime" width="120">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{ parseTime(scope.row.startTime, '{y}-{m}-{d} {h}') }}</span>
|
<span>{{ parseTime(scope.row.startTime, '{y}-{m}-{d} {h}') }}</span>
|
||||||
@@ -101,8 +109,8 @@
|
|||||||
@click="handlePrint(scope.row)">打印</el-button>
|
@click="handlePrint(scope.row)">打印</el-button>
|
||||||
<el-button icon="el-icon-edit" size="mini" @click="handleEdit(scope.row)"
|
<el-button icon="el-icon-edit" size="mini" @click="handleEdit(scope.row)"
|
||||||
v-if="scope.row.approvalStatus === '待审批'">修改</el-button>
|
v-if="scope.row.approvalStatus === '待审批'">修改</el-button>
|
||||||
<el-button icon="el-icon-delete" size="mini" @click="handleWithdraw(scope.row)"
|
<!-- <el-button icon="el-icon-delete" size="mini" @click="handleWithdraw(scope.row)"
|
||||||
v-if="scope.row.approvalStatus === '待审批'">撤回</el-button>
|
v-if="scope.row.approvalStatus === '待审批'">撤回</el-button> -->
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@@ -119,7 +127,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import { getOutRequest, addOutRequest, updateOutRequest } from "@/api/wms/outRequest";
|
import { getOutRequest, addOutRequest, updateOutRequest } from "@/api/wms/outRequest";
|
||||||
import { listApproval, updateApproval } from "@/api/wms/approval"
|
import { listApproval, updateApproval } from "@/api/wms/approval"
|
||||||
import { listDeptWithChildren } from "@/api/system/dept"
|
import { listDept } from "@/api/wms/dept"
|
||||||
import FileUpload from '@/components/FileUpload'
|
import FileUpload from '@/components/FileUpload'
|
||||||
import DictSelect from '@/components/DictSelect'
|
import DictSelect from '@/components/DictSelect'
|
||||||
import OutLabelPrinter from '../components/outLabelPrinter'
|
import OutLabelPrinter from '../components/outLabelPrinter'
|
||||||
@@ -156,7 +164,7 @@ export default {
|
|||||||
outHours: [{ required: true, message: '外出小时数不能为空', trigger: ['blur', 'change'] }],
|
outHours: [{ required: true, message: '外出小时数不能为空', trigger: ['blur', 'change'] }],
|
||||||
outPlace: [{ required: true, message: '外出地点不能为空', trigger: ['blur', 'change'] }],
|
outPlace: [{ required: true, message: '外出地点不能为空', trigger: ['blur', 'change'] }],
|
||||||
outReason: [{ required: true, message: '外出原因不能为空', trigger: ['blur', 'change'] }],
|
outReason: [{ required: true, message: '外出原因不能为空', trigger: ['blur', 'change'] }],
|
||||||
applicantDeptName: [{ required: true, message: '审批部门不能为空', trigger: 'change' }],
|
deptId: [{ required: true, message: '审批部门不能为空', trigger: 'change' }],
|
||||||
},
|
},
|
||||||
deptOptions: [],
|
deptOptions: [],
|
||||||
printerInfo: {},
|
printerInfo: {},
|
||||||
@@ -183,14 +191,14 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getDeptList() {
|
getDeptList() {
|
||||||
listDeptWithChildren("2009923867307630594").then(response => {
|
listDept().then(response => {
|
||||||
this.deptOptions = response.data
|
this.deptOptions = response.data
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 获取部门负责人
|
// 获取部门负责人
|
||||||
getDeptLeader() {
|
getDeptLeader() {
|
||||||
const selectedDept = this.deptOptions.find(item => item.deptName === this.form.applicantDeptName)
|
const selectedDept = this.deptOptions.find(item => item.deptId === this.form.deptId)
|
||||||
const approverName = selectedDept.leader;
|
const approverName = selectedDept.leaderNickName;
|
||||||
if (!approverName) {
|
if (!approverName) {
|
||||||
this.$message.warning('该部门无负责人,申请将无人审批');
|
this.$message.warning('该部门无负责人,申请将无人审批');
|
||||||
return;
|
return;
|
||||||
@@ -208,6 +216,7 @@ export default {
|
|||||||
approvalId: item.approval.approvalId,
|
approvalId: item.approval.approvalId,
|
||||||
approvalType: item.approval.approvalType,
|
approvalType: item.approval.approvalType,
|
||||||
approverName: item.approval.approverName,
|
approverName: item.approval.approverName,
|
||||||
|
tasks: item.tasks,
|
||||||
...item.detail,
|
...item.detail,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -225,7 +234,7 @@ export default {
|
|||||||
outTitle: undefined,
|
outTitle: undefined,
|
||||||
outType: undefined,
|
outType: undefined,
|
||||||
applicantName: undefined,
|
applicantName: undefined,
|
||||||
applicantDeptName: undefined,
|
deptId: undefined,
|
||||||
startTime: undefined,
|
startTime: undefined,
|
||||||
endTime: undefined,
|
endTime: undefined,
|
||||||
outHours: undefined,
|
outHours: undefined,
|
||||||
@@ -237,7 +246,8 @@ export default {
|
|||||||
updateBy: undefined,
|
updateBy: undefined,
|
||||||
updateTime: undefined,
|
updateTime: undefined,
|
||||||
delFlag: undefined,
|
delFlag: undefined,
|
||||||
remark: undefined
|
remark: undefined,
|
||||||
|
approvalType: 'single'
|
||||||
};
|
};
|
||||||
this.resetForm("form");
|
this.resetForm("form");
|
||||||
},
|
},
|
||||||
@@ -353,6 +363,24 @@ export default {
|
|||||||
}
|
}
|
||||||
return textMap[status] || '未知状态'
|
return textMap[status] || '未知状态'
|
||||||
},
|
},
|
||||||
|
// 获取任务状态的中文文本
|
||||||
|
getTaskStatusText(status) {
|
||||||
|
const textMap = {
|
||||||
|
'pending': '待审批',
|
||||||
|
'approved': '已同意',
|
||||||
|
'rejected': '已驳回'
|
||||||
|
}
|
||||||
|
return textMap[status] || status
|
||||||
|
},
|
||||||
|
// 获取任务状态的标签类型
|
||||||
|
getTaskStatusTagType(status) {
|
||||||
|
const typeMap = {
|
||||||
|
'pending': 'warning',
|
||||||
|
'approved': 'success',
|
||||||
|
'rejected': 'danger'
|
||||||
|
}
|
||||||
|
return typeMap[status] || 'info'
|
||||||
|
},
|
||||||
// 核心新增:自动计算外出小时数的方法
|
// 核心新增:自动计算外出小时数的方法
|
||||||
calculateLeaveDays() {
|
calculateLeaveDays() {
|
||||||
const { startTime, endTime } = this.form;
|
const { startTime, endTime } = this.form;
|
||||||
|
|||||||
@@ -8,10 +8,10 @@
|
|||||||
</template>
|
</template>
|
||||||
<!-- 左侧是新增表单 -->
|
<!-- 左侧是新增表单 -->
|
||||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px" v-loading="loading">
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px" v-loading="loading">
|
||||||
<el-form-item label="审批部门" prop="applicantDeptName">
|
<el-form-item label="审批部门" prop="deptId">
|
||||||
<el-select v-model="form.applicantDeptName" placeholder="请选择审批部门" filterable @change="getDeptLeader">
|
<el-select v-model="form.deptId" placeholder="请选择审批部门" filterable @change="getDeptLeader">
|
||||||
<el-option v-for="item in deptOptions" :key="item.deptId"
|
<el-option v-for="item in deptOptions" :key="item.deptId"
|
||||||
:label="item.deptName + '(' + (item.leader || '无负责人') + ')'" :value="item.deptName"></el-option>
|
:label="item.deptName + '(' + (item.leaderNickName || '无负责人') + ')'" :value="item.deptId"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="请假类型" prop="leaveType">
|
<el-form-item label="请假类型" prop="leaveType">
|
||||||
@@ -109,7 +109,15 @@
|
|||||||
<dict-tag :options="dict.type.hrm_leave_employee" :value="scope.row.applicantName" />
|
<dict-tag :options="dict.type.hrm_leave_employee" :value="scope.row.applicantName" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="审批人" align="center" prop="approverName"></el-table-column>
|
<el-table-column label="审批情况" align="center" prop="approverName">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<!-- 每行一个,不要出现换行,将英文映射成中文 -->
|
||||||
|
<el-tag v-for="task in scope.row.tasks" :key="task.taskId" :type="getTaskStatusTagType(task.taskStatus)" style="margin-right: 8px;">
|
||||||
|
<!-- taskStatus包括pending, approved, rejected, 根据状态设置不同的标签类型 -->
|
||||||
|
{{ task.approverName }} {{ getTaskStatusText(task.taskStatus) }}
|
||||||
|
</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="开始时间" align="center" prop="startTime" width="120">
|
<el-table-column label="开始时间" align="center" prop="startTime" width="120">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{ parseTime(scope.row.startTime, '{y}-{m}-{d} {h}') }}</span>
|
<span>{{ parseTime(scope.row.startTime, '{y}-{m}-{d} {h}') }}</span>
|
||||||
@@ -130,7 +138,7 @@
|
|||||||
<el-table-column label="操作" align="center" width="160">
|
<el-table-column label="操作" align="center" width="160">
|
||||||
<template slot-scope="scope" v-if="scope.row.approvalStatus === '待审批'">
|
<template slot-scope="scope" v-if="scope.row.approvalStatus === '待审批'">
|
||||||
<el-button icon="el-icon-edit" size="mini" @click="handleEdit(scope.row)">修改</el-button>
|
<el-button icon="el-icon-edit" size="mini" @click="handleEdit(scope.row)">修改</el-button>
|
||||||
<el-button icon="el-icon-delete" size="mini" @click="handleWithdraw(scope.row)">撤回</el-button>
|
<!-- <el-button icon="el-icon-delete" size="mini" @click="handleWithdraw(scope.row)">撤回</el-button> -->
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@@ -145,7 +153,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import { getLeaveRequest, addLeaveRequest, updateLeaveRequest } from "@/api/wms/leaveRequest";
|
import { getLeaveRequest, addLeaveRequest, updateLeaveRequest } from "@/api/wms/leaveRequest";
|
||||||
import { listApproval, updateApproval } from "@/api/wms/approval"
|
import { listApproval, updateApproval } from "@/api/wms/approval"
|
||||||
import { listDeptWithChildren } from "@/api/system/dept"
|
import { listDept } from "@/api/wms/dept"
|
||||||
import FileUpload from '@/components/FileUpload'
|
import FileUpload from '@/components/FileUpload'
|
||||||
import DictSelect from '@/components/DictSelect'
|
import DictSelect from '@/components/DictSelect'
|
||||||
|
|
||||||
@@ -183,7 +191,7 @@ export default {
|
|||||||
rules: {
|
rules: {
|
||||||
leaveType: [{ required: true, message: '请假类型不能为空', trigger: 'change' }],
|
leaveType: [{ required: true, message: '请假类型不能为空', trigger: 'change' }],
|
||||||
applicantName: [{ required: true, message: '请假人姓名不能为空', trigger: 'change' }],
|
applicantName: [{ required: true, message: '请假人姓名不能为空', trigger: 'change' }],
|
||||||
applicantDeptName: [{ required: true, message: '审批部门不能为空', trigger: 'change' }],
|
deptId: [{ required: true, message: '审批部门不能为空', trigger: 'change' }],
|
||||||
attachmentUrls: [{ required: false }],
|
attachmentUrls: [{ required: false }],
|
||||||
remark: [{ required: false }],
|
remark: [{ required: false }],
|
||||||
// 数组项的校验规则
|
// 数组项的校验规则
|
||||||
@@ -204,14 +212,14 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getDeptList() {
|
getDeptList() {
|
||||||
listDeptWithChildren("2009923867307630594").then(response => {
|
listDept().then(response => {
|
||||||
this.deptOptions = response.data
|
this.deptOptions = response.data
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 获取部门负责人
|
// 获取部门负责人
|
||||||
getDeptLeader() {
|
getDeptLeader() {
|
||||||
const selectedDept = this.deptOptions.find(item => item.deptName === this.form.applicantDeptName)
|
const selectedDept = this.deptOptions.find(item => item.deptId === this.form.deptId)
|
||||||
const approverName = selectedDept.leader;
|
const approverName = selectedDept.leaderNickName;
|
||||||
if (!approverName) {
|
if (!approverName) {
|
||||||
this.$message.warning('该部门无负责人,申请将无人审批');
|
this.$message.warning('该部门无负责人,申请将无人审批');
|
||||||
return;
|
return;
|
||||||
@@ -229,6 +237,7 @@ export default {
|
|||||||
approvalId: item.approval.approvalId,
|
approvalId: item.approval.approvalId,
|
||||||
approvalType: item.approval.approvalType,
|
approvalType: item.approval.approvalType,
|
||||||
approverName: item.approval.approverName,
|
approverName: item.approval.approverName,
|
||||||
|
tasks: item.tasks,
|
||||||
...item.detail,
|
...item.detail,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -263,7 +272,7 @@ export default {
|
|||||||
leaveId: undefined,
|
leaveId: undefined,
|
||||||
leaveType: undefined,
|
leaveType: undefined,
|
||||||
applicantName: undefined,
|
applicantName: undefined,
|
||||||
applicantDeptName: undefined,
|
deptId: undefined,
|
||||||
approverName: undefined,
|
approverName: undefined,
|
||||||
attachmentUrls: undefined,
|
attachmentUrls: undefined,
|
||||||
remark: undefined,
|
remark: undefined,
|
||||||
@@ -329,7 +338,7 @@ export default {
|
|||||||
// 2. 循环处理每个时段,逐个发送请求
|
// 2. 循环处理每个时段,逐个发送请求
|
||||||
for (let i = 0; i < list.length; i++) {
|
for (let i = 0; i < list.length; i++) {
|
||||||
const item = list[i];
|
const item = list[i];
|
||||||
// 组装单个请求的数据(公共字段 + 当前时段字段)
|
const approvalType = parseInt(item.leaveDays) > 3 ? 'multi' : 'single';
|
||||||
const singleRequestData = {
|
const singleRequestData = {
|
||||||
...commonFields,
|
...commonFields,
|
||||||
startTime: item.startTime,
|
startTime: item.startTime,
|
||||||
@@ -338,7 +347,8 @@ export default {
|
|||||||
leaveDays: item.leaveDays,
|
leaveDays: item.leaveDays,
|
||||||
leaveReason: item.leaveReason,
|
leaveReason: item.leaveReason,
|
||||||
// 生成单条记录的标题
|
// 生成单条记录的标题
|
||||||
leaveTitle: `${commonFields.applicantName}-${commonFields.leaveType}-时段${i+1}-${item.startTime}-${item.leaveReason || ''}`
|
leaveTitle: `${commonFields.applicantName}-${commonFields.leaveType}-时段${i+1}-${item.startTime}-${item.leaveReason || ''}`,
|
||||||
|
approvalType: approvalType,
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -418,6 +428,24 @@ export default {
|
|||||||
}
|
}
|
||||||
return textMap[status] || '未知状态'
|
return textMap[status] || '未知状态'
|
||||||
},
|
},
|
||||||
|
// 获取任务状态的中文文本
|
||||||
|
getTaskStatusText(status) {
|
||||||
|
const textMap = {
|
||||||
|
'pending': '待审批',
|
||||||
|
'approved': '已同意',
|
||||||
|
'rejected': '已驳回'
|
||||||
|
}
|
||||||
|
return textMap[status] || status
|
||||||
|
},
|
||||||
|
// 获取任务状态的标签类型
|
||||||
|
getTaskStatusTagType(status) {
|
||||||
|
const typeMap = {
|
||||||
|
'pending': 'warning',
|
||||||
|
'approved': 'success',
|
||||||
|
'rejected': 'danger'
|
||||||
|
}
|
||||||
|
return typeMap[status] || 'info'
|
||||||
|
},
|
||||||
// 计算指定行的请假天数
|
// 计算指定行的请假天数
|
||||||
calculateLeaveDays(index) {
|
calculateLeaveDays(index) {
|
||||||
const item = this.form.list[index];
|
const item = this.form.list[index];
|
||||||
|
|||||||
300
klp-ui/src/views/wms/hrm/dept/index.vue
Normal file
300
klp-ui/src/views/wms/hrm/dept/index.vue
Normal file
@@ -0,0 +1,300 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
|
<el-form-item label="部门名称" prop="deptName">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.deptName"
|
||||||
|
placeholder="请输入部门名称"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
icon="el-icon-plus"
|
||||||
|
size="mini"
|
||||||
|
@click="handleAdd"
|
||||||
|
>新增</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="info"
|
||||||
|
plain
|
||||||
|
icon="el-icon-sort"
|
||||||
|
size="mini"
|
||||||
|
@click="toggleExpandAll"
|
||||||
|
>展开/折叠</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table
|
||||||
|
v-if="refreshTable"
|
||||||
|
v-loading="loading"
|
||||||
|
:data="deptList"
|
||||||
|
row-key="deptId"
|
||||||
|
:default-expand-all="isExpandAll"
|
||||||
|
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
||||||
|
>
|
||||||
|
<el-table-column label="部门名称" align="center" prop="deptName" />
|
||||||
|
<el-table-column label="部门显示顺序" align="center" prop="orderNum" />
|
||||||
|
<el-table-column label="部门负责人" align="center" prop="leaderNickName" />
|
||||||
|
<el-table-column label="备注" align="center" prop="remark" />
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-edit"
|
||||||
|
@click="handleUpdate(scope.row)"
|
||||||
|
>修改</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-plus"
|
||||||
|
@click="handleAdd(scope.row)"
|
||||||
|
>新增</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
@click="handleDelete(scope.row)"
|
||||||
|
>删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<!-- 添加或修改办公部门对话框 -->
|
||||||
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||||
|
<el-form-item label="父部门id" prop="parentId">
|
||||||
|
<treeselect v-model="form.parentId" :options="deptOptions" :normalizer="normalizer" placeholder="请选择父部门id" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="部门名称" prop="deptName">
|
||||||
|
<el-input v-model="form.deptName" placeholder="请输入部门名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="部门显示顺序" prop="orderNum">
|
||||||
|
<el-input v-model="form.orderNum" placeholder="请输入部门显示顺序" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="部门负责人" prop="leader">
|
||||||
|
<!-- <el-input v-model="form.leader" placeholder="请输入部门负责人" /> -->
|
||||||
|
<el-select v-model="form.leader" placeholder="请选择部门负责人">
|
||||||
|
<el-option v-for="item in userOptions" :key="item.id" :label="item.label" :value="item.id" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { listDept, getDept, delDept, addDept, updateDept } from "@/api/wms/dept";
|
||||||
|
import { listUser } from "@/api/system/user";
|
||||||
|
import Treeselect from "@riophae/vue-treeselect";
|
||||||
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "Dept",
|
||||||
|
components: {
|
||||||
|
Treeselect
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 按钮loading
|
||||||
|
buttonLoading: false,
|
||||||
|
// 遮罩层
|
||||||
|
loading: true,
|
||||||
|
// 显示搜索条件
|
||||||
|
showSearch: true,
|
||||||
|
// 办公部门表格数据
|
||||||
|
deptList: [],
|
||||||
|
// 办公部门树选项
|
||||||
|
deptOptions: [],
|
||||||
|
// 弹出层标题
|
||||||
|
title: "",
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
// 是否展开,默认全部展开
|
||||||
|
isExpandAll: true,
|
||||||
|
// 重新渲染表格状态
|
||||||
|
refreshTable: true,
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
deptName: undefined,
|
||||||
|
leader: undefined,
|
||||||
|
},
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
// 表单校验
|
||||||
|
rules: {
|
||||||
|
},
|
||||||
|
userOptions: []
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
this.getUserList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/** 查询办公部门列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
listDept(this.queryParams).then(response => {
|
||||||
|
this.deptList = this.handleTree(response.data, "deptId", "parentId");
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 查询用户列表 */
|
||||||
|
getUserList() {
|
||||||
|
listUser({ pageSize: 1000 }).then(response => {
|
||||||
|
this.userOptions = response.rows.map(item => ({
|
||||||
|
id: item.userId,
|
||||||
|
label: item.nickName
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 转换办公部门数据结构 */
|
||||||
|
normalizer(node) {
|
||||||
|
if (node.children && !node.children.length) {
|
||||||
|
delete node.children;
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
id: node.deptId,
|
||||||
|
label: node.deptName,
|
||||||
|
children: node.children
|
||||||
|
};
|
||||||
|
},
|
||||||
|
/** 查询办公部门下拉树结构 */
|
||||||
|
getTreeselect() {
|
||||||
|
listDept().then(response => {
|
||||||
|
this.deptOptions = [];
|
||||||
|
const data = { deptId: 0, deptName: '顶级节点', children: [] };
|
||||||
|
data.children = this.handleTree(response.data, "deptId", "parentId");
|
||||||
|
this.deptOptions.push(data);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 取消按钮
|
||||||
|
cancel() {
|
||||||
|
this.open = false;
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
// 表单重置
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
deptId: null,
|
||||||
|
parentId: null,
|
||||||
|
deptName: null,
|
||||||
|
orderNum: null,
|
||||||
|
leader: null,
|
||||||
|
status: null,
|
||||||
|
delFlag: null,
|
||||||
|
remark: null,
|
||||||
|
createTime: null,
|
||||||
|
createBy: null,
|
||||||
|
updateTime: null,
|
||||||
|
updateBy: null
|
||||||
|
};
|
||||||
|
this.resetForm("form");
|
||||||
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
resetQuery() {
|
||||||
|
this.resetForm("queryForm");
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
handleAdd(row) {
|
||||||
|
this.reset();
|
||||||
|
this.getTreeselect();
|
||||||
|
if (row != null && row.deptId) {
|
||||||
|
this.form.parentId = row.deptId;
|
||||||
|
} else {
|
||||||
|
this.form.parentId = 0;
|
||||||
|
}
|
||||||
|
this.open = true;
|
||||||
|
this.title = "添加办公部门";
|
||||||
|
},
|
||||||
|
/** 展开/折叠操作 */
|
||||||
|
toggleExpandAll() {
|
||||||
|
this.refreshTable = false;
|
||||||
|
this.isExpandAll = !this.isExpandAll;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.refreshTable = true;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
handleUpdate(row) {
|
||||||
|
this.loading = true;
|
||||||
|
this.reset();
|
||||||
|
this.getTreeselect();
|
||||||
|
if (row != null) {
|
||||||
|
this.form.parentId = row.deptId;
|
||||||
|
}
|
||||||
|
getDept(row.deptId).then(response => {
|
||||||
|
this.loading = false;
|
||||||
|
this.form = response.data;
|
||||||
|
this.open = true;
|
||||||
|
this.title = "修改办公部门";
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 提交按钮 */
|
||||||
|
submitForm() {
|
||||||
|
this.$refs["form"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
this.buttonLoading = true;
|
||||||
|
if (this.form.deptId != null) {
|
||||||
|
updateDept(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("修改成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
}).finally(() => {
|
||||||
|
this.buttonLoading = false;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
addDept(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("新增成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
}).finally(() => {
|
||||||
|
this.buttonLoading = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
handleDelete(row) {
|
||||||
|
this.$modal.confirm('是否确认删除办公部门编号为"' + row.deptId + '"的数据项?').then(() => {
|
||||||
|
this.loading = true;
|
||||||
|
return delDept(row.deptId);
|
||||||
|
}).then(() => {
|
||||||
|
this.loading = false;
|
||||||
|
this.getList();
|
||||||
|
this.$modal.msgSuccess("删除成功");
|
||||||
|
}).catch(() => {
|
||||||
|
}).finally(() => {
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
<!-- <h4>筛选条件</h4> -->
|
<!-- <h4>筛选条件</h4> -->
|
||||||
|
|
||||||
<!-- 申请类型:自定义选项卡替代el-tabs -->
|
<!-- 申请类型:自定义选项卡替代el-tabs -->
|
||||||
<div class="custom-tabs">
|
<!-- <div class="custom-tabs">
|
||||||
<div class="custom-tabs-header">申请类型</div>
|
<div class="custom-tabs-header">申请类型</div>
|
||||||
<div class="custom-tabs-nav">
|
<div class="custom-tabs-nav">
|
||||||
<div
|
<div
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
外出
|
外出
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div> -->
|
||||||
|
|
||||||
<!-- 审批状态:自定义选项卡替代el-tabs -->
|
<!-- 审批状态:自定义选项卡替代el-tabs -->
|
||||||
<div class="custom-tabs">
|
<div class="custom-tabs">
|
||||||
@@ -99,7 +99,7 @@
|
|||||||
{{ getApplyTypeText(scope.row.applyType) }}
|
{{ getApplyTypeText(scope.row.applyType) }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="applicantDeptName" label="审批部门" align="center" show-overflow-tooltip/>
|
<!-- <el-table-column prop="applicantDeptName" label="审批部门" align="center" show-overflow-tooltip/> -->
|
||||||
<el-table-column prop="startTime" label="开始时间" align="center">
|
<el-table-column prop="startTime" label="开始时间" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{ scope.row.startTime ? formatTime(scope.row.startTime) : '-' }}
|
{{ scope.row.startTime ? formatTime(scope.row.startTime) : '-' }}
|
||||||
@@ -110,10 +110,10 @@
|
|||||||
{{ scope.row.endTime ? formatTime(scope.row.endTime) : '-' }}
|
{{ scope.row.endTime ? formatTime(scope.row.endTime) : '-' }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="approvalStatus" label="审批状态" align="center">
|
<el-table-column prop="taskStatus" label="审批状态" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-tag :type="getStatusTagType(scope.row.approvalStatus)">
|
<el-tag :type="getStatusTagType(scope.row.taskStatus)">
|
||||||
{{ getStatusText(scope.row.approvalStatus) }}
|
{{ getStatusText(scope.row.taskStatus) }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@@ -207,7 +207,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { listApproval, updateApproval } from '@/api/wms/approval'
|
import { listApprovalTask, rejectApprovalTask, resolveApprovalTask } from '@/api/wms/approvalTask'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'TodoList',
|
name: 'TodoList',
|
||||||
@@ -234,6 +234,9 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
nickName() {
|
nickName() {
|
||||||
return this.$store.getters.nickName
|
return this.$store.getters.nickName
|
||||||
|
},
|
||||||
|
userId() {
|
||||||
|
return this.$store.getters.id
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
@@ -247,17 +250,19 @@ export default {
|
|||||||
// 拼接请求参数,新增approveName
|
// 拼接请求参数,新增approveName
|
||||||
const requestParams = {
|
const requestParams = {
|
||||||
...this.queryParams,
|
...this.queryParams,
|
||||||
approveName: this.nickName
|
approverId: this.userId,
|
||||||
}
|
}
|
||||||
listApproval(requestParams)
|
listApprovalTask(requestParams)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
this.todoList = res.rows.map((item) => {
|
this.todoList = res.rows.map((item) => {
|
||||||
return {
|
return {
|
||||||
approvalStatus: item.approval.approvalStatus,
|
approvalStatus: item.approval.approvalStatus,
|
||||||
|
taskStatus: item.task.taskStatus,
|
||||||
applyId: item.approval.applyId,
|
applyId: item.approval.applyId,
|
||||||
approvalId: item.approval.approvalId,
|
approvalId: item.approval.approvalId,
|
||||||
applyType: item.approval.applyType,
|
applyType: item.approval.applyType,
|
||||||
approverName: item.approval.approverName,
|
approverName: item.approval.approverName,
|
||||||
|
taskId: item.task.taskId,
|
||||||
...item.detail, // 合并请假/外出的详情字段
|
...item.detail, // 合并请假/外出的详情字段
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -322,11 +327,8 @@ export default {
|
|||||||
try {
|
try {
|
||||||
const approvalTime = this.parseTime(new Date(), '{y}-{m}-{d} {h}:{i}:{s}')
|
const approvalTime = this.parseTime(new Date(), '{y}-{m}-{d} {h}:{i}:{s}')
|
||||||
// 这里替换为你的审批接口调用
|
// 这里替换为你的审批接口调用
|
||||||
await updateApproval({
|
console.log(row)
|
||||||
approvalId: row.approvalId,
|
await resolveApprovalTask(row.taskId)
|
||||||
approvalStatus: '已同意',
|
|
||||||
approvalTime: approvalTime,
|
|
||||||
})
|
|
||||||
this.$message.success('审批通过成功!')
|
this.$message.success('审批通过成功!')
|
||||||
this.getTodoList() // 重新查询列表
|
this.getTodoList() // 重新查询列表
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -346,13 +348,11 @@ export default {
|
|||||||
}).then(async ({ value }) => {
|
}).then(async ({ value }) => {
|
||||||
this.buttonLoading = true
|
this.buttonLoading = true
|
||||||
try {
|
try {
|
||||||
|
console.log(row)
|
||||||
const approvalTime = this.parseTime(new Date(), '{y}-{m}-{d} {h}:{i}:{s}')
|
const approvalTime = this.parseTime(new Date(), '{y}-{m}-{d} {h}:{i}:{s}')
|
||||||
// 这里替换为你的驳回接口调用
|
// 这里替换为你的驳回接口调用
|
||||||
await updateApproval({
|
await rejectApprovalTask(row.taskId)
|
||||||
approvalId: row.approvalId,
|
console.log(row.taskId)
|
||||||
approvalStatus: '已驳回',
|
|
||||||
approvalTime: approvalTime,
|
|
||||||
})
|
|
||||||
this.$message.success('驳回成功!')
|
this.$message.success('驳回成功!')
|
||||||
this.getTodoList() // 重新查询列表
|
this.getTodoList() // 重新查询列表
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -372,10 +372,10 @@ export default {
|
|||||||
// 获取审批状态对应的标签类型
|
// 获取审批状态对应的标签类型
|
||||||
getStatusTagType(status) {
|
getStatusTagType(status) {
|
||||||
const typeMap = {
|
const typeMap = {
|
||||||
'待审批': 'warning',
|
'pending': 'warning',
|
||||||
'已同意': 'success',
|
'approved': 'success',
|
||||||
'已驳回': 'danger',
|
'rejected': 'danger',
|
||||||
'已撤销': 'info',
|
'withdrawn': 'info',
|
||||||
}
|
}
|
||||||
return typeMap[status] || 'default'
|
return typeMap[status] || 'default'
|
||||||
},
|
},
|
||||||
@@ -383,10 +383,10 @@ export default {
|
|||||||
// 获取审批状态的中文文本
|
// 获取审批状态的中文文本
|
||||||
getStatusText(status) {
|
getStatusText(status) {
|
||||||
const textMap = {
|
const textMap = {
|
||||||
'待审批': '待审批',
|
'pending': '待审批',
|
||||||
'已同意': '已同意',
|
'approved': '已同意',
|
||||||
'已驳回': '已驳回',
|
'rejected': '已驳回',
|
||||||
'已撤销': '已撤销',
|
'withdrawn': '已撤销',
|
||||||
}
|
}
|
||||||
return textMap[status] || '未知状态'
|
return textMap[status] || '未知状态'
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user