合并
This commit is contained in:
		
							
								
								
									
										367
									
								
								src/views/design/volumeCatalog/index.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										367
									
								
								src/views/design/volumeCatalog/index.vue
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,367 @@ | ||||
| <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="designSubitemId"> | ||||
|               <el-input v-model="queryParams.designSubitemId" placeholder="请输入设计子项ID" clearable @keyup.enter="handleQuery" /> | ||||
|             </el-form-item> --> | ||||
|             <el-form-item label="卷册号" prop="volumeNumber"> | ||||
|               <el-input v-model="queryParams.volumeNumber" placeholder="请输入卷册号" clearable @keyup.enter="handleQuery" /> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="资料名称" prop="documentName"> | ||||
|               <el-input v-model="queryParams.documentName" 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="['design:volumeCatalog:add']">新增</el-button> | ||||
|           </el-col> | ||||
|           <el-col :span="1.5"> | ||||
|             <el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['design:volumeCatalog:edit']" | ||||
|               >修改</el-button | ||||
|             > | ||||
|           </el-col> | ||||
|           <el-col :span="1.5"> | ||||
|             <el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['design:volumeCatalog:remove']" | ||||
|               >删除</el-button | ||||
|             > | ||||
|           </el-col> | ||||
|           <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> | ||||
|         </el-row> | ||||
|       </template> | ||||
|  | ||||
|       <el-table v-loading="loading" :data="volumeCatalogList" @selection-change="handleSelectionChange"> | ||||
|         <el-table-column type="selection" width="55" align="center" /> | ||||
|         <!-- <el-table-column label="子项ID" align="center" prop="designSubitemId" /> --> | ||||
|         <el-table-column label="卷册号" align="center" prop="volumeNumber" /> | ||||
|         <el-table-column label="资料名称" align="center" prop="documentName" /> | ||||
|         <el-table-column label="文件" align="center" prop="fileVoList"> | ||||
|           <template #default="scope"> | ||||
|             <el-link | ||||
|               v-for="item in scope.row.fileVoList" | ||||
|               :key="item.fileId" | ||||
|               :href="item.fileUrl" | ||||
|               target="_blank" | ||||
|               :type="item.status == '1' ? 'primary' : 'info'" | ||||
|               :underline="false" | ||||
|               @click="lookFile(scope.row.id)" | ||||
|             > | ||||
|               {{ item.fileName }} | ||||
|             </el-link> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <el-table-column label="上传说明" align="center" prop="explainText"> | ||||
|           <template #default="scope"> | ||||
|             {{ scope.row.fileVoList[0]?.explainText }} | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <el-table-column label="备注" align="center" prop="remark" /> | ||||
|         <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> | ||||
|           <template #default="scope"> | ||||
|             <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['design:volumeCatalog:edit']">修改</el-button> | ||||
|             <el-button link type="primary" icon="Upload" @click="handleUpload(scope.row)">上传</el-button> | ||||
|             <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['design:volumeCatalog:remove']" | ||||
|               >删除</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> | ||||
|     <!-- 添加或修改卷册目录对话框 --> | ||||
|     <el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body> | ||||
|       <el-form ref="volumeCatalogFormRef" :model="form" :rules="rules" label-width="80px"> | ||||
|         <!-- <el-form-item label="子项ID" prop="designSubitemId"> | ||||
|           <el-input v-model="form.designSubitemId" placeholder="请输入设计子项ID" /> | ||||
|         </el-form-item> --> | ||||
|         <el-form-item label="卷册号" prop="volumeNumber"> | ||||
|           <el-input v-model="form.volumeNumber" placeholder="请输入卷册号" /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="资料名称" prop="documentName"> | ||||
|           <el-input v-model="form.documentName" 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> | ||||
|     <!-- 上传文件对话框 --> | ||||
|     <el-dialog title="上传卷册文件" v-model="uploadVisible" width="500px" append-to-body> | ||||
|       <el-form :model="uploadForm" label-width="80px" :inline="false"> | ||||
|         <el-form-item label="查阅人员" prop="userId"> | ||||
|           <el-select v-model="uploadForm.userIds" placeholder="请选择查阅人员" clearable multiple> | ||||
|             <el-option v-for="user in userList" :key="user.userId" :label="user.nickName" :value="user.userId" /> | ||||
|           </el-select> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="作废文件" prop="cancellationIds"> | ||||
|           <el-select v-model="uploadForm.cancellationIds" placeholder="这里可以选择作废已上传的文件" clearable multiple> | ||||
|             <el-option v-for="user in uploadForm.fileList" :key="user.id" :label="user.fileName" :value="user.id" /> | ||||
|           </el-select> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="上传文件" prop="fileId"> | ||||
|           <file-upload v-model="uploadForm.fileId"></file-upload> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="说明" prop="explainText"> | ||||
|           <el-input v-model="uploadForm.explainText" placeholder="请输入说明" /> | ||||
|         </el-form-item> | ||||
|         <el-form-item> | ||||
|           <el-button type="primary" @click="onSubmit" :loading="buttonLoading">确定</el-button> | ||||
|           <el-button @click="uploadVisible = false">取消</el-button> | ||||
|         </el-form-item> | ||||
|       </el-form> | ||||
|     </el-dialog> | ||||
|   </div> | ||||
| </template> | ||||
|  | ||||
| <script setup name="VolumeCatalog" lang="ts"> | ||||
| import { | ||||
|   listVolumeCatalog, | ||||
|   getVolumeCatalog, | ||||
|   delVolumeCatalog, | ||||
|   addVolumeCatalog, | ||||
|   updateVolumeCatalog, | ||||
|   uploadVolumeFile, | ||||
|   getVolumeCatafileList, | ||||
|   lookViewerFile | ||||
| } from '@/api/design/volumeCatalog'; | ||||
| import { VolumeCatalogVO, VolumeCatalogQuery, VolumeCatalogForm } from '@/api/design/volumeCatalog/types'; | ||||
| import { useUserStoreHook } from '@/store/modules/user'; | ||||
|  | ||||
| const { proxy } = getCurrentInstance() as ComponentInternalInstance; | ||||
|  | ||||
| const volumeCatalogList = ref<VolumeCatalogVO[]>([]); | ||||
| 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); | ||||
|  | ||||
| // 获取用户 store | ||||
| const userStore = useUserStoreHook(); | ||||
| // 从 store 中获取项目列表和当前选中的项目 | ||||
| const currentProject = computed(() => userStore.selectedProject); | ||||
| const queryFormRef = ref<ElFormInstance>(); | ||||
| const volumeCatalogFormRef = ref<ElFormInstance>(); | ||||
|  | ||||
| const dialog = reactive<DialogOption>({ | ||||
|   visible: false, | ||||
|   title: '' | ||||
| }); | ||||
|  | ||||
| const uploadForm = reactive({ | ||||
|   userIds: [], | ||||
|   volumeCatalogId: undefined, | ||||
|   fileId: undefined, | ||||
|   explainText: '', | ||||
|   fileList: [], | ||||
|   cancellationIds: [] // 用于存储已作废的文件ID | ||||
| }); | ||||
|  | ||||
| const userList = ref([]); | ||||
|  | ||||
| const initFormData: VolumeCatalogForm = { | ||||
|   id: undefined, | ||||
|   projectId: currentProject.value?.id || '', | ||||
|   designSubitemId: undefined, | ||||
|   volumeNumber: undefined, | ||||
|   documentName: undefined, | ||||
|   remark: undefined | ||||
| }; | ||||
| const data = reactive<PageData<VolumeCatalogForm, VolumeCatalogQuery>>({ | ||||
|   form: { ...initFormData }, | ||||
|   queryParams: { | ||||
|     pageNum: 1, | ||||
|     pageSize: 10, | ||||
|     projectId: currentProject.value?.id, | ||||
|     designSubitemId: undefined, | ||||
|     volumeNumber: undefined, | ||||
|     documentName: undefined, | ||||
|     params: {} | ||||
|   }, | ||||
|   rules: { | ||||
|     id: [{ required: true, message: '主键ID不能为空', trigger: 'blur' }], | ||||
|     projectId: [{ required: true, message: '项目ID不能为空', trigger: 'blur' }], | ||||
|     volumeNumber: [{ required: true, message: '卷册号不能为空', trigger: 'blur' }], | ||||
|     documentName: [{ required: true, message: '资料名称不能为空', trigger: 'blur' }] | ||||
|   } | ||||
| }); | ||||
|  | ||||
| const { queryParams, form, rules } = toRefs(data); | ||||
|  | ||||
| /** 查询卷册目录列表 */ | ||||
| const getList = async () => { | ||||
|   loading.value = true; | ||||
|   try { | ||||
|     const res = await listVolumeCatalog(queryParams.value); | ||||
|     volumeCatalogList.value = res.rows; | ||||
|     total.value = res.total; | ||||
|   } finally { | ||||
|     loading.value = false; | ||||
|   } | ||||
| }; | ||||
|  | ||||
| /** 取消按钮 */ | ||||
| const cancel = () => { | ||||
|   reset(); | ||||
|   dialog.visible = false; | ||||
| }; | ||||
|  | ||||
| /** 表单重置 */ | ||||
| const reset = () => { | ||||
|   form.value = { ...initFormData }; | ||||
|   volumeCatalogFormRef.value?.resetFields(); | ||||
| }; | ||||
|  | ||||
| /** 搜索按钮操作 */ | ||||
| const handleQuery = () => { | ||||
|   queryParams.value.pageNum = 1; | ||||
|   getList(); | ||||
| }; | ||||
|  | ||||
| /** 重置按钮操作 */ | ||||
| const resetQuery = () => { | ||||
|   queryFormRef.value?.resetFields(); | ||||
|   handleQuery(); | ||||
| }; | ||||
|  | ||||
| /** 多选框选中数据 */ | ||||
| const handleSelectionChange = (selection: VolumeCatalogVO[]) => { | ||||
|   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?: VolumeCatalogVO) => { | ||||
|   reset(); | ||||
|   const _id = row?.id || ids.value[0]; | ||||
|   const res = await getVolumeCatalog(_id); | ||||
|   Object.assign(form.value, res.data); | ||||
|   dialog.visible = true; | ||||
|   dialog.title = '修改卷册目录'; | ||||
| }; | ||||
|  | ||||
| /** 上传文件按钮操作 */ | ||||
| const uploadVisible = ref(false); | ||||
| const handleUpload = async (row?: any) => { | ||||
|   resetUploadForm(); | ||||
|   uploadForm.volumeCatalogId = row.id; | ||||
|   userList.value = row.noViewerList; | ||||
|   const res = await getVolumeCatafileList(row.id); | ||||
|   uploadForm.fileList = res.data.filter((item) => item.status == '1') || []; | ||||
|   uploadVisible.value = true; | ||||
| }; | ||||
|  | ||||
| /** 查看文件 */ | ||||
| const lookFile = (fileId: string) => { | ||||
|   lookViewerFile(fileId); | ||||
| }; | ||||
|  | ||||
| /** 重置上传表单 */ | ||||
| const resetUploadForm = () => { | ||||
|   uploadForm.userIds = []; | ||||
|   uploadForm.volumeCatalogId = undefined; | ||||
|   uploadForm.fileId = undefined; | ||||
|   uploadForm.explainText = ''; | ||||
|   uploadForm.fileList = []; | ||||
|   uploadForm.cancellationIds = []; // 重置作废文件ID列表 | ||||
| }; | ||||
|  | ||||
| /** 提交按钮 */ | ||||
| const submitForm = () => { | ||||
|   volumeCatalogFormRef.value?.validate(async (valid: boolean) => { | ||||
|     if (valid) { | ||||
|       buttonLoading.value = true; | ||||
|       if (form.value.id) { | ||||
|         await updateVolumeCatalog(form.value).finally(() => (buttonLoading.value = false)); | ||||
|       } else { | ||||
|         await addVolumeCatalog(form.value).finally(() => (buttonLoading.value = false)); | ||||
|       } | ||||
|       proxy?.$modal.msgSuccess('操作成功'); | ||||
|       dialog.visible = false; | ||||
|       await getList(); | ||||
|     } | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| /** 上传文件提交 */ | ||||
| const onSubmit = async () => { | ||||
|   buttonLoading.value = true; | ||||
|   try { | ||||
|     await uploadVolumeFile(uploadForm); | ||||
|     proxy?.$modal.msgSuccess('文件上传成功'); | ||||
|     uploadVisible.value = false; | ||||
|     await getList(); | ||||
|   } catch (error) { | ||||
|     console.error('上传文件失败:', error); | ||||
|   } finally { | ||||
|     buttonLoading.value = false; | ||||
|   } | ||||
| }; | ||||
|  | ||||
| /** 删除按钮操作 */ | ||||
| const handleDelete = async (row?: VolumeCatalogVO) => { | ||||
|   const _ids = row?.id || ids.value; | ||||
|   await proxy?.$modal.confirm('是否确认删除卷册目录编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false)); | ||||
|   await delVolumeCatalog(_ids); | ||||
|   proxy?.$modal.msgSuccess('删除成功'); | ||||
|   await getList(); | ||||
| }; | ||||
|  | ||||
| /** 导出按钮操作 */ | ||||
| const handleExport = () => { | ||||
|   proxy?.download( | ||||
|     'design/volumeCatalog/export', | ||||
|     { | ||||
|       ...queryParams.value | ||||
|     }, | ||||
|     `volumeCatalog_${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> | ||||
| @ -22,7 +22,7 @@ | ||||
|           </div> | ||||
|           <p>总人数</p> | ||||
|           <div class="peopleNum"> | ||||
|             <span>{{ constructionUserData?.peopleCount + ' ' }} </span>人 | ||||
|             <span>{{ constructionUserData?.peopleCount }}  </span>人 | ||||
|           </div> | ||||
|         </div> | ||||
|         <div class="card"> | ||||
| @ -31,7 +31,7 @@ | ||||
|           </div> | ||||
|           <p>出勤人</p> | ||||
|           <div class="peopleNum"> | ||||
|             <span>{{ constructionUserData?.attendanceCount + ' ' }} </span>人 | ||||
|             <span>{{ constructionUserData?.attendanceCount }}   </span>人 | ||||
|           </div> | ||||
|         </div> | ||||
|         <div class="card"> | ||||
| @ -40,7 +40,7 @@ | ||||
|           </div> | ||||
|           <p>出勤率</p> | ||||
|           <div class="peopleNum"> | ||||
|             <span>{{ constructionUserData?.attendanceRate + ' ' }} </span>% | ||||
|             <span>{{ constructionUserData?.attendanceRate }}   </span>% | ||||
|           </div> | ||||
|         </div> | ||||
|       </div> | ||||
|  | ||||
							
								
								
									
										396
									
								
								src/views/materials/batchPlan/index.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										396
									
								
								src/views/materials/batchPlan/index.vue
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,396 @@ | ||||
| <template> | ||||
|   <div class="p-2"> | ||||
|     <el-row :gutter="20"> | ||||
|       <!-- 流程分类树 --> | ||||
|       <el-col style="" :span="5"> | ||||
|         <el-card shadow="hover"> | ||||
|           <template #header> | ||||
|             <el-row :gutter="10" class="mb8"> | ||||
|               <el-col :span="1.5" :offset="0" | ||||
|                 ><el-button type="primary" size="default" @click="addBatch" icon="FolderAdd" plain>新增</el-button></el-col | ||||
|               > | ||||
|               <el-col :span="1.5" :offset="0" | ||||
|                 ><el-button type="danger" size="default" @click="handleDeleteBatch" icon="FolderDelete" plain>删除</el-button></el-col | ||||
|               > | ||||
|             </el-row> | ||||
|           </template> | ||||
|  | ||||
|           <el-input v-model="queryParams.batchNumber" placeholder="请输入批次号" @input="getBatchList" prefix-icon="Search" clearable /> | ||||
|           <el-tree | ||||
|             ref="batchTreeRef" | ||||
|             class="mt-2" | ||||
|             node-key="batchNumber" | ||||
|             :data="batchOptions" | ||||
|             :props="{ label: 'batchNumber', children: 'children' }" | ||||
|             :expand-on-click-node="false" | ||||
|             highlight-current | ||||
|             default-expand-all | ||||
|             @node-click="handleNodeClick" | ||||
|           ></el-tree> | ||||
|           <pagination | ||||
|             v-show="total > 0" | ||||
|             :total="total" | ||||
|             v-model:page="queryParams.pageNum" | ||||
|             v-model:limit="queryParams.pageSize" | ||||
|             @pagination="getBatchList" | ||||
|             layout="prev, pager, next,jumper" | ||||
|           /> | ||||
|         </el-card> | ||||
|       </el-col> | ||||
|       <el-col :span="19"> | ||||
|         <el-card shadow="never"> | ||||
|           <template #header> | ||||
|             <el-row :gutter="10" class="mb8"> | ||||
|               <el-col :span="1.5"> | ||||
|                 <el-button type="primary" plain icon="SemiSelect" @click="handleAdd" v-hasPermi="['cailiaoshebei:cailiaoshebei:add']">选择</el-button> | ||||
|               </el-col> | ||||
|               <el-col :span="1.5"> | ||||
|                 <el-button type="success" plain icon="Check" @click="submitForm" v-hasPermi="['cailiaoshebei:cailiaoshebei:delete']">保存</el-button> | ||||
|               </el-col> | ||||
|  | ||||
|               <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> | ||||
|             </el-row> | ||||
|           </template> | ||||
|  | ||||
|           <el-table v-loading="loading" :data="cailiaoshebeiList" @selection-change="handleSelectionChange"> | ||||
|             <el-table-column type="selection" width="55" align="center" /> | ||||
|             <!-- <el-table-column label="供货商ID" align="center" prop="supplierId" /> --> | ||||
|             <el-table-column label="供货商" align="center" prop="supplierCompany" /> | ||||
|             <el-table-column label="设备材料名称" align="center" prop="name" /> | ||||
|             <el-table-column label="规格型号" align="center" prop="specification" /> | ||||
|             <el-table-column label="物料编码" align="center" prop="materialCode" width="200" /> | ||||
|             <el-table-column label="计量单位" align="center" prop="unit" width="80" /> | ||||
|             <el-table-column label="供应周期(天)" align="center" prop="estimatedCycle" /> | ||||
|             <el-table-column label="需求数量" align="center" prop="demandQuantity"> | ||||
|               <template #default="scope"> | ||||
|                 <el-input v-model="scope.row.demandQuantity" type="number" /> | ||||
|               </template> | ||||
|             </el-table-column> | ||||
|             <el-table-column label="计划到场时间" align="center" prop="arrivalTime" width="250"> | ||||
|               <template #default="scope"> | ||||
|                 <div class="flex justify-center w100%"> | ||||
|                   <el-date-picker v-model="scope.row.arrivalTime" type="date" value-format="YYYY-MM-DD" /> | ||||
|                 </div> | ||||
|               </template> | ||||
|             </el-table-column> | ||||
|             <el-table-column label="流程状态" align="center" prop="planAuditStatus"> | ||||
|               <template #default="scope"> | ||||
|                 <dict-tag :options="wf_business_status" :value="scope.row.planAuditStatus" /> | ||||
|               </template> | ||||
|             </el-table-column> | ||||
|             <el-table-column label="操作" align="center" width="150"> | ||||
|               <template #default="scope"> | ||||
|                 <el-button link type="primary" icon="Finished" @click="handleAudit(scope.row)" v-hasPermi="['out:monthPlan:remove']">审核</el-button> | ||||
|               </template> | ||||
|             </el-table-column> | ||||
|           </el-table> | ||||
|         </el-card> | ||||
|       </el-col> | ||||
|     </el-row> | ||||
|  | ||||
|     <!-- 添加或修改物资-材料设备对话框 --> | ||||
|     <el-dialog :title="dialog.title" v-model="dialog.visible" width="650px" append-to-body> | ||||
|       <el-transfer | ||||
|         v-model="cailiaoshebeiSelectedList" | ||||
|         filterable | ||||
|         :data="cailiaoshebeiAllList" | ||||
|         :props="{ | ||||
|           label: 'name', | ||||
|           key: 'id' | ||||
|         }" | ||||
|       /> | ||||
|       <template #footer> | ||||
|         <div class="dialog-footer"> | ||||
|           <el-button :loading="buttonLoading" type="primary" @click="submitTransferForm">确 定</el-button> | ||||
|           <el-button @click="cancel">取 消</el-button> | ||||
|         </div> | ||||
|       </template> | ||||
|     </el-dialog> | ||||
|   </div> | ||||
| </template> | ||||
|  | ||||
| <script setup name="Cailiaoshebei" lang="ts"> | ||||
| import { | ||||
|   listCailiaoshebei, | ||||
|   getCailiaoshebei, | ||||
|   delCailiaoshebei, | ||||
|   addCailiaoshebei, | ||||
|   updateCailiaoshebei, | ||||
|   listBatch, | ||||
|   getBatch, | ||||
|   delBatch | ||||
| } from '@/api/materials/batchPlan'; | ||||
| import { CailiaoshebeiVO, CailiaoshebeiQuery, CailiaoshebeiForm } from '@/api/materials/batchPlan/types'; | ||||
|  | ||||
| import { listContractor } from '@/api/project/contractor'; | ||||
| import { useUserStoreHook } from '@/store/modules/user'; | ||||
|  | ||||
| const { proxy } = getCurrentInstance() as ComponentInternalInstance; | ||||
| const { supply } = toRefs<any>(proxy?.useDict('supply')); | ||||
| // 获取用户 store | ||||
| const userStore = useUserStoreHook(); | ||||
| // 从 store 中获取项目列表和当前选中的项目 | ||||
| const currentProject = computed(() => userStore.selectedProject); | ||||
| const batchTreeRef = ref<any>(null); | ||||
| const cailiaoshebeiList = ref<CailiaoshebeiVO[]>([]); | ||||
| const cailiaoshebeiAllList = ref<CailiaoshebeiVO[]>([]); | ||||
| const cailiaoshebeiSelectedList = ref([]); | ||||
| const buttonLoading = ref(false); | ||||
| const loading = ref(false); | ||||
| const showSearch = ref(true); | ||||
| const ids = ref<Array<string | number>>([]); | ||||
| const single = ref(true); | ||||
| const multiple = ref(true); | ||||
| const total = ref(0); | ||||
| const batchOptions = ref<any[]>([]); | ||||
| const { wf_business_status } = toRefs<any>(proxy?.useDict('wf_business_status')); | ||||
|  | ||||
| const queryFormRef = ref<ElFormInstance>(); | ||||
| const cailiaoshebeiFormRef = ref<ElFormInstance>(); | ||||
|  | ||||
| const dialog = reactive<DialogOption>({ | ||||
|   visible: false, | ||||
|   title: '' | ||||
| }); | ||||
|  | ||||
| const initFormData: CailiaoshebeiForm = { | ||||
|   id: undefined, | ||||
|   batchNumber: undefined, | ||||
|   supplierId: undefined, | ||||
|   addDataList: [], | ||||
|  | ||||
|   supplier: undefined, | ||||
|   name: undefined, | ||||
|   supply: undefined, | ||||
|   specification: undefined, | ||||
|   signalment: undefined, | ||||
|   materialCode: undefined, | ||||
|   arrivalTime: undefined, | ||||
|   approvalProject: undefined, | ||||
|  | ||||
|   finishTime: undefined, | ||||
|   unit: undefined, | ||||
|   plan: undefined, | ||||
|   realQuantity: undefined, | ||||
|   projectId: currentProject.value.id, | ||||
|   remark: undefined | ||||
| }; | ||||
| const data = reactive<PageData<CailiaoshebeiForm, CailiaoshebeiQuery>>({ | ||||
|   form: { ...initFormData }, | ||||
|   queryParams: { | ||||
|     pageNum: 1, | ||||
|     pageSize: 10, | ||||
|     batchNumber: undefined, | ||||
|     supplierId: undefined, | ||||
|     supplier: undefined, | ||||
|     name: undefined, | ||||
|     projectId: currentProject.value.id, | ||||
|     supply: undefined, | ||||
|     specification: undefined, | ||||
|     signalment: undefined, | ||||
|     materialCode: undefined, | ||||
|     arrivalTime: undefined, | ||||
|     finishTime: undefined, | ||||
|     unit: undefined, | ||||
|     plan: undefined, | ||||
|     realQuantity: undefined, | ||||
|     params: {} | ||||
|   }, | ||||
|   rules: { | ||||
|     id: [{ required: true, message: '主键ID不能为空', trigger: 'blur' }] | ||||
|   } | ||||
| }); | ||||
|  | ||||
| const { queryParams, form, rules } = toRefs(data); | ||||
|  | ||||
| /** 查询物资-材料设备列表 */ | ||||
| const getList = async () => { | ||||
|   loading.value = true; | ||||
|   const res = await listCailiaoshebei(queryParams.value); | ||||
|   cailiaoshebeiList.value = res.rows; | ||||
|  | ||||
|   loading.value = false; | ||||
| }; | ||||
|  | ||||
| //查询批次列表 | ||||
| const getBatchList = async () => { | ||||
|   const res = await listBatch(queryParams.value); | ||||
|   console.log('🚀 ~ getBatchList ~ res:', res); | ||||
|   batchOptions.value = res.rows; | ||||
|   total.value = res.total; | ||||
|   try { | ||||
|     batchTreeRef.value.setCurrentKey(res.rows[0].batchNumber); | ||||
|     form.value.batchNumber = res.rows[0].batchNumber; | ||||
|     form.value.approvalProject = res.rows[0].approvalProject; | ||||
|   } catch (error) { | ||||
|     form.value.batchNumber = ''; | ||||
|   } | ||||
|   getList(); | ||||
| }; | ||||
|  | ||||
| /** 节点单击事件 */ | ||||
| const handleNodeClick = (data: any) => { | ||||
|   queryParams.value.batchNumber = data.batchNumber; | ||||
|   form.value.batchNumber = data.batchNumber; | ||||
|   form.value.approvalProject = data.approvalProject; | ||||
|  | ||||
|   console.log('🚀 ~ handleNodeClick ~ form.value:', form.value); | ||||
|   if (data.batchNumber === '0') { | ||||
|     queryParams.value.batchNumber = ''; | ||||
|   } | ||||
|   getList(); | ||||
| }; | ||||
|  | ||||
| /** 取消按钮 */ | ||||
| const cancel = () => { | ||||
|   reset(); | ||||
|   dialog.visible = false; | ||||
| }; | ||||
|  | ||||
| /** 表单重置 */ | ||||
| const reset = () => { | ||||
|   const preservedBatchId = form.value.batchNumber; // 先保存当前的 batchNumber | ||||
|   form.value = { ...initFormData, batchNumber: preservedBatchId }; // 重置但保留 | ||||
|   cailiaoshebeiFormRef.value?.resetFields(); | ||||
| }; | ||||
|  | ||||
| /** 搜索按钮操作 */ | ||||
| const handleQuery = () => { | ||||
|   queryParams.value.pageNum = 1; | ||||
|   getList(); | ||||
| }; | ||||
|  | ||||
| /** 重置按钮操作 */ | ||||
| const resetQuery = () => { | ||||
|   queryFormRef.value?.resetFields(); | ||||
|   handleQuery(); | ||||
| }; | ||||
|  | ||||
| /** 多选框选中数据 */ | ||||
| const handleSelectionChange = (selection: CailiaoshebeiVO[]) => { | ||||
|   ids.value = selection.map((item) => item.id); | ||||
|   single.value = selection.length != 1; | ||||
|   multiple.value = !selection.length; | ||||
| }; | ||||
|  | ||||
| /** 新增按钮操作 */ | ||||
| const handleAdd = () => { | ||||
|   reset(); | ||||
|   listCailiaoshebei({ | ||||
|     projectId: currentProject.value.id | ||||
|   }).then((res) => { | ||||
|     cailiaoshebeiAllList.value = res.rows; | ||||
|   }); | ||||
|  | ||||
|   dialog.visible = true; | ||||
|   dialog.title = '选择物资-材料设备'; | ||||
| }; | ||||
|  | ||||
| /** 修改按钮操作 */ | ||||
| // const handleUpdate = async (row?: CailiaoshebeiVO) => { | ||||
| //   reset(); | ||||
| //   const _id = row?.id || ids.value[0]; | ||||
| //   const res = await getCailiaoshebei(_id); | ||||
| //   Object.assign(form.value, res.data); | ||||
| //   selectValue.value = (form.value.supplierId as string).split(','); | ||||
| //   dialog.visible = true; | ||||
| //   dialog.title = '修改物资-材料设备'; | ||||
| // }; | ||||
|  | ||||
| /** 提交按钮 */ | ||||
| const submitForm = async () => { | ||||
|   buttonLoading.value = true; | ||||
|   cailiaoshebeiList.value.forEach((item) => { | ||||
|     if (item.id) { | ||||
|       delete item.id; | ||||
|     } | ||||
|   }); | ||||
|  | ||||
|   await addCailiaoshebei({ addDataList: cailiaoshebeiList.value } as any).finally(() => (buttonLoading.value = false)); | ||||
|   proxy?.$modal.msgSuccess('操作成功'); | ||||
|   dialog.visible = false; | ||||
| }; | ||||
|  | ||||
| /** 提交穿梭框数据 */ | ||||
| const submitTransferForm = async () => { | ||||
|   cailiaoshebeiList.value = cailiaoshebeiSelectedList.value.map((id) => { | ||||
|     const item = cailiaoshebeiAllList.value.find((option) => option.id === id); | ||||
|     return item; | ||||
|   }); | ||||
|   dialog.visible = false; | ||||
| }; | ||||
|  | ||||
| /** 新增批次 */ | ||||
| const addBatch = async () => { | ||||
|   await proxy?.$modal.confirm('是否确认新增批次?').finally(() => (loading.value = false)); | ||||
|   const res = await getBatch({ projectId: currentProject.value.id }); | ||||
|   console.log('🚀 ~ addBatch ~ res:', res); | ||||
|   await getBatchList(); | ||||
|  | ||||
|   proxy?.$modal.msgSuccess('新增成功'); | ||||
| }; | ||||
|  | ||||
| /** 删除批次 */ | ||||
| const handleDeleteBatch = async () => { | ||||
|   const _ids = batchTreeRef.value.getCurrentNode()?.id; | ||||
|   await proxy?.$modal.confirm('是否确认删除批次编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false)); | ||||
|   await delBatch(_ids); | ||||
|   proxy?.$modal.msgSuccess('删除成功'); | ||||
|   queryParams.value.batchNumber = ''; | ||||
|  | ||||
|   await getBatchList(); | ||||
| }; | ||||
|  | ||||
| /** 删除按钮操作 */ | ||||
| const handleDelete = async (row?: CailiaoshebeiVO) => { | ||||
|   const _ids = row?.id || ids.value; | ||||
|   await proxy?.$modal.confirm('是否确认删除物资-材料设备编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false)); | ||||
|   await delCailiaoshebei(_ids); | ||||
|   proxy?.$modal.msgSuccess('删除成功'); | ||||
|   await getList(); | ||||
| }; | ||||
|  | ||||
| /** 审核按钮操作 */ | ||||
| const handleAudit = async (row?: CailiaoshebeiVO) => { | ||||
|   const data = { | ||||
|     ...row, | ||||
|     approvalProject: form.value.approvalProject | ||||
|   }; | ||||
|   proxy?.$tab.openPage('/materials-management/batchPlan/indexEdit', '审核物资设备批次需求计划', { | ||||
|     id: row?.id, | ||||
|     data: JSON.stringify(data), | ||||
|     type: 'update' | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| /** 查询供货商列表 */ | ||||
| const supplierOptions = ref([]); | ||||
| const getSupplierList = async () => { | ||||
|   const res = await listContractor({ | ||||
|     projectId: currentProject.value.id, | ||||
|     pageNum: 1, | ||||
|     pageSize: 10000 | ||||
|   }); | ||||
|   supplierOptions.value = res.rows; | ||||
| }; | ||||
|  | ||||
| onMounted(() => { | ||||
|   getBatchList(); | ||||
|   getSupplierList(); | ||||
| }); | ||||
|  | ||||
| //监听项目id刷新数据 | ||||
| const listeningProject = watch( | ||||
|   () => currentProject.value.id, | ||||
|   (nid, oid) => { | ||||
|     queryParams.value.projectId = nid; | ||||
|     form.value.projectId = nid; | ||||
|     getBatchList(); | ||||
|     getSupplierList(); | ||||
|   } | ||||
| ); | ||||
|  | ||||
| onUnmounted(() => { | ||||
|   listeningProject(); | ||||
| }); | ||||
| </script> | ||||
							
								
								
									
										401
									
								
								src/views/materials/batchPlan/indexEdit.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										401
									
								
								src/views/materials/batchPlan/indexEdit.vue
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,401 @@ | ||||
| <template> | ||||
|   <div class="p-4 bg-gray-50"> | ||||
|     <div class="max-w-4xl mx-auto"> | ||||
|       <!-- 顶部按钮区域 --> | ||||
|       <el-card class="mb-4 rounded-lg shadow-sm bg-white border border-gray-100 transition-all hover:shadow-md"> | ||||
|         <approvalButton | ||||
|           @submitForm="submitForm" | ||||
|           @approvalVerifyOpen="approvalVerifyOpen" | ||||
|           @handleApprovalRecord="handleApprovalRecord" | ||||
|           :buttonLoading="buttonLoading" | ||||
|           :id="form.id" | ||||
|           :status="form.approvalProject" | ||||
|           :pageType="routeParams.type" | ||||
|         /> | ||||
|       </el-card> | ||||
|       <!-- 表单区域 --> | ||||
|       <el-card class="rounded-lg shadow-sm bg-white border border-gray-100 transition-all hover:shadow-md overflow-hidden"> | ||||
|         <div class="p-4 bg-gradient-to-r from-blue-50 to-indigo-50 border-b border-gray-100"> | ||||
|           <h3 class="text-lg font-semibold text-gray-800">施工产值</h3> | ||||
|         </div> | ||||
|         <div class="p-6"> | ||||
|           <el-form | ||||
|             ref="leaveFormRef" | ||||
|             v-loading="loading" | ||||
|             :disabled="routeParams.type === 'view'" | ||||
|             :model="form" | ||||
|             :rules="rules" | ||||
|             label-width="120px" | ||||
|             class="space-y-4" | ||||
|           > | ||||
|             <el-row :gutter="20" justify="center"> | ||||
|               <el-col :span="12" :offset="0"> | ||||
|                 <el-form-item label="计划到场时间" prop="arrivalTime"> | ||||
|                   <el-date-picker | ||||
|                     clearable | ||||
|                     v-model="form.arrivalTime" | ||||
|                     disabled | ||||
|                     type="date" | ||||
|                     value-format="YYYY-MM-DD" | ||||
|                     placeholder="请选择计划到场时间" | ||||
|                   > | ||||
|                   </el-date-picker> | ||||
|                 </el-form-item> | ||||
|                 <el-form-item label="计划完成时间" prop="finishTime"> | ||||
|                   <el-date-picker clearable v-model="form.finishTime" disabled type="date" value-format="YYYY-MM-DD" placeholder="请选择计划完成时间"> | ||||
|                   </el-date-picker> | ||||
|                 </el-form-item> | ||||
|                 <div v-for="(item, index) in selectValue" :key="index"> | ||||
|                   <el-divider content-position="center" | ||||
|                     ><el-text tag="b">{{ item }}</el-text></el-divider | ||||
|                   > | ||||
|                   <el-form-item label="单价" prop="unitPrice"> | ||||
|                     <el-input v-model="form.listOfMaterialInventory[index].unitPrice" type="number" disabled placeholder="请输入单价" /> | ||||
|                   </el-form-item> | ||||
|                   <el-form-item label="数量" prop="num"> | ||||
|                     <el-input v-model="form.listOfMaterialInventory[index].num" type="number" disabled placeholder="请输入数量" /> | ||||
|                   </el-form-item> | ||||
|                   <el-form-item label="合同号" prop="contractNum"> | ||||
|                     <el-input v-model="form.listOfMaterialInventory[index].contractNum" disabled placeholder="请输入合同号" /> | ||||
|                   </el-form-item> | ||||
|                   <el-form-item label="预估供应周期" prop="estimatedCycle"> | ||||
|                     <el-input v-model="form.listOfMaterialInventory[index].estimatedCycle" disabled type="number" placeholder="请输入预估供应周期" /> | ||||
|                   </el-form-item> | ||||
|                   <el-form-item label="供货公司" prop="supplierCompany"> | ||||
|                     <el-input v-model="form.listOfMaterialInventory[index].supplierCompany" disabled placeholder="请输入供货公司" /> | ||||
|                   </el-form-item> | ||||
|                 </div> | ||||
|               </el-col> | ||||
|             </el-row> | ||||
|           </el-form> | ||||
|         </div> | ||||
|       </el-card> | ||||
|       <!-- 提交组件 --> | ||||
|       <submitVerify ref="submitVerifyRef" :task-variables="taskVariables" @submit-callback="submitCallback" /> | ||||
|       <approvalRecord ref="approvalRecordRef"></approvalRecord> | ||||
|       <!-- 流程选择对话框 --> | ||||
|       <el-dialog | ||||
|         draggable | ||||
|         v-model="dialogVisible.visible" | ||||
|         :title="dialogVisible.title" | ||||
|         :before-close="handleClose" | ||||
|         width="500" | ||||
|         class="rounded-lg shadow-lg" | ||||
|       > | ||||
|         <div class="p-4"> | ||||
|           <p class="text-gray-600 mb-4">请选择要启动的流程:</p> | ||||
|           <el-select v-model="flowCode" placeholder="请选择流程" style="width: 100%"> | ||||
|             <el-option v-for="item in flowCodeOptions" :key="item.value" :label="item.label" :value="item.value" /> | ||||
|           </el-select> | ||||
|         </div> | ||||
|         <template #footer> | ||||
|           <div class="dialog-footer p-4 border-t border-gray-100 flex justify-end space-x-3"> | ||||
|             <el-button @click="handleClose" class="px-4 py-2 border border-gray-300 rounded-md text-gray-700 hover:bg-gray-50 transition-colors" | ||||
|               >取消</el-button | ||||
|             > | ||||
|             <el-button type="primary" @click="submitFlow()" class="px-4 py-2 bg-primary text-white rounded-md hover:bg-primary/90 transition-colors" | ||||
|               >确认</el-button | ||||
|             > | ||||
|           </div> | ||||
|         </template> | ||||
|       </el-dialog> | ||||
|     </div> | ||||
|   </div> | ||||
| </template> | ||||
|  | ||||
| <script setup name="Leave" lang="ts"> | ||||
| import { LeaveForm, LeaveQuery, LeaveVO } from '@/api/workflow/leave/types'; | ||||
| import { startWorkFlow } from '@/api/workflow/task'; | ||||
| import SubmitVerify from '@/components/Process/submitVerify.vue'; | ||||
| import ApprovalRecord from '@/components/Process/approvalRecord.vue'; | ||||
| import ApprovalButton from '@/components/Process/approvalButton.vue'; | ||||
| import { StartProcessBo } from '@/api/workflow/workflowCommon/types'; | ||||
| const { proxy } = getCurrentInstance() as ComponentInternalInstance; | ||||
| import { useUserStoreHook } from '@/store/modules/user'; | ||||
| const { design_change_reason_type } = toRefs<any>(proxy?.useDict('design_change_reason_type')); | ||||
| import { getKnowledgeDocument } from '@/api/design/technicalStandard'; | ||||
| import { getConstructionValue } from '@/api/out/constructionValue'; | ||||
| import { workScheduleListDetail } from '@/api/progress/plan'; | ||||
| import { getCailiaoshebei } from '@/api/materials/suppliesprice'; | ||||
| // 获取用户 store | ||||
| const userStore = useUserStoreHook(); | ||||
| // 从 store 中获取项目列表和当前选中的项目 | ||||
| const currentProject = computed(() => userStore.selectedProject); | ||||
| const buttonLoading = ref(false); | ||||
| const loading = ref(true); | ||||
| //路由参数 | ||||
| const routeParams = ref<Record<string, any>>({}); | ||||
| const flowCode = ref<string>(''); | ||||
| const status = ref<string>(''); | ||||
| const dialogVisible = reactive<DialogOption>({ | ||||
|   visible: false, | ||||
|   title: '流程定义' | ||||
| }); | ||||
| //提交组件 | ||||
| const submitVerifyRef = ref<InstanceType<typeof SubmitVerify>>(); | ||||
| //审批记录组件 | ||||
| const approvalRecordRef = ref<InstanceType<typeof ApprovalRecord>>(); | ||||
| //按钮组件 | ||||
| const flowCodeOptions = [ | ||||
|   { | ||||
|     value: currentProject.value?.id + '_batchRequirements', | ||||
|     label: '物资供应总计划审批' | ||||
|   } | ||||
| ]; | ||||
|  | ||||
| const leaveFormRef = ref<ElFormInstance>(); | ||||
| const dialog = reactive({ | ||||
|   visible: false, | ||||
|   title: '', | ||||
|   isEdit: false | ||||
| }); | ||||
| const submitFormData = ref<StartProcessBo>({ | ||||
|   businessId: '', | ||||
|   flowCode: '', | ||||
|   variables: {} | ||||
| }); | ||||
| const taskVariables = ref<Record<string, any>>({}); | ||||
| const selectValue = ref<string[]>([]); | ||||
|  | ||||
| const initFormData = { | ||||
|   id: undefined, | ||||
|   batchNumber: undefined, | ||||
|   supplierId: undefined, | ||||
|   supplier: undefined, | ||||
|   name: undefined, | ||||
|   supply: undefined, | ||||
|   specification: undefined, | ||||
|   signalment: undefined, | ||||
|   materialCode: undefined, | ||||
|   arrivalTime: undefined, | ||||
|   finishTime: undefined, | ||||
|   unit: undefined, | ||||
|   plan: undefined, | ||||
|   realQuantity: undefined, | ||||
|   projectId: currentProject.value.id, | ||||
|   listOfMaterialInventory: [], | ||||
|   remark: undefined | ||||
| }; | ||||
| const data = reactive({ | ||||
|   form: { ...initFormData }, | ||||
|   rules: {} | ||||
| }); | ||||
|  | ||||
| const handleClose = () => { | ||||
|   dialogVisible.visible = false; | ||||
|   flowCode.value = ''; | ||||
|   buttonLoading.value = false; | ||||
| }; | ||||
| const { form, rules } = toRefs(data); | ||||
|  | ||||
| /** 表单重置 */ | ||||
| const reset = () => { | ||||
|   form.value = { ...initFormData }; | ||||
|   leaveFormRef.value?.resetFields(); | ||||
| }; | ||||
|  | ||||
| /** 获取详情 */ | ||||
| const getInfo = () => { | ||||
|   loading.value = true; | ||||
|   buttonLoading.value = false; | ||||
|   nextTick(async () => { | ||||
|     const res = JSON.parse(routeParams.value.data); | ||||
|     Object.assign(form.value, res.data); | ||||
|     selectValue.value = (form.value.supplier as string).split(','); | ||||
|     if (!form.value.listOfMaterialInventory.length) { | ||||
|       form.value.listOfMaterialInventory = selectValue.value.map((item) => { | ||||
|         return { | ||||
|           supplierCompany: item, | ||||
|           estimatedCycle: '', | ||||
|           contractNum: '', | ||||
|           num: '', | ||||
|           unitPrice: '' | ||||
|         }; | ||||
|       }); | ||||
|     } | ||||
|     loading.value = false; | ||||
|     buttonLoading.value = false; | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| /** 提交按钮 */ | ||||
| const submitForm = (status1: string) => { | ||||
|   status.value = status1; | ||||
|   submit(status.value, form.value); | ||||
| }; | ||||
|  | ||||
| const submitFlow = async () => { | ||||
|   handleStartWorkFlow(form.value); | ||||
|   dialogVisible.visible = false; | ||||
| }; | ||||
| //提交申请 | ||||
| const handleStartWorkFlow = async (data: LeaveForm) => { | ||||
|   try { | ||||
|     submitFormData.value.flowCode = flowCode.value; | ||||
|     submitFormData.value.businessId = data.id; | ||||
|     //流程变量 | ||||
|     taskVariables.value = { | ||||
|       // leave4/5 使用的流程变量 | ||||
|       userList: ['1', '3', '4'] | ||||
|     }; | ||||
|     submitFormData.value.variables = taskVariables.value; | ||||
|     const resp = await startWorkFlow(submitFormData.value); | ||||
|     if (submitVerifyRef.value) { | ||||
|       buttonLoading.value = false; | ||||
|       submitVerifyRef.value.openDialog(resp.data.taskId); | ||||
|     } | ||||
|   } finally { | ||||
|     buttonLoading.value = false; | ||||
|   } | ||||
| }; | ||||
| //审批记录 | ||||
| const handleApprovalRecord = () => { | ||||
|   approvalRecordRef.value.init(form.value.id); | ||||
| }; | ||||
| //提交回调 | ||||
| const submitCallback = async () => { | ||||
|   await proxy.$tab.closePage(proxy.$route); | ||||
|   proxy.$router.go(-1); | ||||
| }; | ||||
| //审批 | ||||
| const approvalVerifyOpen = async () => { | ||||
|   submitVerifyRef.value.openDialog(routeParams.value.taskId); | ||||
| }; | ||||
| // 图纸上传成功之后 开始提交 | ||||
| const submit = async (status, data) => { | ||||
|   form.value = data; | ||||
|   if (status === 'draft') { | ||||
|     buttonLoading.value = false; | ||||
|     proxy?.$modal.msgSuccess('暂存成功'); | ||||
|     proxy.$tab.closePage(proxy.$route); | ||||
|     proxy.$router.go(-1); | ||||
|   } else { | ||||
|     if ((form.value.approvalProject === 'draft' && (flowCode.value === '' || flowCode.value === null)) || routeParams.value.type === 'add') { | ||||
|       flowCode.value = flowCodeOptions[0].value; | ||||
|       dialogVisible.visible = true; | ||||
|       return; | ||||
|     } | ||||
|     //说明启动过先随意穿个参数 | ||||
|     if (flowCode.value === '' || flowCode.value === null) { | ||||
|       flowCode.value = 'xx'; | ||||
|     } | ||||
|     await handleStartWorkFlow(data); | ||||
|   } | ||||
| }; | ||||
|  | ||||
| onMounted(() => { | ||||
|   nextTick(async () => { | ||||
|     routeParams.value = proxy.$route.query; | ||||
|     console.log('🚀 ~ proxy.$route.query:', proxy.$route.query); | ||||
|     reset(); | ||||
|     loading.value = false; | ||||
|     if (routeParams.value.type === 'update' || routeParams.value.type === 'view' || routeParams.value.type === 'approval') { | ||||
|       getInfo(); | ||||
|     } | ||||
|   }); | ||||
| }); | ||||
| </script> | ||||
| <style scoped lang="scss"> | ||||
| /* 全局样式 */ | ||||
| :root { | ||||
|   --primary: #409eff; | ||||
|   --primary-light: #66b1ff; | ||||
|   --primary-dark: #3a8ee6; | ||||
|   --success: #67c23a; | ||||
|   --warning: #e6a23c; | ||||
|   --danger: #f56c6c; | ||||
|   --info: #909399; | ||||
| } | ||||
|  | ||||
| /* 表单样式优化 */ | ||||
| .el-form-item { | ||||
|   .el-form-item__label { | ||||
|     color: #606266; | ||||
|     font-weight: 500; | ||||
|   } | ||||
|  | ||||
|   .el-input__inner, | ||||
|   .el-select .el-input__inner { | ||||
|     border-radius: 4px; | ||||
|     transition: | ||||
|       border-color 0.2s, | ||||
|       box-shadow 0.2s; | ||||
|  | ||||
|     &:focus { | ||||
|       border-color: var(--primary-light); | ||||
|       box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.1); | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   .el-textarea__inner { | ||||
|     border-radius: 4px; | ||||
|     transition: | ||||
|       border-color 0.2s, | ||||
|       box-shadow 0.2s; | ||||
|  | ||||
|     &:focus { | ||||
|       border-color: var(--primary-light); | ||||
|       box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.1); | ||||
|     } | ||||
|   } | ||||
| } | ||||
|  | ||||
| /* 按钮样式优化 */ | ||||
| .el-button { | ||||
|   border-radius: 4px; | ||||
|   transition: all 0.2s; | ||||
|  | ||||
|   &.is-primary { | ||||
|     background-color: var(--primary); | ||||
|     border-color: var(--primary); | ||||
|  | ||||
|     &:hover { | ||||
|       background-color: var(--primary-light); | ||||
|       border-color: var(--primary-light); | ||||
|     } | ||||
|  | ||||
|     &:active { | ||||
|       background-color: var(--primary-dark); | ||||
|       border-color: var(--primary-dark); | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   &.is-text { | ||||
|     color: var(--primary); | ||||
|  | ||||
|     &:hover { | ||||
|       color: var(--primary-light); | ||||
|       background-color: rgba(64, 158, 255, 0.05); | ||||
|     } | ||||
|   } | ||||
| } | ||||
|  | ||||
| /* 卡片样式优化 */ | ||||
| .el-card { | ||||
|   transition: all 0.3s ease; | ||||
|  | ||||
|   &:hover { | ||||
|     /* transform: translateY(-2px); */ | ||||
|   } | ||||
| } | ||||
|  | ||||
| /* 对话框样式优化 */ | ||||
| .el-dialog { | ||||
|   .el-dialog__header { | ||||
|     background-color: #f5f7fa; | ||||
|     border-bottom: 1px solid #ebeef5; | ||||
|     padding: 15px 20px; | ||||
|   } | ||||
|  | ||||
|   .el-dialog__title { | ||||
|     font-size: 16px; | ||||
|     font-weight: 600; | ||||
|     color: #303133; | ||||
|   } | ||||
|  | ||||
|   .el-dialog__footer { | ||||
|     padding: 15px 20px; | ||||
|     border-top: 1px solid #ebeef5; | ||||
|   } | ||||
| } | ||||
| </style> | ||||
							
								
								
									
										534
									
								
								src/views/materials/cailiaoshebei/index.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										534
									
								
								src/views/materials/cailiaoshebei/index.vue
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,534 @@ | ||||
| <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="batchNumber"> | ||||
|               <el-input v-model="queryParams.batchNumber" placeholder="请输入批次ID" clearable @keyup.enter="handleQuery" /> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="供货商ID" prop="supplierId"> | ||||
|               <el-input v-model="queryParams.supplierId" placeholder="请输入供货商ID" 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="name"> | ||||
|               <el-input v-model="queryParams.name" placeholder="请输入设备材料名称" clearable @keyup.enter="handleQuery" /> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="供货来源(字典)" prop="supply"> | ||||
|               <el-input v-model="queryParams.supply" placeholder="请输入供货来源(字典)" clearable @keyup.enter="handleQuery" /> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="规格型号" prop="specification"> | ||||
|               <el-input v-model="queryParams.specification" placeholder="请输入规格型号" clearable @keyup.enter="handleQuery" /> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="特征描述" prop="signalment"> | ||||
|               <el-input v-model="queryParams.signalment" placeholder="请输入特征描述" clearable @keyup.enter="handleQuery" /> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="物料编码" prop="materialCode"> | ||||
|               <el-input v-model="queryParams.materialCode" placeholder="请输入物料编码" clearable @keyup.enter="handleQuery" /> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="计划到场时间" prop="arrivalTime"> | ||||
|               <el-date-picker clearable v-model="queryParams.arrivalTime" type="date" value-format="YYYY-MM-DD" placeholder="请选择计划到场时间" /> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="计划完成时间" prop="finishTime"> | ||||
|               <el-date-picker clearable v-model="queryParams.finishTime" type="date" value-format="YYYY-MM-DD" placeholder="请选择计划完成时间" /> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="计量单位" prop="unit"> | ||||
|               <el-input v-model="queryParams.unit" placeholder="请输入计量单位" clearable @keyup.enter="handleQuery" /> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="计划数量" prop="plan"> | ||||
|               <el-input v-model="queryParams.plan" placeholder="请输入计划数量" clearable @keyup.enter="handleQuery" /> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="实际数量" prop="realQuantity"> | ||||
|               <el-input v-model="queryParams.realQuantity" 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-row :gutter="20"> | ||||
|       <!-- 流程分类树 --> | ||||
|       <el-col style="" :span="5"> | ||||
|         <el-card shadow="hover"> | ||||
|           <template #header> | ||||
|             <el-row :gutter="10" class="mb8"> | ||||
|               <el-col :span="1.5" :offset="0" | ||||
|                 ><el-button type="primary" size="default" @click="addBatch" icon="FolderAdd" plain>新增</el-button></el-col | ||||
|               > | ||||
|               <el-col :span="1.5" :offset="0" | ||||
|                 ><el-button type="danger" size="default" @click="handleDeleteBatch" icon="FolderDelete" plain>删除</el-button></el-col | ||||
|               > | ||||
|             </el-row> | ||||
|           </template> | ||||
|  | ||||
|           <el-input v-model="queryParams.batchNumber" placeholder="请输入批次号" @input="getBatchList" prefix-icon="Search" clearable /> | ||||
|           <el-tree | ||||
|             ref="batchTreeRef" | ||||
|             class="mt-2" | ||||
|             node-key="batchNumber" | ||||
|             :data="batchOptions" | ||||
|             :props="{ label: 'batchNumber', children: 'children' }" | ||||
|             :expand-on-click-node="false" | ||||
|             highlight-current | ||||
|             default-expand-all | ||||
|             @node-click="handleNodeClick" | ||||
|           ></el-tree> | ||||
|           <pagination | ||||
|             v-show="total > 0" | ||||
|             :total="total" | ||||
|             v-model:page="queryParams.pageNum" | ||||
|             v-model:limit="queryParams.pageSize" | ||||
|             @pagination="getBatchList" | ||||
|             layout="prev, pager, next,jumper" | ||||
|           /> | ||||
|         </el-card> | ||||
|       </el-col> | ||||
|       <el-col :span="19"> | ||||
|         <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:cailiaoshebei:add']">新增</el-button> | ||||
|               </el-col> | ||||
|               <el-col :span="1.5"> | ||||
|                 <el-button | ||||
|                   type="success" | ||||
|                   plain | ||||
|                   icon="Edit" | ||||
|                   :disabled="single" | ||||
|                   @click="handleUpdate()" | ||||
|                   v-hasPermi="['cailiaoshebei:cailiaoshebei:edit']" | ||||
|                   >修改</el-button | ||||
|                 > | ||||
|               </el-col> | ||||
|               <el-col :span="1.5"> | ||||
|                 <el-button | ||||
|                   type="danger" | ||||
|                   plain | ||||
|                   icon="Delete" | ||||
|                   :disabled="multiple" | ||||
|                   @click="handleDelete()" | ||||
|                   v-hasPermi="['cailiaoshebei:cailiaoshebei:remove']" | ||||
|                   >删除</el-button | ||||
|                 > | ||||
|               </el-col> | ||||
|               <!-- <el-col :span="1.5"> | ||||
|                 <el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['cailiaoshebei:cailiaoshebei:export']" | ||||
|                   >导出</el-button | ||||
|                 > | ||||
|               </el-col> --> | ||||
|               <el-col :span="1.5"> | ||||
|                 <el-button plain type="warning" icon="Finished" @click="handleAudit()" v-hasPermi="['out:monthPlan:remove']">审核</el-button> | ||||
|               </el-col> | ||||
|               <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> | ||||
|             </el-row> | ||||
|           </template> | ||||
|  | ||||
|           <el-table v-loading="loading" :data="cailiaoshebeiList" @selection-change="handleSelectionChange"> | ||||
|             <el-table-column type="selection" width="55" align="center" /> | ||||
|             <!-- <el-table-column label="供货商ID" align="center" prop="supplierId" /> --> | ||||
|             <el-table-column label="供货商" align="center" prop="supplier" /> | ||||
|             <el-table-column label="设备材料名称" align="center" prop="name" /> | ||||
|             <el-table-column label="供货来源" align="center" prop="supply"> | ||||
|               <template #default="scope"> | ||||
|                 <dict-tag :options="supply" :value="scope.row.supply" /> | ||||
|               </template> | ||||
|             </el-table-column> | ||||
|             <el-table-column label="规格型号" align="center" prop="specification" /> | ||||
|             <el-table-column label="特征描述" align="center" prop="signalment" /> | ||||
|             <el-table-column label="物料编码" align="center" prop="materialCode" width="200" /> | ||||
|             <!-- <el-table-column label="计划到场时间" align="center" prop="arrivalTime" width="180"> | ||||
|               <template #default="scope"> | ||||
|                 <span>{{ parseTime(scope.row.arrivalTime, '{y}-{m}-{d}') }}</span> | ||||
|               </template> | ||||
|             </el-table-column> | ||||
|             <el-table-column label="计划完成时间" align="center" prop="finishTime" width="180"> | ||||
|               <template #default="scope"> | ||||
|                 <span>{{ parseTime(scope.row.finishTime, '{y}-{m}-{d}') }}</span> | ||||
|               </template> | ||||
|             </el-table-column> --> | ||||
|             <el-table-column label="计量单位" align="center" prop="unit" /> | ||||
|             <el-table-column label="计划数量" align="center" prop="plan" /> | ||||
|             <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="['cailiaoshebei:cailiaoshebei:edit']" | ||||
|                   ></el-button> | ||||
|                 </el-tooltip> | ||||
|                 <el-tooltip content="删除" placement="top"> | ||||
|                   <el-button | ||||
|                     link | ||||
|                     type="primary" | ||||
|                     icon="Delete" | ||||
|                     @click="handleDelete(scope.row)" | ||||
|                     v-hasPermi="['cailiaoshebei:cailiaoshebei:remove']" | ||||
|                   ></el-button> | ||||
|                 </el-tooltip> | ||||
|               </template> | ||||
|             </el-table-column> | ||||
|           </el-table> | ||||
|         </el-card> | ||||
|       </el-col> | ||||
|     </el-row> | ||||
|  | ||||
|     <!-- 添加或修改物资-材料设备对话框 --> | ||||
|     <el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body> | ||||
|       <el-form ref="cailiaoshebeiFormRef" :model="form" :rules="rules" label-width="110px"> | ||||
|         <el-form-item label="批次号" prop="batchNumber"> | ||||
|           <el-input v-model="form.batchNumber" placeholder="请输入批次ID" disabled /> | ||||
|         </el-form-item> | ||||
|         <!-- <el-form-item label="供货商ID" prop="supplierId"> | ||||
|           <el-input v-model="form.supplierId" placeholder="请输入供货商ID" /> | ||||
|         </el-form-item> --> | ||||
|         <el-form-item label="供货商" prop="supplier"> | ||||
|           <el-select v-model="selectValue" value-key="id" multiple placeholder="请选择供货商" clearable filterable> | ||||
|             <el-option v-for="item in supplierOptions" :key="item.id" :label="item.name" :value="item.id"> </el-option> | ||||
|           </el-select> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="设备材料名称" prop="name"> | ||||
|           <el-input v-model="form.name" placeholder="请输入设备材料名称" /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="供货来源" prop="supply"> | ||||
|           <el-select v-model="form.supply" value-key="value" placeholder="请选择供货来源" clearable filterable @change=""> | ||||
|             <el-option v-for="item in supply" :key="item.value" :label="item.label" :value="item.value"> </el-option> | ||||
|           </el-select> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="规格型号" prop="specification"> | ||||
|           <el-input v-model="form.specification" placeholder="请输入规格型号" /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="特征描述" prop="signalment"> | ||||
|           <el-input v-model="form.signalment" placeholder="请输入特征描述" /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="物料编码" prop="materialCode"> | ||||
|           <el-input v-model="form.materialCode" placeholder="请输入物料编码" /> | ||||
|         </el-form-item> | ||||
|         <!-- <el-form-item label="计划到场时间" prop="arrivalTime"> | ||||
|           <el-date-picker clearable v-model="form.arrivalTime" type="datetime" value-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择计划到场时间"> | ||||
|           </el-date-picker> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="计划完成时间" prop="finishTime"> | ||||
|           <el-date-picker clearable v-model="form.finishTime" type="datetime" value-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择计划完成时间"> | ||||
|           </el-date-picker> | ||||
|         </el-form-item> --> | ||||
|         <el-form-item label="计量单位" prop="unit"> | ||||
|           <el-input v-model="form.unit" placeholder="请输入计量单位" /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="计划数量" prop="plan"> | ||||
|           <el-input v-model="form.plan" placeholder="请输入计划数量" type="number" /> | ||||
|         </el-form-item> | ||||
|         <!-- <el-form-item label="实际数量" prop="realQuantity"> | ||||
|           <el-input v-model="form.realQuantity" placeholder="请输入实际数量" /> | ||||
|         </el-form-item> --> | ||||
|         <el-form-item label="备注" prop="remark"> | ||||
|           <el-input v-model="form.remark" type="textarea" 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="Cailiaoshebei" lang="ts"> | ||||
| import { | ||||
|   listCailiaoshebei, | ||||
|   getCailiaoshebei, | ||||
|   delCailiaoshebei, | ||||
|   addCailiaoshebei, | ||||
|   updateCailiaoshebei, | ||||
|   listBatch, | ||||
|   getBatch, | ||||
|   delBatch | ||||
| } from '@/api/materials/cailiaoshebei'; | ||||
| import { CailiaoshebeiVO, CailiaoshebeiQuery, CailiaoshebeiForm } from '@/api/materials/cailiaoshebei/types'; | ||||
| import { listContractor } from '@/api/project/contractor'; | ||||
| import { useUserStoreHook } from '@/store/modules/user'; | ||||
|  | ||||
| const { proxy } = getCurrentInstance() as ComponentInternalInstance; | ||||
| const { supply } = toRefs<any>(proxy?.useDict('supply')); | ||||
| // 获取用户 store | ||||
| const userStore = useUserStoreHook(); | ||||
| // 从 store 中获取项目列表和当前选中的项目 | ||||
| const currentProject = computed(() => userStore.selectedProject); | ||||
| const batchTreeRef = ref<any>(null); | ||||
| const cailiaoshebeiList = ref<CailiaoshebeiVO[]>([]); | ||||
| const 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 batchOptions = ref<any[]>([]); | ||||
|  | ||||
| const queryFormRef = ref<ElFormInstance>(); | ||||
| const cailiaoshebeiFormRef = ref<ElFormInstance>(); | ||||
|  | ||||
| const dialog = reactive<DialogOption>({ | ||||
|   visible: false, | ||||
|   title: '' | ||||
| }); | ||||
|  | ||||
| const initFormData: CailiaoshebeiForm = { | ||||
|   id: undefined, | ||||
|   batchNumber: undefined, | ||||
|   supplierId: undefined, | ||||
|   supplier: undefined, | ||||
|   name: undefined, | ||||
|   supply: undefined, | ||||
|   specification: undefined, | ||||
|   signalment: undefined, | ||||
|   materialCode: undefined, | ||||
|   arrivalTime: undefined, | ||||
|   finishTime: undefined, | ||||
|   unit: undefined, | ||||
|   plan: undefined, | ||||
|   realQuantity: undefined, | ||||
|   approvalDesign: undefined, | ||||
|   projectId: currentProject.value.id, | ||||
|   remark: undefined | ||||
| }; | ||||
| const data = reactive<PageData<CailiaoshebeiForm, CailiaoshebeiQuery>>({ | ||||
|   form: { ...initFormData }, | ||||
|   queryParams: { | ||||
|     pageNum: 1, | ||||
|     pageSize: 10, | ||||
|     batchNumber: undefined, | ||||
|     supplierId: undefined, | ||||
|     supplier: undefined, | ||||
|     name: undefined, | ||||
|     projectId: currentProject.value.id, | ||||
|     supply: undefined, | ||||
|     specification: undefined, | ||||
|     signalment: undefined, | ||||
|     materialCode: undefined, | ||||
|     arrivalTime: undefined, | ||||
|     finishTime: undefined, | ||||
|     unit: undefined, | ||||
|     plan: undefined, | ||||
|     realQuantity: undefined, | ||||
|     params: {} | ||||
|   }, | ||||
|   rules: { | ||||
|     id: [{ required: true, message: '主键ID不能为空', trigger: 'blur' }] | ||||
|   } | ||||
| }); | ||||
|  | ||||
| const { queryParams, form, rules } = toRefs(data); | ||||
|  | ||||
| /** 查询物资-材料设备列表 */ | ||||
| const getList = async () => { | ||||
|   loading.value = true; | ||||
|   const res = await listCailiaoshebei(queryParams.value); | ||||
|   cailiaoshebeiList.value = res.rows; | ||||
|  | ||||
|   loading.value = false; | ||||
| }; | ||||
|  | ||||
| //查询批次列表 | ||||
| const getBatchList = async () => { | ||||
|   const res = await listBatch(queryParams.value); | ||||
|   console.log('🚀 ~ getBatchList ~ res:', res); | ||||
|   batchOptions.value = res.rows; | ||||
|   total.value = res.total; | ||||
|   try { | ||||
|     batchTreeRef.value.setCurrentKey(res.rows[0].batchNumber); | ||||
|     queryParams.value.batchNumber = res.rows[0].batchNumber; | ||||
|     form.value.batchNumber = res.rows[0].batchNumber; | ||||
|     form.value.batchId = res.rows[0].id; | ||||
|   } catch (error) { | ||||
|     form.value.batchNumber = ''; | ||||
|   } | ||||
|  | ||||
|   getList(); | ||||
| }; | ||||
|  | ||||
| /** 节点单击事件 */ | ||||
| const handleNodeClick = (data: any) => { | ||||
|   queryParams.value.batchNumber = data.batchNumber; | ||||
|   form.value.batchNumber = data.batchNumber; | ||||
|   form.value.batchId = data.id; | ||||
|   if (data.batchNumber === '0') { | ||||
|     queryParams.value.batchNumber = ''; | ||||
|   } | ||||
|   getList(); | ||||
| }; | ||||
|  | ||||
| /** 取消按钮 */ | ||||
| const cancel = () => { | ||||
|   reset(); | ||||
|   dialog.visible = false; | ||||
| }; | ||||
|  | ||||
| /** 表单重置 */ | ||||
| const reset = () => { | ||||
|   const preservedBatchId = form.value.batchNumber; // 先保存当前的 batchNumber | ||||
|   form.value = { ...initFormData, batchNumber: preservedBatchId }; // 重置但保留 | ||||
|   cailiaoshebeiFormRef.value?.resetFields(); | ||||
| }; | ||||
|  | ||||
| /** 搜索按钮操作 */ | ||||
| const handleQuery = () => { | ||||
|   queryParams.value.pageNum = 1; | ||||
|   getList(); | ||||
| }; | ||||
|  | ||||
| /** 重置按钮操作 */ | ||||
| const resetQuery = () => { | ||||
|   queryFormRef.value?.resetFields(); | ||||
|   handleQuery(); | ||||
| }; | ||||
|  | ||||
| /** 多选框选中数据 */ | ||||
| const handleSelectionChange = (selection: CailiaoshebeiVO[]) => { | ||||
|   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?: CailiaoshebeiVO) => { | ||||
|   reset(); | ||||
|   const _id = row?.id || ids.value[0]; | ||||
|   const res = await getCailiaoshebei(_id); | ||||
|   Object.assign(form.value, res.data); | ||||
|   selectValue.value = (form.value.supplierId as string).split(','); | ||||
|   dialog.visible = true; | ||||
|   dialog.title = '修改物资-材料设备'; | ||||
| }; | ||||
|  | ||||
| /** 审核按钮操作 */ | ||||
| const handleAudit = async () => { | ||||
|   proxy?.$tab.openPage('/materials-management/cailiaoshebei/indexEdit', '审核材料设备设计', { | ||||
|     id: form.value.batchId, | ||||
|     number: form.value.batchNumber, | ||||
|     type: 'update' | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| /** 提交按钮 */ | ||||
| const submitForm = () => { | ||||
|   console.log('🚀 ~ submitForm ~ form.value:', form.value); | ||||
|   cailiaoshebeiFormRef.value?.validate(async (valid: boolean) => { | ||||
|     if (valid) { | ||||
|       buttonLoading.value = true; | ||||
|       if (form.value.id) { | ||||
|         await updateCailiaoshebei(form.value).finally(() => (buttonLoading.value = false)); | ||||
|       } else { | ||||
|         await addCailiaoshebei(form.value).finally(() => (buttonLoading.value = false)); | ||||
|       } | ||||
|       proxy?.$modal.msgSuccess('操作成功'); | ||||
|       dialog.visible = false; | ||||
|       await getList(); | ||||
|     } | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| /** 新增批次 */ | ||||
| const addBatch = async () => { | ||||
|   await proxy?.$modal.confirm('是否确认新增批次?').finally(() => (loading.value = false)); | ||||
|   const res = await getBatch({ projectId: currentProject.value.id }); | ||||
|   console.log('🚀 ~ addBatch ~ res:', res); | ||||
|   await getBatchList(); | ||||
|  | ||||
|   proxy?.$modal.msgSuccess('新增成功'); | ||||
| }; | ||||
|  | ||||
| /** 删除批次 */ | ||||
| const handleDeleteBatch = async () => { | ||||
|   const _ids = batchTreeRef.value.getCurrentNode()?.id; | ||||
|   await proxy?.$modal.confirm('是否确认删除批次编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false)); | ||||
|   await delBatch(_ids); | ||||
|   proxy?.$modal.msgSuccess('删除成功'); | ||||
|   queryParams.value.batchNumber = ''; | ||||
|  | ||||
|   await getBatchList(); | ||||
| }; | ||||
|  | ||||
| /** 删除按钮操作 */ | ||||
| const handleDelete = async (row?: CailiaoshebeiVO) => { | ||||
|   const _ids = row?.id || ids.value; | ||||
|   await proxy?.$modal.confirm('是否确认删除物资-材料设备编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false)); | ||||
|   await delCailiaoshebei(_ids); | ||||
|   proxy?.$modal.msgSuccess('删除成功'); | ||||
|   await getList(); | ||||
| }; | ||||
|  | ||||
| /** 导出按钮操作 */ | ||||
| const handleExport = () => { | ||||
|   proxy?.download( | ||||
|     'cailiaoshebei/cailiaoshebei/export', | ||||
|     { | ||||
|       ...queryParams.value | ||||
|     }, | ||||
|     `cailiaoshebei_${new Date().getTime()}.xlsx` | ||||
|   ); | ||||
| }; | ||||
|  | ||||
| /** 查询供货商列表 */ | ||||
| const supplierOptions = ref([]); | ||||
| const getSupplierList = async () => { | ||||
|   const res = await listContractor({ | ||||
|     projectId: currentProject.value.id, | ||||
|     pageNum: 1, | ||||
|     pageSize: 10000 | ||||
|   }); | ||||
|   supplierOptions.value = res.rows; | ||||
| }; | ||||
|  | ||||
| // 中间数组变量供 el-select 使用 | ||||
| const selectValue = ref<string[]>([]); | ||||
|  | ||||
| // 监听 selectValue,每次变化时同步更新 form.supplierId 和 form.supplier | ||||
| watch( | ||||
|   selectValue, | ||||
|   (newVal) => { | ||||
|     form.value.supplierId = newVal.join(','); | ||||
|     const selectedNames = supplierOptions.value.filter((opt) => newVal.includes(opt.id)).map((opt) => opt.name); | ||||
|     form.value.supplier = selectedNames.join(','); | ||||
|   }, | ||||
|   { immediate: true } | ||||
| ); | ||||
|  | ||||
| onMounted(() => { | ||||
|   getBatchList(); | ||||
|   getSupplierList(); | ||||
| }); | ||||
|  | ||||
| //监听项目id刷新数据 | ||||
| const listeningProject = watch( | ||||
|   () => currentProject.value.id, | ||||
|   (nid, oid) => { | ||||
|     queryParams.value.projectId = nid; | ||||
|     form.value.projectId = nid; | ||||
|     getBatchList(); | ||||
|     getSupplierList(); | ||||
|   } | ||||
| ); | ||||
|  | ||||
| onUnmounted(() => { | ||||
|   listeningProject(); | ||||
| }); | ||||
| </script> | ||||
							
								
								
									
										369
									
								
								src/views/materials/cailiaoshebei/indexEdit.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										369
									
								
								src/views/materials/cailiaoshebei/indexEdit.vue
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,369 @@ | ||||
| <template> | ||||
|   <div class="p-4 bg-gray-50"> | ||||
|     <div class="max-w-4xl mx-auto"> | ||||
|       <!-- 顶部按钮区域 --> | ||||
|       <el-card class="mb-4 rounded-lg shadow-sm bg-white border border-gray-100 transition-all hover:shadow-md"> | ||||
|         <approvalButton | ||||
|           @submitForm="submitForm" | ||||
|           @approvalVerifyOpen="approvalVerifyOpen" | ||||
|           @handleApprovalRecord="handleApprovalRecord" | ||||
|           :buttonLoading="buttonLoading" | ||||
|           :id="form.id" | ||||
|           :status="form.approvalDesign" | ||||
|           :pageType="routeParams.type" | ||||
|         /> | ||||
|       </el-card> | ||||
|       <!-- 表单区域 --> | ||||
|       <el-card class="rounded-lg shadow-sm bg-white border border-gray-100 transition-all hover:shadow-md overflow-hidden"> | ||||
|         <div class="p-4 bg-gradient-to-r from-blue-50 to-indigo-50 border-b border-gray-100"> | ||||
|           <h3 class="text-lg font-semibold text-gray-800">设计材料设备</h3> | ||||
|         </div> | ||||
|         <div class="p-6"> | ||||
|           <el-form | ||||
|             ref="leaveFormRef" | ||||
|             v-loading="loading" | ||||
|             :disabled="routeParams.type === 'view'" | ||||
|             :model="form" | ||||
|             :rules="rules" | ||||
|             label-width="120px" | ||||
|             class="space-y-4" | ||||
|           > | ||||
|             <el-row :gutter="20" justify="center"> | ||||
|               <el-col :span="12" :offset="0"> | ||||
|                 <el-form-item label="批次号" prop="batchNumber"> | ||||
|                   <el-input v-model="form.batchNumber" placeholder="请输入批次ID" disabled /> | ||||
|                 </el-form-item> | ||||
|                 <!-- <el-form-item label="供货商ID" prop="supplierId"> | ||||
|           <el-input v-model="form.supplierId" placeholder="请输入供货商ID" /> | ||||
|         </el-form-item> --> | ||||
|                 <el-form-item label="供货商" prop="supplier"> | ||||
|                   <el-input v-model="form.supplier" disabled></el-input> | ||||
|                 </el-form-item> | ||||
|                 <el-form-item label="设备材料名称" prop="name"> | ||||
|                   <el-input v-model="form.name" placeholder="请输入设备材料名称" disabled /> | ||||
|                 </el-form-item> | ||||
|                 <el-form-item label="供货来源" prop="supply"> | ||||
|                   <el-select v-model="form.supply" value-key="value" placeholder="请选择供货来源" clearable filterable @change="" disabled> | ||||
|                     <el-option v-for="item in supply" :key="item.value" :label="item.label" :value="item.value"> </el-option> | ||||
|                   </el-select> | ||||
|                 </el-form-item> | ||||
|                 <el-form-item label="规格型号" prop="specification"> | ||||
|                   <el-input v-model="form.specification" placeholder="请输入规格型号" disabled /> | ||||
|                 </el-form-item> | ||||
|                 <el-form-item label="特征描述" prop="signalment"> | ||||
|                   <el-input v-model="form.signalment" placeholder="请输入特征描述" disabled /> | ||||
|                 </el-form-item> | ||||
|                 <el-form-item label="物料编码" prop="materialCode"> | ||||
|                   <el-input v-model="form.materialCode" placeholder="请输入物料编码" disabled /> | ||||
|                 </el-form-item> | ||||
|                 <el-form-item label="计量单位" prop="unit"> | ||||
|                   <el-input v-model="form.unit" placeholder="请输入计量单位" disabled /> | ||||
|                 </el-form-item> | ||||
|                 <el-form-item label="计划数量" prop="plan"> | ||||
|                   <el-input v-model="form.plan" placeholder="请输入计划数量" type="number" disabled /> | ||||
|                 </el-form-item> | ||||
|                 <el-form-item label="备注" prop="remark"> | ||||
|                   <el-input v-model="form.remark" placeholder="请输入内容" disabled /> | ||||
|                 </el-form-item> | ||||
|               </el-col> | ||||
|             </el-row> | ||||
|           </el-form> | ||||
|         </div> | ||||
|       </el-card> | ||||
|       <!-- 提交组件 --> | ||||
|       <submitVerify ref="submitVerifyRef" :task-variables="taskVariables" @submit-callback="submitCallback" /> | ||||
|       <approvalRecord ref="approvalRecordRef"></approvalRecord> | ||||
|       <!-- 流程选择对话框 --> | ||||
|       <el-dialog | ||||
|         draggable | ||||
|         v-model="dialogVisible.visible" | ||||
|         :title="dialogVisible.title" | ||||
|         :before-close="handleClose" | ||||
|         width="500" | ||||
|         class="rounded-lg shadow-lg" | ||||
|       > | ||||
|         <div class="p-4"> | ||||
|           <p class="text-gray-600 mb-4">请选择要启动的流程:</p> | ||||
|           <el-select v-model="flowCode" placeholder="请选择流程" style="width: 100%"> | ||||
|             <el-option v-for="item in flowCodeOptions" :key="item.value" :label="item.label" :value="item.value" /> | ||||
|           </el-select> | ||||
|         </div> | ||||
|         <template #footer> | ||||
|           <div class="dialog-footer p-4 border-t border-gray-100 flex justify-end space-x-3"> | ||||
|             <el-button @click="handleClose" class="px-4 py-2 border border-gray-300 rounded-md text-gray-700 hover:bg-gray-50 transition-colors" | ||||
|               >取消</el-button | ||||
|             > | ||||
|             <el-button type="primary" @click="submitFlow()" class="px-4 py-2 bg-primary text-white rounded-md hover:bg-primary/90 transition-colors" | ||||
|               >确认</el-button | ||||
|             > | ||||
|           </div> | ||||
|         </template> | ||||
|       </el-dialog> | ||||
|     </div> | ||||
|   </div> | ||||
| </template> | ||||
|  | ||||
| <script setup name="Leave" lang="ts"> | ||||
| import { LeaveForm, LeaveQuery, LeaveVO } from '@/api/workflow/leave/types'; | ||||
| import { startWorkFlow } from '@/api/workflow/task'; | ||||
| import SubmitVerify from '@/components/Process/submitVerify.vue'; | ||||
| import ApprovalRecord from '@/components/Process/approvalRecord.vue'; | ||||
| import ApprovalButton from '@/components/Process/approvalButton.vue'; | ||||
| import { StartProcessBo } from '@/api/workflow/workflowCommon/types'; | ||||
| const { proxy } = getCurrentInstance() as ComponentInternalInstance; | ||||
| import { useUserStoreHook } from '@/store/modules/user'; | ||||
| import { getCailiaoshebei, listCailiaoshebei } from '@/api/materials/cailiaoshebei'; | ||||
| // 获取用户 store | ||||
| const userStore = useUserStoreHook(); | ||||
| // 从 store 中获取项目列表和当前选中的项目 | ||||
| const currentProject = computed(() => userStore.selectedProject); | ||||
| const buttonLoading = ref(false); | ||||
| const loading = ref(true); | ||||
| //路由参数 | ||||
| const routeParams = ref<Record<string, any>>({}); | ||||
| const flowCode = ref<string>(''); | ||||
| const status = ref<string>(''); | ||||
| const dialogVisible = reactive<DialogOption>({ | ||||
|   visible: false, | ||||
|   title: '流程定义' | ||||
| }); | ||||
| //提交组件 | ||||
| const submitVerifyRef = ref<InstanceType<typeof SubmitVerify>>(); | ||||
| //审批记录组件 | ||||
| const approvalRecordRef = ref<InstanceType<typeof ApprovalRecord>>(); | ||||
| //按钮组件 | ||||
| const flowCodeOptions = [ | ||||
|   { | ||||
|     value: currentProject.value?.id + '_materialDesign', | ||||
|     label: '材料设备设计审批' | ||||
|   } | ||||
| ]; | ||||
|  | ||||
| const leaveFormRef = ref<ElFormInstance>(); | ||||
| const dialog = reactive({ | ||||
|   visible: false, | ||||
|   title: '', | ||||
|   isEdit: false | ||||
| }); | ||||
| const { supply } = toRefs<any>(proxy?.useDict('supply')); | ||||
|  | ||||
| const submitFormData = ref<StartProcessBo>({ | ||||
|   businessId: '', | ||||
|   flowCode: '', | ||||
|   variables: {} | ||||
| }); | ||||
| const taskVariables = ref<Record<string, any>>({}); | ||||
| const selectValue = ref<string[]>([]); | ||||
|  | ||||
| const initFormData = []; | ||||
| const data = reactive({ | ||||
|   form: { ...initFormData }, | ||||
|   rules: {} | ||||
| }); | ||||
|  | ||||
| const handleClose = () => { | ||||
|   dialogVisible.visible = false; | ||||
|   flowCode.value = ''; | ||||
|   buttonLoading.value = false; | ||||
| }; | ||||
| const { form, rules } = toRefs(data); | ||||
|  | ||||
| /** 表单重置 */ | ||||
| const reset = () => { | ||||
|   form.value = { ...initFormData }; | ||||
|   leaveFormRef.value?.resetFields(); | ||||
| }; | ||||
|  | ||||
| /** 获取详情 */ | ||||
| const getInfo = () => { | ||||
|   loading.value = true; | ||||
|   buttonLoading.value = false; | ||||
|   nextTick(async () => { | ||||
|     const res = await listCailiaoshebei({ pageNum: 1, pageSize: 10, batchNumber: routeParams.value.batchNumber }); | ||||
|     form.value = res.rows; | ||||
|     loading.value = false; | ||||
|     buttonLoading.value = false; | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| /** 提交按钮 */ | ||||
| const submitForm = (status1: string) => { | ||||
|   status.value = status1; | ||||
|   submit(status.value, form.value); | ||||
| }; | ||||
|  | ||||
| const submitFlow = async () => { | ||||
|   handleStartWorkFlow(form.value); | ||||
|   dialogVisible.visible = false; | ||||
| }; | ||||
| //提交申请 | ||||
| const handleStartWorkFlow = async (data: LeaveForm) => { | ||||
|   try { | ||||
|     submitFormData.value.flowCode = flowCode.value; | ||||
|     submitFormData.value.businessId = data.id; | ||||
|     //流程变量 | ||||
|     taskVariables.value = { | ||||
|       // leave4/5 使用的流程变量 | ||||
|       userList: ['1', '3', '4'] | ||||
|     }; | ||||
|     submitFormData.value.variables = taskVariables.value; | ||||
|     const resp = await startWorkFlow(submitFormData.value); | ||||
|     if (submitVerifyRef.value) { | ||||
|       buttonLoading.value = false; | ||||
|       submitVerifyRef.value.openDialog(resp.data.taskId); | ||||
|     } | ||||
|   } finally { | ||||
|     buttonLoading.value = false; | ||||
|   } | ||||
| }; | ||||
| //审批记录 | ||||
| const handleApprovalRecord = () => { | ||||
|   approvalRecordRef.value.init(form.value.id); | ||||
| }; | ||||
| //提交回调 | ||||
| const submitCallback = async () => { | ||||
|   await proxy.$tab.closePage(proxy.$route); | ||||
|   proxy.$router.go(-1); | ||||
| }; | ||||
| //审批 | ||||
| const approvalVerifyOpen = async () => { | ||||
|   submitVerifyRef.value.openDialog(routeParams.value.taskId); | ||||
| }; | ||||
| // 图纸上传成功之后 开始提交 | ||||
| const submit = async (status, data) => { | ||||
|   form.value = data; | ||||
|   if (status === 'draft') { | ||||
|     buttonLoading.value = false; | ||||
|     proxy?.$modal.msgSuccess('暂存成功'); | ||||
|     proxy.$tab.closePage(proxy.$route); | ||||
|     proxy.$router.go(-1); | ||||
|   } else { | ||||
|     if ((form.value.approvalDesign === 'draft' && (flowCode.value === '' || flowCode.value === null)) || routeParams.value.type === 'add') { | ||||
|       flowCode.value = flowCodeOptions[0].value; | ||||
|       dialogVisible.visible = true; | ||||
|       return; | ||||
|     } | ||||
|     //说明启动过先随意穿个参数 | ||||
|     if (flowCode.value === '' || flowCode.value === null) { | ||||
|       flowCode.value = 'xx'; | ||||
|     } | ||||
|     await handleStartWorkFlow(data); | ||||
|   } | ||||
| }; | ||||
|  | ||||
| onMounted(() => { | ||||
|   nextTick(async () => { | ||||
|     routeParams.value = proxy.$route.query; | ||||
|     console.log('🚀 ~ proxy.$route.query:', proxy.$route.query); | ||||
|     reset(); | ||||
|     loading.value = false; | ||||
|     if (routeParams.value.type === 'update' || routeParams.value.type === 'view' || routeParams.value.type === 'approval') { | ||||
|       getInfo(); | ||||
|     } | ||||
|   }); | ||||
| }); | ||||
| </script> | ||||
| <style scoped lang="scss"> | ||||
| /* 全局样式 */ | ||||
| :root { | ||||
|   --primary: #409eff; | ||||
|   --primary-light: #66b1ff; | ||||
|   --primary-dark: #3a8ee6; | ||||
|   --success: #67c23a; | ||||
|   --warning: #e6a23c; | ||||
|   --danger: #f56c6c; | ||||
|   --info: #909399; | ||||
| } | ||||
|  | ||||
| /* 表单样式优化 */ | ||||
| .el-form-item { | ||||
|   .el-form-item__label { | ||||
|     color: #606266; | ||||
|     font-weight: 500; | ||||
|   } | ||||
|  | ||||
|   .el-input__inner, | ||||
|   .el-select .el-input__inner { | ||||
|     border-radius: 4px; | ||||
|     transition: | ||||
|       border-color 0.2s, | ||||
|       box-shadow 0.2s; | ||||
|  | ||||
|     &:focus { | ||||
|       border-color: var(--primary-light); | ||||
|       box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.1); | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   .el-textarea__inner { | ||||
|     border-radius: 4px; | ||||
|     transition: | ||||
|       border-color 0.2s, | ||||
|       box-shadow 0.2s; | ||||
|  | ||||
|     &:focus { | ||||
|       border-color: var(--primary-light); | ||||
|       box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.1); | ||||
|     } | ||||
|   } | ||||
| } | ||||
|  | ||||
| /* 按钮样式优化 */ | ||||
| .el-button { | ||||
|   border-radius: 4px; | ||||
|   transition: all 0.2s; | ||||
|  | ||||
|   &.is-primary { | ||||
|     background-color: var(--primary); | ||||
|     border-color: var(--primary); | ||||
|  | ||||
|     &:hover { | ||||
|       background-color: var(--primary-light); | ||||
|       border-color: var(--primary-light); | ||||
|     } | ||||
|  | ||||
|     &:active { | ||||
|       background-color: var(--primary-dark); | ||||
|       border-color: var(--primary-dark); | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   &.is-text { | ||||
|     color: var(--primary); | ||||
|  | ||||
|     &:hover { | ||||
|       color: var(--primary-light); | ||||
|       background-color: rgba(64, 158, 255, 0.05); | ||||
|     } | ||||
|   } | ||||
| } | ||||
|  | ||||
| /* 卡片样式优化 */ | ||||
| .el-card { | ||||
|   transition: all 0.3s ease; | ||||
|  | ||||
|   &:hover { | ||||
|     /* transform: translateY(-2px); */ | ||||
|   } | ||||
| } | ||||
|  | ||||
| /* 对话框样式优化 */ | ||||
| .el-dialog { | ||||
|   .el-dialog__header { | ||||
|     background-color: #f5f7fa; | ||||
|     border-bottom: 1px solid #ebeef5; | ||||
|     padding: 15px 20px; | ||||
|   } | ||||
|  | ||||
|   .el-dialog__title { | ||||
|     font-size: 16px; | ||||
|     font-weight: 600; | ||||
|     color: #303133; | ||||
|   } | ||||
|  | ||||
|   .el-dialog__footer { | ||||
|     padding: 15px 20px; | ||||
|     border-top: 1px solid #ebeef5; | ||||
|   } | ||||
| } | ||||
| </style> | ||||
							
								
								
									
										420
									
								
								src/views/materials/orderEquipment/index.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										420
									
								
								src/views/materials/orderEquipment/index.vue
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,420 @@ | ||||
| <template> | ||||
|   <div class="p-2"> | ||||
|     <el-row :gutter="20"> | ||||
|       <!-- 流程分类树 --> | ||||
|       <el-col style="" :span="5"> | ||||
|         <el-card shadow="hover"> | ||||
|           <el-input v-model="queryParams.batchNumber" placeholder="请输入批次号" @input="getBatchList" prefix-icon="Search" clearable /> | ||||
|           <el-tree | ||||
|             ref="batchTreeRef" | ||||
|             class="mt-2" | ||||
|             node-key="batchNumber" | ||||
|             :data="batchOptions" | ||||
|             :props="{ label: 'batchNumber', children: 'children' }" | ||||
|             :expand-on-click-node="false" | ||||
|             highlight-current | ||||
|             default-expand-all | ||||
|             @node-click="handleNodeClick" | ||||
|           ></el-tree> | ||||
|           <pagination | ||||
|             v-show="total > 0" | ||||
|             :total="total" | ||||
|             v-model:page="queryParams.pageNum" | ||||
|             v-model:limit="queryParams.pageSize" | ||||
|             @pagination="getBatchList" | ||||
|             layout="prev, pager, next,jumper" | ||||
|           /> | ||||
|         </el-card> | ||||
|       </el-col> | ||||
|       <el-col :span="19"> | ||||
|         <el-card shadow="never"> | ||||
|           <template #header> | ||||
|             <el-row :gutter="10" class="mb8"> | ||||
|               <!-- <el-col :span="1.5"> | ||||
|                 <el-button type="primary" plain icon="SemiSelect" @click="handleAdd" v-hasPermi="['cailiaoshebei:cailiaoshebei:add']">选择</el-button> | ||||
|               </el-col> --> | ||||
|               <el-col :span="1.5"> | ||||
|                 <el-button type="success" plain icon="Check" @click="submitForm" v-hasPermi="['cailiaoshebei:cailiaoshebei:delete']">保存</el-button> | ||||
|               </el-col> | ||||
|  | ||||
|               <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> | ||||
|             </el-row> | ||||
|           </template> | ||||
|           <el-row :gutter="20"> | ||||
|             <el-col :span="8" :offset="0"> | ||||
|               <el-form-item label="单据号"> | ||||
|                 <el-input v-model="form.batchNumbers" placeholder="请输入单据号" @input="getList" prefix-icon="Search" clearable /> | ||||
|               </el-form-item> | ||||
|             </el-col> | ||||
|             <el-col :span="8" :offset="0"> | ||||
|               <el-form-item label="采购人"> | ||||
|                 <el-input v-model="form.purchasingAgent" placeholder="请输入采购人" @input="getList" prefix-icon="Search" clearable /> | ||||
|               </el-form-item> | ||||
|             </el-col> | ||||
|             <el-col :span="8" :offset="0"> | ||||
|               <el-form-item label="采购时间"> | ||||
|                 <el-date-picker v-model="form.purchasingPeriod" type="date" value-format="YYYY-MM-DD" placeholder="选择采购时间" /> | ||||
|               </el-form-item> | ||||
|             </el-col> | ||||
|             <el-col :span="8" :offset="0"> | ||||
|               <el-form-item label="供应商"> | ||||
|                 <el-input v-model="form.supplier" placeholder="请输入供应商" @input="getList" prefix-icon="Search" clearable /> | ||||
|               </el-form-item> | ||||
|             </el-col> | ||||
|             <el-col :span="8" :offset="0"> | ||||
|               <el-form-item label="合同号"> | ||||
|                 <el-input v-model="form.contractNumber" placeholder="请输入合同号" @input="getList" prefix-icon="Search" clearable /> | ||||
|               </el-form-item> | ||||
|             </el-col> | ||||
|             <el-col :span="8" :offset="0"> | ||||
|               <el-form-item label="备注"> | ||||
|                 <el-input v-model="form.dhRemark" placeholder="请输入备注" @input="getList" prefix-icon="Search" clearable /> | ||||
|               </el-form-item> | ||||
|             </el-col> | ||||
|           </el-row> | ||||
|  | ||||
|           <el-table v-loading="loading" :data="cailiaoshebeiList" @selection-change="handleSelectionChange"> | ||||
|             <el-table-column type="selection" width="55" align="center" /> | ||||
|             <!-- <el-table-column label="供货商ID" align="center" prop="supplierId" /> --> | ||||
|             <!-- <el-table-column label="供货商" align="center" prop="supplierCompany" /> --> | ||||
|             <el-table-column label="设备材料名称" align="center" prop="name" /> | ||||
|             <el-table-column label="规格型号" align="center" prop="specification" /> | ||||
|             <el-table-column label="物料编码" align="center" prop="materialCode" width="200" /> | ||||
|             <el-table-column label="需求数量" align="center" prop="demandQuantity" width="80" /> | ||||
|             <el-table-column label="验收数量" align="center" prop="acceptanceQuantity" /> | ||||
|             <el-table-column label="订货量" align="center" prop="orderQuantity"> | ||||
|               <template #default="scope"> | ||||
|                 <el-input v-model="scope.row.orderQuantity" type="number" /> | ||||
|               </template> | ||||
|             </el-table-column> | ||||
|             <el-table-column label="预计到货时间" align="center" prop="expectedArrival" width="250"> | ||||
|               <template #default="scope"> | ||||
|                 <div class="flex justify-center w100%"> | ||||
|                   <el-date-picker v-model="scope.row.expectedArrival" type="date" value-format="YYYY-MM-DD" /> | ||||
|                 </div> | ||||
|               </template> | ||||
|             </el-table-column> | ||||
|             <el-table-column label="预计生产完成时间" align="center" prop="productionTime" width="250"> | ||||
|               <template #default="scope"> | ||||
|                 <div class="flex justify-center w100%"> | ||||
|                   <el-date-picker v-model="scope.row.productionTime" type="date" value-format="YYYY-MM-DD" /> | ||||
|                 </div> | ||||
|               </template> | ||||
|             </el-table-column> | ||||
|             <!-- <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="['cailiaoshebei:cailiaoshebei:edit']" | ||||
|                   ></el-button> | ||||
|                 </el-tooltip> | ||||
|                 <el-tooltip content="删除" placement="top"> | ||||
|                   <el-button | ||||
|                     link | ||||
|                     type="primary" | ||||
|                     icon="Delete" | ||||
|                     @click="handleDelete(scope.row)" | ||||
|                     v-hasPermi="['cailiaoshebei:cailiaoshebei:remove']" | ||||
|                   ></el-button> | ||||
|                 </el-tooltip> | ||||
|               </template> | ||||
|             </el-table-column> --> | ||||
|           </el-table> | ||||
|         </el-card> | ||||
|       </el-col> | ||||
|     </el-row> | ||||
|  | ||||
|     <!-- 添加或修改物资-材料设备对话框 --> | ||||
|     <el-dialog :title="dialog.title" v-model="dialog.visible" width="650px" append-to-body> | ||||
|       <el-transfer | ||||
|         v-model="cailiaoshebeiSelectedList" | ||||
|         filterable | ||||
|         :data="cailiaoshebeiAllList" | ||||
|         :props="{ | ||||
|           label: 'name', | ||||
|           key: 'id' | ||||
|         }" | ||||
|       /> | ||||
|       <template #footer> | ||||
|         <div class="dialog-footer"> | ||||
|           <el-button :loading="buttonLoading" type="primary" @click="submitTransferForm">确 定</el-button> | ||||
|           <el-button @click="cancel">取 消</el-button> | ||||
|         </div> | ||||
|       </template> | ||||
|     </el-dialog> | ||||
|   </div> | ||||
| </template> | ||||
|  | ||||
| <script setup name="Cailiaoshebei" lang="ts"> | ||||
| import { | ||||
|   listCailiaoshebei, | ||||
|   getCailiaoshebei, | ||||
|   delCailiaoshebei, | ||||
|   addCailiaoshebei, | ||||
|   updateCailiaoshebei, | ||||
|   listBatch, | ||||
|   getBatch, | ||||
|   delBatch | ||||
| } from '@/api/materials/orderEquipment'; | ||||
| import { CailiaoshebeiVO, CailiaoshebeiQuery, CailiaoshebeiForm } from '@/api/materials/orderEquipment/types'; | ||||
|  | ||||
| import { listContractor } from '@/api/project/contractor'; | ||||
| import { useUserStoreHook } from '@/store/modules/user'; | ||||
|  | ||||
| const { proxy } = getCurrentInstance() as ComponentInternalInstance; | ||||
| const { supply } = toRefs<any>(proxy?.useDict('supply')); | ||||
| // 获取用户 store | ||||
| const userStore = useUserStoreHook(); | ||||
| // 从 store 中获取项目列表和当前选中的项目 | ||||
| const currentProject = computed(() => userStore.selectedProject); | ||||
| const batchTreeRef = ref<any>(null); | ||||
| const cailiaoshebeiList = ref<CailiaoshebeiVO[]>([]); | ||||
| const cailiaoshebeiAllList = ref<CailiaoshebeiVO[]>([]); | ||||
| const cailiaoshebeiSelectedList = ref([]); | ||||
| const buttonLoading = ref(false); | ||||
| const loading = ref(false); | ||||
| const showSearch = ref(true); | ||||
| const ids = ref<Array<string | number>>([]); | ||||
| const single = ref(true); | ||||
| const multiple = ref(true); | ||||
| const total = ref(0); | ||||
| const batchOptions = ref<any[]>([]); | ||||
|  | ||||
| const queryFormRef = ref<ElFormInstance>(); | ||||
| const cailiaoshebeiFormRef = ref<ElFormInstance>(); | ||||
|  | ||||
| const dialog = reactive<DialogOption>({ | ||||
|   visible: false, | ||||
|   title: '' | ||||
| }); | ||||
|  | ||||
| const initFormData: CailiaoshebeiForm = { | ||||
|   id: undefined, | ||||
|   batchNumber: undefined, | ||||
|   supplierId: undefined, | ||||
|   addDataList: [], | ||||
|  | ||||
|   supplier: undefined, | ||||
|   name: undefined, | ||||
|   supply: undefined, | ||||
|   specification: undefined, | ||||
|   signalment: undefined, | ||||
|   materialCode: undefined, | ||||
|   arrivalTime: undefined, | ||||
|   finishTime: undefined, | ||||
|   unit: undefined, | ||||
|   plan: undefined, | ||||
|   realQuantity: undefined, | ||||
|   projectId: currentProject.value.id, | ||||
|   remark: undefined | ||||
| }; | ||||
| const data = reactive<PageData<any, any>>({ | ||||
|   form: { ...initFormData }, | ||||
|   queryParams: { | ||||
|     pageNum: 1, | ||||
|     pageSize: 10, | ||||
|     batchNumber: undefined, | ||||
|     supplierId: undefined, | ||||
|     supplier: undefined, | ||||
|     name: undefined, | ||||
|     projectId: currentProject.value.id, | ||||
|     supply: undefined, | ||||
|     specification: undefined, | ||||
|     signalment: undefined, | ||||
|     materialCode: undefined, | ||||
|     arrivalTime: undefined, | ||||
|     finishTime: undefined, | ||||
|     unit: undefined, | ||||
|     plan: undefined, | ||||
|     realQuantity: undefined, | ||||
|     params: {} | ||||
|   }, | ||||
|   rules: { | ||||
|     id: [{ required: true, message: '主键ID不能为空', trigger: 'blur' }] | ||||
|   } | ||||
| }); | ||||
|  | ||||
| const { queryParams, form, rules } = toRefs(data); | ||||
|  | ||||
| /** 查询物资-材料设备列表 */ | ||||
| const getList = async () => { | ||||
|   loading.value = true; | ||||
|   const res = await listCailiaoshebei(queryParams.value); | ||||
|   cailiaoshebeiList.value = res.rows; | ||||
|  | ||||
|   loading.value = false; | ||||
| }; | ||||
|  | ||||
| //查询批次列表 | ||||
| const getBatchList = async () => { | ||||
|   const res = await listBatch(queryParams.value); | ||||
|   console.log('🚀 ~ getBatchList ~ res:', res); | ||||
|   batchOptions.value = res.rows; | ||||
|   total.value = res.total; | ||||
|   try { | ||||
|     batchTreeRef.value.setCurrentKey(res.rows[0].batchNumber); | ||||
|     form.value.batchNumber = res.rows[0].batchNumber; | ||||
|   } catch (error) { | ||||
|     form.value.batchNumber = ''; | ||||
|   } | ||||
|   getList(); | ||||
| }; | ||||
|  | ||||
| /** 节点单击事件 */ | ||||
| const handleNodeClick = (data: any) => { | ||||
|   queryParams.value.batchNumber = data.batchNumber; | ||||
|   form.value.batchNumber = data.batchNumber; | ||||
|   console.log('🚀 ~ handleNodeClick ~ form.value:', form.value); | ||||
|   if (data.batchNumber === '0') { | ||||
|     queryParams.value.batchNumber = ''; | ||||
|   } | ||||
|   getList(); | ||||
| }; | ||||
|  | ||||
| /** 取消按钮 */ | ||||
| const cancel = () => { | ||||
|   reset(); | ||||
|   dialog.visible = false; | ||||
| }; | ||||
|  | ||||
| /** 表单重置 */ | ||||
| const reset = () => { | ||||
|   const preservedBatchId = form.value.batchNumber; // 先保存当前的 batchNumber | ||||
|   form.value = { ...initFormData, batchNumber: preservedBatchId }; // 重置但保留 | ||||
|   cailiaoshebeiFormRef.value?.resetFields(); | ||||
| }; | ||||
|  | ||||
| /** 搜索按钮操作 */ | ||||
| const handleQuery = () => { | ||||
|   queryParams.value.pageNum = 1; | ||||
|   getList(); | ||||
| }; | ||||
|  | ||||
| /** 重置按钮操作 */ | ||||
| const resetQuery = () => { | ||||
|   queryFormRef.value?.resetFields(); | ||||
|   handleQuery(); | ||||
| }; | ||||
|  | ||||
| /** 多选框选中数据 */ | ||||
| const handleSelectionChange = (selection: CailiaoshebeiVO[]) => { | ||||
|   ids.value = selection.map((item) => item.id); | ||||
|   single.value = selection.length != 1; | ||||
|   multiple.value = !selection.length; | ||||
| }; | ||||
|  | ||||
| /** 新增按钮操作 */ | ||||
| const handleAdd = () => { | ||||
|   reset(); | ||||
|   listCailiaoshebei({ | ||||
|     projectId: currentProject.value.id | ||||
|   }).then((res) => { | ||||
|     cailiaoshebeiAllList.value = res.rows; | ||||
|   }); | ||||
|  | ||||
|   dialog.visible = true; | ||||
|   dialog.title = '选择物资-材料设备'; | ||||
| }; | ||||
|  | ||||
| /** 修改按钮操作 */ | ||||
| // const handleUpdate = async (row?: CailiaoshebeiVO) => { | ||||
| //   reset(); | ||||
| //   const _id = row?.id || ids.value[0]; | ||||
| //   const res = await getCailiaoshebei(_id); | ||||
| //   Object.assign(form.value, res.data); | ||||
| //   selectValue.value = (form.value.supplierId as string).split(','); | ||||
| //   dialog.visible = true; | ||||
| //   dialog.title = '修改物资-材料设备'; | ||||
| // }; | ||||
|  | ||||
| /** 提交按钮 */ | ||||
| const submitForm = async () => { | ||||
|   buttonLoading.value = true; | ||||
|   cailiaoshebeiList.value.forEach((item) => { | ||||
|     if (item.id) { | ||||
|       delete item.id; | ||||
|     } | ||||
|   }); | ||||
|  | ||||
|   await addCailiaoshebei({ ...form.value, list: cailiaoshebeiList.value, batchNumber: form.value.batchNumber } as any).finally( | ||||
|     () => (buttonLoading.value = false) | ||||
|   ); | ||||
|  | ||||
|   proxy?.$modal.msgSuccess('操作成功'); | ||||
|   dialog.visible = false; | ||||
| }; | ||||
|  | ||||
| /** 提交穿梭框数据 */ | ||||
| const submitTransferForm = async () => { | ||||
|   cailiaoshebeiList.value = cailiaoshebeiSelectedList.value.map((id) => { | ||||
|     const item = cailiaoshebeiAllList.value.find((option) => option.id === id); | ||||
|     return item; | ||||
|   }); | ||||
|   dialog.visible = false; | ||||
| }; | ||||
|  | ||||
| /** 新增批次 */ | ||||
| const addBatch = async () => { | ||||
|   await proxy?.$modal.confirm('是否确认新增批次?').finally(() => (loading.value = false)); | ||||
|   const res = await getBatch({ projectId: currentProject.value.id }); | ||||
|   console.log('🚀 ~ addBatch ~ res:', res); | ||||
|   await getBatchList(); | ||||
|  | ||||
|   proxy?.$modal.msgSuccess('新增成功'); | ||||
| }; | ||||
|  | ||||
| /** 删除批次 */ | ||||
| const handleDeleteBatch = async () => { | ||||
|   const _ids = batchTreeRef.value.getCurrentNode()?.id; | ||||
|   await proxy?.$modal.confirm('是否确认删除批次编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false)); | ||||
|   await delBatch(_ids); | ||||
|   proxy?.$modal.msgSuccess('删除成功'); | ||||
|   queryParams.value.batchNumber = ''; | ||||
|  | ||||
|   await getBatchList(); | ||||
| }; | ||||
|  | ||||
| /** 删除按钮操作 */ | ||||
| const handleDelete = async (row?: CailiaoshebeiVO) => { | ||||
|   const _ids = row?.id || ids.value; | ||||
|   await proxy?.$modal.confirm('是否确认删除物资-材料设备编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false)); | ||||
|   await delCailiaoshebei(_ids); | ||||
|   proxy?.$modal.msgSuccess('删除成功'); | ||||
|   await getList(); | ||||
| }; | ||||
|  | ||||
| /** 查询供货商列表 */ | ||||
| const supplierOptions = ref([]); | ||||
| const getSupplierList = async () => { | ||||
|   const res = await listContractor({ | ||||
|     projectId: currentProject.value.id, | ||||
|     pageNum: 1, | ||||
|     pageSize: 10000 | ||||
|   }); | ||||
|   supplierOptions.value = res.rows; | ||||
| }; | ||||
|  | ||||
| onMounted(() => { | ||||
|   getBatchList(); | ||||
|   getSupplierList(); | ||||
| }); | ||||
|  | ||||
| //监听项目id刷新数据 | ||||
| const listeningProject = watch( | ||||
|   () => currentProject.value.id, | ||||
|   (nid, oid) => { | ||||
|     queryParams.value.projectId = nid; | ||||
|     form.value.projectId = nid; | ||||
|     getBatchList(); | ||||
|     getSupplierList(); | ||||
|   } | ||||
| ); | ||||
|  | ||||
| onUnmounted(() => { | ||||
|   listeningProject(); | ||||
| }); | ||||
| </script> | ||||
							
								
								
									
										411
									
								
								src/views/materials/orderMaterials/index.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										411
									
								
								src/views/materials/orderMaterials/index.vue
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,411 @@ | ||||
| <template> | ||||
|   <div class="p-2"> | ||||
|     <el-row :gutter="20"> | ||||
|       <!-- 流程分类树 --> | ||||
|       <el-col style="" :span="5"> | ||||
|         <el-card shadow="hover"> | ||||
|           <el-input v-model="queryParams.batchNumber" placeholder="请输入批次号" @input="getBatchList" prefix-icon="Search" clearable /> | ||||
|           <el-tree | ||||
|             ref="batchTreeRef" | ||||
|             class="mt-2" | ||||
|             node-key="batchNumber" | ||||
|             :data="batchOptions" | ||||
|             :props="{ label: 'batchNumber', children: 'children' }" | ||||
|             :expand-on-click-node="false" | ||||
|             highlight-current | ||||
|             default-expand-all | ||||
|             @node-click="handleNodeClick" | ||||
|           ></el-tree> | ||||
|           <pagination | ||||
|             v-show="total > 0" | ||||
|             :total="total" | ||||
|             v-model:page="queryParams.pageNum" | ||||
|             v-model:limit="queryParams.pageSize" | ||||
|             @pagination="getBatchList" | ||||
|             layout="prev, pager, next,jumper" | ||||
|           /> | ||||
|         </el-card> | ||||
|       </el-col> | ||||
|       <el-col :span="19"> | ||||
|         <el-card shadow="never"> | ||||
|           <el-table v-loading="loading" :data="cailiaoshebeiList" @selection-change="handleSelectionChange"> | ||||
|             <el-table-column type="selection" width="55" align="center" /> | ||||
|             <!-- <el-table-column label="供货商ID" align="center" prop="supplierId" /> --> | ||||
|             <el-table-column label="供货商" align="center" prop="supplier" /> | ||||
|             <el-table-column label="设备材料名称" align="center" prop="name" /> | ||||
|             <el-table-column label="供货来源" align="center" prop="supply"> | ||||
|               <template #default="scope"> | ||||
|                 <dict-tag :options="supply" :value="scope.row.supply" /> | ||||
|               </template> | ||||
|             </el-table-column> | ||||
|             <el-table-column label="规格型号" align="center" prop="specification" /> | ||||
|             <el-table-column label="特征描述" align="center" prop="signalment" /> | ||||
|             <el-table-column label="物料编码" align="center" prop="materialCode" width="200" /> | ||||
|             <el-table-column label="计量单位" align="center" prop="unit" /> | ||||
|             <el-table-column label="计划数量" align="center" prop="plan" /> | ||||
|             <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="['cailiaoshebei:cailiaoshebei:edit']" | ||||
|                   ></el-button> | ||||
|                 </el-tooltip> | ||||
|                 <el-tooltip content="删除" placement="top"> | ||||
|                   <el-button | ||||
|                     link | ||||
|                     type="primary" | ||||
|                     icon="Delete" | ||||
|                     @click="handleDelete(scope.row)" | ||||
|                     v-hasPermi="['cailiaoshebei:cailiaoshebei:remove']" | ||||
|                   ></el-button> | ||||
|                 </el-tooltip> | ||||
|               </template> | ||||
|             </el-table-column> | ||||
|           </el-table> | ||||
|         </el-card> | ||||
|       </el-col> | ||||
|     </el-row> | ||||
|  | ||||
|     <!-- 添加或修改物资-材料设备对话框 --> | ||||
|     <el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body> | ||||
|       <el-form ref="cailiaoshebeiFormRef" :model="form" :rules="rules" label-width="110px"> | ||||
|         <el-form-item label="批次号" prop="batchNumber"> | ||||
|           <el-input v-model="form.batchNumber" placeholder="请输入批次ID" disabled /> | ||||
|         </el-form-item> | ||||
|         <!-- <el-form-item label="供货商ID" prop="supplierId"> | ||||
|           <el-input v-model="form.supplierId" placeholder="请输入供货商ID" /> | ||||
|         </el-form-item> --> | ||||
|         <el-form-item label="供货商" prop="supplier"> | ||||
|           <el-select v-model="selectValue" value-key="id" multiple placeholder="请选择供货商" clearable filterable> | ||||
|             <el-option v-for="item in supplierOptions" :key="item.id" :label="item.name" :value="item.id"> </el-option> | ||||
|           </el-select> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="设备材料名称" prop="name"> | ||||
|           <el-input v-model="form.name" placeholder="请输入设备材料名称" /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="供货来源" prop="supply"> | ||||
|           <el-select v-model="form.supply" value-key="value" placeholder="请选择供货来源" clearable filterable @change=""> | ||||
|             <el-option v-for="item in supply" :key="item.value" :label="item.label" :value="item.value"> </el-option> | ||||
|           </el-select> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="规格型号" prop="specification"> | ||||
|           <el-input v-model="form.specification" placeholder="请输入规格型号" /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="特征描述" prop="signalment"> | ||||
|           <el-input v-model="form.signalment" placeholder="请输入特征描述" /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="物料编码" prop="materialCode"> | ||||
|           <el-input v-model="form.materialCode" placeholder="请输入物料编码" /> | ||||
|         </el-form-item> | ||||
|         <!-- <el-form-item label="计划到场时间" prop="arrivalTime"> | ||||
|           <el-date-picker clearable v-model="form.arrivalTime" type="datetime" value-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择计划到场时间"> | ||||
|           </el-date-picker> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="计划完成时间" prop="finishTime"> | ||||
|           <el-date-picker clearable v-model="form.finishTime" type="datetime" value-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择计划完成时间"> | ||||
|           </el-date-picker> | ||||
|         </el-form-item> --> | ||||
|         <el-form-item label="计量单位" prop="unit"> | ||||
|           <el-input v-model="form.unit" placeholder="请输入计量单位" /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="计划数量" prop="plan"> | ||||
|           <el-input v-model="form.plan" placeholder="请输入计划数量" type="number" /> | ||||
|         </el-form-item> | ||||
|         <!-- <el-form-item label="实际数量" prop="realQuantity"> | ||||
|           <el-input v-model="form.realQuantity" placeholder="请输入实际数量" /> | ||||
|         </el-form-item> --> | ||||
|         <el-form-item label="备注" prop="remark"> | ||||
|           <el-input v-model="form.remark" type="textarea" 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="Cailiaoshebei" lang="ts"> | ||||
| import { | ||||
|   listCailiaoshebei, | ||||
|   getCailiaoshebei, | ||||
|   delCailiaoshebei, | ||||
|   addCailiaoshebei, | ||||
|   updateCailiaoshebei, | ||||
|   listBatch, | ||||
|   getBatch, | ||||
|   delBatch | ||||
| } from '@/api/materials/orderMaterials'; | ||||
| import { CailiaoshebeiVO, CailiaoshebeiQuery, CailiaoshebeiForm } from '@/api/materials/cailiaoshebei/types'; | ||||
| import { listContractor } from '@/api/project/contractor'; | ||||
| import { useUserStoreHook } from '@/store/modules/user'; | ||||
|  | ||||
| const { proxy } = getCurrentInstance() as ComponentInternalInstance; | ||||
| const { supply } = toRefs<any>(proxy?.useDict('supply')); | ||||
| // 获取用户 store | ||||
| const userStore = useUserStoreHook(); | ||||
| // 从 store 中获取项目列表和当前选中的项目 | ||||
| const currentProject = computed(() => userStore.selectedProject); | ||||
| const batchTreeRef = ref<any>(null); | ||||
| const cailiaoshebeiList = ref<CailiaoshebeiVO[]>([]); | ||||
| const 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 batchOptions = ref<any[]>([]); | ||||
|  | ||||
| const queryFormRef = ref<ElFormInstance>(); | ||||
| const cailiaoshebeiFormRef = ref<ElFormInstance>(); | ||||
|  | ||||
| const dialog = reactive<DialogOption>({ | ||||
|   visible: false, | ||||
|   title: '' | ||||
| }); | ||||
|  | ||||
| const initFormData: CailiaoshebeiForm = { | ||||
|   id: undefined, | ||||
|   batchNumber: undefined, | ||||
|   supplierId: undefined, | ||||
|   supplier: undefined, | ||||
|   name: undefined, | ||||
|   supply: undefined, | ||||
|   specification: undefined, | ||||
|   signalment: undefined, | ||||
|   materialCode: undefined, | ||||
|   arrivalTime: undefined, | ||||
|   finishTime: undefined, | ||||
|   unit: undefined, | ||||
|   plan: undefined, | ||||
|   realQuantity: undefined, | ||||
|   projectId: currentProject.value.id, | ||||
|   remark: undefined | ||||
| }; | ||||
| const data = reactive<PageData<CailiaoshebeiForm, CailiaoshebeiQuery>>({ | ||||
|   form: { ...initFormData }, | ||||
|   queryParams: { | ||||
|     pageNum: 1, | ||||
|     pageSize: 10, | ||||
|     batchNumber: undefined, | ||||
|     supplierId: undefined, | ||||
|     supplier: undefined, | ||||
|     name: undefined, | ||||
|     projectId: currentProject.value.id, | ||||
|     supply: undefined, | ||||
|     specification: undefined, | ||||
|     signalment: undefined, | ||||
|     materialCode: undefined, | ||||
|     arrivalTime: undefined, | ||||
|     finishTime: undefined, | ||||
|     unit: undefined, | ||||
|     plan: undefined, | ||||
|     realQuantity: undefined, | ||||
|     params: {} | ||||
|   }, | ||||
|   rules: { | ||||
|     id: [{ required: true, message: '主键ID不能为空', trigger: 'blur' }] | ||||
|   } | ||||
| }); | ||||
|  | ||||
| const { queryParams, form, rules } = toRefs(data); | ||||
|  | ||||
| /** 查询物资-材料设备列表 */ | ||||
| const getList = async () => { | ||||
|   loading.value = true; | ||||
|   const res = await listCailiaoshebei(queryParams.value); | ||||
|   cailiaoshebeiList.value = res.rows; | ||||
|  | ||||
|   loading.value = false; | ||||
| }; | ||||
|  | ||||
| //查询批次列表 | ||||
| const getBatchList = async () => { | ||||
|   const res = await listBatch(queryParams.value); | ||||
|   console.log('🚀 ~ getBatchList ~ res:', res); | ||||
|   batchOptions.value = res.rows; | ||||
|   total.value = res.total; | ||||
|   try { | ||||
|     batchTreeRef.value.setCurrentKey(res.rows[0].batchNumber); | ||||
|     form.value.batchNumber = res.rows[0].batchNumber; | ||||
|   } catch (error) { | ||||
|     form.value.batchNumber = ''; | ||||
|   } | ||||
|  | ||||
|   getList(); | ||||
| }; | ||||
|  | ||||
| /** 节点单击事件 */ | ||||
| const handleNodeClick = (data: any) => { | ||||
|   queryParams.value.batchNumber = data.batchNumber; | ||||
|   form.value.batchNumber = data.batchNumber; | ||||
|   console.log('🚀 ~ handleNodeClick ~ form.value:', form.value); | ||||
|   if (data.batchNumber === '0') { | ||||
|     queryParams.value.batchNumber = ''; | ||||
|   } | ||||
|   getList(); | ||||
| }; | ||||
|  | ||||
| /** 取消按钮 */ | ||||
| const cancel = () => { | ||||
|   reset(); | ||||
|   dialog.visible = false; | ||||
| }; | ||||
|  | ||||
| /** 表单重置 */ | ||||
| const reset = () => { | ||||
|   const preservedBatchId = form.value.batchNumber; // 先保存当前的 batchNumber | ||||
|   form.value = { ...initFormData, batchNumber: preservedBatchId }; // 重置但保留 | ||||
|   cailiaoshebeiFormRef.value?.resetFields(); | ||||
| }; | ||||
|  | ||||
| /** 搜索按钮操作 */ | ||||
| const handleQuery = () => { | ||||
|   queryParams.value.pageNum = 1; | ||||
|   getList(); | ||||
| }; | ||||
|  | ||||
| /** 重置按钮操作 */ | ||||
| const resetQuery = () => { | ||||
|   queryFormRef.value?.resetFields(); | ||||
|   handleQuery(); | ||||
| }; | ||||
|  | ||||
| /** 多选框选中数据 */ | ||||
| const handleSelectionChange = (selection: CailiaoshebeiVO[]) => { | ||||
|   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?: CailiaoshebeiVO) => { | ||||
|   reset(); | ||||
|   const _id = row?.id || ids.value[0]; | ||||
|   const res = await getCailiaoshebei(_id); | ||||
|   Object.assign(form.value, res.data); | ||||
|   selectValue.value = (form.value.supplierId as string).split(','); | ||||
|   dialog.visible = true; | ||||
|   dialog.title = '修改物资-材料设备'; | ||||
| }; | ||||
|  | ||||
| /** 提交按钮 */ | ||||
| const submitForm = () => { | ||||
|   console.log('🚀 ~ submitForm ~ form.value:', form.value); | ||||
|   cailiaoshebeiFormRef.value?.validate(async (valid: boolean) => { | ||||
|     if (valid) { | ||||
|       buttonLoading.value = true; | ||||
|       if (form.value.id) { | ||||
|         await updateCailiaoshebei(form.value).finally(() => (buttonLoading.value = false)); | ||||
|       } else { | ||||
|         await addCailiaoshebei(form.value).finally(() => (buttonLoading.value = false)); | ||||
|       } | ||||
|       proxy?.$modal.msgSuccess('操作成功'); | ||||
|       dialog.visible = false; | ||||
|       await getList(); | ||||
|     } | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| /** 新增批次 */ | ||||
| const addBatch = async () => { | ||||
|   await proxy?.$modal.confirm('是否确认新增批次?').finally(() => (loading.value = false)); | ||||
|   const res = await getBatch({ projectId: currentProject.value.id }); | ||||
|   console.log('🚀 ~ addBatch ~ res:', res); | ||||
|   await getBatchList(); | ||||
|  | ||||
|   proxy?.$modal.msgSuccess('新增成功'); | ||||
| }; | ||||
|  | ||||
| /** 删除批次 */ | ||||
| const handleDeleteBatch = async () => { | ||||
|   const _ids = batchTreeRef.value.getCurrentNode()?.id; | ||||
|   await proxy?.$modal.confirm('是否确认删除批次编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false)); | ||||
|   await delBatch(_ids); | ||||
|   proxy?.$modal.msgSuccess('删除成功'); | ||||
|   queryParams.value.batchNumber = ''; | ||||
|  | ||||
|   await getBatchList(); | ||||
| }; | ||||
|  | ||||
| /** 删除按钮操作 */ | ||||
| const handleDelete = async (row?: CailiaoshebeiVO) => { | ||||
|   const _ids = row?.id || ids.value; | ||||
|   await proxy?.$modal.confirm('是否确认删除物资-材料设备编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false)); | ||||
|   await delCailiaoshebei(_ids); | ||||
|   proxy?.$modal.msgSuccess('删除成功'); | ||||
|   await getList(); | ||||
| }; | ||||
|  | ||||
| /** 导出按钮操作 */ | ||||
| const handleExport = () => { | ||||
|   proxy?.download( | ||||
|     'cailiaoshebei/cailiaoshebei/export', | ||||
|     { | ||||
|       ...queryParams.value | ||||
|     }, | ||||
|     `cailiaoshebei_${new Date().getTime()}.xlsx` | ||||
|   ); | ||||
| }; | ||||
|  | ||||
| /** 查询供货商列表 */ | ||||
| const supplierOptions = ref([]); | ||||
| const getSupplierList = async () => { | ||||
|   const res = await listContractor({ | ||||
|     projectId: currentProject.value.id, | ||||
|     pageNum: 1, | ||||
|     pageSize: 10000 | ||||
|   }); | ||||
|   supplierOptions.value = res.rows; | ||||
| }; | ||||
|  | ||||
| // 中间数组变量供 el-select 使用 | ||||
| const selectValue = ref<string[]>([]); | ||||
|  | ||||
| // 监听 selectValue,每次变化时同步更新 form.supplierId 和 form.supplier | ||||
| watch( | ||||
|   selectValue, | ||||
|   (newVal) => { | ||||
|     form.value.supplierId = newVal.join(','); | ||||
|     const selectedNames = supplierOptions.value.filter((opt) => newVal.includes(opt.id)).map((opt) => opt.name); | ||||
|     form.value.supplier = selectedNames.join(','); | ||||
|   }, | ||||
|   { immediate: true } | ||||
| ); | ||||
|  | ||||
| onMounted(() => { | ||||
|   getBatchList(); | ||||
|   getSupplierList(); | ||||
| }); | ||||
|  | ||||
| //监听项目id刷新数据 | ||||
| const listeningProject = watch( | ||||
|   () => currentProject.value.id, | ||||
|   (nid, oid) => { | ||||
|     queryParams.value.projectId = nid; | ||||
|     form.value.projectId = nid; | ||||
|     getBatchList(); | ||||
|     getSupplierList(); | ||||
|   } | ||||
| ); | ||||
|  | ||||
| onUnmounted(() => { | ||||
|   listeningProject(); | ||||
| }); | ||||
| </script> | ||||
							
								
								
									
										513
									
								
								src/views/materials/suppliesprice/index.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										513
									
								
								src/views/materials/suppliesprice/index.vue
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,513 @@ | ||||
| <template> | ||||
|   <div class="p-2"> | ||||
|     <el-row :gutter="20"> | ||||
|       <!-- 流程分类树 --> | ||||
|       <el-col style="" :span="5"> | ||||
|         <el-card shadow="hover"> | ||||
|           <!-- <template #header> | ||||
|             <el-row :gutter="10" class="mb8"> | ||||
|               <el-col :span="1.5" :offset="0" | ||||
|                 ><el-button type="primary" size="default" @click="addBatch" icon="FolderAdd" plain>新增</el-button></el-col | ||||
|               > | ||||
|               <el-col :span="1.5" :offset="0" | ||||
|                 ><el-button type="danger" size="default" @click="handleDeleteBatch" icon="FolderDelete" plain>删除</el-button></el-col | ||||
|               > | ||||
|             </el-row> | ||||
|           </template> --> | ||||
|  | ||||
|           <el-input v-model="queryParams.batchNumber" placeholder="请输入批次号" @input="getBatchList" prefix-icon="Search" clearable /> | ||||
|           <el-tree | ||||
|             ref="batchTreeRef" | ||||
|             class="mt-2" | ||||
|             node-key="batchNumber" | ||||
|             :data="batchOptions" | ||||
|             :props="{ label: 'batchNumber', children: 'children' }" | ||||
|             :expand-on-click-node="false" | ||||
|             highlight-current | ||||
|             default-expand-all | ||||
|             @node-click="handleNodeClick" | ||||
|           ></el-tree> | ||||
|           <pagination | ||||
|             v-show="total > 0" | ||||
|             :total="total" | ||||
|             v-model:page="queryParams.pageNum" | ||||
|             v-model:limit="queryParams.pageSize" | ||||
|             @pagination="getBatchList" | ||||
|             layout="prev, pager, next,jumper" | ||||
|           /> | ||||
|         </el-card> | ||||
|       </el-col> | ||||
|       <el-col :span="19"> | ||||
|         <el-card shadow="never"> | ||||
|           <el-table v-loading="loading" :data="cailiaoshebeiList" @selection-change="handleSelectionChange"> | ||||
|             <el-table-column type="selection" width="55" align="center" /> | ||||
|             <el-table-column label="供货商" align="center" prop="supplier" /> | ||||
|             <el-table-column label="设备材料名称" align="center" prop="name" /> | ||||
|             <el-table-column label="供货来源" align="center" prop="supply"> | ||||
|               <template #default="scope"> | ||||
|                 <dict-tag :options="supply" :value="scope.row.supply" /> | ||||
|               </template> | ||||
|             </el-table-column> | ||||
|             <el-table-column label="规格型号" align="center" prop="specification" /> | ||||
|             <el-table-column label="特征描述" align="center" prop="signalment" /> | ||||
|             <el-table-column label="物料编码" align="center" prop="materialCode" width="200" /> | ||||
|             <el-table-column label="计划到场时间" align="center" prop="arrivalTime" width="180"> | ||||
|               <template #default="scope"> | ||||
|                 <span>{{ parseTime(scope.row.arrivalTime, '{y}-{m}-{d}') }}</span> | ||||
|               </template> | ||||
|             </el-table-column> | ||||
|             <el-table-column label="计划完成时间" align="center" prop="finishTime" width="180"> | ||||
|               <template #default="scope"> | ||||
|                 <span>{{ parseTime(scope.row.finishTime, '{y}-{m}-{d}') }}</span> | ||||
|               </template> | ||||
|             </el-table-column> | ||||
|             <el-table-column label="计量单位" align="center" prop="unit" /> | ||||
|             <el-table-column label="计划数量" align="center" prop="plan" /> | ||||
|             <el-table-column label="流程状态" align="center" prop="planAuditStatus"> | ||||
|               <template #default="scope"> | ||||
|                 <dict-tag :options="wf_business_status" :value="scope.row.planAuditStatus" /> | ||||
|               </template> | ||||
|             </el-table-column> | ||||
|             <el-table-column label="操作" align="center" width="150"> | ||||
|               <template #default="scope" | ||||
|                 ><el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['cailiaoshebei:cailiaoshebei:edit']" | ||||
|                   >修改</el-button | ||||
|                 ><el-button link type="primary" icon="View" @click="handleDelete(scope.row)" v-hasPermi="['cailiaoshebei:cailiaoshebei:remove']" | ||||
|                   >详情</el-button | ||||
|                 > | ||||
|                 <el-button link type="primary" icon="Finished" @click="handleAudit(scope.row)" v-hasPermi="['out:monthPlan:remove']">审核</el-button> | ||||
|               </template> | ||||
|             </el-table-column> | ||||
|           </el-table> | ||||
|         </el-card> | ||||
|       </el-col> | ||||
|     </el-row> | ||||
|  | ||||
|     <!-- 添加或修改物资-材料设备对话框 --> | ||||
|     <el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body> | ||||
|       <el-form ref="cailiaoshebeiFormRef" :model="form" :rules="rules" label-width="110px"> | ||||
|         <el-form-item label="计划到场时间" prop="arrivalTime"> | ||||
|           <el-date-picker clearable v-model="form.arrivalTime" type="date" value-format="YYYY-MM-DD" placeholder="请选择计划到场时间"> | ||||
|           </el-date-picker> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="计划完成时间" prop="finishTime"> | ||||
|           <el-date-picker clearable v-model="form.finishTime" type="date" value-format="YYYY-MM-DD" placeholder="请选择计划完成时间"> | ||||
|           </el-date-picker> | ||||
|         </el-form-item> | ||||
|         <div v-for="(item, index) in selectValue" :key="index"> | ||||
|           <el-divider content-position="center" | ||||
|             ><el-text tag="b">{{ item }}</el-text></el-divider | ||||
|           > | ||||
|           <el-form-item label="单价" prop="unitPrice"> | ||||
|             <el-input v-model="form.listOfMaterialInventory[index].unitPrice" type="number" placeholder="请输入单价" /> | ||||
|           </el-form-item> | ||||
|           <el-form-item label="数量" prop="num"> | ||||
|             <el-input v-model="form.listOfMaterialInventory[index].num" type="number" placeholder="请输入数量" /> | ||||
|           </el-form-item> | ||||
|           <el-form-item label="合同号" prop="contractNum"> | ||||
|             <el-input v-model="form.listOfMaterialInventory[index].contractNum" placeholder="请输入合同号" /> | ||||
|           </el-form-item> | ||||
|           <el-form-item label="预估供应周期" prop="estimatedCycle"> | ||||
|             <el-input v-model="form.listOfMaterialInventory[index].estimatedCycle" type="number" placeholder="请输入预估供应周期" /> | ||||
|           </el-form-item> | ||||
|           <el-form-item label="供货公司" prop="supplierCompany"> | ||||
|             <el-input v-model="form.listOfMaterialInventory[index].supplierCompany" placeholder="请输入供货公司" disabled /> | ||||
|           </el-form-item> | ||||
|         </div> | ||||
|       </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> | ||||
|     <!-- 详情弹框 --> | ||||
|     <el-dialog :title="dialog.title" v-model="dialog.details" width="800px" append-to-body> | ||||
|       <div class="block_box"> | ||||
|         <span>主要信息</span> | ||||
|  | ||||
|         <el-form label-width="130px"> | ||||
|           <el-row :gutter="20" justify="space-around"> | ||||
|             <el-col :span="12"> | ||||
|               <el-form-item label="批次号"> | ||||
|                 {{ form?.batchNumber }} | ||||
|               </el-form-item> | ||||
|             </el-col> | ||||
|             <el-col :span="12"> | ||||
|               <el-form-item label="供货商"> | ||||
|                 {{ form?.supplier }} | ||||
|               </el-form-item> | ||||
|             </el-col> | ||||
|             <el-col :span="12"> | ||||
|               <el-form-item label="设备材料名称"> | ||||
|                 {{ form?.name }} | ||||
|               </el-form-item> | ||||
|             </el-col> | ||||
|             <el-col :span="12"> | ||||
|               <el-form-item label="规格型号"> | ||||
|                 {{ form?.specification }} | ||||
|               </el-form-item> | ||||
|             </el-col> | ||||
|             <el-col :span="12"> | ||||
|               <el-form-item label="供货方式"> | ||||
|                 <dict-tag :options="supply" :value="form.supply" /> | ||||
|               </el-form-item> | ||||
|             </el-col> | ||||
|             <el-col :span="12"> | ||||
|               <el-form-item label="特征描述"> | ||||
|                 {{ form?.signalment }} | ||||
|               </el-form-item> | ||||
|             </el-col> | ||||
|             <el-col :span="12"> | ||||
|               <el-form-item label="物料编码"> | ||||
|                 {{ form?.materialCode }} | ||||
|               </el-form-item> | ||||
|             </el-col> | ||||
|             <el-col :span="12"> | ||||
|               <el-form-item label="计划到场时间"> | ||||
|                 {{ form?.arrivalTime }} | ||||
|               </el-form-item> | ||||
|             </el-col> | ||||
|             <el-col :span="12"> | ||||
|               <el-form-item label="计划完成时间"> | ||||
|                 {{ form?.finishTime }} | ||||
|               </el-form-item> | ||||
|             </el-col> | ||||
|             <el-col :span="12"> | ||||
|               <el-form-item label="计量单位"> | ||||
|                 {{ form?.unit }} | ||||
|               </el-form-item> | ||||
|             </el-col> | ||||
|             <el-col :span="24"> | ||||
|               <el-form-item label="计划数量"> | ||||
|                 {{ form?.plan }} | ||||
|               </el-form-item> | ||||
|             </el-col> | ||||
|           </el-row> | ||||
|         </el-form> | ||||
|       </div> | ||||
|       <div class="block_box" v-for="(item, index) in selectValue" v-if="form?.listOfMaterialInventory.length"> | ||||
|         <span>{{ item }}-物资清单列表</span> | ||||
|         <el-form label-width="130px"> | ||||
|           <el-row :gutter="20"> | ||||
|             <el-col :span="12"> | ||||
|               <el-form-item label="单价"> | ||||
|                 {{ form?.listOfMaterialInventory[index].unitPrice }} | ||||
|               </el-form-item> | ||||
|             </el-col> | ||||
|             <el-col :span="12"> | ||||
|               <el-form-item label="数量"> | ||||
|                 {{ form?.listOfMaterialInventory[index].num }} | ||||
|               </el-form-item> | ||||
|             </el-col> | ||||
|             <el-col :span="12"> | ||||
|               <el-form-item label="合同号"> | ||||
|                 {{ form?.listOfMaterialInventory[index].contractNum }} | ||||
|               </el-form-item> | ||||
|             </el-col> | ||||
|             <el-col :span="12"> | ||||
|               <el-form-item label="预估供应周期"> | ||||
|                 {{ form?.listOfMaterialInventory[index].estimatedCycle }} | ||||
|               </el-form-item> | ||||
|             </el-col> | ||||
|             <el-col :span="12"> | ||||
|               <el-form-item label="供货公司"> | ||||
|                 {{ item }} | ||||
|               </el-form-item> | ||||
|             </el-col> | ||||
|           </el-row> | ||||
|         </el-form> | ||||
|       </div> | ||||
|     </el-dialog> | ||||
|   </div> | ||||
| </template> | ||||
|  | ||||
| <script setup name="Cailiaoshebei" lang="ts"> | ||||
| import { | ||||
|   listCailiaoshebei, | ||||
|   getCailiaoshebei, | ||||
|   delCailiaoshebei, | ||||
|   addCailiaoshebei, | ||||
|   updateCailiaoshebei, | ||||
|   listBatch, | ||||
|   getBatch, | ||||
|   delBatch | ||||
| } from '@/api/materials/suppliesprice'; | ||||
| import { CailiaoshebeiVO, CailiaoshebeiQuery, CailiaoshebeiForm } from '@/api/materials/suppliesprice/types'; | ||||
| import { listContractor } from '@/api/project/contractor'; | ||||
| import { useUserStoreHook } from '@/store/modules/user'; | ||||
|  | ||||
| const { proxy } = getCurrentInstance() as ComponentInternalInstance; | ||||
| const { supply } = toRefs<any>(proxy?.useDict('supply')); | ||||
| // 获取用户 store | ||||
| const userStore = useUserStoreHook(); | ||||
| // 从 store 中获取项目列表和当前选中的项目 | ||||
| const currentProject = computed(() => userStore.selectedProject); | ||||
| const batchTreeRef = ref<any>(null); | ||||
| const cailiaoshebeiList = ref<CailiaoshebeiVO[]>([]); | ||||
| const 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 batchOptions = ref<any[]>([]); | ||||
| const { wf_business_status } = toRefs<any>(proxy?.useDict('wf_business_status')); | ||||
|  | ||||
| const queryFormRef = ref<ElFormInstance>(); | ||||
| const cailiaoshebeiFormRef = ref<ElFormInstance>(); | ||||
| // 中间数组变量供 el-select 使用 | ||||
| const selectValue = ref<string[]>([]); | ||||
| const dialog = reactive<DialogOption>({ | ||||
|   visible: false, | ||||
|   details: false, | ||||
|  | ||||
|   title: '' | ||||
| }); | ||||
|  | ||||
| const initFormData: any = { | ||||
|   id: undefined, | ||||
|   batchNumber: undefined, | ||||
|   supplierId: undefined, | ||||
|   supplier: undefined, | ||||
|   name: undefined, | ||||
|   supply: undefined, | ||||
|   specification: undefined, | ||||
|   signalment: undefined, | ||||
|   approvalPlan: undefined, | ||||
|  | ||||
|   materialCode: undefined, | ||||
|   arrivalTime: undefined, | ||||
|   finishTime: undefined, | ||||
|   unit: undefined, | ||||
|   plan: undefined, | ||||
|   realQuantity: undefined, | ||||
|   projectId: currentProject.value.id, | ||||
|   approvalProject: undefined, | ||||
|  | ||||
|   listOfMaterialInventory: [], | ||||
|   remark: undefined | ||||
| }; | ||||
| const data = reactive<PageData<any, any>>({ | ||||
|   form: { ...initFormData }, | ||||
|   queryParams: { | ||||
|     pageNum: 1, | ||||
|     pageSize: 10, | ||||
|     batchNumber: undefined, | ||||
|     supplierId: undefined, | ||||
|     supplier: undefined, | ||||
|     name: undefined, | ||||
|     projectId: currentProject.value.id, | ||||
|     supply: undefined, | ||||
|     specification: undefined, | ||||
|     signalment: undefined, | ||||
|     materialCode: undefined, | ||||
|     arrivalTime: undefined, | ||||
|     finishTime: undefined, | ||||
|     unit: undefined, | ||||
|     plan: undefined, | ||||
|     realQuantity: undefined, | ||||
|     listOfMaterialInventory: [], | ||||
|     params: {} | ||||
|   }, | ||||
|   rules: { | ||||
|     id: [{ required: true, message: '主键ID不能为空', trigger: 'blur' }] | ||||
|   } | ||||
| }); | ||||
|  | ||||
| const { queryParams, form, rules } = toRefs(data); | ||||
|  | ||||
| /** 查询物资-材料设备列表 */ | ||||
| const getList = async () => { | ||||
|   loading.value = true; | ||||
|   const res = await listCailiaoshebei(queryParams.value); | ||||
|   cailiaoshebeiList.value = res.rows; | ||||
|  | ||||
|   loading.value = false; | ||||
| }; | ||||
|  | ||||
| //查询批次列表 | ||||
| const getBatchList = async () => { | ||||
|   const res = await listBatch(queryParams.value); | ||||
|   console.log('🚀 ~ getBatchList ~ res:', res); | ||||
|   batchOptions.value = res.rows; | ||||
|   total.value = res.total; | ||||
|   try { | ||||
|     batchTreeRef.value.setCurrentKey(res.rows[0].batchNumber); | ||||
|     form.value.batchNumber = res.rows[0].batchNumber; | ||||
|     form.value.approvalPlan = res.rows[0].approvalPlan; | ||||
|   } catch (error) { | ||||
|     form.value.batchNumber = ''; | ||||
|   } | ||||
|  | ||||
|   getList(); | ||||
| }; | ||||
|  | ||||
| /** 节点单击事件 */ | ||||
| const handleNodeClick = (data: any) => { | ||||
|   console.log('🚀 ~ handleNodeClick ~ data:', data); | ||||
|   queryParams.value.batchNumber = data.batchNumber; | ||||
|   form.value.batchNumber = data.batchNumber; | ||||
|   form.value.approvalPlan = data.approvalPlan; | ||||
|  | ||||
|   console.log('🚀 ~ handleNodeClick ~ form.value:', form.value); | ||||
|   if (data.batchNumber === '0') { | ||||
|     queryParams.value.batchNumber = ''; | ||||
|   } | ||||
|   getList(); | ||||
| }; | ||||
|  | ||||
| /** 取消按钮 */ | ||||
| const cancel = () => { | ||||
|   reset(); | ||||
|   dialog.visible = false; | ||||
| }; | ||||
|  | ||||
| /** 表单重置 */ | ||||
| const reset = () => { | ||||
|   const preservedBatchId = form.value.batchNumber; // 先保存当前的 batchNumber | ||||
|   form.value = { ...initFormData, batchNumber: preservedBatchId }; // 重置但保留 | ||||
|   cailiaoshebeiFormRef.value?.resetFields(); | ||||
|   selectValue.value = []; | ||||
| }; | ||||
|  | ||||
| /** 搜索按钮操作 */ | ||||
| const handleQuery = () => { | ||||
|   queryParams.value.pageNum = 1; | ||||
|   getList(); | ||||
| }; | ||||
|  | ||||
| /** 重置按钮操作 */ | ||||
| const resetQuery = () => { | ||||
|   queryFormRef.value?.resetFields(); | ||||
|   handleQuery(); | ||||
| }; | ||||
|  | ||||
| /** 多选框选中数据 */ | ||||
| const handleSelectionChange = (selection: CailiaoshebeiVO[]) => { | ||||
|   ids.value = selection.map((item) => item.id); | ||||
|   single.value = selection.length != 1; | ||||
|   multiple.value = !selection.length; | ||||
| }; | ||||
|  | ||||
| /** 修改按钮操作 */ | ||||
| const handleUpdate = async (row?: CailiaoshebeiVO) => { | ||||
|   reset(); | ||||
|   const _id = row?.id || ids.value[0]; | ||||
|   const res = await getCailiaoshebei(_id); | ||||
|   Object.assign(form.value, res.data); | ||||
|   selectValue.value = (form.value.supplier as string).split(','); | ||||
|  | ||||
|   if (!form.value.listOfMaterialInventory.length) { | ||||
|     form.value.listOfMaterialInventory = selectValue.value.map((item) => { | ||||
|       return { | ||||
|         supplierCompany: item, | ||||
|         estimatedCycle: '', | ||||
|         contractNum: '', | ||||
|         num: '', | ||||
|         unitPrice: '' | ||||
|       }; | ||||
|     }); | ||||
|   } | ||||
|   dialog.visible = true; | ||||
|   dialog.title = '修改物资供应总计划'; | ||||
| }; | ||||
|  | ||||
| /** 提交按钮 */ | ||||
| const submitForm = () => { | ||||
|   console.log('🚀 ~ submitForm ~ form.value:', form.value); | ||||
|   cailiaoshebeiFormRef.value?.validate(async (valid: boolean) => { | ||||
|     if (valid) { | ||||
|       buttonLoading.value = true; | ||||
|       await updateCailiaoshebei(form.value).finally(() => (buttonLoading.value = false)); | ||||
|       proxy?.$modal.msgSuccess('操作成功'); | ||||
|       dialog.visible = false; | ||||
|       await getList(); | ||||
|     } | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| /** 详情按钮操作 */ | ||||
| const handleDelete = async (row?: CailiaoshebeiVO) => { | ||||
|   reset(); | ||||
|   dialog.details = true; | ||||
|   const _id = row?.id || ids.value[0]; | ||||
|   const res = await getCailiaoshebei(_id); | ||||
|   Object.assign(form.value, res.data); | ||||
|   selectValue.value = (form.value.supplier as string).split(','); | ||||
|   if (!form.value.listOfMaterialInventory.length) { | ||||
|     form.value.listOfMaterialInventory = selectValue.value.map((item) => { | ||||
|       return { | ||||
|         supplierCompany: item, | ||||
|         estimatedCycle: '', | ||||
|         contractNum: '', | ||||
|         num: '', | ||||
|         unitPrice: '' | ||||
|       }; | ||||
|     }); | ||||
|   } | ||||
|   dialog.title = '物资供应总计划详情'; | ||||
| }; | ||||
|  | ||||
| /** 审核按钮操作 */ | ||||
| const handleAudit = async (row?: CailiaoshebeiVO) => { | ||||
|   const data = { | ||||
|     ...row, | ||||
|     approvalPlan: form.value.approvalPlan | ||||
|   }; | ||||
|   proxy?.$tab.openPage('/materials-management/suppliesprice/indexEdit', '审核物资供应总计划', { | ||||
|     id: row?.id, | ||||
|     data: JSON.stringify(data), | ||||
|     type: 'update' | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| /** 查询供货商列表 */ | ||||
| const supplierOptions = ref([]); | ||||
| const getSupplierList = async () => { | ||||
|   const res = await listContractor({ | ||||
|     projectId: currentProject.value.id, | ||||
|     pageNum: 1, | ||||
|     pageSize: 10000 | ||||
|   }); | ||||
|   supplierOptions.value = res.rows; | ||||
| }; | ||||
|  | ||||
| onMounted(() => { | ||||
|   getBatchList(); | ||||
|   getSupplierList(); | ||||
| }); | ||||
|  | ||||
| //监听项目id刷新数据 | ||||
| const listeningProject = watch( | ||||
|   () => currentProject.value.id, | ||||
|   (nid, oid) => { | ||||
|     queryParams.value.projectId = nid; | ||||
|     form.value.projectId = nid; | ||||
|     getBatchList(); | ||||
|     getSupplierList(); | ||||
|   } | ||||
| ); | ||||
|  | ||||
| onUnmounted(() => { | ||||
|   listeningProject(); | ||||
| }); | ||||
| </script> | ||||
| <style scoped lang="scss"> | ||||
| .block_box { | ||||
|   border: 1px solid #9eccfa; | ||||
|   border-radius: 6px; | ||||
|   padding: 10px 20px 20px 10px; | ||||
|   margin: 15px; | ||||
|  | ||||
|   > span { | ||||
|     color: #409eff; | ||||
|     font-weight: 700; | ||||
|     font-size: 14px; | ||||
|     margin-bottom: 10px; | ||||
|     display: block; | ||||
|   } | ||||
| } | ||||
| </style> | ||||
							
								
								
									
										401
									
								
								src/views/materials/suppliesprice/indexEdit.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										401
									
								
								src/views/materials/suppliesprice/indexEdit.vue
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,401 @@ | ||||
| <template> | ||||
|   <div class="p-4 bg-gray-50"> | ||||
|     <div class="max-w-4xl mx-auto"> | ||||
|       <!-- 顶部按钮区域 --> | ||||
|       <el-card class="mb-4 rounded-lg shadow-sm bg-white border border-gray-100 transition-all hover:shadow-md"> | ||||
|         <approvalButton | ||||
|           @submitForm="submitForm" | ||||
|           @approvalVerifyOpen="approvalVerifyOpen" | ||||
|           @handleApprovalRecord="handleApprovalRecord" | ||||
|           :buttonLoading="buttonLoading" | ||||
|           :id="form.id" | ||||
|           :status="form.approvalPlan" | ||||
|           :pageType="routeParams.type" | ||||
|         /> | ||||
|       </el-card> | ||||
|       <!-- 表单区域 --> | ||||
|       <el-card class="rounded-lg shadow-sm bg-white border border-gray-100 transition-all hover:shadow-md overflow-hidden"> | ||||
|         <div class="p-4 bg-gradient-to-r from-blue-50 to-indigo-50 border-b border-gray-100"> | ||||
|           <h3 class="text-lg font-semibold text-gray-800">施工产值</h3> | ||||
|         </div> | ||||
|         <div class="p-6"> | ||||
|           <el-form | ||||
|             ref="leaveFormRef" | ||||
|             v-loading="loading" | ||||
|             :disabled="routeParams.type === 'view'" | ||||
|             :model="form" | ||||
|             :rules="rules" | ||||
|             label-width="120px" | ||||
|             class="space-y-4" | ||||
|           > | ||||
|             <el-row :gutter="20" justify="center"> | ||||
|               <el-col :span="12" :offset="0"> | ||||
|                 <el-form-item label="计划到场时间" prop="arrivalTime"> | ||||
|                   <el-date-picker | ||||
|                     clearable | ||||
|                     v-model="form.arrivalTime" | ||||
|                     disabled | ||||
|                     type="date" | ||||
|                     value-format="YYYY-MM-DD" | ||||
|                     placeholder="请选择计划到场时间" | ||||
|                   > | ||||
|                   </el-date-picker> | ||||
|                 </el-form-item> | ||||
|                 <el-form-item label="计划完成时间" prop="finishTime"> | ||||
|                   <el-date-picker clearable v-model="form.finishTime" disabled type="date" value-format="YYYY-MM-DD" placeholder="请选择计划完成时间"> | ||||
|                   </el-date-picker> | ||||
|                 </el-form-item> | ||||
|                 <div v-for="(item, index) in selectValue" :key="index"> | ||||
|                   <el-divider content-position="center" | ||||
|                     ><el-text tag="b">{{ item }}</el-text></el-divider | ||||
|                   > | ||||
|                   <el-form-item label="单价" prop="unitPrice"> | ||||
|                     <el-input v-model="form.listOfMaterialInventory[index].unitPrice" type="number" disabled placeholder="请输入单价" /> | ||||
|                   </el-form-item> | ||||
|                   <el-form-item label="数量" prop="num"> | ||||
|                     <el-input v-model="form.listOfMaterialInventory[index].num" type="number" disabled placeholder="请输入数量" /> | ||||
|                   </el-form-item> | ||||
|                   <el-form-item label="合同号" prop="contractNum"> | ||||
|                     <el-input v-model="form.listOfMaterialInventory[index].contractNum" disabled placeholder="请输入合同号" /> | ||||
|                   </el-form-item> | ||||
|                   <el-form-item label="预估供应周期" prop="estimatedCycle"> | ||||
|                     <el-input v-model="form.listOfMaterialInventory[index].estimatedCycle" disabled type="number" placeholder="请输入预估供应周期" /> | ||||
|                   </el-form-item> | ||||
|                   <el-form-item label="供货公司" prop="supplierCompany"> | ||||
|                     <el-input v-model="form.listOfMaterialInventory[index].supplierCompany" disabled placeholder="请输入供货公司" /> | ||||
|                   </el-form-item> | ||||
|                 </div> | ||||
|               </el-col> | ||||
|             </el-row> | ||||
|           </el-form> | ||||
|         </div> | ||||
|       </el-card> | ||||
|       <!-- 提交组件 --> | ||||
|       <submitVerify ref="submitVerifyRef" :task-variables="taskVariables" @submit-callback="submitCallback" /> | ||||
|       <approvalRecord ref="approvalRecordRef"></approvalRecord> | ||||
|       <!-- 流程选择对话框 --> | ||||
|       <el-dialog | ||||
|         draggable | ||||
|         v-model="dialogVisible.visible" | ||||
|         :title="dialogVisible.title" | ||||
|         :before-close="handleClose" | ||||
|         width="500" | ||||
|         class="rounded-lg shadow-lg" | ||||
|       > | ||||
|         <div class="p-4"> | ||||
|           <p class="text-gray-600 mb-4">请选择要启动的流程:</p> | ||||
|           <el-select v-model="flowCode" placeholder="请选择流程" style="width: 100%"> | ||||
|             <el-option v-for="item in flowCodeOptions" :key="item.value" :label="item.label" :value="item.value" /> | ||||
|           </el-select> | ||||
|         </div> | ||||
|         <template #footer> | ||||
|           <div class="dialog-footer p-4 border-t border-gray-100 flex justify-end space-x-3"> | ||||
|             <el-button @click="handleClose" class="px-4 py-2 border border-gray-300 rounded-md text-gray-700 hover:bg-gray-50 transition-colors" | ||||
|               >取消</el-button | ||||
|             > | ||||
|             <el-button type="primary" @click="submitFlow()" class="px-4 py-2 bg-primary text-white rounded-md hover:bg-primary/90 transition-colors" | ||||
|               >确认</el-button | ||||
|             > | ||||
|           </div> | ||||
|         </template> | ||||
|       </el-dialog> | ||||
|     </div> | ||||
|   </div> | ||||
| </template> | ||||
|  | ||||
| <script setup name="Leave" lang="ts"> | ||||
| import { LeaveForm, LeaveQuery, LeaveVO } from '@/api/workflow/leave/types'; | ||||
| import { startWorkFlow } from '@/api/workflow/task'; | ||||
| import SubmitVerify from '@/components/Process/submitVerify.vue'; | ||||
| import ApprovalRecord from '@/components/Process/approvalRecord.vue'; | ||||
| import ApprovalButton from '@/components/Process/approvalButton.vue'; | ||||
| import { StartProcessBo } from '@/api/workflow/workflowCommon/types'; | ||||
| const { proxy } = getCurrentInstance() as ComponentInternalInstance; | ||||
| import { useUserStoreHook } from '@/store/modules/user'; | ||||
| const { design_change_reason_type } = toRefs<any>(proxy?.useDict('design_change_reason_type')); | ||||
| import { getKnowledgeDocument } from '@/api/design/technicalStandard'; | ||||
| import { getConstructionValue } from '@/api/out/constructionValue'; | ||||
| import { workScheduleListDetail } from '@/api/progress/plan'; | ||||
| import { getCailiaoshebei } from '@/api/materials/suppliesprice'; | ||||
| // 获取用户 store | ||||
| const userStore = useUserStoreHook(); | ||||
| // 从 store 中获取项目列表和当前选中的项目 | ||||
| const currentProject = computed(() => userStore.selectedProject); | ||||
| const buttonLoading = ref(false); | ||||
| const loading = ref(true); | ||||
| //路由参数 | ||||
| const routeParams = ref<Record<string, any>>({}); | ||||
| const flowCode = ref<string>(''); | ||||
| const status = ref<string>(''); | ||||
| const dialogVisible = reactive<DialogOption>({ | ||||
|   visible: false, | ||||
|   title: '流程定义' | ||||
| }); | ||||
| //提交组件 | ||||
| const submitVerifyRef = ref<InstanceType<typeof SubmitVerify>>(); | ||||
| //审批记录组件 | ||||
| const approvalRecordRef = ref<InstanceType<typeof ApprovalRecord>>(); | ||||
| //按钮组件 | ||||
| const flowCodeOptions = [ | ||||
|   { | ||||
|     value: currentProject.value?.id + '_materialsPlans', | ||||
|     label: '批次需求计划审批' | ||||
|   } | ||||
| ]; | ||||
|  | ||||
| const leaveFormRef = ref<ElFormInstance>(); | ||||
| const dialog = reactive({ | ||||
|   visible: false, | ||||
|   title: '', | ||||
|   isEdit: false | ||||
| }); | ||||
| const submitFormData = ref<StartProcessBo>({ | ||||
|   businessId: '', | ||||
|   flowCode: '', | ||||
|   variables: {} | ||||
| }); | ||||
| const taskVariables = ref<Record<string, any>>({}); | ||||
| const selectValue = ref<string[]>([]); | ||||
|  | ||||
| const initFormData = { | ||||
|   id: undefined, | ||||
|   batchNumber: undefined, | ||||
|   supplierId: undefined, | ||||
|   supplier: undefined, | ||||
|   name: undefined, | ||||
|   supply: undefined, | ||||
|   specification: undefined, | ||||
|   signalment: undefined, | ||||
|   materialCode: undefined, | ||||
|   arrivalTime: undefined, | ||||
|   finishTime: undefined, | ||||
|   unit: undefined, | ||||
|   plan: undefined, | ||||
|   realQuantity: undefined, | ||||
|   projectId: currentProject.value.id, | ||||
|   listOfMaterialInventory: [], | ||||
|   remark: undefined | ||||
| }; | ||||
| const data = reactive({ | ||||
|   form: { ...initFormData }, | ||||
|   rules: {} | ||||
| }); | ||||
|  | ||||
| const handleClose = () => { | ||||
|   dialogVisible.visible = false; | ||||
|   flowCode.value = ''; | ||||
|   buttonLoading.value = false; | ||||
| }; | ||||
| const { form, rules } = toRefs(data); | ||||
|  | ||||
| /** 表单重置 */ | ||||
| const reset = () => { | ||||
|   form.value = { ...initFormData }; | ||||
|   leaveFormRef.value?.resetFields(); | ||||
| }; | ||||
|  | ||||
| /** 获取详情 */ | ||||
| const getInfo = () => { | ||||
|   loading.value = true; | ||||
|   buttonLoading.value = false; | ||||
|   nextTick(async () => { | ||||
|     const res = JSON.parse(routeParams.value.data); | ||||
|     Object.assign(form.value, res.data); | ||||
|     selectValue.value = (form.value.supplier as string).split(','); | ||||
|     if (!form.value.listOfMaterialInventory.length) { | ||||
|       form.value.listOfMaterialInventory = selectValue.value.map((item) => { | ||||
|         return { | ||||
|           supplierCompany: item, | ||||
|           estimatedCycle: '', | ||||
|           contractNum: '', | ||||
|           num: '', | ||||
|           unitPrice: '' | ||||
|         }; | ||||
|       }); | ||||
|     } | ||||
|     loading.value = false; | ||||
|     buttonLoading.value = false; | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| /** 提交按钮 */ | ||||
| const submitForm = (status1: string) => { | ||||
|   status.value = status1; | ||||
|   submit(status.value, form.value); | ||||
| }; | ||||
|  | ||||
| const submitFlow = async () => { | ||||
|   handleStartWorkFlow(form.value); | ||||
|   dialogVisible.visible = false; | ||||
| }; | ||||
| //提交申请 | ||||
| const handleStartWorkFlow = async (data: LeaveForm) => { | ||||
|   try { | ||||
|     submitFormData.value.flowCode = flowCode.value; | ||||
|     submitFormData.value.businessId = data.id; | ||||
|     //流程变量 | ||||
|     taskVariables.value = { | ||||
|       // leave4/5 使用的流程变量 | ||||
|       userList: ['1', '3', '4'] | ||||
|     }; | ||||
|     submitFormData.value.variables = taskVariables.value; | ||||
|     const resp = await startWorkFlow(submitFormData.value); | ||||
|     if (submitVerifyRef.value) { | ||||
|       buttonLoading.value = false; | ||||
|       submitVerifyRef.value.openDialog(resp.data.taskId); | ||||
|     } | ||||
|   } finally { | ||||
|     buttonLoading.value = false; | ||||
|   } | ||||
| }; | ||||
| //审批记录 | ||||
| const handleApprovalRecord = () => { | ||||
|   approvalRecordRef.value.init(form.value.id); | ||||
| }; | ||||
| //提交回调 | ||||
| const submitCallback = async () => { | ||||
|   await proxy.$tab.closePage(proxy.$route); | ||||
|   proxy.$router.go(-1); | ||||
| }; | ||||
| //审批 | ||||
| const approvalVerifyOpen = async () => { | ||||
|   submitVerifyRef.value.openDialog(routeParams.value.taskId); | ||||
| }; | ||||
| // 图纸上传成功之后 开始提交 | ||||
| const submit = async (status, data) => { | ||||
|   form.value = data; | ||||
|   if (status === 'draft') { | ||||
|     buttonLoading.value = false; | ||||
|     proxy?.$modal.msgSuccess('暂存成功'); | ||||
|     proxy.$tab.closePage(proxy.$route); | ||||
|     proxy.$router.go(-1); | ||||
|   } else { | ||||
|     if ((form.value.approvalPlan === 'draft' && (flowCode.value === '' || flowCode.value === null)) || routeParams.value.type === 'add') { | ||||
|       flowCode.value = flowCodeOptions[0].value; | ||||
|       dialogVisible.visible = true; | ||||
|       return; | ||||
|     } | ||||
|     //说明启动过先随意穿个参数 | ||||
|     if (flowCode.value === '' || flowCode.value === null) { | ||||
|       flowCode.value = 'xx'; | ||||
|     } | ||||
|     await handleStartWorkFlow(data); | ||||
|   } | ||||
| }; | ||||
|  | ||||
| onMounted(() => { | ||||
|   nextTick(async () => { | ||||
|     routeParams.value = proxy.$route.query; | ||||
|     console.log('🚀 ~ proxy.$route.query:', proxy.$route.query); | ||||
|     reset(); | ||||
|     loading.value = false; | ||||
|     if (routeParams.value.type === 'update' || routeParams.value.type === 'view' || routeParams.value.type === 'approval') { | ||||
|       getInfo(); | ||||
|     } | ||||
|   }); | ||||
| }); | ||||
| </script> | ||||
| <style scoped lang="scss"> | ||||
| /* 全局样式 */ | ||||
| :root { | ||||
|   --primary: #409eff; | ||||
|   --primary-light: #66b1ff; | ||||
|   --primary-dark: #3a8ee6; | ||||
|   --success: #67c23a; | ||||
|   --warning: #e6a23c; | ||||
|   --danger: #f56c6c; | ||||
|   --info: #909399; | ||||
| } | ||||
|  | ||||
| /* 表单样式优化 */ | ||||
| .el-form-item { | ||||
|   .el-form-item__label { | ||||
|     color: #606266; | ||||
|     font-weight: 500; | ||||
|   } | ||||
|  | ||||
|   .el-input__inner, | ||||
|   .el-select .el-input__inner { | ||||
|     border-radius: 4px; | ||||
|     transition: | ||||
|       border-color 0.2s, | ||||
|       box-shadow 0.2s; | ||||
|  | ||||
|     &:focus { | ||||
|       border-color: var(--primary-light); | ||||
|       box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.1); | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   .el-textarea__inner { | ||||
|     border-radius: 4px; | ||||
|     transition: | ||||
|       border-color 0.2s, | ||||
|       box-shadow 0.2s; | ||||
|  | ||||
|     &:focus { | ||||
|       border-color: var(--primary-light); | ||||
|       box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.1); | ||||
|     } | ||||
|   } | ||||
| } | ||||
|  | ||||
| /* 按钮样式优化 */ | ||||
| .el-button { | ||||
|   border-radius: 4px; | ||||
|   transition: all 0.2s; | ||||
|  | ||||
|   &.is-primary { | ||||
|     background-color: var(--primary); | ||||
|     border-color: var(--primary); | ||||
|  | ||||
|     &:hover { | ||||
|       background-color: var(--primary-light); | ||||
|       border-color: var(--primary-light); | ||||
|     } | ||||
|  | ||||
|     &:active { | ||||
|       background-color: var(--primary-dark); | ||||
|       border-color: var(--primary-dark); | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   &.is-text { | ||||
|     color: var(--primary); | ||||
|  | ||||
|     &:hover { | ||||
|       color: var(--primary-light); | ||||
|       background-color: rgba(64, 158, 255, 0.05); | ||||
|     } | ||||
|   } | ||||
| } | ||||
|  | ||||
| /* 卡片样式优化 */ | ||||
| .el-card { | ||||
|   transition: all 0.3s ease; | ||||
|  | ||||
|   &:hover { | ||||
|     /* transform: translateY(-2px); */ | ||||
|   } | ||||
| } | ||||
|  | ||||
| /* 对话框样式优化 */ | ||||
| .el-dialog { | ||||
|   .el-dialog__header { | ||||
|     background-color: #f5f7fa; | ||||
|     border-bottom: 1px solid #ebeef5; | ||||
|     padding: 15px 20px; | ||||
|   } | ||||
|  | ||||
|   .el-dialog__title { | ||||
|     font-size: 16px; | ||||
|     font-weight: 600; | ||||
|     color: #303133; | ||||
|   } | ||||
|  | ||||
|   .el-dialog__footer { | ||||
|     padding: 15px 20px; | ||||
|     border-top: 1px solid #ebeef5; | ||||
|   } | ||||
| } | ||||
| </style> | ||||
							
								
								
									
										395
									
								
								src/views/out/constructionValue/index.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										395
									
								
								src/views/out/constructionValue/index.vue
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,395 @@ | ||||
| <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="reportDate"> | ||||
|               <el-date-picker clearable v-model="queryParams.reportDate" 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> | ||||
|             </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="['out:constructionValue:add']">新增</el-button> | ||||
|           </el-col> | ||||
|           <el-col :span="1.5"> | ||||
|             <el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['out:constructionValue:edit']" | ||||
|               >修改</el-button | ||||
|             > | ||||
|           </el-col> | ||||
|           <el-col :span="1.5"> | ||||
|             <el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['out:constructionValue:remove']" | ||||
|               >删除</el-button | ||||
|             > | ||||
|           </el-col> | ||||
|           <el-col :span="1.5"> | ||||
|             <el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['out:constructionValue:export']">导出</el-button> | ||||
|           </el-col> | ||||
|           <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> | ||||
|         </el-row> | ||||
|       </template> | ||||
|  | ||||
|       <el-table v-loading="loading" :data="constructionValueList" @selection-change="handleSelectionChange"> | ||||
|         <el-table-column type="selection" width="55" align="center" /> | ||||
|         <!-- <el-table-column label="主键ID" align="center" prop="id" v-if="true" /> --> | ||||
|         <el-table-column label="上报日期" align="center" prop="reportDate" width="180"> | ||||
|           <template #default="scope"> | ||||
|             <span>{{ parseTime(scope.row.reportDate, '{y}-{m}-{d}') }}</span> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <el-table-column label="项目子项" align="center" prop="subProjectName" /> | ||||
|         <el-table-column label="分部工程" align="center" prop="categoryName" /> | ||||
|         <el-table-column label="分项工程" align="center" prop="progressCategoryName" /> | ||||
|         <el-table-column label="人工填报数量" align="center" prop="artificialNum" /> | ||||
|         <el-table-column label="无人机识别数量" align="center" prop="uavNum" /> | ||||
|         <el-table-column label="确认数量" align="center" prop="confirmNum" /> | ||||
|         <el-table-column label="产值" align="center" prop="outValue" /> | ||||
|         <el-table-column label="流程状态" align="center" prop="status"> | ||||
|           <template #default="scope"> | ||||
|             <dict-tag :options="wf_business_status" :value="scope.row.auditStatus" /> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="210"> | ||||
|           <template #default="scope"> | ||||
|             <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['out:constructionValue:edit']">修改</el-button> | ||||
|             <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['out:constructionValue:remove']" | ||||
|               >删除</el-button | ||||
|             > | ||||
|             <el-button link type="primary" icon="Finished" @click="handleAudit(scope.row)" v-hasPermi="['out:constructionValue: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> | ||||
|     <!-- 添加或修改施工产值对话框 --> | ||||
|     <el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body> | ||||
|       <el-form ref="constructionValueFormRef" :model="form" :rules="rules" label-width="120px"> | ||||
|         <el-form-item label="方阵" prop="matrixId" v-if="!form.id"> | ||||
|           <el-cascader | ||||
|             :options="matrixOptions" | ||||
|             placeholder="请选择" | ||||
|             :props="{ value: 'matrixId', label: 'name', emitPath: false }" | ||||
|             v-model="form.matrixId" | ||||
|             @clear="resetCascader(1)" | ||||
|             @change="handleChange" | ||||
|             clearable | ||||
|           /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="分项工程" prop="progressCategoryId" v-if="!form.id"> | ||||
|           <el-cascader | ||||
|             :options="progressCategoryList" | ||||
|             v-model="form.progressCategoryId" | ||||
|             @clear="resetCascader()" | ||||
|             :disabled="!form.matrixId" | ||||
|             @change="selectTime" | ||||
|             :props="{ expandTrigger: 'hover', value: 'id', label: 'name', emitPath: false }" | ||||
|             placeholder="请选择分项工程" | ||||
|             clearable | ||||
|           > | ||||
|           </el-cascader> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="计划日期" prop="reportDateId" v-if="!form.id"> | ||||
|           <el-cascader | ||||
|             :options="progressTimeList" | ||||
|             v-model="form.reportDateId" | ||||
|             :disabled="!form.progressCategoryId" | ||||
|             :props="{ expandTrigger: 'hover', value: 'id', label: 'date', emitPath: false }" | ||||
|             placeholder="请选择计划日期" | ||||
|             @change="submitTime" | ||||
|             clearable | ||||
|           > | ||||
|           </el-cascader> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="人工填报数量" prop="artificialNum"> | ||||
|           <el-input v-model="form.artificialNum" placeholder="请输入人工填报数量" disabled /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="无人机识别数量" prop="uavNum"> | ||||
|           <el-input v-model="form.uavNum" placeholder="请输入无人机识别数量" disabled /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="上报日期" prop="planDate"> | ||||
|           <el-date-picker v-model="form.planDate" type="date" value-format="YYYY-MM-DD" placeholder="请选择上报日期" /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="确认数量" prop="confirmNum"> | ||||
|           <el-input v-model="form.confirmNum" placeholder="请输入确认数量" /> | ||||
|         </el-form-item> | ||||
|         <!-- <el-form-item label="产值" prop="outValue"> | ||||
|           <el-input v-model="form.outValue" disabled /> | ||||
|         </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="ConstructionValue" lang="ts"> | ||||
| import { | ||||
|   listConstructionValue, | ||||
|   getConstructionValue, | ||||
|   delConstructionValue, | ||||
|   addConstructionValue, | ||||
|   updateConstructionValue | ||||
| } from '@/api/out/constructionValue'; | ||||
| import { ConstructionValueVO, ConstructionValueQuery, ConstructionValueForm } from '@/api/out/constructionValue/types'; | ||||
| import { getProjectSquare, listProgressCategory, workScheduleList, workScheduleListDetail, workScheduleListPosition } from '@/api/progress/plan'; | ||||
| import { ProgressCategoryVO } from '@/api/progress/plan/types'; | ||||
|  | ||||
| const { proxy } = getCurrentInstance() as ComponentInternalInstance; | ||||
| import { useUserStoreHook } from '@/store/modules/user'; | ||||
| // 获取用户 store | ||||
| const userStore = useUserStoreHook(); | ||||
| // 从 store 中获取项目列表和当前选中的项目 | ||||
| const currentProject = computed(() => userStore.selectedProject); | ||||
| const constructionValueList = ref<ConstructionValueVO[]>([]); | ||||
| 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 matrixOptions = ref([]); | ||||
| const progressCategoryList = ref<ProgressCategoryVO[]>([]); | ||||
| const progressTimeList = ref<any[]>([]); | ||||
| const queryFormRef = ref<ElFormInstance>(); | ||||
| const constructionValueFormRef = ref<ElFormInstance>(); | ||||
| const { wf_business_status } = toRefs<any>(proxy?.useDict('wf_business_status')); | ||||
|  | ||||
| const dialog = reactive<DialogOption>({ | ||||
|   visible: false, | ||||
|   title: '' | ||||
| }); | ||||
|  | ||||
| const initFormData: ConstructionValueForm = { | ||||
|   id: undefined, | ||||
|   projectId: currentProject.value?.id, | ||||
|   matrixId: undefined, | ||||
|   progressCategoryId: undefined, | ||||
|   artificialNum: undefined, | ||||
|   planNum: undefined, | ||||
|   planDate: undefined, | ||||
|   uavNum: undefined, | ||||
|   confirmNum: undefined, | ||||
|   outValue: undefined, | ||||
|   reportDate: undefined, | ||||
|   reportDateId: undefined, | ||||
|   auditStatus: undefined | ||||
| }; | ||||
| const data = reactive<PageData<ConstructionValueForm, ConstructionValueQuery>>({ | ||||
|   form: { ...initFormData }, | ||||
|   queryParams: { | ||||
|     pageNum: 1, | ||||
|     pageSize: 10, | ||||
|     projectId: currentProject.value?.id, | ||||
|     matrixId: undefined, | ||||
|     progressCategoryId: undefined, | ||||
|     artificialNum: undefined, | ||||
|     uavNum: undefined, | ||||
|     confirmNum: undefined, | ||||
|     outValue: undefined, | ||||
|     reportDate: undefined, | ||||
|     auditStatus: undefined, | ||||
|     params: {} | ||||
|   }, | ||||
|   rules: { | ||||
|     id: [{ required: true, message: '主键ID不能为空', trigger: 'blur' }], | ||||
|     projectId: [{ required: true, message: '项目ID不能为空', trigger: 'blur' }], | ||||
|     matrixId: [{ required: true, message: '方阵id不能为空', trigger: 'blur' }], | ||||
|     progressCategoryId: [{ required: true, message: '分项工程不能为空', trigger: 'blur' }], | ||||
|     artificialNum: [{ required: true, message: '人工填报数量不能为空', trigger: 'blur' }], | ||||
|     reportDateId: [{ required: true, message: '上报日期不能为空', trigger: 'blur' }], | ||||
|     uavNum: [{ required: true, message: '无人机识别数量不能为空', trigger: 'blur' }], | ||||
|     confirmNum: [{ required: true, message: '确认数量不能为空', trigger: 'blur' }], | ||||
|     outValue: [{ required: true, message: '产值不能为空', trigger: 'blur' }] | ||||
|   } | ||||
| }); | ||||
|  | ||||
| const { queryParams, form, rules } = toRefs(data); | ||||
|  | ||||
| /** 查询施工产值列表 */ | ||||
| const getList = async () => { | ||||
|   loading.value = true; | ||||
|   const res = await listConstructionValue(queryParams.value); | ||||
|   constructionValueList.value = res.rows; | ||||
|   total.value = res.total; | ||||
|   loading.value = false; | ||||
| }; | ||||
|  | ||||
| /** 取消按钮 */ | ||||
| const cancel = () => { | ||||
|   reset(); | ||||
|   dialog.visible = false; | ||||
| }; | ||||
|  | ||||
| /** 表单重置 */ | ||||
| const reset = () => { | ||||
|   form.value = { ...initFormData }; | ||||
|   constructionValueFormRef.value?.resetFields(); | ||||
| }; | ||||
|  | ||||
| /** 搜索按钮操作 */ | ||||
| const handleQuery = () => { | ||||
|   queryParams.value.pageNum = 1; | ||||
|   getList(); | ||||
| }; | ||||
|  | ||||
| /** 重置按钮操作 */ | ||||
| const resetQuery = () => { | ||||
|   queryFormRef.value?.resetFields(); | ||||
|   handleQuery(); | ||||
| }; | ||||
|  | ||||
| /** 多选框选中数据 */ | ||||
| const handleSelectionChange = (selection: ConstructionValueVO[]) => { | ||||
|   ids.value = selection.map((item) => item.id); | ||||
|   single.value = selection.length != 1; | ||||
|   multiple.value = !selection.length; | ||||
| }; | ||||
|  | ||||
| /** 新增按钮操作 */ | ||||
| const handleAdd = async () => { | ||||
|   reset(); | ||||
|   const res = await getProjectSquare(currentProject.value.id); | ||||
|   if (res.data.length === 0) return proxy?.$modal.msgWarning('当前项目下没有方阵,请先创建方阵'); | ||||
|   const isFangzhen = res.data.some((item) => item.children && item.children.length); | ||||
|   console.log('🚀 ~ handleAdd ~ isFangzhen:', isFangzhen); | ||||
|  | ||||
|   if (!isFangzhen) return proxy?.$modal.msgWarning('当前项目下没有方阵,请先创建方阵'); | ||||
|   let matrixList = res.data.map((item) => { | ||||
|     return { | ||||
|       ...item, | ||||
|       matrixId: item?.projectId | ||||
|     }; | ||||
|   }); | ||||
|   matrixOptions.value = matrixList; | ||||
|   dialog.visible = true; | ||||
|   dialog.title = '添加施工产值'; | ||||
| }; | ||||
|  | ||||
| /** 方阵选择器改变事件 */ | ||||
| const handleChange = async (value: number) => { | ||||
|   queryParams.value.matrixId = value; | ||||
|   const res = await listProgressCategory(queryParams.value); | ||||
|   const data = proxy?.handleTree<ProgressCategoryVO>(res.data, 'id', 'pid'); | ||||
|   if (data) { | ||||
|     progressCategoryList.value = data; | ||||
|     console.log('🚀 ~ handleChange ~ progressCategoryList.value :', progressCategoryList.value); | ||||
|   } | ||||
| }; | ||||
|  | ||||
| /** 分项工程选择器改变事件 */ | ||||
| const selectTime = async (value: string) => { | ||||
|   const res = await workScheduleListDetail(value); | ||||
|   console.log('🚀 ~ selectTime ~ res:', res); | ||||
|   progressTimeList.value = res.rows; | ||||
| }; | ||||
|  | ||||
| /** 上报日期选择器改变事件 */ | ||||
| const submitTime = async (value: string) => { | ||||
|   const data = progressTimeList.value.filter((item) => item.id === value)[0]; | ||||
|   console.log(data); | ||||
|   form.value.uavNum = data?.aiFill; | ||||
|   form.value.reportDate = data?.date; | ||||
|   form.value.planNum = data?.planNumber; | ||||
|   form.value.artificialNum = data?.finishedNumber; | ||||
| }; | ||||
|  | ||||
| /** 重置选择器 */ | ||||
| const resetCascader = (index?: number) => { | ||||
|   if (index) { | ||||
|     form.value.progressCategoryId = undefined; | ||||
|   } | ||||
|   form.value.reportDate = undefined; | ||||
| }; | ||||
|  | ||||
| /** 修改按钮操作 */ | ||||
| const handleUpdate = async (row?: ConstructionValueVO) => { | ||||
|   reset(); | ||||
|   const _id = row?.id || ids.value[0]; | ||||
|   const res = await getConstructionValue(_id); | ||||
|   Object.assign(form.value, res.data); | ||||
|   dialog.visible = true; | ||||
|   dialog.title = '修改施工产值'; | ||||
| }; | ||||
|  | ||||
| /** 提交按钮 */ | ||||
| const submitForm = () => { | ||||
|   constructionValueFormRef.value?.validate(async (valid: boolean) => { | ||||
|     if (valid) { | ||||
|       buttonLoading.value = true; | ||||
|       if (form.value.id) { | ||||
|         await updateConstructionValue(form.value).finally(() => (buttonLoading.value = false)); | ||||
|       } else { | ||||
|         console.log('🚀 ~ submitForm ~ form.value :', form.value); | ||||
|         await addConstructionValue(form.value).finally(() => (buttonLoading.value = false)); | ||||
|       } | ||||
|       proxy?.$modal.msgSuccess('操作成功'); | ||||
|       dialog.visible = false; | ||||
|       await getList(); | ||||
|     } | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| /** 删除按钮操作 */ | ||||
| const handleDelete = async (row?: ConstructionValueVO) => { | ||||
|   const _ids = row?.id || ids.value; | ||||
|   await proxy?.$modal.confirm('是否确认删除施工产值编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false)); | ||||
|   await delConstructionValue(_ids); | ||||
|   proxy?.$modal.msgSuccess('删除成功'); | ||||
|   await getList(); | ||||
| }; | ||||
|  | ||||
| /** 审核按钮操作 */ | ||||
| const handleAudit = async (row?: ConstructionValueVO) => { | ||||
|   proxy?.$tab.openPage('/out/constructionValue/indexEdit', '审核施工产值', { | ||||
|     id: row?.id, | ||||
|     type: 'update' | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| /** 导出按钮操作 */ | ||||
| const handleExport = () => { | ||||
|   proxy?.download( | ||||
|     'out/constructionValue/export', | ||||
|     { | ||||
|       ...queryParams.value | ||||
|     }, | ||||
|     `constructionValue_${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> | ||||
							
								
								
									
										384
									
								
								src/views/out/constructionValue/indexEdit.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										384
									
								
								src/views/out/constructionValue/indexEdit.vue
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,384 @@ | ||||
| <template> | ||||
|   <div class="p-4 bg-gray-50"> | ||||
|     <div class="max-w-4xl mx-auto"> | ||||
|       <!-- 顶部按钮区域 --> | ||||
|       <el-card class="mb-4 rounded-lg shadow-sm bg-white border border-gray-100 transition-all hover:shadow-md"> | ||||
|         <approvalButton | ||||
|           @submitForm="submitForm" | ||||
|           @approvalVerifyOpen="approvalVerifyOpen" | ||||
|           @handleApprovalRecord="handleApprovalRecord" | ||||
|           :buttonLoading="buttonLoading" | ||||
|           :id="form.id" | ||||
|           :status="form.auditStatus" | ||||
|           :pageType="routeParams.type" | ||||
|         /> | ||||
|       </el-card> | ||||
|       <!-- 表单区域 --> | ||||
|       <el-card class="rounded-lg shadow-sm bg-white border border-gray-100 transition-all hover:shadow-md overflow-hidden"> | ||||
|         <div class="p-4 bg-gradient-to-r from-blue-50 to-indigo-50 border-b border-gray-100"> | ||||
|           <h3 class="text-lg font-semibold text-gray-800">施工产值</h3> | ||||
|         </div> | ||||
|         <div class="p-6"> | ||||
|           <el-form | ||||
|             ref="leaveFormRef" | ||||
|             v-loading="loading" | ||||
|             :disabled="routeParams.type === 'view'" | ||||
|             :model="form" | ||||
|             :rules="rules" | ||||
|             label-width="120px" | ||||
|             class="space-y-4" | ||||
|           > | ||||
|             <div class="grid grid-cols-1 gap-4"> | ||||
|               <el-row :gutter="20" justify="center"> | ||||
|                 <el-col :span="13" :offset="0"> | ||||
|                   <el-form-item label="方阵" prop="matrixName"> | ||||
|                     <el-input v-model="form.matrixName" clearable disabled></el-input> | ||||
|                   </el-form-item> | ||||
|                 </el-col> | ||||
|  | ||||
|                 <el-col :span="13" :offset="0"> | ||||
|                   <el-form-item label="分项工程" prop="progressCategoryName"> | ||||
|                     <el-input v-model="form.progressCategoryName" disabled></el-input> | ||||
|                   </el-form-item> | ||||
|                 </el-col> | ||||
|                 <el-col :span="13" :offset="0"> | ||||
|                   <el-form-item label="计划日期" prop="planDate"> | ||||
|                     <el-input v-model="form.planDate" disabled></el-input> | ||||
|                   </el-form-item> | ||||
|                 </el-col> | ||||
|                 <el-col :span="13" :offset="0"> | ||||
|                   <el-form-item label="人工填报数量" prop="artificialNum"> | ||||
|                     <el-input v-model="form.artificialNum" placeholder="请输入人工填报数量" disabled /> | ||||
|                   </el-form-item> | ||||
|                 </el-col> | ||||
|                 <el-col :span="13" :offset="0"> | ||||
|                   <el-form-item label="无人机识别数量" prop="uavNum"> | ||||
|                     <el-input v-model="form.uavNum" placeholder="请输入无人机识别数量" disabled /> | ||||
|                   </el-form-item> | ||||
|                 </el-col> | ||||
|                 <el-col :span="13" :offset="0"> | ||||
|                   <el-form-item label="上报日期" prop="planDate"> | ||||
|                     <el-date-picker v-model="form.planDate" type="date" value-format="YYYY-MM-DD" disabled placeholder="请选择上报日期" /> | ||||
|                   </el-form-item> | ||||
|                 </el-col> | ||||
|                 <el-col :span="13" :offset="0"> | ||||
|                   <el-form-item label="确认数量" prop="confirmNum"> | ||||
|                     <el-input v-model="form.confirmNum" placeholder="请输入确认数量" disabled /> | ||||
|                   </el-form-item> | ||||
|                 </el-col> | ||||
|               </el-row> | ||||
|             </div> | ||||
|           </el-form> | ||||
|         </div> | ||||
|       </el-card> | ||||
|       <!-- 提交组件 --> | ||||
|       <submitVerify ref="submitVerifyRef" :task-variables="taskVariables" @submit-callback="submitCallback" /> | ||||
|       <approvalRecord ref="approvalRecordRef"></approvalRecord> | ||||
|       <!-- 流程选择对话框 --> | ||||
|       <el-dialog | ||||
|         draggable | ||||
|         v-model="dialogVisible.visible" | ||||
|         :title="dialogVisible.title" | ||||
|         :before-close="handleClose" | ||||
|         width="500" | ||||
|         class="rounded-lg shadow-lg" | ||||
|       > | ||||
|         <div class="p-4"> | ||||
|           <p class="text-gray-600 mb-4">请选择要启动的流程:</p> | ||||
|           <el-select v-model="flowCode" placeholder="请选择流程" style="width: 100%"> | ||||
|             <el-option v-for="item in flowCodeOptions" :key="item.value" :label="item.label" :value="item.value" /> | ||||
|           </el-select> | ||||
|         </div> | ||||
|         <template #footer> | ||||
|           <div class="dialog-footer p-4 border-t border-gray-100 flex justify-end space-x-3"> | ||||
|             <el-button @click="handleClose" class="px-4 py-2 border border-gray-300 rounded-md text-gray-700 hover:bg-gray-50 transition-colors" | ||||
|               >取消</el-button | ||||
|             > | ||||
|             <el-button type="primary" @click="submitFlow()" class="px-4 py-2 bg-primary text-white rounded-md hover:bg-primary/90 transition-colors" | ||||
|               >确认</el-button | ||||
|             > | ||||
|           </div> | ||||
|         </template> | ||||
|       </el-dialog> | ||||
|     </div> | ||||
|   </div> | ||||
| </template> | ||||
|  | ||||
| <script setup name="Leave" lang="ts"> | ||||
| import { LeaveForm, LeaveQuery, LeaveVO } from '@/api/workflow/leave/types'; | ||||
| import { startWorkFlow } from '@/api/workflow/task'; | ||||
| import SubmitVerify from '@/components/Process/submitVerify.vue'; | ||||
| import ApprovalRecord from '@/components/Process/approvalRecord.vue'; | ||||
| import ApprovalButton from '@/components/Process/approvalButton.vue'; | ||||
| import { StartProcessBo } from '@/api/workflow/workflowCommon/types'; | ||||
| const { proxy } = getCurrentInstance() as ComponentInternalInstance; | ||||
| import { useUserStoreHook } from '@/store/modules/user'; | ||||
| const { design_change_reason_type } = toRefs<any>(proxy?.useDict('design_change_reason_type')); | ||||
| import { getKnowledgeDocument } from '@/api/design/technicalStandard'; | ||||
| import { getConstructionValue } from '@/api/out/constructionValue'; | ||||
| import { workScheduleListDetail } from '@/api/progress/plan'; | ||||
| // 获取用户 store | ||||
| const userStore = useUserStoreHook(); | ||||
| // 从 store 中获取项目列表和当前选中的项目 | ||||
| const currentProject = computed(() => userStore.selectedProject); | ||||
| const buttonLoading = ref(false); | ||||
| const loading = ref(true); | ||||
| //路由参数 | ||||
| const routeParams = ref<Record<string, any>>({}); | ||||
| const flowCode = ref<string>(''); | ||||
| const status = ref<string>(''); | ||||
| const dialogVisible = reactive<DialogOption>({ | ||||
|   visible: false, | ||||
|   title: '流程定义' | ||||
| }); | ||||
| //提交组件 | ||||
| const submitVerifyRef = ref<InstanceType<typeof SubmitVerify>>(); | ||||
| //审批记录组件 | ||||
| const approvalRecordRef = ref<InstanceType<typeof ApprovalRecord>>(); | ||||
| //按钮组件 | ||||
| const flowCodeOptions = [ | ||||
|   { | ||||
|     value: currentProject.value?.id + '_constructionValue', | ||||
|     label: '施工产值审批' | ||||
|   } | ||||
| ]; | ||||
|  | ||||
| const leaveFormRef = ref<ElFormInstance>(); | ||||
| const dialog = reactive({ | ||||
|   visible: false, | ||||
|   title: '', | ||||
|   isEdit: false | ||||
| }); | ||||
| const submitFormData = ref<StartProcessBo>({ | ||||
|   businessId: '', | ||||
|   flowCode: '', | ||||
|   variables: {} | ||||
| }); | ||||
| const taskVariables = ref<Record<string, any>>({}); | ||||
|  | ||||
| const initFormData = { | ||||
|   id: undefined, | ||||
|   projectId: currentProject.value?.id, | ||||
|   matrixName: undefined, | ||||
|   progressCategoryName: undefined, | ||||
|   artificialNum: undefined, | ||||
|   planNum: undefined, | ||||
|   planDate: undefined, | ||||
|   uavNum: undefined, | ||||
|   confirmNum: undefined, | ||||
|   outValue: undefined, | ||||
|   reportDate: undefined, | ||||
|   reportDateId: undefined, | ||||
|   auditStatus: undefined | ||||
| }; | ||||
| const data = reactive({ | ||||
|   form: { ...initFormData }, | ||||
|   rules: {} | ||||
| }); | ||||
|  | ||||
| const handleClose = () => { | ||||
|   dialogVisible.visible = false; | ||||
|   flowCode.value = ''; | ||||
|   buttonLoading.value = false; | ||||
| }; | ||||
| const { form, rules } = toRefs(data); | ||||
|  | ||||
| /** 表单重置 */ | ||||
| const reset = () => { | ||||
|   form.value = { ...initFormData }; | ||||
|   leaveFormRef.value?.resetFields(); | ||||
| }; | ||||
|  | ||||
| /** 获取详情 */ | ||||
| const getInfo = () => { | ||||
|   loading.value = true; | ||||
|   buttonLoading.value = false; | ||||
|   nextTick(async () => { | ||||
|     const res = await getConstructionValue(routeParams.value.id); | ||||
|     Object.assign(form.value, res.data); | ||||
|     loading.value = false; | ||||
|     buttonLoading.value = false; | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| /** 提交按钮 */ | ||||
| const submitForm = (status1: string) => { | ||||
|   status.value = status1; | ||||
|   submit(status.value, form.value); | ||||
| }; | ||||
|  | ||||
| const submitFlow = async () => { | ||||
|   handleStartWorkFlow(form.value); | ||||
|   dialogVisible.visible = false; | ||||
| }; | ||||
| //提交申请 | ||||
| const handleStartWorkFlow = async (data: LeaveForm) => { | ||||
|   try { | ||||
|     submitFormData.value.flowCode = flowCode.value; | ||||
|     submitFormData.value.businessId = data.id; | ||||
|     //流程变量 | ||||
|     taskVariables.value = { | ||||
|       // leave4/5 使用的流程变量 | ||||
|       userList: ['1', '3', '4'] | ||||
|     }; | ||||
|     submitFormData.value.variables = taskVariables.value; | ||||
|     const resp = await startWorkFlow(submitFormData.value); | ||||
|     if (submitVerifyRef.value) { | ||||
|       buttonLoading.value = false; | ||||
|       submitVerifyRef.value.openDialog(resp.data.taskId); | ||||
|     } | ||||
|   } finally { | ||||
|     buttonLoading.value = false; | ||||
|   } | ||||
| }; | ||||
| //审批记录 | ||||
| const handleApprovalRecord = () => { | ||||
|   approvalRecordRef.value.init(form.value.id); | ||||
| }; | ||||
| //提交回调 | ||||
| const submitCallback = async () => { | ||||
|   await proxy.$tab.closePage(proxy.$route); | ||||
|   proxy.$router.go(-1); | ||||
| }; | ||||
| //审批 | ||||
| const approvalVerifyOpen = async () => { | ||||
|   submitVerifyRef.value.openDialog(routeParams.value.taskId); | ||||
| }; | ||||
| // 图纸上传成功之后 开始提交 | ||||
| const submit = async (status, data) => { | ||||
|   form.value = data; | ||||
|   if (status === 'draft') { | ||||
|     buttonLoading.value = false; | ||||
|     proxy?.$modal.msgSuccess('暂存成功'); | ||||
|     proxy.$tab.closePage(proxy.$route); | ||||
|     proxy.$router.go(-1); | ||||
|   } else { | ||||
|     if ((form.value.auditStatus === 'draft' && (flowCode.value === '' || flowCode.value === null)) || routeParams.value.type === 'add') { | ||||
|       flowCode.value = flowCodeOptions[0].value; | ||||
|       dialogVisible.visible = true; | ||||
|       return; | ||||
|     } | ||||
|     //说明启动过先随意穿个参数 | ||||
|     if (flowCode.value === '' || flowCode.value === null) { | ||||
|       flowCode.value = 'xx'; | ||||
|     } | ||||
|     await handleStartWorkFlow(data); | ||||
|   } | ||||
| }; | ||||
|  | ||||
| onMounted(() => { | ||||
|   nextTick(async () => { | ||||
|     routeParams.value = proxy.$route.query; | ||||
|     console.log('🚀 ~ proxy.$route.query:', proxy.$route.query); | ||||
|     reset(); | ||||
|     loading.value = false; | ||||
|     if (routeParams.value.type === 'update' || routeParams.value.type === 'view' || routeParams.value.type === 'approval') { | ||||
|       getInfo(); | ||||
|     } | ||||
|   }); | ||||
| }); | ||||
| </script> | ||||
| <style scoped lang="scss"> | ||||
| /* 全局样式 */ | ||||
| :root { | ||||
|   --primary: #409eff; | ||||
|   --primary-light: #66b1ff; | ||||
|   --primary-dark: #3a8ee6; | ||||
|   --success: #67c23a; | ||||
|   --warning: #e6a23c; | ||||
|   --danger: #f56c6c; | ||||
|   --info: #909399; | ||||
| } | ||||
|  | ||||
| /* 表单样式优化 */ | ||||
| .el-form-item { | ||||
|   .el-form-item__label { | ||||
|     color: #606266; | ||||
|     font-weight: 500; | ||||
|   } | ||||
|  | ||||
|   .el-input__inner, | ||||
|   .el-select .el-input__inner { | ||||
|     border-radius: 4px; | ||||
|     transition: | ||||
|       border-color 0.2s, | ||||
|       box-shadow 0.2s; | ||||
|  | ||||
|     &:focus { | ||||
|       border-color: var(--primary-light); | ||||
|       box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.1); | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   .el-textarea__inner { | ||||
|     border-radius: 4px; | ||||
|     transition: | ||||
|       border-color 0.2s, | ||||
|       box-shadow 0.2s; | ||||
|  | ||||
|     &:focus { | ||||
|       border-color: var(--primary-light); | ||||
|       box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.1); | ||||
|     } | ||||
|   } | ||||
| } | ||||
|  | ||||
| /* 按钮样式优化 */ | ||||
| .el-button { | ||||
|   border-radius: 4px; | ||||
|   transition: all 0.2s; | ||||
|  | ||||
|   &.is-primary { | ||||
|     background-color: var(--primary); | ||||
|     border-color: var(--primary); | ||||
|  | ||||
|     &:hover { | ||||
|       background-color: var(--primary-light); | ||||
|       border-color: var(--primary-light); | ||||
|     } | ||||
|  | ||||
|     &:active { | ||||
|       background-color: var(--primary-dark); | ||||
|       border-color: var(--primary-dark); | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   &.is-text { | ||||
|     color: var(--primary); | ||||
|  | ||||
|     &:hover { | ||||
|       color: var(--primary-light); | ||||
|       background-color: rgba(64, 158, 255, 0.05); | ||||
|     } | ||||
|   } | ||||
| } | ||||
|  | ||||
| /* 卡片样式优化 */ | ||||
| .el-card { | ||||
|   transition: all 0.3s ease; | ||||
|  | ||||
|   &:hover { | ||||
|     /* transform: translateY(-2px); */ | ||||
|   } | ||||
| } | ||||
|  | ||||
| /* 对话框样式优化 */ | ||||
| .el-dialog { | ||||
|   .el-dialog__header { | ||||
|     background-color: #f5f7fa; | ||||
|     border-bottom: 1px solid #ebeef5; | ||||
|     padding: 15px 20px; | ||||
|   } | ||||
|  | ||||
|   .el-dialog__title { | ||||
|     font-size: 16px; | ||||
|     font-weight: 600; | ||||
|     color: #303133; | ||||
|   } | ||||
|  | ||||
|   .el-dialog__footer { | ||||
|     padding: 15px 20px; | ||||
|     border-top: 1px solid #ebeef5; | ||||
|   } | ||||
| } | ||||
| </style> | ||||
							
								
								
									
										292
									
								
								src/views/out/designCompletion/index.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										292
									
								
								src/views/out/designCompletion/index.vue
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,292 @@ | ||||
| <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="planMonth"> | ||||
|               <el-date-picker v-model="queryParams.planMonth" type="month" value-format="YYYY-MM" 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> | ||||
|             </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="['out:monthPlan:add']">新增</el-button> | ||||
|           </el-col> | ||||
|           <!-- <el-col :span="1.5"> | ||||
|             <el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['out:monthPlan:edit']" | ||||
|               >修改</el-button | ||||
|             > | ||||
|           </el-col> | ||||
|           <el-col :span="1.5"> | ||||
|             <el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['out:monthPlan:remove']" | ||||
|               >删除</el-button | ||||
|             > | ||||
|           </el-col> | ||||
|           <el-col :span="1.5"> | ||||
|             <el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['out:monthPlan:export']">导出</el-button> | ||||
|           </el-col> --> | ||||
|           <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> | ||||
|         </el-row> | ||||
|       </template> | ||||
|  | ||||
|       <el-table v-loading="loading" :data="monthPlanList" @selection-change="handleSelectionChange"> | ||||
|         <el-table-column type="selection" width="55" align="center" /> | ||||
|         <el-table-column label="计划月份" align="center" prop="planMonth" /> | ||||
|         <el-table-column label="计划产值" align="center" prop="planValue" /> | ||||
|         <el-table-column label="完成产值" align="center" prop="completeValue" /> | ||||
|         <el-table-column label="差额" align="center" prop="differenceValue" /> | ||||
|         <el-table-column label="产值类型" align="center" prop="valueType"> | ||||
|           <template #default="scope"> | ||||
|             <dict-tag :options="out_value_type" :value="scope.row.valueType" /> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <el-table-column label="流程状态" align="center" prop="status"> | ||||
|           <template #default="scope"> | ||||
|             <dict-tag :options="wf_business_status" :value="scope.row.completeAuditStatus" /> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="210"> | ||||
|           <template #default="scope"> | ||||
|             <el-button link type="primary" icon="Finished" @click="handleAudit(scope.row)" v-hasPermi="['out:constructionValue: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> | ||||
|     <!-- 添加或修改月度产值计划对话框 --> | ||||
|     <el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body> | ||||
|       <el-form ref="monthPlanFormRef" :model="form" :rules="rules" label-width="80px"> | ||||
|         <el-form-item label="所属项目" prop="projectId"> | ||||
|           <el-select v-model="form.projectId" placeholder="请选择所属项目"> | ||||
|             <el-option v-for="item in projectList" :key="item.id" :label="item.name" :value="item.id" /> | ||||
|           </el-select> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="计划月份" prop="planMonth"> | ||||
|           <el-date-picker v-model="form.planMonth" type="month" value-format="YYYY-MM" placeholder="请选择计划月份" @change="handlePlanMonthChange" /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="计划产值" prop="planValue"> | ||||
|           <el-input v-model="form.planValue" placeholder="请输入计划产值" disabled /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="完成产值" prop="completeValue"> | ||||
|           <el-input v-model="form.completeValue" 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="MonthPlan" lang="ts"> | ||||
| import { listMonthPlan, getMonthPlan, delMonthPlan, addMonthPlan, updateMonthPlan, getMonth } from '@/api/out/monthPlan'; | ||||
| import { MonthPlanVO, MonthPlanQuery, MonthPlanForm } from '@/api/out/monthPlan/types'; | ||||
| const { proxy } = getCurrentInstance() as ComponentInternalInstance; | ||||
| const { out_value_type } = toRefs<any>(proxy?.useDict('out_value_type')); | ||||
| const { wf_business_status } = toRefs<any>(proxy?.useDict('wf_business_status')); | ||||
|  | ||||
| import { useUserStoreHook } from '@/store/modules/user'; | ||||
| // 获取用户 store | ||||
| const userStore = useUserStoreHook(); | ||||
| // 从 store 中获取项目列表和当前选中的项目 | ||||
| const currentProject = computed(() => userStore.selectedProject); | ||||
| const projectList = computed(() => userStore.projects); | ||||
| const monthPlanList = ref<MonthPlanVO[]>([]); | ||||
| 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 monthPlanFormRef = ref<ElFormInstance>(); | ||||
|  | ||||
| const dialog = reactive<DialogOption>({ | ||||
|   visible: false, | ||||
|   title: '' | ||||
| }); | ||||
|  | ||||
| const initFormData: MonthPlanForm = { | ||||
|   id: undefined, | ||||
|   projectId: currentProject.value?.id, | ||||
|   planValue: undefined, | ||||
|   completeValue: undefined, | ||||
|   differenceValue: undefined, | ||||
|   planMonth: undefined, | ||||
|   valueType: '1', | ||||
|   planAuditStatus: undefined, | ||||
|   completeAuditStatus: undefined | ||||
| }; | ||||
| const data = reactive<PageData<MonthPlanForm, MonthPlanQuery>>({ | ||||
|   form: { ...initFormData }, | ||||
|   queryParams: { | ||||
|     pageNum: 1, | ||||
|     pageSize: 10, | ||||
|     projectId: undefined, | ||||
|     planValue: undefined, | ||||
|     completeValue: undefined, | ||||
|     differenceValue: undefined, | ||||
|     planMonth: undefined, | ||||
|     valueType: '1', | ||||
|     planAuditStatus: undefined, | ||||
|     completeAuditStatus: undefined, | ||||
|     params: {} | ||||
|   }, | ||||
|   rules: { | ||||
|     id: [{ required: true, message: '主键ID不能为空', trigger: 'blur' }], | ||||
|     projectId: [{ required: true, message: '项目ID不能为空', trigger: 'blur' }], | ||||
|     planValue: [{ required: true, message: '计划产值不能为空', trigger: 'blur' }], | ||||
|     planMonth: [{ required: true, message: '计划月份不能为空', trigger: 'blur' }], | ||||
|     valueType: [{ required: true, message: '1-设计 2-采购 3-施工不能为空', trigger: 'change' }] | ||||
|   } | ||||
| }); | ||||
|  | ||||
| const { queryParams, form, rules } = toRefs(data); | ||||
|  | ||||
| /** 查询月度产值计划列表 */ | ||||
| const getList = async () => { | ||||
|   loading.value = true; | ||||
|   const res = await listMonthPlan(queryParams.value); | ||||
|   monthPlanList.value = res.rows; | ||||
|   total.value = res.total; | ||||
|   loading.value = false; | ||||
| }; | ||||
|  | ||||
| /** 取消按钮 */ | ||||
| const cancel = () => { | ||||
|   reset(); | ||||
|   dialog.visible = false; | ||||
| }; | ||||
|  | ||||
| /** 表单重置 */ | ||||
| const reset = () => { | ||||
|   form.value = { ...initFormData }; | ||||
|   monthPlanFormRef.value?.resetFields(); | ||||
| }; | ||||
|  | ||||
| /** 搜索按钮操作 */ | ||||
| const handleQuery = () => { | ||||
|   queryParams.value.pageNum = 1; | ||||
|   getList(); | ||||
| }; | ||||
|  | ||||
| /** 重置按钮操作 */ | ||||
| const resetQuery = () => { | ||||
|   queryFormRef.value?.resetFields(); | ||||
|   handleQuery(); | ||||
| }; | ||||
|  | ||||
| /** 多选框选中数据 */ | ||||
| const handleSelectionChange = (selection: MonthPlanVO[]) => { | ||||
|   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?: MonthPlanVO) => { | ||||
|   reset(); | ||||
|   const _id = row?.id || ids.value[0]; | ||||
|   const res = await getMonthPlan(_id); | ||||
|   Object.assign(form.value, res.data); | ||||
|   dialog.visible = true; | ||||
|   dialog.title = '修改设计完工产值'; | ||||
| }; | ||||
|  | ||||
| /** 提交按钮 */ | ||||
| const submitForm = () => { | ||||
|   monthPlanFormRef.value?.validate(async (valid: boolean) => { | ||||
|     if (valid) { | ||||
|       buttonLoading.value = true; | ||||
|       await updateMonthPlan(form.value).finally(() => (buttonLoading.value = false)); | ||||
|       proxy?.$modal.msgSuccess('操作成功'); | ||||
|       dialog.visible = false; | ||||
|       await getList(); | ||||
|     } | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| /** 删除按钮操作 */ | ||||
| const handleDelete = async (row?: MonthPlanVO) => { | ||||
|   const _ids = row?.id || ids.value; | ||||
|   await proxy?.$modal.confirm('是否确认删除月度产值计划编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false)); | ||||
|   await delMonthPlan(_ids); | ||||
|   proxy?.$modal.msgSuccess('删除成功'); | ||||
|   await getList(); | ||||
| }; | ||||
|  | ||||
| /** 计划月份改变 */ | ||||
| const handlePlanMonthChange = async (val: string) => { | ||||
|   const res = await getMonth({ | ||||
|     projectId: form.value.projectId, | ||||
|     planMonth: val, | ||||
|     valueType: form.value.valueType | ||||
|   }); | ||||
|   if (!res.data) return proxy?.$modal.msgError('该月份未计划'); | ||||
|   form.value.planValue = res.data.planValue; | ||||
|   form.value.id = res.data.id; | ||||
|   console.log(res); | ||||
| }; | ||||
|  | ||||
| /** 导出按钮操作 */ | ||||
| const handleExport = () => { | ||||
|   proxy?.download( | ||||
|     'out/monthPlan/export', | ||||
|     { | ||||
|       ...queryParams.value | ||||
|     }, | ||||
|     `monthPlan_${new Date().getTime()}.xlsx` | ||||
|   ); | ||||
| }; | ||||
|  | ||||
| onMounted(() => { | ||||
|   getList(); | ||||
| }); | ||||
|  | ||||
| /** 审核按钮操作 */ | ||||
| const handleAudit = async (row?: MonthPlanVO) => { | ||||
|   proxy?.$tab.openPage('/out/designCompletion/indexEdit', '审核设计完工产值', { | ||||
|     id: row?.id, | ||||
|     type: 'update' | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| //监听项目id刷新数据 | ||||
| // const listeningProject = watch( | ||||
| //   () => currentProject.value.id, | ||||
| //   (nid, oid) => { | ||||
| //     queryParams.value.projectId = nid; | ||||
| //     form.value.projectId = nid; | ||||
| //     getList(); | ||||
| //   } | ||||
| // ); | ||||
|  | ||||
| // onUnmounted(() => { | ||||
| //   listeningProject(); | ||||
| // }); | ||||
| </script> | ||||
							
								
								
									
										356
									
								
								src/views/out/designCompletion/indexEdit.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										356
									
								
								src/views/out/designCompletion/indexEdit.vue
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,356 @@ | ||||
| <template> | ||||
|   <div class="p-4 bg-gray-50"> | ||||
|     <div class="max-w-4xl mx-auto"> | ||||
|       <!-- 顶部按钮区域 --> | ||||
|       <el-card class="mb-4 rounded-lg shadow-sm bg-white border border-gray-100 transition-all hover:shadow-md"> | ||||
|         <approvalButton | ||||
|           @submitForm="submitForm" | ||||
|           @approvalVerifyOpen="approvalVerifyOpen" | ||||
|           @handleApprovalRecord="handleApprovalRecord" | ||||
|           :buttonLoading="buttonLoading" | ||||
|           :id="form.id" | ||||
|           :status="form.completeAuditStatus" | ||||
|           :pageType="routeParams.type" | ||||
|         /> | ||||
|       </el-card> | ||||
|       <!-- 表单区域 --> | ||||
|       <el-card class="rounded-lg shadow-sm bg-white border border-gray-100 transition-all hover:shadow-md overflow-hidden"> | ||||
|         <div class="p-4 bg-gradient-to-r from-blue-50 to-indigo-50 border-b border-gray-100"> | ||||
|           <h3 class="text-lg font-semibold text-gray-800">设计完工产值</h3> | ||||
|         </div> | ||||
|         <div class="p-6"> | ||||
|           <el-form | ||||
|             ref="leaveFormRef" | ||||
|             v-loading="loading" | ||||
|             :disabled="routeParams.type === 'view'" | ||||
|             :model="form" | ||||
|             :rules="rules" | ||||
|             label-width="120px" | ||||
|             class="space-y-4" | ||||
|           > | ||||
|             <div class="grid grid-cols-1 gap-4"> | ||||
|               <el-row :gutter="20" justify="center"> | ||||
|                 <el-col :span="13" :offset="0"> | ||||
|                   <el-form-item label="计划月份" prop="planMonth"> | ||||
|                     <el-input v-model="form.planMonth" clearable disabled></el-input> | ||||
|                   </el-form-item> | ||||
|                 </el-col> | ||||
|  | ||||
|                 <el-col :span="13" :offset="0"> | ||||
|                   <el-form-item label="完成产值" prop="completeValue"> | ||||
|                     <el-input v-model="form.completeValue" disabled></el-input> | ||||
|                   </el-form-item> | ||||
|                 </el-col> | ||||
|               </el-row> | ||||
|             </div> | ||||
|           </el-form> | ||||
|         </div> | ||||
|       </el-card> | ||||
|       <!-- 提交组件 --> | ||||
|       <submitVerify ref="submitVerifyRef" :task-variables="taskVariables" @submit-callback="submitCallback" /> | ||||
|       <approvalRecord ref="approvalRecordRef"></approvalRecord> | ||||
|       <!-- 流程选择对话框 --> | ||||
|       <el-dialog | ||||
|         draggable | ||||
|         v-model="dialogVisible.visible" | ||||
|         :title="dialogVisible.title" | ||||
|         :before-close="handleClose" | ||||
|         width="500" | ||||
|         class="rounded-lg shadow-lg" | ||||
|       > | ||||
|         <div class="p-4"> | ||||
|           <p class="text-gray-600 mb-4">请选择要启动的流程:</p> | ||||
|           <el-select v-model="flowCode" placeholder="请选择流程" style="width: 100%"> | ||||
|             <el-option v-for="item in flowCodeOptions" :key="item.value" :label="item.label" :value="item.value" /> | ||||
|           </el-select> | ||||
|         </div> | ||||
|         <template #footer> | ||||
|           <div class="dialog-footer p-4 border-t border-gray-100 flex justify-end space-x-3"> | ||||
|             <el-button @click="handleClose" class="px-4 py-2 border border-gray-300 rounded-md text-gray-700 hover:bg-gray-50 transition-colors" | ||||
|               >取消</el-button | ||||
|             > | ||||
|             <el-button type="primary" @click="submitFlow()" class="px-4 py-2 bg-primary text-white rounded-md hover:bg-primary/90 transition-colors" | ||||
|               >确认</el-button | ||||
|             > | ||||
|           </div> | ||||
|         </template> | ||||
|       </el-dialog> | ||||
|     </div> | ||||
|   </div> | ||||
| </template> | ||||
|  | ||||
| <script setup name="Leave" lang="ts"> | ||||
| import { LeaveForm, LeaveQuery, LeaveVO } from '@/api/workflow/leave/types'; | ||||
| import { startWorkFlow } from '@/api/workflow/task'; | ||||
| import SubmitVerify from '@/components/Process/submitVerify.vue'; | ||||
| import ApprovalRecord from '@/components/Process/approvalRecord.vue'; | ||||
| import ApprovalButton from '@/components/Process/approvalButton.vue'; | ||||
| import { StartProcessBo } from '@/api/workflow/workflowCommon/types'; | ||||
| const { proxy } = getCurrentInstance() as ComponentInternalInstance; | ||||
| import { useUserStoreHook } from '@/store/modules/user'; | ||||
| const { design_change_reason_type } = toRefs<any>(proxy?.useDict('design_change_reason_type')); | ||||
| import { getKnowledgeDocument } from '@/api/design/technicalStandard'; | ||||
| import { getConstructionValue } from '@/api/out/constructionValue'; | ||||
| import { workScheduleListDetail } from '@/api/progress/plan'; | ||||
| import { getMonthPlan } from '@/api/out/monthPlan'; | ||||
| // 获取用户 store | ||||
| const userStore = useUserStoreHook(); | ||||
| // 从 store 中获取项目列表和当前选中的项目 | ||||
| const currentProject = computed(() => userStore.selectedProject); | ||||
| const buttonLoading = ref(false); | ||||
| const loading = ref(true); | ||||
| //路由参数 | ||||
| const routeParams = ref<Record<string, any>>({}); | ||||
| const flowCode = ref<string>(''); | ||||
| const status = ref<string>(''); | ||||
| const dialogVisible = reactive<DialogOption>({ | ||||
|   visible: false, | ||||
|   title: '流程定义' | ||||
| }); | ||||
| //提交组件 | ||||
| const submitVerifyRef = ref<InstanceType<typeof SubmitVerify>>(); | ||||
| //审批记录组件 | ||||
| const approvalRecordRef = ref<InstanceType<typeof ApprovalRecord>>(); | ||||
| //按钮组件 | ||||
| const flowCodeOptions = [ | ||||
|   { | ||||
|     value: currentProject.value?.id + '_designCompleteValue', | ||||
|     label: '设计完工产值审批' | ||||
|   } | ||||
| ]; | ||||
|  | ||||
| const leaveFormRef = ref<ElFormInstance>(); | ||||
| const dialog = reactive({ | ||||
|   visible: false, | ||||
|   title: '', | ||||
|   isEdit: false | ||||
| }); | ||||
| const submitFormData = ref<StartProcessBo>({ | ||||
|   businessId: '', | ||||
|   flowCode: '', | ||||
|   variables: {} | ||||
| }); | ||||
| const taskVariables = ref<Record<string, any>>({}); | ||||
|  | ||||
| const initFormData = { | ||||
|   id: undefined, | ||||
|   projectId: currentProject.value?.id, | ||||
|   planValue: undefined, | ||||
|   completeValue: undefined, | ||||
|   differenceValue: undefined, | ||||
|   planMonth: undefined, | ||||
|   valueType: '1', | ||||
|   planAuditStatus: undefined, | ||||
|   completeAuditStatus: undefined | ||||
| }; | ||||
| const data = reactive({ | ||||
|   form: { ...initFormData }, | ||||
|   rules: {} | ||||
| }); | ||||
|  | ||||
| const handleClose = () => { | ||||
|   dialogVisible.visible = false; | ||||
|   flowCode.value = ''; | ||||
|   buttonLoading.value = false; | ||||
| }; | ||||
| const { form, rules } = toRefs(data); | ||||
|  | ||||
| /** 表单重置 */ | ||||
| const reset = () => { | ||||
|   form.value = { ...initFormData }; | ||||
|   leaveFormRef.value?.resetFields(); | ||||
| }; | ||||
|  | ||||
| /** 获取详情 */ | ||||
| const getInfo = () => { | ||||
|   loading.value = true; | ||||
|   buttonLoading.value = false; | ||||
|   nextTick(async () => { | ||||
|     const res = await getMonthPlan(routeParams.value.id); | ||||
|     Object.assign(form.value, res.data); | ||||
|     loading.value = false; | ||||
|     buttonLoading.value = false; | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| /** 提交按钮 */ | ||||
| const submitForm = (status1: string) => { | ||||
|   status.value = status1; | ||||
|   submit(status.value, form.value); | ||||
| }; | ||||
|  | ||||
| const submitFlow = async () => { | ||||
|   handleStartWorkFlow(form.value); | ||||
|   dialogVisible.visible = false; | ||||
| }; | ||||
| //提交申请 | ||||
| const handleStartWorkFlow = async (data: LeaveForm) => { | ||||
|   try { | ||||
|     submitFormData.value.flowCode = flowCode.value; | ||||
|     submitFormData.value.businessId = data.id; | ||||
|     //流程变量 | ||||
|     taskVariables.value = { | ||||
|       // leave4/5 使用的流程变量 | ||||
|       userList: ['1', '3', '4'] | ||||
|     }; | ||||
|     submitFormData.value.variables = taskVariables.value; | ||||
|     const resp = await startWorkFlow(submitFormData.value); | ||||
|     if (submitVerifyRef.value) { | ||||
|       buttonLoading.value = false; | ||||
|       submitVerifyRef.value.openDialog(resp.data.taskId); | ||||
|     } | ||||
|   } finally { | ||||
|     buttonLoading.value = false; | ||||
|   } | ||||
| }; | ||||
| //审批记录 | ||||
| const handleApprovalRecord = () => { | ||||
|   approvalRecordRef.value.init(form.value.id); | ||||
| }; | ||||
| //提交回调 | ||||
| const submitCallback = async () => { | ||||
|   await proxy.$tab.closePage(proxy.$route); | ||||
|   proxy.$router.go(-1); | ||||
| }; | ||||
| //审批 | ||||
| const approvalVerifyOpen = async () => { | ||||
|   submitVerifyRef.value.openDialog(routeParams.value.taskId); | ||||
| }; | ||||
| // 图纸上传成功之后 开始提交 | ||||
| const submit = async (status, data) => { | ||||
|   form.value = data; | ||||
|   if (status === 'draft') { | ||||
|     buttonLoading.value = false; | ||||
|     proxy?.$modal.msgSuccess('暂存成功'); | ||||
|     proxy.$tab.closePage(proxy.$route); | ||||
|     proxy.$router.go(-1); | ||||
|   } else { | ||||
|     if ((form.value.completeAuditStatus === 'draft' && (flowCode.value === '' || flowCode.value === null)) || routeParams.value.type === 'add') { | ||||
|       flowCode.value = flowCodeOptions[0].value; | ||||
|       dialogVisible.visible = true; | ||||
|       return; | ||||
|     } | ||||
|     //说明启动过先随意穿个参数 | ||||
|     if (flowCode.value === '' || flowCode.value === null) { | ||||
|       flowCode.value = 'xx'; | ||||
|     } | ||||
|     await handleStartWorkFlow(data); | ||||
|   } | ||||
| }; | ||||
|  | ||||
| onMounted(() => { | ||||
|   nextTick(async () => { | ||||
|     routeParams.value = proxy.$route.query; | ||||
|     console.log('🚀 ~ proxy.$route.query:', proxy.$route.query); | ||||
|     reset(); | ||||
|     loading.value = false; | ||||
|     if (routeParams.value.type === 'update' || routeParams.value.type === 'view' || routeParams.value.type === 'approval') { | ||||
|       getInfo(); | ||||
|     } | ||||
|   }); | ||||
| }); | ||||
| </script> | ||||
| <style scoped lang="scss"> | ||||
| /* 全局样式 */ | ||||
| :root { | ||||
|   --primary: #409eff; | ||||
|   --primary-light: #66b1ff; | ||||
|   --primary-dark: #3a8ee6; | ||||
|   --success: #67c23a; | ||||
|   --warning: #e6a23c; | ||||
|   --danger: #f56c6c; | ||||
|   --info: #909399; | ||||
| } | ||||
|  | ||||
| /* 表单样式优化 */ | ||||
| .el-form-item { | ||||
|   .el-form-item__label { | ||||
|     color: #606266; | ||||
|     font-weight: 500; | ||||
|   } | ||||
|  | ||||
|   .el-input__inner, | ||||
|   .el-select .el-input__inner { | ||||
|     border-radius: 4px; | ||||
|     transition: | ||||
|       border-color 0.2s, | ||||
|       box-shadow 0.2s; | ||||
|  | ||||
|     &:focus { | ||||
|       border-color: var(--primary-light); | ||||
|       box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.1); | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   .el-textarea__inner { | ||||
|     border-radius: 4px; | ||||
|     transition: | ||||
|       border-color 0.2s, | ||||
|       box-shadow 0.2s; | ||||
|  | ||||
|     &:focus { | ||||
|       border-color: var(--primary-light); | ||||
|       box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.1); | ||||
|     } | ||||
|   } | ||||
| } | ||||
|  | ||||
| /* 按钮样式优化 */ | ||||
| .el-button { | ||||
|   border-radius: 4px; | ||||
|   transition: all 0.2s; | ||||
|  | ||||
|   &.is-primary { | ||||
|     background-color: var(--primary); | ||||
|     border-color: var(--primary); | ||||
|  | ||||
|     &:hover { | ||||
|       background-color: var(--primary-light); | ||||
|       border-color: var(--primary-light); | ||||
|     } | ||||
|  | ||||
|     &:active { | ||||
|       background-color: var(--primary-dark); | ||||
|       border-color: var(--primary-dark); | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   &.is-text { | ||||
|     color: var(--primary); | ||||
|  | ||||
|     &:hover { | ||||
|       color: var(--primary-light); | ||||
|       background-color: rgba(64, 158, 255, 0.05); | ||||
|     } | ||||
|   } | ||||
| } | ||||
|  | ||||
| /* 卡片样式优化 */ | ||||
| .el-card { | ||||
|   transition: all 0.3s ease; | ||||
|  | ||||
|   &:hover { | ||||
|     /* transform: translateY(-2px); */ | ||||
|   } | ||||
| } | ||||
|  | ||||
| /* 对话框样式优化 */ | ||||
| .el-dialog { | ||||
|   .el-dialog__header { | ||||
|     background-color: #f5f7fa; | ||||
|     border-bottom: 1px solid #ebeef5; | ||||
|     padding: 15px 20px; | ||||
|   } | ||||
|  | ||||
|   .el-dialog__title { | ||||
|     font-size: 16px; | ||||
|     font-weight: 600; | ||||
|     color: #303133; | ||||
|   } | ||||
|  | ||||
|   .el-dialog__footer { | ||||
|     padding: 15px 20px; | ||||
|     border-top: 1px solid #ebeef5; | ||||
|   } | ||||
| } | ||||
| </style> | ||||
							
								
								
									
										288
									
								
								src/views/out/monthPlan/index.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										288
									
								
								src/views/out/monthPlan/index.vue
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,288 @@ | ||||
| <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="planValue"> | ||||
|               <el-input v-model="queryParams.planValue" placeholder="请输入计划产值" clearable @keyup.enter="handleQuery" /> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="计划月份" prop="planMonth"> | ||||
|               <el-date-picker v-model="queryParams.planMonth" type="month" value-format="YYYY-MM" placeholder="请选择计划月份" /> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="产值类型" prop="valueType"> | ||||
|               <el-select v-model="queryParams.valueType" placeholder="请选择产值类型"> | ||||
|                 <el-option v-for="item in out_value_type" :key="item.value" :label="item.label" :value="item.value" /> | ||||
|               </el-select> | ||||
|             </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="['out:monthPlan:add']">新增</el-button> | ||||
|           </el-col> | ||||
|           <el-col :span="1.5"> | ||||
|             <el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['out:monthPlan:edit']" | ||||
|               >修改</el-button | ||||
|             > | ||||
|           </el-col> | ||||
|           <el-col :span="1.5"> | ||||
|             <el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['out:monthPlan:remove']" | ||||
|               >删除</el-button | ||||
|             > | ||||
|           </el-col> | ||||
|           <el-col :span="1.5"> | ||||
|             <el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['out:monthPlan:export']">导出</el-button> | ||||
|           </el-col> | ||||
|           <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> | ||||
|         </el-row> | ||||
|       </template> | ||||
|  | ||||
|       <el-table v-loading="loading" :data="monthPlanList" @selection-change="handleSelectionChange"> | ||||
|         <el-table-column type="selection" width="55" align="center" /> | ||||
|         <el-table-column label="计划月份" align="center" prop="planMonth" /> | ||||
|         <el-table-column label="计划产值" align="center" prop="planValue" /> | ||||
|         <el-table-column label="完成产值" align="center" prop="completeValue" /> | ||||
|         <el-table-column label="差额" align="center" prop="differenceValue" /> | ||||
|         <el-table-column label="产值类型" align="center" prop="valueType"> | ||||
|           <template #default="scope"> | ||||
|             <dict-tag :options="out_value_type" :value="scope.row.valueType" /> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <el-table-column label="流程状态" align="center" prop="planAuditStatus"> | ||||
|           <template #default="scope"> | ||||
|             <dict-tag :options="wf_business_status" :value="scope.row.planAuditStatus" /> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> | ||||
|           <template #default="scope" | ||||
|             ><el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['out:monthPlan:edit']">修改</el-button> | ||||
|             <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['out:monthPlan:remove']">删除</el-button> | ||||
|             <el-button link type="primary" icon="Finished" @click="handleAudit(scope.row)" v-hasPermi="['out:monthPlan: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> | ||||
|     <!-- 添加或修改月度产值计划对话框 --> | ||||
|     <el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body> | ||||
|       <el-form ref="monthPlanFormRef" :model="form" :rules="rules" label-width="80px"> | ||||
|         <el-form-item label="计划产值" prop="planValue"> | ||||
|           <el-input v-model="form.planValue" placeholder="请输入计划产值" /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="计划月份" prop="planMonth"> | ||||
|           <el-date-picker v-model="form.planMonth" type="month" value-format="YYYY-MM" placeholder="请选择计划月份" /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="产值类型" prop="valueType"> | ||||
|           <el-select v-model="form.valueType" placeholder="请选择产值类型"> | ||||
|             <el-option v-for="item in out_value_type" :key="item.value" :label="item.label" :value="item.value" /> | ||||
|           </el-select> | ||||
|         </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="MonthPlan" lang="ts"> | ||||
| import { listMonthPlan, getMonthPlan, delMonthPlan, addMonthPlan, updateMonthPlan } from '@/api/out/monthPlan'; | ||||
| import { MonthPlanVO, MonthPlanQuery, MonthPlanForm } from '@/api/out/monthPlan/types'; | ||||
| const { proxy } = getCurrentInstance() as ComponentInternalInstance; | ||||
| const { out_value_type } = toRefs<any>(proxy?.useDict('out_value_type')); | ||||
| const { wf_business_status } = toRefs<any>(proxy?.useDict('wf_business_status')); | ||||
|  | ||||
| import { useUserStoreHook } from '@/store/modules/user'; | ||||
| // 获取用户 store | ||||
| const userStore = useUserStoreHook(); | ||||
| // 从 store 中获取项目列表和当前选中的项目 | ||||
| const currentProject = computed(() => userStore.selectedProject); | ||||
| const monthPlanList = ref<MonthPlanVO[]>([]); | ||||
| 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 monthPlanFormRef = ref<ElFormInstance>(); | ||||
|  | ||||
| const dialog = reactive<DialogOption>({ | ||||
|   visible: false, | ||||
|   title: '' | ||||
| }); | ||||
|  | ||||
| const initFormData: MonthPlanForm = { | ||||
|   id: undefined, | ||||
|   projectId: currentProject.value?.id, | ||||
|   planValue: undefined, | ||||
|   completeValue: undefined, | ||||
|   differenceValue: undefined, | ||||
|   planMonth: undefined, | ||||
|   valueType: undefined, | ||||
|   planAuditStatus: undefined, | ||||
|   completeAuditStatus: undefined | ||||
| }; | ||||
| const data = reactive<PageData<MonthPlanForm, MonthPlanQuery>>({ | ||||
|   form: { ...initFormData }, | ||||
|   queryParams: { | ||||
|     pageNum: 1, | ||||
|     pageSize: 10, | ||||
|     projectId: currentProject.value?.id, | ||||
|     planValue: undefined, | ||||
|     completeValue: undefined, | ||||
|     differenceValue: undefined, | ||||
|     planMonth: undefined, | ||||
|     valueType: undefined, | ||||
|     planAuditStatus: undefined, | ||||
|     completeAuditStatus: undefined, | ||||
|     params: {} | ||||
|   }, | ||||
|   rules: { | ||||
|     id: [{ required: true, message: '主键ID不能为空', trigger: 'blur' }], | ||||
|     projectId: [{ required: true, message: '项目ID不能为空', trigger: 'blur' }], | ||||
|     planValue: [{ required: true, message: '计划产值不能为空', trigger: 'blur' }], | ||||
|     planMonth: [{ required: true, message: '计划月份不能为空', trigger: 'blur' }], | ||||
|     valueType: [{ required: true, message: '1-设计 2-采购 3-施工不能为空', trigger: 'change' }] | ||||
|   } | ||||
| }); | ||||
|  | ||||
| const { queryParams, form, rules } = toRefs(data); | ||||
|  | ||||
| /** 查询月度产值计划列表 */ | ||||
| const getList = async () => { | ||||
|   loading.value = true; | ||||
|   const res = await listMonthPlan(queryParams.value); | ||||
|   monthPlanList.value = res.rows; | ||||
|   total.value = res.total; | ||||
|   loading.value = false; | ||||
| }; | ||||
|  | ||||
| /** 取消按钮 */ | ||||
| const cancel = () => { | ||||
|   reset(); | ||||
|   dialog.visible = false; | ||||
| }; | ||||
|  | ||||
| /** 表单重置 */ | ||||
| const reset = () => { | ||||
|   form.value = { ...initFormData }; | ||||
|   monthPlanFormRef.value?.resetFields(); | ||||
| }; | ||||
|  | ||||
| /** 搜索按钮操作 */ | ||||
| const handleQuery = () => { | ||||
|   queryParams.value.pageNum = 1; | ||||
|   getList(); | ||||
| }; | ||||
|  | ||||
| /** 重置按钮操作 */ | ||||
| const resetQuery = () => { | ||||
|   queryFormRef.value?.resetFields(); | ||||
|   handleQuery(); | ||||
| }; | ||||
|  | ||||
| /** 多选框选中数据 */ | ||||
| const handleSelectionChange = (selection: MonthPlanVO[]) => { | ||||
|   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?: MonthPlanVO) => { | ||||
|   reset(); | ||||
|   const _id = row?.id || ids.value[0]; | ||||
|   const res = await getMonthPlan(_id); | ||||
|   Object.assign(form.value, res.data); | ||||
|   dialog.visible = true; | ||||
|   dialog.title = '修改月度产值计划'; | ||||
| }; | ||||
|  | ||||
| /** 提交按钮 */ | ||||
| const submitForm = () => { | ||||
|   form.value.projectId = currentProject.value.id; | ||||
|   monthPlanFormRef.value?.validate(async (valid: boolean) => { | ||||
|     if (valid) { | ||||
|       buttonLoading.value = true; | ||||
|       if (form.value.id) { | ||||
|         await updateMonthPlan(form.value).finally(() => (buttonLoading.value = false)); | ||||
|       } else { | ||||
|         await addMonthPlan(form.value).finally(() => (buttonLoading.value = false)); | ||||
|       } | ||||
|       proxy?.$modal.msgSuccess('操作成功'); | ||||
|       dialog.visible = false; | ||||
|       await getList(); | ||||
|     } | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| /** 删除按钮操作 */ | ||||
| const handleDelete = async (row?: MonthPlanVO) => { | ||||
|   const _ids = row?.id || ids.value; | ||||
|   await proxy?.$modal.confirm('是否确认删除月度产值计划编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false)); | ||||
|   await delMonthPlan(_ids); | ||||
|   proxy?.$modal.msgSuccess('删除成功'); | ||||
|   await getList(); | ||||
| }; | ||||
|  | ||||
| /** 审核按钮操作 */ | ||||
| const handleAudit = async (row?: MonthPlanVO) => { | ||||
|   proxy?.$tab.openPage('/out/monthPlan/indexEdit', '审核月度产值计划', { | ||||
|     planMonth: row?.planMonth, | ||||
|     type: 'update' | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| /** 导出按钮操作 */ | ||||
| const handleExport = () => { | ||||
|   proxy?.download( | ||||
|     'out/monthPlan/export', | ||||
|     { | ||||
|       ...queryParams.value | ||||
|     }, | ||||
|     `monthPlan_${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> | ||||
							
								
								
									
										368
									
								
								src/views/out/monthPlan/indexEdit.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										368
									
								
								src/views/out/monthPlan/indexEdit.vue
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,368 @@ | ||||
| <template> | ||||
|   <div class="p-4 bg-gray-50"> | ||||
|     <div class="max-w-4xl mx-auto"> | ||||
|       <!-- 顶部按钮区域 --> | ||||
|       <el-card class="mb-4 rounded-lg shadow-sm bg-white border border-gray-100 transition-all hover:shadow-md"> | ||||
|         <approvalButton | ||||
|           @submitForm="submitForm" | ||||
|           @approvalVerifyOpen="approvalVerifyOpen" | ||||
|           @handleApprovalRecord="handleApprovalRecord" | ||||
|           :buttonLoading="buttonLoading" | ||||
|           :id="form[0]?.id" | ||||
|           :status="form[0]?.planAuditStatus" | ||||
|           :pageType="routeParams.type" | ||||
|         /> | ||||
|       </el-card> | ||||
|       <!-- 表单区域 --> | ||||
|       <el-card class="rounded-lg shadow-sm bg-white border border-gray-100 transition-all hover:shadow-md overflow-hidden"> | ||||
|         <div class="p-4 bg-gradient-to-r from-blue-50 to-indigo-50 border-b border-gray-100"> | ||||
|           <h3 class="text-lg font-semibold text-gray-800">月度产值计划</h3> | ||||
|         </div> | ||||
|         <div class="p-6"> | ||||
|           <el-form | ||||
|             ref="leaveFormRef" | ||||
|             v-loading="loading" | ||||
|             :disabled="routeParams.type === 'view'" | ||||
|             :model="form" | ||||
|             :rules="rules" | ||||
|             label-width="120px" | ||||
|             class="space-y-4" | ||||
|           > | ||||
|             <div class="grid grid-cols-1 gap-4"> | ||||
|               <el-row :gutter="20" justify="space-between" v-for="item in form"> | ||||
|                 <el-col :span="8" :offset="0"> | ||||
|                   <el-form-item label="计划产值" prop="planValue"> | ||||
|                     <el-input v-model="item.planValue" placeholder="请输入计划产值" disabled /> | ||||
|                   </el-form-item> | ||||
|                 </el-col> | ||||
|  | ||||
|                 <el-col :span="8" :offset="0"> | ||||
|                   <el-form-item label="计划月份" prop="planMonth"> | ||||
|                     <el-date-picker v-model="item.planMonth" type="month" value-format="YYYY-MM" disabled placeholder="请选择计划月份" /> | ||||
|                   </el-form-item> | ||||
|                 </el-col> | ||||
|                 <el-col :span="8" :offset="0"> | ||||
|                   <el-form-item label="产值类型" prop="valueType"> | ||||
|                     <el-select v-model="item.valueType" placeholder="请选择产值类型" disabled> | ||||
|                       <el-option v-for="it in out_value_type" :key="it.value" :label="it.label" :value="it.value" /> | ||||
|                     </el-select> | ||||
|                   </el-form-item> | ||||
|                 </el-col> | ||||
|               </el-row> | ||||
|             </div> | ||||
|           </el-form> | ||||
|         </div> | ||||
|       </el-card> | ||||
|       <!-- 提交组件 --> | ||||
|       <submitVerify ref="submitVerifyRef" :task-variables="taskVariables" @submit-callback="submitCallback" /> | ||||
|       <approvalRecord ref="approvalRecordRef"></approvalRecord> | ||||
|       <!-- 流程选择对话框 --> | ||||
|       <el-dialog | ||||
|         draggable | ||||
|         v-model="dialogVisible.visible" | ||||
|         :title="dialogVisible.title" | ||||
|         :before-close="handleClose" | ||||
|         width="500" | ||||
|         class="rounded-lg shadow-lg" | ||||
|       > | ||||
|         <div class="p-4"> | ||||
|           <p class="text-gray-600 mb-4">请选择要启动的流程:</p> | ||||
|           <el-select v-model="flowCode" placeholder="请选择流程" style="width: 100%"> | ||||
|             <el-option v-for="item in flowCodeOptions" :key="item.value" :label="item.label" :value="item.value" /> | ||||
|           </el-select> | ||||
|         </div> | ||||
|         <template #footer> | ||||
|           <div class="dialog-footer p-4 border-t border-gray-100 flex justify-end space-x-3"> | ||||
|             <el-button @click="handleClose" class="px-4 py-2 border border-gray-300 rounded-md text-gray-700 hover:bg-gray-50 transition-colors" | ||||
|               >取消</el-button | ||||
|             > | ||||
|             <el-button type="primary" @click="submitFlow()" class="px-4 py-2 bg-primary text-white rounded-md hover:bg-primary/90 transition-colors" | ||||
|               >确认</el-button | ||||
|             > | ||||
|           </div> | ||||
|         </template> | ||||
|       </el-dialog> | ||||
|     </div> | ||||
|   </div> | ||||
| </template> | ||||
|  | ||||
| <script setup name="Leave" lang="ts"> | ||||
| import { LeaveForm, LeaveQuery, LeaveVO } from '@/api/workflow/leave/types'; | ||||
| import { startWorkFlow } from '@/api/workflow/task'; | ||||
| import SubmitVerify from '@/components/Process/submitVerify.vue'; | ||||
| import ApprovalRecord from '@/components/Process/approvalRecord.vue'; | ||||
| import ApprovalButton from '@/components/Process/approvalButton.vue'; | ||||
| import { StartProcessBo } from '@/api/workflow/workflowCommon/types'; | ||||
| const { proxy } = getCurrentInstance() as ComponentInternalInstance; | ||||
| import { useUserStoreHook } from '@/store/modules/user'; | ||||
| import { getMonthInfo, isSubmit } from '@/api/out/monthPlan'; | ||||
| // 获取用户 store | ||||
| const userStore = useUserStoreHook(); | ||||
| // 从 store 中获取项目列表和当前选中的项目 | ||||
| const currentProject = computed(() => userStore.selectedProject); | ||||
| const buttonLoading = ref(false); | ||||
| const loading = ref(true); | ||||
| const { out_value_type } = toRefs<any>(proxy?.useDict('out_value_type')); | ||||
|  | ||||
| //路由参数 | ||||
| const routeParams = ref<Record<string, any>>({}); | ||||
| const flowCode = ref<string>(''); | ||||
| const status = ref<string>(''); | ||||
| const dialogVisible = reactive<DialogOption>({ | ||||
|   visible: false, | ||||
|   title: '流程定义' | ||||
| }); | ||||
| //提交组件 | ||||
| const submitVerifyRef = ref<InstanceType<typeof SubmitVerify>>(); | ||||
| //审批记录组件 | ||||
| const approvalRecordRef = ref<InstanceType<typeof ApprovalRecord>>(); | ||||
| //按钮组件 | ||||
| const flowCodeOptions = [ | ||||
|   { | ||||
|     value: currentProject.value?.id + '_monthPlan', | ||||
|     label: '月度产值计划审批' | ||||
|   } | ||||
| ]; | ||||
|  | ||||
| const leaveFormRef = ref<ElFormInstance>(); | ||||
| const dialog = reactive({ | ||||
|   visible: false, | ||||
|   title: '', | ||||
|   isEdit: false | ||||
| }); | ||||
| const submitFormData = ref<StartProcessBo>({ | ||||
|   businessId: '', | ||||
|   flowCode: '', | ||||
|   variables: {} | ||||
| }); | ||||
| const taskVariables = ref<Record<string, any>>({}); | ||||
|  | ||||
| const initFormData = []; | ||||
| const data = reactive({ | ||||
|   form: { ...initFormData }, | ||||
|   rules: {} | ||||
| }); | ||||
|  | ||||
| const handleClose = () => { | ||||
|   dialogVisible.visible = false; | ||||
|   flowCode.value = ''; | ||||
|   buttonLoading.value = false; | ||||
| }; | ||||
| const { form, rules } = toRefs(data); | ||||
|  | ||||
| /** 表单重置 */ | ||||
| const reset = () => { | ||||
|   form.value = { ...initFormData }; | ||||
|   leaveFormRef.value?.resetFields(); | ||||
| }; | ||||
|  | ||||
| /** 获取详情 */ | ||||
| const getInfo = () => { | ||||
|   loading.value = true; | ||||
|   buttonLoading.value = false; | ||||
|   nextTick(async () => { | ||||
|     console.log('🚀 ~ routeParams.value:', routeParams.value.businessId); | ||||
|     const projectId = routeParams.value.businessId ? routeParams.value.businessId.split('_')[0] : currentProject.value?.id; | ||||
|     const res = await getMonthInfo({ projectId: projectId, planMonth: routeParams.value.planMonth }); | ||||
|     form.value = res.data as any; | ||||
|  | ||||
|     console.log('🚀 ~ getInfo ~ form.value:', form.value[0].projectId); | ||||
|  | ||||
|     form.value[0].id = form.value[0].projectId + '_' + form.value[0].planMonth; | ||||
|     loading.value = false; | ||||
|     buttonLoading.value = false; | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| /** 提交按钮 */ | ||||
| const submitForm = (status1: string) => { | ||||
|   status.value = status1; | ||||
|   submit(status.value, form.value); | ||||
| }; | ||||
|  | ||||
| const submitFlow = async () => { | ||||
|   handleStartWorkFlow(form.value); | ||||
|   dialogVisible.visible = false; | ||||
| }; | ||||
| //提交申请 | ||||
| const handleStartWorkFlow = async (data: LeaveForm) => { | ||||
|   try { | ||||
|     submitFormData.value.flowCode = flowCode.value; | ||||
|     submitFormData.value.businessId = currentProject.value.id + '_' + form.value[0]?.planMonth; | ||||
|  | ||||
|     //流程变量 | ||||
|     taskVariables.value = { | ||||
|       // leave4/5 使用的流程变量 | ||||
|       userList: ['1', '3', '4'] | ||||
|     }; | ||||
|     submitFormData.value.variables = taskVariables.value; | ||||
|     const resp = await startWorkFlow(submitFormData.value); | ||||
|     if (submitVerifyRef.value) { | ||||
|       buttonLoading.value = false; | ||||
|       submitVerifyRef.value.openDialog(resp.data.taskId); | ||||
|     } | ||||
|   } finally { | ||||
|     buttonLoading.value = false; | ||||
|   } | ||||
| }; | ||||
| //审批记录 | ||||
| const handleApprovalRecord = () => { | ||||
|   console.log(form.value[0]?.id); | ||||
|  | ||||
|   approvalRecordRef.value.init(form.value[0]?.id); | ||||
| }; | ||||
| //提交回调 | ||||
| const submitCallback = async () => { | ||||
|   await proxy.$tab.closePage(proxy.$route); | ||||
|   proxy.$router.go(-1); | ||||
| }; | ||||
| //审批 | ||||
| const approvalVerifyOpen = async () => { | ||||
|   submitVerifyRef.value.openDialog(routeParams.value.taskId); | ||||
| }; | ||||
| // 图纸上传成功之后 开始提交 | ||||
| const submit = async (status, data) => { | ||||
|   form.value = data; | ||||
|   if (status === 'draft') { | ||||
|     buttonLoading.value = false; | ||||
|     proxy?.$modal.msgSuccess('暂存成功'); | ||||
|     proxy.$tab.closePage(proxy.$route); | ||||
|     proxy.$router.go(-1); | ||||
|   } else { | ||||
|     const res = await isSubmit(data[0]?.id); | ||||
|  | ||||
|     if (!res.data) { | ||||
|       proxy?.$modal.msgError('三种计划产值必须填写'); | ||||
|       return; | ||||
|     } | ||||
|     if ((form.value[0]?.planAuditStatus === 'draft' && (flowCode.value === '' || flowCode.value === null)) || routeParams.value.type === 'add') { | ||||
|       flowCode.value = flowCodeOptions[0].value; | ||||
|       dialogVisible.visible = true; | ||||
|       return; | ||||
|     } | ||||
|     //说明启动过先随意穿个参数 | ||||
|     if (flowCode.value === '' || flowCode.value === null) { | ||||
|       flowCode.value = 'xx'; | ||||
|     } | ||||
|     await handleStartWorkFlow(data); | ||||
|   } | ||||
| }; | ||||
|  | ||||
| onMounted(() => { | ||||
|   nextTick(async () => { | ||||
|     routeParams.value = proxy.$route.query; | ||||
|     console.log('🚀 ~ proxy.$route.query:', proxy.$route.query); | ||||
|     reset(); | ||||
|     loading.value = false; | ||||
|     if (routeParams.value.type === 'update' || routeParams.value.type === 'view' || routeParams.value.type === 'approval') { | ||||
|       console.log('🚀 ~ routeParams.value:', routeParams.value); | ||||
|  | ||||
|       getInfo(); | ||||
|     } | ||||
|   }); | ||||
| }); | ||||
| </script> | ||||
| <style scoped lang="scss"> | ||||
| /* 全局样式 */ | ||||
| :root { | ||||
|   --primary: #409eff; | ||||
|   --primary-light: #66b1ff; | ||||
|   --primary-dark: #3a8ee6; | ||||
|   --success: #67c23a; | ||||
|   --warning: #e6a23c; | ||||
|   --danger: #f56c6c; | ||||
|   --info: #909399; | ||||
| } | ||||
|  | ||||
| /* 表单样式优化 */ | ||||
| .el-form-item { | ||||
|   .el-form-item__label { | ||||
|     color: #606266; | ||||
|     font-weight: 500; | ||||
|   } | ||||
|  | ||||
|   .el-input__inner, | ||||
|   .el-select .el-input__inner { | ||||
|     border-radius: 4px; | ||||
|     transition: | ||||
|       border-color 0.2s, | ||||
|       box-shadow 0.2s; | ||||
|  | ||||
|     &:focus { | ||||
|       border-color: var(--primary-light); | ||||
|       box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.1); | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   .el-textarea__inner { | ||||
|     border-radius: 4px; | ||||
|     transition: | ||||
|       border-color 0.2s, | ||||
|       box-shadow 0.2s; | ||||
|  | ||||
|     &:focus { | ||||
|       border-color: var(--primary-light); | ||||
|       box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.1); | ||||
|     } | ||||
|   } | ||||
| } | ||||
|  | ||||
| /* 按钮样式优化 */ | ||||
| .el-button { | ||||
|   border-radius: 4px; | ||||
|   transition: all 0.2s; | ||||
|  | ||||
|   &.is-primary { | ||||
|     background-color: var(--primary); | ||||
|     border-color: var(--primary); | ||||
|  | ||||
|     &:hover { | ||||
|       background-color: var(--primary-light); | ||||
|       border-color: var(--primary-light); | ||||
|     } | ||||
|  | ||||
|     &:active { | ||||
|       background-color: var(--primary-dark); | ||||
|       border-color: var(--primary-dark); | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   &.is-text { | ||||
|     color: var(--primary); | ||||
|  | ||||
|     &:hover { | ||||
|       color: var(--primary-light); | ||||
|       background-color: rgba(64, 158, 255, 0.05); | ||||
|     } | ||||
|   } | ||||
| } | ||||
|  | ||||
| /* 卡片样式优化 */ | ||||
| .el-card { | ||||
|   transition: all 0.3s ease; | ||||
|  | ||||
|   &:hover { | ||||
|     /* transform: translateY(-2px); */ | ||||
|   } | ||||
| } | ||||
|  | ||||
| /* 对话框样式优化 */ | ||||
| .el-dialog { | ||||
|   .el-dialog__header { | ||||
|     background-color: #f5f7fa; | ||||
|     border-bottom: 1px solid #ebeef5; | ||||
|     padding: 15px 20px; | ||||
|   } | ||||
|  | ||||
|   .el-dialog__title { | ||||
|     font-size: 16px; | ||||
|     font-weight: 600; | ||||
|     color: #303133; | ||||
|   } | ||||
|  | ||||
|   .el-dialog__footer { | ||||
|     padding: 15px 20px; | ||||
|     border-top: 1px solid #ebeef5; | ||||
|   } | ||||
| } | ||||
| </style> | ||||
							
								
								
									
										249
									
								
								src/views/out/monthPlanAudit/index.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										249
									
								
								src/views/out/monthPlanAudit/index.vue
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,249 @@ | ||||
| <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="planMonth"> | ||||
|               <el-date-picker | ||||
|                 v-model="queryParams.planMonth" | ||||
|                 type="month" | ||||
|                 value-format="YYYY-MM" | ||||
|                 placeholder="请选择计划月份" | ||||
|                 clearable | ||||
|                 @change="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="warning" plain icon="Download" @click="handleExport" v-hasPermi="['out:monthPlanAudit:export']">导出</el-button> | ||||
|           </el-col> | ||||
|           <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> | ||||
|         </el-row> | ||||
|       </template> | ||||
|  | ||||
|       <el-table v-loading="loading" :data="monthPlanAuditList" @selection-change="handleSelectionChange"> | ||||
|         <el-table-column type="selection" width="55" align="center" /> | ||||
|         <el-table-column label="设计产值" align="center" prop="designValue" /> | ||||
|         <el-table-column label="采购产值" align="center" prop="purchaseValue" /> | ||||
|         <el-table-column label="施工产值" align="center" prop="constructionValue" /> | ||||
|         <el-table-column label="总产值" align="center" prop="totalValue" /> | ||||
|         <el-table-column label="计划月份" align="center" prop="planMonth" /> | ||||
|       </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="monthPlanAuditFormRef" :model="form" :rules="rules" label-width="80px"> | ||||
|         <el-form-item label="设计产值" prop="designValue"> | ||||
|           <el-input v-model="form.designValue" placeholder="请输入设计产值" /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="采购产值" prop="purchaseValue"> | ||||
|           <el-input v-model="form.purchaseValue" placeholder="请输入采购产值" /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="施工产值" prop="constructionValue"> | ||||
|           <el-input v-model="form.constructionValue" placeholder="请输入施工产值" /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="总产值" prop="totalValue"> | ||||
|           <el-input v-model="form.totalValue" placeholder="请输入总产值" /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="计划月份" prop="planMonth"> | ||||
|           <el-date-picker v-model="form.planMonth" type="month" value-format="YYYY-MM" placeholder="请选择计划月份" clearable /> | ||||
|         </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="MonthPlanAudit" lang="ts"> | ||||
| import { listMonthPlanAudit, getMonthPlanAudit, delMonthPlanAudit, addMonthPlanAudit, updateMonthPlanAudit } from '@/api/out/monthPlanAudit'; | ||||
| import { MonthPlanAuditVO, MonthPlanAuditQuery, MonthPlanAuditForm } from '@/api/out/monthPlanAudit/types'; | ||||
|  | ||||
| const { proxy } = getCurrentInstance() as ComponentInternalInstance; | ||||
| import { useUserStoreHook } from '@/store/modules/user'; | ||||
| // 获取用户 store | ||||
| const userStore = useUserStoreHook(); | ||||
| // 从 store 中获取项目列表和当前选中的项目 | ||||
| const currentProject = computed(() => userStore.selectedProject); | ||||
| const monthPlanAuditList = ref<MonthPlanAuditVO[]>([]); | ||||
| 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 monthPlanAuditFormRef = ref<ElFormInstance>(); | ||||
|  | ||||
| const dialog = reactive<DialogOption>({ | ||||
|   visible: false, | ||||
|   title: '' | ||||
| }); | ||||
|  | ||||
| const initFormData: MonthPlanAuditForm = { | ||||
|   id: undefined, | ||||
|   projectId: currentProject.value?.id, | ||||
|   designValue: undefined, | ||||
|   purchaseValue: undefined, | ||||
|   constructionValue: undefined, | ||||
|   totalValue: undefined, | ||||
|   planMonth: undefined | ||||
| }; | ||||
| const data = reactive<PageData<MonthPlanAuditForm, MonthPlanAuditQuery>>({ | ||||
|   form: { ...initFormData }, | ||||
|   queryParams: { | ||||
|     pageNum: 1, | ||||
|     pageSize: 10, | ||||
|     projectId: currentProject.value?.id, | ||||
|     designValue: undefined, | ||||
|     purchaseValue: undefined, | ||||
|     constructionValue: undefined, | ||||
|     totalValue: undefined, | ||||
|     planMonth: undefined, | ||||
|     params: {} | ||||
|   }, | ||||
|   rules: { | ||||
|     id: [{ required: true, message: '主键ID不能为空', trigger: 'blur' }], | ||||
|     projectId: [{ required: true, message: '项目ID不能为空', trigger: 'blur' }], | ||||
|     designValue: [{ required: true, message: '设计产值不能为空', trigger: 'blur' }], | ||||
|     purchaseValue: [{ required: true, message: '采购产值不能为空', trigger: 'blur' }], | ||||
|     constructionValue: [{ required: true, message: '施工产值不能为空', trigger: 'blur' }], | ||||
|     totalValue: [{ required: true, message: '总产值不能为空', trigger: 'blur' }], | ||||
|     planMonth: [{ required: true, message: '计划月份不能为空', trigger: 'blur' }] | ||||
|   } | ||||
| }); | ||||
|  | ||||
| const { queryParams, form, rules } = toRefs(data); | ||||
|  | ||||
| /** 查询审核通过月度产值计划列表 */ | ||||
| const getList = async () => { | ||||
|   loading.value = true; | ||||
|   const res = await listMonthPlanAudit(queryParams.value); | ||||
|   monthPlanAuditList.value = res.rows; | ||||
|   total.value = res.total; | ||||
|   loading.value = false; | ||||
| }; | ||||
|  | ||||
| /** 取消按钮 */ | ||||
| const cancel = () => { | ||||
|   reset(); | ||||
|   dialog.visible = false; | ||||
| }; | ||||
|  | ||||
| /** 表单重置 */ | ||||
| const reset = () => { | ||||
|   form.value = { ...initFormData }; | ||||
|   monthPlanAuditFormRef.value?.resetFields(); | ||||
| }; | ||||
|  | ||||
| /** 搜索按钮操作 */ | ||||
| const handleQuery = () => { | ||||
|   queryParams.value.pageNum = 1; | ||||
|   getList(); | ||||
| }; | ||||
|  | ||||
| /** 重置按钮操作 */ | ||||
| const resetQuery = () => { | ||||
|   queryFormRef.value?.resetFields(); | ||||
|   handleQuery(); | ||||
| }; | ||||
|  | ||||
| /** 多选框选中数据 */ | ||||
| const handleSelectionChange = (selection: MonthPlanAuditVO[]) => { | ||||
|   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?: MonthPlanAuditVO) => { | ||||
|   reset(); | ||||
|   const _id = row?.id || ids.value[0]; | ||||
|   const res = await getMonthPlanAudit(_id); | ||||
|   Object.assign(form.value, res.data); | ||||
|   dialog.visible = true; | ||||
|   dialog.title = '修改审核通过月度产值计划'; | ||||
| }; | ||||
|  | ||||
| /** 提交按钮 */ | ||||
| const submitForm = () => { | ||||
|   monthPlanAuditFormRef.value?.validate(async (valid: boolean) => { | ||||
|     if (valid) { | ||||
|       buttonLoading.value = true; | ||||
|       if (form.value.id) { | ||||
|         await updateMonthPlanAudit(form.value).finally(() => (buttonLoading.value = false)); | ||||
|       } else { | ||||
|         await addMonthPlanAudit(form.value).finally(() => (buttonLoading.value = false)); | ||||
|       } | ||||
|       proxy?.$modal.msgSuccess('操作成功'); | ||||
|       dialog.visible = false; | ||||
|       await getList(); | ||||
|     } | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| /** 删除按钮操作 */ | ||||
| const handleDelete = async (row?: MonthPlanAuditVO) => { | ||||
|   const _ids = row?.id || ids.value; | ||||
|   await proxy?.$modal.confirm('是否确认删除审核通过月度产值计划编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false)); | ||||
|   await delMonthPlanAudit(_ids); | ||||
|   proxy?.$modal.msgSuccess('删除成功'); | ||||
|   await getList(); | ||||
| }; | ||||
|  | ||||
| /** 导出按钮操作 */ | ||||
| const handleExport = () => { | ||||
|   proxy?.download( | ||||
|     'out/monthPlanAudit/export', | ||||
|     { | ||||
|       ...queryParams.value | ||||
|     }, | ||||
|     `monthPlanAudit_${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> | ||||
							
								
								
									
										127
									
								
								src/views/out/outDesignTable/index.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										127
									
								
								src/views/out/outDesignTable/index.vue
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,127 @@ | ||||
| <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="month"> | ||||
|               <el-date-picker v-model="queryParams.month" type="month" value-format="YYYY-MM" placeholder="请选择计划月份" /> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="产值类型" prop="valueType"> | ||||
|               <el-select v-model="queryParams.valueType" placeholder="请选择产值类型"> | ||||
|                 <el-option v-for="item in out_value_type" :key="item.value" :label="item.label" :value="item.value" /> | ||||
|               </el-select> | ||||
|             </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="warning" plain icon="Download" @click="handleExport" v-hasPermi="['out:valueAllocation:export']">导出</el-button> | ||||
|           </el-col> | ||||
|           <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> | ||||
|         </el-row> | ||||
|       </template> | ||||
|  | ||||
|       <el-table v-loading="loading" :data="valueAllocationList"> | ||||
|         <el-table-column label="项目" align="center" prop="projectName" /> | ||||
|         <el-table-column label="月预计产值" align="center" prop="monthEstimatedValue" /> | ||||
|         <el-table-column label="完成产值月合计" align="center" prop="monthCompletionValue" /> | ||||
|         <el-table-column label="产值差额" align="center" prop="valueDifference" /> | ||||
|         <el-table-column label="项目总产值" align="center" prop="totalValue" /> | ||||
|         <el-table-column label="累计完成产值" align="center" prop="accumulatedCompletionValue" /> | ||||
|         <el-table-column label="项目完成率" align="center" prop="projectCompletionRate" /> | ||||
|       </el-table> | ||||
|       <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" /> | ||||
|     </el-card> | ||||
|   </div> | ||||
| </template> | ||||
|  | ||||
| <script setup name="ValueAllocation" lang="ts"> | ||||
| import { listOutTable } from '@/api/out/outDesignTable'; | ||||
| const { proxy } = getCurrentInstance() as ComponentInternalInstance; | ||||
| import { useUserStoreHook } from '@/store/modules/user'; | ||||
| import { dayjs } from 'element-plus'; | ||||
| // 获取用户 store | ||||
| const userStore = useUserStoreHook(); | ||||
| // 从 store 中获取项目列表和当前选中的项目 | ||||
| const currentProject = computed(() => userStore.selectedProject); | ||||
| const valueAllocationList = ref([]); | ||||
| const loading = ref(true); | ||||
| const showSearch = ref(true); | ||||
| const total = ref(0); | ||||
| const { out_value_type } = toRefs<any>(proxy?.useDict('out_value_type')); | ||||
|  | ||||
| const queryFormRef = ref<ElFormInstance>(); | ||||
| const data = reactive({ | ||||
|   queryParams: { | ||||
|     pageNum: 1, | ||||
|     pageSize: 10, | ||||
|     valueType: undefined, | ||||
|     projectId: currentProject.value.id, | ||||
|     month: undefined | ||||
|   } | ||||
| }); | ||||
|  | ||||
| const { queryParams } = toRefs(data); | ||||
|  | ||||
| /** 查询项目总产值分配列表 */ | ||||
| const getList = async () => { | ||||
|   loading.value = true; | ||||
|  | ||||
|   const res = await listOutTable(queryParams.value); | ||||
|   valueAllocationList.value = res.rows; | ||||
|   total.value = res.total; | ||||
|   loading.value = false; | ||||
| }; | ||||
|  | ||||
| /** 搜索按钮操作 */ | ||||
| const handleQuery = () => { | ||||
|   queryParams.value.pageNum = 1; | ||||
|   getList(); | ||||
| }; | ||||
|  | ||||
| /** 重置按钮操作 */ | ||||
| const resetQuery = () => { | ||||
|   queryFormRef.value?.resetFields(); | ||||
|   handleQuery(); | ||||
| }; | ||||
|  | ||||
| /** 导出按钮操作 */ | ||||
| const handleExport = () => { | ||||
|   proxy?.download( | ||||
|     'out/valueAllocation/export', | ||||
|     { | ||||
|       ...queryParams.value | ||||
|     }, | ||||
|     `valueAllocation_${new Date().getTime()}.xlsx` | ||||
|   ); | ||||
| }; | ||||
|  | ||||
| onMounted(() => { | ||||
|   // 也可以使用字符串格式(例如 YYYY-MM) | ||||
|   const currentMonthString = ref(dayjs().format('YYYY-MM')); | ||||
|   queryParams.value.month = currentMonthString.value; | ||||
|   getList(); | ||||
| }); | ||||
|  | ||||
| //监听项目id刷新数据 | ||||
| const listeningProject = watch( | ||||
|   () => currentProject.value.id, | ||||
|   (nid, oid) => { | ||||
|     queryParams.value.projectId = nid; | ||||
|     getList(); | ||||
|   } | ||||
| ); | ||||
|  | ||||
| onUnmounted(() => { | ||||
|   listeningProject(); | ||||
| }); | ||||
| </script> | ||||
							
								
								
									
										135
									
								
								src/views/out/outDesignTableVS/index.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										135
									
								
								src/views/out/outDesignTableVS/index.vue
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,135 @@ | ||||
| <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="month"> | ||||
|               <el-date-picker v-model="queryParams.month" type="month" value-format="YYYY-MM" placeholder="请选择计划月份" /> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="产值类型" prop="valueType"> | ||||
|               <el-select v-model="queryParams.valueType" placeholder="请选择产值类型"> | ||||
|                 <el-option v-for="item in out_value_type" :key="item.value" :label="item.label" :value="item.value" /> | ||||
|               </el-select> | ||||
|             </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="warning" plain icon="Download" @click="handleExport" v-hasPermi="['out:valueAllocation:export']">导出</el-button> | ||||
|           </el-col> | ||||
|           <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> | ||||
|         </el-row> | ||||
|       </template> | ||||
|  | ||||
|       <el-table v-loading="loading" :data="valueAllocationList"> | ||||
|         <el-table-column label="项目" align="center" prop="projectName" /> | ||||
|         <el-table-column label="累计完工产值" align="center" prop="totalCompletionOutputValue" /> | ||||
|         <el-table-column label="累计结算产值" align="center" prop="totalSettlementOutputValue" /> | ||||
|         <el-table-column label="完工未结算额" align="center" prop="completionUnsettledAmount" /> | ||||
|         <el-table-column label="完工未结算比例" align="center" prop="completionUnsettledRatio" /> | ||||
|         <el-table-column label="操作" align="center"> | ||||
|           <template #default="scope"> | ||||
|             <el-button type="primary" @click="handleEdit(scope.row)" link icon="Position">联查分包结算</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> | ||||
|   </div> | ||||
| </template> | ||||
|  | ||||
| <script setup name="ValueAllocation" lang="ts"> | ||||
| import { listOutTable } from '@/api/out/outDesignTableVS'; | ||||
| const { proxy } = getCurrentInstance() as ComponentInternalInstance; | ||||
| import { useUserStoreHook } from '@/store/modules/user'; | ||||
| import { dayjs } from 'element-plus'; | ||||
| // 获取用户 store | ||||
| const userStore = useUserStoreHook(); | ||||
| // 从 store 中获取项目列表和当前选中的项目 | ||||
| const currentProject = computed(() => userStore.selectedProject); | ||||
| const valueAllocationList = ref([]); | ||||
| const loading = ref(true); | ||||
| const showSearch = ref(true); | ||||
| const total = ref(0); | ||||
| const { out_value_type } = toRefs<any>(proxy?.useDict('out_value_type')); | ||||
|  | ||||
| const queryFormRef = ref<ElFormInstance>(); | ||||
| const data = reactive({ | ||||
|   queryParams: { | ||||
|     pageNum: 1, | ||||
|     pageSize: 10, | ||||
|     valueType: '1', | ||||
|     projectId: currentProject.value.id, | ||||
|     month: undefined | ||||
|   } | ||||
| }); | ||||
|  | ||||
| const { queryParams } = toRefs(data); | ||||
|  | ||||
| /** 查询项目总产值分配列表 */ | ||||
| const getList = async () => { | ||||
|   loading.value = true; | ||||
|  | ||||
|   const res = await listOutTable(queryParams.value); | ||||
|   valueAllocationList.value = res.rows; | ||||
|   total.value = res.total; | ||||
|   loading.value = false; | ||||
| }; | ||||
|  | ||||
| /** 搜索按钮操作 */ | ||||
| const handleQuery = () => { | ||||
|   queryParams.value.pageNum = 1; | ||||
|   getList(); | ||||
| }; | ||||
|  | ||||
| /** 联查分包结算 */ | ||||
| const handleEdit = (row: any) => { | ||||
|   proxy?.$tab.openPage('/out/settlementValueSubcontract'); | ||||
| }; | ||||
|  | ||||
| /** 重置按钮操作 */ | ||||
| const resetQuery = () => { | ||||
|   queryFormRef.value?.resetFields(); | ||||
|   handleQuery(); | ||||
| }; | ||||
|  | ||||
| /** 导出按钮操作 */ | ||||
| const handleExport = () => { | ||||
|   proxy?.download( | ||||
|     'out/valueAllocation/export', | ||||
|     { | ||||
|       ...queryParams.value | ||||
|     }, | ||||
|     `valueAllocation_${new Date().getTime()}.xlsx` | ||||
|   ); | ||||
| }; | ||||
|  | ||||
| onMounted(() => { | ||||
|   // 也可以使用字符串格式(例如 YYYY-MM) | ||||
|   const currentMonthString = ref(dayjs().format('YYYY-MM')); | ||||
|   queryParams.value.month = currentMonthString.value; | ||||
|   getList(); | ||||
| }); | ||||
|  | ||||
| //监听项目id刷新数据 | ||||
| const listeningProject = watch( | ||||
|   () => currentProject.value.id, | ||||
|   (nid, oid) => { | ||||
|     queryParams.value.projectId = nid; | ||||
|     getList(); | ||||
|   } | ||||
| ); | ||||
|  | ||||
| onUnmounted(() => { | ||||
|   listeningProject(); | ||||
| }); | ||||
| </script> | ||||
							
								
								
									
										127
									
								
								src/views/out/outTable/index.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										127
									
								
								src/views/out/outTable/index.vue
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,127 @@ | ||||
| <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="month"> | ||||
|               <el-date-picker v-model="queryParams.month" type="month" value-format="YYYY-MM" 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> | ||||
|             </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="warning" plain icon="Download" @click="handleExport" v-hasPermi="['out:valueAllocation:export']">导出</el-button> | ||||
|           </el-col> | ||||
|           <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> | ||||
|         </el-row> | ||||
|       </template> | ||||
|  | ||||
|       <el-table v-loading="loading" :data="valueAllocationList"> | ||||
|         <el-table-column label="项目" align="center" prop="projectName" /> | ||||
|         <el-table-column label="项目总产值" align="center" prop="totalValue" /> | ||||
|         <el-table-column label="月预计产值" align="center" prop="monthlyEstimatedValue" /> | ||||
|         <el-table-column label="完成产值(第一周)" align="center" prop="firstWeekCompletionValue" /> | ||||
|         <el-table-column label="完成产值(第二周)" align="center" prop="secondWeekCompletionValue" /> | ||||
|         <el-table-column label="完成产值(第三周)" align="center" prop="thirdWeekCompletionValue" /> | ||||
|         <el-table-column label="完成产值(第四周)" align="center" prop="fourthWeekCompletionValue" /> | ||||
|         <el-table-column label="完成产值(第五周)" align="center" prop="fifthWeekCompletionValue" /> | ||||
|         <el-table-column label="完成产值月合计" align="center" prop="totalCompletionValue" /> | ||||
|         <el-table-column label="产值差额" align="center" prop="valueDifference" /> | ||||
|         <el-table-column label="预计累计产值" align="center" prop="estimatedAccumulatedValue" /> | ||||
|         <el-table-column label="累计完成产值" align="center" prop="accumulatedCompletionValue" /> | ||||
|         <el-table-column label="产值差额" align="center" prop="valueDifferenceAccumulation" /> | ||||
|         <el-table-column label="项目完成总进度" align="center" prop="totalCompletionProgress" /> | ||||
|       </el-table> | ||||
|       <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" /> | ||||
|     </el-card> | ||||
|   </div> | ||||
| </template> | ||||
|  | ||||
| <script setup name="ValueAllocation" lang="ts"> | ||||
| import { listOutTable } from '@/api/out/outTable'; | ||||
| const { proxy } = getCurrentInstance() as ComponentInternalInstance; | ||||
| import { useUserStoreHook } from '@/store/modules/user'; | ||||
| import { dayjs } from 'element-plus'; | ||||
| // 获取用户 store | ||||
| const userStore = useUserStoreHook(); | ||||
| // 从 store 中获取项目列表和当前选中的项目 | ||||
| const currentProject = computed(() => userStore.selectedProject); | ||||
| const valueAllocationList = ref([]); | ||||
| const loading = ref(true); | ||||
| const showSearch = ref(true); | ||||
| const total = ref(0); | ||||
|  | ||||
| const queryFormRef = ref<ElFormInstance>(); | ||||
| const data = reactive({ | ||||
|   queryParams: { | ||||
|     pageNum: 1, | ||||
|     pageSize: 10, | ||||
|     projectId: currentProject.value.id, | ||||
|     month: undefined | ||||
|   } | ||||
| }); | ||||
|  | ||||
| const { queryParams } = toRefs(data); | ||||
|  | ||||
| /** 查询项目总产值分配列表 */ | ||||
| const getList = async () => { | ||||
|   loading.value = true; | ||||
|  | ||||
|   const res = await listOutTable(queryParams.value); | ||||
|   valueAllocationList.value = res.rows; | ||||
|   total.value = res.total; | ||||
|   loading.value = false; | ||||
| }; | ||||
|  | ||||
| /** 搜索按钮操作 */ | ||||
| const handleQuery = () => { | ||||
|   queryParams.value.pageNum = 1; | ||||
|   getList(); | ||||
| }; | ||||
|  | ||||
| /** 重置按钮操作 */ | ||||
| const resetQuery = () => { | ||||
|   queryFormRef.value?.resetFields(); | ||||
|   handleQuery(); | ||||
| }; | ||||
|  | ||||
| /** 导出按钮操作 */ | ||||
| const handleExport = () => { | ||||
|   proxy?.download( | ||||
|     'out/valueAllocation/export', | ||||
|     { | ||||
|       ...queryParams.value | ||||
|     }, | ||||
|     `valueAllocation_${new Date().getTime()}.xlsx` | ||||
|   ); | ||||
| }; | ||||
|  | ||||
| onMounted(() => { | ||||
|   // 也可以使用字符串格式(例如 YYYY-MM) | ||||
|   const currentMonthString = ref(dayjs().format('YYYY-MM')); | ||||
|   queryParams.value.month = currentMonthString.value; | ||||
|   getList(); | ||||
| }); | ||||
|  | ||||
| //监听项目id刷新数据 | ||||
| const listeningProject = watch( | ||||
|   () => currentProject.value.id, | ||||
|   (nid, oid) => { | ||||
|     queryParams.value.projectId = nid; | ||||
|     getList(); | ||||
|   } | ||||
| ); | ||||
|  | ||||
| onUnmounted(() => { | ||||
|   listeningProject(); | ||||
| }); | ||||
| </script> | ||||
							
								
								
									
										130
									
								
								src/views/out/ownerSettlement/index.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										130
									
								
								src/views/out/ownerSettlement/index.vue
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,130 @@ | ||||
| <!-- 结算产值 VS 业主结算报表z --> | ||||
| <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="month"> | ||||
|               <el-date-picker v-model="queryParams.month" type="month" value-format="YYYY-MM" 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> | ||||
|             </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="warning" plain icon="Download" @click="handleExport" v-hasPermi="['out:valueAllocation:export']">导出</el-button> | ||||
|           </el-col> | ||||
|           <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> | ||||
|         </el-row> | ||||
|       </template> | ||||
|  | ||||
|       <el-table v-loading="loading" :data="valueAllocationList"> | ||||
|         <el-table-column label="项目" align="center" prop="projectName" /> | ||||
|         <el-table-column label="累计完工产值" align="center" prop="totalCompletionOutputValue" /> | ||||
|         <el-table-column label="分包结算金额" align="center" prop="subTotalSettlementOutputValue" /> | ||||
|         <el-table-column label="业主结算金额" align="center" prop="ownerTotalSettlementOutputValue" /> | ||||
|         <el-table-column label="业主结算-分包结算" align="center" prop="differenceValue" /> | ||||
|         <el-table-column label="操作" align="center"> | ||||
|           <template #default="scope"> | ||||
|             <el-button type="primary" @click="handleEdit(scope.row)" link icon="Position">联查分包结算</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> | ||||
|   </div> | ||||
| </template> | ||||
|  | ||||
| <script setup name="ValueAllocation" lang="ts"> | ||||
| import { listOutTable } from '@/api/out/ownerSettlement'; | ||||
| const { proxy } = getCurrentInstance() as ComponentInternalInstance; | ||||
| import { useUserStoreHook } from '@/store/modules/user'; | ||||
| import { dayjs } from 'element-plus'; | ||||
| // 获取用户 store | ||||
| const userStore = useUserStoreHook(); | ||||
| // 从 store 中获取项目列表和当前选中的项目 | ||||
| const currentProject = computed(() => userStore.selectedProject); | ||||
| const valueAllocationList = ref([]); | ||||
| const loading = ref(true); | ||||
| const showSearch = ref(true); | ||||
| const total = ref(0); | ||||
|  | ||||
| const queryFormRef = ref<ElFormInstance>(); | ||||
| const data = reactive({ | ||||
|   queryParams: { | ||||
|     pageNum: 1, | ||||
|     pageSize: 10, | ||||
|     valueType: undefined, | ||||
|     projectId: currentProject.value.id, | ||||
|     month: undefined | ||||
|   } | ||||
| }); | ||||
|  | ||||
| const { queryParams } = toRefs(data); | ||||
|  | ||||
| /** 查询项目总产值分配列表 */ | ||||
| const getList = async () => { | ||||
|   loading.value = true; | ||||
|  | ||||
|   const res = await listOutTable(queryParams.value); | ||||
|   valueAllocationList.value = res.rows; | ||||
|   total.value = res.total; | ||||
|   loading.value = false; | ||||
| }; | ||||
|  | ||||
| /** 搜索按钮操作 */ | ||||
| const handleQuery = () => { | ||||
|   queryParams.value.pageNum = 1; | ||||
|   getList(); | ||||
| }; | ||||
|  | ||||
| /** 联查分包结算 */ | ||||
| const handleEdit = (row: any) => { | ||||
|   proxy?.$tab.openPage('/out/settlementValueSubcontract'); | ||||
| }; | ||||
|  | ||||
| /** 重置按钮操作 */ | ||||
| const resetQuery = () => { | ||||
|   queryFormRef.value?.resetFields(); | ||||
|   handleQuery(); | ||||
| }; | ||||
|  | ||||
| /** 导出按钮操作 */ | ||||
| const handleExport = () => { | ||||
|   proxy?.download( | ||||
|     'out/valueAllocation/export', | ||||
|     { | ||||
|       ...queryParams.value | ||||
|     }, | ||||
|     `valueAllocation_${new Date().getTime()}.xlsx` | ||||
|   ); | ||||
| }; | ||||
|  | ||||
| onMounted(() => { | ||||
|   // 也可以使用字符串格式(例如 YYYY-MM) | ||||
|   const currentMonthString = ref(dayjs().format('YYYY-MM')); | ||||
|   queryParams.value.month = currentMonthString.value; | ||||
|   getList(); | ||||
| }); | ||||
|  | ||||
| //监听项目id刷新数据 | ||||
| const listeningProject = watch( | ||||
|   () => currentProject.value.id, | ||||
|   (nid, oid) => { | ||||
|     queryParams.value.projectId = nid; | ||||
|     getList(); | ||||
|   } | ||||
| ); | ||||
|  | ||||
| onUnmounted(() => { | ||||
|   listeningProject(); | ||||
| }); | ||||
| </script> | ||||
							
								
								
									
										292
									
								
								src/views/out/settlementValueOwner/index.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										292
									
								
								src/views/out/settlementValueOwner/index.vue
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,292 @@ | ||||
| <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="valueType"> | ||||
|               <el-select v-model="queryParams.valueType" placeholder="请选择产值类型"> | ||||
|                 <el-option v-for="item in out_value_type" :key="item.value" :label="item.label" :value="item.value" /> | ||||
|               </el-select> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="结算日期" prop="settlementDate"> | ||||
|               <el-date-picker clearable v-model="queryParams.settlementDate" 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> | ||||
|             </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="['out:settlementValueOwner:add']">新增</el-button> | ||||
|           </el-col> | ||||
|           <el-col :span="1.5"> | ||||
|             <el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['out:settlementValueOwner:edit']" | ||||
|               >修改</el-button | ||||
|             > | ||||
|           </el-col> | ||||
|           <el-col :span="1.5"> | ||||
|             <el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['out:settlementValueOwner:remove']" | ||||
|               >删除</el-button | ||||
|             > | ||||
|           </el-col> | ||||
|           <el-col :span="1.5"> | ||||
|             <el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['out:settlementValueOwner:export']">导出</el-button> | ||||
|           </el-col> | ||||
|           <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> | ||||
|         </el-row> | ||||
|       </template> | ||||
|  | ||||
|       <el-table v-loading="loading" :data="settlementValueOwnerList" @selection-change="handleSelectionChange"> | ||||
|         <el-table-column type="selection" width="55" align="center" /> | ||||
|         <el-table-column label="填报人" align="center" prop="createByName" /> | ||||
|         <el-table-column label="结算产值" align="center" prop="settlementValue" /> | ||||
|         <el-table-column label="产值类型" align="center" prop="valueType"> | ||||
|           <template #default="scope"> | ||||
|             <dict-tag :options="out_value_type" :value="scope.row.valueType" /> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <el-table-column label="结算日期" align="center" prop="settlementDate" width="180"> | ||||
|           <template #default="scope"> | ||||
|             <span>{{ parseTime(scope.row.settlementDate, '{y}-{m}-{d}') }}</span> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <el-table-column label="填报日期" align="center" prop="createTime" width="180"> | ||||
|           <template #default="scope"> | ||||
|             <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <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="['out:settlementValueOwner:edit']"></el-button> | ||||
|             </el-tooltip> | ||||
|             <el-tooltip content="删除" placement="top"> | ||||
|               <el-button | ||||
|                 link | ||||
|                 type="primary" | ||||
|                 icon="Delete" | ||||
|                 @click="handleDelete(scope.row)" | ||||
|                 v-hasPermi="['out:settlementValueOwner: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="settlementValueOwnerFormRef" :model="form" :rules="rules" label-width="80px"> | ||||
|         <el-form-item label="结算产值" prop="settlementValue"> | ||||
|           <el-input v-model="form.settlementValue" placeholder="请输入结算产值" /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="产值类型" prop="valueType"> | ||||
|           <el-select v-model="form.valueType" placeholder="请选择产值类型"> | ||||
|             <el-option v-for="item in out_value_type" :key="item.value" :label="item.label" :value="item.value" /> | ||||
|           </el-select> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="说明" prop="remark"> | ||||
|           <el-input v-model="form.remark" placeholder="请输入说明" /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="结算日期" prop="settlementDate"> | ||||
|           <el-date-picker clearable v-model="form.settlementDate" type="date" value-format="YYYY-MM-DD" placeholder="请选择结算日期"> | ||||
|           </el-date-picker> | ||||
|         </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="SettlementValueOwner" lang="ts"> | ||||
| import { | ||||
|   listSettlementValueOwner, | ||||
|   getSettlementValueOwner, | ||||
|   delSettlementValueOwner, | ||||
|   addSettlementValueOwner, | ||||
|   updateSettlementValueOwner | ||||
| } from '@/api/out/settlementValueOwner'; | ||||
| import { SettlementValueOwnerVO, SettlementValueOwnerQuery, SettlementValueOwnerForm } from '@/api/out/settlementValueOwner/types'; | ||||
|  | ||||
| const { proxy } = getCurrentInstance() as ComponentInternalInstance; | ||||
| const { out_value_type } = toRefs<any>(proxy?.useDict('out_value_type')); | ||||
|  | ||||
| import { useUserStoreHook } from '@/store/modules/user'; | ||||
| // 获取用户 store | ||||
| const userStore = useUserStoreHook(); | ||||
| // 从 store 中获取项目列表和当前选中的项目 | ||||
| const currentProject = computed(() => userStore.selectedProject); | ||||
| const settlementValueOwnerList = ref<SettlementValueOwnerVO[]>([]); | ||||
| 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 settlementValueOwnerFormRef = ref<ElFormInstance>(); | ||||
|  | ||||
| const dialog = reactive<DialogOption>({ | ||||
|   visible: false, | ||||
|   title: '' | ||||
| }); | ||||
|  | ||||
| const initFormData: SettlementValueOwnerForm = { | ||||
|   id: undefined, | ||||
|   projectId: currentProject.value.id, | ||||
|   settlementValue: undefined, | ||||
|   valueType: undefined, | ||||
|   remark: undefined, | ||||
|   settlementDate: undefined | ||||
| }; | ||||
| const data = reactive<PageData<SettlementValueOwnerForm, SettlementValueOwnerQuery>>({ | ||||
|   form: { ...initFormData }, | ||||
|   queryParams: { | ||||
|     pageNum: 1, | ||||
|     pageSize: 10, | ||||
|     projectId: currentProject.value.id, | ||||
|     settlementValue: undefined, | ||||
|     valueType: undefined, | ||||
|     settlementDate: undefined, | ||||
|     params: {} | ||||
|   }, | ||||
|   rules: { | ||||
|     id: [{ required: true, message: '主键ID不能为空', trigger: 'blur' }], | ||||
|     projectId: [{ required: true, message: '项目ID不能为空', trigger: 'blur' }], | ||||
|     settlementValue: [{ required: true, message: '结算产值不能为空', trigger: 'blur' }], | ||||
|     valueType: [{ required: true, message: '产值类型不能为空', trigger: 'change' }], | ||||
|     settlementDate: [{ required: true, message: '结算日期不能为空', trigger: 'change' }] | ||||
|   } | ||||
| }); | ||||
|  | ||||
| const { queryParams, form, rules } = toRefs(data); | ||||
|  | ||||
| /** 查询结算产值登记(对甲)列表 */ | ||||
| const getList = async () => { | ||||
|   loading.value = true; | ||||
|   const res = await listSettlementValueOwner(queryParams.value); | ||||
|   settlementValueOwnerList.value = res.rows; | ||||
|   total.value = res.total; | ||||
|   loading.value = false; | ||||
| }; | ||||
|  | ||||
| /** 取消按钮 */ | ||||
| const cancel = () => { | ||||
|   reset(); | ||||
|   dialog.visible = false; | ||||
| }; | ||||
|  | ||||
| /** 表单重置 */ | ||||
| const reset = () => { | ||||
|   form.value = { ...initFormData }; | ||||
|   settlementValueOwnerFormRef.value?.resetFields(); | ||||
| }; | ||||
|  | ||||
| /** 搜索按钮操作 */ | ||||
| const handleQuery = () => { | ||||
|   queryParams.value.pageNum = 1; | ||||
|   getList(); | ||||
| }; | ||||
|  | ||||
| /** 重置按钮操作 */ | ||||
| const resetQuery = () => { | ||||
|   queryFormRef.value?.resetFields(); | ||||
|   handleQuery(); | ||||
| }; | ||||
|  | ||||
| /** 多选框选中数据 */ | ||||
| const handleSelectionChange = (selection: SettlementValueOwnerVO[]) => { | ||||
|   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?: SettlementValueOwnerVO) => { | ||||
|   reset(); | ||||
|   const _id = row?.id || ids.value[0]; | ||||
|   const res = await getSettlementValueOwner(_id); | ||||
|   Object.assign(form.value, res.data); | ||||
|   dialog.visible = true; | ||||
|   dialog.title = '修改结算产值登记(对甲)'; | ||||
| }; | ||||
|  | ||||
| /** 提交按钮 */ | ||||
| const submitForm = () => { | ||||
|   settlementValueOwnerFormRef.value?.validate(async (valid: boolean) => { | ||||
|     if (valid) { | ||||
|       buttonLoading.value = true; | ||||
|       if (form.value.id) { | ||||
|         await updateSettlementValueOwner(form.value).finally(() => (buttonLoading.value = false)); | ||||
|       } else { | ||||
|         await addSettlementValueOwner(form.value).finally(() => (buttonLoading.value = false)); | ||||
|       } | ||||
|       proxy?.$modal.msgSuccess('操作成功'); | ||||
|       dialog.visible = false; | ||||
|       await getList(); | ||||
|     } | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| /** 删除按钮操作 */ | ||||
| const handleDelete = async (row?: SettlementValueOwnerVO) => { | ||||
|   const _ids = row?.id || ids.value; | ||||
|   await proxy?.$modal.confirm('是否确认删除结算产值登记(对甲)编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false)); | ||||
|   await delSettlementValueOwner(_ids); | ||||
|   proxy?.$modal.msgSuccess('删除成功'); | ||||
|   await getList(); | ||||
| }; | ||||
|  | ||||
| /** 导出按钮操作 */ | ||||
| const handleExport = () => { | ||||
|   proxy?.download( | ||||
|     'out/settlementValueOwner/export', | ||||
|     { | ||||
|       ...queryParams.value | ||||
|     }, | ||||
|     `settlementValueOwner_${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> | ||||
							
								
								
									
										366
									
								
								src/views/out/settlementValueSubcontract/index.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										366
									
								
								src/views/out/settlementValueSubcontract/index.vue
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,366 @@ | ||||
| <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="valueType"> | ||||
|               <el-select v-model="queryParams.valueType" placeholder="请选择产值类型"> | ||||
|                 <el-option v-for="item in out_value_type" :key="item.value" :label="item.label" :value="item.value" /> | ||||
|               </el-select> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="结算周期" prop="settlementMonth"> | ||||
|               <el-date-picker clearable v-model="queryParams.settlementMonth" type="month" value-format="YYYY-MM" 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> | ||||
|             </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="['out:settlementValueSubcontract:add']">新增</el-button> | ||||
|           </el-col> | ||||
|           <el-col :span="1.5"> | ||||
|             <el-button | ||||
|               type="success" | ||||
|               plain | ||||
|               icon="Edit" | ||||
|               :disabled="single" | ||||
|               @click="handleUpdate()" | ||||
|               v-hasPermi="['out:settlementValueSubcontract:edit']" | ||||
|               >修改</el-button | ||||
|             > | ||||
|           </el-col> | ||||
|           <el-col :span="1.5"> | ||||
|             <el-button | ||||
|               type="danger" | ||||
|               plain | ||||
|               icon="Delete" | ||||
|               :disabled="multiple" | ||||
|               @click="handleDelete()" | ||||
|               v-hasPermi="['out:settlementValueSubcontract:remove']" | ||||
|               >删除</el-button | ||||
|             > | ||||
|           </el-col> | ||||
|           <el-col :span="1.5"> | ||||
|             <el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['out:settlementValueSubcontract:export']" | ||||
|               >导出</el-button | ||||
|             > | ||||
|           </el-col> | ||||
|           <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> | ||||
|         </el-row> | ||||
|       </template> | ||||
|  | ||||
|       <el-table v-loading="loading" :data="settlementValueSubcontractList" @selection-change="handleSelectionChange"> | ||||
|         <el-table-column type="selection" width="55" align="center" /> | ||||
|         <el-table-column label="分包单位" align="center" prop="contractorName" /> | ||||
|         <el-table-column label="单据编码" align="center" prop="documentCode" /> | ||||
|         <el-table-column label="结算说明" align="center" prop="settlementDescribe" /> | ||||
|         <el-table-column label="产值类型" align="center" prop="valueType"> | ||||
|           <template #default="scope"> | ||||
|             <dict-tag :options="out_value_type" :value="scope.row.valueType" /> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <el-table-column label="结算周期" align="center" prop="settlementMonth" /> | ||||
|         <el-table-column label="结算日期" align="center" prop="settlementDate" width="180"> | ||||
|           <template #default="scope"> | ||||
|             <span>{{ parseTime(scope.row.settlementDate, '{y}-{m}-{d}') }}</span> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <el-table-column label="结算产值" align="center" prop="settlementValue" /> | ||||
|         <el-table-column label="说明" align="center" prop="remark" /> | ||||
|         <el-table-column label="合同编码" align="center" prop="contractCode" /> | ||||
|         <el-table-column label="合同名称" align="center" prop="contractName" /> | ||||
|         <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="['out:settlementValueSubcontract:edit']" | ||||
|               ></el-button> | ||||
|             </el-tooltip> | ||||
|             <el-tooltip content="删除" placement="top"> | ||||
|               <el-button | ||||
|                 link | ||||
|                 type="primary" | ||||
|                 icon="Delete" | ||||
|                 @click="handleDelete(scope.row)" | ||||
|                 v-hasPermi="['out:settlementValueSubcontract: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="settlementValueSubcontractFormRef" :model="form" :rules="rules" label-width="100px"> | ||||
|         <el-form-item label="单据编码" prop="documentCode"> | ||||
|           <el-input v-model="form.documentCode" placeholder="请输入单据编码" /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="结算说明" prop="settlementDescribe"> | ||||
|           <el-input v-model="form.settlementDescribe" placeholder="请输入结算说明" /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="结算周期" prop="settlementMonth"> | ||||
|           <el-date-picker clearable v-model="form.settlementMonth" type="month" value-format="YYYY-MM" placeholder="请选择结算周期"> </el-date-picker> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="结算日期" prop="settlementDate"> | ||||
|           <el-date-picker clearable v-model="form.settlementDate" type="date" value-format="YYYY-MM-DD" placeholder="请选择结算日期"> | ||||
|           </el-date-picker> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="产值类型" prop="valueType"> | ||||
|           <el-select v-model="form.valueType" placeholder="请选择产值类型"> | ||||
|             <el-option v-for="item in out_value_type" :key="item.value" :label="item.label" :value="item.value" /> | ||||
|           </el-select> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="分包单位" prop="contractorId"> | ||||
|           <el-select v-model="form.contractorId" value-key="id" placeholder="请选择分包单位" clearable filterable @change=""> | ||||
|             <el-option v-for="item in contractorList" :key="item.id" :label="item.name" :value="item.id"> </el-option> | ||||
|           </el-select> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="结算产值" prop="settlementValue"> | ||||
|           <el-input v-model="form.settlementValue" placeholder="请输入结算产值" /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="说明" prop="remark"> | ||||
|           <el-input v-model="form.remark" placeholder="请输入说明" /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="合同编码" prop="contractCode"> | ||||
|           <el-input v-model="form.contractCode" placeholder="请输入合同编码" /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="合同名称" prop="contractName"> | ||||
|           <el-input v-model="form.contractName" placeholder="请输入合同名称" /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="合同地址" prop="contractUrl"> | ||||
|           <el-input v-model="form.contractUrl" 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="SettlementValueSubcontract" lang="ts"> | ||||
| import { | ||||
|   listSettlementValueSubcontract, | ||||
|   getSettlementValueSubcontract, | ||||
|   delSettlementValueSubcontract, | ||||
|   addSettlementValueSubcontract, | ||||
|   updateSettlementValueSubcontract | ||||
| } from '@/api/out/settlementValueSubcontract'; | ||||
| import { | ||||
|   SettlementValueSubcontractVO, | ||||
|   SettlementValueSubcontractQuery, | ||||
|   SettlementValueSubcontractForm | ||||
| } from '@/api/out/settlementValueSubcontract/types'; | ||||
| import { listContractor } from '@/api/project/contractor'; | ||||
| import { ContractorVO } from '@/api/project/contractor/types'; | ||||
|  | ||||
| const { proxy } = getCurrentInstance() as ComponentInternalInstance; | ||||
| const { out_value_type } = toRefs<any>(proxy?.useDict('out_value_type')); | ||||
| import { useUserStoreHook } from '@/store/modules/user'; | ||||
| // 获取用户 store | ||||
| const userStore = useUserStoreHook(); | ||||
| // 从 store 中获取项目列表和当前选中的项目 | ||||
| const currentProject = computed(() => userStore.selectedProject); | ||||
| const settlementValueSubcontractList = ref<SettlementValueSubcontractVO[]>([]); | ||||
| 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 settlementValueSubcontractFormRef = ref<ElFormInstance>(); | ||||
|  | ||||
| const dialog = reactive<DialogOption>({ | ||||
|   visible: false, | ||||
|   title: '' | ||||
| }); | ||||
|  | ||||
| const initFormData: SettlementValueSubcontractForm = { | ||||
|   id: undefined, | ||||
|   projectId: currentProject.value.id, | ||||
|   documentCode: undefined, | ||||
|   settlementDescribe: undefined, | ||||
|   valueType: undefined, | ||||
|   settlementMonth: undefined, | ||||
|   settlementDate: undefined, | ||||
|   contractorId: undefined, | ||||
|   contractorName: undefined, | ||||
|   settlementValue: undefined, | ||||
|   remark: undefined, | ||||
|   contractCode: undefined, | ||||
|   contractName: undefined, | ||||
|   contractUrl: undefined | ||||
| }; | ||||
| const data = reactive<PageData<SettlementValueSubcontractForm, SettlementValueSubcontractQuery>>({ | ||||
|   form: { ...initFormData }, | ||||
|   queryParams: { | ||||
|     pageNum: 1, | ||||
|     pageSize: 10, | ||||
|     projectId: currentProject.value.id, | ||||
|     documentCode: undefined, | ||||
|     settlementDescribe: undefined, | ||||
|     valueType: undefined, | ||||
|     settlementMonth: undefined, | ||||
|     settlementDate: undefined, | ||||
|     contractorId: undefined, | ||||
|     contractorName: undefined, | ||||
|     settlementValue: undefined, | ||||
|     contractCode: undefined, | ||||
|     contractName: undefined, | ||||
|     contractUrl: undefined, | ||||
|     params: {} | ||||
|   }, | ||||
|   rules: { | ||||
|     id: [{ required: true, message: '主键ID不能为空', trigger: 'blur' }], | ||||
|     projectId: [{ required: true, message: '项目ID不能为空', trigger: 'blur' }], | ||||
|     settlementMonth: [{ required: true, message: '结算周期不能为空', trigger: 'blur' }], | ||||
|     settlementDate: [{ required: true, message: '结算日期不能为空', trigger: 'blur' }], | ||||
|     settlementValue: [{ required: true, message: '结算产值不能为空', trigger: 'blur' }] | ||||
|   } | ||||
| }); | ||||
|  | ||||
| const { queryParams, form, rules } = toRefs(data); | ||||
|  | ||||
| /** 查询结算产值登记(对乙)列表 */ | ||||
| const getList = async () => { | ||||
|   loading.value = true; | ||||
|   const res = await listSettlementValueSubcontract(queryParams.value); | ||||
|   settlementValueSubcontractList.value = res.rows; | ||||
|   total.value = res.total; | ||||
|   loading.value = false; | ||||
| }; | ||||
|  | ||||
| //获取分包单位 | ||||
| const contractorList = ref<ContractorVO[]>([]); | ||||
| const getContractorList = async () => { | ||||
|   const res = await listContractor({ projectId: currentProject.value.id } as any); | ||||
|   contractorList.value = res.rows; | ||||
| }; | ||||
|  | ||||
| /** 取消按钮 */ | ||||
| const cancel = () => { | ||||
|   reset(); | ||||
|   dialog.visible = false; | ||||
| }; | ||||
|  | ||||
| /** 表单重置 */ | ||||
| const reset = () => { | ||||
|   form.value = { ...initFormData }; | ||||
|   settlementValueSubcontractFormRef.value?.resetFields(); | ||||
| }; | ||||
|  | ||||
| /** 搜索按钮操作 */ | ||||
| const handleQuery = () => { | ||||
|   queryParams.value.pageNum = 1; | ||||
|   getList(); | ||||
| }; | ||||
|  | ||||
| /** 重置按钮操作 */ | ||||
| const resetQuery = () => { | ||||
|   queryFormRef.value?.resetFields(); | ||||
|   handleQuery(); | ||||
| }; | ||||
|  | ||||
| /** 多选框选中数据 */ | ||||
| const handleSelectionChange = (selection: SettlementValueSubcontractVO[]) => { | ||||
|   ids.value = selection.map((item) => item.id); | ||||
|   single.value = selection.length != 1; | ||||
|   multiple.value = !selection.length; | ||||
| }; | ||||
|  | ||||
| /** 新增按钮操作 */ | ||||
| const handleAdd = () => { | ||||
|   reset(); | ||||
|   dialog.visible = true; | ||||
|   getContractorList(); | ||||
|   dialog.title = '添加结算产值登记(对乙)'; | ||||
| }; | ||||
|  | ||||
| /** 修改按钮操作 */ | ||||
| const handleUpdate = async (row?: SettlementValueSubcontractVO) => { | ||||
|   reset(); | ||||
|   const _id = row?.id || ids.value[0]; | ||||
|   await getContractorList(); | ||||
|   const res = await getSettlementValueSubcontract(_id); | ||||
|   Object.assign(form.value, res.data); | ||||
|   dialog.visible = true; | ||||
|   dialog.title = '修改结算产值登记(对乙)'; | ||||
| }; | ||||
|  | ||||
| /** 提交按钮 */ | ||||
| const submitForm = () => { | ||||
|   settlementValueSubcontractFormRef.value?.validate(async (valid: boolean) => { | ||||
|     if (valid) { | ||||
|       buttonLoading.value = true; | ||||
|       if (form.value.id) { | ||||
|         await updateSettlementValueSubcontract(form.value).finally(() => (buttonLoading.value = false)); | ||||
|       } else { | ||||
|         await addSettlementValueSubcontract(form.value).finally(() => (buttonLoading.value = false)); | ||||
|       } | ||||
|       proxy?.$modal.msgSuccess('操作成功'); | ||||
|       dialog.visible = false; | ||||
|       await getList(); | ||||
|     } | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| /** 删除按钮操作 */ | ||||
| const handleDelete = async (row?: SettlementValueSubcontractVO) => { | ||||
|   const _ids = row?.id || ids.value; | ||||
|   await proxy?.$modal.confirm('是否确认删除结算产值登记(对乙)编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false)); | ||||
|   await delSettlementValueSubcontract(_ids); | ||||
|   proxy?.$modal.msgSuccess('删除成功'); | ||||
|   await getList(); | ||||
| }; | ||||
|  | ||||
| /** 导出按钮操作 */ | ||||
| const handleExport = () => { | ||||
|   proxy?.download( | ||||
|     'out/settlementValueSubcontract/export', | ||||
|     { | ||||
|       ...queryParams.value | ||||
|     }, | ||||
|     `settlementValueSubcontract_${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> | ||||
							
								
								
									
										272
									
								
								src/views/out/valueAllocation/index.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										272
									
								
								src/views/out/valueAllocation/index.vue
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,272 @@ | ||||
| <template> | ||||
|   <div class="p-2"> | ||||
|     <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="['out:valueAllocation:add']">新增</el-button> | ||||
|           </el-col> | ||||
|           <el-col :span="1.5"> | ||||
|             <el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['out:valueAllocation:edit']" | ||||
|               >修改</el-button | ||||
|             > | ||||
|           </el-col> | ||||
|           <el-col :span="1.5"> | ||||
|             <el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['out:valueAllocation:remove']" | ||||
|               >删除</el-button | ||||
|             > | ||||
|           </el-col> | ||||
|           <el-col :span="1.5"> | ||||
|             <el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['out:valueAllocation:export']">导出</el-button> | ||||
|           </el-col> | ||||
|           <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> | ||||
|         </el-row> | ||||
|       </template> | ||||
|  | ||||
|       <el-table v-loading="loading" :data="valueAllocationList" @selection-change="handleSelectionChange"> | ||||
|         <el-table-column type="selection" width="55" align="center" /> | ||||
|         <el-table-column label="对甲总产值" align="center" prop="ownerTotalValue" /> | ||||
|         <el-table-column label="对甲设计产值" align="center" prop="ownerDesignValue" /> | ||||
|         <el-table-column label="对甲采购产值" align="center" prop="ownerPurchaseValue" /> | ||||
|         <el-table-column label="对甲施工产值" align="center" prop="ownerConstructionValue" /> | ||||
|         <el-table-column label="对乙总产值" align="center" prop="subTotalValue" /> | ||||
|         <el-table-column label="对乙设计产值" align="center" prop="subDesignValue" /> | ||||
|         <el-table-column label="对乙采购产值" align="center" prop="subPurchaseValue" /> | ||||
|         <el-table-column label="对乙施工产值" align="center" prop="subConstructionValue" /> | ||||
|         <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="['out:valueAllocation:edit']"></el-button> | ||||
|             </el-tooltip> | ||||
|             <el-tooltip content="删除" placement="top"> | ||||
|               <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['out:valueAllocation: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="valueAllocationFormRef" :model="form" :rules="rules" label-width="120px"> | ||||
|         <el-form-item label="对甲总产值" prop="ownerTotalValue"> | ||||
|           <el-input v-model="form.ownerTotalValue" placeholder="请输入对甲总产值" /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="对甲设计产值" prop="ownerDesignValue"> | ||||
|           <el-input v-model="form.ownerDesignValue" placeholder="请输入对甲设计产值" /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="对甲采购产值" prop="ownerPurchaseValue"> | ||||
|           <el-input v-model="form.ownerPurchaseValue" placeholder="请输入对甲采购产值" /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="对甲施工产值" prop="ownerConstructionValue"> | ||||
|           <el-input v-model="form.ownerConstructionValue" placeholder="请输入对甲施工产值" /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="对乙总产值" prop="subTotalValue"> | ||||
|           <el-input v-model="form.subTotalValue" placeholder="请输入对乙总产值" /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="对乙设计产值" prop="subDesignValue"> | ||||
|           <el-input v-model="form.subDesignValue" placeholder="请输入对乙设计产值" /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="对乙采购产值" prop="subPurchaseValue"> | ||||
|           <el-input v-model="form.subPurchaseValue" placeholder="请输入对乙采购产值" /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="对乙施工产值" prop="subConstructionValue"> | ||||
|           <el-input v-model="form.subConstructionValue" 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="ValueAllocation" lang="ts"> | ||||
| import { listValueAllocation, getValueAllocation, delValueAllocation, addValueAllocation, updateValueAllocation } from '@/api/out/valueAllocation'; | ||||
| import { ValueAllocationVO, ValueAllocationQuery, ValueAllocationForm } from '@/api/out/valueAllocation/types'; | ||||
|  | ||||
| const { proxy } = getCurrentInstance() as ComponentInternalInstance; | ||||
| import { useUserStoreHook } from '@/store/modules/user'; | ||||
| // 获取用户 store | ||||
| const userStore = useUserStoreHook(); | ||||
| // 从 store 中获取项目列表和当前选中的项目 | ||||
| const currentProject = computed(() => userStore.selectedProject); | ||||
| const valueAllocationList = ref<ValueAllocationVO[]>([]); | ||||
| 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 valueAllocationFormRef = ref<ElFormInstance>(); | ||||
|  | ||||
| const dialog = reactive<DialogOption>({ | ||||
|   visible: false, | ||||
|   title: '' | ||||
| }); | ||||
|  | ||||
| const initFormData: ValueAllocationForm = { | ||||
|   id: undefined, | ||||
|   projectId: currentProject.value.id, | ||||
|   ownerDesignValue: undefined, | ||||
|   ownerPurchaseValue: undefined, | ||||
|   ownerConstructionValue: undefined, | ||||
|   ownerTotalValue: undefined, | ||||
|   subDesignValue: undefined, | ||||
|   subPurchaseValue: undefined, | ||||
|   valueType: undefined, | ||||
|   subConstructionValue: undefined, | ||||
|   subTotalValue: undefined | ||||
| }; | ||||
| const data = reactive<PageData<ValueAllocationForm, ValueAllocationQuery>>({ | ||||
|   form: { ...initFormData }, | ||||
|   queryParams: { | ||||
|     pageNum: 1, | ||||
|     pageSize: 10, | ||||
|     projectId: currentProject.value.id, | ||||
|     ownerDesignValue: undefined, | ||||
|     ownerPurchaseValue: undefined, | ||||
|     ownerConstructionValue: undefined, | ||||
|     valueType: undefined, | ||||
|     ownerTotalValue: undefined, | ||||
|     subDesignValue: undefined, | ||||
|     subPurchaseValue: undefined, | ||||
|     subConstructionValue: undefined, | ||||
|     subTotalValue: undefined, | ||||
|     params: {} | ||||
|   }, | ||||
|   rules: { | ||||
|     id: [{ required: true, message: '主键ID不能为空', trigger: 'blur' }], | ||||
|     projectId: [{ required: true, message: '项目ID不能为空', trigger: 'blur' }], | ||||
|     ownerDesignValue: [{ required: true, message: '对甲设计产值不能为空', trigger: 'blur' }], | ||||
|     ownerPurchaseValue: [{ required: true, message: '对甲采购产值不能为空', trigger: 'blur' }], | ||||
|     ownerConstructionValue: [{ required: true, message: '对甲施工产值不能为空', trigger: 'blur' }], | ||||
|     ownerTotalValue: [{ required: true, message: '对甲总产值不能为空', trigger: 'blur' }], | ||||
|     subDesignValue: [{ required: true, message: '对乙设计产值不能为空', trigger: 'blur' }], | ||||
|     subPurchaseValue: [{ required: true, message: '对乙采购产值不能为空', trigger: 'blur' }], | ||||
|     subConstructionValue: [{ required: true, message: '对乙施工产值不能为空', trigger: 'blur' }], | ||||
|     subTotalValue: [{ required: true, message: '对乙总产值不能为空', trigger: 'blur' }] | ||||
|   } | ||||
| }); | ||||
|  | ||||
| const { queryParams, form, rules } = toRefs(data); | ||||
|  | ||||
| /** 查询项目总产值分配列表 */ | ||||
| const getList = async () => { | ||||
|   loading.value = true; | ||||
|   const res = await listValueAllocation(queryParams.value); | ||||
|   valueAllocationList.value = res.rows; | ||||
|   total.value = res.total; | ||||
|   loading.value = false; | ||||
| }; | ||||
|  | ||||
| /** 取消按钮 */ | ||||
| const cancel = () => { | ||||
|   reset(); | ||||
|   dialog.visible = false; | ||||
| }; | ||||
|  | ||||
| /** 表单重置 */ | ||||
| const reset = () => { | ||||
|   form.value = { ...initFormData }; | ||||
|   valueAllocationFormRef.value?.resetFields(); | ||||
| }; | ||||
|  | ||||
| /** 搜索按钮操作 */ | ||||
| const handleQuery = () => { | ||||
|   queryParams.value.pageNum = 1; | ||||
|   getList(); | ||||
| }; | ||||
|  | ||||
| /** 重置按钮操作 */ | ||||
| const resetQuery = () => { | ||||
|   queryFormRef.value?.resetFields(); | ||||
|   handleQuery(); | ||||
| }; | ||||
|  | ||||
| /** 多选框选中数据 */ | ||||
| const handleSelectionChange = (selection: ValueAllocationVO[]) => { | ||||
|   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?: ValueAllocationVO) => { | ||||
|   reset(); | ||||
|   const _id = row?.id || ids.value[0]; | ||||
|   const res = await getValueAllocation(_id); | ||||
|   Object.assign(form.value, res.data); | ||||
|   dialog.visible = true; | ||||
|   dialog.title = '修改项目总产值分配'; | ||||
| }; | ||||
|  | ||||
| /** 提交按钮 */ | ||||
| const submitForm = () => { | ||||
|   valueAllocationFormRef.value?.validate(async (valid: boolean) => { | ||||
|     if (valid) { | ||||
|       buttonLoading.value = true; | ||||
|       if (form.value.id) { | ||||
|         await updateValueAllocation(form.value).finally(() => (buttonLoading.value = false)); | ||||
|       } else { | ||||
|         await addValueAllocation(form.value).finally(() => (buttonLoading.value = false)); | ||||
|       } | ||||
|       proxy?.$modal.msgSuccess('操作成功'); | ||||
|       dialog.visible = false; | ||||
|       await getList(); | ||||
|     } | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| /** 删除按钮操作 */ | ||||
| const handleDelete = async (row?: ValueAllocationVO) => { | ||||
|   const _ids = row?.id || ids.value; | ||||
|   await proxy?.$modal.confirm('是否确认删除项目总产值分配编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false)); | ||||
|   await delValueAllocation(_ids); | ||||
|   proxy?.$modal.msgSuccess('删除成功'); | ||||
|   await getList(); | ||||
| }; | ||||
|  | ||||
| /** 导出按钮操作 */ | ||||
| const handleExport = () => { | ||||
|   proxy?.download( | ||||
|     'out/valueAllocation/export', | ||||
|     { | ||||
|       ...queryParams.value | ||||
|     }, | ||||
|     `valueAllocation_${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> | ||||
							
								
								
									
										362
									
								
								src/views/progress/constructionSchedulePlan/index.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										362
									
								
								src/views/progress/constructionSchedulePlan/index.vue
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,362 @@ | ||||
| <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="nodeName"> | ||||
|               <el-input v-model="queryParams.nodeName" placeholder="请输入节点名称" clearable @keyup.enter="handleQuery" /> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="状态" prop="status"> | ||||
|               <el-select v-model="queryParams.status" placeholder="请选择状态" clearable> | ||||
|                 <el-option v-for="dict in project_construction_status" :key="dict.value" :label="dict.label" :value="dict.value" /> | ||||
|               </el-select> | ||||
|             </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="['progress:constructionSchedulePlan:add']">新增</el-button> | ||||
|           </el-col> | ||||
|           <el-col :span="1.5"> | ||||
|             <el-button type="info" plain icon="Sort" @click="handleToggleExpandAll">展开/折叠</el-button> | ||||
|           </el-col> | ||||
|           <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> | ||||
|         </el-row> | ||||
|       </template> | ||||
|       <el-table | ||||
|         ref="constructionSchedulePlanTableRef" | ||||
|         v-loading="loading" | ||||
|         :data="constructionSchedulePlanList" | ||||
|         row-key="id" | ||||
|         :default-expand-all="isExpandAll" | ||||
|         :tree-props="{ children: 'children', hasChildren: 'hasChildren' }" | ||||
|       > | ||||
|         <!-- <el-table-column label="序号" type="id" /> --> | ||||
|         <el-table-column label="节点名称" prop="nodeName" /> | ||||
|         <el-table-column label="对应项目结构" align="center" prop="projectStructure" /> | ||||
|         <el-table-column label="预计开始时间" align="center" prop="planStartDate" width="180"> | ||||
|           <template #default="scope"> | ||||
|             <span>{{ parseTime(scope.row.planStartDate, '{y}-{m}-{d}') }}</span> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <el-table-column label="预计结束时间" align="center" prop="planEndDate" width="180"> | ||||
|           <template #default="scope"> | ||||
|             <span>{{ parseTime(scope.row.planEndDate, '{y}-{m}-{d}') }}</span> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <el-table-column label="实际开始时间" align="center" prop="practicalStartDate" width="180"> | ||||
|           <template #default="scope"> | ||||
|             <span>{{ parseTime(scope.row.practicalStartDate, '{y}-{m}-{d}') }}</span> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <el-table-column label="实际结束时间" align="center" prop="practicalEndDate" width="180"> | ||||
|           <template #default="scope"> | ||||
|             <span>{{ parseTime(scope.row.practicalEndDate, '{y}-{m}-{d}') }}</span> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <el-table-column label="状态" align="center" prop="status"> | ||||
|           <template #default="scope"> | ||||
|             <dict-tag :options="project_construction_status" :value="scope.row.status" /> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <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="['progress:constructionSchedulePlan:edit']" /> | ||||
|             </el-tooltip> | ||||
|             <el-tooltip content="新增" placement="top"> | ||||
|               <el-button link type="primary" icon="Plus" @click="handleAdd(scope.row)" v-hasPermi="['progress:constructionSchedulePlan:add']" /> | ||||
|             </el-tooltip> | ||||
|             <el-tooltip content="删除" placement="top"> | ||||
|               <el-button | ||||
|                 link | ||||
|                 type="primary" | ||||
|                 icon="Delete" | ||||
|                 @click="handleDelete(scope.row)" | ||||
|                 v-hasPermi="['progress:constructionSchedulePlan:remove']" | ||||
|               /> | ||||
|             </el-tooltip> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|       </el-table> | ||||
|     </el-card> | ||||
|     <!-- 添加或修改施工进度计划对话框 --> | ||||
|     <el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body> | ||||
|       <el-form ref="constructionSchedulePlanFormRef" :model="form" :rules="rules" label-width="110px"> | ||||
|         <el-form-item label="父节点" prop="parentId"> | ||||
|           <el-tree-select | ||||
|             v-model="form.parentId" | ||||
|             :data="constructionSchedulePlanOptions" | ||||
|             :props="{ value: 'id', label: 'nodeName', children: 'children' }" | ||||
|             value-key="id" | ||||
|             placeholder="请选择父节点" | ||||
|             check-strictly | ||||
|           /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="节点名称" prop="nodeName"> | ||||
|           <el-input v-model="form.nodeName" placeholder="请输入节点名称" /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="对应项目结构" prop="projectStructure"> | ||||
|           <el-input v-model="form.projectStructure" placeholder="请输入对应项目结构" /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="预计开始时间" prop="planStartDate"> | ||||
|           <el-date-picker clearable v-model="form.planStartDate" type="datetime" value-format="YYYY-MM-DD HH:mm:ss" placeholder="选择预计开始时间" /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="预计结束时间" prop="planEndDate"> | ||||
|           <el-date-picker clearable v-model="form.planEndDate" type="datetime" value-format="YYYY-MM-DD HH:mm:ss" placeholder="选择预计结束时间" /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="实际开始时间" prop="practicalStartDate"> | ||||
|           <el-date-picker | ||||
|             clearable | ||||
|             v-model="form.practicalStartDate" | ||||
|             type="datetime" | ||||
|             value-format="YYYY-MM-DD HH:mm:ss" | ||||
|             placeholder="选择实际开始时间" | ||||
|           /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="实际结束时间" prop="practicalEndDate"> | ||||
|           <el-date-picker | ||||
|             clearable | ||||
|             v-model="form.practicalEndDate" | ||||
|             type="datetime" | ||||
|             value-format="YYYY-MM-DD HH:mm:ss" | ||||
|             placeholder="选择实际结束时间" | ||||
|           /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="状态" prop="status"> | ||||
|           <el-select v-model="form.status" placeholder="请选择状态"> | ||||
|             <el-option v-for="dict in project_construction_status" :key="dict.value" :label="dict.label" :value="dict.value" /> | ||||
|           </el-select> | ||||
|         </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="ConstructionSchedulePlan" lang="ts"> | ||||
| import { | ||||
|   listConstructionSchedulePlan, | ||||
|   getConstructionSchedulePlan, | ||||
|   delConstructionSchedulePlan, | ||||
|   addConstructionSchedulePlan, | ||||
|   updateConstructionSchedulePlan | ||||
| } from '@/api/progress/constructionSchedulePlan'; | ||||
| import { | ||||
|   ConstructionSchedulePlanVO, | ||||
|   ConstructionSchedulePlanQuery, | ||||
|   ConstructionSchedulePlanForm | ||||
| } from '@/api/progress/constructionSchedulePlan/types'; | ||||
| import { useUserStoreHook } from '@/store/modules/user'; | ||||
|  | ||||
| type ConstructionSchedulePlanOption = { | ||||
|   id: number; | ||||
|   nodeName: string; | ||||
|   children?: ConstructionSchedulePlanOption[]; | ||||
| }; | ||||
| const { proxy } = getCurrentInstance() as ComponentInternalInstance; | ||||
| const userStore = useUserStoreHook(); | ||||
| // 从 store 中获取项目列表和当前选中的项目 | ||||
| const currentProject = computed(() => userStore.selectedProject); | ||||
|  | ||||
| const { project_construction_status } = toRefs<any>(proxy?.useDict('project_construction_status')); | ||||
|  | ||||
| const constructionSchedulePlanList = ref<ConstructionSchedulePlanVO[]>([]); | ||||
| const constructionSchedulePlanOptions = ref<ConstructionSchedulePlanOption[]>([]); | ||||
| const buttonLoading = ref(false); | ||||
| const showSearch = ref(true); | ||||
| const isExpandAll = ref(true); | ||||
| const loading = ref(false); | ||||
|  | ||||
| const queryFormRef = ref<ElFormInstance>(); | ||||
| const constructionSchedulePlanFormRef = ref<ElFormInstance>(); | ||||
| const constructionSchedulePlanTableRef = ref<ElTableInstance>(); | ||||
|  | ||||
| const dialog = reactive<DialogOption>({ | ||||
|   visible: false, | ||||
|   title: '' | ||||
| }); | ||||
|  | ||||
| const initFormData: ConstructionSchedulePlanForm = { | ||||
|   id: undefined, | ||||
|   projectId: currentProject.value.id, | ||||
|   parentId: undefined, | ||||
|   nodeName: undefined, | ||||
|   projectStructure: undefined, | ||||
|   planStartDate: undefined, | ||||
|   planEndDate: undefined, | ||||
|   practicalStartDate: undefined, | ||||
|   practicalEndDate: undefined, | ||||
|   status: undefined, | ||||
|   remark: undefined | ||||
| }; | ||||
|  | ||||
| const data = reactive<PageData<ConstructionSchedulePlanForm, ConstructionSchedulePlanQuery>>({ | ||||
|   form: { ...initFormData }, | ||||
|   queryParams: { | ||||
|     projectId: currentProject.value.id, | ||||
|     parentId: undefined, | ||||
|     nodeName: undefined, | ||||
|     status: undefined, | ||||
|     params: {} | ||||
|   }, | ||||
|   rules: { | ||||
|     id: [{ required: true, message: '主键ID不能为空', trigger: 'blur' }], | ||||
|     projectId: [{ required: true, message: '项目ID不能为空', trigger: 'blur' }], | ||||
|     parentId: [{ required: true, message: '父ID不能为空', trigger: 'blur' }], | ||||
|     nodeName: [{ required: true, message: '节点名称不能为空', trigger: 'blur' }], | ||||
|     planStartDate: [{ required: true, message: '预计开始时间不能为空', trigger: 'blur' }], | ||||
|     planEndDate: [{ required: true, message: '预计结束时间不能为空', trigger: 'blur' }] | ||||
|   } | ||||
| }); | ||||
|  | ||||
| const { queryParams, form, rules } = toRefs(data); | ||||
|  | ||||
| /** 查询施工进度计划列表 */ | ||||
| const getList = async () => { | ||||
|   loading.value = true; | ||||
|   const res = await listConstructionSchedulePlan(queryParams.value); | ||||
|   const data = proxy?.handleTree<ConstructionSchedulePlanVO>(res.data, 'id', 'parentId'); | ||||
|   console.log('🚀 ~ getList ~ data:', data); | ||||
|  | ||||
|   if (data) { | ||||
|     constructionSchedulePlanList.value = data; | ||||
|     loading.value = false; | ||||
|   } | ||||
| }; | ||||
|  | ||||
| /** 查询施工进度计划下拉树结构 */ | ||||
| const getTreeselect = async () => { | ||||
|   const res = await listConstructionSchedulePlan(); | ||||
|   constructionSchedulePlanOptions.value = []; | ||||
|   const data: ConstructionSchedulePlanOption = { id: 0, nodeName: '顶级节点', children: [] }; | ||||
|   data.children = proxy?.handleTree<ConstructionSchedulePlanOption>(res.data, 'id', 'parentId'); | ||||
|   constructionSchedulePlanOptions.value.push(data); | ||||
| }; | ||||
|  | ||||
| // 取消按钮 | ||||
| const cancel = () => { | ||||
|   reset(); | ||||
|   dialog.visible = false; | ||||
| }; | ||||
|  | ||||
| // 表单重置 | ||||
| const reset = () => { | ||||
|   form.value = { ...initFormData }; | ||||
|   constructionSchedulePlanFormRef.value?.resetFields(); | ||||
| }; | ||||
|  | ||||
| /** 搜索按钮操作 */ | ||||
| const handleQuery = () => { | ||||
|   getList(); | ||||
| }; | ||||
|  | ||||
| /** 重置按钮操作 */ | ||||
| const resetQuery = () => { | ||||
|   queryFormRef.value?.resetFields(); | ||||
|   handleQuery(); | ||||
| }; | ||||
|  | ||||
| /** 新增按钮操作 */ | ||||
| const handleAdd = (row?: ConstructionSchedulePlanVO) => { | ||||
|   reset(); | ||||
|   getTreeselect(); | ||||
|   if (row != null && row.id) { | ||||
|     form.value.parentId = row.id; | ||||
|   } else { | ||||
|     form.value.parentId = 0; | ||||
|   } | ||||
|   dialog.visible = true; | ||||
|   dialog.title = '添加施工进度计划'; | ||||
| }; | ||||
|  | ||||
| /** 展开/折叠操作 */ | ||||
| const handleToggleExpandAll = () => { | ||||
|   isExpandAll.value = !isExpandAll.value; | ||||
|   toggleExpandAll(constructionSchedulePlanList.value, isExpandAll.value); | ||||
| }; | ||||
|  | ||||
| /** 展开/折叠操作 */ | ||||
| const toggleExpandAll = (data: ConstructionSchedulePlanVO[], status: boolean) => { | ||||
|   data.forEach((item) => { | ||||
|     constructionSchedulePlanTableRef.value?.toggleRowExpansion(item, status); | ||||
|     if (item.children && item.children.length > 0) toggleExpandAll(item.children, status); | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| /** 修改按钮操作 */ | ||||
| const handleUpdate = async (row: ConstructionSchedulePlanVO) => { | ||||
|   reset(); | ||||
|   await getTreeselect(); | ||||
|   if (row != null) { | ||||
|     form.value.parentId = row.parentId; | ||||
|   } | ||||
|   const res = await getConstructionSchedulePlan(row.id); | ||||
|   Object.assign(form.value, res.data); | ||||
|   dialog.visible = true; | ||||
|   dialog.title = '修改施工进度计划'; | ||||
| }; | ||||
|  | ||||
| /** 提交按钮 */ | ||||
| const submitForm = () => { | ||||
|   constructionSchedulePlanFormRef.value?.validate(async (valid: boolean) => { | ||||
|     if (valid) { | ||||
|       buttonLoading.value = true; | ||||
|       if (form.value.id) { | ||||
|         await updateConstructionSchedulePlan(form.value).finally(() => (buttonLoading.value = false)); | ||||
|       } else { | ||||
|         await addConstructionSchedulePlan(form.value).finally(() => (buttonLoading.value = false)); | ||||
|       } | ||||
|       proxy?.$modal.msgSuccess('操作成功'); | ||||
|       dialog.visible = false; | ||||
|       getList(); | ||||
|     } | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| /** 删除按钮操作 */ | ||||
| const handleDelete = async (row: ConstructionSchedulePlanVO) => { | ||||
|   await proxy?.$modal.confirm('是否确认删除施工进度计划编号为"' + row.id + '"的数据项?'); | ||||
|   loading.value = true; | ||||
|   await delConstructionSchedulePlan(row.id).finally(() => (loading.value = false)); | ||||
|   await getList(); | ||||
|   proxy?.$modal.msgSuccess('删除成功'); | ||||
| }; | ||||
|  | ||||
| onMounted(() => { | ||||
|   getList(); | ||||
| }); | ||||
|  | ||||
| //监听项目id刷新数据 | ||||
| const listeningProject = watch( | ||||
|   () => currentProject.value.id, | ||||
|   (nid, oid) => { | ||||
|     queryParams.value.projectId = nid; | ||||
|     form.value.projectId = nid; | ||||
|     getList(); | ||||
|   } | ||||
| ); | ||||
|  | ||||
| onUnmounted(() => { | ||||
|   listeningProject(); | ||||
| }); | ||||
| </script> | ||||
| @ -203,7 +203,7 @@ import { ProgressCategoryVO, ProgressCategoryQuery, ProgressCategoryForm } from | ||||
| const { proxy } = getCurrentInstance() as ComponentInternalInstance; | ||||
|  | ||||
| const { progress_unit_type, progress_status } = toRefs<any>(proxy?.useDict('progress_unit_type', 'progress_status')); | ||||
| import { useUserStoreHook } from '@/store/modules/user'; | ||||
|  | ||||
| import CreatePlan from './component/createPlan.vue'; | ||||
| import CreateDaily from './component/createDaily.vue'; | ||||
| import CreateDailyRate from './component/createDailyRate.vue'; | ||||
| @ -212,7 +212,7 @@ type ProgressCategoryOption = { | ||||
|   name: string; | ||||
|   children?: ProgressCategoryOption[]; | ||||
| }; | ||||
|  | ||||
| import { useUserStoreHook } from '@/store/modules/user'; | ||||
| // 获取用户 store | ||||
| const userStore = useUserStoreHook(); | ||||
| // 从 store 中获取项目列表和当前选中的项目 | ||||
| @ -273,7 +273,7 @@ const { queryParams, form, rules } = toRefs(data); | ||||
| const getList = async () => { | ||||
|   if (!queryParams.value.matrixId) { | ||||
|     const res = await getProjectSquare(currentProject.value.id); | ||||
|     if (res.data.length === 0) { | ||||
|     if (!res.data || res.data.length === 0) { | ||||
|       proxy?.$modal.msgWarning('当前项目下没有方阵,请先创建方阵'); | ||||
|     } else { | ||||
|       let matrixList = res.data.map((item) => { | ||||
| @ -282,17 +282,19 @@ const getList = async () => { | ||||
|           matrixId: item.projectId | ||||
|         }; | ||||
|       }); | ||||
|       if (!matrixValue.value) matrixValue.value = matrixList[0].id; | ||||
|       matrixOptions.value = matrixList; | ||||
|       queryParams.value.matrixId = matrixList[0].children[0].matrixId; | ||||
|       try { | ||||
|         if (!matrixValue.value) matrixValue.value = matrixList[0].id; | ||||
|         matrixOptions.value = matrixList; | ||||
|         queryParams.value.matrixId = matrixList[0].children[0].matrixId; | ||||
|       } catch (error) { | ||||
|         proxy?.$modal.msgError('获取方阵失败'); | ||||
|       } | ||||
|     } | ||||
|   } | ||||
|   loading.value = true; | ||||
|   loading.value = true; | ||||
|  | ||||
|   try { | ||||
|     const res = await listProgressCategory(queryParams.value); | ||||
|     const data = proxy?.handleTree<ProgressCategoryVO>(res.data, 'id', 'pid'); | ||||
|     const data = proxy?.handleTree<ProgressCategoryVO>(res.data, 'id', 'parentId'); | ||||
|     if (data) { | ||||
|       progressCategoryList.value = data; | ||||
|     } | ||||
|  | ||||
							
								
								
									
										379
									
								
								src/views/progress/progressCategory/index.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										379
									
								
								src/views/progress/progressCategory/index.vue
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,379 @@ | ||||
| <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="pid" label-width="100"> | ||||
|               <!-- <el-input v-model="queryParams.pid" placeholder="请选择" clearable /> --> | ||||
|               <el-cascader | ||||
|                 :options="matrixOptions" | ||||
|                 placeholder="请选择" | ||||
|                 @change="handleChange" | ||||
|                 :props="{ value: 'matrixId', label: 'name' }" | ||||
|                 v-model="queryParams.matrixId" | ||||
|                 clearable | ||||
|               /> | ||||
|               <!-- <el-select v-model="matrixValue" placeholder="请选择" @change="handleChange" clearable> | ||||
|                 <el-option v-for="item in matrixOptions" :key="item.id" :label="item.matrixName" :value="item.id" /> | ||||
|               </el-select> --> | ||||
|             </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="info" plain icon="Sort" @click="handleToggleExpandAll">展开/折叠</el-button> | ||||
|           </el-col> | ||||
|           <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> | ||||
|         </el-row> | ||||
|       </template> | ||||
|       <el-table | ||||
|         ref="progressCategoryTableRef" | ||||
|         v-loading="loading" | ||||
|         :data="progressCategoryList" | ||||
|         row-key="id" | ||||
|         :default-expand-all="isExpandAll" | ||||
|         :tree-props="{ children: 'children', hasChildren: 'hasChildren' }" | ||||
|       > | ||||
|         <!-- <el-table-column label="父类别id" prop="parentId" /> --> | ||||
|         <el-table-column label="类别名称" prop="name" /> | ||||
|         <el-table-column label="计量方式" align="center" prop="unitType"> | ||||
|           <template #default="{ row }"> | ||||
|             <dict-tag :options="progress_unit_type" :value="row.unitType" v-if="row.parentId != 0" /> | ||||
|             <span v-else></span> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <el-table-column label="计量单位" align="center" prop="unit"> | ||||
|           <template #default="{ row }"> | ||||
|             {{ row.parentId == 0 ? '' : row.unit }} | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <el-table-column label="综合单价" align="center" prop="unitPrice"> | ||||
|           <template #default="{ row }"> | ||||
|             {{ row.parentId == 0 ? '' : row.unitPrice }} | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <el-table-column label="产值金额" align="center" prop="outputValue"> | ||||
|           <template #default="{ row }"> | ||||
|             {{ row.parentId == 0 ? '' : row.outputValue }} | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <el-table-column label="总数量/百分比" align="center" prop="total"> | ||||
|           <template #default="{ row }"> | ||||
|             {{ row.parentId == 0 ? '' : row.total }} | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> | ||||
|           <template #default="scope"> | ||||
|             <div v-if="scope.row.parentId"> | ||||
|               <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['progress:progressCategory:edit']"> | ||||
|                 修改 | ||||
|               </el-button> | ||||
|               <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['progress:progressCategory:remove']"> | ||||
|                 删除 | ||||
|               </el-button> | ||||
|             </div> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|       </el-table> | ||||
|     </el-card> | ||||
|     <!-- 添加或修改分项工程单价对话框 --> | ||||
|     <el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body> | ||||
|       <el-form ref="progressCategoryFormRef" :model="form" :rules="rules" label-width="80px"> | ||||
|         <el-form-item label="类别名称" prop="name"> | ||||
|           <el-input v-model="form.name" placeholder="请输入类别名称" disabled /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="计量单位" prop="unit"> | ||||
|           <el-input v-model="form.unit" placeholder="请输入计量单位" /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="数量" prop="total" v-if="isDisabled"> | ||||
|           <el-input v-model="form.total" placeholder="请输入数量" /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="综合单价" prop="unitPrice"> | ||||
|           <el-input v-model="form.unitPrice" placeholder="请输入综合单价" /> | ||||
|         </el-form-item> | ||||
|  | ||||
|         <!-- <el-form-item label="总数量/百分比" prop="total"> | ||||
|           <el-input v-model="form.total" 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="ProgressCategory" lang="ts"> | ||||
| import { getProjectSquare } from '@/api/progress/plan'; | ||||
| import { | ||||
|   listProgressCategory, | ||||
|   getProgressCategory, | ||||
|   delProgressCategory, | ||||
|   addProgressCategory, | ||||
|   updateProgressCategory | ||||
| } from '@/api/progress/progressCategory'; | ||||
| import { ProgressCategoryVO, ProgressCategoryQuery, ProgressCategoryForm } from '@/api/progress/progressCategory/types'; | ||||
| import { useUserStoreHook } from '@/store/modules/user'; | ||||
|  | ||||
| const { proxy } = getCurrentInstance() as ComponentInternalInstance; | ||||
| const { progress_unit_type, progress_status } = toRefs<any>(proxy?.useDict('progress_unit_type', 'progress_status')); | ||||
|  | ||||
| // 获取用户 store | ||||
| const userStore = useUserStoreHook(); | ||||
| // 从 store 中获取项目列表和当前选中的项目 | ||||
| const currentProject = computed(() => userStore.selectedProject); | ||||
| type ProgressCategoryOption = { | ||||
|   id: number; | ||||
|   name: string; | ||||
|   children?: ProgressCategoryOption[]; | ||||
| }; | ||||
|  | ||||
| const matrixOptions = ref([]); | ||||
|  | ||||
| const progressCategoryList = ref<ProgressCategoryVO[]>([]); | ||||
| const progressCategoryOptions = ref<ProgressCategoryOption[]>([]); | ||||
| const buttonLoading = ref(false); | ||||
| const showSearch = ref(true); | ||||
| const isExpandAll = ref(true); | ||||
| const loading = ref(false); | ||||
|  | ||||
| const queryFormRef = ref<ElFormInstance>(); | ||||
| const progressCategoryFormRef = ref<ElFormInstance>(); | ||||
| const progressCategoryTableRef = ref<ElTableInstance>(); | ||||
|  | ||||
| const dialog = reactive<DialogOption>({ | ||||
|   visible: false, | ||||
|   title: '' | ||||
| }); | ||||
|  | ||||
| const initFormData: ProgressCategoryForm = { | ||||
|   id: undefined, | ||||
|   parentId: undefined, | ||||
|   projectId: currentProject.value.id, | ||||
|   matrixId: undefined, | ||||
|   matrixName: undefined, | ||||
|   name: undefined, | ||||
|   unitType: undefined, | ||||
|   unit: undefined, | ||||
|   unitPrice: undefined, | ||||
|   outputValue: undefined, | ||||
|   total: undefined, | ||||
|   completed: undefined, | ||||
|   planTotal: undefined, | ||||
|   isDelay: undefined, | ||||
|   workType: undefined, | ||||
|   status: undefined, | ||||
|   remark: undefined | ||||
| }; | ||||
|  | ||||
| const data = reactive<PageData<ProgressCategoryForm, ProgressCategoryQuery>>({ | ||||
|   form: { ...initFormData }, | ||||
|   queryParams: { | ||||
|     parentId: undefined, | ||||
|     projectId: currentProject.value.id, | ||||
|     matrixId: undefined, | ||||
|     matrixName: undefined, | ||||
|     name: undefined, | ||||
|     unitType: undefined, | ||||
|     unit: undefined, | ||||
|     unitPrice: undefined, | ||||
|     outputValue: undefined, | ||||
|     total: undefined, | ||||
|     completed: undefined, | ||||
|     planTotal: undefined, | ||||
|     isDelay: undefined, | ||||
|     workType: undefined, | ||||
|     status: undefined, | ||||
|     params: {} | ||||
|   }, | ||||
|   rules: { | ||||
|     id: [{ required: true, message: '主键id不能为空', trigger: 'blur' }], | ||||
|     parentId: [{ required: true, message: '父类别id不能为空', trigger: 'blur' }], | ||||
|     projectId: [{ required: true, message: '项目id不能为空', trigger: 'blur' }], | ||||
|     matrixId: [{ required: true, message: '方阵id不能为空', trigger: 'blur' }], | ||||
|     name: [{ required: true, message: '类别名称不能为空', trigger: 'blur' }], | ||||
|     unitType: [{ required: true, message: '计量方式不能为空', trigger: 'change' }], | ||||
|     unitPrice: [{ required: true, message: '综合单价不能为空', trigger: 'blur' }], | ||||
|     outputValue: [{ required: true, message: '产值金额不能为空', trigger: 'blur' }], | ||||
|     isDelay: [{ required: true, message: '是否超期不能为空', trigger: 'blur' }], | ||||
|     status: [{ required: true, message: '完成状态不能为空', trigger: 'change' }] | ||||
|   } | ||||
| }); | ||||
|  | ||||
| const { queryParams, form, rules } = toRefs(data); | ||||
|  | ||||
| /** 查询分项工程单价列表 */ | ||||
| const getList = async () => { | ||||
|   if (!queryParams.value.matrixId) { | ||||
|     const res = await getProjectSquare(currentProject.value.id); | ||||
|     if (res.data.length === 0) { | ||||
|       proxy?.$modal.msgWarning('当前项目下没有方阵,请先创建方阵'); | ||||
|     } else { | ||||
|       let matrixList = res.data.map((item) => { | ||||
|         return { | ||||
|           ...item, | ||||
|           matrixId: item.projectId | ||||
|         }; | ||||
|       }); | ||||
|       if (!matrixValue.value) matrixValue.value = matrixList[0].id; | ||||
|       matrixOptions.value = matrixList; | ||||
|       queryParams.value.matrixId = matrixList[0].children[0].matrixId; | ||||
|     } | ||||
|   } | ||||
|   loading.value = true; | ||||
|   try { | ||||
|     const res = await listProgressCategory(queryParams.value); | ||||
|     const data = proxy?.handleTree<ProgressCategoryVO>(res.data, 'id', 'parentId'); | ||||
|     if (data) { | ||||
|       progressCategoryList.value = data; | ||||
|       loading.value = false; | ||||
|     } | ||||
|   } finally { | ||||
|     loading.value = false; | ||||
|   } | ||||
| }; | ||||
|  | ||||
| /** 查询分项工程单价下拉树结构 */ | ||||
| const getTreeselect = async () => { | ||||
|   const res = await listProgressCategory(queryParams.value); | ||||
|   progressCategoryOptions.value = []; | ||||
|   const data: ProgressCategoryOption = { id: 0, name: '顶级节点', children: [] }; | ||||
|   data.children = proxy?.handleTree<ProgressCategoryOption>(res.data, 'id', 'parentId'); | ||||
|   progressCategoryOptions.value.push(data); | ||||
| }; | ||||
|  | ||||
| // 取消按钮 | ||||
| const cancel = () => { | ||||
|   reset(); | ||||
|   dialog.visible = false; | ||||
| }; | ||||
|  | ||||
| // 表单重置 | ||||
| const reset = () => { | ||||
|   form.value = { ...initFormData }; | ||||
|   isDisabled.value = false; | ||||
|   progressCategoryFormRef.value?.resetFields(); | ||||
| }; | ||||
| /** 级联选择器改变事件 */ | ||||
| const handleChange = (value: number) => { | ||||
|   queryParams.value.matrixId = value[1]; | ||||
|  | ||||
|   getList(); | ||||
| }; | ||||
|  | ||||
| /** 搜索按钮操作 */ | ||||
| const handleQuery = () => { | ||||
|   getList(); | ||||
| }; | ||||
|  | ||||
| /** 重置按钮操作 */ | ||||
| const resetQuery = () => { | ||||
|   queryFormRef.value?.resetFields(); | ||||
|   handleQuery(); | ||||
| }; | ||||
|  | ||||
| /** 新增按钮操作 */ | ||||
| const handleAdd = (row?: ProgressCategoryVO) => { | ||||
|   reset(); | ||||
|   getTreeselect(); | ||||
|   if (row != null && row.id) { | ||||
|     form.value.parentId = row.id; | ||||
|   } else { | ||||
|     form.value.parentId = 0; | ||||
|   } | ||||
|   dialog.visible = true; | ||||
|   dialog.title = '添加分项工程单价'; | ||||
| }; | ||||
|  | ||||
| /** 展开/折叠操作 */ | ||||
| const handleToggleExpandAll = () => { | ||||
|   isExpandAll.value = !isExpandAll.value; | ||||
|   toggleExpandAll(progressCategoryList.value, isExpandAll.value); | ||||
| }; | ||||
|  | ||||
| /** 展开/折叠操作 */ | ||||
| const toggleExpandAll = (data: ProgressCategoryVO[], status: boolean) => { | ||||
|   data.forEach((item) => { | ||||
|     progressCategoryTableRef.value?.toggleRowExpansion(item, status); | ||||
|     if (item.children && item.children.length > 0) toggleExpandAll(item.children, status); | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| /** 修改按钮操作 */ | ||||
| const isDisabled = ref<boolean>(false); | ||||
| const handleUpdate = async (row: ProgressCategoryVO) => { | ||||
|   reset(); | ||||
|   if (row.unitType == '2') { | ||||
|     isDisabled.value = true; | ||||
|   } | ||||
|   await getTreeselect(); | ||||
|   if (row != null) { | ||||
|     form.value.parentId = row.parentId; | ||||
|   } | ||||
|   const res = await getProgressCategory(row.id); | ||||
|   Object.assign(form.value, res.data); | ||||
|   dialog.visible = true; | ||||
|   dialog.title = '修改分项工程单价'; | ||||
| }; | ||||
|  | ||||
| /** 提交按钮 */ | ||||
| const submitForm = () => { | ||||
|   progressCategoryFormRef.value?.validate(async (valid: boolean) => { | ||||
|     if (valid) { | ||||
|       buttonLoading.value = true; | ||||
|       if (form.value.id) { | ||||
|         await updateProgressCategory(form.value).finally(() => (buttonLoading.value = false)); | ||||
|       } else { | ||||
|         await addProgressCategory(form.value).finally(() => (buttonLoading.value = false)); | ||||
|       } | ||||
|       proxy?.$modal.msgSuccess('操作成功'); | ||||
|       dialog.visible = false; | ||||
|       getList(); | ||||
|     } | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| //切换项目重置方阵 | ||||
| const matrixValue = ref<number | undefined>(matrixOptions.value.length > 0 ? matrixOptions.value[0].id : undefined); | ||||
| const resetMatrix = () => { | ||||
|   matrixValue.value = undefined; | ||||
|   queryParams.value.matrixId = undefined; | ||||
|   matrixOptions.value = []; | ||||
| }; | ||||
|  | ||||
| /** 删除按钮操作 */ | ||||
| const handleDelete = async (row: ProgressCategoryVO) => { | ||||
|   await proxy?.$modal.confirm('是否确认删除分项工程单价编号为"' + row.id + '"的数据项?'); | ||||
|   loading.value = true; | ||||
|   await delProgressCategory(row.id).finally(() => (loading.value = false)); | ||||
|   await getList(); | ||||
|   proxy?.$modal.msgSuccess('删除成功'); | ||||
| }; | ||||
|  | ||||
| onMounted(() => { | ||||
|   getList(); | ||||
| }); | ||||
| //监听项目id刷新数据 | ||||
| const listeningProject = watch( | ||||
|   () => currentProject.value.id, | ||||
|   (nid, oid) => { | ||||
|     queryParams.value.projectId = nid; | ||||
|     form.value.projectId = nid; | ||||
|     resetMatrix(); | ||||
|     getList(); | ||||
|   } | ||||
| ); | ||||
|  | ||||
| onUnmounted(() => { | ||||
|   listeningProject(); | ||||
| }); | ||||
| </script> | ||||
| @ -280,11 +280,42 @@ | ||||
|                 /> | ||||
|               </el-form-item> | ||||
|             </el-col> | ||||
|             <el-col :span="24" :offset="0"> | ||||
|             <el-col :span="12" :offset="0"> | ||||
|               <el-form-item label="打卡类型" prop="playCardStart" label-width="110px"> | ||||
|                 <!-- <el-time-picker value-format="HH:mm" v-model="form.playCardStart" placeholder="请输入打卡开始时间" /> --> | ||||
|                 <el-time-select | ||||
|                   v-model="form.playCardStart" | ||||
|                   style="width: 100%" | ||||
|                   class="mr-4" | ||||
|                   placeholder="请输入打卡开始时间" | ||||
|                   value-format="HH:mm" | ||||
|                   start="00:00" | ||||
|                   step="00:15" | ||||
|                   end="23:59" | ||||
|                 /> | ||||
|               </el-form-item> | ||||
|             </el-col> | ||||
|             <el-col :span="12" :offset="0"> | ||||
|               <el-form-item label="工作日" prop="playCardEnd" label-width="110px"> | ||||
|                 <!-- <el-time-picker value-format="HH:mm" v-model="form.playCardEnd" placeholder="请输入打卡结束时间" /> --> | ||||
|                 <el-time-select | ||||
|                   v-model="form.playCardEnd" | ||||
|                   style="width: 100%" | ||||
|                   :min-time="form.playCardStart" | ||||
|                   class="mr-4" | ||||
|                   placeholder="请输入打卡结束时间" | ||||
|                   value-format="HH:mm" | ||||
|                   start="00:00" | ||||
|                   step="00:15" | ||||
|                   end="23:59" | ||||
|                 /> | ||||
|               </el-form-item> | ||||
|             </el-col> | ||||
|             <!-- <el-col :span="24" :offset="0"> | ||||
|               <el-form-item label="安全协议书" prop="securityAgreement"> | ||||
|                 <file-upload v-model="form.securityAgreement" :limit="1" :file-type="['pdf']" :file-size="50" /> | ||||
|               </el-form-item> | ||||
|             </el-col> | ||||
|             </el-col> --> | ||||
|           </el-row> | ||||
|         </div> | ||||
|       </el-form> | ||||
|  | ||||
| @ -1,7 +1,190 @@ | ||||
| <template> | ||||
|   <div>init</div> | ||||
|   <div class="system-busSalaryDetails-container"> | ||||
|     <el-card shadow="hover"> | ||||
|       <div class="info_s"> | ||||
|         <div> | ||||
|           <el-button type="success" @click="DownloadSalaryMOdel" | ||||
|             ><el-icon><Download /></el-icon>下载模版</el-button | ||||
|           > | ||||
|           <el-button type="primary" @click="uploadSalary" | ||||
|             ><el-icon><Upload /></el-icon>上传工资表</el-button | ||||
|           > | ||||
|           <el-button type="danger" :disabled="!(ids.length > 0)" @click="delSalary" | ||||
|             ><el-icon><Delete /></el-icon>删除</el-button | ||||
|           > | ||||
|         </div> | ||||
|         <el-popover placement="top-start" title="" :width="200" trigger="hover" :content="DetailMoney + '元'"> | ||||
|           <template #reference> | ||||
|             <el-tag class="m-2" size="large" | ||||
|               ><span style="font-size: 20px; cursor: pointer">金额:{{ totalMoney }}元</span></el-tag | ||||
|             > | ||||
|           </template> | ||||
|         </el-popover> | ||||
|       </div> | ||||
|       <el-table v-loading="loading" @selection-change="handleSelectionChange" size="large" border :data="tableData.data" height="76vh"> | ||||
|         <el-table-column type="selection" width="55" align="center" /> | ||||
|         <el-table-column label="序号" align="center" type="index" min-width="50px" /> | ||||
|         <el-table-column label="标题" align="center" prop="title" min-width="120px" /> | ||||
|         <el-table-column label="金额" align="center" prop="money" min-width="100px" /> | ||||
|         <el-table-column label="操作" align="center" class-name="small-padding" min-width="200px" fixed="right"> | ||||
|           <template #default="scope"> | ||||
|             <el-button type="primary" link @click="handleView(scope.row)" | ||||
|               ><el-icon><View /></el-icon>详情</el-button | ||||
|             > | ||||
|             <el-button type="success" link @click="bookSalary(scope.row)" | ||||
|               ><el-icon><View /></el-icon>查看工资表</el-button | ||||
|             > | ||||
|             <el-button type="primary" link @click="DownloadSalary(scope.row)" | ||||
|               ><el-icon><Download /></el-icon>下载工资表</el-button | ||||
|             > | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|       </el-table> | ||||
|     </el-card> | ||||
|     <!-- <uploadSalary ref="uploadSalaryRef" @busSalaryDetailsList="busSalaryDetailsList"></uploadSalary> | ||||
|     <detail ref="detailRef" @busSalaryDetailsList="busSalaryDetailsList"></detail> | ||||
|     <documentDetail ref="documentDetailRef" v-if="showDocumentDetail" @onClose="showDocumentDetail = false"></documentDetail> --> | ||||
|   </div> | ||||
| </template> | ||||
| <script setup lang="ts"> | ||||
| import { ref, reactive, onMounted, getCurrentInstance, nextTick, toRaw } from 'vue'; | ||||
| // import uploadSalary from '/@/views/system/salaryExcel/component/uploadSalary.vue'; | ||||
| // import detail from '/@/views/system/salaryExcel/component/detail.vue'; | ||||
| // import { readAllImportedListData, getTheSourceExcelAccordingToTheIdOfThePayroll, deletePayroll } from '/@/api/system/salaryExcel'; | ||||
| // import documentDetail from '/@/views/OnlineEngineering/comm/documentsDetail/index.vue'; | ||||
| import { ElMessageBox, ElMessage } from 'element-plus'; | ||||
| import { useUserStoreHook } from '@/store/modules/user'; | ||||
|  | ||||
| <script lang="ts" setup></script> | ||||
| const stores = useUserStoreHook(); | ||||
| const { proxy } = <any>getCurrentInstance(); | ||||
|  | ||||
| <style lang="scss" scoped></style> | ||||
| const loading = ref(false); | ||||
| const uploadSalaryRef = ref(); | ||||
| const editRef = ref(); | ||||
| const documentDetailRef = ref(); | ||||
| const detailRef = ref(); | ||||
|  | ||||
| const showAll = ref(false); | ||||
| const single = ref(true); | ||||
| const multiple = ref(true); | ||||
|  | ||||
| const showDocumentDetail = ref(false); | ||||
| const tableData = reactive({ | ||||
|   data: [], | ||||
|   total: 0 | ||||
| }); | ||||
| const totalMoney = ref(0); | ||||
| const DetailMoney = ref(0); | ||||
| const ids = ref<any[]>([]); | ||||
|  | ||||
| const uploadSalary = () => { | ||||
|   uploadSalaryRef.value.openDialog(); | ||||
| }; | ||||
|  | ||||
| const initTableData = () => { | ||||
|   busSalaryDetailsList(); | ||||
| }; | ||||
|  | ||||
| const busSalaryDetailsList = () => { | ||||
|   loading.value = true; | ||||
|   readAllImportedListData().then((res: any) => { | ||||
|     let list = res.data.list ?? []; | ||||
|     let moneySum = 0; | ||||
|     list.forEach((item) => { | ||||
|       moneySum += parseInt(item.money); | ||||
|     }); | ||||
|     DetailMoney.value = moneySum; | ||||
|     totalMoney.value = moneySum >= 10000 ? (moneySum / 10000).toFixed(2) + '万' : moneySum; | ||||
|     tableData.data = list; | ||||
|     loading.value = false; | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| const handleView = (row: any) => { | ||||
|   detailRef.value.openDialog(toRaw(row)); | ||||
| }; | ||||
|  | ||||
| const bookSalary = (row: any) => { | ||||
|   getTheSourceExcelAccordingToTheIdOfThePayroll({ id: row.id }).then((res: any) => { | ||||
|     if (res.code == 0) { | ||||
|       showDocumentDetail.value = true; | ||||
|       let obj = { | ||||
|         suffix: '.' + res.data.Suffix, | ||||
|         name: res.data.Name, | ||||
|         filenPathCoding: res.data.Path, | ||||
|         id: row.id | ||||
|       }; | ||||
|       nextTick(() => { | ||||
|         documentDetailRef.value.openDialog(obj); | ||||
|       }); | ||||
|     } | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| const DownloadSalary = (row: any) => { | ||||
|   getTheSourceExcelAccordingToTheIdOfThePayroll({ id: row.id }).then((res: any) => { | ||||
|     if (res.code == 0) { | ||||
|       window.open(res.data.Path, '_blank'); | ||||
|     } | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| const DownloadSalaryMOdel = () => { | ||||
|   window.open('http://zmkg.cqet.top:8899/file/masterMask/coryStorageTemplate/工资表模板.xlsx', '_blank'); | ||||
| }; | ||||
|  | ||||
| const delSalary = () => { | ||||
|   ElMessageBox.confirm('是否删除选中数据', '提示', { | ||||
|     confirmButtonText: '确认', | ||||
|     cancelButtonText: '取消', | ||||
|     type: 'warning' | ||||
|   }) | ||||
|     .then(() => { | ||||
|       deletePayroll({ ids: ids.value }).then(() => { | ||||
|         ElMessage.success('删除成功'); | ||||
|         busSalaryDetailsList(); | ||||
|       }); | ||||
|     }) | ||||
|     .catch(() => {}); | ||||
| }; | ||||
|  | ||||
| const handleSelectionChange = (selection: any[]) => { | ||||
|   ids.value = selection.map((item) => item.id); | ||||
| }; | ||||
|  | ||||
| onMounted(() => { | ||||
|   // initTableData(); | ||||
| }); | ||||
| </script> | ||||
|  | ||||
| <style lang="scss" scoped> | ||||
| .colBlock { | ||||
|   display: block; | ||||
| } | ||||
| .colNone { | ||||
|   display: none; | ||||
| } | ||||
| .system-busSalaryDetails-container { | ||||
|   .el-tag__content { | ||||
|     font-size: 20px !important; | ||||
|     font-weight: 600; | ||||
|   } | ||||
|   .info_s { | ||||
|     display: flex; | ||||
|     justify-content: space-between; | ||||
|     margin-bottom: 10px; | ||||
|   } | ||||
|   input[type='file'] { | ||||
|     display: none; | ||||
|   } | ||||
|   label { | ||||
|     display: inline-block; | ||||
|     background-color: #007bff; /*设置背景色*/ | ||||
|     color: #fff; /*设置字体颜色*/ | ||||
|     padding: 3px 10px; /*设置内边距*/ | ||||
|     border-radius: 5px; /*设置圆角*/ | ||||
|     cursor: pointer; /*将鼠标光标设置为手型*/ | ||||
|     font-size: 13px; | ||||
|   } | ||||
| } | ||||
| </style> | ||||
|  | ||||
| @ -124,6 +124,11 @@ | ||||
|             <el-option v-for="dict in quality_inspection_check_type" :key="dict.value" :label="dict.label" :value="dict.value"></el-option> | ||||
|           </el-select> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="整改单位" prop="rectificationUnit"> | ||||
|           <el-select v-model="form.rectificationUnit" placeholder="请选择整改单位"> | ||||
|             <el-option v-for="dict in rectification_unit_type" :key="dict.value" :label="dict.label" :value="dict.value"></el-option> | ||||
|           </el-select> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="所在班组" prop="teamId"> | ||||
|           <el-select v-model="form.teamId" placeholder="请选择所在班组"> | ||||
|             <el-option | ||||
| @ -177,8 +182,8 @@ import { QualityInspectionVO, QualityInspectionQuery, QualityInspectionForm } fr | ||||
| import { useUserStoreHook } from '@/store/modules/user'; | ||||
| import QualityInspectionDetail from './component/qualityInspectionDetail.vue'; | ||||
| const { proxy } = getCurrentInstance() as ComponentInternalInstance; | ||||
| const { quality_inspection_check_type, quality_inspection_status_type } = toRefs<any>( | ||||
|   proxy?.useDict('quality_inspection_check_type', 'quality_inspection_status_type') | ||||
| const { quality_inspection_check_type, quality_inspection_status_type, rectification_unit_type } = toRefs<any>( | ||||
|   proxy?.useDict('quality_inspection_check_type', 'quality_inspection_status_type', 'rectification_unit_type') | ||||
| ); | ||||
| // 获取用户 store | ||||
| const userStore = useUserStoreHook(); | ||||
| @ -220,6 +225,7 @@ const initFormData: QualityInspectionForm = { | ||||
|   verificationResult: undefined, | ||||
|   verificationType: undefined, | ||||
|   verificationTime: undefined, | ||||
|   rectificationUnit: undefined, | ||||
|   remark: undefined | ||||
| }; | ||||
| const data = reactive<PageData<QualityInspectionForm, QualityInspectionQuery>>({ | ||||
|  | ||||
| @ -27,9 +27,11 @@ const iframeLoaded = () => { | ||||
| }; | ||||
| //baseUrl + | ||||
| const open = async (definitionId, disabled) => { | ||||
|   const url = baseUrl + `/warm-flow-ui/index.html?id=${definitionId}&disabled=${disabled}`; | ||||
|   const url = import.meta.env.DEV | ||||
|     ? `/warm-flow-ui/index.html?id=${definitionId}&disabled=${disabled}` | ||||
|     : baseUrl + `/warm-flow-ui/index.html?id=${definitionId}&disabled=${disabled}`; | ||||
|   iframeUrl.value = url + '&Authorization=Bearer ' + getToken() + '&clientid=' + import.meta.env.VITE_APP_CLIENT_ID; | ||||
|   console.log('🚀 ~ open ~ iframeUrl:', iframeUrl.value); | ||||
|   console.log('🚀 ~ open ~ iframeUrl:', import.meta.env); | ||||
| }; | ||||
| /** 关闭按钮 */ | ||||
| function close() { | ||||
|  | ||||
| @ -160,6 +160,7 @@ const handleOpen = async (row: FlowTaskVO) => { | ||||
|     taskId: row.id, | ||||
|     type: 'approval', | ||||
|     formCustom: row.formCustom, | ||||
|     planMonth: row.businessId.split('_')[1], | ||||
|     formPath: row.formPath | ||||
|   }); | ||||
|   workflowCommon.routerJump(routerJumpVo, proxy); | ||||
|  | ||||
		Reference in New Issue
	
	Block a user