dialog.ts 7.1 KB

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