| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619 |
- <template>
- <view class="content" >
- <view class="header" :style='"background-image:url("+imgUrl+"/detail/bg.png);background-repeat: no-repeat;background-size: 100% 200%;"'>
- <view class="status_info">
- <view class="status_detail">
- <view class="status_text">{{ getStatusText() }}</view>
- <view v-if="deviceInfo.status == 3" class="online_text online">·在线</view>
- <view v-if="deviceInfo.status == 4" class="online_text">·离线</view>
- </view>
- <view class="device_info">机器编号: {{deviceInfo.serialNumber}}</view>
- </view>
- <view style="position: absolute;right:10vw;top:9vh;z-index: 9" @click="showDrawer">
- <image :src="imgUrl+'/detail/setting2.png'" style="width: 50rpx;height: 50rpx;"/>
- </view>
- <view style="position: relative;top:8%;width: 100%;text-align: center">
- <image :src="imgUrl+'/detail/product.png'" style="width: 330rpx;height: 550rpx;"/>
- </view>
- <view class="tabs">
- <view class="child_tab" v-for="item in (summary)" @click="changeTab(item)">
- <image :src="imgUrl+'/detail/tab.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
- <image class="child_img" v-if="item.checked" :src="imgUrl+'/detail/jianyao_on.png'" />
- <image class="child_img" v-if="!item.checked" :src="imgUrl+'/detail/jianyao_off.png'" />
- <view class="child_title" :class="item.checked?'active_on':''">
- {{item.name}}
- </view>
- </view>
- <view class="child_tab" @click="changeTab({name:'baozhuang'})">
- <image :src="imgUrl+'/detail/tab.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
- <image class="child_img" v-if="firstTab" :src="imgUrl+'/detail/baozhuang_off.png'" />
- <image class="child_img" v-if="!firstTab" :src="imgUrl+'/detail/baozhuang_on.png'" />
- <view class="child_title" :class="firstTab?'':'active_on'">
- 包装机
- </view>
- </view>
- </view>
- <view v-if="firstTab">
- <view class="control">
- <view class="control_item">
- <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
- <view class="control_item_detail">
- <view class="control_item_left" @click="subTemperature(1)">-</view>
- <view class="control_item_center">
- <view style="position: absolute">
- <u-input customStyle="width:150rpx;border:0px;" disabledColor="white" @change="changeTemperature()" v-model="temperature"></u-input>
- </view>
- </view>
- <view class="control_item_center_unit" :style="unitFixedStyle">℃</view>
- <view class="control_item_right" @click="addTemperature(1)">+</view>
- </view>
- <view class="control_item_title">
- 温度设置
- </view>
- </view>
- <view class="control_item">
- <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
- <view class="control_item_detail">
- <view class="control_item_center">
- <view style="position: absolute">
- <u-input customStyle="width:150rpx;border:0px;" disabledColor="white" v-model="leftJianyaoTime"></u-input>
- </view>
- </view>
- <view class="control_item_center_unit" :style="unitFixedStyle">分钟</view>
- <view class="control_item_right" style="left:75%;top:10rpx" @click="showBaozhuangDlg(3)">
- <uni-icons type="gear-filled" size="20"></uni-icons>
- </view>
- </view>
- <view class="control_item_title">
- 文火时间倒计时
- </view>
- </view>
- <view class="control_item">
- <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
- <view class="control_item_detail">
- <view class="control_item_center">
- <u-input customStyle="width:150rpx;border:0px;" disabledColor="white" :value="currentTemperature"></u-input>
- </view>
- <view class="control_item_center_unit" :style="unitFixedStyle">℃</view>
- </view>
- <view class="control_item_title">
- 当前温度
- </view>
- </view>
- <view class="control_item">
- <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
- <view class="control_item_detail">
- <view class="control_item_center">
- <u-input customStyle="width:150rpx;border:0px;" disabledColor="white" :value="hightTemperature"></u-input>
- </view>
- <view class="control_item_center_unit" :style="unitFixedStyle">分钟</view>
- </view>
- <view class="control_item_title">
- 高温时间
- </view>
- </view>
- </view>
- <view class="bottom">
- <image :src="imgUrl+'/detail/bg_large.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
- <view class="bottom_item" @click="decoctControlOnOffChange">
- <image v-if="decoctControlOnOffStatus" :src="imgUrl+'/detail/open_on.png'" style="width: 32%;height:32%;"/>
- <image v-if="!decoctControlOnOffStatus" :src="imgUrl+'/detail/open_off.png'" style="width: 32%;height:32%;"/>
- <view :class="decoctControlOnOffStatus?'active_on':''">开关</view>
- </view>
- <view class="bottom_item" @click="decoctControlChange">
- <image v-if="decoctControlStatus" :src="imgUrl+'/detail/jianing_on.png'" style="width: 32%;height:32%;"/>
- <image v-if="!decoctControlStatus" :src="imgUrl+'/detail/jianing_off.png'" style="width: 32%;height:32%;"/>
- <view :class="decoctControlStatus?'active_on':''">煎药</view>
- </view>
- <view class="bottom_item" @click="stopDecoctControlChange">
- <image v-if="!decoctControlStatus" :src="imgUrl+'/detail/stop_on.png'" style="width: 32%;height:32%;"/>
- <image v-if="decoctControlStatus" :src="imgUrl+'/detail/stop_off.png'" style="width: 32%;height:32%;"/>
- <view :class="!decoctControlStatus?'active_on':''">停止</view>
- </view>
- <view class="bottom_item" @click="toPlan">
- <image v-if="leftAppointmentTime>0" :src="imgUrl+'/detail/plan_on.png'" style="width: 32%;height:32%;"/>
- <image v-else :src="imgUrl+'/detail/plan_off.png'" style="width: 32%;height:32%;"/>
- <view :class="leftAppointmentTime>0?'active_on':''">预约</view>
- </view>
- </view>
- </view>
- <view v-if="!firstTab">
- <view class="control">
- <view class="control_item">
- <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
- <view class="control_item_detail">
- <view class="control_item_center">
- <u-input customStyle="width:150rpx;border:0px;background:none;" disabledColor="white" placeholder="0" disabled v-model="edegTemperature"></u-input>
- </view>
- <view class="control_item_center_unit" :style="unitFixedStyle">℃</view>
- <view class="control_item_right" style="left:75%;top:10rpx" @click="showBaozhuangDlg(1)">
- <uni-icons type="gear-filled" size="20"></uni-icons>
- </view>
- </view>
- <view class="control_item_title">
- 当前封边温度
- </view>
- </view>
- <view class="control_item">
- <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
- <view class="control_item_detail">
- <view class="control_item_center">
- <u-input customStyle="width:150rpx;border:0px;background:none;" disabledColor="white" placeholder="0" disabled v-model="sealingTemperature"></u-input>
- </view>
- <view class="control_item_center_unit" :style="unitFixedStyle">℃</view>
- <view class="control_item_right" style="left:75%;top:10rpx" @click="showBaozhuangDlg(2)">
- <uni-icons type="gear-filled" size="20"></uni-icons>
- </view>
- </view>
- <view class="control_item_title">
- 当前封口温度
- </view>
- </view>
- <view class="control_item">
- <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
- <view class="control_item_detail">
- <view class="control_item_left" @click="subPackageNumber()">-</view>
- <view class="control_item_center">
- <view style="position: absolute">
- <u-input customStyle="width:150rpx;border:0px;" disabledColor="white" @change="changePackageNumber" :value="packageNumber"></u-input>
- </view>
- </view>
- <view class="control_item_center_unit" :style="unitFixedStyle">袋</view>
- <view class="control_item_right" @click="addPackageNumber()">+</view>
- </view>
- <view class="control_item_title">
- 包装数量
- </view>
- </view>
- <view class="control_item">
- <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
- <view class="control_item_detail">
- <view class="control_item_left" @click="subPackageVolume()">-</view>
- <view class="control_item_center">
- <view style="position: absolute">
- <u-input customStyle="width:150rpx;border:0px;" disabledColor="white" @change="changePackageVolume" :value="packageVolume"></u-input>
- </view>
- </view>
- <view class="control_item_center_unit" :style="unitFixedStyle">ml</view>
- <view class="control_item_right" @click="addPackageVolume()">+</view>
- </view>
- <view class="control_item_title">
- 包装容量
- </view>
- </view>
- </view>
- <view class="bottom">
- <image :src="imgUrl+'/detail/bg_large.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
- <view class="bottom_item" @click="packageControlOnOffChange">
- <image v-if="packageControlOnOffStatus" :src="imgUrl+'/detail/open_on.png'" style="width: 32%;height:32%;"/>
- <image v-if="!packageControlOnOffStatus" :src="imgUrl+'/detail/open_off.png'" style="width: 32%;height:32%;"/>
- <view :class="packageControlOnOffStatus?'active_on':''">开关</view>
- </view>
- <view class="bottom_item" @click="turnChange(1)">
- <image v-if="qitingTurn" :src="imgUrl+'/detail/open_on.png'" style="width: 32%;height:32%;"/>
- <image v-if="!qitingTurn" :src="imgUrl+'/detail/open_off.png'" style="width: 32%;height:32%;"/>
- <view :class="qitingTurn?'active_on':''">启停</view>
- </view>
- <view class="bottom_item" @click="turnChange(2)">
- <image v-if="baozhuangTurn" :src="imgUrl+'/detail/bao_on.png'" style="width: 32%;height:32%;"/>
- <image v-if="!baozhuangTurn" :src="imgUrl+'/detail/bao_off.png'" style="width: 32%;height:32%;"/>
- <view :class="baozhuangTurn?'active_on':''">包装</view>
- </view>
- <view class="bottom_item" @click="turnChange(3)">
- <image v-if="qingxiTurn" :src="imgUrl+'/detail/xi_on.png'" style="width: 32%;height:32%;"/>
- <image v-if="!qingxiTurn" :src="imgUrl+'/detail/xi_off.png'" style="width: 32%;height:32%;"/>
- <view :class="qingxiTurn?'active_on':''">清洗</view>
- </view>
- </view>
- </view>
- </view>
- <u-popup :show="popDlg" @close="closePop" mode="center" bgColor="transparent" :closeable="true">
- <view style="position: relative;width: 500rpx;height:300rpx;background: none">
- <view class="control_item" style="width: 100%" v-if="fengbianDlgShow">
- <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
- <view class="control_item_detail">
- <view class="control_item_left" @click="subEdegTemperature(1)">-</view>
- <view class="control_item_center">
- <u-input customStyle="width:150rpx;border:0px;" disabledColor="white" @change="changeEdegTemperature" v-model="setEdegTemperature"></u-input>
- </view>
- <view class="control_item_center_unit" :style="unitFixedStyle1">℃</view>
- <view class="control_item_right" @click="addEdegTemperature(1)">+</view>
- </view>
- <view class="control_item_title">
- 封边温度设置
- </view>
- </view>
- <view class="control_item" style="width: 100%" v-if="fengkouDlgShow">
- <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
- <view class="control_item_detail">
- <view class="control_item_left" @click="subSealingTemperature(1)">-</view>
- <view class="control_item_center">
- <u-input customStyle="width:150rpx;border:0px;" disabledColor="white" @change="changeSealingTemperature" v-model="setSealingTemperature"></u-input>
- </view>
- <view class="control_item_center_unit" :style="unitFixedStyle1">℃</view>
- <view class="control_item_right" @click="addSealingTemperature(1)">+</view>
- </view>
- <view class="control_item_title">
- 封口温度设置
- </view>
- </view>
- <view class="control_item" style="width: 100%" v-if="wenhuoTimeDlgShow">
- <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
- <view class="control_item_detail">
- <view class="control_item_left" @click="subTemperatureTime()">-</view>
- <view class="control_item_center">
- <u-input customStyle="width:150rpx;border:0px;" disabledColor="white" @change="changeTemperatureTime()" v-model="temperatureTime"></u-input>
- </view>
- <view class="control_item_center_unit" :style="unitFixedStyle1">℃</view>
- <view class="control_item_right" @click="addTemperatureTime()">+</view>
- </view>
- <view class="control_item_title">
- 文火时间
- </view>
- </view>
- </view>
- </u-popup>
- <u-popup :show="deviceInfo.status != 3" mode="center" >
- <view style="
- margin:2%;padding:10%;background-color: #f0f0f0; /* 背景色 */color: #000; padding: 10px; /* 内边距 */border-radius: 5px; /* 圆角 */font-size: 16px; /* 文字大小 */text-align: center; /* 文字居中 */ ">
- 设备未在线,无法操作
- </view>
- </u-popup>
- <u-popup :show="planPopDlg" @close="closePlanPop" mode="center" :closeable="true">
- <view style="position: relative;width: 400rpx;background: none;padding:40rpx;">
- <view class="control_item" style="width: 100%">
- <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
- <view class="control_item_detail">
- <view class="control_item_left" @click="subPlanTime(1)" style="left: 18%;">-</view>
- <view class="control_item_center">
- <view style="position: absolute">
- <u-input customStyle="width:150rpx;border:0px;" disabledColor="white" v-model="planTime"></u-input>
- </view>
- </view>
- <view class="control_item_center_unit" :style="unitFixedStyle">分钟</view>
- <view class="control_item_right" style="left: 80%;" @click="addPlanTime(1)">+</view>
- </view>
- <view class="control_item_title">
- 预约时间
- </view>
- </view>
- <view class="control_item" style="width: 100%">
- <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
- <view class="control_item_detail">
- <view class="control_item_left" @click="subTemperature(1)" style="left: 18%;">-</view>
- <view class="control_item_center">
- <view style="position: absolute">
- <u-input customStyle="width:150rpx;border:0px;" disabledColor="white" @change="changeTemperature()" v-model="temperature"></u-input>
- </view>
- </view>
- <view class="control_item_center_unit" :style="unitFixedStyle">℃</view>
- <view class="control_item_right" @click="addTemperature(1)" style="left: 80%;">+</view>
- </view>
- <view class="control_item_title">
- 温度设置
- </view>
- </view>
- <view class="control_item" style="width: 100%">
- <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
- <view class="control_item_detail">
- <view class="control_item_left" @click="subTemperatureTime()" style="left: 18%;">-</view>
- <view class="control_item_center">
- <view style="position: absolute">
- <u-input customStyle="width:150rpx;border:0px;" disabledColor="white" @change="changeTemperatureTime()" v-model="temperatureTime"></u-input>
- </view>
- </view>
- <view class="control_item_center_unit" :style="unitFixedStyle">分钟</view>
- <view class="control_item_right" @click="addTemperatureTime()" style="left: 80%;">+</view>
- </view>
- <view class="control_item_title">
- 时间设置
- </view>
- </view>
- <view>
- <button style="background: white;" @click="plan">确认</button>
- </view>
- </view>
- </u-popup>
- <!-- 预约框-->
- <u-popup :show="yuyueIngPop" @close="closeYuyueIngPop" mode="center" :closeable="true">
- <view style="position: relative;width: 400rpx;background: none;padding:40rpx;">
- <view class="control_item" style="width: 100%">
- <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
- <view class="control_item_detail">
- <view class="control_item_center">
- <u-input customStyle="width:150rpx;border:0px;padding:0px" disabledColor="white" :value="leftAppointmentTime"></u-input>
- </view>
- <view class="control_item_center_unit" :style="unitFixedStyle">℃</view>
- </view>
- <view class="control_item_title">
- 剩余时间
- </view>
- </view>
- <view>
- <button style="background: white;" @click="cancelPlan">取消</button>
- </view>
- </view>
- </u-popup>
- <u-popup :show="planIngPopDlg" @close="closePlanIngPop" mode="center" :closeable="true">
- <view style="position: relative;width: 400rpx;background: none;padding:40rpx;">
- <view class="control_item" style="width: 100%">
- <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
- <view class="control_item_detail" style="width: 100%; padding: 40rpx;margin-bottom:10rpx;">
- <u-line-progress :percentage="step" activeColor="#50ACFF"></u-line-progress>
- </view>
- <view class="control_item_title" v-if="leftAppointmentTime>0">
- 预约煎药中,倒计时{{leftAppointmentTime}}分钟
- </view>
- <view class="control_item_title" v-else>
- <view v-if="leftJianyaoTime>0">
- 正在熬制,请稍等
- </view>
- <view v-else>
- 煎药完成
- </view>
- </view>
- </view>
- <view class="control_item" style="width: 100%">
- <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
- <view class="control_item_detail">
- <view class="control_item_center">
- <u-input customStyle="width:150rpx;border:0px;" disabledColor="white" :value="currentTemperature"></u-input>
- </view>
- <view class="control_item_center_unit" :style="unitFixedStyle">℃</view>
- </view>
- <view class="control_item_title">
- 当前温度
- </view>
- </view>
- <view class="control_item" style="width: 100%">
- <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
- <view class="control_item_detail">
- <view class="control_item_center">
- <u-input customStyle="width:150rpx;border:0px;" disabledColor="white" :value="leftJianyaoTime"></u-input>
- </view>
- <view class="control_item_center_unit" :style="unitFixedStyle">分钟</view>
- </view>
- <view class="control_item_title">
- 文火倒计时
- </view>
- </view>
- <!-- <view>-->
- <!-- <button style="background: white;" @click="cancelPlan">暂停</button>-->
- <!-- </view>-->
- </view>
- </u-popup>
- <uni-drawer ref="showLeft" :width="320" :maskClick="true" mode="right" @change="change($event,'showLeft')">
- <scroll-view style="height: 88%;padding:20% 0%;" scroll-y="true">
- <view style="text-align:center">设置</view>
- <view>
- <view class="prop-item">
- <view class="prop-item-image">
- <image :src="imgUrl+'/setting/net.png'" style="width: 100%;height:100%;"/>
- </view>
- <view class="prop-item-left">网络连接</view>
- <view class="prop-item-right">
- <view v-if="deviceInfo.status == 3">
- 已连接
- </view>
- <view v-else>
- 未连接
- <!-- <uni-icons type="forward" size="16"></uni-icons>-->
- </view>
- </view>
- </view>
- <view class="prop-item" v-if="firstTab">
- <view class="prop-item-image">
- <image :src="imgUrl+'/setting/oper_temp.png'" style="width: 100%;height:100%;"/>
- </view>
- <view class="prop-item-left">温度校准</view>
- <view class="prop-item-right" @click="showJiaozhunProp">
- {{jiaozhunTemp}}℃<uni-icons type="forward" size="16"></uni-icons>
- </view>
- </view>
- <view class="prop-item" v-if="firstTab">
- <view class="prop-item-image">
- <image :src="imgUrl+'/setting/list.png'" style="width: 100%;height:100%;"/>
- </view>
- <view class="prop-item-left">工作模式</view>
- <view class="prop-item-right" @click="showModelPicker = true">
- <view v-if="workMode == 1">
- 微压循环<uni-icons type="forward" size="16"></uni-icons>
- </view>
- <view v-if="workMode == 2">
- 常温二煎的一煎<uni-icons type="forward" size="16"></uni-icons>
- </view>
- <view v-if="workMode == 3">
- 常温二煎的二煎<uni-icons type="forward" size="16"></uni-icons>
- </view>
- </view>
- </view>
- <view class="prop-item">
- <view class="prop-item-image">
- <image :src="imgUrl+'/setting/no.png'" style="width: 100%;height:100%;"/>
- </view>
- <view class="prop-item-left">二维码编号</view>
- <view class="prop-item-right">
- <text class="text-right">{{deviceInfo.qrcodeId==null?"未绑定":deviceInfo.qrcodeId}}</text>
- </view>
- </view>
- <view class="prop-item">
- <view class="prop-item-image">
- <image :src="imgUrl+'/setting/learn.png'" style="width: 100%;height:100%;"/>
- </view>
- <view class="prop-item-left">使用教程</view>
- <view class="prop-item-right">
- <uni-icons type="forward" size="16"></uni-icons>
- </view>
- </view>
- <view class="prop-item">
- <view class="prop-item-image">
- <image :src="imgUrl+'/setting/video.png'" style="width: 100%;height:100%;"/>
- </view>
- <view class="prop-item-left">维修视频</view>
- <view class="prop-item-right">
- <uni-icons type="forward" size="16"></uni-icons>
- </view>
- </view>
- <view class="prop-item">
- <view class="prop-item-image">
- <image :src="imgUrl+'/setting/upload.png'" style="width: 100%;height:100%;"/>
- </view>
- <view class="prop-item-left">在线升级</view>
- <view class="prop-item-right" @click="getUpdateInfo">
- <uni-icons type="forward" size="16"></uni-icons>
- </view>
- </view>
- <view class="prop-item">
- <view class="prop-item-image">
- <image :src="imgUrl+'/setting/shou.png'" style="width: 100%;height:100%;"/>
- </view>
- <view class="prop-item-left">售后服务</view>
- <view class="prop-item-right">
- <uni-icons type="forward" size="16"></uni-icons>
- </view>
- </view>
- <view class="prop-item">
- <view class="prop-item-image">
- <image :src="imgUrl+'/setting/reset.png'" style="width: 100%;height:100%;"/>
- </view>
- <view class="prop-item-left">恢复出厂</view>
- <view class="prop-item-right" @click="reset">
- <uni-icons type="forward" size="16"></uni-icons>
- </view>
- </view>
- </view>
- </scroll-view>
- </uni-drawer>
- <u-popup :show="jiaozhunPopDlg" @close="closejiaozhunPop" mode="center" :closeable="true">
- <view style="position: relative;width: 400rpx;background: none;padding:40rpx;">
- <view class="control_item" style="width: 100%">
- <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
- <view class="control_item_detail">
- <view class="control_item_left" @click="subJiaoZhunTemperature(1)" style="left: 18%;">-</view>
- <view class="control_item_center">
- <view style="position: absolute">
- <u-input customStyle="width:150rpx;border:0px;" disabledColor="white" v-model="jiaozhunTemp_temp"></u-input>
- </view>
- </view>
- <view class="control_item_center_unit" :style="unitFixedStyle">℃</view>
- <view class="control_item_right" @click="addJiaoZhunTemperature(1)" style="left: 80%;">+</view>
- </view>
- <view class="control_item_title">
- 校准温度
- </view>
- </view>
- <view>
- <button style="background: white;" @click="confirmJiaozhunTemp">确认</button>
- </view>
- </view>
- </u-popup>
- <u-picker :show="showModelPicker" @cancel="closeModelPicker" @confirm="confirmMode" :columns="modeList" keyName="text"></u-picker>
- </view>
- </template>
- <script>
- import { getDetail,getDeviceStatus,cacheJsonThingsModel,reportError ,getDeviceRunTime,getLatestFirmware} from '@/api/device/device.js'
- import config from '@/config'
- export default {
- data(){
- return {
- modeList:[[
- {id:1,text:"微压循环"},
- {id:2,text:"常温二煎的一煎"},
- {id:3,text:"常温二煎的二煎"},
- {id:3,text:"密闭微压"},
- {id:3,text:"常温常压"},
- ]],
- showModelPicker:false,
- unitFixedStyle:"",
- unitFixedStyle1:"",
- planTime:10,
- setSealingTemperature:160,
- setEdegTemperature:160,
- sealingTemperature:0,
- edegTemperature:0,
- hightTemperature:0,
- currentTemperature:0,
- temperatureTime:1,
- temperature:0,
- packageNumber:0,
- packageVolume:50,
- firstTab:true,
- decoctControlStatus:false,
- decoctControlOnOffStatus:false,
- packageControlOnOffStatus:false,
- subDecoctTabList:[
- {name:'子煎药1'},
- {name:'子煎药2'},
- {name:'子煎药3'},
- ],
- DecoctControlStatus:false,
- PackagControlStatus:false,
- baozhuangTurn:false,
- qitingTurn:false,
- qingxiTurn:false,
- subCurrent:0,
- current:0,
- inputStyle:{height:'44rpx','fontSize':'20rpx'},
- modelKey:['PowerControl','LockControl'],
- jianyaoKeys : ["TempSetting","TimeSetting"],
- baozhuangKeys:["SetSealTemp","SetBandingTemp","PackageQuantity","PackingVolume"],
- power:{
- loading:true,
- value:0,
- },
- lock:{
- loading:true,
- value:0,
- },
- showTimeDlg:false,
- showErrDlg:null,
- errorMsg:"asdasdasdasd",
- show:null,
- value:"",
- deviceInfo:{},
- id:0,
- summary:[
- ],
- tabs:[
- {tabName:"煎药控制"},
- {tabName:"包装控制"},
- ],
- activeName:0,
- childId:0,
- oneToMul:false,
- inputProp:[],
- watchProp:[],
- columns:[],
- location:{},
- sysDept:null,
- timeobj:{alltime:0,avgtime:0},
- publishMsg:false,
- checkTimer:null,
- functions:[],
- properties:[],
- propMap:{},
- jianyaoTimer:null,
- baozhuangTimer:null,
- editing:false,
- workMode:2,
- leftAppointmentTime:0,
- leftJianyaoTime:0,
- imgUrl:"",
- popDlg:false,
- fengbianDlgShow:false,
- fengkouDlgShow:false,
- wenhuoTimeDlgShow:false,
- planPopDlg:false,
- planIngPopDlg:false,
- maxWidth:320,
- jiaozhunTemp:0,//校准温度,
- jiaozhunTemp_temp:0,//校准温度,
- jiaozhunPopDlg:false,
- step:0,
- yuyueIngPop:false,
- firmware:{},
- jianyaoPopClose:true,
- }
- },
- onLoad: function(opt) {
- this.id = opt.id;
- // this.id = 61;
- this.connectMqtt();
- this.getDetail();
- this.imgUrl = config.imgUrl
- this.fixStyle();
- },
- destroyed() {
- // 取消订阅主题
- this.mqttUnSubscribe(this.deviceInfo);
- clearTimeout(this.checkTimer);
- },
- methods:{
- getUpdateInfo(){
- let self = this;
- getLatestFirmware(this.id).then(res=>{
- self.firmware = res.data;
- let curVersion = self.deviceInfo.firmwareVersion;
- let onlineVersion = self.firmware.version
- if(curVersion>=onlineVersion){
- this.$modal.showToast('当前已经是最新版本')
- }else{
- uni.showModal({
- title: '检测到新版本',
- content: "当前版本:"+curVersion+",新版本:"+onlineVersion,
- cancelText: '取消',
- confirmText: '升级',
- success: function(res) {
- if (res.confirm) {
- self.doUpdate();
- }
- }
- })
- }
- });
- },
- doUpdate(){
- if(this.deviceInfo.status != 3){
- this.notifyError("请等待设备上线后操作")
- return;
- }
- let device = this.deviceInfo;
- let message = "";
- let topic = "";
- let title = "升级";
- topic = "/" + device.productId + "/" + device.serialNumber + "/ota/get";
- message = '{"version":"' + this.firmware.version + '","downloadUrl":"' + this.getDownloadUrl(this.firmware.filePath) + '","size":"'+this.firmware.size+'"}';
- this.$mqttTool.publish(topic, message,title).then(res => {
- this.notifySuccess(res);
- }).catch(res => {
- this.notifyError(res);
- });
- },
- getStatusText(){
- if(this.baozhuangRunning()){
- return "工作中";
- }
- if(this.jianyaoIng()){
- return "工作中";
- }
- if(this.leftAppointmentTime>0){
- return "已预约";
- }
- return "空闲中";
- },
- closeYuyueIngPop(){
- this.yuyueIngPop = false;
- },
- confirmMode(item){
- console.log(item)
- this.workMode = item.value[0].id;
- this.setMode(this.workMode);
- this.closeModelPicker();
- },
- closeModelPicker(){
- this.showModelPicker = false;
- },
- confirmJiaozhunTemp(){
- this.jiaozhunTemp = this.jiaozhunTemp_temp;
- this.temperNumber();
- this.closejiaozhunPop();
- },
- addJiaoZhunTemperature(){
- this.jiaozhunTemp_temp ++;
- if(this.jiaozhunTemp_temp>20){
- this.jiaozhunTemp_temp = 20;
- }
- },
- subJiaoZhunTemperature(){
- this.jiaozhunTemp_temp --;
- if(this.jiaozhunTemp_temp<-20){
- this.jiaozhunTemp_temp = -20;
- }
- },
- closejiaozhunPop(){
- this.jiaozhunPopDlg = false;
- },
- showJiaozhunProp(){
- this.jiaozhunTemp_temp = this.jiaozhunTemp;
- this.jiaozhunPopDlg = true;
- },
- fixStyle(){
- let self = this;
- wx.getSystemInfo({
- success: res => {
- const { windowWidth, windowHeight, statusBarHeight } = res;
- // 在这里可以获取到屏幕的宽度和高度
- console.log(windowWidth, windowHeight, statusBarHeight);
- if(windowWidth<=350){
- self.unitFixedStyle = ";padding-top:6px;left: 28vw;";
- self.unitFixedStyle1 = ";padding-top:6px;left: 28vw;";
- }else if(windowWidth>=360){
- self.unitFixedStyle = ";padding-top:10rpx;";
- self.unitFixedStyle1 = ";padding-top:10rpx;left: 32vw;";
- }
- self.maxWidth = windowWidth;
- }
- })
- },
- closePlanIngPop(){
- this.jianyaoPopClose = false;
- this.planIngPopDlg = false;
- },
- closePlanPop(){
- this.planPopDlg = false;
- },
- showBaozhuangDlg(type){
- this.popDlg = true;
- if(type == 1){
- this.fengbianDlgShow = true;
- }else if(type == 2){
- this.fengkouDlgShow = true;
- }else if(type == 3){
- this.wenhuoTimeDlgShow = true;
- }
- },
- closePop(){
- this.popDlg = false;
- this.fengbianDlgShow = false;
- this.fengkouDlgShow = false;
- this.wenhuoTimeDlgShow = false;
- },
- changeTab(item){
- let summary = this.summary;
- let self = this;
- this.resetChoose();
- if(item.name == 'baozhuang'){
- this.firstTab = false;
- getDeviceStatus(this.id,0).then(res=>{
- let data =res.data;
- this.deviceInfo = data;
- self.parseStatusData(data)
- });
- }else{
- item.checked = true;
- this.firstTab = true;
- if(summary.length>1){
- this.childId = item.id;
- this.getDeviceStatus()
- }else{
- this.getDeviceStatus()
- }
- }
- },
- resetChoose(){
- for (let i = 0; i <this.summary.length; i++) {
- let data = this.summary[i];
- data.checked = false;
- }
- },
- changePackageVolume(){
- if(this.packageVolume<50){
- this.packageVolume = 50;
- }
- if(this.packageVolume>300){
- this.packageVolume = 300;
- }
- this.sendBaozhuang("PackingVolume");
- },
- changePackageNumber(){
- let min = 1;
- let max = 999;
- if(this.packageNumber<min){
- this.packageNumber = min;
- }
- if(this.packageNumber>max){
- this.packageNumber = max;
- }
- this.sendBaozhuang("PackageQuantity");
- },
- changeEdegTemperature(){
- let min = 80;
- let max = 220;
- if(this.setEdegTemperature<min){
- this.setEdegTemperature = min;
- }
- if(this.setEdegTemperature>max){
- this.setEdegTemperature = max;
- }
- console.log("current setEdegTemperature is :"+this.setEdegTemperature)
- this.sendBaozhuang("SetBandingTemp");
- },
- changeSealingTemperature(){
- let min = 80;
- let max = 220;
- if(this.setSealingTemperature<min){
- this.setSealingTemperature = min;
- }
- if(this.setSealingTemperature>max){
- this.setSealingTemperature = max;
- }
- console.log("current setSealingTemperature is :"+this.setSealingTemperature)
- this.sendBaozhuang("SetSealTemp");
- },
- changeTemperature(){
- let max = 140;
- let min = 100;
- if(this.workMode == 2){
- min = 1;
- }
- if(this.temperature<min){
- this.temperature = min;
- }
- if(this.temperature>max){
- this.temperature = max;
- }
- console.log("current temperature is :"+this.temperature)
- this.sendJianYao("TempSetting");
- },
- changeTemperatureTime(){
- let min = 1;
- let max = 600;
- if(this.temperatureTime<min){
- this.temperatureTime = min;
- }
- if(this.temperatureTime>max){
- this.temperatureTime = max;
- }
- console.log("current temperatureTime is :"+this.temperatureTime)
- this.sendJianYao("TimeSetting");
- },
- jianyaoOpen(){
- if(this.decoctControlOnOffStatus){
- return true;
- }
- return false;
- },
- baozhuangOpen(){
- if(this.packageControlOnOffStatus){
- return true;
- }
- return false;
- },
- baozhuangRunning(){
- if(this.qingxiTurn || this.baozhuangTurn || this.qitingTurn){
- return true;
- }
- return false;
- },
- jianyaoIng(){
- if(this.decoctControlStatus){
- return true;
- }
- return false;
- },
- cancelPlan(){
- let arr = [];
- let obj = {};
- obj.id = "AppointmentTime";
- obj.shadow = 0;
- arr.push(obj);
- let self = this;
- self.kongzhiJianyao(false,arr);
- this.mqttPublish(2,this.deviceInfo,arr,true);
- this.closeYuyueIngPop();
- },
- toPlan(){
- if(!this.jianyaoOpen()){
- this.$modal.showToast('煎药机已经关机')
- return;
- }
- if(this.leftAppointmentTime>0){
- this.yuyueIngPop = true;
- }else{
- if(this.jianyaoIng()){
- this.$modal.showToast('正在煎药')
- return;
- }
- this.planPopDlg = true;
- }
- },
- calcuStep(){
- if(this.leftAppointmentTime>0){
- this.step = 0;
- return 0;
- }
- if(this.leftJianyaoTime == 0){
- this.step = 100;
- return ;
- }
- let currentTemperature = this.currentTemperature;
- let hightTemperature = this.temperatureTime-this.leftJianyaoTime;//设置的高温时间
- let targetTemperature =100;// this.temperature;
- let targetTemperatureTime = this.temperatureTime;//倒计时
- if(targetTemperature>100){
- targetTemperature = 100;
- }
- let step = 0;
- if(currentTemperature<100){
- let tem = currentTemperature/200*100;
- step = tem;
- }else{
- step = 50;
- let rate = hightTemperature/targetTemperatureTime;
- rate = rate/2;
- rate = rate*100;
- rate = rate.toFixed(2)
- step = step + parseFloat(rate);
- }
- this.step = step.toFixed(2);
- },
- plan(){
- let self = this;
- if(this.planTime>600){
- this.$modal.showToast('预约时间最大为600分钟')
- return;
- }
- if(this.planTime == 0){
- this.$modal.showToast('预约时间不能为空')
- }else{
- let arr = [];
- let obj = {};
- obj.id = "AppointmentTime";
- obj.shadow = this.planTime;
- arr.push(obj);
- this.kongzhiJianyao(true,arr);
- this.mqttPublish(2,this.deviceInfo,arr,true);
- }
- this.$modal.showToast('预约成功')
- this.planPopDlg = false;
- },
- lockCtrl(key){
- let arr = [];
- let obj = {};
- obj.id = "LockControl";
- if(key == 0){
- obj.shadow = 1;
- this.lock.value = 1;
- }else{
- obj.shadow = 0;
- this.lock.value = 0;
- }
- arr.push(obj);
- this.mqttPublish(2,this.deviceInfo,arr)
- },
- setMode(type){
- let arr = [];
- let obj = {};
- obj.id = "WorkMode";
- obj.shadow = type;
- arr.push(obj);
- this.mqttPublish(2,this.deviceInfo,arr,true)
- this.workMode = type;
- },
- temperNumber(value){
- let arr = [];
- let obj = {};
- obj.id = "CalibrationTemp";
- obj.shadow = this.jiaozhunTemp;
- arr.push(obj);
- this.mqttPublish(2,this.deviceInfo,arr,true)
- },
- volumeNumber(){
- let arr = [];
- let obj = {};
- obj.id = "CapacityCalibration";
- obj.shadow = 1;
- arr.push(obj);
- this.mqttPublish(2,this.deviceInfo,arr,true)
- },
- showConfirm(title,content,yes,no){
- uni.showModal({
- title: title,
- content: content,
- success: function (res) {
- if (res.confirm) {
- yes();
- } else if (res.cancel) {
- no();
- }
- }
- });
- },
- reset(){
- let self = this;
- this.showConfirm("提示","确认恢复出厂吗",function(){
- let arr = [];
- let obj = {};
- obj.id = "RestoreFactory";
- obj.shadow = 1;
- arr.push(obj);
- self.mqttPublish(2,self.deviceInfo,arr)
- },function(){});
- },
- turnChange(type){
- let flag = false;
- let obj = {};
- if(type ==3){
- if(this.baozhuangTurn || this.qitingTurn){
- this.$modal.showToast("启停、包装、清洗不能同时打开")
- return;
- }
- flag = this.qingxiTurn;
- obj.id = "WashSwitch";
- }else if(type == 2){
- if(this.qingxiTurn || this.qitingTurn){
- this.$modal.showToast("启停、包装、清洗不能同时打开")
- return;
- }
- flag = this.baozhuangTurn;
- obj.id = "PackageSwitch";
- }else if(type == 1) {
- if(this.qingxiTurn || this.baozhuangTurn){
- this.$modal.showToast("启停、包装、清洗不能同时打开")
- return;
- }
- flag = this.qitingTurn;
- obj.id = "CarrybagSwitch";
- }
- flag = !flag;
- let arr = [];
- if(flag){
- obj.shadow = 1;
- }else{
- obj.shadow = 0;
- }
- arr.push(obj);
- this.mqttPublish(2,this.deviceInfo,arr)
- },
- addPackageVolume(){
- this.packageVolume++;
- console.log("增加包装容量")
- this.changePackageVolume()
- },
- subPackageVolume(){
- this.packageVolume--;
- console.log("减少包装容量")
- this.changePackageVolume()
- },
- addPackageNumber(){
- this.packageNumber++;
- console.log("增加包装数量")
- this.changePackageNumber();
- },
- subPackageNumber(){
- this.packageNumber--;
- console.log("减少包装数量")
- this.changePackageNumber();
- },
- addSealingTemperature(){
- console.log("增加封口温度")
- this.setSealingTemperature++;
- this.changeSealingTemperature();
- },
- subSealingTemperature(){
- console.log("减少封口温度")
- this.setSealingTemperature--;
- this.changeSealingTemperature();
- },
- addEdegTemperature(){
- console.log("增加封边温度")
- this.editing = true;
- this.setEdegTemperature++;
- this.changeEdegTemperature();
- },
- subEdegTemperature(){
- console.log("减少封边温度")
- this.editing = true;
- this.setEdegTemperature--;
- this.changeEdegTemperature();
- },
- addTemperatureTime(){
- console.log("增加煎药时间")
- this.temperatureTime++;
- this.changeTemperatureTime()
- },
- subTemperatureTime(){
- console.log("减少煎药时间")
- this.temperatureTime--;
- if(this.temperatureTime<=0){
- this.temperatureTime = 1;
- }
- this.changeTemperatureTime()
- },
- addTemperature(){
- console.log("增加煎药温度")
- this.temperature++;
- this.changeTemperature();
- },
- subTemperature(type){
- console.log("减少煎药温度")
- this.temperature--;
- this.changeTemperature();
- },
- addPlanTime(){
- console.log("增加预约时间")
- this.planTime++;
- },
- subPlanTime(){
- console.log("减少预约时间")
- this.planTime--;
- },
- sendBaozhuang(targetKey){
- let self = this;
- let arr = [];
- if(this.baozhuangTimer != null){
- clearTimeout(this.baozhuangTimer);
- }
- this.baozhuangTimer = setTimeout(function (){
- for (let i = 0; i <this.baozhuangKeys.length; i++) {
- let key = this.baozhuangKeys[i];
- let obj = {};
- obj.id = key;
- if(key === "PackingVolume"){
- obj.shadow = this.packageVolume;
- }
- if(key === "PackageQuantity"){
- obj.shadow = this.packageNumber;
- }
- if(key === "SetSealTemp"){
- obj.shadow = this.setSealingTemperature;
- }
- if(key === "SetBandingTemp"){
- obj.shadow = this.setEdegTemperature;
- }
- if(targetKey == key){
- arr.push(obj);
- break;
- }
- }
- this.mqttPublish(2,this.deviceInfo,arr)
- }.bind(this),500);
- },
- sendJianYao(targetKey){
- let arr = [];
- if(this.jianyaoTimer != null){
- clearTimeout(this.jianyaoTimer);
- }
- this.jianyaoTimer = setTimeout(function (){
- for (let i = 0; i <this.jianyaoKeys.length; i++) {
- let key = this.jianyaoKeys[i];
- let obj = {};
- obj.id = key;
- if(key === "TempSetting"){
- obj.shadow = this.temperature;
- }
- if(key === "TimeSetting"){
- obj.shadow = this.temperatureTime;
- }
- if(targetKey == key){
- arr.push(obj);
- break;
- }
- }
- this.mqttPublish(2,this.deviceInfo,arr,true)
- }.bind(this),500);
- },
- buildPropKey(key){
- if(this.childId !=0){
- return key+"_"+this.childId;
- }else{
- return key;
- }
- },
- decoctControlChange(){
- let obj = {};
- let arr = [];
- if(!this.decoctControlOnOffStatus){
- this.notifyError("请先开机后再进行操作")
- return;
- }
- if(this.decoctControlStatus){
- this.showJianyao();
- return;
- }
- this.decoctControlStatus = !this.decoctControlStatus;
- obj.id = "DecoctingSwitch";
- if(this.decoctControlStatus){
- obj.shadow = 1;
- console.log("煎药状态打开")
- this.checkJianyao();
- }else{
- obj.shadow = 0;
- console.log("煎药状态关闭")
- }
- arr.push(obj);
- this.mqttPublish(2,this.deviceInfo,arr,true)
- },
- kongzhiJianyao(flag,arr){//不判断煎药状态
- let obj = {};
- if(!this.decoctControlOnOffStatus){
- this.notifyError("请先开机后再进行操作")
- return;
- }
- obj.id = "DecoctingSwitch";
- if(flag){
- obj.shadow = 1;
- console.log("煎药状态打开")
- this.checkJianyao();
- }else{
- obj.shadow = 0;
- console.log("煎药状态关闭")
- }
- arr.push(obj);
- },
- stopDecoctControlChange(){
- let obj = {};
- let arr = [];
- if(!this.decoctControlOnOffStatus){
- this.notifyError("请先开机后再进行操作")
- return;
- }
- if(!this.decoctControlStatus){
- return;
- }
- this.decoctControlStatus = !this.decoctControlStatus;
- obj.id = "DecoctingSwitch";
- if(this.decoctControlStatus){
- obj.shadow = 1;
- console.log("煎药状态打开")
- }else{
- obj.shadow = 0;
- console.log("煎药状态关闭")
- }
- arr.push(obj);
- let obj2 = {};
- obj2.id = "AppointmentTime";
- obj2.shadow = 0;
- arr.push(obj2);
- this.mqttPublish(2,this.deviceInfo,arr,true)
- },
- decoctControlOnOffChange(){
- let obj = {};
- this.decoctControlOnOffStatus = !this.decoctControlOnOffStatus;
- let arr = [];
- obj.id = "PowerControl";
- let isMul = false;
- if(this.decoctControlStatus){
- this.$modal.showToast('请先结束煎药后操作')
- this.decoctControlOnOffStatus = !this.decoctControlOnOffStatus;
- return;
- }
- if(this.oneToMul && this.firstTab){
- obj.id = "PowerCtl";
- isMul = true;
- }
- if(this.decoctControlOnOffStatus){
- obj.shadow = 1;
- console.log("煎药机开关打开")
- }else{
- obj.shadow = 0;
- console.log("煎药机开关关闭")
- }
- arr.push(obj);
- this.mqttPublish(2,this.deviceInfo,arr,isMul)
- },
- packageControlOnOffChange(){
- let obj = {};
- let arr = [];
- if(this.baozhuangRunning()){
- this.$modal.showToast('请先停止运行后操作')
- return;
- }
- obj.id = "PackagePowerControl";
- this.packageControlOnOffStatus = !this.packageControlOnOffStatus;
- if(this.packageControlOnOffStatus){
- console.log("包装机器开关打开")
- obj.shadow = 1;
- }else{
- console.log("包装机器开关关闭")
- obj.shadow = 0;
- }
- arr.push(obj);
- this.mqttPublish(2,this.deviceInfo,arr)
- },
- containKey(arr,key){
- for (let i = 0; i < arr.length; i++) {
- const data = arr[i];
- if(data == key){
- return true;
- }
- }
- return false;
- },
- // 抽屉状态发生变化触发
- change(e, type) {
- console.log(e);
- },
- showDrawer() {
- this.$refs.showLeft.open();
- },
- closeDrawer() {
- this.$refs.showLeft.close();
- },
- checkItemValue(item){
- if(!item.shadow){
- item.shadow = 0;
- }
- if(!item.unit){
- item.unit = "";
- }
- return true;
- },
- sendProperties(){
- let properties = this.properties;
- for (let i = 0; i < properties; i++) {
- let property = this.properties[i];
- let shadow = property.shadow;
- if(shadow){
- arr.push(property);
- }
- }
- this.mqttPublish(1,this.deviceInfo,arr)
- },
- sendFunctions(){
- let arr = [];
- let functions = this.functions;
- for (let i = 0; i < functions.length; i++) {
- let functionObj = this.functions[i];
- let shadow = functionObj.shadow;
- if(shadow){
- arr.push(functionObj);
- }
- }
- this.mqttPublish(2,this.deviceInfo,arr)
- },
- changeProp(key,val){
- let item = null;
- let obj = null;
- let oneToMul = this.oneToMul;
- if(key === "LockControl"){
- this.lock.value = val;
- item = this.lock;
- }else if(key === "PowerControl"){
- this.power.value = val;
- item = this.power;
- }
- let value = val;
- obj = item.item;
- if(value){
- obj.value = 1;
- obj.shadow = 1;
- }else{
- obj.value = 0;
- obj.shadow = 0;
- }
- if(!oneToMul){
- }
- this.publishThingsModel(this.deviceInfo,obj);
- },
- checkCommonProp(item){
- let id =item.id;
- let isCommonKey = this.modelKey.some(res=>{
- return id === res;
- })
- return !isCommonKey;
- },
- getRunTime(){
- let self = this;
- getDeviceRunTime(this.id).then(res=>{
- self.timeobj = res.data;
- if(self.timeobj.avgtime == ""){
- self.timeobj.avgtime = 0;
- }
- if(self.timeobj.alltime == ""){
- self.timeobj.alltime = 0;
- }
- })
- },
- seeTime(){
- this.showTimeDlg = true;
- this.getRunTime();
- },
- closeTime(){
- this.showTimeDlg = false;
- },
- cancel(){
- this.showErrDlg = false;
- },
- reportError(){
- this.showErrDlg = true;
- },
- doReportError(){
- if(!this.errorMsg){
- this.$modal.showToast('异常信息不能为空')
- }else{
- let self = this;
- let errObj = {};
- errObj.deviceId = this.deviceInfo.deviceId;
- errObj.deviceName = this.deviceInfo.deviceName
- errObj.desc = this.errorMsg;
- errObj.deptId= this.deviceInfo.deptId;
- reportError(errObj).then(res=>{
- self.$modal.showToast(res.msg)
- self.cancel();
- })
- }
- },
- openLocation(){
- uni.openLocation({
- latitude: this.location.latitude,
- longitude: this.location.longitude,
- success: function () {
- console.log('success');
- }
- });
- },
- confirmItemData(e){
- let data = e.value[0];
- this.show.text = data.text;
- this.show.shadow=data.value;
- this.show = null;
- console.log(data);
- },
- send(){
- let shadow = false
- let _arr = []
- this.inputProp.forEach((item)=>{
- _arr.push(item.value)
- })
- // if(_arr.some(val => val === '' || val.length < 0)){
- // shadow = true
- // }
- if(this.deviceInfo.status != 3){
- uni.showToast({
- title:"设备暂未上线",
- icon:"error"
- })
- return;
- }
- if(shadow){
- uni.showToast({
- title:"数据不能为空",
- icon:"error"
- })
- return;
- }
- this.publishThingsModel(this.deviceInfo,this.inputProp.map(item=>{return{"id":item.id,"value":item.value}}))
- },
- /** 更新设备状态 */
- updateDeviceStatus(device) {
- },
- chooseItemData(data){
- if(this.deviceInfo.status != 3){
- uni.showToast({
- title:"设备暂未上线",
- icon:"error"
- })
- return;
- }
- this.columns = [data.enumList];
- this.show =data;
- },
- getDetail(){
- let self = this;
- getDetail(this.id).then(res=>{
- self.deviceInfo = res.data;
- self.location = {
- latitude: self.deviceInfo.latitude,
- longitude: self.deviceInfo.longitude};
- self.sysDept = self.deviceInfo.sysDept;
- self.parseSummay(res.data.summary)
- self.mqttSubscribe(res.data);
- self.getDeviceStatus();
- self.seeTime();
- self.summary[0].checked = true;
- });
- },
- getDeviceStatus(){
- let self = this;
- if(this.summary.length>1){
- }else{
- this.childId = 0;
- }
- getDeviceStatus(this.id,this.childId).then(res=>{
- let data =res.data;
- this.deviceInfo = data;
- self.parseStatusData(data)
- });
- },
- getNewDeviceStatus(item){
- console.log(item);
- let self = this;
- if(item.index == 0){
- this.firstTab = true;
- this.getDeviceStatus();
- }
- if(item.index == 1){
- this.firstTab = false;
- getDeviceStatus(this.id,0).then(res=>{
- let data =res.data;
- this.deviceInfo = data;
- self.parseStatusData(data)
- });
- }
- },
- changeSub(item){
- this.childId = item.id;
- this.getDeviceStatus()
- },
- parseEnumList(){
- let enumList = this.deviceInfo.enumList;
- for (let enumListElement of enumList) {
- let id = enumListElement.id;
- if(id.indexOf("LockControl") !=-1){
- let shadow = enumListElement.shadow;
- this.lock.item = enumListElement;
- if(shadow == 1){
- this.lock.value = true;
- this.lock.loading = false;
- }else if(shadow == 0){
- this.lock.value = false;
- this.lock.loading = false;
- }else{
- this.lock.loading = true;
- }
- }
- if(id.indexOf("PowerControl") !=-1){
- let shadow = enumListElement.shadow;
- if(this.oneToMul){
- if(!this.firstTab){
- if(shadow == 1){
- this.decoctControlOnOffStatus = true;
- }else if(shadow == 0){
- this.decoctControlOnOffStatus = false;
- }
- }
- }else{
- if(shadow == 1){
- this.decoctControlOnOffStatus = true;
- }else if(shadow == 0){
- this.decoctControlOnOffStatus = false;
- }
- }
- }
- if(id.indexOf("PowerCtl") !=-1){
- if(this.oneToMul && this.firstTab){
- let shadow = enumListElement.shadow;
- if(shadow == 1){
- this.decoctControlOnOffStatus = true;
- }else if(shadow == 0){
- this.decoctControlOnOffStatus = false;
- }
- }
- }
- this.formatValue(id,enumListElement,"PackagePowerControl","packageControlOnOffStatus")
- this.formatValue(id,enumListElement,"DecoctingSwitch","decoctControlStatus")
- this.formatValue(id,enumListElement,"CarrybagSwitch","qitingTurn")
- this.formatValue(id,enumListElement,"WashSwitch","qingxiTurn")
- this.formatValue(id,enumListElement,"PackageSwitch","baozhuangTurn");
- if(id.indexOf("WorkMode") !=-1){
- let shadow = enumListElement.shadow;
- if(!shadow){
- shadow = 1;
- }
- this.workMode = shadow;
- }
- let shadow = enumListElement.shadow
- let valueList = enumListElement.enumList;
- for (let valueObj of valueList){
- if(valueObj.value == shadow){
- enumListElement.text = valueObj.text;
- }
- }
- }
- },
- formatValue(id,enumListElement,key,propkey){
- if(id.indexOf(key) !=-1){
- let shadow = enumListElement.shadow;
- if(shadow == 1){
- this[propkey] = true;
- }else if(shadow == 0){
- this[propkey] = false;
- }
- }
- },
- parseStatusData(data){
- let self = this;
- cacheJsonThingsModel(data.productId).then(res=>{
- let thingsModel = JSON.parse(res.data);
- let arr = [];
- let arrayList = data.arrayList;
- arr = arr.concat(arrayList);
- let enumList = data.enumList;
- arr = arr.concat(enumList);
- let integerList = data.integerList;
- arr = arr.concat(integerList);
- let stringList = data.stringList;
- arr = arr.concat(stringList);
- self.inputProp = arr;
- for (let i = 0; i < thingsModel.functions.length; i++) {
- for (let j = 0; j < arr.length; j++) {
- let model = arr[j];
- if(model.id == thingsModel.functions[i].id){
- self.functions.push(model);
- }
- }
- }
- for (let i = 0; i < thingsModel.properties.length; i++) {
- for (let j = 0; j < arr.length; j++) {
- let model = arr[j];
- if(model.id == thingsModel.properties[i].id){
- self.properties.push(model);
- }
- }
- }
- let readOnlyList = data.readOnlyList;
- self.watchProp = readOnlyList;
- self.parseEnumList();
- self.parseProp();
- self.checkJianyao();
- })
- },
- showJianyao(){
- this.calcuStep();
- this.planIngPopDlg = true;
- },
- parseProp(){
- let self = this;
- for (let i = 0; i <self.inputProp.length; i++) {
- let prop = self.inputProp[i];
- let value = prop.shadow||0;
- let id = prop.id;
- if(id === "TimeSetting"){//温度设置
- self.temperatureTime = value;
- }
- if(id === "TempSetting"){
- self.temperature = value;
- }
- this.setPropValue(id,"SlowfireTiem","leftJianyaoTime",value,0)
- this.setPropValue(id,"HighTempTime","hightTemperature",value,0)
- this.setPropValue(id,"CurrentTemp","currentTemperature",value,0)
- this.setPropValue(id,"CalibrationTemp","jiaozhunTemp",value,0)
- this.setPropValue(id,"PackingVolume","packageVolume",value,50)
- this.setPropValue(id,"PackageQuantity","packageNumber",value,1)
- this.setPropValue(id,"SealTemp","sealingTemperature",value)
- this.setPropValue(id,"BandingTemp","edegTemperature",value)
- this.setPropValue(id,"SetSealTemp","setSealingTemperature",value,160)
- this.setPropValue(id,"SetBandingTemp","setEdegTemperature",value,160)
- this.setPropValue(id,"LeftAppointmentTime","leftAppointmentTime",value,0)
- self.propMap[id] = prop;
- }
- },
- setPropValue(id,key,propKey,value,defaultValue){
- if(!value && defaultValue){
- value = defaultValue;
- }
- if(id === key){
- this[propKey] = value;
- }
- },
- parseSummay(summary){
- let self = this;
- if(!summary){
- summary = "";
- }
- if(summary.length>0){
- this.summary = JSON.parse(summary);
- if(self.summary.length>0){
- this.oneToMul = true;
- for (let i = 0; i < self.summary.length; i++) {
- self.summary[i].tabName = self.summary[i].name
- }
- let childId = "";
- if(this.oneToMul){
- this.childId = self.summary[0].id;
- }
- }else{
- this.summary = [{name:"煎药机一"}]
- }
- }else{
- this.summary = [{name:"煎药机一"}]
- }
- },
- goDeviceDetail(id){
- uni.navigateTo({
- url: '/pages/device/detail/detail?id='+id
- });
- },
- async connectMqtt() {
- if (this.$mqttTool.client == null) {
- await this.$mqttTool.connect(this.vuex_token);
- }
- this.mqttCallback();
- this.startCheck();
- },
- /** Mqtt订阅主题 */
- mqttSubscribe(device) {
- // 订阅当前设备状态和实时监测
- let topicStatus = '/' + device.productId + '/' + device.serialNumber + '/status/post';
- let topicProperty = '/' + device.productId + '/' + device.serialNumber + '/property/post';
- let topicFunction = '/' + device.productId + '/' + device.serialNumber + '/function/post';
- let topics = [];
- topics.push(topicStatus);
- topics.push(topicProperty);
- topics.push(topicFunction);
- this.$mqttTool.subscribe(topics);
- },
- /** Mqtt取消订阅主题 */
- mqttUnSubscribe(device) {
- // 订阅当前设备状态和实时监测
- let topicStatus = '/' + device.productId + '/' + device.serialNumber + '/status/post';
- let topicProperty = '/' + device.productId + '/' + device.serialNumber + '/property/post';
- let topicFunction = '/' + device.productId + '/' + device.serialNumber + '/function/post';
- let topics = [];
- topics.push(topicStatus);
- topics.push(topicProperty);
- topics.push(topicFunction);
- console.log('取消订阅', topics);
- this.$mqttTool.unsubscribe(topics);
- },
- /* Mqtt回调处理 */
- mqttCallback() {
- this.$mqttTool.client.on('message', (topic, message, buffer) => {
- let topics = topic.split('/');
- let productId = topics[1];
- let deviceNum = topics[2];
- console.log('接收到内容:'+message);
- message = JSON.parse(message.toString());
- if (topics[3] == 'status') {
- console.log('接收到【设备状态-运行】主题:', topic);
- console.log('接收到【设备状态-运行】内容:', message);
- // 更新列表中设备的状态
- if (this.deviceInfo.serialNumber == deviceNum) {
- this.deviceInfo.status = message.status;
- this.deviceInfo.isShadow = message.isShadow;
- this.deviceInfo.rssi = message.rssi;
- this.updateDeviceStatus(this.deviceInfo);
- }
- }
- if (topics[3] == 'property' || topics[3] == 'function') {
- console.log('接收到【物模型】主题:', topic);
- console.log('接收到【物模型】内容:', message);
- if(this.oneToMul){
- let curTabId = this.childId;
- let msg = [];
- for (let i = 0; i < message.length; i++) {
- let curMsg = message[i];
- let id = curMsg.id;
- let ids = id.split("_");
- let value = curMsg.value;
- if(ids.length == 2){
- if(curTabId == ids[1]){
- msg.push({id:ids[0],value:value});
- }
- }else{
- msg.push(curMsg);
- }
- }
- message = msg;
- }
- // 更新列表中设备的属性
- if (this.deviceInfo.serialNumber == deviceNum) {
- for (let j = 0; j < message.length; j++) {
- let isComplete = false;
- let msgId = message[j].id;
- this.exchangeData(msgId,message[j]);
- // 布尔类型
- for (let k = 0; k < this.deviceInfo.boolList.length && !isComplete; k++) {
- if (this.deviceInfo.boolList[k].id == message[j].id) {
- this.deviceInfo.boolList[k].shadow = message[j].value;
- isComplete = true;
- break;
- }
- }
- // 枚举类型
- for (let k = 0; k < this.deviceInfo.enumList.length && !isComplete; k++) {
- if (this.deviceInfo.enumList[k].id == message[j].id) {
- this.deviceInfo.enumList[k].shadow = message[j].value;
- isComplete = true;
- break;
- }
- }
- // 字符串类型
- for (let k = 0; k < this.deviceInfo.stringList.length && !isComplete; k++) {
- if (this.deviceInfo.stringList[k].id == message[j].id) {
- this.deviceInfo.stringList[k].shadow = message[j].value;
- isComplete = true;
- break;
- }
- }
- // 数组类型
- for (let k = 0; k < this.deviceInfo.arrayList.length && !isComplete; k++) {
- if (this.deviceInfo.arrayList[k].id == message[j].id) {
- this.deviceInfo.arrayList[k].shadow = message[j].value;
- isComplete = true;
- break;
- }
- }
- // 整数类型
- for (let k = 0; k < this.deviceInfo.integerList.length && !isComplete; k++) {
- if (this.deviceInfo.integerList[k].id == message[j].id) {
- this.deviceInfo.integerList[k].shadow = message[j].value;
- isComplete = true;
- break;
- }
- }
- // 小数类型
- for (let k = 0; k < this.deviceInfo.decimalList.length && !isComplete; k++) {
- if (this.deviceInfo.decimalList[k].id == message[j].id) {
- this.deviceInfo.decimalList[k].shadow = message[j].value;
- isComplete = true;
- break;
- }
- }
- // 监测数据
- for (let k = 0; k < this.deviceInfo.readOnlyList.length && !isComplete; k++) {
- if (this.deviceInfo.readOnlyList[k].id == message[j].id) {
- this.deviceInfo.readOnlyList[k].shadow = message[j].value;
- // 更新图表
- // for (let m = 0; m < this.monitorChart.length; m++) {
- // if (message[j].id == this.monitorChart[m].data.id) {
- // let data = [{
- // value: message[j].value,
- // name: this.monitorChart[m].data.name
- // }];
- // this.monitorChart[m].chart.setOption({
- // series: [{
- // data: data
- // }]
- // });
- // break;
- // }
- // }
- isComplete = true;
- break;
- }
- }
- }
- this.parseEnumList();
- this.checkJianyao();
- if(this.planIngPopDlg){
- this.calcuStep();
- }
- }
- this.$forceUpdate();
- }
- });
- },
- checkJianyao(){
- // if(!this.jianyaoPopClose){
- // return;
- // }
- // let self = this;
- // setTimeout(function(){
- // if(self.decoctControlStatus){
- // self.showJianyao();
- // }
- // },1000);
- },
- exchangeData(msgId,obj){
- if(msgId === "TempSetting"){
- this.temperature = obj.value;
- }
- if(msgId === "TimeSetting"){
- this.temperatureTime = obj.value;
- }
- if(msgId === "CurrentTemp"){
- this.currentTemperature = obj.value;
- }
- if(msgId === "HighTempTime"){
- this.hightTemperature = obj.value;
- }
- if(msgId === "SealTemp"){
- if(!this.editing){
- this.sealingTemperature = obj.value;
- }
- }
- if(msgId === "BandingTemp"){
- if(!this.editing){
- this.edegTemperature = obj.value;
- }
- }
- if(msgId === "PackingVolume"){
- if(!this.editing){
- this.packageVolume = obj.value;
- }
- }
- if(msgId === "PackageQuantity"){
- if(!this.editing){
- this.packageNumber = obj.value;
- }
- }
- if(msgId === "LeftAppointmentTime"){
- this.leftAppointmentTime = obj.value;
- }
- if(msgId === "SlowfireTiem"){
- this.leftJianyaoTime = obj.value;
- }
- if(msgId === "CalibrationTemp"){
- this.jiaozhunTemp = obj.value;
- }
- },
- /** 发布物模型 类型(1=属性,2=功能) */
- publishThingsModel(device, model) {
- // 获取缓存的Json物模型
- cacheJsonThingsModel(device.productId).then(response => {
- let thingsModel = JSON.parse(response.data);
- let type = 0;
- for (let i = 0; i < thingsModel.functions.length; i++) {
- if (model.id == thingsModel.functions[i].id) {
- type = 2;
- break;
- }
- }
- if (type == 0) {
- for (let i = 0; i < thingsModel.properties.length; i++) {
- if (model.id == thingsModel.properties[i].id) {
- type = 1;
- break;
- }
- }
- }
- if (type != 0) {
- this.mqttPublish(type, device, [model]);
- }
- });
- },
- notifyError(res){
- uni.showToast({
- title:res,
- icon:"error"
- })
- },
- notifySuccess(res){
- uni.showToast({
- title:res,
- icon:"success"
- })
- },
- getDownloadUrl(path){
- return this.firmware.downUrl +"/iot/tool/download?fileName="+ path;
- },
- /**
- * Mqtt发布消息
- * @type 类型(1=属性,2=功能,3=OTA升级,4=实时监测)
- * @device 设备
- * @model 物模型
- * */
- mqttPublish(type, device, modelList,needMore) {
- if(this.deviceInfo.status != 3){
- this.notifyError("请等待设备上线后操作")
- return;
- }
- if(modelList.length == 0){
- return;
- }
- let topic = "";
- let message = ""
- let oneToMul = false;
- if(this.summary.length>1){
- oneToMul = true;
- }
- if(!needMore){
- oneToMul = false;
- }
- if(this.firstTab){
- let isKaijiKey = false;
- if(modelList.length >0){
- let modelData = modelList[0];
- let curKeyId = modelData.id;
- if(!this.decoctControlOnOffStatus){
- if(oneToMul){
- if(curKeyId.indexOf("PowerCtl") !=-1){
- isKaijiKey = true;
- }
- }else{
- if(curKeyId.indexOf("PowerControl") !=-1){
- isKaijiKey = true;
- }
- }
- }else{
- isKaijiKey = true;
- }
- }
- if(!isKaijiKey){
- this.notifyError("请先开机后再进行操作")
- return;
- }
- }else{
- let isKaijiKey = false;
- if(modelList.length >0){
- let modelData = modelList[0];
- let curKeyId = modelData.id;
- if(!this.packageControlOnOffStatus){
- if(curKeyId.indexOf("PackagePowerControl") !=-1){
- isKaijiKey = true;
- }
- }else{
- isKaijiKey = true;
- }
- }
- if(!isKaijiKey){
- this.notifyError("请先开机后再进行操作")
- return;
- }
- }
- if (type == 1) {
- if (device.status == 3) {
- // 属性,在线模式
- topic = "/" + device.productId + "/" + device.serialNumber + "/property-online/get";
- }
- } else if (type == 2) {
- if (device.status == 3) {
- // 功能,在线模式
- topic = "/" + device.productId + "/" + device.serialNumber + "/function-online/get";
- }
- } else if (type == 3) {
- // OTA升级
- topic = "/" + device.productId + "/" + device.serialNumber + "/ota/get";
- } else {
- return;
- }
- let title = "";
- if(type == 1){
- title = "属性";
- }else if(type == 2){
- title = "功能";
- }else if(type == 3){
- title = "升级";
- }
- if (topic != "") {
- // 发布
- let arr = [];
- for (let i = 0; i <modelList.length; i++) {
- let model = modelList[i];
- let modelId = model.id;
- if(oneToMul){
- let childId = this.childId;
- if(childId){
- modelId = modelId+"_"+childId;
- }
- }
- let shadow = model.shadow+"";
- let modelType = model.type;
- let shadowInt = parseInt(shadow,10);
- let isNumber = false;
- let shadowStr = shadowInt+"";
- if(shadowStr === shadow){
- isNumber = true;
- shadow = shadowInt;
- }
- if(modelType == "integer" && !isNumber){
- this.$modal.showToast(model.name+'的值必须是数字类型')
- return;
- }
- arr.push({id:modelId,value:shadow+""});
- }
- message = JSON.stringify(arr);
- let self = this;
- this.$mqttTool.publish(topic, message,title).then(res => {
- this.notifySuccess(res);
- }).catch(res => {
- this.notifyError(res);
- });
- }
- },
- startCheck(){
- let self = this;
- this.checkTimer = setTimeout(function (){
- self.sendHeart();
- self.startCheck();
- },20000);
- },
- checkActive(){
- let self = this;
- setTimeout(function (){
- if(self.publishMsg){
- self.resetConn()
- }
- },3000);
- },
- sendHeart(){
- console.log("发送心跳111")
- let device = this.deviceInfo;
- let self = this;
- let topic = "/property-offline/post";
- self.publishMsg = true;
- self.checkActive();
- this.$mqttTool.publish(topic, "ok", "heart").then(res => {
- self.publishMsg = false;
- }).catch(res => {
- self.publishMsg = false;
- });
- },
- resetConn(){
- console.log("检测异常,重连")
- this.$mqttTool.end();
- this.$mqttTool.client = null;
- this.connectMqtt();
- this.getDetail();
- }
- }
- }
- </script>
- <style>
- .send_btn{
- width: 160rpx !important;
- height: 40rpx !important;
- font-size: 10px !important;
- margin-top: 5px;
- }
- uni-col{
- width: 150px;
- }
- .header{
- width: 100%;
- background: white;
- padding:0px 20rpx;
- position: relative;
- height: 100vh;
- position: relative;
- }
- .content {
- display: flex;
- align-items: center;
- justify-content: center;
- color: #060B25;
- }
- .logo {
- height: 200rpx;
- width: 200rpx;
- margin-top: 200rpx;
- margin-left: auto;
- margin-right: auto;
- margin-bottom: 50rpx;
- }
- .text-area {
- margin:10px;
- padding-bottom: 10px;
- justify-content: center;
- width: 100%;
- }
- .grid-text {
- font-size: 14px;
- color: #909399;
- padding: 10rpx 0 20rpx 0rpx;
- /* #ifndef APP-PLUS */
- box-sizing: border-box;
- /* #endif */
- }
- .title {
- font-size: 36rpx;
- color: #8f8f94;
- }
- .item{
- height: 80rpx;
- line-height: 80rpx;
- }
- .bg{
- position: relative;
- }
- .text-left{
- color: #8A92A5;
- }
- .text-right{
- color: #545454;
- }
- .prop-text{
- position: relative;
- margin:20rpx 0;
- font-size: 26rpx;
- }
- .prop-card-area{
- }
- .prop-card{
- width: 28%;
- height: 100rpx;
- text-align: center;
- display: inline-block;
- background: #F5FCFF;
- box-shadow: 0px 9rpx 8rpx 0px rgba(0,0,0,0.09);
- border-radius: 8rpx;
- margin:0px 15rpx;
- line-height: 48rpx;
- }
- .prop-card-top{
- color: #3E9CFC;
- }
- .prop-card-bottom{
- color: #8A92A5;
- }
- .tab-area {
- background: white;
- position: absolute;
- left: 0px;
- right: 0px;
- top:480rpx;
- bottom:-20px;
- min-height: 200rpx;
- box-shadow: 0rpx 5rpx 27rpx 0rpx rgba(195, 195, 195, 0.4);
- border-radius: 40rpx;
- overflow-y: auto;
- padding-bottom:80rpx;
- }
- .prop-item{
- position: relative;
- display: flex;
- flex-direction: row;
- height: 100rpx;
- line-height: 100rpx;
- margin:0 20rpx;
- }
- .prop-item-left{
- color: #545454;
- width: 100%;
- font-size: 16px;
- border-bottom: 1px solid lightgray;
- margin-left: 120rpx;
- }
- .prop-item-image{
- width: 120rpx;
- height: 120rpx;
- position: absolute;
- bottom:-10rpx;
- }
- .prop-item-right{
- position: absolute;
- right:10rpx;
- top:5rpx;
- }
- input::-webkit-input-placeholder,textarea::-webkit-input-placeholder{
- color:#666;
- font-size:12px;
- }
- .clearfix::after {
- content: "";
- display: block;
- clear: both;
- }
- .decoctControlHeader {
- display: flex;
- align-items: center;
- font-weight: 600;
- }
- .decoctControlTop {
- display: flex;
- height: 240rpx;
- border-bottom:1px #B2B2B2 dotted;
- margin:0 40rpx;
- }
- .decoctControlTopLeft {
- width:40%;
- line-height: 2;
- text-align: center;
- margin: 0 15px;
- position: relative;
- }
- .addTemperature {
- border-radius:5px;
- position:absolute;
- background-color: dodgerblue;
- color:white;
- width: 30px;
- height: 30px;
- left:15px;
- top:80px;
- }
- .addTemperatureBtn {
- border-radius:10px;
- position:absolute;
- clip-path: polygon(50% 0,100% 100%,0 100%);
- transform: scale(0.5);
- left: 0;
- top:0;
- bottom: 0;
- right: 0;
- margin: auto;
- }
- .subTemperature {
- border-radius:5px;
- position:absolute;
- background-color: dodgerblue;
- color:white;
- width: 30px;
- height: 30px;
- right:15px;
- top:80px;
- }
- .subTemperatureBtn {
- border-radius:10px;
- position:absolute;
- clip-path: polygon(50% 0,100% 100%,0 100%);
- transform: scale(0.5);
- left: 0;
- top:0;
- bottom: 0;
- right: 0;
- margin: auto;
- }
- .decoctControlTopRight {
- width:40%;
- line-height: 2;
- text-align: center;
- margin: 0 15px;
- position: relative;
- }
- .decoctControlBottom {
- border-bottom:1px #B2B2B2 dotted;
- width:91vw;
- margin:0 auto;
- padding:10px;
- display: flex;
- justify-content:space-between;
- align-items: center;
- }
- .addTime {
- border-radius:5px;
- position:absolute;
- background-color: dodgerblue;
- color:white;
- width: 30px;
- height: 30px;
- left:15px;
- top:80px;
- }
- .addTimeBtn {
- border-radius:10px;
- position:absolute;
- clip-path: polygon(50% 0,100% 100%,0 100%);
- transform: scale(0.5);
- left: 0;
- top:0;
- bottom: 0;
- right: 0;
- margin: auto;
- }
- .subTime {
- border-radius:5px;
- position:absolute;
- background-color: dodgerblue;
- color:white;
- width: 30px;
- height: 30px;
- right:15px;
- top:80px;
- }
- .subTimeBtn {
- border-radius:10px;
- position:absolute;
- clip-path: polygon(50% 0,100% 100%,0 100%);
- transform: scale(0.5);
- left: 0;
- top:0;
- bottom: 0;
- right: 0;
- margin: auto;
- }
- .packageControlBottomRight {
- border-radius:5px;
- padding:5px 10px;
- margin-right: 15px;
- background-color: #3c9cff;
- color: #fff;
- }
- .packageControlBottomClear {
- border-radius:5px;
- padding:5px 10px;
- background-color: #B2B2B2;
- color: #fff;
- }
- .active_btn{
- background-color: #3c9cff;
- }
- .baozhuang-sub{
- right: 10rpx !important;
- }
- .baozhuang-add{
- left: 6rpx !important;
- }
- .control-input-box{
- display: flex;
- flex-direction: row;
- padding-left: 26rpx;
- }
- .control-input-box-danwei{
- padding-top:12rpx;
- margin-left:4rpx;
- }
- .tabs{
- position: relative;
- top:7vh;
- }
- .child_tab{
- position: relative;
- display: inline-block;
- width: 25%;
- height: 180rpx;
- }
- .child_img{
- width: 50rpx;
- height: 50rpx;
- left: 66rpx;
- top: 66rpx;
- position: relative;
- }
- .child_title{
- position: absolute;
- left: 0px;
- right: 0px;
- text-align: center;
- font-size: 12px;
- bottom: -12rpx;
- color: #060B25;
- }
- .control{
- width: 100%;
- margin-top:8vh;
- position: relative;
- }
- .control_item{
- position: relative;
- width: 50%;
- display: inline-block;
- height: 150rpx;
- }
- .control_item_detail{
- position: relative;
- top:22rpx;
- }
- .control_item_left{
- position:absolute;;
- left:22%;
- font-size: 55px;
- z-index: 999;
- top:-30rpx
- }
- .control_item_center{
- position:absolute;;
- left:34%;
- top:0vh;
- }
- .control_item_right{
- position:absolute;;
- left:67%;
- font-size: 34px;
- z-index: 999;
- }
- .control_item_center_unit{
- position: absolute;
- left:26vw;
- top: 0.8vh;
- width:200rpx;
- }
- .control_item_title{
- position: absolute;
- bottom:34rpx;
- font-size: 12px;
- width: 100%;
- text-align: center;
- }
- .bottom{
- height: 140rpx;
- position: absolute;
- left: 0px;
- width: 94%;
- margin: 0 3%;
- padding-top: 10rpx;
- }
- .bottom_item{
- display: inline-block;
- width: 25%;
- font-size: 12px;
- height: 100%;
- position: relative;
- text-align: center;
- margin-top: 2vh;
- }
- .active_on{
- color: #50ACFF;
- }
- .status_info{
- position: absolute;
- left: 5vw;
- top: 8vh;
- }
- .status_detail{
- display: flex;
- flex-direction: row;
- }
- .status_text{
- font-size: 16px;
- }
- .online_text{
- font-size: 12px;
- padding-top: 3px;
- }
- .online{
- color: #017128;
- }
- .device_info{
- font-size: 13px;
- }
- </style>
|