detail.vue 93 KB

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