合并版
This commit is contained in:
@ -10,7 +10,7 @@ import useSettingsStore from '@/store/modules/settings';
|
||||
import usePermissionStore from '@/store/modules/permission';
|
||||
|
||||
NProgress.configure({ showSpinner: false });
|
||||
const whiteList = ['/login', '/register', '/social-callback', '/register*', '/register/*'];
|
||||
const whiteList = ['/login', '/register', '/social-callback', '/register*', '/register/*', '/materials/purchaseDoc/uploadCode'];
|
||||
|
||||
const isWhiteList = (path: string) => {
|
||||
return whiteList.some((pattern) => isPathMatch(pattern, path));
|
||||
|
@ -118,6 +118,11 @@ export const constantRoutes: RouteRecordRaw[] = [
|
||||
path: '/gis2D1',
|
||||
component: () => import('@/views/gis2D/index.vue'),
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: '/materials/purchaseDoc/uploadCode',
|
||||
component: () => import('@/views/materials/purchaseDoc/uploadCode.vue'),
|
||||
hidden: true
|
||||
}
|
||||
];
|
||||
|
||||
|
@ -126,7 +126,7 @@
|
||||
<div class="flex flex-wrap">
|
||||
<div class="flex">
|
||||
<div class="w3"></div>
|
||||
<el-button link type="primary" icon="Finished" @click="handleUpload(scope.row)" v-hasPermi="['cailiaoshebei:purchaseDoc:edit']">
|
||||
<el-button link type="primary" icon="Finished" @click="handleAudit(scope.row)" v-hasPermi="['cailiaoshebei:purchaseDoc:edit']">
|
||||
审核</el-button
|
||||
>
|
||||
<el-button link type="primary" icon="Upload" @click="handleUpload(scope.row)" v-hasPermi="['cailiaoshebei:purchaseDoc:edit']"
|
||||
@ -428,7 +428,7 @@ const getBatchList = async () => {
|
||||
planCode: undefined,
|
||||
projectId: currentProject.value?.id
|
||||
});
|
||||
batchOptions.value = res.rows;
|
||||
batchOptions.value = res.rows.filter((item) => item.status == 'finish');
|
||||
};
|
||||
|
||||
const getSupplierList = async () => {
|
||||
@ -473,6 +473,15 @@ const handleSuccess = (list, res: any) => {
|
||||
form.value.feedbackUrl = res.data.url;
|
||||
};
|
||||
|
||||
/** 审核按钮操作 */
|
||||
const handleAudit = async (row?: PurchaseDocVO) => {
|
||||
proxy?.$tab.closePage(route);
|
||||
proxy?.$tab.openPage('/materials/purchaseDoc/indexEdit', '审核采购联系单', {
|
||||
id: row.id,
|
||||
type: 'update'
|
||||
});
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
getSupplierList();
|
||||
|
439
src/views/materials/purchaseDoc/indexEdit.vue
Normal file
439
src/views/materials/purchaseDoc/indexEdit.vue
Normal file
@ -0,0 +1,439 @@
|
||||
<template>
|
||||
<div class="p-4 bg-gray-50">
|
||||
<div class="max-w-4xl mx-auto">
|
||||
<!-- 顶部按钮区域 -->
|
||||
<el-card class="mb-4 rounded-lg shadow-sm bg-white border border-gray-100 transition-all hover:shadow-md">
|
||||
<approvalButton
|
||||
@submitForm="submitForm"
|
||||
@approvalVerifyOpen="approvalVerifyOpen"
|
||||
@handleApprovalRecord="handleApprovalRecord"
|
||||
:buttonLoading="buttonLoading"
|
||||
:id="form.id"
|
||||
:status="form.status"
|
||||
:pageType="routeParams.type"
|
||||
/>
|
||||
</el-card>
|
||||
|
||||
<!-- 表单区域 -->
|
||||
<el-card class="rounded-lg shadow-sm bg-white border border-gray-100 transition-all hover:shadow-md overflow-hidden">
|
||||
<div class="p-4 bg-gradient-to-r from-blue-50 to-indigo-50 border-b border-gray-100">
|
||||
<h3 class="text-lg font-semibold text-gray-800">采购单信息</h3>
|
||||
</div>
|
||||
<div class="p-6">
|
||||
<el-form ref="leaveFormRef" disabled :model="form" label-width="100px" class="space-y-4">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12" :offset="0"
|
||||
><el-form-item label="采购单编号" prop="docCode"> <el-input v-model="form.docCode" placeholder="请输入采购单编号" /> </el-form-item
|
||||
></el-col>
|
||||
<el-col :span="12" :offset="0"
|
||||
><el-form-item label="供应商" prop="supplier">
|
||||
<el-select v-model="form.supplier" value-key="id" placeholder="请选择供应商" clearable filterable @change="">
|
||||
<el-option v-for="item in supplierOptions" :key="item.id" :label="item.name" :value="item.name"> </el-option>
|
||||
</el-select> </el-form-item
|
||||
></el-col>
|
||||
<el-col :span="12" :offset="0"
|
||||
><el-form-item label="需求批次号" prop="mrpBaseId">
|
||||
<el-select v-model="form.mrpBaseId" value-key="id" placeholder="请选择需求批次号" filterable @change="getPlanList">
|
||||
<el-option v-for="item in batchOptions" :key="item.id" :label="item.planCode" :value="item.id"> </el-option>
|
||||
</el-select> </el-form-item
|
||||
></el-col>
|
||||
<el-col :span="12" :offset="0">
|
||||
<el-form-item label="需求计划" prop="planId">
|
||||
<el-select v-model="form.planId" value-key="id" placeholder="请选择需求计划" multiple filterable :disabled="!form.mrpBaseId">
|
||||
<el-option v-for="item in planList" :key="item.id" :label="item.name" :value="item.id"> </el-option>
|
||||
</el-select> </el-form-item
|
||||
></el-col>
|
||||
<el-col :span="12" :offset="0"
|
||||
><el-form-item label="事由" prop="reason"> <el-input v-model="form.reason" placeholder="请输入事由" /> </el-form-item
|
||||
></el-col>
|
||||
<el-col :span="12" :offset="0">
|
||||
<el-form-item label="设备统称" prop="name"> <el-input v-model="form.name" placeholder="请输入设备统称" /> </el-form-item
|
||||
></el-col>
|
||||
<el-col :span="12" :offset="0"
|
||||
><el-form-item label="到货日期" prop="arrivalDate">
|
||||
<el-date-picker clearable v-model="form.arrivalDate" type="date" value-format="YYYY-MM-DD" placeholder="请选择到货日期">
|
||||
</el-date-picker> </el-form-item
|
||||
></el-col>
|
||||
<el-col :span="12" :offset="0"
|
||||
><el-form-item label="负责人联系方式" prop="designDirectorTel">
|
||||
<el-input v-model="form.designDirectorTel" placeholder="请输入设计负责人联系方式" type="number" /> </el-form-item
|
||||
></el-col>
|
||||
<el-col :span="12" :offset="0"
|
||||
><el-form-item label="现场联系方式" prop="technicalDirectorTel">
|
||||
<el-input v-model="form.technicalDirectorTel" placeholder="请输入现场技术负责人联系方式" type="number" /> </el-form-item
|
||||
></el-col>
|
||||
<el-col :span="12" :offset="0">
|
||||
<el-form-item label="收货地址" prop="receivingAddress">
|
||||
<el-input v-model="form.receivingAddress" placeholder="请输入收货地址" /> </el-form-item
|
||||
></el-col>
|
||||
<el-col :span="12" :offset="0">
|
||||
<el-form-item label="联系人" prop="contacts"> <el-input v-model="form.contacts" placeholder="请输入联系人" /> </el-form-item
|
||||
></el-col>
|
||||
<el-col :span="12" :offset="0"
|
||||
><el-form-item label="项目负责人" prop="projectDirector">
|
||||
<el-input v-model="form.projectDirector" placeholder="请输入项目负责人" /> </el-form-item
|
||||
></el-col>
|
||||
<el-col :span="12" :offset="0"
|
||||
><el-form-item label="采购经办人" prop="purchasingAgent">
|
||||
<el-input v-model="form.purchasingAgent" placeholder="请输入采购经办人" /> </el-form-item
|
||||
></el-col>
|
||||
<el-col :span="12" :offset="0"
|
||||
><el-form-item label="日期" prop="preparedDate">
|
||||
<el-date-picker clearable v-model="form.preparedDate" type="date" value-format="YYYY-MM-DD" placeholder="请选择日期">
|
||||
</el-date-picker> </el-form-item
|
||||
></el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</div>
|
||||
</el-card>
|
||||
<!-- 提交组件 -->
|
||||
<submitVerify ref="submitVerifyRef" :task-variables="taskVariables" @submit-callback="submitCallback" />
|
||||
<approvalRecord ref="approvalRecordRef"></approvalRecord>
|
||||
<!-- 流程选择对话框 -->
|
||||
<el-dialog
|
||||
draggable
|
||||
v-model="dialogVisible.visible"
|
||||
:title="dialogVisible.title"
|
||||
:before-close="handleClose"
|
||||
width="500"
|
||||
class="rounded-lg shadow-lg"
|
||||
>
|
||||
<div class="p-4">
|
||||
<p class="text-gray-600 mb-4">请选择要启动的流程:</p>
|
||||
<el-select v-model="flowCode" placeholder="请选择流程" style="width: 100%">
|
||||
<el-option v-for="item in flowCodeOptions" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</div>
|
||||
<template #footer>
|
||||
<div class="dialog-footer p-4 border-t border-gray-100 flex justify-end space-x-3">
|
||||
<el-button @click="handleClose" class="px-4 py-2 border border-gray-300 rounded-md text-gray-700 hover:bg-gray-50 transition-colors"
|
||||
>取消</el-button
|
||||
>
|
||||
<el-button type="primary" @click="submitFlow()" class="px-4 py-2 bg-primary text-white rounded-md hover:bg-primary/90 transition-colors"
|
||||
>确认</el-button
|
||||
>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</div>
|
||||
</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';
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
import { useUserStoreHook } from '@/store/modules/user';
|
||||
import { getDrawing } from '@/api/design/drawing';
|
||||
import { updateDesignChange, getDesignChange } from '@/api/design/designChange';
|
||||
import { getPurchaseDoc } from '@/api/materials/purchaseDoc';
|
||||
import { getBatch } from '@/api/materials/batchPlan';
|
||||
|
||||
// 获取用户 store
|
||||
const userStore = useUserStoreHook();
|
||||
// 从 store 中获取项目列表和当前选中的项目
|
||||
const currentProject = computed(() => userStore.selectedProject);
|
||||
const buttonLoading = ref(false);
|
||||
const loading = ref(true);
|
||||
//路由参数
|
||||
const routeParams = ref<Record<string, any>>({});
|
||||
const flowCodeOptions = [
|
||||
{
|
||||
value: currentProject.value?.id + '_purchaseDoc',
|
||||
label: '采购单审批'
|
||||
}
|
||||
];
|
||||
|
||||
const flowCode = ref<string>('');
|
||||
const status = ref<string>('');
|
||||
const dialogVisible = reactive<DialogOption>({
|
||||
visible: false,
|
||||
title: '流程定义'
|
||||
});
|
||||
//提交组件
|
||||
const submitVerifyRef = ref<InstanceType<typeof SubmitVerify>>();
|
||||
//审批记录组件
|
||||
const approvalRecordRef = ref<InstanceType<typeof ApprovalRecord>>();
|
||||
//按钮组件
|
||||
const approvalButtonRef = ref<InstanceType<typeof ApprovalButton>>();
|
||||
|
||||
const leaveFormRef = ref<ElFormInstance>();
|
||||
const dialog = reactive({
|
||||
visible: false,
|
||||
title: '',
|
||||
isEdit: false
|
||||
});
|
||||
const submitFormData = ref<StartProcessBo>({
|
||||
businessId: '',
|
||||
flowCode: '',
|
||||
variables: {}
|
||||
});
|
||||
const taskVariables = ref<Record<string, any>>({});
|
||||
|
||||
const initFormData = {
|
||||
id: undefined,
|
||||
projectId: currentProject.value?.id,
|
||||
|
||||
docCode: undefined,
|
||||
supplier: undefined,
|
||||
reason: undefined,
|
||||
name: undefined,
|
||||
arrivalDate: undefined,
|
||||
designDirectorTel: undefined,
|
||||
technicalDirectorTel: undefined,
|
||||
receivingAddress: undefined,
|
||||
contacts: undefined,
|
||||
associationList: [],
|
||||
|
||||
projectDirector: undefined,
|
||||
purchasingAgent: undefined,
|
||||
preparedDate: undefined,
|
||||
feedbackUrl: undefined,
|
||||
signingUnit: undefined,
|
||||
signingPerson: undefined,
|
||||
signingDate: undefined,
|
||||
status: undefined
|
||||
};
|
||||
const data = reactive({
|
||||
form: { ...initFormData },
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
projectId: currentProject.value?.id,
|
||||
fileName: undefined,
|
||||
fileType: undefined,
|
||||
fileSuffix: undefined,
|
||||
fileStatus: undefined,
|
||||
originalName: undefined,
|
||||
newest: undefined,
|
||||
params: {}
|
||||
}
|
||||
});
|
||||
|
||||
const handleClose = () => {
|
||||
dialogVisible.visible = false;
|
||||
flowCode.value = '';
|
||||
buttonLoading.value = false;
|
||||
};
|
||||
const { form, rules } = toRefs(data);
|
||||
|
||||
/** 表单重置 */
|
||||
const reset = () => {
|
||||
form.value = { ...initFormData };
|
||||
leaveFormRef.value?.resetFields();
|
||||
};
|
||||
|
||||
/** 获取详情 */
|
||||
const getInfo = () => {
|
||||
loading.value = true;
|
||||
buttonLoading.value = false;
|
||||
nextTick(async () => {
|
||||
const res = await getPurchaseDoc(routeParams.value.id);
|
||||
Object.assign(form.value, res.data);
|
||||
getPlanList();
|
||||
form.value.planId = form.value.associationList?.map((item: any) => item.planId);
|
||||
loading.value = false;
|
||||
buttonLoading.value = false;
|
||||
});
|
||||
};
|
||||
const planList = ref([]);
|
||||
|
||||
const getPlanList = async () => {
|
||||
form.value.planId = '';
|
||||
const res = await getBatch({
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
mrpBaseId: undefined,
|
||||
projectId: currentProject.value?.id,
|
||||
mrpBaseId: form.value.mrpBaseId
|
||||
});
|
||||
planList.value = res.rows;
|
||||
};
|
||||
|
||||
/** 提交按钮 */
|
||||
const submitForm = (status1: string) => {
|
||||
status.value = status1;
|
||||
dialog.visible = false;
|
||||
submit(status.value, form.value);
|
||||
};
|
||||
|
||||
const submitFlow = async () => {
|
||||
handleStartWorkFlow(form.value);
|
||||
dialogVisible.visible = false;
|
||||
};
|
||||
//提交申请
|
||||
const handleStartWorkFlow = async (data: LeaveForm) => {
|
||||
try {
|
||||
submitFormData.value.flowCode = flowCode.value;
|
||||
submitFormData.value.businessId = data.id;
|
||||
//流程变量
|
||||
taskVariables.value = {
|
||||
// leave4/5 使用的流程变量
|
||||
userList: ['1', '3', '4']
|
||||
};
|
||||
submitFormData.value.variables = taskVariables.value;
|
||||
const resp = await startWorkFlow(submitFormData.value);
|
||||
if (submitVerifyRef.value) {
|
||||
buttonLoading.value = false;
|
||||
submitVerifyRef.value.openDialog(resp.data.taskId);
|
||||
}
|
||||
} finally {
|
||||
buttonLoading.value = false;
|
||||
}
|
||||
};
|
||||
//审批记录
|
||||
const handleApprovalRecord = () => {
|
||||
approvalRecordRef.value.init(form.value.id);
|
||||
};
|
||||
//提交回调
|
||||
const submitCallback = async () => {
|
||||
await proxy.$tab.closePage(proxy.$route);
|
||||
proxy.$router.go(-1);
|
||||
};
|
||||
//审批
|
||||
const approvalVerifyOpen = async () => {
|
||||
submitVerifyRef.value.openDialog(routeParams.value.taskId, true, routeParams.value.businessId);
|
||||
// submitVerifyRef.value.openDialog(routeParams.value.taskId);
|
||||
};
|
||||
// 图纸上传成功之后 开始提交
|
||||
const submit = async (status, data) => {
|
||||
form.value = data;
|
||||
if (status === 'draft') {
|
||||
buttonLoading.value = false;
|
||||
proxy?.$modal.msgSuccess('暂存成功');
|
||||
proxy.$tab.closePage(proxy.$route);
|
||||
proxy.$router.go(-1);
|
||||
} else {
|
||||
if ((form.value.status === 'draft' && (flowCode.value === '' || flowCode.value === null)) || routeParams.value.type === 'add') {
|
||||
flowCode.value = flowCodeOptions[0].value;
|
||||
dialogVisible.visible = true;
|
||||
return;
|
||||
}
|
||||
//说明启动过先随意穿个参数
|
||||
if (flowCode.value === '' || flowCode.value === null) {
|
||||
flowCode.value = 'xx';
|
||||
}
|
||||
console.log(data);
|
||||
await handleStartWorkFlow(data);
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
nextTick(async () => {
|
||||
routeParams.value = proxy.$route.query;
|
||||
reset();
|
||||
loading.value = false;
|
||||
if (routeParams.value.type === 'update' || routeParams.value.type === 'view' || routeParams.value.type === 'approval') {
|
||||
getInfo();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
/* 全局样式 */
|
||||
:root {
|
||||
--primary: #409eff;
|
||||
--primary-light: #66b1ff;
|
||||
--primary-dark: #3a8ee6;
|
||||
--success: #67c23a;
|
||||
--warning: #e6a23c;
|
||||
--danger: #f56c6c;
|
||||
--info: #909399;
|
||||
}
|
||||
|
||||
/* 表单样式优化 */
|
||||
.el-form-item {
|
||||
.el-form-item__label {
|
||||
color: #606266;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.el-input__inner,
|
||||
.el-select .el-input__inner {
|
||||
border-radius: 4px;
|
||||
transition:
|
||||
border-color 0.2s,
|
||||
box-shadow 0.2s;
|
||||
|
||||
&:focus {
|
||||
border-color: var(--primary-light);
|
||||
box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.1);
|
||||
}
|
||||
}
|
||||
|
||||
.el-textarea__inner {
|
||||
border-radius: 4px;
|
||||
transition:
|
||||
border-color 0.2s,
|
||||
box-shadow 0.2s;
|
||||
|
||||
&:focus {
|
||||
border-color: var(--primary-light);
|
||||
box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 按钮样式优化 */
|
||||
.el-button {
|
||||
border-radius: 4px;
|
||||
transition: all 0.2s;
|
||||
|
||||
&.is-primary {
|
||||
background-color: var(--primary);
|
||||
border-color: var(--primary);
|
||||
|
||||
&:hover {
|
||||
background-color: var(--primary-light);
|
||||
border-color: var(--primary-light);
|
||||
}
|
||||
|
||||
&:active {
|
||||
background-color: var(--primary-dark);
|
||||
border-color: var(--primary-dark);
|
||||
}
|
||||
}
|
||||
|
||||
&.is-text {
|
||||
color: var(--primary);
|
||||
|
||||
&:hover {
|
||||
color: var(--primary-light);
|
||||
background-color: rgba(64, 158, 255, 0.05);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 卡片样式优化 */
|
||||
.el-card {
|
||||
transition: all 0.3s ease;
|
||||
|
||||
&:hover {
|
||||
/* transform: translateY(-2px); */
|
||||
}
|
||||
}
|
||||
|
||||
/* 对话框样式优化 */
|
||||
.el-dialog {
|
||||
.el-dialog__header {
|
||||
background-color: #f5f7fa;
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
padding: 15px 20px;
|
||||
}
|
||||
|
||||
.el-dialog__title {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.el-dialog__footer {
|
||||
padding: 15px 20px;
|
||||
border-top: 1px solid #ebeef5;
|
||||
}
|
||||
}
|
||||
</style>
|
54
src/views/materials/purchaseDoc/uploadCode.vue
Normal file
54
src/views/materials/purchaseDoc/uploadCode.vue
Normal file
@ -0,0 +1,54 @@
|
||||
<template>
|
||||
<div class="p-2">
|
||||
<el-card shadow="always" :body-style="{ padding: '20px' }">
|
||||
<template #header>
|
||||
<div>
|
||||
<span><!-- card title --></span>
|
||||
</div>
|
||||
</template>
|
||||
<!-- card body -->
|
||||
<el-form :model="form" ref="form" :rules="rules" label-width="80px" :inline="false" size="normal">
|
||||
<el-row :gutter="20" v-for="item in form.list">
|
||||
<el-col :span="8" :offset="0">
|
||||
<el-form-item label="计划">
|
||||
<el-input v-model="item.planId"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8" :offset="0">
|
||||
<el-form-item label="数量">
|
||||
<el-input v-model="item.num"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8" :offset="0">
|
||||
<el-form-item label="物流单号">
|
||||
<el-input v-model="item.ltn"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="onSubmit">立即提交</el-button>
|
||||
<el-button>取消</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useRoute } from 'vue-router';
|
||||
const route = useRoute();
|
||||
const form = reactive({
|
||||
docId: '',
|
||||
supplier: '',
|
||||
list: [
|
||||
{
|
||||
planId: '',
|
||||
num: '',
|
||||
ltn: ''
|
||||
}
|
||||
]
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="stylus" scoped></style>
|
Reference in New Issue
Block a user