| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655 |
- <template>
- <div class="app-container">
- <el-row>
- <el-col :span="4" class="nav-class" v-loading="navLoading">
- <div class="nav-box">
- <div class="item-school" v-for="(item0, index0) in navData" :key="index0">
- <div class="school" @click="school_toggle(item0.id, item0.label)">
- <div>{{item0.label}}</div>
- <i v-if="item0.isShow" class="el-icon-arrow-down"></i>
- <i v-else class="el-icon-arrow-right"></i>
- </div>
- <div class="item-loudong" v-for="(item1, index1) in item0.children" :key="index1" :style="{display: item0.isShow ? '' : 'none'}">
- <div class="loudong" @click="loudong_toggle(item1.id + '|' + item0.id, item1.label + '|'+ item0.label)">
- <div class="louidong_text" :title="item1.label">{{item1.label}}</div>
- <i v-if="item1.isShow" class="el-icon-arrow-down"></i>
- <i v-else class="el-icon-arrow-right"></i>
- </div>
- <div class="item-louceng" v-for="(item2, index2) in item1.children" :key="index2" :style="{display: item1.isShow ? '' : 'none'}">
- <div :id="`louceng${index0}${index1}${index2}`" class="louceng" :class="louceng_click_id == item2.id ? 'louceng-clicked' : '' "
- @click="louceng_click($event, item2.id + '|' + item1.id + '|' + item0.id, item2.label + '|' + item1.label + '|'+ item0.label, item2.rooms)">
- {{item2.label}}
- </div>
- </div>
- <div class="loudong-add-louceng" :style="{display: item1.isShow ? '' : 'none'}"
- @click="add_louceng(item1.id + '|' + item0.id, item1.label + '|'+ item0.label)">
- <i class="el-icon-circle-plus-outline"></i>
- <div class="loudong-add-louceng-txt">添加楼层</div>
- </div>
- </div>
- <div class="add-loudong" @click="add_loudong(item0.id, item0.label)" :style="{display: item0.isShow ? '' : 'none'}">
- <i class="el-icon-circle-plus-outline"></i>
- <div class="add-loudong-txt">添加楼栋</div>
- </div>
- </div>
- </div>
- </el-col>
- <el-col :span="20">
- <div class="cell">
- <div class="cell-title">
- <div class="title-left">
- <div class="title">{{currentData.title_any_where}} 空调管理</div>
- <div class="title-detail">房间:{{room_number}}间</div>
- <div class="title-detail">设备:{{device_number}}台</div>
- <div class="title-detail">离线:{{offline_device_number}}台</div>
- <div class="title-detail">关机:{{shutdown_device_number}}台</div>
- <div class="title-detail">已开:{{open_number}}台</div>
- <div class="title-detail">预警:{{warning_number}}台</div>
- </div>
- <div class="title-right">
- <el-button type="primary" @click="add_room">新增房间</el-button>
- </div>
- </div>
- <div class="cell-body" v-loading="listLoading">
- <div class="cell-body-top-btns">
- <el-button :class="btnActive == 'all' ? 'btn-active':'btn-no-active'" type="primary" size="medium" round
- @click="top_btn_click('all')">全部</el-button>
- <el-button :class="btnActive == 'powerOn' ? 'btn-active':'btn-no-active'" type="primary" size="medium" round
- @click="top_btn_click('powerOn')">开机</el-button>
- <el-button :class="btnActive == 'powerOff' ? 'btn-active':'btn-no-active'" type="primary" size="medium" round
- @click="top_btn_click('powerOff')">关机</el-button>
- <el-button :class="btnActive == 'abnormal' ? 'btn-active':'btn-no-active'" type="primary" size="medium" round
- @click="top_btn_click('abnormal')">离线</el-button>
- </div>
- <el-row>
- <el-col :span="12">
- <div class="panel-left" :style="{display: currentData.rooms[0].room == '' ? 'none' : ''}">
- <div class="panel-header">
- <div class="panel-title-caption">
- <svg-icon icon-class="panel-home" class="panel-title-icon" />
- <div class="panel-title">{{currentData.rooms[0].room}}</div>
- </div>
- <div class="panel-title-btns">
- <el-button class="panel-title-btn" type="text" icon="el-icon-edit-outline"
- @click="operate_modify_room(currentData.rooms[0].room)">编辑</el-button>
- <el-button class="panel-title-btn" type="text" icon="el-icon-delete"
- @click="operate_delete_room(currentData.rooms[0].room)">删除
- </el-button>
- </div>
- </div>
- <div class="panel-body">
- <el-table :data="currentData.rooms[0].tableData" height="170" v-loading="airsLoading[0].loading"
- :element-loading-text="airsLoading[0].text" element-loading-spinner="el-icon-loading" :cell-style="setCellStyle"
- element-loading-background="rgba(0, 0, 0, 0.8)" :header-cell-style="setHeaderSellStyle">
- <el-table-column label="名称" align="center" width="140">
- <template slot-scope="scope">
- <span>{{ scope.row.name }}</span>
- </template>
- </el-table-column>
- <el-table-column label="ID" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.ip }}</span>
- </template>
- </el-table-column>
- <el-table-column label="类型" align="center" width="85">
- <template slot-scope="scope">
- <span>{{ scope.row.device }}</span>
- </template>
- </el-table-column>
- <el-table-column label="使用时长" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.userTime }}</span>
- </template>
- </el-table-column>
- <el-table-column label="告警状态" align="center">
- <template slot-scope="scope">
- <span v-if="scope.row.alarmStatus == '正常'">{{ scope.row.alarmStatus }}</span>
- <span v-else @click="alarm_status_click(scope.$index, scope.row)"
- class="txt-cell-blue">{{ scope.row.alarmStatus }}</span>
- </template>
- </el-table-column>
- <el-table-column label="开关状态" align="center">
- <template slot-scope="scope">
- <span v-if="scope.row.onOffStatus == 0" title="已关机"
- @click="open_close_airs(0, scope.$index, scope.row, 'open')">
- <svg-icon icon-class="power" class="power-icon-off" />
- </span>
- <span v-else class="txt-cell-blue" title="已开机"
- @click="open_close_airs(0, scope.$index, scope.row, 'close')">
- <svg-icon icon-class="power" class="power-icon-on" />
- </span>
- </template>
- </el-table-column>
- <el-table-column label="操作" align="center">
- <template slot-scope="scope">
- <el-button class="btn-cell-blue" size="mini" round
- @click="operate_delete_air(scope.$index, scope.row, currentData.rooms[0].room)">
- 删除
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <div class="panel-footer" @click="">
- <i class="el-icon-circle-plus-outline"></i>
- <div class="panel-footer-txt" @click="add_device(currentData.rooms[0].room)">
- 添加设备</div>
- </div>
- </div>
- </el-col>
- <el-col :span="12">
- <div class="panel-right" :style="{display: currentData.rooms[1].room == '' ? 'none' : ''}">
- <div class="panel-header">
- <div class="panel-title-caption">
- <svg-icon icon-class="panel-home" class="panel-title-icon" />
- <div class="panel-title">{{currentData.rooms[1].room}}</div>
- </div>
- <div class="panel-title-btns">
- <el-button class="panel-title-btn" type="text" icon="el-icon-edit-outline"
- @click="operate_modify_room(currentData.rooms[1].room)">编辑</el-button>
- <el-button class="panel-title-btn" type="text" icon="el-icon-delete"
- @click="operate_delete_room(currentData.rooms[1].room)">删除
- </el-button>
- </div>
- </div>
- <div class="panel-body">
- <el-table :data="currentData.rooms[1].tableData" height="170" v-loading="airsLoading[1].loading"
- :element-loading-text="airsLoading[1].text" element-loading-spinner="el-icon-loading"
- element-loading-background="rgba(0, 0, 0, 0.8)" :cell-style="setCellStyle" :header-cell-style="setHeaderSellStyle">
- <el-table-column label="名称" align="center" width="140">
- <template slot-scope="scope">
- <span>{{ scope.row.name }}</span>
- </template>
- </el-table-column>
- <el-table-column label="ID" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.ip }}</span>
- </template>
- </el-table-column>
- <el-table-column label="类型" align="center" width="85">
- <template slot-scope="scope">
- <span>{{ scope.row.device }}</span>
- </template>
- </el-table-column>
- <el-table-column label="使用时长" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.userTime }}</span>
- </template>
- </el-table-column>
- <el-table-column label="告警状态" align="center">
- <template slot-scope="scope">
- <span v-if="scope.row.alarmStatus == '正常'">{{ scope.row.alarmStatus }}</span>
- <span v-else @click="alarm_status_click(scope.$index, scope.row)"
- class="txt-cell-blue">{{ scope.row.alarmStatus }}</span>
- </template>
- </el-table-column>
- <el-table-column label="开关状态" align="center">
- <template slot-scope="scope">
- <span v-if="scope.row.onOffStatus == 0" title="已关机"
- @click="open_close_airs(1, scope.$index, scope.row, 'open')">
- <svg-icon icon-class="power" class="power-icon-off" />
- </span>
- <span v-else class="txt-cell-blue" title="已开机"
- @click="open_close_airs(1, scope.$index, scope.row, 'close')">
- <svg-icon icon-class="power" class="power-icon-on" />
- </span>
- </template>
- </el-table-column>
- <el-table-column label="操作" align="center">
- <template slot-scope="scope">
- <el-button class="btn-cell-blue" size="mini" round
- @click="operate_delete_air(scope.$index, scope.row, currentData.rooms[1].room)">
- 删除
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <div class="panel-footer" @click="">
- <i class="el-icon-circle-plus-outline"></i>
- <div class="panel-footer-txt" @click="add_device(currentData.rooms[1].room)">
- 添加设备</div>
- </div>
- </div>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="12">
- <div class="panel-left" :style="{display: currentData.rooms[2].room == '' ? 'none' : ''}">
- <div class="panel-header">
- <div class="panel-title-caption">
- <svg-icon icon-class="panel-home" class="panel-title-icon" />
- <div class="panel-title">{{currentData.rooms[2].room}}</div>
- </div>
- <div class="panel-title-btns">
- <el-button class="panel-title-btn" type="text" icon="el-icon-edit-outline"
- @click="operate_modify_room(currentData.rooms[2].room)">编辑</el-button>
- <el-button class="panel-title-btn" type="text" icon="el-icon-delete"
- @click="operate_delete_room(currentData.rooms[2].room)">删除
- </el-button>
- </div>
- </div>
- <div class="panel-body">
- <el-table :data="currentData.rooms[2].tableData" height="170" v-loading="airsLoading[2].loading"
- :element-loading-text="airsLoading[2].text" element-loading-spinner="el-icon-loading"
- element-loading-background="rgba(0, 0, 0, 0.8)" :cell-style="setCellStyle" :header-cell-style="setHeaderSellStyle">
- <el-table-column label="名称" align="center" width="140">
- <template slot-scope="scope">
- <span>{{ scope.row.name }}</span>
- </template>
- </el-table-column>
- <el-table-column label="ID" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.ip }}</span>
- </template>
- </el-table-column>
- <el-table-column label="类型" align="center" width="85">
- <template slot-scope="scope">
- <span>{{ scope.row.device }}</span>
- </template>
- </el-table-column>
- <el-table-column label="使用时长" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.userTime }}</span>
- </template>
- </el-table-column>
- <el-table-column label="告警状态" align="center">
- <template slot-scope="scope">
- <span v-if="scope.row.alarmStatus == '正常'">{{ scope.row.alarmStatus }}</span>
- <span v-else @click="alarm_status_click(scope.$index, scope.row)"
- class="txt-cell-blue">{{ scope.row.alarmStatus }}</span>
- </template>
- </el-table-column>
- <el-table-column label="开关状态" align="center">
- <template slot-scope="scope">
- <span v-if="scope.row.onOffStatus == 0" title="已关机"
- @click="open_close_airs(2, scope.$index, scope.row, 'open')">
- <svg-icon icon-class="power" class="power-icon-off" />
- </span>
- <span v-else class="txt-cell-blue" title="已开机"
- @click="open_close_airs(2, scope.$index, scope.row, 'close')">
- <svg-icon icon-class="power" class="power-icon-on" />
- </span>
- </template>
- </el-table-column>
- <el-table-column label="操作" align="center">
- <template slot-scope="scope">
- <el-button class="btn-cell-blue" size="mini" round
- @click="operate_delete_air(scope.$index, scope.row, currentData.rooms[2].room)">
- 删除
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <div class="panel-footer" @click="">
- <i class="el-icon-circle-plus-outline"></i>
- <div class="panel-footer-txt" @click="add_device(currentData.rooms[2].room)">
- 添加设备</div>
- </div>
- </div>
- </el-col>
- <el-col :span="12">
- <div class="panel-right" :style="{display: currentData.rooms[3].room == '' ? 'none' : ''}">
- <div class="panel-header">
- <div class="panel-title-caption">
- <svg-icon icon-class="panel-home" class="panel-title-icon" />
- <div class="panel-title">{{currentData.rooms[3].room}}</div>
- </div>
- <div class="panel-title-btns">
- <el-button class="panel-title-btn" type="text" icon="el-icon-edit-outline"
- @click="operate_modify_room(currentData.rooms[3].room)">编辑</el-button>
- <el-button class="panel-title-btn" type="text" icon="el-icon-delete"
- @click="operate_delete_room(currentData.rooms[3].room)">删除
- </el-button>
- </div>
- </div>
- <div class="panel-body">
- <el-table :data="currentData.rooms[3].tableData" height="170" v-loading="airsLoading[3].loading"
- :element-loading-text="airsLoading[3].text" element-loading-spinner="el-icon-loading"
- element-loading-background="rgba(0, 0, 0, 0.8)" :cell-style="setCellStyle" :header-cell-style="setHeaderSellStyle">
- <el-table-column label="名称" align="center" width="140">
- <template slot-scope="scope">
- <span>{{ scope.row.name }}</span>
- </template>
- </el-table-column>
- <el-table-column label="ID" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.ip }}</span>
- </template>
- </el-table-column>
- <el-table-column label="类型" align="center" width="85">
- <template slot-scope="scope">
- <span>{{ scope.row.device }}</span>
- </template>
- </el-table-column>
- <el-table-column label="使用时长" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.userTime }}</span>
- </template>
- </el-table-column>
- <el-table-column label="告警状态" align="center">
- <template slot-scope="scope">
- <span v-if="scope.row.alarmStatus == '正常'">{{ scope.row.alarmStatus }}</span>
- <span v-else @click="alarm_status_click(scope.$index, scope.row)"
- class="txt-cell-blue">{{ scope.row.alarmStatus }}</span>
- </template>
- </el-table-column>
- <el-table-column label="开关状态" align="center">
- <template slot-scope="scope">
- <span v-if="scope.row.onOffStatus == 0" title="已关机"
- @click="open_close_airs(3, scope.$index, scope.row, 'open')">
- <svg-icon icon-class="power" class="power-icon-off" />
- </span>
- <span v-else class="txt-cell-blue" title="已开机"
- @click="open_close_airs(3, scope.$index, scope.row, 'close')">
- <svg-icon icon-class="power" class="power-icon-on" />
- </span>
- </template>
- </el-table-column>
- <el-table-column label="操作" align="center">
- <template slot-scope="scope">
- <el-button class="btn-cell-blue" size="mini" round
- @click="operate_delete_air(scope.$index, scope.row, currentData.rooms[3].room)">
- 删除
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <div class="panel-footer" @click="">
- <i class="el-icon-circle-plus-outline"></i>
- <div class="panel-footer-txt" @click="add_device(currentData.rooms[3].room)">
- 添加设备</div>
- </div>
- </div>
- </el-col>
- </el-row>
- <div class="pagination-table">
- <el-pagination @current-change="currentPageChange" :hide-on-single-page="hideOnSinglePage"
- :current-page.sync="pagination.currentPage" :page-size="pagination.pageSize" layout="prev, pager, next, jumper"
- :total="pagination.total">
- </el-pagination>
- </div>
- </div>
- </div>
- </el-col>
- </el-row>
- <!-- 添加楼栋 -->
- <el-dialog title="添加楼栋" custom-class="el-dialog-add-loudong" :visible.sync="dialog_add_loudong" :close-on-click-modal="false"
- :close-on-press-escape="false" @close="dialog_close('form_add_loudong')">
- <!-- <el-form :model="form_add_loudong" ref="add_loudong_form" :rules="form_add_loudong_rules"> -->
- <el-form :model="form_add_loudong" ref="add_loudong_form">
- <el-form-item label="校区:" :label-width="formLabelWidth">
- <span>{{form_add_loudong.school}}</span>
- </el-form-item>
- <el-form-item label="楼栋:" :label-width="formLabelWidth" prop="building" :required="true">
- <el-input v-model="form_add_loudong.building" autocomplete="off" placeholder="请输入楼栋名称" ref="ref_loudong" maxlength="15"></el-input>
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button @click="dialog_add_loudong = false">取 消</el-button>
- <el-button type="primary" @click="dialog_add_loudong_click">确 定</el-button>
- </div>
- </el-dialog>
- <!-- 添加楼层 -->
- <el-dialog title="添加楼层" custom-class="el-dialog-add-louceng" :visible.sync="dialog_add_louceng" :close-on-click-modal="false"
- :close-on-press-escape="false" @close="dialog_close('form_add_louceng')">
- <el-form :model="form_add_louceng" ref="add_louceng_form" :rules="form_add_louceng_rules">
- <el-form-item label="校区:" :label-width="formLabelWidth">
- <div>{{form_add_louceng.school}}</div>
- </el-form-item>
- <el-form-item label="楼栋:" :label-width="formLabelWidth">
- <div>{{form_add_louceng.building}}</div>
- </el-form-item>
- <el-form-item label="楼层:" :label-width="formLabelWidth" prop="floor" :required="true">
- <el-input v-model="form_add_louceng.floor" autocomplete="off" placeholder="请输入楼层号" ref="ref_louceng" maxlength="1"
- @keydown.enter.native="dialog_add_louceng_click"></el-input>
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button @click="dialog_add_louceng = false">取 消</el-button>
- <el-button type="primary" @click="dialog_add_louceng_click">确 定</el-button>
- </div>
- </el-dialog>
- <!-- 操作员详情 -->
- <el-dialog title="操作员详情" custom-class="el-dialog-operator_details" :visible.sync="dialog_operator_details"
- @close="dialog_close('form_operator_details')">
- <el-form :model="form_operator_details">
- <el-form-item label="姓 名:" :label-width="formLabelWidth">
- <div>{{form_operator_details.name}}</div>
- </el-form-item>
- <el-form-item label="联系方式:" :label-width="formLabelWidth">
- <div>{{form_operator_details.contact}}</div>
- </el-form-item>
- </el-form>
- </el-dialog>
- <!-- 添加房间 -->
- <el-dialog title="新增房间" custom-class="el-dialog-add-room" :visible.sync="dialog_add_room" :close-on-click-modal="false" :close-on-press-escape="false"
- @close="dialog_close('form_add_room')">
- <el-form :model="form_add_room" ref="add_room_form" :rules="form_add_room_rules">
- <el-form-item label="校区:" :label-width="formLabelWidth">
- <div>{{form_add_room.school}}</div>
- </el-form-item>
- <el-form-item label="楼栋:" :label-width="formLabelWidth">
- <div>{{form_add_room.building}}</div>
- </el-form-item>
- <el-form-item label="楼层:" :label-width="formLabelWidth">
- <div>{{form_add_room.floor}}</div>
- </el-form-item>
- <el-form-item label="房间:" :label-width="formLabelWidth" :required="true" prop="room">
- <el-input v-model="form_add_room.room" autocomplete="off" placeholder="请输入房间名称" ref="ref_add_room" maxlength="10"
- @keydown.enter.native="dialog_add_room_click"></el-input>
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button @click="dialog_add_room = false">取 消</el-button>
- <el-button type="primary" @click="dialog_add_room_click">确 定</el-button>
- </div>
- </el-dialog>
- <!-- 添加空调设备 -->
- <el-dialog :title="currentData.addDevice + ' 添加设备'" custom-class="el-dialog-add-device" :visible.sync="dialog_add_device" :close-on-click-modal="false"
- :close-on-press-escape="false" @close="dialog_close('form_add_device')">
- <el-form :model="form_add_device" ref="add_device_form" :rules="form_add_device_rules">
- <el-form-item label="当前坐标:" :label-width="formLabelWidth">
- <div>{{form_add_device.school + ' / ' + form_add_device.build + ' / ' + form_add_device.floors}}
- </div>
- </el-form-item>
- <el-form-item label="操作员:" :label-width="formLabelWidth" prop="cao">
- <el-input v-model="cao" autocomplete="off" placeholder="请输入操作员" ref="ref_cao" readonly="" maxlength="10"></el-input>
- </el-form-item>
- <el-form-item label="手机号码:" :label-width="formLabelWidth" prop="contact">
- <el-input v-model="contact" autocomplete="off" placeholder="请输入手机号码" ref="ref_contact" maxlength="11" readonly=""></el-input>
- </el-form-item>
- <el-form-item label="设备名称:" :label-width="formLabelWidth" prop="deviceName" :required="true">
- <el-input v-model="form_add_device.deviceName" autocomplete="off" placeholder="请输入设备名称" ref="ref_deviceName" maxlength="10"></el-input>
- </el-form-item>
- <el-form-item label="设备IP/ID:" :label-width="formLabelWidth" prop="deviceIp" :required="true">
- <el-input v-model="form_add_device.deviceIp" autocomplete="off" placeholder="请输入设备IP/ID" maxlength="4">
- </el-input>
- </el-form-item>
- <el-form-item label="设备类型:" :label-width="formLabelWidth" prop="checkedDevice" :required="true">
- <el-checkbox-group v-model="form_add_device.checkedDevice" :min="0" :max="1" style="width: 380px;">
- <el-checkbox v-for="(device, index) in form_add_device.devices" :label="device" :key="index">
- {{device}}
- </el-checkbox>
- </el-checkbox-group>
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button @click="dialog_add_device = false">取 消</el-button>
- <el-button type="primary" @click="dialog_add_air_click">确 定</el-button>
- </div>
- </el-dialog>
- <!-- 编辑房间 -->
- <el-dialog title="编辑房间" custom-class="el-dialog-modify-room" :visible.sync="dialog_modify_room" :close-on-click-modal="false"
- :close-on-press-escape="false" @close="dialog_close('form_modify_room')">
- <el-form :model="form_modify_room" ref="modify_room_form" :rules="form_modify_room_rules">
- <el-form-item label="校区:" :label-width="formLabelWidth">
- <div>{{form_modify_room.school}}</div>
- </el-form-item>
- <el-form-item label="楼栋:" :label-width="formLabelWidth">
- <div>{{form_modify_room.building}}</div>
- </el-form-item>
- <el-form-item label="楼层:" :label-width="formLabelWidth">
- <div>{{form_modify_room.floor}}</div>
- </el-form-item>
- <el-form-item label="房间:" :label-width="formLabelWidth" :required="true" prop="room">
- <el-input v-model="form_modify_room.room" autocomplete="off" placeholder="请输入房间号" ref="ref_modi_room" maxlength="10"
- @keydown.enter.native="dialog_modify_room_click(show_modify_room)"></el-input>
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button @click="dialog_modify_room = false">取 消</el-button>
- <el-button type="primary" @click="dialog_modify_room_click(show_modify_room)">确 定</el-button>
- </div>
- </el-dialog>
- <!-- 删除房间 -->
- <el-dialog custom-class="el-dialog-delete-room" :visible.sync="dialog_delete_room" :close-on-click-modal="false" :close-on-press-escape="false"
- :show-close="false">
- <div slot="" class="del-air-body">
- <img src="../../icons/serveAC/del_warning.png" alt="">
- <div class="del-air-body-txt">是否确定删除房间【{{ show_delete_room }}】?</div>
- </div>
- <div slot="footer" class="dialog-footer">
- <el-button @click="dialog_delete_room = false"> 否 </el-button>
- <el-button type="primary" @click="dialog_delete_rooms_click(show_delete_room)"> 是 </el-button>
- </div>
- </el-dialog>
- <!-- 删除空调 -->
- <el-dialog custom-class="el-dialog-delete-air" :visible.sync="dialog_delete_air" :close-on-click-modal="false" :close-on-press-escape="false"
- :show-close="false">
- <div slot="" class="del-air-body">
- <img src="../../icons/serveAC/del_warning.png" alt="">
- <div class="del-air-body-txt">是否确定刪除IP/ID为【{{delAir.deleteAirIp}}】的空调?</div>
- </div>
- <div slot="footer" class="dialog-footer">
- <el-button @click="dialog_delete_air = false"> 否 </el-button>
- <el-button type="primary" @click="dialog_delete_air_click"> 是 </el-button>
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- import {
- getBuildingData,
- addBuild,
- addFloors,
- addRooms,
- addAirs,
- getRoomAirs,
- deleteAirs,
- getRoomsAndAirs,
- getOpeningAndAbnomal,
- updateRooms,
- delRooms,
- startAirs,
- stopAirs,
- selAirsStatus,
- getDevices
- } from '@/api/serveAC';
- export default {
- data() {
- // var checkloudong = (rule, value, callback) => {
- // if (!value) {
- // return callback(new Error('请输入楼栋名称'));
- // }
- // setTimeout(() => {
- // var reg = /^[a-zA-Z0-9_\u4e00-\u9fa5]{2,10}$/
- // if (!reg.test(value)) {
- // callback(new Error('必须为2-10个汉字、数字、字母或下划线!'));
- // } else {
- // callback();
- // }
- // }, 100);
- // }
- var checklouceng = (rule, value, callback) => {
- if (!value) {
- return callback(new Error('请输入数字楼层号'));
- }
- setTimeout(() => {
- var reg = /^[1-9]{1}$/
- if (!reg.test(value)) {
- callback(new Error('楼层只能输入 1 到 9 的数字'));
- } else {
- callback();
- }
- }, 100);
- };
- var checkroom = (rule, value, callback) => {
- if (!value) {
- return callback(new Error('请输入房间号'));
- }
- setTimeout(() => {
- callback();
- }, 100);
- // setTimeout(() => {
- // var regH = /[\d]$/g;
- // var floor = this.currentData.floor.replace(regH, '');
- // var reg = /[1-9]{1}[0-9]{2,3}$/
- // if (value.indexOf(floor)) {
- // callback(new Error('房间号数字部分,必须以楼层号开头!'));
- // } else if (!reg.test(value)) {
- // callback(new Error('房间号数字部分,为3-4个数字,非0开头!栋号不需要添加!'));
- // } else {
- // callback();
- // }
- // }, 100);
- };
- // var checkCao = (rule, value, callback) => {
- // if (!value) {
- // return callback(new Error('请输入操作员'));
- // };
- // setTimeout(() => {
- // var reg = /^[\u4e00-\u9fa5]{2,10}$/
- // if (!reg.test(value)) {
- // callback(new Error('必须为2-10个汉字!'));
- // } else {
- // callback();
- // }
- // }, 100);
- // };
- // var checkcontact = (rule, value, callback) => {
- // if (!value) {
- // return callback(new Error('请输入手机号码'));
- // };
- // setTimeout(() => {
- // var reg =
- // /^((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}$/
- // if (!reg.test(value)) {
- // callback(new Error('手机号码输入不规范!'));
- // } else {
- // callback();
- // }
- // }, 100);
- // };
- var checkDeviceName = (rule, value, callback) => {
- if (!value) {
- return callback(new Error('请输入设备名称'));
- }
- setTimeout(() => {
- var reg = /^[a-zA-Z0-9_\u4e00-\u9fa5]{2,10}$/
- if (!reg.test(value)) {
- callback(new Error('必须为2-10个汉字、数字、字母或下划线!'));
- } else {
- callback();
- }
- }, 100);
- };
- var checkDeviceIp = (rule, value, callback) => {
- if (!value) {
- return callback(new Error('请输入设备IP/ID'));
- }
- setTimeout(() => {
- var reg = /^[0-9]{4}$/
- if (!reg.test(value)) {
- callback(new Error('必须为4位数字!'));
- } else {
- callback();
- }
- }, 100);
- };
- var checkCheckedDevice = (rule, value, callback) => {
- if (!value[0]) {
- return callback(new Error('请选择设备类型'));
- } else {
- callback();
- }
- };
- return {
- hideOnSinglePage: true, // 只有一页时是否隐藏
- cao: this.$store.state.user.user_name, // 操作员
- contact: this.$store.state.user.phone,
- room_number: 0, // 房间数量
- device_number: 0, // 设备数量
- offline_device_number: 0, // 离线数量
- shutdown_device_number: 0, // 关机数量
- open_number: 0, // 已开启
- warning_number: 0, // 预警台数
- search_datatime: '',
- // 添加楼栋
- dialog_add_loudong: false, // 显示 或 隐藏 添加楼栋对话框
- form_add_loudong: { // 添加楼栋数据
- school: '',
- building: ''
- },
- // form_add_loudong_rules: { // 添加楼栋表单验证
- // building: [{
- // validator: checkloudong
- // }]
- // },
- // 添加楼层
- dialog_add_louceng: false,
- form_add_louceng: { // 添加楼层数据
- school: '',
- building: '',
- floor: ''
- },
- form_add_louceng_rules: { // 添加楼层表单验证
- floor: [{
- validator: checklouceng
- }]
- },
- // 新增房间
- dialog_add_room: false,
- form_add_room: { // 新增房间数据
- school: '',
- building: '',
- floor: '',
- room: ''
- },
- form_add_room_rules: { // 添加房间表单验证
- room: [{
- validator: checkroom
- }]
- },
- // 修改房间
- dialog_modify_room: false,
- form_modify_room: { // 修改房间数据
- school: '',
- building: '',
- floor: '',
- room: ''
- },
- form_modify_room_rules: { // 修改房间表单验证
- room: [{
- validator: checkroom
- }]
- },
- // 添加设备
- dialog_add_device: false,
- form_add_device: { // 添加设备数据
- school: '',
- build: '',
- floors: '',
- room: '',
- deviceName: '',
- deviceIp: '',
- checkedDevice: [],
- devices: [],
- duration_use: 0.00, // 使用时长
- is_normal: '1', // 是否正常
- is_on: '0' // 是否开启
- },
- form_add_device_rules: {
- deviceName: [{
- validator: checkDeviceName
- }],
- deviceIp: [{
- validator: checkDeviceIp
- }],
- checkedDevice: [{
- validator: checkCheckedDevice
- }],
- // cao: [{
- // validator: checkCao
- // }],
- // contact: [{
- // validator: checkcontact
- // }]
- },
- dialog_operator_details: false, // 操作员详情
- form_operator_details: { // 操作员详情数据
- name: '',
- contact: ''
- },
- dialog_delete_room: false, // 删除房间
- show_delete_room: '', // 记录需要删除的房间
- dialog_delete_air: false, // 删除空调
- show_modify_room: '', // 记录需要修改的房间
- btnActive: 'all',
- louceng_click_id: '',
- // 左侧导航数据:校区,楼栋,楼层
- navData: [],
- form: {
- status: '',
- name: '',
- building: '',
- floor: '',
- room: '',
- device: ''
- },
- formLabelWidth: '120px',
- // 保存当前页数据
- currentData: {
- school: '',
- building: '',
- floor: '',
- allRooms: [],
- rooms: [{
- room: '',
- tableData: []
- }, {
- room: '',
- tableData: []
- }, {
- room: '',
- tableData: []
- }, {
- room: '',
- tableData: []
- }],
- addDevice: '',
- title_any_where: '',
- clickElement: ''
- },
- // 分页参数
- pagination: {
- pageSize: 4,
- currentPage: 1,
- total: 0
- },
- delAir: {
- deleteAirIp: '',
- room: ''
- },
- navLoading: false, // 加载
- listLoading: false,
- airsLoading: [{
- loading: false,
- text: ''
- }, {
- loading: false,
- text: ''
- }, {
- loading: false,
- text: ''
- }, {
- loading: false,
- text: ''
- }],
- deviceOptions: []
- }
- },
- created() {
- // 获取表格数据
- this.get_loudong_data()
- // 默认选中第一个房间
- let auto_click = setInterval(() => {
- let louchen_first = document.getElementById("louceng000");
- if (louchen_first !== null) {
- louchen_first.click();
- clearInterval(auto_click);
- }
- }, 200);
- // 空调设备类型
- this.get_Devices();
- },
- mounted() {
- var obj = document.getElementsByClassName("el-pagination__jump")[0];
- if (typeof obj == 'undefined') {
- return;
- } else {
- obj[0].childNodes[0].nodeValue = "跳至";
- }
- },
- methods: {
- /**
- * 获取所有的空调列表
- */
- get_Devices() {
- var _this = this;
- // 开始发送请求,获取配置数据
- getDevices().then((res) => {
- // console.log(res.data);
- if (res.code == 200) {
- let resdata = res.data;
- _this.deviceOptions = [];
- for (var i = 0; i < resdata.length; i++) {
- _this.deviceOptions.push(resdata[i].air_config);
- }
- _this.deviceOptions.sort((a, b) => a - b);
- this.form_add_device.devices = _this.deviceOptions;
- } else {
- _this.deviceOptions = [];
- this.$message.warning('没有符合条件的数据!');
- }
- }).catch((err) => {
- // console.log(err);
- this.$message.error(err.message);
- });
- },
- /**
- * 开关空调
- * @param {Object} roomIndex
- * @param {Object} rowIndex
- */
- open_close_airs(roomIndex, rowIndex, row, open_close) {
- // console.log(roomIndex, rowIndex, row, open_close);
- // console.log(this.currentData.rooms[roomIndex].tableData[rowIndex]);
- // console.log(row);
- let air_ip = this.currentData.rooms[roomIndex].tableData[rowIndex].ip;
- if (open_close == 'open') {
- this.$set(this.airsLoading[roomIndex], 'loading', true);
- this.$set(this.airsLoading[roomIndex], 'text', row.name + ' ' + row.device + ' 正在【开机】中...');
- let user = this.$store.state.user;
- startAirs({
- admin_name: user.name,
- password: user.pwd,
- air_ip: air_ip
- }).then((res) => {
- // console.log(res);
- if (typeof res.code == 'undefined' || res.code == '') {
- this.$message.error('返回数据格式问题,code未获取到!')
- return
- }
- if (res.code == 200) {
- this.$set(this.currentData.rooms[roomIndex].tableData[rowIndex], 'onOffStatus',
- res.is_on)
- if (res.is_normal == 1) {
- this.$set(this.currentData.rooms[roomIndex].tableData[rowIndex],
- 'alarmStatus', '正常')
- } else {
- this.$set(this.currentData.rooms[roomIndex].tableData[rowIndex],
- 'alarmStatus', '离线')
- }
- // let _this = this;
- // setTimeout(() => {
- // _this.getAirsStatus(roomIndex, rowIndex, air_ip)
- // }, 4000)
- } else {
- this.$message.error(res.message)
- }
- this.$set(this.airsLoading[roomIndex], 'loading', false);
- // 刷新顶部数据
- this.flush_top_data();
- }).catch((err) => {
- // console.log(err);
- // this.$message.error(err.message)
- this.$set(this.airsLoading[roomIndex], 'loading', false);
- // 刷新顶部数据
- this.flush_top_data();
- })
- } else if (open_close == 'close') {
- this.$set(this.airsLoading[roomIndex], 'loading', true);
- this.$set(this.airsLoading[roomIndex], 'text', row.name + ' ' + row.device + ' 正在【关机】中...');
- stopAirs({
- air_ip: air_ip
- }).then((res) => {
- // console.log(res);
- if (typeof res.code == 'undefined' || res.code == '') {
- this.$message.error('返回数据格式问题,code未获取到!')
- return
- }
- if (res.code == 200) {
- this.$set(this.currentData.rooms[roomIndex].tableData[rowIndex], 'onOffStatus',
- res.is_on)
- if (res.is_normal == 1) {
- this.$set(this.currentData.rooms[roomIndex].tableData[rowIndex],
- 'alarmStatus', '正常')
- } else {
- this.$set(this.currentData.rooms[roomIndex].tableData[rowIndex],
- 'alarmStatus', '离线')
- }
- // let _this = this;
- // setTimeout(() => {
- // _this.getAirsStatus(roomIndex, rowIndex, air_ip)
- // }, 4000)
- } else {
- this.$message.error(res.message)
- }
- this.$set(this.airsLoading[roomIndex], 'loading', false);
- // 刷新顶部数据
- this.flush_top_data();
- }).catch((err) => {
- // console.log(err);
- // this.$message.error(err.message)
- this.$set(this.airsLoading[roomIndex], 'loading', false);
- // 刷新顶部数据
- this.flush_top_data();
- })
- }
- },
- /**
- * 获取空调状态
- * @param {Object} roomIndex
- * @param {Object} rowIndex
- * @param {Object} air_ip
- */
- getAirsStatus(roomIndex, rowIndex, air_ip) {
- // console.log(roomIndex, rowIndex);
- selAirsStatus({
- air_ip: air_ip
- }).then((res) => {
- console.log(res);
- if (typeof res.code == 'undefined' || res.code == '') {
- this.$message.error('返回数据格式问题,code未获取到!')
- return
- }
- if (res.code == 200) {
- this.currentData.rooms[roomIndex].tableData[rowIndex].onOffStatus == res.is_on
- this.currentData.rooms[roomIndex].tableData[rowIndex].alarmStatus == res.is_normal
- } else {
- this.$message.error(res.message)
- }
- }).catch((err) => {
- // console.log(err);
- this.$message.error(err.message)
- })
- },
- /**
- * 编辑修改房间
- */
- dialog_modify_room_click(room) {
- this.$refs["modify_room_form"].validate(validate => {
- if (validate) {
- updateRooms({
- school: this.form_modify_room.school,
- build: this.form_modify_room.building,
- floors: this.form_modify_room.floor,
- dom: this.form_modify_room.room,
- old_dom: room
- }).then((res) => {
- // console.log(res);
- if (typeof res.code == 'undefined' || res.code == '') {
- this.$message.error('返回数据格式问题,code未获取到!')
- return
- }
- if (res.code == 200) {
- // 隐藏删除对话框
- this.dialog_modify_room = false
- // 更新本地变量中的房间
- let tmp = this.navData
- for (var i = 0; i < tmp.length; i++) {
- if (tmp[i].label == this.form_modify_room.school && typeof tmp[i]
- .children !==
- 'undefined' && tmp[i].children.length > 0) {
- let tmp1 = tmp[i].children;
- for (var j = 0; j < tmp1.length; j++) {
- if (tmp1[j].label == this.form_modify_room.building &&
- typeof tmp1[j]
- .children !== 'undefined' && tmp1[j].children.length > 0) {
- let tmp2 = tmp1[j].children;
- for (var k = 0; k < tmp2.length; k++) {
- if (tmp2[k].label == this.form_modify_room.floor &&
- typeof tmp2[k]
- .rooms !== 'undefined' && tmp2[k].rooms.length > 0
- ) {
- let tmp3 = tmp2[k].rooms;
- for (var p = 0; p < tmp3.length; p++) {
- if (tmp3[p] == room) {
- this.navData[i].children[j].children[k]
- .rooms[p] =
- this
- .form_modify_room.building + '-' + this
- .form_modify_room.room;
- }
- }
- this.navData[i].children[j].children[k].rooms
- .sort();
- }
- }
- }
- }
- }
- }
- // 自动点击
- this.currentData.clickElement.click()
- } else {
- this.$message.error(res.message)
- }
- }).catch((err) => {
- // console.log(err);
- this.$message.error(err.message)
- })
- } else {
- this.$message.error('验证不通过')
- return false
- }
- });
- },
- /**
- * 删除房间
- * @param {Object} room
- */
- dialog_delete_rooms_click(room) {
- let data = this.currentData.title_any_where.split('-')
- delRooms({
- school: data[0],
- build: data[1],
- floors: data[2],
- dom: room
- }).then((res) => {
- // console.log(res);
- if (typeof res.code == 'undefined' || res.code == '') {
- this.$message.error('返回数据格式问题,code未获取到!')
- return
- }
- if (res.code == 200) {
- // 隐藏删除对话框
- this.dialog_delete_room = false
- // 更新本地变量中的房间
- let tmp = this.navData
- for (var i = 0; i < tmp.length; i++) {
- if (tmp[i].label == data[0] && typeof tmp[i].children !== 'undefined' && tmp[i]
- .children.length > 0) {
- let tmp1 = tmp[i].children
- for (var j = 0; j < tmp1.length; j++) {
- if (tmp1[j].label == data[1] && typeof tmp1[j].children !==
- 'undefined' && tmp1[j].children.length > 0) {
- let tmp2 = tmp1[j].children
- for (var k = 0; k < tmp2.length; k++) {
- if (tmp2[k].label == data[2] && typeof tmp2[k].rooms !==
- 'undefined' && tmp2[k].rooms.length > 0) {
- let tmp3 = tmp2[k].rooms
- for (var p = 0; p < tmp3.length; p++) {
- if (tmp3[p] == room) {
- this.navData[i].children[j].children[k].rooms
- .splice(p, 1)
- }
- }
- this.navData[i].children[j].children[k].rooms.sort()
- }
- }
- }
- }
- }
- }
- // 自动点击
- this.currentData.clickElement.click()
- } else {
- this.$message.error(res.message)
- }
- }).catch((err) => {
- // console.log(err);
- this.$message.error(err.message)
- })
- },
- /**
- * 获取楼栋信息
- */
- get_loudong_data() {
- this.navLoading = true;
- getBuildingData().then((res) => {
- // console.log(res);
- if (typeof res.code == 'undefined' || res.code == '') {
- this.$message.error('返回数据格式问题,code未获取到!');
- return;
- }
- // console.log(res.data);
- if (typeof res.data == 'undefined' || res.data == '') {
- this.$message.error('返回数据格式问题,data未获取到!');
- return;
- }
- // 校区
- let school = JSON.parse(res.data);
- // console.log('school', school);
- if (school.length > 0) {
- this.navData = []
- let tmpSchool = []
- for (var i = 0; i < school.length; i++) {
- let nData = []
- let builds = school[i].builds
- for (var j = 0; j < builds.length; j++) {
- let tmpBuilds = {}
- let tmpFloors = []
- let floors = builds[j]['floors']
- for (var k = 0; k < floors.length; k++) {
- let floor = {
- id: floors[k].id,
- label: floors[k].floor,
- rooms: floors[k].rooms
- }
- // 房间排序
- floor.rooms.sort();
- tmpFloors.push(floor);
- }
- // 楼层排序
- tmpFloors.sort((a, b) => {
- return (a.label - b.label)
- })
- tmpBuilds.id = builds[j].id
- tmpBuilds.label = builds[j].building
- tmpBuilds.isShow = true
- tmpBuilds.children = []
- tmpBuilds.children = tmpFloors
- nData.push(tmpBuilds)
- }
- // 楼栋排序
- nData.sort((a, b) => a.label.localeCompare(b.label))
- tmpSchool.push({
- id: school[i].id,
- label: school[i].school,
- isShow: true,
- children: nData
- })
- }
- // 校区排序
- tmpSchool.sort((a, b) => b.label.localeCompare(a.label))
- this.navData = tmpSchool
- // console.log(JSON.stringify(this.navData));
- } else {
- this.navData = []
- this.$message.warning('没有符合条件的数据!')
- }
- }).catch((err) => {
- // console.log(err);
- this.$message.error(err.message)
- });
- this.navLoading = false;
- },
- /**
- * 获取房间数据
- * @param {Object} school
- * @param {Object} build
- * @param {Object} floors
- * @param {Object} room
- * @param {Object} index
- */
- get_room_airs_data(school, build, floors, room, index) {
- // console.log(school, build, floors, room, index);
- let param = {
- school: school,
- build: build,
- floors: floors,
- dom: room
- }
- getRoomAirs(param).then((res) => {
- // console.log(res);
- if (typeof res.code == 'undefined' || res.code == '') {
- this.$message.error('返回数据格式问题,code未获取到!')
- return
- }
- if (res.code == 200) {
- let data = res.data
- // 有设备数据
- if (typeof data !== 'undefined' && data !== '') {
- let tmpTableData = []
- for (var i = 0; i < data.length; i++) {
- let room = {}
- let param = this.btnActive
- if (param == 'all') { // 全部
- room = {
- name: data[i].air_name, // 名称
- ip: data[i].air_ip, // 空调ip或id
- building: data[i].build, // 楼栋
- device: data[i].air_config, // 空调配置
- userTime: data[i].duration_use, // 使用时长
- alarmStatus: data[i].is_normal == 1 ? '正常' : '离线', // 是否正常
- onOffStatus: data[i].is_on, // 是否开启
- userName: data[i].cao, // 操作员
- contact: '待接口返回,待优化' // 联系方式
- };
- } else if (param == 'powerOn' && data[i].is_on == '1') { // 开机
- room = {
- name: data[i].air_name, // 名称
- ip: data[i].air_ip, // 空调ip或id
- building: data[i].build, // 楼栋
- device: data[i].air_config, // 空调配置
- userTime: data[i].duration_use, // 使用时长
- alarmStatus: data[i].is_normal == 1 ? '正常' : '离线', // 是否正常
- onOffStatus: data[i].is_on, // 是否开启
- userName: data[i].cao, // 操作员
- contact: '待接口返回,待优化' // 联系方式
- };
- } else if (param == 'powerOff' && data[i].is_on == '0') { // 关机
- room = {
- name: data[i].air_name, // 名称
- ip: data[i].air_ip, // 空调ip或id
- building: data[i].build, // 楼栋
- device: data[i].air_config, // 空调配置
- userTime: data[i].duration_use, // 使用时长
- alarmStatus: data[i].is_normal == 1 ? '正常' : '离线', // 是否正常
- onOffStatus: data[i].is_on, // 是否开启
- userName: data[i].cao, // 操作员
- contact: '待接口返回,待优化' // 联系方式
- };
- } else if (param == 'abnormal' && data[i].is_normal == '0') { // 离线
- room = {
- name: data[i].air_name, // 名称
- ip: data[i].air_ip, // 空调ip或id
- building: data[i].build, // 楼栋
- device: data[i].air_config, // 空调配置
- userTime: data[i].duration_use, // 使用时长
- alarmStatus: data[i].is_normal == 1 ? '正常' : '离线', // 是否正常
- onOffStatus: data[i].is_on, // 是否开启
- userName: data[i].cao, // 操作员
- contact: '待接口返回,待优化' // 联系方式
- };
- }
- if (JSON.stringify(room) !== '{}') {
- // 每个房间的设备循环添加
- tmpTableData.push(room)
- }
- }
- if (tmpTableData.length > 0) {
- tmpTableData.sort((a, b) => a.ip.localeCompare(b.ip))
- this.currentData.rooms[index].tableData = tmpTableData
- }
- } else {
- // this.$message.warning(room + ' 没有设备的数据!')
- }
- this.currentData.rooms[index].room = room
- } else {
- this.$message.error('异常!请检查数据!')
- }
- }).catch((err) => {
- // console.log(err);
- this.$message.error(err.message)
- })
- },
- /**
- * 选项的展开与收起,进行切换,递归调用
- * @param {Object} obj
- * @param {Object} id
- */
- toggle_item(obj, id) {
- for (var i = 0; i < obj.length; i++) {
- if (obj[i].id == id) {
- if (obj[i].isShow) {
- obj[i].isShow = false
- } else {
- obj[i].isShow = true
- }
- return
- }
- if (typeof obj[i].children != 'undefined' && obj[i].children.length > 0) {
- this.toggle_item(obj[i].children, id)
- }
- }
- },
- /**
- * 选项的展开与收起,进行切换
- * @param {Object} e
- */
- school_toggle(id, label) {
- // console.log(id);
- // console.log(label);
- // 获取id
- this.toggle_item(this.navData, id)
- },
- /**
- * 单击楼栋
- * @param {Object} e
- */
- loudong_toggle(id, label) {
- this.pagination.pageSize = 4;
- this.pagination.currentPage = 1;
- this.pagination.total = 0;
- let ids = id.split('|')
- let labels = label.split('|')
- // console.log(ids);
- // console.log(labels);
- // 获取id
- this.toggle_item(this.navData, ids[0])
- },
- /**
- * 单击楼层
- * @param {Object} e
- * @param {Object} id
- * @param {Object} label
- * @param {Object} rooms
- */
- louceng_click(e, id, label, rooms) {
- // console.log(e, id, label, rooms);
- this.listLoading = true;
- let ids = id.split('|');
- let labels = label.split('|');
- // console.log(ids);
- // console.log(labels);
- // console.log(rooms);
- // 清空当前页面活动数据
- this.currentData = {
- school: '',
- building: '',
- floor: '',
- allRooms: [],
- rooms: [{
- room: '',
- tableData: []
- }, {
- room: '',
- tableData: []
- }, {
- room: '',
- tableData: []
- }, {
- room: '',
- tableData: []
- }],
- addDevice: '',
- title_any_where: '',
- clickElement: e.target
- };
- // 分页每次单价楼层时,都要初始化
- this.pagination = {
- pageSize: 4,
- currentPage: 1,
- total: 0
- };
- this.offline_device_number = 0; // 离线数量初始化
- this.shutdown_device_number = 0; // 关机数量初始化
- // 点击的楼层id
- this.louceng_click_id = ids[0];
- // 填充数据
- this.currentData.school = labels[2];
- this.currentData.building = labels[1];
- this.currentData.floor = labels[0];
- // 给右侧窗口标题赋值
- this.currentData.title_any_where = this.currentData.school + '-' + this.currentData
- .building + '-' + this.currentData.floor;
- // 获取开机、关机、异常的房间,空的不显示
- this.open_close_abnormal(this.currentData.school, this.currentData.building, this.currentData.floor,
- rooms);
- // 刷新顶部数据
- this.flush_top_data();
- // 延迟取消加载loading
- setTimeout(() => {
- this.listLoading = false;
- }, 500);
- },
- /**
- * 刷新顶部数据
- */
- flush_top_data() {
- // 某层房间、空调数
- this.getRoomsAndAirs(this.currentData.school, this.currentData.building, this.currentData.floor);
- // 某层空调开启和异常统计
- this.getOpeningAndAbnomal(this.currentData.school, this.currentData.building, this.currentData.floor);
- },
- /**
- * 获取开机、关机、异常房间数
- * @param {Object} school
- * @param {Object} build
- * @param {Object} floors
- * @param {Object} rooms
- */
- open_close_abnormal(school, build, floors, rooms) {
- // console.log(school, build, floors, rooms);
- let _this = this,
- len = rooms.length;
- for (var i = 0; i < len; i++) {
- // 延时执行
- (function(t, school, build, floors, room, len) { // 注意这里是形参
- setTimeout(function() {
- _this.get_rooms(t, school, build, floors, room, len)
- }, 50 * t); // 还是0.05执行一次,不是累加的
- })(i, school, build, floors, rooms[i], len - 1); // 注意这里是实参,这里把要用的参数传进去
- }
- },
- /**
- * 获取房间数量
- * @param {Object} school
- * @param {Object} build
- * @param {Object} floors
- * @param {Object} room
- */
- get_rooms(index, school, build, floors, room, len) {
- // console.log(index, school, build, floors, room, len);
- if (this.btnActive == 'all') {
- this.currentData.allRooms.push(room);
- if (index == len) {
- // console.log(this.currentData);
- this.pagination_showData()
- }
- } else {
- let param = {
- school: school,
- build: build,
- floors: floors,
- dom: room
- }
- getRoomAirs(param).then((res) => {
- // console.log(res);
- if (typeof res.code == 'undefined' || res.code == '') {
- // this.$message.error('返回数据格式问题,code未获取到!')
- return
- }
- if (res.code == 200) {
- let data = res.data
- // 有设备数据
- if (typeof data !== 'undefined' && data !== '') {
- let tmpTableData = []
- for (var i = 0; i < data.length; i++) {
- let room = {}
- let param = this.btnActive
- if (param == 'all') {
- room = {
- name: data[i].air_name, // 名称
- ip: data[i].air_ip, // 空调ip或id
- building: data[i].build, // 楼栋
- device: data[i].air_config, // 空调配置
- userTime: data[i].duration_use, // 使用时长
- alarmStatus: data[i].is_normal == 1 ? '正常' : '离线', // 是否正常
- onOffStatus: data[i].is_on, // 是否开启
- userName: data[i].cao, // 操作员
- contact: '待接口返回,待优化' // 联系方式
- }
- } else if (param == 'powerOn' && data[i].is_on == '1') {
- room = {
- name: data[i].air_name, // 名称
- ip: data[i].air_ip, // 空调ip或id
- building: data[i].build, // 楼栋
- device: data[i].air_config, // 空调配置
- userTime: data[i].duration_use, // 使用时长
- alarmStatus: data[i].is_normal == 1 ? '正常' : '离线', // 是否正常
- onOffStatus: data[i].is_on, // 是否开启
- userName: data[i].cao, // 操作员
- contact: '待接口返回,待优化' // 联系方式
- }
- } else if (param == 'powerOff' && data[i].is_on == '0') {
- room = {
- name: data[i].air_name, // 名称
- ip: data[i].air_ip, // 空调ip或id
- building: data[i].build, // 楼栋
- device: data[i].air_config, // 空调配置
- userTime: data[i].duration_use, // 使用时长
- alarmStatus: data[i].is_normal == 1 ? '正常' : '离线', // 是否正常
- onOffStatus: data[i].is_on, // 是否开启
- userName: data[i].cao, // 操作员
- contact: '待接口返回,待优化' // 联系方式
- }
- } else if (param == 'abnormal' && data[i].is_normal == '0') {
- room = {
- name: data[i].air_name, // 名称
- ip: data[i].air_ip, // 空调ip或id
- building: data[i].build, // 楼栋
- device: data[i].air_config, // 空调配置
- userTime: data[i].duration_use, // 使用时长
- alarmStatus: data[i].is_normal == 1 ? '正常' : '离线', // 是否正常
- onOffStatus: data[i].is_on, // 是否开启
- userName: data[i].cao, // 操作员
- contact: '待接口返回,待优化' // 联系方式
- }
- }
- if (JSON.stringify(room) !== '{}') {
- // 每个房间的设备循环添加
- tmpTableData.push(room)
- }
- }
- if (tmpTableData.length > 0) {
- this.currentData.allRooms.push(room)
- }
- } else {
- // this.$message.warning(room + ' 没有设备的数据!')
- }
- } else {
- this.$message.error('异常!请检查数据!')
- }
- if (index == len) {
- // console.log(this.currentData);
- this.pagination_showData()
- }
- }).catch((err) => {
- // console.log(err);
- this.$message.error(err.message)
- });
- }
- },
- /**
- * 分页显示数据
- */
- pagination_showData() {
- // 赋值分页数据
- this.pagination.total = this.currentData.allRooms.length;
- // 最后一页删除后已经空了,则显示前一页或第1页
- let size = Math.ceil(this.pagination.total / 4);
- if (size != 0 && this.pagination.currentPage > size) {
- this.pagination.currentPage = size;
- }
- // 进行分页处理
- this.roomDataPagination(this.pagination.currentPage, this.pagination.pageSize, this
- .currentData.allRooms, this.currentData.school, this.currentData.building, this
- .currentData.floor);
- },
- /**
- * 某层空调开启和异常统计
- * @param {Object} school
- * @param {Object} build
- * @param {Object} floors
- */
- getOpeningAndAbnomal(school, build, floors) {
- getOpeningAndAbnomal({
- school,
- build,
- floors
- }).then((res) => {
- // console.log(res);
- if (typeof res.code == 'undefined' || res.code == '') {
- this.$message.error('返回数据格式问题,code未获取到!');
- return;
- }
- if (res.code == 200) {
- // 填充数据
- this.open_number = res.onNum; // 已开启
- this.warning_number = res.stateNum; // 预警台数
- this.offline_device_number = res.offlineNum // 离线数量
- this.shutdown_device_number = res.shutDownNum // 关机数量
- } else {
- this.open_number = 0;
- this.warning_number = 0;
- this.offline_device_number = 0;
- this.shutdown_device_number = 0;
- // this.$message.error(res.message);
- }
- }).catch((err) => {
- // console.log(err);
- this.$message.error(err.message);
- })
- },
- /**
- * 某层房间、空调数
- * @param {Object} school
- * @param {Object} build
- * @param {Object} floors
- */
- getRoomsAndAirs(school, build, floors) {
- getRoomsAndAirs({
- school,
- build,
- floors
- }).then((res) => {
- // console.log(res);
- if (typeof res.code == 'undefined' || res.code == '') {
- this.$message.error('返回数据格式问题,code未获取到!');
- return;
- }
- if (res.code == 200) {
- // 填充数据
- this.room_number = res.domNum;
- this.device_number = res.airNum;
- } else {
- this.room_number = 0;
- this.device_number = 0;
- // this.$message.error(res.message);
- }
- }).catch((err) => {
- // console.log(err);
- this.$message.error(err.message);
- })
- },
- /**
- * 实现分页
- * @param {Object} currentPage
- * @param {Object} pageSize
- * @param {Object} rooms
- */
- roomDataPagination(currentPage, pageSize, rooms, school, build, floors) {
- // console.log(currentPage, pageSize, rooms, school, build, floors);
- let startRecord = (currentPage - 1) * pageSize
- // 避免最后一页不满4个的情况
- let len = rooms.length
- if (startRecord + pageSize < rooms.length) {
- len = startRecord + pageSize
- }
- let _this = this
- let index = 0
- for (var i = startRecord; i < len; i++) {
- // 延时执行
- (function(t, school, build, floors, room, index) { // 注意这里是形参
- setTimeout(function() {
- _this.get_room_airs_data(school, build, floors, room, index)
- }, 50 * t); // 还是0.05执行一次,不是累加的
- })(i, school, build, floors, rooms[i], index); // 注意这里是实参,这里把要用的参数传进去
- index = index + 1
- }
- },
- /**
- * 添加房间
- */
- add_room() {
- if (this.currentData.school == '' || this.currentData.building == '' || this.currentData.floor ==
- '') {
- this.$message.warning('请选择楼层后,再添加房间!')
- return
- }
- // 填充数据
- this.form_add_room.school = this.currentData.school
- this.form_add_room.building = this.currentData.building
- this.form_add_room.floor = this.currentData.floor
- // 显示添加房间
- this.dialog_add_room = true
- setTimeout(() => {
- this.$nextTick(() => {
- this.$refs.ref_add_room.focus()
- })
- }, 500)
- },
- /**
- * 添加楼层
- * @param {Object} e
- */
- add_louceng(id, label) {
- // let ids = id.split('|')
- let labels = label.split('|')
- // console.log(ids);
- // console.log(labels);
- this.form_add_louceng.school = labels[1]
- this.form_add_louceng.building = labels[0]
- // 显示添加楼层
- this.dialog_add_louceng = true
- setTimeout(() => {
- this.$nextTick(() => {
- this.$refs.ref_louceng.focus()
- })
- }, 500)
- },
- /**
- * 告警状态: 异常
- * @param {Object} index
- * @param {Object} row
- */
- alarm_status_click(index, row) {
- // console.log(index, row);
- this.form_operator_details.name = row.userName
- this.form_operator_details.contact = row.contact
- // 显示操作详情
- this.dialog_operator_details = true
- },
- /**
- * 添加楼栋
- */
- add_loudong(id, label) {
- // console.log(id);
- // console.log(label);
- this.form_add_loudong.school = label
- // 显示添加楼栋
- this.dialog_add_loudong = true
- setTimeout(() => {
- this.$nextTick(() => {
- this.$refs.ref_loudong.focus()
- })
- }, 500)
- },
- /**
- * 添加楼栋对话框
- */
- dialog_add_loudong_click() {
- this.$refs["add_loudong_form"].validate(validate => {
- if (validate) {
- // console.log(this.form_add_loudong);
- addBuild(this.form_add_loudong).then((res) => {
- // console.log(res);
- if (typeof res.code == 'undefined' || res.code == '') {
- this.$message.error('返回数据格式问题,code未获取到!')
- return
- }
- if (res.code == 200) {
- this.get_loudong_data()
- this.$message.success('楼栋添加成功!')
- this.dialog_add_loudong = false
- } else {
- this.$message.error(res.message)
- }
- }).catch((err) => {
- // console.log(err);
- this.$message.error(err.message)
- })
- } else {
- this.$message.error('验证不通过')
- return false
- }
- })
- },
- /**
- * 添加楼层对话框
- */
- dialog_add_louceng_click() {
- this.$refs["add_louceng_form"].validate(validate => {
- if (validate) {
- // console.log(this.form_add_louceng);
- addFloors(this.form_add_louceng).then((res) => {
- // console.log(res);
- if (typeof res.code == 'undefined' || res.code == '') {
- this.$message.error('返回数据格式问题,code未获取到!')
- return
- }
- if (res.code == 200) {
- this.get_loudong_data()
- this.$message.success('楼层添加成功!')
- this.dialog_add_louceng = false
- } else {
- this.$message.error(res.message)
- }
- }).catch((err) => {
- // console.log(err);
- this.$message.error(err.message)
- })
- } else {
- this.$message.error('验证不通过')
- return false
- }
- })
- },
- /**
- * 添加房间对话框
- */
- dialog_add_room_click() {
- this.$refs["add_room_form"].validate(validate => {
- if (validate) {
- // console.log(this.form_add_room);
- addRooms(this.form_add_room).then((res) => {
- // console.log(res);
- if (typeof res.code == 'undefined' || res.code == '') {
- this.$message.error('返回数据格式问题,code未获取到!')
- return
- }
- if (res.code == 200) {
- this.get_loudong_data()
- this.$message.success('房间添加成功!')
- this.dialog_add_room = false
- let _this = this
- setTimeout(() => {
- _this.currentData.clickElement.click()
- }, 1000)
- } else {
- this.$message.error(res.message)
- }
- }).catch((err) => {
- // console.log(err);
- this.$message.error(err.message)
- })
- } else {
- this.$message.error('验证不通过')
- return false
- }
- })
- },
- /**
- * 添加空调对话框
- */
- dialog_add_air_click() {
- this.$refs["add_device_form"].validate(validate => {
- if (validate) {
- // console.log(this.form_add_device);
- addAirs(this.form_add_device).then((res) => {
- // console.log(res);
- if (typeof res.code == 'undefined' || res.code == '') {
- this.$message.error('返回数据格式问题,code未获取到!')
- return
- }
- if (res.code == 200) {
- this.get_loudong_data()
- this.$message.success('空调设备添加成功!')
- this.dialog_add_device = false
- let _this = this
- setTimeout(() => {
- _this.currentData.clickElement.click()
- }, 1000)
- setTimeout(() => {
- }, 300)
- } else {
- this.$message.error(res.message)
- }
- }).catch((err) => {
- // console.log(err);
- this.$message.error(err.message)
- })
- } else {
- this.$message.error('验证不通过')
- return false
- }
- })
- },
- /**
- * 刪除空调对话框
- */
- dialog_delete_air_click() {
- let delAir = {
- school: this.currentData.school,
- build: this.currentData.building,
- floors: this.currentData.floor,
- dom: this.delAir.room,
- air_ip: this.delAir.deleteAirIp
- }
- // console.log(delAir);
- deleteAirs(delAir).then((res) => {
- // console.log(res);
- if (typeof res.code == 'undefined' || res.code == '') {
- this.$message.error('返回数据格式问题,code未获取到!')
- return
- }
- if (res.code == 200) {
- this.get_loudong_data()
- this.$message.success('空调 ' + delAir.air_ip + ' 删除成功!')
- this.dialog_delete_air = false
- let _this = this
- setTimeout(() => {
- _this.currentData.clickElement.click()
- }, 1000)
- } else {
- this.$message.error(res.message)
- }
- }).catch((err) => {
- // console.log(err);
- this.$message.error(err.message)
- })
- },
- /**
- * 主题部分按钮的单击事件
- * @param {Object} param
- */
- top_btn_click(param) {
- // console.log(param);
- this.btnActive = param;
- if (param == 'all') {
- this.currentData.clickElement.click();
- } else if (param == 'powerOn') {
- this.currentData.clickElement.click();
- } else if (param == 'powerOff') {
- this.currentData.clickElement.click();
- } else if (param == 'abnormal') {
- this.currentData.clickElement.click();
- } else {
- this.$message.error('点击按钮出错!');
- }
- },
- /**
- * 添加空调设备
- * @param {Object} room
- */
- add_device(room) {
- // this.$message.success(room);
- this.currentData.addDevice = room;
- // 填充数据
- this.form_add_device.school = this.currentData.school;
- this.form_add_device.build = this.currentData.building;
- this.form_add_device.floors = this.currentData.floor;
- this.form_add_device.room = room;
- // 显示对话框
- this.dialog_add_device = true;
- setTimeout(() => {
- this.$nextTick(() => {
- this.$refs.ref_deviceName.focus();
- });
- }, 500);
- },
- /**
- * 操作编辑修改房间
- * @param {Object} room
- */
- operate_modify_room(room) {
- let tmpData = this.currentData.title_any_where.split('-');
- this.form_modify_room.school = tmpData[0]
- this.form_modify_room.building = tmpData[1]
- this.form_modify_room.floor = tmpData[2]
- this.form_modify_room.room = room.split('-')[1]
- this.show_modify_room = room
- this.dialog_modify_room = true
- setTimeout(() => {
- this.$nextTick(() => {
- this.$refs.ref_modi_room.focus()
- })
- }, 500)
- },
- /**
- * 操作删除房间
- */
- operate_delete_room(room) {
- this.show_delete_room = room
- this.dialog_delete_room = true
- },
- /**
- * 操作删除空调
- * @param {Object} index
- * @param {Object} row
- */
- operate_delete_air(index, row, room) {
- // console.log(index, row, row.ip, room);
- this.delAir.deleteAirIp = row.ip
- this.delAir.room = room
- this.dialog_delete_air = true
- },
- /**
- * 对话框关闭时清理数据
- */
- dialog_close(param) {
- if (param == 'form_add_loudong') {
- this.form_add_loudong = {
- school: '',
- building: ''
- }
- }
- if (param == 'form_add_louceng') {
- this.form_add_louceng = {
- school: '',
- building: '',
- floor: ''
- }
- }
- if (param == 'form_add_room') {
- this.form_add_room = {
- school: '',
- building: '',
- floor: '',
- room: ''
- }
- }
- if (param == 'form_modify_room') {
- this.form_modify_room = {
- school: '',
- building: '',
- floor: '',
- room: ''
- }
- }
- if (param == 'form_add_device') {
- this.form_add_device = {
- school: '',
- build: '',
- floors: '',
- room: '',
- deviceName: '',
- deviceIp: '',
- checkedDevice: [],
- devices: [],
- duration_use: 0.00, // 使用时长
- is_normal: '0', // 是否正常
- is_on: '0', // 是否开启
- }
- }
- if (param == 'form_operator_details') {
- this.form_operator_details = {
- name: '',
- contact: ''
- }
- }
- },
- /**
- * currentPage 改变时会触发
- * @param {Object} val
- */
- currentPageChange(val) {
- this.listLoading = true;
- // console.log('当前页:' + val);
- // 清理一下当前数据中的rooms
- this.currentData.rooms = [{
- room: '',
- tableData: []
- }, {
- room: '',
- tableData: []
- }, {
- room: '',
- tableData: []
- }, {
- room: '',
- tableData: []
- }];
- this.pagination.currentPage = val;
- this.roomDataPagination(this.pagination.currentPage, this.pagination.pageSize, this.currentData
- .allRooms,
- this.currentData.school, this.currentData.building, this.currentData.floor);
- this.listLoading = false;
- },
- /**
- * 设置表格单元格样式
- */
- setCellStyle() {
- return `
- color: #53575A;
- font-size: 14px;
- font-family: Microsoft YaHei-3970(82674968);
- background-color: #ECF1F8;
- border-bottom: 1px solid #DBE0E7;
- `
- },
- /**
- * 设置表格头部单元格样式
- */
- setHeaderSellStyle({
- row,
- column,
- rowIndex,
- columnIndex
- }) {
- if (columnIndex === 0) {
- return `
- background: #FFFFFF;
- color: #53575A;
- font-size: 14px;
- font-family: Microsoft YaHei-3970(82674968);
- border-radius: 6px 0 0 6px;
- `
- } else if (columnIndex === 6) {
- return `
- background: #FFFFFF;
- color: #53575A;
- font-size: 14px;
- font-family: Microsoft YaHei-3970(82674968);
- border-radius: 0 6px 6px 0;
- `
- } else {
- return `
- background: #FFFFFF;
- color: #53575A;
- font-size: 14px;
- font-family: Microsoft YaHei-3970(82674968);
- `
- }
- }
- },
- }
- </script>
- <style scoped lang="scss">
- .app-container {
- background-color: #EFF2F7;
- padding: 10px;
- .el-row {
- .nav-class {
- .nav-box {
- height: 788px;
- overflow-x: hidden;
- overflow-y: scroll;
- }
- .nav-box::-webkit-scrollbar {
- display: none;
- }
- }
- .el-col {
- .nav-box {
- margin: 10px 5px 0 10px;
- padding: 20px 0;
- border-radius: 10px;
- background-color: #FFFFFF;
- font-size: 18px;
- // box-shadow: 5px 5px 15px #979797;
- box-shadow: 0px 3px 21px 0px rgba(60, 108, 254, 0.16);
- .item-school {
- margin-top: 0px;
- .school {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 10px;
- background: #2B4CFE;
- font-family: Microsoft YaHei-3970(82674968);
- font-weight: bold;
- color: #EDF0F5;
- cursor: pointer;
- white-space: nowrap;
- }
- .item-loudong {
- display: flex;
- flex-direction: column;
- padding: 10px 0 0 0;
- .loudong {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 10px 10px 10px 20px;
- background: #EDF0F5;
- font-family: Microsoft YaHei-3970(82674968);
- font-weight: bold;
- color: #2B4CFE;
- cursor: pointer;
- .louidong_text {
- white-space: nowrap;
- width: 260px;
- overflow: hidden;
- text-overflow: ellipsis;
- }
- }
- .item-louceng {
- display: flex;
- flex-direction: column;
- margin-left: 40px;
- .louceng {
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 10px;
- height: 30px;
- font-size: 18px;
- cursor: pointer;
- }
- .louceng:hover {
- background-color: #5c8aff;
- color: #FFFFFF;
- }
- .louceng-clicked {
- font-size: 20px;
- font-weight: bold;
- background-color: #3e5afe;
- color: #FFFFFF;
- }
- }
- .loudong-add-louceng {
- display: flex;
- align-items: center;
- padding: 10px 0 10px 30px;
- cursor: pointer;
- .loudong-add-louceng-txt {
- margin-left: 5px;
- }
- }
- }
- }
- .item-school .item-loudong:nth-child(2) {
- padding: 0;
- }
- .add-loudong {
- display: flex;
- align-items: center;
- padding: 10px 0 0 20px;
- cursor: pointer;
- .add-loudong-txt {
- margin-left: 5px;
- }
- }
- }
- .cell {
- margin: 10px 10px 10px 0;
- padding: 20px;
- border-radius: 10px;
- background-color: #FFFFFF;
- // box-shadow: 5px 5px 15px #979797;
- box-shadow: 0px 3px 21px 0px rgba(60, 108, 254, 0.16);
- .cell-title {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 20px;
- padding-bottom: 18px;
- border-bottom: 1px solid #CCCCCC;
- .title-left {
- width: 88%;
- display: flex;
- justify-content: space-between;
- align-items: center;
- white-space: nowrap;
- .title {
- font-size: 22px;
- font-family: Microsoft YaHei-3970(82674968);
- font-weight: bold;
- color: #1A202B;
- }
- .title-detail {
- margin-left: 16px;
- font-size: 18px;
- font-family: Microsoft YaHei-3970(82674968);
- color: #1A202B;
- }
- }
- .title-right {
- display: flex;
- justify-content: space-between;
- align-items: center;
- .el-button {
- width: 110px;
- height: 46px;
- background: #2B4CFE;
- font-size: 18px;
- color: #FFFFFF;
- font-family: Microsoft YaHei-3970(82674968);
- border-radius: 5px;
- }
- .el-button--warning {
- background: #F88A64;
- }
- }
- }
- .cell-body {
- .cell-body-top-btns {
- display: flex;
- align-items: center;
- margin-bottom: 20px;
- .btn-active {
- display: flex;
- justify-content: center;
- align-items: center;
- width: 66px;
- height: 36px;
- border-radius: 18px;
- font-size: 18px;
- font-family: Microsoft YaHei-3970(82674968);
- background: #2B4CFE;
- color: #FEFEFE;
- margin-right: 10px;
- }
- .btn-no-active {
- display: flex;
- justify-content: center;
- align-items: center;
- width: 66px;
- height: 36px;
- border: none;
- font-size: 18px;
- font-family: Microsoft YaHei-3970(82674968);
- background: none;
- color: #53575A;
- margin-right: 10px;
- }
- }
- .el-row {
- height: 286px;
- .el-col {
- .panel-left,
- .panel-right {
- background: #ECF1F8;
- border-radius: 10px;
- margin: 0 0 10px 0;
- }
- .panel-left,
- .panel-right {
- .panel-header {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 5px 20px;
- margin-bottom: 10px;
- border-bottom: 1px solid #D9D9D9;
- .panel-title-caption {
- display: flex;
- justify-content: space-between;
- align-items: center;
- .panel-title-icon {
- color: #2B4CFE;
- font-size: 20px;
- margin-right: 8px;
- }
- .panel-title {
- font-size: 20px;
- }
- }
- .panel-title-btns {
- .panel-title-btn {
- margin-left: 20px;
- font-size: 16px;
- font-family: Microsoft YaHei-3970(82674968);
- color: #2B4CFE;
- }
- }
- }
- .panel-body {
- /*将表格每一行的背景色去掉*/
- .el-table,
- .el-table__expanded-cell,
- .el-table tr {
- background-color: transparent;
- }
- ::v-deep .el-table td,
- ::v-deep .el-table th {
- padding: 6px 0;
- }
- .el-table {
- margin: 0 3px;
- width: calc(100% - 6px);
- .txt-cell-blue,
- .btn-cell-blue {
- color: #2B4CFE;
- border: none;
- font-size: 14px;
- cursor: pointer;
- }
- .btn-cell-blue {
- border: 1px solid #2B4CFE;
- }
- .power-icon-on {
- font-size: 22px;
- cursor: pointer;
- color: #00ff00;
- }
- .power-icon-off {
- font-size: 22px;
- cursor: pointer;
- color: #ff0000;
- }
- }
- }
- .panel-footer {
- display: flex;
- align-items: center;
- padding: 10px 30px 15px 25px;
- color: #2B4CFE;
- cursor: pointer;
- .panel-footer-txt {
- margin-left: 5px;
- }
- }
- }
- .panel-right {
- margin-right: 0px;
- margin-left: 10px;
- }
- }
- }
- .pagination-table {
- display: flex;
- justify-content: flex-end;
- align-items: center;
- height: 30px;
- margin-top: 5px;
- padding-right: 100px;
- ::v-deep .el-pagination {
- display: flex;
- justify-content: flex-end;
- align-items: center;
- }
- ::v-deep .el-pagination ul {
- display: flex;
- }
- ::v-deep .el-pagination button,
- ::v-deep .el-pagination li {
- display: flex;
- justify-content: center;
- align-items: center;
- width: 50px;
- height: 36px;
- border: 1px solid #626262;
- border-radius: 3px;
- font-size: 14px;
- margin: 0 5px;
- }
- ::v-deep .el-pagination span {
- margin-left: 10px;
- }
- ::v-deep .el-pagination .el-pagination__jump {
- font-size: 16px;
- }
- ::v-deep .el-pagination .el-pagination__editor {
- width: 50px;
- height: 36px;
- margin: 0 5px;
- }
- ::v-deep .el-pagination .el-input__inner {
- width: 50px;
- height: 36px;
- border: 1px solid #626262;
- margin: -4px 0 0 0;
- }
- }
- }
- }
- }
- }
- ::v-deep .el-dialog {
- margin: 0 !important;
- width: 400px;
- height: 320px;
- background: #FFFFFF;
- box-shadow: 0px 0px 13px 0px rgba(0, 0, 0, 0.29);
- border-radius: 10px;
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- .el-dialog__header {
- display: flex;
- align-items: center;
- width: 100%;
- height: 58px;
- padding: 30px;
- background: #E6EBFE;
- border-radius: 10px 10px 0px 0px;
- font-weight: bold;
- }
- .el-dialog__body {
- padding-bottom: 0;
- .el-form-item {
- .el-form-item__label,
- .el-form-item__content {
- font-size: 16px;
- font-family: Microsoft YaHei-3970(82674968);
- color: #53575A;
- }
- .el-input__inner {
- width: 180px;
- }
- }
- // 删除对话框的样式
- .del-air-body {
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- height: 180px;
- img {
- width: 72px;
- }
- .del-air-body-txt {
- height: 58px;
- line-height: 58px;
- font-size: 18px;
- font-family: Microsoft YaHei-3970(82674968);
- color: #333333;
- white-space: nowrap;
- }
- }
- }
- .el-dialog__footer {
- padding-bottom: 0 !important;
- text-align: center;
- .el-button.el-button--default {
- width: 75px;
- height: 40px;
- border: 1px solid #2B4CFE;
- border-radius: 6px;
- font-size: 16px;
- font-family: Microsoft YaHei-3970(82674968);
- color: #2B4CFE;
- }
- .el-button.el-button--primary {
- width: 75px;
- height: 40px;
- background: #2B4CFE;
- border-radius: 6px;
- font-size: 16px;
- font-family: Microsoft YaHei-3970(82674968);
- color: #FFFFFF;
- margin-left: 60px;
- }
- }
- }
- }
- </style>
- <style>
- .el-dialog-add-loudong {
- height: 300px !important;
- }
- .el-dialog-add-room {
- height: 420px !important;
- }
- .el-dialog-modify-room {
- height: 420px !important;
- }
- .el-dialog-add-louceng {
- height: 360px !important;
- }
- .el-dialog-operator_details {
- height: 300px !important;
- }
- .el-dialog-delete-room {
- height: fit-content !important;
- width: fit-content !important;
- }
- .el-dialog-add-device {
- height: fit-content !important;
- width: fit-content !important;
- }
- .el-dialog-delete-air {
- height: fit-content !important;
- width: fit-content !important;
- }
- .dialog-footer {
- height: 68px !important;
- }
- .el-dialog-delete-room .el-dialog__header,
- .el-dialog-delete-air .el-dialog__header {
- display: none !important;
- }
- </style>
|