index.vue 87 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795
  1. <template>
  2. <div class="app-container">
  3. <el-row>
  4. <el-col :span="4" class="nav-class" v-loading="navLoading">
  5. <div class="nav-box">
  6. <div class="item-school" v-for="(item0, index0) in navData" :key="index0">
  7. <div class="school" @click="school_toggle(item0.id, item0.label)">
  8. <div>{{item0.label}}</div>
  9. <i v-if="item0.isShow" class="el-icon-arrow-down"></i>
  10. <i v-else class="el-icon-arrow-right"></i>
  11. </div>
  12. <div class="item-loudong" v-for="(item1, index1) in item0.children" :key="index1" :style="{display: item0.isShow ? '' : 'none'}">
  13. <el-tooltip class="item" effect="dark" :content="item1.label" placement="right">
  14. <div class="loudong" @click="loudong_toggle(item1.id + '|' + item0.id, item1.label + '|'+ item0.label)">
  15. <div class="louidong_text">{{item1.label}}</div>
  16. <i v-if="item1.isShow" class="el-icon-arrow-down"></i>
  17. <i v-else class="el-icon-arrow-right"></i>
  18. </div>
  19. </el-tooltip>
  20. <div class="item-louceng" v-for="(item2, index2) in item1.children" :key="index2" :style="{display: item1.isShow ? '' : 'none'}">
  21. <div :id="`louceng${index0}${index1}${index2}`" class="louceng" :class="louceng_click_id == item2.id ? 'louceng-clicked' : '' "
  22. @click="louceng_click($event, item2.id + '|' + item1.id + '|' + item0.id, item2.label + '|' + item1.label + '|'+ item0.label, item2.rooms)">
  23. {{item2.label}}
  24. </div>
  25. <div class="louceng-del"
  26. @click="del_louceng_click($event, item2.id + '|' + item1.id + '|' + item0.id, item2.label + '|' + item1.label + '|'+ item0.label, item2.rooms)">
  27. <i class="el-icon-delete"></i>
  28. </div>
  29. </div>
  30. <div class="loudong-add-louceng" :style="{display: item1.isShow ? '' : 'none'}"
  31. @click="add_louceng(item1.id + '|' + item0.id, item1.label + '|'+ item0.label)">
  32. <i class="el-icon-circle-plus-outline"></i>
  33. <div class="loudong-add-louceng-txt">添加楼层</div>
  34. </div>
  35. </div>
  36. <div class="add-loudong" @click="add_loudong(item0.id, item0.label)" :style="{display: item0.isShow ? '' : 'none'}">
  37. <i class="el-icon-circle-plus-outline"></i>
  38. <div class="add-loudong-txt">添加楼栋</div>
  39. </div>
  40. </div>
  41. </div>
  42. </el-col>
  43. <el-col :span="20">
  44. <div class="cell">
  45. <div class="cell-title">
  46. <div class="title-left">
  47. <div class="title">{{currentData.title_any_where}} 空调管理</div>
  48. <div class="title-detail">房间:{{room_number}}间</div>
  49. <div class="title-detail">设备:{{device_number}}台</div>
  50. <div class="title-detail">离线:{{offline_device_number}}台</div>
  51. <div class="title-detail">关机:{{shutdown_device_number}}台</div>
  52. <div class="title-detail">已开:{{open_number}}台</div>
  53. <div class="title-detail">预警:{{warning_number}}台</div>
  54. </div>
  55. <div class="title-right">
  56. <el-button type="primary" @click="add_room">新增房间</el-button>
  57. </div>
  58. </div>
  59. <div class="cell-body" v-loading="listLoading">
  60. <div class="cell-body-top-btns">
  61. <el-button :class="btnActive == 'all' ? 'btn-active':'btn-no-active'" type="primary" size="medium" round
  62. @click="top_btn_click('all')">全部</el-button>
  63. <el-button :class="btnActive == 'powerOn' ? 'btn-active':'btn-no-active'" type="primary" size="medium" round
  64. @click="top_btn_click('powerOn')">开机</el-button>
  65. <el-button :class="btnActive == 'powerOff' ? 'btn-active':'btn-no-active'" type="primary" size="medium" round
  66. @click="top_btn_click('powerOff')">关机</el-button>
  67. <el-button :class="btnActive == 'abnormal' ? 'btn-active':'btn-no-active'" type="primary" size="medium" round
  68. @click="top_btn_click('abnormal')">离线</el-button>
  69. </div>
  70. <el-row>
  71. <el-col :span="12">
  72. <div class="panel-left" :style="{display: currentData.rooms[0].room == '' ? 'none' : ''}">
  73. <div class="panel-header">
  74. <div class="panel-title-caption">
  75. <svg-icon icon-class="panel-home" class="panel-title-icon" />
  76. <div class="panel-title">{{currentData.rooms[0].room}}</div>
  77. </div>
  78. <div class="panel-title-btns">
  79. <el-button class="panel-title-btn" type="text" icon="el-icon-edit-outline"
  80. @click="operate_modify_room(currentData.rooms[0].room)">编辑</el-button>
  81. <el-button class="panel-title-btn" type="text" icon="el-icon-delete"
  82. @click="operate_delete_room(currentData.rooms[0].room)">删除
  83. </el-button>
  84. </div>
  85. </div>
  86. <div class="panel-body">
  87. <el-table :data="currentData.rooms[0].tableData" height="170" v-loading="airsLoading[0].loading"
  88. :element-loading-text="airsLoading[0].text" element-loading-spinner="el-icon-loading" :cell-style="setCellStyle"
  89. element-loading-background="rgba(0, 0, 0, 0.8)" :header-cell-style="setHeaderSellStyle">
  90. <el-table-column label="名称" align="center" width="140">
  91. <template slot-scope="scope">
  92. <span>{{ scope.row.name }}</span>
  93. </template>
  94. </el-table-column>
  95. <el-table-column label="ID" align="center">
  96. <template slot-scope="scope">
  97. <span>{{ scope.row.ip }}</span>
  98. </template>
  99. </el-table-column>
  100. <el-table-column label="类型" align="center" width="85">
  101. <template slot-scope="scope">
  102. <span>{{ scope.row.device }}</span>
  103. </template>
  104. </el-table-column>
  105. <el-table-column label="使用时长" align="center">
  106. <template slot-scope="scope">
  107. <span>{{ scope.row.userTime }}</span>
  108. </template>
  109. </el-table-column>
  110. <el-table-column label="告警状态" align="center">
  111. <template slot-scope="scope">
  112. <span v-if="scope.row.alarmStatus == '正常'">{{ scope.row.alarmStatus }}</span>
  113. <span v-else @click="alarm_status_click(scope.$index, scope.row)"
  114. class="txt-cell-blue">{{ scope.row.alarmStatus }}</span>
  115. </template>
  116. </el-table-column>
  117. <el-table-column label="开关状态" align="center">
  118. <template slot-scope="scope">
  119. <span v-if="scope.row.onOffStatus == 0" @click="open_close_airs(0, scope.$index, scope.row, 'open')">
  120. <el-tooltip class="item" effect="dark" content="已关机" placement="left">
  121. <svg-icon icon-class="power" class="power-icon-off" />
  122. </el-tooltip>
  123. </span>
  124. <span v-else class="txt-cell-blue" @click="open_close_airs(0, scope.$index, scope.row, 'close')">
  125. <el-tooltip class="item" effect="dark" content="已开机" placement="left">
  126. <svg-icon icon-class="power" class="power-icon-on" />
  127. </el-tooltip>
  128. </span>
  129. </template>
  130. </el-table-column>
  131. <el-table-column label="操作" align="center">
  132. <template slot-scope="scope">
  133. <el-button class="btn-cell-blue" size="mini" round
  134. @click="operate_delete_air(scope.$index, scope.row, currentData.rooms[0].room)">
  135. 删除
  136. </el-button>
  137. </template>
  138. </el-table-column>
  139. </el-table>
  140. </div>
  141. <div class="panel-footer" @click="">
  142. <i class="el-icon-circle-plus-outline"></i>
  143. <div class="panel-footer-txt" @click="add_device(currentData.rooms[0].room)">
  144. 添加设备</div>
  145. </div>
  146. </div>
  147. </el-col>
  148. <el-col :span="12">
  149. <div class="panel-right" :style="{display: currentData.rooms[1].room == '' ? 'none' : ''}">
  150. <div class="panel-header">
  151. <div class="panel-title-caption">
  152. <svg-icon icon-class="panel-home" class="panel-title-icon" />
  153. <div class="panel-title">{{currentData.rooms[1].room}}</div>
  154. </div>
  155. <div class="panel-title-btns">
  156. <el-button class="panel-title-btn" type="text" icon="el-icon-edit-outline"
  157. @click="operate_modify_room(currentData.rooms[1].room)">编辑</el-button>
  158. <el-button class="panel-title-btn" type="text" icon="el-icon-delete"
  159. @click="operate_delete_room(currentData.rooms[1].room)">删除
  160. </el-button>
  161. </div>
  162. </div>
  163. <div class="panel-body">
  164. <el-table :data="currentData.rooms[1].tableData" height="170" v-loading="airsLoading[1].loading"
  165. :element-loading-text="airsLoading[1].text" element-loading-spinner="el-icon-loading"
  166. element-loading-background="rgba(0, 0, 0, 0.8)" :cell-style="setCellStyle" :header-cell-style="setHeaderSellStyle">
  167. <el-table-column label="名称" align="center" width="140">
  168. <template slot-scope="scope">
  169. <span>{{ scope.row.name }}</span>
  170. </template>
  171. </el-table-column>
  172. <el-table-column label="ID" align="center">
  173. <template slot-scope="scope">
  174. <span>{{ scope.row.ip }}</span>
  175. </template>
  176. </el-table-column>
  177. <el-table-column label="类型" align="center" width="85">
  178. <template slot-scope="scope">
  179. <span>{{ scope.row.device }}</span>
  180. </template>
  181. </el-table-column>
  182. <el-table-column label="使用时长" align="center">
  183. <template slot-scope="scope">
  184. <span>{{ scope.row.userTime }}</span>
  185. </template>
  186. </el-table-column>
  187. <el-table-column label="告警状态" align="center">
  188. <template slot-scope="scope">
  189. <span v-if="scope.row.alarmStatus == '正常'">{{ scope.row.alarmStatus }}</span>
  190. <span v-else @click="alarm_status_click(scope.$index, scope.row)"
  191. class="txt-cell-blue">{{ scope.row.alarmStatus }}</span>
  192. </template>
  193. </el-table-column>
  194. <el-table-column label="开关状态" align="center">
  195. <template slot-scope="scope">
  196. <span v-if="scope.row.onOffStatus == 0" @click="open_close_airs(1, scope.$index, scope.row, 'open')">
  197. <el-tooltip class="item" effect="dark" content="已关机" placement="left">
  198. <svg-icon icon-class="power" class="power-icon-off" />
  199. </el-tooltip>
  200. </span>
  201. <span v-else class="txt-cell-blue" @click="open_close_airs(1, scope.$index, scope.row, 'close')">
  202. <el-tooltip class="item" effect="dark" content="已开机" placement="left">
  203. <svg-icon icon-class="power" class="power-icon-on" />
  204. </el-tooltip>
  205. </span>
  206. </template>
  207. </el-table-column>
  208. <el-table-column label="操作" align="center">
  209. <template slot-scope="scope">
  210. <el-button class="btn-cell-blue" size="mini" round
  211. @click="operate_delete_air(scope.$index, scope.row, currentData.rooms[1].room)">
  212. 删除
  213. </el-button>
  214. </template>
  215. </el-table-column>
  216. </el-table>
  217. </div>
  218. <div class="panel-footer" @click="">
  219. <i class="el-icon-circle-plus-outline"></i>
  220. <div class="panel-footer-txt" @click="add_device(currentData.rooms[1].room)">
  221. 添加设备</div>
  222. </div>
  223. </div>
  224. </el-col>
  225. </el-row>
  226. <el-row>
  227. <el-col :span="12">
  228. <div class="panel-left" :style="{display: currentData.rooms[2].room == '' ? 'none' : ''}">
  229. <div class="panel-header">
  230. <div class="panel-title-caption">
  231. <svg-icon icon-class="panel-home" class="panel-title-icon" />
  232. <div class="panel-title">{{currentData.rooms[2].room}}</div>
  233. </div>
  234. <div class="panel-title-btns">
  235. <el-button class="panel-title-btn" type="text" icon="el-icon-edit-outline"
  236. @click="operate_modify_room(currentData.rooms[2].room)">编辑</el-button>
  237. <el-button class="panel-title-btn" type="text" icon="el-icon-delete"
  238. @click="operate_delete_room(currentData.rooms[2].room)">删除
  239. </el-button>
  240. </div>
  241. </div>
  242. <div class="panel-body">
  243. <el-table :data="currentData.rooms[2].tableData" height="170" v-loading="airsLoading[2].loading"
  244. :element-loading-text="airsLoading[2].text" element-loading-spinner="el-icon-loading"
  245. element-loading-background="rgba(0, 0, 0, 0.8)" :cell-style="setCellStyle" :header-cell-style="setHeaderSellStyle">
  246. <el-table-column label="名称" align="center" width="140">
  247. <template slot-scope="scope">
  248. <span>{{ scope.row.name }}</span>
  249. </template>
  250. </el-table-column>
  251. <el-table-column label="ID" align="center">
  252. <template slot-scope="scope">
  253. <span>{{ scope.row.ip }}</span>
  254. </template>
  255. </el-table-column>
  256. <el-table-column label="类型" align="center" width="85">
  257. <template slot-scope="scope">
  258. <span>{{ scope.row.device }}</span>
  259. </template>
  260. </el-table-column>
  261. <el-table-column label="使用时长" align="center">
  262. <template slot-scope="scope">
  263. <span>{{ scope.row.userTime }}</span>
  264. </template>
  265. </el-table-column>
  266. <el-table-column label="告警状态" align="center">
  267. <template slot-scope="scope">
  268. <span v-if="scope.row.alarmStatus == '正常'">{{ scope.row.alarmStatus }}</span>
  269. <span v-else @click="alarm_status_click(scope.$index, scope.row)"
  270. class="txt-cell-blue">{{ scope.row.alarmStatus }}</span>
  271. </template>
  272. </el-table-column>
  273. <el-table-column label="开关状态" align="center">
  274. <template slot-scope="scope">
  275. <span v-if="scope.row.onOffStatus == 0" @click="open_close_airs(2, scope.$index, scope.row, 'open')">
  276. <el-tooltip class="item" effect="dark" content="已关机" placement="left">
  277. <svg-icon icon-class="power" class="power-icon-off" />
  278. </el-tooltip>
  279. </span>
  280. <span v-else class="txt-cell-blue" @click="open_close_airs(2, scope.$index, scope.row, 'close')">
  281. <el-tooltip class="item" effect="dark" content="已开机" placement="left">
  282. <svg-icon icon-class="power" class="power-icon-on" />
  283. </el-tooltip>
  284. </span>
  285. </template>
  286. </el-table-column>
  287. <el-table-column label="操作" align="center">
  288. <template slot-scope="scope">
  289. <el-button class="btn-cell-blue" size="mini" round
  290. @click="operate_delete_air(scope.$index, scope.row, currentData.rooms[2].room)">
  291. 删除
  292. </el-button>
  293. </template>
  294. </el-table-column>
  295. </el-table>
  296. </div>
  297. <div class="panel-footer" @click="">
  298. <i class="el-icon-circle-plus-outline"></i>
  299. <div class="panel-footer-txt" @click="add_device(currentData.rooms[2].room)">
  300. 添加设备</div>
  301. </div>
  302. </div>
  303. </el-col>
  304. <el-col :span="12">
  305. <div class="panel-right" :style="{display: currentData.rooms[3].room == '' ? 'none' : ''}">
  306. <div class="panel-header">
  307. <div class="panel-title-caption">
  308. <svg-icon icon-class="panel-home" class="panel-title-icon" />
  309. <div class="panel-title">{{currentData.rooms[3].room}}</div>
  310. </div>
  311. <div class="panel-title-btns">
  312. <el-button class="panel-title-btn" type="text" icon="el-icon-edit-outline"
  313. @click="operate_modify_room(currentData.rooms[3].room)">编辑</el-button>
  314. <el-button class="panel-title-btn" type="text" icon="el-icon-delete"
  315. @click="operate_delete_room(currentData.rooms[3].room)">删除
  316. </el-button>
  317. </div>
  318. </div>
  319. <div class="panel-body">
  320. <el-table :data="currentData.rooms[3].tableData" height="170" v-loading="airsLoading[3].loading"
  321. :element-loading-text="airsLoading[3].text" element-loading-spinner="el-icon-loading"
  322. element-loading-background="rgba(0, 0, 0, 0.8)" :cell-style="setCellStyle" :header-cell-style="setHeaderSellStyle">
  323. <el-table-column label="名称" align="center" width="140">
  324. <template slot-scope="scope">
  325. <span>{{ scope.row.name }}</span>
  326. </template>
  327. </el-table-column>
  328. <el-table-column label="ID" align="center">
  329. <template slot-scope="scope">
  330. <span>{{ scope.row.ip }}</span>
  331. </template>
  332. </el-table-column>
  333. <el-table-column label="类型" align="center" width="85">
  334. <template slot-scope="scope">
  335. <span>{{ scope.row.device }}</span>
  336. </template>
  337. </el-table-column>
  338. <el-table-column label="使用时长" align="center">
  339. <template slot-scope="scope">
  340. <span>{{ scope.row.userTime }}</span>
  341. </template>
  342. </el-table-column>
  343. <el-table-column label="告警状态" align="center">
  344. <template slot-scope="scope">
  345. <span v-if="scope.row.alarmStatus == '正常'">{{ scope.row.alarmStatus }}</span>
  346. <span v-else @click="alarm_status_click(scope.$index, scope.row)"
  347. class="txt-cell-blue">{{ scope.row.alarmStatus }}</span>
  348. </template>
  349. </el-table-column>
  350. <el-table-column label="开关状态" align="center">
  351. <template slot-scope="scope">
  352. <span v-if="scope.row.onOffStatus == 0" @click="open_close_airs(3, scope.$index, scope.row, 'open')">
  353. <el-tooltip class="item" effect="dark" content="已关机" placement="left">
  354. <svg-icon icon-class="power" class="power-icon-off" />
  355. </el-tooltip>
  356. </span>
  357. <span v-else class="txt-cell-blue" @click="open_close_airs(3, scope.$index, scope.row, 'close')">
  358. <el-tooltip class="item" effect="dark" content="已开机" placement="left">
  359. <svg-icon icon-class="power" class="power-icon-on" />
  360. </el-tooltip>
  361. </span>
  362. </template>
  363. </el-table-column>
  364. <el-table-column label="操作" align="center">
  365. <template slot-scope="scope">
  366. <el-button class="btn-cell-blue" size="mini" round
  367. @click="operate_delete_air(scope.$index, scope.row, currentData.rooms[3].room)">
  368. 删除
  369. </el-button>
  370. </template>
  371. </el-table-column>
  372. </el-table>
  373. </div>
  374. <div class="panel-footer" @click="">
  375. <i class="el-icon-circle-plus-outline"></i>
  376. <div class="panel-footer-txt" @click="add_device(currentData.rooms[3].room)">
  377. 添加设备</div>
  378. </div>
  379. </div>
  380. </el-col>
  381. </el-row>
  382. <div class="pagination-table">
  383. <el-pagination @current-change="currentPageChange" :hide-on-single-page="hideOnSinglePage"
  384. :current-page.sync="pagination.currentPage" :page-size="pagination.pageSize" layout="prev, pager, next, jumper"
  385. :total="pagination.total">
  386. </el-pagination>
  387. </div>
  388. </div>
  389. </div>
  390. </el-col>
  391. </el-row>
  392. <!-- 添加楼栋 -->
  393. <el-dialog title="添加楼栋" custom-class="el-dialog-add-loudong" :visible.sync="dialog_add_loudong" :close-on-click-modal="false"
  394. :close-on-press-escape="false" @close="dialog_close('form_add_loudong')">
  395. <el-form :model="form_add_loudong" ref="add_loudong_form" :rules="form_add_loudong_rules">
  396. <el-form-item label="校区:" :label-width="formLabelWidth">
  397. <span>{{form_add_loudong.school}}</span>
  398. </el-form-item>
  399. <el-form-item label="楼栋:" :label-width="formLabelWidth" prop="building" :required="true">
  400. <el-input v-model="form_add_loudong.building" autocomplete="off" placeholder="请输入楼栋名称" ref="ref_loudong" maxlength="15"></el-input>
  401. </el-form-item>
  402. </el-form>
  403. <div slot="footer" class="dialog-footer">
  404. <el-button @click="dialog_add_loudong = false">取 消</el-button>
  405. <el-button type="primary" @click="dialog_add_loudong_click">确 定</el-button>
  406. </div>
  407. </el-dialog>
  408. <!-- 添加楼层 -->
  409. <el-dialog title="添加楼层" custom-class="el-dialog-add-louceng" :visible.sync="dialog_add_louceng" :close-on-click-modal="false"
  410. :close-on-press-escape="false" @close="dialog_close('form_add_louceng')">
  411. <el-form :model="form_add_louceng" ref="add_louceng_form" :rules="form_add_louceng_rules">
  412. <el-form-item label="校区:" :label-width="formLabelWidth">
  413. <div>{{form_add_louceng.school}}</div>
  414. </el-form-item>
  415. <el-form-item label="楼栋:" :label-width="formLabelWidth">
  416. <div>{{form_add_louceng.building}}</div>
  417. </el-form-item>
  418. <el-form-item label="楼层:" :label-width="formLabelWidth" prop="floor" :required="true">
  419. <el-input v-model="form_add_louceng.floor" autocomplete="off" placeholder="请输入楼层号" ref="ref_louceng" maxlength="1"
  420. @keydown.enter.native="dialog_add_louceng_click"></el-input>
  421. </el-form-item>
  422. </el-form>
  423. <div slot="footer" class="dialog-footer">
  424. <el-button @click="dialog_add_louceng = false">取 消</el-button>
  425. <el-button type="primary" @click="dialog_add_louceng_click">确 定</el-button>
  426. </div>
  427. </el-dialog>
  428. <!-- 操作员详情 -->
  429. <el-dialog title="操作员详情" custom-class="el-dialog-operator_details" :visible.sync="dialog_operator_details"
  430. @close="dialog_close('form_operator_details')">
  431. <el-form :model="form_operator_details">
  432. <el-form-item label="姓  名:" :label-width="formLabelWidth">
  433. <div>{{form_operator_details.name}}</div>
  434. </el-form-item>
  435. <el-form-item label="联系方式:" :label-width="formLabelWidth">
  436. <div>{{form_operator_details.contact}}</div>
  437. </el-form-item>
  438. </el-form>
  439. </el-dialog>
  440. <!-- 添加房间 -->
  441. <el-dialog title="新增房间" custom-class="el-dialog-add-room" :visible.sync="dialog_add_room" :close-on-click-modal="false" :close-on-press-escape="false"
  442. @close="dialog_close('form_add_room')">
  443. <el-form :model="form_add_room" ref="add_room_form" :rules="form_add_room_rules">
  444. <el-form-item label="校区:" :label-width="formLabelWidth">
  445. <div>{{form_add_room.school}}</div>
  446. </el-form-item>
  447. <el-form-item label="楼栋:" :label-width="formLabelWidth">
  448. <div>{{form_add_room.building}}</div>
  449. </el-form-item>
  450. <el-form-item label="楼层:" :label-width="formLabelWidth">
  451. <div>{{form_add_room.floor}}</div>
  452. </el-form-item>
  453. <el-form-item label="房间:" :label-width="formLabelWidth" :required="true" prop="room">
  454. <el-input v-model="form_add_room.room" autocomplete="off" placeholder="请输入房间名称" ref="ref_add_room" maxlength="10"
  455. @keydown.enter.native="dialog_add_room_click"></el-input>
  456. </el-form-item>
  457. </el-form>
  458. <div slot="footer" class="dialog-footer">
  459. <el-button @click="dialog_add_room = false">取 消</el-button>
  460. <el-button type="primary" @click="dialog_add_room_click">确 定</el-button>
  461. </div>
  462. </el-dialog>
  463. <!-- 添加空调设备 -->
  464. <el-dialog :title="currentData.addDevice + ' 添加设备'" custom-class="el-dialog-add-device" :visible.sync="dialog_add_device" :close-on-click-modal="false"
  465. :close-on-press-escape="false" @close="dialog_close('form_add_device')">
  466. <el-form :model="form_add_device" ref="add_device_form" :rules="form_add_device_rules">
  467. <el-form-item label="当前坐标:" :label-width="formLabelWidth">
  468. <div>{{form_add_device.school + ' / ' + form_add_device.build + ' / ' + form_add_device.floors}}
  469. </div>
  470. </el-form-item>
  471. <el-form-item label="操作员:" :label-width="formLabelWidth" prop="cao">
  472. <el-input v-model="form_add_device.cao" autocomplete="off" placeholder="请输入操作员" ref="ref_cao" maxlength="10"></el-input>
  473. </el-form-item>
  474. <el-form-item label="手机号码:" :label-width="formLabelWidth" prop="contact">
  475. <el-input v-model="form_add_device.contact" autocomplete="off" placeholder="请输入手机号码" ref="ref_contact" maxlength="11"
  476. readonly=""></el-input>
  477. </el-form-item>
  478. <el-form-item label="设备名称:" :label-width="formLabelWidth" prop="deviceName" :required="true">
  479. <el-input v-model="form_add_device.deviceName" autocomplete="off" placeholder="请输入设备名称" ref="ref_deviceName" maxlength="10"></el-input>
  480. </el-form-item>
  481. <el-form-item label="设备IP/ID:" :label-width="formLabelWidth" prop="deviceIp" :required="true">
  482. <el-input v-model="form_add_device.deviceIp" autocomplete="off" placeholder="请输入设备IP/ID" maxlength="4">
  483. </el-input>
  484. </el-form-item>
  485. <el-form-item label="设备类型:" :label-width="formLabelWidth" prop="checkedDevice" :required="true">
  486. <el-checkbox-group v-model="form_add_device.checkedDevice" :min="0" :max="1" style="width: 380px;">
  487. <el-checkbox v-for="(device, index) in form_add_device.devices" :label="device" :key="index">
  488. {{device}}
  489. </el-checkbox>
  490. </el-checkbox-group>
  491. </el-form-item>
  492. </el-form>
  493. <div slot="footer" class="dialog-footer">
  494. <el-button @click="dialog_add_device = false">取 消</el-button>
  495. <el-button type="primary" @click="dialog_add_air_click">确 定</el-button>
  496. </div>
  497. </el-dialog>
  498. <!-- 编辑房间 -->
  499. <el-dialog title="编辑房间" custom-class="el-dialog-modify-room" :visible.sync="dialog_modify_room" :close-on-click-modal="false"
  500. :close-on-press-escape="false" @close="dialog_close('form_modify_room')">
  501. <el-form :model="form_modify_room" ref="modify_room_form" :rules="form_modify_room_rules">
  502. <el-form-item label="校区:" :label-width="formLabelWidth">
  503. <div>{{form_modify_room.school}}</div>
  504. </el-form-item>
  505. <el-form-item label="楼栋:" :label-width="formLabelWidth">
  506. <div>{{form_modify_room.building}}</div>
  507. </el-form-item>
  508. <el-form-item label="楼层:" :label-width="formLabelWidth">
  509. <div>{{form_modify_room.floor}}</div>
  510. </el-form-item>
  511. <el-form-item label="房间:" :label-width="formLabelWidth" :required="true" prop="room">
  512. <el-input v-model="form_modify_room.room" autocomplete="off" placeholder="请输入房间号" ref="ref_modi_room" maxlength="10"
  513. @keydown.enter.native="dialog_modify_room_click(show_modify_room)"></el-input>
  514. </el-form-item>
  515. </el-form>
  516. <div slot="footer" class="dialog-footer">
  517. <el-button @click="dialog_modify_room = false">取 消</el-button>
  518. <el-button type="primary" @click="dialog_modify_room_click(show_modify_room)">确 定</el-button>
  519. </div>
  520. </el-dialog>
  521. <!-- 删除房间 -->
  522. <el-dialog custom-class="el-dialog-delete-room" :visible.sync="dialog_delete_room" :close-on-click-modal="false" :close-on-press-escape="false"
  523. :show-close="false">
  524. <div slot="" class="del-air-body">
  525. <img src="../../icons/serveAC/del_warning.png" alt="">
  526. <div class="del-air-body-txt">是否确定删除房间【{{ show_delete_room }}】?</div>
  527. </div>
  528. <div slot="footer" class="dialog-footer">
  529. <el-button @click="dialog_delete_room = false"> 否 </el-button>
  530. <el-button type="primary" @click="dialog_delete_rooms_click(show_delete_room)"> 是 </el-button>
  531. </div>
  532. </el-dialog>
  533. <!-- 删除空调 -->
  534. <el-dialog custom-class="el-dialog-delete-air" :visible.sync="dialog_delete_air" :close-on-click-modal="false" :close-on-press-escape="false"
  535. :show-close="false">
  536. <div slot="" class="del-air-body">
  537. <img src="../../icons/serveAC/del_warning.png" alt="">
  538. <div class="del-air-body-txt">是否确定刪除IP/ID为【{{delAir.deleteAirIp}}】的空调?</div>
  539. </div>
  540. <div slot="footer" class="dialog-footer">
  541. <el-button @click="dialog_delete_air = false"> 否 </el-button>
  542. <el-button type="primary" @click="dialog_delete_air_click"> 是 </el-button>
  543. </div>
  544. </el-dialog>
  545. </div>
  546. </template>
  547. <script>
  548. import {
  549. getBuildingData,
  550. addBuild,
  551. addFloors,
  552. addRooms,
  553. addAirs,
  554. getRoomAirs,
  555. deleteAirs,
  556. getRoomsAndAirs,
  557. getOpeningAndAbnomal,
  558. updateRooms,
  559. delRooms,
  560. startAirs,
  561. stopAirs,
  562. selAirsStatus,
  563. getDevices,
  564. delFloors
  565. } from '@/api/serveAC';
  566. export default {
  567. data() {
  568. var checkloudong = (rule, value, callback) => {
  569. if (!value) {
  570. return callback(new Error('请输入楼栋名称'));
  571. }
  572. // setTimeout(() => {
  573. // var reg = /^[a-zA-Z0-9_\u4e00-\u9fa5]{2,10}$/
  574. // if (!reg.test(value)) {
  575. // callback(new Error('必须为2-10个汉字、数字、字母或下划线!'));
  576. // } else {
  577. // callback();
  578. // }
  579. // }, 100);
  580. callback();
  581. }
  582. var checklouceng = (rule, value, callback) => {
  583. if (!value) {
  584. return callback(new Error('请输入数字楼层号'));
  585. }
  586. setTimeout(() => {
  587. var reg = /^[1-9]{1}$/
  588. if (!reg.test(value)) {
  589. callback(new Error('楼层只能输入 1 到 9 的数字'));
  590. } else {
  591. callback();
  592. }
  593. }, 100);
  594. };
  595. var checkroom = (rule, value, callback) => {
  596. if (!value) {
  597. return callback(new Error('请输入房间号'));
  598. }
  599. setTimeout(() => {
  600. callback();
  601. }, 100);
  602. // setTimeout(() => {
  603. // var regH = /[\d]$/g;
  604. // var floor = this.currentData.floor.replace(regH, '');
  605. // var reg = /[1-9]{1}[0-9]{2,3}$/
  606. // if (value.indexOf(floor)) {
  607. // callback(new Error('房间号数字部分,必须以楼层号开头!'));
  608. // } else if (!reg.test(value)) {
  609. // callback(new Error('房间号数字部分,为3-4个数字,非0开头!栋号不需要添加!'));
  610. // } else {
  611. // callback();
  612. // }
  613. // }, 100);
  614. };
  615. var checkCao = (rule, value, callback) => {
  616. if (!value) {
  617. return callback(new Error('请输入操作员'));
  618. };
  619. setTimeout(() => {
  620. callback();
  621. }, 100);
  622. // setTimeout(() => {
  623. // var reg = /^[\u4e00-\u9fa5]{2,10}$/
  624. // if (!reg.test(value)) {
  625. // callback(new Error('必须为2-10个汉字!'));
  626. // } else {
  627. // callback();
  628. // }
  629. // }, 100);
  630. };
  631. // var checkcontact = (rule, value, callback) => {
  632. // if (!value) {
  633. // return callback(new Error('请输入手机号码'));
  634. // };
  635. // setTimeout(() => {
  636. // var reg =
  637. // /^((13[0-9])|(14[0|5|6|7|9])|(15[0-3])|(15[5-9])|(16[6|7])|(17[2|3|5|6|7|8])|(18[0-9])|(19[1|8|9]))\d{8}$/
  638. // if (!reg.test(value)) {
  639. // callback(new Error('手机号码输入不规范!'));
  640. // } else {
  641. // callback();
  642. // }
  643. // }, 100);
  644. // };
  645. var checkDeviceName = (rule, value, callback) => {
  646. if (!value) {
  647. return callback(new Error('请输入设备名称'));
  648. }
  649. setTimeout(() => {
  650. var reg = /^[a-zA-Z0-9_\u4e00-\u9fa5]{2,10}$/
  651. if (!reg.test(value)) {
  652. callback(new Error('必须为2-10个汉字、数字、字母或下划线!'));
  653. } else {
  654. callback();
  655. }
  656. }, 100);
  657. };
  658. var checkDeviceIp = (rule, value, callback) => {
  659. if (!value) {
  660. return callback(new Error('请输入设备IP/ID'));
  661. }
  662. setTimeout(() => {
  663. var reg = /^[0-9]{4}$/
  664. if (!reg.test(value)) {
  665. callback(new Error('必须为4位数字!'));
  666. } else {
  667. callback();
  668. }
  669. }, 100);
  670. };
  671. var checkCheckedDevice = (rule, value, callback) => {
  672. if (!value[0]) {
  673. return callback(new Error('请选择设备类型'));
  674. } else {
  675. callback();
  676. }
  677. };
  678. return {
  679. hideOnSinglePage: true, // 只有一页时是否隐藏
  680. room_number: 0, // 房间数量
  681. device_number: 0, // 设备数量
  682. offline_device_number: 0, // 离线数量
  683. shutdown_device_number: 0, // 关机数量
  684. open_number: 0, // 已开启
  685. warning_number: 0, // 预警台数
  686. search_datatime: '',
  687. // 添加楼栋
  688. dialog_add_loudong: false, // 显示 或 隐藏 添加楼栋对话框
  689. form_add_loudong: { // 添加楼栋数据
  690. school: '',
  691. building: ''
  692. },
  693. form_add_loudong_rules: { // 添加楼栋表单验证
  694. building: [{
  695. validator: checkloudong
  696. }]
  697. },
  698. // 添加楼层
  699. dialog_add_louceng: false,
  700. form_add_louceng: { // 添加楼层数据
  701. school: '',
  702. building: '',
  703. floor: ''
  704. },
  705. form_add_louceng_rules: { // 添加楼层表单验证
  706. floor: [{
  707. validator: checklouceng
  708. }]
  709. },
  710. // 新增房间
  711. dialog_add_room: false,
  712. form_add_room: { // 新增房间数据
  713. school: '',
  714. building: '',
  715. floor: '',
  716. room: ''
  717. },
  718. form_add_room_rules: { // 添加房间表单验证
  719. room: [{
  720. validator: checkroom
  721. }]
  722. },
  723. // 修改房间
  724. dialog_modify_room: false,
  725. form_modify_room: { // 修改房间数据
  726. school: '',
  727. building: '',
  728. floor: '',
  729. room: ''
  730. },
  731. form_modify_room_rules: { // 修改房间表单验证
  732. room: [{
  733. validator: checkroom
  734. }]
  735. },
  736. // 添加设备
  737. dialog_add_device: false,
  738. form_add_device: { // 添加设备数据
  739. cao: this.$store.state.user.name, // 操作员
  740. contact: this.$store.state.user.phone, // 操作员手机号
  741. school: '',
  742. build: '',
  743. floors: '',
  744. room: '',
  745. deviceName: '',
  746. deviceIp: '',
  747. checkedDevice: [],
  748. devices: [],
  749. duration_use: 0.00, // 使用时长
  750. is_normal: '1', // 是否正常
  751. is_on: '0' // 是否开启
  752. },
  753. form_add_device_rules: {
  754. deviceName: [{
  755. validator: checkDeviceName
  756. }],
  757. deviceIp: [{
  758. validator: checkDeviceIp
  759. }],
  760. checkedDevice: [{
  761. validator: checkCheckedDevice
  762. }],
  763. cao: [{
  764. validator: checkCao
  765. }],
  766. // contact: [{
  767. // validator: checkcontact
  768. // }]
  769. },
  770. dialog_operator_details: false, // 操作员详情
  771. form_operator_details: { // 操作员详情数据
  772. name: '',
  773. contact: ''
  774. },
  775. dialog_delete_room: false, // 删除房间
  776. show_delete_room: '', // 记录需要删除的房间
  777. dialog_delete_air: false, // 删除空调
  778. show_modify_room: '', // 记录需要修改的房间
  779. btnActive: 'all',
  780. louceng_click_id: '',
  781. // 左侧导航数据:校区,楼栋,楼层
  782. navData: [],
  783. form: {
  784. status: '',
  785. name: '',
  786. building: '',
  787. floor: '',
  788. room: '',
  789. device: ''
  790. },
  791. formLabelWidth: '120px',
  792. // 保存当前页数据
  793. currentData: {
  794. school: '',
  795. building: '',
  796. floor: '',
  797. allRooms: [],
  798. rooms: [{
  799. room: '',
  800. tableData: []
  801. }, {
  802. room: '',
  803. tableData: []
  804. }, {
  805. room: '',
  806. tableData: []
  807. }, {
  808. room: '',
  809. tableData: []
  810. }],
  811. addDevice: '',
  812. title_any_where: '',
  813. clickElement: ''
  814. },
  815. // 分页参数
  816. pagination: {
  817. pageSize: 4,
  818. currentPage: 1,
  819. total: 0
  820. },
  821. delAir: {
  822. deleteAirIp: '',
  823. room: ''
  824. },
  825. navLoading: false, // 加载
  826. listLoading: false,
  827. airsLoading: [{
  828. loading: false,
  829. text: ''
  830. }, {
  831. loading: false,
  832. text: ''
  833. }, {
  834. loading: false,
  835. text: ''
  836. }, {
  837. loading: false,
  838. text: ''
  839. }],
  840. deviceOptions: []
  841. }
  842. },
  843. created() {
  844. // 获取表格数据
  845. this.get_loudong_data()
  846. // 默认选中第一个房间
  847. let auto_click = setInterval(() => {
  848. let louchen_first = document.getElementById("louceng000");
  849. if (louchen_first !== null) {
  850. louchen_first.click();
  851. clearInterval(auto_click);
  852. }
  853. }, 200);
  854. // 空调设备类型
  855. this.get_Devices();
  856. },
  857. mounted() {
  858. var obj = document.getElementsByClassName("el-pagination__jump")[0];
  859. if (typeof obj == 'undefined') {
  860. return;
  861. } else {
  862. obj[0].childNodes[0].nodeValue = "跳至";
  863. }
  864. },
  865. methods: {
  866. /**
  867. * 获取所有的空调列表
  868. */
  869. get_Devices() {
  870. var _this = this;
  871. // 开始发送请求,获取配置数据
  872. getDevices().then((res) => {
  873. // console.log(res.data);
  874. if (res.code == 200) {
  875. let resdata = res.data;
  876. _this.deviceOptions = [];
  877. for (var i = 0; i < resdata.length; i++) {
  878. _this.deviceOptions.push(resdata[i].air_config);
  879. }
  880. _this.deviceOptions.sort((a, b) => a - b);
  881. this.form_add_device.devices = _this.deviceOptions;
  882. } else {
  883. _this.deviceOptions = [];
  884. this.$message.warning('没有符合条件的数据!');
  885. }
  886. }).catch((err) => {
  887. // console.log(err);
  888. this.$message.error(err.message);
  889. });
  890. },
  891. /**
  892. * 开关空调
  893. * @param {Object} roomIndex
  894. * @param {Object} rowIndex
  895. */
  896. open_close_airs(roomIndex, rowIndex, row, open_close) {
  897. // console.log(roomIndex, rowIndex, row, open_close);
  898. // console.log(this.currentData.rooms[roomIndex].tableData[rowIndex]);
  899. // console.log(row);
  900. let air_ip = this.currentData.rooms[roomIndex].tableData[rowIndex].ip;
  901. if (open_close == 'open') {
  902. this.$confirm('是否开启设备:' + row.name + ' ' + row.device, '提示', {
  903. confirmButtonText: '是的',
  904. cancelButtonText: '不用了',
  905. type: 'warning'
  906. }).then(() => {
  907. this.$set(this.airsLoading[roomIndex], 'loading', true);
  908. this.$set(this.airsLoading[roomIndex], 'text', row.name + ' ' + row.device + ' 正在【开机】中...');
  909. let user = this.$store.state.user;
  910. startAirs({
  911. admin_name: user.name,
  912. password: user.pwd,
  913. air_ip: air_ip
  914. }).then((res) => {
  915. // console.log(res);
  916. if (typeof res.code == 'undefined' || res.code == '') {
  917. this.$message.error('返回数据格式问题,code未获取到!')
  918. return
  919. }
  920. if (res.code == 200) {
  921. this.$set(this.currentData.rooms[roomIndex].tableData[rowIndex], 'onOffStatus',
  922. res.is_on)
  923. if (res.is_normal == 1) {
  924. this.$set(this.currentData.rooms[roomIndex].tableData[rowIndex],
  925. 'alarmStatus', '正常')
  926. } else {
  927. this.$set(this.currentData.rooms[roomIndex].tableData[rowIndex],
  928. 'alarmStatus', '离线')
  929. }
  930. // let _this = this;
  931. // setTimeout(() => {
  932. // _this.getAirsStatus(roomIndex, rowIndex, air_ip)
  933. // }, 4000)
  934. } else {
  935. this.$message.error(res.message)
  936. }
  937. this.$set(this.airsLoading[roomIndex], 'loading', false);
  938. // 刷新顶部数据
  939. this.flush_top_data();
  940. }).catch((err) => {
  941. // console.log(err);
  942. // this.$message.error(err.message)
  943. this.$set(this.airsLoading[roomIndex], 'loading', false);
  944. // 刷新顶部数据
  945. this.flush_top_data();
  946. });
  947. }).catch(() => {
  948. this.$message({
  949. type: 'warning',
  950. message: '已取消'
  951. });
  952. });
  953. } else if (open_close == 'close') {
  954. this.$confirm('是否关闭设备:' + row.name + ' ' + row.device, '提示', {
  955. confirmButtonText: '是的',
  956. cancelButtonText: '不用了',
  957. type: 'warning'
  958. }).then(() => {
  959. this.$set(this.airsLoading[roomIndex], 'loading', true);
  960. this.$set(this.airsLoading[roomIndex], 'text', row.name + ' ' + row.device + ' 正在【关机】中...');
  961. stopAirs({
  962. air_ip: air_ip
  963. }).then((res) => {
  964. // console.log(res);
  965. if (typeof res.code == 'undefined' || res.code == '') {
  966. this.$message.error('返回数据格式问题,code未获取到!')
  967. return
  968. }
  969. if (res.code == 200) {
  970. this.$set(this.currentData.rooms[roomIndex].tableData[rowIndex], 'onOffStatus',
  971. res.is_on)
  972. if (res.is_normal == 1) {
  973. this.$set(this.currentData.rooms[roomIndex].tableData[rowIndex],
  974. 'alarmStatus', '正常')
  975. } else {
  976. this.$set(this.currentData.rooms[roomIndex].tableData[rowIndex],
  977. 'alarmStatus', '离线')
  978. }
  979. // let _this = this;
  980. // setTimeout(() => {
  981. // _this.getAirsStatus(roomIndex, rowIndex, air_ip)
  982. // }, 4000)
  983. } else {
  984. this.$message.error(res.message)
  985. }
  986. this.$set(this.airsLoading[roomIndex], 'loading', false);
  987. // 刷新顶部数据
  988. this.flush_top_data();
  989. }).catch((err) => {
  990. // console.log(err);
  991. // this.$message.error(err.message)
  992. this.$set(this.airsLoading[roomIndex], 'loading', false);
  993. // 刷新顶部数据
  994. this.flush_top_data();
  995. });
  996. }).catch(() => {
  997. this.$message({
  998. type: 'warning',
  999. message: '已取消'
  1000. });
  1001. });
  1002. } else {
  1003. this.$message('未知开关');
  1004. }
  1005. },
  1006. /**
  1007. * 获取空调状态
  1008. * @param {Object} roomIndex
  1009. * @param {Object} rowIndex
  1010. * @param {Object} air_ip
  1011. */
  1012. getAirsStatus(roomIndex, rowIndex, air_ip) {
  1013. // console.log(roomIndex, rowIndex);
  1014. selAirsStatus({
  1015. air_ip: air_ip
  1016. }).then((res) => {
  1017. console.log(res);
  1018. if (typeof res.code == 'undefined' || res.code == '') {
  1019. this.$message.error('返回数据格式问题,code未获取到!')
  1020. return
  1021. }
  1022. if (res.code == 200) {
  1023. this.currentData.rooms[roomIndex].tableData[rowIndex].onOffStatus == res.is_on
  1024. this.currentData.rooms[roomIndex].tableData[rowIndex].alarmStatus == res.is_normal
  1025. } else {
  1026. this.$message.error(res.message)
  1027. }
  1028. }).catch((err) => {
  1029. // console.log(err);
  1030. this.$message.error(err.message)
  1031. })
  1032. },
  1033. /**
  1034. * 编辑修改房间
  1035. */
  1036. dialog_modify_room_click(room) {
  1037. this.$refs["modify_room_form"].validate(validate => {
  1038. if (validate) {
  1039. updateRooms({
  1040. school: this.form_modify_room.school,
  1041. build: this.form_modify_room.building,
  1042. floors: this.form_modify_room.floor,
  1043. dom: this.form_modify_room.room,
  1044. old_dom: room
  1045. }).then((res) => {
  1046. // console.log(res);
  1047. if (typeof res.code == 'undefined' || res.code == '') {
  1048. this.$message.error('返回数据格式问题,code未获取到!')
  1049. return
  1050. }
  1051. if (res.code == 200) {
  1052. // 隐藏删除对话框
  1053. this.dialog_modify_room = false
  1054. // 更新本地变量中的房间
  1055. let tmp = this.navData
  1056. for (var i = 0; i < tmp.length; i++) {
  1057. if (tmp[i].label == this.form_modify_room.school && typeof tmp[i]
  1058. .children !== 'undefined' && tmp[i].children.length > 0) {
  1059. let tmp1 = tmp[i].children;
  1060. for (var j = 0; j < tmp1.length; j++) {
  1061. if (tmp1[j].label == this.form_modify_room.building && typeof tmp1[j].children !== 'undefined' && tmp1[
  1062. j].children.length > 0) {
  1063. let tmp2 = tmp1[j].children;
  1064. for (var k = 0; k < tmp2.length; k++) {
  1065. if (tmp2[k].label == this.form_modify_room.floor && typeof tmp2[k].rooms !== 'undefined' &&
  1066. tmp2[k].rooms.length > 0
  1067. ) {
  1068. let tmp3 = tmp2[k].rooms;
  1069. for (var p = 0; p < tmp3.length; p++) {
  1070. if (tmp3[p] == room) {
  1071. this.navData[i].children[j].children[k].rooms[p] =
  1072. this.form_modify_room.building + '-' + this.form_modify_room.room;
  1073. }
  1074. }
  1075. this.navData[i].children[j].children[k].rooms.sort();
  1076. }
  1077. }
  1078. }
  1079. }
  1080. }
  1081. }
  1082. // 自动点击
  1083. this.currentData.clickElement.click()
  1084. } else {
  1085. this.$message.error(res.message)
  1086. }
  1087. }).catch((err) => {
  1088. // console.log(err);
  1089. this.$message.error(err.message)
  1090. })
  1091. } else {
  1092. this.$message.error('验证不通过')
  1093. return false
  1094. }
  1095. });
  1096. },
  1097. /**
  1098. * 删除房间
  1099. * @param {Object} room
  1100. */
  1101. dialog_delete_rooms_click(room) {
  1102. let data = this.currentData.title_any_where.split('-')
  1103. delRooms({
  1104. school: data[0],
  1105. build: data[1],
  1106. floors: data[2],
  1107. dom: room
  1108. }).then((res) => {
  1109. // console.log(res);
  1110. if (typeof res.code == 'undefined' || res.code == '') {
  1111. this.$message.error('返回数据格式问题,code未获取到!')
  1112. return
  1113. }
  1114. if (res.code == 200) {
  1115. // 隐藏删除对话框
  1116. this.dialog_delete_room = false
  1117. // 更新本地变量中的房间
  1118. let tmp = this.navData
  1119. for (var i = 0; i < tmp.length; i++) {
  1120. if (tmp[i].label == data[0] && typeof tmp[i].children !== 'undefined' && tmp[i]
  1121. .children.length > 0) {
  1122. let tmp1 = tmp[i].children
  1123. for (var j = 0; j < tmp1.length; j++) {
  1124. if (tmp1[j].label == data[1] && typeof tmp1[j].children !==
  1125. 'undefined' && tmp1[j].children.length > 0) {
  1126. let tmp2 = tmp1[j].children
  1127. for (var k = 0; k < tmp2.length; k++) {
  1128. if (tmp2[k].label == data[2] && typeof tmp2[k].rooms !== 'undefined' && tmp2[k].rooms.length > 0) {
  1129. let tmp3 = tmp2[k].rooms
  1130. for (var p = 0; p < tmp3.length; p++) {
  1131. if (tmp3[p] == room) {
  1132. this.navData[i].children[j].children[k].rooms.splice(p, 1)
  1133. }
  1134. }
  1135. this.navData[i].children[j].children[k].rooms.sort()
  1136. }
  1137. }
  1138. }
  1139. }
  1140. }
  1141. }
  1142. // 自动点击
  1143. this.currentData.clickElement.click()
  1144. } else {
  1145. this.$message.error(res.message)
  1146. }
  1147. }).catch((err) => {
  1148. // console.log(err);
  1149. this.$message.error(err.message)
  1150. })
  1151. },
  1152. /**
  1153. * 获取楼栋信息
  1154. */
  1155. get_loudong_data() {
  1156. this.navLoading = true;
  1157. getBuildingData().then((res) => {
  1158. // console.log(res);
  1159. if (typeof res.code == 'undefined' || res.code == '') {
  1160. this.$message.error('返回数据格式问题,code未获取到!');
  1161. return;
  1162. }
  1163. // console.log(res.data);
  1164. if (typeof res.data == 'undefined' || res.data == '') {
  1165. this.$message.error('返回数据格式问题,data未获取到!');
  1166. return;
  1167. }
  1168. // 校区
  1169. let school = JSON.parse(res.data);
  1170. // console.log('school', school);
  1171. if (school.length > 0) {
  1172. this.navData = []
  1173. let tmpSchool = []
  1174. // 每个校区追加楼栋
  1175. for (var i = 0; i < school.length; i++) {
  1176. let nData = []
  1177. let builds = school[i].builds
  1178. // 每栋中追加楼层
  1179. for (var j = 0; j < builds.length; j++) {
  1180. let tmpBuilds = {}
  1181. let tmpFloors = []
  1182. let floors = builds[j]['floors']
  1183. for (var k = 0; k < floors.length; k++) {
  1184. let floor = {
  1185. id: floors[k].id,
  1186. label: floors[k].floor,
  1187. rooms: floors[k].rooms
  1188. }
  1189. // 房间排序
  1190. floor.rooms.sort();
  1191. tmpFloors.push(floor);
  1192. }
  1193. // 楼层排序
  1194. tmpFloors.sort((a, b) => {
  1195. return (a.label - b.label)
  1196. })
  1197. tmpBuilds.id = builds[j].id
  1198. tmpBuilds.label = builds[j].building
  1199. tmpBuilds.isShow = false
  1200. tmpBuilds.children = []
  1201. tmpBuilds.children = tmpFloors
  1202. // 放入楼栋
  1203. nData.push(tmpBuilds)
  1204. }
  1205. // 楼栋排序
  1206. nData.sort((a, b) => a.label.localeCompare(b.label))
  1207. // 默认展开第1个楼栋
  1208. nData[0].isShow = true
  1209. // 放入校区
  1210. tmpSchool.push({
  1211. id: school[i].id,
  1212. label: school[i].school,
  1213. isShow: true,
  1214. children: nData
  1215. })
  1216. }
  1217. // 校区排序
  1218. tmpSchool.sort((a, b) => b.label.localeCompare(a.label))
  1219. this.navData = tmpSchool
  1220. // console.log(JSON.stringify(this.navData));
  1221. } else {
  1222. this.navData = []
  1223. this.$message.warning('没有符合条件的数据!')
  1224. }
  1225. }).catch((err) => {
  1226. // console.log(err);
  1227. this.$message.error(err.message)
  1228. });
  1229. this.navLoading = false;
  1230. },
  1231. /**
  1232. * 获取房间数据
  1233. * @param {Object} school
  1234. * @param {Object} build
  1235. * @param {Object} floors
  1236. * @param {Object} room
  1237. * @param {Object} index
  1238. */
  1239. get_room_airs_data(school, build, floors, room, index) {
  1240. // console.log(school, build, floors, room, index);
  1241. let param = {
  1242. school: school,
  1243. build: build,
  1244. floors: floors,
  1245. dom: room
  1246. }
  1247. getRoomAirs(param).then((res) => {
  1248. // console.log(res);
  1249. if (typeof res.code == 'undefined' || res.code == '') {
  1250. this.$message.error('返回数据格式问题,code未获取到!')
  1251. return
  1252. }
  1253. if (res.code == 200) {
  1254. let data = res.data
  1255. // 有设备数据
  1256. if (typeof data !== 'undefined' && data !== '') {
  1257. let tmpTableData = []
  1258. for (var i = 0; i < data.length; i++) {
  1259. let room = {}
  1260. let param = this.btnActive
  1261. if (param == 'all') { // 全部
  1262. room = {
  1263. name: data[i].air_name, // 名称
  1264. ip: data[i].air_ip, // 空调ip或id
  1265. building: data[i].build, // 楼栋
  1266. device: data[i].air_config, // 空调配置
  1267. userTime: data[i].duration_use, // 使用时长
  1268. alarmStatus: data[i].is_normal == 1 ? '正常' : '离线', // 是否正常
  1269. onOffStatus: data[i].is_on, // 是否开启
  1270. userName: data[i].cao, // 操作员
  1271. contact: '待接口返回,待优化' // 联系方式
  1272. };
  1273. } else if (param == 'powerOn' && data[i].is_on == '1') { // 开机
  1274. room = {
  1275. name: data[i].air_name, // 名称
  1276. ip: data[i].air_ip, // 空调ip或id
  1277. building: data[i].build, // 楼栋
  1278. device: data[i].air_config, // 空调配置
  1279. userTime: data[i].duration_use, // 使用时长
  1280. alarmStatus: data[i].is_normal == 1 ? '正常' : '离线', // 是否正常
  1281. onOffStatus: data[i].is_on, // 是否开启
  1282. userName: data[i].cao, // 操作员
  1283. contact: '待接口返回,待优化' // 联系方式
  1284. };
  1285. } else if (param == 'powerOff' && data[i].is_on == '0') { // 关机
  1286. room = {
  1287. name: data[i].air_name, // 名称
  1288. ip: data[i].air_ip, // 空调ip或id
  1289. building: data[i].build, // 楼栋
  1290. device: data[i].air_config, // 空调配置
  1291. userTime: data[i].duration_use, // 使用时长
  1292. alarmStatus: data[i].is_normal == 1 ? '正常' : '离线', // 是否正常
  1293. onOffStatus: data[i].is_on, // 是否开启
  1294. userName: data[i].cao, // 操作员
  1295. contact: '待接口返回,待优化' // 联系方式
  1296. };
  1297. } else if (param == 'abnormal' && data[i].is_normal == '0') { // 离线
  1298. room = {
  1299. name: data[i].air_name, // 名称
  1300. ip: data[i].air_ip, // 空调ip或id
  1301. building: data[i].build, // 楼栋
  1302. device: data[i].air_config, // 空调配置
  1303. userTime: data[i].duration_use, // 使用时长
  1304. alarmStatus: data[i].is_normal == 1 ? '正常' : '离线', // 是否正常
  1305. onOffStatus: data[i].is_on, // 是否开启
  1306. userName: data[i].cao, // 操作员
  1307. contact: '待接口返回,待优化' // 联系方式
  1308. };
  1309. }
  1310. if (JSON.stringify(room) !== '{}') {
  1311. // 每个房间的设备循环添加
  1312. tmpTableData.push(room)
  1313. }
  1314. }
  1315. if (tmpTableData.length > 0) {
  1316. tmpTableData.sort((a, b) => a.ip.localeCompare(b.ip))
  1317. this.currentData.rooms[index].tableData = tmpTableData
  1318. }
  1319. } else {
  1320. // this.$message.warning(room + ' 没有设备的数据!')
  1321. }
  1322. this.currentData.rooms[index].room = room
  1323. } else {
  1324. this.$message.error('异常!请检查数据!')
  1325. }
  1326. }).catch((err) => {
  1327. // console.log(err);
  1328. this.$message.error(err.message)
  1329. })
  1330. },
  1331. /**
  1332. * 选项的展开与收起,进行切换,递归调用
  1333. * @param {Object} obj
  1334. * @param {Object} id
  1335. */
  1336. toggle_item(obj, id) {
  1337. for (var i = 0; i < obj.length; i++) {
  1338. if (obj[i].id == id) {
  1339. if (obj[i].isShow) {
  1340. obj[i].isShow = false
  1341. } else {
  1342. obj[i].isShow = true
  1343. }
  1344. return
  1345. }
  1346. if (typeof obj[i].children != 'undefined' && obj[i].children.length > 0) {
  1347. this.toggle_item(obj[i].children, id)
  1348. }
  1349. }
  1350. },
  1351. /**
  1352. * 选项的展开与收起,进行切换
  1353. * @param {Object} e
  1354. */
  1355. school_toggle(id, label) {
  1356. // console.log(id);
  1357. // console.log(label);
  1358. // 获取id
  1359. this.toggle_item(this.navData, id)
  1360. },
  1361. /**
  1362. * 单击楼栋
  1363. * @param {Object} e
  1364. */
  1365. loudong_toggle(id, label) {
  1366. this.pagination.pageSize = 4;
  1367. this.pagination.currentPage = 1;
  1368. this.pagination.total = 0;
  1369. let ids = id.split('|')
  1370. let labels = label.split('|')
  1371. // console.log(ids);
  1372. // console.log(labels);
  1373. // 获取id
  1374. this.toggle_item(this.navData, ids[0])
  1375. },
  1376. /**
  1377. * 单击楼层
  1378. * @param {Object} e
  1379. * @param {Object} id
  1380. * @param {Object} label
  1381. * @param {Object} rooms
  1382. */
  1383. louceng_click(e, id, label, rooms) {
  1384. // console.log(e, id, label, rooms);
  1385. this.listLoading = true;
  1386. let ids = id.split('|');
  1387. let labels = label.split('|');
  1388. // console.log(ids);
  1389. // console.log(labels);
  1390. // console.log(rooms);
  1391. // 清空当前页面活动数据
  1392. this.currentData = {
  1393. school: '',
  1394. building: '',
  1395. floor: '',
  1396. allRooms: [],
  1397. rooms: [{
  1398. room: '',
  1399. tableData: []
  1400. }, {
  1401. room: '',
  1402. tableData: []
  1403. }, {
  1404. room: '',
  1405. tableData: []
  1406. }, {
  1407. room: '',
  1408. tableData: []
  1409. }],
  1410. addDevice: '',
  1411. title_any_where: '',
  1412. clickElement: e.target
  1413. };
  1414. // 分页每次单价楼层时,都要初始化
  1415. this.pagination = {
  1416. pageSize: 4,
  1417. currentPage: 1,
  1418. total: 0
  1419. };
  1420. this.offline_device_number = 0; // 离线数量初始化
  1421. this.shutdown_device_number = 0; // 关机数量初始化
  1422. // 点击的楼层id
  1423. this.louceng_click_id = ids[0];
  1424. // 填充数据
  1425. this.currentData.school = labels[2];
  1426. this.currentData.building = labels[1];
  1427. this.currentData.floor = labels[0];
  1428. // 给右侧窗口标题赋值
  1429. this.currentData.title_any_where = this.currentData.school + '-' + this.currentData
  1430. .building + '-' + this.currentData.floor;
  1431. // 获取开机、关机、异常的房间,空的不显示
  1432. this.open_close_abnormal(this.currentData.school, this.currentData.building, this.currentData.floor,
  1433. rooms);
  1434. // 刷新顶部数据
  1435. this.flush_top_data();
  1436. // 延迟取消加载loading
  1437. setTimeout(() => {
  1438. this.listLoading = false;
  1439. }, 500);
  1440. },
  1441. /**
  1442. * 删除楼层
  1443. * @param {Object} e
  1444. * @param {Object} id
  1445. * @param {Object} label
  1446. * @param {Object} rooms
  1447. */
  1448. del_louceng_click(e, id, label, rooms) {
  1449. // console.log(e, id, label, rooms);
  1450. // console.log(this.navData)
  1451. let ids = id.split('|');
  1452. let labels = label.split('|');
  1453. let _this = this;
  1454. this.$confirm('此操作将永久删除该楼层, 是否继续?', '提示', {
  1455. confirmButtonText: '确定',
  1456. cancelButtonText: '取消',
  1457. type: 'warning'
  1458. }).then(() => {
  1459. for (var i = 0; i < _this.navData.length; i++) {
  1460. if (_this.navData[i].id == ids[2]) {
  1461. // 校区
  1462. var xiaoqu = _this.navData[i].children;
  1463. for (var j = 0; j < xiaoqu.length; j++) {
  1464. // 楼栋
  1465. if (xiaoqu[j].id == ids[1]) {
  1466. var loudong = xiaoqu[j].children;
  1467. for (var k = 0; k < loudong.length; k++) {
  1468. // 楼层
  1469. if (loudong[k].id == ids[0]) {
  1470. // 删除楼层
  1471. // console.log(i, j, k);
  1472. if (_this.navData[i].children[j].children[k].rooms.length == 0) {
  1473. // 调用删除楼层接口
  1474. delFloors({
  1475. school: labels[2],
  1476. build: labels[1],
  1477. floors: labels[0]
  1478. }).then((res) => {
  1479. // console.log(res);
  1480. if (typeof res.code == 'undefined' || res.code == '') {
  1481. // this.$message.error('返回数据格式问题,code未获取到!')
  1482. return
  1483. }
  1484. if (res.code == 200) {
  1485. _this.navData[i].children[j].children.splice(k, 1);
  1486. this.$message.success('楼层删除成功!');
  1487. } else {
  1488. _this.$message.error(res.message);
  1489. }
  1490. }).catch((err) => {
  1491. // console.log(err);
  1492. this.$message.error(err.message)
  1493. });
  1494. } else {
  1495. _this.$message.error('该楼层中有房间,暂不能删除!');
  1496. }
  1497. break;
  1498. }
  1499. }
  1500. }
  1501. }
  1502. }
  1503. }
  1504. }).catch(() => {
  1505. this.$message({
  1506. type: 'info',
  1507. message: '已取消删除楼层'
  1508. });
  1509. });
  1510. },
  1511. /**
  1512. * 刷新顶部数据
  1513. */
  1514. flush_top_data() {
  1515. // 某层房间、空调数
  1516. this.getRoomsAndAirs(this.currentData.school, this.currentData.building, this.currentData.floor);
  1517. // 某层空调开启和异常统计
  1518. this.getOpeningAndAbnomal(this.currentData.school, this.currentData.building, this.currentData.floor);
  1519. },
  1520. /**
  1521. * 获取开机、关机、异常房间数
  1522. * @param {Object} school
  1523. * @param {Object} build
  1524. * @param {Object} floors
  1525. * @param {Object} rooms
  1526. */
  1527. open_close_abnormal(school, build, floors, rooms) {
  1528. // console.log(school, build, floors, rooms);
  1529. let _this = this,
  1530. len = rooms.length;
  1531. for (var i = 0; i < len; i++) {
  1532. // 延时执行
  1533. (function(t, school, build, floors, room, len) { // 注意这里是形参
  1534. setTimeout(function() {
  1535. _this.get_rooms(t, school, build, floors, room, len)
  1536. }, 50 * t); // 还是0.05执行一次,不是累加的
  1537. })(i, school, build, floors, rooms[i], len - 1); // 注意这里是实参,这里把要用的参数传进去
  1538. }
  1539. },
  1540. /**
  1541. * 获取房间数量
  1542. * @param {Object} school
  1543. * @param {Object} build
  1544. * @param {Object} floors
  1545. * @param {Object} room
  1546. */
  1547. get_rooms(index, school, build, floors, room, len) {
  1548. // console.log(index, school, build, floors, room, len);
  1549. if (this.btnActive == 'all') {
  1550. this.currentData.allRooms.push(room);
  1551. if (index == len) {
  1552. // console.log(this.currentData);
  1553. this.pagination_showData()
  1554. }
  1555. } else {
  1556. let param = {
  1557. school: school,
  1558. build: build,
  1559. floors: floors,
  1560. dom: room
  1561. }
  1562. getRoomAirs(param).then((res) => {
  1563. // console.log(res);
  1564. if (typeof res.code == 'undefined' || res.code == '') {
  1565. // this.$message.error('返回数据格式问题,code未获取到!')
  1566. return
  1567. }
  1568. if (res.code == 200) {
  1569. let data = res.data
  1570. // 有设备数据
  1571. if (typeof data !== 'undefined' && data !== '') {
  1572. let tmpTableData = []
  1573. for (var i = 0; i < data.length; i++) {
  1574. let room = {}
  1575. let param = this.btnActive
  1576. if (param == 'all') {
  1577. room = {
  1578. name: data[i].air_name, // 名称
  1579. ip: data[i].air_ip, // 空调ip或id
  1580. building: data[i].build, // 楼栋
  1581. device: data[i].air_config, // 空调配置
  1582. userTime: data[i].duration_use, // 使用时长
  1583. alarmStatus: data[i].is_normal == 1 ? '正常' : '离线', // 是否正常
  1584. onOffStatus: data[i].is_on, // 是否开启
  1585. userName: data[i].cao, // 操作员
  1586. contact: '待接口返回,待优化' // 联系方式
  1587. }
  1588. } else if (param == 'powerOn' && data[i].is_on == '1') {
  1589. room = {
  1590. name: data[i].air_name, // 名称
  1591. ip: data[i].air_ip, // 空调ip或id
  1592. building: data[i].build, // 楼栋
  1593. device: data[i].air_config, // 空调配置
  1594. userTime: data[i].duration_use, // 使用时长
  1595. alarmStatus: data[i].is_normal == 1 ? '正常' : '离线', // 是否正常
  1596. onOffStatus: data[i].is_on, // 是否开启
  1597. userName: data[i].cao, // 操作员
  1598. contact: '待接口返回,待优化' // 联系方式
  1599. }
  1600. } else if (param == 'powerOff' && data[i].is_on == '0') {
  1601. room = {
  1602. name: data[i].air_name, // 名称
  1603. ip: data[i].air_ip, // 空调ip或id
  1604. building: data[i].build, // 楼栋
  1605. device: data[i].air_config, // 空调配置
  1606. userTime: data[i].duration_use, // 使用时长
  1607. alarmStatus: data[i].is_normal == 1 ? '正常' : '离线', // 是否正常
  1608. onOffStatus: data[i].is_on, // 是否开启
  1609. userName: data[i].cao, // 操作员
  1610. contact: '待接口返回,待优化' // 联系方式
  1611. }
  1612. } else if (param == 'abnormal' && data[i].is_normal == '0') {
  1613. room = {
  1614. name: data[i].air_name, // 名称
  1615. ip: data[i].air_ip, // 空调ip或id
  1616. building: data[i].build, // 楼栋
  1617. device: data[i].air_config, // 空调配置
  1618. userTime: data[i].duration_use, // 使用时长
  1619. alarmStatus: data[i].is_normal == 1 ? '正常' : '离线', // 是否正常
  1620. onOffStatus: data[i].is_on, // 是否开启
  1621. userName: data[i].cao, // 操作员
  1622. contact: '待接口返回,待优化' // 联系方式
  1623. }
  1624. }
  1625. if (JSON.stringify(room) !== '{}') {
  1626. // 每个房间的设备循环添加
  1627. tmpTableData.push(room)
  1628. }
  1629. }
  1630. if (tmpTableData.length > 0) {
  1631. this.currentData.allRooms.push(room)
  1632. }
  1633. } else {
  1634. // this.$message.warning(room + ' 没有设备的数据!')
  1635. }
  1636. } else {
  1637. this.$message.error('异常!请检查数据!')
  1638. }
  1639. if (index == len) {
  1640. // console.log(this.currentData);
  1641. this.pagination_showData()
  1642. }
  1643. }).catch((err) => {
  1644. // console.log(err);
  1645. this.$message.error(err.message)
  1646. });
  1647. }
  1648. },
  1649. /**
  1650. * 分页显示数据
  1651. */
  1652. pagination_showData() {
  1653. // 赋值分页数据
  1654. this.pagination.total = this.currentData.allRooms.length;
  1655. // 最后一页删除后已经空了,则显示前一页或第1页
  1656. let size = Math.ceil(this.pagination.total / 4);
  1657. if (size != 0 && this.pagination.currentPage > size) {
  1658. this.pagination.currentPage = size;
  1659. }
  1660. // 进行分页处理
  1661. this.roomDataPagination(this.pagination.currentPage, this.pagination.pageSize, this
  1662. .currentData.allRooms, this.currentData.school, this.currentData.building, this
  1663. .currentData.floor);
  1664. },
  1665. /**
  1666. * 某层空调开启和异常统计
  1667. * @param {Object} school
  1668. * @param {Object} build
  1669. * @param {Object} floors
  1670. */
  1671. getOpeningAndAbnomal(school, build, floors) {
  1672. getOpeningAndAbnomal({
  1673. school,
  1674. build,
  1675. floors
  1676. }).then((res) => {
  1677. // console.log(res);
  1678. if (typeof res.code == 'undefined' || res.code == '') {
  1679. this.$message.error('返回数据格式问题,code未获取到!');
  1680. return;
  1681. }
  1682. if (res.code == 200) {
  1683. // 填充数据
  1684. this.open_number = res.onNum; // 已开启
  1685. this.warning_number = res.stateNum; // 预警台数
  1686. this.offline_device_number = res.offlineNum // 离线数量
  1687. this.shutdown_device_number = res.shutDownNum // 关机数量
  1688. } else {
  1689. this.open_number = 0;
  1690. this.warning_number = 0;
  1691. this.offline_device_number = 0;
  1692. this.shutdown_device_number = 0;
  1693. // this.$message.error(res.message);
  1694. }
  1695. }).catch((err) => {
  1696. // console.log(err);
  1697. this.$message.error(err.message);
  1698. })
  1699. },
  1700. /**
  1701. * 某层房间、空调数
  1702. * @param {Object} school
  1703. * @param {Object} build
  1704. * @param {Object} floors
  1705. */
  1706. getRoomsAndAirs(school, build, floors) {
  1707. getRoomsAndAirs({
  1708. school,
  1709. build,
  1710. floors
  1711. }).then((res) => {
  1712. // console.log(res);
  1713. if (typeof res.code == 'undefined' || res.code == '') {
  1714. this.$message.error('返回数据格式问题,code未获取到!');
  1715. return;
  1716. }
  1717. if (res.code == 200) {
  1718. // 填充数据
  1719. this.room_number = res.domNum;
  1720. this.device_number = res.airNum;
  1721. } else {
  1722. this.room_number = 0;
  1723. this.device_number = 0;
  1724. // this.$message.error(res.message);
  1725. }
  1726. }).catch((err) => {
  1727. // console.log(err);
  1728. this.$message.error(err.message);
  1729. })
  1730. },
  1731. /**
  1732. * 实现分页
  1733. * @param {Object} currentPage
  1734. * @param {Object} pageSize
  1735. * @param {Object} rooms
  1736. */
  1737. roomDataPagination(currentPage, pageSize, rooms, school, build, floors) {
  1738. // console.log(currentPage, pageSize, rooms, school, build, floors);
  1739. let startRecord = (currentPage - 1) * pageSize
  1740. // 避免最后一页不满4个的情况
  1741. let len = rooms.length
  1742. if (startRecord + pageSize < rooms.length) {
  1743. len = startRecord + pageSize
  1744. }
  1745. let _this = this
  1746. let index = 0
  1747. for (var i = startRecord; i < len; i++) {
  1748. // 延时执行
  1749. (function(t, school, build, floors, room, index) { // 注意这里是形参
  1750. setTimeout(function() {
  1751. _this.get_room_airs_data(school, build, floors, room, index)
  1752. }, 50 * t); // 还是0.05执行一次,不是累加的
  1753. })(i, school, build, floors, rooms[i], index); // 注意这里是实参,这里把要用的参数传进去
  1754. index = index + 1
  1755. }
  1756. },
  1757. /**
  1758. * 添加房间
  1759. */
  1760. add_room() {
  1761. if (this.currentData.school == '' || this.currentData.building == '' || this.currentData.floor ==
  1762. '') {
  1763. this.$message.warning('请选择楼层后,再添加房间!')
  1764. return
  1765. }
  1766. // 填充数据
  1767. this.form_add_room.school = this.currentData.school
  1768. this.form_add_room.building = this.currentData.building
  1769. this.form_add_room.floor = this.currentData.floor
  1770. // 显示添加房间
  1771. this.dialog_add_room = true
  1772. setTimeout(() => {
  1773. this.$nextTick(() => {
  1774. this.$refs.ref_add_room.focus()
  1775. })
  1776. }, 500)
  1777. },
  1778. /**
  1779. * 添加楼层
  1780. * @param {Object} e
  1781. */
  1782. add_louceng(id, label) {
  1783. // let ids = id.split('|')
  1784. let labels = label.split('|')
  1785. // console.log(ids);
  1786. // console.log(labels);
  1787. this.form_add_louceng.school = labels[1]
  1788. this.form_add_louceng.building = labels[0]
  1789. // 显示添加楼层
  1790. this.dialog_add_louceng = true
  1791. setTimeout(() => {
  1792. this.$nextTick(() => {
  1793. this.$refs.ref_louceng.focus()
  1794. })
  1795. }, 500)
  1796. },
  1797. /**
  1798. * 告警状态: 异常
  1799. * @param {Object} index
  1800. * @param {Object} row
  1801. */
  1802. alarm_status_click(index, row) {
  1803. // console.log(index, row);
  1804. this.form_operator_details.name = row.userName
  1805. this.form_operator_details.contact = row.contact
  1806. // 显示操作详情
  1807. this.dialog_operator_details = true
  1808. },
  1809. /**
  1810. * 添加楼栋
  1811. */
  1812. add_loudong(id, label) {
  1813. // console.log(id, label);
  1814. this.form_add_loudong.school = label
  1815. // 显示添加楼栋
  1816. this.dialog_add_loudong = true
  1817. setTimeout(() => {
  1818. this.$nextTick(() => {
  1819. this.$refs.ref_loudong.focus()
  1820. })
  1821. }, 500)
  1822. },
  1823. /**
  1824. * 添加楼栋对话框
  1825. */
  1826. dialog_add_loudong_click() {
  1827. this.$refs["add_loudong_form"].validate(validate => {
  1828. if (validate) {
  1829. // console.log(this.form_add_loudong);
  1830. addBuild(this.form_add_loudong).then((res) => {
  1831. // console.log(res);
  1832. if (typeof res.code == 'undefined' || res.code == '') {
  1833. this.$message.error('返回数据格式问题,code未获取到!')
  1834. return
  1835. }
  1836. if (res.code == 200) {
  1837. this.get_loudong_data()
  1838. this.$message.success('楼栋添加成功!')
  1839. this.dialog_add_loudong = false
  1840. } else {
  1841. this.$message.error(res.message)
  1842. }
  1843. }).catch((err) => {
  1844. // console.log(err);
  1845. this.$message.error(err.message)
  1846. })
  1847. } else {
  1848. this.$message.error('验证不通过')
  1849. return false
  1850. }
  1851. })
  1852. },
  1853. /**
  1854. * 添加楼层对话框
  1855. */
  1856. dialog_add_louceng_click() {
  1857. this.$refs["add_louceng_form"].validate(validate => {
  1858. if (validate) {
  1859. // console.log(this.form_add_louceng);
  1860. addFloors(this.form_add_louceng).then((res) => {
  1861. // console.log(res);
  1862. if (typeof res.code == 'undefined' || res.code == '') {
  1863. this.$message.error('返回数据格式问题,code未获取到!')
  1864. return
  1865. }
  1866. if (res.code == 200) {
  1867. this.get_loudong_data()
  1868. this.$message.success('楼层添加成功!')
  1869. this.dialog_add_louceng = false
  1870. } else {
  1871. this.$message.error(res.message)
  1872. }
  1873. }).catch((err) => {
  1874. // console.log(err);
  1875. this.$message.error(err.message)
  1876. })
  1877. } else {
  1878. this.$message.error('验证不通过')
  1879. return false
  1880. }
  1881. })
  1882. },
  1883. /**
  1884. * 添加房间对话框
  1885. */
  1886. dialog_add_room_click() {
  1887. this.$refs["add_room_form"].validate(validate => {
  1888. if (validate) {
  1889. // console.log(this.form_add_room);
  1890. addRooms(this.form_add_room).then((res) => {
  1891. // console.log(res);
  1892. if (typeof res.code == 'undefined' || res.code == '') {
  1893. this.$message.error('返回数据格式问题,code未获取到!')
  1894. return
  1895. }
  1896. if (res.code == 200) {
  1897. this.get_loudong_data()
  1898. this.$message.success('房间添加成功!')
  1899. this.dialog_add_room = false
  1900. let _this = this
  1901. setTimeout(() => {
  1902. _this.currentData.clickElement.click()
  1903. }, 1000)
  1904. } else {
  1905. this.$message.error(res.message)
  1906. }
  1907. }).catch((err) => {
  1908. // console.log(err);
  1909. this.$message.error(err.message)
  1910. })
  1911. } else {
  1912. this.$message.error('验证不通过')
  1913. return false
  1914. }
  1915. })
  1916. },
  1917. /**
  1918. * 添加空调对话框
  1919. */
  1920. dialog_add_air_click() {
  1921. this.$refs["add_device_form"].validate(validate => {
  1922. if (validate) {
  1923. addAirs(this.form_add_device).then((res) => {
  1924. // console.log(res);
  1925. if (typeof res.code == 'undefined' || res.code == '') {
  1926. this.$message.error('返回数据格式问题,code未获取到!')
  1927. return
  1928. }
  1929. if (res.code == 200) {
  1930. this.get_loudong_data()
  1931. this.$message.success('空调设备添加成功!')
  1932. this.dialog_add_device = false
  1933. let _this = this
  1934. setTimeout(() => {
  1935. _this.currentData.clickElement.click()
  1936. }, 1000)
  1937. setTimeout(() => {
  1938. }, 300)
  1939. } else {
  1940. this.$message.error(res.message)
  1941. }
  1942. }).catch((err) => {
  1943. // console.log(err);
  1944. this.$message.error(err.message)
  1945. })
  1946. } else {
  1947. this.$message.error('验证不通过')
  1948. return false
  1949. }
  1950. })
  1951. },
  1952. /**
  1953. * 刪除空调对话框
  1954. */
  1955. dialog_delete_air_click() {
  1956. let delAir = {
  1957. school: this.currentData.school,
  1958. build: this.currentData.building,
  1959. floors: this.currentData.floor,
  1960. dom: this.delAir.room,
  1961. air_ip: this.delAir.deleteAirIp
  1962. }
  1963. // console.log(delAir);
  1964. deleteAirs(delAir).then((res) => {
  1965. // console.log(res);
  1966. if (typeof res.code == 'undefined' || res.code == '') {
  1967. this.$message.error('返回数据格式问题,code未获取到!')
  1968. return
  1969. }
  1970. if (res.code == 200) {
  1971. this.get_loudong_data()
  1972. this.$message.success('空调 ' + delAir.air_ip + ' 删除成功!')
  1973. this.dialog_delete_air = false
  1974. let _this = this
  1975. setTimeout(() => {
  1976. _this.currentData.clickElement.click()
  1977. }, 1000)
  1978. } else {
  1979. this.$message.error(res.message)
  1980. }
  1981. }).catch((err) => {
  1982. // console.log(err);
  1983. this.$message.error(err.message)
  1984. })
  1985. },
  1986. /**
  1987. * 主题部分按钮的单击事件
  1988. * @param {Object} param
  1989. */
  1990. top_btn_click(param) {
  1991. // console.log(param);
  1992. this.btnActive = param;
  1993. if (param == 'all') {
  1994. this.currentData.clickElement.click();
  1995. } else if (param == 'powerOn') {
  1996. this.currentData.clickElement.click();
  1997. } else if (param == 'powerOff') {
  1998. this.currentData.clickElement.click();
  1999. } else if (param == 'abnormal') {
  2000. this.currentData.clickElement.click();
  2001. } else {
  2002. this.$message.error('点击按钮出错!');
  2003. }
  2004. },
  2005. /**
  2006. * 添加空调设备
  2007. * @param {Object} room
  2008. */
  2009. add_device(room) {
  2010. // this.$message.success(room);
  2011. this.currentData.addDevice = room;
  2012. // 填充数据
  2013. this.form_add_device.school = this.currentData.school;
  2014. this.form_add_device.build = this.currentData.building;
  2015. this.form_add_device.floors = this.currentData.floor;
  2016. this.form_add_device.room = room;
  2017. // 显示对话框
  2018. this.dialog_add_device = true;
  2019. setTimeout(() => {
  2020. this.$nextTick(() => {
  2021. this.$refs.ref_deviceName.focus();
  2022. });
  2023. }, 500);
  2024. },
  2025. /**
  2026. * 操作编辑修改房间
  2027. * @param {Object} room
  2028. */
  2029. operate_modify_room(room) {
  2030. let tmpData = this.currentData.title_any_where.split('-');
  2031. this.form_modify_room.school = tmpData[0]
  2032. this.form_modify_room.building = tmpData[1]
  2033. this.form_modify_room.floor = tmpData[2]
  2034. this.form_modify_room.room = room.split('-')[1]
  2035. this.show_modify_room = room
  2036. this.dialog_modify_room = true
  2037. setTimeout(() => {
  2038. this.$nextTick(() => {
  2039. this.$refs.ref_modi_room.focus()
  2040. })
  2041. }, 500)
  2042. },
  2043. /**
  2044. * 操作删除房间
  2045. */
  2046. operate_delete_room(room) {
  2047. this.show_delete_room = room
  2048. this.dialog_delete_room = true
  2049. },
  2050. /**
  2051. * 操作删除空调
  2052. * @param {Object} index
  2053. * @param {Object} row
  2054. */
  2055. operate_delete_air(index, row, room) {
  2056. // console.log(index, row, row.ip, room);
  2057. this.delAir.deleteAirIp = row.ip
  2058. this.delAir.room = room
  2059. this.dialog_delete_air = true
  2060. },
  2061. /**
  2062. * 对话框关闭时清理数据
  2063. */
  2064. dialog_close(param) {
  2065. if (param == 'form_add_loudong') {
  2066. this.form_add_loudong = {
  2067. school: '',
  2068. building: ''
  2069. }
  2070. }
  2071. if (param == 'form_add_louceng') {
  2072. this.form_add_louceng = {
  2073. school: '',
  2074. building: '',
  2075. floor: ''
  2076. }
  2077. }
  2078. if (param == 'form_add_room') {
  2079. this.form_add_room = {
  2080. school: '',
  2081. building: '',
  2082. floor: '',
  2083. room: ''
  2084. }
  2085. }
  2086. if (param == 'form_modify_room') {
  2087. this.form_modify_room = {
  2088. school: '',
  2089. building: '',
  2090. floor: '',
  2091. room: ''
  2092. }
  2093. }
  2094. if (param == 'form_add_device') {
  2095. var tmpdevices = this.form_add_device.devices;
  2096. this.form_add_device = {
  2097. cao: this.$store.state.user.name, // 操作员
  2098. contact: this.$store.state.user.phone, // 操作员手机号
  2099. school: '',
  2100. build: '',
  2101. floors: '',
  2102. room: '',
  2103. deviceName: '',
  2104. deviceIp: '',
  2105. checkedDevice: [],
  2106. devices: tmpdevices,
  2107. duration_use: 0.00, // 使用时长
  2108. is_normal: '0', // 是否正常
  2109. is_on: '0', // 是否开启
  2110. }
  2111. }
  2112. if (param == 'form_operator_details') {
  2113. this.form_operator_details = {
  2114. name: '',
  2115. contact: ''
  2116. }
  2117. }
  2118. },
  2119. /**
  2120. * currentPage 改变时会触发
  2121. * @param {Object} val
  2122. */
  2123. currentPageChange(val) {
  2124. this.listLoading = true;
  2125. // console.log('当前页:' + val);
  2126. // 清理一下当前数据中的rooms
  2127. this.currentData.rooms = [{
  2128. room: '',
  2129. tableData: []
  2130. }, {
  2131. room: '',
  2132. tableData: []
  2133. }, {
  2134. room: '',
  2135. tableData: []
  2136. }, {
  2137. room: '',
  2138. tableData: []
  2139. }];
  2140. this.pagination.currentPage = val;
  2141. this.roomDataPagination(this.pagination.currentPage, this.pagination.pageSize, this.currentData
  2142. .allRooms,
  2143. this.currentData.school, this.currentData.building, this.currentData.floor);
  2144. this.listLoading = false;
  2145. },
  2146. /**
  2147. * 设置表格单元格样式
  2148. */
  2149. setCellStyle() {
  2150. return `
  2151. color: #53575A;
  2152. font-size: 14px;
  2153. font-family: Microsoft YaHei-3970(82674968);
  2154. background-color: #ECF1F8;
  2155. border-bottom: 1px solid #DBE0E7;
  2156. `
  2157. },
  2158. /**
  2159. * 设置表格头部单元格样式
  2160. */
  2161. setHeaderSellStyle({
  2162. row,
  2163. column,
  2164. rowIndex,
  2165. columnIndex
  2166. }) {
  2167. if (columnIndex === 0) {
  2168. return `
  2169. background: #FFFFFF;
  2170. color: #53575A;
  2171. font-size: 14px;
  2172. font-family: Microsoft YaHei-3970(82674968);
  2173. border-radius: 6px 0 0 6px;
  2174. `
  2175. } else if (columnIndex === 6) {
  2176. return `
  2177. background: #FFFFFF;
  2178. color: #53575A;
  2179. font-size: 14px;
  2180. font-family: Microsoft YaHei-3970(82674968);
  2181. border-radius: 0 6px 6px 0;
  2182. `
  2183. } else {
  2184. return `
  2185. background: #FFFFFF;
  2186. color: #53575A;
  2187. font-size: 14px;
  2188. font-family: Microsoft YaHei-3970(82674968);
  2189. `
  2190. }
  2191. }
  2192. },
  2193. }
  2194. </script>
  2195. <style scoped lang="scss">
  2196. .app-container {
  2197. background-color: #EFF2F7;
  2198. padding: 10px;
  2199. .el-row {
  2200. .nav-class {
  2201. .nav-box {
  2202. height: 788px;
  2203. overflow-x: hidden;
  2204. overflow-y: scroll;
  2205. }
  2206. .nav-box::-webkit-scrollbar {
  2207. display: none;
  2208. }
  2209. }
  2210. .el-col {
  2211. .nav-box {
  2212. margin: 10px 5px 0 10px;
  2213. padding: 20px 0;
  2214. border-radius: 10px;
  2215. background-color: #FFFFFF;
  2216. font-size: 18px;
  2217. // box-shadow: 5px 5px 15px #979797;
  2218. box-shadow: 0px 3px 21px 0px rgba(60, 108, 254, 0.16);
  2219. .item-school {
  2220. margin-top: 0px;
  2221. .school {
  2222. display: flex;
  2223. justify-content: space-between;
  2224. align-items: center;
  2225. padding: 10px;
  2226. background: #2B4CFE;
  2227. font-family: Microsoft YaHei-3970(82674968);
  2228. font-weight: bold;
  2229. color: #EDF0F5;
  2230. cursor: pointer;
  2231. white-space: nowrap;
  2232. }
  2233. .item-loudong {
  2234. display: flex;
  2235. flex-direction: column;
  2236. padding: 10px 0 0 0;
  2237. .loudong {
  2238. display: flex;
  2239. justify-content: space-between;
  2240. align-items: center;
  2241. padding: 10px 10px 10px 20px;
  2242. background: #EDF0F5;
  2243. font-family: Microsoft YaHei-3970(82674968);
  2244. font-weight: bold;
  2245. color: #2B4CFE;
  2246. cursor: pointer;
  2247. .louidong_text {
  2248. white-space: nowrap;
  2249. width: 260px;
  2250. overflow: hidden;
  2251. text-overflow: ellipsis;
  2252. }
  2253. }
  2254. .item-louceng {
  2255. display: flex;
  2256. // flex-direction: column;
  2257. justify-content: space-around;
  2258. margin-left: 40px;
  2259. .louceng {
  2260. display: flex;
  2261. align-items: center;
  2262. // justify-content: space-between;
  2263. padding: 10px;
  2264. height: 30px;
  2265. width: 80%;
  2266. font-size: 18px;
  2267. cursor: pointer;
  2268. }
  2269. .louceng:hover {
  2270. background-color: #0099FF;
  2271. color: #FFFFFF;
  2272. }
  2273. .louceng-clicked {
  2274. font-size: 20px;
  2275. font-weight: bold;
  2276. background-color: #0066FF;
  2277. color: #FFFFFF;
  2278. }
  2279. .louceng-del {
  2280. display: flex;
  2281. align-items: center;
  2282. padding: 10px;
  2283. height: 30px;
  2284. font-size: 18px;
  2285. cursor: pointer;
  2286. }
  2287. .louceng-del:hover {
  2288. background-color: #ff4e51;
  2289. color: #FFFFFF;
  2290. }
  2291. }
  2292. .loudong-add-louceng {
  2293. display: flex;
  2294. align-items: center;
  2295. padding: 10px 0 10px 30px;
  2296. cursor: pointer;
  2297. .loudong-add-louceng-txt {
  2298. margin-left: 5px;
  2299. }
  2300. }
  2301. .loudong-add-louceng:hover {
  2302. background-color: #CCCCCC;
  2303. }
  2304. }
  2305. }
  2306. .item-school .item-loudong:nth-child(2) {
  2307. padding: 0;
  2308. }
  2309. .add-loudong {
  2310. display: flex;
  2311. align-items: center;
  2312. padding: 10px 0 10px 20px;
  2313. cursor: pointer;
  2314. .add-loudong-txt {
  2315. margin-left: 5px;
  2316. }
  2317. }
  2318. .add-loudong:hover {
  2319. background-color: #CCCCCC;
  2320. }
  2321. }
  2322. .cell {
  2323. margin: 10px 10px 10px 0;
  2324. padding: 20px;
  2325. border-radius: 10px;
  2326. background-color: #FFFFFF;
  2327. // box-shadow: 5px 5px 15px #979797;
  2328. box-shadow: 0px 3px 21px 0px rgba(60, 108, 254, 0.16);
  2329. .cell-title {
  2330. display: flex;
  2331. justify-content: space-between;
  2332. align-items: center;
  2333. margin-bottom: 20px;
  2334. padding-bottom: 18px;
  2335. border-bottom: 1px solid #CCCCCC;
  2336. .title-left {
  2337. width: 88%;
  2338. display: flex;
  2339. justify-content: space-between;
  2340. align-items: center;
  2341. white-space: nowrap;
  2342. .title {
  2343. font-size: 22px;
  2344. font-family: Microsoft YaHei-3970(82674968);
  2345. font-weight: bold;
  2346. color: #1A202B;
  2347. }
  2348. .title-detail {
  2349. margin-left: 16px;
  2350. font-size: 18px;
  2351. font-family: Microsoft YaHei-3970(82674968);
  2352. color: #1A202B;
  2353. }
  2354. }
  2355. .title-right {
  2356. display: flex;
  2357. justify-content: space-between;
  2358. align-items: center;
  2359. .el-button {
  2360. width: 110px;
  2361. height: 46px;
  2362. background: #2B4CFE;
  2363. font-size: 18px;
  2364. color: #FFFFFF;
  2365. font-family: Microsoft YaHei-3970(82674968);
  2366. border-radius: 5px;
  2367. }
  2368. .el-button--warning {
  2369. background: #F88A64;
  2370. }
  2371. }
  2372. }
  2373. .cell-body {
  2374. .cell-body-top-btns {
  2375. display: flex;
  2376. align-items: center;
  2377. margin-bottom: 20px;
  2378. .btn-active {
  2379. display: flex;
  2380. justify-content: center;
  2381. align-items: center;
  2382. width: 66px;
  2383. height: 36px;
  2384. border-radius: 18px;
  2385. font-size: 18px;
  2386. font-family: Microsoft YaHei-3970(82674968);
  2387. background: #2B4CFE;
  2388. color: #FEFEFE;
  2389. margin-right: 10px;
  2390. }
  2391. .btn-no-active {
  2392. display: flex;
  2393. justify-content: center;
  2394. align-items: center;
  2395. width: 66px;
  2396. height: 36px;
  2397. border: none;
  2398. font-size: 18px;
  2399. font-family: Microsoft YaHei-3970(82674968);
  2400. background: none;
  2401. color: #53575A;
  2402. margin-right: 10px;
  2403. }
  2404. }
  2405. .el-row {
  2406. height: 286px;
  2407. .el-col {
  2408. .panel-left,
  2409. .panel-right {
  2410. background: #ECF1F8;
  2411. border-radius: 10px;
  2412. margin: 0 0 10px 0;
  2413. }
  2414. .panel-left,
  2415. .panel-right {
  2416. .panel-header {
  2417. display: flex;
  2418. justify-content: space-between;
  2419. align-items: center;
  2420. padding: 5px 20px;
  2421. margin-bottom: 10px;
  2422. border-bottom: 1px solid #D9D9D9;
  2423. .panel-title-caption {
  2424. display: flex;
  2425. justify-content: space-between;
  2426. align-items: center;
  2427. .panel-title-icon {
  2428. color: #2B4CFE;
  2429. font-size: 20px;
  2430. margin-right: 8px;
  2431. }
  2432. .panel-title {
  2433. font-size: 20px;
  2434. }
  2435. }
  2436. .panel-title-btns {
  2437. .panel-title-btn {
  2438. margin-left: 20px;
  2439. font-size: 16px;
  2440. font-family: Microsoft YaHei-3970(82674968);
  2441. color: #2B4CFE;
  2442. }
  2443. }
  2444. }
  2445. .panel-body {
  2446. /*将表格每一行的背景色去掉*/
  2447. .el-table,
  2448. .el-table__expanded-cell,
  2449. .el-table tr {
  2450. background-color: transparent;
  2451. }
  2452. ::v-deep .el-table td,
  2453. ::v-deep .el-table th {
  2454. padding: 6px 0;
  2455. }
  2456. .el-table {
  2457. margin: 0 3px;
  2458. width: calc(100% - 6px);
  2459. .txt-cell-blue,
  2460. .btn-cell-blue {
  2461. color: #2B4CFE;
  2462. border: none;
  2463. font-size: 14px;
  2464. cursor: pointer;
  2465. }
  2466. .btn-cell-blue {
  2467. border: 1px solid #2B4CFE;
  2468. }
  2469. .power-icon-on {
  2470. font-size: 22px;
  2471. cursor: pointer;
  2472. color: #00ff00;
  2473. }
  2474. .power-icon-off {
  2475. font-size: 22px;
  2476. cursor: pointer;
  2477. color: #ff0000;
  2478. }
  2479. .power-icon-off:focus,
  2480. .power-icon-on:focus {
  2481. outline: none;
  2482. }
  2483. }
  2484. }
  2485. .panel-footer {
  2486. display: flex;
  2487. align-items: center;
  2488. padding: 10px 30px 15px 25px;
  2489. color: #2B4CFE;
  2490. cursor: pointer;
  2491. .panel-footer-txt {
  2492. margin-left: 5px;
  2493. }
  2494. }
  2495. }
  2496. .panel-right {
  2497. margin-right: 0px;
  2498. margin-left: 10px;
  2499. }
  2500. }
  2501. }
  2502. .pagination-table {
  2503. display: flex;
  2504. justify-content: flex-end;
  2505. align-items: center;
  2506. height: 30px;
  2507. margin-top: 5px;
  2508. padding-right: 100px;
  2509. ::v-deep .el-pagination {
  2510. display: flex;
  2511. justify-content: flex-end;
  2512. align-items: center;
  2513. }
  2514. ::v-deep .el-pagination ul {
  2515. display: flex;
  2516. }
  2517. ::v-deep .el-pagination button,
  2518. ::v-deep .el-pagination li {
  2519. display: flex;
  2520. justify-content: center;
  2521. align-items: center;
  2522. width: 50px;
  2523. height: 36px;
  2524. border: 1px solid #626262;
  2525. border-radius: 3px;
  2526. font-size: 14px;
  2527. margin: 0 5px;
  2528. }
  2529. ::v-deep .el-pagination span {
  2530. margin-left: 10px;
  2531. }
  2532. ::v-deep .el-pagination .el-pagination__jump {
  2533. font-size: 16px;
  2534. }
  2535. ::v-deep .el-pagination .el-pagination__editor {
  2536. width: 50px;
  2537. height: 36px;
  2538. margin: 0 5px;
  2539. }
  2540. ::v-deep .el-pagination .el-input__inner {
  2541. width: 50px;
  2542. height: 36px;
  2543. border: 1px solid #626262;
  2544. margin: -4px 0 0 0;
  2545. }
  2546. }
  2547. }
  2548. }
  2549. }
  2550. }
  2551. ::v-deep .el-dialog {
  2552. margin: 0 !important;
  2553. width: 400px;
  2554. height: 320px;
  2555. background: #FFFFFF;
  2556. box-shadow: 0px 0px 13px 0px rgba(0, 0, 0, 0.29);
  2557. border-radius: 10px;
  2558. position: absolute;
  2559. top: 50%;
  2560. left: 50%;
  2561. transform: translate(-50%, -50%);
  2562. .el-dialog__header {
  2563. display: flex;
  2564. align-items: center;
  2565. width: 100%;
  2566. height: 58px;
  2567. padding: 30px;
  2568. background: #E6EBFE;
  2569. border-radius: 10px 10px 0px 0px;
  2570. font-weight: bold;
  2571. }
  2572. .el-dialog__body {
  2573. padding-bottom: 0;
  2574. .el-form-item {
  2575. .el-form-item__label,
  2576. .el-form-item__content {
  2577. font-size: 16px;
  2578. font-family: Microsoft YaHei-3970(82674968);
  2579. color: #53575A;
  2580. }
  2581. .el-input__inner {
  2582. width: 180px;
  2583. }
  2584. }
  2585. // 删除对话框的样式
  2586. .del-air-body {
  2587. display: flex;
  2588. flex-direction: column;
  2589. justify-content: center;
  2590. align-items: center;
  2591. height: 180px;
  2592. img {
  2593. width: 72px;
  2594. }
  2595. .del-air-body-txt {
  2596. height: 58px;
  2597. line-height: 58px;
  2598. font-size: 18px;
  2599. font-family: Microsoft YaHei-3970(82674968);
  2600. color: #333333;
  2601. white-space: nowrap;
  2602. }
  2603. }
  2604. }
  2605. .el-dialog__footer {
  2606. padding-bottom: 0 !important;
  2607. text-align: center;
  2608. .el-button.el-button--default {
  2609. width: 75px;
  2610. height: 40px;
  2611. border: 1px solid #2B4CFE;
  2612. border-radius: 6px;
  2613. font-size: 16px;
  2614. font-family: Microsoft YaHei-3970(82674968);
  2615. color: #2B4CFE;
  2616. }
  2617. .el-button.el-button--primary {
  2618. width: 75px;
  2619. height: 40px;
  2620. background: #2B4CFE;
  2621. border-radius: 6px;
  2622. font-size: 16px;
  2623. font-family: Microsoft YaHei-3970(82674968);
  2624. color: #FFFFFF;
  2625. margin-left: 60px;
  2626. }
  2627. }
  2628. }
  2629. }
  2630. </style>
  2631. <style>
  2632. .el-dialog-add-loudong {
  2633. height: 300px !important;
  2634. }
  2635. .el-dialog-add-room {
  2636. height: 420px !important;
  2637. }
  2638. .el-dialog-modify-room {
  2639. height: 420px !important;
  2640. }
  2641. .el-dialog-add-louceng {
  2642. height: 360px !important;
  2643. }
  2644. .el-dialog-operator_details {
  2645. height: 300px !important;
  2646. }
  2647. .el-dialog-delete-room {
  2648. height: fit-content !important;
  2649. width: fit-content !important;
  2650. }
  2651. .el-dialog-add-device {
  2652. height: fit-content !important;
  2653. width: fit-content !important;
  2654. }
  2655. .el-dialog-delete-air {
  2656. height: fit-content !important;
  2657. width: fit-content !important;
  2658. }
  2659. .dialog-footer {
  2660. height: 68px !important;
  2661. }
  2662. .el-dialog-delete-room .el-dialog__header,
  2663. .el-dialog-delete-air .el-dialog__header {
  2664. display: none !important;
  2665. }
  2666. </style>