index.vue 59 KB

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