物资使用计划
This commit is contained in:
		| @ -203,6 +203,18 @@ const handleFile = async (row) => { | ||||
| onMounted(() => { | ||||
|   getList(); | ||||
| }); | ||||
| //监听项目id刷新数据 | ||||
| const listeningProject = watch( | ||||
|   () => currentProject.value?.id, | ||||
|   (nid, oid) => { | ||||
|     queryParams.value.projectId = nid; | ||||
|     getList(); | ||||
|   } | ||||
| ); | ||||
|  | ||||
| onUnmounted(() => { | ||||
|   listeningProject(); | ||||
| }); | ||||
| </script> | ||||
|  | ||||
| <style lang="scss"> | ||||
|  | ||||
| @ -16,7 +16,7 @@ | ||||
|       <!-- 表单区域 --> | ||||
|       <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> | ||||
|           <h3 class="text-lg font-semibold text-gray-800">物资设备清单</h3> | ||||
|         </div> | ||||
|         <div class="p-6"> | ||||
|           <el-form | ||||
|  | ||||
| @ -26,14 +26,7 @@ | ||||
|         <el-table-column label="操作"> | ||||
|           <template #default="scope"> | ||||
|             <el-button link type="primary" icon="Download" @click="onExport(scope.row.fileUrl)">下载</el-button> | ||||
|             <el-button | ||||
|               type="success" | ||||
|               link | ||||
|               icon="edit" | ||||
|               v-show="scope.row.status == 'draft' || scope.row.status == 'waiting'" | ||||
|               @click="onUpdate(scope.row)" | ||||
|               >审核</el-button | ||||
|             > | ||||
|             <el-button type="success" link icon="edit" v-show="scope.row.status == 'draft'" @click="onUpdate(scope.row)">审核</el-button> | ||||
|             <el-button link type="warning" v-show="scope.row.status != 'draft'" icon="View" @click="onView(scope.row)">查看流程</el-button> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|  | ||||
| @ -60,7 +60,7 @@ | ||||
|             <dict-tag v-if="scope.row.fileId != null" :options="wf_business_status" :value="scope.row.status" /> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <el-table-column label="变更文件" align="center" prop="remark" width="150"> | ||||
|         <el-table-column label="变更文件" align="center" width="150"> | ||||
|           <template #default="scope"> | ||||
|             <el-button | ||||
|               link | ||||
| @ -81,13 +81,24 @@ | ||||
|         <el-table-column label="备注" align="center" prop="remark" width="150" /> | ||||
|         <el-table-column label="操作" fixed="right" width="300"> | ||||
|           <template #default="scope"> | ||||
|             <el-button type="primary" link icon="Upload" @click="handleAddChange(scope.row)" v-if="!scope.row.fileId">上传</el-button> | ||||
|             <el-button | ||||
|               type="primary" | ||||
|               link | ||||
|               icon="Upload" | ||||
|               @click="handleAddChange(scope.row)" | ||||
|               v-if="scope.row.status == 'draft' || scope.row.status == 'back'" | ||||
|               >上传</el-button | ||||
|             > | ||||
|             <el-button type="success" link icon="View" v-if="scope.row.status != 'draft'" @click="handleViewInfo(scope.row)">查看</el-button> | ||||
|             <el-button type="success" link icon="View" @click="handleViewDetail(scope.row)">通知单</el-button> | ||||
|             <!-- <el-tooltip content="查看文档" placement="top"> | ||||
|               <el-button link type="primary" icon="Document" @click="handleView(scope.row)"></el-button> | ||||
|             </el-tooltip> --> | ||||
|             <el-button type="warning" link icon="View" v-if="scope.row.status != 'draft'" @click="handleViewHistory(scope.row)">查看单据</el-button> | ||||
|             <el-button | ||||
|               type="warning" | ||||
|               link | ||||
|               icon="View" | ||||
|               v-if="scope.row.status == 'draft' || scope.row.status == 'termination'" | ||||
|               @click="handleViewHistory(scope.row)" | ||||
|               >查看单据</el-button | ||||
|             > | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|       </el-table> | ||||
|  | ||||
| @ -236,7 +236,10 @@ const data = reactive({ | ||||
|     newest: undefined, | ||||
|     params: {} | ||||
|   }, | ||||
|   rules: {} | ||||
|   rules: { | ||||
|     // 卷册号 | ||||
|     volumeNo: [{ required: true, message: '请请选择卷册号', trigger: 'change' }] | ||||
|   } | ||||
| }); | ||||
|  | ||||
| const { form, rules } = toRefs(data); | ||||
|  | ||||
| @ -13,7 +13,6 @@ | ||||
|           :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"> | ||||
|  | ||||
| @ -319,6 +319,18 @@ function importExcel(options) { | ||||
| onMounted(() => { | ||||
|   getList(); | ||||
| }); | ||||
| //监听项目id刷新数据 | ||||
| const listeningProject = watch( | ||||
|   () => currentProject.value?.id, | ||||
|   (nid, oid) => { | ||||
|     queryParams.value.projectId = nid; | ||||
|     getList(); | ||||
|   } | ||||
| ); | ||||
|  | ||||
| onUnmounted(() => { | ||||
|   listeningProject(); | ||||
| }); | ||||
| </script> | ||||
| <style lang="scss"> | ||||
| .drawingreview { | ||||
|  | ||||
| @ -25,7 +25,7 @@ | ||||
|           <el-col :span="1.5"> | ||||
|             <el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['design:volumeCatalog:add']">新增</el-button> | ||||
|           </el-col> | ||||
|           <el-col :span="1.5"> | ||||
|           <!-- <el-col :span="1.5"> | ||||
|             <file-upload | ||||
|               v-model="form.file" | ||||
|               isImportInfo | ||||
| @ -41,7 +41,7 @@ | ||||
|             > | ||||
|               <el-button type="warning" plain icon="Upload">导入</el-button> | ||||
|             </file-upload> | ||||
|           </el-col> | ||||
|           </el-col> --> | ||||
|           <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> | ||||
|         </el-row> | ||||
|       </template> | ||||
| @ -79,7 +79,7 @@ | ||||
|             <el-button | ||||
|               link | ||||
|               type="primary" | ||||
|               v-if="scope.row.auditStatus != 'finish' && scope.row.auditStatus != 'termination'" | ||||
|               v-if="scope.row.auditStatus != 'finish' && scope.row.auditStatus != 'termination' && scope.row.auditStatus != 'waiting'" | ||||
|               icon="Edit" | ||||
|               @click="handleUpdate(scope.row)" | ||||
|               v-hasPermi="['design:volumeCatalog:edit']" | ||||
| @ -111,7 +111,12 @@ | ||||
|               v-hasPermi="['out:monthPlan:remove']" | ||||
|               >查看流程</el-button | ||||
|             > | ||||
|             <el-button type="warning" link icon="View" v-if="scope.row.auditType != 'draft'" @click="handleViewHistory(scope.row)" | ||||
|             <el-button | ||||
|               type="warning" | ||||
|               link | ||||
|               icon="View" | ||||
|               v-if="scope.row.auditType == 'back' || scope.row.auditStatus == 'termination'" | ||||
|               @click="handleViewHistory(scope.row)" | ||||
|               >查看单据</el-button | ||||
|             > | ||||
|           </template> | ||||
| @ -135,11 +140,11 @@ | ||||
|             <el-option v-for="item in userAppList" :key="item.userId" :label="item.userName" :value="item.userId" /> | ||||
|           </el-select> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="设计状态" prop="designState"> | ||||
|         <!-- <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> --> | ||||
|         <el-form-item label="计划出图时间" prop="plannedCompletion"> | ||||
|           <el-date-picker v-model="form.plannedCompletion" type="date" value-format="YYYY-MM-DD" placeholder="请选择计划出图时间" /> | ||||
|         </el-form-item> | ||||
|  | ||||
							
								
								
									
										360
									
								
								src/views/formalities/formalitiesAreConsolidated/index.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										360
									
								
								src/views/formalities/formalitiesAreConsolidated/index.vue
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,360 @@ | ||||
| <template> | ||||
|   <div class="p-2"> | ||||
|     <transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave"> | ||||
|       <div v-show="showSearch" class="mb-[10px]"> | ||||
|         <el-card shadow="hover"> | ||||
|           <el-form ref="queryFormRef" :model="queryParams" :inline="true"> | ||||
|             <el-form-item label="手续办理清单模板父id" prop="formalitiesPid"> | ||||
|               <el-input v-model="queryParams.formalitiesPid" placeholder="请输入手续办理清单模板父id" clearable @keyup.enter="handleQuery" /> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="手续办理清单模板id" prop="formalitiesId"> | ||||
|               <el-input v-model="queryParams.formalitiesId" placeholder="请输入手续办理清单模板id" clearable @keyup.enter="handleQuery" /> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="计划开始时间" prop="planTheStartTime"> | ||||
|               <el-date-picker | ||||
|                 clearable | ||||
|                 v-model="queryParams.planTheStartTime" | ||||
|                 type="date" | ||||
|                 value-format="YYYY-MM-DD" | ||||
|                 placeholder="请选择计划开始时间" | ||||
|               /> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="负责人" prop="head"> | ||||
|               <el-input v-model="queryParams.head" placeholder="请输入负责人" clearable @keyup.enter="handleQuery" /> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="实际完成时间" prop="actualCompletionTime"> | ||||
|               <el-date-picker | ||||
|                 clearable | ||||
|                 v-model="queryParams.actualCompletionTime" | ||||
|                 type="date" | ||||
|                 value-format="YYYY-MM-DD" | ||||
|                 placeholder="请选择实际完成时间" | ||||
|               /> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="手续材料" prop="formalitiesUrl"> | ||||
|               <el-input v-model="queryParams.formalitiesUrl" placeholder="请输入手续材料" clearable @keyup.enter="handleQuery" /> | ||||
|             </el-form-item> | ||||
|             <el-form-item> | ||||
|               <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button> | ||||
|               <el-button icon="Refresh" @click="resetQuery">重置</el-button> | ||||
|             </el-form-item> | ||||
|           </el-form> | ||||
|         </el-card> | ||||
|       </div> | ||||
|     </transition> | ||||
|  | ||||
|     <el-card shadow="never"> | ||||
|       <template #header> | ||||
|         <el-row :gutter="10" class="mb8"> | ||||
|           <el-col :span="1.5"> | ||||
|             <el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['formalities:formalitiesAreConsolidated:add']" | ||||
|               >新增</el-button | ||||
|             > | ||||
|           </el-col> | ||||
|           <el-col :span="1.5"> | ||||
|             <el-button | ||||
|               type="success" | ||||
|               plain | ||||
|               icon="Edit" | ||||
|               :disabled="single" | ||||
|               @click="handleUpdate()" | ||||
|               v-hasPermi="['formalities:formalitiesAreConsolidated:edit']" | ||||
|               >修改</el-button | ||||
|             > | ||||
|           </el-col> | ||||
|           <el-col :span="1.5"> | ||||
|             <el-button | ||||
|               type="danger" | ||||
|               plain | ||||
|               icon="Delete" | ||||
|               :disabled="multiple" | ||||
|               @click="handleDelete()" | ||||
|               v-hasPermi="['formalities:formalitiesAreConsolidated:remove']" | ||||
|               >删除</el-button | ||||
|             > | ||||
|           </el-col> | ||||
|           <el-col :span="1.5"> | ||||
|             <el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['formalities:formalitiesAreConsolidated:export']" | ||||
|               >导出</el-button | ||||
|             > | ||||
|           </el-col> | ||||
|           <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> | ||||
|         </el-row> | ||||
|       </template> | ||||
|  | ||||
|       <el-table v-loading="loading" :data="formalitiesAreConsolidatedList" @selection-change="handleSelectionChange"> | ||||
|         <el-table-column type="selection" width="55" align="center" /> | ||||
|         <el-table-column label="手续办理清单模板父id" align="center" prop="formalitiesPid" /> | ||||
|         <el-table-column label="手续办理清单模板id" align="center" prop="formalitiesId" /> | ||||
|         <el-table-column label="计划开始时间" align="center" prop="planTheStartTime" width="180"> | ||||
|           <template #default="scope"> | ||||
|             <span>{{ parseTime(scope.row.planTheStartTime, '{y}-{m}-{d}') }}</span> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <el-table-column label="负责人" align="center" prop="head" /> | ||||
|         <el-table-column label="实际完成时间" align="center" prop="actualCompletionTime" width="180"> | ||||
|           <template #default="scope"> | ||||
|             <span>{{ parseTime(scope.row.actualCompletionTime, '{y}-{m}-{d}') }}</span> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <el-table-column label="办理状态" align="center" prop="processingStatus" /> | ||||
|         <el-table-column label="手续材料" align="center" prop="formalitiesUrl" /> | ||||
|         <el-table-column label="备注" align="center" prop="remark" /> | ||||
|         <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> | ||||
|           <template #default="scope"> | ||||
|             <el-tooltip content="修改" placement="top"> | ||||
|               <el-button | ||||
|                 link | ||||
|                 type="primary" | ||||
|                 icon="Edit" | ||||
|                 @click="handleUpdate(scope.row)" | ||||
|                 v-hasPermi="['formalities:formalitiesAreConsolidated:edit']" | ||||
|               ></el-button> | ||||
|             </el-tooltip> | ||||
|             <el-tooltip content="删除" placement="top"> | ||||
|               <el-button | ||||
|                 link | ||||
|                 type="primary" | ||||
|                 icon="Delete" | ||||
|                 @click="handleDelete(scope.row)" | ||||
|                 v-hasPermi="['formalities:formalitiesAreConsolidated:remove']" | ||||
|               ></el-button> | ||||
|             </el-tooltip> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|       </el-table> | ||||
|  | ||||
|       <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" /> | ||||
|     </el-card> | ||||
|     <!-- 添加或修改合规性手续合账对话框 --> | ||||
|     <el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body> | ||||
|       <el-form ref="formalitiesAreConsolidatedFormRef" :model="form" :rules="rules" label-width="160px"> | ||||
|         <el-form-item label="手续办理清单模板父id" prop="formalitiesPid"> | ||||
|           <el-input v-model="form.formalitiesPid" placeholder="请输入手续办理清单模板父id" /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="手续办理清单模板id" prop="formalitiesId"> | ||||
|           <el-input v-model="form.formalitiesId" placeholder="请输入手续办理清单模板id" /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="计划开始时间" prop="planTheStartTime"> | ||||
|           <el-date-picker | ||||
|             clearable | ||||
|             v-model="form.planTheStartTime" | ||||
|             type="datetime" | ||||
|             value-format="YYYY-MM-DD HH:mm:ss" | ||||
|             placeholder="请选择计划开始时间" | ||||
|           > | ||||
|           </el-date-picker> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="负责人" prop="head"> | ||||
|           <el-input v-model="form.head" placeholder="请输入负责人" /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="实际完成时间" prop="actualCompletionTime"> | ||||
|           <el-date-picker | ||||
|             clearable | ||||
|             v-model="form.actualCompletionTime" | ||||
|             type="datetime" | ||||
|             value-format="YYYY-MM-DD HH:mm:ss" | ||||
|             placeholder="请选择实际完成时间" | ||||
|           > | ||||
|           </el-date-picker> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="手续材料" prop="formalitiesUrl"> | ||||
|           <el-input v-model="form.formalitiesUrl" placeholder="请输入手续材料" /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="备注" prop="remark"> | ||||
|           <el-input v-model="form.remark" placeholder="请输入备注" /> | ||||
|         </el-form-item> | ||||
|       </el-form> | ||||
|       <template #footer> | ||||
|         <div class="dialog-footer"> | ||||
|           <el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button> | ||||
|           <el-button @click="cancel">取 消</el-button> | ||||
|         </div> | ||||
|       </template> | ||||
|     </el-dialog> | ||||
|   </div> | ||||
| </template> | ||||
|  | ||||
| <script setup name="FormalitiesAreConsolidated" lang="ts"> | ||||
| import { | ||||
|   listFormalitiesAreConsolidated, | ||||
|   getFormalitiesAreConsolidated, | ||||
|   delFormalitiesAreConsolidated, | ||||
|   addFormalitiesAreConsolidated, | ||||
|   updateFormalitiesAreConsolidated | ||||
| } from '@/api/formalities/formalitiesAreConsolidated'; | ||||
| import { | ||||
|   FormalitiesAreConsolidatedVO, | ||||
|   FormalitiesAreConsolidatedQuery, | ||||
|   FormalitiesAreConsolidatedForm | ||||
| } from '@/api/formalities/formalitiesAreConsolidated/types'; | ||||
| import { useUserStoreHook } from '@/store/modules/user'; | ||||
|  | ||||
| const { proxy } = getCurrentInstance() as ComponentInternalInstance; | ||||
| // 获取用户 store | ||||
| const userStore = useUserStoreHook(); | ||||
| // 从 store 中获取项目列表和当前选中的项目 | ||||
| const currentProject = computed(() => userStore.selectedProject); | ||||
| const formalitiesAreConsolidatedList = ref<FormalitiesAreConsolidatedVO[]>([]); | ||||
| const buttonLoading = ref(false); | ||||
| 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 queryFormRef = ref<ElFormInstance>(); | ||||
| const formalitiesAreConsolidatedFormRef = ref<ElFormInstance>(); | ||||
|  | ||||
| const dialog = reactive<DialogOption>({ | ||||
|   visible: false, | ||||
|   title: '' | ||||
| }); | ||||
|  | ||||
| const initFormData: FormalitiesAreConsolidatedForm = { | ||||
|   id: undefined, | ||||
|   projectId: currentProject.value?.id, | ||||
|   formalitiesPid: undefined, | ||||
|   formalitiesId: undefined, | ||||
|   planTheStartTime: undefined, | ||||
|   head: undefined, | ||||
|   actualCompletionTime: undefined, | ||||
|   processingStatus: undefined, | ||||
|   formalitiesUrl: undefined, | ||||
|   remark: undefined | ||||
| }; | ||||
| const data = reactive<PageData<FormalitiesAreConsolidatedForm, FormalitiesAreConsolidatedQuery>>({ | ||||
|   form: { ...initFormData }, | ||||
|   queryParams: { | ||||
|     pageNum: 1, | ||||
|     pageSize: 10, | ||||
|     projectId: currentProject.value?.id, | ||||
|     formalitiesPid: undefined, | ||||
|     formalitiesId: undefined, | ||||
|     planTheStartTime: undefined, | ||||
|     head: undefined, | ||||
|     actualCompletionTime: undefined, | ||||
|     processingStatus: undefined, | ||||
|     formalitiesUrl: undefined, | ||||
|     params: {} | ||||
|   }, | ||||
|   rules: { | ||||
|     id: [{ required: true, message: '不能为空', trigger: 'blur' }] | ||||
|   } | ||||
| }); | ||||
|  | ||||
| const { queryParams, form, rules } = toRefs(data); | ||||
|  | ||||
| /** 查询合规性手续合账列表 */ | ||||
| const getList = async () => { | ||||
|   loading.value = true; | ||||
|   const res = await listFormalitiesAreConsolidated(queryParams.value); | ||||
|   formalitiesAreConsolidatedList.value = res.data; | ||||
|   total.value = res.total; | ||||
|   loading.value = false; | ||||
| }; | ||||
|  | ||||
| /** 取消按钮 */ | ||||
| const cancel = () => { | ||||
|   reset(); | ||||
|   dialog.visible = false; | ||||
| }; | ||||
|  | ||||
| /** 表单重置 */ | ||||
| const reset = () => { | ||||
|   form.value = { ...initFormData }; | ||||
|   formalitiesAreConsolidatedFormRef.value?.resetFields(); | ||||
| }; | ||||
|  | ||||
| /** 搜索按钮操作 */ | ||||
| const handleQuery = () => { | ||||
|   queryParams.value.pageNum = 1; | ||||
|   getList(); | ||||
| }; | ||||
|  | ||||
| /** 重置按钮操作 */ | ||||
| const resetQuery = () => { | ||||
|   queryFormRef.value?.resetFields(); | ||||
|   handleQuery(); | ||||
| }; | ||||
|  | ||||
| /** 多选框选中数据 */ | ||||
| const handleSelectionChange = (selection: FormalitiesAreConsolidatedVO[]) => { | ||||
|   ids.value = selection.map((item) => item.id); | ||||
|   single.value = selection.length != 1; | ||||
|   multiple.value = !selection.length; | ||||
| }; | ||||
|  | ||||
| /** 新增按钮操作 */ | ||||
| const handleAdd = () => { | ||||
|   reset(); | ||||
|   dialog.visible = true; | ||||
|   dialog.title = '添加合规性手续合账'; | ||||
| }; | ||||
|  | ||||
| /** 修改按钮操作 */ | ||||
| const handleUpdate = async (row?: FormalitiesAreConsolidatedVO) => { | ||||
|   reset(); | ||||
|   const _id = row?.id || ids.value[0]; | ||||
|   const res = await getFormalitiesAreConsolidated(_id); | ||||
|   Object.assign(form.value, res.data); | ||||
|   dialog.visible = true; | ||||
|   dialog.title = '修改合规性手续合账'; | ||||
| }; | ||||
|  | ||||
| /** 提交按钮 */ | ||||
| const submitForm = () => { | ||||
|   formalitiesAreConsolidatedFormRef.value?.validate(async (valid: boolean) => { | ||||
|     if (valid) { | ||||
|       buttonLoading.value = true; | ||||
|       if (form.value.id) { | ||||
|         await updateFormalitiesAreConsolidated(form.value).finally(() => (buttonLoading.value = false)); | ||||
|       } else { | ||||
|         await addFormalitiesAreConsolidated(form.value).finally(() => (buttonLoading.value = false)); | ||||
|       } | ||||
|       proxy?.$modal.msgSuccess('操作成功'); | ||||
|       dialog.visible = false; | ||||
|       await getList(); | ||||
|     } | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| /** 删除按钮操作 */ | ||||
| const handleDelete = async (row?: FormalitiesAreConsolidatedVO) => { | ||||
|   const _ids = row?.id || ids.value; | ||||
|   await proxy?.$modal.confirm('是否确认删除合规性手续合账编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false)); | ||||
|   await delFormalitiesAreConsolidated(_ids); | ||||
|   proxy?.$modal.msgSuccess('删除成功'); | ||||
|   await getList(); | ||||
| }; | ||||
|  | ||||
| /** 导出按钮操作 */ | ||||
| const handleExport = () => { | ||||
|   proxy?.download( | ||||
|     'formalities/formalitiesAreConsolidated/export', | ||||
|     { | ||||
|       ...queryParams.value | ||||
|     }, | ||||
|     `formalitiesAreConsolidated_${new Date().getTime()}.xlsx` | ||||
|   ); | ||||
| }; | ||||
|  | ||||
| onMounted(() => { | ||||
|   getList(); | ||||
| }); | ||||
|  | ||||
| //监听项目id刷新数据 | ||||
| const listeningProject = watch( | ||||
|   () => currentProject.value?.id, | ||||
|   (nid, oid) => { | ||||
|     queryParams.value.projectId = nid; | ||||
|     form.value.projectId = nid; | ||||
|     getList(); | ||||
|   } | ||||
| ); | ||||
|  | ||||
| onUnmounted(() => { | ||||
|   listeningProject(); | ||||
| }); | ||||
| </script> | ||||
							
								
								
									
										277
									
								
								src/views/formalities/listOfFormalities/index.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										277
									
								
								src/views/formalities/listOfFormalities/index.vue
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,277 @@ | ||||
| <template> | ||||
|   <div class="p-2"> | ||||
|     <transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave"> | ||||
|       <div v-show="showSearch" class="mb-[10px]"> | ||||
|         <el-card shadow="hover"> | ||||
|           <el-form ref="queryFormRef" :model="queryParams" :inline="true"> | ||||
|             <el-form-item label="名称" prop="name"> | ||||
|               <el-input v-model="queryParams.name" placeholder="请输入名称" clearable @keyup.enter="handleQuery" /> | ||||
|             </el-form-item> | ||||
|             <el-form-item> | ||||
|               <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button> | ||||
|               <el-button icon="Refresh" @click="resetQuery">重置</el-button> | ||||
|             </el-form-item> | ||||
|           </el-form> | ||||
|         </el-card> | ||||
|       </div> | ||||
|     </transition> | ||||
|  | ||||
|     <el-card shadow="never"> | ||||
|       <template #header> | ||||
|         <el-row :gutter="10" class="mb8"> | ||||
|           <el-col :span="1.5"> | ||||
|             <el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['formalities:listOfFormalities:add']">新增</el-button> | ||||
|           </el-col> | ||||
|           <el-col :span="1.5"> | ||||
|             <el-button type="primary" :disabled="multiple" plain icon="Plus" @click="handleOk" v-hasPermi="['formalities:listOfFormalities:add']" | ||||
|               >确认</el-button | ||||
|             > | ||||
|           </el-col> | ||||
|           <!-- <el-col :span="1.5"> | ||||
|             <el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['formalities:listOfFormalities:edit']" | ||||
|               >修改</el-button | ||||
|             > | ||||
|           </el-col> | ||||
|           <el-col :span="1.5"> | ||||
|             <el-button | ||||
|               type="danger" | ||||
|               plain | ||||
|               icon="Delete" | ||||
|               :disabled="multiple" | ||||
|               @click="handleDelete()" | ||||
|               v-hasPermi="['formalities:listOfFormalities:remove']" | ||||
|               >删除</el-button | ||||
|             > | ||||
|           </el-col> | ||||
|           <el-col :span="1.5"> | ||||
|             <el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['formalities:listOfFormalities:export']" | ||||
|               >导出</el-button | ||||
|             > | ||||
|           </el-col> --> | ||||
|           <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> | ||||
|         </el-row> | ||||
|       </template> | ||||
|  | ||||
|       <el-table v-loading="loading" :data="listOfFormalitiesList" @selection-change="handleSelectionChange" row-key="id"> | ||||
|         <el-table-column type="selection" width="55" align="center" /> | ||||
|         <el-table-column label="名称" prop="name" /> | ||||
|         <!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> | ||||
|           <template #default="scope"> | ||||
|             <el-tooltip content="修改" placement="top"> | ||||
|               <el-button | ||||
|                 link | ||||
|                 type="primary" | ||||
|                 icon="Edit" | ||||
|                 @click="handleUpdate(scope.row)" | ||||
|                 v-hasPermi="['formalities:listOfFormalities:edit']" | ||||
|               ></el-button> | ||||
|             </el-tooltip> | ||||
|             <el-tooltip content="删除" placement="top"> | ||||
|               <el-button | ||||
|                 link | ||||
|                 type="primary" | ||||
|                 icon="Delete" | ||||
|                 @click="handleDelete(scope.row)" | ||||
|                 v-hasPermi="['formalities:listOfFormalities:remove']" | ||||
|               ></el-button> | ||||
|             </el-tooltip> | ||||
|           </template> | ||||
|         </el-table-column> --> | ||||
|       </el-table> | ||||
|  | ||||
|       <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" /> | ||||
|     </el-card> | ||||
|     <!-- 添加或修改手续办理清单模板对话框 --> | ||||
|     <el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body> | ||||
|       <el-form ref="listOfFormalitiesFormRef" :model="form" :rules="rules" label-width="80px"> | ||||
|         <!-- <el-form-item label="父级id" prop="pid"> | ||||
|           <el-input v-model="form.pid" placeholder="请输入父级id" /> | ||||
|         </el-form-item> --> | ||||
|         <el-form-item label="名称" prop="name"> | ||||
|           <el-input v-model="form.name" placeholder="请输入名称" /> | ||||
|         </el-form-item> | ||||
|       </el-form> | ||||
|       <template #footer> | ||||
|         <div class="dialog-footer"> | ||||
|           <el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button> | ||||
|           <el-button @click="cancel">取 消</el-button> | ||||
|         </div> | ||||
|       </template> | ||||
|     </el-dialog> | ||||
|   </div> | ||||
| </template> | ||||
|  | ||||
| <script setup name="ListOfFormalities" lang="ts"> | ||||
| import { addFormalitiesAreConsolidated } from '@/api/formalities/formalitiesAreConsolidated'; | ||||
| import { | ||||
|   listListOfFormalities, | ||||
|   getListOfFormalities, | ||||
|   delListOfFormalities, | ||||
|   addListOfFormalities, | ||||
|   updateListOfFormalities | ||||
| } from '@/api/formalities/listOfFormalities'; | ||||
| import { ListOfFormalitiesVO, ListOfFormalitiesQuery, ListOfFormalitiesForm } from '@/api/formalities/listOfFormalities/types'; | ||||
| import { useUserStoreHook } from '@/store/modules/user'; | ||||
|  | ||||
| const { proxy } = getCurrentInstance() as ComponentInternalInstance; | ||||
| // 获取用户 store | ||||
| const userStore = useUserStoreHook(); | ||||
| // 从 store 中获取项目列表和当前选中的项目 | ||||
| const currentProject = computed(() => userStore.selectedProject); | ||||
| const listOfFormalitiesList = ref<ListOfFormalitiesVO[]>([]); | ||||
| const buttonLoading = ref(false); | ||||
| 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 queryFormRef = ref<ElFormInstance>(); | ||||
| const listOfFormalitiesFormRef = ref<ElFormInstance>(); | ||||
|  | ||||
| const dialog = reactive<DialogOption>({ | ||||
|   visible: false, | ||||
|   title: '' | ||||
| }); | ||||
|  | ||||
| const initFormData: ListOfFormalitiesForm = { | ||||
|   id: undefined, | ||||
|   pid: undefined, | ||||
|   name: undefined | ||||
| }; | ||||
| const data = reactive<PageData<ListOfFormalitiesForm, ListOfFormalitiesQuery>>({ | ||||
|   form: { ...initFormData }, | ||||
|   queryParams: { | ||||
|     pageNum: 1, | ||||
|     pageSize: 10, | ||||
|     pid: undefined, | ||||
|     name: undefined, | ||||
|     params: {} | ||||
|   }, | ||||
|   rules: { | ||||
|     id: [{ required: true, message: '不能为空', trigger: 'blur' }] | ||||
|   } | ||||
| }); | ||||
|  | ||||
| const { queryParams, form, rules } = toRefs(data); | ||||
|  | ||||
| /** 查询手续办理清单模板列表 */ | ||||
| const getList = async () => { | ||||
|   loading.value = true; | ||||
|   const res = await listListOfFormalities(queryParams.value); | ||||
|   listOfFormalitiesList.value = res.data; | ||||
|   total.value = res.total; | ||||
|   loading.value = false; | ||||
| }; | ||||
|  | ||||
| /** 取消按钮 */ | ||||
| const cancel = () => { | ||||
|   reset(); | ||||
|   dialog.visible = false; | ||||
| }; | ||||
|  | ||||
| /** 表单重置 */ | ||||
| const reset = () => { | ||||
|   form.value = { ...initFormData }; | ||||
|   listOfFormalitiesFormRef.value?.resetFields(); | ||||
| }; | ||||
|  | ||||
| /** 搜索按钮操作 */ | ||||
| const handleQuery = () => { | ||||
|   queryParams.value.pageNum = 1; | ||||
|   getList(); | ||||
| }; | ||||
|  | ||||
| /** 重置按钮操作 */ | ||||
| const resetQuery = () => { | ||||
|   queryFormRef.value?.resetFields(); | ||||
|   handleQuery(); | ||||
| }; | ||||
|  | ||||
| /** 多选框选中数据 */ | ||||
| const handleSelectionChange = (selection: ListOfFormalitiesVO[]) => { | ||||
|   console.log('🚀 ~ handleSelectionChange ~ selection:', selection); | ||||
|   ids.value = selection.filter((item) => item.pid); | ||||
|   console.log('🚀 ~ handleSelectionChange ~ ids.value:', ids.value); | ||||
|  | ||||
|   multiple.value = !selection.length; | ||||
| }; | ||||
|  | ||||
| /** 新增按钮操作 */ | ||||
| const handleAdd = () => { | ||||
|   reset(); | ||||
|   dialog.visible = true; | ||||
|   dialog.title = '添加手续办理清单模板'; | ||||
| }; | ||||
|  | ||||
| const handleOk = async () => { | ||||
|   await proxy?.$modal.confirm('确定新增手续吗').finally(() => (loading.value = false)); | ||||
|   let addBusFormalitiesAreConsolidatedBos = ids.value.map((item) => { | ||||
|     return { | ||||
|       formalitiesId: item.id, | ||||
|       formalitiesPid: item.pid | ||||
|     }; | ||||
|   }); | ||||
|   const data = { | ||||
|     addBusFormalitiesAreConsolidatedBos, | ||||
|     projectId: currentProject.value.id | ||||
|   }; | ||||
|   const res = await addFormalitiesAreConsolidated(data); | ||||
|   if (res.code == 200) { | ||||
|     proxy?.$modal.msgSuccess('操作成功'); | ||||
|     proxy?.$tab.openPage('/formalities/formalitiesAreConsolidated'); | ||||
|   } | ||||
| }; | ||||
|  | ||||
| /** 修改按钮操作 */ | ||||
| const handleUpdate = async (row?: ListOfFormalitiesVO) => { | ||||
|   reset(); | ||||
|   const _id = row?.id || ids.value[0]; | ||||
|   const res = await getListOfFormalities(_id); | ||||
|   Object.assign(form.value, res.data); | ||||
|   dialog.visible = true; | ||||
|   dialog.title = '修改手续办理清单模板'; | ||||
| }; | ||||
|  | ||||
| /** 提交按钮 */ | ||||
| const submitForm = () => { | ||||
|   listOfFormalitiesFormRef.value?.validate(async (valid: boolean) => { | ||||
|     if (valid) { | ||||
|       buttonLoading.value = true; | ||||
|       if (form.value.id) { | ||||
|         await updateListOfFormalities(form.value).finally(() => (buttonLoading.value = false)); | ||||
|       } else { | ||||
|         await addListOfFormalities(form.value).finally(() => (buttonLoading.value = false)); | ||||
|       } | ||||
|       proxy?.$modal.msgSuccess('操作成功'); | ||||
|       dialog.visible = false; | ||||
|       await getList(); | ||||
|     } | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| /** 删除按钮操作 */ | ||||
| const handleDelete = async (row?: ListOfFormalitiesVO) => { | ||||
|   const _ids = row?.id || ids.value; | ||||
|   await proxy?.$modal.confirm('是否确认删除手续办理清单模板编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false)); | ||||
|   await delListOfFormalities(_ids); | ||||
|   proxy?.$modal.msgSuccess('删除成功'); | ||||
|   await getList(); | ||||
| }; | ||||
|  | ||||
| /** 导出按钮操作 */ | ||||
| const handleExport = () => { | ||||
|   proxy?.download( | ||||
|     'formalities/listOfFormalities/export', | ||||
|     { | ||||
|       ...queryParams.value | ||||
|     }, | ||||
|     `listOfFormalities_${new Date().getTime()}.xlsx` | ||||
|   ); | ||||
| }; | ||||
|  | ||||
| onMounted(() => { | ||||
|   getList(); | ||||
| }); | ||||
| </script> | ||||
| @ -1,15 +1,16 @@ | ||||
| <template> | ||||
|   <div class="p-6 bg-gray-50"> | ||||
|   <div class="p-6 bg-gray-50 pt-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> 为必填项 --> | ||||
|         <el-button @click="isDisabled = false" class="px-8 py-2.5 transition-all duration-300 font-medium" v-if="isDisabled"> 点击编辑 </el-button> | ||||
|       </div> | ||||
|  | ||||
|       <!-- 表单内容区域 --> | ||||
|       <el-form ref="leaveFormRef" :model="form" :rules="rules" label-width="120px" class="p-6 space-y-6"> | ||||
|       <el-form ref="leaveFormRef" :model="form" :rules="rules" label-width="120px" class="p-6 pt30 space-y-6 h75" :disabled="isDisabled"> | ||||
|         <!-- 设计负责人 --> | ||||
|         <div class="fonts"> | ||||
|           <el-form-item label="采购专员" prop="userId" class="mb-4"> | ||||
| @ -24,7 +25,7 @@ | ||||
|         </div> | ||||
|  | ||||
|         <!-- 提交按钮区域 --> | ||||
|         <div class="flex justify-center space-x-6 mt-8 pt-6 border-t border-gray-100"> | ||||
|         <div class="flex justify-center space-x-6 mt-8 pt-6 border-t border-gray-100" v-if="!isDisabled"> | ||||
|           <el-button | ||||
|             type="primary" | ||||
|             @click="submitForm" | ||||
| @ -60,6 +61,7 @@ const userStore = useUserStoreHook(); | ||||
| const currentProject = computed(() => userStore.selectedProject); | ||||
| // 专业字典数据 | ||||
| const { des_user_major } = toRefs<any>(proxy?.useDict('des_user_major')); | ||||
| const isDisabled = ref(false); | ||||
|  | ||||
| // 表单数据 | ||||
| const form = reactive({ | ||||
| @ -106,9 +108,12 @@ const designUser = async () => { | ||||
|       if (!res.data) { | ||||
|         resetForm(); | ||||
|         form.id = null; | ||||
|         isDisabled.value = false; | ||||
|  | ||||
|         return; | ||||
|       } | ||||
|       Object.assign(form, res.data); | ||||
|       isDisabled.value = true; | ||||
|     } | ||||
|   } catch (error) { | ||||
|     ElMessage.error('获取配置数据失败'); | ||||
| @ -136,6 +141,7 @@ const submitForm = async () => { | ||||
|     const res = await designUserAdd(data); | ||||
|     if (res.code === 200) { | ||||
|       ElMessage.success('提交成功'); | ||||
|       isDisabled.value = true; | ||||
|     } else { | ||||
|       ElMessage.error(res.msg || '提交失败'); | ||||
|     } | ||||
|  | ||||
| @ -71,9 +71,9 @@ | ||||
|             <el-tooltip content="查看" placement="top"> | ||||
|               <el-button link type="primary" icon="View" @click="handleView(scope.row)"></el-button> | ||||
|             </el-tooltip> | ||||
|             <el-tooltip content="修改" placement="top"> | ||||
|             <!-- <el-tooltip content="修改" placement="top"> | ||||
|               <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['materials:materialReceive:edit']"></el-button> | ||||
|             </el-tooltip> | ||||
|             </el-tooltip> --> | ||||
|             <el-tooltip content="删除" placement="top"> | ||||
|               <el-button | ||||
|                 link | ||||
| @ -89,7 +89,7 @@ | ||||
|       <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" /> | ||||
|     </el-card> | ||||
|     <!-- 添加或修改物料接收单对话框 --> | ||||
|     <el-dialog :title="dialog.title" v-model="dialog.visible" width="800px" append-to-body> | ||||
|     <el-dialog draggable :title="dialog.title" v-model="dialog.visible" width="800px" append-to-body> | ||||
|       <el-form ref="materialReceiveFormRef" :model="form" :rules="rules" label-width="110px"> | ||||
|         <el-row> | ||||
|           <el-col :span="12"> | ||||
| @ -106,18 +106,14 @@ | ||||
|             </el-form-item> | ||||
|           </el-col> | ||||
|           <el-col :span="12" | ||||
|             ><el-form-item label="工程名称" prop="projectName"> | ||||
|               <el-input v-model="form.projectName" placeholder="请输入工程名称" /> | ||||
|             </el-form-item> | ||||
|             ><el-form-item label="采购单编号" prop="docId" | ||||
|               ><el-select @change="handleSelect" v-model="form.docId" filterable placeholder="请选择采购单" style="width: 100%"> | ||||
|                 <el-option v-for="item in purchaseDocList" :key="item.id" :label="item.docCode" :value="item.id"></el-option> </el-select | ||||
|             ></el-form-item> | ||||
|           </el-col> | ||||
|           <el-col :span="12"> | ||||
|             <el-form-item label="设备材料名称" prop="materialName"> | ||||
|               <el-input v-model="form.materialName" placeholder="请输入设备材料名称" /> | ||||
|             </el-form-item> | ||||
|           </el-col> | ||||
|           <el-col :span="12"> | ||||
|             <el-form-item label="合同名称" prop="contractName"> | ||||
|               <el-input v-model="form.contractName" placeholder="请输入合同名称" /> | ||||
|             <el-form-item label="供货单位" prop="supplierUnit"> | ||||
|               <el-input disabled v-model="form.supplierUnit" placeholder="请输入供货单位" /> | ||||
|             </el-form-item> | ||||
|           </el-col> | ||||
|           <el-col :span="12"> | ||||
| @ -125,9 +121,14 @@ | ||||
|               <el-input v-model="form.orderingUnit" placeholder="请输入订货单位" /> | ||||
|             </el-form-item> | ||||
|           </el-col> | ||||
|           <el-col :span="12" | ||||
|             ><el-form-item label="工程名称" prop="projectName"> | ||||
|               <el-input v-model="form.projectName" placeholder="请输入工程名称" /> | ||||
|             </el-form-item> | ||||
|           </el-col> | ||||
|           <el-col :span="12"> | ||||
|             <el-form-item label="供货单位" prop="supplierUnit"> | ||||
|               <el-input v-model="form.supplierUnit" placeholder="请输入供货单位" /> | ||||
|             <el-form-item label="合同名称" prop="contractName"> | ||||
|               <el-input v-model="form.contractName" placeholder="请输入合同名称" /> | ||||
|             </el-form-item> | ||||
|           </el-col> | ||||
|           <el-col :span="24"> | ||||
| @ -139,22 +140,18 @@ | ||||
|             <div class="detail"> | ||||
|               <div class="detail-header"> | ||||
|                 <span>数量验收</span> | ||||
|                 <el-button type="primary" link @click="addItem" icon="Plus">添加一行</el-button> | ||||
|                 <!-- <el-button type="primary" link @click="addItem" icon="Plus">添加数量验收</el-button> --> | ||||
|               </div> | ||||
|               <div v-for="(item, index) in form.itemList" :key="index" class="detail-item"> | ||||
|                 <el-row> | ||||
|                   <el-col :span="12"> | ||||
|                     <el-form-item | ||||
|                       :label="index === 0 ? '名称' : ''" | ||||
|                       :prop="`itemList.${index}.name`" | ||||
|                       :rules="{ required: true, message: '名称不能为空', trigger: 'blur' }" | ||||
|                     > | ||||
|                     <el-form-item label="名称" :prop="`itemList.${index}.name`" :rules="{ required: true, message: '名称不能为空', trigger: 'blur' }"> | ||||
|                       <el-input v-model="item.name" placeholder="请输入名称" /> | ||||
|                     </el-form-item> | ||||
|                   </el-col> | ||||
|                   <el-col :span="12"> | ||||
|                     <el-form-item | ||||
|                       :label="index === 0 ? '规格' : ''" | ||||
|                       label="规格" | ||||
|                       :prop="`itemList.${index}.specification`" | ||||
|                       :rules="{ required: true, message: '规格不能为空', trigger: 'blur' }" | ||||
|                     > | ||||
| @ -162,56 +159,52 @@ | ||||
|                     </el-form-item> | ||||
|                   </el-col> | ||||
|                   <el-col :span="12"> | ||||
|                     <el-form-item | ||||
|                       :label="index === 0 ? '单位' : ''" | ||||
|                       :prop="`itemList.${index}.unit`" | ||||
|                       :rules="{ required: true, message: '单位不能为空', trigger: 'blur' }" | ||||
|                     > | ||||
|                     <el-form-item label="单位" :prop="`itemList.${index}.unit`" :rules="{ required: true, message: '单位不能为空', trigger: 'blur' }"> | ||||
|                       <el-input v-model="item.unit" placeholder="请输入单位" /> | ||||
|                     </el-form-item> | ||||
|                   </el-col> | ||||
|                   <el-col :span="12"> | ||||
|                     <el-form-item | ||||
|                       :label="index === 0 ? '数量' : ''" | ||||
|                       label="数量" | ||||
|                       :prop="`itemList.${index}.quantity`" | ||||
|                       :rules="{ required: true, message: '数量不能为空', trigger: 'blur' }" | ||||
|                     > | ||||
|                       <el-input v-model="item.quantity" placeholder="请输入数量" /> | ||||
|                       <el-input type="number" v-model="item.quantity" placeholder="请输入数量" /> | ||||
|                     </el-form-item> | ||||
|                   </el-col> | ||||
|                   <el-col :span="12"> | ||||
|                     <el-form-item | ||||
|                       :label="index === 0 ? '验收' : ''" | ||||
|                       label="验收" | ||||
|                       :prop="`itemList.${index}.acceptedQuantity`" | ||||
|                       :rules="{ required: true, message: '验收数量不能为空', trigger: 'blur' }" | ||||
|                     > | ||||
|                       <el-input v-model="item.acceptedQuantity" placeholder="请输入验收" /> | ||||
|                       <el-input type="number" v-model="item.acceptedQuantity" placeholder="请输入验收" /> | ||||
|                     </el-form-item> | ||||
|                   </el-col> | ||||
|                   <el-col :span="12"> | ||||
|                     <el-form-item | ||||
|                       :label="index === 0 ? '缺件' : ''" | ||||
|                       label="缺件" | ||||
|                       :prop="`itemList.${index}.shortageQuantity`" | ||||
|                       :rules="{ required: true, message: '缺件数量不能为空', trigger: 'blur' }" | ||||
|                     > | ||||
|                       <el-input v-model="item.shortageQuantity" placeholder="请输入缺件" /> | ||||
|                       <el-input type="number" v-model="item.shortageQuantity" placeholder="自动计算(数量-验收数量)" readonly /> | ||||
|                       <span class="tips">*自动计算(数量-验收数量)</span> | ||||
|                     </el-form-item> | ||||
|                   </el-col> | ||||
|                   <el-col :span="12"> | ||||
|                     <el-form-item :label="index === 0 ? '备注' : ''" prop="remark"> | ||||
|                     <el-form-item label="备注" prop="remark"> | ||||
|                       <el-input v-model="item.remark" placeholder="请输入备注" /> | ||||
|                     </el-form-item> | ||||
|                   </el-col> | ||||
|                   <el-col :span="12" v-if="form.itemList.length > 1"> | ||||
|                   <!-- <el-col :span="12" v-if="form.itemList.length > 1"> | ||||
|                     <div class="item-actions"> | ||||
|                       <el-button type="danger" link @click="removeItem(index)" icon="Delete">删除</el-button> | ||||
|                     </div> | ||||
|                   </el-col> | ||||
|                   </el-col> --> | ||||
|                 </el-row> | ||||
|               </div> | ||||
|             </div> | ||||
|           </el-col> | ||||
|  | ||||
|           <el-col :span="12"> | ||||
|             <el-form-item label="合格证文件" prop="certCountFileId"> | ||||
|               <file-upload :isShowTip="false" v-model="form.certCountFileId" /> | ||||
| @ -272,6 +265,8 @@ import { | ||||
| import { MaterialReceiveVO, MaterialReceiveQuery, MaterialReceiveForm } from '@/api/materials/materialReceive/types'; | ||||
| import { useUserStoreHook } from '@/store/modules/user'; | ||||
| import wordllReceive from './word/index.vue'; | ||||
| import { listPurchaseDoc, purchaseDocPlanList } from '@/api/materials/purchaseDoc'; | ||||
| import { watch } from 'vue'; | ||||
|  | ||||
| const { proxy } = getCurrentInstance() as ComponentInternalInstance; | ||||
| const { storage_type } = toRefs<any>(proxy?.useDict('storage_type')); | ||||
| @ -291,7 +286,8 @@ const total = ref(0); | ||||
|  | ||||
| const queryFormRef = ref<ElFormInstance>(); | ||||
| const materialReceiveFormRef = ref<ElFormInstance>(); | ||||
|  | ||||
| const purchaseDocList = ref([]); //物资采购单 | ||||
| const purchaseMap = new Map(); | ||||
| const dialog = reactive<DialogOption>({ | ||||
|   visible: false, | ||||
|   title: '' | ||||
| @ -318,6 +314,8 @@ const getInitFormData = () => { | ||||
|     licenseCountFileId: undefined, | ||||
|     storageType: [], | ||||
|     remark: undefined, | ||||
|     docId: undefined, | ||||
|     docCode: undefined, | ||||
|     itemList: [ | ||||
|       { | ||||
|         name: undefined, | ||||
| @ -332,7 +330,7 @@ const getInitFormData = () => { | ||||
|   }; | ||||
| }; | ||||
| const initFormData: MaterialReceiveForm = {}; | ||||
| const data = reactive<PageData<MaterialReceiveForm, MaterialReceiveQuery>>({ | ||||
| const data = reactive({ | ||||
|   form: getInitFormData(), | ||||
|   queryParams: { | ||||
|     pageNum: 1, | ||||
| @ -397,6 +395,10 @@ const handleAdd = () => { | ||||
|   reset(); | ||||
|   dialog.visible = true; | ||||
|   dialog.title = '添加物料接收单'; | ||||
|   // 为初始条目添加监听 | ||||
|   if (form.value.itemList.length > 0) { | ||||
|     watchItemChanges(0); | ||||
|   } | ||||
| }; | ||||
|  | ||||
| /** 修改按钮操作 */ | ||||
| @ -405,11 +407,17 @@ const handleUpdate = async (row?: MaterialReceiveVO) => { | ||||
|   const _id = row?.id || ids.value[0]; | ||||
|   const res = await getMaterialReceive(_id); | ||||
|   Object.assign(form.value, res.data); | ||||
|   if (form.value.storageType.length) { | ||||
|   if (form.value.storageType && form.value.storageType.length) { | ||||
|     form.value.storageType = form.value.storageType.split(','); | ||||
|   } else { | ||||
|     form.value.storageType = []; | ||||
|   } | ||||
|  | ||||
|   // 为每个条目添加监听 | ||||
|   form.value.itemList.forEach((_, index) => { | ||||
|     watchItemChanges(index); | ||||
|   }); | ||||
|  | ||||
|   dialog.visible = true; | ||||
|   dialog.title = '修改物料接收单'; | ||||
| }; | ||||
| @ -440,9 +448,10 @@ const handleDelete = async (row?: MaterialReceiveVO) => { | ||||
|   proxy?.$modal.msgSuccess('删除成功'); | ||||
|   await getList(); | ||||
| }; | ||||
|  | ||||
| // 添加数量验收条目 | ||||
| const addItem = () => { | ||||
|   form.value.itemList.push({ | ||||
|   const newItem = { | ||||
|     name: undefined, | ||||
|     specification: undefined, | ||||
|     unit: undefined, | ||||
| @ -450,7 +459,25 @@ const addItem = () => { | ||||
|     acceptedQuantity: undefined, | ||||
|     shortageQuantity: undefined, | ||||
|     remark: undefined | ||||
|   }); | ||||
|   }; | ||||
|   form.value.itemList.push(newItem); | ||||
|   // 监听新条目数据变化 | ||||
|   watchItemChanges(form.value.itemList.length - 1); | ||||
| }; | ||||
|  | ||||
| // 监听条目数据变化,自动计算缺件数量 | ||||
| const watchItemChanges = (index: number) => { | ||||
|   watch( | ||||
|     () => [form.value.itemList[index].quantity, form.value.itemList[index].acceptedQuantity], | ||||
|     ([quantity, acceptedQuantity]) => { | ||||
|       // 确保数量和验收数量都是数字 | ||||
|       const qty = Number(quantity) || 0; | ||||
|       const acceptedQty = Number(acceptedQuantity) || 0; | ||||
|       // 计算缺件数量(数量 - 验收数量) | ||||
|       form.value.itemList[index].shortageQuantity = qty - acceptedQty; | ||||
|     }, | ||||
|     { immediate: true } | ||||
|   ); | ||||
| }; | ||||
|  | ||||
| // 删除数量验收条目 | ||||
| @ -461,14 +488,70 @@ const removeItem = (index: number) => { | ||||
|     proxy?.$modal.msgWarning('至少需要保留一条数量验收记录'); | ||||
|   } | ||||
| }; | ||||
|  | ||||
| const handleView = (row) => { | ||||
|   // 查看详情 | ||||
|   wordllReceiveRef.value?.openDialog(row); | ||||
| }; | ||||
|  | ||||
| /** 查询物资-采购联系单列表 */ | ||||
| const getlistPurchase = async () => { | ||||
|   const res = await listPurchaseDoc({ | ||||
|     projectId: currentProject.value?.id, | ||||
|     status: 'finish' | ||||
|   }); | ||||
|  | ||||
|   purchaseDocList.value = res.rows; | ||||
|   if (purchaseDocList.value && purchaseDocList.value.length > 0) { | ||||
|     purchaseDocList.value.forEach((item) => { | ||||
|       purchaseMap.set(item.id, item); | ||||
|     }); | ||||
|   } | ||||
| }; | ||||
|  | ||||
| // 通过采购单获取需求信息 | ||||
| const getdemandInfo = async (docId: string) => { | ||||
|   let res = await purchaseDocPlanList(docId); | ||||
|   if (res.code == 200) { | ||||
|     // 需求表单赋值 | ||||
|     form.value.itemList = []; | ||||
|     //  form.value.itemList 清空 | ||||
|     console.log(form.value.itemList); | ||||
|     res.data.forEach((item, index) => { | ||||
|       let obj = { | ||||
|         quantity: item.demandQuantity, | ||||
|         acceptedQuantity: 0, | ||||
|         shortageQuantity: item.demandQuantity, // 初始化缺件数量为总数量 | ||||
|         planId: item.id, | ||||
|         ...item | ||||
|       }; | ||||
|       obj.id = null; | ||||
|       form.value.itemList.push(obj); | ||||
|       // 监听每个条目的变化 | ||||
|       watchItemChanges(form.value.itemList.length - 1); | ||||
|     }); | ||||
|   } | ||||
| }; | ||||
|  | ||||
| const handleSelect = (val) => { | ||||
|   // 选择设备 | ||||
|   let obj = purchaseMap.get(val); | ||||
|   getdemandInfo(val); | ||||
|   form.value.docCode = obj?.docCode || ''; | ||||
|   form.value.supplierUnit = obj?.supplier || ''; | ||||
|   form.value.materialName = obj?.name || ''; | ||||
| }; | ||||
|  | ||||
| onMounted(() => { | ||||
|   getList(); | ||||
|   getlistPurchase(); | ||||
|   // 为初始条目添加监听 | ||||
|   if (form.value.itemList.length > 0) { | ||||
|     watchItemChanges(0); | ||||
|   } | ||||
| }); | ||||
| //监听项目id刷新数据 | ||||
|  | ||||
| // 监听项目id刷新数据 | ||||
| const listeningProject = watch( | ||||
|   () => currentProject.value?.id, | ||||
|   (nid, oid) => { | ||||
| @ -516,4 +599,10 @@ onUnmounted(() => { | ||||
|   justify-content: flex-end; | ||||
|   padding-top: 6px; | ||||
| } | ||||
|  | ||||
| .tips { | ||||
|   font-size: 12px; | ||||
|   color: #666; | ||||
|   margin-left: 8px; | ||||
| } | ||||
| </style> | ||||
|  | ||||
| @ -1,98 +1,129 @@ | ||||
| <template> | ||||
|     <div class="overall-plan-material-supply"> | ||||
|         <!-- tabPosition="left" --> | ||||
|         <el-card shadow="always"> | ||||
|             <el-form :inline="true"> | ||||
|                 <el-form-item v-if="state.masterData.status == 'draft'"> | ||||
|                     <el-button type="primary" icon="edit" @click="clickApprovalSheet1()">审批</el-button> | ||||
|                 </el-form-item> | ||||
|                 <el-form-item v-if="state.masterData.status == 'waiting' || state.masterData.status == 'finish'"> | ||||
|                     <el-button icon="view" @click="lookApprovalFlow()" type="warning">查看流程</el-button> | ||||
|                 </el-form-item> | ||||
|             </el-form> | ||||
|         </el-card> | ||||
|         <el-table :data="state.tableData" v-loading="state.loading.list" stripe | ||||
|             style="width: 100%; margin-bottom: 20px; height: calc(100vh - 230px)" row-key="id" border> | ||||
|             <el-table-column prop="num" label="编号" /> | ||||
|             <el-table-column prop="name" label="工程或费用名称" /> | ||||
|             <el-table-column prop="unit" label="单位" /> | ||||
|             <el-table-column prop="quantity" label="数量" /> | ||||
|             <el-table-column prop="remark" label="备注" /> | ||||
|             <el-table-column label="操作"> | ||||
|                 <template #default="{ row }"> | ||||
|                     <el-button :disabled="state.masterData.status == 'waiting' || state.masterData.status == 'finish'" type="primary" @click="editApprovalSheet(row)">修改</el-button> | ||||
|                 </template> | ||||
|             </el-table-column> | ||||
|         </el-table> | ||||
|         <!-- 编辑 --> | ||||
|         <el-dialog v-model="visible" title="修改物料信息" :width="800" :close-on-click-modal="false" @close="handleClose"> | ||||
|             <el-form ref="formRef" :model="formData" :rules="formRules" label-width="120px" class="space-y-4"> | ||||
|                 <el-row :gutter="20"> | ||||
|                     <el-col :span="12"> | ||||
|                         <el-form-item label="批次号" prop="batchNumber"> | ||||
|                             <el-input disabled v-model="formData.batchNumber" placeholder="请输入批次号" clearable /> | ||||
|                         </el-form-item> | ||||
|                     </el-col> | ||||
|                     <el-col :span="12"> | ||||
|                         <el-form-item label="品牌" prop="brand"> | ||||
|                             <el-input v-model="formData.brand" placeholder="请输入品牌" clearable /> | ||||
|                         </el-form-item> | ||||
|                     </el-col> | ||||
|                 </el-row> | ||||
|                 <!-- 物料属性区域 --> | ||||
|                 <el-row :gutter="20"> | ||||
|                     <el-col :span="12"> | ||||
|                         <el-form-item label="材质" prop="texture"> | ||||
|                             <el-input v-model="formData.texture" placeholder="请输入材质" clearable /> | ||||
|                         </el-form-item> | ||||
|                     </el-col> | ||||
|                     <el-col :span="12"> | ||||
|                         <el-form-item label="质量标准" prop="qualityStandard"> | ||||
|                             <el-input v-model="formData.qualityStandard" placeholder="请输入质量标准" clearable /> | ||||
|                         </el-form-item> | ||||
|                     </el-col> | ||||
|                 </el-row> | ||||
|                 <!-- 日期与状态区域 --> | ||||
|                 <el-row :gutter="20"> | ||||
|                     <el-col :span="12"> | ||||
|                         <el-form-item label="使用部位" prop="partUsed"> | ||||
|                             <el-input v-model="formData.partUsed" placeholder="请输入使用部位" clearable /> | ||||
|                         </el-form-item> | ||||
|                     </el-col> | ||||
|                     <el-col :span="12"> | ||||
|                         <el-form-item label="交货地点" prop="deliveryPoints"> | ||||
|                             <el-input v-model="formData.deliveryPoints" placeholder="请输入交货地点" clearable /> | ||||
|                         </el-form-item> | ||||
|                     </el-col> | ||||
|                 </el-row> | ||||
|                 <!-- 其他信息区域 --> | ||||
|                 <el-row :gutter="20"> | ||||
|                     <el-col :span="12"> | ||||
|                         <el-form-item label="预计使用日期" prop="dateService"> | ||||
|                             <el-date-picker v-model="formData.dateService" type="date" placeholder="选择预计使用日期" | ||||
|                                 format="YYYY-MM-DD" /> | ||||
|                         </el-form-item> | ||||
|                     </el-col> | ||||
|                 </el-row> | ||||
|                 <el-row> | ||||
|                     <el-col :span="24"> | ||||
|                         <el-form-item label="备注" prop="remark"> | ||||
|                             <el-input v-model="formData.remark" placeholder="请输入备注信息" type="textarea" rows="3" /> | ||||
|                         </el-form-item> | ||||
|                     </el-col> | ||||
|                 </el-row> | ||||
|             </el-form> | ||||
|             <template #footer> | ||||
|                 <el-button @click="handleClose">取消</el-button> | ||||
|                 <el-button type="primary" @click="handleSubmit">确定</el-button> | ||||
|             </template> | ||||
|         </el-dialog> | ||||
|     </div> | ||||
|   <div class="overall-plan-material-supply"> | ||||
|     <!-- tabPosition="left" --> | ||||
|     <el-card shadow="always"> | ||||
|       <template #header> | ||||
|         <el-row :gutter="10" class="mb8"> | ||||
|           <el-form :inline="true"> | ||||
|             <el-form-item v-if="state.masterData.status == 'draft'"> | ||||
|               <el-button type="primary" icon="edit" @click="clickApprovalSheet1()">审批</el-button> | ||||
|             </el-form-item> | ||||
|             <el-form-item v-if="state.masterData.status == 'waiting' || state.masterData.status == 'finish'"> | ||||
|               <el-button icon="view" @click="lookApprovalFlow()" type="warning">查看流程</el-button> | ||||
|             </el-form-item> | ||||
|           </el-form> | ||||
|           <right-toolbar @queryTable="getMasterDataList"></right-toolbar> | ||||
|         </el-row> | ||||
|       </template> | ||||
|     </el-card> | ||||
|     <el-table | ||||
|       :data="state.tableData" | ||||
|       v-loading="state.loading.list" | ||||
|       stripe | ||||
|       style="width: 100%; margin-bottom: 20px; height: calc(100vh - 230px)" | ||||
|       row-key="id" | ||||
|       border | ||||
|     > | ||||
|       <el-table-column prop="num" label="编号" /> | ||||
|       <el-table-column prop="name" label="工程或费用名称" width="180" /> | ||||
|       <el-table-column prop="unit" label="单位" /> | ||||
|       <el-table-column prop="quantity" label="数量" width="60" /> | ||||
|       <el-table-column prop="batchNumber" label="批次号" width="200" /> | ||||
|       <el-table-column prop="brand" label="品牌" /> | ||||
|       <el-table-column prop="texture" label="材质" /> | ||||
|       <el-table-column prop="qualityStandard" label="质量标准" /> | ||||
|       <el-table-column prop="partUsed" label="使用部位" /> | ||||
|       <el-table-column prop="deliveryPoints" label="交货地点" /> | ||||
|       <el-table-column label="预计使用日期"> | ||||
|         <template #default="{ row }"> | ||||
|           <span>{{ row.dateService ? row.dateService.split(' ')[0] : '' }}</span> | ||||
|         </template> | ||||
|       </el-table-column> | ||||
|       <el-table-column prop="remark" label="备注" /> | ||||
|       <el-table-column label="操作"> | ||||
|         <template #default="{ row }"> | ||||
|           <el-button | ||||
|             :disabled="state.masterData.status == 'waiting' || state.masterData.status == 'finish'" | ||||
|             type="primary" | ||||
|             @click="editApprovalSheet(row)" | ||||
|             >修改</el-button | ||||
|           > | ||||
|         </template> | ||||
|       </el-table-column> | ||||
|     </el-table> | ||||
|     <!-- 编辑 --> | ||||
|     <el-dialog v-model="visible" title="修改物料信息" :width="800" :close-on-click-modal="false" @close="handleClose"> | ||||
|       <el-form ref="formRef" :model="formData" :rules="formRules" label-width="120px" class="space-y-4"> | ||||
|         <el-row :gutter="20"> | ||||
|           <el-col :span="12"> | ||||
|             <el-form-item label="批次号" prop="batchNumber"> | ||||
|               <el-input disabled v-model="formData.batchNumber" placeholder="请输入批次号" clearable /> | ||||
|             </el-form-item> | ||||
|           </el-col> | ||||
|           <el-col :span="12"> | ||||
|             <el-form-item label="品牌" prop="brand"> | ||||
|               <el-input v-model="formData.brand" placeholder="请输入品牌" clearable /> | ||||
|             </el-form-item> | ||||
|           </el-col> | ||||
|         </el-row> | ||||
|         <!-- 物料属性区域 --> | ||||
|         <el-row :gutter="20"> | ||||
|           <el-col :span="12"> | ||||
|             <el-form-item label="材质" prop="texture"> | ||||
|               <el-input v-model="formData.texture" placeholder="请输入材质" clearable /> | ||||
|             </el-form-item> | ||||
|           </el-col> | ||||
|           <el-col :span="12"> | ||||
|             <el-form-item label="质量标准" prop="qualityStandard"> | ||||
|               <el-input v-model="formData.qualityStandard" placeholder="请输入质量标准" clearable /> | ||||
|             </el-form-item> | ||||
|           </el-col> | ||||
|         </el-row> | ||||
|         <!-- 日期与状态区域 --> | ||||
|         <el-row :gutter="20"> | ||||
|           <el-col :span="12"> | ||||
|             <el-form-item label="使用部位" prop="partUsed"> | ||||
|               <el-input v-model="formData.partUsed" placeholder="请输入使用部位" clearable /> | ||||
|             </el-form-item> | ||||
|           </el-col> | ||||
|           <el-col :span="12"> | ||||
|             <el-form-item label="交货地点" prop="deliveryPoints"> | ||||
|               <el-input v-model="formData.deliveryPoints" placeholder="请输入交货地点" clearable /> | ||||
|             </el-form-item> | ||||
|           </el-col> | ||||
|         </el-row> | ||||
|         <!-- 其他信息区域 --> | ||||
|         <el-row :gutter="20"> | ||||
|           <el-col :span="12"> | ||||
|             <el-form-item label="预计使用日期" prop="dateService"> | ||||
|               <el-date-picker v-model="formData.dateService" type="date" placeholder="选择预计使用日期" format="YYYY-MM-DD" /> | ||||
|             </el-form-item> | ||||
|           </el-col> | ||||
|         </el-row> | ||||
|         <el-row> | ||||
|           <el-col :span="24"> | ||||
|             <el-form-item label="备注" prop="remark"> | ||||
|               <el-input v-model="formData.remark" placeholder="请输入备注信息" type="textarea" rows="3" /> | ||||
|             </el-form-item> | ||||
|           </el-col> | ||||
|         </el-row> | ||||
|       </el-form> | ||||
|       <template #footer> | ||||
|         <el-button @click="handleClose">取消</el-button> | ||||
|         <el-button type="primary" @click="handleSubmit">确定</el-button> | ||||
|       </template> | ||||
|     </el-dialog> | ||||
|   </div> | ||||
| </template> | ||||
|  | ||||
| <script setup name="billofQuantities"> | ||||
| import { ref, reactive, onMounted, computed, getCurrentInstance } from 'vue'; | ||||
| import { obtainMasterDataList, totalsupplyplan, totalSupplyplanDetails, materialChangeSupplyplan } from '@/api/materials/overallPlanMaterialSupply/index'; | ||||
| import { | ||||
|   obtainMasterDataList, | ||||
|   totalsupplyplan, | ||||
|   totalSupplyplanDetails, | ||||
|   materialChangeSupplyplan | ||||
| } from '@/api/materials/overallPlanMaterialSupply/index'; | ||||
| import { useUserStoreHook } from '@/store/modules/user'; | ||||
| const userStore = useUserStoreHook(); | ||||
| const currentProject = computed(() => userStore.selectedProject); | ||||
| @ -100,215 +131,211 @@ const { proxy } = getCurrentInstance(); | ||||
| const visible = ref(false); | ||||
| const formRef = ref(null); | ||||
| const state = reactive({ | ||||
|     tableData: [], | ||||
|     queryForm: { | ||||
|         projectId: currentProject.value?.id, | ||||
|         versions: '', | ||||
|         sheet: '', | ||||
|         pageSize: 20, | ||||
|         pageNum: 1 | ||||
|     }, | ||||
|     loading: { | ||||
|         versions: false, | ||||
|         sheets: false, | ||||
|         list: false | ||||
|     }, | ||||
|     // 主id | ||||
|     masterData: {} | ||||
|      | ||||
|   tableData: [], | ||||
|   queryForm: { | ||||
|     projectId: currentProject.value?.id, | ||||
|     versions: '', | ||||
|     sheet: '', | ||||
|     pageSize: 20, | ||||
|     pageNum: 1 | ||||
|   }, | ||||
|   loading: { | ||||
|     versions: false, | ||||
|     sheets: false, | ||||
|     list: false | ||||
|   }, | ||||
|   // 主id | ||||
|   masterData: {} | ||||
| }); | ||||
| // 表单数据 | ||||
| const formData = reactive({ | ||||
|     batchNumber: '', | ||||
|     brand: '', | ||||
|     compileDate: '', | ||||
|     dateService: '', | ||||
|     deliveryPoints: '', | ||||
|     id: undefined, | ||||
|     name: '', | ||||
|     num: '', | ||||
|     partUsed: '', | ||||
|     planNumber: '', | ||||
|     projectId: undefined, | ||||
|     qualityStandard: '', | ||||
|     quantity: 0, | ||||
|     remark: '', | ||||
|     specification: '', | ||||
|     status: '', | ||||
|     texture: '', | ||||
|     unit: '' | ||||
|   batchNumber: '', | ||||
|   brand: '', | ||||
|   compileDate: '', | ||||
|   dateService: '', | ||||
|   deliveryPoints: '', | ||||
|   id: undefined, | ||||
|   name: '', | ||||
|   num: '', | ||||
|   partUsed: '', | ||||
|   planNumber: '', | ||||
|   projectId: undefined, | ||||
|   qualityStandard: '', | ||||
|   quantity: 0, | ||||
|   remark: '', | ||||
|   specification: '', | ||||
|   status: '', | ||||
|   texture: '', | ||||
|   unit: '' | ||||
| }); | ||||
| // 表单验证规则 | ||||
| const formRules = reactive({ | ||||
|     name: [ | ||||
|         { required: true, message: '请输入名称', trigger: 'blur' }, | ||||
|         { max: 100, message: '名称长度不能超过100个字符', trigger: 'blur' } | ||||
|     ], | ||||
|     num: [ | ||||
|         { required: true, message: '请输入编号', trigger: 'blur' }, | ||||
|         { max: 50, message: '编号长度不能超过50个字符', trigger: 'blur' } | ||||
|     ], | ||||
|     quantity: [ | ||||
|         { required: true, message: '请输入数量', trigger: 'blur' }, | ||||
|         { type: 'number', min: 0, message: '数量不能为负数', trigger: 'blur' } | ||||
|     ], | ||||
|     compileDate: [ | ||||
|         { required: true, message: '请选择编制日期', trigger: 'change' } | ||||
|     ] | ||||
|   name: [ | ||||
|     { required: true, message: '请输入名称', trigger: 'blur' }, | ||||
|     { max: 100, message: '名称长度不能超过100个字符', trigger: 'blur' } | ||||
|   ], | ||||
|   num: [ | ||||
|     { required: true, message: '请输入编号', trigger: 'blur' }, | ||||
|     { max: 50, message: '编号长度不能超过50个字符', trigger: 'blur' } | ||||
|   ], | ||||
|   quantity: [ | ||||
|     { required: true, message: '请输入数量', trigger: 'blur' }, | ||||
|     { type: 'number', min: 0, message: '数量不能为负数', trigger: 'blur' } | ||||
|   ], | ||||
|   compileDate: [{ required: true, message: '请选择编制日期', trigger: 'change' }] | ||||
| }); | ||||
| // 获取主表数据 | ||||
| async function getMasterDataList() { | ||||
|     try { | ||||
|         // 获取主数据列表 | ||||
|         state.loading.list = true; | ||||
|         const masterDataRes = await obtainMasterDataList({ | ||||
|             projectId: currentProject.value?.id | ||||
|         }); | ||||
|   try { | ||||
|     // 获取主数据列表 | ||||
|     state.loading.list = true; | ||||
|     const masterDataRes = await obtainMasterDataList({ | ||||
|       projectId: currentProject.value?.id | ||||
|     }); | ||||
|  | ||||
|         const { data: masterData } = masterDataRes; | ||||
|         console.log('masterData', masterData); | ||||
|     const { data: masterData } = masterDataRes; | ||||
|     console.log('masterData', masterData); | ||||
|  | ||||
|         if (!masterData[0].id) { | ||||
|             console.warn('未获取到有效的主数据ID'); | ||||
|             state.tableData = []; | ||||
|             return; | ||||
|         } | ||||
|         state.masterData = masterData[0]; | ||||
|  | ||||
|         // 获取供应计划 | ||||
|         const supplyPlanRes = await totalsupplyplan({ id: masterData[0].id }); | ||||
|  | ||||
|         // 处理结果 | ||||
|         if (supplyPlanRes.list == null) { | ||||
|             state.tableData = supplyPlanRes.rows || []; | ||||
|             console.log('state.tableData', state.tableData); | ||||
|         } else { | ||||
|             // 根据实际业务逻辑处理有list的情况 | ||||
|             state.tableData = []; | ||||
|         } | ||||
|  | ||||
|     } catch (error) { | ||||
|         console.error('获取主数据列表失败:', error); | ||||
|         // 错误情况下给默认值,避免页面出错 | ||||
|         state.tableData = []; | ||||
|     } finally { | ||||
|         state.loading.list = false; | ||||
|     if (!masterData[0].id) { | ||||
|       console.warn('未获取到有效的主数据ID'); | ||||
|       state.tableData = []; | ||||
|       return; | ||||
|     } | ||||
|     state.masterData = masterData[0]; | ||||
|  | ||||
|     // 获取供应计划 | ||||
|     const supplyPlanRes = await totalsupplyplan({ id: masterData[0].id }); | ||||
|  | ||||
|     // 处理结果 | ||||
|     if (supplyPlanRes.list == null) { | ||||
|       state.tableData = supplyPlanRes.rows || []; | ||||
|       console.log('state.tableData', state.tableData); | ||||
|     } else { | ||||
|       // 根据实际业务逻辑处理有list的情况 | ||||
|       state.tableData = []; | ||||
|     } | ||||
|   } catch (error) { | ||||
|     console.error('获取主数据列表失败:', error); | ||||
|     // 错误情况下给默认值,避免页面出错 | ||||
|     state.tableData = []; | ||||
|   } finally { | ||||
|     state.loading.list = false; | ||||
|   } | ||||
| } | ||||
| // 获取详情 | ||||
| // 修改获取详情的方法 | ||||
| async function totalSupplyplanDetail(id) { | ||||
|     try { | ||||
|         const result = await totalSupplyplanDetails(id); | ||||
|         if (result?.code === 200) { | ||||
|             const detailData = result.data || {}; | ||||
|             // 1. 清空原有表单数据 | ||||
|             Object.keys(formData).forEach(key => { | ||||
|                 formData[key] = undefined; | ||||
|             }); | ||||
|             // 2. 处理日期格式(假设接口返回的是Date对象或ISO字符串) | ||||
|             const formatDate = (date) => { | ||||
|                 if (!date) return ''; | ||||
|                 // 若为字符串,先转为Date对象 | ||||
|                 const d = typeof date === 'string' ? new Date(date) : date; | ||||
|                 return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`; | ||||
|             }; | ||||
|             // 3. 合并数据到formData(响应式赋值) | ||||
|             Object.assign(formData, { | ||||
|                 ...detailData, | ||||
|                 // 单独处理日期字段,转为表单可识别的字符串格式 | ||||
|                 compileDate: formatDate(detailData.compileDate), | ||||
|                 dateService: formatDate(detailData.dateService) | ||||
|             }); | ||||
|             console.log('表单数据已更新:', formData); | ||||
|         } else { | ||||
|             ElMessage.error(`获取详情失败: ${result?.msg || '未知错误'}`); | ||||
|         } | ||||
|     } catch (err) { | ||||
|         ElMessage.error(`接口请求失败: ${err.message}`); | ||||
|         console.error('详情接口错误:', err); | ||||
|     } finally { | ||||
|         state.loading.list = false; | ||||
|   try { | ||||
|     const result = await totalSupplyplanDetails(id); | ||||
|     if (result?.code === 200) { | ||||
|       const detailData = result.data || {}; | ||||
|       // 1. 清空原有表单数据 | ||||
|       Object.keys(formData).forEach((key) => { | ||||
|         formData[key] = undefined; | ||||
|       }); | ||||
|       // 2. 处理日期格式(假设接口返回的是Date对象或ISO字符串) | ||||
|       const formatDate = (date) => { | ||||
|         if (!date) return ''; | ||||
|         // 若为字符串,先转为Date对象 | ||||
|         const d = typeof date === 'string' ? new Date(date) : date; | ||||
|         return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`; | ||||
|       }; | ||||
|       // 3. 合并数据到formData(响应式赋值) | ||||
|       Object.assign(formData, { | ||||
|         ...detailData, | ||||
|         // 单独处理日期字段,转为表单可识别的字符串格式 | ||||
|         compileDate: formatDate(detailData.compileDate), | ||||
|         dateService: formatDate(detailData.dateService) | ||||
|       }); | ||||
|       console.log('表单数据已更新:', formData); | ||||
|     } else { | ||||
|       ElMessage.error(`获取详情失败: ${result?.msg || '未知错误'}`); | ||||
|     } | ||||
|   } catch (err) { | ||||
|     ElMessage.error(`接口请求失败: ${err.message}`); | ||||
|     console.error('详情接口错误:', err); | ||||
|   } finally { | ||||
|     state.loading.list = false; | ||||
|   } | ||||
| } | ||||
| // 修改 | ||||
| function editApprovalSheet(row) { | ||||
|     console.log(row); | ||||
|     totalSupplyplanDetail(row.id) | ||||
|     visible.value = true; | ||||
|   console.log(row); | ||||
|   totalSupplyplanDetail(row.id); | ||||
|   visible.value = true; | ||||
| } | ||||
| // 提交表单 | ||||
| const handleSubmit = async () => { | ||||
|     try { | ||||
|         // 表单验证 | ||||
|         await formRef.value.validate(); | ||||
|         // 触发提交事件 | ||||
|         console.log('submitData:', formData); | ||||
|         editMaterialSupply(formData); | ||||
|         handleClose(); | ||||
|     } catch (error) { | ||||
|         // 验证失败不提交 | ||||
|         console.error('表单验证失败:', error); | ||||
|         return; | ||||
|     } | ||||
|   try { | ||||
|     // 表单验证 | ||||
|     await formRef.value.validate(); | ||||
|     // 触发提交事件 | ||||
|     editMaterialSupply(formData); | ||||
|     handleClose(); | ||||
|   } catch (error) { | ||||
|     // 验证失败不提交 | ||||
|     console.error('表单验证失败:', error); | ||||
|     return; | ||||
|   } | ||||
| }; | ||||
| // 修改物资 | ||||
| function editMaterialSupply(formData) { | ||||
|     materialChangeSupplyplan(formData).then(res => { | ||||
|         if (res.code === 200) { | ||||
|             ElMessage.success('修改成功'); | ||||
|         } else { | ||||
|             ElMessage.error('修改失败'); | ||||
|         } | ||||
|     }); | ||||
|   materialChangeSupplyplan(formData).then((res) => { | ||||
|     if (res.code === 200) { | ||||
|       ElMessage.success('修改成功'); | ||||
|       getMasterDataList(); | ||||
|     } else { | ||||
|       ElMessage.error('修改失败'); | ||||
|     } | ||||
|   }); | ||||
| } | ||||
|  | ||||
| // 关闭弹窗 | ||||
| const handleClose = () => { | ||||
|     visible.value = false; | ||||
|     // 清空表单数据 | ||||
|     Object.keys(formData).forEach(key => { | ||||
|         formData[key] = undefined; | ||||
|     }); | ||||
|     // 重置表单验证状态 | ||||
|     formRef.value?.resetFields(); | ||||
|   visible.value = false; | ||||
|   // 清空表单数据 | ||||
|   Object.keys(formData).forEach((key) => { | ||||
|     formData[key] = undefined; | ||||
|   }); | ||||
|   // 重置表单验证状态 | ||||
|   formRef.value?.resetFields(); | ||||
| }; | ||||
|  | ||||
| // 审批 | ||||
| function clickApprovalSheet1() { | ||||
|     proxy.$tab.closePage(proxy.$route); | ||||
|     proxy.$router.push({ | ||||
|         path: `/materials/overallPlanMaterialSupply/indexEdit`, | ||||
|         query: { | ||||
|             id: state.masterData.id, | ||||
|             type: 'update' | ||||
|         } | ||||
|     }); | ||||
|   proxy.$tab.closePage(proxy.$route); | ||||
|   proxy.$router.push({ | ||||
|     path: `/materials/overallPlanMaterialSupply/indexEdit`, | ||||
|     query: { | ||||
|       id: state.masterData.id, | ||||
|       type: 'update' | ||||
|     } | ||||
|   }); | ||||
| } | ||||
| // 审核流程 | ||||
| function lookApprovalFlow() { | ||||
|     proxy.$router.push({ | ||||
|         path: `/materials/overallPlanMaterialSupply/indexEdit`, | ||||
|         query: { | ||||
|             id: state.masterData.id, | ||||
|             type: 'view' | ||||
|         } | ||||
|     }); | ||||
|   proxy.$router.push({ | ||||
|     path: `/materials/overallPlanMaterialSupply/indexEdit`, | ||||
|     query: { | ||||
|       id: state.masterData.id, | ||||
|       type: 'view' | ||||
|     } | ||||
|   }); | ||||
| } | ||||
| onMounted(() => { | ||||
|     getMasterDataList(); | ||||
| }) | ||||
|   getMasterDataList(); | ||||
| }); | ||||
| </script> | ||||
| <style> | ||||
| .overall-plan-material-supply { | ||||
|     padding: 20px; | ||||
|   padding: 20px; | ||||
| } | ||||
|  | ||||
| .space-y-4>.el-row { | ||||
|     margin-bottom: 16px; | ||||
| .space-y-4 > .el-row { | ||||
|   margin-bottom: 16px; | ||||
| } | ||||
|  | ||||
| .space-y-4>.el-row:last-child { | ||||
|     margin-bottom: 0; | ||||
| .space-y-4 > .el-row:last-child { | ||||
|   margin-bottom: 0; | ||||
| } | ||||
| </style> | ||||
|  | ||||
| @ -3,55 +3,16 @@ | ||||
|     <transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave"> | ||||
|       <div v-show="showSearch" class="mb-[10px]"> | ||||
|         <el-card shadow="hover"> | ||||
|           <el-form ref="queryFormRef" :model="queryParams" :inline="true"> | ||||
|           <el-form ref="queryFormRef" :model="queryParams" :inline="true" label-width="100px"> | ||||
|             <el-form-item label="采购单编号" prop="docCode"> | ||||
|               <el-input v-model="queryParams.docCode" placeholder="请输入采购单编号" clearable @keyup.enter="handleQuery" /> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="供应商" prop="supplier"> | ||||
|               <el-input v-model="queryParams.supplier" placeholder="请输入供应商" clearable @keyup.enter="handleQuery" /> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="事由" prop="reason"> | ||||
|               <el-input v-model="queryParams.reason" placeholder="请输入事由" clearable @keyup.enter="handleQuery" /> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="设备统称" prop="name"> | ||||
|               <el-input v-model="queryParams.name" placeholder="请输入设备统称" clearable @keyup.enter="handleQuery" /> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="到货日期" prop="arrivalDate"> | ||||
|               <el-date-picker clearable v-model="queryParams.arrivalDate" type="date" value-format="YYYY-MM-DD" placeholder="请选择到货日期" /> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="设计负责人联系方式" prop="designDirectorTel"> | ||||
|               <el-input v-model="queryParams.designDirectorTel" placeholder="请输入设计负责人联系方式" clearable @keyup.enter="handleQuery" /> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="现场技术负责人联系方式" prop="technicalDirectorTel"> | ||||
|               <el-input v-model="queryParams.technicalDirectorTel" placeholder="请输入现场技术负责人联系方式" clearable @keyup.enter="handleQuery" /> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="收货地址" prop="receivingAddress"> | ||||
|               <el-input v-model="queryParams.receivingAddress" placeholder="请输入收货地址" clearable @keyup.enter="handleQuery" /> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="联系人" prop="contacts"> | ||||
|               <el-input v-model="queryParams.contacts" placeholder="请输入联系人" clearable @keyup.enter="handleQuery" /> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="项目负责人" prop="projectDirector"> | ||||
|               <el-input v-model="queryParams.projectDirector" placeholder="请输入项目负责人" clearable @keyup.enter="handleQuery" /> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="采购经办人" prop="purchasingAgent"> | ||||
|               <el-input v-model="queryParams.purchasingAgent" placeholder="请输入采购经办人" clearable @keyup.enter="handleQuery" /> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="日期" prop="preparedDate"> | ||||
|               <el-date-picker clearable v-model="queryParams.preparedDate" type="date" value-format="YYYY-MM-DD" placeholder="请选择日期" /> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="反馈文件地址" prop="feedbackUrl"> | ||||
|               <el-input v-model="queryParams.feedbackUrl" placeholder="请输入反馈文件地址" clearable @keyup.enter="handleQuery" /> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="签收单位" prop="signingUnit"> | ||||
|               <el-input v-model="queryParams.signingUnit" placeholder="请输入签收单位" clearable @keyup.enter="handleQuery" /> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="签收人" prop="signingPerson"> | ||||
|               <el-input v-model="queryParams.signingPerson" placeholder="请输入签收人" clearable @keyup.enter="handleQuery" /> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="签收日期" prop="signingDate"> | ||||
|               <el-date-picker clearable v-model="queryParams.signingDate" type="date" value-format="YYYY-MM-DD" placeholder="请选择签收日期" /> | ||||
|             </el-form-item> | ||||
|             <el-form-item> | ||||
|               <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button> | ||||
|               <el-button icon="Refresh" @click="resetQuery">重置</el-button> | ||||
| @ -60,62 +21,48 @@ | ||||
|         </el-card> | ||||
|       </div> | ||||
|     </transition> | ||||
|  | ||||
|     <el-card shadow="never"> | ||||
|       <template #header> | ||||
|         <el-row :gutter="10" class="mb8"> | ||||
|           <el-col :span="1.5"> | ||||
|             <el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['cailiaoshebei:purchaseDoc:add']">新增</el-button> | ||||
|           </el-col> | ||||
|           <el-col :span="1.5"> | ||||
|             <el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['cailiaoshebei:purchaseDoc:edit']" | ||||
|               >修改</el-button | ||||
|             > | ||||
|           </el-col> | ||||
|           <el-col :span="1.5"> | ||||
|             <el-button | ||||
|               type="danger" | ||||
|               plain | ||||
|               icon="Delete" | ||||
|               :disabled="multiple" | ||||
|               @click="handleDelete()" | ||||
|               v-hasPermi="['cailiaoshebei:purchaseDoc:remove']" | ||||
|               >删除</el-button | ||||
|             > | ||||
|           </el-col> | ||||
|           <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> | ||||
|         </el-row> | ||||
|       </template> | ||||
|  | ||||
|       <el-table v-loading="loading" :data="purchaseDocList" @selection-change="handleSelectionChange"> | ||||
|         <el-table-column type="selection" width="55" align="center" /> | ||||
|         <el-table-column label="采购单编号" align="center" prop="docCode" width="90" /> | ||||
|         <el-table-column label="批次号" align="center" prop="mrpBaseId"> | ||||
|           <template #default="scope"> | ||||
|             {{ batchOptions.find((item) => item.id == scope.row.mrpBaseId)?.planCode }} | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <el-table-column label="供应商" align="center" prop="supplier" /> | ||||
|         <el-table-column label="事由" align="center" prop="reason" /> | ||||
|         <el-table-column label="设备统称" align="center" prop="name" /> | ||||
|         <el-table-column label="到货日期" align="center" prop="arrivalDate" width="180"> | ||||
|         <el-table-column label="到货日期" align="center" prop="arrivalDate" width="120"> | ||||
|           <template #default="scope"> | ||||
|             <span>{{ parseTime(scope.row.arrivalDate, '{y}-{m}-{d}') }}</span> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <el-table-column label="负责人联系方式" align="center" prop="designDirectorTel" width="130" /> | ||||
|         <el-table-column label="现场联系方式" align="center" prop="technicalDirectorTel" width="130" /> | ||||
|         <el-table-column label="收货地址" align="center" prop="receivingAddress" /> | ||||
|         <el-table-column label="联系人" align="center" prop="contacts" /> | ||||
|         <el-table-column label="项目负责人" align="center" prop="projectDirector" width="90" /> | ||||
|  | ||||
|         <el-table-column label="物流单号" align="center" prop="remark" width="150"> | ||||
|           <template #default="scope"> | ||||
|             <el-button link type="primary" icon="View" @click="handleView(scope.row)" v-hasPermi="['out:monthPlan:remove']">查看物流单</el-button> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <el-table-column label="采购经办人" align="center" prop="purchasingAgent" width="90" /> | ||||
|         <el-table-column label="日期" align="center" prop="preparedDate" width="180"> | ||||
|         <el-table-column label="日期" align="center" prop="preparedDate" width="120"> | ||||
|           <template #default="scope"> | ||||
|             <span>{{ parseTime(scope.row.preparedDate, '{y}-{m}-{d}') }}</span> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <el-table-column label="文件地址" align="center" prop="feedbackUrl" width="130"> | ||||
|         <el-table-column label="供应商返回" align="center" prop="feedbackUrl" width="130"> | ||||
|           <template #default="scope"> | ||||
|             <el-link :href="scope.row.feedbackUrl" target="_blank" type="primary" v-if="scope.row.feedbackUrl">回单</el-link> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|  | ||||
|         <el-table-column label="审核状态" align="center" prop="status"> | ||||
|           <template #default="scope"> | ||||
|             <dict-tag :options="wf_business_status" :value="scope.row.status"></dict-tag> | ||||
| @ -123,29 +70,56 @@ | ||||
|         </el-table-column> | ||||
|         <el-table-column label="操作" align="center" fixed="right" width="160"> | ||||
|           <template #default="scope"> | ||||
|             <div class="flex flex-wrap"> | ||||
|               <div class="flex"> | ||||
|                 <div class="w3"></div> | ||||
|                 <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']" | ||||
|                   >上传</el-button | ||||
|                 > | ||||
|               </div> | ||||
|               <br /> | ||||
|               <div class="w3"></div> | ||||
|               <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['cailiaoshebei:purchaseDoc:edit']" | ||||
|                 >修改</el-button | ||||
|               > | ||||
|               <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['cailiaoshebei:purchaseDoc:remove']" | ||||
|                 >删除</el-button | ||||
|               > | ||||
|             </div> | ||||
|             <el-button | ||||
|               link | ||||
|               type="primary" | ||||
|               v-if="scope.row.status == 'draft' || scope.row.status == 'back'" | ||||
|               icon="Finished" | ||||
|               @click="handleAudit(scope.row)" | ||||
|               v-hasPermi="['cailiaoshebei:purchaseDoc:edit']" | ||||
|             > | ||||
|               审核</el-button | ||||
|             > | ||||
|             <el-button | ||||
|               link | ||||
|               type="primary" | ||||
|               v-if="scope.row.status != 'draft'" | ||||
|               icon="view" | ||||
|               @click="handleViewDetail(scope.row)" | ||||
|               v-hasPermi="['cailiaoshebei:purchaseDoc:edit']" | ||||
|             > | ||||
|               查看</el-button | ||||
|             > | ||||
|             <el-button | ||||
|               link | ||||
|               type="primary" | ||||
|               v-if="!scope.row.feedbackUrl && scope.row.status == 'finish'" | ||||
|               icon="Upload" | ||||
|               @click="handleUpload(scope.row)" | ||||
|               v-hasPermi="['cailiaoshebei:purchaseDoc:edit']" | ||||
|               >上传</el-button | ||||
|             > | ||||
|             <el-button | ||||
|               link | ||||
|               type="primary" | ||||
|               icon="Edit" | ||||
|               @click="handleUpdate(scope.row)" | ||||
|               v-if="scope.row.status == 'draft'" | ||||
|               v-hasPermi="['cailiaoshebei:purchaseDoc:edit']" | ||||
|               >修改</el-button | ||||
|             > | ||||
|             <el-button | ||||
|               link | ||||
|               type="primary" | ||||
|               v-if="scope.row.status == 'finish' && scope.row.feedbackUrl" | ||||
|               icon="Share" | ||||
|               @click="handleShare(scope.row)" | ||||
|               v-hasPermi="['cailiaoshebei:purchaseDoc:remove']" | ||||
|               >物流单分享</el-button | ||||
|             > | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|       </el-table> | ||||
|  | ||||
|       <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" /> | ||||
|     </el-card> | ||||
|     <!-- 添加或修改物资-采购联系单对话框 --> | ||||
| @ -157,7 +131,6 @@ | ||||
|           ></el-col> | ||||
|           <el-col :span="12" :offset="0" | ||||
|             ><el-form-item label="供应商" prop="supplier"> | ||||
|               <!-- <el-input v-model="form.supplier" placeholder="请输入供应商" /> --> | ||||
|               <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 | ||||
| @ -187,11 +160,11 @@ | ||||
|           ></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-input v-model="form.designDirectorTel" placeholder="请输入设计负责人联系方式" /> </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-input v-model="form.technicalDirectorTel" placeholder="请输入现场技术负责人联系方式" /> </el-form-item | ||||
|           ></el-col> | ||||
|           <el-col :span="12" :offset="0"> | ||||
|             <el-form-item label="收货地址" prop="receivingAddress"> | ||||
| @ -208,13 +181,28 @@ | ||||
|             ><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-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-col> --> | ||||
|         </el-row> | ||||
|       </el-form> | ||||
|       <el-table v-loading="loading" :data="selectPlanList" v-if="form.id"> | ||||
|         <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="unit" width="80" /> | ||||
|         <el-table-column label="需求数量" align="center" prop="demandQuantity" v-if="form.docType == 2"> | ||||
|           <template #default="scope"> | ||||
|             <el-input v-model="scope.row.demandQuantity" placeholder="请输入" type="number" /> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <el-table-column label="需求数量" align="center" prop="demandQuantity" v-else /> | ||||
|         <!-- <el-table-column label="需求到货时间" align="center" prop="arrivalTime" width="250" /> --> | ||||
|         <el-table-column label="备注" align="center" prop="remark" /> | ||||
|       </el-table> | ||||
|       <template #footer> | ||||
|         <div class="dialog-footer"> | ||||
|           <el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button> | ||||
| @ -231,15 +219,30 @@ | ||||
|         </span> | ||||
|       </template> | ||||
|     </el-dialog> | ||||
|     <!-- 查看文件列表 --> | ||||
|     <el-dialog title="文件列表" v-model="viewVisible" width="45%"> | ||||
|       <el-table v-if="fileList.length > 0" :data="fileList" style="width: 100%" border> | ||||
|         <el-table-column label="单号" align="center" prop="ltn" /> | ||||
|         <el-table-column label="数量" align="center" prop="num" /> | ||||
|         <el-table-column label="物资名称" align="center" prop="name" /> | ||||
|       </el-table> | ||||
|       <div v-else class="empty-list text-center">暂无文件</div> | ||||
|       <template #footer> | ||||
|         <span> | ||||
|           <el-button type="primary" @click="viewVisible = false">关闭</el-button> | ||||
|         </span> | ||||
|       </template> | ||||
|     </el-dialog> | ||||
|   </div> | ||||
| </template> | ||||
|  | ||||
| <script setup name="PurchaseDoc" lang="ts"> | ||||
| import { getBatch, listBatch } from '@/api/materials/batchPlan'; | ||||
| import { listPurchaseDoc, getPurchaseDoc, delPurchaseDoc, addPurchaseDoc, updatePurchaseDoc } from '@/api/materials/purchaseDoc'; | ||||
| import { listPurchaseDoc, getPurchaseDoc, listLink, addPurchaseDoc, updatePurchaseDoc } from '@/api/materials/purchaseDoc'; | ||||
| import { PurchaseDocVO, PurchaseDocQuery, PurchaseDocForm } from '@/api/materials/purchaseDoc/types'; | ||||
| import { listContractor } from '@/api/project/contractor'; | ||||
| import { useUserStoreHook } from '@/store/modules/user'; | ||||
| import { getToken } from '@/utils/auth'; | ||||
|  | ||||
| const { proxy } = getCurrentInstance() as ComponentInternalInstance; | ||||
| const route = useRoute(); | ||||
| @ -261,6 +264,7 @@ const total = ref(0); | ||||
| const feedbackUrl = ref(''); | ||||
| const queryFormRef = ref<ElFormInstance>(); | ||||
| const purchaseDocFormRef = ref<ElFormInstance>(); | ||||
| const IP = 'http://192.168.110.151:7788'; | ||||
|  | ||||
| const dialog = reactive<DialogOption>({ | ||||
|   visible: false, | ||||
| @ -284,7 +288,6 @@ const initFormData: any = { | ||||
|   receivingAddress: undefined, | ||||
|   contacts: undefined, | ||||
|   associationList: [], | ||||
|  | ||||
|   projectDirector: undefined, | ||||
|   purchasingAgent: undefined, | ||||
|   preparedDate: undefined, | ||||
| @ -321,7 +324,16 @@ const data = reactive({ | ||||
|     params: {} | ||||
|   }, | ||||
|   rules: { | ||||
|     id: [{ required: true, message: '主键ID不能为空', trigger: 'blur' }] | ||||
|     id: [{ required: true, message: '主键ID不能为空', trigger: 'blur' }], | ||||
|     // 电话号码验证 | ||||
|     technicalDirectorTel: [ | ||||
|       { required: true, message: '请输入电话', trigger: 'blur' }, | ||||
|       { pattern: /^1[3-9]\d{9}$/, message: '请输入正确的手机号码', trigger: 'blur' } | ||||
|     ], | ||||
|     designDirectorTel: [ | ||||
|       { required: true, message: '请输入电话', trigger: 'blur' }, | ||||
|       { pattern: /^1[3-9]\d{9}$/, message: '请输入正确的手机号码', trigger: 'blur' } | ||||
|     ] | ||||
|   } | ||||
| }); | ||||
|  | ||||
| @ -361,6 +373,17 @@ const resetQuery = () => { | ||||
|   handleQuery(); | ||||
| }; | ||||
|  | ||||
| const fileList = ref([]); | ||||
| const viewVisible = ref(false); | ||||
| const handleView = async (row?: any) => { | ||||
|   const res = await listLink({ | ||||
|     docId: row.id | ||||
|   }); | ||||
|   fileList.value = res.rows; | ||||
|  | ||||
|   viewVisible.value = true; | ||||
| }; | ||||
|  | ||||
| /** 多选框选中数据 */ | ||||
| const handleSelectionChange = (selection: PurchaseDocVO[]) => { | ||||
|   ids.value = selection.map((item) => item.id); | ||||
| @ -388,6 +411,12 @@ const handleUpdate = async (row?: PurchaseDocVO) => { | ||||
|   dialog.title = '修改物资-采购联系单'; | ||||
| }; | ||||
|  | ||||
| const selectPlanList = computed(() => { | ||||
|   if (!form.value.planId) return []; | ||||
|   const result = planList.value.filter((item) => form.value.planId.includes(item.id)); | ||||
|   return result; | ||||
| }); | ||||
|  | ||||
| /** 提交按钮 */ | ||||
| const submitForm = () => { | ||||
|   purchaseDocFormRef.value?.validate(async (valid: boolean) => { | ||||
| @ -414,7 +443,6 @@ const getPlanList = async () => { | ||||
|   const res = await getBatch({ | ||||
|     pageNum: 1, | ||||
|     pageSize: 10, | ||||
|     mrpBaseId: undefined, | ||||
|     projectId: currentProject.value?.id, | ||||
|     mrpBaseId: form.value.mrpBaseId | ||||
|   }); | ||||
| @ -441,13 +469,26 @@ const getSupplierList = async () => { | ||||
|   supplierOptions.value = res.rows; | ||||
| }; | ||||
|  | ||||
| /** 删除按钮操作 */ | ||||
| const handleDelete = async (row?: PurchaseDocVO) => { | ||||
|   const _ids = row?.id || ids.value; | ||||
|   await proxy?.$modal.confirm('是否确认删除物资-采购联系单编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false)); | ||||
|   await delPurchaseDoc(_ids); | ||||
|   proxy?.$modal.msgSuccess('删除成功'); | ||||
|   await getList(); | ||||
| /** 分享按钮操作 */ | ||||
| const handleShare = async (row?: PurchaseDocVO) => { | ||||
|   const textarea = document.createElement('textarea'); | ||||
|   const data = JSON.stringify({ | ||||
|     docId: row.id, | ||||
|     mrpBaseId: row.mrpBaseId, | ||||
|     projectId: currentProject.value?.id, | ||||
|     token: 'Bearer ' + getToken() | ||||
|   }); | ||||
|   // 获取当前域名地址 | ||||
|   console.log(location); | ||||
|   textarea.value = IP + '/materials/purchaseDoc/uploadCode?data=' + data; | ||||
|   // textarea.value = location.host + '/materials/purchaseDoc/uploadCode?data=' + data; | ||||
|   textarea.style.position = 'fixed'; | ||||
|   textarea.style.opacity = '0'; | ||||
|   document.body.appendChild(textarea); | ||||
|   textarea.select(); | ||||
|   const success = document.execCommand('copy'); | ||||
|   document.body.removeChild(textarea); | ||||
|   ElMessage[success ? 'success' : 'error'](success ? '复制成功!' : '复制失败'); | ||||
| }; | ||||
|  | ||||
| /** 导出按钮操作 */ | ||||
| @ -481,6 +522,14 @@ const handleAudit = async (row?: PurchaseDocVO) => { | ||||
|     type: 'update' | ||||
|   }); | ||||
| }; | ||||
| /** 审核按钮操作 */ | ||||
| const handleViewDetail = async (row?: PurchaseDocVO) => { | ||||
|   proxy?.$tab.closePage(route); | ||||
|   proxy?.$tab.openPage('/materials/purchaseDoc/indexEdit', '审核采购联系单', { | ||||
|     id: row.id, | ||||
|     type: 'view' | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| onMounted(() => { | ||||
|   getList(); | ||||
|  | ||||
| @ -3,32 +3,54 @@ | ||||
|     <el-card shadow="always" :body-style="{ padding: '20px' }"> | ||||
|       <template #header> | ||||
|         <div> | ||||
|           <span><!-- card title --></span> | ||||
|           <span>物流单号填写</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 :model="shareForm" label-width="80px" ref="formRef" :rules="formRules"> | ||||
|         <!-- 循环项添加prop属性,指定嵌套字段路径 --> | ||||
|         <div v-for="(item, index) in shareForm.list" :key="index" class="row-wrap flex items-center"> | ||||
|           <el-row :gutter="20" class="w-full"> | ||||
|             <!-- 计划:必填 + 选择触发验证 --> | ||||
|             <el-col :xs="24" :sm="12" :lg="8"> | ||||
|               <el-form-item label="计划" :prop="`list[${index}].planId`" :rules="[{ required: true, message: '请选择计划', trigger: 'change' }]"> | ||||
|                 <el-select v-model="item.planId" placeholder="请选择"> | ||||
|                   <el-option v-for="plan in planList" :key="plan.id" :label="plan.name" :value="plan.id.toString()" /> | ||||
|                 </el-select> | ||||
|               </el-form-item> | ||||
|             </el-col> | ||||
|  | ||||
|             <!-- 数量:必填 + 数字验证(大于0) --> | ||||
|             <el-col :xs="24" :sm="12" :lg="8"> | ||||
|               <el-form-item label="数量" :prop="`list[${index}].num`"> | ||||
|                 <el-input v-model.number="item.num" placeholder="请填写数量" /> | ||||
|               </el-form-item> | ||||
|             </el-col> | ||||
|  | ||||
|             <!-- 物流单号:必填 + 非空验证 --> | ||||
|             <el-col :xs="20" :sm="10" :lg="6"> | ||||
|               <el-form-item | ||||
|                 label="物流单号" | ||||
|                 :prop="`list[${index}].ltn`" | ||||
|                 :rules="[ | ||||
|                   { required: true, message: '请填写物流单号', trigger: 'blur' }, | ||||
|                   { min: 3, max: 50, message: '物流单号长度需在3-50字符之间', trigger: 'blur' } | ||||
|                 ]" | ||||
|               > | ||||
|                 <el-input v-model="item.ltn" placeholder="请填写物流单号" /> | ||||
|               </el-form-item> | ||||
|             </el-col> | ||||
|  | ||||
|             <el-col :xs="4" :sm="2" :lg="2" class="flex items-center justify-center"> | ||||
|               <el-button type="danger" icon="Delete" size="small" @click="deleteRow(index)" :disabled="shareForm.list.length <= 1" /> | ||||
|             </el-col> | ||||
|           </el-row> | ||||
|         </div> | ||||
|  | ||||
|         <el-form-item> | ||||
|           <el-button type="primary" @click="onSubmit">立即提交</el-button> | ||||
|           <el-button>取消</el-button> | ||||
|           <el-button type="primary" @click="addRow" icon="Plus">添加物流单</el-button> | ||||
|           <el-button type="success" @click="onSubmit">提交</el-button> | ||||
|         </el-form-item> | ||||
|       </el-form> | ||||
|     </el-card> | ||||
| @ -36,19 +58,131 @@ | ||||
| </template> | ||||
|  | ||||
| <script lang="ts" setup> | ||||
| import { getBatch } from '@/api/materials/batchPlan'; | ||||
| import { uploadCode, ltnList } from '@/api/materials/purchaseDoc'; | ||||
| import { removeToken } from '@/utils/auth'; | ||||
| import { useRoute } from 'vue-router'; | ||||
| import { getCurrentInstance, onMounted, onUnmounted, ref } from 'vue'; | ||||
| import type { ElForm } from 'element-plus'; | ||||
|  | ||||
| const route = useRoute(); | ||||
| const form = reactive({ | ||||
| const { proxy } = getCurrentInstance() as any; | ||||
|  | ||||
| // 表单引用,用于调用验证方法 | ||||
| const formRef = ref<InstanceType<typeof ElForm>>(null); | ||||
|  | ||||
| const shareForm = ref({ | ||||
|   docId: '', | ||||
|   supplier: '', | ||||
|   mrpBaseId: '', | ||||
|   projectId: '', | ||||
|   token: '', | ||||
|   list: [ | ||||
|     { | ||||
|       planId: '', | ||||
|       num: '', | ||||
|       num: 0, // 初始化数量为0,避免undefined影响数字验证 | ||||
|       ltn: '' | ||||
|     } | ||||
|   ] | ||||
| }); | ||||
|  | ||||
| // 表单验证规则 | ||||
| const formRules = ref({}); | ||||
|  | ||||
| const planList = ref([]); | ||||
| const getPlanList = async () => { | ||||
|   const res = await getBatch({ | ||||
|     pageNum: 1, | ||||
|     pageSize: 10, | ||||
|     projectId: shareForm.value.projectId, | ||||
|     mrpBaseId: shareForm.value.mrpBaseId, | ||||
|     token: shareForm.value.token | ||||
|   }); | ||||
|   planList.value = res.rows; | ||||
|   getOrder(); | ||||
| }; | ||||
|  | ||||
| const addRow = () => { | ||||
|   shareForm.value.list.push({ | ||||
|     planId: '', | ||||
|     num: 0, // 新增行初始化数量为0 | ||||
|     ltn: '' | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| const deleteRow = (index: number) => { | ||||
|   proxy?.$modal | ||||
|     .confirm('确定要删除这行数据吗?') | ||||
|     .then(() => { | ||||
|       shareForm.value.list.splice(index, 1); | ||||
|     }) | ||||
|     .catch(() => {}); | ||||
| }; | ||||
|  | ||||
| // 表单提交验证 | ||||
| const onSubmit = async () => { | ||||
|   // 先触发Element Plus表单的整体验证 | ||||
|   const formValid = await formRef.value?.validate().catch(() => false); | ||||
|   if (!formValid) { | ||||
|     proxy?.$modal.msgError('请完善所有必填项信息'); | ||||
|     return; | ||||
|   } | ||||
|  | ||||
|   // 再执行数据清洗和完整性校验(避免空行提交) | ||||
|   const cleanedArr = shareForm.value.list.filter((item) => item.planId && item.num > 0 && item.ltn); | ||||
|   if (cleanedArr.length === 0) { | ||||
|     proxy?.$modal.msgError('至少需填写一条完整的物流单信息'); | ||||
|     return; | ||||
|   } | ||||
|  | ||||
|   // 提交前替换列表为清洗后的数据(排除空行) | ||||
|   const submitData = { | ||||
|     ...shareForm.value, | ||||
|     list: cleanedArr | ||||
|   }; | ||||
|  | ||||
|   try { | ||||
|     await uploadCode(submitData); | ||||
|     proxy?.$modal.msgSuccess('上传成功'); | ||||
|     // getOrder(); | ||||
|     // 重置表单 | ||||
|     // shareForm.value.list = [{ planId: '', num: 0, ltn: '' }]; | ||||
|   } catch (error) { | ||||
|     proxy?.$modal.msgError('上传失败,请重试'); | ||||
|   } | ||||
| }; | ||||
|  | ||||
| const getOrder = async () => { | ||||
|   let res = await ltnList(shareForm.value); | ||||
|   shareForm.value.list = | ||||
|     res.rows.length > 0 | ||||
|       ? res.rows.map((item) => ({ | ||||
|           planId: item.planId?.toString() || '', // 确保与下拉框value类型一致 | ||||
|           num: item.num || 0, | ||||
|           ltn: item.ltn || '' | ||||
|         })) | ||||
|       : [{ planId: '', num: 0, ltn: '' }]; | ||||
| }; | ||||
|  | ||||
| onMounted(() => { | ||||
|   let data = JSON.parse(route.query.data as string); | ||||
|   shareForm.value.docId = data.docId || ''; | ||||
|   shareForm.value.supplier = data.supplier || ''; | ||||
|   shareForm.value.mrpBaseId = data.mrpBaseId || ''; | ||||
|   shareForm.value.projectId = data.projectId || ''; | ||||
|   shareForm.value.token = data.token || ''; | ||||
|   getPlanList(); | ||||
| }); | ||||
|  | ||||
| onUnmounted(() => { | ||||
|   removeToken(); | ||||
| }); | ||||
| </script> | ||||
|  | ||||
| <style lang="stylus" scoped></style> | ||||
| <style lang="scss" scoped> | ||||
| .row-wrap { | ||||
|   border-bottom: 1px dashed #dcdfe6; | ||||
|   padding-bottom: 10px; | ||||
|   margin-bottom: 10px; | ||||
| } | ||||
| </style> | ||||
|  | ||||
| @ -225,11 +225,12 @@ const handleUpdate = async (row?: ConfigVO) => { | ||||
| const submitForm = () => { | ||||
|   configFormRef.value?.validate(async (valid: boolean) => { | ||||
|     if (valid) { | ||||
|       buttonLoading.value = true; | ||||
|       // buttonLoading.value = true; | ||||
|       if (form.value.id) { | ||||
|         form.value.userId = form.value.userId ? form.value.userId?.join(',') : ''; | ||||
|         await updateConfig(form.value).finally(() => (buttonLoading.value = false)); | ||||
|       } else { | ||||
|         form.value.userId = form.value.userId.join(','); | ||||
|         form.value.userId = form.value.userId?.join(','); | ||||
|         await addConfig(form.value).finally(() => (buttonLoading.value = false)); | ||||
|       } | ||||
|       proxy?.$modal.msgSuccess('操作成功'); | ||||
|  | ||||
		Reference in New Issue
	
	Block a user