index.tsx 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. import Card from '@/components/Card';
  2. import { computed, defineComponent } from 'vue-demi';
  3. // @ts-ignore
  4. import IconLevel from '@/assets/icons/detail/level@2x.png';
  5. // @ts-ignore
  6. import IconSource from '@/assets/icons/detail/source@2x.png';
  7. // @ts-ignore
  8. import IconStyle from '@/assets/icons/detail/style@2x.png';
  9. // @ts-ignore
  10. import IconLevel2 from '@/assets/icons/detail/level2@2x.png';
  11. // @ts-ignore
  12. import IconSource2 from '@/assets/icons/detail/source2@2x.png';
  13. // @ts-ignore
  14. import IconStyle2 from '@/assets/icons/detail/style2@2x.png';
  15. // @ts-ignore
  16. import IconTitle from '@/assets/icons/detail/title@2x.png';
  17. // @ts-ignore
  18. import IconList from '@/assets/icons/detail/list@2x.png';
  19. // @ts-ignore
  20. import IconInformation from '@/assets/icons/detail/information@2x.png';
  21. import { useCommonStore, useIncidentStore,useMainStore } from '@/store';
  22. const listss = [
  23. { label: '事件标题', icon: IconTitle, prop: 'name' as const },
  24. { label: '事件类型', icon: IconStyle, prop: 'type' as const },
  25. { label: '事件来源', icon: IconSource, prop: 'source' as const },
  26. { label: '事件等级', icon: IconLevel, prop: 'level' as const },
  27. ];
  28. export default defineComponent({
  29. name: 'IncidentInfoCard',
  30. setup(props) {
  31. const store = useIncidentStore();
  32. const commonStore = useCommonStore();
  33. const mainStore = useMainStore();
  34. const list = computed(() => [
  35. // {
  36. // label: '事件标题',
  37. // icon: IconTitle,
  38. // prop: 'name' as const,
  39. // value: store.incidentDetail?.baseInfo?.name,
  40. // },
  41. {
  42. label: '事件类型',
  43. icon: IconStyle2,
  44. prop: 'type' as const,
  45. dict: 'zhdd_incident_type' as const,
  46. class: 'normal',
  47. value:
  48. (commonStore.globalDict['zhdd_incident_type']?.find(
  49. (i) =>
  50. i.dictValue?.toString() ===
  51. (store.incidentDetail?.baseInfo?.type ?? '').toString(),
  52. )?.dictLabel ?? '-') +
  53. ' ' +
  54. (commonStore.globalDict['zhdd_incident_level']?.find(
  55. (i) =>
  56. i.dictValue?.toString() ===
  57. (store.incidentDetail?.baseInfo?.level ?? '').toString(),
  58. )?.dictLabel ?? '-') +
  59. ' 级',
  60. },
  61. {
  62. label: '事件来源',
  63. icon: IconInformation,
  64. prop: 'source' as const,
  65. dict: 'zhdd_incident_source' as const,
  66. class: 'logtext',
  67. value: (
  68. <div style="overflow-y: auto;" class="source">
  69. <div>
  70. 上报时间:
  71. {store.incidentDetail?.baseInfo?.createTime ?? ''}
  72. </div>
  73. <div>事件地点:{store.incidentDetail?.baseInfo?.addr ?? ''}</div>
  74. <div>
  75. 上报人员:{store.incidentDetail?.baseInfo?.createBy ?? ''}
  76. </div>
  77. <div>联系方式:{store.incidentDetail?.baseInfo?.expr1 ?? '-'}</div>
  78. <div>
  79. 上报单位:
  80. <span>
  81. {commonStore.globalDict['zhdd_org_upload']?.find(
  82. (i) =>
  83. i.dictValue?.toString() ===
  84. (
  85. store.incidentDetail?.baseInfo?.createDept ?? ''
  86. ).toString(),
  87. )?.dictLabel ?? '-'}
  88. </span>
  89. </div>
  90. <div>
  91. 事件描述:
  92. <span style="word-break:normal;white-space:pre-wrap;overflow:hidden;">
  93. {store.incidentDetail?.baseInfo?.des ?? ''}
  94. </span>
  95. </div>
  96. </div>
  97. ),
  98. },
  99. // {
  100. // label: '事件等级',
  101. // icon: IconLevel2,
  102. // prop: 'level' as const,
  103. // dict: 'zhdd_incident_level' as const,
  104. // },
  105. ]);
  106. const showeventlist = () => {
  107. mainStore.setEventListshow(true);
  108. }
  109. // setTimeout(() => {
  110. // console.log(store.incidentDetail?.baseInfo);
  111. // }, 2000);
  112. // debugger
  113. return () => (
  114. <Card cardType="incident-info">
  115. <div class="event-list" onClick={showeventlist}>
  116. <img src={IconList} />
  117. </div>
  118. <div class="info-title">{store.incidentDetail?.baseInfo?.name}</div>
  119. <div class="info-container">
  120. {list.value.map((item, idx) => (
  121. <div class={`info-item ${item.class}`}>
  122. <div class="info-item-lebel" data-idx={idx}>
  123. <img src={item.icon} alt={item.label} />
  124. {/* <span>{item.label}</span> */}
  125. </div>
  126. <div class="info-item-value" >
  127. {(item.value
  128. ? item.value
  129. : item.dict &&
  130. commonStore.globalDict[item.dict]?.find(
  131. (i) =>
  132. i.dictValue?.toString() ===
  133. ((store.incidentDetail?.baseInfo ?? {})[item.prop] ?? "").toString(),
  134. )?.dictLabel) ?? '-'}
  135. </div>
  136. </div>
  137. ))}
  138. </div>
  139. </Card>
  140. );
  141. },
  142. });