index.vue 39 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232
  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'" :dataSource="majorPathEchartsData" 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 majorPathEchartsData = ref({})
  281. const activeID = ref('') // 打开详情modal时监测的设备id
  282. const deviceType = ref('') // 监测设备类型
  283. const systemType = ref('')
  284. const systemID = ref('') // 系统监测时,系统id
  285. const selectedKeys = ref<string[]>([]);
  286. const expandedKeys = ref<string[]>(['0-0-0-1']);
  287. const scroll = reactive({
  288. y: 210
  289. })
  290. const treeData = ref<TreeProps['treeData']>([]);
  291. //树形菜单选择事件
  292. const onSelect: TreeProps['onSelect'] = (keys, e) => {
  293. deviceType.value = ''
  294. systemID.value = ''
  295. deviceList.value = []
  296. if (e.node.parent && (e.node.parent.node.type.toString()).startsWith('sys')) {
  297. systemType.value = e.node.parent.node.type
  298. deviceType.value = e.node.parent.node.type
  299. systemID.value = e.node.type
  300. // 传递工作面id信息,用于定位
  301. actions.setGlobalState({ locationObj: { pageType: deviceType.value, deviceid: systemID.value }, pageObj: null });
  302. } else {
  303. systemType.value = e.node.type
  304. deviceType.value = e.node.type
  305. actions.setGlobalState({ locationObj: { pageType: deviceType.value }, pageObj: null });
  306. }
  307. selectedKeys.value = keys
  308. treeNodeTitle.value = e.node.title
  309. dataSource.value = []
  310. };
  311. function tabChange(activeKeyVal) {
  312. activeKey.value = activeKeyVal;
  313. };
  314. function showTree(flag, value) {
  315. if (flag == 'treeShow') treeShow.value = value
  316. if (flag == 'location') locationSettingShow.value = value
  317. }
  318. async function getDeviceType() {
  319. if (treeData.value?.length > 0) return
  320. const result = await getDeviceTypeList({})
  321. if (result.length > 0) {
  322. const dataSource = <TreeProps['treeData']>[]
  323. let key = '0'
  324. const getData = (resultList, dataSourceList, keyVal) => {
  325. resultList.forEach((item, index) => {
  326. if (item.deviceType != 'sys' && item.children && item.children.length > 0) {
  327. const children = getData(item.children, [], `${keyVal}-${index}`)
  328. dataSourceList.push({
  329. children: children,
  330. title: item.itemText,
  331. key: `${keyVal}-${index}`,
  332. type: item.itemValue,
  333. parentKey: `${keyVal}`
  334. });
  335. } else {
  336. dataSourceList.push({
  337. children: [],
  338. title: item.itemText,
  339. key: `${keyVal}-${index}`,
  340. type: item.itemValue,
  341. parentKey: `${keyVal}`
  342. });
  343. }
  344. });
  345. return dataSourceList
  346. }
  347. treeData.value = getData(result, dataSource, key)
  348. }
  349. }
  350. // https获取监测数据
  351. let timer: null | NodeJS.Timeout = undefined;
  352. function getMonitor() {
  353. if (deviceType.value) {
  354. if (timer) timer = null
  355. if (Object.prototype.toString.call(timer) === '[object Null]') {
  356. timer = setTimeout(async () => {
  357. await getDataSource()
  358. if (timer) {
  359. getMonitor();
  360. }
  361. }, 1000);
  362. }
  363. }
  364. };
  365. async function getDataSource() {
  366. if (deviceType.value && deviceType.value.startsWith('sys') && systemID.value) {
  367. const res = await list({ devicetype: 'sys', systemID: systemID.value });
  368. const result = res.msgTxt;
  369. const deviceArr = <DeviceType[]>[]
  370. result.forEach(item => {
  371. const data = item['datalist'].filter((data: any) => {
  372. const readData = data.readData;
  373. return Object.assign(data, readData);
  374. })
  375. if (item.type != 'sys') {
  376. if(item.type === 'majorpath'){
  377. deviceArr.unshift({ deviceType: item.type, deviceName: item['typeName'], datalist: item['datalist'][0]['paths'] })
  378. majorPathEchartsData.value = item['datalist'][0]
  379. }else {
  380. deviceArr.unshift({ deviceType: item.type, deviceName: item['typeName'] ? item['typeName'] : item['datalist'][0]['typeName'], datalist: data })
  381. }
  382. }
  383. })
  384. deviceList.value = deviceArr
  385. if (deviceArr.length > 0) {
  386. // if (deviceArr[1]) {
  387. // deviceActive.value = deviceArr[1].deviceType
  388. // monitorChange(1)
  389. // } else {
  390. // deviceActive.value = deviceArr[0].deviceType
  391. // monitorChange(0)
  392. // }
  393. deviceActive.value = deviceArr[0].deviceType
  394. monitorChange(0)
  395. }
  396. } else {
  397. let res = null
  398. if(systemID.value){
  399. res = await list({ devicetype: 'sys', types: deviceType.value, systemID: systemID.value })
  400. if (res && res.msgTxt) {
  401. const result = res.msgTxt;
  402. result.forEach(item => {
  403. const data = item['datalist'].filter((data: any) => {
  404. const readData = data.readData;
  405. return Object.assign(data, readData);
  406. })
  407. if (item.type != 'sys') {
  408. if (item.type.startsWith('majorpath') && item.type == deviceType.value) {
  409. dataSource.value = item['datalist'][0]['paths']
  410. majorPathEchartsData.value = item['datalist'][0]
  411. return
  412. } else if(item.type == deviceType.value) {
  413. dataSource.value = data
  414. console.log('关联设备数据--------------->', data)
  415. return
  416. }
  417. }
  418. })
  419. }
  420. }else{
  421. res = await list({ devicetype: deviceType.value, pagetype: 'normal' })
  422. if (res && res.msgTxt) {
  423. const result = res.msgTxt[0];
  424. if(result){
  425. const data = result['datalist'].filter((data: any) => {
  426. const readData = data.readData;
  427. return Object.assign(data, readData);
  428. })
  429. dataSource.value = data
  430. }
  431. }
  432. }
  433. }
  434. }
  435. function goLocation(record) {
  436. actions.setGlobalState({ locationId: record.deviceID, locationObj: null, pageObj: null });
  437. }
  438. function goDetail(record?) {
  439. if (record) {
  440. activeID.value = record.deviceID
  441. if (deviceType.value.startsWith('fiber')) {
  442. currentModal.value = FiberModal
  443. modalVisible.value = true;
  444. } else if (deviceType.value.startsWith('dusting')) { //bundletube
  445. currentModal.value = DustModal
  446. modalVisible.value = true;
  447. } else if (deviceType.value.startsWith('bundletube')) {
  448. currentModal.value = BundleModal
  449. modalVisible.value = true;
  450. } else if (deviceType.value.indexOf("gate") != -1) {
  451. const newPage = router.resolve({ path: '/monitorChannel/monitor-gate', query: { id: activeID.value } })
  452. window.open(newPage.href, '_blank')
  453. } else if (deviceType.value.indexOf("window") != -1) {
  454. const newPage = router.resolve({ path: '/monitorChannel/monitor-window', query: { id: activeID.value } })
  455. window.open(newPage.href, '_blank')
  456. } else if (deviceType.value.indexOf("windrect") != -1) {
  457. const newPage = router.resolve({ path: '/monitorChannel/monitor-windrect', query: { id: activeID.value } })
  458. window.open(newPage.href, '_blank')
  459. } else if (deviceType.value.indexOf("fanmain") != -1) {
  460. const newPage = router.resolve({ path: '/monitorChannel/monitor-fan-main', query: { id: activeID.value } })
  461. window.open(newPage.href, '_blank')
  462. } else if (deviceType.value.indexOf("fanlocal") != -1) {
  463. const newPage = router.resolve({ path: '/monitorChannel/monitor-fan-local', query: { id: activeID.value } })
  464. window.open(newPage.href, '_blank')
  465. } else if (deviceType.value.indexOf("pulping") != -1) {
  466. const newPage = router.resolve({ path: '/grout-home', query: { id: activeID.value } })
  467. window.open(newPage.href, '_blank')
  468. } else if (deviceType.value.indexOf("pressurefan") != -1) {
  469. const newPage = router.resolve({ path: '/nitrogen/home', query: { id: activeID.value } })
  470. window.open(newPage.href, '_blank')
  471. } else if (deviceType.value.indexOf("chamber") != -1) {
  472. const newPage = router.resolve({ path: '/chamber-home', query: { id: activeID.value } })
  473. window.open(newPage.href, '_blank')
  474. } else if (deviceType.value.indexOf("safetymonitor") != -1) {
  475. const newPage = router.resolve({ path: '/monitorChannel/device-monitor/safetymonitor', query: { id: activeID.value } })
  476. window.open(newPage.href, '_blank')
  477. } else if (deviceType.value.indexOf("pump") != -1) {
  478. const newPage = router.resolve({ path: '/monitorChannel/gasPump-home', query: { id: activeID.value } })
  479. window.open(newPage.href, '_blank')
  480. } else {
  481. message.info('待开发。。。')
  482. }
  483. } else {
  484. if (systemType.value.indexOf("sys_dongshi") != -1) {
  485. const newPage = router.resolve({ path: '/chamber-home', query: { id: systemID.value } })
  486. window.open(newPage.href, '_blank')
  487. } else if (systemType.value.indexOf("sys_obfurage") != -1) {
  488. const newPage = router.resolve({ path: '/monitorChannel/obfurage-home', query: { id: systemID.value } })
  489. window.open(newPage.href, '_blank')
  490. } else if (systemType.value.indexOf("sys_surface_caimei") != -1) {
  491. const newPage = router.resolve({ path: '/monitorChannel/wokerFace-home', query: { id: systemID.value } })
  492. window.open(newPage.href, '_blank')
  493. } else if (systemType.value.indexOf("sys_surface_juejin") != -1) {
  494. const newPage = router.resolve({ path: '/monitorChannel/tunFace-home', query: { id: systemID.value } })
  495. window.open(newPage.href, '_blank')
  496. } else if (systemType.value.indexOf("sys_maintunnel_leather") != -1) {
  497. const newPage = router.resolve({ path: '/monitorChannel/beltTun-home', query: { id: systemID.value } })
  498. window.open(newPage.href, '_blank')
  499. } else if (systemType.value.indexOf("sys_surface_junya") != -1) {
  500. const newPage = router.resolve({ path: '/monitorChannel/balancePress-home', query: { id: systemID.value } })
  501. window.open(newPage.href, '_blank')
  502. } else if (systemType.value.indexOf("sys_nitrogen") != -1) {
  503. const newPage = router.resolve({ path: '/nitrogen-home', query: { id: systemID.value } })
  504. window.open(newPage.href, '_blank')
  505. } else if (deviceType.value.indexOf("forcFan") != -1) {
  506. const newPage = router.resolve({ path: '/forcFan/home', query: { id: activeID.value } })
  507. window.open(newPage.href, '_blank')
  508. } else {
  509. message.info('待开发。。。')
  510. }
  511. }
  512. }
  513. function toHome() {
  514. deviceList.value = []
  515. if (timer) clearTimeout(timer)
  516. timer = undefined
  517. deviceType.value = ''
  518. actions.setGlobalState({ pageObj: { pageType: 'home' } });
  519. }
  520. async function findTreeDataValue(obj) {
  521. const findDeviceType = (data: [], obj) => {
  522. let type = ''
  523. if (obj.deviceid) {
  524. type = obj.deviceid
  525. } else {
  526. type = obj.deviceType
  527. }
  528. data.find((item: any) => {
  529. if (item.children.length > 0) {
  530. findDeviceType(item.children, obj)
  531. }
  532. if (item.type == type) {
  533. deviceType.value = obj.deviceid ? 'sys' : item.type
  534. if (obj.deviceid) systemID.value = obj.deviceid
  535. selectedKeys.value = [item.key]
  536. expandedKeys.value = [item.key]
  537. treeNodeTitle.value = item.title
  538. return true
  539. }
  540. return false
  541. })
  542. }
  543. findDeviceType(treeData.value, obj)
  544. if (timer === undefined) {
  545. timer = null
  546. await getDataSource()
  547. getMonitor()
  548. }
  549. }
  550. function monitorChange(index) {
  551. dataSource.value = []
  552. deviceActive.value = deviceType.value = deviceList.value[index].deviceType
  553. if (activeKey.value == '1' && monitorTable.value) {
  554. monitorTable.value.setLoading(true)
  555. dataSource.value = deviceList.value[index].datalist
  556. }
  557. if (activeKey.value == '2' && historyTable.value) {
  558. historyTable.value.setLoading(true)
  559. }
  560. if (activeKey.value == '3' && alarmHistoryTable.value) {
  561. alarmHistoryTable.value.setLoading(true)
  562. }
  563. if (activeKey.value == '4' && handlerHistoryTable.value) {
  564. handlerHistoryTable.value.setLoading(true)
  565. }
  566. }
  567. /**
  568. * 设置巷道设备定位图标的显示与隐藏
  569. */
  570. function setLocation() {
  571. let locationStr = ''
  572. locationList.value.forEach((item: any) => {
  573. if (item.Visible) {
  574. locationStr = locationStr ? locationStr + ',' + item.value : item.value
  575. }
  576. })
  577. actions.setGlobalState({ locationId: null, locationObj: null, pageObj: null, locationPlane: locationStr });
  578. setTimeout(() => {
  579. message.success('设置成功')
  580. }, 600)
  581. }
  582. onMounted(async () => {
  583. await getDeviceType()
  584. const pageObj = props.pageData
  585. if(!pageObj) return
  586. if (pageObj.deviceid) {
  587. findTreeDataValue({ deviceid: pageObj.deviceid })
  588. } else {
  589. findTreeDataValue({ deviceType: pageObj.pageType })
  590. }
  591. // 定位
  592. const posShowData = pageObj.locationPlane
  593. if (posShowData) {
  594. locationList.value = posShowData
  595. }
  596. })
  597. onUnmounted(() => {
  598. if (timer) {
  599. clearTimeout(timer);
  600. }
  601. timer = undefined;
  602. })
  603. </script>
  604. <style lang="less" scoped >
  605. @import '/@/design/vent/modal.less';
  606. @ventSpace: zxm;
  607. .top-header {
  608. position: fixed;
  609. width: 100%;
  610. height: 56px;
  611. background: url('/@/assets/images/vent/home/modal-top.png');
  612. text-align: center;
  613. line-height: 56px;
  614. font-size: 28px;
  615. color: #ffffffdd;
  616. font-weight: 600;
  617. z-index: 1;
  618. letter-spacing: 2px;
  619. font-size: 30px;
  620. }
  621. .select-node {
  622. position: fixed;
  623. top: 60px;
  624. left: 10px;
  625. color: #fff;
  626. display: flex;
  627. justify-content: center;
  628. font-size: 22px;
  629. .title {
  630. margin-left: 10px;
  631. }
  632. }
  633. .expansion-icon {
  634. background: url('/@/assets/images/vent/home/tree-icon-bg.png') no-repeat;
  635. background-size: contain;
  636. position: absolute;
  637. left: 190px;
  638. top: 25px;
  639. &:hover {
  640. background: url('/@/assets/images/vent/home/tree-icon-hover-bg.png') no-repeat;
  641. background-size: contain;
  642. }
  643. }
  644. .device-select {
  645. width: 250px;
  646. height: 500px;
  647. background: url('/@/assets/images/vent/home/tree-bg.png') no-repeat;
  648. position: fixed;
  649. top: 60px;
  650. left: 10px;
  651. background-size: contain;
  652. pointer-events: auto;
  653. padding: 20px 10px 30px 10px;
  654. }
  655. .is-expansion-icon {
  656. padding: 5px;
  657. pointer-events: auto;
  658. z-index: 999;
  659. }
  660. .device-select-show {
  661. left: 10px;
  662. animation-name: treeShow;
  663. /* 持续时间 */
  664. animation-duration: 1s;
  665. transition: all 1s cubic-bezier(0.165, 0.84, 0.44, 1) .5s;
  666. }
  667. .device-select-hide {
  668. left: -250px;
  669. animation-name: treeHide;
  670. /* 持续时间 */
  671. animation-duration: 1s;
  672. transition: all 1s cubic-bezier(0.165, 0.84, 0.44, 1) .5s;
  673. }
  674. .node-select-show {
  675. width: 276px;
  676. height: 44px;
  677. background: url('/@/assets/images/vent/home/tree-expansion-bg.png') no-repeat;
  678. left: 10px;
  679. animation-name: treeShow;
  680. /* 持续时间 */
  681. animation-duration: 1s;
  682. transition: all 1s cubic-bezier(0.165, 0.84, 0.44, 1) .5s;
  683. display: flex;
  684. align-items: center;
  685. margin-left: 0;
  686. justify-content: flex-start;
  687. pointer-events: auto;
  688. &:hover {
  689. background: url('/@/assets/images/vent/home/tree-expansion-hover-bg.png') no-repeat;
  690. }
  691. .put-away-icon {
  692. position: relative;
  693. display: inline-block;
  694. left: 4px;
  695. }
  696. }
  697. .node-select-hide {
  698. left: -400px;
  699. animation-name: treeHide;
  700. /* 持续时间 */
  701. animation-duration: 1s;
  702. transition: all 1s cubic-bezier(0.165, 0.84, 0.44, 1) .5s;
  703. }
  704. .device-select-box {
  705. width: 208px;
  706. height: 450px;
  707. overflow-y: auto;
  708. color: #fff;
  709. :deep(.zxm-tree) {
  710. background: transparent !important;
  711. color: #fff !important;
  712. .zxm-tree-switcher {
  713. background: transparent !important;
  714. }
  715. .zxm-tree-node-content-wrapper.zxm-tree-node-selected {
  716. background-color: #00b1c8;
  717. }
  718. .zxm-tree-node-content-wrapper:hover {
  719. background-color: #00b1c855;
  720. }
  721. input {
  722. height: 0px !important;
  723. }
  724. }
  725. &::-webkit-scrollbar-track {
  726. -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  727. border-radius: 10px;
  728. background: #ededed22;
  729. height: 100px;
  730. }
  731. &::-webkit-scrollbar-thumb {
  732. -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  733. background: #4288A444;
  734. }
  735. }
  736. .location-icon {
  737. width: 46px;
  738. height: 178px;
  739. position: absolute;
  740. top: 60px;
  741. // right: 0;
  742. background: url('/@/assets/images/vent/home/location-bg.png') no-repeat;
  743. background-size: contain;
  744. writing-mode: vertical-lr;
  745. line-height: 46px;
  746. color: #fff;
  747. padding-top: 10px;
  748. pointer-events: auto;
  749. cursor: pointer;
  750. &:hover {
  751. background: url('/@/assets/images/vent/home/location-hover-bg.png') no-repeat;
  752. }
  753. .location-text {
  754. padding-top: 20px;
  755. letter-spacing: 3px;
  756. font-size: 16px;
  757. }
  758. }
  759. .location-select {
  760. position: fixed;
  761. top: 60px;
  762. // right: 240px;
  763. pointer-events: auto;
  764. .location-select-box {
  765. width: 100%;
  766. height: 100%;
  767. position: relative;
  768. &::before {
  769. content: "";
  770. position: absolute;
  771. width: 230px;
  772. height: 500px;
  773. top: 0;
  774. left: 0;
  775. background: url('/@/assets/images/vent/home/tree-bg.png') no-repeat;
  776. background-size: contain;
  777. transform: rotateY(180deg);
  778. z-index: -1;
  779. // &:hover {
  780. // background: url('/@/assets/images/vent/home/tree-icon-hover-bg.png') no-repeat;
  781. // background-size: contain;
  782. // }
  783. }
  784. .location-top-title {
  785. color: #fff;
  786. position: absolute;
  787. width: 225px;
  788. height: 68px;
  789. background: url('/@/assets/images/vent/home/turn-location-top-bg.png') no-repeat;
  790. background-size: contain;
  791. top: 5px;
  792. left: 5px;
  793. display: flex;
  794. flex-direction: row;
  795. justify-content: space-between;
  796. align-items: flex-end;
  797. .title {
  798. font-size: 18px;
  799. position: relative;
  800. top: -14px;
  801. right: 15px;
  802. }
  803. }
  804. .location-expansion-icon {
  805. background: url('/@/assets/images/vent/home/tree-icon-cover-bg.png') no-repeat;
  806. background-size: contain;
  807. position: relative;
  808. left: 10px;
  809. top: -15px;
  810. padding: 5px;
  811. &:hover {
  812. background: url('/@/assets/images/vent/home/tree-icon-cover-hover-bg.png') no-repeat;
  813. background-size: contain;
  814. }
  815. }
  816. }
  817. .location-container {
  818. width: 200px;
  819. height: 390px;
  820. position: absolute;
  821. display: flex;
  822. flex-direction: column;
  823. top: 80px;
  824. left: 18px;
  825. overflow-y: auto;
  826. .location-item {
  827. color: #fff;
  828. line-height: 30px;
  829. display: flex;
  830. justify-content: space-between;
  831. background-image: linear-gradient(to left, #39f5ff05, #39f5ff10);
  832. margin: 3px 0;
  833. .item-title {
  834. width: 80px;
  835. text-align: right;
  836. color: #87f1ff;
  837. }
  838. }
  839. .location-bottom-btn {
  840. width: 100%;
  841. color: #fff;
  842. display: flex;
  843. justify-content: flex-end;
  844. margin-top: 20px;
  845. span {
  846. display: inline-block;
  847. width: 100%;
  848. background: #00709955;
  849. border-radius: 3px;
  850. border: 1px solid rgba(174, 243, 255, 0.3);
  851. text-align: center;
  852. padding: 2px 0;
  853. cursor: pointer;
  854. &:hover {
  855. background: #00557422;
  856. }
  857. }
  858. }
  859. }
  860. }
  861. .location-select-show {
  862. right: 240px;
  863. animation-name: locationShow;
  864. /* 持续时间 */
  865. animation-duration: 1s;
  866. transition: all 1s cubic-bezier(0.165, 0.84, 0.44, 1) .5s;
  867. }
  868. .location-select-hide {
  869. right: -2px;
  870. animation-name: locationHide;
  871. /* 持续时间 */
  872. animation-duration: 1s;
  873. transition: all 1s cubic-bezier(0.165, 0.84, 0.44, 1) .5s;
  874. }
  875. .location-btn-show {
  876. right: -0px;
  877. animation-name: locationBtnShow;
  878. /* 持续时间 */
  879. animation-duration: 1s;
  880. transition: all 1s cubic-bezier(0.165, 0.84, 0.44, 1) .5s;
  881. }
  882. .location-btn-hide {
  883. right: -240px;
  884. animation-name: locationBtnHide;
  885. /* 持续时间 */
  886. animation-duration: 1s;
  887. transition: all 1s cubic-bezier(0.165, 0.84, 0.44, 1) .5s;
  888. }
  889. .bottom-tabs-box {
  890. position: relative;
  891. .tabs-box {
  892. width: calc(100% - 12px) !important;
  893. bottom: 3px !important;
  894. }
  895. .to-small {
  896. width: 60px;
  897. height: 60px;
  898. background: url('/@/assets/images/vent/home/tosmall.png') no-repeat center;
  899. background-size: auto;
  900. position: absolute;
  901. top: -65px;
  902. right: 36px;
  903. border-radius: 10px;
  904. padding: 8px;
  905. backdrop-filter: blur(10px);
  906. background-color: rgba(45, 86, 137, 0.418);
  907. &:hover {
  908. background-color: rgba(79, 104, 134, 0.418);
  909. }
  910. }
  911. .device-button-group {
  912. position: absolute;
  913. top: -30px;
  914. display: flex;
  915. width: 100%;
  916. .device-button {
  917. height: 26px;
  918. padding: 0 20px;
  919. background: linear-gradient(45deg, #04e6fb55, #0c5cab55);
  920. clip-path: polygon(10px 0,
  921. 0 50%,
  922. 10px 100%,
  923. 100% 100%,
  924. calc(100% - 10px) 50%,
  925. 100% 0);
  926. display: flex;
  927. justify-content: center;
  928. align-items: center;
  929. color: #FFF;
  930. position: relative;
  931. cursor: pointer;
  932. &:nth-child(1) {
  933. left: calc(-6px * 1);
  934. }
  935. &:nth-child(2) {
  936. left: calc(-6px * 2);
  937. }
  938. &:nth-child(3) {
  939. left: calc(-6px * 3);
  940. }
  941. &:nth-child(4) {
  942. left: calc(-6px * 4);
  943. }
  944. &:nth-child(5) {
  945. left: calc(-6px * 5);
  946. }
  947. &:nth-child(6) {
  948. left: calc(-6px * 6);
  949. }
  950. &:nth-child(7) {
  951. left: calc(-6px * 7);
  952. }
  953. &:nth-child(8) {
  954. left: calc(-6px * 8);
  955. }
  956. &:nth-child(9) {
  957. left: calc(-6px * 9);
  958. }
  959. &:nth-child(10) {
  960. left: calc(-6px * 10);
  961. }
  962. &:nth-child(11) {
  963. left: calc(-6px * 11);
  964. }
  965. &:nth-child(12) {
  966. left: calc(-6px * 12);
  967. }
  968. &:nth-child(13) {
  969. left: calc(-6px * 13);
  970. }
  971. &:nth-child(14) {
  972. left: calc(-6px * 14);
  973. }
  974. &:nth-child(15) {
  975. left: calc(-6px * 15);
  976. }
  977. &:nth-child(16) {
  978. left: calc(-6px * 16);
  979. }
  980. &:first-child {
  981. clip-path: polygon(0 0,
  982. 10px 50%,
  983. 0 100%,
  984. 100% 100%,
  985. calc(100% - 10px) 50%,
  986. 100% 0);
  987. }
  988. }
  989. .device-active {
  990. background: linear-gradient(45deg, #04e6fb, #0c5cab);
  991. &::before {
  992. border-color: #0efcff;
  993. box-shadow: 1px 1px 3px 1px #0efcff inset;
  994. }
  995. }
  996. }
  997. .enter-detail {
  998. color: #fff;
  999. cursor: pointer;
  1000. position: absolute;
  1001. right: 20px;
  1002. top: 35px;
  1003. padding: 5px;
  1004. border-radius: 5px;
  1005. margin-left: 8px;
  1006. margin-right: 8px;
  1007. width: auto;
  1008. height: 33px !important;
  1009. display: flex;
  1010. align-items: center;
  1011. justify-content: center;
  1012. color: #fff;
  1013. padding: 5px 15px 5px 15px;
  1014. z-index: 999;
  1015. cursor: pointer;
  1016. &:hover {
  1017. background: linear-gradient(#2cd1ff55, #1eb0ff55);
  1018. }
  1019. &::before {
  1020. width: calc(100% - 6px);
  1021. height: 27px;
  1022. content: '';
  1023. position: absolute;
  1024. top: 3px;
  1025. right: 0;
  1026. left: 3px;
  1027. bottom: 0;
  1028. z-index: -1;
  1029. border-radius: inherit;
  1030. /*important*/
  1031. background: linear-gradient(#1fa6cb, #127cb5);
  1032. }
  1033. }
  1034. }
  1035. @keyframes treeShow {
  1036. 0% {
  1037. left: -400px;
  1038. opacity: 0;
  1039. }
  1040. 100% {
  1041. left: 10px;
  1042. opacity: 1;
  1043. }
  1044. }
  1045. @keyframes treeHide {
  1046. 0% {
  1047. left: 10px;
  1048. opacity: 1;
  1049. }
  1050. 100% {
  1051. left: -400px;
  1052. opacity: 0;
  1053. }
  1054. }
  1055. @keyframes locationShow {
  1056. 0% {
  1057. right: 0px;
  1058. opacity: 0;
  1059. }
  1060. 100% {
  1061. right: 240px;
  1062. opacity: 1;
  1063. }
  1064. }
  1065. @keyframes locationHide {
  1066. 0% {
  1067. right: 240px;
  1068. opacity: 1;
  1069. }
  1070. 100% {
  1071. right: 0;
  1072. opacity: 0;
  1073. }
  1074. }
  1075. @keyframes locationBtnShow {
  1076. 0% {
  1077. right: -240px;
  1078. opacity: 0;
  1079. }
  1080. 100% {
  1081. right: -2px;
  1082. opacity: 1;
  1083. }
  1084. }
  1085. @keyframes locationBtnHide {
  1086. 0% {
  1087. right: -2px;
  1088. opacity: 1;
  1089. }
  1090. 100% {
  1091. right: -240px;
  1092. opacity: 0;
  1093. }
  1094. }
  1095. :deep(.@{ventSpace}-tabs-tabpane-active) {
  1096. // overflow: auto;
  1097. height: 100%;
  1098. }
  1099. :deep(.zxm-select-dropdown) {
  1100. left: 0 !important;
  1101. color: #000000 !important;
  1102. }
  1103. // :deep(.@{ventSpace}-pagination){
  1104. // margin-right: 20px !important;
  1105. // margin-top: 5px !important;
  1106. // display: flex;
  1107. // align-items: center;
  1108. // }
  1109. </style>