修改bug
This commit is contained in:
		| @ -5,7 +5,7 @@ VITE_APP_TITLE = 新能源项目管理平台 | ||||
| VITE_APP_ENV = 'development' | ||||
|  | ||||
| # 开发环境 | ||||
| VITE_APP_BASE_API = 'http://192.168.110.180:8898' | ||||
| VITE_APP_BASE_API = 'http://192.168.110.159:8898' | ||||
|  | ||||
| # 无人机接口地址 | ||||
|  | ||||
|  | ||||
							
								
								
									
										72
									
								
								src/api/message/config/index.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										72
									
								
								src/api/message/config/index.ts
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,72 @@ | ||||
| import request from '@/utils/request'; | ||||
| import { AxiosPromise } from 'axios'; | ||||
| import { ConfigVO, ConfigForm, ConfigQuery } from '@/api/message/config/types'; | ||||
|  | ||||
| /** | ||||
|  * 查询消息配置列表 | ||||
|  * @param query | ||||
|  * @returns {*} | ||||
|  */ | ||||
|  | ||||
| export const listConfig = (query?: ConfigQuery): AxiosPromise<ConfigVO[]> => { | ||||
|   return request({ | ||||
|     url: '/message/config/list', | ||||
|     method: 'get', | ||||
|     params: query | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * 查询消息配置详细 | ||||
|  * @param id | ||||
|  */ | ||||
| export const getConfig = (id: string | number): AxiosPromise<ConfigVO> => { | ||||
|   return request({ | ||||
|     url: '/message/config/' + id, | ||||
|     method: 'get' | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * 新增消息配置 | ||||
|  * @param data | ||||
|  */ | ||||
| export const addConfig = (data: ConfigForm) => { | ||||
|   return request({ | ||||
|     url: '/message/config', | ||||
|     method: 'post', | ||||
|     data: data | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * 修改消息配置 | ||||
|  * @param data | ||||
|  */ | ||||
| export const updateConfig = (data: ConfigForm) => { | ||||
|   return request({ | ||||
|     url: '/message/config', | ||||
|     method: 'put', | ||||
|     data: data | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * 删除消息配置 | ||||
|  * @param id | ||||
|  */ | ||||
| export const delConfig = (id: string | number | Array<string | number>) => { | ||||
|   return request({ | ||||
|     url: '/message/config/' + id, | ||||
|     method: 'delete' | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| /** 获取用户列表 */ | ||||
| export const listUser = (query?: any) => { | ||||
|   return request({ | ||||
|     url: '/system/user/list', | ||||
|     method: 'get', | ||||
|     params: query | ||||
|   }); | ||||
| }; | ||||
							
								
								
									
										116
									
								
								src/api/message/config/types.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										116
									
								
								src/api/message/config/types.ts
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,116 @@ | ||||
| export interface ConfigVO { | ||||
|   /** | ||||
|    * 主键ID | ||||
|    */ | ||||
|   id: string | number; | ||||
|  | ||||
|   /** | ||||
|    * 项目ID | ||||
|    */ | ||||
|   projectId: string | number; | ||||
|  | ||||
|   /** | ||||
|    * 消息名称 | ||||
|    */ | ||||
|   msgName: number; | ||||
|  | ||||
|   /** | ||||
|    * 消息模板 | ||||
|    */ | ||||
|   msgContent: string; | ||||
|  | ||||
|   /** | ||||
|    * 消息标识 | ||||
|    */ | ||||
|   msgKey: string; | ||||
|  | ||||
|   /** | ||||
|    * 跳转路由 | ||||
|    */ | ||||
|   route: string; | ||||
|  | ||||
|   /** | ||||
|    * 通知人 | ||||
|    */ | ||||
|   userId: string | number; | ||||
|  | ||||
| } | ||||
|  | ||||
| export interface ConfigForm extends BaseEntity { | ||||
|   /** | ||||
|    * 主键ID | ||||
|    */ | ||||
|   id?: string | number; | ||||
|  | ||||
|   /** | ||||
|    * 项目ID | ||||
|    */ | ||||
|   projectId?: string | number; | ||||
|  | ||||
|   /** | ||||
|    * 消息名称 | ||||
|    */ | ||||
|   msgName?: number; | ||||
|  | ||||
|   /** | ||||
|    * 消息模板 | ||||
|    */ | ||||
|   msgContent?: string; | ||||
|  | ||||
|   /** | ||||
|    * 消息标识 | ||||
|    */ | ||||
|   msgKey?: string; | ||||
|  | ||||
|   /** | ||||
|    * 跳转路由 | ||||
|    */ | ||||
|   route?: string; | ||||
|  | ||||
|   /** | ||||
|    * 通知人 | ||||
|    */ | ||||
|   userId?: string | number; | ||||
|  | ||||
| } | ||||
|  | ||||
| export interface ConfigQuery extends PageQuery { | ||||
|  | ||||
|   /** | ||||
|    * 项目ID | ||||
|    */ | ||||
|   projectId?: string | number; | ||||
|  | ||||
|   /** | ||||
|    * 消息名称 | ||||
|    */ | ||||
|   msgName?: number; | ||||
|  | ||||
|   /** | ||||
|    * 消息模板 | ||||
|    */ | ||||
|   msgContent?: string; | ||||
|  | ||||
|   /** | ||||
|    * 消息标识 | ||||
|    */ | ||||
|   msgKey?: string; | ||||
|  | ||||
|   /** | ||||
|    * 跳转路由 | ||||
|    */ | ||||
|   route?: string; | ||||
|  | ||||
|   /** | ||||
|    * 通知人 | ||||
|    */ | ||||
|   userId?: string | number; | ||||
|  | ||||
|     /** | ||||
|      * 日期范围参数 | ||||
|      */ | ||||
|     params?: any; | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| @ -4,7 +4,11 @@ | ||||
|       <el-table-column type="selection" width="55" align="center" /> | ||||
|       <el-table-column align="center" prop="projectName" label="工程名称" /> | ||||
|       <el-table-column align="center" prop="submitUnit" label="提出单位" /> | ||||
|       <el-table-column align="center" prop="specialty" label="专业" /> | ||||
|       <el-table-column align="center" prop="specialty" label="专业"> | ||||
|         <template #default="{ row }"> | ||||
|           <dict-tag :options="des_user_major" :value="row.specialty" /> | ||||
|         </template> | ||||
|       </el-table-column> | ||||
|       <el-table-column align="center" prop="submitDate" label="提出日期"> | ||||
|         <template #default="{ row }"> | ||||
|           {{ formatDate(row.submitDate) }} | ||||
| @ -41,14 +45,16 @@ | ||||
|           <el-descriptions :column="2" border style="margin-top: 8px" label-width="160px" size="large"> | ||||
|             <el-descriptions-item label-align="center" label="工程名称" class-name="zebra"> {{ tableDetail.projectName }} </el-descriptions-item> | ||||
|             <el-descriptions-item label-align="center" label="提出单位" class-name="zebra"> {{ tableDetail.submitUnit }} </el-descriptions-item> | ||||
|             <el-descriptions-item label-align="center" label="专业" label-class-name="white"> {{ tableDetail.specialty }} </el-descriptions-item> | ||||
|             <el-descriptions-item label-align="center" label="专业" label-class-name="white" | ||||
|               ><dict-tag :options="des_user_major" :value="tableDetail.specialty" /> | ||||
|             </el-descriptions-item> | ||||
|             <el-descriptions-item label-align="center" label="提出日期" label-class-name="white"> | ||||
|               {{ dayjs(tableDetail.submitDate).format('YYYY-MM-DD') }} | ||||
|             </el-descriptions-item> | ||||
|             <el-descriptions-item label-align="center" label="卷册名称" class-name="zebra"> {{ tableDetail.volumeName }} </el-descriptions-item> | ||||
|             <el-descriptions-item label-align="center" label="卷册号" class-name="zebra"> {{ tableDetail.volumeNumber }} </el-descriptions-item> | ||||
|             <el-descriptions-item label-align="center" label="附图" :span="2" label-class-name="white"> | ||||
|               <image-preview :src="item.url" v-for="item in tableDetail.attachments" width="200px" class="mr" /> | ||||
|               <img :src="item.url" v-for="item in tableDetail.attachmentsImgList" alt="" style="width: 200px; height: auto" /> | ||||
|             </el-descriptions-item> | ||||
|             <el-descriptions-item label-align="center" label="变更原因" :span="2" class-name="zebra"> | ||||
|               <el-checkbox-group v-model="tableDetail.changeReasons"> | ||||
| @ -64,6 +70,11 @@ | ||||
|             <el-descriptions-item label-align="center" label="内容" :span="2" label-class-name="white"> | ||||
|               {{ tableDetail.content }} | ||||
|             </el-descriptions-item> | ||||
|             <el-descriptions-item label-align="center" label="附件" :span="2" label-class-name="white"> | ||||
|               <el-link type="primary" :underline="false" :href="tableDetail.attachmentsList.url" target="_blank">{{ | ||||
|                 tableDetail.attachmentsList.originalName | ||||
|               }}</el-link> | ||||
|             </el-descriptions-item> | ||||
|             <el-descriptions-item label-align="center" label="变更费用估算" :span="2" class-name="zebra"> | ||||
|               {{ tableDetail.costEstimation }} | ||||
|             </el-descriptions-item> | ||||
| @ -163,6 +174,7 @@ const props = defineProps({ | ||||
|     default: '' | ||||
|   } | ||||
| }); | ||||
|  | ||||
| const tableDetail = ref<any>({}); | ||||
| const exportRef = ref<HTMLElement>(); | ||||
| const radioList = ref([ | ||||
| @ -177,13 +189,24 @@ const radioList = ref([ | ||||
| ]); | ||||
| const detailVisible = ref(false); | ||||
| const formatDate = (val: string | Date) => (val ? dayjs(val).format('YYYY-MM-DD') : ''); | ||||
| const { des_user_major } = toRefs<any>(proxy?.useDict('des_user_major')); | ||||
|  | ||||
| const handleDetail = async (row) => { | ||||
|   const res = await listByIds(row.id); | ||||
|   tableDetail.value = { | ||||
|     ...row, | ||||
|     hasAttachmentList: res.data | ||||
|   }; | ||||
|   tableDetail.value = { ...row }; | ||||
|  | ||||
|   if (row.attachmentsImg) { | ||||
|     const res = await listByIds(row.attachmentsImg); | ||||
|     tableDetail.value.attachmentsImgList = res.data; | ||||
|   } | ||||
|   if (row.attachments) { | ||||
|     const res = await listByIds(row.attachments); | ||||
|     tableDetail.value.attachmentsList = res.data[0]; | ||||
|   } | ||||
|  | ||||
|   // tableDetail.value = { | ||||
|   //   ...row, | ||||
|   //   hasAttachmentList: res.data | ||||
|   // }; | ||||
|   detailVisible.value = true; | ||||
| }; | ||||
| /** 多选框选中数据 */ | ||||
| @ -220,7 +243,7 @@ const handleViewInfo = (row) => { | ||||
|     } | ||||
|   }); | ||||
| }; | ||||
| const handleDownload = () => { | ||||
| const handleDownload = async () => { | ||||
|   const style = ` | ||||
|     <style> | ||||
|       .white { background: #fff !important; } | ||||
| @ -230,17 +253,52 @@ const handleDownload = () => { | ||||
|       table { border-collapse: collapse; width: 100%; } | ||||
|       th, td { border: 1px solid #333; padding: 6px; font-size: 14px; } | ||||
|     </style> | ||||
| `; | ||||
|   `; | ||||
|  | ||||
|   const el = exportRef.value; | ||||
|   if (!el) return; | ||||
|  | ||||
|   // 拷贝 DOM,避免修改原内容 | ||||
|   // 拷贝 DOM,避免影响原内容 | ||||
|   const clone = el.cloneNode(true) as HTMLElement; | ||||
|  | ||||
|   // 删除 .dialog-footer | ||||
|   const footer = clone.querySelector('.dialog-footer'); | ||||
|   if (footer) { | ||||
|     footer.remove(); | ||||
|   } | ||||
|  | ||||
|   // 工具函数:图片转成指定宽度的 base64 | ||||
|   const resizeImageToBase64 = (img: HTMLImageElement, maxWidth = 500) => { | ||||
|     return new Promise<string>((resolve) => { | ||||
|       const image = new Image(); | ||||
|       image.crossOrigin = 'anonymous'; | ||||
|       image.src = img.src; | ||||
|       image.onload = () => { | ||||
|         const scale = Math.min(1, maxWidth / image.naturalWidth); | ||||
|         const canvas = document.createElement('canvas'); | ||||
|         canvas.width = image.naturalWidth * scale; | ||||
|         canvas.height = image.naturalHeight * scale; | ||||
|         const ctx = canvas.getContext('2d'); | ||||
|         ctx!.drawImage(image, 0, 0, canvas.width, canvas.height); | ||||
|         resolve(canvas.toDataURL('image/png')); | ||||
|       }; | ||||
|       image.onerror = () => { | ||||
|         resolve(img.src); // 如果加载失败就用原地址 | ||||
|       }; | ||||
|     }); | ||||
|   }; | ||||
|  | ||||
|   // 找到所有图片并替换成 base64(顺序执行以避免并发问题) | ||||
|   const imgs = Array.from(clone.querySelectorAll('img')); | ||||
|   for (let img of imgs) { | ||||
|     const base64 = await resizeImageToBase64(img, 200); | ||||
|     img.src = base64; | ||||
|   } | ||||
|  | ||||
|   // 应用表格的内联样式 | ||||
|   applyInlineTableStyles(clone); | ||||
|  | ||||
|   // 包裹 HTML 内容 | ||||
|   // 拼接 HTML | ||||
|   const html = ` | ||||
|     <html> | ||||
|       <head> | ||||
| @ -256,6 +314,7 @@ const handleDownload = () => { | ||||
|   const blob = (window as any).htmlDocx.asBlob(html); | ||||
|   saveAs(blob, '变更单.docx'); | ||||
| }; | ||||
|  | ||||
| const applyInlineTableStyles = (rootEl: HTMLElement) => { | ||||
|   rootEl.querySelectorAll('table').forEach((table) => { | ||||
|     table.setAttribute('style', 'width:100%; border-collapse:collapse; table-layout:fixed; border:1px solid #333;'); | ||||
| @ -328,6 +387,9 @@ const applyInlineTableStyles = (rootEl: HTMLElement) => { | ||||
|     flex-direction: column; | ||||
|     justify-content: center; | ||||
|     cursor: pointer; | ||||
|     img { | ||||
|       transform: rotateZ(180deg); | ||||
|     } | ||||
|   } | ||||
| } | ||||
| </style> | ||||
|  | ||||
| @ -50,7 +50,9 @@ | ||||
|                   <el-row :gutter="20"> | ||||
|                     <el-col :span="12"> | ||||
|                       <el-form-item label="专业"> | ||||
|                         <el-input v-model="form.specialty" /> | ||||
|                         <el-select v-model="form.specialty" placeholder=""> | ||||
|                           <el-option v-for="item in des_user_major" :key="item.value" :label="item.label" :value="item.value" /> | ||||
|                         </el-select> | ||||
|                       </el-form-item> | ||||
|                     </el-col> | ||||
|                     <el-col :span="12"> | ||||
| @ -69,7 +71,7 @@ | ||||
|                     </el-col> | ||||
|                     <el-col :span="12"> | ||||
|                       <el-form-item label="附图"> | ||||
|                         <file-Upload v-model="form.attachments"> | ||||
|                         <file-Upload v-model="form.attachmentsImg" :file-type="['pdf', 'png', 'jpg', 'jpeg', 'gif', 'bmp']"> | ||||
|                           <el-button type="primary">上传附件</el-button> | ||||
|                         </file-Upload> | ||||
|                       </el-form-item> | ||||
| @ -98,7 +100,7 @@ | ||||
|                     <el-input v-model="form.content" type="textarea" :rows="6" placeholder="请输入内容" /> | ||||
|                   </el-form-item> | ||||
|                   <el-form-item label="附件" prop="attachments"> | ||||
|                     <file-upload v-model="form.attachments" :limit="1" :file-type="['pdf', 'png', 'jpg', 'jpeg', 'gif', 'bmp']"></file-upload> | ||||
|                     <file-upload v-model="form.attachments" :limit="1" :file-type="['pdf']"></file-upload> | ||||
|                   </el-form-item> | ||||
|                   <el-form-item label="变更费用估算" prop="costEstimation"> | ||||
|                     <el-input v-model="form.costEstimation" :rows="6" placeholder="请输入变更费用估算" /> | ||||
| @ -174,6 +176,7 @@ const { proxy } = getCurrentInstance() as ComponentInternalInstance; | ||||
| import { useUserStoreHook } from '@/store/modules/user'; | ||||
| import { listByIds } from '@/api/system/oss'; | ||||
| import { addContactnotice, getContactnotice, updateContactnotice } from '@/api/cory/contactnotice'; | ||||
| const { des_user_major } = toRefs(proxy?.useDict('des_user_major')); | ||||
|  | ||||
| // 获取用户 store | ||||
| const userStore = useUserStoreHook(); | ||||
|  | ||||
| @ -40,7 +40,7 @@ | ||||
|           </el-col> | ||||
|           <el-col :span="1.5"> | ||||
|             <file-upload | ||||
|               v-model="filePath" | ||||
|               v-model="form.file" | ||||
|               isImportInfo | ||||
|               :isShowTip="false" | ||||
|               uploadUrl="/design/volumeCatalog/importData" | ||||
| @ -67,11 +67,14 @@ | ||||
|             <dict-tag :options="design_state" :value="scope.row.designState" /> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <el-table-column label="专业" align="center" prop="specialty" /> | ||||
|         <el-table-column label="专业" align="center" prop="specialty"> | ||||
|           <template #default="scope"> | ||||
|             <dict-tag :options="des_user_major" :value="scope.row.specialty" /> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <el-table-column label="负责人" align="center" prop="principal" /> | ||||
|         <el-table-column label="卷册号" align="center" prop="volumeNumber" /> | ||||
|         <el-table-column label="资料名称" align="center" prop="documentName" /> | ||||
|         <el-table-column label="上传时间" align="center" prop="createTime" /> | ||||
|         <el-table-column label="计划出图时间" align="center" prop="plannedCompletion" /> | ||||
|         <el-table-column label="审核状态" align="center" prop="auditStatus"> | ||||
|           <template #default="scope"> | ||||
| @ -79,7 +82,7 @@ | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|  | ||||
|         <el-table-column label="文件" align="center" prop="fileVoList" width="180"> | ||||
|         <!-- <el-table-column label="文件" align="center" prop="fileVoList" width="180"> | ||||
|           <template #default="scope"> | ||||
|             <el-link | ||||
|               v-for="item in scope.row.fileVoList" | ||||
| @ -93,7 +96,7 @@ | ||||
|               {{ item.fileName }} | ||||
|             </el-link> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         </el-table-column> --> | ||||
|         <el-table-column label="上传说明" align="center" prop="explainText"> | ||||
|           <template #default="scope"> | ||||
|             {{ scope.row.fileVoList[0]?.explainText }} | ||||
| @ -102,6 +105,7 @@ | ||||
|         <el-table-column label="备注" align="center" prop="remark" /> | ||||
|         <el-table-column label="操作" align="center" width="220"> | ||||
|           <template #default="scope"> | ||||
|             <el-button link type="primary" icon="View" @click="handleView(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> | ||||
|             <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> | ||||
| @ -121,7 +125,9 @@ | ||||
|           <el-input v-model="form.designSubitem" placeholder="请输入设计子项" /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="专业" prop="specialty"> | ||||
|           <el-input v-model="form.specialty" placeholder="请输入专业" /> | ||||
|           <el-select v-model="form.specialty" placeholder="请选择专业"> | ||||
|             <el-option :value="item.value" v-for="item in des_user_major" :key="item.value" :label="item.label" /> | ||||
|           </el-select> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="负责人" prop="principal"> | ||||
|           <el-input v-model="form.principal" placeholder="请输入负责人" /> | ||||
| @ -176,6 +182,41 @@ | ||||
|         </el-form-item> | ||||
|       </el-form> | ||||
|     </el-dialog> | ||||
|     <!-- 查看文件列表 --> | ||||
|     <el-dialog title="文件列表" v-model="viewVisible" width="45%"> | ||||
|       <el-table v-if="fileList.length > 0" :data="fileList" style="width: 100%" border> | ||||
|         <el-table-column prop="fileName" label="文件" align="center"> | ||||
|           <template #default="scope"> | ||||
|             <el-link | ||||
|               :key="scope.row.fileId" | ||||
|               :href="scope.row.fileUrl" | ||||
|               target="_blank" | ||||
|               :type="scope.row.status == '1' ? 'primary' : 'info'" | ||||
|               :underline="false" | ||||
|             > | ||||
|               {{ scope.row.fileName }} | ||||
|             </el-link> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <el-table-column prop="size" label="状态" width="170" align="center"> | ||||
|           <template #default="scope"> | ||||
|             <el-tag :type="scope.row.status == 1 ? 'success' : 'info'">{{ scope.row.status == 1 ? '使用中' : '已作废' }}</el-tag> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <el-table-column label="操作" width="170" align="center"> | ||||
|           <template #default="scope"> | ||||
|             <el-button type="danger" link icon="Download" @click="handleDownload(scope.row)"> 下载 </el-button> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|       </el-table> | ||||
|  | ||||
|       <div v-else class="empty-list text-center">暂无文件</div> | ||||
|       <template #footer> | ||||
|         <span> | ||||
|           <el-button type="primary" @click="viewVisible = false">关闭</el-button> | ||||
|         </span> | ||||
|       </template> | ||||
|     </el-dialog> | ||||
|   </div> | ||||
| </template> | ||||
|  | ||||
| @ -192,9 +233,9 @@ import { | ||||
| } from '@/api/design/volumeCatalog'; | ||||
| import { VolumeCatalogVO, VolumeCatalogQuery, VolumeCatalogForm } from '@/api/design/volumeCatalog/types'; | ||||
| import { useUserStoreHook } from '@/store/modules/user'; | ||||
|  | ||||
| const fileList = ref([]); | ||||
| const { proxy } = getCurrentInstance() as ComponentInternalInstance; | ||||
| const { design_state, wf_business_status } = toRefs(proxy?.useDict('design_state', 'wf_business_status')); | ||||
| const { design_state, wf_business_status, des_user_major } = toRefs(proxy?.useDict('design_state', 'wf_business_status', 'des_user_major')); | ||||
|  | ||||
| const volumeCatalogList = ref<VolumeCatalogVO[]>([]); | ||||
| const buttonLoading = ref(false); | ||||
| @ -228,16 +269,17 @@ const uploadForm = reactive({ | ||||
|  | ||||
| const userList = ref([]); | ||||
|  | ||||
| const initFormData: VolumeCatalogForm = { | ||||
| const initFormData: any = { | ||||
|   design: undefined, | ||||
|   projectId: currentProject.value?.id || '', | ||||
|   designSubitemId: undefined, | ||||
|   volumeNumber: undefined, | ||||
|   documentName: undefined, | ||||
|   designState: '2', | ||||
|  | ||||
|   remark: undefined | ||||
| }; | ||||
| const data = reactive<PageData<VolumeCatalogForm, VolumeCatalogQuery>>({ | ||||
| const data = reactive({ | ||||
|   form: { ...initFormData }, | ||||
|   queryParams: { | ||||
|     pageNum: 1, | ||||
| @ -305,7 +347,7 @@ const handleSelectionChange = (selection: VolumeCatalogVO[]) => { | ||||
| const handleAdd = () => { | ||||
|   reset(); | ||||
|   dialog.visible = true; | ||||
|   dialog.title = '添加卷册目录'; | ||||
|   dialog.title = '添加设计出图计划'; | ||||
| }; | ||||
|  | ||||
| /** 修改按钮操作 */ | ||||
| @ -315,11 +357,18 @@ const handleUpdate = async (row?: VolumeCatalogVO) => { | ||||
|   const res = await getVolumeCatalog(_id); | ||||
|   Object.assign(form.value, res.data); | ||||
|   dialog.visible = true; | ||||
|   dialog.title = '修改卷册目录'; | ||||
|   dialog.title = '修改设计出图计划'; | ||||
| }; | ||||
|  | ||||
| const handleView = (row?: any) => { | ||||
|   fileList.value = row.fileVoList; | ||||
|  | ||||
|   viewVisible.value = true; | ||||
| }; | ||||
|  | ||||
| /** 上传文件按钮操作 */ | ||||
| const uploadVisible = ref(false); | ||||
| const viewVisible = ref(false); | ||||
| const handleUpload = async (row?: any) => { | ||||
|   resetUploadForm(); | ||||
|   uploadForm.volumeCatalogId = row.design; | ||||
| @ -331,7 +380,7 @@ const handleUpload = async (row?: any) => { | ||||
|  | ||||
| /** 查看文件 */ | ||||
| const lookFile = (fileId: string) => { | ||||
|   lookViewerFile(fileId); | ||||
|   // lookViewerFile(fileId); | ||||
| }; | ||||
|  | ||||
| /** 重置上传表单 */ | ||||
| @ -361,6 +410,10 @@ const submitForm = () => { | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| const handleDownload = (row: any) => { | ||||
|   proxy?.$download.oss(row.fileId); | ||||
| }; | ||||
|  | ||||
| /** 上传文件提交 */ | ||||
| const onSubmit = async () => { | ||||
|   buttonLoading.value = true; | ||||
|  | ||||
							
								
								
									
										275
									
								
								src/views/message/config/index.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										275
									
								
								src/views/message/config/index.vue
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,275 @@ | ||||
| <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="msgName"> | ||||
|               <el-input v-model="queryParams.msgName" placeholder="请输入消息名称" clearable @keyup.enter="handleQuery" /> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="消息标识" prop="msgKey"> | ||||
|               <el-input v-model="queryParams.msgKey" placeholder="请输入消息标识" clearable @keyup.enter="handleQuery" /> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="跳转路由" prop="route"> | ||||
|               <el-input v-model="queryParams.route" placeholder="请输入跳转路由" clearable @keyup.enter="handleQuery" /> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="通知人" prop="userId"> | ||||
|               <el-input v-model="queryParams.userId" 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="['message:config:add']">新增</el-button> | ||||
|           </el-col> | ||||
|           <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> | ||||
|         </el-row> | ||||
|       </template> | ||||
|  | ||||
|       <el-table v-loading="loading" :data="configList" @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="msgName" /> | ||||
|         <el-table-column label="消息模板" align="center" prop="msgContent" /> | ||||
|         <el-table-column label="消息标识" align="center" prop="msgKey" /> | ||||
|         <el-table-column label="跳转路由" align="center" prop="route" /> | ||||
|         <el-table-column label="通知人" align="center" prop="userId" /> | ||||
|         <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="['message:config:edit']"></el-button> | ||||
|             </el-tooltip> | ||||
|             <el-tooltip content="删除" placement="top"> | ||||
|               <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['message:config: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="configFormRef" :model="form" :rules="rules" label-width="80px"> | ||||
|         <el-form-item label="消息名称" prop="msgName"> | ||||
|           <el-input v-model="form.msgName" placeholder="请输入消息名称" /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="消息模板" prop="msgContent"> | ||||
|           <el-input v-model="form.msgContent" placeholder="请输入消息模板" /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="消息标识" prop="msgKey"> | ||||
|           <el-input v-model="form.msgKey" placeholder="请输入消息标识" /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="跳转路由" prop="route"> | ||||
|           <el-input v-model="form.route" placeholder="请输入跳转路由" /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="通知人" prop="userId"> | ||||
|           <el-select v-model="form.userId" placeholder="请选择通知人" multiple filterable> | ||||
|             <el-option v-for="item in userList" :key="item.id" :label="item.nickName" :value="item.id" /> | ||||
|           </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="Config" lang="ts"> | ||||
| import { listConfig, getConfig, delConfig, addConfig, updateConfig, listUser } from '@/api/message/config'; | ||||
| import { ConfigVO, ConfigQuery, ConfigForm } from '@/api/message/config/types'; | ||||
| import { useUserStoreHook } from '@/store/modules/user'; | ||||
|  | ||||
| const { proxy } = getCurrentInstance() as ComponentInternalInstance; | ||||
| // 获取用户 store | ||||
| const userStore = useUserStoreHook(); | ||||
| // 从 store 中获取项目列表和当前选中的项目 | ||||
| const currentProject = computed(() => userStore.selectedProject); | ||||
| const configList = ref<ConfigVO[]>([]); | ||||
| 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 userList = ref([]); | ||||
| const queryFormRef = ref<ElFormInstance>(); | ||||
| const configFormRef = ref<ElFormInstance>(); | ||||
|  | ||||
| const dialog = reactive<DialogOption>({ | ||||
|   visible: false, | ||||
|   title: '' | ||||
| }); | ||||
|  | ||||
| const initFormData: ConfigForm = { | ||||
|   id: undefined, | ||||
|   projectId: currentProject.value.id, | ||||
|   msgName: undefined, | ||||
|   msgContent: undefined, | ||||
|   msgKey: undefined, | ||||
|   route: undefined, | ||||
|   userId: undefined | ||||
| }; | ||||
| const data = reactive<PageData<ConfigForm, ConfigQuery>>({ | ||||
|   form: { ...initFormData }, | ||||
|   queryParams: { | ||||
|     pageNum: 1, | ||||
|     pageSize: 10, | ||||
|     projectId: currentProject.value.id, | ||||
|     msgName: undefined, | ||||
|     msgContent: undefined, | ||||
|     msgKey: undefined, | ||||
|     route: undefined, | ||||
|     userId: undefined, | ||||
|     params: {} | ||||
|   }, | ||||
|   rules: { | ||||
|     id: [{ required: true, message: '主键ID不能为空', trigger: 'blur' }], | ||||
|     projectId: [{ required: true, message: '项目ID不能为空', trigger: 'blur' }], | ||||
|     msgName: [{ required: true, message: '消息名称不能为空', trigger: 'blur' }], | ||||
|     msgContent: [{ required: true, message: '消息模板不能为空', trigger: 'blur' }], | ||||
|     msgKey: [{ required: true, message: '消息标识不能为空', trigger: 'blur' }], | ||||
|     route: [{ required: true, message: '跳转路由不能为空', trigger: 'blur' }] | ||||
|   } | ||||
| }); | ||||
|  | ||||
| const { queryParams, form, rules } = toRefs(data); | ||||
|  | ||||
| /** 查询消息配置列表 */ | ||||
| const getList = async () => { | ||||
|   loading.value = true; | ||||
|   const res = await listConfig(queryParams.value); | ||||
|   configList.value = res.rows; | ||||
|   total.value = res.total; | ||||
|   loading.value = false; | ||||
| }; | ||||
|  | ||||
| /** 取消按钮 */ | ||||
| const cancel = () => { | ||||
|   reset(); | ||||
|   dialog.visible = false; | ||||
| }; | ||||
|  | ||||
| /** 表单重置 */ | ||||
| const reset = () => { | ||||
|   form.value = { ...initFormData }; | ||||
|   form.value.projectId = currentProject.value.id; | ||||
|   configFormRef.value?.resetFields(); | ||||
| }; | ||||
|  | ||||
| /** 搜索按钮操作 */ | ||||
| const handleQuery = () => { | ||||
|   queryParams.value.pageNum = 1; | ||||
|   getList(); | ||||
| }; | ||||
|  | ||||
| /** 重置按钮操作 */ | ||||
| const resetQuery = () => { | ||||
|   queryFormRef.value?.resetFields(); | ||||
|   handleQuery(); | ||||
| }; | ||||
|  | ||||
| /** 多选框选中数据 */ | ||||
| const handleSelectionChange = (selection: ConfigVO[]) => { | ||||
|   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?: ConfigVO) => { | ||||
|   reset(); | ||||
|   const _id = row?.id || ids.value[0]; | ||||
|   const res = await getConfig(_id); | ||||
|   Object.assign(form.value, res.data); | ||||
|   dialog.visible = true; | ||||
|   dialog.title = '修改消息配置'; | ||||
| }; | ||||
|  | ||||
| /** 提交按钮 */ | ||||
| const submitForm = () => { | ||||
|   configFormRef.value?.validate(async (valid: boolean) => { | ||||
|     if (valid) { | ||||
|       buttonLoading.value = true; | ||||
|       if (form.value.id) { | ||||
|         await updateConfig(form.value).finally(() => (buttonLoading.value = false)); | ||||
|       } else { | ||||
|         await addConfig(form.value).finally(() => (buttonLoading.value = false)); | ||||
|       } | ||||
|       proxy?.$modal.msgSuccess('操作成功'); | ||||
|       dialog.visible = false; | ||||
|       await getList(); | ||||
|     } | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| /** 删除按钮操作 */ | ||||
| const handleDelete = async (row?: ConfigVO) => { | ||||
|   const _ids = row?.id || ids.value; | ||||
|   await proxy?.$modal.confirm('是否确认删除消息配置编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false)); | ||||
|   await delConfig(_ids); | ||||
|   proxy?.$modal.msgSuccess('删除成功'); | ||||
|   await getList(); | ||||
| }; | ||||
|  | ||||
| /** 导出按钮操作 */ | ||||
| const handleExport = () => { | ||||
|   proxy?.download( | ||||
|     'message/config/export', | ||||
|     { | ||||
|       ...queryParams.value | ||||
|     }, | ||||
|     `config_${new Date().getTime()}.xlsx` | ||||
|   ); | ||||
| }; | ||||
|  | ||||
| /** 获取用户列表 */ | ||||
| const getListUser = async () => { | ||||
|   const res = await listUser({ | ||||
|     pageNum: 1, | ||||
|     pageSize: 1000, | ||||
|     projectId: currentProject.value.id | ||||
|   }); | ||||
|   userList.value = res.rows; | ||||
| }; | ||||
|  | ||||
| onMounted(() => { | ||||
|   getList(); | ||||
|   getListUser(); | ||||
| }); | ||||
|  | ||||
| //监听项目id刷新数据 | ||||
| const listeningProject = watch( | ||||
|   () => currentProject.value.id, | ||||
|   (nid, oid) => { | ||||
|     queryParams.value.projectId = nid; | ||||
|     form.value.projectId = nid; | ||||
|     getList(); | ||||
|   } | ||||
| ); | ||||
|  | ||||
| onUnmounted(() => { | ||||
|   listeningProject(); | ||||
| }); | ||||
| </script> | ||||
		Reference in New Issue
	
	Block a user