detail.vue 93 KB

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