index.vue 39 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229
  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" @click="showTree('treeShow', false)" />
  11. <div class="device-select-box">
  12. <a-tree :show-line="true" :tree-data="treeData" v-model:selectedKeys="selectedKeys" :autoExpandParent="true"
  13. v-model:expandedKeys="expandedKeys" @select="onSelect">
  14. </a-tree>
  15. </div>
  16. </div>
  17. <div class="location-icon"
  18. :class="{ 'location-btn-show': !locationSettingShow, 'location-btn-hide': locationSettingShow, }"
  19. @click="showTree('location', true)">
  20. <SvgIcon size="18" name="put-away" />
  21. <span class="location-text">定位图标显示</span>
  22. </div>
  23. <div class="location-select"
  24. :class="{ 'location-select-show': locationSettingShow, 'location-select-hide': !locationSettingShow, }">
  25. <div class="location-select-box">
  26. <div class="location-top-title" @click="showTree('location', false)">
  27. <SvgIcon class="is-expansion-icon location-expansion-icon" size="28" name="expansion" />
  28. <div class="title">定位图标显示</div>
  29. </div>
  30. <div class="location-container">
  31. <template v-for="location in locationList" :key="location.deviceType">
  32. <div class="location-item">
  33. <div class="item-title">{{ location.title }}&nbsp;:</div>
  34. <div>
  35. <a-radio-group v-model:value="location.Visible" :name="location.deviceType">
  36. <a-radio :value="1">是</a-radio>
  37. <a-radio :value="0">否</a-radio>
  38. </a-radio-group>
  39. </div>
  40. </div>
  41. </template>
  42. <div class="location-bottom-btn">
  43. <span @click="setLocation">提交</span>
  44. </div>
  45. </div>
  46. </div>
  47. </div>
  48. <div class="bottom-tabs-box" @mousedown="setDivHeight($event, 230, scroll, 125)" id="monitorBox">
  49. <!-- <dv-border-box8 :dur="5" :style="`padding: 5px; height: ${scroll.y + 100}px`" > -->
  50. <div :style="`padding: 5px; height: ${scroll.y + 100}px`">
  51. <div class="to-small" @click="toHome"></div>
  52. <div class="device-button-group" v-if="deviceList.length > 0">
  53. <div class="device-button" :class="{ 'device-active': deviceActive == device.deviceType }"
  54. v-for="(device, index) in deviceList" :key="index" @click="monitorChange(index)">{{ device.deviceName }}</div>
  55. <div class="enter-detail" @click="goDetail()">
  56. <send-outlined />
  57. {{ treeNodeTitle }}详情
  58. </div>
  59. </div>
  60. <div v-else-if="deviceType == 'forcFan'">
  61. <div class="device-button-group">
  62. <div class="enter-detail" @click="goDetail()">
  63. <send-outlined />
  64. {{ treeNodeTitle }}详情
  65. </div>
  66. </div>
  67. </div>
  68. <div style="color: #fff;">{{ deviceType }}</div>
  69. <a-tabs class="tabs-box" v-model:activeKey="activeKey" @change="tabChange" id="tabsBox" v-if="isRefresh">
  70. <a-tab-pane key="1" tab="实时监测">
  71. <template v-if="(deviceType.startsWith('fanlocal') || deviceType.startsWith('fanmain')) && activeKey == '1'">
  72. <GroupMonitorTable ref="MonitorDataTable" :dataSource="dataSource" :columnsType="`${deviceType}_monitor`" :scroll="scroll" :isAction="true" :isShowSelect="false">
  73. <template #action="{ record }">
  74. <TableAction :actions="haveDetailArr.find((item) => deviceType.startsWith(item)) ? [
  75. {
  76. label: '详情',
  77. onClick: goDetail.bind(null, record),
  78. },
  79. {
  80. label: '定位',
  81. onClick: goLocation.bind(null, record),
  82. },
  83. ] : [
  84. {
  85. label: '定位',
  86. onClick: goLocation.bind(null, record),
  87. },
  88. ]" />
  89. </template>
  90. </GroupMonitorTable>
  91. </template>
  92. <template v-else-if="deviceType == 'majorpath' && activeKey == '1'">
  93. <a-table :columns="majorColumns" :data-source="dataSource" bordered :scroll="scroll" :pagination="false">
  94. <template #bodyCell="{ column, record }">
  95. <!-- <template v-if="column.dataIndex === 'operation'">
  96. <a class="action-link" @click="handleOpen(record)">编辑</a>
  97. <a class="action-link vent-margin-l-10" @click="handleDelete(record)">删除</a>
  98. </template>
  99. <template v-if="column.dataIndex === 'operation1'">
  100. <a class="action-link" @click="handleOpen()">新增</a>
  101. </template> -->
  102. </template>
  103. </a-table>
  104. </template>
  105. <template v-else="activeKey == '1'">
  106. <MonitorTable ref="monitorTable" :columnsType="`${deviceType}_monitor`" :dataSource="dataSource"
  107. design-scope="device_monitor" :isShowActionColumn="true" :isShowSelect="false" title="设备监测"
  108. :scroll="{y: scroll.y - 30}">
  109. <template #action="{ record }">
  110. <TableAction :actions="haveDetailArr.find((item) => deviceType.startsWith(item)) ? [
  111. {
  112. label: '详情',
  113. onClick: goDetail.bind(null, record),
  114. },
  115. {
  116. label: '定位',
  117. onClick: goLocation.bind(null, record),
  118. },
  119. ]: [
  120. {
  121. label: '定位',
  122. onClick: goLocation.bind(null, record),
  123. },
  124. ] " />
  125. </template>
  126. <template #filterCell="{ column, record }">
  127. <template v-if="deviceType.startsWith('gate')">
  128. <template v-if="record.frontGateOpenCtrl == 1 || record.frontGateOpenCtrl === true">
  129. <a-tag
  130. v-if="column.dataIndex === 'frontGateOpen' && record.frontGateOpen == 0 && record.frontGateClose == 0"
  131. color="red">正在打开</a-tag>
  132. <a-tag v-else-if="column.dataIndex === 'frontGateOpen'" color="processing">打开</a-tag>
  133. </template>
  134. <template v-else-if="record.frontGateOpenCtrl == 0 || record.frontGateOpenCtrl === false">
  135. <a-tag
  136. v-if="column.dataIndex === 'frontGateOpen' && record.frontGateOpen == 0 && record.frontGateClose == 0"
  137. color="red">正在关闭</a-tag>
  138. <a-tag
  139. v-else-if="column.dataIndex === 'frontGateOpen' && record.frontGateOpen == 0 && record.frontGateClose == 1"
  140. color="default">关闭</a-tag>
  141. <a-tag
  142. v-else-if="column.dataIndex === 'frontGateOpen' && record.frontGateOpen == 1 && record.frontGateClose == 0"
  143. color="default">打开</a-tag>
  144. </template>
  145. <template v-if="record.rearGateOpenCtrl == 1 || record.rearGateOpenCtrl === true">
  146. <a-tag
  147. v-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == 0 && record.rearGateClose == 0"
  148. color="red">正在打开</a-tag>
  149. <a-tag v-else-if="column.dataIndex === 'rearGateOpen'" color="processing">打开</a-tag>
  150. </template>
  151. <template v-else-if="record.rearGateOpenCtrl == 0 || record.rearGateOpenCtrl === false">
  152. <a-tag
  153. v-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == 0 && record.rearGateClose == 0"
  154. color="red">正在关闭</a-tag>
  155. <a-tag
  156. v-else-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == 0 && record.rearGateClose == 1"
  157. color="default">关闭</a-tag>
  158. <a-tag
  159. v-else-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == 1 && record.rearGateClose == 0"
  160. color="default">打开</a-tag>
  161. </template>
  162. </template>
  163. <template v-if="deviceType.startsWith('windrect')">
  164. <a-tag v-if="column.dataIndex === 'sign'"
  165. :color="record.sign == 0 ? '#95CF65' : record.sign == 1 ? '#4590EA' : '#9876AA'"> {{
  166. record.sign == 0 ? '高位' : record.sign == 1 ? '中位' : '低位'
  167. }}</a-tag>
  168. <template v-if="record && column && column.dataIndex === 'isRun' && record.isRun">
  169. <a-tag v-if="record.isRun == -2 || record.isRun == -1"
  170. :color="record.isRun == -2 ? '#95CF65' : '#ED5700'">{{
  171. record.isRun == -2 ? '空闲' : '等待'
  172. }}</a-tag>
  173. <a-tag v-else-if="record.isRun == 100" color="#4693FF">完成</a-tag>
  174. <Progress v-else :percent="Number(record.isRun)" size="small" status="active" />
  175. </template>
  176. </template>
  177. <a-tag v-if="column.dataIndex === 'warnFlag'"
  178. :color="record.warnFlag == 0 ? 'green' : record.warnFlag == 1 ? '#FF5812' : 'gray'"> {{
  179. record.warnFlag == 0 ? '正常' : record.warnFlag == 1 ? '报警' : record.warnFlag == 2 ? '断开' : '未监测'
  180. }}</a-tag>
  181. <template v-if="column.dataIndex === 'warnLevel'">
  182. <a-tag v-if="record.warnLevel == '101'" color="green">蓝色预警</a-tag>
  183. <a-tag v-else-if="record.warnLevel == '102'" color="#FF5812">黄色预警</a-tag>
  184. <a-tag v-else-if="record.warnLevel == '103'" color="#FF5812">橙色预警</a-tag>
  185. <a-tag v-else-if="record.warnLevel == '104'" color="#FF5812">红色预警</a-tag>
  186. <a-tag v-else-if="record.warnLevel == '201'" color="#FF0000">报警</a-tag>
  187. <a-tag v-else-if="record.warnLevel == '10000'" color="#FF5812">数据超限</a-tag>
  188. <a-tag v-else-if="record.warnLevel == '1001'" color="default">网络中断</a-tag>
  189. <a-tag v-else="record.warnLevel == '1001'" color="green">正常</a-tag>
  190. </template>
  191. <a-tag v-if="column.dataIndex === 'netStatus'" :color="record.netStatus == 0 ? 'default' : 'green'">{{
  192. record.netStatus == 0 ? '断开' : '连接'
  193. }}</a-tag>
  194. </template>
  195. </MonitorTable>
  196. </template>
  197. </a-tab-pane>
  198. <a-tab-pane key="2" tab="历史数据">
  199. <div class="tab-item">
  200. <HistoryTable ref="historyTable" v-if="activeKey == '2'" :sysId="systemID" :columns-type="`${deviceType}`"
  201. :device-type="deviceType"
  202. :device-list-api="getDeviceList.bind(null, { devicekind: deviceType, sysId: systemID })"
  203. designScope="device-history" :scroll="scroll" />
  204. </div>
  205. </a-tab-pane>
  206. <a-tab-pane key="3" tab="报警历史" v-if="!noWarningArr.find((item) => deviceType.startsWith(item))">
  207. <div class="tab-item">
  208. <AlarmHistoryTable ref="alarmHistoryTable" v-if="activeKey == '3'" :sysId="systemID" columns-type="alarm"
  209. :device-type="deviceType"
  210. :device-list-api="getDeviceList.bind(null, { devicekind: deviceType, sysId: systemID })" :scroll="scroll"
  211. designScope="alarm-history" />
  212. </div>
  213. </a-tab-pane>
  214. <a-tab-pane key="4" tab="操作历史" v-if="haveHandlerArr.find((item) => deviceType.startsWith(item))">
  215. <div class="tab-item">
  216. <HandlerHistoryTable ref="handlerHistoryTable" v-if="activeKey == '4'" :sysId="systemID"
  217. columns-type="operator_history" :device-type="deviceType"
  218. :device-list-api="getDeviceList.bind(null, { devicekind: deviceType, sysId: systemID })" :scroll="scroll"
  219. designScope="operator-history" />
  220. </div>
  221. </a-tab-pane>
  222. </a-tabs>
  223. <!-- </dv-border-box8> -->
  224. </div>
  225. </div>
  226. <mainPath v-if="deviceType == 'majorpath'" :line-list="dataSource" style="width: 300px; height: 300px; position: absolute; left: 250px;"/>
  227. <component v-if="modalVisible" :is="currentModal" v-model:visible="modalVisible" :dataSource="dataSource"
  228. :activeID="activeID" />
  229. </div>
  230. </template>
  231. <script setup lang="ts">
  232. import { ref, onMounted, onUnmounted, ComponentOptions, shallowRef, reactive, defineProps } from 'vue'
  233. import { SendOutlined } from '@ant-design/icons-vue';
  234. import { list, getDeviceList, getDeviceTypeList } from './device.api'
  235. import AlarmHistoryTable from '../../../comment/AlarmHistoryTable.vue';
  236. import HistoryTable from '../../../comment/HistoryTable.vue';
  237. import HandlerHistoryTable from '../../../comment/HandlerHistoryTable.vue';
  238. import MonitorTable from '../../../comment/MonitorTable.vue';
  239. import GroupMonitorTable from '../../../comment/GroupMonitorTable.vue';
  240. import { TreeProps, message, Progress } from 'ant-design-vue';
  241. import { TableAction } from '/@/components/Table';
  242. import FiberModal from './modal/fiber.modal.vue';
  243. import BundleModal from './modal/bundle.modal.vue'
  244. import DustModal from './modal/dust.modal.vue'
  245. import { SvgIcon } from '/@/components/Icon';
  246. import { getActions } from '/@/qiankun/state';
  247. import { useRouter } from 'vue-router';
  248. import { setDivHeight } from '/@/utils/event';
  249. import { majorColumns, noDetailArr, haveDetailArr, haveHandlerArr, noWarningArr } from './device.data'
  250. import mainPath from './modal/mainPath.vue'
  251. // import { BorderBox8 as DvBorderBox8 } from '@kjgl77/datav-vue3';
  252. type DeviceType = { deviceType: string, deviceName: string, datalist: any[] };
  253. const props = defineProps({
  254. pageData: {
  255. type: Object,
  256. default: () => { }
  257. }
  258. })
  259. const router = useRouter()
  260. const actions = getActions();
  261. // actions.setGlobalState({ pageObj: { pageType: 'home' } });
  262. const monitorTable = ref()
  263. const historyTable = ref()
  264. const alarmHistoryTable = ref()
  265. const handlerHistoryTable = ref()
  266. // const routerParam = ref('home') // 默认进来时首页
  267. const isRefresh = ref(true)
  268. // 模态框
  269. const currentModal = shallowRef<Nullable<ComponentOptions>>(null); //模态框
  270. const modalVisible = ref<Boolean>(false); // 模态框是否可见
  271. // const drawerHeight = ref(240) // 监测框最小高度
  272. const treeShow = ref(true) //是否显示树形菜单
  273. const locationSettingShow = ref(false) //是否显示树形菜单
  274. const treeNodeTitle = ref('') // 选中的树形标题
  275. const locationList = ref([]) //巷道定位图标显示列表
  276. const deviceList = ref<DeviceType[]>([]) //关联设备列表
  277. const deviceActive = ref('')
  278. const activeKey = ref('1'); // tab key
  279. const dataSource = shallowRef([]) // 实时监测数据
  280. const activeID = ref('') // 打开详情modal时监测的设备id
  281. const deviceType = ref('') // 监测设备类型
  282. const systemType = ref('')
  283. const systemID = ref('') // 系统监测时,系统id
  284. const selectedKeys = ref<string[]>([]);
  285. const expandedKeys = ref<string[]>(['0-0-0-1']);
  286. const scroll = reactive({
  287. y: 210
  288. })
  289. const treeData = ref<TreeProps['treeData']>([]);
  290. //树形菜单选择事件
  291. const onSelect: TreeProps['onSelect'] = (keys, e) => {
  292. deviceType.value = ''
  293. systemID.value = ''
  294. deviceList.value = []
  295. if (e.node.parent && (e.node.parent.node.type.toString()).startsWith('sys')) {
  296. systemType.value = e.node.parent.node.type
  297. deviceType.value = e.node.parent.node.type
  298. systemID.value = e.node.type
  299. // 传递工作面id信息,用于定位
  300. actions.setGlobalState({ locationObj: { pageType: deviceType.value, deviceid: systemID.value }, pageObj: null });
  301. } else {
  302. systemType.value = e.node.type
  303. deviceType.value = e.node.type
  304. actions.setGlobalState({ locationObj: { pageType: deviceType.value }, pageObj: null });
  305. }
  306. selectedKeys.value = keys
  307. treeNodeTitle.value = e.node.title
  308. dataSource.value = []
  309. };
  310. function tabChange(activeKeyVal) {
  311. activeKey.value = activeKeyVal;
  312. };
  313. function showTree(flag, value) {
  314. if (flag == 'treeShow') treeShow.value = value
  315. if (flag == 'location') locationSettingShow.value = value
  316. }
  317. async function getDeviceType() {
  318. if (treeData.value?.length > 0) return
  319. const result = await getDeviceTypeList({})
  320. if (result.length > 0) {
  321. const dataSource = <TreeProps['treeData']>[]
  322. let key = '0'
  323. const getData = (resultList, dataSourceList, keyVal) => {
  324. resultList.forEach((item, index) => {
  325. if (item.deviceType != 'sys' && item.children && item.children.length > 0) {
  326. const children = getData(item.children, [], `${keyVal}-${index}`)
  327. dataSourceList.push({
  328. children: children,
  329. title: item.itemText,
  330. key: `${keyVal}-${index}`,
  331. type: item.itemValue,
  332. parentKey: `${keyVal}`
  333. });
  334. } else {
  335. dataSourceList.push({
  336. children: [],
  337. title: item.itemText,
  338. key: `${keyVal}-${index}`,
  339. type: item.itemValue,
  340. parentKey: `${keyVal}`
  341. });
  342. }
  343. });
  344. return dataSourceList
  345. }
  346. treeData.value = getData(result, dataSource, key)
  347. }
  348. }
  349. // https获取监测数据
  350. let timer: null | NodeJS.Timeout = undefined;
  351. function getMonitor() {
  352. if (deviceType.value) {
  353. if (timer) timer = null
  354. if (Object.prototype.toString.call(timer) === '[object Null]') {
  355. timer = setTimeout(async () => {
  356. await getDataSource()
  357. if (timer) {
  358. getMonitor();
  359. }
  360. }, 1000);
  361. }
  362. }
  363. };
  364. async function getDataSource() {
  365. if (deviceType.value && deviceType.value.startsWith('sys') && systemID.value) {
  366. const res = await list({ devicetype: 'sys', systemID: systemID.value });
  367. const result = res.msgTxt;
  368. const deviceArr = <DeviceType[]>[]
  369. result.forEach(item => {
  370. const data = item['datalist'].filter((data: any) => {
  371. const readData = data.readData;
  372. return Object.assign(data, readData);
  373. })
  374. if (item.type != 'sys') {
  375. if(item.type === 'majorpath'){
  376. deviceArr.unshift({ deviceType: item.type, deviceName: item['typeName'], datalist: item['datalist'][0]['paths'] })
  377. }else {
  378. deviceArr.unshift({ deviceType: item.type, deviceName: item['typeName'] ? item['typeName'] : item['datalist'][0]['typeName'], datalist: data })
  379. }
  380. }
  381. })
  382. deviceList.value = deviceArr
  383. if (deviceArr.length > 0) {
  384. // if (deviceArr[1]) {
  385. // deviceActive.value = deviceArr[1].deviceType
  386. // monitorChange(1)
  387. // } else {
  388. // deviceActive.value = deviceArr[0].deviceType
  389. // monitorChange(0)
  390. // }
  391. deviceActive.value = deviceArr[0].deviceType
  392. monitorChange(0)
  393. }
  394. } else {
  395. let res = null
  396. if(systemID.value){
  397. res = await list({ devicetype: 'sys', types: deviceType.value, systemID: systemID.value })
  398. if (res && res.msgTxt) {
  399. const result = res.msgTxt;
  400. result.forEach(item => {
  401. const data = item['datalist'].filter((data: any) => {
  402. const readData = data.readData;
  403. return Object.assign(data, readData);
  404. })
  405. if (item.type != 'sys') {
  406. if (item.type.startsWith('majorpath') && item.type == deviceType.value) {
  407. dataSource.value = item['datalist'][0]['paths']
  408. return
  409. } else if(item.type == deviceType.value) {
  410. dataSource.value = data
  411. console.log('关联设备数据--------------->', data)
  412. return
  413. }
  414. }
  415. })
  416. }
  417. }else{
  418. res = await list({ devicetype: deviceType.value, pagetype: 'normal' })
  419. if (res && res.msgTxt) {
  420. const result = res.msgTxt[0];
  421. if(result){
  422. const data = result['datalist'].filter((data: any) => {
  423. const readData = data.readData;
  424. return Object.assign(data, readData);
  425. })
  426. dataSource.value = data
  427. }
  428. }
  429. }
  430. }
  431. }
  432. function goLocation(record) {
  433. actions.setGlobalState({ locationId: record.deviceID, locationObj: null, pageObj: null });
  434. }
  435. function goDetail(record?) {
  436. if (record) {
  437. activeID.value = record.deviceID
  438. if (deviceType.value.startsWith('fiber')) {
  439. currentModal.value = FiberModal
  440. modalVisible.value = true;
  441. } else if (deviceType.value.startsWith('dusting')) { //bundletube
  442. currentModal.value = DustModal
  443. modalVisible.value = true;
  444. } else if (deviceType.value.startsWith('bundletube')) {
  445. currentModal.value = BundleModal
  446. modalVisible.value = true;
  447. } else if (deviceType.value.indexOf("gate") != -1) {
  448. const newPage = router.resolve({ path: '/monitorChannel/monitor-gate', query: { id: activeID.value } })
  449. window.open(newPage.href, '_blank')
  450. } else if (deviceType.value.indexOf("window") != -1) {
  451. const newPage = router.resolve({ path: '/monitorChannel/monitor-window', query: { id: activeID.value } })
  452. window.open(newPage.href, '_blank')
  453. } else if (deviceType.value.indexOf("windrect") != -1) {
  454. const newPage = router.resolve({ path: '/monitorChannel/monitor-windrect', query: { id: activeID.value } })
  455. window.open(newPage.href, '_blank')
  456. } else if (deviceType.value.indexOf("fanmain") != -1) {
  457. const newPage = router.resolve({ path: '/monitorChannel/monitor-fan-main', query: { id: activeID.value } })
  458. window.open(newPage.href, '_blank')
  459. } else if (deviceType.value.indexOf("fanlocal") != -1) {
  460. const newPage = router.resolve({ path: '/monitorChannel/monitor-fan-local', query: { id: activeID.value } })
  461. window.open(newPage.href, '_blank')
  462. } else if (deviceType.value.indexOf("pulping") != -1) {
  463. const newPage = router.resolve({ path: '/grout-home', query: { id: activeID.value } })
  464. window.open(newPage.href, '_blank')
  465. } else if (deviceType.value.indexOf("pressurefan") != -1) {
  466. const newPage = router.resolve({ path: '/nitrogen/home', query: { id: activeID.value } })
  467. window.open(newPage.href, '_blank')
  468. } else if (deviceType.value.indexOf("chamber") != -1) {
  469. const newPage = router.resolve({ path: '/chamber-home', query: { id: activeID.value } })
  470. window.open(newPage.href, '_blank')
  471. } else if (deviceType.value.indexOf("safetymonitor") != -1) {
  472. const newPage = router.resolve({ path: '/monitorChannel/device-monitor/safetymonitor', query: { id: activeID.value } })
  473. window.open(newPage.href, '_blank')
  474. } else if (deviceType.value.indexOf("pump") != -1) {
  475. const newPage = router.resolve({ path: '/monitorChannel/gasPump-home', query: { id: activeID.value } })
  476. window.open(newPage.href, '_blank')
  477. } else {
  478. message.info('待开发。。。')
  479. }
  480. } else {
  481. if (systemType.value.indexOf("sys_dongshi") != -1) {
  482. const newPage = router.resolve({ path: '/chamber-home', query: { id: systemID.value } })
  483. window.open(newPage.href, '_blank')
  484. } else if (systemType.value.indexOf("sys_obfurage") != -1) {
  485. const newPage = router.resolve({ path: '/monitorChannel/obfurage-home', query: { id: systemID.value } })
  486. window.open(newPage.href, '_blank')
  487. } else if (systemType.value.indexOf("sys_surface_caimei") != -1) {
  488. const newPage = router.resolve({ path: '/monitorChannel/wokerFace-home', query: { id: systemID.value } })
  489. window.open(newPage.href, '_blank')
  490. } else if (systemType.value.indexOf("sys_surface_juejin") != -1) {
  491. const newPage = router.resolve({ path: '/monitorChannel/tunFace-home', query: { id: systemID.value } })
  492. window.open(newPage.href, '_blank')
  493. } else if (systemType.value.indexOf("sys_maintunnel_leather") != -1) {
  494. const newPage = router.resolve({ path: '/monitorChannel/beltTun-home', query: { id: systemID.value } })
  495. window.open(newPage.href, '_blank')
  496. } else if (systemType.value.indexOf("sys_surface_junya") != -1) {
  497. const newPage = router.resolve({ path: '/monitorChannel/balancePress-home', query: { id: systemID.value } })
  498. window.open(newPage.href, '_blank')
  499. } else if (systemType.value.indexOf("sys_nitrogen") != -1) {
  500. const newPage = router.resolve({ path: '/nitrogen-home', query: { id: systemID.value } })
  501. window.open(newPage.href, '_blank')
  502. } else if (deviceType.value.indexOf("forcFan") != -1) {
  503. const newPage = router.resolve({ path: '/forcFan/home', query: { id: activeID.value } })
  504. window.open(newPage.href, '_blank')
  505. } else {
  506. message.info('待开发。。。')
  507. }
  508. }
  509. }
  510. function toHome() {
  511. deviceList.value = []
  512. if (timer) clearTimeout(timer)
  513. timer = undefined
  514. deviceType.value = ''
  515. actions.setGlobalState({ pageObj: { pageType: 'home' } });
  516. }
  517. async function findTreeDataValue(obj) {
  518. const findDeviceType = (data: [], obj) => {
  519. let type = ''
  520. if (obj.deviceid) {
  521. type = obj.deviceid
  522. } else {
  523. type = obj.deviceType
  524. }
  525. data.find((item: any) => {
  526. if (item.children.length > 0) {
  527. findDeviceType(item.children, obj)
  528. }
  529. if (item.type == type) {
  530. deviceType.value = obj.deviceid ? 'sys' : item.type
  531. if (obj.deviceid) systemID.value = obj.deviceid
  532. selectedKeys.value = [item.key]
  533. expandedKeys.value = [item.key]
  534. treeNodeTitle.value = item.title
  535. return true
  536. }
  537. return false
  538. })
  539. }
  540. findDeviceType(treeData.value, obj)
  541. if (timer === undefined) {
  542. timer = null
  543. await getDataSource()
  544. getMonitor()
  545. }
  546. }
  547. function monitorChange(index) {
  548. dataSource.value = []
  549. deviceActive.value = deviceType.value = deviceList.value[index].deviceType
  550. if (activeKey.value == '1' && monitorTable.value) {
  551. monitorTable.value.setLoading(true)
  552. dataSource.value = deviceList.value[index].datalist
  553. }
  554. if (activeKey.value == '2' && historyTable.value) {
  555. historyTable.value.setLoading(true)
  556. }
  557. if (activeKey.value == '3' && alarmHistoryTable.value) {
  558. alarmHistoryTable.value.setLoading(true)
  559. }
  560. if (activeKey.value == '4' && handlerHistoryTable.value) {
  561. handlerHistoryTable.value.setLoading(true)
  562. }
  563. }
  564. /**
  565. * 设置巷道设备定位图标的显示与隐藏
  566. */
  567. function setLocation() {
  568. let locationStr = ''
  569. locationList.value.forEach((item: any) => {
  570. if (item.Visible) {
  571. locationStr = locationStr ? locationStr + ',' + item.value : item.value
  572. }
  573. })
  574. actions.setGlobalState({ locationId: null, locationObj: null, pageObj: null, locationPlane: locationStr });
  575. setTimeout(() => {
  576. message.success('设置成功')
  577. }, 600)
  578. }
  579. onMounted(async () => {
  580. await getDeviceType()
  581. const pageObj = props.pageData
  582. if(!pageObj) return
  583. if (pageObj.deviceid) {
  584. findTreeDataValue({ deviceid: pageObj.deviceid })
  585. } else {
  586. findTreeDataValue({ deviceType: pageObj.pageType })
  587. }
  588. // 定位
  589. const posShowData = pageObj.locationPlane
  590. if (posShowData) {
  591. locationList.value = posShowData
  592. }
  593. })
  594. onUnmounted(() => {
  595. if (timer) {
  596. clearTimeout(timer);
  597. }
  598. timer = undefined;
  599. })
  600. </script>
  601. <style lang="less" scoped >
  602. @import '/@/design/vent/modal.less';
  603. @ventSpace: zxm;
  604. .top-header {
  605. position: fixed;
  606. width: 100%;
  607. height: 56px;
  608. background: url('/@/assets/images/vent/home/modal-top.png');
  609. text-align: center;
  610. line-height: 56px;
  611. font-size: 28px;
  612. color: #ffffffdd;
  613. font-weight: 600;
  614. z-index: 1;
  615. letter-spacing: 2px;
  616. font-size: 30px;
  617. }
  618. .select-node {
  619. position: fixed;
  620. top: 60px;
  621. left: 10px;
  622. color: #fff;
  623. display: flex;
  624. justify-content: center;
  625. font-size: 22px;
  626. .title {
  627. margin-left: 10px;
  628. }
  629. }
  630. .expansion-icon {
  631. background: url('/@/assets/images/vent/home/tree-icon-bg.png') no-repeat;
  632. background-size: contain;
  633. position: absolute;
  634. left: 190px;
  635. top: 25px;
  636. &:hover {
  637. background: url('/@/assets/images/vent/home/tree-icon-hover-bg.png') no-repeat;
  638. background-size: contain;
  639. }
  640. }
  641. .device-select {
  642. width: 250px;
  643. height: 500px;
  644. background: url('/@/assets/images/vent/home/tree-bg.png') no-repeat;
  645. position: fixed;
  646. top: 60px;
  647. left: 10px;
  648. background-size: contain;
  649. pointer-events: auto;
  650. padding: 20px 10px 30px 10px;
  651. }
  652. .is-expansion-icon {
  653. padding: 5px;
  654. pointer-events: auto;
  655. z-index: 999;
  656. }
  657. .device-select-show {
  658. left: 10px;
  659. animation-name: treeShow;
  660. /* 持续时间 */
  661. animation-duration: 1s;
  662. transition: all 1s cubic-bezier(0.165, 0.84, 0.44, 1) .5s;
  663. }
  664. .device-select-hide {
  665. left: -250px;
  666. animation-name: treeHide;
  667. /* 持续时间 */
  668. animation-duration: 1s;
  669. transition: all 1s cubic-bezier(0.165, 0.84, 0.44, 1) .5s;
  670. }
  671. .node-select-show {
  672. width: 276px;
  673. height: 44px;
  674. background: url('/@/assets/images/vent/home/tree-expansion-bg.png') no-repeat;
  675. left: 10px;
  676. animation-name: treeShow;
  677. /* 持续时间 */
  678. animation-duration: 1s;
  679. transition: all 1s cubic-bezier(0.165, 0.84, 0.44, 1) .5s;
  680. display: flex;
  681. align-items: center;
  682. margin-left: 0;
  683. justify-content: flex-start;
  684. pointer-events: auto;
  685. &:hover {
  686. background: url('/@/assets/images/vent/home/tree-expansion-hover-bg.png') no-repeat;
  687. }
  688. .put-away-icon {
  689. position: relative;
  690. display: inline-block;
  691. left: 4px;
  692. }
  693. }
  694. .node-select-hide {
  695. left: -400px;
  696. animation-name: treeHide;
  697. /* 持续时间 */
  698. animation-duration: 1s;
  699. transition: all 1s cubic-bezier(0.165, 0.84, 0.44, 1) .5s;
  700. }
  701. .device-select-box {
  702. width: 208px;
  703. height: 450px;
  704. overflow-y: auto;
  705. color: #fff;
  706. :deep(.zxm-tree) {
  707. background: transparent !important;
  708. color: #fff !important;
  709. .zxm-tree-switcher {
  710. background: transparent !important;
  711. }
  712. .zxm-tree-node-content-wrapper.zxm-tree-node-selected {
  713. background-color: #00b1c8;
  714. }
  715. .zxm-tree-node-content-wrapper:hover {
  716. background-color: #00b1c855;
  717. }
  718. input {
  719. height: 0px !important;
  720. }
  721. }
  722. &::-webkit-scrollbar-track {
  723. -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  724. border-radius: 10px;
  725. background: #ededed22;
  726. height: 100px;
  727. }
  728. &::-webkit-scrollbar-thumb {
  729. -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  730. background: #4288A444;
  731. }
  732. }
  733. .location-icon {
  734. width: 46px;
  735. height: 178px;
  736. position: absolute;
  737. top: 60px;
  738. // right: 0;
  739. background: url('/@/assets/images/vent/home/location-bg.png') no-repeat;
  740. background-size: contain;
  741. writing-mode: vertical-lr;
  742. line-height: 46px;
  743. color: #fff;
  744. padding-top: 10px;
  745. pointer-events: auto;
  746. cursor: pointer;
  747. &:hover {
  748. background: url('/@/assets/images/vent/home/location-hover-bg.png') no-repeat;
  749. }
  750. .location-text {
  751. padding-top: 20px;
  752. letter-spacing: 3px;
  753. font-size: 16px;
  754. }
  755. }
  756. .location-select {
  757. position: fixed;
  758. top: 60px;
  759. // right: 240px;
  760. pointer-events: auto;
  761. .location-select-box {
  762. width: 100%;
  763. height: 100%;
  764. position: relative;
  765. &::before {
  766. content: "";
  767. position: absolute;
  768. width: 230px;
  769. height: 500px;
  770. top: 0;
  771. left: 0;
  772. background: url('/@/assets/images/vent/home/tree-bg.png') no-repeat;
  773. background-size: contain;
  774. transform: rotateY(180deg);
  775. z-index: -1;
  776. // &:hover {
  777. // background: url('/@/assets/images/vent/home/tree-icon-hover-bg.png') no-repeat;
  778. // background-size: contain;
  779. // }
  780. }
  781. .location-top-title {
  782. color: #fff;
  783. position: absolute;
  784. width: 225px;
  785. height: 68px;
  786. background: url('/@/assets/images/vent/home/turn-location-top-bg.png') no-repeat;
  787. background-size: contain;
  788. top: 5px;
  789. left: 5px;
  790. display: flex;
  791. flex-direction: row;
  792. justify-content: space-between;
  793. align-items: flex-end;
  794. .title {
  795. font-size: 18px;
  796. position: relative;
  797. top: -14px;
  798. right: 15px;
  799. }
  800. }
  801. .location-expansion-icon {
  802. background: url('/@/assets/images/vent/home/tree-icon-cover-bg.png') no-repeat;
  803. background-size: contain;
  804. position: relative;
  805. left: 10px;
  806. top: -15px;
  807. padding: 5px;
  808. &:hover {
  809. background: url('/@/assets/images/vent/home/tree-icon-cover-hover-bg.png') no-repeat;
  810. background-size: contain;
  811. }
  812. }
  813. }
  814. .location-container {
  815. width: 200px;
  816. height: 390px;
  817. position: absolute;
  818. display: flex;
  819. flex-direction: column;
  820. top: 80px;
  821. left: 18px;
  822. overflow-y: auto;
  823. .location-item {
  824. color: #fff;
  825. line-height: 30px;
  826. display: flex;
  827. justify-content: space-between;
  828. background-image: linear-gradient(to left, #39f5ff05, #39f5ff10);
  829. margin: 3px 0;
  830. .item-title {
  831. width: 80px;
  832. text-align: right;
  833. color: #87f1ff;
  834. }
  835. }
  836. .location-bottom-btn {
  837. width: 100%;
  838. color: #fff;
  839. display: flex;
  840. justify-content: flex-end;
  841. margin-top: 20px;
  842. span {
  843. display: inline-block;
  844. width: 100%;
  845. background: #00709955;
  846. border-radius: 3px;
  847. border: 1px solid rgba(174, 243, 255, 0.3);
  848. text-align: center;
  849. padding: 2px 0;
  850. cursor: pointer;
  851. &:hover {
  852. background: #00557422;
  853. }
  854. }
  855. }
  856. }
  857. }
  858. .location-select-show {
  859. right: 240px;
  860. animation-name: locationShow;
  861. /* 持续时间 */
  862. animation-duration: 1s;
  863. transition: all 1s cubic-bezier(0.165, 0.84, 0.44, 1) .5s;
  864. }
  865. .location-select-hide {
  866. right: -2px;
  867. animation-name: locationHide;
  868. /* 持续时间 */
  869. animation-duration: 1s;
  870. transition: all 1s cubic-bezier(0.165, 0.84, 0.44, 1) .5s;
  871. }
  872. .location-btn-show {
  873. right: -0px;
  874. animation-name: locationBtnShow;
  875. /* 持续时间 */
  876. animation-duration: 1s;
  877. transition: all 1s cubic-bezier(0.165, 0.84, 0.44, 1) .5s;
  878. }
  879. .location-btn-hide {
  880. right: -240px;
  881. animation-name: locationBtnHide;
  882. /* 持续时间 */
  883. animation-duration: 1s;
  884. transition: all 1s cubic-bezier(0.165, 0.84, 0.44, 1) .5s;
  885. }
  886. .bottom-tabs-box {
  887. position: relative;
  888. .tabs-box {
  889. width: calc(100% - 12px) !important;
  890. bottom: 3px !important;
  891. }
  892. .to-small {
  893. width: 60px;
  894. height: 60px;
  895. background: url('/@/assets/images/vent/home/tosmall.png') no-repeat center;
  896. background-size: auto;
  897. position: absolute;
  898. top: -65px;
  899. right: 36px;
  900. border-radius: 10px;
  901. padding: 8px;
  902. backdrop-filter: blur(10px);
  903. background-color: rgba(45, 86, 137, 0.418);
  904. &:hover {
  905. background-color: rgba(79, 104, 134, 0.418);
  906. }
  907. }
  908. .device-button-group {
  909. position: absolute;
  910. top: -30px;
  911. display: flex;
  912. width: 100%;
  913. .device-button {
  914. height: 26px;
  915. padding: 0 20px;
  916. background: linear-gradient(45deg, #04e6fb55, #0c5cab55);
  917. clip-path: polygon(10px 0,
  918. 0 50%,
  919. 10px 100%,
  920. 100% 100%,
  921. calc(100% - 10px) 50%,
  922. 100% 0);
  923. display: flex;
  924. justify-content: center;
  925. align-items: center;
  926. color: #FFF;
  927. position: relative;
  928. cursor: pointer;
  929. &:nth-child(1) {
  930. left: calc(-6px * 1);
  931. }
  932. &:nth-child(2) {
  933. left: calc(-6px * 2);
  934. }
  935. &:nth-child(3) {
  936. left: calc(-6px * 3);
  937. }
  938. &:nth-child(4) {
  939. left: calc(-6px * 4);
  940. }
  941. &:nth-child(5) {
  942. left: calc(-6px * 5);
  943. }
  944. &:nth-child(6) {
  945. left: calc(-6px * 6);
  946. }
  947. &:nth-child(7) {
  948. left: calc(-6px * 7);
  949. }
  950. &:nth-child(8) {
  951. left: calc(-6px * 8);
  952. }
  953. &:nth-child(9) {
  954. left: calc(-6px * 9);
  955. }
  956. &:nth-child(10) {
  957. left: calc(-6px * 10);
  958. }
  959. &:nth-child(11) {
  960. left: calc(-6px * 11);
  961. }
  962. &:nth-child(12) {
  963. left: calc(-6px * 12);
  964. }
  965. &:nth-child(13) {
  966. left: calc(-6px * 13);
  967. }
  968. &:nth-child(14) {
  969. left: calc(-6px * 14);
  970. }
  971. &:nth-child(15) {
  972. left: calc(-6px * 15);
  973. }
  974. &:nth-child(16) {
  975. left: calc(-6px * 16);
  976. }
  977. &:first-child {
  978. clip-path: polygon(0 0,
  979. 10px 50%,
  980. 0 100%,
  981. 100% 100%,
  982. calc(100% - 10px) 50%,
  983. 100% 0);
  984. }
  985. }
  986. .device-active {
  987. background: linear-gradient(45deg, #04e6fb, #0c5cab);
  988. &::before {
  989. border-color: #0efcff;
  990. box-shadow: 1px 1px 3px 1px #0efcff inset;
  991. }
  992. }
  993. }
  994. .enter-detail {
  995. color: #fff;
  996. cursor: pointer;
  997. position: absolute;
  998. right: 20px;
  999. top: 35px;
  1000. padding: 5px;
  1001. border-radius: 5px;
  1002. margin-left: 8px;
  1003. margin-right: 8px;
  1004. width: auto;
  1005. height: 33px !important;
  1006. display: flex;
  1007. align-items: center;
  1008. justify-content: center;
  1009. color: #fff;
  1010. padding: 5px 15px 5px 15px;
  1011. z-index: 999;
  1012. cursor: pointer;
  1013. &:hover {
  1014. background: linear-gradient(#2cd1ff55, #1eb0ff55);
  1015. }
  1016. &::before {
  1017. width: calc(100% - 6px);
  1018. height: 27px;
  1019. content: '';
  1020. position: absolute;
  1021. top: 3px;
  1022. right: 0;
  1023. left: 3px;
  1024. bottom: 0;
  1025. z-index: -1;
  1026. border-radius: inherit;
  1027. /*important*/
  1028. background: linear-gradient(#1fa6cb, #127cb5);
  1029. }
  1030. }
  1031. }
  1032. @keyframes treeShow {
  1033. 0% {
  1034. left: -400px;
  1035. opacity: 0;
  1036. }
  1037. 100% {
  1038. left: 10px;
  1039. opacity: 1;
  1040. }
  1041. }
  1042. @keyframes treeHide {
  1043. 0% {
  1044. left: 10px;
  1045. opacity: 1;
  1046. }
  1047. 100% {
  1048. left: -400px;
  1049. opacity: 0;
  1050. }
  1051. }
  1052. @keyframes locationShow {
  1053. 0% {
  1054. right: 0px;
  1055. opacity: 0;
  1056. }
  1057. 100% {
  1058. right: 240px;
  1059. opacity: 1;
  1060. }
  1061. }
  1062. @keyframes locationHide {
  1063. 0% {
  1064. right: 240px;
  1065. opacity: 1;
  1066. }
  1067. 100% {
  1068. right: 0;
  1069. opacity: 0;
  1070. }
  1071. }
  1072. @keyframes locationBtnShow {
  1073. 0% {
  1074. right: -240px;
  1075. opacity: 0;
  1076. }
  1077. 100% {
  1078. right: -2px;
  1079. opacity: 1;
  1080. }
  1081. }
  1082. @keyframes locationBtnHide {
  1083. 0% {
  1084. right: -2px;
  1085. opacity: 1;
  1086. }
  1087. 100% {
  1088. right: -240px;
  1089. opacity: 0;
  1090. }
  1091. }
  1092. :deep(.@{ventSpace}-tabs-tabpane-active) {
  1093. // overflow: auto;
  1094. height: 100%;
  1095. }
  1096. :deep(.zxm-select-dropdown) {
  1097. left: 0 !important;
  1098. color: #fff !important;
  1099. }
  1100. // :deep(.@{ventSpace}-pagination){
  1101. // margin-right: 20px !important;
  1102. // margin-top: 5px !important;
  1103. // display: flex;
  1104. // align-items: center;
  1105. // }
  1106. </style>