add 入库审批界面

dev
wanghao 2 months ago
parent bd4f3f9e12
commit bd3cedb854

@ -74,3 +74,14 @@ export function getWmsInStockBillList(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-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-col :span="12">
<el-form-item label="入库单号" prop="inStockCode">
@ -94,13 +94,12 @@
</template>
<script setup name="Leave" lang="ts">
import { LeaveForm } from '@/api/workflow/leave/types';
import { startWorkFlow } from '@/api/workflow/task';
import SubmitVerify from '@/components/Process/submitVerify.vue';
import ApprovalRecord from '@/components/Process/approvalRecord.vue';
import ApprovalButton from '@/components/Process/approvalButton.vue';
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 type { ComponentInternalInstance } 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>>({});
// flowCode 'leave1'
const flowCode = ref<string>('leave1');
const flowCode = ref<string>('wms_in');
//
const submitVerifyRef = ref<InstanceType<typeof SubmitVerify>>();
//
@ -183,7 +182,7 @@ const getInfo = () => {
buttonLoading.value = false;
nextTick(async () => {
const id = routeParams.value.inStockBillId;
const id = routeParams.value.id;
const res = await getInStockBill(id);
Object.assign(form.value, res.data);
@ -200,64 +199,32 @@ const getInfo = () => {
/** 提交按钮*/
const submitForm = (status: string, mode: boolean) => {
if (leaveTime.value.length === 0) {
proxy?.$modal.msgError('请假时间不能为空');
if (status === 'submit') {
const res = submitFlowData(form.value).finally(() => (buttonLoading.value = false));
form.value = res.data;
buttonLoading.value = false;
proxy?.$modal.msgSuccess('操作成功');
proxy.$tab.closePage(proxy.$route);
proxy.$router.go(-1);
// handleStartWorkFlow();
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;
buttonLoading.value = false;
proxy?.$modal.msgSuccess('操作成功');
proxy.$tab.closePage(proxy.$route);
proxy.$router.go(-1);
} else {
let res;
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.$router.go(-1);
} else {
await handleStartWorkFlow(res.data);
}
}
}
});
} finally {
buttonLoading.value = false;
}
proxy.$tab.closePage(proxy.$route);
proxy.$router.go(-1);
console.log('submitForm', status, mode);
};
//
const handleStartWorkFlow = async (data: LeaveForm) => {
const handleStartWorkFlow = async () => {
try {
submitFormData.value.flowCode = flowCode.value;
submitFormData.value.businessId = data.id;
//
taskVariables.value = {
// leave2/6 使
leaveDays: data.leaveDays,
// leave4/5 使
userList: ['1', '3', '4']
};
//
flowInstanceBizExtBo.value = {
businessTitle: '请假申请',
businessTitle: '物料入库流程',
businessCode: data.applyCode
};
submitFormData.value.variables = taskVariables.value;
@ -290,6 +257,7 @@ onMounted(() => {
routeParams.value = proxy.$route.query;
reset();
loading.value = false;
// routeParams.value.type = 'update';
// if (routeParams.value.type === 'update' || routeParams.value.type === 'view' || routeParams.value.type === 'approval') {
getInfo();
// }

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

Loading…
Cancel
Save