OneByOneAuditDetail.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  1. <template>
  2. <div class="safety-platform-container">
  3. <header class="safety-platform-container__header">
  4. <div class="breadcrumb-title">{{ detailData?.problem || '-' }}</div>
  5. <div class="detail-content">
  6. <span>创建人:{{ detailData?.creatorName || '-' }}</span>
  7. <span>创建时间:{{ detailData?.createdAt || '-' }}</span>
  8. </div>
  9. </header>
  10. <main class="safety-platform-container__main">
  11. <div class="audit-content">
  12. <h4 class="section-title">
  13. <el-icon class="section-title__icon"><Document /></el-icon>
  14. <span>基本信息</span>
  15. </h4>
  16. <div class="detail-ct detail-ct--table">
  17. <div class="row">
  18. <div class="col">
  19. <div class="label">隐患问题:</div>
  20. <div class="value">{{ detailData?.problem || '-' }}</div>
  21. </div>
  22. <div class="col">
  23. <div class="label">状态:</div>
  24. <div class="value">{{ detailData?.statusName || '-' }}</div>
  25. </div>
  26. </div>
  27. <div class="row">
  28. <div class="col">
  29. <div class="label">下发数:</div>
  30. <div class="value">{{ detailData?.issueCount ?? '-' }}</div>
  31. </div>
  32. <div class="col">
  33. <div class="label">反馈数:</div>
  34. <div class="value">{{ detailData?.feedbackCount ?? '-' }}</div>
  35. </div>
  36. </div>
  37. <div class="row">
  38. <div class="col">
  39. <div class="label">计划开始日期:</div>
  40. <div class="value">{{ detailData?.planStartDate || detailData?.dangerProposeDate || '-' }}</div>
  41. </div>
  42. <div class="col">
  43. <div class="label">计划完成日期:</div>
  44. <div class="value">{{ detailData?.associationOtTimeLimit || '-' }}</div>
  45. </div>
  46. </div>
  47. </div>
  48. <h4 class="section-title">
  49. <el-icon class="section-title__icon"><Document /></el-icon>
  50. <span>举一反三要求</span>
  51. </h4>
  52. <div class="detail-ct requirement-block">
  53. <div class="value value-text">{{ detailData?.associationOneThree || '-' }}</div>
  54. </div>
  55. <h4 class="section-title">
  56. <el-icon class="section-title__icon"><Document /></el-icon>
  57. <span>材料上传</span>
  58. </h4>
  59. <div class="detail-ct detail-ct--table attachment-row">
  60. <div class="row">
  61. <div class="col">
  62. <div class="label">上传附件:</div>
  63. <div class="value value--attachment">
  64. <div class="attachment-list">
  65. <div
  66. v-for="(item, index) in attachmentList"
  67. :key="index"
  68. class="attachment-item"
  69. >
  70. <span class="attachment-item--name">{{ item.fileName || item.fileNameOrUrl }}</span>
  71. <el-button
  72. v-if="item.fileUrl || item.url"
  73. type="primary"
  74. link
  75. @click="handlePreview(item)"
  76. >
  77. 预览
  78. </el-button>
  79. </div>
  80. </div>
  81. <span v-if="!attachmentList.length" class="empty-text">-</span>
  82. </div>
  83. </div>
  84. </div>
  85. </div>
  86. </div>
  87. </main>
  88. <footer class="safety-platform-container__footer">
  89. <el-button @click="router.back()">返回</el-button>
  90. <el-button type="primary" @click="handleReject">审核不通过</el-button>
  91. <el-button type="primary" @click="handleApprove">审核通过</el-button>
  92. </footer>
  93. <el-dialog
  94. v-model="showRejectDialog"
  95. title="审核不通过原因"
  96. width="560px"
  97. :close-on-click-modal="false"
  98. destroy-on-close
  99. @close="rejectReason = ''"
  100. >
  101. <el-input
  102. v-model="rejectReason"
  103. type="textarea"
  104. :rows="6"
  105. maxlength="300"
  106. show-word-limit
  107. placeholder="请填写审核不通过原因(限300字)"
  108. />
  109. <template #footer>
  110. <el-button @click="showRejectDialog = false">取消</el-button>
  111. <el-button type="primary" @click="handleRejectSubmit">确定</el-button>
  112. </template>
  113. </el-dialog>
  114. <PreviewOnline ref="previewOnlineRef" />
  115. </div>
  116. </template>
  117. <script setup lang="ts">
  118. import { computed, onMounted, ref } from 'vue';
  119. import { useRoute, useRouter } from 'vue-router';
  120. import { ElMessage } from 'element-plus';
  121. import { Document } from '@element-plus/icons-vue';
  122. import PreviewOnline from '@/views/disaster/components/PreviewOnline.vue';
  123. import { getDrawLessonsAdminDetail, approveDrawLessons } from '@/api/drawLessons';
  124. const router = useRouter();
  125. const route = useRoute();
  126. const id = computed(() => Number(route.query.id));
  127. const detailData = ref<{
  128. problem?: string;
  129. creatorName?: string;
  130. createdAt?: string;
  131. statusName?: string;
  132. issueCount?: number;
  133. feedbackCount?: number;
  134. planStartDate?: string;
  135. dangerProposeDate?: string;
  136. associationOtTimeLimit?: string;
  137. associationOneThree?: string;
  138. attachments?: string;
  139. attachmentList?: Array<{ fileName?: string; fileUrl?: string; fileNameOrUrl?: string; url?: string }>;
  140. } | null>(null);
  141. const showRejectDialog = ref(false);
  142. const rejectReason = ref('');
  143. const submitting = ref(false);
  144. const previewOnlineRef = ref<InstanceType<typeof PreviewOnline>>();
  145. const attachmentList = computed(() => {
  146. const d = detailData.value;
  147. if (!d) return [];
  148. if (Array.isArray(d.attachmentList) && d.attachmentList.length) return d.attachmentList;
  149. if (!d.attachments) return [];
  150. try {
  151. const parsed = JSON.parse(d.attachments);
  152. return Array.isArray(parsed) ? parsed : [];
  153. } catch {
  154. return d.attachments.split(',').filter(Boolean).map((s) => ({ fileNameOrUrl: s.trim(), fileUrl: s.trim() }));
  155. }
  156. });
  157. const getDetail = async () => {
  158. if (!id.value) return;
  159. try {
  160. const res = await getDrawLessonsAdminDetail(id.value);
  161. const data = (res as any)?.data ?? res;
  162. if (data && typeof data === 'object') {
  163. const records = Array.isArray(data.issueRecords) ? data.issueRecords : [];
  164. detailData.value = {
  165. problem: data.problem,
  166. creatorName: data.creatorName,
  167. createdAt: data.createdAt,
  168. statusName: data.statusName,
  169. issueCount: records.length ?? data.issueCount,
  170. feedbackCount: data.feedbackCount ?? records.filter((r: any) => r.statusId === 5 || r.statusName === '已完成' || r.feedbackAt).length,
  171. planStartDate: data.planStartDate,
  172. dangerProposeDate: data.dangerProposeDate,
  173. associationOtTimeLimit: data.associationOtTimeLimit,
  174. associationOneThree: data.associationOneThree,
  175. attachments: data.attachments,
  176. attachmentList: data.attachmentList,
  177. };
  178. }
  179. } catch (e) {
  180. console.error('获取举一反三详情失败:', e);
  181. ElMessage.error('获取详情失败');
  182. }
  183. };
  184. const handlePreview = (item: { fileUrl?: string; url?: string }) => {
  185. const url = item.fileUrl || item.url;
  186. if (url) previewOnlineRef.value?.open(url, 'pdf');
  187. };
  188. const handleReject = () => {
  189. showRejectDialog.value = true;
  190. };
  191. const handleRejectSubmit = async () => {
  192. if (!rejectReason.value?.trim()) {
  193. ElMessage.warning('请填写审核不通过原因');
  194. return;
  195. }
  196. if (!id.value) return;
  197. submitting.value = true;
  198. try {
  199. await approveDrawLessons({
  200. id: id.value,
  201. statusId: 6,
  202. statusName: '已作废',
  203. });
  204. ElMessage.success('审核不通过操作成功');
  205. showRejectDialog.value = false;
  206. rejectReason.value = '';
  207. router.back();
  208. } catch (e) {
  209. console.error('审核不通过失败:', e);
  210. ElMessage.error('操作失败,请重试');
  211. } finally {
  212. submitting.value = false;
  213. }
  214. };
  215. const handleApprove = async () => {
  216. if (!id.value) return;
  217. submitting.value = true;
  218. try {
  219. await approveDrawLessons({
  220. id: id.value,
  221. statusId: 5,
  222. statusName: '已完成',
  223. });
  224. ElMessage.success('审核通过操作成功');
  225. router.back();
  226. } catch (e) {
  227. console.error('审核通过失败:', e);
  228. ElMessage.error('操作失败,请重试');
  229. } finally {
  230. submitting.value = false;
  231. }
  232. };
  233. onMounted(() => {
  234. getDetail();
  235. });
  236. </script>
  237. <style scoped lang="scss">
  238. @use '@/styles/page-details-layout.scss' as *;
  239. @use '@/styles/page-main-layout.scss' as *;
  240. .detail-content {
  241. display: flex;
  242. gap: 30px;
  243. margin: 10px 0;
  244. font-size: 14px;
  245. }
  246. .audit-content {
  247. padding: 0 16px;
  248. .section-title {
  249. display: flex;
  250. align-items: center;
  251. gap: 8px;
  252. margin: 20px 0 12px 0;
  253. font-size: 16px;
  254. font-weight: 600;
  255. color: #333;
  256. .section-title__icon {
  257. font-size: 18px;
  258. color: #333;
  259. }
  260. }
  261. .section-title:first-child {
  262. margin-top: 0;
  263. }
  264. .detail-ct {
  265. font-size: 14px;
  266. margin-bottom: 20px;
  267. &--table {
  268. border: 1px solid #dcdfe6;
  269. .row {
  270. display: flex;
  271. border-bottom: 1px solid #dcdfe6;
  272. &:last-child {
  273. border-bottom: none;
  274. }
  275. }
  276. .col {
  277. display: flex;
  278. flex: 1;
  279. min-height: 40px;
  280. align-items: stretch;
  281. &.col--wide {
  282. flex: 2;
  283. }
  284. .label {
  285. display: flex;
  286. align-items: center;
  287. justify-content: flex-end;
  288. flex-shrink: 0;
  289. width: 140px;
  290. padding: 0 12px;
  291. background-color: #f5f5f5;
  292. border-right: 1px solid #dcdfe6;
  293. color: #333;
  294. }
  295. .value {
  296. flex: 1;
  297. display: flex;
  298. align-items: center;
  299. padding: 10px 20px;
  300. background-color: #fff;
  301. border-right: 1px solid #dcdfe6;
  302. color: #333;
  303. }
  304. }
  305. .row .col:last-child .value {
  306. border-right: none;
  307. }
  308. .row .col:nth-child(2) .label {
  309. border-left: 1px solid #dcdfe6;
  310. }
  311. }
  312. &.requirement-block {
  313. border: 1px solid #e0e0e0;
  314. background-color: #fff;
  315. padding: 16px 20px;
  316. min-height: 60px;
  317. .value-text {
  318. white-space: pre-wrap;
  319. word-break: break-word;
  320. color: #333;
  321. line-height: 1.5;
  322. }
  323. }
  324. &.attachment-row .value--attachment {
  325. flex-wrap: wrap;
  326. align-items: flex-start;
  327. .attachment-list {
  328. display: grid;
  329. grid-template-columns: 1fr 1fr;
  330. gap: 12px 24px;
  331. width: 100%;
  332. }
  333. .attachment-item {
  334. display: flex;
  335. align-items: center;
  336. gap: 8px;
  337. font-size: 14px;
  338. .attachment-item--name {
  339. color: #333;
  340. flex: 1;
  341. min-width: 0;
  342. overflow: hidden;
  343. text-overflow: ellipsis;
  344. }
  345. .el-button--primary.is-link {
  346. flex-shrink: 0;
  347. }
  348. }
  349. .empty-text {
  350. color: #999;
  351. }
  352. }
  353. }
  354. }
  355. </style>