index.vue 57 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714
  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="/ventanaly-device/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">
  313. <template v-if="activeKey == '2' && 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. activeKey.value = '1';
  482. // if (e.node.children?.length < 1 && timer) {
  483. // getMonitor(true);
  484. // }
  485. }, 1000);
  486. }
  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. if (record) {
  718. activeID.value = record.deviceID;
  719. if (deviceType.value.startsWith('fiber')) {
  720. currentModal.value = FiberModal;
  721. modalVisible.value = true;
  722. } else if (deviceType.value.startsWith('dusting')) {
  723. currentModal.value = DustModal;
  724. modalVisible.value = true;
  725. } else if (deviceType.value.startsWith('bundletube')) {
  726. currentModal.value = BundleModal;
  727. modalVisible.value = true;
  728. } else if (deviceType.value.startsWith('firemon_normal')) {
  729. // currentModal.value = BundleModal;
  730. currentModal.value = WisdomBallModal;
  731. modalVisible.value = true;
  732. } else if (deviceType.value.startsWith('ballvalve')) {
  733. currentModal.value = BallvalveModal;
  734. modalVisible.value = true;
  735. } else if (deviceType.value.startsWith('atomizing')) {
  736. currentModal.value = AtomizingModal;
  737. modalVisible.value = true;
  738. } else if (deviceType.value.startsWith('gaspatrol')) {
  739. currentModal.value = GaspatrolModal;
  740. modalVisible.value = true;
  741. } else if (deviceType.value.indexOf('gate') != -1) {
  742. const newPage = router.resolve({ path: '/monitorChannel/monitor-gate', query: { id: activeID.value, deviceType: deviceType.value } });
  743. window.open(newPage.href, '_blank');
  744. } else if (deviceType.value.indexOf('window') != -1) {
  745. const newPage = router.resolve({ path: '/monitorChannel/monitor-window', query: { id: activeID.value, deviceType: deviceType.value } });
  746. window.open(newPage.href, '_blank');
  747. } else if (deviceType.value.indexOf('windrect') != -1) {
  748. const newPage = router.resolve({ path: '/monitorChannel/monitor-windrect', query: { id: activeID.value, deviceType: deviceType.value } });
  749. window.open(newPage.href, '_blank');
  750. } else if (deviceType.value.indexOf('fanmain') != -1) {
  751. const newPage = router.resolve({ path: '/monitorChannel/monitor-fanmain', query: { id: activeID.value, deviceType: deviceType.value } });
  752. window.open(newPage.href, '_blank');
  753. } else if (deviceType.value.indexOf('fanlocal') != -1) {
  754. const newPage = router.resolve({ path: '/monitorChannel/monitor-fanlocal', query: { id: activeID.value, deviceType: deviceType.value } });
  755. window.open(newPage.href, '_blank');
  756. } else if (deviceType.value.indexOf('pulping') != -1) {
  757. const newPage = router.resolve({ path: '/grout-home', query: { id: activeID.value } });
  758. window.open(newPage.href, '_blank');
  759. } else if (deviceType.value.indexOf('pressurefan') != -1) {
  760. const newPage = router.resolve({ path: '/nitrogen/home', query: { id: activeID.value } });
  761. window.open(newPage.href, '_blank');
  762. } else if (deviceType.value.indexOf('chamber') != -1) {
  763. const newPage = router.resolve({ path: '/chamber-home', query: { id: activeID.value } });
  764. window.open(newPage.href, '_blank');
  765. } else if (deviceType.value.indexOf('safetymonitor') != -1) {
  766. const newPage = router.resolve({ path: '/monitorChannel/device-monitor/safetymonitor', query: { id: activeID.value } });
  767. window.open(newPage.href, '_blank');
  768. } else if (deviceType.value.indexOf('pump') != -1) {
  769. const newPage = router.resolve({ path: '/monitorChannel/gasPump-home', query: { id: activeID.value } });
  770. window.open(newPage.href, '_blank');
  771. } else if (systemType.value.indexOf('nitrogen') != -1) {
  772. const newPage = router.resolve({ path: '/nitrogen-home', query: { id: systemID.value } });
  773. window.open(newPage.href, '_blank');
  774. }else if (deviceType.value.indexOf('forcFan') != -1) {
  775. const newPage = router.resolve({ path: '/forcFan/home', query: { id: activeID.value } });
  776. window.open(newPage.href, '_blank');
  777. } else if (deviceType.value.indexOf('pulping') != -1) {
  778. const newPage = router.resolve({ path: '/grout-home', query: { id: activeID.value } });
  779. window.open(newPage.href, '_blank');
  780. } else {
  781. message.info('待开发。。。');
  782. }
  783. } else {
  784. if (systemType.value.indexOf('sys_dongshi') != -1) {
  785. const newPage = router.resolve({ path: '/chamber-home', query: { id: systemID.value } });
  786. window.open(newPage.href, '_blank');
  787. } else if (systemType.value.indexOf('sys_obfurage') != -1) {
  788. const newPage = router.resolve({ path: '/monitorChannel/obfurage-home', query: { id: systemID.value } });
  789. window.open(newPage.href, '_blank');
  790. } else if (systemType.value.indexOf('sys_surface_caimei') != -1) {
  791. const newPage = router.resolve({ path: '/monitorChannel/wokerFace-home', query: { id: systemID.value } });
  792. window.open(newPage.href, '_blank');
  793. } else if (systemType.value.indexOf('sys_surface_juejin') != -1) {
  794. const newPage = router.resolve({ path: '/monitorChannel/tunFace-home', query: { id: systemID.value } });
  795. window.open(newPage.href, '_blank');
  796. } else if (systemType.value.indexOf('sys_maintunnel_leather') != -1) {
  797. const newPage = router.resolve({ path: '/monitorChannel/beltTun-home', query: { id: systemID.value } });
  798. window.open(newPage.href, '_blank');
  799. } else if (systemType.value.indexOf('sys_surface_junya') != -1) {
  800. const newPage = router.resolve({ path: '/monitorChannel/balancePress-home', query: { id: systemID.value } });
  801. window.open(newPage.href, '_blank');
  802. } else if (systemType.value.indexOf('sys_nitrogen') != -1) {
  803. const newPage = router.resolve({ path: '/nitrogen-home', query: { id: systemID.value } });
  804. window.open(newPage.href, '_blank');
  805. } else if (deviceType.value.indexOf('forcFan') != -1) {
  806. const newPage = router.resolve({ path: '/forcFan/home', query: { id: activeID.value } });
  807. window.open(newPage.href, '_blank');
  808. } else if (deviceType.value.indexOf('pulping') != -1) {
  809. const newPage = router.resolve({ path: '/grout-home', query: { id: systemID.value } });
  810. window.open(newPage.href, '_blank');
  811. } else {
  812. message.info('待开发。。。');
  813. }
  814. }
  815. }
  816. function exportXls() {
  817. handleExportXls('瓦斯巡检记录', getExportUrl, { devicetype: deviceType.value });
  818. }
  819. function toHome() {
  820. deviceList.value = [];
  821. if (timer) clearTimeout(timer);
  822. timer = undefined;
  823. deviceType.value = '';
  824. go(glob.homePath);
  825. }
  826. function toHide() {
  827. tableShow.value = !tableShow.value;
  828. document.getElementById('monitorBox').addEventListener('animationend', () => {
  829. if (!tableShow.value) {
  830. document.getElementById('monitorBox').style.height = '0px';
  831. } else {
  832. document.getElementById('monitorBox').style.height = '290px';
  833. }
  834. });
  835. }
  836. async function findTreeDataValue(obj) {
  837. const findDeviceType = (data: any[], obj, flag = true) => {
  838. return data.find((item: any) => {
  839. if (item.children.length > 0) {
  840. findDeviceType(item.children, obj);
  841. }
  842. if (obj.deviceType && obj.deviceType.startsWith('sys_')) {
  843. if (item.type == obj.deviceid) {
  844. deviceType.value = 'sys';
  845. systemID.value = obj.deviceid;
  846. selectedKeys.value = [item.key];
  847. expandedKeys.value = [item.key];
  848. treeNodeTitle.value = item.title;
  849. }
  850. } else {
  851. if (!flag) {
  852. if (obj.deviceType && item.type.startsWith(obj.deviceType)) {
  853. deviceType.value = item.type;
  854. selectedKeys.value = [item.key];
  855. expandedKeys.value = [item.key];
  856. treeNodeTitle.value = item.title;
  857. return true;
  858. }
  859. return false;
  860. } else {
  861. if (obj.deviceType && item.type == obj.deviceType) {
  862. deviceType.value = item.type;
  863. selectedKeys.value = [item.key];
  864. expandedKeys.value = [item.key];
  865. treeNodeTitle.value = item.title;
  866. return true;
  867. }
  868. return false;
  869. }
  870. }
  871. return false;
  872. });
  873. };
  874. const flag = findDeviceType(treeData.value, obj);
  875. if (!flag) {
  876. findDeviceType(treeData.value, obj, false);
  877. }
  878. // 无类型时
  879. if (!treeNodeTitle.value && treeData.value && treeData.value[0] && treeData.value[0]['children']) {
  880. const defaultData = treeData.value[0]['children'][0];
  881. if (deviceType.value !== defaultData.type) deviceType.value = defaultData.type;
  882. selectedKeys.value = [defaultData.key as string];
  883. expandedKeys.value = [defaultData.key as string];
  884. treeNodeTitle.value = defaultData.title;
  885. }
  886. if (timer === undefined) {
  887. timer = null;
  888. await getDataSource();
  889. getMonitor(true);
  890. }
  891. }
  892. function monitorChange(index) {
  893. dataSource.value = [];
  894. deviceActive.value = deviceList.value[index].deviceType;
  895. if (deviceType.value != deviceActive.value) deviceType.value = deviceActive.value;
  896. if (activeKey.value == '1' && monitorTable.value) {
  897. monitorTable.value.setLoading(true);
  898. dataSource.value = deviceList.value[index].datalist;
  899. }
  900. if (activeKey.value == '2' && historyTable.value) {
  901. historyTable.value.setLoading(true);
  902. }
  903. if (activeKey.value == '3' && alarmHistoryTable.value) {
  904. alarmHistoryTable.value.setLoading(true);
  905. }
  906. if (activeKey.value == '4' && handlerHistoryTable.value) {
  907. handlerHistoryTable.value.setLoading(true);
  908. }
  909. }
  910. /**
  911. * 设置巷道设备定位图标的显示与隐藏
  912. */
  913. function setLocation() {
  914. let locationStr = '';
  915. locationList.value.forEach((item: any) => {
  916. if (item.Visible) {
  917. locationStr = locationStr ? locationStr + ',' + item.value : item.value;
  918. }
  919. });
  920. actions.setGlobalState({ locationId: null, locationObj: null, pageObj: null, locationPlane: locationStr });
  921. setTimeout(() => {
  922. message.success('设置成功');
  923. }, 600);
  924. }
  925. // function clearMonitor() {
  926. // clearTimeout(timer);
  927. // timer = undefined;
  928. // if (startMonitorTimer) {
  929. // clearTimeout(startMonitorTimer);
  930. // }
  931. // dataSource.value = [];
  932. // startMonitorTimer = setTimeout(() => {
  933. // expandedKeys.value = keys;
  934. // selectedKeys.value = keys;
  935. // treeNodeTitle.value = e.node.title;
  936. // activeKey.value = '1';
  937. // timer = null;
  938. // if (e.node.children?.length < 1) {
  939. // getMonitor(true);
  940. // }
  941. // }, 1000);
  942. // }show
  943. watch(
  944. () => props.pageData,
  945. async (pageObj) => {
  946. isRefresh.value = false;
  947. if (!treeData.value || treeData.value?.length < 1) {
  948. await getDeviceType();
  949. }
  950. nextTick(() => {
  951. isRefresh.value = true;
  952. findTreeDataValue(pageObj);
  953. });
  954. },
  955. { immediate: true }
  956. );
  957. onMounted(async () => {
  958. const pageObj = props.pageData;
  959. if (!pageObj) return;
  960. if (pageObj.deviceid) {
  961. await getDeviceType();
  962. findTreeDataValue({ deviceid: pageObj.deviceid });
  963. } else {
  964. if (pageObj && pageObj.pageType && pageObj.pageType.startsWith('sys_')) {
  965. await getDeviceType(pageObj.pageType);
  966. findTreeDataValue({ deviceid: systemID.value });
  967. } else {
  968. await getDeviceType();
  969. findTreeDataValue({ deviceType: pageObj.pageType });
  970. }
  971. }
  972. // 定位
  973. const posShowData = pageObj.locationPlane;
  974. if (posShowData) {
  975. locationList.value = posShowData;
  976. } else {
  977. locationList.value = await devPosition({});
  978. }
  979. // safetyOption.value = await safetyDeviceList(null, { devicetype: 'safetymonitor', code: 'dataTypeName' })
  980. });
  981. onUnmounted(() => {
  982. if (timer) {
  983. clearTimeout(timer);
  984. }
  985. timer = undefined;
  986. });
  987. </script>
  988. <style lang="less" scoped>
  989. @import '/@/design/vent/modal.less';
  990. @ventSpace: zxm;
  991. .top-header {
  992. position: fixed;
  993. width: 100%;
  994. height: 56px;
  995. background: url('/@/assets/images/vent/home/modal-top.png');
  996. text-align: center;
  997. line-height: 56px;
  998. font-size: 28px;
  999. color: #ffffffdd;
  1000. font-weight: 600;
  1001. z-index: 1;
  1002. letter-spacing: 2px;
  1003. font-size: 30px;
  1004. }
  1005. .select-node {
  1006. position: fixed;
  1007. top: 100px;
  1008. left: 10px;
  1009. color: #fff;
  1010. display: flex;
  1011. justify-content: center;
  1012. font-size: 22px;
  1013. .title {
  1014. margin-left: 10px;
  1015. }
  1016. }
  1017. .expansion-icon {
  1018. background: url('/@/assets/images/vent/home/tree-icon-bg.png') no-repeat;
  1019. background-size: contain;
  1020. position: absolute;
  1021. left: 190px;
  1022. top: 25px;
  1023. &:hover {
  1024. background: url('/@/assets/images/vent/home/tree-icon-hover-bg.png') no-repeat;
  1025. background-size: contain;
  1026. }
  1027. }
  1028. .device-select {
  1029. width: 250px;
  1030. height: 500px;
  1031. background: url('/@/assets/images/vent/home/tree-bg.png') no-repeat;
  1032. position: fixed;
  1033. top: 100px;
  1034. left: 10px;
  1035. background-size: contain;
  1036. pointer-events: auto;
  1037. padding: 20px 10px 30px 10px;
  1038. }
  1039. .is-expansion-icon {
  1040. padding: 5px;
  1041. pointer-events: auto;
  1042. z-index: 999;
  1043. }
  1044. .device-select-show {
  1045. left: 10px;
  1046. animation-name: treeShow;
  1047. /* 持续时间 */
  1048. animation-duration: 1s;
  1049. transition: all 1s cubic-bezier(0.165, 0.84, 0.44, 1) 0.5s;
  1050. }
  1051. .device-select-hide {
  1052. left: -250px;
  1053. animation-name: treeHide;
  1054. /* 持续时间 */
  1055. animation-duration: 1s;
  1056. transition: all 1s cubic-bezier(0.165, 0.84, 0.44, 1) 0.5s;
  1057. }
  1058. .node-select-show {
  1059. width: 276px;
  1060. height: 44px;
  1061. background: url('/@/assets/images/vent/home/tree-expansion-bg.png') no-repeat;
  1062. left: 10px;
  1063. animation-name: treeShow;
  1064. /* 持续时间 */
  1065. animation-duration: 1s;
  1066. transition: all 1s cubic-bezier(0.165, 0.84, 0.44, 1) 0.5s;
  1067. display: flex;
  1068. align-items: center;
  1069. margin-left: 0;
  1070. justify-content: flex-start;
  1071. pointer-events: auto;
  1072. &:hover {
  1073. background: url('/@/assets/images/vent/home/tree-expansion-hover-bg.png') no-repeat;
  1074. }
  1075. .put-away-icon {
  1076. position: relative;
  1077. display: inline-block;
  1078. left: 4px;
  1079. }
  1080. }
  1081. .node-select-hide {
  1082. left: -400px;
  1083. animation-name: treeHide;
  1084. /* 持续时间 */
  1085. animation-duration: 1s;
  1086. transition: all 1s cubic-bezier(0.165, 0.84, 0.44, 1) 0.5s;
  1087. }
  1088. .device-select-box {
  1089. width: 208px;
  1090. height: 450px;
  1091. overflow-y: auto;
  1092. color: #fff;
  1093. :deep(.zxm-tree) {
  1094. background: transparent !important;
  1095. color: #fff !important;
  1096. .zxm-tree-switcher {
  1097. background: transparent !important;
  1098. }
  1099. .zxm-tree-node-content-wrapper.zxm-tree-node-selected {
  1100. background-color: #00b1c8;
  1101. }
  1102. .zxm-tree-node-content-wrapper:hover {
  1103. background-color: #00b1c855;
  1104. }
  1105. input {
  1106. height: 0px !important;
  1107. }
  1108. }
  1109. &::-webkit-scrollbar-track {
  1110. -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  1111. border-radius: 10px;
  1112. background: #ededed22;
  1113. height: 100px;
  1114. }
  1115. &::-webkit-scrollbar-thumb {
  1116. -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  1117. background: #4288a444;
  1118. }
  1119. }
  1120. .location-icon {
  1121. width: 46px;
  1122. height: 178px;
  1123. position: absolute;
  1124. top: 100px;
  1125. // right: 0;
  1126. background: url('/@/assets/images/vent/home/location-bg.png') no-repeat;
  1127. background-size: contain;
  1128. writing-mode: vertical-lr;
  1129. line-height: 46px;
  1130. color: #fff;
  1131. padding-top: 10px;
  1132. pointer-events: auto;
  1133. cursor: pointer;
  1134. &:hover {
  1135. background: url('/@/assets/images/vent/home/location-hover-bg.png') no-repeat;
  1136. }
  1137. .location-text {
  1138. padding-top: 20px;
  1139. letter-spacing: 3px;
  1140. font-size: 16px;
  1141. }
  1142. }
  1143. .location-select {
  1144. position: fixed;
  1145. top: 100px;
  1146. // right: 240px;
  1147. pointer-events: auto;
  1148. .location-select-box {
  1149. width: 100%;
  1150. height: 100%;
  1151. position: relative;
  1152. &::before {
  1153. content: '';
  1154. position: absolute;
  1155. width: 230px;
  1156. height: 500px;
  1157. top: 0;
  1158. left: 0;
  1159. background: url('/@/assets/images/vent/home/tree-bg.png') no-repeat;
  1160. background-size: contain;
  1161. transform: rotateY(180deg);
  1162. z-index: -1;
  1163. // &:hover {
  1164. // background: url('/@/assets/images/vent/home/tree-icon-hover-bg.png') no-repeat;
  1165. // background-size: contain;
  1166. // }
  1167. }
  1168. .location-top-title {
  1169. color: #fff;
  1170. position: absolute;
  1171. width: 225px;
  1172. height: 68px;
  1173. background: url('/@/assets/images/vent/home/turn-location-top-bg.png') no-repeat;
  1174. background-size: contain;
  1175. top: 5px;
  1176. left: 5px;
  1177. display: flex;
  1178. flex-direction: row;
  1179. justify-content: space-between;
  1180. align-items: flex-end;
  1181. .title {
  1182. font-size: 18px;
  1183. position: relative;
  1184. top: -14px;
  1185. right: 15px;
  1186. }
  1187. }
  1188. .location-expansion-icon {
  1189. background: url('/@/assets/images/vent/home/tree-icon-cover-bg.png') no-repeat;
  1190. background-size: contain;
  1191. position: relative;
  1192. left: 10px;
  1193. top: -15px;
  1194. padding: 5px;
  1195. &:hover {
  1196. background: url('/@/assets/images/vent/home/tree-icon-cover-hover-bg.png') no-repeat;
  1197. background-size: contain;
  1198. }
  1199. }
  1200. }
  1201. .location-container {
  1202. width: 200px;
  1203. height: 390px;
  1204. position: absolute;
  1205. display: flex;
  1206. flex-direction: column;
  1207. top: 80px;
  1208. left: 18px;
  1209. overflow-y: auto;
  1210. .location-item {
  1211. color: #fff;
  1212. line-height: 30px;
  1213. display: flex;
  1214. justify-content: space-between;
  1215. background-image: linear-gradient(to left, #39f5ff05, #39f5ff10);
  1216. margin: 3px 0;
  1217. .item-title {
  1218. width: 80px;
  1219. text-align: right;
  1220. color: #87f1ff;
  1221. }
  1222. }
  1223. .location-bottom-btn {
  1224. width: 100%;
  1225. color: #fff;
  1226. display: flex;
  1227. justify-content: flex-end;
  1228. margin-top: 20px;
  1229. span {
  1230. display: inline-block;
  1231. width: 100%;
  1232. background: #00709955;
  1233. border-radius: 3px;
  1234. border: 1px solid rgba(174, 243, 255, 0.3);
  1235. text-align: center;
  1236. padding: 2px 0;
  1237. cursor: pointer;
  1238. &:hover {
  1239. background: #00557422;
  1240. }
  1241. }
  1242. }
  1243. }
  1244. }
  1245. .location-select-show {
  1246. right: 240px;
  1247. animation-name: locationShow;
  1248. /* 持续时间 */
  1249. animation-duration: 1s;
  1250. transition: all 1s cubic-bezier(0.165, 0.84, 0.44, 1) 0.5s;
  1251. }
  1252. .location-select-hide {
  1253. right: -2px;
  1254. animation-name: locationHide;
  1255. /* 持续时间 */
  1256. animation-duration: 1s;
  1257. transition: all 1s cubic-bezier(0.165, 0.84, 0.44, 1) 0.5s;
  1258. }
  1259. .location-btn-show {
  1260. right: -0px;
  1261. animation-name: locationBtnShow;
  1262. /* 持续时间 */
  1263. animation-duration: 1s;
  1264. transition: all 1s cubic-bezier(0.165, 0.84, 0.44, 1) 0.5s;
  1265. }
  1266. .location-btn-hide {
  1267. right: -240px;
  1268. animation-name: locationBtnHide;
  1269. /* 持续时间 */
  1270. animation-duration: 1s;
  1271. transition: all 1s cubic-bezier(0.165, 0.84, 0.44, 1) 0.5s;
  1272. }
  1273. .tabs-box {
  1274. height: 290px;
  1275. }
  1276. .bottom-tabs-box {
  1277. position: relative;
  1278. .tabs-box {
  1279. width: calc(100% - 12px) !important;
  1280. bottom: 3px !important;
  1281. }
  1282. .to-small {
  1283. position: absolute;
  1284. top: -65px;
  1285. right: 36px;
  1286. display: flex;
  1287. align-items: center;
  1288. justify-content: center;
  1289. .to-home {
  1290. width: 60px;
  1291. height: 60px;
  1292. background: url('/@/assets/images/vent/home/tohome.png') no-repeat center;
  1293. background-size: auto;
  1294. padding: 8px;
  1295. &:hover {
  1296. background-color: rgba(79, 104, 134, 0.418);
  1297. }
  1298. }
  1299. .table-show-icon {
  1300. width: 30px;
  1301. height: 30px;
  1302. font-size: 30px;
  1303. color: #fff;
  1304. margin-left: 10px;
  1305. }
  1306. }
  1307. .device-button-group {
  1308. position: absolute;
  1309. top: -30px;
  1310. display: flex;
  1311. width: 100%;
  1312. .device-button {
  1313. height: 26px;
  1314. padding: 0 20px;
  1315. background: linear-gradient(45deg, #04e6fb55, #0c5cab55);
  1316. clip-path: polygon(10px 0, 0 50%, 10px 100%, 100% 100%, calc(100% - 10px) 50%, 100% 0);
  1317. display: flex;
  1318. justify-content: center;
  1319. align-items: center;
  1320. color: #fff;
  1321. position: relative;
  1322. cursor: pointer;
  1323. &:nth-child(1) {
  1324. left: calc(-6px * 1);
  1325. }
  1326. &:nth-child(2) {
  1327. left: calc(-6px * 2);
  1328. }
  1329. &:nth-child(3) {
  1330. left: calc(-6px * 3);
  1331. }
  1332. &:nth-child(4) {
  1333. left: calc(-6px * 4);
  1334. }
  1335. &:nth-child(5) {
  1336. left: calc(-6px * 5);
  1337. }
  1338. &:nth-child(6) {
  1339. left: calc(-6px * 6);
  1340. }
  1341. &:nth-child(7) {
  1342. left: calc(-6px * 7);
  1343. }
  1344. &:nth-child(8) {
  1345. left: calc(-6px * 8);
  1346. }
  1347. &:nth-child(9) {
  1348. left: calc(-6px * 9);
  1349. }
  1350. &:nth-child(10) {
  1351. left: calc(-6px * 10);
  1352. }
  1353. &:nth-child(11) {
  1354. left: calc(-6px * 11);
  1355. }
  1356. &:nth-child(12) {
  1357. left: calc(-6px * 12);
  1358. }
  1359. &:nth-child(13) {
  1360. left: calc(-6px * 13);
  1361. }
  1362. &:nth-child(14) {
  1363. left: calc(-6px * 14);
  1364. }
  1365. &:nth-child(15) {
  1366. left: calc(-6px * 15);
  1367. }
  1368. &:nth-child(16) {
  1369. left: calc(-6px * 16);
  1370. }
  1371. &:nth-child(17) {
  1372. left: calc(-6px * 17);
  1373. }
  1374. &:nth-child(18) {
  1375. left: calc(-6px * 18);
  1376. }
  1377. &:nth-child(19) {
  1378. left: calc(-6px * 19);
  1379. }
  1380. &:first-child {
  1381. clip-path: polygon(0 0, 10px 50%, 0 100%, 100% 100%, calc(100% - 10px) 50%, 100% 0);
  1382. }
  1383. }
  1384. .device-active {
  1385. background: linear-gradient(45deg, #04e6fb, #0c5cab);
  1386. &::before {
  1387. border-color: #0efcff;
  1388. box-shadow: 1px 1px 3px 1px #0efcff inset;
  1389. }
  1390. }
  1391. }
  1392. .table-hide-icon {
  1393. color: #fff;
  1394. cursor: pointer;
  1395. position: absolute;
  1396. right: 20px;
  1397. top: 10px;
  1398. z-index: 9999;
  1399. }
  1400. .enter-detail {
  1401. color: #fff;
  1402. cursor: pointer;
  1403. position: absolute;
  1404. right: 20px;
  1405. top: 35px;
  1406. padding: 5px;
  1407. border-radius: 5px;
  1408. margin-left: 8px;
  1409. margin-right: 8px;
  1410. width: auto;
  1411. height: 33px !important;
  1412. display: flex;
  1413. align-items: center;
  1414. justify-content: center;
  1415. color: #fff;
  1416. padding: 5px 15px 5px 15px;
  1417. z-index: 999;
  1418. cursor: pointer;
  1419. &:hover {
  1420. background: linear-gradient(#2cd1ff55, #1eb0ff55);
  1421. }
  1422. &::before {
  1423. width: calc(100% - 6px);
  1424. height: 27px;
  1425. content: '';
  1426. position: absolute;
  1427. top: 3px;
  1428. right: 0;
  1429. left: 3px;
  1430. bottom: 0;
  1431. z-index: -1;
  1432. border-radius: inherit;
  1433. /*important*/
  1434. background: linear-gradient(#1fa6cb, #127cb5);
  1435. }
  1436. }
  1437. }
  1438. .table-hide {
  1439. height: 0px;
  1440. animation-name: tableHide;
  1441. /* 持续时间 */
  1442. animation-duration: 1s;
  1443. transition: all 1s;
  1444. }
  1445. .table-show {
  1446. height: 290px;
  1447. animation-name: tableShow;
  1448. /* 持续时间 */
  1449. animation-duration: 1s;
  1450. transition: all 1s;
  1451. }
  1452. .location-form {
  1453. display: flex;
  1454. margin: 8px;
  1455. .location-form-item {
  1456. width: 400px;
  1457. .location-form-label {
  1458. width: 100px;
  1459. display: inline-block;
  1460. color: #fff;
  1461. }
  1462. input {
  1463. background: transparent !important;
  1464. color: #fff;
  1465. border: 1px solid #3ad8ff77 !important;
  1466. }
  1467. }
  1468. .zxm-select-selector {
  1469. width: 200px !important;
  1470. }
  1471. }
  1472. @keyframes tableShow {
  1473. 0% {
  1474. height: 0px;
  1475. opacity: 0;
  1476. }
  1477. 100% {
  1478. height: 290px;
  1479. opacity: 1;
  1480. }
  1481. }
  1482. @keyframes tableHide {
  1483. 0% {
  1484. opacity: 1;
  1485. }
  1486. 100% {
  1487. height: 0px;
  1488. opacity: 0;
  1489. }
  1490. }
  1491. @keyframes treeShow {
  1492. 0% {
  1493. left: -400px;
  1494. opacity: 0;
  1495. }
  1496. 100% {
  1497. left: 10px;
  1498. opacity: 1;
  1499. }
  1500. }
  1501. @keyframes treeHide {
  1502. 0% {
  1503. left: 10px;
  1504. opacity: 1;
  1505. }
  1506. 100% {
  1507. left: -400px;
  1508. opacity: 0;
  1509. }
  1510. }
  1511. @keyframes locationShow {
  1512. 0% {
  1513. right: 0px;
  1514. opacity: 0;
  1515. }
  1516. 100% {
  1517. right: 240px;
  1518. opacity: 1;
  1519. }
  1520. }
  1521. @keyframes locationHide {
  1522. 0% {
  1523. right: 240px;
  1524. opacity: 1;
  1525. }
  1526. 100% {
  1527. right: 0;
  1528. opacity: 0;
  1529. }
  1530. }
  1531. @keyframes locationBtnShow {
  1532. 0% {
  1533. right: -240px;
  1534. opacity: 0;
  1535. }
  1536. 100% {
  1537. right: -2px;
  1538. opacity: 1;
  1539. }
  1540. }
  1541. @keyframes locationBtnHide {
  1542. 0% {
  1543. right: -2px;
  1544. opacity: 1;
  1545. }
  1546. 100% {
  1547. right: -240px;
  1548. opacity: 0;
  1549. }
  1550. }
  1551. :deep(.@{ventSpace}-tabs-tabpane-active) {
  1552. // overflow: auto;
  1553. height: 100%;
  1554. }
  1555. :deep(.zxm-select-dropdown) {
  1556. left: 0 !important;
  1557. color: #000000 !important;
  1558. }
  1559. :deep(.zxm-select-selector) {
  1560. height: 34px !important;
  1561. line-height: 34px !important;
  1562. }
  1563. :deep(.zxm-input) {
  1564. height: 32px !important;
  1565. line-height: 32px !important;
  1566. .zxm-select-selection-item {
  1567. line-height: 32px !important;
  1568. }
  1569. }
  1570. // :deep(.@{ventSpace}-pagination){
  1571. // margin-right: 20px !important;
  1572. // margin-top: 5px !important;
  1573. // display: flex;
  1574. // align-items: center;
  1575. // }</style>