index.vue 59 KB

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