equipmentStatusList.vue 23 KB

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