This commit is contained in:
123 2025-05-15 11:45:19 +08:00
parent d9640b681a
commit e2d0c38306
6 changed files with 180 additions and 140 deletions

View File

@ -67,7 +67,6 @@ export interface UserForm {
remark?: string;
postIds: string[];
roleIds: string[];
employeeName?: string;
}

View File

@ -3,7 +3,7 @@ import { AxiosPromise } from 'axios';
import { BusinessTripVO, BusinessTripQuery, BusinessTripForm } from '@/api/workflow/businessTrip/types';
/**
*
*
* @param query
* @returns {*}
*/
@ -17,7 +17,7 @@ export const listBusinessTrip = (query?: BusinessTripQuery): AxiosPromise<Busine
};
/**
*
*
* @param id
*/
export const getBusinessTrip = (id: string | number): AxiosPromise<BusinessTripVO> => {
@ -28,7 +28,7 @@ export const getBusinessTrip = (id: string | number): AxiosPromise<BusinessTripV
};
/**
*
*
* @param data
*/
export const addBusinessTrip = (data: BusinessTripForm): AxiosPromise<BusinessTripVO> => {
@ -40,7 +40,7 @@ export const addBusinessTrip = (data: BusinessTripForm): AxiosPromise<BusinessTr
};
/**
*
*
* @param data
*/
export const updateBusinessTrip = (data: BusinessTripForm): AxiosPromise<BusinessTripVO> => {
@ -52,7 +52,7 @@ export const updateBusinessTrip = (data: BusinessTripForm): AxiosPromise<Busines
};
/**
*
*
* @param id
*/
export const delBusinessTrip = (id: string | number | Array<string | number>) => {

View File

@ -1,9 +1,10 @@
export interface BusinessTripVO {
id: string | number;
leaveType: string;
tripType: string;
startDate: string;
endDate: string;
tripDays: number;
budgetType?: string;
remark: string;
status?: string;
}
@ -14,7 +15,12 @@ export interface BusinessTripForm extends BaseEntity {
startDate?: string;
endDate?: string;
tripDays?: number;
tripMoney?: number;
reason?: string;
budgetType?: string;
currentProjects?: string;
remark?: string;
attachment?: string;
status?: string;
}

View File

@ -177,6 +177,20 @@ export const dynamicRoutes: RouteRecordRaw[] = [
}
]
},
{
path: '/workflow/tripEdit',
component: Layout,
hidden: true,
permissions: ['workflow:businessTrip:edit'],
children: [
{
path: 'index',
component: () => import('@/views/workflow/businessTrip/tripEdit.vue'),
name: 'tripEdit',
meta: { title: '出差申请', activeMenu: '/workflow/businessTrip', noCache: true }
}
]
},
{
path: '/workflow/design',
component: Layout,

View File

@ -3,12 +3,12 @@
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div v-show="showSearch" class="search">
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
<el-form-item label="出差天数" prop="startLeaveDays">
<el-input v-model="queryParams.startLeaveDays" placeholder="请输入出差天数" clearable @keyup.enter="handleQuery" />
<el-form-item label="出差天数" prop="startBusinessTripDays">
<el-input v-model="queryParams.startBusinessTripDays" placeholder="请输入出差天数" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item prop="endTripDays"> </el-form-item>
<el-form-item prop="endTripDays">
<el-input v-model="queryParams.endTripDays" placeholder="请输入出差天数" clearable @keyup.enter="handleQuery" />
<el-form-item prop="endBusinessTripDays"> </el-form-item>
<el-form-item prop="endBusinessTripDays">
<el-input v-model="queryParams.endBusinessTripDays" placeholder="请输入出差天数" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
@ -31,12 +31,12 @@
</el-row>
</template>
<el-table v-loading="loading" border :data="leaveList" @selection-change="handleSelectionChange">
<el-table v-loading="loading" border :data="tripList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column v-if="false" label="主键" align="center" prop="id" />
<el-table-column label="出差类型" align="center">
<el-table-column label="业务类别" align="center">
<template #default="scope">
<el-tag>{{ options.find((e) => e.value === scope.row.leaveType)?.label }}</el-tag>
<dict-tag :options="business_type" :value="scope.row.tripType" />
</template>
</el-table-column>
<el-table-column label="开始时间" align="center" prop="startDate">
@ -49,8 +49,9 @@
<span>{{ proxy.parseTime(scope.row.endDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="出差天数" align="center" prop="leaveDays" />
<el-table-column label="出差原因" align="center" prop="remark" />
<el-table-column label="出差天数" align="center" prop="tripDays" />
<el-table-column label="出差原因" align="center" prop="reason" />
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column align="center" label="流程状态" min-width="70">
<template #default="scope">
<dict-tag :options="wf_business_status" :value="scope.row.status"></dict-tag>
@ -87,59 +88,60 @@
</div>
</template>
<script setup name="Leave" lang="ts">
import { delLeave, listLeave } from '@/api/workflow/businesstrip';
<script setup name="Trip" lang="ts">
import { delBusinessTrip, listBusinessTrip } from '@/api/workflow/businessTrip';
import { cancelProcessApply } from '@/api/workflow/instance';
import { LeaveForm, LeaveQuery, LeaveVO } from '@/api/workflow/leave/types';
import { BusinessTripForm, BusinessTripQuery, BusinessTripVO } from '@/api/workflow/businessTrip/types';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { wf_business_status } = toRefs<any>(proxy?.useDict('wf_business_status'));
const leaveList = ref<LeaveVO[]>([]);
const tripList = ref<BusinessTripVO[]>([]);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref<Array<string | number>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const options = [
{
value: '1',
label: '事假'
},
{
value: '2',
label: '调休'
},
{
value: '3',
label: '病假'
},
{
value: '4',
label: '婚假'
}
];
const { business_type } = toRefs<any>(proxy?.useDict('business_type'));
// const options = [
// {
// value: '1',
// label: ''
// },
// {
// value: '2',
// label: ''
// },
// {
// value: '3',
// label: ''
// },
// {
// value: '4',
// label: ''
// }
// ];
const queryFormRef = ref<ElFormInstance>();
const data = reactive<PageData<LeaveForm, LeaveQuery>>({
const data = reactive<PageData<BusinessTripForm, BusinessTripQuery>>({
form: {},
queryParams: {
pageNum: 1,
pageSize: 10,
startLeaveDays: undefined,
endLeaveDays: undefined
startBusinessTripDays: undefined,
endBusinessTripDays: undefined
},
rules: {}
});
const { queryParams } = toRefs(data);
/** 查询请假列表 */
/** 查询出差列表 */
const getList = async () => {
loading.value = true;
const res = await listLeave(queryParams.value);
leaveList.value = res.rows;
const res = await listBusinessTrip(queryParams.value);
tripList.value = res.rows;
total.value = res.total;
loading.value = false;
};
@ -157,7 +159,7 @@ const resetQuery = () => {
};
/** 多选框选中数据 */
const handleSelectionChange = (selection: LeaveVO[]) => {
const handleSelectionChange = (selection: BusinessTripVO[]) => {
ids.value = selection.map((item) => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
@ -167,7 +169,7 @@ const handleSelectionChange = (selection: LeaveVO[]) => {
const handleAdd = () => {
proxy.$tab.closePage(proxy.$route);
proxy.$router.push({
path: `/workflow/leaveEdit/index`,
path: `/workflow/tripEdit/index`,
query: {
type: 'add'
}
@ -175,10 +177,10 @@ const handleAdd = () => {
};
/** 修改按钮操作 */
const handleUpdate = (row?: LeaveVO) => {
const handleUpdate = (row?: BusinessTripVO) => {
proxy.$tab.closePage(proxy.$route);
proxy.$router.push({
path: `/workflow/leaveEdit/index`,
path: `/workflow/tripEdit/index`,
query: {
id: row.id,
type: 'update'
@ -187,10 +189,10 @@ const handleUpdate = (row?: LeaveVO) => {
};
/** 查看按钮操作 */
const handleView = (row?: LeaveVO) => {
const handleView = (row?: BusinessTripVO) => {
proxy.$tab.closePage(proxy.$route);
proxy.$router.push({
path: `/workflow/leaveEdit/index`,
path: `/workflow/tripEdit/index`,
query: {
id: row.id,
type: 'view'
@ -199,10 +201,10 @@ const handleView = (row?: LeaveVO) => {
};
/** 删除按钮操作 */
const handleDelete = async (row?: LeaveVO) => {
const handleDelete = async (row?: BusinessTripVO) => {
const _ids = row?.id || ids.value;
await proxy?.$modal.confirm('是否确认删除请假编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
await delLeave(_ids);
await proxy?.$modal.confirm('是否确认删除出差编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
await delBusinessTrip(_ids);
proxy?.$modal.msgSuccess('删除成功');
await getList();
};
@ -210,11 +212,11 @@ const handleDelete = async (row?: LeaveVO) => {
/** 导出按钮操作 */
const handleExport = () => {
proxy?.download(
'workflow/leave/export',
'workflow/businessTrip/export',
{
...queryParams.value
},
`leave_${new Date().getTime()}.xlsx`
`businessTrip_${new Date().getTime()}.xlsx`
);
};

View File

@ -14,29 +14,46 @@
</div>
</el-card>
<el-card shadow="never" style="height: 78vh; overflow-y: auto">
<el-form ref="leaveFormRef" v-loading="loading" :disabled="routeParams.type === 'view'" :model="form" :rules="rules" label-width="80px">
<el-form-item label="请假类型" prop="leaveType">
<el-select v-model="form.leaveType" placeholder="请选择请假类型" style="width: 100%">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
<el-form ref="businessTripFormRef" v-loading="loading" :disabled="routeParams.type === 'view'" :model="form" :rules="rules" label-width="80px">
<el-form-item label="业务类别" prop="tripType">
<el-select v-model="form.tripType" placeholder="请选择业务类别" style="width: 100%">
<el-option v-for="item in business_type" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item label="请假时间">
<el-form-item label="预算事项" prop="budgetType">
<el-select v-model="form.budgetType" placeholder="请选择预算事项" style="width: 100%">
<el-option v-for="item in opr_oa_trip_budget_type" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item label="出差时间">
<el-date-picker
v-model="leaveTime"
v-model="businessTripTime"
value-format="YYYY-MM-DD HH:mm:ss"
type="daterange"
range-separator="To"
start-placeholder="开始时间"
end-placeholder="结束时间"
:default-time="[new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 1, 1, 23, 59, 59)]"
@change="changeLeaveTime()"
@change="changeBusinessTripTime()"
/>
</el-form-item>
<el-form-item label="请假天数" prop="leaveDays">
<el-input v-model="form.leaveDays" disabled type="number" placeholder="请输入请假天数" />
<el-form-item label="出差天数" prop="tripDays">
<el-input v-model="form.tripDays" disabled type="number" placeholder="请输入出差天数" />
</el-form-item>
<el-form-item label="请假原因" prop="remark">
<el-input v-model="form.remark" type="textarea" :rows="3" placeholder="请输入请假原因" />
<el-form-item label="差旅金额" prop="tripMoney">
<el-input v-model="form.tripMoney" type="number" placeholder="请输入差旅金额" style="width: 200px;"/>
</el-form-item>
<el-form-item label="在办项目" prop="currentProjects">
<el-input v-model="form.currentProjects" type="textarea" :rows="3" placeholder="请输入在办项目" />
</el-form-item>
<el-form-item label="出差原因" prop="resaon">
<el-input v-model="form.reason" type="textarea" :rows="3" placeholder="请输入出差原因" />
</el-form-item>
<el-form-item label="附件" prop="attachment">
<imageUpload v-model="form.attachment" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" :rows="3" placeholder="请输入备注" />
</el-form-item>
</el-form>
</el-card>
@ -59,8 +76,8 @@
</template>
<script setup name="Leave" lang="ts">
import { addLeave, getLeave, updateLeave } from '@/api/workflow/leave';
import { LeaveForm, LeaveQuery, LeaveVO } from '@/api/workflow/leave/types';
import { addBusinessTrip, getBusinessTrip, updateBusinessTrip } from '@/api/workflow/businessTrip';
import { BusinessTripForm, BusinessTripQuery, BusinessTripVO } from '@/api/workflow/businessTrip/types';
import { startWorkFlow } from '@/api/workflow/task';
import SubmitVerify from '@/components/Process/submitVerify.vue';
import ApprovalRecord from '@/components/Process/approvalRecord.vue';
@ -70,52 +87,54 @@ const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const buttonLoading = ref(false);
const loading = ref(true);
const leaveTime = ref<Array<string>>([]);
const businessTripTime = ref<Array<string>>([]);
//
const routeParams = ref<Record<string, any>>({});
const options = [
{
value: '1',
label: '事假'
},
{
value: '2',
label: '调休'
},
{
value: '3',
label: '病假'
},
{
value: '4',
label: '婚假'
}
];
const { business_type,opr_oa_trip_budget_type } = toRefs<any>(proxy?.useDict('business_type','opr_oa_trip_budget_type'));
// const options = [
// {
// value: '1',
// label: ''
// },
// {
// value: '2',
// label: ''
// },
// {
// value: '3',
// label: ''
// },
// {
// value: '4',
// label: ''
// }
// ];
const flowCodeOptions = [
{
value: 'leave1',
label: '请假申请-普通'
},
{
value: 'leave2',
label: '请假申请-排他网关'
},
{
value: 'leave3',
label: '请假申请-并行网关'
},
{
value: 'leave4',
label: '请假申请-会签'
},
{
value: 'leave5',
label: '请假申请-并行会签网关'
},
{
value: 'leave6',
label: '请假申请-排他并行会签'
value: 'trip1',
label: '出差申请-普通'
}
// ,
// {
// value: 'leave2',
// label: '-'
// },
// {
// value: 'leave3',
// label: '-'
// },
// {
// value: 'leave4',
// label: '-'
// },
// {
// value: 'leave5',
// label: '-'
// },
// {
// value: 'leave6',
// label: '-'
// }
];
const flowCode = ref<string>('');
@ -129,7 +148,7 @@ const submitVerifyRef = ref<InstanceType<typeof SubmitVerify>>();
//
const approvalRecordRef = ref<InstanceType<typeof ApprovalRecord>>();
const leaveFormRef = ref<ElFormInstance>();
const businessTripFormRef = ref<ElFormInstance>();
const submitFormData = ref<StartProcessBo>({
businessId: '',
@ -138,28 +157,28 @@ const submitFormData = ref<StartProcessBo>({
});
const taskVariables = ref<Record<string, any>>({});
const initFormData: LeaveForm = {
const initFormData: BusinessTripForm = {
id: undefined,
leaveType: undefined,
tripType: undefined,
startDate: undefined,
endDate: undefined,
leaveDays: undefined,
tripDays: undefined,
remark: undefined,
status: undefined
};
const data = reactive<PageData<LeaveForm, LeaveQuery>>({
const data = reactive<PageData<BusinessTripForm, BusinessTripQuery>>({
form: { ...initFormData },
queryParams: {
pageNum: 1,
pageSize: 10,
startLeaveDays: undefined,
endLeaveDays: undefined
startBusinessTripDays: undefined,
endBusinessTripDays: undefined
},
rules: {
id: [{ required: true, message: '主键不能为空', trigger: 'blur' }],
leaveType: [{ required: true, message: '请假类型不能为空', trigger: 'blur' }],
leaveTime: [{ required: true, message: '请假时间不能为空', trigger: 'blur' }],
leaveDays: [{ required: true, message: '请假天数不能为空', trigger: 'blur' }]
tripType: [{ required: true, message: '业务类别不能为空', trigger: 'blur' }],
tripTime: [{ required: true, message: '出差时间不能为空', trigger: 'blur' }],
tripDays: [{ required: true, message: '出差天数不能为空', trigger: 'blur' }]
}
});
@ -173,26 +192,26 @@ const { form, rules } = toRefs(data);
/** 表单重置 */
const reset = () => {
form.value = { ...initFormData };
leaveTime.value = [];
leaveFormRef.value?.resetFields();
businessTripTime.value = [];
businessTripFormRef.value?.resetFields();
};
const changeLeaveTime = () => {
const startDate = new Date(leaveTime.value[0]).getTime();
const endDate = new Date(leaveTime.value[1]).getTime();
const changeBusinessTripTime = () => {
const startDate = new Date(businessTripTime.value[0]).getTime();
const endDate = new Date(businessTripTime.value[1]).getTime();
const diffInMilliseconds = endDate - startDate;
form.value.leaveDays = Math.floor(diffInMilliseconds / (1000 * 60 * 60 * 24)) + 1;
form.value.tripDays = Math.floor(diffInMilliseconds / (1000 * 60 * 60 * 24)) + 1;
};
/** 获取详情 */
const getInfo = () => {
loading.value = true;
buttonLoading.value = false;
nextTick(async () => {
const res = await getLeave(routeParams.value.id);
const res = await getBusinessTrip(routeParams.value.id);
Object.assign(form.value, res.data);
leaveTime.value = [];
leaveTime.value.push(form.value.startDate);
leaveTime.value.push(form.value.endDate);
businessTripTime.value = [];
businessTripTime.value.push(form.value.startDate);
businessTripTime.value.push(form.value.endDate);
loading.value = false;
buttonLoading.value = false;
});
@ -200,21 +219,21 @@ const getInfo = () => {
/** 提交按钮 */
const submitForm = (status: string) => {
if (leaveTime.value.length === 0) {
proxy?.$modal.msgError('请假时间不能为空');
if (businessTripTime.value.length === 0) {
proxy?.$modal.msgError('出差时间不能为空');
return;
}
try {
leaveFormRef.value?.validate(async (valid: boolean) => {
form.value.startDate = leaveTime.value[0];
form.value.endDate = leaveTime.value[1];
businessTripFormRef.value?.validate(async (valid: boolean) => {
form.value.startDate = businessTripTime.value[0];
form.value.endDate = businessTripTime.value[1];
if (valid) {
buttonLoading.value = true;
let res: AxiosResponse<LeaveVO>;
let res: AxiosResponse<BusinessTripVO>;
if (form.value.id) {
res = await updateLeave(form.value);
res = await updateBusinessTrip(form.value);
} else {
res = await addLeave(form.value);
res = await addBusinessTrip(form.value);
}
form.value = res.data;
if (status === 'draft') {
@ -246,13 +265,13 @@ const submitFlow = async () => {
dialogVisible.visible = false;
};
//
const handleStartWorkFlow = async (data: LeaveForm) => {
const handleStartWorkFlow = async (data: BusinessTripForm) => {
try {
submitFormData.value.flowCode = flowCode.value;
submitFormData.value.businessId = data.id;
//
taskVariables.value = {
leaveDays: data.leaveDays,
businessTripDays: data.tripDays,
userList: ['1', '3', '4']
};
submitFormData.value.variables = taskVariables.value;