detail.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747
  1. <template>
  2. <div class="container">
  3. <div v-if="!hideMap" id="aMap" class="event_map" />
  4. <div class="box">
  5. <div class="event_title">
  6. {{ eventInfo.event_title || "暂无事件标题" }}
  7. </div>
  8. <div class="event_prop">
  9. <div class="event_type">
  10. <dict-tag :options="mm_event_type" :value="eventInfo.event_type" />
  11. </div>
  12. <div class="event_level">
  13. <dict-tag
  14. :options="mm_event_level"
  15. :value="eventInfo.event_level || '0'"
  16. />
  17. </div>
  18. <div class="event_status">
  19. <dict-tag :options="mm_event_state" :value="eventInfo.event_status" />
  20. </div>
  21. </div>
  22. <van-tabs v-model:active="active">
  23. <van-tab title="基础信息">
  24. <div class="event_tab">
  25. <div class="event-data-item">
  26. <div class="item-left">
  27. <i class="icon6" />
  28. <div class="event-data-item-title">事件编号:</div>
  29. </div>
  30. <div class="event-data-item-value">{{ eventInfo.event_id }}</div>
  31. </div>
  32. <div class="event-data-item">
  33. <div class="item-left">
  34. <i class="icon1" />
  35. <div class="event-data-item-title">事件类型:</div>
  36. </div>
  37. <div class="event-data-item-value">
  38. <dict-tag
  39. :options="mm_event_type"
  40. :value="eventInfo.event_type"
  41. />
  42. </div>
  43. </div>
  44. <div class="event-data-item">
  45. <div class="item-left">
  46. <i class="icon2" />
  47. <div class="event-data-item-title">事件等级:</div>
  48. </div>
  49. <div class="event-data-item-value">
  50. <dict-tag
  51. :options="mm_event_level"
  52. :value="eventInfo.event_level || '0'"
  53. />
  54. </div>
  55. </div>
  56. <div class="event-data-item">
  57. <div class="item-left">
  58. <i class="icon3" />
  59. <div class="event-data-item-title">事件状态:</div>
  60. </div>
  61. <div class="event-data-item-value">
  62. <dict-tag
  63. :options="mm_event_state"
  64. :value="eventInfo.event_status"
  65. />
  66. </div>
  67. </div>
  68. <div class="event-data-item">
  69. <div class="item-left">
  70. <i class="icon5" />
  71. <div class="event-data-item-title">事发地点:</div>
  72. </div>
  73. <div class="event-data-item-value">{{ eventInfo.address }}</div>
  74. </div>
  75. <div class="event-data-item">
  76. <div class="item-left">
  77. <i class="icon4" />
  78. <div class="event-data-item-title">事发时间:</div>
  79. </div>
  80. <div class="event-data-item-value">
  81. {{ eventInfo.event_time }}
  82. </div>
  83. </div>
  84. <div class="event-data-item">
  85. <div class="item-left">
  86. <i class="icon4" />
  87. <div class="event-data-item-title">上报时间:</div>
  88. </div>
  89. <div class="event-data-item-value">
  90. {{ eventInfo.report_time }}
  91. </div>
  92. </div>
  93. <div class="event-data-item">
  94. <div class="item-left">
  95. <i class="icon7" />
  96. <div class="event-data-item-title">伤亡情况:</div>
  97. </div>
  98. <div
  99. class="event-data-item-value blue"
  100. @click="handleUploadCasualties"
  101. >
  102. 去上报
  103. </div>
  104. </div>
  105. <div class="event-data-item">
  106. <div class="item-left">
  107. <i class="icon8" />
  108. <div class="event-data-item-title">登记人:</div>
  109. </div>
  110. <div class="event-data-item-value">
  111. {{ eventInfo.reported_by }}
  112. </div>
  113. </div>
  114. <div class="event-data-item">
  115. <div class="item-left">
  116. <i class="icon4" />
  117. <div class="event-data-item-title">登记时间:</div>
  118. </div>
  119. <div class="event-data-item-value">
  120. {{ eventInfo.reported_time }}
  121. </div>
  122. </div>
  123. <div class="event-data-item">
  124. <div class="item-left">
  125. <i class="icon9" />
  126. <div class="event-data-item-title">联系方式:</div>
  127. </div>
  128. <div class="event-data-item-value">{{ eventInfo.contact }}</div>
  129. </div>
  130. <div class="event-data-item">
  131. <div class="item-left">
  132. <i class="icon10" />
  133. <div class="event-data-item-title">事件来源:</div>
  134. </div>
  135. <div class="event-data-item-value">
  136. {{ eventInfo.event_source }}
  137. </div>
  138. </div>
  139. </div>
  140. </van-tab>
  141. <van-tab title="事件概要">
  142. <div class="event_tab">{{ eventInfo.event_description }}</div>
  143. </van-tab>
  144. <van-tab title="事件跟踪">
  145. <div class="event_tab">
  146. <van-steps direction="vertical" :active="0">
  147. <van-step
  148. v-for="(item, index) in eventTrackState.items"
  149. :key="item.id"
  150. >
  151. <h3>{{ item.title }}</h3>
  152. <p>{{ item.description }}</p>
  153. </van-step>
  154. </van-steps>
  155. </div>
  156. </van-tab>
  157. <van-tab title="匹配预案">
  158. <div class="event_tab2">
  159. <template
  160. v-if="
  161. !!eventInfo.plan_id &&
  162. !!eventInfo.plan_files &&
  163. eventInfo.plan_files.length > 0
  164. "
  165. >
  166. <div class="plan-content">
  167. <div class="content-header">
  168. <div class="plan-content-title">
  169. {{ eventInfo.plan_files[0]?.name }}
  170. </div>
  171. <i
  172. class="download-icon"
  173. @click="handleDownload(eventInfo.plan_files[0])"
  174. />
  175. </div>
  176. <div class="content-text">
  177. <div v-for="(item, index) in planFiles" :key="index">
  178. <div>{{ item.title }}</div>
  179. <div v-for="(item2, index2) in item.items" :key="index2">
  180. <div>{{ item2.title }}</div>
  181. <div v-html="item2.value" />
  182. </div>
  183. </div>
  184. </div>
  185. </div>
  186. </template>
  187. <template v-else>
  188. <div class="emptyIcon" />
  189. <div class="emptyText">未关联到对应预案</div>
  190. <van-button
  191. type="primary"
  192. size="small"
  193. @click="associationShow = true"
  194. >手工关联</van-button
  195. >
  196. </template>
  197. </div>
  198. </van-tab>
  199. <van-tab title="总结报告">
  200. <div class="event_tab2">
  201. <div
  202. v-if="eventInfo.summary_file && eventInfo.summary_file.length > 0"
  203. class="file-list"
  204. >
  205. <div
  206. v-for="(item, index) in eventInfo.summary_file"
  207. :key="index"
  208. class="item"
  209. @click="handleDownload2(item)"
  210. >
  211. {{ item.file_name }}
  212. </div>
  213. </div>
  214. <template v-else>
  215. <div class="emptyIcon2" />
  216. <div class="emptyText">暂未上传总结报告</div>
  217. <van-button
  218. type="primary"
  219. size="small"
  220. @click="handleUploadCasualties"
  221. >去上传</van-button
  222. >
  223. </template>
  224. </div>
  225. </van-tab>
  226. </van-tabs>
  227. </div>
  228. <div class="footer">
  229. <div
  230. style="
  231. display: flex;
  232. flex-direction: row;
  233. justify-content: space-between;
  234. "
  235. >
  236. <van-button
  237. v-if="eventInfo.event_status == '0'"
  238. type="primary"
  239. @click="handleStartEvent"
  240. >开始指挥</van-button
  241. >
  242. <van-button
  243. v-if="eventInfo.event_status == '1'"
  244. type="primary"
  245. @click="handleEnterEvent"
  246. >进入指挥</van-button
  247. >
  248. <van-button
  249. v-if="eventInfo.event_status == '0' || eventInfo.event_status == '2'"
  250. type="danger"
  251. @click="handleCloseEvent"
  252. >关闭事件
  253. </van-button>
  254. </div>
  255. </div>
  256. <AssociationPlan
  257. v-model="associationShow"
  258. :eventId="eventId"
  259. @confirm="associationPlanConfirm"
  260. />
  261. <UploadEventCasualtiesDialog
  262. v-model="uploadCasualtiesState.show"
  263. :data="uploadCasualtiesState.form"
  264. @update:model-value="onUploadCasualtiesDialogClose"
  265. @confirm="onUploadCasualtiesDialogClose"
  266. />
  267. <StartEventDialog
  268. v-model="startEventState.show"
  269. :data="startEventState.form"
  270. @update:model-value="onStartEventDialogClose"
  271. />
  272. </div>
  273. </template>
  274. <script lang="ts" setup>
  275. import { getCurrentInstance, reactive, ref, toRefs, onMounted } from "vue";
  276. import { useRouter, useRoute } from "vue-router";
  277. import { getEventDetail, closeEvent } from "@/api/event";
  278. import UploadEventCasualtiesDialog from "./UploadEventCasualtiesDialog.vue";
  279. import { showDialog, showConfirmDialog } from "vant";
  280. import { useAMap } from "@/hooks/AMap/useAMap";
  281. import StartEventDialog from "@/views/event/StartEventDialog.vue";
  282. import { download2 } from "@/utils/request";
  283. import { getPlanDoc, listPlan } from "@/api/duty/eventing";
  284. import AssociationPlan from "@/views/event/AssociationPlan.vue";
  285. const router = useRouter();
  286. const route = useRoute();
  287. const proxy = getCurrentInstance()?.proxy;
  288. const { mm_event_type, mm_event_level, mm_event_state } = toRefs<any>(
  289. proxy?.useDict("mm_event_type", "mm_event_level", "mm_event_state")
  290. );
  291. const active = ref(0);
  292. const eventId = ref("");
  293. const data = reactive({
  294. eventInfo: {
  295. event_id: "",
  296. event_title: "",
  297. event_code: "",
  298. event_type: "",
  299. event_level: "",
  300. event_status: "",
  301. address: "",
  302. event_time: "",
  303. report_time: "",
  304. contact: "",
  305. event_source: "",
  306. event_description: "",
  307. reported_by: "",
  308. reported_time: "",
  309. longitude: "",
  310. latitude: "",
  311. plan_id: "",
  312. plan_name: "",
  313. summary_file: [],
  314. plan_files: [],
  315. // 伤亡情况
  316. deaths: "",
  317. injuries: "",
  318. missing: ""
  319. },
  320. eventTrackState: {
  321. active: 0,
  322. items: [
  323. {
  324. id: 0,
  325. title: "事件登记",
  326. description: ""
  327. }
  328. ]
  329. }
  330. });
  331. const { eventInfo, eventTrackState } = toRefs(data);
  332. const startEventState = reactive({
  333. show: false,
  334. form: {
  335. event_id: "",
  336. event_title: "",
  337. event_level: "",
  338. event_level_text: ""
  339. }
  340. });
  341. const handleStartEvent = () => {
  342. startEventState.form.event_id = eventInfo.value.event_id;
  343. startEventState.form.event_title = eventInfo.value.event_title;
  344. startEventState.form.event_level = eventInfo.value.event_level;
  345. startEventState.show = true;
  346. return false;
  347. };
  348. const handleEnterEvent = () => {
  349. router.push({
  350. path: "/leader/mobile_control",
  351. query: {
  352. event_id: eventId.value
  353. }
  354. });
  355. };
  356. // 关闭事件
  357. const handleCloseEvent = () => {
  358. if (eventInfo.value.plan_id === "") {
  359. showDialog({ message: "关闭事件前请先匹配预案" });
  360. return false;
  361. }
  362. if (eventInfo.value.summary_file.length === 0) {
  363. showDialog({ message: "关闭事件前请先上传总结报告" });
  364. return false;
  365. }
  366. showConfirmDialog({
  367. title: "提示",
  368. message: "关闭事件所有事项相关数据将不能再修改,是否继续?"
  369. }).then(() => {
  370. closeEvent({ eventId: eventId.value }).then(res => {
  371. refreshData();
  372. });
  373. });
  374. };
  375. let associationShow = ref(false);
  376. // 上报伤亡情况
  377. const uploadCasualtiesState = reactive({
  378. show: false,
  379. form: {
  380. event_id: "",
  381. deaths: "",
  382. injuries: "",
  383. missing: ""
  384. }
  385. });
  386. const handleUploadCasualties = () => {
  387. console.log("handleUploadCasualties");
  388. uploadCasualtiesState.form.event_id = eventId.value;
  389. uploadCasualtiesState.form.deaths = eventInfo.value.deaths;
  390. uploadCasualtiesState.form.injuries = eventInfo.value.injuries;
  391. uploadCasualtiesState.form.missing = eventInfo.value.missing;
  392. uploadCasualtiesState.show = true;
  393. };
  394. const onUploadCasualtiesDialogClose = t => {
  395. console.log("onUploadCasualtiesDialogClose", t);
  396. uploadCasualtiesState.show = false;
  397. if (t) {
  398. refreshData();
  399. }
  400. };
  401. const onStartEventDialogClose = t => {
  402. startEventState.show = false;
  403. console.log(startEventState.form);
  404. if (t) {
  405. getEventDetail({ event_id: eventId.value }).then(res => {
  406. eventInfo.value = res.data;
  407. eventTrackState.value = res.data.event_status_tracks;
  408. });
  409. }
  410. };
  411. let planFiles = ref([]);
  412. const getPlan = () => {
  413. getPlanDoc({ plan_id: eventInfo.value.plan_id }).then(res => {
  414. planFiles.value = res.data;
  415. });
  416. };
  417. const associationPlanConfirm = plan_id => {
  418. associationShow.value = false;
  419. eventInfo.value.plan_id = plan_id;
  420. getPlan();
  421. };
  422. const baseUrl = import.meta.env.VITE_BASE_API;
  423. // 下载方法
  424. const handleDownload = (file: any) => {
  425. download2(baseUrl + "/file/download/" + file.url, file.name);
  426. };
  427. const handleDownload2 = (file: any) => {
  428. download2(baseUrl + "/file/download/" + file.url, file.file_name);
  429. };
  430. onMounted(() => {
  431. refreshData();
  432. });
  433. let hideMap = ref(false);
  434. let map;
  435. const refreshData = () => {
  436. eventId.value = route.query.event_id as string;
  437. getEventDetail({ event_id: eventId.value }).then(res => {
  438. eventInfo.value = res.data;
  439. eventTrackState.value = res.data.event_status_tracks;
  440. if (!!eventInfo.value.plan_id) {
  441. getPlan(eventInfo.value.plan_id);
  442. }
  443. if (!eventInfo.value.longitude || !eventInfo.value.latitude) {
  444. hideMap.value.vlaue = true;
  445. } else {
  446. // 初始化地图
  447. const lnglat = [eventInfo.value.longitude, eventInfo.value.latitude];
  448. const { getMap } = useAMap({
  449. key: "30d3d8448efd68cb0b284549fd41adcf",
  450. version: "2.0",
  451. zoom: 16,
  452. center: lnglat,
  453. dragEnable: true,
  454. scrollWheel: true,
  455. // 加载完成事件
  456. onLoadCompleted: AMap => {
  457. map = getMap();
  458. let marker = new AMap.Marker({
  459. position: lnglat,
  460. icon: new AMap.Icon({
  461. size: new AMap.Size(22, 28), //图标所处区域大小
  462. imageSize: new AMap.Size(22, 28), //图标大小
  463. image:
  464. "//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png"
  465. }),
  466. anchor: "bottom-center",
  467. offset: new AMap.Pixel(0, 0)
  468. });
  469. marker.setMap(map);
  470. }
  471. });
  472. }
  473. });
  474. };
  475. </script>
  476. <style lang="scss" scoped>
  477. .event_map {
  478. width: 100%;
  479. height: 170px;
  480. }
  481. .box {
  482. margin: 0 16px 16px;
  483. background-color: #ffffff;
  484. border-radius: 4px;
  485. box-shadow: 0 0 4px 0 #4554661a;
  486. }
  487. .event_title {
  488. font-weight: 600;
  489. min-height: 46px;
  490. background-image: linear-gradient(180deg, #f3f7fd 0%, #ffffff 100%);
  491. padding: 12px;
  492. }
  493. .event_prop {
  494. padding: 0 12px;
  495. line-height: 4.8vmin;
  496. display: flex;
  497. flex-direction: row;
  498. justify-content: start;
  499. color: #999;
  500. font-size: 12px;
  501. .event_type {
  502. padding: 3px 10px;
  503. border: 0.8px solid #2c81ff;
  504. border-radius: 2px;
  505. color: #2c81ff;
  506. margin-right: 7px;
  507. }
  508. .event_level {
  509. padding: 3px 10px;
  510. border: 0.8px solid #2c81ff;
  511. border-radius: 2px;
  512. margin-right: 7px;
  513. color: #2c81ff;
  514. }
  515. .event_status {
  516. padding: 3px 10px;
  517. border: 0.8px solid #2c81ff;
  518. border-radius: 2px;
  519. color: #2c81ff;
  520. }
  521. }
  522. .event_tab {
  523. padding: 16px;
  524. color: #a6000000;
  525. .event-data-item {
  526. font-size: 14px;
  527. line-height: 8vmin;
  528. display: flex;
  529. flex-direction: row;
  530. align-items: flex-start;
  531. justify-content: space-between;
  532. .item-left {
  533. display: flex;
  534. align-items: center;
  535. justify-content: center;
  536. flex-shrink: 0;
  537. .icon1 {
  538. width: 17px;
  539. height: 16px;
  540. background: url("@/assets/images/event/icon1.png") no-repeat;
  541. background-size: 100% 100%;
  542. margin-right: 7px;
  543. }
  544. .icon2 {
  545. width: 17px;
  546. height: 16px;
  547. background: url("@/assets/images/event/icon2.png") no-repeat;
  548. background-size: 100% 100%;
  549. margin-right: 7px;
  550. }
  551. .icon3 {
  552. width: 17px;
  553. height: 16px;
  554. background: url("@/assets/images/event/icon3.png") no-repeat;
  555. background-size: 100% 100%;
  556. margin-right: 7px;
  557. }
  558. .icon4 {
  559. width: 17px;
  560. height: 16px;
  561. background: url("@/assets/images/event/icon4.png") no-repeat;
  562. background-size: 100% 100%;
  563. margin-right: 7px;
  564. }
  565. .icon5 {
  566. width: 16px;
  567. height: 16px;
  568. background: url("@/assets/images/event/icon5.png") no-repeat;
  569. background-size: 100% 100%;
  570. margin-right: 7px;
  571. }
  572. .icon6 {
  573. width: 16px;
  574. height: 16px;
  575. background: url("@/assets/images/event/icon6.png") no-repeat;
  576. background-size: 100% 100%;
  577. margin-right: 7px;
  578. }
  579. .icon7 {
  580. width: 16px;
  581. height: 16px;
  582. background: url("@/assets/images/event/icon7.png") no-repeat;
  583. background-size: 100% 100%;
  584. margin-right: 7px;
  585. }
  586. .icon8 {
  587. width: 16px;
  588. height: 16px;
  589. background: url("@/assets/images/event/icon8.png") no-repeat;
  590. background-size: 100% 100%;
  591. margin-right: 7px;
  592. }
  593. .icon9 {
  594. width: 16px;
  595. height: 16px;
  596. background: url("@/assets/images/event/icon9.png") no-repeat;
  597. background-size: 100% 100%;
  598. margin-right: 7px;
  599. }
  600. .icon10 {
  601. width: 16px;
  602. height: 16px;
  603. background: url("@/assets/images/event/icon10.png") no-repeat;
  604. background-size: 100% 100%;
  605. margin-right: 7px;
  606. }
  607. }
  608. .event-data-item-title {
  609. color: #888;
  610. min-width: 5em;
  611. }
  612. .event-data-item-value {
  613. color: #888;
  614. }
  615. .blue {
  616. color: #1989fa;
  617. }
  618. }
  619. h3 {
  620. font-size: 4.2vmin;
  621. line-height: 8vmin;
  622. }
  623. }
  624. .event_tab2 {
  625. padding: 16px;
  626. display: flex;
  627. flex-direction: column;
  628. justify-content: center;
  629. align-items: center;
  630. color: rgba(0, 0, 0, 0.65);
  631. }
  632. .footer {
  633. padding: 0 16px 16px;
  634. display: flex;
  635. align-items: center;
  636. justify-content: center;
  637. .van-button {
  638. border-radius: 2px;
  639. width: 94px;
  640. height: 40px;
  641. font-size: 14px;
  642. &:first-child {
  643. margin-right: 24px;
  644. }
  645. }
  646. }
  647. .emptyIcon {
  648. width: 110px;
  649. height: 108px;
  650. background: url("@/assets/images/unrelatedPlan.png") no-repeat;
  651. background-size: 100% 100%;
  652. }
  653. .emptyIcon2 {
  654. width: 111px;
  655. height: 110px;
  656. background: url("@/assets/images/noReport.png") no-repeat;
  657. background-size: 100% 100%;
  658. }
  659. .emptyText {
  660. font-size: 14px;
  661. margin: 6px;
  662. color: rgba(0, 0, 0, 0.65);
  663. }
  664. .plan-content {
  665. .content-header {
  666. display: flex;
  667. justify-content: center;
  668. align-items: center;
  669. font-size: 14px;
  670. color: #2c81ff;
  671. font-weight: bold;
  672. padding: 5px 0;
  673. .plan-content-title {
  674. text-align: center;
  675. }
  676. .download-icon {
  677. flex-shrink: 0;
  678. display: inline-block;
  679. width: 15px;
  680. height: 14px;
  681. background: url("@/assets/images/download.png") no-repeat;
  682. background-size: 100% 100%;
  683. margin-left: 20px;
  684. }
  685. }
  686. .content-text {
  687. font-size: 14px;
  688. color: rgba(0, 0, 0, 0.65);
  689. max-height: 500px;
  690. overflow-y: auto;
  691. }
  692. }
  693. :deep(.van-tabs__wrap) {
  694. border-bottom: 1px solid #f6f6f6;
  695. }
  696. .file-list {
  697. width: 100%;
  698. .item {
  699. width: 100%;
  700. padding: 5px 0;
  701. color: #2c81ff;
  702. }
  703. }
  704. </style>