index.vue 60 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787
  1. <template>
  2. <div class="scene-box">
  3. <!-- <div class="top-header">智能通风管理系统</div> -->
  4. <div class="select-node" :class="{ 'node-select-show': !treeShow, 'node-select-hide': treeShow }"
  5. @click="showTree('treeShow', true)">
  6. <SvgIcon class="is-expansion-icon put-away-icon" size="38" name="expansion" />
  7. <span class="title">{{ treeNodeTitle }}</span>
  8. </div>
  9. <div class="device-select" :class="{ 'device-select-show': treeShow, 'device-select-hide': !treeShow }">
  10. <SvgIcon class="is-expansion-icon expansion-icon" size="28" name="put-away"
  11. @click="showTree('treeShow', false)" />
  12. <div class="device-select-box">
  13. <a-tree :show-line="true" :tree-data="treeData" v-model:selectedKeys="selectedKeys" :autoExpandParent="true"
  14. v-model:expandedKeys="expandedKeys" @select="onSelect">
  15. </a-tree>
  16. </div>
  17. </div>
  18. <div class="location-icon"
  19. :class="{ 'location-btn-show': !locationSettingShow, 'location-btn-hide': locationSettingShow }"
  20. @click="showTree('location', true)">
  21. <SvgIcon size="18" name="put-away" />
  22. <span class="location-text">定位图标显示</span>
  23. </div>
  24. <div class="location-select"
  25. :class="{ 'location-select-show': locationSettingShow, 'location-select-hide': !locationSettingShow }">
  26. <div class="location-select-box">
  27. <div class="location-top-title" @click="showTree('location', false)">
  28. <SvgIcon class="is-expansion-icon location-expansion-icon" size="28" name="expansion" />
  29. <div class="title">定位图标显示</div>
  30. </div>
  31. <div class="location-container">
  32. <template v-for="location in locationList" :key="location.deviceType">
  33. <div class="location-item">
  34. <div class="item-title">{{ location.title }}&nbsp;:</div>
  35. <div>
  36. <a-radio-group v-model:value="location.Visible" :name="location.deviceType">
  37. <a-radio :value="1">是</a-radio>
  38. <a-radio :value="0">否</a-radio>
  39. </a-radio-group>
  40. </div>
  41. </div>
  42. </template>
  43. <div class="location-bottom-btn">
  44. <span @click="setLocation">提交</span>
  45. </div>
  46. </div>
  47. </div>
  48. </div>
  49. <div class="tabs-box bottom-tabs-box" :class="{ 'table-hide': !tableShow, 'table-show': tableShow }"
  50. style="height: 290px" @mousedown="setDivHeight($event, 230, scroll, 0)" id="monitorBox">
  51. <div :style="`padding: 5px; height: ${scroll.y + 100}px`">
  52. <div class="to-small">
  53. <div class="to-home" @click="toHome"></div>
  54. <FullscreenOutlined v-if="!tableShow" class="table-show-icon" @click="toHide" />
  55. </div>
  56. <div class="device-button-group" v-if="deviceList.length > 0">
  57. <!-- 关联设备 -->
  58. <div class="device-button" :class="{ 'device-active': deviceActive == device.deviceType }"
  59. v-for="(device, index) in deviceList" :key="index" @click="monitorChange(index)">{{ device.deviceName }}
  60. </div>
  61. <!-- 场景详情进入 -->
  62. <div v-if="haveSysDetailArr.find((item) => deviceType.startsWith(item))" class="enter-detail"
  63. @click.stop="goDetail()">
  64. <send-outlined />
  65. {{ treeNodeTitle }}详情
  66. </div>
  67. </div>
  68. <div v-if="deviceType == 'gaspatrol'">
  69. <div class="device-button-group">
  70. <div class="enter-detail" @click="exportXls()">
  71. <send-outlined />
  72. 导出
  73. </div>
  74. </div>
  75. </div>
  76. <div class="table-hide-icon" @click="toHide">
  77. <FullscreenExitOutlined style="font-size: 18px" />
  78. </div>
  79. <!-- 是人员定位表单代码,由于放在tab中,表格对已知刷新,导致表单数据也在刷寻,造成输入一半的中文时会清空输入框的内容,导致的输入不上数据 -->
  80. <div v-if="deviceType.startsWith('location') && activeKey == '1'" class="location-form"
  81. style="position: absolute; z-index: 9999; top: 50px">
  82. <div class="location-form-item">
  83. <span class="location-form-label">人员名称:</span>
  84. <Input style="width: 200px" v-model:value="locationForm.strname" />
  85. </div>
  86. <div class="location-form-item">
  87. <span class="location-form-label">所属部门:</span>
  88. <MTreeSelect style="width: 200px" v-model:value="locationForm.department" placeholder="请选择所属部门"
  89. api="/monitor/getDepartmentInfo" :virtual="false" :isGetPopupContainer="false" />
  90. </div>
  91. <div class="location-form-item">
  92. <span class="location-form-label">分站名称:</span>
  93. <Input style="width: 200px" v-model:value="locationForm.stationname" />
  94. </div>
  95. </div>
  96. <a-tabs class="tabs-box" v-model:activeKey="activeKey" @change="tabChange" id="tabsBox">
  97. <a-tab-pane key="1" tab="实时监测">
  98. <template
  99. v-if="(deviceType.startsWith('fanlocal') || deviceType.startsWith('fanmain')) && activeKey == '1'">
  100. <GroupMonitorTable ref="MonitorDataTable" :dataSource="dataSource" :columnsType="`${deviceType}_monitor`"
  101. :scroll="scroll" :isAction="true" :isShowSelect="false">
  102. <template #action="{ record }">
  103. <TableAction :actions="haveDetailArr.find((item) => deviceType.startsWith(item))
  104. ? [
  105. {
  106. label: '详情',
  107. onClick: goDetail.bind(null, record),
  108. },
  109. {
  110. label: '定位',
  111. onClick: goLocation.bind(null, record),
  112. },
  113. ]
  114. : [
  115. {
  116. label: '定位',
  117. onClick: goLocation.bind(null, record),
  118. },
  119. ]
  120. " />
  121. </template>
  122. </GroupMonitorTable>
  123. </template>
  124. <template v-else-if="deviceType == 'majorpath' && activeKey == '1'">
  125. <a-table :columns="majorColumns" :data-source="dataSource" bordered :scroll="{ y: scroll.y - 30 }"
  126. :pagination="false"></a-table>
  127. </template>
  128. <template v-else-if="deviceType.startsWith('safetymonitor') && activeKey == '1'">
  129. <MonitorTable ref="monitorTable" :columnsType="`${deviceType}_monitor`" :deviceType="deviceType"
  130. :dataSource="dataSource" design-scope="device_monitor" :isShowActionColumn="true" :isShowSelect="false"
  131. title="设备监测" :form-config="formConfig" :scroll="{ y: scroll.y - 110 }">
  132. <template #action="{ record }">
  133. <TableAction :actions="haveDetailArr.find((item) => deviceType.startsWith(item))
  134. ? [
  135. {
  136. label: '详情',
  137. onClick: goDetail.bind(null, record),
  138. },
  139. {
  140. label: '定位',
  141. onClick: goLocation.bind(null, record),
  142. },
  143. ]
  144. : [
  145. {
  146. label: '定位',
  147. onClick: goLocation.bind(null, record),
  148. },
  149. ]
  150. " />
  151. </template>
  152. <template #filterCell="{ column, record }">
  153. <div v-if="!record.devicename && column.dataIndex === 'devicename'">-</div>
  154. <div v-if="!record.V && column.dataIndex === 'V'">-</div>
  155. <div v-if="!record.PointUnit && column.dataIndex === 'PointUnit'">-</div>
  156. <div v-if="!record.highRange && column.dataIndex === 'highRange'">-</div>
  157. <div v-if="!record.lowRange && column.dataIndex === 'lowRange'">-</div>
  158. <div v-if="!record.dataTypeName && column.dataIndex === 'dataTypeName'">-</div>
  159. <a-tag v-if="column.dataIndex === 'netStatus'" :color="record.netStatus == '0' ? '#f00' : 'green'">{{
  160. record.netStatus == '0' ? '断开' : '连接'
  161. }}</a-tag>
  162. </template>
  163. </MonitorTable>
  164. </template>
  165. <template v-else-if="deviceType.startsWith('location') && activeKey == '1'">
  166. <MonitorTable ref="monitorTable" :columnsType="`${deviceType}_monitor`" :deviceType="deviceType"
  167. :dataSource="dataSource" design-scope="device_monitor" :isShowActionColumn="true" :isShowSelect="false"
  168. title="设备监测" :scroll="{ y: scroll.y - 110 }" style="margin-top: 60px">
  169. <template #action="{ record }">
  170. <TableAction :actions="[
  171. {
  172. label: '定位',
  173. onClick: goLocation.bind(null, record),
  174. },
  175. ]" />
  176. </template>
  177. </MonitorTable>
  178. </template>
  179. <template v-else-if="deviceType.startsWith('vehicle') && activeKey == '1'">
  180. <MonitorTable ref="monitorTable" :columnsType="`${deviceType}_monitor`" :deviceType="deviceType"
  181. :dataSource="dataSource" design-scope="device_monitor" :isShowActionColumn="true" :isShowSelect="false"
  182. title="设备监测" :form-config="vehicleFormConfig" :scroll="{ y: scroll.y - 110 }">
  183. <template #action="{ record }">
  184. <TableAction :actions="[
  185. {
  186. label: '定位',
  187. onClick: goLocation.bind(null, record),
  188. },
  189. ]" />
  190. </template>
  191. </MonitorTable>
  192. </template>
  193. <!-- 瓦斯巡检 -->
  194. <template v-else-if="deviceType.startsWith('gaspatrol') && activeKey == '1'">
  195. <gaspatrolTable :addressData="addressData" :personData="personData" :instypeData="instypeData"
  196. :classData="classData" :tableData="gaspatrolData" @addressInput="addressInput" @userInput="userInput"
  197. @insTypeChange="insTypeChange" @classChange="classChange"></gaspatrolTable>
  198. </template>
  199. <template v-else>
  200. <!-- 工作面echarts图标 -->
  201. <BarAndLine v-if="activeKey == '1' && deviceType == 'surface_history'" class="echarts-line"
  202. xAxisPropType="time" :dataSource="surfaceEchartsData" height="300px"
  203. :chartsColumns="surfaceChartsColumns" :option="echatsOption" />
  204. <MonitorTable v-else-if="activeKey == '1'" ref="monitorTable" :columnsType="`${deviceType}_monitor`"
  205. :dataSource="dataSource" design-scope="device_monitor" :isShowActionColumn="true" :isShowSelect="false"
  206. title="设备监测" :scroll="{ y: scroll.y - 30 }">
  207. <template #action="{ record }">
  208. <TableAction :actions="haveDetailArr.find((item) => deviceType.startsWith(item))
  209. ? [
  210. {
  211. label: '详情',
  212. onClick: goDetail.bind(null, record),
  213. },
  214. {
  215. label: '定位',
  216. onClick: goLocation.bind(null, record),
  217. },
  218. ]
  219. : [
  220. {
  221. label: '定位',
  222. onClick: goLocation.bind(null, record),
  223. },
  224. ]
  225. " />
  226. </template>
  227. <template #filterCell="{ column, record }">
  228. <template v-if="deviceType.startsWith('gate') || deviceType.startsWith('door')">
  229. <a-tag
  230. v-if="column.dataIndex === 'frontGateOpen' && record.frontGateOpen == '0' && record.frontGateClose == '0'"
  231. color="red">正在运行</a-tag>
  232. <a-tag
  233. v-else-if="column.dataIndex === 'frontGateOpen' && record.frontGateOpen == '0' && record.frontGateClose == 1"
  234. color="default">关闭</a-tag>
  235. <a-tag
  236. v-else-if="column.dataIndex === 'frontGateOpen' && record.frontGateOpen == '1' && record.frontGateClose == '0'"
  237. color="#46C66F">打开</a-tag>
  238. <a-tag
  239. v-else-if="column.dataIndex === 'frontGateOpen' && record.frontGateOpen == '1' && record.frontGateClose == '1'"
  240. color="#FF0000">点位异常</a-tag>
  241. <a-tag
  242. v-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == '0' && record.rearGateClose == '0'"
  243. color="red">正在运行</a-tag>
  244. <a-tag
  245. v-else-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == '0' && record.rearGateClose == '1'"
  246. color="default">关闭</a-tag>
  247. <a-tag
  248. v-else-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == '1' && record.rearGateClose == '0'"
  249. color="#46C66F">打开</a-tag>
  250. <a-tag
  251. v-else-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == '1' && record.rearGateClose == '1'"
  252. color="#FF0000">点位异常</a-tag>
  253. <a-tag
  254. v-if="column.dataIndex === 'midGateOpen' && record.midGateOpen == '0' && record.midGateClose == '0'"
  255. color="red">正在运行</a-tag>
  256. <a-tag
  257. v-else-if="column.dataIndex === 'midGateOpen' && record.midGateOpen == '0' && record.midGateClose == 1"
  258. color="default">关闭</a-tag>
  259. <a-tag
  260. v-else-if="column.dataIndex === 'midGateOpen' && record.midGateOpen == '1' && record.midGateClose == '0'"
  261. color="#46C66F">打开</a-tag>
  262. <a-tag
  263. v-else-if="column.dataIndex === 'midGateOpen' && record.midGateOpen == '1' && record.midGateClose == '1'"
  264. color="#FF0000">点位异常</a-tag>
  265. <template v-if="column.dataIndex === 'doorUse'">
  266. <span v-if="record.doorUse == 1" color="default">行车风门</span>
  267. <span v-else-if="record.doorUse == 2">行人风门</span>
  268. <span v-else-if="record.doorUse == 3">短路风门</span>
  269. </template>
  270. </template>
  271. <template v-else-if="deviceType.startsWith('windrect')">
  272. <a-tag v-if="column.dataIndex === 'sign'"
  273. :color="record.sign == 0 ? '#95CF65' : record.sign == 1 ? '#4590EA' : '#9876AA'">
  274. {{ record.sign == 0 ? '高位' : record.sign == 1 ? '中位' : '低位' }}</a-tag>
  275. <template v-if="record && column && column.dataIndex === 'isRun' && record.isRun">
  276. <a-tag v-if="record.isRun == -2 || record.isRun == -1"
  277. :color="record.isRun == -2 ? '#95CF65' : '#ED5700'">{{
  278. record.isRun == -2 ? '空闲' : '等待'
  279. }}</a-tag>
  280. <a-tag v-else-if="record.isRun == 100" color="#4693FF">完成</a-tag>
  281. <Progress v-else :percent="Number(record.isRun)" size="small" status="active" />
  282. </template>
  283. </template>
  284. <template v-else-if="deviceType.startsWith('safetymonitor')">
  285. <div v-if="!record.devicename && column.dataIndex === 'devicename'">-</div>
  286. <div v-if="!record.V && column.dataIndex === 'V'">-</div>
  287. <div v-if="!record.PointUnit && column.dataIndex === 'PointUnit'">-</div>
  288. <div v-if="!record.highRange && column.dataIndex === 'highRange'">-</div>
  289. <div v-if="!record.lowRange && column.dataIndex === 'lowRange'">-</div>
  290. <div v-if="!record.dataTypeName && column.dataIndex === 'dataTypeName'">-</div>
  291. </template>
  292. <template v-else-if="deviceType.startsWith('atomizing')">
  293. <a-tag v-if="column.dataIndex === 'stateConn' && record.stateConn == '1'" color="green">连接</a-tag>
  294. <a-tag v-if="column.dataIndex === 'stateConn' && record.stateConn == '0'" color="red">断开</a-tag>
  295. </template>
  296. <template v-else-if="deviceType.startsWith('gaspatrol')">
  297. <a-tag v-if="column.dataIndex === 'deviceConnect_str' && record.deviceConnect_str.endsWith('正常')"
  298. color="green">{{ record.deviceConnect_str }}</a-tag>
  299. <a-tag v-if="column.dataIndex === 'deviceConnect_str' && record.deviceConnect_str.endsWith('断开')"
  300. color="red">{{ record.deviceConnect_str }}</a-tag>
  301. </template>
  302. <a-tag v-if="column.dataIndex === 'warnFlag'"
  303. :color="record.warnFlag == 0 ? 'green' : record.warnFlag == 1 ? '#FF5812' : 'gray'">
  304. {{ record.warnFlag == 0 ? '正常' : record.warnFlag == 1 ? '报警' : record.warnFlag == 2 ? '断开' : '未监测'
  305. }}</a-tag>
  306. <template v-else-if="column.dataIndex === 'warnLevel'">
  307. <a-tag v-if="record.warnLevel == '101'" color="green">低风险</a-tag>
  308. <a-tag v-else-if="record.warnLevel == '102'" color="#FF5812">一般风险</a-tag>
  309. <a-tag v-else-if="record.warnLevel == '103'" color="#FF5812">较大风险</a-tag>
  310. <a-tag v-else-if="record.warnLevel == '104'" color="#FF5812">重大风险</a-tag>
  311. <a-tag v-else-if="record.warnLevel == '201'" color="#FF0000">报警</a-tag>
  312. <a-tag v-else-if="record.warnLevel == '10000'" color="#FF5812">数据超限</a-tag>
  313. <a-tag v-else-if="record.warnLevel == '1001'" color="default">网络中断</a-tag>
  314. <a-tag v-else color="green">正常</a-tag>
  315. </template>
  316. <a-tag v-if="column.dataIndex === 'netStatus'" :color="record.netStatus == '0' ? '#f00' : 'green'">{{
  317. record.netStatus == '0' ? '断开' : '连接'
  318. }}</a-tag>
  319. </template>
  320. </MonitorTable>
  321. </template>
  322. </a-tab-pane>
  323. <a-tab-pane key="2" tab="历史数据" v-if="!noHistoryArr().find((item) => deviceType.startsWith(item))">
  324. <div class="tab-item" v-if="activeKey == '2'">
  325. <template v-if="deviceType.startsWith('firemon_normal')">
  326. <HistoryBall :dataSource="dataSource"></HistoryBall>
  327. </template>
  328. <template v-else>
  329. <HistoryTable ref="historyTable" :sysId="systemID" :columns-type="`${deviceType}`"
  330. :device-type="deviceType" designScope="device-history" :scroll="scroll" />
  331. </template>
  332. </div>
  333. </a-tab-pane>
  334. <a-tab-pane key="3" tab="报警历史" v-if="!noWarningArr.find((item) => deviceType.startsWith(item))">
  335. <div class="tab-item">
  336. <AlarmHistoryTable ref="alarmHistoryTable" v-if="activeKey == '3'" :sysId="systemID" columns-type="alarm"
  337. :device-type="deviceType"
  338. :device-list-api="getDeviceList.bind(null, { devicekind: deviceType, sysId: systemID, pageSize: 10000 })"
  339. :scroll="scroll" designScope="alarm-history" />
  340. </div>
  341. </a-tab-pane>
  342. <a-tab-pane key="4" tab="操作历史" v-if="haveHandlerArr.find((item) => deviceType.startsWith(item))">
  343. <div class="tab-item">
  344. <HandlerHistoryTable ref="handlerHistoryTable" v-if="activeKey == '4'" :sysId="systemID"
  345. columns-type="operator_history" :device-type="deviceType"
  346. :device-list-api="getDeviceList.bind(null, { devicekind: deviceType, sysId: systemID })"
  347. :scroll="scroll" designScope="operator-history" />
  348. </div>
  349. </a-tab-pane>
  350. </a-tabs>
  351. </div>
  352. </div>
  353. <mainPath v-if="deviceType == 'majorpath'" :dataSource="majorPathEchartsData"
  354. style="width: 300px; height: 300px; position: absolute; left: 250px; top: 40px" />
  355. <component v-if="modalVisible" :is="currentModal" v-model:visible="modalVisible" :dataSource="dataSource"
  356. :activeID="activeID" />
  357. </div>
  358. </template>
  359. <script setup lang="ts">
  360. import { ref, onMounted, onUnmounted, ComponentOptions, shallowRef, reactive, defineProps, watch } from 'vue';
  361. import { SendOutlined, FullscreenExitOutlined, FullscreenOutlined } from '@ant-design/icons-vue';
  362. import { list, getDeviceList, getDeviceTypeList, devPosition, getDepartmentInfo, getExportUrl, queryNowGasInsInfo, } from './device.api';
  363. import AlarmHistoryTable from '../../../comment/AlarmHistoryTable.vue';
  364. import HistoryTable from '../../../comment/HistoryTable.vue';
  365. import HandlerHistoryTable from '../../../comment/HandlerHistoryTable.vue';
  366. import MonitorTable from '../../../comment/MonitorTable.vue';
  367. import GroupMonitorTable from '../../../comment/GroupMonitorTable.vue';
  368. import gaspatrolTable from '../../../comment/gaspatrolTable.vue'
  369. import HistoryBall from './modal/history-ball.vue'
  370. import { TreeProps, message, Progress, Input, Select } from 'ant-design-vue';
  371. import { TableAction } from '/@/components/Table';
  372. import { SvgIcon } from '/@/components/Icon';
  373. import { getActions } from '/@/qiankun/state';
  374. import { useRouter } from 'vue-router';
  375. import { setDivHeight } from '/@/utils/event';
  376. import {
  377. majorColumns,
  378. haveSysDetailArr,
  379. haveDetailArr,
  380. haveHandlerArr,
  381. noWarningArr,
  382. surfaceChartsColumns,
  383. noHistoryArr,
  384. getMonitorComponent,
  385. vehicleFormConfig,
  386. } from './device.data';
  387. import mainPath from './modal/mainPath.vue';
  388. import { formConfig } from '../../../safetyMonitor/safety.data';
  389. import { getDictItemsByCode } from '/@/utils/dict';
  390. import BarAndLine from '/@/components/chart/BarAndLine.vue';
  391. import MTreeSelect from '/@/components/Form/src/jeecg/components/MTreeSelect.vue';
  392. // import ApiSelect from '/@/components/Form/src/components/ApiSelect.vue';
  393. import { nextTick } from 'vue';
  394. import { useMethods } from '/@/hooks/system/useMethods';
  395. import { useGo } from '/@/hooks/web/usePage';
  396. import { useGlobSetting } from '/@/hooks/setting';
  397. //瓦斯巡检查询参数
  398. const addressData = ref('')//巡检地点
  399. const personData = ref('')//巡检员
  400. const instypeData = ref('')//巡检类型
  401. const classData = ref('')//巡检班次
  402. const gaspatrolData = ref<any[]>([])
  403. const glob = useGlobSetting();
  404. // import { BorderBox8 as DvBorderBox8 } from '@kjgl77/datav-vue3';
  405. const { FiberModal, BundleModal, DustModal, BallvalveModal, AtomizingModal, GaspatrolModal, WisdomBallModal } = getMonitorComponent();
  406. type DeviceType = { deviceType: string; deviceName: string; datalist: any[] };
  407. const props = defineProps({
  408. pageData: {
  409. type: Object,
  410. default: () => { },
  411. },
  412. });
  413. const { handleExportXls } = useMethods();
  414. const go = useGo();
  415. const echatsOption = {
  416. grid: {
  417. top: '35',
  418. left: '30',
  419. right: '45',
  420. bottom: '25',
  421. containLabel: true,
  422. },
  423. toolbox: {
  424. feature: {},
  425. },
  426. };
  427. const router = useRouter();
  428. const actions = getActions();
  429. // actions.setGlobalState({ pageObj: { pageType: 'home' } });
  430. const locationForm = reactive({
  431. strname: '',
  432. department: '',
  433. stationname: '',
  434. });
  435. const safetymonitorForm = reactive({
  436. dataTypeName: '',
  437. strinstallpos: '',
  438. });
  439. const monitorTable = ref();
  440. const historyTable = ref();
  441. const alarmHistoryTable = ref();
  442. const handlerHistoryTable = ref();
  443. // const routerParam = ref('home') // 默认进来时首页
  444. const isRefresh = ref(true);
  445. // 模态框
  446. const currentModal = shallowRef<Nullable<ComponentOptions>>(null); //模态框
  447. const modalVisible = ref<Boolean>(false); // 模态框是否可见
  448. // const drawerHeight = ref(240) // 监测框最小高度
  449. const treeShow = ref(true); //是否显示树形菜单
  450. const tableShow = ref(true); //是否显示树形菜单
  451. const locationSettingShow = ref(false); //是否显示树形菜单
  452. const treeNodeTitle = ref(''); // 选中的树形标题
  453. const locationList = ref([]); //巷道定位图标显示列表
  454. const deviceList = ref<DeviceType[]>([]); //关联设备列表
  455. const deviceActive = ref('');
  456. const activeKey = ref('1'); // tab key
  457. const dataSource = shallowRef([]); // 实时监测数据
  458. const majorPathEchartsData = ref({}); // 关键路线echarts数据
  459. const surfaceEchartsData = ref<any[]>(); // 工作面历史记录,echarts数据
  460. const activeID = ref(''); // 打开详情modal时监测的设备id
  461. const deviceType = ref(''); // 监测设备类型
  462. const systemType = ref('');
  463. const systemID = ref(''); // 系统监测时,系统id
  464. const selectedKeys = ref<string[]>([]);
  465. const expandedKeys = ref<string[]>([]);
  466. const scroll = reactive({
  467. y: 180,
  468. });
  469. const treeData = ref<TreeProps['treeData']>([]);
  470. let departmentInfo: Null | Object = null;
  471. let startMonitorTimer = 0;
  472. //树形菜单选择事件
  473. const onSelect: TreeProps['onSelect'] = (keys, e) => {
  474. deviceType.value = '';
  475. systemID.value = '';
  476. deviceList.value = [];
  477. const title = e.node.title; // 在
  478. if (e.node.parent && e.node.parent.node.type.toString().startsWith('sys')) {
  479. systemType.value = e.node.parent.node.type;
  480. if (deviceType.value != e.node.parent.node.type) deviceType.value = e.node.parent.node.type;
  481. systemID.value = e.node.type;
  482. // 传递工作面id信息,用于定位
  483. go(`/micro-vent-3dModal/dashboard/analysis?type=tunMonitor&deviceType=${deviceType.value}&deviceid=${systemID.value}`);
  484. } else {
  485. systemType.value = e.node.type;
  486. if (deviceType.value != e.node.type) deviceType.value = e.node.type;
  487. go(`/micro-vent-3dModal/dashboard/analysis?type=tunMonitor&deviceType=${deviceType.value}&deviceid=`);
  488. }
  489. // clearTimeout(timer);
  490. // timer = undefined;
  491. // if (startMonitorTimer) {
  492. // clearTimeout(startMonitorTimer);
  493. // }
  494. dataSource.value = [];
  495. if (!startMonitorTimer) {
  496. startMonitorTimer = setTimeout(() => {
  497. expandedKeys.value = keys;
  498. selectedKeys.value = keys;
  499. treeNodeTitle.value = e.node.title;
  500. // if (e.node.children?.length < 1 && timer) {
  501. // getMonitor(true);
  502. // }
  503. }, 1000);
  504. }
  505. // activeKey.value = '1';
  506. };
  507. function tabChange(activeKeyVal) {
  508. activeKey.value = activeKeyVal;
  509. }
  510. function showTree(flag, value) {
  511. if (flag == 'treeShow') treeShow.value = value;
  512. if (flag == 'location') locationSettingShow.value = value;
  513. }
  514. async function getDeviceType(sysType?) {
  515. if (treeData.value?.length > 0) return;
  516. const result = await getDeviceTypeList({});
  517. if (result.length > 0) {
  518. debugger;
  519. const dataSource = <TreeProps['treeData']>[];
  520. let key = '0';
  521. const getData = (resultList, dataSourceList, keyVal) => {
  522. resultList.forEach((item, index) => {
  523. if (item.deviceType != 'sys' && item.children && item.children.length > 0) {
  524. const children = getData(item.children, [], `${keyVal}-${index}`);
  525. // 判断关键阻力路线
  526. if (item.itemValue.startsWith(sysType) && children[0]) {
  527. systemID.value = item.children[0]['itemValue'];
  528. }
  529. dataSourceList.push({
  530. children: children,
  531. title: item.itemText,
  532. key: `${keyVal}-${index}`,
  533. type: item.itemValue,
  534. parentKey: `${keyVal}`,
  535. });
  536. } else {
  537. dataSourceList.push({
  538. children: [],
  539. title: item.itemText,
  540. key: `${keyVal}-${index}`,
  541. type: item.itemValue,
  542. parentKey: `${keyVal}`,
  543. });
  544. }
  545. });
  546. return dataSourceList;
  547. };
  548. treeData.value = getData(result, dataSource, key);
  549. }
  550. }
  551. // https获取监测数据
  552. let timer: null | NodeJS.Timeout = undefined;
  553. function getMonitor(flag?) {
  554. if (deviceType.value) {
  555. if (timer) timer = null;
  556. if (Object.prototype.toString.call(timer) === '[object Null]') {
  557. timer = setTimeout(
  558. async () => {
  559. if (!deviceType.value.startsWith('gaspatrol')) {
  560. await getDataSource();
  561. } else {
  562. await queryNowGasInsInfoList();
  563. }
  564. if (timer) {
  565. getMonitor();
  566. }
  567. },
  568. flag ? 0 : 1000
  569. );
  570. }
  571. }
  572. }
  573. async function getDataSource() {
  574. if (deviceType.value && deviceType.value.startsWith('sys') && systemID.value) {
  575. const res = await list({ devicetype: 'sys', systemID: systemID.value });
  576. const result = res.msgTxt;
  577. const deviceArr = <DeviceType[]>[];
  578. result.forEach((item) => {
  579. const data = item['datalist'].filter((data: any) => {
  580. const readData = data.readData;
  581. return Object.assign(data, readData);
  582. });
  583. if (item.type != 'sys') {
  584. if (item.type === 'majorpath') {
  585. deviceArr.unshift({ deviceType: item.type, deviceName: item['typeName'], datalist: item['datalist'][0]['paths'] });
  586. majorPathEchartsData.value = item['datalist'][0];
  587. } else if (item.type.startsWith('surface_history')) {
  588. surfaceEchartsData.value = item['datalist'][0];
  589. deviceArr.unshift({
  590. deviceType: item.type,
  591. deviceName: item['typeName'] ? item['typeName'] : item['datalist'][0]['typeName'],
  592. datalist: data,
  593. });
  594. } else {
  595. deviceArr.unshift({
  596. deviceType: item.type,
  597. deviceName: item['typeName'] ? item['typeName'] : item['datalist'][0]['typeName'],
  598. datalist: data,
  599. });
  600. }
  601. }
  602. });
  603. deviceList.value = deviceArr;
  604. if (deviceArr.length > 0) {
  605. // if (deviceArr[1]) {
  606. // deviceActive.value = deviceArr[1].deviceType
  607. // monitorChange(1)
  608. // } else {
  609. // deviceActive.value = deviceArr[0].deviceType
  610. // monitorChange(0)
  611. // }
  612. deviceActive.value = deviceArr[0].deviceType;
  613. monitorChange(0);
  614. }
  615. } else {
  616. let res = null;
  617. if (systemID.value) {
  618. res = await list({ devicetype: 'sys', types: deviceType.value, systemID: systemID.value });
  619. if (res && res.msgTxt) {
  620. const result = res.msgTxt;
  621. result.forEach((item) => {
  622. const data = item['datalist'].filter((data: any) => {
  623. const readData = data.readData;
  624. return Object.assign(data, readData);
  625. });
  626. if (item.type != 'sys') {
  627. if (item.type.startsWith('majorpath') && item.type == deviceType.value) {
  628. dataSource.value = item['datalist'][0]['paths'];
  629. majorPathEchartsData.value = item['datalist'][0];
  630. return;
  631. } else if (item.type == deviceType.value) {
  632. if (item.type == 'surface_history') {
  633. // 工作面图标数据
  634. surfaceEchartsData.value = item['datalist'][0];
  635. } else {
  636. dataSource.value = data;
  637. console.log('关联设备数据--------------->', data);
  638. }
  639. return;
  640. }
  641. }
  642. });
  643. }
  644. } else {
  645. let resultData, searchForm;
  646. if (monitorTable.value) {
  647. const formData = monitorTable.value.getForm();
  648. searchForm = formData.getFieldsValue();
  649. }
  650. if (monitorTable.value) {
  651. if (deviceType.value.startsWith('safetymonitor')) {
  652. resultData = await list({ devicetype: deviceType.value, pagetype: 'normal', filterParams: { ...searchForm } });
  653. } else if (deviceType.value.startsWith('location')) {
  654. if (!departmentInfo) {
  655. departmentInfo = await getDepartmentInfo({});
  656. }
  657. let department = null;
  658. if (departmentInfo && locationForm && locationForm['department']) {
  659. for (const key in departmentInfo) {
  660. const item = departmentInfo[key];
  661. if (item['id'] === locationForm['department']) {
  662. department = item;
  663. break;
  664. }
  665. }
  666. }
  667. resultData = await list({
  668. devicetype: deviceType.value,
  669. pagetype: 'normal',
  670. filterParams: {
  671. strinstallpos: locationForm['stationname'] ? locationForm['stationname'] : '',
  672. userName: locationForm['strname'] ? locationForm['strname'] : '',
  673. userJson: department && department['name'] ? department['name'] : '',
  674. },
  675. });
  676. } else if (deviceType.value.startsWith('vehicle')) {
  677. resultData = await list({
  678. devicetype: deviceType.value,
  679. pagetype: 'normal',
  680. filterParams: {
  681. strinstallpos: locationForm['stationname'] ? locationForm['stationname'] : '',
  682. vehicleName: locationForm['strname'] ? locationForm['strname'] : '',
  683. },
  684. });
  685. } else {
  686. resultData = await list({ devicetype: deviceType.value, pagetype: 'normal' });
  687. }
  688. } else {
  689. // 非安全监控
  690. resultData = await list({ devicetype: deviceType.value, pagetype: 'normal' });
  691. }
  692. if (resultData && resultData.msgTxt) {
  693. const result = resultData.msgTxt[0];
  694. if (result) {
  695. const data = result['datalist'].filter((data: any) => {
  696. const readData = data.readData;
  697. return Object.assign(data, readData);
  698. });
  699. if (deviceType.value.startsWith('safetymonitor')) {
  700. const resultData = <any[]>[];
  701. // 如果是安全监控的数据时需要过滤常见设备数据,根据设定的常用安全监控字典去匹配
  702. const dictCodes = getDictItemsByCode('safetynormal');
  703. if (searchForm && !searchForm['dataTypeName'] && dictCodes && dictCodes.length) {
  704. for (let i = 0; i < dictCodes.length; i++) {
  705. const dict = dictCodes[i];
  706. data.forEach((item) => {
  707. if (dict['value'] == item['dataTypeName']) {
  708. resultData.push(item);
  709. }
  710. });
  711. }
  712. dataSource.value = resultData;
  713. } else {
  714. dataSource.value = data;
  715. }
  716. } else {
  717. let tableData: any[] = [];
  718. let noNetData: any[] = [];
  719. data.filter((el) => {
  720. if (el.netStatus == 1) {
  721. tableData.push(el);
  722. } else {
  723. noNetData.push(el);
  724. }
  725. });
  726. dataSource.value = [...tableData, ...noNetData];
  727. }
  728. } else {
  729. dataSource.value = [];
  730. }
  731. } else {
  732. dataSource.value = [];
  733. }
  734. }
  735. }
  736. }
  737. //查询当前各班瓦斯巡检信息
  738. async function queryNowGasInsInfoList() {
  739. let res = await queryNowGasInsInfo({ address: addressData.value, userName: personData.value, insType: instypeData.value, class: classData.value })
  740. console.log(res, '查询当前各班瓦斯巡检信息')
  741. if (res.length) {
  742. gaspatrolData.value = res
  743. } else {
  744. gaspatrolData.value = []
  745. }
  746. }
  747. //巡检地点输入
  748. let addressInput = (param) => {
  749. addressData.value = param
  750. }
  751. //巡检员输入
  752. let userInput = (param) => {
  753. personData.value = param
  754. }
  755. //巡检类型选项切换
  756. let insTypeChange = (param) => {
  757. instypeData.value = param
  758. }
  759. //巡检班次选项切换
  760. let classChange = (param) => {
  761. classData.value = param
  762. }
  763. function goLocation(record) {
  764. if (record['deviceType'] == 'person_bd' || record['deviceType'] == 'car_bd') {
  765. actions.setGlobalState({ locationId: record.devNum, locationObj: null, pageObj: null, type: record['deviceType'].split('_')[0] });
  766. } else {
  767. if (deviceType.value.startsWith('location')) {
  768. actions.setGlobalState({ locationId: record.deviceID, locationObj: null, pageObj: null, type: 'person' });
  769. } else if (deviceType.value.startsWith('vehicle')) {
  770. actions.setGlobalState({ locationId: record.deviceID, locationObj: null, pageObj: null, type: 'car' });
  771. } else {
  772. actions.setGlobalState({ locationId: record.deviceID, locationObj: null, pageObj: null });
  773. }
  774. }
  775. }
  776. function goDetail(record?) {
  777. debugger;
  778. if (record) {
  779. activeID.value = record.deviceID;
  780. if (deviceType.value.startsWith('fiber')) {
  781. currentModal.value = FiberModal;
  782. modalVisible.value = true;
  783. } else if (deviceType.value.startsWith('dusting')) {
  784. currentModal.value = DustModal;
  785. modalVisible.value = true;
  786. } else if (deviceType.value.startsWith('bundletube')) {
  787. currentModal.value = BundleModal;
  788. modalVisible.value = true;
  789. } else if (deviceType.value.startsWith('firemon_normal')) {
  790. // currentModal.value = BundleModal;
  791. currentModal.value = WisdomBallModal;
  792. modalVisible.value = true;
  793. } else if (deviceType.value.startsWith('ballvalve')) {
  794. currentModal.value = BallvalveModal;
  795. modalVisible.value = true;
  796. } else if (deviceType.value.startsWith('atomizing')) {
  797. currentModal.value = AtomizingModal;
  798. modalVisible.value = true;
  799. } else if (deviceType.value.startsWith('gaspatrol')) {
  800. currentModal.value = GaspatrolModal;
  801. modalVisible.value = true;
  802. } else if (deviceType.value.indexOf('gate') != -1) {
  803. const newPage = router.resolve({ path: '/monitorChannel/monitor-gate', query: { id: activeID.value, deviceType: deviceType.value } });
  804. window.open(newPage.href, '_blank');
  805. } else if (deviceType.value.indexOf('window') != -1) {
  806. const newPage = router.resolve({ path: '/monitorChannel/monitor-window', query: { id: activeID.value, deviceType: deviceType.value } });
  807. window.open(newPage.href, '_blank');
  808. } else if (deviceType.value.indexOf('windrect') != -1) {
  809. const newPage = router.resolve({ path: '/monitorChannel/monitor-windrect', query: { id: activeID.value, deviceType: deviceType.value } });
  810. window.open(newPage.href, '_blank');
  811. } else if (deviceType.value.indexOf('fanmain') != -1) {
  812. const newPage = router.resolve({ path: '/monitorChannel/monitor-fanmain', query: { id: activeID.value, deviceType: deviceType.value } });
  813. window.open(newPage.href, '_blank');
  814. } else if (deviceType.value.indexOf('fanlocal') != -1 && glob.sysOrgCode !== 'ymdnymdn') {
  815. const newPage = router.resolve({ path: '/monitorChannel/monitor-fanlocal', query: { id: activeID.value, deviceType: deviceType.value } });
  816. window.open(newPage.href, '_blank');
  817. } else if (deviceType.value.indexOf('fanlocal') != -1 && glob.sysOrgCode == 'ymdnymdn') {
  818. const newPage = router.resolve({ path: '/monitorChannel/monitor-fanlocal1', query: { id: activeID.value, deviceType: record.deviceType } });
  819. window.open(newPage.href, '_blank');
  820. } else if (deviceType.value.indexOf('pulping') != -1) {
  821. const newPage = router.resolve({ path: '/grout-home', query: { id: activeID.value } });
  822. window.open(newPage.href, '_blank');
  823. } else if (deviceType.value.indexOf('pressurefan') != -1) {
  824. const newPage = router.resolve({ path: '/nitrogen/home', query: { id: activeID.value } });
  825. window.open(newPage.href, '_blank');
  826. } else if (deviceType.value.indexOf('chamber') != -1) {
  827. const newPage = router.resolve({ path: '/chamber-home', query: { id: activeID.value } });
  828. window.open(newPage.href, '_blank');
  829. } else if (deviceType.value.indexOf('safetymonitor') != -1) {
  830. const newPage = router.resolve({ path: '/monitorChannel/device-monitor/safetymonitor', query: { id: activeID.value } });
  831. window.open(newPage.href, '_blank');
  832. } else if (deviceType.value.indexOf('pump') != -1) {
  833. const newPage = router.resolve({ path: '/monitorChannel/gasPump-home', query: { id: activeID.value } });
  834. window.open(newPage.href, '_blank');
  835. } else if (systemType.value.indexOf('nitrogen') != -1) {
  836. const newPage = router.resolve({ path: '/nitrogen-home', query: { id: systemID.value } });
  837. window.open(newPage.href, '_blank');
  838. } else if (deviceType.value.indexOf('forcFan') != -1) {
  839. const newPage = router.resolve({ path: '/forcFan/home', query: { id: activeID.value } });
  840. window.open(newPage.href, '_blank');
  841. } else if (deviceType.value.indexOf('pulping') != -1) {
  842. const newPage = router.resolve({ path: '/grout-home', query: { id: activeID.value } });
  843. window.open(newPage.href, '_blank');
  844. } else {
  845. message.info('待开发。。。');
  846. }
  847. } else {
  848. if (systemType.value.indexOf('sys_dongshi') != -1) {
  849. const newPage = router.resolve({ path: '/chamber-home', query: { id: systemID.value } });
  850. window.open(newPage.href, '_blank');
  851. } else if (systemType.value.indexOf('sys_obfurage') != -1) {
  852. const newPage = router.resolve({ path: '/monitorChannel/obfurage-home', query: { id: systemID.value } });
  853. window.open(newPage.href, '_blank');
  854. } else if (systemType.value.indexOf('sys_surface_caimei') != -1) {
  855. const newPage = router.resolve({ path: '/monitorChannel/wokerFace-home', query: { id: systemID.value } });
  856. window.open(newPage.href, '_blank');
  857. } else if (systemType.value.indexOf('sys_surface_juejin') != -1) {
  858. const newPage = router.resolve({ path: '/monitorChannel/tunFace-home', query: { id: systemID.value } });
  859. window.open(newPage.href, '_blank');
  860. } else if (systemType.value.indexOf('sys_maintunnel_leather') != -1) {
  861. const newPage = router.resolve({ path: '/monitorChannel/beltTun-home', query: { id: systemID.value } });
  862. window.open(newPage.href, '_blank');
  863. } else if (systemType.value.indexOf('sys_surface_junya') != -1) {
  864. const newPage = router.resolve({ path: '/monitorChannel/balancePress-home', query: { id: systemID.value } });
  865. window.open(newPage.href, '_blank');
  866. } else if (systemType.value.indexOf('sys_nitrogen') != -1) {
  867. const newPage = router.resolve({ path: '/nitrogen-home', query: { id: systemID.value } });
  868. window.open(newPage.href, '_blank');
  869. } else if (deviceType.value.indexOf('forcFan') != -1) {
  870. const newPage = router.resolve({ path: '/forcFan/home', query: { id: activeID.value } });
  871. window.open(newPage.href, '_blank');
  872. } else if (deviceType.value.indexOf('pulping') != -1) {
  873. const newPage = router.resolve({ path: '/grout-home', query: { id: systemID.value } });
  874. window.open(newPage.href, '_blank');
  875. } else {
  876. message.info('待开发。。。');
  877. }
  878. }
  879. }
  880. function exportXls() {
  881. handleExportXls('瓦斯巡检记录', getExportUrl, { devicetype: deviceType.value });
  882. }
  883. function toHome() {
  884. deviceList.value = [];
  885. if (timer) clearTimeout(timer);
  886. timer = undefined;
  887. deviceType.value = '';
  888. go(glob.homePath);
  889. }
  890. function toHide() {
  891. tableShow.value = !tableShow.value;
  892. document.getElementById('monitorBox').addEventListener('animationend', () => {
  893. if (!tableShow.value) {
  894. document.getElementById('monitorBox').style.height = '0px';
  895. } else {
  896. document.getElementById('monitorBox').style.height = '290px';
  897. }
  898. });
  899. }
  900. async function findTreeDataValue(obj) {
  901. const findDeviceType = (data: any[], obj, flag = true) => {
  902. return data.find((item: any) => {
  903. if (item.children.length > 0) {
  904. findDeviceType(item.children, obj);
  905. }
  906. debugger
  907. if (obj.deviceType && obj.deviceType.startsWith('sys_')) {
  908. debugger;
  909. if (item.type == obj.deviceid) {
  910. deviceType.value = 'sys';
  911. systemID.value = obj.deviceid;
  912. selectedKeys.value = [item.key];
  913. expandedKeys.value = [item.key];
  914. treeNodeTitle.value = item.title;
  915. }
  916. } else {
  917. if (!flag) {
  918. if (obj.deviceType && item.type.startsWith(obj.deviceType)) {
  919. deviceType.value = item.type;
  920. selectedKeys.value = [item.key];
  921. expandedKeys.value = [item.key];
  922. treeNodeTitle.value = item.title;
  923. return true;
  924. }
  925. return false;
  926. } else {
  927. if (obj.deviceType && item.type == obj.deviceType) {
  928. deviceType.value = item.type;
  929. selectedKeys.value = [item.key];
  930. expandedKeys.value = [item.key];
  931. treeNodeTitle.value = item.title;
  932. return true;
  933. }
  934. return false;
  935. }
  936. }
  937. return false;
  938. });
  939. };
  940. const flag = findDeviceType(treeData.value, obj);
  941. if (!flag) {
  942. findDeviceType(treeData.value, obj, false);
  943. }
  944. // 无类型时
  945. if (!treeNodeTitle.value && treeData.value && treeData.value[0] && treeData.value[0]['children']) {
  946. const defaultData = treeData.value[0]['children'][0];
  947. if (deviceType.value !== defaultData.type) deviceType.value = defaultData.type;
  948. selectedKeys.value = [defaultData.key as string];
  949. expandedKeys.value = [defaultData.key as string];
  950. treeNodeTitle.value = defaultData.title;
  951. }
  952. if (timer === undefined) {
  953. timer = null;
  954. await getDataSource();
  955. getMonitor(true);
  956. }
  957. }
  958. function monitorChange(index) {
  959. dataSource.value = [];
  960. deviceActive.value = deviceList.value[index].deviceType;
  961. if (deviceType.value != deviceActive.value) deviceType.value = deviceActive.value;
  962. if (activeKey.value == '1' && monitorTable.value) {
  963. monitorTable.value.setLoading(true);
  964. dataSource.value = deviceList.value[index].datalist;
  965. }
  966. if (activeKey.value == '2' && historyTable.value) {
  967. historyTable.value.setLoading(true);
  968. }
  969. if (activeKey.value == '3' && alarmHistoryTable.value) {
  970. alarmHistoryTable.value.setLoading(true);
  971. }
  972. if (activeKey.value == '4' && handlerHistoryTable.value) {
  973. handlerHistoryTable.value.setLoading(true);
  974. }
  975. }
  976. /**
  977. * 设置巷道设备定位图标的显示与隐藏
  978. */
  979. function setLocation() {
  980. let locationStr = '';
  981. locationList.value.forEach((item: any) => {
  982. if (item.Visible) {
  983. locationStr = locationStr ? locationStr + ',' + item.value : item.value;
  984. }
  985. });
  986. actions.setGlobalState({ locationId: null, locationObj: null, pageObj: null, locationPlane: locationStr });
  987. setTimeout(() => {
  988. message.success('设置成功');
  989. }, 600);
  990. }
  991. // function clearMonitor() {
  992. // clearTimeout(timer);
  993. // timer = undefined;
  994. // if (startMonitorTimer) {
  995. // clearTimeout(startMonitorTimer);
  996. // }
  997. // dataSource.value = [];
  998. // startMonitorTimer = setTimeout(() => {
  999. // expandedKeys.value = keys;
  1000. // selectedKeys.value = keys;
  1001. // treeNodeTitle.value = e.node.title;
  1002. // activeKey.value = '1';
  1003. // timer = null;
  1004. // if (e.node.children?.length < 1) {
  1005. // getMonitor(true);
  1006. // }
  1007. // }, 1000);
  1008. // }show
  1009. watch(
  1010. () => props.pageData,
  1011. async (pageObj) => {
  1012. isRefresh.value = false;
  1013. if (!treeData.value || treeData.value?.length < 1) {
  1014. await getDeviceType();
  1015. }
  1016. nextTick(() => {
  1017. isRefresh.value = true;
  1018. debugger;
  1019. // if (pageObj && pageObj.pageType && pageObj.pageType.startsWith('sys_')) {
  1020. // findTreeDataValue({ deviceid: systemID.value });
  1021. // } else {
  1022. // findTreeDataValue({ deviceType: pageObj.pageType });
  1023. // }
  1024. findTreeDataValue(pageObj);
  1025. });
  1026. },
  1027. { immediate: true }
  1028. );
  1029. onMounted(async () => {
  1030. const pageObj = props.pageData;
  1031. if (!pageObj) return;
  1032. if (pageObj && pageObj.pageType) {
  1033. if (pageObj.pageType.startsWith('sys_')) {
  1034. await getDeviceType(pageObj.pageType);
  1035. findTreeDataValue({ deviceType: pageObj.pageType, deviceid: pageObj.deviceid });
  1036. } else {
  1037. await getDeviceType();
  1038. findTreeDataValue({ deviceType: pageObj.pageType });
  1039. }
  1040. } else {
  1041. await getDeviceType();
  1042. findTreeDataValue({ deviceid: pageObj.deviceid });
  1043. }
  1044. // 定位
  1045. const posShowData = pageObj.locationPlane;
  1046. if (posShowData) {
  1047. locationList.value = posShowData;
  1048. } else {
  1049. locationList.value = await devPosition({});
  1050. }
  1051. // safetyOption.value = await safetyDeviceList(null, { devicetype: 'safetymonitor', code: 'dataTypeName' })
  1052. });
  1053. onUnmounted(() => {
  1054. if (timer) {
  1055. clearTimeout(timer);
  1056. }
  1057. timer = undefined;
  1058. });
  1059. </script>
  1060. <style lang="less" scoped>
  1061. @import '/@/design/vent/modal.less';
  1062. @ventSpace: zxm;
  1063. .top-header {
  1064. position: fixed;
  1065. width: 100%;
  1066. height: 56px;
  1067. background: url('/@/assets/images/vent/home/modal-top.png');
  1068. text-align: center;
  1069. line-height: 56px;
  1070. font-size: 28px;
  1071. color: #ffffffdd;
  1072. font-weight: 600;
  1073. z-index: 1;
  1074. letter-spacing: 2px;
  1075. font-size: 30px;
  1076. }
  1077. .select-node {
  1078. position: fixed;
  1079. top: 100px;
  1080. left: 10px;
  1081. color: #fff;
  1082. display: flex;
  1083. justify-content: center;
  1084. font-size: 22px;
  1085. .title {
  1086. margin-left: 10px;
  1087. }
  1088. }
  1089. .expansion-icon {
  1090. background: url('/@/assets/images/vent/home/tree-icon-bg.png') no-repeat;
  1091. background-size: contain;
  1092. position: absolute;
  1093. left: 190px;
  1094. top: 25px;
  1095. &:hover {
  1096. background: url('/@/assets/images/vent/home/tree-icon-hover-bg.png') no-repeat;
  1097. background-size: contain;
  1098. }
  1099. }
  1100. .device-select {
  1101. width: 250px;
  1102. height: 500px;
  1103. background: url('/@/assets/images/vent/home/tree-bg.png') no-repeat;
  1104. position: fixed;
  1105. top: 100px;
  1106. left: 10px;
  1107. background-size: contain;
  1108. pointer-events: auto;
  1109. padding: 20px 10px 30px 10px;
  1110. }
  1111. .is-expansion-icon {
  1112. padding: 5px;
  1113. pointer-events: auto;
  1114. z-index: 999;
  1115. }
  1116. .device-select-show {
  1117. left: 10px;
  1118. animation-name: treeShow;
  1119. /* 持续时间 */
  1120. animation-duration: 1s;
  1121. transition: all 1s cubic-bezier(0.165, 0.84, 0.44, 1) 0.5s;
  1122. }
  1123. .device-select-hide {
  1124. left: -250px;
  1125. animation-name: treeHide;
  1126. /* 持续时间 */
  1127. animation-duration: 1s;
  1128. transition: all 1s cubic-bezier(0.165, 0.84, 0.44, 1) 0.5s;
  1129. }
  1130. .node-select-show {
  1131. width: 276px;
  1132. height: 44px;
  1133. background: url('/@/assets/images/vent/home/tree-expansion-bg.png') no-repeat;
  1134. left: 10px;
  1135. animation-name: treeShow;
  1136. /* 持续时间 */
  1137. animation-duration: 1s;
  1138. transition: all 1s cubic-bezier(0.165, 0.84, 0.44, 1) 0.5s;
  1139. display: flex;
  1140. align-items: center;
  1141. margin-left: 0;
  1142. justify-content: flex-start;
  1143. pointer-events: auto;
  1144. &:hover {
  1145. background: url('/@/assets/images/vent/home/tree-expansion-hover-bg.png') no-repeat;
  1146. }
  1147. .put-away-icon {
  1148. position: relative;
  1149. display: inline-block;
  1150. left: 4px;
  1151. }
  1152. }
  1153. .node-select-hide {
  1154. left: -400px;
  1155. animation-name: treeHide;
  1156. /* 持续时间 */
  1157. animation-duration: 1s;
  1158. transition: all 1s cubic-bezier(0.165, 0.84, 0.44, 1) 0.5s;
  1159. }
  1160. .device-select-box {
  1161. width: 208px;
  1162. height: 450px;
  1163. overflow-y: auto;
  1164. color: #fff;
  1165. :deep(.zxm-tree) {
  1166. background: transparent !important;
  1167. color: #fff !important;
  1168. .zxm-tree-switcher {
  1169. background: transparent !important;
  1170. }
  1171. .zxm-tree-node-content-wrapper.zxm-tree-node-selected {
  1172. background-color: #00b1c8;
  1173. }
  1174. .zxm-tree-node-content-wrapper:hover {
  1175. background-color: #00b1c855;
  1176. }
  1177. input {
  1178. height: 0px !important;
  1179. }
  1180. }
  1181. &::-webkit-scrollbar-track {
  1182. -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  1183. border-radius: 10px;
  1184. background: #ededed22;
  1185. height: 100px;
  1186. }
  1187. &::-webkit-scrollbar-thumb {
  1188. -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  1189. background: #4288a444;
  1190. }
  1191. }
  1192. .location-icon {
  1193. width: 46px;
  1194. height: 178px;
  1195. position: absolute;
  1196. top: 100px;
  1197. // right: 0;
  1198. background: url('/@/assets/images/vent/home/location-bg.png') no-repeat;
  1199. background-size: contain;
  1200. writing-mode: vertical-lr;
  1201. line-height: 46px;
  1202. color: #fff;
  1203. padding-top: 10px;
  1204. pointer-events: auto;
  1205. cursor: pointer;
  1206. &:hover {
  1207. background: url('/@/assets/images/vent/home/location-hover-bg.png') no-repeat;
  1208. }
  1209. .location-text {
  1210. padding-top: 20px;
  1211. letter-spacing: 3px;
  1212. font-size: 16px;
  1213. }
  1214. }
  1215. .location-select {
  1216. position: fixed;
  1217. top: 100px;
  1218. // right: 240px;
  1219. pointer-events: auto;
  1220. .location-select-box {
  1221. width: 100%;
  1222. height: 100%;
  1223. position: relative;
  1224. &::before {
  1225. content: '';
  1226. position: absolute;
  1227. width: 230px;
  1228. height: 500px;
  1229. top: 0;
  1230. left: 0;
  1231. background: url('/@/assets/images/vent/home/tree-bg.png') no-repeat;
  1232. background-size: contain;
  1233. transform: rotateY(180deg);
  1234. z-index: -1;
  1235. // &:hover {
  1236. // background: url('/@/assets/images/vent/home/tree-icon-hover-bg.png') no-repeat;
  1237. // background-size: contain;
  1238. // }
  1239. }
  1240. .location-top-title {
  1241. color: #fff;
  1242. position: absolute;
  1243. width: 225px;
  1244. height: 68px;
  1245. background: url('/@/assets/images/vent/home/turn-location-top-bg.png') no-repeat;
  1246. background-size: contain;
  1247. top: 5px;
  1248. left: 5px;
  1249. display: flex;
  1250. flex-direction: row;
  1251. justify-content: space-between;
  1252. align-items: flex-end;
  1253. .title {
  1254. font-size: 18px;
  1255. position: relative;
  1256. top: -14px;
  1257. right: 15px;
  1258. }
  1259. }
  1260. .location-expansion-icon {
  1261. background: url('/@/assets/images/vent/home/tree-icon-cover-bg.png') no-repeat;
  1262. background-size: contain;
  1263. position: relative;
  1264. left: 10px;
  1265. top: -15px;
  1266. padding: 5px;
  1267. &:hover {
  1268. background: url('/@/assets/images/vent/home/tree-icon-cover-hover-bg.png') no-repeat;
  1269. background-size: contain;
  1270. }
  1271. }
  1272. }
  1273. .location-container {
  1274. width: 200px;
  1275. height: 390px;
  1276. position: absolute;
  1277. display: flex;
  1278. flex-direction: column;
  1279. top: 80px;
  1280. left: 18px;
  1281. overflow-y: auto;
  1282. .location-item {
  1283. color: #fff;
  1284. line-height: 30px;
  1285. display: flex;
  1286. justify-content: space-between;
  1287. background-image: linear-gradient(to left, #39f5ff05, #39f5ff10);
  1288. margin: 3px 0;
  1289. .item-title {
  1290. width: 80px;
  1291. text-align: right;
  1292. color: #87f1ff;
  1293. }
  1294. }
  1295. .location-bottom-btn {
  1296. width: 100%;
  1297. color: #fff;
  1298. display: flex;
  1299. justify-content: flex-end;
  1300. margin-top: 20px;
  1301. span {
  1302. display: inline-block;
  1303. width: 100%;
  1304. background: #00709955;
  1305. border-radius: 3px;
  1306. border: 1px solid rgba(174, 243, 255, 0.3);
  1307. text-align: center;
  1308. padding: 2px 0;
  1309. cursor: pointer;
  1310. &:hover {
  1311. background: #00557422;
  1312. }
  1313. }
  1314. }
  1315. }
  1316. }
  1317. .location-select-show {
  1318. right: 240px;
  1319. animation-name: locationShow;
  1320. /* 持续时间 */
  1321. animation-duration: 1s;
  1322. transition: all 1s cubic-bezier(0.165, 0.84, 0.44, 1) 0.5s;
  1323. }
  1324. .location-select-hide {
  1325. right: -2px;
  1326. animation-name: locationHide;
  1327. /* 持续时间 */
  1328. animation-duration: 1s;
  1329. transition: all 1s cubic-bezier(0.165, 0.84, 0.44, 1) 0.5s;
  1330. }
  1331. .location-btn-show {
  1332. right: -0px;
  1333. animation-name: locationBtnShow;
  1334. /* 持续时间 */
  1335. animation-duration: 1s;
  1336. transition: all 1s cubic-bezier(0.165, 0.84, 0.44, 1) 0.5s;
  1337. }
  1338. .location-btn-hide {
  1339. right: -240px;
  1340. animation-name: locationBtnHide;
  1341. /* 持续时间 */
  1342. animation-duration: 1s;
  1343. transition: all 1s cubic-bezier(0.165, 0.84, 0.44, 1) 0.5s;
  1344. }
  1345. .tabs-box {
  1346. height: 290px;
  1347. }
  1348. .bottom-tabs-box {
  1349. position: relative;
  1350. .tabs-box {
  1351. width: calc(100% - 12px) !important;
  1352. bottom: 3px !important;
  1353. }
  1354. .to-small {
  1355. position: absolute;
  1356. top: -65px;
  1357. right: 36px;
  1358. display: flex;
  1359. align-items: center;
  1360. justify-content: center;
  1361. .to-home {
  1362. width: 60px;
  1363. height: 60px;
  1364. background: url('/@/assets/images/vent/home/tohome.png') no-repeat center;
  1365. background-size: auto;
  1366. padding: 8px;
  1367. &:hover {
  1368. background-color: rgba(79, 104, 134, 0.418);
  1369. }
  1370. }
  1371. .table-show-icon {
  1372. width: 30px;
  1373. height: 30px;
  1374. font-size: 30px;
  1375. color: #fff;
  1376. margin-left: 10px;
  1377. }
  1378. }
  1379. .device-button-group {
  1380. position: absolute;
  1381. top: -30px;
  1382. display: flex;
  1383. width: 100%;
  1384. .device-button {
  1385. height: 26px;
  1386. padding: 0 20px;
  1387. background: linear-gradient(45deg, #04e6fb55, #0c5cab55);
  1388. clip-path: polygon(10px 0, 0 50%, 10px 100%, 100% 100%, calc(100% - 10px) 50%, 100% 0);
  1389. display: flex;
  1390. justify-content: center;
  1391. align-items: center;
  1392. color: #fff;
  1393. position: relative;
  1394. cursor: pointer;
  1395. &:nth-child(1) {
  1396. left: calc(-6px * 1);
  1397. }
  1398. &:nth-child(2) {
  1399. left: calc(-6px * 2);
  1400. }
  1401. &:nth-child(3) {
  1402. left: calc(-6px * 3);
  1403. }
  1404. &:nth-child(4) {
  1405. left: calc(-6px * 4);
  1406. }
  1407. &:nth-child(5) {
  1408. left: calc(-6px * 5);
  1409. }
  1410. &:nth-child(6) {
  1411. left: calc(-6px * 6);
  1412. }
  1413. &:nth-child(7) {
  1414. left: calc(-6px * 7);
  1415. }
  1416. &:nth-child(8) {
  1417. left: calc(-6px * 8);
  1418. }
  1419. &:nth-child(9) {
  1420. left: calc(-6px * 9);
  1421. }
  1422. &:nth-child(10) {
  1423. left: calc(-6px * 10);
  1424. }
  1425. &:nth-child(11) {
  1426. left: calc(-6px * 11);
  1427. }
  1428. &:nth-child(12) {
  1429. left: calc(-6px * 12);
  1430. }
  1431. &:nth-child(13) {
  1432. left: calc(-6px * 13);
  1433. }
  1434. &:nth-child(14) {
  1435. left: calc(-6px * 14);
  1436. }
  1437. &:nth-child(15) {
  1438. left: calc(-6px * 15);
  1439. }
  1440. &:nth-child(16) {
  1441. left: calc(-6px * 16);
  1442. }
  1443. &:nth-child(17) {
  1444. left: calc(-6px * 17);
  1445. }
  1446. &:nth-child(18) {
  1447. left: calc(-6px * 18);
  1448. }
  1449. &:nth-child(19) {
  1450. left: calc(-6px * 19);
  1451. }
  1452. &:first-child {
  1453. clip-path: polygon(0 0, 10px 50%, 0 100%, 100% 100%, calc(100% - 10px) 50%, 100% 0);
  1454. }
  1455. }
  1456. .device-active {
  1457. background: linear-gradient(45deg, #04e6fb, #0c5cab);
  1458. &::before {
  1459. border-color: #0efcff;
  1460. box-shadow: 1px 1px 3px 1px #0efcff inset;
  1461. }
  1462. }
  1463. }
  1464. .table-hide-icon {
  1465. color: #fff;
  1466. cursor: pointer;
  1467. position: absolute;
  1468. right: 20px;
  1469. top: 10px;
  1470. z-index: 9999;
  1471. }
  1472. .enter-detail {
  1473. color: #fff;
  1474. cursor: pointer;
  1475. position: absolute;
  1476. right: 35px;
  1477. top: 35px;
  1478. padding: 5px;
  1479. border-radius: 5px;
  1480. margin-left: 8px;
  1481. margin-right: 8px;
  1482. width: auto;
  1483. height: 33px !important;
  1484. display: flex;
  1485. align-items: center;
  1486. justify-content: center;
  1487. color: #fff;
  1488. padding: 5px 15px 5px 15px;
  1489. z-index: 999;
  1490. cursor: pointer;
  1491. &:hover {
  1492. background: linear-gradient(#2cd1ff55, #1eb0ff55);
  1493. }
  1494. &::before {
  1495. width: calc(100% - 6px);
  1496. height: 27px;
  1497. content: '';
  1498. position: absolute;
  1499. top: 3px;
  1500. right: 0;
  1501. left: 3px;
  1502. bottom: 0;
  1503. z-index: -1;
  1504. border-radius: inherit;
  1505. /*important*/
  1506. background: linear-gradient(#1fa6cb, #127cb5);
  1507. }
  1508. }
  1509. }
  1510. .table-hide {
  1511. height: 0px;
  1512. animation-name: tableHide;
  1513. /* 持续时间 */
  1514. animation-duration: 1s;
  1515. transition: all 1s;
  1516. }
  1517. .table-show {
  1518. height: 290px;
  1519. animation-name: tableShow;
  1520. /* 持续时间 */
  1521. animation-duration: 1s;
  1522. transition: all 1s;
  1523. }
  1524. .location-form {
  1525. display: flex;
  1526. margin: 8px;
  1527. .location-form-item {
  1528. width: 400px;
  1529. .location-form-label {
  1530. width: 100px;
  1531. display: inline-block;
  1532. color: #fff;
  1533. }
  1534. input {
  1535. background: transparent !important;
  1536. color: #fff;
  1537. border: 1px solid #3ad8ff77 !important;
  1538. }
  1539. }
  1540. .zxm-select-selector {
  1541. width: 200px !important;
  1542. }
  1543. }
  1544. @keyframes tableShow {
  1545. 0% {
  1546. height: 0px;
  1547. opacity: 0;
  1548. }
  1549. 100% {
  1550. height: 290px;
  1551. opacity: 1;
  1552. }
  1553. }
  1554. @keyframes tableHide {
  1555. 0% {
  1556. opacity: 1;
  1557. }
  1558. 100% {
  1559. height: 0px;
  1560. opacity: 0;
  1561. }
  1562. }
  1563. @keyframes treeShow {
  1564. 0% {
  1565. left: -400px;
  1566. opacity: 0;
  1567. }
  1568. 100% {
  1569. left: 10px;
  1570. opacity: 1;
  1571. }
  1572. }
  1573. @keyframes treeHide {
  1574. 0% {
  1575. left: 10px;
  1576. opacity: 1;
  1577. }
  1578. 100% {
  1579. left: -400px;
  1580. opacity: 0;
  1581. }
  1582. }
  1583. @keyframes locationShow {
  1584. 0% {
  1585. right: 0px;
  1586. opacity: 0;
  1587. }
  1588. 100% {
  1589. right: 240px;
  1590. opacity: 1;
  1591. }
  1592. }
  1593. @keyframes locationHide {
  1594. 0% {
  1595. right: 240px;
  1596. opacity: 1;
  1597. }
  1598. 100% {
  1599. right: 0;
  1600. opacity: 0;
  1601. }
  1602. }
  1603. @keyframes locationBtnShow {
  1604. 0% {
  1605. right: -240px;
  1606. opacity: 0;
  1607. }
  1608. 100% {
  1609. right: -2px;
  1610. opacity: 1;
  1611. }
  1612. }
  1613. @keyframes locationBtnHide {
  1614. 0% {
  1615. right: -2px;
  1616. opacity: 1;
  1617. }
  1618. 100% {
  1619. right: -240px;
  1620. opacity: 0;
  1621. }
  1622. }
  1623. :deep(.@{ventSpace}-tabs-tabpane-active) {
  1624. // overflow: auto;
  1625. height: 100%;
  1626. }
  1627. :deep(.zxm-select-dropdown) {
  1628. left: 0 !important;
  1629. color: #000000 !important;
  1630. }
  1631. :deep(.zxm-select-selector) {
  1632. height: 34px !important;
  1633. line-height: 34px !important;
  1634. }
  1635. :deep(.zxm-input) {
  1636. height: 32px !important;
  1637. line-height: 32px !important;
  1638. .zxm-select-selection-item {
  1639. line-height: 32px !important;
  1640. }
  1641. }
  1642. // :deep(.@{ventSpace}-pagination){
  1643. // margin-right: 20px !important;
  1644. // margin-top: 5px !important;
  1645. // display: flex;
  1646. // align-items: center;
  1647. // }</style>