123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 |
- import { FormattedMessage, useModel } from 'umi';
- import {
- changeAllAirHttp,
- changeAirHttp,
- setEquipeHttp,
- setallLampHttp,
- getStatusHttp,
- getLampHttp,
- getFeedbackDocumentsHttp
- } from '@/services/sagacare_service/equipment';
- import { Spin, Modal, message } from 'antd';
- import { setallLamps } from '@/pages/Equipment/checLampStatus.js';
- export const changeLight = (type, itemarr, getDeviceStatus, status) => {
-
-
- const setType = status === '打开' ? true : false;
- var paramsArr = [];
- itemarr.forEach((citem) => {
- (citem.equipList||[]).forEach((item) => {
- if (item.equipType == 'light') {
- paramsArr.push({
- id: item.id,
- switch: setType,
- });
- }
- });
- });
- setallLamps(paramsArr, getDeviceStatus);
- };
- export const changeCurtain = (type, itemarr, getDeviceStatus, status) => {
- const setType = status === '打开' ? 'EquipOnSet' : 'EquipOffSet';
- var paramsArr = [];
- itemarr.forEach((citem) => {
- (citem.equipList||[]).forEach((item) => {
- if (item.equipType == 'curtain') {
- paramsArr.push({
- equipmentCategory: 'CFSSES',
- infoCode: setType,
- value: 1,
- objectId: item.id,
- });
- }
- });
- });
-
- setEquipeHttp(paramsArr);
- message.success('指令已经下发');
-
- getDeviceStatus && getDeviceStatus();
- };
- export const changeAir = (sitem, index, getDeviceStatus) => {
- const itemId = sitem.airConditioner === 0 ? 12 : 10;
- const paramsObj = {
- objectId: sitem.spaceId,
- valueType: 1,
- itemId: itemId,
- };
- changeAirHttp(paramsObj).then((res) => {
- if (res.result == 'success') {
- message.success('指令已经下发');
-
-
-
-
-
- getDeviceStatus && getDeviceStatus();
- } else {
- message.error('操作失败,请重试');
- }
- }).catch((err)=>{
- });
- };
- export const changeAllAir = (itemarr, getDeviceStatus, status, projectId) => {
- let paramsArr = [];
- itemarr.forEach((sitem) => {
- const itemId = status === '打开' ? 12 : 10;
- paramsArr.push({
- projectId: projectId,
- objectId: sitem.spaceId,
- valueType: 1,
- itemId: itemId,
- });
- });
- setTimeout(()=>{
- message.success({
- content:`指令已经下发,设备会逐步${status === '打开'?'开启':'关闭'},请耐心等待,勿频繁操作`,
- duration:4,
- });
- },3000);
- changeAllAirHttp(paramsArr).then((res) => {
- if (res.result == 'success') {
-
- getDeviceStatus && getDeviceStatus();
- } else {
-
- }
- }).catch((err)=>{
- console.log('err',err);
- });
- };
|