view.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433
  1. <template>
  2. <div class="safety-platform-container">
  3. <header class="safety-platform-container__header">
  4. <div class="breadcrumb-title">
  5. <BreadcrumbBack />
  6. 查看施工安全申请
  7. </div>
  8. </header>
  9. <el-alert v-if="showAlertBar" :title="formValue.rejectReason" type="error" />
  10. <main class="safety-platform-container__main">
  11. <el-form ref="formRef" :inline="true" label-width="auto" :model="formValue">
  12. <el-form-item label="项目名称" prop="projectName">
  13. <el-input
  14. v-model="formValue.projectName"
  15. size="large"
  16. :disabled="true"
  17. placeholder="请输入项目名称"
  18. style="width: 330px"
  19. />
  20. </el-form-item>
  21. <el-form-item label="施工地点(区域)" prop="constructionLocation">
  22. <el-input
  23. v-model="formValue.constructionLocation"
  24. size="large"
  25. :disabled="true"
  26. placeholder="请输入施工地点(区域)"
  27. style="width: 330px"
  28. />
  29. </el-form-item>
  30. <el-form-item label="施工单位名称" prop="constructionUnit">
  31. <el-input
  32. v-model="formValue.constructionUnit"
  33. size="large"
  34. :disabled="true"
  35. placeholder="请输入施工单位名称"
  36. style="width: 330px"
  37. />
  38. </el-form-item>
  39. <el-form-item label="施工项目负责人" prop="projectManagerName">
  40. <el-input
  41. v-model="formValue.projectManagerName"
  42. :disabled="true"
  43. size="large"
  44. placeholder="输入施工项目负责人"
  45. style="width: 330px"
  46. />
  47. </el-form-item>
  48. <el-form-item label="施工项目负责人电话1" prop="projectManagerPhone1">
  49. <el-input
  50. v-model="formValue.projectManagerPhone1"
  51. :disabled="true"
  52. size="large"
  53. placeholder="输入施工项目负责人电话1"
  54. style="width: 330px"
  55. />
  56. </el-form-item>
  57. <el-form-item label="施工项目负责人电话2" prop="projectManagerPhone2">
  58. <el-input
  59. v-model="formValue.projectManagerPhone2"
  60. :disabled="true"
  61. size="large"
  62. placeholder="输入施工项目负责人电话2"
  63. style="width: 330px"
  64. />
  65. </el-form-item>
  66. <el-form-item label="施工现场安全负责人" prop="siteSafetyManagerName">
  67. <el-input
  68. v-model="formValue.siteSafetyManagerName"
  69. size="large"
  70. :disabled="true"
  71. placeholder="输入施工现场安全负责人"
  72. style="width: 330px"
  73. />
  74. </el-form-item>
  75. <el-form-item label="施工现场安全负责人电话1" prop="siteSafetyPhone1">
  76. <el-input
  77. v-model="formValue.siteSafetyPhone1"
  78. :disabled="true"
  79. size="large"
  80. placeholder="输入施工现场安全负责人电话1"
  81. style="width: 330px"
  82. />
  83. </el-form-item>
  84. <el-form-item label="施工现场安全负责人电话2" prop="siteSafetyPhone2">
  85. <el-input
  86. v-model="formValue.siteSafetyPhone2"
  87. size="large"
  88. :disabled="true"
  89. placeholder="输入施工现场安全负责人电话2"
  90. style="width: 330px"
  91. />
  92. </el-form-item>
  93. <el-form-item label="开始时间" prop="projectStartTime">
  94. <el-date-picker
  95. v-model="formValue.projectStartTime"
  96. type="date"
  97. value-format="YYYY-MM-DD"
  98. size="large"
  99. :disabled="true"
  100. placeholder="开始时间"
  101. style="width: 330px"
  102. />
  103. </el-form-item>
  104. <el-form-item label="结束时间" prop="projectEndTime">
  105. <el-date-picker
  106. v-model="formValue.projectEndTime"
  107. type="date"
  108. value-format="YYYY-MM-DD"
  109. size="large"
  110. :disabled="true"
  111. placeholder="结束时间"
  112. style="width: 330px"
  113. />
  114. </el-form-item>
  115. <el-form-item label="施工人数" prop="workerCount">
  116. <el-input-number
  117. v-model="formValue.workerCount"
  118. :disabled="true"
  119. size="large"
  120. :min="1"
  121. style="width: 330px"
  122. />
  123. </el-form-item>
  124. <el-form-item label="所涉工种" prop="involvedTrades" style="width: 87.2%">
  125. <el-checkbox-group v-model="tradeArray" :disabled="true">
  126. <el-checkbox
  127. v-for="t in ['水电', '泥瓦', '木工', '焊接', '气割', '登高', '密闭', '特种驾驶', '其他']"
  128. :key="t"
  129. :label="t"
  130. :value="t"
  131. />
  132. </el-checkbox-group>
  133. </el-form-item>
  134. <el-form-item v-if="tradeArray.includes('其他')" label="其他工种说明" prop="otherTrade">
  135. <el-input
  136. v-model="formValue.otherTrade"
  137. size="large"
  138. :disabled="true"
  139. placeholder="请补充工种类型"
  140. style="width: 330px"
  141. />
  142. </el-form-item>
  143. <el-form-item label="工程施工内容(方案)简要描述" prop="constructionContent" style="width: 81%">
  144. <el-input
  145. type="textarea"
  146. v-model="formValue.constructionContent"
  147. size="large"
  148. :rows="3"
  149. :disabled="true"
  150. placeholder="输入工程施工内容(方案)简要描述"
  151. />
  152. </el-form-item>
  153. <el-form-item label="其他说明" prop="otherDescription" style="width: 81%">
  154. <el-input
  155. type="textarea"
  156. v-model="formValue.otherDescription"
  157. size="large"
  158. :rows="3"
  159. :disabled="true"
  160. placeholder="补充其他说明"
  161. />
  162. </el-form-item>
  163. <div style="width: 100%; height: 1px; background: #eee; margin: 20px 0"></div>
  164. <div style="width: 100%; margin-bottom: 20px; font-weight: bold; padding-left: 10px">附件清单</div>
  165. <el-form-item
  166. v-for="item in attachmentConfigs"
  167. :key="item.prop"
  168. :label="item.label"
  169. label-width="240px"
  170. :prop="item.prop"
  171. class="label"
  172. style="width: 43.6%"
  173. >
  174. <!-- 详情页面只展示,不需要上传 -->
  175. <!-- <UploadFiles
  176. label="上传文件"
  177. :disabled="true"
  178. :fileList="attachmentLists[item.prop]"
  179. /> -->
  180. <div class="file-list" v-if="attachmentLists[item.prop]?.length">
  181. <div class="file-item" v-for="li in attachmentLists[item.prop]" :key="li.fileId">
  182. <span class="file-item--name">{{ li.fileName }}</span>
  183. <div class="file-item--footer">
  184. <el-button link type="primary" @click="previewOnline(li.fileUrl, li.fileType)">预览</el-button>
  185. <el-button link type="primary" @click.stop="downloadFile(li.fileUrl, li.fileName)">下载</el-button>
  186. <el-button type="primary" link @click="templateDownload(item)"> 模版下载 </el-button>
  187. </div>
  188. </div>
  189. </div>
  190. <div v-else>
  191. <el-button type="primary" link @click="templateDownload(item)"> 模版下载 </el-button>
  192. </div>
  193. </el-form-item>
  194. <div style="width: 100%; height: 1px; background: #eee; margin: 20px 0"></div>
  195. <el-form-item label="审批流程" style="width: 87.2%">
  196. <el-select v-model="formValue.templateId" size="large" :disabled="true" style="width: 330px">
  197. <el-option v-for="opt in approvalOptions" :key="opt.id" :label="opt.templateName" :value="opt.id" />
  198. </el-select>
  199. </el-form-item>
  200. </el-form>
  201. <PreviewOnline ref="previewOnlineRef" />
  202. </main>
  203. <footer class="safety-platform-container__footer">
  204. <el-button @click="router.back()">返回</el-button>
  205. </footer>
  206. </div>
  207. </template>
  208. <script lang="ts" setup>
  209. import { ref, reactive, onMounted, computed } from 'vue';
  210. import { useRouter, useRoute } from 'vue-router';
  211. import { ElMessage } from 'element-plus';
  212. import UploadFiles from '@/components/UploadFiles/UploadFiles.vue';
  213. import { getAllApproval } from '@/api/approval/approval';
  214. import { constructionSafetyQueryDetailConstruction } from '@/api/production-safety/responsibility-implementation';
  215. import { unformatAttachment } from '@/components/UploadFiles/utils';
  216. import PreviewOnline from '@/views/disaster/components/PreviewOnline.vue';
  217. import { downloadFile } from '@/views/disaster/utils';
  218. const router = useRouter();
  219. const route = useRoute();
  220. const tradeArray = ref<string[]>([]);
  221. const approvalOptions = ref<any[]>([]);
  222. const attachmentConfigs = [
  223. { label: '施工人员身份信息(复印件,施工单位盖章)', prop: 'personnelIdAttachment' },
  224. { label: '施工方提供施工安全交底(施工方敲章)', prop: 'safetyCommitmentAttachment' },
  225. { label: '施工方提供施工人员安全教育(施工人员签字并敲章)', prop: 'safetyEducationAttachment' },
  226. {
  227. label: '安全管理协议(双方签字两份,上飞院部门领导签甲方代表、乙方盖章并签字)',
  228. prop: 'safetyAgreementAttachment',
  229. },
  230. { label: '施工作业环境承诺(上飞院的项目具体经办人签字)', prop: 'environmentCommitmentAttachment' },
  231. { label: '安全告知单(部门具体经办人签字)', prop: 'safetyNoticeAttachment' },
  232. { label: '消防管理承诺书(部门具体经办人签字)', prop: 'fireManagementAttachment' },
  233. { label: '施工方案(含风险识别、安全措施、应急预案等)', prop: 'constructionPlanAttachment' },
  234. { label: '劳保用品清单', prop: 'ppeListAttachment' },
  235. { label: '施工机械清单', prop: 'equipmentListAttachment' },
  236. { label: '若有特种施工人员提供特种作业证(复印件,施工单位盖章)', prop: 'specialWorkerCertAttachment' },
  237. { label: '若有特种设备提供特种设备的合格证(复印件,施工单位盖章', prop: 'specialEquipmentCertAttachment' },
  238. ];
  239. const attachmentLists = reactive<any>(Object.fromEntries(attachmentConfigs.map((a) => [a.prop, []])));
  240. const showAlertBar = computed(() => {
  241. if (!formValue.rejectReason) {
  242. return false;
  243. }
  244. return formValue.status === 1 && formValue.rejectReason !== '';
  245. });
  246. const formValue = reactive<any>({
  247. projectName: '',
  248. constructionContent: '',
  249. constructionLocation: '',
  250. constructionUnit: '',
  251. projectManagerName: '',
  252. projectManagerPhone1: '',
  253. projectManagerPhone2: '',
  254. siteSafetyManagerName: '',
  255. siteSafetyPhone1: '',
  256. siteSafetyPhone2: '',
  257. workerCount: undefined,
  258. projectStartTime: '',
  259. projectEndTime: '',
  260. involvedTrades: '',
  261. otherTrade: '',
  262. otherDescription: '',
  263. templateId: '',
  264. status: '',
  265. });
  266. const previewOnlineRef = ref<InstanceType<typeof PreviewOnline>>();
  267. const previewOnline = (url: string | undefined, type) => {
  268. if (url) {
  269. previewOnlineRef.value?.open(url, type);
  270. }
  271. };
  272. const initData = async () => {
  273. const id = route.query.id as string;
  274. if (!id) return;
  275. try {
  276. // 1. 获取审批流选项(为了回显 label)
  277. const approvals = await getAllApproval();
  278. approvalOptions.value = approvals || [];
  279. // 2. 获取详情
  280. const res = await constructionSafetyQueryDetailConstruction(id);
  281. if (res) {
  282. // 基础数据回显
  283. Object.assign(formValue, res);
  284. // 工种回显
  285. if (res.involvedTrades) {
  286. tradeArray.value = res.involvedTrades.split(',');
  287. }
  288. // 附件回显还原
  289. attachmentConfigs.forEach((item) => {
  290. if (res[item.prop]) {
  291. attachmentLists[item.prop] = unformatAttachment(res[item.prop]);
  292. }
  293. });
  294. }
  295. } catch (error) {
  296. console.error('获取详情数据失败:', error);
  297. }
  298. };
  299. // 下载模版
  300. const templateDownload = (item) => {
  301. const baseUrl = './skyeye-file-upload/sfysecurity/TEMPLATE/';
  302. switch (item.prop) {
  303. case 'personnelIdAttachment':
  304. downloadFile('./skyeye-file-upload/sfysecurity/TEMPLATE/施工证申请表.doc', item.label);
  305. break;
  306. case 'safetyCommitmentAttachment':
  307. downloadFile('./skyeye-file-upload/sfysecurity/TEMPLATE/施工证申请表.doc', item.label);
  308. break;
  309. case 'safetyEducationAttachment':
  310. downloadFile('./skyeye-file-upload/sfysecurity/TEMPLATE/施工证申请表.doc', item.label);
  311. break;
  312. case 'safetyAgreementAttachment':
  313. downloadFile('./skyeye-file-upload/sfysecurity/TEMPLATE/施工证申请表.doc', item.label);
  314. break;
  315. case 'environmentCommitmentAttachment':
  316. downloadFile('./skyeye-file-upload/sfysecurity/TEMPLATE/施工证申请表.doc', item.label);
  317. break;
  318. case 'safetyNoticeAttachment':
  319. downloadFile('./skyeye-file-upload/sfysecurity/TEMPLATE/施工证申请表.doc', item.label);
  320. break;
  321. case 'fireManagementAttachment':
  322. downloadFile('./skyeye-file-upload/sfysecurity/TEMPLATE/施工证申请表.doc', item.label);
  323. break;
  324. case 'constructionPlanAttachment':
  325. downloadFile('./skyeye-file-upload/sfysecurity/TEMPLATE/施工证申请表.doc', item.label);
  326. break;
  327. case 'ppeListAttachment':
  328. downloadFile('./skyeye-file-upload/sfysecurity/TEMPLATE/施工证申请表.doc', item.label);
  329. break;
  330. case 'equipmentListAttachment':
  331. downloadFile('./skyeye-file-upload/sfysecurity/TEMPLATE/施工证申请表.doc', item.label);
  332. break;
  333. case 'specialWorkerCertAttachment':
  334. downloadFile('./skyeye-file-upload/sfysecurity/TEMPLATE/施工证申请表.doc', item.label);
  335. break;
  336. case 'specialEquipmentCertAttachment':
  337. downloadFile('./skyeye-file-upload/sfysecurity/TEMPLATE/施工证申请表.doc', item.label);
  338. break;
  339. // 无匹配时提示
  340. default:
  341. ElMessage.warning('该附件暂无模板可下载');
  342. }
  343. };
  344. onMounted(() => {
  345. initData();
  346. });
  347. </script>
  348. <style lang="scss" scoped>
  349. @use '@/styles/page-main-layout.scss' as *;
  350. @use '@/styles/page-details-layout.scss' as *;
  351. .safety-platform-container {
  352. &__main {
  353. padding: 24px;
  354. background-color: #fff;
  355. }
  356. :deep(.el-form-item) {
  357. margin-right: 20px;
  358. margin-bottom: 24px;
  359. vertical-align: top;
  360. .el-form-item__label {
  361. font-weight: bold;
  362. }
  363. }
  364. // :deep(.el-input.is-disabled .el-input__wrapper) {
  365. // background-color: #f8f9fb;
  366. // color: #606266;
  367. // }
  368. }
  369. .label {
  370. :deep(.el-form-item__label) {
  371. line-height: 26px;
  372. }
  373. }
  374. .file-list {
  375. .file-item--name {
  376. padding: 6px 14px;
  377. border: 1px solid #efefef;
  378. border-radius: 8px;
  379. }
  380. }
  381. </style>