setting.vue 111 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882
  1. <template>
  2. <view class="content" >
  3. <view class="header" :style='"background-image:url("+imgUrl+"/detail/bg.png);background-repeat: no-repeat;background-size: 100% 200%;top:-5vh;height:110vh"'>
  4. <view v-if="isH5" @click='goBack()' style=" font-size: 16px;
  5. padding-top: 7px;
  6. position: absolute;
  7. top: 5vh;
  8. left: 20px;
  9. }">
  10. 返回
  11. </view>
  12. <view style=" background: white;
  13. margin-top: 59px;
  14. border-radius: 10px;">
  15. <view class="prop-item" @click="showJiaozhunProp" v-if="firstTab">
  16. <view class="prop-item-image">
  17. <image :src="imgUrl+'/setting/oper_temp.png'" style="width: 100%;height:100%;"/>
  18. </view>
  19. <view class="prop-item-left">温度校准</view>
  20. <view class="prop-item-right" >
  21. {{jiaozhunTemp}}℃<uni-icons type="forward" size="16"></uni-icons>
  22. </view>
  23. </view>
  24. <view class="prop-item" @click="toPlan" v-if="firstTab">
  25. <view class="prop-item-image" style="width: 60rpx;
  26. height: 60rpx;
  27. bottom: 22rpx;
  28. left: 26rpx;
  29. }">
  30. <image :src="imgUrl+'/setting/plan_oper.png?1'" style="width: 100%;height:100%;"/>
  31. </view>
  32. <view class="prop-item-left">预约</view>
  33. <view class="prop-item-right" >
  34. <uni-icons type="forward" size="16"></uni-icons>
  35. </view>
  36. </view>
  37. <view class="prop-item" v-if="firstTab && boardType == 5">
  38. <view class="prop-item-image">
  39. <image :src="imgUrl+'/setting/current_icon6.png'" style="width: 100%;height:100%;"/>
  40. </view>
  41. <view class="prop-item-left">当前扭力</view>
  42. <view class="prop-item-right" >
  43. {{validCurrent}}
  44. </view>
  45. </view>
  46. <view class="prop-item" @click="showLiuProp" v-if="firstTab && boardType == 5">
  47. <view class="prop-item-image">
  48. <image :src="imgUrl+'/setting/current_icon5.png'" style="width: 100%;height:100%;"/>
  49. </view>
  50. <view class="prop-item-left">扭力设置</view>
  51. <view class="prop-item-right" >
  52. {{turnCurrent}}<uni-icons type="forward" size="16"></uni-icons>
  53. </view>
  54. </view>
  55. <!-- <view class="prop-item" @click="showWorkPicker" v-if="firstTab">-->
  56. <!-- <view class="prop-item-image">-->
  57. <!-- <image :src="imgUrl+'/setting/list.png'" style="width: 100%;height:100%;"/>-->
  58. <!-- </view>-->
  59. <!-- <view class="prop-item-left">工作模式</view>-->
  60. <!-- <view class="prop-item-right" >-->
  61. <!-- <view v-if="workMode == 1">-->
  62. <!-- 1<uni-icons type="forward" size="16"></uni-icons>-->
  63. <!-- </view>-->
  64. <!-- <view v-if="workMode == 2">-->
  65. <!-- 2<uni-icons type="forward" size="16"></uni-icons>-->
  66. <!-- </view>-->
  67. <!-- <view v-if="workMode == 3">-->
  68. <!-- 3<uni-icons type="forward" size="16"></uni-icons>-->
  69. <!-- </view>-->
  70. <!-- </view>-->
  71. <!-- </view>-->
  72. <view class="prop-item">
  73. <view class="prop-item-image">
  74. <image :src="imgUrl+'/setting/no.png'" style="width: 100%;height:100%;"/>
  75. </view>
  76. <view class="prop-item-left">二维码编号</view>
  77. <view class="prop-item-right">
  78. <text class="text-right">{{deviceInfo.qrcodeId==null?"未绑定":deviceInfo.qrcodeId}}</text>
  79. </view>
  80. </view>
  81. <view class="prop-item">
  82. <view class="prop-item-image">
  83. <image :src="imgUrl+'/setting/no.png'" style="width: 100%;height:100%;"/>
  84. </view>
  85. <view class="prop-item-left">设备编号</view>
  86. <view class="prop-item-right">
  87. <text class="text-right">{{deviceInfo.serialNumber}}</text>
  88. </view>
  89. </view>
  90. <view class="prop-item" @click="skip(1)">
  91. <view class="prop-item-image">
  92. <image :src="imgUrl+'/setting/learn.png'" style="width: 100%;height:100%;"/>
  93. </view>
  94. <view class="prop-item-left">使用教程</view>
  95. <view class="prop-item-right" >
  96. <uni-icons type="forward" size="16"></uni-icons>
  97. </view>
  98. </view>
  99. <view class="prop-item" @click="skip(1)">
  100. <view class="prop-item-image">
  101. <image :src="imgUrl+'/setting/video.png'" style="width: 100%;height:100%;"/>
  102. </view>
  103. <view class="prop-item-left">维修视频</view>
  104. <view class="prop-item-right" >
  105. <uni-icons type="forward" size="16"></uni-icons>
  106. </view>
  107. </view>
  108. <view class="prop-item" @click="getUpdateInfo">
  109. <view class="prop-item-image">
  110. <image :src="imgUrl+'/setting/upload.png'" style="width: 100%;height:100%;"/>
  111. </view>
  112. <view class="prop-item-left">在线升级</view>
  113. <view class="prop-item-right" >
  114. <uni-icons type="forward" size="16"></uni-icons>
  115. </view>
  116. </view>
  117. <view class="prop-item" @click="skip(2)">
  118. <view class="prop-item-image">
  119. <image :src="imgUrl+'/setting/shou.png'" style="width: 100%;height:100%;"/>
  120. </view>
  121. <view class="prop-item-left">售后服务</view>
  122. <view class="prop-item-right" >
  123. <uni-icons type="forward" size="16"></uni-icons>
  124. </view>
  125. </view>
  126. <view class="prop-item" @click="reset">
  127. <view class="prop-item-image">
  128. <image :src="imgUrl+'/setting/reset.png'" style="width: 100%;height:100%;"/>
  129. </view>
  130. <view class="prop-item-left">恢复出厂</view>
  131. <view class="prop-item-right" >
  132. <uni-icons type="forward" size="16"></uni-icons>
  133. </view>
  134. </view>
  135. <view class="prop-item" @click="modifyName">
  136. <view class="prop-item-image">
  137. <image :src="imgUrl+'/setting/runinfo.png'" style="width: 100%;height:100%;"/>
  138. </view>
  139. <view class="prop-item-left">修改名称</view>
  140. <view class="prop-item-right" >
  141. <uni-icons type="forward" size="16"></uni-icons>
  142. </view>
  143. </view>
  144. </view>
  145. <u-popup :show="false" @close="closePop" mode="center" bgColor="transparent" :closeable="true" :round="10">
  146. <view style="position: relative;width: 500rpx;height:300rpx;background: none">
  147. <view class="control_item" style="width: 100%" v-if="fengbianDlgShow">
  148. <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
  149. <view class="control_item_detail">
  150. <view class="control_item_left" @click="subEdegTemperature(1)">-</view>
  151. <view class="control_item_center">
  152. <u-input customStyle="width:150rpx;border:0px;" disabledColor="white" @change="changeEdegTemperature" v-model="setEdegTemperature"></u-input>
  153. </view>
  154. <view class="control_item_center_unit" :style="unitFixedStyle1">℃</view>
  155. <view class="control_item_right" @click="addEdegTemperature(1)">+</view>
  156. </view>
  157. <view class="control_item_title">
  158. 封边温度设置
  159. </view>
  160. </view>
  161. <view class="control_item" style="width: 100%" v-if="fengkouDlgShow">
  162. <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
  163. <view class="control_item_detail">
  164. <view class="control_item_left" @click="subSealingTemperature(1)">-</view>
  165. <view class="control_item_center">
  166. <u-input customStyle="width:150rpx;border:0px;" disabledColor="white" @change="changeSealingTemperature" v-model="setSealingTemperature"></u-input>
  167. </view>
  168. <view class="control_item_center_unit" :style="unitFixedStyle1">℃</view>
  169. <view class="control_item_right" @click="addSealingTemperature(1)">+</view>
  170. </view>
  171. <view class="control_item_title">
  172. 封口温度设置
  173. </view>
  174. </view>
  175. <view class="control_item" style="width: 100%" v-if="wenhuoTimeDlgShow">
  176. <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
  177. <view class="control_item_detail">
  178. <view class="control_item_left" @click="subTemperatureTime()">-</view>
  179. <view class="control_item_center">
  180. <u-input customStyle="width:150rpx;border:0px;" disabledColor="white" @change="changeTemperatureTime()" v-model="temperatureTime"></u-input>
  181. </view>
  182. <view class="control_item_center_unit" :style="unitFixedStyle1">℃</view>
  183. <view class="control_item_right" @click="addTemperatureTime()">+</view>
  184. </view>
  185. <view class="control_item_title">
  186. 文火时间
  187. </view>
  188. </view>
  189. </view>
  190. </u-popup>
  191. <u-popup :show="planPopDlg" @close="closePlanPop" mode="center" :closeable="true" :round="10">
  192. <view style="position: relative;width: 400rpx;background: none;padding:40rpx;">
  193. <view class="control_item" style="width: 100%">
  194. <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
  195. <view class="control_item_detail">
  196. <view class="control_item_left" @click="subPlanTime(1)" style="left: 18%;">-</view>
  197. <view class="control_item_center">
  198. <view style="position: absolute">
  199. <u-input customStyle="width:150rpx;border:0px;" disabledColor="white" v-model="planTime"></u-input>
  200. </view>
  201. </view>
  202. <view class="control_item_center_unit" :style="unitFixedStyle">分钟</view>
  203. <view class="control_item_right" style="left: 80%;" @click="addPlanTime(1)">+</view>
  204. </view>
  205. <view class="control_item_title">
  206. 预约时间
  207. </view>
  208. </view>
  209. <view class="control_item" style="width: 100%">
  210. <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
  211. <view class="control_item_detail">
  212. <view class="control_item_left" @click="subTemperatureTime()" style="left: 18%;">-</view>
  213. <view class="control_item_center">
  214. <view style="position: absolute">
  215. <u-input customStyle="width:150rpx;border:0px;" disabledColor="white" @change="changeTemperatureTime()" v-model="temperatureTime"></u-input>
  216. </view>
  217. </view>
  218. <view class="control_item_center_unit" :style="unitFixedStyle">分钟</view>
  219. <view class="control_item_right" @click="addTemperatureTime()" style="left: 80%;">+</view>
  220. </view>
  221. <view class="control_item_title">
  222. 时间设置
  223. </view>
  224. </view>
  225. <view>
  226. <button style="background: white;" @click="plan">确认</button>
  227. </view>
  228. </view>
  229. </u-popup>
  230. <u-popup :show="erqibushuiDlg" @close="closeErqibushuiPop" mode="center" :closeable="true" :round="10">
  231. <view style="position: relative;width: 400rpx;background: none;padding:40rpx;">
  232. <view class="control_item" style="width: 100%">
  233. <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
  234. <view class="control_item_detail">
  235. <view class="control_item_left" @click="subErqibushui(1)" style="left: 18%;">-</view>
  236. <view class="control_item_center">
  237. <view style="position: absolute">
  238. <u-input customStyle="width:150rpx;border:0px;" disabledColor="white" v-model="secondAddWaterTime"></u-input>
  239. </view>
  240. </view>
  241. <view class="control_item_center_unit" :style="unitFixedStyle">分钟</view>
  242. <view class="control_item_right" style="left: 80%;" @click="addErqibushui(1)">+</view>
  243. </view>
  244. <view class="control_item_title">
  245. 二煎补水时间
  246. </view>
  247. </view>
  248. <view class="control_item" style="width: 100%">
  249. <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
  250. <view class="control_item_detail">
  251. <view class="control_item_center">
  252. <view style="position: absolute">
  253. <u-input customStyle="width:150rpx;border:0px;" disabledColor="white" v-model="currentSecondAddWaterTime"></u-input>
  254. </view>
  255. </view>
  256. <view class="control_item_center_unit" :style="unitFixedStyle">分钟</view>
  257. </view>
  258. <view class="control_item_title">
  259. 二煎补水剩余时间
  260. </view>
  261. </view>
  262. </view>
  263. </u-popup>
  264. <!-- 预约框-->
  265. <u-popup :show="yuyueIngPop" @close="closeYuyueIngPop" mode="center" :closeable="true" :round="10">
  266. <view style="position: relative;width: 400rpx;background: none;;padding:30rpx;padding-top:60rpx;">
  267. <view class="control_item" style="width: 100%">
  268. <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
  269. <view class="control_item_detail">
  270. <view class="control_item_center">
  271. <u-input customStyle="width:150rpx;border:0px;padding:0px" disabledColor="white" :value="leftAppointmentTime"></u-input>
  272. </view>
  273. <view class="control_item_center_unit" :style="unitFixedStyle">℃</view>
  274. </view>
  275. <view class="control_item_title">
  276. 剩余时间
  277. </view>
  278. </view>
  279. <view>
  280. <button style="background: white;" @click="cancelPlan">取消</button>
  281. </view>
  282. </view>
  283. </u-popup>
  284. <u-popup :show="planIngPopDlg" @close="closePlanIngPop" mode="center" :closeable="true" :round="10">
  285. <view style="position: relative;width: 400rpx;background: none;padding:40rpx;">
  286. <view class="control_item" style="width: 100%">
  287. <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
  288. <view class="control_item_detail" style="width: 100%; padding: 40rpx;margin-bottom:10rpx;">
  289. <u-line-progress :percentage="step" activeColor="#50ACFF"></u-line-progress>
  290. </view>
  291. <view class="control_item_title" v-if="leftAppointmentTime>0">
  292. 预约煎药中,倒计时{{leftAppointmentTime}}分钟
  293. </view>
  294. <view class="control_item_title" v-else>
  295. <view v-if="leftJianyaoTime>0">
  296. 正在熬制,请稍等
  297. </view>
  298. <view v-else>
  299. 煎药完成
  300. </view>
  301. </view>
  302. </view>
  303. <view class="control_item" style="width: 100%">
  304. <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
  305. <view class="control_item_detail">
  306. <view class="control_item_center">
  307. <u-input customStyle="width:150rpx;border:0px;" disabledColor="white" :value="currentTemperature"></u-input>
  308. </view>
  309. <view class="control_item_center_unit" :style="unitFixedStyle">℃</view>
  310. </view>
  311. <view class="control_item_title">
  312. 当前温度
  313. </view>
  314. </view>
  315. <view class="control_item" style="width: 100%">
  316. <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
  317. <view class="control_item_detail">
  318. <view class="control_item_center">
  319. <u-input customStyle="width:150rpx;border:0px;" disabledColor="white" :value="leftJianyaoTime"></u-input>
  320. </view>
  321. <view class="control_item_center_unit" :style="unitFixedStyle">分钟</view>
  322. </view>
  323. <view class="control_item_title">
  324. 文火倒计时
  325. </view>
  326. </view>
  327. <!-- <view>-->
  328. <!-- <button style="background: white;" @click="cancelPlan">暂停</button>-->
  329. <!-- </view>-->
  330. </view>
  331. </u-popup>
  332. <u-popup :show="jiaozhunPopDlg" @close="closejiaozhunPop" mode="center" :closeable="true" :round="10">
  333. <view style="position: relative;width: 400rpx;background: none;padding:30rpx;padding-top:60rpx;">
  334. <view class="control_item" style="width: 100%">
  335. <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
  336. <view class="control_item_detail">
  337. <view class="control_item_left" @click="subJiaoZhunTemperature(1)" style="left: 18%;">-</view>
  338. <view class="control_item_center">
  339. <view style="position: absolute">
  340. <u-input customStyle="width:150rpx;border:0px;" disabledColor="white" v-model="jiaozhunTemp_temp"></u-input>
  341. </view>
  342. </view>
  343. <view class="control_item_center_unit" :style="unitFixedStyle">℃</view>
  344. <view class="control_item_right" @click="addJiaoZhunTemperature(1)" style="left: 80%;">+</view>
  345. </view>
  346. <view class="control_item_title">
  347. 校准温度
  348. </view>
  349. </view>
  350. <view>
  351. <button style="background: white;" @click="confirmJiaozhunTemp">确认</button>
  352. </view>
  353. </view>
  354. </u-popup>
  355. <u-popup :show="deviceYuyueIngPop" @close="closeDeviceYuyueIngPop" mode="center" :closeable="true" :round="10">
  356. <view style="position: relative;width: 400rpx;background: none;padding:30rpx;padding-top:60rpx;">
  357. <view class="control_item" style="width: 100%">
  358. <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
  359. <view class="control_item_detail">
  360. <view class="control_item_center">
  361. <u-input customStyle="width:150rpx;border:0px;padding:0px" disabledColor="white" :value="devicePlanInfo.minute"></u-input>
  362. </view>
  363. <view class="control_item_center_unit" :style="unitFixedStyle">分</view>
  364. </view>
  365. <view class="control_item_title">
  366. 剩余时间
  367. </view>
  368. </view>
  369. <view>
  370. <button style="background: white;" @click="cancelDevicePlan">取消</button>
  371. </view>
  372. </view>
  373. </u-popup>
  374. <u-popup :show="devicePlanPopDlg" @close="closeDevicePlanPop" mode="center" :closeable="true" :round="10">
  375. <view style="position: relative;width: 400rpx;background: none;padding:30rpx;padding-top:60rpx;">
  376. <view class="control_item" style="width: 100%">
  377. <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
  378. <view class="control_item_detail">
  379. <view class="control_item_left" @click="subDevicePlanTime(1)" style="left: 18%;">-</view>
  380. <view class="control_item_center">
  381. <view style="position: absolute">
  382. <u-input customStyle="width:150rpx;border:0px;" disabledColor="white" v-model="devicePlanTime"></u-input>
  383. </view>
  384. </view>
  385. <view class="control_item_center_unit" :style="unitFixedStyle">分钟</view>
  386. <view class="control_item_right" style="left: 80%;" @click="addDevicePlanTime(1)">+</view>
  387. </view>
  388. <view class="control_item_title">
  389. 预约时间
  390. </view>
  391. </view>
  392. <view>
  393. <button style="background: white;" @click="devicePlan">确认</button>
  394. </view>
  395. </view>
  396. </u-popup>
  397. <u-popup :show="liuzhuanPopDlg" @close="closeliuzhuanPop" mode="center" :closeable="true" :round="10">
  398. <view style="position: relative;width: 400rpx;background: none;padding:30rpx;padding-top:60rpx;">
  399. <view class="control_item" style="width: 100%">
  400. <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
  401. <view class="control_item_detail">
  402. <view class="control_item_center">
  403. <view style="position: absolute">
  404. <u-input customStyle="width:150rpx;border:0px;" disabledColor="white" v-model="setTurnCurrent"></u-input>
  405. </view>
  406. </view>
  407. <view class="control_item_center_unit" :style="unitFixedStyle">MA</view>
  408. </view>
  409. <view class="control_item_title">
  410. 扭力
  411. </view>
  412. </view>
  413. <view>
  414. <button style="background: white;" @click="confirmLiuzhuannCurrent">确认</button>
  415. </view>
  416. </view>
  417. </u-popup>
  418. <u-popup :show="baowenPopDlg" @close="closeBaowenPopDlg" mode="center" :closeable="true" :round="10">
  419. <view style="position: relative;width: 400rpx;background: none;padding:30rpx;padding-top:60rpx;">
  420. <view class="control_item" style="width: 100%">
  421. <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
  422. <view class="control_item_detail">
  423. <view class="control_item_left" @click="subBaowenTime(1)" style="left: 18%;">-</view>
  424. <view class="control_item_center">
  425. <view style="position: absolute">
  426. <u-input customStyle="width:150rpx;border:0px;" disabledColor="white" v-model="baowenTime"></u-input>
  427. </view>
  428. </view>
  429. <view class="control_item_center_unit" :style="unitFixedStyle">分钟</view>
  430. <view class="control_item_right" style="left: 80%;" @click="addBaowenTime(1)">+</view>
  431. </view>
  432. <view class="control_item_title">
  433. 保温时间
  434. </view>
  435. </view>
  436. <view class="control_item" style="width: 100%">
  437. <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
  438. <view class="control_item_detail">
  439. <view class="control_item_left" @click="subBaowenTemp(1)" style="left: 18%;">-</view>
  440. <view class="control_item_center">
  441. <view style="position: absolute">
  442. <u-input customStyle="width:150rpx;border:0px;" disabledColor="white" v-model="baowenTemp"></u-input>
  443. </view>
  444. </view>
  445. <view class="control_item_center_unit" :style="unitFixedStyle">℃</view>
  446. <view class="control_item_right" style="left: 80%;" @click="addBaowenTemp(1)">+</view>
  447. </view>
  448. <view class="control_item_title">
  449. 保温温度
  450. </view>
  451. </view>
  452. <view>
  453. <button style="background: white;" @click="doBaowenSeting" v-if="!hasBaowen">确认添加</button>
  454. <button style="background: white;" @click="delBaowenSetting" v-if="hasBaowen">取消保温</button>
  455. </view>
  456. </view>
  457. </u-popup>
  458. <u-picker :show="showModelPicker" @cancel="closeModelPicker" @confirm="confirmMode" :columns="modeList" keyName="text"></u-picker>
  459. <u-picker :show="showYaofangPicker" @cancel="closeYaofangPicker" @confirm="confirmYaofang" :columns="yaofangList" keyName="text"></u-picker>
  460. </view>
  461. </view>
  462. </template>
  463. <script>
  464. import { getDetail,getDeviceStatus,cacheJsonThingsModel,reportError ,getDeviceRunTime,getLatestFirmware,bingDeviceDept,editDeviceName,getDevicePlan,addDevicePlan,delDevicePlan,saveBaowenSetting,getBaoWen,editBaowenSetting,cancelBaowen} from '@/api/device/device.js'
  465. import config from '@/config'
  466. import UPicker from "../../uni_modules/uview-ui/components/u-picker/u-picker";
  467. export default {
  468. components: {UPicker},
  469. data(){
  470. return {
  471. lineProgreeStyle:"width:0%;background:#50ACFF;height: 100%;",
  472. liuzhuanPopDlg:false,
  473. turnPercent:1,
  474. onlineStatus:false,
  475. modeList:[[
  476. {id:1,text:"1"},
  477. {id:2,text:"2"},
  478. {id:3,text:"3"},
  479. ]],
  480. yaofangList:[[
  481. {id:0,text:"一般药方"},
  482. {id:1,text:"解表药方"},
  483. {id:2,text:"滋补药方"},
  484. ]],
  485. productSize:"",
  486. productImage:"",
  487. showModelPicker:false,
  488. showYaofangPicker:false,
  489. unitFixedStyle:"",
  490. unitFixedStyle1:"",
  491. planTime:0,
  492. setSealingTemperature:160,
  493. setEdegTemperature:160,
  494. sealingTemperature:0,
  495. edegTemperature:0,
  496. hightTemperature:0,
  497. currentTemperature:0,
  498. temperatureTime:1,
  499. temperature:0,
  500. packageNumber:1,
  501. packageVolume:50,
  502. firstTab:true,
  503. decoctControlStatus:false,
  504. decoctControlOnOffStatus:false,
  505. packageControlOnOffStatus:false,
  506. subDecoctTabList:[
  507. {name:'子煎药1'},
  508. {name:'子煎药2'},
  509. {name:'子煎药3'},
  510. ],
  511. DecoctControlStatus:false,
  512. PackagControlStatus:false,
  513. baozhuangTurn:false,
  514. qitingTurn:false,
  515. qingxiTurn:false,
  516. subCurrent:0,
  517. current:0,
  518. inputStyle:{height:'44rpx','fontSize':'20rpx'},
  519. modelKey:['PowerControl','LockControl'],
  520. jianyaoKeys : ["TempSetting","TimeSetting","WaterVolume","AppointmentTime","TimeSettingFirst","TimeSettingSecond","SecondAddWaterTime"],
  521. baozhuangKeys:["SetSealTemp","SetBandingTemp","PackageQuantity","PackingVolume"],
  522. power:{
  523. loading:true,
  524. value:0,
  525. },
  526. lock:{
  527. loading:true,
  528. value:0,
  529. },
  530. showTimeDlg:false,
  531. showErrDlg:null,
  532. errorMsg:"asdasdasdasd",
  533. show:null,
  534. value:"",
  535. deviceInfo:{},
  536. id:0,
  537. summary:[
  538. ],
  539. tabs:[
  540. {tabName:"煎药控制"},
  541. {tabName:"包装控制"},
  542. ],
  543. activeName:0,
  544. childId:0,
  545. oneToMul:false,
  546. inputProp:[],
  547. watchProp:[],
  548. columns:[],
  549. location:{},
  550. sysDept:null,
  551. timeobj:{alltime:0,avgtime:0},
  552. publishMsg:false,
  553. checkTimer:null,
  554. functions:[],
  555. properties:[],
  556. propMap:{},
  557. jianyaoTimer:null,
  558. baozhuangTimer:null,
  559. editing:false,
  560. workMode:2,
  561. leftAppointmentTime:0,
  562. leftJianyaoTime:0,
  563. planEditTime:false,
  564. editWaterVolume:false,
  565. timeSettingFirst:0,
  566. currentTimeSettingFirst:0,
  567. timeSettingSecond:0,
  568. currentTimeSettingSecond:0,
  569. editTimeSettingFirst:false,
  570. editTimeSettingSecond:false,
  571. secondAddWaterTime:0,
  572. currentSecondAddWaterTime:0,
  573. imgUrl:"",
  574. popDlg:false,
  575. fengbianDlgShow:false,
  576. fengkouDlgShow:false,
  577. wenhuoTimeDlgShow:false,
  578. planPopDlg:false,
  579. erqibushuiDlg:false,
  580. planIngPopDlg:false,
  581. maxWidth:320,
  582. jiaozhunTemp:0,//校准温度,
  583. jiaozhunTemp_temp:0,//校准温度,
  584. jiaozhunPopDlg:false,
  585. step:0,
  586. yuyueIngPop:false,
  587. firmware:{},
  588. jianyaoPopClose:true,
  589. tabIndex:1,
  590. appid:"wxfd7b1a0e03e9b7e9",
  591. firstMachine:true,
  592. secondMachine:false,
  593. thirdMachine:false,
  594. forthMachine:true,
  595. deviceType:1,
  596. tabActive:[true,false,false],
  597. resetDuration:4000,
  598. jianyaoWenduSetting:false,
  599. jianyaoShijianSetting:false,
  600. baozhuangFengbianSetting:false,
  601. baozhuangFengkouSetting:false,
  602. baozhuangRongLiangSetting:false,
  603. baozhuangShuLIangSetting:false,
  604. tempFengkouWendu:0,
  605. tempFengBianWendu:0,
  606. boardType:6,//板子类型
  607. lineTimer:null,
  608. validCurrent:0,//当前扭力
  609. turnCurrent:0,//堵转电流值
  610. setTurnCurrent:0,
  611. pressTurn:0,
  612. resetTurn:0,
  613. drainageTurn:0,
  614. canGetPrsValue:false,//可以接收挤压的动画
  615. devicePlanInfo: {},//设备后台预约任务
  616. devicePlanPopDlg:false,
  617. deviceYuyueIngPop:false,
  618. baowenPopDlg:false,
  619. devicePlanTime:10,
  620. boardStyle:"",
  621. baowenTime:10,
  622. baowenTemp:100,
  623. hasBaowen:false,
  624. baowenId:0,
  625. jiashuiTurn:false,
  626. baowenTurn:false,
  627. waterVolume:5,
  628. currentWaterVolume:12,
  629. baowenSettingMode:false,
  630. baowenSettingTimer:null,
  631. baowenSettingSendTimer:null,
  632. wenwuhuoTurn:false,
  633. wenduSetting:false,
  634. wenduSettingTimer:null,
  635. planTimeSettingTimer:null,
  636. waterVolumeSettingTimer:null,
  637. timeSettingFirstSettingTimer:null,
  638. timeSettingSecondSettingTimer:null,
  639. workText:"·在线",
  640. isH5:false,
  641. jianyaoMode:0,
  642. yaofang:{
  643. type:0,
  644. name:"一般药方"
  645. }
  646. }
  647. },
  648. onLoad: function(opt) {
  649. this.id = opt.id;
  650. // this.id = 61;
  651. this.connectMqtt();
  652. this.getDetail();
  653. this.imgUrl = config.imgUrl
  654. // this.fixStyle();
  655. this.setSystemInfo();
  656. // this.fixImage();
  657. // console.log = function(){}
  658. },
  659. destroyed() {
  660. // 取消订阅主题
  661. this.mqttUnSubscribe(this.deviceInfo);
  662. clearTimeout(this.checkTimer);
  663. },
  664. watch: {
  665. turnPercent(newvalue){
  666. // this.lineProgreeStyle = ""
  667. this.lineProgreeStyle = "width:"+newvalue+"%;background:#50ACFF;height: 100%;";
  668. },
  669. pressTurn(newVal,oldValue) {
  670. // this.pressTurnChangeEvent(newVal);
  671. },
  672. resetTurn(newVal){
  673. // this.resetTurnChnageEvent(newVal);
  674. },
  675. decoctControlStatus(newVal,oldValue){
  676. console.log(newVal+",煎药");
  677. this.setStatusText();
  678. },
  679. currentTemperature(newVal){
  680. console.log(newVal+",当前温度");
  681. this.setStatusText();
  682. },
  683. temperature(newVal){
  684. console.log(newVal+",实时温度");
  685. this.setStatusText();
  686. }
  687. },
  688. methods:{
  689. setSystemInfo(){
  690. const systemInfo = uni.getSystemInfoSync();
  691. let uniPlatform = systemInfo.uniPlatform;
  692. if(uniPlatform == 'web' || uniPlatform == 'h5'){
  693. this.isH5 = true;
  694. }else{
  695. this.isH5 = false;
  696. }
  697. },
  698. setStatusText(){
  699. if(!this.jianyaoIng()){
  700. this.workText = "·在线";
  701. return;
  702. }
  703. if(this.currentTemperature>=this.temperature){
  704. this.workText = "·文火煎药";
  705. }else{
  706. this.workText = "·武火煎药";
  707. }
  708. },
  709. goBack(){
  710. uni.navigateBack();
  711. },
  712. pressTurnChangeEvent(newVal){
  713. },
  714. resetTurnChnageEvent(newVal){
  715. },
  716. closeDeviceYuyueIngPop(){
  717. this.deviceYuyueIngPop = false;
  718. },
  719. closeDevicePlanPop(){
  720. this.devicePlanPopDlg = false;
  721. },
  722. devicePlan(){
  723. let self = this;
  724. if(this.devicePlanTime>600){
  725. this.$modal.showToast('预约时间最大为600分钟')
  726. return;
  727. }
  728. if(this.devicePlanTime == 0){
  729. this.$modal.showToast('预约时间不能为空')
  730. }else{
  731. let child = this.childId;
  732. let obj = {deviceNo:this.deviceInfo.serialNumber+"&&"+child,minute:this.devicePlanTime};
  733. addDevicePlan(obj).then(res=>{
  734. self.getDevicePlanInfo();
  735. self.$modal.showToast('预约成功')
  736. self.devicePlanPopDlg = false;
  737. });
  738. }
  739. },
  740. closeliuzhuanPop(){
  741. this.liuzhuanPopDlg = false;
  742. },
  743. addBaowenTime(){
  744. console.log("增加保温时间")
  745. this.baowenTime++;
  746. this.sendBaowenSetting();
  747. },
  748. subBaowenTime(){
  749. console.log("减少保温时间")
  750. this.baowenTime--;
  751. if(this.baowenTime < 0){
  752. this.baowenTime = 0;
  753. }
  754. this.sendBaowenSetting();
  755. },
  756. subBaowenTemp(){
  757. this.baowenTemp--;
  758. if(this.baowenTemp<0){
  759. this.baowenTemp = 1;
  760. }
  761. console.log("减少保温温度")
  762. this.sendBaowenSetting();
  763. },
  764. addBaowenTemp(){
  765. console.log("增加保温温度")
  766. this.baowenTemp++;
  767. this.sendBaowenSetting();
  768. },
  769. closeBaowenPopDlg(){
  770. this.baowenPopDlg = false;
  771. },
  772. sendBaowenSetting(){
  773. this.resetBaowenTimer();
  774. if(this.baowenSettingSendTimer){
  775. clearTimeout(this.baowenSettingSendTimer);
  776. }
  777. let self = this;
  778. this.baowenSettingSendTimer = setTimeout(function(){
  779. self.doBaowenSeting();
  780. },500)
  781. },
  782. //6号板子的保温功能
  783. doBaowenSeting(){
  784. let arr = [];
  785. let pressObj = {};
  786. pressObj.id = "HoldingTemp";
  787. pressObj.shadow = this.baowenTemp;
  788. let baowen = {};
  789. baowen.id = "HoldingTime";
  790. baowen.shadow = this.baowenTime;
  791. arr.push(pressObj);
  792. arr.push(baowen);
  793. this.mqttPublish(2,this.deviceInfo,arr,true)
  794. },
  795. addBaowenSetting(){
  796. let self = this;
  797. let obj = {};
  798. obj.baowenTemp = this.baowenTemp;
  799. obj.baowenTime = this.baowenTime;
  800. obj.childId = this.childId;
  801. obj.productId = this.deviceInfo.productId;
  802. obj.status = 0;
  803. obj.deviceNo = this.deviceInfo.serialNumber;
  804. saveBaowenSetting(obj).then(res=>{
  805. let code = res.code;
  806. if(code == 200){
  807. self.$modal.showToast('添加成功')
  808. this.closeBaowenPopDlg();
  809. }else{
  810. self.$modal.showToast('已经存在保温设置')
  811. }
  812. });
  813. },
  814. editBaowenSetting(){
  815. let obj = {};
  816. obj.baowenTemp = this.baowenTemp;
  817. obj.baowenTime = this.baowenTime;
  818. obj.childId = this.childId;
  819. obj.productId = this.deviceInfo.productId;
  820. obj.status = 0;
  821. obj.id = this.baowenId;
  822. obj.deviceNo = this.deviceInfo.serialNumber;
  823. editBaowenSetting(obj).then(res=>{
  824. this.closeBaowenPopDlg();
  825. });
  826. },
  827. delBaowenSetting(){
  828. let obj = {};
  829. obj.id = this.baowenId;
  830. obj.status = 1;
  831. editBaowenSetting(obj).then(res=>{
  832. this.hasBaowen = false;
  833. this.baowenId = 0;
  834. this.closeBaowenPopDlg();
  835. });
  836. },
  837. confirmLiuzhuannCurrent(){
  838. if(this.setTurnCurrent<200 || this.setTurnCurrent>400){
  839. this.notifyError("扭力范围为200-400")
  840. return;
  841. }
  842. let arr = [];
  843. let pressObj = {};
  844. pressObj.id = "TurnCurrent";
  845. pressObj.shadow = this.setTurnCurrent;
  846. arr.push(pressObj);
  847. this.mqttPublish(2,this.deviceInfo,arr)
  848. this.closeliuzhuanPop();
  849. },
  850. setPressTurn(){
  851. let self = this;
  852. let arr = [];
  853. let currentPresturn = this.pressTurn;
  854. let pressObj = {};
  855. if(this.resetTurn == 1){
  856. this.resetTurn = 0;
  857. }
  858. if(currentPresturn == 1){//代表要关闭
  859. pressObj.id = "PressTurn";
  860. pressObj.shadow = 0;
  861. arr.push(pressObj);
  862. this.turnPercent = 0;
  863. this.pressTurn = 0;
  864. }else{//代表要开启
  865. pressObj.id = "PressTurn";
  866. pressObj.shadow = 1;
  867. arr.push(pressObj);
  868. this.pressTurn = 1;
  869. this.resetTurn = 0;
  870. }
  871. let resetObj = {}
  872. resetObj.id = "ResetTurn";
  873. resetObj.shadow = 0;
  874. arr.push(resetObj);
  875. this.mqttPublish(2,this.deviceInfo,arr,true);
  876. },
  877. startProgressTimer(type){
  878. let self = this;
  879. if(self.lineTimer != null){
  880. clearInterval(self.lineTimer)
  881. }
  882. if(type == 1){
  883. self.lineTimer = setInterval(function(){
  884. if(self.turnPercent >=100){
  885. self.turnPercent = 1;
  886. clearInterval(self.lineTimer);
  887. self.startProgressTimer(1);
  888. }
  889. self.turnPercent +=2;
  890. },100);
  891. }else{
  892. self.lineTimer = setInterval(function(){
  893. if(self.turnPercent >=100){
  894. self.turnPercent = 1;
  895. clearInterval(self.lineTimer);
  896. self.startProgressTimer(2);
  897. }
  898. self.turnPercent +=2;
  899. },100);
  900. }
  901. },
  902. setResetTurn(){
  903. let self = this;
  904. if(this.pressTurn == 1){
  905. this.pressTurn = 0;
  906. }
  907. let arr = [];
  908. if(this.resetTurn == 1){
  909. let resetObj = {};
  910. resetObj.id = "ResetTurn";
  911. resetObj.shadow = 0;
  912. this.resetTurn = 0;
  913. this.turnPercent = 0;
  914. arr.push(resetObj);
  915. }else{
  916. let resetObj = {};
  917. resetObj.id = "ResetTurn";
  918. resetObj.shadow = 1;
  919. this.resetTurn = 0;
  920. this.turnPercent = 0;
  921. arr.push(resetObj);
  922. }
  923. let pressObj = {};
  924. pressObj.id = "PressTurn";
  925. pressObj.shadow = 0;
  926. arr.push(pressObj);
  927. this.mqttPublish(2,this.deviceInfo,arr,true);
  928. },
  929. fixImage(heng){
  930. let self = this;
  931. wx.getSystemInfo({
  932. success: res => {
  933. const { windowWidth, windowHeight, statusBarHeight } = res;
  934. if(heng){
  935. let rate = 0.35;
  936. if(windowHeight<800){
  937. rate = 0.30;
  938. }
  939. let imgHeight = windowWidth*0.85;
  940. let imageWidth = windowWidth * 1;
  941. if(this.isH5){
  942. imgHeight = windowWidth*0.6;
  943. imageWidth = windowWidth * 0.8;
  944. }
  945. self.productSize = ";width:"+imageWidth+"px;height:"+imgHeight+"px;";
  946. }else{
  947. let rate = 0.35;
  948. if(windowHeight<800){
  949. rate = 0.30;
  950. }
  951. let imgHeight = windowHeight*rate;
  952. let imageWidth = imgHeight * 0.6;
  953. self.productSize = ";width:"+imageWidth+"px;height:"+imgHeight+"px;";
  954. }
  955. }
  956. })
  957. },
  958. propChange(type){
  959. // if(type == 1){
  960. // }
  961. },
  962. propFocus(type){
  963. if(type == 1){
  964. this.jianyaoWenduSetting = true;
  965. }
  966. if(type == 2){
  967. this.jianyaoShijianSetting = true;
  968. }
  969. if(type == 3){
  970. this.baozhuangFengbianSetting = true;
  971. this.tempFengBianWendu = this.edegTemperature;
  972. this.edegTemperature = this.setEdegTemperature;
  973. }
  974. if(type == 4){
  975. this.baozhuangFengkouSetting = true;
  976. this.tempFengkouWendu = this.sealingTemperature;
  977. this.sealingTemperature = this.setSealingTemperature;
  978. }
  979. if(type == 5){
  980. this.baozhuangRongLiangSetting = true;
  981. }
  982. if(type == 6){
  983. this.baozhuangShuLIangSetting = true;
  984. }
  985. },
  986. autoBlur(type){
  987. },
  988. propBlur(type){
  989. if(type == 1){
  990. this.jianyaoWenduSetting = false;
  991. this.changeTemperature();
  992. }
  993. if(type == 2){
  994. this.temperatureTime = this.leftJianyaoTime;
  995. this.changeTemperatureTime();
  996. }
  997. if(type == 3){
  998. this.setEdegTemperature = this.edegTemperature;
  999. this.changeEdegTemperature();
  1000. }
  1001. if(type == 4){
  1002. this.setSealingTemperature = this.sealingTemperature;
  1003. this.changeSealingTemperature();
  1004. }
  1005. if(type == 5){
  1006. this.changePackageVolume()
  1007. }
  1008. if(type == 6){
  1009. this.changePackageNumber();
  1010. }
  1011. if(type ==7){
  1012. this.sendWaterVolume();
  1013. }
  1014. if(type == 8){
  1015. this.sendPlanTime();
  1016. }
  1017. if(type == 9){
  1018. this.sendPlanTime(2);
  1019. }
  1020. if(type == 10){
  1021. this.sendBaowenSetting();
  1022. }
  1023. if(type == 11){
  1024. this.sendBaowenSetting();
  1025. }
  1026. },
  1027. modifyName(){
  1028. let self = this;
  1029. uni.showModal({
  1030. title: "修改设备名称",
  1031. editable: true,
  1032. placeholderText: "请输入设备名称",
  1033. content: this.deviceInfo.deviceName,
  1034. showCancel: true,
  1035. success: function (res) {
  1036. console.log(res);
  1037. if(res.confirm){
  1038. let content = res.content;
  1039. let obj = {"deviceId":self.id,deviceName:content};
  1040. editDeviceName(obj).then(res=>{
  1041. if(res.code == 200){
  1042. self.deviceInfo.deviceName = content;
  1043. self.$modal.showToast('修改成功')
  1044. }else{
  1045. self.$modal.showToast('修改失败,请稍后再试')
  1046. }
  1047. });
  1048. }
  1049. },
  1050. fail: function (res) {
  1051. console.log(res);
  1052. }
  1053. })
  1054. },
  1055. showWorkPicker(){
  1056. let self = this;
  1057. uni.showModal({
  1058. title: "提 示",
  1059. content: "非专业人员修改可能导致机器损坏",
  1060. confirmText:"确认",
  1061. success: function (res) {
  1062. if(res.confirm){
  1063. self.showModelPicker = true;
  1064. }
  1065. },
  1066. })
  1067. },
  1068. skip(type){
  1069. if(type == 1){
  1070. wx.navigateToMiniProgram({
  1071. appId: this.appid,
  1072. path: 'pages/news_details/help?id=25',
  1073. success(res) {
  1074. // 打开成功
  1075. },
  1076. fail(res){
  1077. console.log(res);
  1078. }
  1079. })
  1080. }else if(type == 2){
  1081. wx.openCustomerServiceChat({
  1082. extInfo: {url: 'https://work.weixin.qq.com/kfid/kfc4202b8764df71c0c'},
  1083. corpId: 'ww8e678fbe6f1079ba',
  1084. success(res) {
  1085. },
  1086. fail(res){
  1087. console.log(res);
  1088. }
  1089. })
  1090. }
  1091. },
  1092. isMulTab(index){
  1093. let type = this.deviceType;
  1094. if(this.secondMachine || this.secondMachine){
  1095. return true;
  1096. }
  1097. return false;
  1098. },
  1099. isPage(index){
  1100. if(this.tabIndex == index){
  1101. return true;
  1102. }
  1103. return false;
  1104. },
  1105. getUpdateInfo(){
  1106. let self = this;
  1107. getLatestFirmware(this.id).then(res=>{
  1108. self.firmware = res.data;
  1109. let curVersion = self.deviceInfo.firmwareVersion;
  1110. let onlineVersion = self.firmware.version
  1111. if(curVersion>=onlineVersion){
  1112. this.$modal.showToast('当前已经是最新版本')
  1113. }else{
  1114. uni.showModal({
  1115. title: '检测到新版本',
  1116. content: "当前版本:"+curVersion+",新版本:"+onlineVersion,
  1117. cancelText: '取消',
  1118. confirmText: '升级',
  1119. success: function(res) {
  1120. if (res.confirm) {
  1121. self.doUpdate();
  1122. }
  1123. }
  1124. })
  1125. }
  1126. });
  1127. },
  1128. doUpdate(){
  1129. if(this.deviceInfo.status != 3){
  1130. this.notifyError("请等待设备上线后操作")
  1131. return;
  1132. }
  1133. let device = this.deviceInfo;
  1134. let message = "";
  1135. let topic = "";
  1136. let title = "升级";
  1137. topic = "/" + device.productId + "/" + device.serialNumber + "/ota/get";
  1138. message = '{"version":"' + this.firmware.version + '","downloadUrl":"' + this.getDownloadUrl(this.firmware.filePath) + '","size":"'+this.firmware.size+'"}';
  1139. this.$mqttTool.publish(topic, message,title).then(res => {
  1140. this.notifySuccess(res);
  1141. }).catch(res => {
  1142. this.notifyError(res);
  1143. });
  1144. },
  1145. getStatusText(){
  1146. if(this.baozhuangRunning()){
  1147. return "工作中";
  1148. }
  1149. if(this.jianyaoIng()){
  1150. return "工作中";
  1151. }
  1152. if(this.leftAppointmentTime>0){
  1153. return "已预约";
  1154. }
  1155. return "空闲中";
  1156. },
  1157. closeYuyueIngPop(){
  1158. this.yuyueIngPop = false;
  1159. },
  1160. confirmMode(item){
  1161. console.log(item)
  1162. this.workMode = item.value[0].id;
  1163. this.setMode(this.workMode);
  1164. this.closeModelPicker();
  1165. },
  1166. closeModelPicker(){
  1167. this.showModelPicker = false;
  1168. },
  1169. confirmYaofang(item){
  1170. this.yaofang = {
  1171. type:item.value[0].id,
  1172. name:item.value[0].text
  1173. }
  1174. let arr = [];
  1175. let obj = {};
  1176. obj.id = "MedicineType";
  1177. obj.shadow = item.value[0].id;
  1178. arr.push(obj);
  1179. this.mqttPublish(2,this.deviceInfo,arr,true)
  1180. this.closeYaofangPicker();
  1181. },
  1182. closeYaofangPicker(){
  1183. this.showYaofangPicker = false;
  1184. },
  1185. confirmJiaozhunTemp(){
  1186. this.jiaozhunTemp = this.jiaozhunTemp_temp;
  1187. this.temperNumber();
  1188. this.closejiaozhunPop();
  1189. },
  1190. addJiaoZhunTemperature(){
  1191. this.jiaozhunTemp_temp ++;
  1192. if(this.jiaozhunTemp_temp>20){
  1193. this.jiaozhunTemp_temp = 20;
  1194. }
  1195. },
  1196. subJiaoZhunTemperature(){
  1197. this.jiaozhunTemp_temp --;
  1198. if(this.jiaozhunTemp_temp<-20){
  1199. this.jiaozhunTemp_temp = -20;
  1200. }
  1201. },
  1202. closejiaozhunPop(){
  1203. this.jiaozhunPopDlg = false;
  1204. },
  1205. showLiuProp(){
  1206. let self = this;
  1207. uni.showModal({
  1208. title: "提 示",
  1209. content: "非专业人员修改可能导致机器损坏",
  1210. confirmText:"确认",
  1211. success: function (res) {
  1212. if(res.confirm){
  1213. self.liuzhuanPopDlg = true;
  1214. }
  1215. },
  1216. })
  1217. },
  1218. showJiaozhunProp(){
  1219. let self = this;
  1220. uni.showModal({
  1221. title: "提 示",
  1222. content: "非专业人员修改可能导致机器损坏",
  1223. confirmText:"确认",
  1224. success: function (res) {
  1225. if(res.confirm){
  1226. self.jiaozhunTemp_temp = self.jiaozhunTemp;
  1227. self.jiaozhunPopDlg = true;
  1228. }
  1229. },
  1230. })
  1231. },
  1232. resetBaowenTimer(){
  1233. let self = this;
  1234. this.baowenSettingMode = true;
  1235. if(this.baowenSettingTimer != null){
  1236. clearTimeout(this.baowenSettingTimer)
  1237. }
  1238. this.baowenSettingTimer = setTimeout(function(){
  1239. self.baowenSettingMode = false;
  1240. },3000);
  1241. },
  1242. jinBaowenMode(){
  1243. let self = this;
  1244. if(!this.jianyaoOpen()){
  1245. this.notifyError("请先开机后再进行操作")
  1246. return;
  1247. }
  1248. if(this.jianyaoIng()){
  1249. this.$modal.showToast('必须在非煎药模式下才能设置')
  1250. return;
  1251. }
  1252. let arr = [];
  1253. let obj = {};
  1254. obj.id = "HoldingSwitch";
  1255. if(!this.baowenTurn){
  1256. obj.shadow = 1;
  1257. this.baowenTurn = true;
  1258. console.log("保温状态打开")
  1259. this.resetBaowenTimer();
  1260. }else{
  1261. this.baowenTurn = false;
  1262. obj.shadow = 0;
  1263. console.log("保温状态关闭")
  1264. }
  1265. arr.push(obj);
  1266. this.mqttPublish(2,this.deviceInfo,arr,true)
  1267. },
  1268. showBaowenProp(){
  1269. if(this.jianyaoIng()){
  1270. this.$modal.showToast('必须非煎药模式下才能设置')
  1271. return;
  1272. }
  1273. let obj = {};
  1274. obj.childId = this.childId;
  1275. obj.status =0;
  1276. obj.deviceNo = this.deviceInfo.serialNumber;
  1277. getBaoWen(obj).then(res=>{
  1278. let data = res.data;
  1279. if(data != null){
  1280. this.baowenTime = data.baowenTime;
  1281. this.baowenTemp = data.baowenTemp;
  1282. this.baowenId = data.id;
  1283. this.hasBaowen = true;
  1284. }else{
  1285. this.hasBaowen = false;
  1286. this.baowenId = 0;
  1287. }
  1288. this.baowenPopDlg = true;
  1289. });
  1290. },
  1291. fixStyle(){
  1292. let self = this;
  1293. wx.getSystemInfo({
  1294. success: res => {
  1295. const { windowWidth, windowHeight, statusBarHeight } = res;
  1296. // 在这里可以获取到屏幕的宽度和高度
  1297. console.log(windowWidth, windowHeight, statusBarHeight);
  1298. if(windowWidth<=350){
  1299. self.unitFixedStyle = ";padding-top:6px;left: 28vw;";
  1300. self.unitFixedStyle1 = ";padding-top:6px;left: 28vw;";
  1301. }else if(windowWidth>=360){
  1302. self.unitFixedStyle = ";padding-top:10rpx;";
  1303. self.unitFixedStyle1 = ";padding-top:10rpx;left: 32vw;";
  1304. }
  1305. self.maxWidth = windowWidth;
  1306. }
  1307. })
  1308. },
  1309. closePlanIngPop(){
  1310. this.jianyaoPopClose = false;
  1311. this.planIngPopDlg = false;
  1312. },
  1313. closePlanPop(){
  1314. this.planPopDlg = false;
  1315. },
  1316. closeErqibushuiPop(){
  1317. this.erqibushuiDlg = false;
  1318. },
  1319. showBaozhuangDlg(type){
  1320. this.popDlg = true;
  1321. if(type == 1){
  1322. this.fengbianDlgShow = true;
  1323. }else if(type == 2){
  1324. this.fengkouDlgShow = true;
  1325. }else if(type == 3){
  1326. this.wenhuoTimeDlgShow = true;
  1327. }
  1328. },
  1329. closePop(){
  1330. this.popDlg = false;
  1331. this.fengbianDlgShow = false;
  1332. this.fengkouDlgShow = false;
  1333. this.wenhuoTimeDlgShow = false;
  1334. },
  1335. changeTab(index,tag){
  1336. if(!tag){
  1337. return;
  1338. }
  1339. let type = this.deviceType;
  1340. let self = this;
  1341. if(index == 2 || index == 3){
  1342. if(!this.isMulTab(index)){
  1343. return;
  1344. }
  1345. }
  1346. this.resetChoose();
  1347. if(index == 4){
  1348. if(!this.forthMachine){
  1349. return;
  1350. }
  1351. uni.showLoading({title:"加载中"});
  1352. getDeviceStatus(this.id,0).then(res=>{
  1353. let data =res.data;
  1354. this.deviceInfo = data;
  1355. self.parseStatusData(data)
  1356. setTimeout(function () {
  1357. uni.hideLoading();
  1358. self.firstTab = false;
  1359. },100);
  1360. });
  1361. }else{
  1362. this.resetResetFunc();
  1363. let arr = ["a","b","c"]
  1364. if(this.isMulTab(index)){
  1365. this.childId =arr[index-1];
  1366. this.getDeviceStatus(function(){
  1367. self.tabIndex = index;
  1368. self.firstTab = true;
  1369. self.tabActive[index-1] = true;
  1370. self.$forceUpdate();
  1371. });
  1372. }else{
  1373. this.getDeviceStatus(function(){
  1374. self.tabIndex = index;
  1375. self.firstTab = true;
  1376. self.tabActive[index-1] = true;
  1377. self.$forceUpdate();
  1378. })
  1379. }
  1380. console.log(this.tabActive)
  1381. }
  1382. },
  1383. resetResetFunc(){
  1384. let self = this;
  1385. if(self.lineTimer != null){
  1386. clearInterval(self.lineTimer)
  1387. }
  1388. this.turnPercent = 0;
  1389. },
  1390. resetChoose(){
  1391. this.tabIndex = 0;
  1392. for (let i = 0; i < 3; i++) {
  1393. this.tabActive[i] = false;
  1394. }
  1395. },
  1396. changePackageVolume(){
  1397. if(this.packageVolume<50){
  1398. this.packageVolume = 50;
  1399. }
  1400. if(this.packageVolume>300){
  1401. this.packageVolume = 300;
  1402. }
  1403. this.sendBaozhuang("PackingVolume");
  1404. },
  1405. changePackageNumber(){
  1406. let min = 1;
  1407. let max = 999;
  1408. if(this.packageNumber<min){
  1409. this.packageNumber = min;
  1410. }
  1411. if(this.packageNumber>max){
  1412. this.packageNumber = max;
  1413. }
  1414. this.sendBaozhuang("PackageQuantity");
  1415. },
  1416. changeEdegTemperature(){
  1417. let min = 80;
  1418. let max = 220;
  1419. if(this.setEdegTemperature<min){
  1420. this.setEdegTemperature = min;
  1421. }
  1422. if(this.setEdegTemperature>max){
  1423. this.setEdegTemperature = max;
  1424. }
  1425. console.log("current setEdegTemperature is :"+this.setEdegTemperature)
  1426. this.sendBaozhuang("SetBandingTemp");
  1427. },
  1428. changeSealingTemperature(){
  1429. let min = 80;
  1430. let max = 220;
  1431. if(this.setSealingTemperature<min){
  1432. this.setSealingTemperature = min;
  1433. }
  1434. if(this.setSealingTemperature>max){
  1435. this.setSealingTemperature = max;
  1436. }
  1437. console.log("current setSealingTemperature is :"+this.setSealingTemperature)
  1438. this.sendBaozhuang("SetSealTemp");
  1439. },
  1440. changeTemperature(){
  1441. let max = 140;
  1442. let min = 100;
  1443. if(this.workMode == 2){
  1444. min = 1;
  1445. }
  1446. if(this.temperature<min){
  1447. this.temperature = min;
  1448. }
  1449. if(this.temperature>max){
  1450. this.temperature = max;
  1451. }
  1452. console.log("current temperature is :"+this.temperature)
  1453. this.sendJianYao("TempSetting");
  1454. },
  1455. changeTemperatureTime(){
  1456. let min = 1;
  1457. let max = 600;
  1458. if(this.temperatureTime<min){
  1459. this.temperatureTime = min;
  1460. }
  1461. if(this.temperatureTime>max){
  1462. this.temperatureTime = max;
  1463. }
  1464. console.log("current temperatureTime is :"+this.temperatureTime)
  1465. this.sendJianYao("TimeSetting");
  1466. },
  1467. jianyaoOpen(){
  1468. if(this.decoctControlOnOffStatus){
  1469. return true;
  1470. }
  1471. return false;
  1472. },
  1473. baozhuangOpen(){
  1474. if(this.packageControlOnOffStatus){
  1475. return true;
  1476. }
  1477. return false;
  1478. },
  1479. baozhuangRunning(){
  1480. if(this.qingxiTurn || this.baozhuangTurn || this.qitingTurn){
  1481. return true;
  1482. }
  1483. return false;
  1484. },
  1485. jianyaoIng(){
  1486. if(this.decoctControlStatus){
  1487. return true;
  1488. }
  1489. return false;
  1490. },
  1491. cancelPlan(){
  1492. let arr = [];
  1493. let obj = {};
  1494. obj.id = "AppointmentTime";
  1495. obj.shadow = 0;
  1496. arr.push(obj);
  1497. let self = this;
  1498. self.kongzhiJianyao(false,arr);
  1499. this.mqttPublish(2,this.deviceInfo,arr,true);
  1500. this.closeYuyueIngPop();
  1501. },
  1502. toPlan(){
  1503. if(!this.jianyaoOpen()){
  1504. this.$modal.showToast('煎药机已经关机')
  1505. return;
  1506. }
  1507. if(this.leftAppointmentTime>0){
  1508. this.yuyueIngPop = true;
  1509. }else{
  1510. if(this.jianyaoIng()){
  1511. this.$modal.showToast('正在煎药')
  1512. return;
  1513. }
  1514. this.planPopDlg = true;
  1515. }
  1516. },
  1517. toDevicePlan(){
  1518. let self = this;
  1519. if(this.decoctControlOnOffStatus){
  1520. this.$modal.showToast('请先关闭煎药后再预约')
  1521. return;
  1522. }
  1523. getDevicePlan(this.deviceInfo.serialNumber+"&&"+this.childId).then(res=>{
  1524. if(res.data != null){
  1525. self.deviceYuyueIngPop = true;
  1526. self.devicePlanInfo = res.data;
  1527. let minute = self.devicePlanInfo.minute;
  1528. if(minute<0){
  1529. minute = 10;
  1530. }
  1531. self.devicePlanInfo.minute = minute;
  1532. }else{
  1533. self.devicePlanPopDlg = true;
  1534. }
  1535. });
  1536. },
  1537. cancelDevicePlan(){
  1538. delDevicePlan(this.devicePlanInfo.id).then(res=>{
  1539. this.$modal.showToast('取消成功')
  1540. this.deviceYuyueIngPop = false;
  1541. this.devicePlanInfo = null;
  1542. })
  1543. },
  1544. getDevicePlanInfo(){
  1545. if(this.boardType != 4){
  1546. return;
  1547. }
  1548. let self = this;
  1549. self.devicePlanInfo = null;
  1550. getDevicePlan(this.deviceInfo.serialNumber+"&&"+self.childId).then(res=>{
  1551. if(res.data != null){
  1552. self.devicePlanInfo = res.data;
  1553. let minute = self.devicePlanInfo.minute;
  1554. if(minute<0){
  1555. minute = 10;
  1556. }
  1557. self.devicePlanInfo.minute = minute;
  1558. }
  1559. });
  1560. },
  1561. calcuStep(){
  1562. if(this.leftAppointmentTime>0){
  1563. this.step = 0;
  1564. return 0;
  1565. }
  1566. if(this.leftJianyaoTime == 0){
  1567. this.step = 100;
  1568. return ;
  1569. }
  1570. let currentTemperature = this.currentTemperature;
  1571. let hightTemperature = this.temperatureTime-this.leftJianyaoTime;//设置的高温时间
  1572. let targetTemperature =100;// this.temperature;
  1573. let targetTemperatureTime = this.temperatureTime;//倒计时
  1574. if(targetTemperature>100){
  1575. targetTemperature = 100;
  1576. }
  1577. let step = 0;
  1578. if(currentTemperature<100){
  1579. let tem = currentTemperature/200*100;
  1580. step = tem;
  1581. }else{
  1582. step = 50;
  1583. let rate = hightTemperature/targetTemperatureTime;
  1584. rate = rate/2;
  1585. rate = rate*100;
  1586. rate = rate.toFixed(2)
  1587. step = step + parseFloat(rate);
  1588. }
  1589. this.step = step.toFixed(2);
  1590. },
  1591. plan(){
  1592. let self = this;
  1593. if(this.planTime>600){
  1594. this.$modal.showToast('预约时间最大为600分钟')
  1595. return;
  1596. }
  1597. if(this.planTime == 0){
  1598. this.$modal.showToast('预约时间不能为空')
  1599. }else{
  1600. let arr = [];
  1601. let obj = {};
  1602. obj.id = "AppointmentTime";
  1603. obj.shadow = this.planTime;
  1604. arr.push(obj);
  1605. this.kongzhiJianyao(true,arr);
  1606. this.mqttPublish(2,this.deviceInfo,arr,true);
  1607. }
  1608. this.$modal.showToast('预约成功')
  1609. this.planPopDlg = false;
  1610. },
  1611. lockCtrl(key){
  1612. let arr = [];
  1613. let obj = {};
  1614. obj.id = "LockControl";
  1615. if(key == 0){
  1616. obj.shadow = 1;
  1617. this.lock.value = 1;
  1618. }else{
  1619. obj.shadow = 0;
  1620. this.lock.value = 0;
  1621. }
  1622. arr.push(obj);
  1623. this.mqttPublish(2,this.deviceInfo,arr)
  1624. },
  1625. setMode(type){
  1626. let arr = [];
  1627. let obj = {};
  1628. obj.id = "WorkMode";
  1629. obj.shadow = type;
  1630. arr.push(obj);
  1631. this.mqttPublish(2,this.deviceInfo,arr,true)
  1632. this.workMode = type;
  1633. },
  1634. temperNumber(value){
  1635. let arr = [];
  1636. let obj = {};
  1637. obj.id = "CalibrationTemp";
  1638. obj.shadow = this.jiaozhunTemp;
  1639. arr.push(obj);
  1640. this.mqttPublish(2,this.deviceInfo,arr,true)
  1641. },
  1642. volumeNumber(){
  1643. let arr = [];
  1644. let obj = {};
  1645. obj.id = "CapacityCalibration";
  1646. obj.shadow = 1;
  1647. arr.push(obj);
  1648. this.mqttPublish(2,this.deviceInfo,arr,true)
  1649. },
  1650. showConfirm(title,content,yes,no){
  1651. uni.showModal({
  1652. title: title,
  1653. content: content,
  1654. success: function (res) {
  1655. if (res.confirm) {
  1656. yes();
  1657. } else if (res.cancel) {
  1658. no();
  1659. }
  1660. }
  1661. });
  1662. },
  1663. reset(){
  1664. let self = this;
  1665. uni.showModal({
  1666. title: "提 示",
  1667. content: "非专业人员修改可能导致机器损坏",
  1668. confirmText:"确认",
  1669. success: function (res) {
  1670. if(res.confirm){
  1671. let arr = [];
  1672. let obj = {};
  1673. obj.id = "RestoreFactory";
  1674. obj.shadow = 1;
  1675. arr.push(obj);
  1676. self.mqttPublish(2,self.deviceInfo,arr)
  1677. }
  1678. },
  1679. })
  1680. },
  1681. paishui(){
  1682. let flag = false;
  1683. flag = this.drainageTurn == 1?true:false;
  1684. let arr = [];
  1685. let obj = {};
  1686. if(flag){
  1687. obj.shadow = 0;
  1688. }else{
  1689. obj.shadow = 1;
  1690. }
  1691. obj.id = "DrainageTurn";
  1692. arr.push(obj);
  1693. this.mqttPublish(2,this.deviceInfo,arr)
  1694. },
  1695. turnChange(type){
  1696. let flag = false;
  1697. let obj = {};
  1698. if(type ==3){
  1699. flag = this.qingxiTurn;
  1700. obj.id = "WashSwitch";
  1701. }else if(type == 2){
  1702. if(this.qingxiTurn || this.qitingTurn){
  1703. this.$modal.showToast("启停、包装、清洗不能同时打开")
  1704. return;
  1705. }
  1706. flag = this.baozhuangTurn;
  1707. obj.id = "PackageSwitch";
  1708. }else if(type == 1) {
  1709. if(this.qingxiTurn || this.baozhuangTurn){
  1710. this.$modal.showToast("启停、包装、清洗不能同时打开")
  1711. return;
  1712. }
  1713. flag = this.qitingTurn;
  1714. obj.id = "CarrybagSwitch";
  1715. }
  1716. flag = !flag;
  1717. let arr = [];
  1718. if(flag){
  1719. obj.shadow = 1;
  1720. }else{
  1721. obj.shadow = 0;
  1722. }
  1723. arr.push(obj);
  1724. this.mqttPublish(2,this.deviceInfo,arr)
  1725. },
  1726. addPackageVolume(){
  1727. this.packageVolume++;
  1728. if(this.packageVolume>300){
  1729. this.packageVolume = 50;
  1730. }
  1731. console.log("增加包装容量")
  1732. this.changePackageVolume()
  1733. },
  1734. subPackageVolume(){
  1735. this.packageVolume--;
  1736. if( this.packageVolume<50){
  1737. this.packageVolume = 300;
  1738. }
  1739. console.log("减少包装容量")
  1740. this.changePackageVolume()
  1741. },
  1742. addPackageNumber(){
  1743. this.packageNumber++;
  1744. if(this.packageNumber>999){
  1745. this.packageNumber = 1;
  1746. }
  1747. console.log("增加包装数量")
  1748. this.changePackageNumber();
  1749. },
  1750. subPackageNumber(){
  1751. this.packageNumber--;
  1752. if(this.packageNumber<1){
  1753. this.packageNumber = 999;
  1754. }
  1755. console.log("减少包装数量")
  1756. this.changePackageNumber();
  1757. },
  1758. addSealingTemperature(){
  1759. console.log("增加封口温度")
  1760. if(!this.fengkouDlgShow){
  1761. this.fengkouDlgShow = true;
  1762. }
  1763. this.setSealingTemperature++;
  1764. this.changeSealingTemperature();
  1765. },
  1766. subSealingTemperature(){
  1767. console.log("减少封口温度")
  1768. if(!this.fengkouDlgShow){
  1769. this.fengkouDlgShow = true;
  1770. }
  1771. this.setSealingTemperature--;
  1772. this.changeSealingTemperature();
  1773. },
  1774. addEdegTemperature(){
  1775. console.log("增加封边温度")
  1776. this.editing = true;
  1777. if(!this.fengbianDlgShow){
  1778. this.fengbianDlgShow = true;
  1779. }
  1780. this.setEdegTemperature++;
  1781. this.changeEdegTemperature();
  1782. },
  1783. subEdegTemperature(){
  1784. console.log("减少封边温度")
  1785. this.editing = true;
  1786. if(!this.fengbianDlgShow){
  1787. this.fengbianDlgShow = true;
  1788. }
  1789. this.setEdegTemperature--;
  1790. this.changeEdegTemperature();
  1791. },
  1792. subErqibushui(){
  1793. this.secondAddWaterTime--;
  1794. if(this.secondAddWaterTime <0){
  1795. this.secondAddWaterTime = 0
  1796. }
  1797. this.sendJianYao("SecondAddWaterTime")
  1798. },
  1799. addErqibushui(){
  1800. this.secondAddWaterTime++;
  1801. this.sendJianYao("SecondAddWaterTime")
  1802. },
  1803. addTemperatureTime(){
  1804. console.log("增加煎药时间")
  1805. if(!this.wenhuoTimeDlgShow){
  1806. this.wenhuoTimeDlgShow = true;
  1807. this.temperatureTime = this.leftJianyaoTime;
  1808. }
  1809. this.temperatureTime++;
  1810. this.changeTemperatureTime()
  1811. },
  1812. subTemperatureTime(){
  1813. console.log("减少煎药时间")
  1814. if(!this.wenhuoTimeDlgShow){
  1815. this.wenhuoTimeDlgShow = true;
  1816. this.temperatureTime = this.leftJianyaoTime;
  1817. }
  1818. this.temperatureTime--;
  1819. if(this.temperatureTime<=0){
  1820. this.temperatureTime = 1;
  1821. }
  1822. this.changeTemperatureTime()
  1823. },
  1824. addTemperature(){
  1825. console.log("增加煎药温度")
  1826. this.temperature++;
  1827. this.wenduSetting = true;
  1828. this.changeTemperature();
  1829. },
  1830. resetShowPlanTime(){
  1831. let self = this;
  1832. if(this.planTimeSettingTimer){
  1833. clearTimeout(this.planTimeSettingTimer);
  1834. }
  1835. this.planTimeSettingTimer = setTimeout(function(){
  1836. self.planEditTime = false;
  1837. },3000)
  1838. },
  1839. resetWaterVolume(){
  1840. let self = this;
  1841. if(this.waterVolumeSettingTimer){
  1842. clearTimeout(this.waterVolumeSettingTimer);
  1843. }
  1844. this.waterVolumeSettingTimer = setTimeout(function(){
  1845. self.editWaterVolume = false;
  1846. },3000)
  1847. },
  1848. resetTimeSettingFirst(){
  1849. let self = this;
  1850. if(this.timeSettingFirstSettingTimer){
  1851. clearTimeout(this.timeSettingFirstSettingTimer);
  1852. }
  1853. this.timeSettingFirstSettingTimer = setTimeout(function(){
  1854. self.editTimeSettingFirst = false;
  1855. },3000)
  1856. },
  1857. resetTimeSettingSecond(){
  1858. let self = this;
  1859. if(this.timeSettingSecondSettingTimer){
  1860. clearTimeout(this.timeSettingSecondSettingTimer);
  1861. }
  1862. this.timeSettingSecondSettingTimer = setTimeout(function(){
  1863. self.editTimeSettingSecond = false;
  1864. },3000)
  1865. },
  1866. resetShowWendu(){
  1867. let self = this;
  1868. if(this.wenduSettingTimer){
  1869. clearTimeout(this.wenduSettingTimer);
  1870. }
  1871. this.wenduSettingTimer = setTimeout(function(){
  1872. self.wenduSetting = false;
  1873. },3000)
  1874. },
  1875. subTimeFirst(){
  1876. this.timeSettingFirst = parseInt(this.timeSettingFirst) -1;
  1877. if(this.timeSettingFirst<0){
  1878. this.timeSettingFirst = 0;
  1879. }
  1880. this.editTimeSettingFirst = true;
  1881. this.sendJianYao("TimeSettingFirst");
  1882. },
  1883. addTimeFirst(){
  1884. this.timeSettingFirst = parseInt(this.timeSettingFirst) +1;
  1885. this.editTimeSettingFirst = true;
  1886. this.sendJianYao("TimeSettingFirst");
  1887. },
  1888. addTimeSecond(){
  1889. this.timeSettingSecond = parseInt(this.timeSettingSecond) +1;
  1890. this.editTimeSettingSecond = true;
  1891. this.sendJianYao("TimeSettingSecond");
  1892. },
  1893. subTimeSecond(){
  1894. this.timeSettingSecond = parseInt(this.timeSettingSecond) -1;
  1895. if(this.timeSettingSecond<0){
  1896. this.timeSettingSecond = 0
  1897. }
  1898. this.editTimeSettingSecond = true;
  1899. this.sendJianYao("TimeSettingSecond");
  1900. },
  1901. subWaterVolume(){
  1902. this.waterVolume = parseFloat(this.waterVolume) -0.1;
  1903. this.waterVolume = this.waterVolume.toFixed(1);
  1904. this.editWaterVolume = true;
  1905. this.sendWaterVolume();
  1906. },
  1907. addWaterVolume(){
  1908. this.waterVolume = parseFloat(this.waterVolume) +0.1;
  1909. this.waterVolume = this.waterVolume.toFixed(1);
  1910. this.editWaterVolume = true;
  1911. this.sendWaterVolume();
  1912. },
  1913. sendWaterVolume(){
  1914. if(this.waterVolume<0){
  1915. this.waterVolume = 0;
  1916. }
  1917. this.sendJianYao("WaterVolume");
  1918. },
  1919. subTemperature(type){
  1920. console.log("减少煎药温度")
  1921. this.temperature--;
  1922. this.wenduSetting = true;
  1923. this.changeTemperature();
  1924. },
  1925. changeJianyaoMode(mode){
  1926. let arr = [];
  1927. this.jianyaoMode = mode
  1928. let obj2 = {};
  1929. obj2.id = "JianyaoMode";
  1930. obj2.shadow = mode;
  1931. arr.push(obj2);
  1932. this.mqttPublish(2,this.deviceInfo,arr,true);
  1933. },
  1934. addPlanTime(type){
  1935. console.log("增加预约时间")
  1936. if(type == 2){
  1937. this.planTime = this.leftAppointmentTime;
  1938. }
  1939. this.planTime++;
  1940. this.planEditTime = true;
  1941. this.sendPlanTime(type);
  1942. },
  1943. subPlanTime(type){
  1944. console.log("减少预约时间")
  1945. if(type == 2){
  1946. this.planTime = this.leftAppointmentTime;
  1947. }
  1948. this.planEditTime = true;
  1949. this.planTime--;
  1950. this.sendPlanTime(type);
  1951. },
  1952. sendPlanTime(type){
  1953. if(this.planTime<0){
  1954. this.planTime = 0;
  1955. }
  1956. if(type == 2){
  1957. this.leftAppointmentTime = this.planTime;
  1958. }
  1959. this.sendJianYao("AppointmentTime");
  1960. },
  1961. subDevicePlanTime(){
  1962. this.devicePlanTime--;
  1963. if(this.devicePlanTime<0){
  1964. this.devicePlanTime = 1;
  1965. }
  1966. console.log("减少预约时间")
  1967. this.sendJianYao("AppointmentTime")
  1968. },
  1969. addDevicePlanTime(){
  1970. console.log("增加预约时间")
  1971. this.devicePlanTime++;
  1972. this.planEditTime = true;
  1973. this.sendJianYao("AppointmentTime")
  1974. },
  1975. sendBaozhuang(targetKey){
  1976. let self = this;
  1977. let arr = [];
  1978. if(this.baozhuangTimer != null){
  1979. clearTimeout(this.baozhuangTimer);
  1980. }
  1981. this.baozhuangTimer = setTimeout(function (){
  1982. for (let i = 0; i <this.baozhuangKeys.length; i++) {
  1983. let key = this.baozhuangKeys[i];
  1984. let obj = {};
  1985. obj.id = key;
  1986. if(key === "PackingVolume"){
  1987. obj.shadow = this.packageVolume;
  1988. setTimeout(function (){
  1989. self.baozhuangRongLiangSetting = false;
  1990. },self.resetDuration);
  1991. }
  1992. if(key === "PackageQuantity"){
  1993. obj.shadow = this.packageNumber;
  1994. setTimeout(function (){
  1995. self.baozhuangShuLIangSetting = false;
  1996. },self.resetDuration);
  1997. }
  1998. if(key === "SetSealTemp"){
  1999. obj.shadow = this.setSealingTemperature;
  2000. setTimeout(function (){
  2001. self.fengkouDlgShow = false;
  2002. self.baozhuangFengkouSetting = false;
  2003. self.sealingTemperature = self.tempFengKouWendu;;
  2004. },self.resetDuration);
  2005. }
  2006. if(key === "SetBandingTemp"){
  2007. obj.shadow = this.setEdegTemperature;
  2008. setTimeout(function (){
  2009. self.fengbianDlgShow = false;
  2010. self.baozhuangFengbianSetting = false;
  2011. self.edegTemperature = self.tempFengBianWendu;
  2012. },self.resetDuration);
  2013. }
  2014. if(targetKey == key){
  2015. arr.push(obj);
  2016. break;
  2017. }
  2018. }
  2019. this.mqttPublish(2,this.deviceInfo,arr)
  2020. }.bind(this),500);
  2021. },
  2022. sendJianYao(targetKey){
  2023. let self = this;
  2024. let arr = [];
  2025. if(this.jianyaoTimer != null){
  2026. clearTimeout(this.jianyaoTimer);
  2027. }
  2028. this.jianyaoTimer = setTimeout(function (){
  2029. for (let i = 0; i <this.jianyaoKeys.length; i++) {
  2030. let key = this.jianyaoKeys[i];
  2031. let obj = {};
  2032. obj.id = key;
  2033. if(key === "TempSetting"){
  2034. obj.shadow = this.temperature;
  2035. self.resetShowWendu();
  2036. }
  2037. if(key === "SecondAddWaterTime"){
  2038. obj.shadow = this.secondAddWaterTime;
  2039. }
  2040. if(key === "TimeSettingFirst"){
  2041. obj.shadow = this.timeSettingFirst
  2042. // setTimeout(function(){
  2043. // self.wenhuoTimeDlgShow = false;
  2044. // self.jianyaoShijianSetting = false;
  2045. // },self.resetDuration)
  2046. self.resetTimeSettingFirst()
  2047. }
  2048. if(key === "TimeSettingSecond"){
  2049. obj.shadow = this.timeSettingSecond
  2050. // setTimeout(function(){
  2051. // self.wenhuoTimeDlgShow = false;
  2052. // self.jianyaoShijianSetting = false;
  2053. // },self.resetDuration)
  2054. self.resetTimeSettingSecond()
  2055. }
  2056. if(key === "WaterVolume"){
  2057. obj.shadow = this.waterVolume*10;
  2058. self.resetWaterVolume();
  2059. }
  2060. if(key === "AppointmentTime"){
  2061. obj.shadow = this.planTime;
  2062. self.resetShowPlanTime();
  2063. }
  2064. if(key === "TimeSetting"){
  2065. obj.shadow = this.temperatureTime;
  2066. self.leftJianyaoTime = this.temperatureTime;;
  2067. setTimeout(function(){
  2068. self.wenhuoTimeDlgShow = false;
  2069. self.jianyaoShijianSetting = false;
  2070. },self.resetDuration)
  2071. }
  2072. if(targetKey == key){
  2073. arr.push(obj);
  2074. break;
  2075. }
  2076. }
  2077. this.mqttPublish(2,this.deviceInfo,arr,true)
  2078. }.bind(this),500);
  2079. },
  2080. buildPropKey(key){
  2081. if(this.childId !=0){
  2082. return key+"_"+this.childId;
  2083. }else{
  2084. return key;
  2085. }
  2086. },
  2087. addWater(){
  2088. if(!this.jianyaoOpen()){
  2089. this.notifyError("请先开机后再进行操作")
  2090. return;
  2091. }
  2092. if(this.jianyaoIng()){
  2093. this.$modal.showToast('必须在非煎药模式下才能设置')
  2094. return;
  2095. }
  2096. let obj = {};
  2097. let arr = [];
  2098. obj.id = "WaterSwitch";
  2099. if(!this.jiashuiTurn){
  2100. obj.shadow = 1;
  2101. console.log("加水状态打开")
  2102. }else{
  2103. obj.shadow = 0;
  2104. console.log("加水状态关闭")
  2105. }
  2106. arr.push(obj);
  2107. this.mqttPublish(2,this.deviceInfo,arr,true)
  2108. },
  2109. decoctControlChange(){
  2110. if(!this.decoctControlOnOffStatus){
  2111. this.notifyError("请先开机后再进行操作")
  2112. return;
  2113. }
  2114. if(this.decoctControlStatus){
  2115. this.stopDecoctControlChange();
  2116. return;
  2117. }
  2118. this.decoctControlStatus = !this.decoctControlStatus;
  2119. let arr = [];
  2120. let obj = {};
  2121. obj.id = "DecoctingSwitch";
  2122. if(this.decoctControlStatus){
  2123. obj.shadow = 1;
  2124. console.log("煎药状态打开")
  2125. this.checkJianyao();
  2126. }else{
  2127. obj.shadow = 0;
  2128. console.log("煎药状态关闭")
  2129. }
  2130. arr.push(obj);
  2131. this.mqttPublish(2,this.deviceInfo,arr,true)
  2132. },
  2133. kongzhiJianyao(flag,arr){//不判断煎药状态
  2134. let obj = {};
  2135. if(!this.decoctControlOnOffStatus){
  2136. this.notifyError("请先开机后再进行操作")
  2137. return;
  2138. }
  2139. obj.id = "DecoctingSwitch";
  2140. if(flag){
  2141. obj.shadow = 1;
  2142. console.log("煎药状态打开")
  2143. this.checkJianyao();
  2144. }else{
  2145. obj.shadow = 0;
  2146. console.log("煎药状态关闭")
  2147. }
  2148. arr.push(obj);
  2149. },
  2150. stopDecoctControlChange(){
  2151. let obj = {};
  2152. let arr = [];
  2153. if(!this.decoctControlOnOffStatus){
  2154. this.notifyError("请先开机后再进行操作")
  2155. return;
  2156. }
  2157. if(!this.decoctControlStatus){
  2158. return;
  2159. }
  2160. this.decoctControlStatus = !this.decoctControlStatus;
  2161. obj.id = "DecoctingSwitch";
  2162. if(this.decoctControlStatus){
  2163. obj.shadow = 1;
  2164. console.log("煎药状态打开")
  2165. }else{
  2166. obj.shadow = 0;
  2167. console.log("煎药状态关闭")
  2168. }
  2169. arr.push(obj);
  2170. let obj2 = {};
  2171. obj2.id = "AppointmentTime";
  2172. obj2.shadow = 0;
  2173. arr.push(obj2);
  2174. this.mqttPublish(2,this.deviceInfo,arr,true);
  2175. this.cancelBaowen();
  2176. },
  2177. cancelBaowen(){
  2178. let obj = {};
  2179. obj.childId = this.childId;
  2180. obj.productId = this.deviceInfo.productId;
  2181. obj.status = 0;
  2182. obj.deviceNo = this.deviceInfo.serialNumber;
  2183. cancelBaowen(obj);
  2184. },
  2185. decoctControlOnOffChange(){
  2186. let obj = {};
  2187. //4号板子预约是无法开启煎药的
  2188. if(!this.decoctControlOnOffStatus){
  2189. if(this.boardType == 4){
  2190. if(this.devicePlanInfo != null){
  2191. this.$modal.showToast('请先取消预约后再开机');
  2192. return;
  2193. }
  2194. }
  2195. }
  2196. this.decoctControlOnOffStatus = !this.decoctControlOnOffStatus;
  2197. let arr = [];
  2198. obj.id = "PowerControl";
  2199. let isMul = false;
  2200. if(this.boardType != 4){
  2201. if(this.decoctControlStatus){
  2202. this.$modal.showToast('请先结束煎药后操作')
  2203. this.decoctControlOnOffStatus = !this.decoctControlOnOffStatus;
  2204. return;
  2205. }
  2206. }
  2207. if(this.oneToMul && this.firstTab){
  2208. obj.id = "PowerCtl";
  2209. isMul = true;
  2210. }
  2211. if(this.decoctControlOnOffStatus){
  2212. obj.shadow = 1;
  2213. console.log("煎药机开关打开")
  2214. }else{
  2215. obj.shadow = 0;
  2216. console.log("煎药机开关关闭")
  2217. }
  2218. arr.push(obj);
  2219. this.mqttPublish(2,this.deviceInfo,arr,isMul)
  2220. },
  2221. packageControlOnOffChange(){
  2222. let obj = {};
  2223. let arr = [];
  2224. if(this.baozhuangRunning()){
  2225. this.$modal.showToast('请先停止运行后操作')
  2226. return;
  2227. }
  2228. obj.id = "PackagePowerControl";
  2229. this.packageControlOnOffStatus = !this.packageControlOnOffStatus;
  2230. if(this.packageControlOnOffStatus){
  2231. console.log("包装机器开关打开")
  2232. obj.shadow = 1;
  2233. }else{
  2234. console.log("包装机器开关关闭")
  2235. obj.shadow = 0;
  2236. }
  2237. arr.push(obj);
  2238. this.mqttPublish(2,this.deviceInfo,arr)
  2239. },
  2240. containKey(arr,key){
  2241. for (let i = 0; i < arr.length; i++) {
  2242. const data = arr[i];
  2243. if(data == key){
  2244. return true;
  2245. }
  2246. }
  2247. return false;
  2248. },
  2249. // 抽屉状态发生变化触发
  2250. change(e, type) {
  2251. console.log(e);
  2252. },
  2253. showDrawer() {
  2254. this.$refs.showLeft.open();
  2255. },
  2256. closeDrawer() {
  2257. this.$refs.showLeft.close();
  2258. },
  2259. checkItemValue(item){
  2260. if(!item.shadow){
  2261. item.shadow = 0;
  2262. }
  2263. if(!item.unit){
  2264. item.unit = "";
  2265. }
  2266. return true;
  2267. },
  2268. sendProperties(){
  2269. let properties = this.properties;
  2270. for (let i = 0; i < properties; i++) {
  2271. let property = this.properties[i];
  2272. let shadow = property.shadow;
  2273. if(shadow){
  2274. arr.push(property);
  2275. }
  2276. }
  2277. this.mqttPublish(1,this.deviceInfo,arr)
  2278. },
  2279. sendFunctions(){
  2280. let arr = [];
  2281. let functions = this.functions;
  2282. for (let i = 0; i < functions.length; i++) {
  2283. let functionObj = this.functions[i];
  2284. let shadow = functionObj.shadow;
  2285. if(shadow){
  2286. arr.push(functionObj);
  2287. }
  2288. }
  2289. this.mqttPublish(2,this.deviceInfo,arr)
  2290. },
  2291. changeProp(key,val){
  2292. let item = null;
  2293. let obj = null;
  2294. let oneToMul = this.oneToMul;
  2295. if(key === "LockControl"){
  2296. this.lock.value = val;
  2297. item = this.lock;
  2298. }else if(key === "PowerControl"){
  2299. this.power.value = val;
  2300. item = this.power;
  2301. }
  2302. let value = val;
  2303. obj = item.item;
  2304. if(value){
  2305. obj.value = 1;
  2306. obj.shadow = 1;
  2307. }else{
  2308. obj.value = 0;
  2309. obj.shadow = 0;
  2310. }
  2311. if(!oneToMul){
  2312. }
  2313. this.publishThingsModel(this.deviceInfo,obj);
  2314. },
  2315. checkCommonProp(item){
  2316. let id =item.id;
  2317. let isCommonKey = this.modelKey.some(res=>{
  2318. return id === res;
  2319. })
  2320. return !isCommonKey;
  2321. },
  2322. getRunTime(){
  2323. let self = this;
  2324. getDeviceRunTime(this.id).then(res=>{
  2325. self.timeobj = res.data;
  2326. if(self.timeobj.avgtime == ""){
  2327. self.timeobj.avgtime = 0;
  2328. }
  2329. if(self.timeobj.alltime == ""){
  2330. self.timeobj.alltime = 0;
  2331. }
  2332. })
  2333. },
  2334. seeTime(){
  2335. this.showTimeDlg = true;
  2336. this.getRunTime();
  2337. },
  2338. closeTime(){
  2339. this.showTimeDlg = false;
  2340. },
  2341. cancel(){
  2342. this.showErrDlg = false;
  2343. },
  2344. reportError(){
  2345. this.showErrDlg = true;
  2346. },
  2347. doReportError(){
  2348. if(!this.errorMsg){
  2349. this.$modal.showToast('异常信息不能为空')
  2350. }else{
  2351. let self = this;
  2352. let errObj = {};
  2353. errObj.deviceId = this.deviceInfo.deviceId;
  2354. errObj.deviceName = this.deviceInfo.deviceName
  2355. errObj.desc = this.errorMsg;
  2356. errObj.deptId= this.deviceInfo.deptId;
  2357. reportError(errObj).then(res=>{
  2358. self.$modal.showToast(res.msg)
  2359. self.cancel();
  2360. })
  2361. }
  2362. },
  2363. openLocation(){
  2364. uni.openLocation({
  2365. latitude: this.location.latitude,
  2366. longitude: this.location.longitude,
  2367. success: function () {
  2368. console.log('success');
  2369. }
  2370. });
  2371. },
  2372. confirmItemData(e){
  2373. let data = e.value[0];
  2374. this.show.text = data.text;
  2375. this.show.shadow=data.value;
  2376. this.show = null;
  2377. console.log(data);
  2378. },
  2379. send(){
  2380. let shadow = false
  2381. let _arr = []
  2382. this.inputProp.forEach((item)=>{
  2383. _arr.push(item.value)
  2384. })
  2385. // if(_arr.some(val => val === '' || val.length < 0)){
  2386. // shadow = true
  2387. // }
  2388. if(this.deviceInfo.status != 3){
  2389. uni.showToast({
  2390. title:"设备暂未上线",
  2391. icon:"error"
  2392. })
  2393. return;
  2394. }
  2395. if(shadow){
  2396. uni.showToast({
  2397. title:"数据不能为空",
  2398. icon:"error"
  2399. })
  2400. return;
  2401. }
  2402. this.publishThingsModel(this.deviceInfo,this.inputProp.map(item=>{return{"id":item.id,"value":item.value}}))
  2403. },
  2404. /** 更新设备状态 */
  2405. updateDeviceStatus(device) {
  2406. },
  2407. chooseItemData(data){
  2408. if(this.deviceInfo.status != 3){
  2409. uni.showToast({
  2410. title:"设备暂未上线",
  2411. icon:"error"
  2412. })
  2413. return;
  2414. }
  2415. this.columns = [data.enumList];
  2416. this.show =data;
  2417. },
  2418. getDetail(){
  2419. let self = this;
  2420. getDetail(this.id).then(res=>{
  2421. self.deviceInfo = res.data;
  2422. self.deviceType = res.data.type;
  2423. self.deviceType = 23
  2424. let msg = res.msg;
  2425. if(msg){
  2426. try{
  2427. msg = JSON.parse(msg+"");
  2428. }catch (e){
  2429. msg = null;
  2430. }
  2431. }
  2432. let productId = self.deviceInfo.productId;
  2433. if(productId === 57){
  2434. self.boardType = 6;
  2435. }
  2436. let online = self.deviceInfo.status == 3?true:false;
  2437. if(!online){
  2438. if(!self.onlineStatus){
  2439. uni.showModal({
  2440. title: '系统提示',
  2441. content: "设备未在线,无法操作",
  2442. confirmText: '确定',
  2443. showCancel:false,
  2444. success(res){
  2445. if(res.confirm){
  2446. self.onlineStatus = true;
  2447. }
  2448. },
  2449. })
  2450. }
  2451. }
  2452. if(msg != null){
  2453. let b = msg.b;
  2454. let c = msg.c;
  2455. let a = msg.a;
  2456. let d = msg.d;
  2457. if(a == 1){
  2458. self.firstMachine = true;
  2459. }else if(a == 0){
  2460. self.firstMachine = false;
  2461. }
  2462. if(b == 1){
  2463. self.secondMachine = true;
  2464. }else if(b == 0){
  2465. self.secondMachine = false;
  2466. }
  2467. if(c == 1){
  2468. self.thirdMachine = true;
  2469. }else if(c == 0){
  2470. self.thirdMachine = false;
  2471. }
  2472. if(d == 1){
  2473. self.forthMachine = true;
  2474. }else if(d==0){
  2475. self.forthMachine = false;
  2476. }
  2477. }
  2478. console.log("当前设备类型:"+JSON.stringify(self.deviceInfo.type))
  2479. self.location = {
  2480. latitude: self.deviceInfo.latitude,
  2481. longitude: self.deviceInfo.longitude};
  2482. self.sysDept = self.deviceInfo.sysDept;
  2483. self.parseSummay(res.data.summary)
  2484. self.mqttSubscribe(res.data);
  2485. self.getDeviceStatus();
  2486. self.seeTime();
  2487. let heng = false;
  2488. self.productImage = self.imgUrl+'/detail/product.png'
  2489. heng = self.setImage(self.deviceType);
  2490. let typeArr = [7,8,9,10,11,12,15];//单煎药机类型
  2491. for (let i = 0; i < typeArr.length; i++) {
  2492. let typeMa = typeArr[i];
  2493. if(typeMa == self.deviceType){
  2494. self.forthMachine = false;
  2495. }
  2496. }
  2497. self.fixImage(heng);
  2498. if(self.boardType == 4){
  2499. self.boardStyle = ";top:15vh;";
  2500. self.modeList=[[
  2501. {id:1,text:"1"},
  2502. {id:2,text:"2"}
  2503. ]];
  2504. }
  2505. self.$forceUpdate();
  2506. });
  2507. },
  2508. getDeviceStatus(func){
  2509. let self = this;
  2510. if(this.summary.length>1){
  2511. }else{
  2512. this.childId = 0;
  2513. }
  2514. uni.showLoading({title:"加载中"});
  2515. getDeviceStatus(this.id,this.childId).then(res=>{
  2516. let data =res.data;
  2517. this.deviceInfo = data;
  2518. self.parseStatusData(data)
  2519. self.getDevicePlanInfo();
  2520. setTimeout(function () {
  2521. uni.hideLoading();
  2522. if(typeof func == "function"){
  2523. func();
  2524. }
  2525. },50);
  2526. });
  2527. },
  2528. setImage(type){
  2529. let heng = false;
  2530. let self = this;
  2531. self.productImage = self.imgUrl+'/product/24.png'
  2532. return heng;
  2533. },
  2534. getNewDeviceStatus(item){
  2535. console.log(item);
  2536. let self = this;
  2537. if(item.index == 0){
  2538. this.firstTab = true;
  2539. this.getDeviceStatus();
  2540. }
  2541. if(item.index == 1){
  2542. this.firstTab = false;
  2543. getDeviceStatus(this.id,0).then(res=>{
  2544. let data =res.data;
  2545. this.deviceInfo = data;
  2546. self.parseStatusData(data)
  2547. });
  2548. }
  2549. },
  2550. changeSub(item){
  2551. this.childId = item.id;
  2552. this.getDeviceStatus()
  2553. },
  2554. parseEnumList(flag){
  2555. let enumList = this.deviceInfo.enumList;
  2556. for (let enumListElement of enumList) {
  2557. let id = enumListElement.id;
  2558. if(id == 'LockControl'){
  2559. let shadow = enumListElement.shadow;
  2560. this.lock.item = enumListElement;
  2561. if(shadow == 1){
  2562. this.lock.value = true;
  2563. this.lock.loading = false;
  2564. }else if(shadow == 0){
  2565. this.lock.value = false;
  2566. this.lock.loading = false;
  2567. }else{
  2568. this.lock.loading = true;
  2569. }
  2570. }
  2571. if(id == 'PowerControl'){
  2572. let shadow = enumListElement.shadow;
  2573. if(this.oneToMul){
  2574. if(!this.firstTab){
  2575. if(shadow == 1){
  2576. this.decoctControlOnOffStatus = true;
  2577. this.getDevicePlanInfo();
  2578. }else if(shadow == 0){
  2579. this.decoctControlOnOffStatus = false;
  2580. }
  2581. }
  2582. }else{
  2583. if(shadow == 1){
  2584. this.decoctControlOnOffStatus = true;
  2585. this.getDevicePlanInfo();
  2586. }else if(shadow == 0){
  2587. this.decoctControlOnOffStatus = false;
  2588. }
  2589. }
  2590. }
  2591. if(id == 'PowerCtl'){
  2592. if(this.oneToMul && this.firstTab){
  2593. let shadow = enumListElement.shadow;
  2594. if(shadow == 1){
  2595. this.decoctControlOnOffStatus = true;
  2596. this.getDevicePlanInfo();
  2597. }else if(shadow == 0){
  2598. this.decoctControlOnOffStatus = false;
  2599. }
  2600. }
  2601. }
  2602. if(id == 'MedicineType'){
  2603. let shadow = enumListElement.shadow;
  2604. if(!shadow){
  2605. shadow = 0;
  2606. }
  2607. let yaofangMap = {};
  2608. let enumList = enumListElement.enumList
  2609. for (let i = 0; i < enumList.length; i++) {
  2610. let yaofangEnum= enumList[i];
  2611. yaofangMap[yaofangEnum.value] = yaofangEnum.text;
  2612. }
  2613. this.yaofang = {
  2614. type:shadow,
  2615. name:yaofangMap[shadow+""]
  2616. }
  2617. }
  2618. this.formatValue(id,enumListElement,"PackagePowerControl","packageControlOnOffStatus")
  2619. this.formatValue(id,enumListElement,"DecoctingSwitch","decoctControlStatus")
  2620. this.formatValue(id,enumListElement,"CarrybagSwitch","qitingTurn")
  2621. this.formatValue(id,enumListElement,"WashSwitch","qingxiTurn")
  2622. this.formatValue(id,enumListElement,"PackageSwitch","baozhuangTurn");
  2623. this.formatValue(id,enumListElement,"DrainageTurn","drainageTurn");
  2624. //6号
  2625. this.formatValue(id,enumListElement,"WaterSwitch","jiashuiTurn");
  2626. this.formatValue(id,enumListElement,"HoldingSwitch","baowenTurn")
  2627. this.formatValue(id,enumListElement,"SlowHighswitch","wenwuhuoTurn")
  2628. //pressTurn resetTurn
  2629. if(id == 'PressTurn'){
  2630. let shadow = enumListElement.shadow;
  2631. if(!shadow){
  2632. shadow = 0;
  2633. }
  2634. if(shadow == 1){
  2635. this.pressTurn = 1;
  2636. this.resetTurn = 0;
  2637. }else{
  2638. this.pressTurn = 0;
  2639. }
  2640. this.pressTurnChangeEvent(shadow);
  2641. }
  2642. if(id == 'ResetTurn'){
  2643. let shadow = enumListElement.shadow;
  2644. if(!shadow){
  2645. shadow = 0;
  2646. }
  2647. if(shadow == 1){
  2648. this.resetTurn = 1;
  2649. this.pressTurn = 0;
  2650. }else{
  2651. this.resetTurn = 0;
  2652. }
  2653. this.resetTurnChnageEvent(shadow);
  2654. }
  2655. if(id == 'WorkMode'){
  2656. let shadow = enumListElement.shadow;
  2657. if(!shadow){
  2658. shadow = 1;
  2659. }
  2660. this.workMode = shadow;
  2661. }
  2662. let shadow = enumListElement.shadow
  2663. let valueList = enumListElement.enumList;
  2664. for (let valueObj of valueList){
  2665. if(valueObj.value == shadow){
  2666. enumListElement.text = valueObj.text;
  2667. }
  2668. }
  2669. }
  2670. },
  2671. formatValue(id,enumListElement,key,propkey){
  2672. if(id == key){
  2673. let shadow = enumListElement.shadow;
  2674. if(shadow == 1){
  2675. this[propkey] = true;
  2676. }else if(shadow == 0){
  2677. this[propkey] = false;
  2678. }
  2679. }
  2680. },
  2681. parseStatusData(data){
  2682. let self = this;
  2683. cacheJsonThingsModel(data.productId).then(res=>{
  2684. let thingsModel = JSON.parse(res.data);
  2685. let arr = [];
  2686. let arrayList = data.arrayList;
  2687. arr = arr.concat(arrayList);
  2688. let enumList = data.enumList;
  2689. arr = arr.concat(enumList);
  2690. let integerList = data.integerList;
  2691. arr = arr.concat(integerList);
  2692. let stringList = data.stringList;
  2693. arr = arr.concat(stringList);
  2694. let decimalList =data.decimalList
  2695. arr = arr.concat(decimalList);
  2696. self.inputProp = arr;
  2697. for (let i = 0; i < thingsModel.functions.length; i++) {
  2698. for (let j = 0; j < arr.length; j++) {
  2699. let model = arr[j];
  2700. if(model.id == thingsModel.functions[i].id){
  2701. self.functions.push(model);
  2702. }
  2703. }
  2704. }
  2705. for (let i = 0; i < thingsModel.properties.length; i++) {
  2706. for (let j = 0; j < arr.length; j++) {
  2707. let model = arr[j];
  2708. if(model.id == thingsModel.properties[i].id){
  2709. self.properties.push(model);
  2710. }
  2711. }
  2712. }
  2713. let readOnlyList = data.readOnlyList;
  2714. self.watchProp = readOnlyList;
  2715. self.parseEnumList();
  2716. self.parseProp();
  2717. self.checkJianyao();
  2718. })
  2719. },
  2720. showJianyao(){
  2721. this.calcuStep();
  2722. this.planIngPopDlg = true;
  2723. },
  2724. parseProp(){
  2725. let self = this;
  2726. for (let i = 0; i <self.inputProp.length; i++) {
  2727. let prop = self.inputProp[i];
  2728. let value = prop.shadow||0;
  2729. let id = prop.id;
  2730. if(id === "TimeSetting"){//温度设置
  2731. self.temperatureTime = value;
  2732. }
  2733. if(!self.jianyaoWenduSetting){
  2734. if(id === "TempSetting"){
  2735. self.temperature = value;
  2736. }
  2737. }
  2738. if(id == "WaterVolume"){
  2739. this.waterVolume = parseInt(value)/10;
  2740. }
  2741. if(id == "CurrentWaterVolume"){
  2742. this.currentWaterVolume = parseInt(value)/10;
  2743. }
  2744. this.setPropValue(id,"SlowfireTiem","leftJianyaoTime",value,0)
  2745. this.setPropValue(id,"HighTempTime","hightTemperature",value,0)
  2746. this.setPropValue(id,"CurrentTemp","currentTemperature",value,0)
  2747. this.setPropValue(id,"CalibrationTemp","jiaozhunTemp",value,0)
  2748. this.setPropValue(id,"PackingVolume","packageVolume",value,50)
  2749. this.setPropValue(id,"PackageQuantity","packageNumber",value,1)
  2750. //封边温度
  2751. this.setPropValue(id,"BandingTemp","edegTemperature",value);
  2752. this.setPropValue(id,"BandingTemp","tempFengBianWendu",value)
  2753. //封口温度
  2754. this.setPropValue(id,"SealTemp","sealingTemperature",value);
  2755. this.setPropValue(id,"SealTemp","tempFengKouWendu",value)
  2756. this.setPropValue(id,"LeftAppointmentTime","leftAppointmentTime",value,0)
  2757. this.setPropValue(id,"ValidCurrent","validCurrent",value,0)
  2758. this.setPropValue(id,"TurnCurrent","turnCurrent",value,0)
  2759. this.setPropValue(id,"HoldingTemp","baowenTemp",value,0)
  2760. this.setPropValue(id,"HoldingTime","baowenTime",value,0)
  2761. this.setPropValue(id,"AppointmentTime","planTime",value,0)
  2762. this.setPropValue(id,"TimeSettingFirst","timeSettingFirst",value,0)
  2763. this.setPropValue(id,"CurrentTimeSettingFirst","currentTimeSettingFirst",value,0)
  2764. this.setPropValue(id,"TimeSettingSecond","timeSettingSecond",value,0)
  2765. this.setPropValue(id,"CurrentTimeSettingSecond","currentTimeSettingSecond",value,0)
  2766. this.setPropValue(id,"SecondAddWaterTime","secondAddWaterTime",value,0)
  2767. this.setPropValue(id,"CurrentSecondAddWaterTime","currentSecondAddWaterTime",value,0)
  2768. this.setPropValue(id,"JianyaoMode","jianyaoMode",value,0)
  2769. self.propMap[id] = prop;
  2770. }
  2771. },
  2772. setPropValue(id,key,propKey,value,defaultValue){
  2773. if(!value && defaultValue){
  2774. value = defaultValue;
  2775. }
  2776. if(id === key){
  2777. this[propKey] = value;
  2778. }
  2779. },
  2780. parseSummay(summary){
  2781. let self = this;
  2782. if(!summary){
  2783. summary = "";
  2784. }
  2785. if(summary.length>0){
  2786. this.summary = JSON.parse(summary);
  2787. if(self.summary.length>0){
  2788. this.oneToMul = true;
  2789. for (let i = 0; i < self.summary.length; i++) {
  2790. self.summary[i].tabName = self.summary[i].name
  2791. }
  2792. let childId = "";
  2793. if(this.oneToMul){
  2794. this.childId = self.summary[0].id;
  2795. }
  2796. }else{
  2797. this.summary = [{name:"煎药机一"}]
  2798. }
  2799. }else{
  2800. this.summary = [{name:"煎药机一"}]
  2801. }
  2802. },
  2803. goDeviceDetail(id){
  2804. uni.navigateTo({
  2805. url: '/pages/device/detail/detail?id='+id
  2806. });
  2807. },
  2808. async connectMqtt() {
  2809. if (this.$mqttTool.client == null) {
  2810. await this.$mqttTool.connect(this.vuex_token);
  2811. }
  2812. this.mqttCallback();
  2813. this.startCheck();
  2814. },
  2815. /** Mqtt订阅主题 */
  2816. mqttSubscribe(device) {
  2817. // 订阅当前设备状态和实时监测
  2818. let topicStatus = '/' + device.productId + '/' + device.serialNumber + '/status/post';
  2819. let topicProperty = '/' + device.productId + '/' + device.serialNumber + '/property/post';
  2820. let topicFunction = '/' + device.productId + '/' + device.serialNumber + '/function/post';
  2821. let topics = [];
  2822. topics.push(topicStatus);
  2823. topics.push(topicProperty);
  2824. topics.push(topicFunction);
  2825. this.$mqttTool.subscribe(topics);
  2826. },
  2827. /** Mqtt取消订阅主题 */
  2828. mqttUnSubscribe(device) {
  2829. // 订阅当前设备状态和实时监测
  2830. let topicStatus = '/' + device.productId + '/' + device.serialNumber + '/status/post';
  2831. let topicProperty = '/' + device.productId + '/' + device.serialNumber + '/property/post';
  2832. let topicFunction = '/' + device.productId + '/' + device.serialNumber + '/function/post';
  2833. let topics = [];
  2834. topics.push(topicStatus);
  2835. topics.push(topicProperty);
  2836. topics.push(topicFunction);
  2837. console.log('取消订阅', topics);
  2838. this.$mqttTool.unsubscribe(topics);
  2839. },
  2840. /* Mqtt回调处理 */
  2841. mqttCallback() {
  2842. this.$mqttTool.client.on('message', (topic, message, buffer) => {
  2843. let topics = topic.split('/');
  2844. let productId = topics[1];
  2845. let deviceNum = topics[2];
  2846. console.log('接收到内容:'+message);
  2847. message = JSON.parse(message.toString());
  2848. if (topics[3] == 'status') {
  2849. console.log('接收到【设备状态-运行】主题:', topic);
  2850. console.log('接收到【设备状态-运行】内容:', message);
  2851. // 更新列表中设备的状态
  2852. if (this.deviceInfo.serialNumber == deviceNum) {
  2853. this.deviceInfo.status = message.status;
  2854. this.deviceInfo.isShadow = message.isShadow;
  2855. this.deviceInfo.rssi = message.rssi;
  2856. this.updateDeviceStatus(this.deviceInfo);
  2857. }
  2858. }
  2859. if (topics[3] == 'property' || topics[3] == 'function') {
  2860. console.log('接收到【物模型】主题:', topic);
  2861. console.log('接收到【物模型】内容:', message);
  2862. if(this.oneToMul){
  2863. let curTabId = this.childId;
  2864. let msg = [];
  2865. for (let i = 0; i < message.length; i++) {
  2866. let curMsg = message[i];
  2867. let id = curMsg.id;
  2868. let ids = id.split("_");
  2869. let value = curMsg.value;
  2870. if(ids.length == 2){
  2871. if(curTabId == ids[1]){
  2872. msg.push({id:ids[0],value:value});
  2873. }
  2874. }else{
  2875. msg.push(curMsg);
  2876. }
  2877. }
  2878. message = msg;
  2879. }
  2880. // 更新列表中设备的属性
  2881. if (this.deviceInfo.serialNumber == deviceNum) {
  2882. for (let j = 0; j < message.length; j++) {
  2883. let isComplete = false;
  2884. let msgId = message[j].id;
  2885. this.exchangeData(msgId,message[j]);
  2886. // 布尔类型
  2887. if(this.deviceInfo.boolList == null){
  2888. return;
  2889. }
  2890. for (let k = 0; k < this.deviceInfo.boolList.length && !isComplete; k++) {
  2891. if (this.deviceInfo.boolList[k].id == message[j].id) {
  2892. this.deviceInfo.boolList[k].shadow = message[j].value;
  2893. isComplete = true;
  2894. break;
  2895. }
  2896. }
  2897. // 枚举类型
  2898. for (let k = 0; k < this.deviceInfo.enumList.length && !isComplete; k++) {
  2899. if (this.deviceInfo.enumList[k].id == message[j].id) {
  2900. this.deviceInfo.enumList[k].shadow = message[j].value;
  2901. isComplete = true;
  2902. break;
  2903. }
  2904. }
  2905. // 字符串类型
  2906. for (let k = 0; k < this.deviceInfo.stringList.length && !isComplete; k++) {
  2907. if (this.deviceInfo.stringList[k].id == message[j].id) {
  2908. this.deviceInfo.stringList[k].shadow = message[j].value;
  2909. isComplete = true;
  2910. break;
  2911. }
  2912. }
  2913. // 数组类型
  2914. for (let k = 0; k < this.deviceInfo.arrayList.length && !isComplete; k++) {
  2915. if (this.deviceInfo.arrayList[k].id == message[j].id) {
  2916. this.deviceInfo.arrayList[k].shadow = message[j].value;
  2917. isComplete = true;
  2918. break;
  2919. }
  2920. }
  2921. // 整数类型
  2922. for (let k = 0; k < this.deviceInfo.integerList.length && !isComplete; k++) {
  2923. if (this.deviceInfo.integerList[k].id == message[j].id) {
  2924. this.deviceInfo.integerList[k].shadow = message[j].value;
  2925. isComplete = true;
  2926. break;
  2927. }
  2928. }
  2929. // 小数类型
  2930. for (let k = 0; k < this.deviceInfo.decimalList.length && !isComplete; k++) {
  2931. if (this.deviceInfo.decimalList[k].id == message[j].id) {
  2932. this.deviceInfo.decimalList[k].shadow = message[j].value;
  2933. isComplete = true;
  2934. break;
  2935. }
  2936. }
  2937. // 监测数据
  2938. for (let k = 0; k < this.deviceInfo.readOnlyList.length && !isComplete; k++) {
  2939. if (this.deviceInfo.readOnlyList[k].id == message[j].id) {
  2940. this.deviceInfo.readOnlyList[k].shadow = message[j].value;
  2941. // 更新图表
  2942. // for (let m = 0; m < this.monitorChart.length; m++) {
  2943. // if (message[j].id == this.monitorChart[m].data.id) {
  2944. // let data = [{
  2945. // value: message[j].value,
  2946. // name: this.monitorChart[m].data.name
  2947. // }];
  2948. // this.monitorChart[m].chart.setOption({
  2949. // series: [{
  2950. // data: data
  2951. // }]
  2952. // });
  2953. // break;
  2954. // }
  2955. // }
  2956. isComplete = true;
  2957. break;
  2958. }
  2959. }
  2960. }
  2961. this.parseEnumList(true);
  2962. this.checkJianyao();
  2963. if(this.planIngPopDlg){
  2964. this.calcuStep();
  2965. }
  2966. }
  2967. this.$forceUpdate();
  2968. }
  2969. });
  2970. },
  2971. checkJianyao(){
  2972. // if(!this.jianyaoPopClose){
  2973. // return;
  2974. // }
  2975. // let self = this;
  2976. // setTimeout(function(){
  2977. // if(self.decoctControlStatus){
  2978. // self.showJianyao();
  2979. // }
  2980. // },1000);
  2981. },
  2982. exchangeData(msgId,obj){
  2983. if(msgId === "TempSetting"){
  2984. this.temperature = obj.value;
  2985. }
  2986. if(msgId === "TimeSetting"){
  2987. this.temperatureTime = obj.value;
  2988. }
  2989. if(msgId === "CurrentTemp"){
  2990. this.currentTemperature = obj.value;
  2991. }
  2992. if(msgId === "HighTempTime"){
  2993. this.hightTemperature = obj.value;
  2994. }
  2995. if(msgId === "SealTemp"){//封口温度
  2996. if(!this.editing){
  2997. if(this.baozhuangFengkouSetting){
  2998. this.tempFengkouWendu = obj.value;
  2999. }else{
  3000. this.sealingTemperature = obj.value;
  3001. }
  3002. }
  3003. }
  3004. if(msgId === "BandingTemp"){//封边温度
  3005. if(!this.editing){
  3006. if(this.baozhuangFengbianSetting){
  3007. this.tempFengBianWendu = obj.value;
  3008. }else{
  3009. this.edegTemperature = obj.value;
  3010. }
  3011. }
  3012. }
  3013. if(msgId === "PackingVolume"){
  3014. if(!this.editing){
  3015. if(this.baozhuangRongLiangSetting){
  3016. }else{
  3017. this.packageVolume = obj.value;
  3018. }
  3019. }
  3020. }
  3021. if(msgId === "PackageQuantity"){
  3022. if(!this.editing){
  3023. if(this.baozhuangShuLIangSetting){
  3024. }else{
  3025. this.packageNumber = obj.value;
  3026. }
  3027. }
  3028. }
  3029. if(msgId === "LeftAppointmentTime"){
  3030. this.leftAppointmentTime = obj.value;
  3031. }
  3032. if(msgId === "SlowfireTiem"){
  3033. this.leftJianyaoTime = obj.value;
  3034. }
  3035. if(msgId === "CalibrationTemp"){
  3036. this.jiaozhunTemp = obj.value;
  3037. }
  3038. if(msgId === "TurnCurrent"){
  3039. this.turnCurrent = obj.value;
  3040. }
  3041. if(msgId === "ValidCurrent"){
  3042. this.validCurrent = obj.value;
  3043. }
  3044. if(msgId === "WaterVolume"){
  3045. this.waterVolume = parseInt(obj.value)/10;
  3046. }
  3047. if(msgId === "CurrentWaterVolume"){
  3048. this.currentWaterVolume = parseInt(obj.value)/10;
  3049. }
  3050. if(msgId === "HoldingTemp"){
  3051. this.baowenTemp = obj.value;
  3052. }
  3053. if(msgId === "HoldingTime"){
  3054. this.baowenTime = obj.value
  3055. }
  3056. if(msgId === "AppointmentTime"){
  3057. this.planTime = obj.value
  3058. }
  3059. if(msgId === "PressTurn"){
  3060. this.pressTurn = obj.value
  3061. }
  3062. if(msgId === "ResetTurn"){
  3063. this.resetTurn = obj.value
  3064. }
  3065. if(msgId === "DrainageTurn"){
  3066. this.drainageTurn = obj.value
  3067. }
  3068. if(msgId === "TimeSettingFirst"){
  3069. this.timeSettingFirst = obj.value;
  3070. }
  3071. if(msgId === "CurrentTimeSettingFirst"){
  3072. this.currentTimeSettingFirst = obj.value;
  3073. }
  3074. if(msgId === "TimeSettingSecond"){
  3075. this.timeSettingSecond = obj.value;
  3076. }
  3077. if(msgId === "CurrentTimeSettingSecond"){
  3078. this.currentTimeSettingSecond = obj.value;
  3079. }
  3080. if(msgId === "SecondAddWaterTime"){
  3081. this.secondAddWaterTime = obj.value;
  3082. }
  3083. if(msgId === "CurrentSecondAddWaterTime"){
  3084. this.currentSecondAddWaterTime = obj.value;
  3085. }
  3086. if(msgId = "JianyaoMode"){
  3087. this.jianyaoMode = obj.value;
  3088. }
  3089. },
  3090. /** 发布物模型 类型(1=属性,2=功能) */
  3091. publishThingsModel(device, model) {
  3092. // 获取缓存的Json物模型
  3093. cacheJsonThingsModel(device.productId).then(response => {
  3094. let thingsModel = JSON.parse(response.data);
  3095. let type = 0;
  3096. for (let i = 0; i < thingsModel.functions.length; i++) {
  3097. if (model.id == thingsModel.functions[i].id) {
  3098. type = 2;
  3099. break;
  3100. }
  3101. }
  3102. if (type == 0) {
  3103. for (let i = 0; i < thingsModel.properties.length; i++) {
  3104. if (model.id == thingsModel.properties[i].id) {
  3105. type = 1;
  3106. break;
  3107. }
  3108. }
  3109. }
  3110. if (type != 0) {
  3111. this.mqttPublish(type, device, [model]);
  3112. }
  3113. });
  3114. },
  3115. notifyError(res){
  3116. uni.showToast({
  3117. title:res,
  3118. icon:"error"
  3119. })
  3120. },
  3121. notifySuccess(res){
  3122. uni.showToast({
  3123. title:res,
  3124. icon:"success"
  3125. })
  3126. },
  3127. getDownloadUrl(path){
  3128. return this.firmware.downUrl +"/iot/tool/download?fileName="+ path;
  3129. },
  3130. /**
  3131. * Mqtt发布消息
  3132. * @type 类型(1=属性,2=功能,3=OTA升级,4=实时监测)
  3133. * @device 设备
  3134. * @model 物模型
  3135. * */
  3136. mqttPublish(type, device, modelList,needMore) {
  3137. if(this.deviceInfo.status != 3){
  3138. this.notifyError("请等待设备上线后操作")
  3139. return;
  3140. }
  3141. if(modelList.length == 0){
  3142. return;
  3143. }
  3144. let topic = "";
  3145. let message = ""
  3146. let oneToMul = false;
  3147. if(this.summary.length>1){
  3148. oneToMul = true;
  3149. }
  3150. if(!needMore){
  3151. oneToMul = false;
  3152. }
  3153. if(this.firstTab){
  3154. let isKaijiKey = false;
  3155. if(modelList.length >0){
  3156. let modelData = modelList[0];
  3157. let curKeyId = modelData.id;
  3158. if(!this.decoctControlOnOffStatus){
  3159. if(oneToMul){
  3160. if(curKeyId == 'PowerCtl'){
  3161. isKaijiKey = true;
  3162. }
  3163. }else{
  3164. if(curKeyId == 'PowerControl'){
  3165. isKaijiKey = true;
  3166. }
  3167. }
  3168. }else{
  3169. isKaijiKey = true;
  3170. }
  3171. }
  3172. // if(!isKaijiKey){
  3173. // this.notifyError("请先开机后再进行操作")
  3174. // return;
  3175. // }
  3176. }else{
  3177. let isKaijiKey = false;
  3178. if(modelList.length >0){
  3179. let modelData = modelList[0];
  3180. let curKeyId = modelData.id;
  3181. if(!this.packageControlOnOffStatus){
  3182. if(curKeyId == 'PackagePowerControl'){
  3183. isKaijiKey = true;
  3184. }
  3185. }else{
  3186. isKaijiKey = true;
  3187. }
  3188. }
  3189. if(!isKaijiKey){
  3190. this.notifyError("请先开机后再进行操作")
  3191. return;
  3192. }
  3193. }
  3194. if (type == 1) {
  3195. if (device.status == 3) {
  3196. // 属性,在线模式
  3197. topic = "/" + device.productId + "/" + device.serialNumber + "/property-online/get";
  3198. }
  3199. } else if (type == 2) {
  3200. if (device.status == 3) {
  3201. // 功能,在线模式
  3202. topic = "/" + device.productId + "/" + device.serialNumber + "/function-online/get";
  3203. }
  3204. } else if (type == 3) {
  3205. // OTA升级
  3206. topic = "/" + device.productId + "/" + device.serialNumber + "/ota/get";
  3207. } else {
  3208. return;
  3209. }
  3210. let title = "";
  3211. if(type == 1){
  3212. title = "属性";
  3213. }else if(type == 2){
  3214. title = "功能";
  3215. }else if(type == 3){
  3216. title = "升级";
  3217. }
  3218. if (topic != "") {
  3219. // 发布
  3220. let arr = [];
  3221. for (let i = 0; i <modelList.length; i++) {
  3222. let model = modelList[i];
  3223. let modelId = model.id;
  3224. if(oneToMul){
  3225. let childId = this.childId;
  3226. if(childId){
  3227. modelId = modelId+"_"+childId;
  3228. }
  3229. }
  3230. let shadow = model.shadow+"";
  3231. let modelType = model.type;
  3232. let shadowInt = parseInt(shadow,10);
  3233. let isNumber = false;
  3234. let shadowStr = shadowInt+"";
  3235. if(shadowStr === shadow){
  3236. isNumber = true;
  3237. shadow = shadowInt;
  3238. }
  3239. if(modelType == "integer" && !isNumber){
  3240. this.$modal.showToast(model.name+'的值必须是数字类型')
  3241. return;
  3242. }
  3243. arr.push({id:modelId,value:shadow+""});
  3244. }
  3245. message = JSON.stringify(arr);
  3246. let self = this;
  3247. this.$mqttTool.publish(topic, message,title).then(res => {
  3248. this.notifySuccess(res);
  3249. }).catch(res => {
  3250. this.notifyError(res);
  3251. });
  3252. }
  3253. },
  3254. startCheck(){
  3255. let self = this;
  3256. this.checkTimer = setTimeout(function (){
  3257. self.sendHeart();
  3258. self.startCheck();
  3259. },20000);
  3260. },
  3261. checkActive(){
  3262. let self = this;
  3263. setTimeout(function (){
  3264. if(self.publishMsg){
  3265. self.resetConn()
  3266. }
  3267. },3000);
  3268. },
  3269. sendHeart(){
  3270. console.log("发送心跳111")
  3271. let device = this.deviceInfo;
  3272. let self = this;
  3273. let topic = "/property-offline/post";
  3274. self.publishMsg = true;
  3275. self.checkActive();
  3276. this.$mqttTool.publish(topic, "ok", "heart").then(res => {
  3277. self.publishMsg = false;
  3278. }).catch(res => {
  3279. self.publishMsg = false;
  3280. });
  3281. },
  3282. resetConn(){
  3283. console.log("检测异常,重连")
  3284. this.$mqttTool.end();
  3285. this.$mqttTool.client = null;
  3286. this.connectMqtt();
  3287. this.getDetail();
  3288. }
  3289. }
  3290. }
  3291. </script>
  3292. <style>
  3293. .send_btn{
  3294. width: 160rpx !important;
  3295. height: 40rpx !important;
  3296. font-size: 10px !important;
  3297. margin-top: 5px;
  3298. }
  3299. uni-col{
  3300. width: 150px;
  3301. }
  3302. .header{
  3303. width: 100%;
  3304. background: white;
  3305. padding:0px 20rpx;
  3306. position: relative;
  3307. height: 100vh;
  3308. position: relative;
  3309. }
  3310. .content {
  3311. display: flex;
  3312. align-items: center;
  3313. justify-content: center;
  3314. color: #060B25;
  3315. }
  3316. .logo {
  3317. height: 200rpx;
  3318. width: 200rpx;
  3319. margin-top: 200rpx;
  3320. margin-left: auto;
  3321. margin-right: auto;
  3322. margin-bottom: 50rpx;
  3323. }
  3324. .text-area {
  3325. margin:10px;
  3326. padding-bottom: 10px;
  3327. justify-content: center;
  3328. width: 100%;
  3329. }
  3330. .grid-text {
  3331. font-size: 14px;
  3332. color: #909399;
  3333. padding: 10rpx 0 20rpx 0rpx;
  3334. /* #ifndef APP-PLUS */
  3335. box-sizing: border-box;
  3336. /* #endif */
  3337. }
  3338. .title {
  3339. font-size: 36rpx;
  3340. color: #8f8f94;
  3341. }
  3342. .item{
  3343. height: 80rpx;
  3344. line-height: 80rpx;
  3345. }
  3346. .bg{
  3347. position: relative;
  3348. }
  3349. .text-left{
  3350. color: #8A92A5;
  3351. }
  3352. .text-right{
  3353. color: #545454;
  3354. }
  3355. .prop-text{
  3356. position: relative;
  3357. margin:20rpx 0;
  3358. font-size: 26rpx;
  3359. }
  3360. .prop-card-area{
  3361. }
  3362. .prop-card{
  3363. width: 28%;
  3364. height: 100rpx;
  3365. text-align: center;
  3366. display: inline-block;
  3367. background: #F5FCFF;
  3368. box-shadow: 0px 9rpx 8rpx 0px rgba(0,0,0,0.09);
  3369. border-radius: 8rpx;
  3370. margin:0px 15rpx;
  3371. line-height: 48rpx;
  3372. }
  3373. .prop-card-top{
  3374. color: #3E9CFC;
  3375. }
  3376. .prop-card-bottom{
  3377. color: #8A92A5;
  3378. }
  3379. .tab-area {
  3380. background: white;
  3381. position: absolute;
  3382. left: 0px;
  3383. right: 0px;
  3384. top:480rpx;
  3385. bottom:-20px;
  3386. min-height: 200rpx;
  3387. box-shadow: 0rpx 5rpx 27rpx 0rpx rgba(195, 195, 195, 0.4);
  3388. border-radius: 40rpx;
  3389. overflow-y: auto;
  3390. padding-bottom:80rpx;
  3391. }
  3392. .prop-item{
  3393. position: relative;
  3394. display: flex;
  3395. flex-direction: row;
  3396. height: 100rpx;
  3397. line-height: 100rpx;
  3398. margin:0 20rpx;
  3399. }
  3400. .prop-item-left{
  3401. color: #545454;
  3402. width: 100%;
  3403. font-size: 16px;
  3404. border-bottom: 1px solid lightgray;
  3405. margin-left: 120rpx;
  3406. }
  3407. .prop-item-image{
  3408. width: 120rpx;
  3409. height: 120rpx;
  3410. position: absolute;
  3411. bottom:-10rpx;
  3412. }
  3413. .prop-item-right{
  3414. position: absolute;
  3415. right:10rpx;
  3416. top:5rpx;
  3417. }
  3418. input::-webkit-input-placeholder,textarea::-webkit-input-placeholder{
  3419. color:#666;
  3420. font-size:12px;
  3421. }
  3422. .clearfix::after {
  3423. content: "";
  3424. display: block;
  3425. clear: both;
  3426. }
  3427. .decoctControlHeader {
  3428. display: flex;
  3429. align-items: center;
  3430. font-weight: 600;
  3431. }
  3432. .decoctControlTop {
  3433. display: flex;
  3434. height: 240rpx;
  3435. border-bottom:1px #B2B2B2 dotted;
  3436. margin:0 40rpx;
  3437. }
  3438. .decoctControlTopLeft {
  3439. width:40%;
  3440. line-height: 2;
  3441. text-align: center;
  3442. margin: 0 15px;
  3443. position: relative;
  3444. }
  3445. .addTemperature {
  3446. border-radius:5px;
  3447. position:absolute;
  3448. background-color: dodgerblue;
  3449. color:white;
  3450. width: 30px;
  3451. height: 30px;
  3452. left:15px;
  3453. top:80px;
  3454. }
  3455. .addTemperatureBtn {
  3456. border-radius:10px;
  3457. position:absolute;
  3458. clip-path: polygon(50% 0,100% 100%,0 100%);
  3459. transform: scale(0.5);
  3460. left: 0;
  3461. top:0;
  3462. bottom: 0;
  3463. right: 0;
  3464. margin: auto;
  3465. }
  3466. .subTemperature {
  3467. border-radius:5px;
  3468. position:absolute;
  3469. background-color: dodgerblue;
  3470. color:white;
  3471. width: 30px;
  3472. height: 30px;
  3473. right:15px;
  3474. top:80px;
  3475. }
  3476. .subTemperatureBtn {
  3477. border-radius:10px;
  3478. position:absolute;
  3479. clip-path: polygon(50% 0,100% 100%,0 100%);
  3480. transform: scale(0.5);
  3481. left: 0;
  3482. top:0;
  3483. bottom: 0;
  3484. right: 0;
  3485. margin: auto;
  3486. }
  3487. .decoctControlTopRight {
  3488. width:40%;
  3489. line-height: 2;
  3490. text-align: center;
  3491. margin: 0 15px;
  3492. position: relative;
  3493. }
  3494. .decoctControlBottom {
  3495. border-bottom:1px #B2B2B2 dotted;
  3496. width:91vw;
  3497. margin:0 auto;
  3498. padding:10px;
  3499. display: flex;
  3500. justify-content:space-between;
  3501. align-items: center;
  3502. }
  3503. .addTime {
  3504. border-radius:5px;
  3505. position:absolute;
  3506. background-color: dodgerblue;
  3507. color:white;
  3508. width: 30px;
  3509. height: 30px;
  3510. left:15px;
  3511. top:80px;
  3512. }
  3513. .addTimeBtn {
  3514. border-radius:10px;
  3515. position:absolute;
  3516. clip-path: polygon(50% 0,100% 100%,0 100%);
  3517. transform: scale(0.5);
  3518. left: 0;
  3519. top:0;
  3520. bottom: 0;
  3521. right: 0;
  3522. margin: auto;
  3523. }
  3524. .subTime {
  3525. border-radius:5px;
  3526. position:absolute;
  3527. background-color: dodgerblue;
  3528. color:white;
  3529. width: 30px;
  3530. height: 30px;
  3531. right:15px;
  3532. top:80px;
  3533. }
  3534. .subTimeBtn {
  3535. border-radius:10px;
  3536. position:absolute;
  3537. clip-path: polygon(50% 0,100% 100%,0 100%);
  3538. transform: scale(0.5);
  3539. left: 0;
  3540. top:0;
  3541. bottom: 0;
  3542. right: 0;
  3543. margin: auto;
  3544. }
  3545. .packageControlBottomRight {
  3546. border-radius:5px;
  3547. padding:5px 10px;
  3548. margin-right: 15px;
  3549. background-color: #3c9cff;
  3550. color: #fff;
  3551. }
  3552. .packageControlBottomClear {
  3553. border-radius:5px;
  3554. padding:5px 10px;
  3555. background-color: #B2B2B2;
  3556. color: #fff;
  3557. }
  3558. .active_btn{
  3559. background-color: #3c9cff;
  3560. }
  3561. .baozhuang-sub{
  3562. right: 10rpx !important;
  3563. }
  3564. .baozhuang-add{
  3565. left: 6rpx !important;
  3566. }
  3567. .control-input-box{
  3568. display: flex;
  3569. flex-direction: row;
  3570. padding-left: 26rpx;
  3571. }
  3572. .control-input-box-danwei{
  3573. padding-top:12rpx;
  3574. margin-left:4rpx;
  3575. }
  3576. .tabs{
  3577. position: relative;
  3578. top:15vh;
  3579. }
  3580. .child_tab{
  3581. position: relative;
  3582. display: inline-block;
  3583. width: 25%;
  3584. height: 180rpx;
  3585. }
  3586. .child_img{
  3587. width: 50rpx;
  3588. height: 50rpx;
  3589. left: 66rpx;
  3590. top: 66rpx;
  3591. position: relative;
  3592. }
  3593. .child_title{
  3594. position: absolute;
  3595. left: 0px;
  3596. right: 0px;
  3597. text-align: center;
  3598. font-size: 12px;
  3599. bottom: -12rpx;
  3600. color: #060B25;
  3601. }
  3602. .control{
  3603. width: 100%;
  3604. position: relative;
  3605. }
  3606. .control_item{
  3607. position: relative;
  3608. width: 50%;
  3609. display: inline-block;
  3610. height: 150rpx;
  3611. }
  3612. .control_item_detail{
  3613. position: relative;
  3614. top:22rpx;
  3615. }
  3616. .control_item_left{
  3617. position:absolute;;
  3618. left:22%;
  3619. font-size: 55px;
  3620. z-index: 999;
  3621. top:-30rpx
  3622. }
  3623. .control_item_center{
  3624. position:absolute;;
  3625. left:34%;
  3626. top:0vh;
  3627. }
  3628. .control_item_right{
  3629. position:absolute;;
  3630. left:67%;
  3631. font-size: 34px;
  3632. z-index: 999;
  3633. }
  3634. .control_item_center_unit{
  3635. position: absolute;
  3636. left:26vw;
  3637. top: 0.8vh;
  3638. width:200rpx;
  3639. }
  3640. .control_item_title{
  3641. position: absolute;
  3642. bottom:34rpx;
  3643. font-size: 12px;
  3644. width: 100%;
  3645. text-align: center;
  3646. }
  3647. .bottom{
  3648. height: 190rpx;
  3649. position: absolute;
  3650. left: 0px;
  3651. width: 100%;
  3652. padding-top: 18rpx;
  3653. bottom: -8vh;
  3654. }
  3655. .bottom_item{
  3656. display: inline-block;
  3657. width: 20%;
  3658. font-size: 12px;
  3659. height: 100%;
  3660. position: relative;
  3661. text-align: center;
  3662. margin-top: 2vh;
  3663. }
  3664. .active_on{
  3665. color: #50ACFF;
  3666. }
  3667. .status_info{
  3668. position: absolute;
  3669. left: 5vw;
  3670. top: 10vh;
  3671. }
  3672. .status_detail{
  3673. display: flex;
  3674. flex-direction: row;
  3675. }
  3676. .status_text{
  3677. font-size: 16px;
  3678. }
  3679. .online_text{
  3680. font-size: 12px;
  3681. padding-top: 3px;
  3682. }
  3683. .online{
  3684. color: #017128;
  3685. }
  3686. .device_info{
  3687. font-size: 13px;
  3688. }
  3689. .control_area{
  3690. position: relative;
  3691. top:14vh;
  3692. }
  3693. .disabled_tab{
  3694. opacity: 0.4;
  3695. }
  3696. .roate{
  3697. transform: rotate(180deg);
  3698. }
  3699. </style>