index.vue 76 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549
  1. <template>
  2. <div
  3. class="main"
  4. :style="{
  5. backgroundImage:
  6. 'linear-gradient(0deg, rgba(69, 33, 0, 0.2), rgba(69, 33, 0, 0.2)), url(' +
  7. padBgImg +
  8. ')',
  9. 'background-repeat': 'no-repeat',
  10. }"
  11. >
  12. <div class="main-left">
  13. <div
  14. class="left-top"
  15. @touchstart="gtouchstart($event)"
  16. @touchmove="gtouchmove()"
  17. @touchend="showDeleteButton"
  18. >
  19. <div class="logo-box">
  20. <img class="logo-icon" v-if="logImg" :src="logImg" alt="" />
  21. <img
  22. class="logo-icon"
  23. v-else
  24. :src="parseImgUrl('ipdImages', 'shangeyun_logo.svg')"
  25. alt=""
  26. />
  27. </div>
  28. <div class="left-time">
  29. <span>{{ nowDate }} </span>
  30. <span>{{ nowWeek }}</span>
  31. </div>
  32. <div class="weather">
  33. <img
  34. v-show="outWeather.imgname"
  35. :src="outWeather.imgname"
  36. class="weather-icon"
  37. alt=""
  38. />
  39. <span
  40. >{{ outWeather.temperature ? outWeather.temperature : "--" }}℃</span
  41. >
  42. </div>
  43. <div class="weixiin" v-if="contantDetail" @click="showContact">
  44. <img :src="parseImgUrl('ipdImages', 'weixin.svg')" />
  45. <span> 联系客服</span>
  46. </div>
  47. </div>
  48. <div class="left-space">
  49. <div class="text">
  50. <div>
  51. {{ officeData.localName }}
  52. </div>
  53. <!-- <div
  54. v-if="
  55. officeData.isPassengerPass === true ||
  56. officeData.isPassengerPass === false
  57. "
  58. >
  59. <img
  60. :src="parseImgUrl('ipdImages', 'vector-active.svg')"
  61. v-if="officeData.isPassengerPass"
  62. />
  63. <img
  64. :src="parseImgUrl('ipdImages', 'vector.svg')"
  65. v-if="!officeData.isPassengerPass"
  66. />
  67. <span v-if="officeData.isPassengerPass">有人</span>
  68. <span v-if="!officeData.isPassengerPass">无人</span>
  69. </div> -->
  70. </div>
  71. <div class="space-info">
  72. <div class="space-temp">
  73. <img :src="parseImgUrl('ipdImages', 'template-icon.svg')" alt="" />
  74. <span class="temp-text">温度</span>
  75. <span class="temp-num"
  76. >{{ officeData.temperature ? officeData.temperature : "--"
  77. }}<sup>℃</sup></span
  78. >
  79. </div>
  80. </div>
  81. <div class="space-env">
  82. <div
  83. class="env-item"
  84. :style="[
  85. { background: item.bgColor ? item.bgColor : '' },
  86. { opacity: item.bgColor ? 0.8 : '' },
  87. { paddingLeft: index == 0 && item.bgColor ? '15px' : '' },
  88. ]"
  89. :class="[
  90. index == 1 ? 'env-color' : '',
  91. item.bgColor ? 'env-item-radius' : '',
  92. ]"
  93. :key="'env' + index"
  94. @click="handleDetail(item)"
  95. v-for="(item, index) in envlist"
  96. >
  97. <div>
  98. <img :src="parseImgUrl('ipdImages', item.img)" alt="" />
  99. <span>{{ item.name }}</span>
  100. </div>
  101. <div class="env-text">
  102. {{ item.num }} <sup>{{ item.unit }}</sup>
  103. </div>
  104. </div>
  105. </div>
  106. </div>
  107. <div class="fotter" v-if="spaceData && spaceData.length > 1">
  108. <template v-for="(item, index) in spaceData">
  109. <div
  110. class="fotter-item"
  111. :class="item.active ? 'fotter-item-active' : ''"
  112. :key="index + 'nav'"
  113. v-if="index < 3"
  114. @click="changeSpace(item)"
  115. >
  116. <img
  117. v-if="item.active"
  118. :src="parseImgUrl('ipdImages', 'rectangle-active.svg')"
  119. />
  120. <img :src="parseImgUrl('ipdImages', 'rectangle1.svg')" v-else />
  121. <span>{{ item.spaceName }} </span>
  122. </div>
  123. </template>
  124. <div
  125. class="fotter-item-end"
  126. @click="moreSpace"
  127. v-if="spaceData && spaceData.length > 3"
  128. >
  129. <img :src="parseImgUrl('ipdImages', 'rectangle-fotter.svg')" />
  130. <span>…</span>
  131. </div>
  132. </div>
  133. </div>
  134. <div class="main-right">
  135. <!--加班start-->
  136. <div
  137. class="work-btn"
  138. v-if="
  139. (roomType === '开放' && isWork) ||
  140. (roomType === '会议室' && scenarioArr && scenarioArr.length)
  141. "
  142. >
  143. <!--自动控制的加班 start-->
  144. <WorkConfig
  145. v-if="roomType === '开放' && isWork && controlMode == 0"
  146. key="workCkey"
  147. :workkArr="workkArr"
  148. @closeWork="closeWork"
  149. @triggerWork="triggerWork"
  150. @setForceOverTimeFlag="setForceOverTimeFlag"
  151. ></WorkConfig>
  152. <!--手动控制的加班 start-->
  153. <template v-if="roomType === '开放' && isWork && controlMode == 1">
  154. <ManualConfig
  155. key="manualckey"
  156. :workkArr="workkArr"
  157. @closeWork="closeWork"
  158. @triggerWork="triggerWork"
  159. @setForceOverTimeFlag="setForceOverTimeFlag"
  160. ></ManualConfig>
  161. </template>
  162. <scenario-config
  163. v-if="roomType === '会议室' && scenarioArr && scenarioArr.length"
  164. :activeType="activeType"
  165. :scenarioArr="scenarioArr"
  166. :spaceId="spaceInfo.spaceId"
  167. :projectId="projectId"
  168. @setHeadScene="setHeadScene"
  169. ></scenario-config>
  170. </div>
  171. <!--加班end-->
  172. <!--空调手动控制 start-->
  173. <manual-index
  174. v-if="controlMode == 1 && spaceExistenceDevice.airConditioner"
  175. key="manualKey"
  176. ref="manualAirRef"
  177. @triggerWork="triggerWork"
  178. :seviceEquipmentList="seviceEquipmentList"
  179. :forceOverTimeFlag="forceOverTimeFlag"
  180. @updateAirTemp="updateAirTemp"
  181. @showChildAirControl="showChildAirControl"
  182. :airVolumes="officeData.airVolumes"
  183. :temperature="officeData.temperature"
  184. :spaceId="spaceInfo.spaceId"
  185. :projectId="projectId"
  186. :userIsControl="userIsControl"
  187. >
  188. </manual-index>
  189. <!--空调手动控制 end-->
  190. <!--空调自动控制 start-->
  191. <Air
  192. v-if="controlMode == 0 && spaceExistenceDevice.airConditioner"
  193. id="airId"
  194. key="airKey"
  195. @triggerWork="triggerWork"
  196. :forceOverTimeFlag="forceOverTimeFlag"
  197. @updateAirTemp="updateAirTemp"
  198. :hasAir="spaceExistenceDevice.airConditioner"
  199. :airVolumes="officeData.airVolumes"
  200. :temperature="officeData.temperature"
  201. :spaceId="spaceInfo.spaceId"
  202. :projectId="projectId"
  203. :isACATVA="isACATVA"
  204. :userIsControl="userIsControl"
  205. />
  206. <!--空调自动控制 end-->
  207. <!--地暖 start-->
  208. <floor-heating
  209. v-if="spaceInfo.spaceId"
  210. :forceOverTimeFlag="forceOverTimeFlag"
  211. :seviceEquipmentList="seviceEquipmentList"
  212. @triggerWork="triggerWork"
  213. @showFloorHeating="showFloorHeating"
  214. id="floorHeatingId"
  215. key="floorHeatingKey"
  216. :userIsControl="userIsControl"
  217. :spaceId="spaceInfo.spaceId"
  218. :projectId="projectId"
  219. ></floor-heating>
  220. <!--地暖 end-->
  221. <!--出于性能的灯的显示和隐藏最好放在子组件里面判断,减少组件频繁重新加载的问题-->
  222. <Light
  223. v-if="spaceInfo.spaceId"
  224. :showLight="spaceExistenceDevice.light"
  225. :forceOverTimeFlag="forceOverTimeFlag"
  226. :controlMode="controlMode"
  227. :seviceEquipmentList="seviceEquipmentList"
  228. @triggerWork="triggerWork"
  229. @showLightColorCtrol="showLightColorCtrol"
  230. id="lightId"
  231. key="lightKey"
  232. :userIsControl="userIsControl"
  233. :spaceId="spaceInfo.spaceId"
  234. :projectId="projectId"
  235. />
  236. <Curtain
  237. :spaceId="spaceInfo.spaceId"
  238. id="curtainId"
  239. key="curtainKey"
  240. ref="curtainRef"
  241. @showCurtainOpening="showCurtainOpening"
  242. :userIsControl="userIsControl"
  243. v-if="spaceExistenceDevice.curtain && spaceInfo.spaceId"
  244. :projectId="projectId"
  245. />
  246. <!-- <Curtain
  247. :spaceId="spaceInfo.spaceId"
  248. id="curtainId"
  249. key="curtainKey"
  250. :userIsControl="userIsControl"
  251. v-if="spaceExistenceDevice.curtain && spaceInfo.spaceId"
  252. :projectId="projectId"
  253. /> -->
  254. </div>
  255. <!--加班场景-->
  256. <van-popup
  257. v-model:show="isShowWork"
  258. position="right"
  259. :close-on-click-overlay="false"
  260. class="popup-content"
  261. teleport="#app"
  262. >
  263. <work-overtime
  264. v-if="isShowWork && controlMode == 0"
  265. :spaceInfo="spaceInfo"
  266. @closeWork="closeWork"
  267. :projectId="projectId"
  268. :workkArr="workkArr"
  269. ></work-overtime>
  270. <!--加班手动控制 start-->
  271. <manual-overtime
  272. v-if="isShowWork && controlMode == 1"
  273. :seviceEquipmentList="seviceEquipmentList"
  274. :enterType="enterType"
  275. :deviceItem="deviceItem"
  276. :spaceInfo="spaceInfo"
  277. @closeWork="closeWork"
  278. :projectId="projectId"
  279. :workkArr="workkArr"
  280. >
  281. </manual-overtime>
  282. </van-popup>
  283. <!--会议室场景-->
  284. <van-popup
  285. v-model:show="isShowMetting"
  286. position="right"
  287. :close-on-click-overlay="false"
  288. class="popup-content"
  289. teleport="#app"
  290. >
  291. <scenario-dailog
  292. :secenaroStatus="secenaroStatus"
  293. @closeDailog="closeDailog"
  294. >
  295. </scenario-dailog>
  296. </van-popup>
  297. <!--环境数据详情-->
  298. <van-popup
  299. v-model:show="isShowDetail"
  300. position="right"
  301. :close-on-click-overlay="true"
  302. class="popup-content"
  303. teleport="#app"
  304. >
  305. <detail :query="detailQuery" v-if="isShowDetail"></detail>
  306. </van-popup>
  307. <!--地图数据列表-->
  308. <van-popup
  309. v-model:show="isShowMap"
  310. class="map-popup"
  311. position="bottom"
  312. style="width: 100%; height: 70%"
  313. :close-on-click-overlay="true"
  314. teleport="#app"
  315. >
  316. <com-map
  317. v-if="defaultSpace.spaceId && isShowMap"
  318. :spaceData="copySpaceData"
  319. :spaceInfo="defaultSpace"
  320. :projectId="projectId"
  321. :floorId="defaultSpace.floorId"
  322. :buildingId="defaultSpace.buildingId"
  323. @changeSpace="changeSpace"
  324. ></com-map>
  325. </van-popup>
  326. <!--联系方式-->
  327. <contact
  328. :isShowContact="isShowContact"
  329. :contantDetail="contantDetail"
  330. v-if="isShowContact"
  331. @closeDailog="closeContactDailog"
  332. ></contact>
  333. <!--灯灯调光和调色温-->
  334. <van-popup
  335. v-model:show="isLightColorFlag"
  336. position="right"
  337. :close-on-click-overlay="true"
  338. class="popup-content-small"
  339. teleport="#app"
  340. >
  341. <div>
  342. <light-temp :lightData="lightData" v-if="isLightColorFlag"></light-temp>
  343. </div>
  344. </van-popup>
  345. <!--地暖调光和调色温-->
  346. <van-popup
  347. v-model:show="isFloorHeatingTemp"
  348. position="right"
  349. :close-on-click-overlay="true"
  350. class="popup-content-small"
  351. teleport="#app"
  352. >
  353. <div>
  354. <ChildTempSet
  355. :floorData="floorData"
  356. v-if="isFloorHeatingTemp"
  357. ></ChildTempSet>
  358. </div>
  359. </van-popup>
  360. <!--窗帘开度设置-->
  361. <van-popup
  362. v-model:show="isCurtainOpening"
  363. position="right"
  364. :close-on-click-overlay="true"
  365. @click-overlay="closeCurtainOpening"
  366. class="popup-content-small"
  367. teleport="#app"
  368. >
  369. <div v-if="isCurtainOpening">
  370. <curtain-opening
  371. v-if="isCurtainOpening"
  372. :curtainData="curtainData"
  373. ></curtain-opening>
  374. </div>
  375. </van-popup>
  376. <!--空调子设备控制功能-->
  377. <van-popup
  378. v-model:show="isChildAirControl"
  379. position="right"
  380. @click-overlay="closeChildAirControl"
  381. class="popup-content-small"
  382. teleport="#app"
  383. >
  384. <div v-if="isChildAirControl">
  385. <ChildAirControl
  386. :airData="airData"
  387. v-if="isChildAirControl"
  388. ></ChildAirControl>
  389. </div>
  390. </van-popup>
  391. </div>
  392. </template>
  393. <script lang="ts">
  394. import {
  395. defineComponent,
  396. reactive,
  397. toRefs,
  398. ref,
  399. onBeforeMount,
  400. onMounted,
  401. nextTick,
  402. onBeforeUnmount,
  403. getCurrentInstance,
  404. } from "vue";
  405. import WorkOvertime from "./components/workOvertime/index.vue";
  406. import ManualOvertime from "./components/ManualWork/index.vue";
  407. import Contact from "./components/Contact/index.vue";
  408. import WorkConfig from "./components/workOvertime/WorkConfig.vue";
  409. import ManualConfig from "./components/ManualWork/WorkConfig.vue";
  410. import ScenarioConfig from "./components/Scenario/ScenarioConfig.vue";
  411. import MapBox from "@/views/envmonitor/components/Map/MapBox.vue";
  412. import Header from "@/components/header/Index.vue";
  413. import Comheader from "@/components/header/Comheader.vue";
  414. import Air from "@/views/envmonitor/components/Air/index.vue";
  415. import FloorHeating from "@/views/envmonitor/components/FloorHeating/index.vue";
  416. import ManualIndex from "@/views/envmonitor/components/Air/manualIndex.vue";
  417. import Light from "@/views/envmonitor/components/Light/index.vue";
  418. import Curtain from "@/views/envmonitor/components/Curtain/index.vue";
  419. import CurtainOpening from "@/views/envmonitor/components/Curtain/CurtainOpening.vue";
  420. import TimeBox from "@/views/envmonitor/TimeBox.vue";
  421. import NavBar from "@/views/envmonitor/NavBar.vue";
  422. import ScenarioDailog from "@/views/envmonitor/components/Scenario/scenarioDailog.vue";
  423. import Detail from "@/views/envmonitor/detail.vue";
  424. import ComMap from "@/views/envmonitor/components/Map/index.vue";
  425. import LightTemp from "@/views/envmonitor/components/Light/LightTemp.vue";
  426. import ChildTempSet from "@/views/envmonitor/components/FloorHeating/ChildTempSet.vue";
  427. import ChildAirControl from "@/views/envmonitor/components/Air/ChildAirControl.vue";
  428. import { Icon, Popup, Dialog, Toast } from "vant";
  429. import { useRouter, useRoute } from "vue-router";
  430. import {
  431. getCompanyInfo,
  432. getWeather,
  433. getSpaceInfo,
  434. getMeetingSceneHttp,
  435. getSetTimeHttp,
  436. changeSetTimeHttp,
  437. getSpaceEquipType,
  438. getPermanentSpace,
  439. getUserControlAuth,
  440. getSpaceMode,
  441. getSpaceTemp,
  442. querySpaceSceneConfig,
  443. queryCustomAndScence,
  444. queryWorkSpace,
  445. getPadImg,
  446. getSpaceEquipList,
  447. queryCustomerservice,
  448. } from "@/apis/envmonitor";
  449. import Keys from "@/constant/key";
  450. import {
  451. formatDate,
  452. formatDateStr,
  453. getHours,
  454. getLocalNewSpaceInfo,
  455. getNowWeek,
  456. getRelNowTime,
  457. getUserInfo,
  458. parseImgUrl,
  459. setQueryConfig,
  460. } from "@/utils";
  461. import { store } from "@/store";
  462. import { SpaceInfoModel } from "@/model/userModel";
  463. import { getWorkType } from "@/utils/mapIcon";
  464. import { getCookieMac } from "@/utils/cookies";
  465. export default defineComponent({
  466. components: {
  467. MapBox,
  468. ComMap,
  469. ScenarioDailog,
  470. LightTemp,
  471. Header,
  472. Comheader,
  473. NavBar,
  474. Air,
  475. FloorHeating,
  476. ManualIndex,
  477. ManualOvertime,
  478. ChildAirControl,
  479. Light,
  480. Curtain,
  481. TimeBox,
  482. WorkOvertime,
  483. WorkConfig,
  484. ManualConfig,
  485. ScenarioConfig,
  486. Detail,
  487. Contact,
  488. ChildTempSet,
  489. CurtainOpening,
  490. [Dialog.Component.name]: Dialog.Component,
  491. VanPopup: Popup,
  492. VanIcon: Icon,
  493. },
  494. beforeRouteEnter(to, from, next) {
  495. let mac: any = getCookieMac();
  496. if (mac && mac != "null") {
  497. next();
  498. } else {
  499. next("/error");
  500. }
  501. },
  502. setup() {
  503. const proxyGlobal: any = getCurrentInstance();
  504. const router: any = useRouter();
  505. const route: any = useRoute();
  506. const document: any = window.document;
  507. const screenHeight: any = document.body.clientHeight;
  508. const outWeather: any = {};
  509. const weatherTimer: any = null;
  510. const equimentsTimer: any = null;
  511. let curtainData: any = [];
  512. let secenaroStatus: any = {};
  513. // 空间数据(包括空间下的设备的状态)
  514. const officeData: any = {};
  515. let spaceEqFlagObj: SpaceInfoModel = {
  516. hasAir: true, // 有无空调
  517. hasBlowing: false, // 空调有无 变风量系统
  518. hasLamp: false, //有无灯具
  519. };
  520. const popList: any = [];
  521. const detailQuery: any = {};
  522. // 空间类型
  523. let spaceInfo: any = {};
  524. const projectId: string = store.state.user.projectId;
  525. const sceneDetail: any = {};
  526. const timeOutEvent: any = {};
  527. const touchInterval: any = {};
  528. const contantDetail: any = {};
  529. const cusServiceTimer: any = null;
  530. const headerInfo: {
  531. headImg: any;
  532. headScene: string;
  533. tipText: string;
  534. tipTextSwatch: boolean;
  535. } = {
  536. headImg: "",
  537. headScene: "",
  538. tipText: "选择工作结束时间",
  539. tipTextSwatch: false,
  540. };
  541. let spaceExistenceDevice: any = {
  542. curtain: false,
  543. light: false,
  544. airConditioner: false,
  545. bodySensor: false,
  546. };
  547. let curtainRef: any = {};
  548. let manualAirRef: any = {};
  549. // let mapRef: any = {}
  550. let intervalTimer: any = null;
  551. const workInfo: any = {};
  552. const userInfo: any = getUserInfo();
  553. let lightData: any = {};
  554. let floorData: any = {};
  555. let spaceTimer: any = null;
  556. let listSen: any = [
  557. {
  558. id: 0,
  559. code: "DISCUSSING",
  560. name: "会议模式",
  561. img: "scene_work.svg",
  562. checked: true,
  563. textObj: [
  564. {
  565. text: "照明灯光已全部为您开启",
  566. status: "ok",
  567. },
  568. {
  569. text: "演示设备已为您准备",
  570. status: "ok",
  571. },
  572. {
  573. text: "空调已为您开启",
  574. type: "air",
  575. status: "ok",
  576. },
  577. ],
  578. },
  579. {
  580. id: 1,
  581. code: "PROJECTING",
  582. name: "投影模式",
  583. img: "scene_visitor.svg",
  584. checked: false,
  585. textObj: [
  586. {
  587. text: "主灯已为您关闭,氛围灯为您开启",
  588. status: "ok",
  589. },
  590. {
  591. text: "演示设备已为您开启",
  592. status: "ok",
  593. },
  594. {
  595. text: "空调已为您开启",
  596. type: "air",
  597. status: "ok",
  598. },
  599. {
  600. text: "窗帘已为您关闭",
  601. status: "ok",
  602. },
  603. ],
  604. },
  605. {
  606. id: 2,
  607. code: "ADJOURNMENT",
  608. name: "全关模式",
  609. img: "scene_rest.svg",
  610. checked: false,
  611. textObj: [
  612. {
  613. text: "照明灯光2min后将全部关闭",
  614. status: "ok",
  615. },
  616. {
  617. text: "演示设备已为您关闭",
  618. status: "ok",
  619. },
  620. {
  621. text: "空调全部关闭",
  622. type: "air",
  623. status: "ok",
  624. },
  625. {
  626. text: "窗帘已为您关闭",
  627. status: "ok",
  628. },
  629. ],
  630. },
  631. ];
  632. let userSpaceInfo: any = [];
  633. let spaceModelTimer: any = null;
  634. let spaceTempTimer: any = null;
  635. let dateInter: any = null;
  636. let envlist: any = [
  637. {
  638. id: 2,
  639. name: "甲醛",
  640. num: "",
  641. level: "",
  642. bgColor: "",
  643. img: "jiaquan.svg",
  644. funcid: "HCHO",
  645. code: "jiaquan",
  646. unit: "mg/m³",
  647. },
  648. {
  649. id: 0,
  650. name: "CO₂",
  651. bgColor: "",
  652. num: "",
  653. level: "",
  654. img: "co2.svg",
  655. funcid: "CO2",
  656. code: "co2",
  657. unit: "ppm",
  658. },
  659. {
  660. id: 1,
  661. name: "PM2.5",
  662. bgColor: "",
  663. num: "",
  664. level: "",
  665. funcid: "PM2d5",
  666. img: "pm2.5.svg",
  667. code: "pm25",
  668. unit: "ug/m³",
  669. },
  670. {
  671. id: 3,
  672. name: "湿度",
  673. bgColor: "",
  674. img: "humidity.svg",
  675. num: "",
  676. level: "",
  677. funcid: "Tdb,RH",
  678. code: "shidu",
  679. unit: "%",
  680. },
  681. ];
  682. let scenarioArr: any = [];
  683. let sceneConfigTimer: any = [];
  684. let realEevList: any = []; // 解决v-if报错的问题临时使用
  685. let workkArr: any = [];
  686. let spaceData: any = [];
  687. let secenTimer: any = {};
  688. let nowDate: any = formatDate("YYYY.MM.DD HH:mm");
  689. let nowWeek: any = getNowWeek();
  690. let padImgData: any = [];
  691. let controlMode: any = null;
  692. let deviceItem: any = null;
  693. let allDevice: any = [];
  694. let spaceEquipList: any = [];
  695. let equipTimer: any = null;
  696. let airData: any = {};
  697. const proxyData = reactive({
  698. equipTimer: equipTimer,
  699. seviceEquipmentList: allDevice, // 所有的设备
  700. spaceEquipList: spaceEquipList,
  701. enterType: 1,
  702. deviceItem: deviceItem,
  703. parseImgUrl: parseImgUrl,
  704. fileUrl: proxyGlobal.proxy.$fileUrl,
  705. nowDate: nowDate,
  706. nowWeek: nowWeek,
  707. isShowWork: false,
  708. isShowMetting: false,
  709. localName: "",
  710. airTemp: "",
  711. userIsControl: true,
  712. spaceModelTimer: spaceModelTimer,
  713. spaceTempTimer: spaceTempTimer,
  714. userSpaceInfo: userSpaceInfo,
  715. spaceTimer: spaceTimer,
  716. workInfo: workInfo,
  717. intervalTimer: intervalTimer,
  718. roomType: "",
  719. showSpaceTip: false,
  720. mapOpacity: 0,
  721. opacityV: 1,
  722. curtainRef: curtainRef,
  723. manualAirRef: manualAirRef,
  724. hideTopImg: false,
  725. isBottom: false,
  726. isScrool: false,
  727. officeData: officeData,
  728. popList: popList,
  729. popupType: "scenario",
  730. showSecenDetailDalig: false,
  731. sceneDetail: sceneDetail,
  732. showScenario: false,
  733. projectId: projectId,
  734. spaceInfo: spaceInfo,
  735. headerInfo: headerInfo,
  736. topbgimg: "",
  737. userInfo: userInfo,
  738. deviceIcon: "arrow",
  739. visible: false,
  740. outWeather: outWeather,
  741. vanPopupIndex: "",
  742. spaceEqFlagObj: spaceEqFlagObj,
  743. spaceExistenceDevice: spaceExistenceDevice,
  744. listOffice: [
  745. {
  746. id: 0,
  747. name: "工作",
  748. code: "work",
  749. img: "scene_work.svg",
  750. checked: true,
  751. textObj: [
  752. {
  753. text: "办公区灯光已全部为您开启",
  754. status: "ok",
  755. },
  756. {
  757. text: "正在将温度调至 26℃",
  758. status: "ok",
  759. },
  760. {
  761. text: "窗帘已为您全部打开",
  762. status: "ok",
  763. },
  764. {
  765. text: "饮用水已为您准备",
  766. status: "ok",
  767. },
  768. ],
  769. },
  770. {
  771. id: 1,
  772. name: "会客",
  773. code: "guest",
  774. img: "scene_visitor.svg",
  775. checked: false,
  776. textObj: [
  777. {
  778. text: "会客区照明已为您开启",
  779. status: "ok",
  780. },
  781. {
  782. text: "空调已为您切换至会客温度,目标温度24℃",
  783. status: "ok",
  784. },
  785. {
  786. text: "窗帘已为您全部开启",
  787. status: "ok",
  788. },
  789. {
  790. text: "演示设备已为您准备",
  791. status: "ok",
  792. },
  793. {
  794. text: "饮用水已为您准备",
  795. status: "ok",
  796. },
  797. ],
  798. },
  799. {
  800. id: 2,
  801. name: "休息",
  802. code: "rest",
  803. img: "scene_rest.svg",
  804. checked: false,
  805. textObj: [
  806. {
  807. text: "主灯已关闭,氛围灯将为您开启",
  808. status: "ok",
  809. },
  810. {
  811. text: "空调将为您调节至适宜休息的温度,目标温度26℃",
  812. status: "ok",
  813. },
  814. {
  815. text: "窗帘已为您全部关闭",
  816. status: "ok",
  817. },
  818. ],
  819. },
  820. ],
  821. listSen: listSen,
  822. isACATVA: false,
  823. showWorkOff: false, // 开放办公室的 提前关闭是否展示
  824. envlist: envlist,
  825. realEevList: realEevList,
  826. navList: [
  827. {
  828. top: 0,
  829. id: "airId",
  830. code: "air",
  831. name: "温度/湿度",
  832. noShow: true,
  833. img: parseImgUrl("page-officehome", "temp.png"),
  834. activeImg: parseImgUrl("page-officehome", "temp_active.svg"),
  835. },
  836. {
  837. top: 0,
  838. id: "lightId",
  839. code: "lamp",
  840. name: "光照",
  841. noShow: false,
  842. img: parseImgUrl("page-officehome", "lamp.png"),
  843. activeImg: parseImgUrl("page-officehome", "lamp_active.svg"),
  844. },
  845. {
  846. top: 0,
  847. id: "curtainId",
  848. code: "curtain",
  849. name: "窗帘",
  850. noShow: false,
  851. img: parseImgUrl("page-officehome", "curtain-nav.svg"),
  852. activeImg: parseImgUrl("page-officehome", "curtain-nav-active.svg"),
  853. },
  854. {
  855. top: 0,
  856. id: 4,
  857. code: "mySpace",
  858. name: "常驻空间",
  859. noShow: false,
  860. activeImg: parseImgUrl("page-officehome", "mySpaceIcon.svg"),
  861. img: parseImgUrl("page-officehome", "mySpaceIcon.svg"),
  862. },
  863. {
  864. top: 0,
  865. id: 5,
  866. code: "switchSpace",
  867. name: "我的",
  868. noShow: true,
  869. activeImg: parseImgUrl("page-officehome", "mapIcon.png"),
  870. img: parseImgUrl("page-officehome", "mapIcon.png"),
  871. },
  872. ],
  873. // 上班=ATWORK 讨论=DISCUSSING 投影=PROJECTING 散会=ADJOURNMENT 下班=OFFWORK
  874. meetingRoomSence: [
  875. {
  876. code: "DISCUSSING",
  877. name: "讨论",
  878. },
  879. {
  880. code: "PROJECTING",
  881. name: "演示",
  882. },
  883. {
  884. code: "ADJOURNMENT",
  885. name: "散会",
  886. },
  887. ],
  888. nextCusStartTime: 0, // 第二天服务定制开始时间
  889. cusEndTime: 0,
  890. cusStartTime: 0, // 当天服务定制-开始时间
  891. isShowContact: false,
  892. showContact() {
  893. proxyData.isShowContact = true;
  894. },
  895. isFloorHeatingTemp: false,
  896. floorData: floorData,
  897. showFloorHeating(floorData: any) {
  898. proxyData.isFloorHeatingTemp = true;
  899. proxyData.floorData = floorData;
  900. },
  901. isLightColorFlag: false,
  902. lightData: lightData,
  903. // 展示调光,调温弹窗
  904. showLightColorCtrol(lightData: any) {
  905. proxyData.isLightColorFlag = true;
  906. proxyData.lightData = lightData;
  907. },
  908. curtainData: curtainData,
  909. isCurtainOpening: false, // 窗帘开度
  910. // 展示开度调节按钮
  911. showCurtainOpening(curtainData: any) {
  912. // 是否展示窗帘
  913. proxyData.curtainData = curtainData;
  914. proxyData.isCurtainOpening = true;
  915. },
  916. // 展开子设备控制
  917. airData: airData,
  918. isChildAirControl: false,
  919. showChildAirControl(item: any) {
  920. proxyData.airData = item;
  921. proxyData.isChildAirControl = true;
  922. },
  923. // 关闭空调控制弹窗
  924. closeChildAirControl() {
  925. proxyData.manualAirRef.getAirInfo(1);
  926. },
  927. closeCurtainOpening() {
  928. console.log("被点击了");
  929. proxyData.curtainRef.updateGroupPeing();
  930. },
  931. closeContactDailog() {
  932. proxyData.isShowContact = false;
  933. },
  934. padBgImg: "",
  935. // 设置平板背景图
  936. // reviewBaseUrl: `/image-service/common/file_get?systemId=dataPlatform`,
  937. setPadBgImg() {
  938. if (
  939. proxyData.padImgData.isBgDefault === 0 &&
  940. proxyData.padImgData.bgImage &&
  941. proxyData.padImgData.bgImage.fileId
  942. ) {
  943. proxyData.padBgImg =
  944. proxyData.fileUrl + `&key=${proxyData.padImgData.bgImage.fileId}`;
  945. } else {
  946. // debugger;
  947. if (proxyData.roomType == "个人") {
  948. proxyData.padBgImg = parseImgUrl("ipdImages", "pad_img2.png");
  949. } else if (proxyData.roomType === "会议室") {
  950. proxyData.padBgImg = parseImgUrl("ipdImages", "pad_img3.png");
  951. } else if (proxyData.roomType === "开放") {
  952. proxyData.padBgImg = parseImgUrl("ipdImages", "pad_img1.png");
  953. } else {
  954. proxyData.padBgImg = parseImgUrl("ipdImages", "pad_img1.png");
  955. }
  956. }
  957. },
  958. logImg: "",
  959. // 设置平板logo
  960. setPadLogo() {
  961. if (
  962. proxyData.padImgData.isLogoDefault === 0 &&
  963. proxyData.padImgData.logoImage &&
  964. proxyData.padImgData.logoImage.fileId
  965. ) {
  966. // 公司提供的
  967. proxyData.logImg =
  968. proxyData.fileUrl + `&key=${proxyData.padImgData.logoImage.fileId}`;
  969. } else {
  970. proxyData.logImg = "";
  971. }
  972. },
  973. padImgData: padImgData,
  974. padNumber: 0,
  975. // 获取pad的背景图
  976. getPadImg() {
  977. let params: any = {
  978. funcType: proxyData.officeData.roomFuncType,
  979. spaceId: proxyData.spaceInfo.spaceId,
  980. };
  981. let str: any = setQueryConfig(params);
  982. // debugger;
  983. if (proxyData.padNumber < 1) {
  984. proxyData.padNumber = 1;
  985. getPadImg(str).then((res) => {
  986. if (res.result === "success") {
  987. proxyData.padImgData = res.data;
  988. proxyData.setPadBgImg(); // 设置平板背景
  989. proxyData.setPadLogo(); // 设置平板logo
  990. }
  991. });
  992. }
  993. },
  994. /**
  995. * 加班
  996. */
  997. triggerWork(type: any = 1, deviceItem: any = null) {
  998. // console.log(type);
  999. // debugger
  1000. proxyData.enterType = type;
  1001. proxyData.deviceItem = deviceItem || null;
  1002. proxyData.isShowWork = true;
  1003. // proxyData.queryCustomAndScenceTimer(0);
  1004. proxyData.queryCustomAndScence(2); // 打开弹窗立即调用刷新加班数据
  1005. },
  1006. // 关于手动控制是否展示加班弹窗的问题处理
  1007. checkDeviceShowWork() {
  1008. proxyData.spaceEquipList.map((item: any) => {
  1009. item.id = item.equipmentId;
  1010. });
  1011. proxyData.seviceEquipmentList = proxyData.spaceEquipList;
  1012. },
  1013. /**
  1014. * 关闭加班
  1015. */
  1016. closeWork(type: any = "confirm") {
  1017. proxyData.isShowWork = false;
  1018. proxyData.queryCustomAndScence(2); // 关闭弹窗立即调用刷新加班数据
  1019. if (proxyData.enterType == 2 && type == "confirm") {
  1020. //  空调
  1021. if (proxyData.controlMode == 1) {
  1022. // 手动控制
  1023. proxyData.manualAirRef.updateSwitchFromWork(proxyData.deviceItem);
  1024. }
  1025. }
  1026. },
  1027. forceOverTimeFlag: false,
  1028. setForceOverTimeFlag(flag: any) {
  1029. // debugger
  1030. if (proxyData.roomType === "开放" && flag) {
  1031. proxyData.forceOverTimeFlag = true;
  1032. } else {
  1033. proxyData.forceOverTimeFlag = false;
  1034. }
  1035. },
  1036. // 获取公司信息
  1037. async getCompanyInfo() {
  1038. const res: any = await getCompanyInfo({ companyId: Keys.companyKey });
  1039. const data = res.data;
  1040. // store.commit(UserMutationTypes.SET_PROJECT_ID, 'Pj1101080259')
  1041. // const location: any = data.sagaCareCoords.split(',')
  1042. // const targetLocationInfo: any = {
  1043. // longitude: location[0],
  1044. // latitude: location[1]
  1045. // }
  1046. // console.log(targetLocationInfo)
  1047. },
  1048. weatherTimer: weatherTimer,
  1049. getWeatherTimer(timer: any = 3600000) {
  1050. proxyData.weatherTimer = setTimeout(() => {
  1051. clearTimeout(proxyData.weatherTimer);
  1052. proxyData.getWeather();
  1053. }, timer);
  1054. },
  1055. // 获取天气信息
  1056. getWeather() {
  1057. const params: any = {
  1058. openid: proxyData.userInfo.openid,
  1059. pubname: proxyData.userInfo.pubname,
  1060. projectId: store.state.user.projectId,
  1061. };
  1062. const str: string = setQueryConfig(params);
  1063. getWeather(str).then((res) => {
  1064. const content: any = res?.content ?? {};
  1065. proxyData.outWeather = content;
  1066. const text: string = content.text;
  1067. proxyData.getWeatherIcon(text);
  1068. proxyData.getnowTime(text);
  1069. proxyData.getWeatherTimer();
  1070. });
  1071. },
  1072. // 设置当前背景图
  1073. getnowTime(text: string) {
  1074. // 头部背景图片
  1075. const now = getHours();
  1076. if (text.indexOf("霾") > -1) {
  1077. proxyData.topbgimg = parseImgUrl("weather", "office_smog.jpg");
  1078. } else {
  1079. if (now >= 6 && now < 19) {
  1080. // 白天
  1081. proxyData.topbgimg = parseImgUrl("weather", "office_bright.jpg");
  1082. } else {
  1083. // 夜晚
  1084. proxyData.topbgimg = parseImgUrl("weather", "office_night.jpg");
  1085. }
  1086. }
  1087. },
  1088. // 设置天气icon
  1089. getWeatherIcon(text: string) {
  1090. if (text) {
  1091. if (text && text.indexOf("晴") > -1) {
  1092. proxyData.outWeather.imgname = parseImgUrl("weather", "sun.png");
  1093. } else if (text && text.indexOf("雨") > -1) {
  1094. proxyData.outWeather.imgname = parseImgUrl("weather", "rain.png");
  1095. } else if (
  1096. (text && text.indexOf("阴") > -1) ||
  1097. text.indexOf("云") > -1
  1098. ) {
  1099. proxyData.outWeather.imgname = parseImgUrl("weather", "cloudy.png");
  1100. } else if (text && text.indexOf("霾") > -1) {
  1101. proxyData.outWeather.imgname = parseImgUrl("weather", "mai.png");
  1102. } else if (text && text.indexOf("雾") > -1) {
  1103. proxyData.outWeather.imgname = parseImgUrl("weather", "fog.png");
  1104. } else if (text && text.indexOf("风") > -1) {
  1105. proxyData.outWeather.imgname = parseImgUrl("weather", "wind.png");
  1106. } else if (text && text.indexOf("雷") > -1) {
  1107. proxyData.outWeather.imgname = parseImgUrl(
  1108. "weather",
  1109. "thunder.png"
  1110. );
  1111. } else {
  1112. proxyData.outWeather.imgname = parseImgUrl("weather", "sun.png");
  1113. }
  1114. } else {
  1115. proxyData.outWeather.imgname = parseImgUrl("weather", "sun.png");
  1116. }
  1117. },
  1118. // 判断空间类型
  1119. checkSpaceType(roomFuncType: string) {
  1120. let roomType: any = getWorkType(roomFuncType);
  1121. if (roomType === "个人") {
  1122. proxyData.roomType = "个人";
  1123. proxyData.headerInfo.headImg = parseImgUrl(
  1124. "page-officehome",
  1125. "office_person_2.png"
  1126. );
  1127. proxyData.headerInfo.headScene = "工作";
  1128. proxyData.popList = proxyData.listOffice;
  1129. } else if (roomType === "会议室") {
  1130. proxyData.roomType = "会议室";
  1131. proxyData.popList = JSON.parse(JSON.stringify(proxyData.listSen));
  1132. proxyData.headerInfo.headImg = parseImgUrl(
  1133. "page-officehome",
  1134. "office_normal_2.png"
  1135. );
  1136. // 获取会议室场
  1137. proxyData.getPageMeetingSceneHttp();
  1138. } else if (roomType === "开放") {
  1139. // debugger
  1140. proxyData.roomType = "开放";
  1141. proxyData.headerInfo.headImg = parseImgUrl(
  1142. "page-officehome",
  1143. "office_publi_2.png"
  1144. );
  1145. } else {
  1146. proxyData.roomType = "其它";
  1147. proxyData.headerInfo.headImg = parseImgUrl(
  1148. "page-officehome",
  1149. "office_publi_2.png"
  1150. );
  1151. }
  1152. if (roomType !== "会议室") {
  1153. proxyData.timerSpaceInfo();
  1154. }
  1155. },
  1156. /**
  1157. * 检查用户可使用的权限
  1158. */
  1159. checkUserSpace() {
  1160. let flag: any = false;
  1161. // let flag: any = true
  1162. for (let i = 0; i < proxyData.userSpaceInfo.length; i++) {
  1163. if (
  1164. proxyData.spaceInfo.spaceId === proxyData.userSpaceInfo[i].sp_id
  1165. ) {
  1166. flag = true;
  1167. break;
  1168. }
  1169. }
  1170. proxyData.userIsControl = flag;
  1171. },
  1172. /**
  1173. * 获取用户控制权限
  1174. */
  1175. getUserControlAuth() {
  1176. getUserControlAuth()
  1177. .then((res) => {
  1178. let resData: any = res;
  1179. if (resData.result === "success") {
  1180. proxyData.userSpaceInfo = resData.data;
  1181. } else {
  1182. proxyData.userSpaceInfo = [];
  1183. }
  1184. proxyData.checkUserSpace();
  1185. })
  1186. .catch(() => {
  1187. proxyData.userSpaceInfo = [];
  1188. proxyData.checkUserSpace();
  1189. });
  1190. },
  1191. controlMode: controlMode, // 当前空间的模式 0:自动控制 1:手动控制
  1192. // 获取空间信息
  1193. getSpaceInfo() {
  1194. // const userInfo =
  1195. const data: any = {
  1196. criteria: {
  1197. spaceId: proxyData.spaceInfo.spaceId,
  1198. projectId: proxyData.userInfo.projectId,
  1199. },
  1200. pubname: proxyData.userInfo.pubname,
  1201. openid: proxyData.userInfo.openid,
  1202. };
  1203. getSpaceInfo(data)
  1204. .then((res) => {
  1205. const content: any = res?.content ?? [];
  1206. console.log("timer===", 1);
  1207. if (content[0]) {
  1208. proxyData.officeData = content[0];
  1209. }
  1210. proxyData.officeData = proxyData.officeData
  1211. ? proxyData.officeData
  1212. : {};
  1213. if (proxyData.officeData.localName) {
  1214. proxyData.localName = proxyData.officeData.localName;
  1215. }
  1216. if (proxyData.officeData.temperature) {
  1217. proxyData.officeData.temperature =
  1218. proxyData.officeData.temperature.toFixed(1) * 1;
  1219. }
  1220. // proxyData.controlMode = proxyData.officeData.controlMode || 1;
  1221. proxyData.controlMode = proxyData.officeData.controlMode || 0;
  1222. // 环境数据
  1223. proxyData.checkSpaceType(proxyData.officeData.roomFuncType);
  1224. proxyData.formatSpaceInfo(content);
  1225. proxyData.getPadImg();
  1226. // proxyData.setPageheight()
  1227. proxyData.loadinngEnd();
  1228. // 获取pad的背景图
  1229. })
  1230. .catch(() => {
  1231. proxyData.loadinngEnd();
  1232. proxyData.timerSpaceInfo();
  1233. });
  1234. },
  1235. // 定时调获取空调接口
  1236. getSpaceModeTimer() {
  1237. proxyData.spaceModelTimer = setTimeout(() => {
  1238. proxyData.getSpaceMode();
  1239. clearTimeout(proxyData.spaceModelTimer);
  1240. proxyData.spaceModelTimer = null;
  1241. }, 1000);
  1242. },
  1243. // 获取运行模式
  1244. getSpaceMode() {
  1245. getSpaceMode()
  1246. .then((res) => {
  1247. proxyData.getSpaceModeTimer();
  1248. })
  1249. .catch(() => {
  1250. proxyData.getSpaceModeTimer();
  1251. });
  1252. },
  1253. // 定时调用获取温度
  1254. getSpaceTempTimer() {
  1255. proxyData.spaceTempTimer = setTimeout(() => {
  1256. clearTimeout(proxyData.spaceTempTimer);
  1257. proxyData.spaceTempTimer = null;
  1258. proxyData.getSpaceTemp();
  1259. });
  1260. },
  1261. // 获取空间空调设备温度
  1262. getSpaceTemp() {
  1263. getSpaceTemp()
  1264. .then((res) => {
  1265. proxyData.getSpaceTempTimer();
  1266. })
  1267. .catch(() => {
  1268. proxyData.getSpaceTempTimer();
  1269. });
  1270. },
  1271. // 设置环境参数的背景颜色
  1272. setEnvBg(key: any, text: any) {
  1273. let bgColor: any = "";
  1274. if (key === "humidity") {
  1275. // 湿度
  1276. if (text === "干燥" || text === "潮湿") {
  1277. bgColor =
  1278. "linear-gradient(180deg, rgba(205, 11, 0, 0) 0%, #CD0B00 100%)";
  1279. } else {
  1280. bgColor = "";
  1281. }
  1282. } else if (key === "hcho") {
  1283. // 甲醛
  1284. if (text === "超标") {
  1285. bgColor =
  1286. "linear-gradient(180deg, rgba(205, 11, 0, 0) 0%, #CD0B00 100%)";
  1287. } else {
  1288. bgColor = "";
  1289. }
  1290. } else if (key === "co2") {
  1291. if (text === "略高") {
  1292. bgColor =
  1293. "linear-gradient(180deg, rgba(205, 11, 0, 0.5) 0%, #CD0B00 100%)";
  1294. } else if (text === "超标") {
  1295. bgColor =
  1296. "linear-gradient(180deg, rgba(205, 11, 0, 1) 0%, #CD0B00 100%)";
  1297. } else {
  1298. bgColor = "";
  1299. }
  1300. } else if (key === "pm25") {
  1301. if (text === "良") {
  1302. // bgColor =
  1303. // "linear-gradient(180deg, rgba(205, 11, 0, 0.2) 0%, #CD0B00 100%)";
  1304. bgColor = "";
  1305. } else if (text === "轻度污染") {
  1306. bgColor =
  1307. "linear-gradient(180deg, rgba(205, 11, 0, 0.2) 0%, #CD0B00 100%)";
  1308. } else if (text === "中度污染") {
  1309. bgColor =
  1310. "linear-gradient(180deg, rgba(205, 11, 0, 0.5) 0%, #CD0B00 100%)";
  1311. } else if (text === "重度污染") {
  1312. bgColor =
  1313. "linear-gradient(180deg, rgba(205, 11, 0, 0.8) 0%, #CD0B00 100%)";
  1314. } else if (text === "严重污染") {
  1315. bgColor =
  1316. "linear-gradient(180deg, rgba(205, 11, 0, 1) 0%, #CD0B00 100%)";
  1317. } else {
  1318. bgColor = "";
  1319. }
  1320. }
  1321. return bgColor;
  1322. },
  1323. // 格式化环境数据(处理环境数据展示的级别)
  1324. checkLevel(value: string, name: string) {
  1325. let levelTxt: any = "";
  1326. let valueNum: any = parseFloat(value);
  1327. if (valueNum) {
  1328. if (name == "humidity") {
  1329. if (valueNum < 30) {
  1330. levelTxt = "干燥";
  1331. } else if (valueNum > 70) {
  1332. levelTxt = "潮湿";
  1333. } else {
  1334. levelTxt = "健康";
  1335. }
  1336. } else if (name == "co2") {
  1337. if (valueNum <= 800) {
  1338. levelTxt = "健康";
  1339. } else if (valueNum > 800 && valueNum <= 1000) {
  1340. levelTxt = "达标";
  1341. } else if (valueNum > 1000 && valueNum <= 1500) {
  1342. levelTxt = "略高";
  1343. } else if (valueNum > 1500) {
  1344. levelTxt = "超标";
  1345. }
  1346. }
  1347. } else if (name == "pm25") {
  1348. if (valueNum >= 0 && valueNum < 35) {
  1349. levelTxt = "健康";
  1350. } else if (valueNum >= 35 && valueNum <= 75) {
  1351. levelTxt = "良";
  1352. } else if (valueNum > 75 && valueNum <= 115) {
  1353. levelTxt = "轻度污染";
  1354. } else if (valueNum > 115 && valueNum <= 150) {
  1355. levelTxt = "中度污染";
  1356. } else if (valueNum > 150 && valueNum <= 250) {
  1357. levelTxt = "重度污染";
  1358. } else if (valueNum > 250) {
  1359. levelTxt = "严重污染";
  1360. }
  1361. } else if (name == "hcho") {
  1362. if (valueNum <= 0.1) {
  1363. levelTxt = "健康";
  1364. } else {
  1365. levelTxt = "超标";
  1366. }
  1367. }
  1368. // let level = sortArr.findIndex((item) => item === value);
  1369. // let levelTxt = objList[name].text[level];
  1370. // console.log("sortArr==", sortArr);
  1371. let bgColor: any = proxyData.setEnvBg(name, levelTxt);
  1372. return {
  1373. levelTxt,
  1374. bgColor,
  1375. };
  1376. },
  1377. /**
  1378. *设置当前页面的高度
  1379. */
  1380. setPageheight() {
  1381. nextTick(() => {
  1382. document.getElementById("envBox").style.height =
  1383. document.getElementById("envBox").offsetHeight + "px";
  1384. });
  1385. },
  1386. // 修改环境数据
  1387. changeEnvValue(item: any) {
  1388. if (item.co2 > 1000) {
  1389. item.co2 = 1000;
  1390. } else if (item.pm25 > 75) {
  1391. item.pm25 = 75;
  1392. } else if (item.hcho > 0.1) {
  1393. item.hcho = 0.1;
  1394. } else if (item.humidity < 30) {
  1395. item.humidity = 30;
  1396. } else if (item.humidity > 70) {
  1397. item.humidity = 70;
  1398. }
  1399. },
  1400. // 空间信息数据格式化
  1401. formatSpaceInfo(content: any = []) {
  1402. for (let i = 0; i < content.length; i++) {
  1403. let item = content[i];
  1404. // 四川大厦暂时把超标值修改为正确值
  1405. if (proxyData.userInfo.projectId === "Pj1101020007") {
  1406. proxyData.changeEnvValue(item);
  1407. }
  1408. if (item.co2 || item.co2 == 0) {
  1409. let obj: any = proxyData.checkLevel(item.co2, "co2");
  1410. // proxyData.envlist[1].level = obj.levelTxt;
  1411. proxyData.envlist[1].bgColor = obj.bgColor;
  1412. proxyData.envlist[1].num = item.co2;
  1413. } else {
  1414. // proxyData.envlist[1].level = "--";
  1415. proxyData.envlist[1].num = "--";
  1416. proxyData.envlist[1].bgColor = "";
  1417. }
  1418. if (item.pm25 || item.pm25 === 0) {
  1419. let obj: any = proxyData.checkLevel(item.pm25, "pm25");
  1420. // proxyData.envlist[2].level = obj.levelTxt;
  1421. proxyData.envlist[2].bgColor = obj.bgColor;
  1422. proxyData.envlist[2].num = item.pm25;
  1423. } else {
  1424. // proxyData.envlist[2].level = "--";
  1425. proxyData.envlist[2].num = "--";
  1426. proxyData.envlist[2].bgColor = "";
  1427. }
  1428. if (item.hcho || item.hcho == 0) {
  1429. let obj: any = proxyData.checkLevel(item.hcho, "hcho");
  1430. // proxyData.envlist[0].level = obj.levelTxt;
  1431. proxyData.envlist[0].bgColor = obj.bgColor;
  1432. proxyData.envlist[0].num = item.hcho.toFixed(2);
  1433. } else {
  1434. // proxyData.envlist[0].level = "--";
  1435. proxyData.envlist[0].num = "--";
  1436. proxyData.envlist[0].bgColor = "";
  1437. }
  1438. if (item.humidity || item.humidity == 0) {
  1439. let obj: any = proxyData.checkLevel(item.humidity, "humidity");
  1440. // proxyData.envlist[3].level = obj.levelTxt;
  1441. proxyData.envlist[3].bgColor = obj.bgColor;
  1442. proxyData.envlist[3].num = item.humidity.toFixed(0);
  1443. } else {
  1444. // proxyData.envlist[3].level = "--";
  1445. proxyData.envlist[3].num = "--";
  1446. proxyData.envlist[3].bgColor = "";
  1447. }
  1448. }
  1449. },
  1450. activeType: "", // 当前会议室场景
  1451. // 获取会议室场景(如果是会议室的才调此接口)
  1452. getPageMeetingSceneHttp() {
  1453. const params: { spaceId: string } = {
  1454. spaceId: proxyData.spaceInfo.spaceId,
  1455. };
  1456. getMeetingSceneHttp(params)
  1457. .then((res) => {
  1458. let resSen: string = res?.content ?? "";
  1459. if (resSen === "OFFWORK") {
  1460. resSen = "ADJOURNMENT";
  1461. }
  1462. proxyData.activeType = resSen;
  1463. // 定时调空间数据
  1464. proxyData.timerSpaceInfo();
  1465. })
  1466. .catch(() => {
  1467. proxyData.timerSpaceInfo();
  1468. });
  1469. },
  1470. // 切换场景的状态
  1471. secenaroStatus: secenaroStatus,
  1472. // 设置场景名称
  1473. setHeadScene(item: any, flag: any) {
  1474. proxyData.activeType = item.sceneType;
  1475. if (flag == 1) {
  1476. proxyData.isShowMetting = true;
  1477. }
  1478. proxyData.secenaroStatus = {
  1479. localName: proxyData.officeData.localName,
  1480. loading: item.loading,
  1481. lodingText: item.lodingText,
  1482. sceneName: item.sceneName,
  1483. };
  1484. },
  1485. closeDailog() {
  1486. proxyData.isShowMetting = false;
  1487. },
  1488. isShowDetail: false,
  1489. detailQuery: detailQuery,
  1490. handleDetail(item: any) {
  1491. proxyData.isShowDetail = true;
  1492. proxyData.detailQuery.funcid = item.funcid;
  1493. proxyData.detailQuery.spaceId = proxyData.spaceInfo.spaceId;
  1494. // router.push({
  1495. // path: '/envmonitor-detail',
  1496. // query: {
  1497. // funcid: item.funcid,
  1498. // spaceId: proxyData.spaceInfo.spaceId
  1499. // }
  1500. // })
  1501. },
  1502. // 获取空调设备温度
  1503. updateAirTemp(airTemp: any) {
  1504. proxyData.airTemp = airTemp;
  1505. proxyData.setHeadSceneAirTemp();
  1506. },
  1507. // 设置场景切换时候的温度
  1508. setHeadSceneAirTemp() {
  1509. if (
  1510. proxyData.sceneDetail &&
  1511. proxyData.sceneDetail.textObj &&
  1512. proxyData.sceneDetail.textObj.length
  1513. ) {
  1514. if (
  1515. proxyData.airTemp &&
  1516. (proxyData.sceneDetail.code == "DISCUSSING" ||
  1517. proxyData.sceneDetail.code == "PROJECTING")
  1518. ) {
  1519. for (let i = 0; i < proxyData.sceneDetail.textObj.length; i++) {
  1520. let item: any = proxyData.sceneDetail.textObj;
  1521. if (item.type === "air") {
  1522. item.text = item.text + ",目标温度" + proxyData.airTemp;
  1523. }
  1524. }
  1525. }
  1526. }
  1527. },
  1528. // 提前关闭
  1529. handlePreClose() {
  1530. let endDate: any = formatDate();
  1531. let endTime: any = getHours();
  1532. if (endTime < 10) {
  1533. endTime = `0${endTime}`;
  1534. }
  1535. const params = {
  1536. projectId: proxyData.projectId,
  1537. objectId: proxyData.spaceInfo.spaceId, // 空间ID
  1538. endDate: endDate, // 结束日期 "20210310",
  1539. endTime: endTime + "0000", // 结束时间 "090000"
  1540. type: 3, // 0 预约加班,1 取消,2 我来了/确定, 3 我走了
  1541. };
  1542. changeSetTimeHttp(params).then((res) => {
  1543. const resData: any = res;
  1544. if (resData.result == "success") {
  1545. proxyData.changeLampStatus();
  1546. }
  1547. });
  1548. },
  1549. // 提前关闭更改状态
  1550. changeLampStatus() {
  1551. proxyData.showWorkOff = false;
  1552. proxyData.headerInfo.tipText = "选择工作结束时间";
  1553. proxyData.headerInfo.tipTextSwatch = true;
  1554. },
  1555. equimentsTimer: equimentsTimer,
  1556. // 定时查空间下面的展示设备
  1557. setEquimentsTimer() {},
  1558. // 获取空间下的设备信息
  1559. getEquipments() {
  1560. let params: { spaceId: string } = {
  1561. spaceId: proxyData.spaceInfo.spaceId,
  1562. // projectId: proxyData.projectId,
  1563. };
  1564. let queryParams: any = setQueryConfig(params);
  1565. getSpaceEquipType(queryParams).then((res) => {
  1566. let resData: any = res;
  1567. if (resData.result === "success") {
  1568. let data: any = resData?.data ?? [];
  1569. for (let key in proxyData.spaceExistenceDevice) {
  1570. let flag: any = false;
  1571. for (let i = 0; i < data.length; i++) {
  1572. if (key == data[i]) {
  1573. flag = true;
  1574. }
  1575. }
  1576. proxyData.spaceExistenceDevice[key] = flag;
  1577. }
  1578. // app端底部的导航判断
  1579. if (proxyData.spaceExistenceDevice.light) {
  1580. proxyData.navList[1].noShow = true;
  1581. } else {
  1582. proxyData.navList[1].noShow = false;
  1583. }
  1584. if (proxyData.spaceExistenceDevice.curtain) {
  1585. proxyData.navList[2].noShow = true;
  1586. } else {
  1587. proxyData.navList[2].noShow = false;
  1588. }
  1589. }
  1590. });
  1591. },
  1592. // 时间格式转换
  1593. hourMiChange(tempStr: number) {
  1594. // 转为时间 19.3 - 19:30 19.41-19:41 19-19:00
  1595. let str = tempStr.toString();
  1596. let newStr = "";
  1597. let dLen = str.length > 2 ? str.split(".")[1].length : str;
  1598. if (dLen === 1) {
  1599. str = str.replace(".", "") + "0";
  1600. newStr = str.slice(0, 2) + ":" + str.slice(2);
  1601. } else if (dLen === 2) {
  1602. str = str.replace(".", "");
  1603. newStr = str.slice(0, 2) + ":" + str.slice(2);
  1604. } else {
  1605. newStr = str + ":00";
  1606. }
  1607. return newStr;
  1608. },
  1609. // 点击切换会议室场景
  1610. handlePopup(type: string = "scenario") {
  1611. if (proxyData.userIsControl) {
  1612. proxyData.showScenario = !proxyData.showScenario;
  1613. if (proxyData.showScenario) {
  1614. proxyData.deviceIcon = "arrow-down";
  1615. } else {
  1616. proxyData.deviceIcon = "arrow";
  1617. }
  1618. proxyData.popupType = type;
  1619. } else {
  1620. Toast("您没有当前空间的控制权限!");
  1621. }
  1622. },
  1623. // 切换空间
  1624. triggerCheckSpace() {
  1625. let ele: any = document.getElementById("envContent");
  1626. let houseEle: any = document.getElementById("houseDes");
  1627. let houseHeight: any = houseEle.offsetHeight;
  1628. proxyData.opacityV = 0;
  1629. proxyData.mapOpacity = 1;
  1630. ele.scrollTop = 0;
  1631. let top: any = 0;
  1632. let interval: any = setInterval(() => {
  1633. top = top + 15;
  1634. if (top < screenHeight - houseHeight) {
  1635. ele.style.top = top + "px";
  1636. } else {
  1637. ele.style.top = screenHeight - houseHeight + "px";
  1638. clearInterval(interval);
  1639. }
  1640. }, 10);
  1641. proxyData.hideTopImg = true;
  1642. proxyData.isBottom = true;
  1643. },
  1644. /**
  1645. * 加载loading
  1646. */
  1647. loadingStart() {
  1648. Toast.loading({
  1649. duration: 0, // 持续展示 toast
  1650. forbidClick: true,
  1651. message: "加载中...",
  1652. });
  1653. },
  1654. /**
  1655. * 结束
  1656. */
  1657. loadinngEnd() {
  1658. Toast.clear();
  1659. },
  1660. // 清除定时器
  1661. clearTimerSpaceInfo() {
  1662. clearTimeout(proxyData.spaceTimer);
  1663. proxyData.spaceTimer = null;
  1664. },
  1665. // 定时调空间
  1666. timerSpaceInfo(timer: any = 15000) {
  1667. proxyData.spaceTimer = setTimeout(() => {
  1668. proxyData.getSpaceInfo();
  1669. proxyData.clearTimerSpaceInfo();
  1670. }, timer);
  1671. },
  1672. isWork: false,
  1673. isMetting: false,
  1674. // 判断对应的办公室的场景展示
  1675. checkIsSpaceScene() {
  1676. let flag: any = false;
  1677. proxyData.scenarioArr.map((item: any) => {
  1678. if (item.sceneType === "OVERTIME") {
  1679. proxyData.isWork = true;
  1680. flag = true;
  1681. }
  1682. });
  1683. if (!flag) {
  1684. proxyData.isWork = false;
  1685. }
  1686. if (
  1687. (proxyData.scenarioArr && proxyData.scenarioArr.length == 0) ||
  1688. !proxyData.scenarioArr
  1689. ) {
  1690. proxyData.isWork = false;
  1691. }
  1692. if (!proxyData.isWork) {
  1693. proxyData.forceOverTimeFlag = false;
  1694. }
  1695. },
  1696. /**
  1697. * 获取场景列表
  1698. */
  1699. scenarioArr: scenarioArr,
  1700. sceneConfigTimer: sceneConfigTimer,
  1701. clearSceneConfigTimer() {
  1702. clearTimeout(proxyData.sceneConfigTimer);
  1703. },
  1704. // 定时获取场景的配置
  1705. querySpaceSceneConfigTimer(timer: any = 600000) {
  1706. proxyData.clearSceneConfigTimer();
  1707. proxyData.sceneConfigTimer = setTimeout(() => {
  1708. proxyData.querySpaceSceneConfig();
  1709. proxyData.clearSceneConfigTimer();
  1710. }, timer);
  1711. },
  1712. // 场景数据
  1713. querySpaceSceneConfig() {
  1714. let params: any = {
  1715. spaceId: proxyData.spaceInfo.spaceId,
  1716. };
  1717. let str: any = setQueryConfig(params);
  1718. // debugger;
  1719. querySpaceSceneConfig(str)
  1720. .then((res) => {
  1721. let resData: any = res;
  1722. let data: any = resData?.data ?? [];
  1723. proxyData.scenarioArr = data;
  1724. proxyData.checkIsSpaceScene();
  1725. proxyData.querySpaceSceneConfigTimer();
  1726. })
  1727. .catch((error: any) => {
  1728. proxyData.querySpaceSceneConfigTimer();
  1729. });
  1730. },
  1731. /**
  1732. *查询空间加班记录
  1733. */
  1734. workkArr: workkArr,
  1735. secenTimer: secenTimer,
  1736. // 清除查询加班记录的定时器
  1737. clearSecenTimer() {
  1738. clearTimeout(proxyData.secenTimer);
  1739. proxyData.secenTimer = null;
  1740. },
  1741. // 清除定时器
  1742. clearEquipTimer() {
  1743. clearTimeout(proxyData.equipTimer);
  1744. proxyData.equipTimer = null;
  1745. },
  1746. // 定时器
  1747. getSpaceEquipListTimer(timerLen: any = 5000) {
  1748. proxyData.clearEquipTimer();
  1749. proxyData.equipTimer = setTimeout(() => {
  1750. proxyData.getSpaceEquipList();
  1751. proxyData.clearEquipTimer();
  1752. }, timerLen);
  1753. },
  1754. // 查询空间下面受控的设备
  1755. getSpaceEquipList() {
  1756. let params: any = {
  1757. spaceId: proxyData.spaceInfo.spaceId,
  1758. };
  1759. let str: any = setQueryConfig(params);
  1760. getSpaceEquipList(str)
  1761. .then((res: any) => {
  1762. let data: any = res.data || [];
  1763. proxyData.spaceEquipList = data;
  1764. proxyData.checkDeviceShowWork(); // 判断手动控制的设备是否要开启手动控制功能
  1765. proxyData.getSpaceEquipListTimer();
  1766. })
  1767. .catch((error: any) => {
  1768. proxyData.getSpaceEquipListTimer();
  1769. });
  1770. },
  1771. // 定时查空间的加班记录
  1772. queryCustomAndScenceTimer(timer: any = 15000) {
  1773. let nowTime: any = getRelNowTime();
  1774. if (timer == 15000 && nowTime < "070000" && nowTime > "200000") {
  1775. timer = 300000;
  1776. }
  1777. proxyData.clearSecenTimer();
  1778. proxyData.secenTimer = setTimeout(() => {
  1779. proxyData.queryCustomAndScence();
  1780. proxyData.clearSecenTimer();
  1781. }, timer);
  1782. },
  1783. // 定时查空间的加班记录
  1784. queryCustomAndScence(type: any = 1) {
  1785. let params: any = {
  1786. spaceId: proxyData.spaceInfo.spaceId,
  1787. };
  1788. let str: any = setQueryConfig(params);
  1789. queryCustomAndScence(str)
  1790. .then((res) => {
  1791. let resData: any = res?.data ?? [];
  1792. for (let i = 0; i < resData.length; i++) {
  1793. let customSceneList: any = resData[i]?.customSceneList ?? [];
  1794. customSceneList = customSceneList.sort(proxyData.compare);
  1795. }
  1796. // 手动控制的情况下走新的服务定制
  1797. proxyData.formateManualWorkTime(resData);
  1798. proxyData.workkArr = resData || [];
  1799. if (type == 1) {
  1800. // 需要定时调用
  1801. proxyData.queryCustomAndScenceTimer();
  1802. }
  1803. })
  1804. .catch(() => {
  1805. if (type == 1) {
  1806. // 需要定时调用
  1807. proxyData.queryCustomAndScenceTimer();
  1808. }
  1809. });
  1810. },
  1811. // 数组排序
  1812. compare(obj1: any, obj2: any) {
  1813. var val1 = obj1.startTime;
  1814. var val2 = obj2.startTime;
  1815. if (val1 < val2) {
  1816. return -1;
  1817. } else if (val1 > val2) {
  1818. return 1;
  1819. } else {
  1820. return 0;
  1821. }
  1822. },
  1823. // 格式化当前页面展示的时间
  1824. // 手动控制加班处理时间段拼接的逻辑
  1825. formateManualWorkTime(paramsData: any = []) {
  1826. // debugger
  1827. let data: any = paramsData || [];
  1828. for (let i = 0; i < data.length; i++) {
  1829. let item: any = data[i];
  1830. let spaceCustomContentList: any =
  1831. data[i].spaceCustomContentList || [];
  1832. if (spaceCustomContentList && spaceCustomContentList.length) {
  1833. spaceCustomContentList = spaceCustomContentList.sort(
  1834. proxyData.compare
  1835. );
  1836. item.spaceCustomContentList = spaceCustomContentList;
  1837. let nowTime: any = getRelNowTime();
  1838. let nowDate: any = formatDate("YYYY-MM-DD");
  1839. let date: any = formatDateStr(data[i].date);
  1840. item.cusStartTime = spaceCustomContentList[0]
  1841. ? spaceCustomContentList[0].startTime
  1842. : "";
  1843. item.cusEndTime = spaceCustomContentList[0]
  1844. ? spaceCustomContentList[0].endTime
  1845. : "";
  1846. if (nowDate == date) {
  1847. // 当前时间
  1848. item.cusStartTime = "";
  1849. item.cusEndTime = "";
  1850. }
  1851. for (let j = 0; j < spaceCustomContentList.length; j++) {
  1852. if (item.cusStartTime && item.cusEndTime) {
  1853. if (
  1854. item.cusEndTime + 1 ===
  1855. spaceCustomContentList[j].startTime
  1856. ) {
  1857. item.cusEndTime = spaceCustomContentList[j].endTime;
  1858. }
  1859. } else {
  1860. if (
  1861. nowTime >= spaceCustomContentList[j].startTime &&
  1862. nowTime <= spaceCustomContentList[j].endTime
  1863. ) {
  1864. item.cusStartTime = spaceCustomContentList[j].startTime;
  1865. item.cusEndTime = spaceCustomContentList[j].endTime;
  1866. }
  1867. }
  1868. }
  1869. if (!item.cusStartTime) {
  1870. item.cusStartTime = spaceCustomContentList[0]
  1871. ? spaceCustomContentList[0].startTime
  1872. : "";
  1873. item.cusEndTime = spaceCustomContentList[0]
  1874. ? spaceCustomContentList[0].endTime
  1875. : "";
  1876. }
  1877. }
  1878. }
  1879. },
  1880. /**
  1881. * 空间相关的接口
  1882. */
  1883. init() {
  1884. proxyData.padNumber = 0;
  1885. // proxyData.roomType = "";
  1886. // 获取场景配置
  1887. proxyData.getSpaceInfo();
  1888. // 动态获取场景配置
  1889. proxyData.querySpaceSceneConfig();
  1890. // 获取空间下展示的那些设备类(窗帘,灯,空调))
  1891. proxyData.getEquipments();
  1892. // 获取空间下受控设备
  1893. proxyData.getSpaceEquipList();
  1894. // 查询加班记录
  1895. proxyData.queryCustomAndScenceTimer(0);
  1896. },
  1897. /**
  1898. *删除参数
  1899. */
  1900. updatePageUrl() {
  1901. let history: any = window.history;
  1902. let url: any = window.location.origin + window.location.pathname;
  1903. history.replaceState("", "", url);
  1904. },
  1905. // 平板当前空间
  1906. spaceData: spaceData,
  1907. copySpaceData: spaceData,
  1908. floorId: "",
  1909. buildingId: "",
  1910. // 获取pad当前绑定的空间
  1911. queryWorkSpace() {
  1912. let params: any = {
  1913. criteria: {
  1914. //类型:Object 必有字段 备注:无
  1915. projectId: proxyData.userInfo.projectId,
  1916. spaceName: "",
  1917. macAddress: proxyData.userInfo.mac, //类型:String 必有字段 备注:mac地址
  1918. },
  1919. orders: [
  1920. //类型:Array 必有字段 备注:无
  1921. {
  1922. //类型:Object 必有字段 备注:无
  1923. column: "isMajorSpace", //类型:String 必有字段 备注:无
  1924. asc: false, //类型:Boolean 必有字段 备注:无
  1925. },
  1926. ],
  1927. };
  1928. queryWorkSpace(params).then((res) => {
  1929. let resData: any = res;
  1930. if (resData.result === "success") {
  1931. proxyData.spaceData = resData?.content ?? [];
  1932. // proxyData.copySpaceData = resData?.content ?? [];
  1933. } else {
  1934. proxyData.spaceData = [];
  1935. }
  1936. proxyData.spaceData.map((item: any) => {
  1937. if (proxyData.spaceInfo.spaceId === item.spaceId) {
  1938. item.active = true;
  1939. proxyData.spaceInfo = item;
  1940. } else {
  1941. item.active = false;
  1942. }
  1943. // if (item.isMajorSpace) {
  1944. // item.active = true;
  1945. // proxyData.spaceInfo = item;
  1946. // } else {
  1947. // item.active = false;
  1948. // }
  1949. });
  1950. proxyData.copySpaceData = JSON.parse(
  1951. JSON.stringify(proxyData.spaceData)
  1952. );
  1953. });
  1954. },
  1955. // 重置空间状态
  1956. resetSpaceStatus() {
  1957. /**
  1958. *重新获取设备的时候,先初始化数据
  1959. */
  1960. proxyData.spaceExistenceDevice = {
  1961. curtain: false,
  1962. light: false,
  1963. airConditioner: false,
  1964. bodySensor: false,
  1965. };
  1966. proxyData.spaceData.map((item: any) => {
  1967. item.active = false;
  1968. });
  1969. // proxyData.controlMode = ''; // 模式变成自动的
  1970. // proxyData.controlMode='';
  1971. proxyData.isWork = false;
  1972. proxyData.roomType = "";
  1973. proxyData.officeData.temperature = "";
  1974. proxyData.seviceEquipmentList = [];
  1975. proxyData.workkArr = [];
  1976. // 切换空间的时候把加班按钮平板
  1977. proxyData.setForceOverTimeFlag(false);
  1978. },
  1979. // 更多空间
  1980. isShowMap: false,
  1981. defaultSpace: spaceInfo,
  1982. moreSpace() {
  1983. proxyData.isShowMap = true;
  1984. proxyData.defaultSpace = proxyData.spaceInfo;
  1985. },
  1986. // 数组元素更换位置
  1987. elChangeExForArray(item: any) {
  1988. let index1: any = 1;
  1989. let index2: any = 0;
  1990. for (let i = 0; i < proxyData.spaceData.length; i++) {
  1991. if (item.spaceId === proxyData.spaceData[i].spaceId) {
  1992. proxyData.spaceData[i].active = true;
  1993. if (i > 2) {
  1994. index2 = i;
  1995. break;
  1996. }
  1997. }
  1998. }
  1999. if (index2) {
  2000. let temp = proxyData.spaceData[index1];
  2001. proxyData.spaceData[index1] = proxyData.spaceData[index2];
  2002. proxyData.spaceData[index2] = temp;
  2003. }
  2004. },
  2005. // 切换空间
  2006. changeSpace(item: any, type: any = 0) {
  2007. //清除空间下所有的定时器
  2008. proxyData.clearAll();
  2009. // 重置当前选中空间的状态
  2010. proxyData.resetSpaceStatus();
  2011. proxyData.spaceInfo = item;
  2012. if (type === 1) {
  2013. proxyData.defaultSpace = item;
  2014. proxyData.elChangeExForArray(item);
  2015. }
  2016. item.active = true;
  2017. proxyData.init();
  2018. },
  2019. timeOutEvent: timeOutEvent,
  2020. touchNumber: 0,
  2021. gtouchstart(e: any) {
  2022. proxyData.touchNumber = 0;
  2023. proxyData.timeOutEvent = setTimeout(function () {
  2024. proxyData.touchNumber = 1;
  2025. proxyData.longPress();
  2026. }, 500); //这里设置定时器,定义长按500毫秒触发长按事件
  2027. return false;
  2028. },
  2029. //手释放,如果在500毫秒内就释放,则取消长按事件,此时可以执行onclick应该执行的事件
  2030. showDeleteButton() {
  2031. console.log("dddd-");
  2032. clearInterval(proxyData.touchInterval);
  2033. proxyData.touchInterval = null;
  2034. clearTimeout(proxyData.timeOutEvent); //清除定时器
  2035. if (proxyData.timeOutEvent != 0) {
  2036. }
  2037. return false;
  2038. },
  2039. //如果手指有移动,则取消所有事件,此时说明用户只是要移动而不是长按
  2040. gtouchmove() {
  2041. clearTimeout(this.timeOutEvent); //清除定时器
  2042. proxyData.timeOutEvent = 0;
  2043. },
  2044. touchInterval: touchInterval,
  2045. //真正长按后应该执行的内容
  2046. longPress() {
  2047. proxyData.timeOutEvent = 0;
  2048. proxyData.touchInterval = setInterval(() => {
  2049. proxyData.touchNumber++;
  2050. if (proxyData.touchNumber === 6) {
  2051. clearInterval(proxyData.touchInterval);
  2052. proxyData.touchInterval = null;
  2053. router.push({
  2054. name: "home",
  2055. query: { mac: proxyData.userInfo.mac, type: "logoOut" },
  2056. });
  2057. }
  2058. }, 1000);
  2059. //执行长按要执行的内容,如弹出菜单
  2060. // console.log("长按");
  2061. },
  2062. // 定时器清除
  2063. clearAll() {
  2064. proxyData.clearTimerSpaceInfo();
  2065. proxyData.clearSceneConfigTimer();
  2066. proxyData.clearSecenTimer();
  2067. proxyData.clearEquipTimer();
  2068. },
  2069. contantDetail: contantDetail,
  2070. cusServiceTimer: cusServiceTimer,
  2071. queryCustomerserviceTimer(timer: any = 3600000) {
  2072. proxyData.cusServiceTimer = setTimeout(() => {
  2073. clearTimeout(proxyData.cusServiceTimer);
  2074. proxyData.queryCustomerservice();
  2075. }, timer);
  2076. },
  2077. // 查询联系方式
  2078. queryCustomerservice() {
  2079. let params: any = {
  2080. criteria: { projectId: proxyData.userInfo.projectId },
  2081. };
  2082. queryCustomerservice(params)
  2083. .then((res) => {
  2084. let resData: any = res;
  2085. let content: any = resData?.content ?? [];
  2086. proxyData.contantDetail = content[0];
  2087. proxyData.queryCustomerserviceTimer();
  2088. })
  2089. .catch(() => {
  2090. proxyData.queryCustomerserviceTimer();
  2091. });
  2092. },
  2093. dateInter: dateInter,
  2094. setDateTime() {
  2095. proxyData.dateInter = setInterval(() => {
  2096. proxyData.nowDate = formatDate("YYYY.MM.DD HH:mm");
  2097. proxyData.nowWeek = getNowWeek();
  2098. }, 60000);
  2099. },
  2100. });
  2101. onBeforeUnmount(() => {
  2102. proxyData.clearAll();
  2103. clearInterval(proxyData.dateInter);
  2104. clearTimeout(proxyData.cusServiceTimer);
  2105. clearTimeout(proxyData.weatherTimer);
  2106. });
  2107. onMounted(() => {
  2108. let spaceId: any = route.query.spaceId;
  2109. proxyData.spaceInfo = {
  2110. spaceId: spaceId,
  2111. };
  2112. proxyData.defaultSpace = {
  2113. spaceId: spaceId,
  2114. };
  2115. proxyData.setDateTime();
  2116. proxyData.init();
  2117. // 获取当前平板绑定的空间
  2118. proxyData.queryWorkSpace();
  2119. proxyData.getWeather();
  2120. proxyData.queryCustomerservice();
  2121. });
  2122. return {
  2123. ...toRefs(proxyData),
  2124. };
  2125. },
  2126. });
  2127. </script>
  2128. <style lang="scss" scoped>
  2129. .main {
  2130. display: flex;
  2131. justify-content: space-between;
  2132. width: 100%;
  2133. height: 100%;
  2134. box-sizing: border-box;
  2135. padding: 3.33vh 20px 0 20px;
  2136. font-size: 0;
  2137. background-image: linear-gradient(
  2138. 0deg,
  2139. rgba(69, 33, 0, 0.2),
  2140. rgba(69, 33, 0, 0.2)
  2141. );
  2142. background-size: 100% 100%;
  2143. overflow: hidden;
  2144. .main-left {
  2145. // padding-left: 20px;
  2146. display: inline-block;
  2147. //width: 54%;
  2148. .left-top {
  2149. width: 100%;
  2150. overflow: hidden;
  2151. white-space: nowrap;
  2152. text-overflow: ellipsis;
  2153. -o-text-overflow: ellipsis;
  2154. .logo-box {
  2155. display: inline-block;
  2156. vertical-align: middle;
  2157. // width: 60px;
  2158. height: 20px;
  2159. }
  2160. .left-time {
  2161. span {
  2162. font-family: "Montserrat";
  2163. font-style: normal;
  2164. font-weight: 400;
  2165. font-size: 16px;
  2166. line-height: 20px;
  2167. color: #ffffff;
  2168. }
  2169. }
  2170. .logo-icon {
  2171. display: inline-block;
  2172. vertical-align: middle;
  2173. // width: 60px;
  2174. max-width: 60px;
  2175. height: 20px;
  2176. margin-right: 5px;
  2177. }
  2178. div {
  2179. vertical-align: middle;
  2180. display: inline-block;
  2181. font-family: "Montserrat";
  2182. font-style: normal;
  2183. font-weight: 400;
  2184. font-size: 16px;
  2185. line-height: 20px;
  2186. color: #ffffff;
  2187. span {
  2188. display: inline-block;
  2189. vertical-align: middle;
  2190. &:nth-child(1) {
  2191. padding: 10px;
  2192. }
  2193. }
  2194. }
  2195. .weather {
  2196. padding-left: 22px;
  2197. line-height: 24px;
  2198. // font-size: 0;
  2199. // padding-right: 5px;
  2200. .weather-icon {
  2201. width: 24px;
  2202. height: 24px;
  2203. margin-right: 10px;
  2204. display: inline-block;
  2205. vertical-align: middle;
  2206. }
  2207. span {
  2208. display: inline-block;
  2209. vertical-align: middle;
  2210. font-family: "Montserrat";
  2211. font-style: normal;
  2212. font-weight: 400;
  2213. font-size: 16px;
  2214. padding-top: 2px;
  2215. }
  2216. }
  2217. .weixiin {
  2218. margin-left: 20px;
  2219. img {
  2220. margin-right: 5px;
  2221. width: 24px;
  2222. height: 24px;
  2223. display: inline-block;
  2224. vertical-align: middle;
  2225. }
  2226. }
  2227. }
  2228. .left-space {
  2229. padding-top: 12vh;
  2230. padding-right: 30px;
  2231. .text {
  2232. position: relative;
  2233. width: 100%;
  2234. overflow: hidden;
  2235. white-space: nowrap;
  2236. text-overflow: ellipsis;
  2237. -o-text-overflow: ellipsis;
  2238. div {
  2239. display: inline-block;
  2240. vertical-align: middle;
  2241. &:nth-child(1) {
  2242. font-style: normal;
  2243. font-weight: 500;
  2244. font-size: 40px;
  2245. line-height: 58px;
  2246. color: #ffffff;
  2247. }
  2248. &:nth-child(2) {
  2249. position: absolute;
  2250. bottom: 12px;
  2251. width: 70px;
  2252. height: 25px;
  2253. line-height: 25px;
  2254. text-align: center;
  2255. margin-left: 10px;
  2256. background: #edf1f5;
  2257. border-radius: 10px;
  2258. img {
  2259. display: inline-block;
  2260. vertical-align: middle;
  2261. width: 15px;
  2262. height: 15px;
  2263. // margin-top: 4px;
  2264. }
  2265. span {
  2266. display: inline-block;
  2267. vertical-align: middle;
  2268. margin-left: 4px;
  2269. font-weight: 400;
  2270. font-size: 12px;
  2271. line-height: 15px;
  2272. color: #8b949e;
  2273. }
  2274. }
  2275. }
  2276. }
  2277. }
  2278. .space-info {
  2279. // padding-top: 48px;
  2280. padding-top: 6vh;
  2281. .space-temp {
  2282. padding-bottom: 13px;
  2283. // border-bottom: 0.5px solid rgba(255, 255, 255, 0.4);
  2284. overflow: hidden;
  2285. white-space: nowrap;
  2286. text-overflow: ellipsis;
  2287. -o-text-overflow: ellipsis;
  2288. img {
  2289. display: inline-block;
  2290. vertical-align: middle;
  2291. width: 22px;
  2292. height: 40px;
  2293. }
  2294. span {
  2295. display: inline-block;
  2296. vertical-align: middle;
  2297. padding-left: 14px;
  2298. }
  2299. .temp-text {
  2300. font-family: "Noto Sans SC";
  2301. font-style: normal;
  2302. font-weight: 500;
  2303. font-size: 32px;
  2304. line-height: 46px;
  2305. text-align: center;
  2306. color: #ffffff;
  2307. padding-left: 13px;
  2308. }
  2309. .temp-num {
  2310. position: relative;
  2311. padding-left: 24px;
  2312. font-family: "Montserrat";
  2313. font-style: normal;
  2314. font-weight: 400;
  2315. font-size: 60px;
  2316. line-height: 73px;
  2317. color: #ffffff;
  2318. sup {
  2319. position: absolute;
  2320. top: 0;
  2321. font-family: "Noto Sans SC";
  2322. font-style: normal;
  2323. font-weight: 500;
  2324. font-size: 13px;
  2325. line-height: 19px;
  2326. color: #ffffff;
  2327. }
  2328. }
  2329. }
  2330. }
  2331. .space-env {
  2332. display: flex;
  2333. // padding-top: 20px;
  2334. padding-top: 5vh;
  2335. justify-content: space-between;
  2336. text-align: left;
  2337. overflow: hidden;
  2338. white-space: nowrap;
  2339. text-overflow: ellipsis;
  2340. -o-text-overflow: ellipsis;
  2341. .env-item {
  2342. padding-top: 8px;
  2343. height: 88px;
  2344. &:nth-child(1) {
  2345. text-align: left;
  2346. width: 129px;
  2347. }
  2348. &:nth-child(2) {
  2349. // text-align: center;
  2350. padding-left: 20px;
  2351. width: 129px;
  2352. }
  2353. &:nth-child(3) {
  2354. // text-align: center;
  2355. padding-left: 20px;
  2356. width: 125px;
  2357. }
  2358. &:nth-child(4) {
  2359. // text-align: center;
  2360. padding-left: 20px;
  2361. width: 100px;
  2362. }
  2363. div {
  2364. img {
  2365. display: inline-block;
  2366. vertical-align: middle;
  2367. width: 20px;
  2368. height: 20px;
  2369. margin-right: 5px;
  2370. }
  2371. span {
  2372. display: inline-block;
  2373. vertical-align: middle;
  2374. font-size: 16px;
  2375. line-height: 23px;
  2376. text-align: center;
  2377. color: #ffffff;
  2378. }
  2379. &:nth-child(2) {
  2380. padding-top: 10px;
  2381. font-family: "Montserrat";
  2382. font-style: normal;
  2383. font-weight: 400;
  2384. font-size: 32px;
  2385. line-height: 39px;
  2386. color: #ffffff;
  2387. sup {
  2388. font-family: "Noto Sans SC";
  2389. font-style: normal;
  2390. font-weight: 500;
  2391. font-size: 13px;
  2392. line-height: 19px;
  2393. }
  2394. }
  2395. }
  2396. .env-text {
  2397. position: relative;
  2398. width: 100%;
  2399. // text-align: left;
  2400. sup {
  2401. position: absolute;
  2402. // right: -5px;
  2403. top: 10px;
  2404. }
  2405. }
  2406. }
  2407. .env-item-radius {
  2408. border-radius: 25px;
  2409. }
  2410. .env-color {
  2411. // background: linear-gradient(
  2412. // 180deg,
  2413. // rgba(205, 11, 0, 0) 0%,
  2414. // #cd0b00 100%
  2415. // );
  2416. // opacity: 0.8;
  2417. // border-radius: 25px;
  2418. }
  2419. }
  2420. }
  2421. .main-right {
  2422. //width: 45%;
  2423. // width: 330px;
  2424. padding-bottom: 20px;
  2425. display: inline-block;
  2426. overflow: auto;
  2427. .work-btn {
  2428. width: 100%;
  2429. height: 98px;
  2430. font-size: 14px;
  2431. text-align: left;
  2432. }
  2433. }
  2434. .fotter {
  2435. position: fixed;
  2436. font-size: 0;
  2437. left: 0;
  2438. bottom: 0;
  2439. z-index: 666;
  2440. .fotter-item {
  2441. position: relative;
  2442. display: inline-block;
  2443. vertical-align: middle;
  2444. width: 186px;
  2445. height: 40px;
  2446. font-size: 0;
  2447. img {
  2448. width: 100%;
  2449. height: 40px;
  2450. }
  2451. &:nth-child(1) {
  2452. left: 0;
  2453. z-index: 333;
  2454. }
  2455. &:nth-child(2) {
  2456. margin-left: -25px;
  2457. z-index: 222;
  2458. }
  2459. &:nth-child(3) {
  2460. margin-left: -25px;
  2461. z-index: 111;
  2462. }
  2463. span {
  2464. position: absolute;
  2465. display: inline-block;
  2466. width: 128px;
  2467. height: 18px;
  2468. left: 50%;
  2469. top: 50%;
  2470. transform: translateY(-40%) translateX(-50%);
  2471. font-family: "Noto Sans SC";
  2472. font-style: normal;
  2473. font-weight: 400;
  2474. font-size: 16px;
  2475. line-height: 18px;
  2476. text-align: center;
  2477. color: #c3c7cb;
  2478. word-wrap: break-word; /*强制换行*/
  2479. overflow: hidden; /*超出隐藏*/
  2480. text-overflow: ellipsis; /*隐藏后添加省略号*/
  2481. white-space: nowrap; /*强制不换行*/
  2482. }
  2483. }
  2484. .fotter-item-end {
  2485. position: relative;
  2486. display: inline-block;
  2487. vertical-align: middle;
  2488. width: 93px;
  2489. height: 40px;
  2490. margin-left: -30px;
  2491. text-align: center;
  2492. z-index: 1;
  2493. img {
  2494. width: 100%;
  2495. }
  2496. span {
  2497. position: absolute;
  2498. left: 50%;
  2499. top: 50%;
  2500. transform: translate(-50%, -50%);
  2501. font-family: "Noto Sans SC";
  2502. font-style: normal;
  2503. font-weight: 400;
  2504. font-size: 16px;
  2505. text-align: center;
  2506. color: #c3c7cb;
  2507. }
  2508. }
  2509. .fotter-item-active {
  2510. margin-bottom: 0px;
  2511. z-index: 999;
  2512. img {
  2513. height: 40px;
  2514. }
  2515. span {
  2516. color: #1f2429;
  2517. }
  2518. }
  2519. }
  2520. }
  2521. </style>
  2522. <style lang="scss">
  2523. .map-popup {
  2524. background: $elBg;
  2525. }
  2526. </style>