index.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615
  1. <template>
  2. <div class="bg" style="width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; overflow: hidden">
  3. <a-spin :spinning="loading" />
  4. <div id="window3D" v-show="!loading" style="width: 100%; height: 100%; position: absolute; overflow: hidden"> </div>
  5. <!-- <div id="damper3DCSS" v-show="!loading" style="width: 100%; height: 100%; top:0; left: 0; position: absolute; overflow: hidden;">
  6. <div>
  7. <div ref="elementContent" class="elementContent">
  8. <p><span class="data-title">压力(Pa):</span>{{selectData.frontRearDP}}</p>
  9. <p><span class="data-title">动力源压力(MPa):</span>{{selectData.sourcePressure}}</p>
  10. <p><span class="data-title">故障诊断:</span>
  11. <i
  12. :class="{'state-icon': true, 'open': selectData.messageBoxStatus, 'close': !selectData.messageBoxStatus}"
  13. ></i>{{selectData.fault}}</p>
  14. </div>
  15. </div>
  16. </div> -->
  17. </div>
  18. <div class="scene-box">
  19. <div class="top-box">
  20. <div class="top-center" style="display: flex">
  21. <div class="row" v-if="Number(selectData.nwindownum) == 2">
  22. <div v-if="hasPermission('window:AreaControl')" class="button-box" @click="setArea(1)">设定前窗面积</div>
  23. <div v-if="hasPermission('window:AreaControl')" class="button-box" @click="setArea(2)">设定后窗面积</div>
  24. <div v-if="hasPermission('window:showAngle')" class="button-box" @click="setAngle(1)">设定前窗角度</div>
  25. <div v-if="hasPermission('window:showAngle')" class="button-box" @click="setAngle(2)">设定后窗角度</div>
  26. <div v-if="hasPermission('window:gateControl')" class="button-box" @click="playAnimation(1)">打开前门</div>
  27. <div v-if="hasPermission('window:gateControl')" class="button-box" @click="playAnimation(2)">关闭前门</div>
  28. <div v-if="hasPermission('window:twoAreaControl')" class="button-box" @click="setControl('1', '窗1面积设定')">窗1面积设定</div>
  29. <div v-if="hasPermission('window:twoAreaControl')" class="button-box" @click="setControl('2', '窗2面积设定')">窗2面积设定</div>
  30. <div v-if="hasPermission('window:twoAngleControl')" class="button-box" @click="setControl('1', '窗1角度设定')">窗1角度设定</div>
  31. <div v-if="hasPermission('window:twoAngleControl')" class="button-box" @click="setControl('2', '窗2角度设定')">窗2角度设定</div>
  32. <!-- 展会功能 -->
  33. <!-- <div v-if="hasPermission('window:ldkz')" class="button-box" @click="setArea(3)">自主联动控制开启</div>
  34. <div v-if="hasPermission('window:ldkz')" class="button-box" @click="setArea(4)">自主联动控制停止</div> -->
  35. </div>
  36. <div class="row" v-if="hasPermission('window:fourAreaControl') && Number(selectData.nwindownum) == 4">
  37. <div class="button-box" @click="setControl('frontSetValue1', '前窗1面积设置')">前窗1面积</div>
  38. <div class="button-box" @click="setControl('frontSetValue2', '前窗2面积设置')">前窗2面积</div>
  39. <div class="button-box" @click="setControl('frontSetValue3', '后窗1面积设置')">后窗1面积</div>
  40. <div class="button-box" @click="setControl('frontSetValue4', '后窗2面积设置')">后窗2面积</div>
  41. </div>
  42. <div class="row" v-if="Number(selectData.nwindownum) == 1">
  43. <div v-if="hasPermission('window:AreaControl')" class="button-box" @click="setArea(1)">设定风窗面积</div>
  44. <div v-if="hasPermission('window:showAngle')" class="button-box" @click="setAngle(1)">设定风窗角度</div>
  45. </div>
  46. </div>
  47. <div class="top-right row">
  48. <div v-if="hasPermission('window:ldkz')" class="button-box" @click="setArea(7)">风窗自主调控</div>
  49. <div v-if="hasPermission('window:gasldkz')" class="button-box" @click="setArea('ldkzStart')">瓦斯超限调控开启</div>
  50. <div v-if="hasPermission('window:controlFull')" class="button-box" @click="setArea(5)">一键全开</div>
  51. <div v-if="hasPermission('window:controlFull')" class="button-box" @click="setArea(6)">一键全关</div>
  52. <div class="row" v-if="hasPermission('window:fourFlControl') && Number(selectData.nwindownum) == 4">
  53. <div class="button-box" @click="setControl('air1', '前窗1风量设置')">设定前窗1风量</div>
  54. <div class="button-box" @click="setControl('air2', '前窗2风量设置')">设定前窗2风量</div>
  55. <div class="button-box" @click="setControl('air3', '后窗1风量设置')">设定后窗1风量</div>
  56. <div class="button-box" @click="setControl('air4', '后窗2风量设置')">设定后窗2风量</div>
  57. </div>
  58. <!-- 展会功能 -->
  59. <!-- <div v-if="hasPermission('window:ldkz')" class="button-box" @click="setArea('ldkzStart')">自主联动控制开启</div>
  60. <div v-if="hasPermission('window:ldkz')" class="button-box" @click="setArea('ldkzStop')">自主联动控制停止</div> -->
  61. <!-- <div class="button-box" @click="() => (linkAlarmShow = true)">预警指标</div> -->
  62. <!-- <div class="control-type row">
  63. <div class="control-title">控制模式:</div>
  64. <a-radio-group v-model:value="controlType">
  65. <a-radio :value="1">就地</a-radio>
  66. <a-radio :value="2">远程</a-radio>
  67. </a-radio-group>
  68. </div> -->
  69. <!-- <div class="run-type row">
  70. <div class="control-title">运行状态:</div>
  71. <a-radio-group v-model:value="controlType">
  72. <a-radio :value="1">检修</a-radio>
  73. </a-radio-group>
  74. </div>
  75. <div class="run-state row">
  76. <div class="control-title">网络状态:</div>
  77. <a-radio-group v-model:value="controlType">
  78. <a-radio :value="1">运行</a-radio>
  79. </a-radio-group>
  80. </div> -->
  81. </div>
  82. </div>
  83. <div class="title-text">
  84. {{ selectData.strinstallpos || selectData.strname }}
  85. </div>
  86. <div class="bottom-tabs-box" @mousedown="setDivHeight($event, 350, scroll)">
  87. <dv-border-box8 :dur="5" :style="`padding: 5px; height: ${scroll.y + 120}px`">
  88. <a-tabs class="tabs-box" v-model:activeKey="activeKey" @change="tabChange">
  89. <a-tab-pane key="1" tab="实时监测">
  90. <MonitorTable
  91. v-if="activeKey === '1'"
  92. ref="MonitorDataTable"
  93. :columnsType="deviceType"
  94. :dataSource="dataSource"
  95. @selectRow="getSelectRow"
  96. design-scope="window-monitor"
  97. :scroll="{ y: scroll.y - 40 }"
  98. title="风窗监测"
  99. :isShowPagination="true"
  100. :isShowActionColumn="true"
  101. >
  102. <template #filterCell="{ column, record }">
  103. <a-tag v-if="column.dataIndex === 'warnFlag'" :color="record.warnFlag == '0' ? 'green' : 'red'">{{
  104. record.warnFlag == '0' ? '正常' : '报警'
  105. }}</a-tag>
  106. <a-tag v-if="column.dataIndex === 'netStatus'" :color="record.netStatus == '0' ? 'default' : 'green'">{{
  107. record.netStatus == '0' ? '断开' : '连接'
  108. }}</a-tag>
  109. <div v-if="record.nwindownum == 1 && column.dataIndex === 'rearArea'">/</div>
  110. </template>
  111. <template #action="{ record }">
  112. <a v-if="globalConfig?.showReport" class="table-action-link" @click="deviceEdit($event, 'reportInfo', record)">报表录入</a>
  113. <a class="table-action-link" @click="deviceEdit($event, 'deviceInfo', record)">设备编辑</a>
  114. </template>
  115. </MonitorTable>
  116. </a-tab-pane>
  117. <!-- <a-tab-pane key="2" tab="实时曲线图" force-render>
  118. <div class="tab-item" v-if="activeKey === '2'">
  119. <DeviceEcharts
  120. chartsColumnsType="window_chart"
  121. xAxisPropType="strname"
  122. :dataSource="dataSource"
  123. height="100%"
  124. :chartsColumns="chartsColumns"
  125. :device-list-api="baseList"
  126. device-type="window"
  127. />
  128. </div>
  129. </a-tab-pane> -->
  130. <a-tab-pane key="3" tab="历史数据">
  131. <div class="tab-item" v-if="activeKey === '3'">
  132. <HistoryTable :columns-type="deviceType" :device-type="deviceType" designScope="window-history" :scroll="scroll">
  133. <template #filterCell="{ column, record }">
  134. <!-- <a-tag v-if="column.dataIndex === 'warnFlag'" :color="record.warnFlag == '0' ? 'green' : 'red'">{{
  135. record.warnFlag == '0' ? '正常' : '报警'
  136. }}</a-tag>
  137. <a-tag v-if="column.dataIndex === 'netStatus'" :color="record.netStatus == '0' ? 'default' : 'green'">{{
  138. record.netStatus == '0' ? '断开' : '连接'
  139. }}</a-tag> -->
  140. <div v-if="record.nwindownum == 1 && column.dataIndex === 'rearArea'">/</div>
  141. </template>
  142. </HistoryTable>
  143. </div>
  144. </a-tab-pane>
  145. <a-tab-pane key="4" tab="报警历史">
  146. <div class="tab-item" v-if="activeKey === '4'">
  147. <AlarmHistoryTable
  148. columns-type="alarm"
  149. :device-type="deviceType"
  150. :device-list-api="baseList"
  151. designScope="alarm-history"
  152. :scroll="scroll"
  153. />
  154. </div>
  155. </a-tab-pane>
  156. <a-tab-pane key="5" tab="操作历史">
  157. <div class="tab-item" v-if="activeKey === '5'">
  158. <HandlerHistoryTable
  159. columns-type="operator_history"
  160. :device-type="deviceType"
  161. :device-list-api="baseList"
  162. designScope="alarm-history"
  163. :scroll="scroll"
  164. />
  165. </div>
  166. </a-tab-pane>
  167. </a-tabs>
  168. </dv-border-box8>
  169. </div>
  170. </div>
  171. <div ref="playerRef" style="z-index: 999; position: absolute; top: 100px; right: 10px; width: 300px; height: 280px; margin: auto"></div>
  172. <LivePlayer
  173. id="fc-player1"
  174. style="height: 220px; width: 300px; position: absolute; top: 0px; z-index: -1"
  175. ref="player1"
  176. :videoUrl="flvURL1()"
  177. muted
  178. loading
  179. autoplay
  180. controls
  181. loop
  182. fluent
  183. />
  184. <HandleModal :modal-is-show="modalIsShow" :modal-title="modalTitle" :modal-type="modalType" @handle-ok="handleOK" @handle-cancel="handleCancel" />
  185. <DeviceBaseInfo @register="regModal" :device-type="deviceType" />
  186. <LinkControlDesModal
  187. :modal-is-show="linkAlarmShow"
  188. :modal-title="modalTitle"
  189. :device-id="selectData.deviceID"
  190. @close="() => (linkAlarmShow = false)"
  191. />
  192. <SupplyAir
  193. :data="currentData"
  194. :targetVolume="targetVolume"
  195. :modal-is-show="showTargetModal"
  196. :modalType="modalType"
  197. @handle-cancel="() => (showTargetModal = false)"
  198. />
  199. <GasSupplyAir
  200. :data="currentData"
  201. :gasVal="ch4"
  202. :modal-is-show="showGasModal"
  203. :modalType="modalType"
  204. :isMock="isMock"
  205. @handle-cancel="() => (showGasModal = false)"
  206. />
  207. </template>
  208. <script setup lang="ts">
  209. import { message } from 'ant-design-vue';
  210. import DeviceEcharts from '../comment/DeviceEcharts.vue';
  211. import { onBeforeMount, ref, onMounted, onUnmounted, reactive, toRaw, watch, nextTick, inject, unref } from 'vue';
  212. import MonitorTable from '../comment/MonitorTable.vue';
  213. import HistoryTable from '../comment/HistoryTable.vue';
  214. import AlarmHistoryTable from '../comment/AlarmHistoryTable.vue';
  215. import HandlerHistoryTable from '../comment/HandlerHistoryTable.vue';
  216. import HandleModal from './components/modal.vue';
  217. import SupplyAir from './components/supplyAir.vue';
  218. import GasSupplyAir from './components/gasSupplyAir.vue';
  219. import DeviceBaseInfo from '../comment/components/DeviceBaseInfo.vue';
  220. import LinkControlDesModal from '../comment/components/LinkControlDesModal.vue';
  221. import { mountedThree, destroy, addMonitorText, computePlay, setModelType, initCameraCanvas } from './window.threejs';
  222. import { list, getTableList, updateWindowAutoAdjustStatus } from './window.api';
  223. import { list as baseList } from '../../deviceManager/windWindowTabel/ventanalyWindow.api';
  224. import { deviceControlApi } from '/@/api/vent/index';
  225. import lodash from 'lodash';
  226. import { setDivHeight } from '/@/utils/event';
  227. import { BorderBox8 as DvBorderBox8 } from '@kjgl77/datav-vue3';
  228. import { useRouter } from 'vue-router';
  229. import LivePlayer from '@liveqing/liveplayer-v3';
  230. import { useModal } from '/@/components/Modal';
  231. import { useCamera } from '/@/hooks/system/useCamera';
  232. import { usePermission } from '/@/hooks/web/usePermission';
  233. const { hasPermission } = usePermission();
  234. const globalConfig = inject('globalConfig');
  235. const { currentRoute } = useRouter();
  236. const MonitorDataTable = ref();
  237. const playerRef = ref();
  238. const scroll = reactive({
  239. y: 230,
  240. });
  241. const isMock = ref(VENT_PARAM['gasControlMock']);
  242. const modalIsShow = ref<boolean>(false); // 是否显示模态框
  243. const linkAlarmShow = ref<boolean>(false); // 是否显示模态框
  244. const modalTitle = ref(''); // 模态框标题显示内容,根据设备操作类型决定
  245. const modalType = ref(''); // 模态框内容显示类型,设备操作类型
  246. const deviceType = ref('window');
  247. const deviceBaseList = ref([]);
  248. const activeKey = ref('1');
  249. const loading = ref(false);
  250. const windowAngle = ref(0);
  251. const ch4 = ref(0.6);
  252. const targetVolume = ref(0);
  253. const showTargetModal = ref(false);
  254. const showGasModal = ref(false);
  255. // const rotationParam = {
  256. // frontDeg0: 0, // 前门初始
  257. // frontDeg1: windowAngle.value, // 前门目标
  258. // backDeg0: 0, // 后门初始
  259. // backDeg1: windowAngle.value, // 后门目标
  260. // };
  261. // 默认初始是第一行
  262. const selectRowIndex = ref(-1);
  263. const dataSource = ref([]);
  264. // 设备数据
  265. const controlType = ref(1);
  266. const flvURL1 = () => {
  267. return `/video/window.mp4`;
  268. };
  269. const [regModal, { openModal }] = useModal();
  270. const { getCamera, removeCamera } = useCamera();
  271. const tabChange = (activeKeyVal) => {
  272. activeKey.value = activeKeyVal;
  273. if (activeKeyVal == 1) {
  274. nextTick(() => {
  275. MonitorDataTable.value.setSelectedRowKeys([selectData.value.deviceID]);
  276. });
  277. }
  278. };
  279. const initData = {
  280. deviceID: '',
  281. deviceType: '',
  282. strname: '',
  283. dataDh: '-', //压差
  284. dataDtestq: '-', //测试风量
  285. sourcePressure: '-', //气源压力
  286. dataDequivalarea: '-',
  287. netStatus: '0', //通信状态
  288. fault: '气源压力超限',
  289. forntArea: '0',
  290. rearArea: '0',
  291. frontRearDifference: '-',
  292. rearPresentValue: '-',
  293. maxarea: 0,
  294. nwindownum: 0,
  295. };
  296. // 监测数据
  297. const selectData = ref(lodash.cloneDeep(initData));
  298. const currentData = ref(initData);
  299. // https获取监测数据
  300. let timer: null | NodeJS.Timeout = null;
  301. const getMonitor = (flag?) => {
  302. if (Object.prototype.toString.call(timer) === '[object Null]') {
  303. timer = setTimeout(
  304. async () => {
  305. const data = await getDataSource();
  306. currentData.value = data;
  307. selectData.value = data;
  308. playAnimation(selectData.value, selectData.value.maxarea);
  309. addMonitorText(selectData.value);
  310. if (timer) {
  311. timer = null;
  312. }
  313. getMonitor();
  314. },
  315. flag ? 0 : 2000
  316. );
  317. }
  318. };
  319. const getDataSource = async () => {
  320. const res = await list({ devicetype: deviceType.value, pagetype: 'normal' });
  321. dataSource.value = res.msgTxt[0].datalist || [];
  322. dataSource.value.forEach((data: any) => {
  323. const readData = data.readData;
  324. data = Object.assign(data, readData);
  325. });
  326. if (dataSource.value.length > 0 && selectRowIndex.value == -1) {
  327. // 初始打开页面
  328. if (currentRoute.value && currentRoute.value['query'] && currentRoute.value['query']['id']) {
  329. MonitorDataTable.value.setSelectedRowKeys([currentRoute.value['query']['id']]);
  330. } else {
  331. MonitorDataTable.value.setSelectedRowKeys([dataSource.value[0]['deviceID']]);
  332. }
  333. }
  334. const data: any = toRaw(dataSource.value[selectRowIndex.value]); //maxarea
  335. return data;
  336. };
  337. // 获取设备基本信息列表
  338. const getDeviceBaseList = () => {
  339. getTableList({ pageSize: 1000 }).then((res) => {
  340. deviceBaseList.value = res.records;
  341. });
  342. };
  343. // 切换检测数据
  344. const getSelectRow = async (selectRow, index) => {
  345. if (!selectRow) return;
  346. selectRowIndex.value = index;
  347. loading.value = true;
  348. const baseData: any = deviceBaseList.value.find((baseData: any) => baseData.id === selectRow.deviceID);
  349. selectData.value = Object.assign(initData, selectRow, baseData);
  350. const type = selectData.value.windowModal ? selectData.value.windowModal : selectData.value.nwindownum == 1 ? 'ddFc5' : 'sdFc1';
  351. setModelType(type).then(() => {
  352. addMonitorText(selectData.value);
  353. playAnimation(selectRow, selectData.value.maxarea, true);
  354. loading.value = false;
  355. });
  356. await getCamera(selectRow.deviceID, playerRef.value);
  357. };
  358. // 判断前后窗的面积是否发生改变,如果改变则开启动画
  359. const playAnimation = (data, maxarea = 90, isFirst = false) => {
  360. computePlay(data, maxarea, isFirst);
  361. };
  362. // 设置风窗面积
  363. const setArea = (flag) => {
  364. modalType.value = flag + '';
  365. if (flag == 1 || flag == 2) {
  366. if (selectData.value.nwindownum == 2) {
  367. modalTitle.value = flag === 1 ? '设定前窗面积' : '设定后窗面积';
  368. } else {
  369. modalTitle.value = '设定风窗面积';
  370. }
  371. modalIsShow.value = true;
  372. } else {
  373. if (!globalConfig?.simulatedPassword) {
  374. if (flag == 'ldkzStart') {
  375. modalTitle.value = '自主联动控制开启';
  376. } else if (flag == 'ldkzStop') {
  377. modalTitle.value = '自主联动控制停止';
  378. } else if (flag == 5) {
  379. modalTitle.value = '一键全开';
  380. } else if (flag == 6) {
  381. modalTitle.value = '一键全关';
  382. } else if (flag == 7) {
  383. modalTitle.value = '风量自主调控';
  384. }
  385. modalIsShow.value = true;
  386. } else {
  387. handleOK('', modalType.value, selectData.value.nwindownum);
  388. }
  389. }
  390. };
  391. // 设置风窗角度
  392. const setAngle = (flag) => {
  393. modalType.value = flag + '';
  394. if (flag == 1 || flag == 2) {
  395. if (selectData.value.nwindownum == 2) {
  396. modalTitle.value = flag === 1 ? '设定前窗角度' : '设定后窗角度';
  397. } else {
  398. modalTitle.value = '设定风窗角度';
  399. }
  400. modalIsShow.value = true;
  401. } else if (flag == 7) {
  402. modalTitle.value = '风量自主调控';
  403. modalIsShow.value = true;
  404. } else {
  405. if (!globalConfig?.simulatedPassword) {
  406. if (flag == 'ldkzStart') {
  407. modalTitle.value = '自主联动控制开启';
  408. } else if (flag == 'ldkzStop') {
  409. modalTitle.value = '自主联动控制停止';
  410. } else if (flag == 5) {
  411. modalTitle.value = '一键全开';
  412. } else if (flag == 6) {
  413. modalTitle.value = '一键全关';
  414. }
  415. modalIsShow.value = true;
  416. } else {
  417. handleOK('', modalType.value, selectData.value.nwindownum);
  418. }
  419. }
  420. };
  421. const setControl = (flag, title) => {
  422. modalType.value = flag + '';
  423. modalTitle.value = title;
  424. modalIsShow.value = true;
  425. };
  426. const handleOK = (passWord, handlerState, value) => {
  427. if (!passWord && !globalConfig?.simulatedPassword) {
  428. message.warning('请输入密码!');
  429. return;
  430. }
  431. let data = {
  432. deviceid: selectData.value.deviceID,
  433. devicetype: selectData.value.deviceType,
  434. paramcode: '',
  435. password: passWord || globalConfig?.simulatedPassword,
  436. value: null,
  437. };
  438. let params;
  439. // 风窗风量自主调控
  440. if (handlerState == 7 || handlerState == 8) {
  441. if (handlerState == 7) {
  442. // 单道风窗
  443. params = {
  444. windowId: selectData.value.deviceID,
  445. auto: 1,
  446. fengliangF: value,
  447. };
  448. }
  449. updateWindowAutoAdjustStatus(params).then((res) => {
  450. if (res.success) {
  451. if (globalConfig.History_Type == 'remote') {
  452. message.success('指令已下发至生产管控平台成功!');
  453. } else {
  454. message.success('指令已下发成功!');
  455. }
  456. handleCancel();
  457. targetVolume.value = value;
  458. showTargetModal.value = true;
  459. } else {
  460. message.error(res.message);
  461. }
  462. });
  463. return;
  464. } else if (handlerState == 'ldkzStart' || handlerState == 'ldkzStop') {
  465. data.paramcode = 'autoRun';
  466. data.value = handlerState == 'ldkzStart' ? 1 : 0;
  467. if (handlerState == 'ldkzStart') {
  468. ch4.value = value;
  469. params = { auto: 1, windowId: selectData.value.deviceID, gasMax: ch4.value };
  470. } else {
  471. params = { auto: 0, windowId: selectData.value.deviceID };
  472. }
  473. if (isMock.value) {
  474. showGasModal.value = true;
  475. } else {
  476. updateWindowAutoAdjustStatus(params).then((res) => {
  477. if (res.success) {
  478. if (globalConfig.History_Type == 'remote') {
  479. message.success('指令已下发至生产管控平台成功!');
  480. } else {
  481. message.success('指令已下发成功!');
  482. }
  483. handleCancel();
  484. showGasModal.value = true;
  485. } else {
  486. message.error(res.message);
  487. }
  488. });
  489. }
  490. } else {
  491. if (handlerState == 1 || handlerState == 2) {
  492. windowAngle.value = value;
  493. data.paramcode = handlerState == 1 ? 'frontSetValue' : 'rearSetValue';
  494. data.value = windowAngle.value;
  495. } else if (handlerState == 5 || handlerState == 6) {
  496. data.paramcode = 'frontSetValue';
  497. data.value = handlerState == 5 ? selectData.value.maxarea : 0;
  498. } else if (handlerState.startsWith('frontSetValue')) {
  499. data.paramcode = handlerState;
  500. data.value = value;
  501. } else {
  502. data.paramcode = handlerState;
  503. data.value = value;
  504. }
  505. deviceControlApi(handlerState == 3 ? params : data)
  506. .then((res) => {
  507. if (res.success) {
  508. if (globalConfig.History_Type == 'remote') {
  509. message.success('指令已下发至生产管控平台成功!');
  510. } else {
  511. message.success('指令已下发成功!');
  512. }
  513. } else {
  514. message.error(res.message);
  515. }
  516. })
  517. .finally(() => {
  518. handleCancel();
  519. });
  520. }
  521. };
  522. const handleCancel = () => {
  523. modalIsShow.value = false;
  524. modalTitle.value = '';
  525. modalType.value = '';
  526. };
  527. function deviceEdit(e: Event, type: string, record) {
  528. e.stopPropagation();
  529. openModal(true, {
  530. type,
  531. deviceId: record['deviceID'],
  532. });
  533. }
  534. onBeforeMount(() => {
  535. // const sendVal = JSON.stringify({ pagetype: 'normal', devicetype: 'window', orgcode: '', ids: '', systemID: '' });
  536. // initWebSocket(sendVal);
  537. getDeviceBaseList();
  538. });
  539. onMounted(() => {
  540. const { query } = unref(currentRoute);
  541. if (query['deviceType']) deviceType.value = query['deviceType'] as string;
  542. loading.value = true;
  543. mountedThree().then(async () => {
  544. getMonitor(true);
  545. loading.value = false;
  546. addMonitorText(selectData.value);
  547. });
  548. });
  549. onUnmounted(() => {
  550. destroy();
  551. removeCamera();
  552. if (timer) {
  553. clearTimeout(timer);
  554. timer = undefined;
  555. }
  556. });
  557. </script>
  558. <style lang="less" scoped>
  559. @import '/@/design/theme.less';
  560. @import '/@/design/vent/modal.less';
  561. @ventSpace: zxm;
  562. // :deep(.@{ventSpace}-tabs-tabpane-active) {
  563. // height: 100%;
  564. // }
  565. .input-box {
  566. display: flex;
  567. align-items: center;
  568. padding-left: 10px;
  569. .input-title {
  570. color: var(--vent-font-action-link);
  571. width: auto;
  572. }
  573. .@{ventSpace}-input-number {
  574. border-color: #ffffff88 !important;
  575. }
  576. margin-right: 10px;
  577. }
  578. .scene-box {
  579. .bottom-tabs-box {
  580. height: 350px;
  581. }
  582. }
  583. :deep(.@{ventSpace}-picker-datetime-panel) {
  584. height: 200px !important;
  585. overflow-y: auto !important;
  586. }
  587. </style>