detail.vue 93 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050
  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%;"'>
  4. <view class="status_info">
  5. <view class="status_detail">
  6. <view class="status_text">{{ getStatusText() }}</view>
  7. <view v-if="deviceInfo.status == 3" class="online_text online">·在线</view>
  8. <view v-if="deviceInfo.status == 4" class="online_text">·离线</view>
  9. </view>
  10. <view class="device_info">机器编号: {{deviceInfo.serialNumber}}</view>
  11. </view>
  12. <view style="position: absolute;right:10vw;top:12vh;z-index: 9" @click="showDrawer">
  13. <image :src="imgUrl+'/detail/setting2.png'" style="width: 50rpx;height: 50rpx;"/>
  14. </view>
  15. <view style="position: relative;top:15vh;width: 100%;text-align: center">
  16. <image :src="productImage" :style="productSize"/>
  17. </view>
  18. <view class="tabs">
  19. <view class="child_tab" :class="firstMachine?'':'disabled_tab'" @click="changeTab(1,firstMachine)">
  20. <image :src="imgUrl+'/detail/tab.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
  21. <image class="child_img" v-if="tabActive[0]" :src="imgUrl+'/detail/jianyao_on.png'" />
  22. <image class="child_img" v-if="!tabActive[0]" :src="imgUrl+'/detail/jianyao_off.png'" />
  23. <view class="child_title" :class="tabActive[0]?'active_on':''">
  24. 煎药机一
  25. </view>
  26. </view>
  27. <view class="child_tab" :class="secondMachine?'':'disabled_tab'" @click="changeTab(2,secondMachine)">
  28. <image :src="imgUrl+'/detail/tab.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
  29. <image class="child_img" v-if="tabActive[1]" :src="imgUrl+'/detail/jianyao_on.png'" />
  30. <image class="child_img" v-if="!tabActive[1]" :src="imgUrl+'/detail/jianyao_off.png'" />
  31. <view class="child_title" :class="isPage(2)?'active_on':''">
  32. 煎药机二
  33. </view>
  34. </view>
  35. <view class="child_tab" :class="thirdMachine?'':'disabled_tab'" @click="changeTab(3,thirdMachine)">
  36. <image :src="imgUrl+'/detail/tab.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
  37. <image class="child_img" v-if="tabActive[2]" :src="imgUrl+'/detail/jianyao_on.png'" />
  38. <image class="child_img" v-if="!tabActive[2]" :src="imgUrl+'/detail/jianyao_off.png'" />
  39. <view class="child_title" :class="tabActive[2]?'active_on':''">
  40. 煎药机三
  41. </view>
  42. </view>
  43. <view class="child_tab" :class="forthMachine?'':'disabled_tab'" @click="changeTab(4,forthMachine)">
  44. <image :src="imgUrl+'/detail/tab.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
  45. <image class="child_img" v-if="firstTab" :src="imgUrl+'/detail/baozhuang_off.png'" />
  46. <image class="child_img" v-if="!firstTab" :src="imgUrl+'/detail/baozhuang_on.png'" />
  47. <view class="child_title" :class="firstTab?'':'active_on'">
  48. 包装机
  49. </view>
  50. </view>
  51. </view>
  52. <view class="control_area" v-if="firstTab">
  53. <view class="control">
  54. <view class="control_item">
  55. <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
  56. <view class="control_item_detail">
  57. <view class="control_item_left" @click="subTemperature(1)">-</view>
  58. <view class="control_item_center">
  59. <view style="position: absolute">
  60. <u-input customStyle="width:150rpx;border:0px;" disabledColor="white" @change="propChange(1)" @focus="propFocus(1)" @confirm="propBlur(1)" @blur="propBlur(1)" v-model="temperature"></u-input>
  61. </view>
  62. </view>
  63. <view class="control_item_center_unit" :style="unitFixedStyle">℃</view>
  64. <view class="control_item_right" @click="addTemperature(1)">+</view>
  65. </view>
  66. <view class="control_item_title">
  67. 设置温度
  68. </view>
  69. </view>
  70. <view class="control_item" v-if="wenhuoTimeDlgShow">
  71. <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
  72. <view class="control_item_detail">
  73. <view class="control_item_left" @click="subTemperatureTime(1)">-</view>
  74. <view class="control_item_center">
  75. <view style="position: absolute;z-index: 999">
  76. <u-input customStyle="width:150rpx;border:0px;z-index: 999" disabledColor="white" v-model="temperatureTime"></u-input>
  77. </view>
  78. </view>
  79. <view class="control_item_center_unit" :style="unitFixedStyle">分钟</view>
  80. <view class="control_item_right" style="left: 74%;" @click="addTemperatureTime(1)">+</view>
  81. </view>
  82. <view class="control_item_title">
  83. 时间设置
  84. </view>
  85. </view>
  86. <view class="control_item" v-if="!wenhuoTimeDlgShow">
  87. <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
  88. <view class="control_item_detail">
  89. <view class="control_item_left" @click="subTemperatureTime(1)">-</view>
  90. <view class="control_item_center">
  91. <view style="position: absolute">
  92. <u-input customStyle="width:150rpx;border:0px;" disabledColor="white" @change="propChange(1)" @focus="propFocus(2)" @confirm="propBlur(2)" @blur="propBlur(2)" v-model="leftJianyaoTime"></u-input>
  93. </view>
  94. </view>
  95. <view class="control_item_center_unit" :style="unitFixedStyle">分钟</view>
  96. <view class="control_item_right" style="left: 74%;" @click="addTemperatureTime(1)">+</view>
  97. </view>
  98. <view class="control_item_title">
  99. 时间设置
  100. </view>
  101. </view>
  102. <view class="control_item">
  103. <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
  104. <view class="control_item_detail">
  105. <view class="control_item_center">
  106. <u-input disabled customStyle="width:150rpx;border:0px;" disabledColor="white" :value="currentTemperature"></u-input>
  107. </view>
  108. <view class="control_item_center_unit" :style="unitFixedStyle">℃</view>
  109. </view>
  110. <view class="control_item_title">
  111. 当前温度
  112. </view>
  113. </view>
  114. <view class="control_item">
  115. <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
  116. <view class="control_item_detail">
  117. <view class="control_item_center">
  118. <u-input disabled customStyle="width:150rpx;border:0px;" disabledColor="white" :value="hightTemperature"></u-input>
  119. </view>
  120. <view class="control_item_center_unit" :style="unitFixedStyle">分钟</view>
  121. </view>
  122. <view class="control_item_title">
  123. 高温时间
  124. </view>
  125. </view>
  126. </view>
  127. <view class="bottom">
  128. <image :src="imgUrl+'/detail/bg_large.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
  129. <view class="bottom_item" @click="decoctControlOnOffChange">
  130. <image v-if="decoctControlOnOffStatus" :src="imgUrl+'/detail/open_on.png'" style="width: 32%;height:32%;"/>
  131. <image v-if="!decoctControlOnOffStatus" :src="imgUrl+'/detail/open_off.png'" style="width: 32%;height:32%;"/>
  132. <view :class="decoctControlOnOffStatus?'active_on':''">开关</view>
  133. </view>
  134. <view class="bottom_item" @click="decoctControlChange">
  135. <image v-if="decoctControlStatus" :src="imgUrl+'/detail/jianing_on.png'" style="width: 32%;height:32%;"/>
  136. <image v-if="!decoctControlStatus" :src="imgUrl+'/detail/jianing_off.png'" style="width: 32%;height:32%;"/>
  137. <view :class="decoctControlStatus?'active_on':''">煎药</view>
  138. </view>
  139. <view class="bottom_item" @click="stopDecoctControlChange">
  140. <image v-if="!decoctControlStatus" :src="imgUrl+'/detail/stop_on.png'" style="width: 32%;height:32%;"/>
  141. <image v-if="decoctControlStatus" :src="imgUrl+'/detail/stop_off.png'" style="width: 32%;height:32%;"/>
  142. <view :class="!decoctControlStatus?'active_on':''">停止</view>
  143. </view>
  144. <view class="bottom_item" @click="toPlan">
  145. <image v-if="leftAppointmentTime>0" :src="imgUrl+'/detail/plan_on.png'" style="width: 32%;height:32%;"/>
  146. <image v-else :src="imgUrl+'/detail/plan_off.png'" style="width: 32%;height:32%;"/>
  147. <view :class="leftAppointmentTime>0?'active_on':''">预约</view>
  148. </view>
  149. </view>
  150. </view>
  151. <view class="control_area" v-if="!firstTab">
  152. <view class="control">
  153. <view class="control_item" v-if="fengbianDlgShow">
  154. <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
  155. <view class="control_item_detail">
  156. <view class="control_item_left" @click="subEdegTemperature(1)">-</view>
  157. <view class="control_item_center">
  158. <u-input customStyle="width:150rpx;border:0px;background:none;" disabledColor="white" placeholder="0" @confirm="propBlur(3)" v-model="setEdegTemperature"></u-input>
  159. </view>
  160. <view class="control_item_center_unit" :style="unitFixedStyle">℃</view>
  161. <view class="control_item_right" @click="addEdegTemperature(1)">+</view>
  162. </view>
  163. <view class="control_item_title">
  164. 设置温度
  165. </view>
  166. </view>
  167. <view class="control_item" v-if="!fengbianDlgShow">
  168. <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
  169. <view class="control_item_detail">
  170. <view class="control_item_left" @click="subEdegTemperature(1)">-</view>
  171. <view class="control_item_center">
  172. <u-input customStyle="width:150rpx;border:0px;background:none;" disabledColor="white" placeholder="0" @focus="propFocus(3)" @blur="propBlur(3)" v-model="edegTemperature"></u-input>
  173. </view>
  174. <view class="control_item_center_unit" :style="unitFixedStyle">℃</view>
  175. <view class="control_item_right" @click="addEdegTemperature(1)">+</view>
  176. </view>
  177. <view class="control_item_title">
  178. <view v-if="!baozhuangFengbianSetting">
  179. 封边温度
  180. </view>
  181. <view v-if="baozhuangFengbianSetting">
  182. 设置温度
  183. </view>
  184. </view>
  185. </view>
  186. <view class="control_item" v-if="fengkouDlgShow">
  187. <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
  188. <view class="control_item_detail">
  189. <view class="control_item_left" @click="subSealingTemperature(1)">-</view>
  190. <view class="control_item_center">
  191. <u-input customStyle="width:150rpx;border:0px;background:none;" disabledColor="white" placeholder="0" @blur="propBlur(4)" @confirm="propBlur(4)" v-model="setSealingTemperature"></u-input>
  192. </view>
  193. <view class="control_item_center_unit" :style="unitFixedStyle">℃</view>
  194. <view class="control_item_right" @click="addSealingTemperature(1)">+</view>
  195. </view>
  196. <view class="control_item_title">
  197. 设置温度
  198. </view>
  199. </view>
  200. <view class="control_item" v-if="!fengkouDlgShow">
  201. <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
  202. <view class="control_item_detail">
  203. <view class="control_item_left" @click="subSealingTemperature(1)">-</view>
  204. <view class="control_item_center">
  205. <u-input customStyle="width:150rpx;border:0px;background:none;" disabledColor="white" placeholder="0" @change="propChange(1)" @focus="propFocus(4)" @blur="propBlur(4)" v-model="sealingTemperature"></u-input>
  206. </view>
  207. <view class="control_item_center_unit" :style="unitFixedStyle">℃</view>
  208. <view class="control_item_right" @click="addSealingTemperature(1)">+</view>
  209. </view>
  210. <view class="control_item_title">
  211. <view v-if="!baozhuangFengkouSetting">
  212. 封口温度
  213. </view>
  214. <view v-if="baozhuangFengkouSetting">
  215. 设置温度
  216. </view>
  217. </view>
  218. </view>
  219. <view class="control_item">
  220. <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
  221. <view class="control_item_detail">
  222. <view class="control_item_left" @click="subPackageVolume()">-</view>
  223. <view class="control_item_center">
  224. <view style="position: absolute">
  225. <u-input customStyle="width:150rpx;border:0px;" disabledColor="white" @focus="propFocus(5)" @confirm="propBlur(5)" @blur="propBlur(5)" v-model="packageVolume"></u-input>
  226. </view>
  227. </view>
  228. <view class="control_item_center_unit" :style="unitFixedStyle">ml</view>
  229. <view class="control_item_right" @click="addPackageVolume()">+</view>
  230. </view>
  231. <view class="control_item_title">
  232. 包装容量
  233. </view>
  234. </view>
  235. <view class="control_item">
  236. <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
  237. <view class="control_item_detail">
  238. <view class="control_item_left" @click="subPackageNumber()">-</view>
  239. <view class="control_item_center">
  240. <view style="position: absolute">
  241. <u-input customStyle="width:150rpx;border:0px;" disabledColor="white" @focus="propFocus(6)" @confirm="propBlur(6)" @blur="propBlur(6)" v-model="packageNumber"></u-input>
  242. </view>
  243. </view>
  244. <view class="control_item_center_unit" :style="unitFixedStyle">袋</view>
  245. <view class="control_item_right" @click="addPackageNumber()">+</view>
  246. </view>
  247. <view class="control_item_title">
  248. 包装数量
  249. </view>
  250. </view>
  251. </view>
  252. <view class="bottom">
  253. <image :src="imgUrl+'/detail/bg_large.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
  254. <view class="bottom_item" @click="packageControlOnOffChange">
  255. <image v-if="packageControlOnOffStatus" :src="imgUrl+'/detail/open_on.png'" style="width: 32%;height:32%;"/>
  256. <image v-if="!packageControlOnOffStatus" :src="imgUrl+'/detail/open_off.png'" style="width: 32%;height:32%;"/>
  257. <view :class="packageControlOnOffStatus?'active_on':''">开关</view>
  258. </view>
  259. <view class="bottom_item" @click="turnChange(1)">
  260. <image v-if="qitingTurn" :src="imgUrl+'/detail/open_on.png'" style="width: 32%;height:32%;"/>
  261. <image v-if="!qitingTurn" :src="imgUrl+'/detail/open_off.png'" style="width: 32%;height:32%;"/>
  262. <view :class="qitingTurn?'active_on':''">启停</view>
  263. </view>
  264. <view class="bottom_item" @click="turnChange(2)">
  265. <image v-if="baozhuangTurn" :src="imgUrl+'/detail/bao_on.png'" style="width: 32%;height:32%;"/>
  266. <image v-if="!baozhuangTurn" :src="imgUrl+'/detail/bao_off.png'" style="width: 32%;height:32%;"/>
  267. <view :class="baozhuangTurn?'active_on':''">包装</view>
  268. </view>
  269. <view class="bottom_item" @click="turnChange(3)">
  270. <image v-if="qingxiTurn" :src="imgUrl+'/detail/xi_on.png'" style="width: 32%;height:32%;"/>
  271. <image v-if="!qingxiTurn" :src="imgUrl+'/detail/xi_off.png'" style="width: 32%;height:32%;"/>
  272. <view :class="qingxiTurn?'active_on':''">清洗</view>
  273. </view>
  274. </view>
  275. </view>
  276. </view>
  277. <u-popup :show="false" @close="closePop" mode="center" bgColor="transparent" :closeable="true">
  278. <view style="position: relative;width: 500rpx;height:300rpx;background: none">
  279. <view class="control_item" style="width: 100%" v-if="fengbianDlgShow">
  280. <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
  281. <view class="control_item_detail">
  282. <view class="control_item_left" @click="subEdegTemperature(1)">-</view>
  283. <view class="control_item_center">
  284. <u-input customStyle="width:150rpx;border:0px;" disabledColor="white" @change="changeEdegTemperature" v-model="setEdegTemperature"></u-input>
  285. </view>
  286. <view class="control_item_center_unit" :style="unitFixedStyle1">℃</view>
  287. <view class="control_item_right" @click="addEdegTemperature(1)">+</view>
  288. </view>
  289. <view class="control_item_title">
  290. 封边温度设置
  291. </view>
  292. </view>
  293. <view class="control_item" style="width: 100%" v-if="fengkouDlgShow">
  294. <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
  295. <view class="control_item_detail">
  296. <view class="control_item_left" @click="subSealingTemperature(1)">-</view>
  297. <view class="control_item_center">
  298. <u-input customStyle="width:150rpx;border:0px;" disabledColor="white" @change="changeSealingTemperature" v-model="setSealingTemperature"></u-input>
  299. </view>
  300. <view class="control_item_center_unit" :style="unitFixedStyle1">℃</view>
  301. <view class="control_item_right" @click="addSealingTemperature(1)">+</view>
  302. </view>
  303. <view class="control_item_title">
  304. 封口温度设置
  305. </view>
  306. </view>
  307. <view class="control_item" style="width: 100%" v-if="wenhuoTimeDlgShow">
  308. <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
  309. <view class="control_item_detail">
  310. <view class="control_item_left" @click="subTemperatureTime()">-</view>
  311. <view class="control_item_center">
  312. <u-input customStyle="width:150rpx;border:0px;" disabledColor="white" @change="changeTemperatureTime()" v-model="temperatureTime"></u-input>
  313. </view>
  314. <view class="control_item_center_unit" :style="unitFixedStyle1">℃</view>
  315. <view class="control_item_right" @click="addTemperatureTime()">+</view>
  316. </view>
  317. <view class="control_item_title">
  318. 文火时间
  319. </view>
  320. </view>
  321. </view>
  322. </u-popup>
  323. <u-popup :show="planPopDlg" @close="closePlanPop" mode="center" :closeable="true">
  324. <view style="position: relative;width: 400rpx;background: none;padding:40rpx;">
  325. <view class="control_item" style="width: 100%">
  326. <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
  327. <view class="control_item_detail">
  328. <view class="control_item_left" @click="subPlanTime(1)" style="left: 18%;">-</view>
  329. <view class="control_item_center">
  330. <view style="position: absolute">
  331. <u-input customStyle="width:150rpx;border:0px;" disabledColor="white" v-model="planTime"></u-input>
  332. </view>
  333. </view>
  334. <view class="control_item_center_unit" :style="unitFixedStyle">分钟</view>
  335. <view class="control_item_right" style="left: 80%;" @click="addPlanTime(1)">+</view>
  336. </view>
  337. <view class="control_item_title">
  338. 预约时间
  339. </view>
  340. </view>
  341. <view class="control_item" style="width: 100%">
  342. <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
  343. <view class="control_item_detail">
  344. <view class="control_item_left" @click="subTemperatureTime()" style="left: 18%;">-</view>
  345. <view class="control_item_center">
  346. <view style="position: absolute">
  347. <u-input customStyle="width:150rpx;border:0px;" disabledColor="white" @change="changeTemperatureTime()" v-model="temperatureTime"></u-input>
  348. </view>
  349. </view>
  350. <view class="control_item_center_unit" :style="unitFixedStyle">分钟</view>
  351. <view class="control_item_right" @click="addTemperatureTime()" style="left: 80%;">+</view>
  352. </view>
  353. <view class="control_item_title">
  354. 时间设置
  355. </view>
  356. </view>
  357. <view>
  358. <button style="background: white;" @click="plan">确认</button>
  359. </view>
  360. </view>
  361. </u-popup>
  362. <!-- 预约框-->
  363. <u-popup :show="yuyueIngPop" @close="closeYuyueIngPop" mode="center" :closeable="true">
  364. <view style="position: relative;width: 400rpx;background: none;padding:40rpx;">
  365. <view class="control_item" style="width: 100%">
  366. <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
  367. <view class="control_item_detail">
  368. <view class="control_item_center">
  369. <u-input customStyle="width:150rpx;border:0px;padding:0px" disabledColor="white" :value="leftAppointmentTime"></u-input>
  370. </view>
  371. <view class="control_item_center_unit" :style="unitFixedStyle">℃</view>
  372. </view>
  373. <view class="control_item_title">
  374. 剩余时间
  375. </view>
  376. </view>
  377. <view>
  378. <button style="background: white;" @click="cancelPlan">取消</button>
  379. </view>
  380. </view>
  381. </u-popup>
  382. <u-popup :show="planIngPopDlg" @close="closePlanIngPop" mode="center" :closeable="true">
  383. <view style="position: relative;width: 400rpx;background: none;padding:40rpx;">
  384. <view class="control_item" style="width: 100%">
  385. <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
  386. <view class="control_item_detail" style="width: 100%; padding: 40rpx;margin-bottom:10rpx;">
  387. <u-line-progress :percentage="step" activeColor="#50ACFF"></u-line-progress>
  388. </view>
  389. <view class="control_item_title" v-if="leftAppointmentTime>0">
  390. 预约煎药中,倒计时{{leftAppointmentTime}}分钟
  391. </view>
  392. <view class="control_item_title" v-else>
  393. <view v-if="leftJianyaoTime>0">
  394. 正在熬制,请稍等
  395. </view>
  396. <view v-else>
  397. 煎药完成
  398. </view>
  399. </view>
  400. </view>
  401. <view class="control_item" style="width: 100%">
  402. <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
  403. <view class="control_item_detail">
  404. <view class="control_item_center">
  405. <u-input customStyle="width:150rpx;border:0px;" disabledColor="white" :value="currentTemperature"></u-input>
  406. </view>
  407. <view class="control_item_center_unit" :style="unitFixedStyle">℃</view>
  408. </view>
  409. <view class="control_item_title">
  410. 当前温度
  411. </view>
  412. </view>
  413. <view class="control_item" style="width: 100%">
  414. <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
  415. <view class="control_item_detail">
  416. <view class="control_item_center">
  417. <u-input customStyle="width:150rpx;border:0px;" disabledColor="white" :value="leftJianyaoTime"></u-input>
  418. </view>
  419. <view class="control_item_center_unit" :style="unitFixedStyle">分钟</view>
  420. </view>
  421. <view class="control_item_title">
  422. 文火倒计时
  423. </view>
  424. </view>
  425. <!-- <view>-->
  426. <!-- <button style="background: white;" @click="cancelPlan">暂停</button>-->
  427. <!-- </view>-->
  428. </view>
  429. </u-popup>
  430. <uni-drawer ref="showLeft" :width="320" :maskClick="true" mode="right" @change="change($event,'showLeft')">
  431. <scroll-view style="height: 88%;padding:20% 0%;" scroll-y="true">
  432. <view style="text-align:center">设置</view>
  433. <view>
  434. <view class="prop-item">
  435. <view class="prop-item-image">
  436. <image :src="imgUrl+'/setting/net.png'" style="width: 100%;height:100%;"/>
  437. </view>
  438. <view class="prop-item-left">网络连接</view>
  439. <view class="prop-item-right">
  440. <view v-if="deviceInfo.status == 3">
  441. 已连接
  442. </view>
  443. <view v-else>
  444. 未连接
  445. <!-- <uni-icons type="forward" size="16"></uni-icons>-->
  446. </view>
  447. </view>
  448. </view>
  449. <view class="prop-item" v-if="firstTab">
  450. <view class="prop-item-image">
  451. <image :src="imgUrl+'/setting/oper_temp.png'" style="width: 100%;height:100%;"/>
  452. </view>
  453. <view class="prop-item-left">温度校准</view>
  454. <view class="prop-item-right" @click="showJiaozhunProp">
  455. {{jiaozhunTemp}}℃<uni-icons type="forward" size="16"></uni-icons>
  456. </view>
  457. </view>
  458. <view class="prop-item" v-if="firstTab">
  459. <view class="prop-item-image">
  460. <image :src="imgUrl+'/setting/list.png'" style="width: 100%;height:100%;"/>
  461. </view>
  462. <view class="prop-item-left">工作模式</view>
  463. <view class="prop-item-right" @click="showWorkPicker">
  464. <view v-if="workMode == 1">
  465. 1<uni-icons type="forward" size="16"></uni-icons>
  466. </view>
  467. <view v-if="workMode == 2">
  468. 2<uni-icons type="forward" size="16"></uni-icons>
  469. </view>
  470. <view v-if="workMode == 3">
  471. 3<uni-icons type="forward" size="16"></uni-icons>
  472. </view>
  473. </view>
  474. </view>
  475. <view class="prop-item">
  476. <view class="prop-item-image">
  477. <image :src="imgUrl+'/setting/no.png'" style="width: 100%;height:100%;"/>
  478. </view>
  479. <view class="prop-item-left">二维码编号</view>
  480. <view class="prop-item-right">
  481. <text class="text-right">{{deviceInfo.qrcodeId==null?"未绑定":deviceInfo.qrcodeId}}</text>
  482. </view>
  483. </view>
  484. <view class="prop-item">
  485. <view class="prop-item-image">
  486. <image :src="imgUrl+'/setting/learn.png'" style="width: 100%;height:100%;"/>
  487. </view>
  488. <view class="prop-item-left">使用教程</view>
  489. <view class="prop-item-right" @click="skip(1)">
  490. <uni-icons type="forward" size="16"></uni-icons>
  491. </view>
  492. </view>
  493. <view class="prop-item">
  494. <view class="prop-item-image">
  495. <image :src="imgUrl+'/setting/video.png'" style="width: 100%;height:100%;"/>
  496. </view>
  497. <view class="prop-item-left">维修视频</view>
  498. <view class="prop-item-right" @click="skip(1)">
  499. <uni-icons type="forward" size="16"></uni-icons>
  500. </view>
  501. </view>
  502. <view class="prop-item">
  503. <view class="prop-item-image">
  504. <image :src="imgUrl+'/setting/upload.png'" style="width: 100%;height:100%;"/>
  505. </view>
  506. <view class="prop-item-left">在线升级</view>
  507. <view class="prop-item-right" @click="getUpdateInfo">
  508. <uni-icons type="forward" size="16"></uni-icons>
  509. </view>
  510. </view>
  511. <view class="prop-item">
  512. <view class="prop-item-image">
  513. <image :src="imgUrl+'/setting/shou.png'" style="width: 100%;height:100%;"/>
  514. </view>
  515. <view class="prop-item-left">售后服务</view>
  516. <view class="prop-item-right" @click="skip(2)">
  517. <uni-icons type="forward" size="16"></uni-icons>
  518. </view>
  519. </view>
  520. <view class="prop-item">
  521. <view class="prop-item-image">
  522. <image :src="imgUrl+'/setting/reset.png'" style="width: 100%;height:100%;"/>
  523. </view>
  524. <view class="prop-item-left">恢复出厂</view>
  525. <view class="prop-item-right" @click="reset">
  526. <uni-icons type="forward" size="16"></uni-icons>
  527. </view>
  528. </view>
  529. <view class="prop-item">
  530. <view class="prop-item-image">
  531. <image :src="imgUrl+'/setting/runinfo.png'" style="width: 100%;height:100%;"/>
  532. </view>
  533. <view class="prop-item-left">修改名称</view>
  534. <view class="prop-item-right" @click="modifyName">
  535. <uni-icons type="forward" size="16"></uni-icons>
  536. </view>
  537. </view>
  538. </view>
  539. </scroll-view>
  540. </uni-drawer>
  541. <u-popup :show="jiaozhunPopDlg" @close="closejiaozhunPop" mode="center" :closeable="true">
  542. <view style="position: relative;width: 400rpx;background: none;padding:40rpx;">
  543. <view class="control_item" style="width: 100%">
  544. <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
  545. <view class="control_item_detail">
  546. <view class="control_item_left" @click="subJiaoZhunTemperature(1)" style="left: 18%;">-</view>
  547. <view class="control_item_center">
  548. <view style="position: absolute">
  549. <u-input customStyle="width:150rpx;border:0px;" disabledColor="white" v-model="jiaozhunTemp_temp"></u-input>
  550. </view>
  551. </view>
  552. <view class="control_item_center_unit" :style="unitFixedStyle">℃</view>
  553. <view class="control_item_right" @click="addJiaoZhunTemperature(1)" style="left: 80%;">+</view>
  554. </view>
  555. <view class="control_item_title">
  556. 校准温度
  557. </view>
  558. </view>
  559. <view>
  560. <button style="background: white;" @click="confirmJiaozhunTemp">确认</button>
  561. </view>
  562. </view>
  563. </u-popup>
  564. <u-picker :show="showModelPicker" @cancel="closeModelPicker" @confirm="confirmMode" :columns="modeList" keyName="text"></u-picker>
  565. </view>
  566. </template>
  567. <script>
  568. import { getDetail,getDeviceStatus,cacheJsonThingsModel,reportError ,getDeviceRunTime,getLatestFirmware,bingDeviceDept,editDeviceName} from '@/api/device/device.js'
  569. import config from '@/config'
  570. export default {
  571. data(){
  572. return {
  573. onlineStatus:false,
  574. modeList:[[
  575. {id:1,text:"1"},
  576. {id:2,text:"2"},
  577. {id:3,text:"3"},
  578. ]],
  579. productSize:"",
  580. productImage:"",
  581. showModelPicker:false,
  582. unitFixedStyle:"",
  583. unitFixedStyle1:"",
  584. planTime:10,
  585. setSealingTemperature:160,
  586. setEdegTemperature:160,
  587. sealingTemperature:0,
  588. edegTemperature:0,
  589. hightTemperature:0,
  590. currentTemperature:0,
  591. temperatureTime:1,
  592. temperature:0,
  593. packageNumber:1,
  594. packageVolume:50,
  595. firstTab:true,
  596. decoctControlStatus:false,
  597. decoctControlOnOffStatus:false,
  598. packageControlOnOffStatus:false,
  599. subDecoctTabList:[
  600. {name:'子煎药1'},
  601. {name:'子煎药2'},
  602. {name:'子煎药3'},
  603. ],
  604. DecoctControlStatus:false,
  605. PackagControlStatus:false,
  606. baozhuangTurn:false,
  607. qitingTurn:false,
  608. qingxiTurn:false,
  609. subCurrent:0,
  610. current:0,
  611. inputStyle:{height:'44rpx','fontSize':'20rpx'},
  612. modelKey:['PowerControl','LockControl'],
  613. jianyaoKeys : ["TempSetting","TimeSetting"],
  614. baozhuangKeys:["SetSealTemp","SetBandingTemp","PackageQuantity","PackingVolume"],
  615. power:{
  616. loading:true,
  617. value:0,
  618. },
  619. lock:{
  620. loading:true,
  621. value:0,
  622. },
  623. showTimeDlg:false,
  624. showErrDlg:null,
  625. errorMsg:"asdasdasdasd",
  626. show:null,
  627. value:"",
  628. deviceInfo:{},
  629. id:0,
  630. summary:[
  631. ],
  632. tabs:[
  633. {tabName:"煎药控制"},
  634. {tabName:"包装控制"},
  635. ],
  636. activeName:0,
  637. childId:0,
  638. oneToMul:false,
  639. inputProp:[],
  640. watchProp:[],
  641. columns:[],
  642. location:{},
  643. sysDept:null,
  644. timeobj:{alltime:0,avgtime:0},
  645. publishMsg:false,
  646. checkTimer:null,
  647. functions:[],
  648. properties:[],
  649. propMap:{},
  650. jianyaoTimer:null,
  651. baozhuangTimer:null,
  652. editing:false,
  653. workMode:2,
  654. leftAppointmentTime:0,
  655. leftJianyaoTime:0,
  656. imgUrl:"",
  657. popDlg:false,
  658. fengbianDlgShow:false,
  659. fengkouDlgShow:false,
  660. wenhuoTimeDlgShow:false,
  661. planPopDlg:false,
  662. planIngPopDlg:false,
  663. maxWidth:320,
  664. jiaozhunTemp:0,//校准温度,
  665. jiaozhunTemp_temp:0,//校准温度,
  666. jiaozhunPopDlg:false,
  667. step:0,
  668. yuyueIngPop:false,
  669. firmware:{},
  670. jianyaoPopClose:true,
  671. tabIndex:1,
  672. appid:"wxfd7b1a0e03e9b7e9",
  673. firstMachine:true,
  674. secondMachine:false,
  675. thirdMachine:false,
  676. forthMachine:true,
  677. deviceType:1,
  678. tabActive:[true,false,false],
  679. resetDuration:4000,
  680. jianyaoWenduSetting:false,
  681. jianyaoShijianSetting:false,
  682. baozhuangFengbianSetting:false,
  683. baozhuangFengkouSetting:false,
  684. baozhuangRongLiangSetting:false,
  685. baozhuangShuLIangSetting:false,
  686. tempFengkouWendu:0,
  687. tempFengBianWendu:0,
  688. }
  689. },
  690. onLoad: function(opt) {
  691. this.id = opt.id;
  692. // this.id = 61;
  693. this.connectMqtt();
  694. this.getDetail();
  695. this.imgUrl = config.imgUrl
  696. this.fixStyle();
  697. // this.fixImage();
  698. // console.log = function(){}
  699. },
  700. destroyed() {
  701. // 取消订阅主题
  702. this.mqttUnSubscribe(this.deviceInfo);
  703. clearTimeout(this.checkTimer);
  704. },
  705. methods:{
  706. fixImage(heng){
  707. let self = this;
  708. wx.getSystemInfo({
  709. success: res => {
  710. const { windowWidth, windowHeight, statusBarHeight } = res;
  711. if(heng){
  712. let rate = 0.35;
  713. if(windowHeight<800){
  714. rate = 0.30;
  715. }
  716. let imgHeight = windowWidth*0.85;
  717. let imageWidth = windowWidth * 1;
  718. self.productSize = ";width:"+imageWidth+"px;height:"+imgHeight+"px;";
  719. }else{
  720. let rate = 0.35;
  721. if(windowHeight<800){
  722. rate = 0.30;
  723. }
  724. let imgHeight = windowHeight*rate;
  725. let imageWidth = imgHeight * 0.6;
  726. self.productSize = ";width:"+imageWidth+"px;height:"+imgHeight+"px;";
  727. }
  728. }
  729. })
  730. },
  731. propChange(type){
  732. // if(type == 1){
  733. // }
  734. },
  735. propFocus(type){
  736. if(type == 1){
  737. this.jianyaoWenduSetting = true;
  738. }
  739. if(type == 2){
  740. this.jianyaoShijianSetting = true;
  741. }
  742. if(type == 3){
  743. this.baozhuangFengbianSetting = true;
  744. this.tempFengBianWendu = this.edegTemperature;
  745. this.edegTemperature = this.setEdegTemperature;
  746. }
  747. if(type == 4){
  748. this.baozhuangFengkouSetting = true;
  749. this.tempFengkouWendu = this.sealingTemperature;
  750. this.sealingTemperature = this.setSealingTemperature;
  751. }
  752. if(type == 5){
  753. this.baozhuangRongLiangSetting = true;
  754. }
  755. if(type == 6){
  756. this.baozhuangShuLIangSetting = true;
  757. }
  758. },
  759. autoBlur(type){
  760. },
  761. propBlur(type){
  762. if(type == 1){
  763. this.jianyaoWenduSetting = false;
  764. this.changeTemperature();
  765. }
  766. if(type == 2){
  767. this.temperatureTime = this.leftJianyaoTime;
  768. this.changeTemperatureTime();
  769. }
  770. if(type == 3){
  771. this.setEdegTemperature = this.edegTemperature;
  772. this.changeEdegTemperature();
  773. }
  774. if(type == 4){
  775. this.setSealingTemperature = this.sealingTemperature;
  776. this.changeSealingTemperature();
  777. }
  778. if(type == 5){
  779. this.changePackageVolume()
  780. }
  781. if(type == 6){
  782. this.changePackageNumber();
  783. }
  784. },
  785. modifyName(){
  786. let self = this;
  787. uni.showModal({
  788. title: "修改设备名称",
  789. editable: true,
  790. placeholderText: "请输入设备名称",
  791. content: this.deviceInfo.deviceName,
  792. showCancel: true,
  793. success: function (res) {
  794. console.log(res);
  795. if(res.confirm){
  796. let content = res.content;
  797. let obj = {"deviceId":self.id,deviceName:content};
  798. editDeviceName(obj).then(res=>{
  799. if(res.code == 200){
  800. self.deviceInfo.deviceName = content;
  801. self.$modal.showToast('修改成功')
  802. }else{
  803. self.$modal.showToast('修改失败,请稍后再试')
  804. }
  805. });
  806. }
  807. },
  808. fail: function (res) {
  809. console.log(res);
  810. }
  811. })
  812. },
  813. showWorkPicker(){
  814. let self = this;
  815. uni.showModal({
  816. title: "提示",
  817. content: "该功能请在专业人士指导下使用,是否继续",
  818. confirmText:"是",
  819. success: function (res) {
  820. if(res.confirm){
  821. self.showModelPicker = true;
  822. }
  823. },
  824. })
  825. },
  826. skip(type){
  827. if(type == 1){
  828. wx.navigateToMiniProgram({
  829. appId: this.appid,
  830. path: 'pages/news_details/help?id=25',
  831. success(res) {
  832. // 打开成功
  833. },
  834. fail(res){
  835. console.log(res);
  836. }
  837. })
  838. }else if(type == 2){
  839. wx.openCustomerServiceChat({
  840. extInfo: {url: 'https://work.weixin.qq.com/kfid/kfc4202b8764df71c0c'},
  841. corpId: 'ww8e678fbe6f1079ba',
  842. success(res) {
  843. },
  844. fail(res){
  845. console.log(res);
  846. }
  847. })
  848. }
  849. },
  850. isMulTab(index){
  851. let type = this.deviceType;
  852. if(index == 2){
  853. if(type == 4 || type == 5){
  854. return true;
  855. }
  856. }
  857. if(index == 3){
  858. if(type == 5){
  859. return true;
  860. }
  861. }
  862. return false;
  863. },
  864. isPage(index){
  865. if(this.tabIndex == index){
  866. return true;
  867. }
  868. return false;
  869. },
  870. getUpdateInfo(){
  871. let self = this;
  872. getLatestFirmware(this.id).then(res=>{
  873. self.firmware = res.data;
  874. let curVersion = self.deviceInfo.firmwareVersion;
  875. let onlineVersion = self.firmware.version
  876. if(curVersion>=onlineVersion){
  877. this.$modal.showToast('当前已经是最新版本')
  878. }else{
  879. uni.showModal({
  880. title: '检测到新版本',
  881. content: "当前版本:"+curVersion+",新版本:"+onlineVersion,
  882. cancelText: '取消',
  883. confirmText: '升级',
  884. success: function(res) {
  885. if (res.confirm) {
  886. self.doUpdate();
  887. }
  888. }
  889. })
  890. }
  891. });
  892. },
  893. doUpdate(){
  894. if(this.deviceInfo.status != 3){
  895. this.notifyError("请等待设备上线后操作")
  896. return;
  897. }
  898. let device = this.deviceInfo;
  899. let message = "";
  900. let topic = "";
  901. let title = "升级";
  902. topic = "/" + device.productId + "/" + device.serialNumber + "/ota/get";
  903. message = '{"version":"' + this.firmware.version + '","downloadUrl":"' + this.getDownloadUrl(this.firmware.filePath) + '","size":"'+this.firmware.size+'"}';
  904. this.$mqttTool.publish(topic, message,title).then(res => {
  905. this.notifySuccess(res);
  906. }).catch(res => {
  907. this.notifyError(res);
  908. });
  909. },
  910. getStatusText(){
  911. if(this.baozhuangRunning()){
  912. return "工作中";
  913. }
  914. if(this.jianyaoIng()){
  915. return "工作中";
  916. }
  917. if(this.leftAppointmentTime>0){
  918. return "已预约";
  919. }
  920. return "空闲中";
  921. },
  922. closeYuyueIngPop(){
  923. this.yuyueIngPop = false;
  924. },
  925. confirmMode(item){
  926. console.log(item)
  927. this.workMode = item.value[0].id;
  928. this.setMode(this.workMode);
  929. this.closeModelPicker();
  930. },
  931. closeModelPicker(){
  932. this.showModelPicker = false;
  933. },
  934. confirmJiaozhunTemp(){
  935. this.jiaozhunTemp = this.jiaozhunTemp_temp;
  936. this.temperNumber();
  937. this.closejiaozhunPop();
  938. },
  939. addJiaoZhunTemperature(){
  940. this.jiaozhunTemp_temp ++;
  941. if(this.jiaozhunTemp_temp>20){
  942. this.jiaozhunTemp_temp = 20;
  943. }
  944. },
  945. subJiaoZhunTemperature(){
  946. this.jiaozhunTemp_temp --;
  947. if(this.jiaozhunTemp_temp<-20){
  948. this.jiaozhunTemp_temp = -20;
  949. }
  950. },
  951. closejiaozhunPop(){
  952. this.jiaozhunPopDlg = false;
  953. },
  954. showJiaozhunProp(){
  955. let self = this;
  956. uni.showModal({
  957. title: "提示",
  958. content: "该功能请在专业人士指导下使用,是否继续",
  959. confirmText:"是",
  960. success: function (res) {
  961. if(res.confirm){
  962. self.jiaozhunTemp_temp = self.jiaozhunTemp;
  963. self.jiaozhunPopDlg = true;
  964. }
  965. },
  966. })
  967. },
  968. fixStyle(){
  969. let self = this;
  970. wx.getSystemInfo({
  971. success: res => {
  972. const { windowWidth, windowHeight, statusBarHeight } = res;
  973. // 在这里可以获取到屏幕的宽度和高度
  974. console.log(windowWidth, windowHeight, statusBarHeight);
  975. if(windowWidth<=350){
  976. self.unitFixedStyle = ";padding-top:6px;left: 28vw;";
  977. self.unitFixedStyle1 = ";padding-top:6px;left: 28vw;";
  978. }else if(windowWidth>=360){
  979. self.unitFixedStyle = ";padding-top:10rpx;";
  980. self.unitFixedStyle1 = ";padding-top:10rpx;left: 32vw;";
  981. }
  982. self.maxWidth = windowWidth;
  983. }
  984. })
  985. },
  986. closePlanIngPop(){
  987. this.jianyaoPopClose = false;
  988. this.planIngPopDlg = false;
  989. },
  990. closePlanPop(){
  991. this.planPopDlg = false;
  992. },
  993. showBaozhuangDlg(type){
  994. this.popDlg = true;
  995. if(type == 1){
  996. this.fengbianDlgShow = true;
  997. }else if(type == 2){
  998. this.fengkouDlgShow = true;
  999. }else if(type == 3){
  1000. this.wenhuoTimeDlgShow = true;
  1001. }
  1002. },
  1003. closePop(){
  1004. this.popDlg = false;
  1005. this.fengbianDlgShow = false;
  1006. this.fengkouDlgShow = false;
  1007. this.wenhuoTimeDlgShow = false;
  1008. },
  1009. changeTab(index,tag){
  1010. if(!tag){
  1011. return;
  1012. }
  1013. let type = this.deviceType;
  1014. let self = this;
  1015. if(index == 2 || index == 3){
  1016. if(!this.isMulTab(index)){
  1017. return;
  1018. }
  1019. }
  1020. this.resetChoose();
  1021. if(index == 4){
  1022. uni.showLoading({title:"加载中"});
  1023. getDeviceStatus(this.id,0).then(res=>{
  1024. let data =res.data;
  1025. this.deviceInfo = data;
  1026. self.parseStatusData(data)
  1027. setTimeout(function () {
  1028. uni.hideLoading();
  1029. self.firstTab = false;
  1030. },100);
  1031. });
  1032. }else{
  1033. let arr = ["a","b","c"]
  1034. if(type == 4 || type == 5){
  1035. this.childId =arr[index-1];
  1036. this.getDeviceStatus(function(){
  1037. self.tabIndex = index;
  1038. self.firstTab = true;
  1039. self.tabActive[index-1] = true;
  1040. self.$forceUpdate();
  1041. });
  1042. }else{
  1043. this.getDeviceStatus(function(){
  1044. self.tabIndex = index;
  1045. self.firstTab = true;
  1046. self.tabActive[index-1] = true;
  1047. self.$forceUpdate();
  1048. })
  1049. }
  1050. console.log(this.tabActive)
  1051. }
  1052. },
  1053. resetChoose(){
  1054. this.tabIndex = 0;
  1055. for (let i = 0; i < 3; i++) {
  1056. this.tabActive[i] = false;
  1057. }
  1058. },
  1059. changePackageVolume(){
  1060. if(this.packageVolume<50){
  1061. this.packageVolume = 50;
  1062. }
  1063. if(this.packageVolume>300){
  1064. this.packageVolume = 300;
  1065. }
  1066. this.sendBaozhuang("PackingVolume");
  1067. },
  1068. changePackageNumber(){
  1069. let min = 1;
  1070. let max = 999;
  1071. if(this.packageNumber<min){
  1072. this.packageNumber = min;
  1073. }
  1074. if(this.packageNumber>max){
  1075. this.packageNumber = max;
  1076. }
  1077. this.sendBaozhuang("PackageQuantity");
  1078. },
  1079. changeEdegTemperature(){
  1080. let min = 80;
  1081. let max = 220;
  1082. if(this.setEdegTemperature<min){
  1083. this.setEdegTemperature = min;
  1084. }
  1085. if(this.setEdegTemperature>max){
  1086. this.setEdegTemperature = max;
  1087. }
  1088. console.log("current setEdegTemperature is :"+this.setEdegTemperature)
  1089. this.sendBaozhuang("SetBandingTemp");
  1090. },
  1091. changeSealingTemperature(){
  1092. let min = 80;
  1093. let max = 220;
  1094. if(this.setSealingTemperature<min){
  1095. this.setSealingTemperature = min;
  1096. }
  1097. if(this.setSealingTemperature>max){
  1098. this.setSealingTemperature = max;
  1099. }
  1100. console.log("current setSealingTemperature is :"+this.setSealingTemperature)
  1101. this.sendBaozhuang("SetSealTemp");
  1102. },
  1103. changeTemperature(){
  1104. let max = 140;
  1105. let min = 100;
  1106. if(this.workMode == 2){
  1107. min = 1;
  1108. }
  1109. if(this.temperature<min){
  1110. this.temperature = min;
  1111. }
  1112. if(this.temperature>max){
  1113. this.temperature = max;
  1114. }
  1115. console.log("current temperature is :"+this.temperature)
  1116. this.sendJianYao("TempSetting");
  1117. },
  1118. changeTemperatureTime(){
  1119. let min = 1;
  1120. let max = 600;
  1121. if(this.temperatureTime<min){
  1122. this.temperatureTime = min;
  1123. }
  1124. if(this.temperatureTime>max){
  1125. this.temperatureTime = max;
  1126. }
  1127. console.log("current temperatureTime is :"+this.temperatureTime)
  1128. this.sendJianYao("TimeSetting");
  1129. },
  1130. jianyaoOpen(){
  1131. if(this.decoctControlOnOffStatus){
  1132. return true;
  1133. }
  1134. return false;
  1135. },
  1136. baozhuangOpen(){
  1137. if(this.packageControlOnOffStatus){
  1138. return true;
  1139. }
  1140. return false;
  1141. },
  1142. baozhuangRunning(){
  1143. if(this.qingxiTurn || this.baozhuangTurn || this.qitingTurn){
  1144. return true;
  1145. }
  1146. return false;
  1147. },
  1148. jianyaoIng(){
  1149. if(this.decoctControlStatus){
  1150. return true;
  1151. }
  1152. return false;
  1153. },
  1154. cancelPlan(){
  1155. let arr = [];
  1156. let obj = {};
  1157. obj.id = "AppointmentTime";
  1158. obj.shadow = 0;
  1159. arr.push(obj);
  1160. let self = this;
  1161. self.kongzhiJianyao(false,arr);
  1162. this.mqttPublish(2,this.deviceInfo,arr,true);
  1163. this.closeYuyueIngPop();
  1164. },
  1165. toPlan(){
  1166. if(!this.jianyaoOpen()){
  1167. this.$modal.showToast('煎药机已经关机')
  1168. return;
  1169. }
  1170. if(this.leftAppointmentTime>0){
  1171. this.yuyueIngPop = true;
  1172. }else{
  1173. if(this.jianyaoIng()){
  1174. this.$modal.showToast('正在煎药')
  1175. return;
  1176. }
  1177. this.planPopDlg = true;
  1178. }
  1179. },
  1180. calcuStep(){
  1181. if(this.leftAppointmentTime>0){
  1182. this.step = 0;
  1183. return 0;
  1184. }
  1185. if(this.leftJianyaoTime == 0){
  1186. this.step = 100;
  1187. return ;
  1188. }
  1189. let currentTemperature = this.currentTemperature;
  1190. let hightTemperature = this.temperatureTime-this.leftJianyaoTime;//设置的高温时间
  1191. let targetTemperature =100;// this.temperature;
  1192. let targetTemperatureTime = this.temperatureTime;//倒计时
  1193. if(targetTemperature>100){
  1194. targetTemperature = 100;
  1195. }
  1196. let step = 0;
  1197. if(currentTemperature<100){
  1198. let tem = currentTemperature/200*100;
  1199. step = tem;
  1200. }else{
  1201. step = 50;
  1202. let rate = hightTemperature/targetTemperatureTime;
  1203. rate = rate/2;
  1204. rate = rate*100;
  1205. rate = rate.toFixed(2)
  1206. step = step + parseFloat(rate);
  1207. }
  1208. this.step = step.toFixed(2);
  1209. },
  1210. plan(){
  1211. let self = this;
  1212. if(this.planTime>600){
  1213. this.$modal.showToast('预约时间最大为600分钟')
  1214. return;
  1215. }
  1216. if(this.planTime == 0){
  1217. this.$modal.showToast('预约时间不能为空')
  1218. }else{
  1219. let arr = [];
  1220. let obj = {};
  1221. obj.id = "AppointmentTime";
  1222. obj.shadow = this.planTime;
  1223. arr.push(obj);
  1224. this.kongzhiJianyao(true,arr);
  1225. this.mqttPublish(2,this.deviceInfo,arr,true);
  1226. }
  1227. this.$modal.showToast('预约成功')
  1228. this.planPopDlg = false;
  1229. },
  1230. lockCtrl(key){
  1231. let arr = [];
  1232. let obj = {};
  1233. obj.id = "LockControl";
  1234. if(key == 0){
  1235. obj.shadow = 1;
  1236. this.lock.value = 1;
  1237. }else{
  1238. obj.shadow = 0;
  1239. this.lock.value = 0;
  1240. }
  1241. arr.push(obj);
  1242. this.mqttPublish(2,this.deviceInfo,arr)
  1243. },
  1244. setMode(type){
  1245. let arr = [];
  1246. let obj = {};
  1247. obj.id = "WorkMode";
  1248. obj.shadow = type;
  1249. arr.push(obj);
  1250. this.mqttPublish(2,this.deviceInfo,arr,true)
  1251. this.workMode = type;
  1252. },
  1253. temperNumber(value){
  1254. let arr = [];
  1255. let obj = {};
  1256. obj.id = "CalibrationTemp";
  1257. obj.shadow = this.jiaozhunTemp;
  1258. arr.push(obj);
  1259. this.mqttPublish(2,this.deviceInfo,arr,true)
  1260. },
  1261. volumeNumber(){
  1262. let arr = [];
  1263. let obj = {};
  1264. obj.id = "CapacityCalibration";
  1265. obj.shadow = 1;
  1266. arr.push(obj);
  1267. this.mqttPublish(2,this.deviceInfo,arr,true)
  1268. },
  1269. showConfirm(title,content,yes,no){
  1270. uni.showModal({
  1271. title: title,
  1272. content: content,
  1273. success: function (res) {
  1274. if (res.confirm) {
  1275. yes();
  1276. } else if (res.cancel) {
  1277. no();
  1278. }
  1279. }
  1280. });
  1281. },
  1282. reset(){
  1283. let self = this;
  1284. this.showConfirm("提示","确认恢复出厂吗",function(){
  1285. let arr = [];
  1286. let obj = {};
  1287. obj.id = "RestoreFactory";
  1288. obj.shadow = 1;
  1289. arr.push(obj);
  1290. self.mqttPublish(2,self.deviceInfo,arr)
  1291. },function(){});
  1292. },
  1293. turnChange(type){
  1294. let flag = false;
  1295. let obj = {};
  1296. if(type ==3){
  1297. if(this.baozhuangTurn || this.qitingTurn){
  1298. this.$modal.showToast("启停、包装、清洗不能同时打开")
  1299. return;
  1300. }
  1301. flag = this.qingxiTurn;
  1302. obj.id = "WashSwitch";
  1303. }else if(type == 2){
  1304. if(this.qingxiTurn || this.qitingTurn){
  1305. this.$modal.showToast("启停、包装、清洗不能同时打开")
  1306. return;
  1307. }
  1308. flag = this.baozhuangTurn;
  1309. obj.id = "PackageSwitch";
  1310. }else if(type == 1) {
  1311. if(this.qingxiTurn || this.baozhuangTurn){
  1312. this.$modal.showToast("启停、包装、清洗不能同时打开")
  1313. return;
  1314. }
  1315. flag = this.qitingTurn;
  1316. obj.id = "CarrybagSwitch";
  1317. }
  1318. flag = !flag;
  1319. let arr = [];
  1320. if(flag){
  1321. obj.shadow = 1;
  1322. }else{
  1323. obj.shadow = 0;
  1324. }
  1325. arr.push(obj);
  1326. this.mqttPublish(2,this.deviceInfo,arr)
  1327. },
  1328. addPackageVolume(){
  1329. this.packageVolume++;
  1330. if(this.packageVolume>300){
  1331. this.packageVolume = 50;
  1332. }
  1333. console.log("增加包装容量")
  1334. this.changePackageVolume()
  1335. },
  1336. subPackageVolume(){
  1337. this.packageVolume--;
  1338. if( this.packageVolume<50){
  1339. this.packageVolume = 300;
  1340. }
  1341. console.log("减少包装容量")
  1342. this.changePackageVolume()
  1343. },
  1344. addPackageNumber(){
  1345. this.packageNumber++;
  1346. if(this.packageNumber>999){
  1347. this.packageNumber = 1;
  1348. }
  1349. console.log("增加包装数量")
  1350. this.changePackageNumber();
  1351. },
  1352. subPackageNumber(){
  1353. this.packageNumber--;
  1354. if(this.packageNumber<1){
  1355. this.packageNumber = 999;
  1356. }
  1357. console.log("减少包装数量")
  1358. this.changePackageNumber();
  1359. },
  1360. addSealingTemperature(){
  1361. console.log("增加封口温度")
  1362. if(!this.fengkouDlgShow){
  1363. this.fengkouDlgShow = true;
  1364. }
  1365. this.setSealingTemperature++;
  1366. this.changeSealingTemperature();
  1367. },
  1368. subSealingTemperature(){
  1369. console.log("减少封口温度")
  1370. if(!this.fengkouDlgShow){
  1371. this.fengkouDlgShow = true;
  1372. }
  1373. this.setSealingTemperature--;
  1374. this.changeSealingTemperature();
  1375. },
  1376. addEdegTemperature(){
  1377. console.log("增加封边温度")
  1378. this.editing = true;
  1379. if(!this.fengbianDlgShow){
  1380. this.fengbianDlgShow = true;
  1381. }
  1382. this.setEdegTemperature++;
  1383. this.changeEdegTemperature();
  1384. },
  1385. subEdegTemperature(){
  1386. console.log("减少封边温度")
  1387. this.editing = true;
  1388. if(!this.fengbianDlgShow){
  1389. this.fengbianDlgShow = true;
  1390. }
  1391. this.setEdegTemperature--;
  1392. this.changeEdegTemperature();
  1393. },
  1394. addTemperatureTime(){
  1395. console.log("增加煎药时间")
  1396. if(!this.wenhuoTimeDlgShow){
  1397. this.wenhuoTimeDlgShow = true;
  1398. this.temperatureTime = this.leftJianyaoTime;
  1399. }
  1400. this.temperatureTime++;
  1401. this.changeTemperatureTime()
  1402. },
  1403. subTemperatureTime(){
  1404. console.log("减少煎药时间")
  1405. if(!this.wenhuoTimeDlgShow){
  1406. this.wenhuoTimeDlgShow = true;
  1407. this.temperatureTime = this.leftJianyaoTime;
  1408. }
  1409. this.temperatureTime--;
  1410. if(this.temperatureTime<=0){
  1411. this.temperatureTime = 1;
  1412. }
  1413. this.changeTemperatureTime()
  1414. },
  1415. addTemperature(){
  1416. console.log("增加煎药温度")
  1417. this.temperature++;
  1418. this.changeTemperature();
  1419. },
  1420. subTemperature(type){
  1421. console.log("减少煎药温度")
  1422. this.temperature--;
  1423. this.changeTemperature();
  1424. },
  1425. addPlanTime(){
  1426. console.log("增加预约时间")
  1427. this.planTime++;
  1428. },
  1429. subPlanTime(){
  1430. console.log("减少预约时间")
  1431. this.planTime--;
  1432. },
  1433. sendBaozhuang(targetKey){
  1434. let self = this;
  1435. let arr = [];
  1436. if(this.baozhuangTimer != null){
  1437. clearTimeout(this.baozhuangTimer);
  1438. }
  1439. this.baozhuangTimer = setTimeout(function (){
  1440. for (let i = 0; i <this.baozhuangKeys.length; i++) {
  1441. let key = this.baozhuangKeys[i];
  1442. let obj = {};
  1443. obj.id = key;
  1444. if(key === "PackingVolume"){
  1445. obj.shadow = this.packageVolume;
  1446. setTimeout(function (){
  1447. self.baozhuangRongLiangSetting = false;
  1448. },self.resetDuration);
  1449. }
  1450. if(key === "PackageQuantity"){
  1451. obj.shadow = this.packageNumber;
  1452. setTimeout(function (){
  1453. self.baozhuangShuLIangSetting = false;
  1454. },self.resetDuration);
  1455. }
  1456. if(key === "SetSealTemp"){
  1457. obj.shadow = this.setSealingTemperature;
  1458. setTimeout(function (){
  1459. self.fengkouDlgShow = false;
  1460. self.baozhuangFengkouSetting = false;
  1461. self.sealingTemperature = self.tempFengKouWendu;;
  1462. },self.resetDuration);
  1463. }
  1464. if(key === "SetBandingTemp"){
  1465. obj.shadow = this.setEdegTemperature;
  1466. setTimeout(function (){
  1467. self.fengbianDlgShow = false;
  1468. self.baozhuangFengbianSetting = false;
  1469. self.edegTemperature = self.tempFengBianWendu;
  1470. },self.resetDuration);
  1471. }
  1472. if(targetKey == key){
  1473. arr.push(obj);
  1474. break;
  1475. }
  1476. }
  1477. this.mqttPublish(2,this.deviceInfo,arr)
  1478. }.bind(this),500);
  1479. },
  1480. sendJianYao(targetKey){
  1481. let self = this;
  1482. let arr = [];
  1483. if(this.jianyaoTimer != null){
  1484. clearTimeout(this.jianyaoTimer);
  1485. }
  1486. this.jianyaoTimer = setTimeout(function (){
  1487. for (let i = 0; i <this.jianyaoKeys.length; i++) {
  1488. let key = this.jianyaoKeys[i];
  1489. let obj = {};
  1490. obj.id = key;
  1491. if(key === "TempSetting"){
  1492. obj.shadow = this.temperature;
  1493. // setTimeout(function(){
  1494. // self.wenhuoTimeDlgShow = false;
  1495. // self.jianyaoShijianSetting = false;
  1496. // },self.resetDuration)
  1497. }
  1498. if(key === "TimeSetting"){
  1499. obj.shadow = this.temperatureTime;
  1500. self.leftJianyaoTime = this.temperatureTime;;
  1501. setTimeout(function(){
  1502. self.wenhuoTimeDlgShow = false;
  1503. self.jianyaoShijianSetting = false;
  1504. },self.resetDuration)
  1505. }
  1506. if(targetKey == key){
  1507. arr.push(obj);
  1508. break;
  1509. }
  1510. }
  1511. this.mqttPublish(2,this.deviceInfo,arr,true)
  1512. }.bind(this),500);
  1513. },
  1514. buildPropKey(key){
  1515. if(this.childId !=0){
  1516. return key+"_"+this.childId;
  1517. }else{
  1518. return key;
  1519. }
  1520. },
  1521. decoctControlChange(){
  1522. let obj = {};
  1523. let arr = [];
  1524. if(!this.decoctControlOnOffStatus){
  1525. this.notifyError("请先开机后再进行操作")
  1526. return;
  1527. }
  1528. if(this.decoctControlStatus){
  1529. this.showJianyao();
  1530. return;
  1531. }
  1532. this.decoctControlStatus = !this.decoctControlStatus;
  1533. obj.id = "DecoctingSwitch";
  1534. if(this.decoctControlStatus){
  1535. obj.shadow = 1;
  1536. console.log("煎药状态打开")
  1537. this.checkJianyao();
  1538. }else{
  1539. obj.shadow = 0;
  1540. console.log("煎药状态关闭")
  1541. }
  1542. arr.push(obj);
  1543. this.mqttPublish(2,this.deviceInfo,arr,true)
  1544. },
  1545. kongzhiJianyao(flag,arr){//不判断煎药状态
  1546. let obj = {};
  1547. if(!this.decoctControlOnOffStatus){
  1548. this.notifyError("请先开机后再进行操作")
  1549. return;
  1550. }
  1551. obj.id = "DecoctingSwitch";
  1552. if(flag){
  1553. obj.shadow = 1;
  1554. console.log("煎药状态打开")
  1555. this.checkJianyao();
  1556. }else{
  1557. obj.shadow = 0;
  1558. console.log("煎药状态关闭")
  1559. }
  1560. arr.push(obj);
  1561. },
  1562. stopDecoctControlChange(){
  1563. let obj = {};
  1564. let arr = [];
  1565. if(!this.decoctControlOnOffStatus){
  1566. this.notifyError("请先开机后再进行操作")
  1567. return;
  1568. }
  1569. if(!this.decoctControlStatus){
  1570. return;
  1571. }
  1572. this.decoctControlStatus = !this.decoctControlStatus;
  1573. obj.id = "DecoctingSwitch";
  1574. if(this.decoctControlStatus){
  1575. obj.shadow = 1;
  1576. console.log("煎药状态打开")
  1577. }else{
  1578. obj.shadow = 0;
  1579. console.log("煎药状态关闭")
  1580. }
  1581. arr.push(obj);
  1582. let obj2 = {};
  1583. obj2.id = "AppointmentTime";
  1584. obj2.shadow = 0;
  1585. arr.push(obj2);
  1586. this.mqttPublish(2,this.deviceInfo,arr,true)
  1587. },
  1588. decoctControlOnOffChange(){
  1589. let obj = {};
  1590. this.decoctControlOnOffStatus = !this.decoctControlOnOffStatus;
  1591. let arr = [];
  1592. obj.id = "PowerControl";
  1593. let isMul = false;
  1594. if(this.decoctControlStatus){
  1595. this.$modal.showToast('请先结束煎药后操作')
  1596. this.decoctControlOnOffStatus = !this.decoctControlOnOffStatus;
  1597. return;
  1598. }
  1599. if(this.oneToMul && this.firstTab){
  1600. obj.id = "PowerCtl";
  1601. isMul = true;
  1602. }
  1603. if(this.decoctControlOnOffStatus){
  1604. obj.shadow = 1;
  1605. console.log("煎药机开关打开")
  1606. }else{
  1607. obj.shadow = 0;
  1608. console.log("煎药机开关关闭")
  1609. }
  1610. arr.push(obj);
  1611. this.mqttPublish(2,this.deviceInfo,arr,isMul)
  1612. },
  1613. packageControlOnOffChange(){
  1614. let obj = {};
  1615. let arr = [];
  1616. if(this.baozhuangRunning()){
  1617. this.$modal.showToast('请先停止运行后操作')
  1618. return;
  1619. }
  1620. obj.id = "PackagePowerControl";
  1621. this.packageControlOnOffStatus = !this.packageControlOnOffStatus;
  1622. if(this.packageControlOnOffStatus){
  1623. console.log("包装机器开关打开")
  1624. obj.shadow = 1;
  1625. }else{
  1626. console.log("包装机器开关关闭")
  1627. obj.shadow = 0;
  1628. }
  1629. arr.push(obj);
  1630. this.mqttPublish(2,this.deviceInfo,arr)
  1631. },
  1632. containKey(arr,key){
  1633. for (let i = 0; i < arr.length; i++) {
  1634. const data = arr[i];
  1635. if(data == key){
  1636. return true;
  1637. }
  1638. }
  1639. return false;
  1640. },
  1641. // 抽屉状态发生变化触发
  1642. change(e, type) {
  1643. console.log(e);
  1644. },
  1645. showDrawer() {
  1646. this.$refs.showLeft.open();
  1647. },
  1648. closeDrawer() {
  1649. this.$refs.showLeft.close();
  1650. },
  1651. checkItemValue(item){
  1652. if(!item.shadow){
  1653. item.shadow = 0;
  1654. }
  1655. if(!item.unit){
  1656. item.unit = "";
  1657. }
  1658. return true;
  1659. },
  1660. sendProperties(){
  1661. let properties = this.properties;
  1662. for (let i = 0; i < properties; i++) {
  1663. let property = this.properties[i];
  1664. let shadow = property.shadow;
  1665. if(shadow){
  1666. arr.push(property);
  1667. }
  1668. }
  1669. this.mqttPublish(1,this.deviceInfo,arr)
  1670. },
  1671. sendFunctions(){
  1672. let arr = [];
  1673. let functions = this.functions;
  1674. for (let i = 0; i < functions.length; i++) {
  1675. let functionObj = this.functions[i];
  1676. let shadow = functionObj.shadow;
  1677. if(shadow){
  1678. arr.push(functionObj);
  1679. }
  1680. }
  1681. this.mqttPublish(2,this.deviceInfo,arr)
  1682. },
  1683. changeProp(key,val){
  1684. let item = null;
  1685. let obj = null;
  1686. let oneToMul = this.oneToMul;
  1687. if(key === "LockControl"){
  1688. this.lock.value = val;
  1689. item = this.lock;
  1690. }else if(key === "PowerControl"){
  1691. this.power.value = val;
  1692. item = this.power;
  1693. }
  1694. let value = val;
  1695. obj = item.item;
  1696. if(value){
  1697. obj.value = 1;
  1698. obj.shadow = 1;
  1699. }else{
  1700. obj.value = 0;
  1701. obj.shadow = 0;
  1702. }
  1703. if(!oneToMul){
  1704. }
  1705. this.publishThingsModel(this.deviceInfo,obj);
  1706. },
  1707. checkCommonProp(item){
  1708. let id =item.id;
  1709. let isCommonKey = this.modelKey.some(res=>{
  1710. return id === res;
  1711. })
  1712. return !isCommonKey;
  1713. },
  1714. getRunTime(){
  1715. let self = this;
  1716. getDeviceRunTime(this.id).then(res=>{
  1717. self.timeobj = res.data;
  1718. if(self.timeobj.avgtime == ""){
  1719. self.timeobj.avgtime = 0;
  1720. }
  1721. if(self.timeobj.alltime == ""){
  1722. self.timeobj.alltime = 0;
  1723. }
  1724. })
  1725. },
  1726. seeTime(){
  1727. this.showTimeDlg = true;
  1728. this.getRunTime();
  1729. },
  1730. closeTime(){
  1731. this.showTimeDlg = false;
  1732. },
  1733. cancel(){
  1734. this.showErrDlg = false;
  1735. },
  1736. reportError(){
  1737. this.showErrDlg = true;
  1738. },
  1739. doReportError(){
  1740. if(!this.errorMsg){
  1741. this.$modal.showToast('异常信息不能为空')
  1742. }else{
  1743. let self = this;
  1744. let errObj = {};
  1745. errObj.deviceId = this.deviceInfo.deviceId;
  1746. errObj.deviceName = this.deviceInfo.deviceName
  1747. errObj.desc = this.errorMsg;
  1748. errObj.deptId= this.deviceInfo.deptId;
  1749. reportError(errObj).then(res=>{
  1750. self.$modal.showToast(res.msg)
  1751. self.cancel();
  1752. })
  1753. }
  1754. },
  1755. openLocation(){
  1756. uni.openLocation({
  1757. latitude: this.location.latitude,
  1758. longitude: this.location.longitude,
  1759. success: function () {
  1760. console.log('success');
  1761. }
  1762. });
  1763. },
  1764. confirmItemData(e){
  1765. let data = e.value[0];
  1766. this.show.text = data.text;
  1767. this.show.shadow=data.value;
  1768. this.show = null;
  1769. console.log(data);
  1770. },
  1771. send(){
  1772. let shadow = false
  1773. let _arr = []
  1774. this.inputProp.forEach((item)=>{
  1775. _arr.push(item.value)
  1776. })
  1777. // if(_arr.some(val => val === '' || val.length < 0)){
  1778. // shadow = true
  1779. // }
  1780. if(this.deviceInfo.status != 3){
  1781. uni.showToast({
  1782. title:"设备暂未上线",
  1783. icon:"error"
  1784. })
  1785. return;
  1786. }
  1787. if(shadow){
  1788. uni.showToast({
  1789. title:"数据不能为空",
  1790. icon:"error"
  1791. })
  1792. return;
  1793. }
  1794. this.publishThingsModel(this.deviceInfo,this.inputProp.map(item=>{return{"id":item.id,"value":item.value}}))
  1795. },
  1796. /** 更新设备状态 */
  1797. updateDeviceStatus(device) {
  1798. },
  1799. chooseItemData(data){
  1800. if(this.deviceInfo.status != 3){
  1801. uni.showToast({
  1802. title:"设备暂未上线",
  1803. icon:"error"
  1804. })
  1805. return;
  1806. }
  1807. this.columns = [data.enumList];
  1808. this.show =data;
  1809. },
  1810. getDetail(){
  1811. let self = this;
  1812. getDetail(this.id).then(res=>{
  1813. self.deviceInfo = res.data;
  1814. self.deviceType = res.data.type;
  1815. let online = self.deviceInfo == 3?true:false;
  1816. if(!online){
  1817. if(!self.onlineStatus){
  1818. uni.showModal({
  1819. title: '系统提示',
  1820. content: "设备未在线,无法操作",
  1821. confirmText: '确定',
  1822. showCancel:false,
  1823. success(res){
  1824. if(res.confirm){
  1825. self.onlineStatus = true;
  1826. }
  1827. },
  1828. })
  1829. }
  1830. }
  1831. console.log("当前设备类型:"+JSON.stringify(self.deviceInfo.type))
  1832. self.location = {
  1833. latitude: self.deviceInfo.latitude,
  1834. longitude: self.deviceInfo.longitude};
  1835. self.sysDept = self.deviceInfo.sysDept;
  1836. self.parseSummay(res.data.summary)
  1837. self.mqttSubscribe(res.data);
  1838. self.getDeviceStatus();
  1839. self.seeTime();
  1840. let heng = false;
  1841. self.productImage = self.imgUrl+'/detail/product.png'
  1842. if(self.deviceType == 4 ||self.deviceType == 5 ){
  1843. self.secondMachine = true;
  1844. }
  1845. if(self.deviceType == 5){
  1846. self.thirdMachine = true;
  1847. }
  1848. if(self.deviceType == 1 || self.deviceType == 7){
  1849. self.forthMachine = false;
  1850. self.productImage = self.imgUrl+'/product/YJH20.png'
  1851. }
  1852. self.fixImage(heng);
  1853. self.$forceUpdate();
  1854. });
  1855. },
  1856. getDeviceStatus(func){
  1857. let self = this;
  1858. if(this.summary.length>1){
  1859. }else{
  1860. this.childId = 0;
  1861. }
  1862. uni.showLoading({title:"加载中"});
  1863. getDeviceStatus(this.id,this.childId).then(res=>{
  1864. let data =res.data;
  1865. this.deviceInfo = data;
  1866. self.parseStatusData(data)
  1867. setTimeout(function () {
  1868. uni.hideLoading();
  1869. if(typeof func == "function"){
  1870. func();
  1871. }
  1872. },50);
  1873. });
  1874. },
  1875. getNewDeviceStatus(item){
  1876. console.log(item);
  1877. let self = this;
  1878. if(item.index == 0){
  1879. this.firstTab = true;
  1880. this.getDeviceStatus();
  1881. }
  1882. if(item.index == 1){
  1883. this.firstTab = false;
  1884. getDeviceStatus(this.id,0).then(res=>{
  1885. let data =res.data;
  1886. this.deviceInfo = data;
  1887. self.parseStatusData(data)
  1888. });
  1889. }
  1890. },
  1891. changeSub(item){
  1892. this.childId = item.id;
  1893. this.getDeviceStatus()
  1894. },
  1895. parseEnumList(){
  1896. let enumList = this.deviceInfo.enumList;
  1897. for (let enumListElement of enumList) {
  1898. let id = enumListElement.id;
  1899. if(id.indexOf("LockControl") !=-1){
  1900. let shadow = enumListElement.shadow;
  1901. this.lock.item = enumListElement;
  1902. if(shadow == 1){
  1903. this.lock.value = true;
  1904. this.lock.loading = false;
  1905. }else if(shadow == 0){
  1906. this.lock.value = false;
  1907. this.lock.loading = false;
  1908. }else{
  1909. this.lock.loading = true;
  1910. }
  1911. }
  1912. if(id.indexOf("PowerControl") !=-1){
  1913. let shadow = enumListElement.shadow;
  1914. if(this.oneToMul){
  1915. if(!this.firstTab){
  1916. if(shadow == 1){
  1917. this.decoctControlOnOffStatus = true;
  1918. }else if(shadow == 0){
  1919. this.decoctControlOnOffStatus = false;
  1920. }
  1921. }
  1922. }else{
  1923. if(shadow == 1){
  1924. this.decoctControlOnOffStatus = true;
  1925. }else if(shadow == 0){
  1926. this.decoctControlOnOffStatus = false;
  1927. }
  1928. }
  1929. }
  1930. if(id.indexOf("PowerCtl") !=-1){
  1931. if(this.oneToMul && this.firstTab){
  1932. let shadow = enumListElement.shadow;
  1933. if(shadow == 1){
  1934. this.decoctControlOnOffStatus = true;
  1935. }else if(shadow == 0){
  1936. this.decoctControlOnOffStatus = false;
  1937. }
  1938. }
  1939. }
  1940. this.formatValue(id,enumListElement,"PackagePowerControl","packageControlOnOffStatus")
  1941. this.formatValue(id,enumListElement,"DecoctingSwitch","decoctControlStatus")
  1942. this.formatValue(id,enumListElement,"CarrybagSwitch","qitingTurn")
  1943. this.formatValue(id,enumListElement,"WashSwitch","qingxiTurn")
  1944. this.formatValue(id,enumListElement,"PackageSwitch","baozhuangTurn");
  1945. if(id.indexOf("WorkMode") !=-1){
  1946. let shadow = enumListElement.shadow;
  1947. if(!shadow){
  1948. shadow = 1;
  1949. }
  1950. this.workMode = shadow;
  1951. }
  1952. let shadow = enumListElement.shadow
  1953. let valueList = enumListElement.enumList;
  1954. for (let valueObj of valueList){
  1955. if(valueObj.value == shadow){
  1956. enumListElement.text = valueObj.text;
  1957. }
  1958. }
  1959. }
  1960. },
  1961. formatValue(id,enumListElement,key,propkey){
  1962. if(id.indexOf(key) !=-1){
  1963. let shadow = enumListElement.shadow;
  1964. if(shadow == 1){
  1965. this[propkey] = true;
  1966. }else if(shadow == 0){
  1967. this[propkey] = false;
  1968. }
  1969. }
  1970. },
  1971. parseStatusData(data){
  1972. let self = this;
  1973. cacheJsonThingsModel(data.productId).then(res=>{
  1974. let thingsModel = JSON.parse(res.data);
  1975. let arr = [];
  1976. let arrayList = data.arrayList;
  1977. arr = arr.concat(arrayList);
  1978. let enumList = data.enumList;
  1979. arr = arr.concat(enumList);
  1980. let integerList = data.integerList;
  1981. arr = arr.concat(integerList);
  1982. let stringList = data.stringList;
  1983. arr = arr.concat(stringList);
  1984. self.inputProp = arr;
  1985. for (let i = 0; i < thingsModel.functions.length; i++) {
  1986. for (let j = 0; j < arr.length; j++) {
  1987. let model = arr[j];
  1988. if(model.id == thingsModel.functions[i].id){
  1989. self.functions.push(model);
  1990. }
  1991. }
  1992. }
  1993. for (let i = 0; i < thingsModel.properties.length; i++) {
  1994. for (let j = 0; j < arr.length; j++) {
  1995. let model = arr[j];
  1996. if(model.id == thingsModel.properties[i].id){
  1997. self.properties.push(model);
  1998. }
  1999. }
  2000. }
  2001. let readOnlyList = data.readOnlyList;
  2002. self.watchProp = readOnlyList;
  2003. self.parseEnumList();
  2004. self.parseProp();
  2005. self.checkJianyao();
  2006. })
  2007. },
  2008. showJianyao(){
  2009. this.calcuStep();
  2010. this.planIngPopDlg = true;
  2011. },
  2012. parseProp(){
  2013. let self = this;
  2014. for (let i = 0; i <self.inputProp.length; i++) {
  2015. let prop = self.inputProp[i];
  2016. let value = prop.shadow||0;
  2017. let id = prop.id;
  2018. if(id === "TimeSetting"){//温度设置
  2019. self.temperatureTime = value;
  2020. }
  2021. if(!self.jianyaoWenduSetting){
  2022. if(id === "TempSetting"){
  2023. self.temperature = value;
  2024. }
  2025. }
  2026. this.setPropValue(id,"SlowfireTiem","leftJianyaoTime",value,0)
  2027. this.setPropValue(id,"HighTempTime","hightTemperature",value,0)
  2028. this.setPropValue(id,"CurrentTemp","currentTemperature",value,0)
  2029. this.setPropValue(id,"CalibrationTemp","jiaozhunTemp",value,0)
  2030. this.setPropValue(id,"PackingVolume","packageVolume",value,50)
  2031. this.setPropValue(id,"PackageQuantity","packageNumber",value,1)
  2032. //封边温度
  2033. this.setPropValue(id,"BandingTemp","edegTemperature",value);
  2034. this.setPropValue(id,"BandingTemp","tempFengBianWendu",value)
  2035. //封口温度
  2036. this.setPropValue(id,"SealTemp","sealingTemperature",value);
  2037. this.setPropValue(id,"SealTemp","tempFengKouWendu",value)
  2038. this.setPropValue(id,"LeftAppointmentTime","leftAppointmentTime",value,0)
  2039. self.propMap[id] = prop;
  2040. }
  2041. },
  2042. setPropValue(id,key,propKey,value,defaultValue){
  2043. if(!value && defaultValue){
  2044. value = defaultValue;
  2045. }
  2046. if(id === key){
  2047. this[propKey] = value;
  2048. }
  2049. },
  2050. parseSummay(summary){
  2051. let self = this;
  2052. if(!summary){
  2053. summary = "";
  2054. }
  2055. if(summary.length>0){
  2056. this.summary = JSON.parse(summary);
  2057. if(self.summary.length>0){
  2058. this.oneToMul = true;
  2059. for (let i = 0; i < self.summary.length; i++) {
  2060. self.summary[i].tabName = self.summary[i].name
  2061. }
  2062. let childId = "";
  2063. if(this.oneToMul){
  2064. this.childId = self.summary[0].id;
  2065. }
  2066. }else{
  2067. this.summary = [{name:"煎药机一"}]
  2068. }
  2069. }else{
  2070. this.summary = [{name:"煎药机一"}]
  2071. }
  2072. },
  2073. goDeviceDetail(id){
  2074. uni.navigateTo({
  2075. url: '/pages/device/detail/detail?id='+id
  2076. });
  2077. },
  2078. async connectMqtt() {
  2079. if (this.$mqttTool.client == null) {
  2080. await this.$mqttTool.connect(this.vuex_token);
  2081. }
  2082. this.mqttCallback();
  2083. this.startCheck();
  2084. },
  2085. /** Mqtt订阅主题 */
  2086. mqttSubscribe(device) {
  2087. // 订阅当前设备状态和实时监测
  2088. let topicStatus = '/' + device.productId + '/' + device.serialNumber + '/status/post';
  2089. let topicProperty = '/' + device.productId + '/' + device.serialNumber + '/property/post';
  2090. let topicFunction = '/' + device.productId + '/' + device.serialNumber + '/function/post';
  2091. let topics = [];
  2092. topics.push(topicStatus);
  2093. topics.push(topicProperty);
  2094. topics.push(topicFunction);
  2095. this.$mqttTool.subscribe(topics);
  2096. },
  2097. /** Mqtt取消订阅主题 */
  2098. mqttUnSubscribe(device) {
  2099. // 订阅当前设备状态和实时监测
  2100. let topicStatus = '/' + device.productId + '/' + device.serialNumber + '/status/post';
  2101. let topicProperty = '/' + device.productId + '/' + device.serialNumber + '/property/post';
  2102. let topicFunction = '/' + device.productId + '/' + device.serialNumber + '/function/post';
  2103. let topics = [];
  2104. topics.push(topicStatus);
  2105. topics.push(topicProperty);
  2106. topics.push(topicFunction);
  2107. console.log('取消订阅', topics);
  2108. this.$mqttTool.unsubscribe(topics);
  2109. },
  2110. /* Mqtt回调处理 */
  2111. mqttCallback() {
  2112. this.$mqttTool.client.on('message', (topic, message, buffer) => {
  2113. let topics = topic.split('/');
  2114. let productId = topics[1];
  2115. let deviceNum = topics[2];
  2116. console.log('接收到内容:'+message);
  2117. message = JSON.parse(message.toString());
  2118. if (topics[3] == 'status') {
  2119. console.log('接收到【设备状态-运行】主题:', topic);
  2120. console.log('接收到【设备状态-运行】内容:', message);
  2121. // 更新列表中设备的状态
  2122. if (this.deviceInfo.serialNumber == deviceNum) {
  2123. this.deviceInfo.status = message.status;
  2124. this.deviceInfo.isShadow = message.isShadow;
  2125. this.deviceInfo.rssi = message.rssi;
  2126. this.updateDeviceStatus(this.deviceInfo);
  2127. }
  2128. }
  2129. if (topics[3] == 'property' || topics[3] == 'function') {
  2130. console.log('接收到【物模型】主题:', topic);
  2131. console.log('接收到【物模型】内容:', message);
  2132. if(this.oneToMul){
  2133. let curTabId = this.childId;
  2134. let msg = [];
  2135. for (let i = 0; i < message.length; i++) {
  2136. let curMsg = message[i];
  2137. let id = curMsg.id;
  2138. let ids = id.split("_");
  2139. let value = curMsg.value;
  2140. if(ids.length == 2){
  2141. if(curTabId == ids[1]){
  2142. msg.push({id:ids[0],value:value});
  2143. }
  2144. }else{
  2145. msg.push(curMsg);
  2146. }
  2147. }
  2148. message = msg;
  2149. }
  2150. // 更新列表中设备的属性
  2151. if (this.deviceInfo.serialNumber == deviceNum) {
  2152. for (let j = 0; j < message.length; j++) {
  2153. let isComplete = false;
  2154. let msgId = message[j].id;
  2155. this.exchangeData(msgId,message[j]);
  2156. // 布尔类型
  2157. for (let k = 0; k < this.deviceInfo.boolList.length && !isComplete; k++) {
  2158. if (this.deviceInfo.boolList[k].id == message[j].id) {
  2159. this.deviceInfo.boolList[k].shadow = message[j].value;
  2160. isComplete = true;
  2161. break;
  2162. }
  2163. }
  2164. // 枚举类型
  2165. for (let k = 0; k < this.deviceInfo.enumList.length && !isComplete; k++) {
  2166. if (this.deviceInfo.enumList[k].id == message[j].id) {
  2167. this.deviceInfo.enumList[k].shadow = message[j].value;
  2168. isComplete = true;
  2169. break;
  2170. }
  2171. }
  2172. // 字符串类型
  2173. for (let k = 0; k < this.deviceInfo.stringList.length && !isComplete; k++) {
  2174. if (this.deviceInfo.stringList[k].id == message[j].id) {
  2175. this.deviceInfo.stringList[k].shadow = message[j].value;
  2176. isComplete = true;
  2177. break;
  2178. }
  2179. }
  2180. // 数组类型
  2181. for (let k = 0; k < this.deviceInfo.arrayList.length && !isComplete; k++) {
  2182. if (this.deviceInfo.arrayList[k].id == message[j].id) {
  2183. this.deviceInfo.arrayList[k].shadow = message[j].value;
  2184. isComplete = true;
  2185. break;
  2186. }
  2187. }
  2188. // 整数类型
  2189. for (let k = 0; k < this.deviceInfo.integerList.length && !isComplete; k++) {
  2190. if (this.deviceInfo.integerList[k].id == message[j].id) {
  2191. this.deviceInfo.integerList[k].shadow = message[j].value;
  2192. isComplete = true;
  2193. break;
  2194. }
  2195. }
  2196. // 小数类型
  2197. for (let k = 0; k < this.deviceInfo.decimalList.length && !isComplete; k++) {
  2198. if (this.deviceInfo.decimalList[k].id == message[j].id) {
  2199. this.deviceInfo.decimalList[k].shadow = message[j].value;
  2200. isComplete = true;
  2201. break;
  2202. }
  2203. }
  2204. // 监测数据
  2205. for (let k = 0; k < this.deviceInfo.readOnlyList.length && !isComplete; k++) {
  2206. if (this.deviceInfo.readOnlyList[k].id == message[j].id) {
  2207. this.deviceInfo.readOnlyList[k].shadow = message[j].value;
  2208. // 更新图表
  2209. // for (let m = 0; m < this.monitorChart.length; m++) {
  2210. // if (message[j].id == this.monitorChart[m].data.id) {
  2211. // let data = [{
  2212. // value: message[j].value,
  2213. // name: this.monitorChart[m].data.name
  2214. // }];
  2215. // this.monitorChart[m].chart.setOption({
  2216. // series: [{
  2217. // data: data
  2218. // }]
  2219. // });
  2220. // break;
  2221. // }
  2222. // }
  2223. isComplete = true;
  2224. break;
  2225. }
  2226. }
  2227. }
  2228. this.parseEnumList();
  2229. this.checkJianyao();
  2230. if(this.planIngPopDlg){
  2231. this.calcuStep();
  2232. }
  2233. }
  2234. this.$forceUpdate();
  2235. }
  2236. });
  2237. },
  2238. checkJianyao(){
  2239. // if(!this.jianyaoPopClose){
  2240. // return;
  2241. // }
  2242. // let self = this;
  2243. // setTimeout(function(){
  2244. // if(self.decoctControlStatus){
  2245. // self.showJianyao();
  2246. // }
  2247. // },1000);
  2248. },
  2249. exchangeData(msgId,obj){
  2250. if(msgId === "TempSetting"){
  2251. this.temperature = obj.value;
  2252. }
  2253. if(msgId === "TimeSetting"){
  2254. this.temperatureTime = obj.value;
  2255. }
  2256. if(msgId === "CurrentTemp"){
  2257. this.currentTemperature = obj.value;
  2258. }
  2259. if(msgId === "HighTempTime"){
  2260. this.hightTemperature = obj.value;
  2261. }
  2262. if(msgId === "SealTemp"){//封口温度
  2263. if(!this.editing){
  2264. if(this.baozhuangFengkouSetting){
  2265. this.tempFengkouWendu = obj.value;
  2266. }else{
  2267. this.sealingTemperature = obj.value;
  2268. }
  2269. }
  2270. }
  2271. if(msgId === "BandingTemp"){//封边温度
  2272. if(!this.editing){
  2273. if(this.baozhuangFengbianSetting){
  2274. this.tempFengBianWendu = obj.value;
  2275. }else{
  2276. this.edegTemperature = obj.value;
  2277. }
  2278. }
  2279. }
  2280. if(msgId === "PackingVolume"){
  2281. if(!this.editing){
  2282. if(this.baozhuangRongLiangSetting){
  2283. }else{
  2284. this.packageVolume = obj.value;
  2285. }
  2286. }
  2287. }
  2288. if(msgId === "PackageQuantity"){
  2289. if(!this.editing){
  2290. if(this.baozhuangShuLIangSetting){
  2291. }else{
  2292. this.packageNumber = obj.value;
  2293. }
  2294. }
  2295. }
  2296. if(msgId === "LeftAppointmentTime"){
  2297. this.leftAppointmentTime = obj.value;
  2298. }
  2299. if(msgId === "SlowfireTiem"){
  2300. this.leftJianyaoTime = obj.value;
  2301. }
  2302. if(msgId === "CalibrationTemp"){
  2303. this.jiaozhunTemp = obj.value;
  2304. }
  2305. },
  2306. /** 发布物模型 类型(1=属性,2=功能) */
  2307. publishThingsModel(device, model) {
  2308. // 获取缓存的Json物模型
  2309. cacheJsonThingsModel(device.productId).then(response => {
  2310. let thingsModel = JSON.parse(response.data);
  2311. let type = 0;
  2312. for (let i = 0; i < thingsModel.functions.length; i++) {
  2313. if (model.id == thingsModel.functions[i].id) {
  2314. type = 2;
  2315. break;
  2316. }
  2317. }
  2318. if (type == 0) {
  2319. for (let i = 0; i < thingsModel.properties.length; i++) {
  2320. if (model.id == thingsModel.properties[i].id) {
  2321. type = 1;
  2322. break;
  2323. }
  2324. }
  2325. }
  2326. if (type != 0) {
  2327. this.mqttPublish(type, device, [model]);
  2328. }
  2329. });
  2330. },
  2331. notifyError(res){
  2332. uni.showToast({
  2333. title:res,
  2334. icon:"error"
  2335. })
  2336. },
  2337. notifySuccess(res){
  2338. uni.showToast({
  2339. title:res,
  2340. icon:"success"
  2341. })
  2342. },
  2343. getDownloadUrl(path){
  2344. return this.firmware.downUrl +"/iot/tool/download?fileName="+ path;
  2345. },
  2346. /**
  2347. * Mqtt发布消息
  2348. * @type 类型(1=属性,2=功能,3=OTA升级,4=实时监测)
  2349. * @device 设备
  2350. * @model 物模型
  2351. * */
  2352. mqttPublish(type, device, modelList,needMore) {
  2353. if(this.deviceInfo.status != 3){
  2354. this.notifyError("请等待设备上线后操作")
  2355. return;
  2356. }
  2357. if(modelList.length == 0){
  2358. return;
  2359. }
  2360. let topic = "";
  2361. let message = ""
  2362. let oneToMul = false;
  2363. if(this.summary.length>1){
  2364. oneToMul = true;
  2365. }
  2366. if(!needMore){
  2367. oneToMul = false;
  2368. }
  2369. if(this.firstTab){
  2370. let isKaijiKey = false;
  2371. if(modelList.length >0){
  2372. let modelData = modelList[0];
  2373. let curKeyId = modelData.id;
  2374. if(!this.decoctControlOnOffStatus){
  2375. if(oneToMul){
  2376. if(curKeyId.indexOf("PowerCtl") !=-1){
  2377. isKaijiKey = true;
  2378. }
  2379. }else{
  2380. if(curKeyId.indexOf("PowerControl") !=-1){
  2381. isKaijiKey = true;
  2382. }
  2383. }
  2384. }else{
  2385. isKaijiKey = true;
  2386. }
  2387. }
  2388. if(!isKaijiKey){
  2389. this.notifyError("请先开机后再进行操作")
  2390. return;
  2391. }
  2392. }else{
  2393. let isKaijiKey = false;
  2394. if(modelList.length >0){
  2395. let modelData = modelList[0];
  2396. let curKeyId = modelData.id;
  2397. if(!this.packageControlOnOffStatus){
  2398. if(curKeyId.indexOf("PackagePowerControl") !=-1){
  2399. isKaijiKey = true;
  2400. }
  2401. }else{
  2402. isKaijiKey = true;
  2403. }
  2404. }
  2405. if(!isKaijiKey){
  2406. this.notifyError("请先开机后再进行操作")
  2407. return;
  2408. }
  2409. }
  2410. if (type == 1) {
  2411. if (device.status == 3) {
  2412. // 属性,在线模式
  2413. topic = "/" + device.productId + "/" + device.serialNumber + "/property-online/get";
  2414. }
  2415. } else if (type == 2) {
  2416. if (device.status == 3) {
  2417. // 功能,在线模式
  2418. topic = "/" + device.productId + "/" + device.serialNumber + "/function-online/get";
  2419. }
  2420. } else if (type == 3) {
  2421. // OTA升级
  2422. topic = "/" + device.productId + "/" + device.serialNumber + "/ota/get";
  2423. } else {
  2424. return;
  2425. }
  2426. let title = "";
  2427. if(type == 1){
  2428. title = "属性";
  2429. }else if(type == 2){
  2430. title = "功能";
  2431. }else if(type == 3){
  2432. title = "升级";
  2433. }
  2434. if (topic != "") {
  2435. // 发布
  2436. let arr = [];
  2437. for (let i = 0; i <modelList.length; i++) {
  2438. let model = modelList[i];
  2439. let modelId = model.id;
  2440. if(oneToMul){
  2441. let childId = this.childId;
  2442. if(childId){
  2443. modelId = modelId+"_"+childId;
  2444. }
  2445. }
  2446. let shadow = model.shadow+"";
  2447. let modelType = model.type;
  2448. let shadowInt = parseInt(shadow,10);
  2449. let isNumber = false;
  2450. let shadowStr = shadowInt+"";
  2451. if(shadowStr === shadow){
  2452. isNumber = true;
  2453. shadow = shadowInt;
  2454. }
  2455. if(modelType == "integer" && !isNumber){
  2456. this.$modal.showToast(model.name+'的值必须是数字类型')
  2457. return;
  2458. }
  2459. arr.push({id:modelId,value:shadow+""});
  2460. }
  2461. message = JSON.stringify(arr);
  2462. let self = this;
  2463. this.$mqttTool.publish(topic, message,title).then(res => {
  2464. this.notifySuccess(res);
  2465. }).catch(res => {
  2466. this.notifyError(res);
  2467. });
  2468. }
  2469. },
  2470. startCheck(){
  2471. let self = this;
  2472. this.checkTimer = setTimeout(function (){
  2473. self.sendHeart();
  2474. self.startCheck();
  2475. },20000);
  2476. },
  2477. checkActive(){
  2478. let self = this;
  2479. setTimeout(function (){
  2480. if(self.publishMsg){
  2481. self.resetConn()
  2482. }
  2483. },3000);
  2484. },
  2485. sendHeart(){
  2486. console.log("发送心跳111")
  2487. let device = this.deviceInfo;
  2488. let self = this;
  2489. let topic = "/property-offline/post";
  2490. self.publishMsg = true;
  2491. self.checkActive();
  2492. this.$mqttTool.publish(topic, "ok", "heart").then(res => {
  2493. self.publishMsg = false;
  2494. }).catch(res => {
  2495. self.publishMsg = false;
  2496. });
  2497. },
  2498. resetConn(){
  2499. console.log("检测异常,重连")
  2500. this.$mqttTool.end();
  2501. this.$mqttTool.client = null;
  2502. this.connectMqtt();
  2503. this.getDetail();
  2504. }
  2505. }
  2506. }
  2507. </script>
  2508. <style>
  2509. .send_btn{
  2510. width: 160rpx !important;
  2511. height: 40rpx !important;
  2512. font-size: 10px !important;
  2513. margin-top: 5px;
  2514. }
  2515. uni-col{
  2516. width: 150px;
  2517. }
  2518. .header{
  2519. width: 100%;
  2520. background: white;
  2521. padding:0px 20rpx;
  2522. position: relative;
  2523. height: 100vh;
  2524. position: relative;
  2525. }
  2526. .content {
  2527. display: flex;
  2528. align-items: center;
  2529. justify-content: center;
  2530. color: #060B25;
  2531. }
  2532. .logo {
  2533. height: 200rpx;
  2534. width: 200rpx;
  2535. margin-top: 200rpx;
  2536. margin-left: auto;
  2537. margin-right: auto;
  2538. margin-bottom: 50rpx;
  2539. }
  2540. .text-area {
  2541. margin:10px;
  2542. padding-bottom: 10px;
  2543. justify-content: center;
  2544. width: 100%;
  2545. }
  2546. .grid-text {
  2547. font-size: 14px;
  2548. color: #909399;
  2549. padding: 10rpx 0 20rpx 0rpx;
  2550. /* #ifndef APP-PLUS */
  2551. box-sizing: border-box;
  2552. /* #endif */
  2553. }
  2554. .title {
  2555. font-size: 36rpx;
  2556. color: #8f8f94;
  2557. }
  2558. .item{
  2559. height: 80rpx;
  2560. line-height: 80rpx;
  2561. }
  2562. .bg{
  2563. position: relative;
  2564. }
  2565. .text-left{
  2566. color: #8A92A5;
  2567. }
  2568. .text-right{
  2569. color: #545454;
  2570. }
  2571. .prop-text{
  2572. position: relative;
  2573. margin:20rpx 0;
  2574. font-size: 26rpx;
  2575. }
  2576. .prop-card-area{
  2577. }
  2578. .prop-card{
  2579. width: 28%;
  2580. height: 100rpx;
  2581. text-align: center;
  2582. display: inline-block;
  2583. background: #F5FCFF;
  2584. box-shadow: 0px 9rpx 8rpx 0px rgba(0,0,0,0.09);
  2585. border-radius: 8rpx;
  2586. margin:0px 15rpx;
  2587. line-height: 48rpx;
  2588. }
  2589. .prop-card-top{
  2590. color: #3E9CFC;
  2591. }
  2592. .prop-card-bottom{
  2593. color: #8A92A5;
  2594. }
  2595. .tab-area {
  2596. background: white;
  2597. position: absolute;
  2598. left: 0px;
  2599. right: 0px;
  2600. top:480rpx;
  2601. bottom:-20px;
  2602. min-height: 200rpx;
  2603. box-shadow: 0rpx 5rpx 27rpx 0rpx rgba(195, 195, 195, 0.4);
  2604. border-radius: 40rpx;
  2605. overflow-y: auto;
  2606. padding-bottom:80rpx;
  2607. }
  2608. .prop-item{
  2609. position: relative;
  2610. display: flex;
  2611. flex-direction: row;
  2612. height: 100rpx;
  2613. line-height: 100rpx;
  2614. margin:0 20rpx;
  2615. }
  2616. .prop-item-left{
  2617. color: #545454;
  2618. width: 100%;
  2619. font-size: 16px;
  2620. border-bottom: 1px solid lightgray;
  2621. margin-left: 120rpx;
  2622. }
  2623. .prop-item-image{
  2624. width: 120rpx;
  2625. height: 120rpx;
  2626. position: absolute;
  2627. bottom:-10rpx;
  2628. }
  2629. .prop-item-right{
  2630. position: absolute;
  2631. right:10rpx;
  2632. top:5rpx;
  2633. }
  2634. input::-webkit-input-placeholder,textarea::-webkit-input-placeholder{
  2635. color:#666;
  2636. font-size:12px;
  2637. }
  2638. .clearfix::after {
  2639. content: "";
  2640. display: block;
  2641. clear: both;
  2642. }
  2643. .decoctControlHeader {
  2644. display: flex;
  2645. align-items: center;
  2646. font-weight: 600;
  2647. }
  2648. .decoctControlTop {
  2649. display: flex;
  2650. height: 240rpx;
  2651. border-bottom:1px #B2B2B2 dotted;
  2652. margin:0 40rpx;
  2653. }
  2654. .decoctControlTopLeft {
  2655. width:40%;
  2656. line-height: 2;
  2657. text-align: center;
  2658. margin: 0 15px;
  2659. position: relative;
  2660. }
  2661. .addTemperature {
  2662. border-radius:5px;
  2663. position:absolute;
  2664. background-color: dodgerblue;
  2665. color:white;
  2666. width: 30px;
  2667. height: 30px;
  2668. left:15px;
  2669. top:80px;
  2670. }
  2671. .addTemperatureBtn {
  2672. border-radius:10px;
  2673. position:absolute;
  2674. clip-path: polygon(50% 0,100% 100%,0 100%);
  2675. transform: scale(0.5);
  2676. left: 0;
  2677. top:0;
  2678. bottom: 0;
  2679. right: 0;
  2680. margin: auto;
  2681. }
  2682. .subTemperature {
  2683. border-radius:5px;
  2684. position:absolute;
  2685. background-color: dodgerblue;
  2686. color:white;
  2687. width: 30px;
  2688. height: 30px;
  2689. right:15px;
  2690. top:80px;
  2691. }
  2692. .subTemperatureBtn {
  2693. border-radius:10px;
  2694. position:absolute;
  2695. clip-path: polygon(50% 0,100% 100%,0 100%);
  2696. transform: scale(0.5);
  2697. left: 0;
  2698. top:0;
  2699. bottom: 0;
  2700. right: 0;
  2701. margin: auto;
  2702. }
  2703. .decoctControlTopRight {
  2704. width:40%;
  2705. line-height: 2;
  2706. text-align: center;
  2707. margin: 0 15px;
  2708. position: relative;
  2709. }
  2710. .decoctControlBottom {
  2711. border-bottom:1px #B2B2B2 dotted;
  2712. width:91vw;
  2713. margin:0 auto;
  2714. padding:10px;
  2715. display: flex;
  2716. justify-content:space-between;
  2717. align-items: center;
  2718. }
  2719. .addTime {
  2720. border-radius:5px;
  2721. position:absolute;
  2722. background-color: dodgerblue;
  2723. color:white;
  2724. width: 30px;
  2725. height: 30px;
  2726. left:15px;
  2727. top:80px;
  2728. }
  2729. .addTimeBtn {
  2730. border-radius:10px;
  2731. position:absolute;
  2732. clip-path: polygon(50% 0,100% 100%,0 100%);
  2733. transform: scale(0.5);
  2734. left: 0;
  2735. top:0;
  2736. bottom: 0;
  2737. right: 0;
  2738. margin: auto;
  2739. }
  2740. .subTime {
  2741. border-radius:5px;
  2742. position:absolute;
  2743. background-color: dodgerblue;
  2744. color:white;
  2745. width: 30px;
  2746. height: 30px;
  2747. right:15px;
  2748. top:80px;
  2749. }
  2750. .subTimeBtn {
  2751. border-radius:10px;
  2752. position:absolute;
  2753. clip-path: polygon(50% 0,100% 100%,0 100%);
  2754. transform: scale(0.5);
  2755. left: 0;
  2756. top:0;
  2757. bottom: 0;
  2758. right: 0;
  2759. margin: auto;
  2760. }
  2761. .packageControlBottomRight {
  2762. border-radius:5px;
  2763. padding:5px 10px;
  2764. margin-right: 15px;
  2765. background-color: #3c9cff;
  2766. color: #fff;
  2767. }
  2768. .packageControlBottomClear {
  2769. border-radius:5px;
  2770. padding:5px 10px;
  2771. background-color: #B2B2B2;
  2772. color: #fff;
  2773. }
  2774. .active_btn{
  2775. background-color: #3c9cff;
  2776. }
  2777. .baozhuang-sub{
  2778. right: 10rpx !important;
  2779. }
  2780. .baozhuang-add{
  2781. left: 6rpx !important;
  2782. }
  2783. .control-input-box{
  2784. display: flex;
  2785. flex-direction: row;
  2786. padding-left: 26rpx;
  2787. }
  2788. .control-input-box-danwei{
  2789. padding-top:12rpx;
  2790. margin-left:4rpx;
  2791. }
  2792. .tabs{
  2793. position: relative;
  2794. top:15vh;
  2795. }
  2796. .child_tab{
  2797. position: relative;
  2798. display: inline-block;
  2799. width: 25%;
  2800. height: 180rpx;
  2801. }
  2802. .child_img{
  2803. width: 50rpx;
  2804. height: 50rpx;
  2805. left: 66rpx;
  2806. top: 66rpx;
  2807. position: relative;
  2808. }
  2809. .child_title{
  2810. position: absolute;
  2811. left: 0px;
  2812. right: 0px;
  2813. text-align: center;
  2814. font-size: 12px;
  2815. bottom: -12rpx;
  2816. color: #060B25;
  2817. }
  2818. .control{
  2819. width: 100%;
  2820. position: relative;
  2821. }
  2822. .control_item{
  2823. position: relative;
  2824. width: 50%;
  2825. display: inline-block;
  2826. height: 150rpx;
  2827. }
  2828. .control_item_detail{
  2829. position: relative;
  2830. top:22rpx;
  2831. }
  2832. .control_item_left{
  2833. position:absolute;;
  2834. left:22%;
  2835. font-size: 55px;
  2836. z-index: 999;
  2837. top:-30rpx
  2838. }
  2839. .control_item_center{
  2840. position:absolute;;
  2841. left:34%;
  2842. top:0vh;
  2843. }
  2844. .control_item_right{
  2845. position:absolute;;
  2846. left:67%;
  2847. font-size: 34px;
  2848. z-index: 999;
  2849. }
  2850. .control_item_center_unit{
  2851. position: absolute;
  2852. left:26vw;
  2853. top: 0.8vh;
  2854. width:200rpx;
  2855. }
  2856. .control_item_title{
  2857. position: absolute;
  2858. bottom:34rpx;
  2859. font-size: 12px;
  2860. width: 100%;
  2861. text-align: center;
  2862. }
  2863. .bottom{
  2864. height: 190rpx;
  2865. position: absolute;
  2866. left: 0px;
  2867. width: 100%;
  2868. padding-top: 18rpx;
  2869. }
  2870. .bottom_item{
  2871. display: inline-block;
  2872. width: 25%;
  2873. font-size: 12px;
  2874. height: 100%;
  2875. position: relative;
  2876. text-align: center;
  2877. margin-top: 2vh;
  2878. }
  2879. .active_on{
  2880. color: #50ACFF;
  2881. }
  2882. .status_info{
  2883. position: absolute;
  2884. left: 5vw;
  2885. top: 10vh;
  2886. }
  2887. .status_detail{
  2888. display: flex;
  2889. flex-direction: row;
  2890. }
  2891. .status_text{
  2892. font-size: 16px;
  2893. }
  2894. .online_text{
  2895. font-size: 12px;
  2896. padding-top: 3px;
  2897. }
  2898. .online{
  2899. color: #017128;
  2900. }
  2901. .device_info{
  2902. font-size: 13px;
  2903. }
  2904. .control_area{
  2905. position: relative;
  2906. top:19vh;
  2907. }
  2908. .disabled_tab{
  2909. opacity: 0.4;
  2910. }
  2911. </style>