index.vue 57 KB

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