| | |
| | | <template> |
| | | <!-- <u-card :title="title" > --> |
| | | <!-- <u-card :title="ä½ å¥½"> --> |
| | | |
| | | <view class="" slot="body"> |
| | | <!-- <view v-for="(item,index) in tree" :key="item.id"> --> |
| | | <template> |
| | | <view style="display: flex;height:50px;"> |
| | | <button |
| | | :style="{borderRadius: '50%',width: '35px',height: '35px',margin: '5px',backgroundColor: online ? 'green' : 'red'}"></button> |
| | | <div style="margin:10px;">{{online?'å¨çº¿':'离线'}}</div> |
| | | <u-switch v-model="value" @change="asyncChange" style="margin-left: 180px;margin-top: 10px;"></u-switch> |
| | | <text style="margin-left: 10px;margin-top: 15px;">{{ value ? 'èªå¨æ¨¡å¼' : 'æå¨æ¨¡å¼' }}</text> |
| | | </view> |
| | | </template> |
| | | <u-grid :col="3"> |
| | | <u-grid-item @tap="clickCoupon(item.url)" v-for="(item) in tree" :key="item.id"> |
| | | <u-icon name="coupon" :size="50"></u-icon> |
| | |
| | | // title: 'æä½åè½' |
| | | datas: [], |
| | | tree: [], |
| | | version: "" |
| | | version: "", |
| | | online: false, |
| | | value: false, |
| | | isChanging: false |
| | | } |
| | | }, |
| | | onShow() { |
| | |
| | | }, |
| | | onLoad() { |
| | | this.getCurrentTree(); |
| | | this.Socketonline(); |
| | | this.GetAutoStatus(); |
| | | }, |
| | | beforeDestroy() { |
| | | if (this.intervalId) { |
| | | clearInterval(this.intervalId); |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.Socketonline(); |
| | | this.GetAutoStatus(); |
| | | setInterval(() => { |
| | | this.Socketonline(); |
| | | this.GetAutoStatus(); |
| | | }, 5000); |
| | | |
| | | var print = uni.getStorageSync('printFloor'); |
| | | if (print) { |
| | | config.printFloor = print;; |
| | |
| | | config.outboundFloor = outbound; |
| | | } |
| | | }, |
| | | |
| | | methods: { |
| | | asyncChange(e) { |
| | | if (this.isChanging) return; |
| | | this.isChanging = true; |
| | | |
| | | |
| | | // å
æ¾ç¤ºloadingç¶æ |
| | | this.$refs.uToast.show({ |
| | | title: 'æ£å¨åæ¢æ¨¡å¼...', |
| | | type: 'loading', |
| | | duration: 1000 |
| | | }); |
| | | |
| | | // var param = { |
| | | // MainData: { |
| | | // "auto": e ? 'true' : 'false' // ç´æ¥ä½¿ç¨ä¼ å
¥çeå¼ |
| | | // }, |
| | | // } |
| | | // console.log(param); |
| | | this.$u.post('/api/PDA/AutoStatus?auto='+( e ? 'true' : 'false'), {}).then(result => { |
| | | console.log(result); |
| | | if (result) { |
| | | this.value = e; // åªæå¨è¯·æ±æååææ´æ°å®é
å¼ |
| | | this.switchValue = e; // 忥switchçç¶æ |
| | | this.$refs.uToast.show({ |
| | | title: '模å¼åæ¢æå', |
| | | type: 'success', |
| | | duration: 1000 |
| | | }); |
| | | } else { |
| | | this.switchValue = !e; // 请æ±å¤±è´¥åæ¢å¤switchç¶æ |
| | | this.$refs.uToast.show({ |
| | | title: '模å¼åæ¢å¤±è´¥', |
| | | type: 'error', |
| | | duration: 1000 |
| | | }); |
| | | } |
| | | }).catch(error => { |
| | | this.switchValue = !e; // 请æ±å¤±è´¥åæ¢å¤switchç¶æ |
| | | this.$refs.uToast.show({ |
| | | title: '请æ±åºé', |
| | | type: 'error', |
| | | duration: 1000 |
| | | }); |
| | | }).finally(() => { |
| | | this.isChanging = false; |
| | | }); |
| | | }, |
| | | AndroidCheckUpdate: function() { |
| | | var _this = this; |
| | | uni.request({ |
| | | url: 'http://10.1.211.101:9004/api/PDA/GetPDAVersion?version=' + this.version, |
| | | url: 'http://192.168.30.250:5000/api/PDA/GetPDAVersion?version=' + this.version, |
| | | method: 'GET', |
| | | data: {}, |
| | | success: res => { |
| | |
| | | icon: "none" |
| | | }); |
| | | var dtask = plus.downloader.createDownload( |
| | | "http://10.1.211.101:9004/api/PDA/DownLoadApp", {}, |
| | | "http://192.168.30.250:5000/api/PDA/DownLoadApp", {}, |
| | | function(d, status) { |
| | | // ä¸è½½å®æ |
| | | if (status == 200) { |
| | |
| | | }); |
| | | }, |
| | | getCurrentTree() { |
| | | this.$u.post('/api/Sys_Menu/getTreeMenu', {}).then(result => { |
| | | this.$u.post('/api/Menu/getTreeMenu', {}).then(result => { |
| | | this.tree = result; |
| | | }) |
| | | }, |
| | | GetAutoStatus() { |
| | | this.$u.post('/api/PDA/GetAutoStatus', {}).then(result => { |
| | | if (result == false) { |
| | | this.value = false; |
| | | } else { |
| | | this.value = true; |
| | | } |
| | | }).catch(error => { |
| | | this.value = false; |
| | | }); |
| | | }, |
| | | Socketonline() { |
| | | this.$u.post('/api/PDA/Socketonline', {}).then(result => { |
| | | if (result.data != null && result.data == false) { |
| | | console.log(result); |
| | | this.online = false; |
| | | } else { |
| | | this.online = true; |
| | | } |
| | | // = result; |
| | | }).catch(error => { |
| | | this.online = false; |
| | | }); |
| | | }, |
| | | getTree(id, data, isRootId) { |
| | | this.datas.forEach((x) => { |
| | | if (x.pid == id) { |