index.vue 24 KB

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