dialog.ts 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. import { IncidentItem } from '@/api/incident';
  2. import {
  3. ResourceItemDetail,
  4. SingleDeviceItem,
  5. getResourceItem,
  6. ResourceItemDetailResponse,
  7. } from '@/api/resource';
  8. import { useCommonStore } from '@/store';
  9. import { MarkerType } from "@/store/useMarkerStore";
  10. export const GET_INCIDENT_DIALOG_HTML = (
  11. item: MarkerType,
  12. callback = () => {},
  13. ) => {
  14. const commonStore = useCommonStore();
  15. const el = document.createElement('div');
  16. el.innerHTML = `
  17. <div>
  18. <div class="title">事件信息</div>
  19. <div class="content">
  20. <div><span>标题:</span><span>${item?.name ?? '-'}</span></div>
  21. <div><span>来源:</span><span>${
  22. commonStore.globalDict['zhdd_incident_type']?.find(
  23. (i) => i.dictValue.toString() === `${item?.source}`,
  24. )?.dictLabel ?? '-'
  25. }</span></div>
  26. <div><span>类型:</span><span>${
  27. commonStore.globalDict['zhdd_incident_type']?.find(
  28. (i) => i.dictValue.toString() === `${item?.type}`,
  29. )?.dictLabel ?? '-'
  30. }</span></div>
  31. <div><span>时间:</span><span>${item?.createTime ?? '-'}</span></div>
  32. <div><span>地点:</span><span>${item?.addr ?? '-'}</span></div>
  33. <div><span>描述:</span><span>${item?.des ?? '-'}</span></div>
  34. </div>
  35. <i class="card-border-bottom-left"></i>
  36. <i class="card-border-bottom-right"></i>
  37. </div>
  38. `;
  39. const action = document.createElement('div');
  40. action.className = 'action';
  41. const button = document.createElement('button');
  42. button.className = 'el-button el-button--primary el-button--small';
  43. button.innerHTML = '查看';
  44. action.appendChild(button);
  45. button.addEventListener('click', callback);
  46. el.appendChild(action);
  47. return el;
  48. };
  49. // • 视频打开后显示数据:
  50. // a.视频点位编号
  51. // b.视频点位地点
  52. // c.按钮可以打开一个窗口,然后窗口中显示摄像头拍摄内容 (目前还无该项目数据,暂定为该内容)
  53. export const GET_VIDEO_DIALOG_HTML = (
  54. {
  55. name,
  56. addr,
  57. status
  58. }: MarkerType,
  59. callback = (type=1) => {},
  60. ) => {
  61. const el = document.createElement('div');
  62. if(status!=1 || status!="1" ) return el;
  63. el.innerHTML = `
  64. <div>
  65. <div class="title">视频监控信息</div>
  66. <div class="content">
  67. <div><span>编号:</span><span>${name ?? '-'}</span></div>
  68. <div><span>地点:</span><span>${addr ?? '-'}</span></div>
  69. </div>
  70. <i class="card-border-bottom-left"></i>
  71. <i class="card-border-bottom-right"></i>
  72. </div>`;
  73. const action = document.createElement('div');
  74. action.className = 'action';
  75. const button = document.createElement('button');
  76. button.className = 'el-button el-button--primary el-button--small';
  77. button.innerHTML = '查看';
  78. action.appendChild(button);
  79. button.addEventListener('click', ()=>{
  80. callback(1)
  81. });
  82. const button2 = document.createElement('button');
  83. button2.className = 'el-button el-button--primary el-button--small';
  84. button2.innerHTML = '监测';
  85. action.appendChild(button2);
  86. button2.addEventListener('click', ()=>{
  87. callback(2)
  88. });
  89. el.appendChild(action);
  90. // const action2 = document.createElement('div');
  91. // action.className = 'action action2';
  92. // el.appendChild(action2);
  93. return el;
  94. };
  95. // • 应急仓库
  96. // a.应急仓库名称
  97. // b.应急仓库地点
  98. // c.应急仓库管理单位
  99. // d.联系人
  100. // e.联系电话
  101. // f.按钮(方式一:跳转应急仓库详情查看物资情况,方式二:在按钮旁边打开一个列表,该列表显示应急仓库的物资情况:物资名称、型号、数量)
  102. export const GET_WAREHOUSE_DIALOG_HTML = (item: ResourceItemDetail) => {
  103. var header = ['序号', '名称', '型号', '规格', '仓储数量', '可用数量', '单位'];
  104. const el = document.createElement('div');
  105. el.innerHTML = `
  106. <div class="ckbg">
  107. <div class="title">应急仓库信息</div>
  108. <div class="content">
  109. <div><span>仓库名称:</span><span style='overflow: hidden;text-overflow: ellipsis;white-space: nowrap;width: 150px;'>${
  110. item.name ?? '-'
  111. }</span></div>
  112. <div><span>地点:</span><span style='overflow: hidden;text-overflow: ellipsis;white-space: nowrap;width: 150px;'>${
  113. item.address ?? '-'
  114. }</span></div>
  115. <div><span>管理单位:</span><span style='overflow: hidden;text-overflow: ellipsis;white-space: nowrap;width: 150px;'>${
  116. item.manageUnit ?? '-'
  117. }</span></div>
  118. <div><span>联系人:</span><span style='overflow: hidden;text-overflow: ellipsis;white-space: nowrap;width: 150px;'>${
  119. item.contactName ?? '-'
  120. }</span></div>
  121. <div><span>更新时间:</span><span style='overflow: hidden;text-overflow: ellipsis;white-space: nowrap;width: 150px;'>${
  122. item.updateTime ?? '-'
  123. }</span></div>
  124. <div><span>联系方式:</span><span style='overflow: hidden;text-overflow: ellipsis;white-space: nowrap;width: 150px;'>${
  125. item.contactPhone ?? '-'
  126. }</span></div>
  127. </div>
  128. <div class="wz">
  129. <table id="tbl-${item.id}">
  130. <tr>
  131. ${header.map((i) => '<th>' + i + '</th>').join('')}
  132. </tr>
  133. </table>
  134. </div>
  135. </div>
  136. `;
  137. return el;
  138. };
  139. // • 应急车辆
  140. // a.车牌号
  141. // b.归属单位
  142. // c.车辆类型 (应急车辆为实时位置,目前暂无具体数据)
  143. export const GET_VEHICLES_DIALOG_HTML = (item: ResourceItemDetail) => {
  144. const el = document.createElement('div');
  145. el.innerHTML = `
  146. <div>
  147. <div class="title">应急车辆信息</div>
  148. <div class="content">
  149. <div><span>车牌号:</span><span>${item.name ?? '-'}</span></div>
  150. <div><span>管理单位:</span><span>${item.manageUnit ?? '-'}</span></div>
  151. <div><span>车辆类型:</span><span>${item.carType ?? '-'}</span></div>
  152. </div>
  153. <i class="card-border-bottom-left"></i>
  154. <i class="card-border-bottom-right"></i>
  155. </div>
  156. `;
  157. return el;
  158. };
  159. // • 应急队伍
  160. // a.队伍名称
  161. // b.管理单位
  162. // c.携带物资
  163. // d.人数
  164. // e. 联系人
  165. // f.联系电话
  166. export const GET_TEAM_DIALOG_HTML = (item: ResourceItemDetail) => {
  167. const el = document.createElement('div');
  168. el.innerHTML = `
  169. <div>
  170. <div class="title">应急队伍信息</div>
  171. <div class="content">
  172. <div><span>队伍名称:</span><span>${item.name ?? '-'}</span></div>
  173. <div><span>管理单位:</span><span>${item.manageUnit ?? '-'}</span></div>
  174. <div><span>携带物资:</span><span>${item.carryGoods ?? '-'}</span></div>
  175. <div><span>人数:</span><span>${item.num ?? '-'}</span></div>
  176. <div><span>联系人:</span><span>${item.contactName ?? '-'}</span></div>
  177. <div><span>联系方式:</span><span>${item.contactPhone ?? '-'}</span></div>
  178. </div>
  179. <i class="card-border-bottom-left"></i>
  180. <i class="card-border-bottom-right"></i>
  181. </div>
  182. `;
  183. return el;
  184. };
  185. export const GET_SINGLE_DEVICE_DIALOG_HTML = (
  186. item: SingleDeviceItem,
  187. callback = () => {},
  188. ) => {
  189. const el = document.createElement('div');
  190. el.innerHTML = `
  191. <div>
  192. <div class="title">单兵设备</div>
  193. <div class="content">
  194. <div><span>名称:</span><span>${item.userName ?? '-'}</span></div>
  195. <div><span>定位时间:</span><span>${item.time ?? '-'}</span></div>
  196. </div>
  197. <i class="card-border-bottom-left"></i>
  198. <i class="card-border-bottom-right"></i>
  199. </div>
  200. `;
  201. const action = document.createElement('div');
  202. action.className = 'action';
  203. const button = document.createElement('button');
  204. button.className = 'el-button el-button--primary el-button--small';
  205. button.innerHTML = '查看单兵';
  206. action.appendChild(button);
  207. button.addEventListener('click', callback);
  208. // const action2 = document.createElement('div');
  209. // action2.className = 'action';
  210. // const button2 = document.createElement('button');
  211. // button2.className = 'el-button el-button--primary el-button--small';
  212. // button2.innerHTML = '查看视频';
  213. // action2.appendChild(button);
  214. // button2.addEventListener('click', videoplay);
  215. el.appendChild(action);
  216. // el.appendChild(action2);
  217. console.log(el);
  218. return el;
  219. };
  220. export const renderElement = (image: any) => {
  221. const el = document.createElement('div');
  222. el.id = 'marker';
  223. el.style.backgroundImage = `url(${image})`;
  224. el.style.backgroundSize = 'cover';
  225. el.style.width = (24 * 2) / 576 + 'rem';
  226. el.style.minWidth = '24px';
  227. el.style.height = (25 * 2) / 576 + 'rem';
  228. el.style.minHeight = '25px';
  229. el.className = "pointerc"
  230. return el;
  231. };