add 入库审批界面

dev
wanghao 2 months ago
parent bd4f3f9e12
commit bd3cedb854

@ -74,3 +74,14 @@ export function getWmsInStockBillList(query) {
params: query params: query
}); });
} }
/**
*
* @param data
*/
export const submitFlowData = (data: InStockBillForm) => {
return request({
url: '/wms/inStockBill/submitFlowData',
method: 'post',
data: data
});
};

@ -15,7 +15,7 @@
/> />
<el-card shadow="never" style="height: 78vh; overflow-y: auto"> <el-card shadow="never" style="height: 78vh; overflow-y: auto">
<el-form ref="addFormRef" :model="form" :rules="rules" label-width="120px" > <el-form ref="addFormRef" :model="form" :rules="rules" label-width="120px" :disabled="true">
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="入库单号" prop="inStockCode"> <el-form-item label="入库单号" prop="inStockCode">
@ -94,13 +94,12 @@
</template> </template>
<script setup name="Leave" lang="ts"> <script setup name="Leave" lang="ts">
import { LeaveForm } from '@/api/workflow/leave/types';
import { startWorkFlow } from '@/api/workflow/task'; import { startWorkFlow } from '@/api/workflow/task';
import SubmitVerify from '@/components/Process/submitVerify.vue'; import SubmitVerify from '@/components/Process/submitVerify.vue';
import ApprovalRecord from '@/components/Process/approvalRecord.vue'; import ApprovalRecord from '@/components/Process/approvalRecord.vue';
import ApprovalButton from '@/components/Process/approvalButton.vue'; import ApprovalButton from '@/components/Process/approvalButton.vue';
import { StartProcessBo } from '@/api/workflow/workflowCommon/types'; import { StartProcessBo } from '@/api/workflow/workflowCommon/types';
import { getInStockBill } from '@/api/wms/inStockBill'; import { getInStockBill, submitFlowData } from '@/api/wms/inStockBill';
import { getWmsInStockDetailsList } from '@/api/wms/inStockDetails'; import { getWmsInStockDetailsList } from '@/api/wms/inStockDetails';
import type { ComponentInternalInstance } from 'vue'; import type { ComponentInternalInstance } from 'vue';
import { getCurrentInstance, nextTick, onMounted, reactive, ref, toRefs } from 'vue'; import { getCurrentInstance, nextTick, onMounted, reactive, ref, toRefs } from 'vue';
@ -117,7 +116,7 @@ const leaveTime = ref<Array<string>>([]);
// //
const routeParams = ref<Record<string, any>>({}); const routeParams = ref<Record<string, any>>({});
// flowCode 'leave1' // flowCode 'leave1'
const flowCode = ref<string>('leave1'); const flowCode = ref<string>('wms_in');
// //
const submitVerifyRef = ref<InstanceType<typeof SubmitVerify>>(); const submitVerifyRef = ref<InstanceType<typeof SubmitVerify>>();
// //
@ -183,7 +182,7 @@ const getInfo = () => {
buttonLoading.value = false; buttonLoading.value = false;
nextTick(async () => { nextTick(async () => {
const id = routeParams.value.inStockBillId; const id = routeParams.value.id;
const res = await getInStockBill(id); const res = await getInStockBill(id);
Object.assign(form.value, res.data); Object.assign(form.value, res.data);
@ -200,64 +199,32 @@ const getInfo = () => {
/** 提交按钮*/ /** 提交按钮*/
const submitForm = (status: string, mode: boolean) => { const submitForm = (status: string, mode: boolean) => {
if (leaveTime.value.length === 0) { if (status === 'submit') {
proxy?.$modal.msgError('请假时间不能为空'); const res = submitFlowData(form.value).finally(() => (buttonLoading.value = false));
return;
}
try {
leaveFormRef.value?.validate(async (valid: boolean) => {
form.value.startDate = leaveTime.value[0];
form.value.endDate = leaveTime.value[1];
if (valid) {
buttonLoading.value = true;
// 稿
console.log('mode', mode);
if (mode && status != 'draft') {
const res = await submitAndFlowStart(form.value).finally(() => (buttonLoading.value = false));
form.value = res.data; form.value = res.data;
buttonLoading.value = false; buttonLoading.value = false;
proxy?.$modal.msgSuccess('操作成功'); proxy?.$modal.msgSuccess('操作成功');
proxy.$tab.closePage(proxy.$route); proxy.$tab.closePage(proxy.$route);
proxy.$router.go(-1); proxy.$router.go(-1);
} else { // handleStartWorkFlow();
let res; return;
if (form.value.id) {
res = await updateLeave(form.value).finally(() => (buttonLoading.value = false));
} else {
res = await addLeave(form.value).finally(() => (buttonLoading.value = false));
} }
form.value = res.data;
if (status === 'draft') {
buttonLoading.value = false;
proxy?.$modal.msgSuccess('暂存成功');
proxy.$tab.closePage(proxy.$route); proxy.$tab.closePage(proxy.$route);
proxy.$router.go(-1); proxy.$router.go(-1);
} else {
await handleStartWorkFlow(res.data); console.log('submitForm', status, mode);
}
}
}
});
} finally {
buttonLoading.value = false;
}
}; };
// //
const handleStartWorkFlow = async (data: LeaveForm) => { const handleStartWorkFlow = async () => {
try { try {
submitFormData.value.flowCode = flowCode.value; submitFormData.value.flowCode = flowCode.value;
submitFormData.value.businessId = data.id; submitFormData.value.businessId = data.id;
//
taskVariables.value = {
// leave2/6 使
leaveDays: data.leaveDays,
// leave4/5 使
userList: ['1', '3', '4']
};
// //
flowInstanceBizExtBo.value = { flowInstanceBizExtBo.value = {
businessTitle: '请假申请', businessTitle: '物料入库流程',
businessCode: data.applyCode businessCode: data.applyCode
}; };
submitFormData.value.variables = taskVariables.value; submitFormData.value.variables = taskVariables.value;
@ -290,6 +257,7 @@ onMounted(() => {
routeParams.value = proxy.$route.query; routeParams.value = proxy.$route.query;
reset(); reset();
loading.value = false; loading.value = false;
// routeParams.value.type = 'update';
// if (routeParams.value.type === 'update' || routeParams.value.type === 'view' || routeParams.value.type === 'approval') { // if (routeParams.value.type === 'update' || routeParams.value.type === 'view' || routeParams.value.type === 'approval') {
getInfo(); getInfo();
// } // }

@ -128,7 +128,7 @@
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width" width="auto"> <el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width" width="auto">
<template #default="scope"> <template #default="scope">
<div style="display: flex; justify-content: center; "> <div style="display: flex; justify-content: center">
<el-tooltip content="查看" placement="top"> <el-tooltip content="查看" placement="top">
<el-button link type="primary" icon="View" @click="handleView(scope.row)" v-hasPermi="['wms:inStockBill:edit']"></el-button> <el-button link type="primary" icon="View" @click="handleView(scope.row)" v-hasPermi="['wms:inStockBill:edit']"></el-button>
</el-tooltip> </el-tooltip>
@ -650,8 +650,8 @@ const handleView = (row?: InStockBillVO) => {
proxy.$router.push({ proxy.$router.push({
path: '/wms/inStockEdit', path: '/wms/inStockEdit',
query: { query: {
inStockBillId: row.inStockBillId, id: row.inStockBillId,
type: 'approval' type: row.flowStatus === 'draft' ? 'update' : 'view'
} }
}); });
}; };

Loading…
Cancel
Save