index.vue 48 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840
  1. <template>
  2. <view>
  3. <view class="textbox">
  4. <view class="inputs">
  5. <u-search placeholder="请输入设备名称/编号" v-model="device_id" placeholder-color="#909696" :show-action="false"
  6. search-icon-color="#909696" @input="searchinput">
  7. </u-search>
  8. </view>
  9. <view class="tab">
  10. <view class="tab-content">
  11. <view class="tab-box tab-box-top">
  12. <view v-for="(item,index) in menuList" :key="index" @click="change(index,item)"
  13. v-if="isShow(item)"
  14. :class="['tab-item',current==index?'active':'']">
  15. <image class="img-icon" :src="item.app_menu_icon" mode=""></image>
  16. <view class="text">{{ getSlice(item.purview_name) }}</view>
  17. </view>
  18. </view>
  19. <u-empty v-if="!menuList.length && !loading" :image-size="100" text="暂无设备权限,请联系工作人员添加"></u-empty>
  20. </view>
  21. </view>
  22. <view class="listbox" v-if="menuList.length">
  23. <view class="second-tab">
  24. <view class="tab-box">
  25. <view
  26. v-for="(item,index) in list"
  27. :key="index"
  28. @click="changeDevice(item,index)"
  29. v-show="!item.url"
  30. :class="['tab-item',currents == index?'active':'']"
  31. >
  32. <text>{{item.purview_name}}</text>
  33. </view>
  34. </view>
  35. </view>
  36. <view class="third-tab">
  37. <view
  38. class="third-tab-item"
  39. @click="changeStatus('')"
  40. :class="{'active-tab' : device_status == ''}"
  41. >总计{{ counts }}</view>
  42. <view
  43. class="third-tab-item"
  44. @click="changeStatus('1')"
  45. :class="{'active-tab' : device_status == '1'}"
  46. >在线{{ online_counts }}</view>
  47. <view
  48. class="third-tab-item"
  49. @click="changeStatus('0')"
  50. :class="{'active-tab' : device_status == '0'}"
  51. >离线{{ offline_counts }}</view>
  52. </view>
  53. <view class="action-group" v-if="type_id == 49 && myuser_type == 4">
  54. <view class="action-item" @click="toControls">分组控制</view>
  55. </view>
  56. <scroll-view
  57. :scroll-top="0"
  58. :scroll-y="true"
  59. class="list scroll-Y"
  60. @scrolltoupper="upper"
  61. @scrolltolower="lower"
  62. @scroll="scroll"
  63. >
  64. <view class="list_item" v-for="(item, index) in eqlistdata" :key="index" @click="historys(item)">
  65. <view class="list_item_top">
  66. <view class="p1">
  67. <span class="title">{{ (item.name || '--' )}}</span>
  68. <span class="sub-title" @click.stop="modification(item)">信息修改</span>
  69. </view>
  70. <view class="online-status"
  71. v-if="item.status == 1 || item.is_online" >
  72. <image
  73. :src="$imageURL+'/bigdata_app/newImg/home/online1.png'"
  74. mode=""
  75. ></image>
  76. <text class="status-text-online">在线</text>
  77. </view>
  78. <view
  79. v-else
  80. class="online-status"
  81. >
  82. <image
  83. :src="$imageURL+'/bigdata_app/newImg/home/offline.png'"
  84. mode=""
  85. ></image>
  86. <text class="status-text-offline">离线</text>
  87. </view>
  88. </view>
  89. <view class="list_item_text">
  90. <view v-if="item.imei" class="p1">
  91. <text class="label">IMEI</text>{{ (item.dui || item.imei) }}
  92. </view>
  93. <view class="p1">
  94. <text class="label">设备ID</text>{{ item.only_for_show || item.id || item.device_id }}
  95. </view>
  96. <view class="p1">
  97. <text class="label">上报时间</text>{{ (item.report || item.uptime || item.upload_time) | timeFormat() }}
  98. </view>
  99. <view class="p1" style="display:flex;align-items: center;">
  100. <text class="label">设备位置</text>
  101. <text class="nav-label">{{ (item.address|| '无') }}</text>
  102. </view>
  103. <view class="action-list" style="display:flex;align-items: center;" v-if="type_id == 53">
  104. <view class="action-item" v-if="item.fa_v != null">
  105. <image :src="lightning" alt="" class="item-icon">
  106. </image>
  107. <text>{{item.fa_v}}v</text>
  108. </view>
  109. <view class="action-item" v-if="item.fa_a != null">
  110. <text>{{item.fa_a}}A</text>
  111. </view>
  112. <view class="action-item" v-if="item.fa_v_signal != null">
  113. <image :src="getSignal2(item.fa_v_signal)" alt="" class="item-icon">
  114. </image>
  115. <text>{{item.fa_v_signal}}</text>
  116. </view>
  117. <u-icon
  118. name="reload"
  119. color="#0bbc58"
  120. size="28"
  121. style="margin-left: auto;"
  122. @click.native="()=>refreshFaData(item)"
  123. ></u-icon>
  124. </view>
  125. <view class="action-container" style="display:flex;align-items: center;" v-if="type_id == 53 && item.fa && item.fa.length">
  126. <view class="action-container-item" :class="n.value != '0' ? 'action-container-container-item-active':''" v-for="(n,key) in item.fa" :key="key">
  127. <view class="action-open">
  128. <view class="item-number fa-item-number" :class="n.value != '0' ? 'item-number-active':''">{{n.name}}</view>
  129. <u-switch
  130. :value="n.value != '0'"
  131. active-color="#0BBC58"
  132. inactiveColor="#C3CAD8"
  133. @click.native="()=>changeFaSwitchStatus(n)"
  134. size="36"
  135. ></u-switch>
  136. </view>
  137. </view>
  138. </view>
  139. <view class="action-list" style="display:flex;align-items: center;" v-if="type_id == 49">
  140. <view class="action-item">
  141. <image :src="lightning" alt="" class="item-icon">
  142. </image>
  143. <text>{{getcharging_vol(item.sensor_params)}}</text>
  144. </view>
  145. <view class="action-item">
  146. <image :src="getSignal(item.sensor_params)" alt="" class="item-icon">
  147. </image>
  148. <text>{{getrssl(item.sensor_params)}}</text>
  149. </view>
  150. <view class="action-item">
  151. <image :src="battery" alt="" class="item-icon">
  152. </image>
  153. <text>{{getopeningValue(item.sensor_params)}}%</text>
  154. </view>
  155. </view>
  156. <view class="action-container" v-if="type_id == 49">
  157. <view class="action-container-item" :class="n.switchValue?'action-container-container-item-active':''" v-for="(n,key) in getvalve_params(item)" :key="key">
  158. <view class="action-open">
  159. <view class="item-number" :class="{'item-number-active':n.switchValue}">{{n.name}}</view>
  160. <u-switch
  161. :value="n.switchValue"
  162. active-color="#0BBC58"
  163. inactiveColor="#C3CAD8"
  164. @click.native="()=>changeSwitchStatus(n.value,n,item)"
  165. size="36"
  166. ></u-switch>
  167. </view>
  168. <view class="action-open-value" @click.stop="editHandle(n.value,n,item)" v-if="n.value != 0">
  169. <image :src="openingDegree" alt="" class="item-icon">
  170. </image>
  171. <text>{{n.value}}%</text>
  172. <u-icon name="edit-pen" color="#0BBC58"></u-icon>
  173. </view>
  174. </view>
  175. </view>
  176. </view>
  177. </view>
  178. </scroll-view>
  179. </view>
  180. </view>
  181. <view class="loading" v-if="loadingtf">
  182. <image src="../../static/images/ajax-loader.gif" mode="" class="img"></image>
  183. </view>
  184. <view class="top" v-if="isTop" @click="top">
  185. <image :src="$imageURL+'/bigdata_app' + '/image/6209a98f0cb3b5086f2ca36152c9269.png'" mode=""></image>
  186. </view>
  187. <u-popup v-model="showPopup" mode="bottom">
  188. <u-form :model="form" label-width="160rpx" :label-style="{marginLeft:'20rpx'}">
  189. <u-form-item label="开启状态">
  190. <u-radio-group v-model="value">
  191. <u-radio
  192. v-for="(item, index) in radioList" :key="index"
  193. :name="item.value"
  194. active-color="#0BBC58"
  195. >
  196. {{item.name}}
  197. </u-radio>
  198. </u-radio-group>
  199. </u-form-item>
  200. <u-form-item label="开阀时间" v-if="value == 1">
  201. <view @click="show1 = true" class="hour">{{hour}} 小时</view>
  202. <!-- <view @click="show2 = true" class="minute">{{minute}} 分钟</view> -->
  203. </u-form-item>
  204. <u-form-item label="开度数值">
  205. <view class="slider-container">
  206. <view class="slider-min-value">10</view>
  207. <view
  208. :class="['custom-progress', { dragging: sliderDragging }]"
  209. @touchstart.stop="onSliderTouchStart($event, 'openingValue', 10, 100)"
  210. @touchmove.stop.prevent="onSliderTouchMove($event, 10, 100)"
  211. @touchend.stop="onSliderTouchEnd"
  212. @tap.stop="onSliderTap($event, 'openingValue', 10, 100)"
  213. >
  214. <view class="progress-track">
  215. <view class="progress-fill" :style="{ width: getProgressWidth(equipContrlForm.openingValue, 10, 100) + '%' }"></view>
  216. <view class="progress-thumb" :style="{ left: getProgressWidth(equipContrlForm.openingValue, 10, 100) + '%' }"></view>
  217. </view>
  218. </view>
  219. <view class="slider-max-value">100</view>
  220. </view>
  221. <text style="margin-left: 20rpx">{{equipContrlForm.openingValue}}</text>
  222. </u-form-item>
  223. <u-button type="success" style="width: 94%;margin-left: 3%;margin-bottom: 40rpx" @click="submit">提交</u-button>
  224. </u-form>
  225. </u-popup>
  226. <u-popup v-model="showPopup2" mode="bottom">
  227. <u-form :model="form" label-width="160rpx" :label-style="{marginLeft:'20rpx'}">
  228. <u-form-item label="开度数值">
  229. <view class="slider-container">
  230. <view class="slider-min-value">10</view>
  231. <view
  232. :class="['custom-progress', { dragging: sliderDragging }]"
  233. @touchstart.stop="onSliderTouchStart($event, 'openingValue', 10, 100)"
  234. @touchmove.stop.prevent="onSliderTouchMove($event, 10, 100)"
  235. @touchend.stop="onSliderTouchEnd"
  236. @tap.stop="onSliderTap($event, 'openingValue', 10, 100)"
  237. >
  238. <view class="progress-track">
  239. <view class="progress-fill" :style="{ width: getProgressWidth(equipContrlForm.openingValue, 10, 100) + '%' }"></view>
  240. <view class="progress-thumb" :style="{ left: getProgressWidth(equipContrlForm.openingValue, 10, 100) + '%' }"></view>
  241. </view>
  242. </view>
  243. <view class="slider-max-value">100</view>
  244. </view>
  245. <text style="margin-left: 20rpx">{{equipContrlForm.openingValue}}</text>
  246. </u-form-item>
  247. <u-button type="success" style="width: 94%;margin-left: 3%;margin-bottom: 40rpx" @click="submit2">提交</u-button>
  248. </u-form>
  249. </u-popup>
  250. <u-modal
  251. v-model="show3"
  252. :content="content"
  253. @confirm="confirmClose"
  254. @cancel="cancelClose"
  255. :mask-close-able="true"
  256. :show-cancel-button="true"
  257. ></u-modal>
  258. <u-select v-model="show1" :list="hours" @confirm="changeHour"></u-select>
  259. <u-select v-model="show2" :list="minutes" @confirm="changeMinute"></u-select>
  260. <u-popup v-model="show4" mode="center" width="80%" :mask-close-able="false">
  261. <view class="progress-container">
  262. <u-line-progress :percent="percentage" style="width: 90%;"></u-line-progress>
  263. </view>
  264. </u-popup>
  265. </view>
  266. </template>
  267. <script>
  268. import lightning from '../assets/lightning.png';
  269. import battery from '../assets/battery.png';
  270. import signal0 from '../assets/signal0.png';
  271. import signal1 from '../assets/signal1.png';
  272. import signal2 from '../assets/signal2.png';
  273. import signal3 from '../assets/signal3.png';
  274. import signal4 from '../assets/signal4.png';
  275. import signal5 from '../assets/signal5.png';
  276. import openingDegree from '../assets/openingDegree.png';
  277. import { wgs84togcj02, bd09togcj02 } from '../../util/coordtransform_utils.js';
  278. import {
  279. Debounce,
  280. Throttle
  281. } from '../../util/anitthro.js';
  282. export default {
  283. data() {
  284. return {
  285. showPopup: false,
  286. showPopup2: false,
  287. show4: false,
  288. percentage: 0,
  289. openingValue: 60,
  290. show1: false,
  291. show2: false,
  292. show3: false,
  293. content:'确认关闭当前阀吗?',
  294. hours: [],
  295. value: 0,
  296. minutes: [],
  297. sensor_params:{},
  298. valve_params:[],
  299. currentRow: {},
  300. lightning,
  301. battery,
  302. radioList:[{
  303. name:'常开',
  304. value:0
  305. },
  306. {
  307. name:'定时',
  308. value:1
  309. }],
  310. form:{},
  311. openingDegree,
  312. signal0,
  313. signal1,
  314. signal2,
  315. signal3,
  316. signal4,
  317. signal5,
  318. list: [],
  319. hour: 1,
  320. minute: 0,
  321. pur_id: '',
  322. loading: false,
  323. currentPur_id:'',
  324. device_status: '',
  325. counts:0,
  326. online_counts:0,
  327. offline_counts:0,
  328. accessToken: '',
  329. current: 0,
  330. currents: 0,
  331. total: 0,
  332. refreshData:'',
  333. page: 1,
  334. size: 10,
  335. eqlistdata: [],
  336. isTop: false,
  337. device_model: '',
  338. infoalter: false, // 权限设置,
  339. type_id: 0, //设备类型,
  340. imgpath: [],
  341. loadingtf: false,
  342. width: 0, //顶部搜索栏宽度
  343. device_id: '', //搜索设备ID
  344. current_device_id: '', //当前设备ID
  345. menuList: [],
  346. sliderRect: {},
  347. sliderDragging: false,
  348. equipContrlForm: {
  349. openingValue: 60,
  350. },
  351. sliderField: '',
  352. sliderMin: 0,
  353. sliderMax: 0,
  354. timer: null,
  355. myuser_type: -1,
  356. valve_param_key: '',
  357. };
  358. },
  359. methods: {
  360. toControls(){
  361. uni.navigateTo({
  362. url: '/pages/cb/zhamenFirst/controls',
  363. });
  364. },
  365. getvalve_params(item){
  366. return item?.valve_params || [];
  367. },
  368. getcharging_vol(item){
  369. return item?.charging_vol || 0;
  370. },
  371. getrssl(item){
  372. return item?.rssl || 0;
  373. },
  374. getopeningValue(item){
  375. return item?.kwh || 0;
  376. },
  377. getRadioValue(){
  378. return this.value;
  379. },
  380. setPercentage(msg){
  381. this.timer = setInterval(() => {
  382. this.percentage += 1;
  383. if(this.percentage >= 100){
  384. this.percentage = 100;
  385. uni.showToast({
  386. title: msg,
  387. icon: 'none',
  388. });
  389. clearInterval(this.timer);
  390. this.show4 = false;
  391. this.percentage = 0;
  392. this.eqlist();
  393. }
  394. }, 125);
  395. },
  396. getSignal(item){
  397. const val = item?.rssl || 0;
  398. if(val < 0){
  399. return this.signal0;
  400. }
  401. if(val > 5){
  402. return this.signal5;
  403. }
  404. return this['signal' + val];
  405. },
  406. getSignal2(item){
  407. const val = +item || 0;
  408. if(val < 0){
  409. return this.signal0;
  410. }
  411. if(val > 5){
  412. return this.signal5;
  413. }
  414. return this['signal' + val];
  415. },
  416. confirmClose(){
  417. this.closeValve();
  418. },
  419. cancelClose(){
  420. this.show3 = false;
  421. },
  422. editHandle(openingValue,item,device){
  423. this.valve_param_key = item.key;
  424. this.current_device_id = device.id;
  425. this.showPopup2 = true;
  426. this.equipContrlForm.openingValue = openingValue;
  427. },
  428. changeHour(e){
  429. this.hour = e[0].value
  430. },
  431. changeMinute(e){
  432. this.minute = e[0].value
  433. },
  434. getProgressWidth(value, min, max) {
  435. if (max === min) return 0
  436. return ((value - min) / (max - min)) * 100
  437. },
  438. getModel(value){
  439. return value == 0 ? false : true
  440. },
  441. async closeValve(){
  442. const res = await this.$myRequest({
  443. url: '/api/api_gateway?method=irrigation_system.valvecontrol.close_valvecontrol_valve',
  444. method: 'POST',
  445. data: {
  446. device_id: this.current_device_id,
  447. valve_param_key: this.valve_param_key
  448. },
  449. });
  450. if(res.code == 0){
  451. this.show4 = true;
  452. this.setPercentage(res.message);
  453. }else{
  454. uni.showToast({
  455. title: res?.message,
  456. icon: 'none',
  457. });
  458. }
  459. },
  460. async setAction(data){
  461. const res = await this.$myRequest({
  462. url: '/api/api_gateway?method=irrigation_system.valvecontrol.open_valvecontrol_valve',
  463. method: 'POST',
  464. data,
  465. });
  466. if(res.code == 0){
  467. this.show4 = true;
  468. this.setPercentage(res.message);
  469. }else{
  470. uni.showToast({
  471. title: res?.message,
  472. icon: 'none',
  473. });
  474. }
  475. },
  476. async setEditAction(data){
  477. const res = await this.$myRequest({
  478. url: '/api/api_gateway?method=irrigation_system.valvecontrol.alter_valvecontrol_valve_percentage',
  479. method: 'POST',
  480. data,
  481. });
  482. if(res.code == 0){
  483. this.show4 = true;
  484. this.setPercentage(res.message);
  485. }else{
  486. uni.showToast({
  487. title: res?.message,
  488. icon: 'none',
  489. });
  490. }
  491. },
  492. onSliderTouchStart(e, field, min, max) {
  493. this.sliderDragging = true
  494. this.sliderField = field
  495. this.sliderMin = min
  496. this.sliderMax = max
  497. const query = uni.createSelectorQuery().in(this)
  498. query.select('.custom-progress').boundingClientRect(rect => {
  499. this.sliderRect = rect
  500. }).exec()
  501. this.updateSliderValue(e.touches[0].clientX, field, min, max)
  502. },
  503. onSliderTouchMove(e, min, max) {
  504. if (!this.sliderField || !this.sliderRect) return
  505. this.updateSliderValue(e.touches[0].clientX, this.sliderField, min, max)
  506. },
  507. onSliderTouchEnd() {
  508. this.sliderField = ''
  509. this.sliderDragging = false
  510. },
  511. onSliderTap(e, field, min, max) {
  512. const query = uni.createSelectorQuery().in(this)
  513. query.select('.custom-progress').boundingClientRect(rect => {
  514. this.sliderRect = rect
  515. this.updateSliderValue(e.detail.x + rect.left, field, min, max)
  516. }).exec()
  517. },
  518. updateSliderValue(clientX, field, min, max) {
  519. if (!this.sliderRect) return
  520. let ratio = (clientX - this.sliderRect.left) / this.sliderRect.width
  521. ratio = Math.max(0, Math.min(1, ratio))
  522. const value = Math.round(min + ratio * (max - min))
  523. if (this.equipContrlForm[field] === value) return
  524. this.$set(this.equipContrlForm, field, value)
  525. },
  526. submit(){
  527. this.setAction({
  528. device_id: this.current_device_id,
  529. valve_param_key: this.valve_param_key,
  530. var_value: this.equipContrlForm.openingValue,
  531. valve_delayed: this.value == 0 ? 0 : Number(this.hour) * 60 + Number(this.minute)
  532. })
  533. this.showPopup = false;
  534. },
  535. submit2(){
  536. this.setEditAction({
  537. device_id: this.current_device_id,
  538. valve_param_key: this.valve_param_key,
  539. var_value: this.equipContrlForm.openingValue,
  540. })
  541. this.showPopup2 = false;
  542. },
  543. getHours(){
  544. for(let i = 1; i <= 12; i++){
  545. this.hours.push({
  546. label: i + ' 时',
  547. value: i,
  548. })
  549. }
  550. },
  551. getMinutes(){
  552. for(let i = 0; i < 60; i++){
  553. this.minutes.push({
  554. label: i + ' 分',
  555. value: i,
  556. })
  557. }
  558. },
  559. isShow(item){
  560. return item.pur_id != 422
  561. },
  562. getSlice(name){
  563. return name.slice(0,4)
  564. },
  565. modification(item) {
  566. if(item?.gps == 1){
  567. item.lng = wgs84togcj02(item.lng, item.lat)[0];
  568. item.lat = wgs84togcj02(item.lng, item.lat)[1];
  569. }else if(item?.gps == 3){
  570. item.lng = bd09togcj02(item.lng, item.lat)[0];
  571. item.lat = bd09togcj02(item.lng, item.lat)[1];
  572. }
  573. uni.navigateTo({
  574. url:
  575. './seabox/modification?data=' +
  576. JSON.stringify(item) +
  577. '&id=' +
  578. this.type_id,
  579. });
  580. },
  581. // fa 单路开关控制:device_id 用 point_id 指定 30/60/90 度某一路,status 0=关 1=开
  582. async changeFaSwitchStatus(fa){
  583. if(fa.operating) return;
  584. const oldStatus = fa.value;
  585. const status = oldStatus == 1 ? 0 : 1; // 0关 1开
  586. this.$set(fa, 'operating', true);
  587. // 先切换开关显示,请求失败再回滚
  588. this.$set(fa, 'value', String(status));
  589. let res;
  590. try{
  591. res = await this.$myRequest({
  592. url: '/api/api_gateway?method=hran.tz.operate_device',
  593. method: 'POST',
  594. data: {
  595. device_id: fa.point_id,
  596. status,
  597. },
  598. });
  599. }catch(e){
  600. // 失败 toast 已在 myRequest 中弹出,这里只回滚开关状态
  601. this.$set(fa, 'value', oldStatus);
  602. this.$set(fa, 'operating', false);
  603. return;
  604. }
  605. this.$set(fa, 'operating', false);
  606. // 该接口 data: true=成功 false=失败(errorCode 恒为 0)
  607. if(res === true){
  608. uni.showToast({
  609. title: status == 1 ? '已开启' : '已关闭',
  610. icon: 'none',
  611. });
  612. }else{
  613. this.$set(fa, 'value', oldStatus);
  614. uni.showToast({
  615. title: res?.message || '操作失败',
  616. icon: 'none',
  617. });
  618. }
  619. },
  620. // 刷新单台设备最新数据(电压/电流/信号/开关状态等),device_id 用设备 id
  621. async refreshFaData(item){
  622. if(item.refreshing) return;
  623. this.$set(item, 'refreshing', true);
  624. try{
  625. const res = await this.$myRequest({
  626. url: '/api/api_gateway?method=hran.tz.get_now_data',
  627. method: 'POST',
  628. data: {
  629. device_id: item.id,
  630. },
  631. });
  632. // 该接口 errorCode 恒为 0,data 有值(true/最新数据)即成功
  633. if(res && (res === true || res.data !== false)){
  634. uni.showToast({
  635. title: '刷新成功',
  636. icon: 'none',
  637. });
  638. // 重新拉取列表,更新电压/电流/信号/开关状态
  639. this.page = 1;
  640. this.eqlist();
  641. }else{
  642. uni.showToast({
  643. title: '刷新失败',
  644. icon: 'none',
  645. });
  646. }
  647. }catch(e){
  648. // 失败 toast 已在 myRequest 中弹出
  649. }finally{
  650. this.$set(item, 'refreshing', false);
  651. }
  652. },
  653. async changeDfSwitchStatus(item){
  654. if(item.operating) return;
  655. const oldStatus = item.irr_status;
  656. const status = oldStatus == 1 ? 0 : 1; // 0关 1开
  657. this.$set(item, 'operating', true);
  658. // 先切换开关显示,请求失败再回滚
  659. this.$set(item, 'irr_status', status);
  660. const res = await this.$myRequest({
  661. url: '/api/api_gateway?method=hran.tz.operate_device',
  662. method: 'POST',
  663. data: {
  664. device_id: item.id,
  665. status,
  666. },
  667. });
  668. this.$set(item, 'operating', false);
  669. if(res.code == 0){
  670. uni.showToast({
  671. title: status == 1 ? '已开启' : '已关闭',
  672. icon: 'none',
  673. });
  674. }else{
  675. this.$set(item, 'irr_status', oldStatus);
  676. uni.showToast({
  677. title: res?.message || '操作失败',
  678. icon: 'none',
  679. });
  680. }
  681. },
  682. changeSwitchStatus(status,item,device){
  683. this.valve_param_key = item.key;
  684. this.current_device_id = device.id;
  685. if(status == 0){
  686. this.equipContrlForm.openingValue = 40;
  687. this.showPopup = true;
  688. this.currentRow = item;
  689. }else{
  690. this.show3 = true;
  691. }
  692. },
  693. changeStatus(status){
  694. this.device_status = status;
  695. Debounce(() => {
  696. this.page = 1;
  697. this.eqlist();
  698. }, 500)();
  699. },
  700. async getUserlogin() {
  701. this.list = [];
  702. this.loading = true;
  703. const res = await this.$myRequest({
  704. url: '/api/api_gateway?method=user.login.user_login_info',
  705. method: 'POST',
  706. data: {
  707. is_app: 1,
  708. },
  709. });
  710. this.loading = false;
  711. res.forEach(item=>{
  712. item.icon = '/bigdata_app/newImg/home/sqjd.png'
  713. })
  714. const menulist = res || [];
  715. const menuItem = menulist.find(item => item.purview_name == '智慧物联')
  716. this.menuList = menuItem.children || [];
  717. if(this.menuList.length == 0){
  718. //提示暂无分配权限
  719. uni.showToast({
  720. title: '暂无分配权限,请联系工作人员',
  721. icon: 'none',
  722. });
  723. return
  724. }
  725. if(!this.pur_id){
  726. this.list = this.menuList[0].children || []
  727. this.pur_id = this.menuList[0].pur_id || '';
  728. this.current = 0;
  729. }else{
  730. this.list = this.menuList.find(item => item.pur_id == this.pur_id)?.children || []
  731. this.pur_id = this.menuList.find(item => item.pur_id == this.pur_id)?.pur_id || '';
  732. this.current = this.menuList.findIndex(item => item.pur_id == this.pur_id);
  733. }
  734. if(this.list.length > 1){
  735. if(this.list[0].purview_name != '全部'){
  736. this.list.unshift({
  737. device_type_id: '',
  738. purview_name: '全部'
  739. })
  740. }
  741. }
  742. const firstChild = this.list[0];
  743. this.type_id = firstChild.device_type_id;
  744. if(firstChild.device_type_id !== ''){
  745. this.device_model = firstChild?.device_model || '';
  746. }else{
  747. this.device_model = '';
  748. }
  749. this.initPage();
  750. },
  751. async eqlist(tf) {
  752. this.counts = 0;
  753. this.online_counts = 0;
  754. this.offline_counts = 0;
  755. this.loadingtf = true;
  756. let data = {
  757. device_type_id: this.type_id,
  758. page_num: this.page,
  759. page_size: this.size,
  760. pur_id: this.pur_id,
  761. device_status: this.device_status,
  762. device_id: this.device_id,
  763. device_model: this.device_model
  764. }
  765. const res = await this.$myRequest({
  766. url: '/api/api_gateway?method=device.app_device.app_device_list',
  767. data: data,
  768. });
  769. this.loadingtf = false;
  770. const status = res?.status || {};
  771. this.online_counts = status.online || 0;
  772. this.offline_counts = status.offline || 0;
  773. this.counts = (status.online || 0) + (status.offline || 0);
  774. this.total = res.total || 0;
  775. const resData = res?.data;
  776. resData.forEach(item=>{
  777. if(item.type_id == 49 && item.valve_params.length){
  778. item.valve_params.forEach(param=>{
  779. param.switchValue = param.value == 0 ? false : true;
  780. })
  781. }
  782. })
  783. console.log(resData,'resDasadsdss')
  784. if (tf) {
  785. this.eqlistdata = this.eqlistdata.concat(resData);
  786. } else {
  787. this.eqlistdata = resData;
  788. }
  789. },
  790. change(index,itemData) {
  791. this.list = this.menuList[index].children || []
  792. const list = [];
  793. this.list.forEach(item=>{
  794. if(item.url){
  795. list.push(item)
  796. }
  797. })
  798. // if(list.length > 1){
  799. // if(this.list[0].purview_name != '全部'){
  800. // this.list.unshift({
  801. // device_type_id: '',
  802. // purview_name: '全部'
  803. // })
  804. // }
  805. // }
  806. this.current = index;
  807. const item = this.list[0];
  808. this.pur_id = itemData.pur_id || '';
  809. // this.changeDevice(item,0);
  810. },
  811. changeDevice(item,index){
  812. this.currents = index;
  813. this.currentPur_id = item.pur_id || '';
  814. const name = item.menu;
  815. if (name === 'cbd4') {
  816. this.device_model = 11;
  817. } else if(name === 'cbd1'){
  818. this.device_model = 12;
  819. } else if(name === 'cbd3'){
  820. this.device_model = '';
  821. } else if(name === 'cbd5'){
  822. this.device_model = 13;
  823. } else if(name === 'cbd6'){
  824. this.device_model = 14;
  825. }else if(name === 'gkcbd1'){
  826. this.device_model = 15;
  827. } else if(name === 'zhiCbd'){
  828. this.device_model = 16;
  829. } else {
  830. this.device_model = item.device_model || '';
  831. }
  832. this.page = 1;
  833. this.eqlistdata = [];
  834. this.type_id = item.device_type_id;
  835. Debounce(() => {
  836. this.eqlist();
  837. }, 500)();
  838. },
  839. top() {
  840. uni.pageScrollTo({
  841. scrollTop: 0,
  842. duration: 500,
  843. });
  844. },
  845. initPage(){
  846. this.eqlistdata = [];
  847. this.currents = 0;
  848. this.page = 1;
  849. Debounce(() => {
  850. this.eqlist();
  851. }, 500)();
  852. this.width = 0;
  853. },
  854. historys(item) {
  855. const type_id = item.type_id;
  856. if(item?.gps == 1){
  857. item.lng = wgs84togcj02(item.lng, item.lat)[0];
  858. item.lat = wgs84togcj02(item.lng, item.lat)[1];
  859. }else if(item?.gps == 3){
  860. item.lng = bd09togcj02(item.lng, item.lat)[0];
  861. item.lat = bd09togcj02(item.lng, item.lat)[1];
  862. }
  863. this.accessToken = uni.getStorageSync('session_key')
  864. switch (type_id) {
  865. // 水肥新设备
  866. case 49:
  867. case 53:
  868. return;
  869. case 22:
  870. var obj = {};
  871. obj.d_id = item.d_id;
  872. obj.device_id = item.id;
  873. obj.is_online = item.status;
  874. obj.lat = item.lat;
  875. obj.lng = item.lng;
  876. obj.equip_name = item.name;
  877. obj.uptime = item.uptime;
  878. uni.navigateTo({
  879. url: '../waterandfernew/details?shebei=' + JSON.stringify(obj),
  880. });
  881. break;
  882. // 病虫害可视监测
  883. case 14:
  884. item.addtime = item.uptime;
  885. uni.navigateTo({
  886. url: '../cb/sy/detail?detail=' + JSON.stringify(item),
  887. });
  888. // uni.navigateTo({
  889. // url: '../sy/detail?info=' +
  890. // JSON.stringify(item) + '&cmd=sy',
  891. // });
  892. break;
  893. case 2:
  894. item.addtime = item.uptime;
  895. // if(item.device_model == 102){
  896. uni.navigateTo({
  897. url: '../scd/detail?info=' + JSON.stringify(item),
  898. });
  899. // }else{
  900. // uni.navigateTo({
  901. // url: '../prevention/equipmentdetails?shebei=' + JSON.stringify(item),
  902. // });
  903. // }
  904. break;
  905. case 38:
  906. case 50:
  907. uni.navigateTo({
  908. url: `../deviceDetails/weatherStation1/index?devBid=${item.id}&devName=${item.name}&devStatus=${item.status}&address=${item.address}&uptime=${item.uptime}&d_id=${item.d_id}&deviceType=46&type_id=${type_id}`,
  909. });
  910. break;
  911. // var obj = {};
  912. // obj.d_id = item.d_id;
  913. // obj.equip_id = item.id;
  914. // obj.is_online = item.status;
  915. // obj.lat = item.lat;
  916. // obj.lng = item.lng;
  917. // obj.equip_name = item.name;
  918. // obj.uptime = item.uptime;
  919. // uni.navigateTo({
  920. // url: '../environment/equipment-new?shebei=' + JSON.stringify(obj),
  921. // });
  922. break;
  923. case 5:
  924. var obj = {};
  925. obj.d_id = item.d_id;
  926. obj.equip_id = item.id;
  927. obj.is_online = item.status;
  928. obj.lat = item.lat;
  929. obj.lng = item.lng;
  930. obj.equip_name = item.name;
  931. obj.uptime = item.uptime;
  932. // uni.navigateTo({
  933. // url: '../environment/equipment?shebei=' + JSON.stringify(obj),
  934. // });
  935. uni.navigateTo({
  936. url: `../deviceDetails/weatherStation2/index?devBid=${item.id}&devName=${item.name}&devStatus=${item.status}&address=${item.address}&uptime=${item.uptime}&d_id=${item.d_id}&deviceType=46`,
  937. });
  938. break;
  939. case 6:
  940. uni.navigateTo({
  941. url: '/pages/webview?device_id=' +
  942. item.id +
  943. '&accessToken=' +
  944. this.accessToken,
  945. });
  946. break;
  947. case 44:
  948. uni.navigateTo({
  949. url:
  950. '/pages/webviewdgp?device_id=' +
  951. item.id +
  952. '&accessToken=' +
  953. uni.getStorageSync('session_key') +
  954. '&type=dgp',
  955. });
  956. break;
  957. case 3:
  958. item.addtime = item.uptime;
  959. item.type = item.type_id;
  960. uni.navigateTo({
  961. url: '../cbd/detail?info=' + JSON.stringify(item),
  962. });
  963. break;
  964. case 28:
  965. item.addtime = item.uptime;
  966. item.type = item.type_id;
  967. uni.navigateTo({
  968. url: '../cb/smallPest/smallPest?info=' + JSON.stringify(item),
  969. });
  970. break;
  971. case 4:
  972. item.addtime = item.uptime;
  973. item.type = item.type_id;
  974. uni.navigateTo({
  975. url: '../cb/equip-detail/equip-detail?info=' + JSON.stringify(item),
  976. });
  977. break;
  978. case 32:
  979. case 35:
  980. item.addtime = item.uptime;
  981. item.type = item.type_id;
  982. uni.navigateTo({
  983. url: '../cb/equip-detail/equip-detail-new?info=' +
  984. JSON.stringify(item),
  985. });
  986. break;
  987. case 33:
  988. case 34:
  989. item.addtime = item.uptime;
  990. item.type = item.type_id;
  991. let cmd = ''
  992. if(type_id == 34){
  993. cmd = 'sy1'
  994. }else if(type_id == 33){
  995. cmd = 'sy2'
  996. }
  997. uni.navigateTo({
  998. url: '../sy/detail?info=' +
  999. JSON.stringify(item) + '&cmd=' + cmd,
  1000. });
  1001. break;
  1002. case 7:
  1003. item.addtime = item.uptime;
  1004. item.type = item.type_id;
  1005. // uni.navigateTo({
  1006. // url: '../bzy/detail?info=' + JSON.stringify(item),
  1007. // });
  1008. if(item.pur_id == 39 || item.pur_id == 300){
  1009. uni.navigateTo({
  1010. url: '../bzy/detail?info=' + JSON.stringify(item),
  1011. });
  1012. }else if(item.pur_id == 307){
  1013. uni.navigateTo({
  1014. url: '../bzy2/detail?info=' + JSON.stringify(item) + '&device_code=' + (item.device_code || ''),
  1015. });
  1016. }else{
  1017. uni.navigateTo({
  1018. url: '../cb/equip-detail/equip-detail?info=' + JSON.stringify(item),
  1019. });
  1020. }
  1021. break;
  1022. case 8:
  1023. uni.navigateTo({
  1024. url: '../cb/thxydetail/thxydetail?imei=' + item.id,
  1025. });
  1026. break;
  1027. case 29:
  1028. uni.navigateTo({
  1029. url: `../cb/nlNewXy/nlNewXy?imei=${item.id}&showId=${item.d_id}`,
  1030. });
  1031. break;
  1032. case 24:
  1033. uni.navigateTo({
  1034. url: '../cb/zjxydetail/thxydetail?imei=' + item.id,
  1035. });
  1036. break;
  1037. case 12:
  1038. item.addtime = item.uptime;
  1039. uni.navigateTo({
  1040. url: '../cb/xctdetail/xctdetail?info=' + JSON.stringify(item),
  1041. });
  1042. break;
  1043. case 13:
  1044. var obj = {};
  1045. obj.d_id = item.d_id;
  1046. obj.device_id = item.id;
  1047. obj.is_online = item.status;
  1048. obj.lat = item.lat;
  1049. obj.lng = item.lng;
  1050. obj.equip_name = item.name;
  1051. obj.uptime = item.uptime;
  1052. uni.navigateTo({
  1053. url: '../waterandfer/datails?shebei=' + JSON.stringify(obj),
  1054. });
  1055. break;
  1056. case 15:
  1057. var obj = {};
  1058. obj.d_id = item.d_id;
  1059. obj.device_id = item.id;
  1060. obj.is_online = item.status;
  1061. obj.lat = item.lat;
  1062. obj.lng = item.lng;
  1063. obj.equip_name = item.name;
  1064. obj.uptime = item.uptime;
  1065. obj.address = item.address || '无';
  1066. // uni.navigateTo({
  1067. // url: '../environment/gsequipment?shebei=' + JSON.stringify(obj),
  1068. // });
  1069. uni.navigateTo({
  1070. url: `../deviceDetails/SoilMoisturelist/index?devBid=${item.id}&devName=${item.name}&devStatus=${item.status}&address=${item.address}&uptime=${item.uptime}&d_id=${item.d_id}&deviceType=46`,
  1071. });
  1072. break;
  1073. case 17:
  1074. break;
  1075. case 18:
  1076. var obj = {};
  1077. obj.device_id = item.id;
  1078. obj.is_online = item.status;
  1079. uni.navigateTo({
  1080. url: '../cb/shuifeiL/shuifeiL?detail=' + JSON.stringify(obj),
  1081. });
  1082. break;
  1083. case 43:
  1084. uni.navigateTo({
  1085. url: "/pages/fmSys/details?info=" + JSON.stringify(item)
  1086. })
  1087. break;
  1088. // case 44:
  1089. // uni.navigateTo({
  1090. // url: "/pages/webviewdgp/webview?device_id=" + item.id + "&accessToken=" + this.accessToken || uni
  1091. // .getStorageSync('session_key') +
  1092. // '&type=dgp'
  1093. // })
  1094. // break;
  1095. case 11:
  1096. var obj = {};
  1097. obj.d_id = item.d_id;
  1098. obj.device_id = item.id;
  1099. obj.is_online = item.status;
  1100. obj.lat = item.lat;
  1101. obj.lng = item.lng;
  1102. obj.equip_name = item.name;
  1103. obj.uptime = item.uptime;
  1104. obj.location = item.address;
  1105. obj.type = 11;
  1106. uni.navigateTo({
  1107. url: '../disease/cmb?shebei=' + JSON.stringify(obj),
  1108. });
  1109. break;
  1110. case 19:
  1111. var obj = {};
  1112. obj.d_id = item.d_id;
  1113. obj.device_id = item.id;
  1114. obj.is_online = item.status;
  1115. obj.lat = item.lat;
  1116. obj.lng = item.lng;
  1117. obj.equip_name = item.name;
  1118. obj.uptime = item.uptime;
  1119. obj.location = item.address;
  1120. obj.type = 19;
  1121. uni.navigateTo({
  1122. url: '../disease/cmb?shebei=' + JSON.stringify(obj),
  1123. });
  1124. break;
  1125. case 20:
  1126. var obj = {};
  1127. obj.d_id = item.d_id;
  1128. obj.device_id = item.id;
  1129. obj.is_online = item.status;
  1130. obj.lat = item.lat;
  1131. obj.lng = item.lng;
  1132. obj.equip_name = item.name;
  1133. obj.uptime = item.uptime;
  1134. obj.location = item.address;
  1135. obj.type = 20;
  1136. uni.navigateTo({
  1137. url: '../disease/cmb?shebei=' + JSON.stringify(obj),
  1138. });
  1139. break;
  1140. case 21:
  1141. var obj = {};
  1142. obj.d_id = item.d_id;
  1143. obj.device_id = item.id;
  1144. obj.is_online = item.status;
  1145. obj.lat = item.lat;
  1146. obj.lng = item.lng;
  1147. obj.equip_name = item.name;
  1148. obj.uptime = item.uptime;
  1149. obj.location = item.address;
  1150. obj.type = 21;
  1151. uni.navigateTo({
  1152. url: '../disease/cmb?shebei=' + JSON.stringify(obj),
  1153. });
  1154. break;
  1155. case 26:
  1156. var obj = {};
  1157. obj.d_id = item.d_id;
  1158. obj.device_id = item.id;
  1159. obj.is_online = item.status;
  1160. obj.lat = item.lat;
  1161. obj.lng = item.lng;
  1162. obj.equip_name = item.name;
  1163. obj.uptime = item.uptime;
  1164. obj.location = item.address;
  1165. obj.type = 26;
  1166. uni.navigateTo({
  1167. url: '../disease/cmb?shebei=' + JSON.stringify(obj),
  1168. });
  1169. break;
  1170. case 27:
  1171. var obj = {};
  1172. obj.d_id = item.d_id;
  1173. obj.device_id = item.id;
  1174. obj.is_online = item.status;
  1175. obj.lat = item.lat;
  1176. obj.lng = item.lng;
  1177. obj.equip_name = item.name;
  1178. obj.uptime = item.uptime;
  1179. obj.location = item.address;
  1180. obj.type = 26;
  1181. uni.navigateTo({
  1182. url: '../disease/mls/mls?shebei=' + JSON.stringify(obj),
  1183. });
  1184. break;
  1185. case 25:
  1186. item.addtime = item.uptime;
  1187. uni.navigateTo({
  1188. url: '../cb/xylps/detail?detail=' + JSON.stringify(item),
  1189. });
  1190. break;
  1191. case 51:
  1192. item.addtime = item.uptime;
  1193. item.type = item.type_id;
  1194. uni.navigateTo({
  1195. url: '../shuHai/detail?info=' + JSON.stringify(item),
  1196. });
  1197. break;
  1198. case 31:
  1199. item.addtime = item.uptime;
  1200. item.type = item.type_id;
  1201. uni.navigateTo({
  1202. url: '../shuHai1/detail?info=' + JSON.stringify(item),
  1203. });
  1204. break;
  1205. case 40:
  1206. item.addtime = item.uptime;
  1207. uni.navigateTo({
  1208. url: `../cb/shuifeizs/shuifeizs?devBid=${item.d_id}&devName=${item.name}&devStatus=${item.status}`,
  1209. });
  1210. break;
  1211. case 42:
  1212. item.addtime = item.uptime;
  1213. uni.navigateTo({
  1214. url: `../cb/wenshizs/wenshizs?devBid=${item.d_id}&devName=${item.name}&devStatus=${item.status}`,
  1215. });
  1216. break;
  1217. case 52:
  1218. item.addtime = item.uptime;
  1219. uni.navigateTo({
  1220. url: `../cb/wenshidp/wenshidp?devBid=${item.d_id}&devName=${item.name}&devStatus=${item.status}`,
  1221. });
  1222. break;
  1223. case 45:
  1224. item.addtime = item.uptime;
  1225. uni.navigateTo({
  1226. url: `../cb/shuifeizsFirst/shuifeizs?devBid=${item.d_id}&devName=${item.name}&devStatus=${item.status}`,
  1227. });
  1228. break;
  1229. case 46:
  1230. uni.navigateTo({
  1231. url: `../deviceDetails/weatherStation/index?devBid=${item.id}&devName=${item.name}&devStatus=${item.status}&address=${item.address}&uptime=${item.uptime}&d_id=${item.d_id}&deviceType=46`,
  1232. });
  1233. break;
  1234. case 47:
  1235. uni.navigateTo({
  1236. url: `../cb/zhamenFirst/zhamenzs?devBid=${item.d_id}&devName=${item.name}&devStatus=${item.status}`,
  1237. });
  1238. break;
  1239. default:
  1240. item.addtime = item.uptime;
  1241. item.type = this.type_id;
  1242. uni.navigateTo({
  1243. url: '../cb/xy2.0/particulars?info=' + JSON.stringify(item),
  1244. });
  1245. break;
  1246. }
  1247. },
  1248. searchinput() {
  1249. Debounce(() => {
  1250. this.eqlistdata = [];
  1251. this.page = 1;
  1252. this.eqlist();
  1253. }, 1000)();
  1254. },
  1255. scrollTop(e) {},
  1256. upper() {},
  1257. lower() {
  1258. if(this.eqlistdata.length >= this.total){
  1259. return;
  1260. }
  1261. Debounce(() => {
  1262. this.page++;
  1263. this.eqlist(true);
  1264. }, 500)();
  1265. },
  1266. scroll() {},
  1267. },
  1268. watch:{
  1269. pur_id(){
  1270. setTimeout(() => {
  1271. this.getUserlogin();
  1272. }, 100);
  1273. },
  1274. },
  1275. onLoad() {
  1276. this.getHours();
  1277. this.getMinutes();
  1278. const that = this;
  1279. uni.$on('purId', (item) => {
  1280. that.pur_id = item.purId;
  1281. that.menu = item.menu;
  1282. that.device_model = item.device_model;
  1283. });
  1284. uni.$on('refreshData', (refreshData) => {
  1285. this.eqlist();
  1286. });
  1287. uni.getStorage({
  1288. key:"myuser_type",
  1289. success:(res)=>{
  1290. console.log(res,'resresres')
  1291. this.myuser_type = res?.data;
  1292. }
  1293. })
  1294. this.getUserlogin();
  1295. },
  1296. onShow() {
  1297. // 监听刷新数据事件
  1298. const refreshData = uni.getStorageSync('refreshData');
  1299. if(!this.refreshData){
  1300. this.refreshData = refreshData;
  1301. // 如果发生改变,刷新数据
  1302. if(refreshData){
  1303. Debounce(() => {
  1304. this.getUserlogin();
  1305. }, 500)();
  1306. }
  1307. }else if(this.refreshData != refreshData){
  1308. this.refreshData = refreshData;
  1309. Debounce(() => {
  1310. this.getUserlogin();
  1311. }, 500)();
  1312. }
  1313. },
  1314. onTabItemTap(e) {
  1315. },
  1316. onReachBottom() {
  1317. if(this.eqlistdata.length >= this.total){
  1318. return;
  1319. }
  1320. Debounce(() => {
  1321. this.page++;
  1322. this.eqlist(true);
  1323. }, 500)();
  1324. },
  1325. onPageScroll(e) {
  1326. //nvue暂不支持滚动监听,可用bindingx代替
  1327. if (e.scrollTop > 200) {
  1328. //距离大于200时显示
  1329. this.isTop = true;
  1330. } else {
  1331. //距离小于200时隐藏
  1332. this.isTop = false;
  1333. }
  1334. },
  1335. };
  1336. </script>
  1337. <style lang="scss">
  1338. page {
  1339. background: linear-gradient(180deg, #ffffff00 0%, #F5F6FA 23.64%, #F5F6FA 100%), linear-gradient(102deg, #BFEADD 6.77%, #B8F1E7 40.15%, #B9EEF5 84.02%);
  1340. }
  1341. ::v-deep .u-flex{
  1342. display: flex;
  1343. align-items: center;
  1344. justify-content: center;
  1345. }
  1346. .hour,.minute{
  1347. font-size: 28rpx;
  1348. color: #999999;
  1349. border-radius: 8rpx;
  1350. border: 2rpx solid #aaa;
  1351. padding: 4rpx 8rpx;
  1352. margin-right: 8rpx;
  1353. height: 40rpx;
  1354. display: flex;
  1355. align-items: center;
  1356. justify-content: center;
  1357. width: 160rpx;
  1358. }
  1359. /deep/.uni-icons {
  1360. font-size: 40rpx !important;
  1361. }
  1362. input{
  1363. background: transparent !important;
  1364. }
  1365. .textbox {
  1366. width: 100%;
  1367. height: calc(100vh - 82rpx);
  1368. padding-top: 82rpx;
  1369. box-sizing: border-box;
  1370. }
  1371. .inputs {
  1372. width: 65%;
  1373. margin-left: 12rpx;
  1374. /deep/.u-content {
  1375. background-color: #fff !important;
  1376. }
  1377. /deep/.uni-input-wrapper {
  1378. background-color: #fff !important;
  1379. }
  1380. }
  1381. .slider-container{
  1382. position: relative;
  1383. margin-top: 10rpx;
  1384. .slider-min-value{
  1385. position: absolute;
  1386. left: 0;
  1387. top: -60rpx;
  1388. }
  1389. .slider{
  1390. width: 600rpx;
  1391. }
  1392. .slider-max-value{
  1393. position: absolute;
  1394. right: 0;
  1395. top: -60rpx;
  1396. }
  1397. }
  1398. .custom-progress{
  1399. width: 500rpx;
  1400. padding: 0;
  1401. &.dragging{
  1402. .progress-fill,
  1403. .progress-thumb{
  1404. transition: none;
  1405. }
  1406. }
  1407. .progress-track{
  1408. position: relative;
  1409. height: 12rpx;
  1410. background-color: #ebedf0;
  1411. border-radius: 6rpx;
  1412. }
  1413. .progress-fill{
  1414. position: absolute;
  1415. left: 0;
  1416. top: 0;
  1417. height: 100%;
  1418. background-color: #0BBC58;
  1419. border-radius: 6rpx;
  1420. transition: width 0.2s;
  1421. }
  1422. .progress-thumb{
  1423. position: absolute;
  1424. top: 50%;
  1425. width: 28rpx;
  1426. height: 28rpx;
  1427. margin-left: -14rpx;
  1428. margin-top: -14rpx;
  1429. border-radius: 50%;
  1430. background-color: #fff;
  1431. box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  1432. transition: left 0.2s;
  1433. }
  1434. }
  1435. .utabs_box {
  1436. width: 100%;
  1437. position: fixed;
  1438. top: 88px;
  1439. background-color: #ffffff;
  1440. z-index: 100;
  1441. .utabs {
  1442. width: 95%;
  1443. margin: 0 auto;
  1444. }
  1445. }
  1446. .opening-container{
  1447. position: relative;
  1448. width: 100%;
  1449. .opening-min{
  1450. position: absolute;
  1451. top: 0;
  1452. left: 0;
  1453. font-size: 24rpx;
  1454. }
  1455. .opening-max{
  1456. position: absolute;
  1457. top: 0;
  1458. right: 0;
  1459. font-size: 24rpx;
  1460. }
  1461. }
  1462. .loading {
  1463. position: fixed;
  1464. top: 440px;
  1465. width: 95%;
  1466. left: 2.5%;
  1467. text-align: center;
  1468. .img {
  1469. width: 300rpx;
  1470. height: 40rpx;
  1471. }
  1472. }
  1473. .active-tab{
  1474. border-radius: 8rpx;
  1475. background: linear-gradient(0deg, #0bbc580f 0%, #0bbc580f 100%), #00000005;
  1476. }
  1477. .tab-box {
  1478. font-size: 30rpx;
  1479. box-sizing: border-box;
  1480. width: 100%;
  1481. height: 100%;
  1482. overflow-y: hidden;
  1483. overflow-x: auto;
  1484. white-space: nowrap;
  1485. // 去掉滚动条
  1486. -ms-overflow-style: none;
  1487. scrollbar-width: none;
  1488. .tab-item {
  1489. cursor: pointer;
  1490. position: relative;
  1491. text-align: center;
  1492. display: inline-block;
  1493. padding: 16rpx 24rpx;
  1494. box-sizing: border-box;
  1495. span {
  1496. display: inline-block;
  1497. }
  1498. }
  1499. }
  1500. .tab-box-top{
  1501. .tab-item {
  1502. width: 140rpx;
  1503. text-align: center;
  1504. }
  1505. }
  1506. .action-list{
  1507. display: flex;
  1508. margin: 8px 0;
  1509. .action-item{
  1510. display: flex;
  1511. align-items: center;
  1512. margin-right: 8px;
  1513. .item-icon{
  1514. width: 15px;
  1515. height: 15px;
  1516. margin-right: 4px;
  1517. }
  1518. }
  1519. }
  1520. .action-container{
  1521. display: flex;
  1522. align-items: center;
  1523. gap: 16rpx;
  1524. border-radius: 8rpx;
  1525. border: 2rpx solid #999999;
  1526. .action-container-item{
  1527. flex:1;
  1528. height: 90rpx;
  1529. background: #ffffff;
  1530. padding: 8rpx;
  1531. display:flex;
  1532. align-items: center;
  1533. margin-right: 16rpx;
  1534. &:last-child{
  1535. margin-right: 0;
  1536. }
  1537. }
  1538. .action-open{
  1539. width: 100%;
  1540. display: flex;
  1541. justify-content: center;
  1542. align-items: center;
  1543. }
  1544. .item-number{
  1545. width: 30rpx;
  1546. height: 30rpx;
  1547. line-height: 30rpx;
  1548. display: flex;
  1549. justify-content: center;
  1550. align-items: center;
  1551. border-radius: 50%;
  1552. border: 2rpx solid #999999;
  1553. color: #999999;
  1554. font-size: 22rpx;
  1555. margin-right: 8rpx;
  1556. //超出部分省略号
  1557. overflow: hidden;
  1558. white-space: nowrap;
  1559. text-overflow: ellipsis;
  1560. }
  1561. .item-number-active{
  1562. border: 2rpx solid #0BBC58;
  1563. color: #0BBC58;
  1564. }
  1565. // 天正开关(53)的 fa 路数名为"30度/60度/90度",用自适应宽度的胶囊样式
  1566. .fa-item-number{
  1567. width: auto;
  1568. min-width: 30rpx;
  1569. padding: 0 10rpx;
  1570. border-radius: 30rpx;
  1571. }
  1572. .action-open-value{
  1573. margin-top: 8rpx;
  1574. display: flex;
  1575. align-items: center;
  1576. justify-content: center;
  1577. font-size: 24rpx;
  1578. }
  1579. .item-icon{
  1580. width: 15px;
  1581. height: 15px;
  1582. margin-right: 4px;
  1583. }
  1584. }
  1585. .progress-container{
  1586. display: flex;
  1587. justify-content: center;
  1588. align-items: center;
  1589. height:100%;
  1590. }
  1591. .tab {
  1592. // background-color: #0BBC58;
  1593. margin-top: 42rpx;
  1594. margin-bottom: 38rpx;
  1595. padding: 0 32rpx;
  1596. .img-icon {
  1597. width: 80rpx;
  1598. height: 80rpx;
  1599. margin-bottom: 12rpx;
  1600. }
  1601. .text {
  1602. color: #303133;
  1603. font-size: 24rpx;
  1604. }
  1605. .tab-content {
  1606. width: 100%;
  1607. height: 162rpx;
  1608. }
  1609. .tab-item.active {
  1610. border-radius: 24rpx;
  1611. background: linear-gradient(0deg, #0bbc580f 0%, #0bbc580f 100%), #00000005;
  1612. }
  1613. }
  1614. .action-group{
  1615. display: flex;
  1616. align-items: center;
  1617. gap: 16rpx;
  1618. margin-top: 24rpx;
  1619. background: #0BBC58;
  1620. position: fixed;
  1621. bottom: 0rpx;;
  1622. border-radius: 8rpx;
  1623. z-index:1000;
  1624. color:#fff;
  1625. width:100%;
  1626. padding: 10rpx 0;
  1627. .action-item{
  1628. display: flex;
  1629. align-items: center;
  1630. justify-content: center;
  1631. flex:1;
  1632. text-align: center;
  1633. border-radius: 8rpx;
  1634. border:2rpx solid #0BBC58;
  1635. padding: 16rpx 0;
  1636. font-size: 24rpx;
  1637. color: #fff;
  1638. .item-icon{
  1639. width: 15px;
  1640. height: 15px;
  1641. margin-right: 4px;
  1642. }
  1643. }
  1644. }
  1645. .second-tab {
  1646. height: 80rpx;
  1647. .tab-item{
  1648. font-size: 28rpx;
  1649. color: #999999;
  1650. }
  1651. .tab-item.active {
  1652. color: #303133;
  1653. font-weight: 700;
  1654. }
  1655. .tab-item.active::after {
  1656. content: '';
  1657. position: absolute;
  1658. bottom: 0;
  1659. left: 50%;
  1660. transform: translateX(-50%);
  1661. width: 18px; /* 比文字略宽 */
  1662. height: 18px;
  1663. border: 3px solid #0BBC58;
  1664. border-radius: 50%;
  1665. border-color: transparent; /* 隐藏其他部分 */
  1666. border-bottom-color: #0BBC58; /* 组合成45度角 */
  1667. // transform: rotate(0deg); /* 调整角度 */
  1668. }
  1669. }
  1670. .third-tab {
  1671. margin: 8rpx 0;
  1672. height: 64rpx;
  1673. line-height: 64rpx;
  1674. display: flex;
  1675. justify-content: space-between;
  1676. .third-tab-item {
  1677. flex: 1;
  1678. text-align: center;
  1679. }
  1680. }
  1681. .list {
  1682. width: 100%;
  1683. background-color: #F5F6FA;
  1684. // margin-bottom: 100rpx;
  1685. overflow-y: auto;
  1686. padding: 0 32rpx;
  1687. padding-bottom: 100rpx;
  1688. box-sizing: border-box;
  1689. .list_item {
  1690. width: 100%;
  1691. margin: 0 auto 24rpx;
  1692. padding: 32rpx;
  1693. box-sizing: border-box;
  1694. position: relative;
  1695. background-color: #ffffff;
  1696. border-radius: 16rpx;
  1697. .list_item_top {
  1698. .p1 {
  1699. width: 86%;
  1700. font-size: 28rpx;
  1701. overflow: hidden;
  1702. display: flex;
  1703. align-items: center;
  1704. .title{
  1705. max-width: 75%;
  1706. color: #333333;
  1707. font-size: 28rpx;
  1708. font-weight: 700;
  1709. margin-right: 8rpx;
  1710. overflow: hidden;
  1711. text-overflow: ellipsis;
  1712. white-space: nowrap;
  1713. }
  1714. .sub-title{
  1715. border-radius: 32rpx;
  1716. border:2rpx solid #0bbc58;
  1717. padding: 4rpx 12rpx;
  1718. font-size: 22rpx;
  1719. font-weight: 400;
  1720. overflow: hidden;
  1721. text-overflow: ellipsis;
  1722. white-space: nowrap;
  1723. color:#0bbc58;
  1724. margin-left: 20rpx;
  1725. }
  1726. }
  1727. }
  1728. .online-status{
  1729. font-size: 28rpx;
  1730. position: absolute;
  1731. text-align: center;
  1732. right: 2rpx;
  1733. top: 2rpx;
  1734. image{
  1735. width: 140rpx;
  1736. height: 56rpx;
  1737. }
  1738. .status-text-online{
  1739. color: #0BBC58;
  1740. position: absolute;
  1741. top: 0rpx;
  1742. right: 0rpx;
  1743. width: 120rpx;
  1744. height: 56rpx;
  1745. line-height: 56rpx;
  1746. font-size: 26rpx;
  1747. }
  1748. .status-text-offline{
  1749. color: #FB4E52;
  1750. position: absolute;
  1751. top: 0rpx;
  1752. right: 0rpx;
  1753. width: 120rpx;
  1754. height: 56rpx;
  1755. line-height: 56rpx;
  1756. font-size: 26rpx;
  1757. }
  1758. }
  1759. // .p2 {
  1760. // color: #0BBC58;
  1761. // background: #0bbc581a;
  1762. // }
  1763. // .p_out {
  1764. // color: #FB4E52;
  1765. // background: #fb4e521a;
  1766. // }
  1767. .list_item_text {
  1768. margin-top: 20rpx;
  1769. .p1 {
  1770. font-size: 24rpx;
  1771. color: #303133;
  1772. margin-top: 10rpx;
  1773. word-break: break-all;
  1774. }
  1775. .label{
  1776. color: #999999;
  1777. text-align: left;
  1778. margin-right: 32rpx;
  1779. font-size: 24rpx;
  1780. min-width: 90rpx;
  1781. display: inline-block;
  1782. }
  1783. .nav-label{
  1784. //超出隐藏
  1785. display: inline-block;
  1786. width: 70%;
  1787. overflow: hidden;
  1788. text-overflow: ellipsis;
  1789. white-space: nowrap;
  1790. }
  1791. }
  1792. .list_item_btn {
  1793. width: 126rpx;
  1794. color: #42b983;
  1795. height: 40rpx;
  1796. text-align: center;
  1797. border: 1rpx solid #42b983;
  1798. border-radius: 25rpx;
  1799. font-size: 24rpx;
  1800. line-height: 35rpx;
  1801. position: absolute;
  1802. bottom: 15rpx;
  1803. right: 20rpx;
  1804. }
  1805. }
  1806. }
  1807. .top {
  1808. position: fixed;
  1809. right: 30px;
  1810. bottom: 100px;
  1811. z-index: 100;
  1812. image {
  1813. width: 100rpx;
  1814. height: 100rpx;
  1815. }
  1816. }
  1817. </style>