equipmentStatusList.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857
  1. <!-- 机器状态页面 -->
  2. <template>
  3. <view v-if="merchantList.length>1">
  4. <uni-collapse :accordion="true">
  5. <view class="titleFlag">
  6. <image class="img" src="../../static/img/red.png"></image>
  7. <font class="wenziT">红色代表机器报警</font>
  8. <image class="img" src="../../static/img/green.png"></image>
  9. <font class="wenziT">绿色代表机器正常</font>
  10. </view>
  11. <view class="titlelist" v-for="(merchant,index) in merchantList" :key="merchant.id">
  12. <uni-collapse-item :title="getMerchantTitle(merchant)" :open="index===0">
  13. <view style="padding: 20upx;background-color: aliceblue;">
  14. <view v-if="merchant.equipmentList.length==0" style="text-align: center;">暂无数据</view>
  15. <view v-if="merchant.equipmentList.length>0">
  16. <uni-collapse :show-animation="true">
  17. <view style="position: relative;" v-for="equipment in merchant.equipmentList"
  18. :key="equipment.id">
  19. <span class="status-css"
  20. :class="equipment.hasTodayAlarm===true?statusError : statusNormal"></span>
  21. <uni-collapse-item :title="getEquipmentTitle(equipment)">
  22. <view style="padding: 20upx;background-color: antiquewhite;">
  23. <view class="swithBox" v-if="equipment.isSleep">
  24. <view class="swichFont">睡眠状态:机器已睡眠</view>
  25. <view class="switch">
  26. <switch style="transform:scale(0.65)" checked
  27. @change="change(equipment.id,0)" />
  28. </view>
  29. </view>
  30. <view class="swithBox" v-else>
  31. <view class="swichFont">睡眠状态:未睡眠</view>
  32. <view class="switch">
  33. <switch style="transform:scale(0.65)" :checked="sleepChecked"
  34. @change="change(equipment.id,1)" />
  35. </view>
  36. </view>
  37. <view class="line1"></view>
  38. <view class="swithBox" v-if="equipment.eqeStatus==0">
  39. <view class="swichFont">关机:已关机</view>
  40. <view class="switch">
  41. <switch style="transform:scale(0.65)" checked
  42. @change="OnOff(equipment.id,1)" />
  43. </view>
  44. </view>
  45. <view class="swithBox" v-else>
  46. <view class="swichFont">关机:未关机</view>
  47. <view class="switch">
  48. <switch style="transform:scale(0.65)" :checked="onffChecked"
  49. @change="OnOff(equipment.id,0)" />
  50. </view>
  51. </view>
  52. <view class="line1"></view>
  53. <view><span>机器唯一码:</span><span>{{equipment.clientId}}</span></view>
  54. <view>
  55. <span>所在地:</span><span>{{equipment.fullName?equipment.fullName:''}}</span>
  56. </view>
  57. <view>
  58. <span>炉头温度:</span><span>{{equipment.furnaceTm?equipment.furnaceTm:''}}</span>
  59. </view>
  60. <view>
  61. <span>柜内湿度:</span><span>{{equipment.cabinetHd?equipment.cabinetHd:''}}</span>
  62. </view>
  63. <view>
  64. <span>柜内温度:</span><span>{{equipment.cabinetTm?equipment.cabinetTm:''}}</span>
  65. </view>
  66. <view v-if="equipment.hasTodayAlarm">
  67. <view><span>报警内容:</span></view>
  68. <view v-for="(alarm,index) in equipment.alarmList" :key="index">
  69. <view><span
  70. class="baojing">{{alarm.occurrenceTime?alarm.occurrenceTime:''}}
  71. {{alarm.alarmContent}}
  72. <button v-if="alarm.isEliminate==1" style="color:#BEBEBE;"
  73. @click="eliminate(alarm.id)" class="eliminateButton">
  74. <p class="p">已消除</p>
  75. </button>
  76. <button v-if="alarm.isEliminate!=1" type="primary"
  77. @click="eliminate(alarm.id)" class="eliminateButton">
  78. <p class="p">消除</p>
  79. </button>
  80. </span></view>
  81. </view>
  82. </view>
  83. <view v-else>
  84. <view><span>报警内容:</span><span>{{equipment.occurrenceTime?equipment.occurrenceTime:''}}
  85. {{equipment.alarmContent}}</span></view>
  86. </view>
  87. </view>
  88. </uni-collapse-item>
  89. </view>
  90. </uni-collapse>
  91. </view>
  92. </view>
  93. </uni-collapse-item>
  94. </view>
  95. </uni-collapse>
  96. </view>
  97. <view v-else>
  98. <uni-collapse :show-animation="true">
  99. <view class="titleFlag">
  100. <image class="img" src="../../static/img/red.png"></image>
  101. <font class="wenziT">{{$t('equipmentStatusList.red')}}</font>
  102. <image class="img" src="../../static/img/green.png"></image>
  103. <font class="wenziT">{{$t('equipmentStatusList.green')}}</font>
  104. </view>
  105. <view class="titlelist" style="position: relative;" v-for="equipment in merchantList[0].equipmentList"
  106. :key="equipment.id">
  107. <span class="status-css" :class="equipment.hasTodayAlarm===true?statusError : statusNormal"></span>
  108. <uni-collapse-item :title="getEquipmentTitle(equipment)">
  109. <!-- 睡眠 -->
  110. <view style="padding: 20upx;background-color: antiquewhite;">
  111. <view class="swithBox" v-if="equipment.isSleep">
  112. <view class="swichFont">{{$t('equipmentStatusList.sleep')}}</view>
  113. <view class="switch">
  114. <switch style="transform:scale(0.65)" checked @change="change(equipment.id,0)" />
  115. </view>
  116. </view>
  117. <view class="swithBox" v-else>
  118. <view class="swichFont">{{$t('equipmentStatusList.unsleep')}}</view>
  119. <view class="switch">
  120. <switch style="transform:scale(0.65)" :checked="sleepChecked"
  121. @change="change(equipment.id,1)" />
  122. </view>
  123. </view>
  124. <view class="line1"></view>
  125. <!-- 一键重启 -->
  126. <view class="opendoor"><span>{{$t('equipmentStatusList.reboot')}}:</span>
  127. <view class="">
  128. <button type="primary" @click="reboot(equipment.id)" class="button">
  129. <p class="p">{{$t('equipmentStatusList.reset')}}</p>
  130. </button>
  131. </view>
  132. </view>
  133. <view class="line1"></view>
  134. <!-- 关机 -->
  135. <view class="" v-if="globalUser.open==0">
  136. <!-- 已关机 -->
  137. <view class="swithBox" v-if="equipment.eqeStatus==0">
  138. <view class="swichFont1">{{$t('equipmentStatusList.off')}}</view>
  139. <view class="switch1">
  140. <!-- <switch style="transform:scale(0.65)" checked @change="OnOff(equipment.id,1)" /> -->
  141. <button style="color:#BEBEBE;" @click="OnOff(equipment.id,1)" class="button">
  142. <p class="p">{{$t('equipmentStatusList.kaiqi')}}</p>
  143. </button>
  144. <button type="primary" @click="OnOff(equipment.id,0)" class="button">
  145. <p class="p">{{$t('equipmentStatusList.guanbi')}}</p>
  146. </button>
  147. </view>
  148. </view>
  149. <!-- 已开机 -->
  150. <view class="swithBox" v-else>
  151. <view class="swichFont1">{{$t('equipmentStatusList.on')}}</view>
  152. <view class="switch1">
  153. <!-- <switch style="transform:scale(0.65)" :checked="onffChecked" @change="OnOff(equipment.id,0)" /> -->
  154. <button type="primary" @click="OnOff(equipment.id,1)" class="button">
  155. <p class="p">{{$t('equipmentStatusList.kaiqi')}}</p>
  156. </button>
  157. <button style="color:#BEBEBE;" @click="OnOff(equipment.id,0)" class="button">
  158. <p class="p">{{$t('equipmentStatusList.guanbi')}}</p>
  159. </button>
  160. </view>
  161. </view>
  162. </view>
  163. <view class="line1"></view>
  164. <!-- 一键重启 -->
  165. <!-- <view class="opendoor"><span>{{$t('equipmentStatusList.reboot')}}:</span>
  166. <view class="">
  167. <button type="primary" @click="reboot(equipment.id)" class="button">
  168. <p class="p">{{$t('equipmentStatusList.reset')}}</p>
  169. </button>
  170. </view>
  171. </view>
  172. <view class="line1"></view> -->
  173. <!-- 远程开门 -->
  174. <view class="opendoor"><span>{{$t('equipmentStatusList.door')}}:</span>
  175. <view class="">
  176. <button type="primary" @click="openDoor(equipment.id)" class="button">
  177. <p class="p">{{$t('equipmentStatusList.open')}}</p>
  178. </button>
  179. </view>
  180. </view>
  181. <!-- 查看定位 -->
  182. <view class="opendoor"><span>{{$t('equipmentStatusList.gps')}}:</span>
  183. <view class="">
  184. <button type="primary"
  185. @click="lookMap(equipment.id,equipment.longitude,equipment.latitude)"
  186. class="button">
  187. <p class="p">{{$t('equipmentStatusList.look')}}</p>
  188. </button>
  189. </view>
  190. </view>
  191. <view><span>{{$t('equipmentStatusList.equipmentNo')}}:</span><span>{{equipment.clientId}}</span>
  192. </view>
  193. <view>
  194. <span>{{$t('equipmentStatusList.area')}}:</span><span>{{equipment.fullName?equipment.fullName:''}}</span>
  195. </view>
  196. <view>
  197. <span>{{$t('equipmentStatusList.temperature')}}:</span><span>{{equipment.furnaceTm?equipment.furnaceTm:''}}</span>
  198. </view>
  199. <view>
  200. <span>{{$t('equipmentStatusList.humidity')}}:</span><span>{{equipment.cabinetHd?equipment.cabinetHd:''}}</span>
  201. </view>
  202. <view>
  203. <span>{{$t('equipmentStatusList.equipmentTemperature')}}:</span><span>{{equipment.cabinetTm?equipment.cabinetTm:''}}</span>
  204. </view>
  205. <view><span>plcVersion:</span><span>{{equipment.plcVersion}}</span></view>
  206. <!-- 物料 -->
  207. <view v-show="equipment.isMaterialUse==1">
  208. <span>{{$t('equipmentStatusList.whiteSugar')}}:</span><span>{{equipment.whiteSugar?equipment.whiteSugar:''}}%
  209. -- </span>
  210. <span>{{$t('equipmentStatusList.redSugar')}}:</span><span>{{equipment.redSugar?equipment.redSugar:''}}%
  211. -- </span>
  212. <span>{{$t('equipmentStatusList.yellowSugar')}}:</span><span>{{equipment.yellowSugar?equipment.yellowSugar:''}}%
  213. -- </span>
  214. <span>{{$t('equipmentStatusList.blueSugar')}}:</span><span>{{equipment.blueSugar?equipment.blueSugar:''}}%
  215. </span>
  216. </view>
  217. <view v-show="equipment.isMaterialUse==1">
  218. <span>{{$t('equipmentStatusList.stick')}}:</span><span>{{equipment.stick?equipment.stick:''}}%
  219. </span></view>
  220. <view v-show="equipment.isMaterialUse==1">
  221. <span>{{$t('equipmentStatusList.water')}}:</span><span>{{equipment.water?equipment.water:''}}%
  222. -- </span>
  223. <span>{{$t('equipmentStatusList.wasteWater')}}:</span><span>{{equipment.wasteWater?equipment.wasteWater:''}}%</span>
  224. </view>
  225. <view class="opendoor" v-show="equipment.isMaterialUse==1"><span>{{$t('equipmentStatusList.buliao')}}:</span>
  226. <view class="">
  227. <button type="primary" @click="buliao(equipment.id)" class="button">
  228. <p class="p">{{$t('equipmentStatusList.buliaoT')}}</p>
  229. </button>
  230. </view>
  231. </view>
  232. <view>
  233. <span>{{$t('equipmentStatusList.refreshTime')}}:</span><span>{{equipment.lastUpdateTime}}</span>
  234. </view>
  235. <view>
  236. <span>{{$t('equipmentStatusList.volume')}}:</span><span>{{equipment.volume?equipment.volume:''}}</span>
  237. </view>
  238. <view class="" v-if="equipment.hasTodayAlarm">
  239. <view><span>{{$t('equipmentStatusList.alarm')}}:</span></view>
  240. <view v-for="(alarm,index) in equipment.alarmList" :key="index">
  241. <view>
  242. <span class="baojing">{{alarm.occurrenceTime?alarm.occurrenceTime:''}}
  243. {{alarm.alarmContent}}
  244. <button v-if="alarm.isEliminate==1" style="color:#BEBEBE;"
  245. @click="eliminate(alarm.id)" class="eliminateButton">
  246. <p class="p">{{$t('equipmentStatusList.yixiaochu')}}</p>
  247. </button>
  248. <button v-if="alarm.isEliminate!=1" type="primary" @click="eliminate(alarm.id)"
  249. class="eliminateButton">
  250. <p class="p">{{$t('equipmentStatusList.xiaochu')}}</p>
  251. </button>
  252. </span>
  253. </view>
  254. </view>
  255. </view>
  256. <view class="" v-else>
  257. <view><span>{{$t('equipmentStatusList.alarm')}}:</span><span>{{equipment.occurrenceTime?equipment.occurrenceTime:''}}
  258. {{equipment.alarmContent}}</span></view>
  259. </view>
  260. </view>
  261. </uni-collapse-item>
  262. </view>
  263. </uni-collapse>
  264. </view>
  265. </template>
  266. <script>
  267. import {
  268. mapState,
  269. mapActions,
  270. mapMutations
  271. } from 'vuex'
  272. import uniCollapse from '@/components/uni-collapse/uni-collapse.vue'
  273. import uniCollapseItem from '@/components/uni-collapse-item/uni-collapse-item.vue'
  274. import uniList from '@/components/uni-list/uni-list.vue'
  275. import uniListItem from '@/components/uni-list-item/uni-list-item.vue'
  276. import {
  277. dateUtils
  278. } from '@/common/util.js';
  279. export default {
  280. components: {
  281. uniCollapse,
  282. uniCollapseItem,
  283. uniList,
  284. uniListItem,
  285. },
  286. data() {
  287. return {
  288. globalUser: {},
  289. merchantList: [{
  290. equipmentList: []
  291. }],
  292. extraIcon: {
  293. color: '#4cd964',
  294. size: '22',
  295. type: 'spinner'
  296. },
  297. statusNormal: 'status-normal',
  298. statusError: 'status-error',
  299. sleepChecked: null,
  300. onffChecked: null,
  301. time: null,
  302. timeAll: {
  303. },
  304. input: 0,
  305. }
  306. },
  307. computed: {
  308. ...mapState(['loginUser']),
  309. },
  310. onPullDownRefresh() {
  311. this.getEquipmentListData();
  312. },
  313. onShow() {
  314. this.input = this.input + 1;
  315. this.globalUser = uni.getStorageSync("globalUser");
  316. uni.setNavigationBarTitle({
  317. title: this.$t('equipmentStatusList.title')
  318. });
  319. uni.setTabBarItem({
  320. index: 3,
  321. text: this.$t('tabs.tab4')
  322. });
  323. var token = uni.getStorageSync("token");
  324. if (token.length > 1) {
  325. this.getEquipmentListData();
  326. } else {
  327. uni.reLaunch({
  328. url: '../Login/Login',
  329. });
  330. }
  331. },
  332. methods: {
  333. ...mapActions('chart', ['getEquipmentListByUser']),
  334. getMerchantTitle(merchant) {
  335. return merchant.name ? merchant.name : merchant.username;
  336. },
  337. getEquipmentTitle(equipment) {
  338. return equipment.name ? equipment.name : '暂无名称';
  339. },
  340. getEquipmentListData() {
  341. this.getEquipmentListByUser(this.globalUser)
  342. .then(data => {
  343. this.merchantList = data;
  344. var listName = data[0].equipmentList;
  345. var times = new Map;
  346. if (this.input == 1) {
  347. for (var i = 0; i < listName.length; i++) {
  348. var k = listName[i].id;
  349. times.set(k, null);
  350. }
  351. this.timeAll = times;
  352. }
  353. var listId = data[0].id;
  354. if (listId != null && listId != '1') {
  355. uni.setStorageSync("listName", listName);
  356. }
  357. uni.stopPullDownRefresh();
  358. }, _ => void uni.stopPullDownRefresh());
  359. },
  360. //查看经纬度
  361. lookMap(id, longitude, latitude) {
  362. var item = {};
  363. item["id"] = id;
  364. item["longitude"] = longitude;
  365. item["latitude"] = latitude;
  366. var globalUser = uni.getStorageSync("globalUser");
  367. var ifForeign = globalUser.ifForeign;
  368. if (ifForeign == 0) {
  369. uni.navigateTo({
  370. url: '../../packageA/pages/equipmentStatus/map?item=' + encodeURIComponent(JSON.stringify(
  371. item))
  372. });
  373. }
  374. if (ifForeign == 1) {
  375. uni.navigateTo({
  376. url: '../../packageA/pages/equipmentStatus/GoogleMap?item=' + encodeURIComponent(JSON
  377. .stringify(item))
  378. });
  379. }
  380. // uni.navigateTo({
  381. // // url:'map?item='+ encodeURIComponent(JSON.stringify(item))
  382. // url:'../../packageA/pages/equipmentStatus/map?item='+ encodeURIComponent(JSON.stringify(item))
  383. // // url:'../../packageA/pages/equipmentStatus/GoogleMap?item='+ encodeURIComponent(JSON.stringify(item))
  384. // // url: '/pages/user/map?item='+ encodeURIComponent(JSON.stringify(item))
  385. // });
  386. },
  387. //一键重启
  388. reboot(id) {
  389. var that = this;
  390. uni.showModal({
  391. title: that.$t('equipmentStatusList.tip'),
  392. content: that.$t('equipmentStatusList.rebootTip'),
  393. success: function(res) {
  394. if (res.confirm) {
  395. var serverurl = that.serverurl;
  396. var code = "1";
  397. var equipmentId = id;
  398. var token = uni.getStorageSync("token");
  399. uni.request({
  400. url: serverurl + '/TEquipment/onOff',
  401. data: {
  402. "adminId": code,
  403. "equipmentId": equipmentId
  404. },
  405. method: "POST",
  406. header: {
  407. 'token': token
  408. },
  409. success: (res) => {
  410. var list = res.data.data;
  411. if (list == "SUCCESS") {
  412. uni.showModal({
  413. title: that.$t('equipmentStatusList.kaiji'),
  414. content: '发送成功',
  415. success: function(res) {}
  416. })
  417. } else {
  418. uni.showModal({
  419. title: that.$t('equipmentStatusList.error'),
  420. content: that.$t(
  421. 'equipmentStatusList.kaijierror'),
  422. success: function(res) {}
  423. })
  424. }
  425. }
  426. });
  427. }
  428. }
  429. })
  430. },
  431. OnOff(id, code) {
  432. var that = this;
  433. var ddd = this.timeAll.get(id);
  434. if (that.timeAll.get(id) != null) {
  435. var stamp = Date.parse(new Date());
  436. var t = (stamp - that.timeAll.get(id)) / 1000;
  437. if (t < 30) {
  438. var s = 30 - t;
  439. uni.showModal({
  440. title: that.$t('equipmentStatusList.onoff'),
  441. content: that.$t('equipmentStatusList.remainingtime') + s + "s",
  442. success: function(res) {
  443. that.getEquipmentListData();
  444. }
  445. });
  446. return;
  447. }
  448. }
  449. var code1 = code;
  450. if (code1 == 0) {
  451. uni.showModal({
  452. title: that.$t('equipmentStatusList.tip'),
  453. content: that.$t('equipmentStatusList.onoffTip'),
  454. success: function(res) {
  455. if (res.confirm) {
  456. var serverurl = that.serverurl;
  457. var code2 = code1;
  458. var equipmentId = id;
  459. var token = uni.getStorageSync("token");
  460. uni.request({
  461. url: serverurl + '/TEquipment/onOff',
  462. data: {
  463. "adminId": code2,
  464. "equipmentId": equipmentId
  465. },
  466. method: "POST",
  467. header: {
  468. 'token': token
  469. },
  470. success: (res) => {
  471. var list = res.data.data;
  472. that.input = 2;
  473. var timestamp = Date.parse(new Date());
  474. that.timeAll.set(id, timestamp);
  475. var oo = that.timeAll;
  476. that.getEquipmentListData();
  477. if (list == 'SUCCESS') {
  478. uni.showModal({
  479. title: that.$t(
  480. 'equipmentStatusList.guanji'),
  481. content: that.$t(
  482. 'equipmentStatusList.tishi'),
  483. success: function(res) {
  484. that.getEquipmentListData();
  485. setTimeout(function() {
  486. that.network(id);
  487. }, 7000);
  488. }
  489. })
  490. } else {
  491. uni.showModal({
  492. title: that.$t(
  493. 'equipmentStatusList.error'),
  494. content: that.$t(
  495. 'equipmentStatusList.guanjierror'),
  496. success: function(res) {
  497. that.onffChecked = true;
  498. that.getEquipmentListData();
  499. }
  500. })
  501. }
  502. }
  503. });
  504. } else if (res.cancel) {
  505. that.onffChecked = false;
  506. that.getEquipmentListData();
  507. }
  508. }
  509. });
  510. } else {
  511. var serverurl = that.serverurl;
  512. var code = code;
  513. var equipmentId = id;
  514. var token = uni.getStorageSync("token");
  515. uni.request({
  516. url: serverurl + '/TEquipment/onOff',
  517. data: {
  518. "adminId": code,
  519. "equipmentId": equipmentId
  520. },
  521. method: "POST",
  522. header: {
  523. 'token': token
  524. },
  525. success: (res) => {
  526. that.input = 2;
  527. var list = res.data.data;
  528. that.getEquipmentListData();
  529. var timestamp = Date.parse(new Date());
  530. that.timeAll.set(id, timestamp);
  531. var oo = that.timeAll;
  532. if (list == "SUCCESS") {
  533. uni.showModal({
  534. title: that.$t('equipmentStatusList.kaiji'),
  535. content: that.$t('equipmentStatusList.tishi'),
  536. success: function(res) {
  537. that.getEquipmentListData();
  538. setTimeout(function() {
  539. that.network(id);
  540. }, 7000);
  541. }
  542. })
  543. } else {
  544. uni.showModal({
  545. title: that.$t('equipmentStatusList.error'),
  546. content: that.$t('equipmentStatusList.kaijierror'),
  547. success: function(res) {
  548. that.onffChecked = false;
  549. that.getEquipmentListData();
  550. }
  551. })
  552. }
  553. }
  554. });
  555. }
  556. },
  557. eliminate(id) {
  558. var token = uni.getStorageSync("token");
  559. uni.request({
  560. url: this.serverurl + '/TEquipment/eliminate',
  561. data: {
  562. "id": id
  563. },
  564. method: "POST",
  565. header: {
  566. 'token': token
  567. },
  568. success: (res) => {
  569. uni.showToast({
  570. title: "发送成功",
  571. icon: 'none',
  572. duration: 1000
  573. });
  574. this.getEquipmentListData();
  575. }
  576. });
  577. },
  578. network(id) {
  579. console.log("network");
  580. var token = uni.getStorageSync("token");
  581. var equipmentId = id;
  582. uni.request({
  583. url: this.serverurl + '/TEquipment/checkStatus',
  584. data: {
  585. "equipmentId": id
  586. },
  587. method: "POST",
  588. header: {
  589. 'token': token
  590. },
  591. success: (res) => {
  592. var data = res.data.data;
  593. if (data == 'fail') {
  594. uni.showToast({
  595. title: this.$t('equipmentStatusList.network'),
  596. icon: 'none',
  597. duration: 3000
  598. });
  599. this.getEquipmentListData();
  600. }
  601. }
  602. });
  603. },
  604. openDoor(id) {
  605. var token = uni.getStorageSync("token");
  606. uni.request({
  607. url: this.serverurl + '/TEquipment/openDoor',
  608. data: {
  609. "equipmentId": id
  610. },
  611. method: "POST",
  612. header: {
  613. 'token': token
  614. },
  615. success: (res) => {
  616. uni.showModal({
  617. title: this.$t('equipmentStatusList.open'),
  618. content: this.$t('equipmentStatusList.opensuccess'),
  619. success: function(res) {
  620. }
  621. })
  622. }
  623. });
  624. },
  625. buliao(id) {
  626. var that = this;
  627. var token = uni.getStorageSync("token");
  628. uni.showModal({
  629. title: this.$t('equipmentStatusList.tip'),
  630. content: this.$t('equipmentStatusList.wuliaoTip'),
  631. success: function(res) {
  632. uni.request({
  633. url: that.serverurl + '/TEquipment/buliao',
  634. data: {
  635. "equipmentId": id
  636. },
  637. method: "POST",
  638. header: {
  639. 'token': token
  640. },
  641. success: (res) => {
  642. uni.showModal({
  643. title: '提示Tip',
  644. content: res.data.message,
  645. success: function(res) {
  646. that.getEquipmentListData();
  647. }
  648. })
  649. }
  650. })
  651. }
  652. })
  653. },
  654. change(id, code) {
  655. var that = this;
  656. var code1 = code;
  657. if (code1 == 1) {
  658. uni.showModal({
  659. title: that.$t('equipmentStatusList.tip'),
  660. content: that.$t('equipmentStatusList.sleepTip'),
  661. success: function(res) {
  662. if (res.confirm) {
  663. var serverurl = that.serverurl;
  664. var code2 = code1;
  665. var equipmentId = id;
  666. var token = uni.getStorageSync("token");
  667. uni.request({
  668. url: serverurl + '/TEquipment/sleep',
  669. data: {
  670. "adminId": code2,
  671. "equipmentId": equipmentId
  672. },
  673. method: "POST",
  674. header: {
  675. 'token': token
  676. },
  677. success: (res) => {
  678. var list = res.data.data;
  679. that.getEquipmentListData();
  680. }
  681. });
  682. } else if (res.cancel) {
  683. that.sleepChecked = false;
  684. that.getEquipmentListData();
  685. }
  686. }
  687. });
  688. } else {
  689. var serverurl = that.serverurl;
  690. var code = code;
  691. var equipmentId = id;
  692. var token = uni.getStorageSync("token");
  693. uni.request({
  694. url: serverurl + '/TEquipment/sleep',
  695. data: {
  696. "adminId": code,
  697. "equipmentId": equipmentId
  698. },
  699. method: "POST",
  700. header: {
  701. 'token': token
  702. },
  703. success: (res) => {
  704. var list = res.data.data;
  705. that.getEquipmentListData();
  706. }
  707. });
  708. }
  709. },
  710. }
  711. }
  712. </script>
  713. <style>
  714. .status-css {
  715. position: absolute;
  716. width: 30upx;
  717. height: 30upx;
  718. right: 86upx;
  719. top: 30upx;
  720. border-radius: 30upx;
  721. color: "#596D83";
  722. font-size: 12upx;
  723. }
  724. .status-error {
  725. background-color: #dd524d
  726. }
  727. .status-normal {
  728. background-color: #4cd964
  729. }
  730. .baojing {
  731. display: flex;
  732. flex-direction: row;
  733. padding-left: 20upx;
  734. }
  735. .titleFlag {
  736. height: 56upx;
  737. background-color: #F8F8F8;
  738. color: #8C959F;
  739. font-size: 22upx;
  740. display: flex;
  741. flex-direction: row;
  742. }
  743. .opendoor {
  744. /* #ifdef H5 */
  745. /* #endif */
  746. padding-top: 10upx;
  747. padding-bottom: 10upx;
  748. /* text-align: center; */
  749. display: flex;
  750. flex-direction: row;
  751. }
  752. .button {
  753. /* #ifdef H5 */
  754. text-align: center;
  755. height: 50upx;
  756. weight: 20upx;
  757. /* #endif */
  758. padding-left: 15upx;
  759. /* padding-top: 2upx; */
  760. }
  761. .eliminateButton {
  762. /* #ifdef H5 */
  763. text-align: center;
  764. height: 50upx;
  765. weight: 20upx;
  766. /* #endif */
  767. padding-left: 15upx;
  768. /* padding-top: 2upx; */
  769. }
  770. .p {
  771. /* #ifdef H5 */
  772. font-size: 28upx;
  773. height: 50upx;
  774. weight: 20upx;
  775. transform: translateY(-14upx);
  776. /* text-align: center; */
  777. /* #endif */
  778. /* padding-bottom: 50upx; */
  779. text-align: center;
  780. padding-left: 13upx;
  781. }
  782. .img {
  783. padding-top: 20upx;
  784. padding-left: 30upx;
  785. width: 15upx;
  786. height: 15upx;
  787. }
  788. .wenziT {
  789. padding-top: 10upx;
  790. padding-left: 10upx;
  791. }
  792. .titlelist {
  793. color: #363D44;
  794. font-size: 16upx;
  795. font-family: "PingFang-SC-Medium";
  796. }
  797. .swithBox {
  798. display: flex;
  799. flex-direction: row;
  800. padding-bottom: 15upx;
  801. padding-top: 5upx;
  802. }
  803. .switch {
  804. width: 100upx;
  805. height: 22upx;
  806. }
  807. .switch1 {
  808. display: flex;
  809. flex-direction: row;
  810. width: 35%;
  811. height: 42upx;
  812. padding-top: 13upx;
  813. padding-left: 72upx;
  814. }
  815. .swichFont {
  816. width: 85%;
  817. padding-top: 12upx;
  818. }
  819. .swichFont1 {
  820. width: 55%;
  821. padding-top: 12upx;
  822. }
  823. .line1 {
  824. width: 100%;
  825. height: 3upx;
  826. background: #000000;
  827. }
  828. </style>