采购员任命

This commit is contained in:
Teo
2025-08-13 19:10:35 +08:00
parent fbe1dae085
commit b90b0a457c
12 changed files with 1210 additions and 286 deletions

View File

@ -5,7 +5,7 @@ VITE_APP_TITLE = 新能源项目管理平台
VITE_APP_ENV = 'development'
# 开发环境
VITE_APP_BASE_API = 'http://192.168.110.159:8898'
VITE_APP_BASE_API = 'http://192.168.110.180:8898'
# 无人机接口地址

View File

@ -8,6 +8,7 @@ export interface ContactnoticeVO {
* 项目ID
*/
projectId: string | number;
status: string;
/**
* 模板类型

View File

@ -0,0 +1,28 @@
import request from '@/utils/request';
// 设计人员
// 新增
export const designUserAdd = (data) => {
return request({
url: '/cailiaoshebei/purchaseUser/addOrUpdate',
method: 'post',
data: data
});
};
// 查询
export const designUserDetail = (projectId) => {
return request({
url: `/cailiaoshebei/purchaseUser/byProject/${projectId}`,
method: 'get'
});
};
// 查询
export const systemUserList = (query) => {
return request({
url: '/system/user/list',
method: 'get',
params: query
});
};

View File

@ -22,7 +22,7 @@ export const listCailiaoshebei = (query?: any): AxiosPromise<CailiaoshebeiVO[]>
*/
export const getCailiaoshebei = (id: string | number): AxiosPromise<CailiaoshebeiVO> => {
return request({
url: '/cailiaoshebei/cailiaoshebei/' + id,
url: '/cailiaoshebei/mrpBase/' + id,
method: 'get'
});
};
@ -45,8 +45,8 @@ export const addCailiaoshebei = (data: CailiaoshebeiForm) => {
*/
export const updateCailiaoshebei = (data: CailiaoshebeiForm) => {
return request({
url: '/cailiaoshebei/cailiaoshebei',
method: 'put',
url: '/cailiaoshebei/mrpBase/batch',
method: 'post',
data: data
});
};
@ -69,7 +69,7 @@ export const delCailiaoshebei = (id: string | number | Array<string | number>) =
*/
export const listBatch = (query?: any): AxiosPromise => {
return request({
url: '/cailiaoshebei/materialbatchdemandplan/pcList',
url: '/cailiaoshebei/mrpBase/list',
method: 'get',
params: query
});
@ -79,11 +79,11 @@ export const listBatch = (query?: any): AxiosPromise => {
* 新增物资-材料设备批次
* @param data
*/
export const getBatch = (data: any) => {
export const getBatch = (query: any) => {
return request({
url: '/cailiaoshebei/materialbatchdemandplan/pcAdd',
method: 'post',
data: data
url: '/cailiaoshebei/materialbatchdemandplan/list',
method: 'get',
params: query
});
};
@ -93,7 +93,7 @@ export const getBatch = (data: any) => {
*/
export const delBatch = (ids: string | number | Array<string | number>) => {
return request({
url: '/cailiaoshebei/materialbatchdemandplan/' + ids,
url: '/cailiaoshebei/mrpBase/' + ids,
method: 'delete'
});
};

View File

@ -3,17 +3,17 @@
<el-table :data="data" style="width: 100%" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column align="center" prop="projectName" label="工程名称" />
<el-table-column align="center" prop="unitName" label="提出单位" />
<el-table-column align="center" prop="profession" label="专业" />
<el-table-column align="center" prop="applyDate" label="提出日期">
<el-table-column align="center" prop="submitUnit" label="提出单位" />
<el-table-column align="center" prop="specialty" label="专业" />
<el-table-column align="center" prop="submitDate" label="提出日期">
<template #default="{ row }">
{{ formatDate(row.applyDate) }}
{{ formatDate(row.submitDate) }}
</template>
</el-table-column>
<el-table-column align="center" prop="bookName" label="卷册名称" />
<el-table-column align="center" prop="bookNo" label="卷册号" />
<el-table-column align="center" prop="changeContent" label="变更内容" />
<el-table-column align="center" prop="costEstimate" label="变更费用估算1" />
<el-table-column align="center" prop="volumeName" label="卷册名称" />
<el-table-column align="center" prop="volumeNumber" label="卷册号" />
<el-table-column align="center" prop="content" label="变更内容" />
<el-table-column align="center" prop="costEstimation" label="变更费用估算" />
<el-table-column label="流程状态" align="center" prop="status">
<template #default="scope">
<dict-tag :options="wf_business_status" :value="scope.row.status" />
@ -40,15 +40,15 @@
</el-row>
<el-descriptions :column="2" border style="margin-top: 8px" label-width="160px" size="large">
<el-descriptions-item label-align="center" label="工程名称" class-name="zebra"> {{ tableDetail.projectName }} </el-descriptions-item>
<el-descriptions-item label-align="center" label="提出单位" class-name="zebra"> {{ tableDetail.unitName }} </el-descriptions-item>
<el-descriptions-item label-align="center" label="专业" label-class-name="white"> {{ tableDetail.profession }} </el-descriptions-item>
<el-descriptions-item label-align="center" label="提出单位" class-name="zebra"> {{ tableDetail.submitUnit }} </el-descriptions-item>
<el-descriptions-item label-align="center" label="专业" label-class-name="white"> {{ tableDetail.specialty }} </el-descriptions-item>
<el-descriptions-item label-align="center" label="提出日期" label-class-name="white">
{{ dayjs(tableDetail.applyDate).format('YYYY-MM-DD') }}
{{ dayjs(tableDetail.submitDate).format('YYYY-MM-DD') }}
</el-descriptions-item>
<el-descriptions-item label-align="center" label="卷册名称" class-name="zebra"> {{ tableDetail.bookName }} </el-descriptions-item>
<el-descriptions-item label-align="center" label="卷册号" class-name="zebra"> {{ tableDetail.bookNo }} </el-descriptions-item>
<el-descriptions-item label-align="center" label="卷册名称" class-name="zebra"> {{ tableDetail.volumeName }} </el-descriptions-item>
<el-descriptions-item label-align="center" label="卷册号" class-name="zebra"> {{ tableDetail.volumeNumber }} </el-descriptions-item>
<el-descriptions-item label-align="center" label="附图" :span="2" label-class-name="white">
<image-preview :src="item.url" v-for="item in tableDetail.hasAttachmentList" width="200px" class="mr" />
<image-preview :src="item.url" v-for="item in tableDetail.attachments" width="200px" class="mr" />
</el-descriptions-item>
<el-descriptions-item label-align="center" label="变更原因" :span="2" class-name="zebra">
<el-checkbox-group v-model="tableDetail.changeReasons">
@ -62,10 +62,10 @@
</el-checkbox-group>
</el-descriptions-item>
<el-descriptions-item label-align="center" label="内容" :span="2" label-class-name="white">
{{ tableDetail.changeContent }}
{{ tableDetail.content }}
</el-descriptions-item>
<el-descriptions-item label-align="center" label="变更费用估算" :span="2" class-name="zebra">
{{ tableDetail.costEstimate }}
{{ tableDetail.costEstimation }}
</el-descriptions-item>
</el-descriptions>
<el-descriptions border direction="vertical" size="large">
@ -73,13 +73,13 @@
</el-descriptions>
<el-descriptions :column="2" border label-width="160px" size="large">
<el-descriptions-item label-align="center" label="项目经理 " label-class-name="white">
{{ tableDetail.asupervisorLeader }}
{{ tableDetail.contractorLeader }}
</el-descriptions-item>
<el-descriptions-item label-align="center" label="日期" label-class-name="white">
{{ dayjs(tableDetail.asupervisorDate).format('YYYY-MM-DD') }}
{{ dayjs(tableDetail.contractorDate).format('YYYY-MM-DD') }}
</el-descriptions-item>
</el-descriptions>
<el-descriptions border direction="vertical" size="large">
<!-- <el-descriptions border direction="vertical" size="large">
<el-descriptions-item label-align="center" label="总承包单位" class-name="none"></el-descriptions-item>
</el-descriptions>
<el-descriptions :column="2" border label-width="160px" size="large">
@ -100,36 +100,39 @@
<el-descriptions-item label-align="center" label="日期" label-class-name="white">
{{ dayjs(tableDetail.csupervisorDate).format('YYYY-MM-DD') }}
</el-descriptions-item>
</el-descriptions>
</el-descriptions> -->
<el-descriptions border direction="vertical" size="large">
<el-descriptions-item label-align="center" label="项目监理单位" class-name="none"></el-descriptions-item>
</el-descriptions>
<!-- 单独插入整行占用的内容 -->
<el-descriptions :column="2" border label-width="160px" size="large">
<el-descriptions-item label="总监理工程师" :span="2" label-align="center" label-class-name="white">
{{ tableDetail.dasupervisorLeader }}
<el-descriptions-item label="总监理工程师" label-align="center" label-class-name="white">
{{ tableDetail.supervisorLeader }}
</el-descriptions-item>
<el-descriptions-item label="日期" label-align="center" label-class-name="white">
{{ dayjs(tableDetail.supervisorDate).format('YYYY-MM-DD') }}
</el-descriptions-item>
</el-descriptions>
<!-- 一组完整两列 -->
<el-descriptions :column="2" border label-width="160px" size="large">
<!-- <el-descriptions :column="2" border label-width="160px" size="large">
<el-descriptions-item label="监理工程师" label-align="center" label-class-name="white">
{{ tableDetail.dsupervisorLeader }}
</el-descriptions-item>
<el-descriptions-item label="日期" label-align="center" label-class-name="white">
{{ dayjs(tableDetail.dsupervisorDate).format('YYYY-MM-DD') }}
{{ dayjs(tableDetail.supervisorDate).format('YYYY-MM-DD') }}
</el-descriptions-item>
</el-descriptions>
</el-descriptions> -->
<el-descriptions border direction="vertical" size="large">
<el-descriptions-item label-align="center" label="建设单位" class-name="none"></el-descriptions-item>
</el-descriptions>
<el-descriptions :column="2" border label-width="160px" size="large">
<!-- <el-descriptions-item label-align="center" label="会签" :span="2" label-class-name="white"> {{ tableDetail.esupervisorLeader }} </el-descriptions-item> -->
<el-descriptions-item label-align="center" label="负责人" label-class-name="white">
{{ tableDetail.esupervisorLeader }}
{{ tableDetail.ownerRep }}
</el-descriptions-item>
<el-descriptions-item label-align="center" label="日期" label-class-name="white">
{{ dayjs(tableDetail.esupervisorDate).format('YYYY-MM-DD') }}
{{ dayjs(tableDetail.ownerDate).format('YYYY-MM-DD') }}
</el-descriptions-item>
</el-descriptions>
</div>
@ -169,8 +172,8 @@ const radioList = ref([
{ value: 3, label: '接口差错' },
{ value: 4, label: '业主要求' },
{ value: 5, label: '施工承包商要求' },
{ value: 6, label: '外部资料不符' },
{ value: 7, label: '材料代用其他' }
{ value: 6, label: '外部资料与最终情况不符' },
{ value: 7, label: '材料代用其他' }
]);
const detailVisible = ref(false);
const formatDate = (val: string | Date) => (val ? dayjs(val).format('YYYY-MM-DD') : '');
@ -208,7 +211,7 @@ const handleViewInfo = (row) => {
// 添加审批
proxy.$tab.closePage(proxy.$route);
proxy.$router.push({
path: `/cory/template/indexEdit`,
path: `/relation-management/changeContact/indexEdit`,
query: {
thumbnailUrl: props.thumbnail,
row: JSON.stringify(row),

View File

@ -190,7 +190,7 @@ const data = reactive<PageData<any, any>>({
teamId: undefined,
type: undefined,
params: {},
ids: ['1942107830848872449', '1942107931415699457'],
// ids: ['1942107830848872449', '1942107931415699457'],
projectType: undefined
},
rules: {
@ -233,18 +233,20 @@ const getList = async () => {
if (!queryParams.value.projectType) {
const res = await listContactTypeformtemplate(queryParams.value);
projectTypeOptions.value = res.data;
queryParams.value.projectType = res.data[0].name;
thumbnailUrl.value = res.data[0].thumbnail;
queryParams.value.type = res.data[0].id as string;
queryParams.value.projectType = res.data[1].name;
thumbnailUrl.value = res.data[1].thumbnail;
queryParams.value.type = res.data[1].id as string;
}
const res = await listContactnotice(queryParams.value);
res.rows = res.rows.map((item) => {
return {
...item,
...JSON.parse(item.detail)
...JSON.parse(item.detail),
status: item.status
};
});
tableData.value = res.rows;
console.log('🚀 ~ getList ~ tableData.value:', tableData.value);
total.value = res.total || 0;
};
const handleDelete = async (id?: string) => {
@ -282,6 +284,7 @@ const handleAddApp = (row) => {
path: `/relation-management/changeContact/indexEdit`,
query: {
thumbnailUrl: projectTypeOptions.value[1].thumbnail,
id: projectTypeOptions.value[1].id,
row,
type: 'add'
}

View File

@ -31,7 +31,7 @@
>
<div class="grid grid-cols-1 gap-4">
<div class="flex">
<div><image-preview :src="thumbnailUrl" width="150px"></image-preview></div>
<div v-if="thumbnailUrl"><image-preview :src="thumbnailUrl" width="150px"></image-preview></div>
<div>
<el-row :gutter="20">
<el-col :span="12">
@ -69,9 +69,9 @@
</el-col>
<el-col :span="12">
<el-form-item label="附图">
<el-upload v-model:file-list="form.attachments" action="#" list-type="text">
<file-Upload v-model="form.attachments">
<el-button type="primary">上传附件</el-button>
</el-upload>
</file-Upload>
</el-form-item>
</el-col>
</el-row>
@ -286,8 +286,9 @@ const getInfo = () => {
nextTick(async () => {
const res = await getContactnotice(routeParams.value.id);
var data = {
...JSON.parse(routeParams.value.row),
...JSON.parse(res.data.detail)
// ...JSON.parse(routeParams.value.row),
...JSON.parse(res.data.detail),
...res.data
};
console.log(routeParams.value);
@ -303,11 +304,19 @@ const submitForm = (status1: string) => {
leaveFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
buttonLoading.value = true;
let data = {
detail: JSON.stringify(form.value),
type: routeParams.value.id,
projectId: currentProject.value?.id
};
var res;
if (form.value.id) {
res = await updateContactnotice(form.value).finally(() => (buttonLoading.value = false));
res = await updateContactnotice(data).finally(() => (buttonLoading.value = false));
Object.assign(form.value, res.data);
} else {
res = await addContactnotice(form.value).finally(() => (buttonLoading.value = false));
res = await addContactnotice(data).finally(() => (buttonLoading.value = false));
Object.assign(form.value, res.data);
}
if (res.code == 200) {
dialog.visible = false;
@ -318,11 +327,15 @@ const submitForm = (status1: string) => {
};
const submitFlow = async () => {
console.log('form.value', form.value);
handleStartWorkFlow(form.value);
dialogVisible.visible = false;
};
//提交申请
const handleStartWorkFlow = async (data: LeaveForm) => {
console.log('data', data);
try {
submitFormData.value.flowCode = flowCode.value;
submitFormData.value.businessId = data.id;
@ -352,6 +365,10 @@ const submitCallback = async () => {
};
//审批
const approvalVerifyOpen = async () => {
taskVariables.value = {
// leave4/5 使用的流程变量
costEstimation: form.value.costEstimation
};
submitVerifyRef.value.openDialog(routeParams.value.taskId);
};
// 图纸上传成功之后 开始提交
@ -372,7 +389,7 @@ const submit = async (status, data) => {
if (flowCode.value === '' || flowCode.value === null) {
flowCode.value = 'xx';
}
console.log(data);
console.log('data', data);
await handleStartWorkFlow(data);
}
};

View File

@ -38,14 +38,30 @@
>删除</el-button
>
</el-col>
<el-col :span="1.5">
<file-upload
v-model="filePath"
isImportInfo
:isShowTip="false"
uploadUrl="/design/volumeCatalog/importData"
:limit="1"
:fileType="['xlsx', 'xls']"
:data="{
projectId: currentProject?.id
}"
:file-size="50"
:onUploadSuccess="handleUploadSuccess"
>
<el-button type="warning" plain icon="Upload">导入</el-button>
</file-upload>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
</template>
<el-table v-loading="loading" :data="volumeCatalogList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="子项ID" align="center" prop="designSubitemId" />
<el-table-column label="子项名称" align="center" prop="designSubitemName" />
<el-table-column label="子项名称" align="center" prop="designSubitem" />
<el-table-column label="设计状态" align="center" prop="designState">
<template #default="scope">
<dict-tag :options="design_state" :value="scope.row.designState" />
@ -55,7 +71,13 @@
<el-table-column label="负责人" align="center" prop="principal" />
<el-table-column label="卷册号" align="center" prop="volumeNumber" />
<el-table-column label="资料名称" align="center" prop="documentName" />
<el-table-column label="计划完成时间" align="center" prop="planCompleteTime" />
<el-table-column label="上传时间" align="center" prop="createTime" />
<el-table-column label="计划出图时间" align="center" prop="plannedCompletion" />
<el-table-column label="审核状态" align="center" prop="auditStatus">
<template #default="scope">
<dict-tag :options="wf_business_status" :value="scope.row.auditStatus" />
</template>
</el-table-column>
<el-table-column label="文件" align="center" prop="fileVoList" width="180">
<template #default="scope">
@ -80,6 +102,7 @@
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" width="220">
<template #default="scope">
<el-button link type="primary" icon="Finished" @click="handleAudit(scope.row)" v-hasPermi="['out:monthPlan:remove']">审核</el-button>
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['design:volumeCatalog:edit']">修改</el-button>
<el-button link type="primary" icon="Upload" @click="handleUpload(scope.row)">上传</el-button>
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['design:volumeCatalog:remove']"
@ -94,9 +117,6 @@
<!-- 添加或修改卷册目录对话框 -->
<el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
<el-form ref="volumeCatalogFormRef" :model="form" :rules="rules" label-width="100px">
<el-form-item label="子项ID" prop="designSubitemId">
<el-input v-model="form.designSubitemId" placeholder="请输入设计子项ID" />
</el-form-item>
<el-form-item label="子项" prop="designSubitem">
<el-input v-model="form.designSubitem" placeholder="请输入设计子项" />
</el-form-item>
@ -106,14 +126,14 @@
<el-form-item label="负责人" prop="principal">
<el-input v-model="form.principal" placeholder="请输入负责人" />
</el-form-item>
<el-form-item label="计划完成时间" prop="plannedCompletion">
<el-date-picker v-model="form.plannedCompletion" type="date" value-format="YYYY-MM-DD" placeholder="请选择计划完成时间" />
</el-form-item>
<el-form-item label="设计状态" prop="designState">
<el-select v-model="form.designState" placeholder="请选择设计状态">
<el-option :value="item.value" v-for="item in design_state" :key="item.value" :label="item.label" />
</el-select>
</el-form-item>
<el-form-item label="计划出图时间" prop="plannedCompletion">
<el-date-picker v-model="form.plannedCompletion" type="date" value-format="YYYY-MM-DD" placeholder="请选择计划出图时间" />
</el-form-item>
<el-form-item label="卷册号" prop="volumeNumber">
<el-input v-model="form.volumeNumber" placeholder="请输入卷册号" />
</el-form-item>
@ -174,7 +194,7 @@ import { VolumeCatalogVO, VolumeCatalogQuery, VolumeCatalogForm } from '@/api/de
import { useUserStoreHook } from '@/store/modules/user';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { design_state } = toRefs(proxy?.useDict('design_state'));
const { design_state, wf_business_status } = toRefs(proxy?.useDict('design_state', 'wf_business_status'));
const volumeCatalogList = ref<VolumeCatalogVO[]>([]);
const buttonLoading = ref(false);
@ -365,6 +385,11 @@ const handleDelete = async (row?: VolumeCatalogVO) => {
await getList();
};
const handleUploadSuccess = async (flieList: any, res: any) => {
proxy?.$modal.msgSuccess('文件上传成功');
getList();
};
/** 导出按钮操作 */
const handleExport = () => {
proxy?.download(
@ -376,6 +401,14 @@ const handleExport = () => {
);
};
/** 审核按钮操作 */
const handleAudit = async (row?: VolumeCatalogVO) => {
proxy?.$tab.openPage('/design-management/volumeCatalog/indexEdit', '审核设计出图计划', {
id: row?.design,
type: 'update'
});
};
onMounted(() => {
getList();
});

View File

@ -0,0 +1,414 @@
<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.design"
:status="form.auditStatus"
: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"
v-loading="loading"
:disabled="routeParams.type === 'view'"
:model="form"
:rules="rules"
label-width="100px"
class="space-y-4"
>
<div class="grid grid-cols-1 gap-4">
<el-row>
<el-col :span="12">
<el-form-item label="子项" prop="designSubitem">
<el-input v-model="form.designSubitem" placeholder="请输入设计子项" disabled />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="专业" prop="specialty"> <el-input v-model="form.specialty" disabled placeholder="请输入专业" /> </el-form-item
></el-col>
<el-col :span="12">
<el-form-item label="负责人" prop="principal">
<el-input v-model="form.principal" placeholder="请输入负责人" disabled />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="设计状态" prop="designState">
<el-select v-model="form.designState" placeholder="请选择设计状态" disabled>
<el-option :value="item.value" v-for="item in design_state" :key="item.value" :label="item.label" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="计划出图时间" prop="plannedCompletion">
<el-date-picker
v-model="form.plannedCompletion"
type="date"
value-format="YYYY-MM-DD"
disabled
placeholder="请选择计划出图时间"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="卷册号" prop="volumeNumber">
<el-input v-model="form.volumeNumber" placeholder="请输入卷册号" disabled /> </el-form-item
></el-col>
<el-col :span="12">
<el-form-item label="资料名称" prop="documentName">
<el-input v-model="form.documentName" placeholder="请输入资料名称" disabled />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="备注" prop="remark"> <el-input v-model="form.remark" placeholder="请输入备注" disabled /> </el-form-item
></el-col>
<el-col :span="24" v-for="(item, index) in form.fileVoList">
<el-form-item :label="index == 0 ? '已上传文件' : ''" v-if="item.status == 1">
<el-link type="primary" :underline="false" :href="item.fileUrl" target="_blank">{{ item.fileName }}</el-link>
</el-form-item>
</el-col>
</el-row>
</div>
</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, LeaveQuery, LeaveVO } 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 { getDesignChange, addDesignChange, updateDesignChange } from '@/api/design/designChange';
import { getVolumeCatalog } from '@/api/design/volumeCatalog';
const { design_state } = toRefs<any>(proxy?.useDict('design_state'));
// 获取用户 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 + '_designTheDiagram',
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,
formNo: undefined,
projectName: undefined,
submitUnit: undefined,
specialty: undefined,
submitDate: undefined,
volumeName: undefined,
volumeNo: undefined,
attachmentPic: undefined,
changeReason: [],
changeContent: undefined,
costEstimation: undefined,
costEstimationFile: undefined,
fileId: undefined,
status: undefined,
remark: 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: {}
},
rules: {}
});
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 getVolumeCatalog(routeParams.value.id);
Object.assign(form.value, res.data);
loading.value = false;
buttonLoading.value = false;
});
};
/** 提交按钮 */
const submitForm = (status1: string) => {
status.value = status1;
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.design;
//流程变量
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);
};
// 图纸上传成功之后 开始提交
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.auditStatus === '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';
}
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>

View File

@ -0,0 +1,313 @@
<template>
<div class="p-6 bg-gray-50">
<div class="appWidth mx-auto bg-white rounded-xl shadow-sm overflow-hidden transition-all duration-300 hover:shadow-md">
<!-- 表单标题区域 -->
<div class="bg-gradient-to-r from-blue-500 to-blue-600 text-white p-6">
<h2 class="text-2xl font-bold flex items-center"><i class="el-icon-user-circle mr-3"></i>人员配置</h2>
<p class="text-blue-100 mt-2 opacity-90">请配置采购专员信息</p>
<!-- <span class="text-red-300">*</span> 为必填项 -->
</div>
<!-- 表单内容区域 -->
<el-form ref="leaveFormRef" :model="form" :rules="rules" label-width="120px" class="p-6 space-y-6">
<!-- 设计负责人 -->
<div class="fonts">
<el-form-item label="采购专员" prop="userId" class="mb-4">
<el-select
v-model="form.userId"
placeholder="请选择采购专员"
class="w-full transition-all duration-300 border-gray-300 focus:border-blue-400 focus:ring-1 focus:ring-blue-400"
>
<el-option v-for="item in userList" :key="item.userId" :label="item.nickName" :value="item.userId" />
</el-select>
</el-form-item>
</div>
<!-- 提交按钮区域 -->
<div class="flex justify-center space-x-6 mt-8 pt-6 border-t border-gray-100">
<el-button
type="primary"
@click="submitForm"
icon="Check"
class="px-8 py-2.5 transition-all duration-300 transform hover:scale-105 bg-blue-500 hover:bg-blue-600 text-white font-medium"
>
确认提交
</el-button>
<el-button @click="resetForm" icon="Refresh" class="px-8 py-2.5 transition-all duration-300 border-gray-300 hover:bg-gray-100 font-medium">
重置
</el-button>
</div>
</el-form>
</div>
</div>
</template>
<script setup name="PersonnelForm" lang="ts">
import { ref, reactive, computed, onMounted, toRefs } from 'vue';
import { getCurrentInstance } from 'vue';
import type { ComponentInternalInstance } from 'vue';
import { useUserStoreHook } from '@/store/modules/user';
import { listUserByDeptId } from '@/api/system/user';
import { ElMessage, ElLoading } from 'element-plus';
import { Delete } from '@element-plus/icons-vue';
import { designUserAdd, designUserDetail, systemUserList } from '@/api/materials/appointment';
// 获取当前实例
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
// 获取用户 store
const userStore = useUserStoreHook();
// 从 store 中获取当前选中的项目
const currentProject = computed(() => userStore.selectedProject);
// 专业字典数据
const { des_user_major } = toRefs<any>(proxy?.useDict('des_user_major'));
// 表单数据
const form = reactive({
id: null,
projectId: currentProject.value?.id,
userId: null // 设计负责人
});
// 表单验证规则
const rules = reactive({
userId: [{ required: true, message: '请选择采购专员', trigger: 'change' }]
});
// 用户列表
const userList = ref([]);
// 表单引用
const leaveFormRef = ref();
/** 查询当前部门的所有用户 */
const getDeptAllUser = async (deptId: any) => {
try {
const res = await systemUserList({ deptId });
// 实际项目中使用接口返回的数据
userList.value = res.rows;
} catch (error) {
ElMessage.error('获取用户列表失败');
} finally {
}
};
/** 查询当前表单数据并回显 */
const designUser = async () => {
if (!currentProject.value?.id) return;
const loading = ElLoading.service({
lock: true,
text: '加载配置数据中...',
background: 'rgba(255, 255, 255, 0.7)'
});
try {
const res = await designUserDetail(currentProject.value?.id);
if (res.code == 200) {
if (!res.data) {
resetForm();
form.id = null;
return;
}
Object.assign(form, res.data);
}
} catch (error) {
ElMessage.error('获取配置数据失败');
// 添加默认空项
} finally {
loading.close();
}
};
/** 提交表单 */
const submitForm = async () => {
if (!leaveFormRef.value) return;
try {
// 表单验证
await leaveFormRef.value.validate();
let userName = userList.value.find((item) => item.userId === form.userId)?.nickName;
const data = {
projectId: currentProject.value?.id,
userId: form.userId,
userName,
id: form.id
};
// 提交到后端
const res = await designUserAdd(data);
if (res.code === 200) {
ElMessage.success('提交成功');
} else {
ElMessage.error(res.msg || '提交失败');
}
} catch (error) {
ElMessage.error('请完善表单信息后再提交');
} finally {
// 关闭加载状态
ElLoading.service().close();
}
};
/** 重置表单 */
const resetForm = () => {
if (leaveFormRef.value) {
leaveFormRef.value.resetFields();
}
};
// 页面挂载时初始化数据
onMounted(() => {
console.log(userStore.deptId);
// 先获取用户列表,再加载表单数据
getDeptAllUser(userStore.deptId).then(() => {
designUser();
});
});
//监听项目id刷新数据
const listeningProject = watch(
() => currentProject.value.id,
(nid, oid) => {
getDeptAllUser(userStore.deptId).then(() => {
designUser();
});
}
);
onUnmounted(() => {
listeningProject();
});
</script>
<style lang="scss">
.appWidth {
width: 50vw;
max-width: 1200px;
.el-select__wrapper {
width: 16vw !important;
}
.el-button--small {
margin-bottom: 10px;
}
.fonts {
.el-form-item--default .el-form-item__label {
font-size: 18px !important;
}
}
}
// 自定义动画
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.animate-fadeIn {
animation: fadeIn 0.3s ease-out forwards;
}
// 表单样式优化
::v-deep .el-form {
--el-form-item-margin-bottom: 0;
}
::v-deep .el-form-item {
margin-bottom: 0;
&__label {
font-weight: 500;
color: #4e5969;
padding: 0 0 8px 0;
}
&__content {
padding: 0;
}
}
::v-deep .el-select {
width: 100%;
.el-input__inner {
border-radius: 6px;
transition: all 0.3s ease;
}
&:hover .el-input__inner {
border-color: #66b1ff;
}
&.el-select-focus .el-input__inner {
border-color: #409eff;
box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.2);
}
}
::v-deep .el-button {
border-radius: 6px;
padding: 8px 16px;
&--primary {
background-color: #409eff;
border-color: #409eff;
&:hover {
background-color: #66b1ff;
border-color: #66b1ff;
}
}
&--danger {
background-color: #f56c6c;
border-color: #f56c6c;
&:hover {
background-color: #f78989;
border-color: #f78989;
}
&:disabled {
background-color: #ffcccc;
border-color: #ffbbbb;
cursor: not-allowed;
}
}
}
// 响应式网格布局
.grid {
display: grid;
}
.grid-cols-1 {
grid-template-columns: repeat(1, minmax(0, 1fr));
}
.md\:grid-cols-2 {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.gap-4 {
gap: 1rem;
}
// 适配小屏幕
@media (max-width: 768px) {
.appWidth {
width: 95vw;
}
::v-deep .el-form {
padding: 4px;
}
::v-deep .el-form-item__label {
width: 100px;
}
}
</style>

View File

@ -7,7 +7,7 @@
<template #header>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5" :offset="0"
><el-button type="primary" size="default" @click="addBatch" icon="FolderAdd" plain>新增</el-button></el-col
><el-button type="primary" size="default" @click="handleAdd" icon="FolderAdd" plain>新增</el-button></el-col
>
<el-col :span="1.5" :offset="0"
><el-button type="danger" size="default" @click="handleDeleteBatch" icon="FolderDelete" plain>删除</el-button></el-col
@ -19,9 +19,9 @@
<el-tree
ref="batchTreeRef"
class="mt-2"
node-key="batchNumber"
node-key="id"
:data="batchOptions"
:props="{ label: 'batchNumber', children: 'children' }"
:props="{ label: 'planCode', children: 'children' }"
:expand-on-click-node="false"
highlight-current
default-expand-all
@ -29,17 +29,17 @@
>
<template #default="{ node, data }">
<div class="custom-tree-node">
{{node.label }}
<dict-tag :options="wf_business_status" :value="data.approvalProject" />
{{ node.label }}
<dict-tag :options="wf_business_status" :value="data.status" />
</div>
</template>
</el-tree>
<pagination
v-show="total > 0"
:total="total"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
@pagination="getBatchList"
v-model:page="queryParams.batchData.pageNum"
v-model:limit="queryParams.batchData.pageSize"
@pagination="getList"
layout="prev, pager, next,jumper"
/>
</el-card>
@ -48,11 +48,8 @@
<el-card shadow="never">
<template #header>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5" v-if="form.approvalProject == 'draft'">
<el-button type="primary" plain icon="SemiSelect" @click="handleAdd" v-hasPermi="['cailiaoshebei:cailiaoshebei:add']">选择</el-button>
</el-col>
<el-col :span="1.5" v-if="form.approvalProject == 'draft'">
<el-button type="success" plain icon="Check" @click="submitForm" v-hasPermi="['cailiaoshebei:cailiaoshebei:delete']">保存</el-button>
<el-col :span="1.5" v-if="form.mrpBaseBo.status == 'draft'">
<el-button type="primary" plain icon="Edit" @click="handleUpdata" v-hasPermi="['cailiaoshebei:cailiaoshebei:add']">修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button plain type="warning" icon="Finished" @click="handleAudit()" v-hasPermi="['out:monthPlan:remove']">审核</el-button>
@ -63,49 +60,98 @@
</template>
<el-table v-loading="loading" :data="cailiaoshebeiList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<!-- <el-table-column type="selection" width="55" align="center" /> -->
<!-- <el-table-column label="供货商ID" align="center" prop="supplierId" /> -->
<el-table-column label="供货商" align="center" prop="supplierCompany" />
<el-table-column label="设备材料名称" align="center" prop="name" />
<el-table-column label="物资名称" align="center" prop="name" />
<el-table-column label="质量标准" align="center" prop="qs" />
<el-table-column label="规格型号" align="center" prop="specification" />
<el-table-column label="物料编码" align="center" prop="materialCode" width="200" />
<el-table-column label="计量单位" align="center" prop="unit" width="80" />
<el-table-column label="供应周期(天)" align="center" prop="estimatedCycle" />
<el-table-column label="需求数量" align="center" prop="demandQuantity">
<template #default="scope">
<el-input v-model="scope.row.demandQuantity" type="number" :disabled="form.approvalProject != 'draft'"/>
</template>
</el-table-column>
<el-table-column label="计划到场时间" align="center" prop="arrivalTime" width="250">
<template #default="scope">
<div class="flex justify-center w100%">
<el-date-picker v-model="scope.row.arrivalTime" type="date" value-format="YYYY-MM-DD" :disabled="form.approvalProject != 'draft'" />
</div>
</template>
</el-table-column>
<el-table-column label="需求数量" align="center" prop="demandQuantity" />
<el-table-column label="需求到货时间" align="center" prop="arrivalTime" width="250" />
<el-table-column label="备注" align="center" prop="remark" />
</el-table>
<pagination
v-show="mainTotal > 0"
:total="mainTotal"
v-model:page="queryParams.mainData.pageNum"
v-model:limit="queryParams.mainData.pageSize"
@pagination="getMainList"
/>
</el-card>
</el-col>
</el-row>
<!-- 添加或修改物资-材料设备对话框 -->
<el-dialog :title="dialog.title" v-model="dialog.visible" width="650px" append-to-body>
<el-transfer
v-model="cailiaoshebeiSelectedList"
filterable
:data="cailiaoshebeiAllList"
:props="{
label: 'name',
key: 'cailiaoshebeiId'
}"
><template #default="{ option }">
{{ `${option.specification || ''} ${option.name || ''}` }}1
<el-dialog :title="dialog.title" v-model="dialog.visible" width="1250px" append-to-body>
<el-form :model="form" ref="cailiaoshebeiFormRef" :rules="rules" label-width="80px" :inline="false">
<el-divider>基础信息</el-divider>
<el-row :gutter="20">
<el-col :span="8" :offset="0">
<el-form-item label="物资类别" prop="mrpBaseBo.matCat">
<el-input v-model="form.mrpBaseBo.matCat" placeholder="请输入物资类别" />
</el-form-item>
</el-col>
<el-col :span="8" :offset="0">
<el-form-item label="编制日期" prop="mrpBaseBo.preparedDate">
<el-date-picker v-model="form.mrpBaseBo.preparedDate" type="date" value-format="YYYY-MM-DD" placeholder="请选择编制日期" />
</el-form-item>
</el-col>
<el-col :span="8" :offset="0">
<el-form-item label="计划编号" prop="mrpBaseBo.planCode">
<el-input v-model="form.mrpBaseBo.planCode" placeholder="请输入计划编号" />
</el-form-item>
</el-col>
</el-row>
<el-divider>主要信息</el-divider>
<el-table :data="form.planList">
<el-table-column prop="name" align="center" label="物资名称">
<template #default="scope">
<el-input v-model="scope.row.name" placeholder="请输入物资" />
</template>
</el-transfer>
</el-table-column>
<el-table-column prop="specification" align="center" label="规格型号" width="150">
<template #default="scope">
<el-input v-model="scope.row.specification" placeholder="请输入规格型号" />
</template>
</el-table-column>
<el-table-column prop="unit" align="center" label="单位" width="130">
<template #default="scope">
<el-input v-model="scope.row.unit" placeholder="请输入单位" />
</template>
</el-table-column>
<el-table-column prop="demandQuantity" align="center" label="数量" width="130">
<template #default="scope">
<el-input v-model="scope.row.demandQuantity" placeholder="请输入数量" type="number" min="0" />
</template>
</el-table-column>
<el-table-column prop="qs" align="center" label="质量标准" width="150">
<template #default="scope">
<el-input v-model="scope.row.qs" placeholder="请输入质量标准" />
</template>
</el-table-column>
<el-table-column prop="arrivalTime" align="center" label="需求到货时间">
<template #default="scope">
<el-date-picker v-model="scope.row.arrivalTime" type="date" value-format="YYYY-MM-DD" placeholder="请选择" style="width: 140px" />
</template>
</el-table-column>
<el-table-column prop="remark" align="center" label="备注" width="150">
<template #default="scope">
<el-input v-model="scope.row.remark" placeholder="请输入备注" />
</template>
</el-table-column>
<el-table-column prop="remark" align="center" label="操作" width="150">
<template #default="scope">
<el-button @click="addRow" type="success" icon="Plus" circle size="small" />
<el-button @click="delRow(scope.$index)" type="danger" icon="Delete" circle size="small" />
</template>
</el-table-column>
</el-table>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button :loading="buttonLoading" type="primary" @click="submitTransferForm"> </el-button>
<el-button @click="cancel"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</template>
</el-dialog>
@ -125,20 +171,15 @@ import {
listSelectCailiaoshebei
} from '@/api/materials/batchPlan';
import { CailiaoshebeiVO, CailiaoshebeiQuery, CailiaoshebeiForm } from '@/api/materials/batchPlan/types';
import { listContractor } from '@/api/project/contractor';
import { useUserStoreHook } from '@/store/modules/user';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { supply } = toRefs<any>(proxy?.useDict('supply'));
// 获取用户 store
const userStore = useUserStoreHook();
// 从 store 中获取项目列表和当前选中的项目
const currentProject = computed(() => userStore.selectedProject);
const batchTreeRef = ref<any>(null);
const cailiaoshebeiList = ref<CailiaoshebeiVO[]>([]);
const cailiaoshebeiAllList = ref<CailiaoshebeiVO[]>([]);
const cailiaoshebeiSelectedList = ref([]);
const buttonLoading = ref(false);
const loading = ref(false);
const showSearch = ref(true);
@ -146,6 +187,7 @@ const ids = ref<Array<string | number>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const mainTotal = ref(0);
const batchOptions = ref<any[]>([]);
const { wf_business_status } = toRefs<any>(proxy?.useDict('wf_business_status'));
@ -157,99 +199,110 @@ const dialog = reactive<DialogOption>({
title: ''
});
const initFormData: CailiaoshebeiForm = {
const initFormData: any = {
mrpBaseBo: {
id: undefined,
batchNumber: undefined,
supplierId: undefined,
addDataList: [],
preparedDate: undefined,
planCode: undefined,
matCat: undefined,
status: undefined,
projectId: currentProject.value.id
},
supplier: undefined,
planList: [
{
id: undefined,
name: undefined,
supply: undefined,
specification: undefined,
signalment: undefined,
materialCode: undefined,
arrivalTime: undefined,
approvalProject: undefined,
finishTime: undefined,
unit: undefined,
plan: undefined,
realQuantity: undefined,
projectId: currentProject.value.id,
demandQuantity: undefined,
qs: undefined,
arrivalTime: undefined,
remark: undefined
}
]
};
const data = reactive<PageData<CailiaoshebeiForm, CailiaoshebeiQuery>>({
const data = reactive({
form: { ...initFormData },
queryParams: {
batchData: {
pageNum: 1,
pageSize: 10,
batchNumber: undefined,
supplierId: undefined,
supplier: undefined,
name: undefined,
projectId: currentProject.value.id,
supply: undefined,
specification: undefined,
signalment: undefined,
materialCode: undefined,
arrivalTime: undefined,
finishTime: undefined,
unit: undefined,
plan: undefined,
realQuantity: undefined,
params: {}
planCode: undefined,
projectId: currentProject.value.id
},
mainData: {
pageNum: 1,
pageSize: 10,
mrpBaseId: undefined,
projectId: currentProject.value.id
}
},
rules: {
id: [{ required: true, message: '主键ID不能为空', trigger: 'blur' }]
id: [{ required: true, message: '主键ID不能为空', trigger: 'blur' }],
'mrpBaseBo.preparedDate': [{ required: true, message: '计划日期不能为空', trigger: 'blur' }],
'mrpBaseBo.planCode': [{ required: true, message: '计划编码不能为空', trigger: 'blur' }],
'mrpBaseBo.matCat': [{ required: true, message: '物资分类不能为空', trigger: 'blur' }]
}
});
const batchNumber = ref('');
const { queryParams, form, rules } = toRefs(data);
/** 查询物资-材料设备列表 */
const getList = async () => {
if (!queryParams.value.batchNumber) return;
const getList = async (type: string) => {
loading.value = true;
const res = await listCailiaoshebei(queryParams.value);
cailiaoshebeiList.value = res.rows;
loading.value = false;
};
//查询批次列表
const getBatchList = async () => {
const res = await listBatch(queryParams.value);
const res = await listBatch(queryParams.value.batchData);
batchOptions.value = res.rows;
total.value = res.total;
try {
queryParams.value.batchNumber = res.rows[0].batchNumber;
batchTreeRef.value.setCurrentKey(res.rows[0].batchNumber);
form.value.batchNumber = res.rows[0].batchNumber;
form.value.approvalProject = res.rows[0].approvalProject;
} catch (error) {
form.value.batchNumber = '';
queryParams.value.batchNumber = '';
if (res.rows && res.rows.length > 0 && !queryParams.value.mainData.mrpBaseId) {
batchTreeRef.value.setCurrentKey(res.rows[0].id);
queryParams.value.mainData.mrpBaseId = res.rows[0].id;
form.value.mrpBaseBo.status = res.rows[0].status;
}
getList();
total.value = res.total;
loading.value = false;
if (type === 'search') return;
getMainList();
};
/** 节点单击事件 */
const handleNodeClick = (data: any) => {
queryParams.value.batchNumber = data.batchNumber;
form.value.batchNumber = data.batchNumber;
form.value.approvalProject = data.approvalProject;
queryParams.value.mainData.mrpBaseId = data.id;
form.value.mrpBaseBo.status = data.status;
console.log('🚀 ~ handleNodeClick ~ form.value:', form.value);
if (data.batchNumber === '0') {
queryParams.value.batchNumber = '';
}
getList();
getMainList();
};
const getMainList = async () => {
if (!queryParams.value.mainData.mrpBaseId) return;
const res = await getBatch(queryParams.value.mainData);
cailiaoshebeiList.value = res.rows;
mainTotal.value = res.total;
};
const searchBatchList = async () => {
queryParams.value.batchNumber = batchNumber.value;
getBatchList();
queryParams.value.batchData.planCode = batchNumber.value;
getList('search');
};
//删除
const delRow = (index: number) => {
if (form.value.planList.length <= 1) return proxy?.$modal.msgWarning('请至少保留一项');
form.value.planList.splice(index, 1);
};
//新增
const addRow = () => {
form.value.planList.push({
name: undefined,
specification: undefined,
unit: undefined,
demandQuantity: undefined,
qs: undefined,
arrivalTime: undefined,
remark: undefined
});
};
/** 取消按钮 */
@ -260,23 +313,34 @@ const cancel = () => {
/** 表单重置 */
const reset = () => {
const preservedBatchId = form.value.batchNumber; // 先保存当前的 batchNumber
const status=form.value.approvalProject
form.value = { ...initFormData, batchNumber: preservedBatchId,approvalProject:status }; // 重置但保留
const status = form.value.mrpBaseBo.status;
form.value = { ...initFormData, status }; // 重置但保留
cailiaoshebeiFormRef.value?.resetFields();
form.value.mrpBaseBo.projectId = currentProject.value.id;
form.value.planList = [
{
name: undefined,
specification: undefined,
unit: undefined,
demandQuantity: undefined,
qs: undefined,
arrivalTime: undefined,
remark: undefined
}
];
};
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
};
// /** 搜索按钮操作 */
// const handleQuery = () => {
// queryParams.value.pageNum = 1;
// getList();
// };
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value?.resetFields();
handleQuery();
};
// /** 重置按钮操作 */
// const resetQuery = () => {
// queryFormRef.value?.resetFields();
// handleQuery();
// };
/** 多选框选中数据 */
const handleSelectionChange = (selection: CailiaoshebeiVO[]) => {
@ -288,15 +352,26 @@ const handleSelectionChange = (selection: CailiaoshebeiVO[]) => {
/** 新增按钮操作 */
const handleAdd = () => {
reset();
dialog.visible = true;
dialog.title = '新增物资-需求';
};
listSelectCailiaoshebei({
projectId: currentProject.value.id
}).then((res) => {
cailiaoshebeiAllList.value = res.rows;
const handleUpdata = () => {
reset();
getCailiaoshebei(queryParams.value.mainData.mrpBaseId).then((res: any) => {
form.value.mrpBaseBo = res.data.mrpBaseBo;
const allowedKeys = Object.keys(initFormData.planList[0]);
form.value.planList = res.data.planList.map((item) => {
return allowedKeys.reduce((obj, key) => {
obj[key] = item[key] ?? undefined;
return obj;
}, {});
});
console.log(form.value);
});
dialog.visible = true;
dialog.title = '选择物资-材料设备';
dialog.title = '修改物资-需求';
};
/** 提交按钮 */
@ -307,30 +382,32 @@ const submitForm = async () => {
delete item.id;
}
});
await addCailiaoshebei({ addDataList: cailiaoshebeiList.value,batchNumber:form.value.batchNumber,projectId:currentProject.value.id } as any).finally(() => (buttonLoading.value = false));
await addCailiaoshebei({
addDataList: cailiaoshebeiList.value,
batchNumber: form.value.batchNumber,
projectId: currentProject.value.id
} as any).finally(() => (buttonLoading.value = false));
proxy?.$modal.msgSuccess('操作成功');
dialog.visible = false;
};
/** 提交穿梭框数据 */
/** 提交数据 */
const submitTransferForm = async () => {
cailiaoshebeiList.value = cailiaoshebeiSelectedList.value.map((id) => {
const item = cailiaoshebeiAllList.value.find((option) => option.cailiaoshebeiId === id);
return item;
});
const result = validateAndClean(form.value.planList);
if (!result.valid) {
proxy?.$modal.msgError('验证失败,主要信息存在部分字段缺失的数据项');
return;
}
cailiaoshebeiFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
buttonLoading.value = true;
form.value.planList = result.data;
await updateCailiaoshebei(form.value).finally(() => (buttonLoading.value = false));
proxy?.$modal.msgSuccess('操作成功');
dialog.visible = false;
};
/** 新增批次 */
const addBatch = async () => {
await proxy?.$modal.confirm('是否确认新增批次?').finally(() => (loading.value = false));
await getBatch({ projectId: currentProject.value.id });
queryParams.value.batchNumber = '';
await getBatchList();
proxy?.$modal.msgSuccess('新增成功');
await getList();
}
});
};
/** 删除批次 */
@ -339,58 +416,63 @@ const handleDeleteBatch = async () => {
await proxy?.$modal.confirm('是否确认删除批次编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
await delBatch(_ids);
proxy?.$modal.msgSuccess('删除成功');
queryParams.value.batchNumber = '';
await getBatchList();
};
/** 删除按钮操作 */
const handleDelete = async (row?: CailiaoshebeiVO) => {
const _ids = row?.id || ids.value;
await proxy?.$modal.confirm('是否确认删除物资-材料设备编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
await delCailiaoshebei(_ids);
proxy?.$modal.msgSuccess('删除成功');
queryParams.value.mainData.mrpBaseId = undefined;
await getList();
};
//检测主要信息填写状况
function validateAndClean(arr) {
// 过滤掉全空的数据项
const cleanedArr = arr.filter((item) => !Object.values(item).every((v) => v === '' || v == null));
let hasFullItem = false; // 是否有一条全填数据
for (const item of cleanedArr) {
const keys = Object.keys(item).filter((k) => k !== 'remark' && k !== 'id');
const allFilled = keys.every((k) => item[k] !== '' && item[k] != null);
if (allFilled) {
hasFullItem = true; // 有一条全填
}
const allEmpty = Object.values(item).every((v) => v === '' || v == null);
// 如果不是全填,也不是全空(部分填) → 直接返回失败
if (!allFilled && !allEmpty) {
return { valid: false, data: cleanedArr };
}
}
// 如果没有至少一条全填,返回失败
if (!hasFullItem) {
return { valid: false, data: cleanedArr };
}
return { valid: true, data: cleanedArr };
}
/** 审核按钮操作 */
const handleAudit = async () => {
if (!form.value.approvalProject) {
if (!form.value.mrpBaseBo.status) {
proxy?.$modal.msgError('请选择批次号');
return;
}
proxy?.$tab.closePage(proxy.$route);
proxy?.$tab.openPage('/materials-management/batchPlan/indexEdit', '审核物资设备批次需求计划', {
id: form.value.batchNumber,
approvalProject: form.value.approvalProject + '_batchRequirements',
id: queryParams.value.mainData.mrpBaseId,
status: form.value.mrpBaseBo.status + '_batchRequirements',
type: 'update'
});
};
/** 查询供货商列表 */
const supplierOptions = ref([]);
const getSupplierList = async () => {
const res = await listContractor({
projectId: currentProject.value.id,
pageNum: 1,
pageSize: 10000
});
supplierOptions.value = res.rows;
};
onMounted(() => {
getBatchList();
getSupplierList();
getList();
// getSupplierList();
});
//监听项目id刷新数据
const listeningProject = watch(
() => currentProject.value.id,
(nid, oid) => {
queryParams.value.projectId = nid;
form.value.projectId = nid;
getBatchList();
getSupplierList();
queryParams.value.mainData.projectId = nid;
form.value.mrpBaseBo.projectId = nid;
getList();
}
);
@ -407,5 +489,4 @@ onUnmounted(() => {
font-size: 14px;
padding-right: 8px;
}
</style
</style>

View File

@ -8,8 +8,8 @@
@approvalVerifyOpen="approvalVerifyOpen"
@handleApprovalRecord="handleApprovalRecord"
:buttonLoading="buttonLoading"
:id="form.id"
:status="form.approvalProject"
:id="form.mrpBaseBo.id"
:status="form.mrpBaseBo.status"
:pageType="routeParams.type"
/>
</el-card>
@ -17,17 +17,36 @@
<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>
<el-row :gutter="20">
<el-col :span="8" :offset="0">
<el-form-item label="物资类别" prop="mrpBaseBo.matCat">
<el-input v-model="form.mrpBaseBo.matCat" placeholder="请输入物资类别" disabled />
</el-form-item>
</el-col>
<el-col :span="8" :offset="0">
<el-form-item label="编制日期" prop="mrpBaseBo.preparedDate">
<el-date-picker v-model="form.mrpBaseBo.preparedDate" type="date" value-format="YYYY-MM-DD" disabled placeholder="请选择编制日期" />
</el-form-item>
</el-col>
<el-col :span="8" :offset="0">
<el-form-item label="计划编号" prop="mrpBaseBo.planCode">
<el-input v-model="form.mrpBaseBo.planCode" placeholder="请输入计划编号" disabled />
</el-form-item>
</el-col>
</el-row>
</div>
<div class="p-6">
<el-table v-loading="loading" :data="cailiaoshebeiList">
<el-table-column label="供货商" align="center" prop="supplierCompany" />
<el-table-column label="设备材料名称" align="center" prop="name" />
<!-- <el-table-column type="selection" width="55" align="center" /> -->
<!-- <el-table-column label="供货商ID" align="center" prop="supplierId" /> -->
<el-table-column label="物资名称" align="center" prop="name" />
<el-table-column label="质量标准" align="center" prop="qs" />
<el-table-column label="规格型号" align="center" prop="specification" />
<el-table-column label="物料编码" align="center" prop="materialCode" width="200" />
<el-table-column label="计量单位" align="center" prop="unit" width="80" />
<el-table-column label="供应周期(天)" align="center" prop="estimatedCycle" />
<el-table-column label="需求数量" align="center" prop="demandQuantity" />
<el-table-column label="计划到场时间" align="center" prop="arrivalTime" width="250" />
<el-table-column label="需求到货时间" align="center" prop="arrivalTime" width="250" />
<el-table-column label="备注" align="center" prop="remark" />
</el-table>
</div>
</el-card>
@ -77,7 +96,7 @@ const { design_change_reason_type } = toRefs<any>(proxy?.useDict('design_change_
import { getKnowledgeDocument } from '@/api/design/technicalStandard';
import { getConstructionValue } from '@/api/out/constructionValue';
import { workScheduleListDetail } from '@/api/progress/plan';
import { getCailiaoshebei } from '@/api/materials/suppliesprice';
import { getCailiaoshebei } from '@/api/materials/batchPlan';
import { getPcDetail, listCailiaoshebei } from '@/api/materials/batchPlan';
import { CailiaoshebeiVO } from '@/api/materials/batchPlan/types';
// 获取用户 store
@ -101,7 +120,7 @@ const approvalRecordRef = ref<InstanceType<typeof ApprovalRecord>>();
//按钮组件
const flowCodeOptions = [
{
value: currentProject.value?.id + '_batchRequirements',
value: currentProject.value?.id + '_mrp',
label: '物资供应总计划审批'
}
];
@ -121,9 +140,28 @@ const taskVariables = ref<Record<string, any>>({});
const selectValue = ref<string[]>([]);
const cailiaoshebeiList = ref<CailiaoshebeiVO[]>([]);
const initFormData = {
const initFormData: any = {
mrpBaseBo: {
id: undefined,
approvalProject: undefined
preparedDate: undefined,
planCode: undefined,
matCat: undefined,
status: undefined,
projectId: currentProject.value.id
},
planList: [
{
id: undefined,
name: undefined,
specification: undefined,
unit: undefined,
demandQuantity: undefined,
qs: undefined,
arrivalTime: undefined,
remark: undefined
}
]
};
const data = reactive({
form: { ...initFormData },
@ -148,18 +186,11 @@ const getInfo = () => {
loading.value = true;
buttonLoading.value = false;
nextTick(async () => {
const id = routeParams.value.id.split('_')[0];
const res = await listCailiaoshebei({ pageNum: 1, pageSize: 10, batchNumber: id });
cailiaoshebeiList.value = res.rows;
if (!form.value.approvalProject) {
const res = await getPcDetail(id);
form.value.approvalProject = res.data.approvalProject;
} else {
form.value.approvalProject = routeParams.value.approvalProject;
}
console.log('🚀 ~ getInfo ~ form.value.approvalProject:', form.value.approvalProject);
form.value.id = routeParams.value.id;
const id = routeParams.value.id;
const res: any = await getCailiaoshebei(id);
cailiaoshebeiList.value = res.data.planList;
Object.assign(form.value, res.data);
console.log('🚀 ~ getInfo ~ form.value:', form.value);
loading.value = false;
buttonLoading.value = false;
@ -177,10 +208,10 @@ const submitFlow = async () => {
dialogVisible.visible = false;
};
//提交申请
const handleStartWorkFlow = async (data: LeaveForm) => {
const handleStartWorkFlow = async (data: any) => {
try {
submitFormData.value.flowCode = flowCode.value;
submitFormData.value.businessId = data.id;
submitFormData.value.businessId = data.mrpBaseBo.id;
//流程变量
taskVariables.value = {
// leave4/5 使用的流程变量
@ -198,7 +229,7 @@ const handleStartWorkFlow = async (data: LeaveForm) => {
};
//审批记录
const handleApprovalRecord = () => {
approvalRecordRef.value.init(form.value.id);
approvalRecordRef.value.init(form.value.mrpBaseBo.id);
};
//提交回调
const submitCallback = async () => {
@ -218,7 +249,7 @@ const submit = async (status, data) => {
proxy.$tab.closePage(proxy.$route);
proxy.$router.go(-1);
} else {
if ((form.value.approvalProject === 'draft' && (flowCode.value === '' || flowCode.value === null)) || routeParams.value.type === 'add') {
if ((form.value.mrpBaseBo.status === 'draft' && (flowCode.value === '' || flowCode.value === null)) || routeParams.value.type === 'add') {
flowCode.value = flowCodeOptions[0].value;
dialogVisible.visible = true;
return;