|
|
@@ -0,0 +1,185 @@
|
|
|
+<template>
|
|
|
+ <view class="greenhouse-page">
|
|
|
+ <custom-card>
|
|
|
+ <block slot="backText">
|
|
|
+ <view class="greenhouse-top__title">
|
|
|
+ {{ dataSource.devName }}
|
|
|
+ </view> </block
|
|
|
+ ><view slot="right">
|
|
|
+ <view class="ntoNative" @tap="toNavigation">
|
|
|
+ <image :src="location" class="icon"></image>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </custom-card>
|
|
|
+ <view class="greenhouse-top">
|
|
|
+ <device-card :dataSource="dataSource" />
|
|
|
+ </view>
|
|
|
+ <view class="greenhouse-bottom">
|
|
|
+ <!-- <Element /> -->
|
|
|
+ <operation-card
|
|
|
+ @run-status="runStatusHandler"
|
|
|
+ @close-status="closeStatusHandler"
|
|
|
+ v-for="(item, index) in juanmoList"
|
|
|
+ :key="index"
|
|
|
+ :dourceData="item"
|
|
|
+ />
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import location from './assets/location.svg';
|
|
|
+import Element from './components/element.vue';
|
|
|
+import deviceCard from './components/DeviceCard.vue';
|
|
|
+import OperationCard from './components/OperationCard.vue';
|
|
|
+
|
|
|
+export default {
|
|
|
+ components: {
|
|
|
+ Element,
|
|
|
+ deviceCard,
|
|
|
+ OperationCard,
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ location,
|
|
|
+ juanmoList: [],
|
|
|
+ dataSource: {
|
|
|
+ devStatus: '1',
|
|
|
+ devStatusName: '在线',
|
|
|
+ devName: '-',
|
|
|
+ devCode: '-',
|
|
|
+ devUpdateddate: '-',
|
|
|
+ devProvincealign: '-',
|
|
|
+ },
|
|
|
+ };
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ init() {
|
|
|
+ this.getDpdevicedpkzgjuanmoList();
|
|
|
+ this.getDataSource();
|
|
|
+ },
|
|
|
+ async getDataSource() {
|
|
|
+ const res = await this.$myRequest({
|
|
|
+ url: '/api/v2/iot/mobile/device/dpkzg/info/',
|
|
|
+ method: 'post',
|
|
|
+ data: {
|
|
|
+ devBid: this.devBid,
|
|
|
+ },
|
|
|
+ });
|
|
|
+ console.log(res, 'resresress');
|
|
|
+ this.dataSource = res;
|
|
|
+ },
|
|
|
+ runStatusHandler(dourceData) {
|
|
|
+ if (dourceData.down_status === '0' && dourceData.up_status === '1') {
|
|
|
+ this.$set(dourceData, 'up_status', '0');
|
|
|
+ }
|
|
|
+ this.$set(
|
|
|
+ dourceData,
|
|
|
+ 'down_status',
|
|
|
+ dourceData.down_status === '1' ? '0' : '1'
|
|
|
+ );
|
|
|
+ },
|
|
|
+ closeStatusHandler(dourceData) {
|
|
|
+ if (dourceData.up_status === '0' && dourceData.down_status === '1') {
|
|
|
+ this.$set(dourceData, 'down_status', '0');
|
|
|
+ }
|
|
|
+ this.$set(
|
|
|
+ dourceData,
|
|
|
+ 'up_status',
|
|
|
+ dourceData.up_status === '1' ? '0' : '1'
|
|
|
+ );
|
|
|
+ },
|
|
|
+ toNavigation() {
|
|
|
+ const roundedLongitude =
|
|
|
+ this.deviceInfo.devLngalign || this.deviceInfo.devLng;
|
|
|
+ const roundedLatitude =
|
|
|
+ this.deviceInfo.devLatalign || this.deviceInfo.devLat;
|
|
|
+ if (!roundedLongitude) {
|
|
|
+ uni.showToast({
|
|
|
+ title: '当前设备无定位信息',
|
|
|
+ icon: 'none',
|
|
|
+ duration: 3000,
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (
|
|
|
+ plus.runtime.isApplicationExist({
|
|
|
+ pname: 'com.autonavi.minimap',
|
|
|
+ action: 'iosamap://',
|
|
|
+ })
|
|
|
+ ) {
|
|
|
+ let url = `amapuri://route/plan?sourceApplication=yourAppName&dlat=${roundedLatitude}&dlon=${roundedLongitude}&dev=0&t=0&style=0&start=&auto=1&rtdType=1&coordinate=wgs84`;
|
|
|
+ plus.runtime.openURL(url);
|
|
|
+ } else if (
|
|
|
+ plus.runtime.isApplicationExist({
|
|
|
+ pname: 'com.baidu.BaiduMap',
|
|
|
+ action: 'baidumap://',
|
|
|
+ })
|
|
|
+ ) {
|
|
|
+ let url = `baidumap://map/direction?destination=${roundedLongitude},${roundedLatitude}&mode=navigation&output=html&coord_type=wgs84`;
|
|
|
+ plus.runtime.openURL(url);
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ title: '当前未安装 高德地图或百度地图 无法导航',
|
|
|
+ icon: 'none',
|
|
|
+ duration: 3000,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 获取卷膜设备列表
|
|
|
+ async getDpdevicedpkzgjuanmoList(tf) {
|
|
|
+ const res = await this.$myRequest({
|
|
|
+ url: '/api/v2/iot/mobile/device/dpkzg/juanmo/list/',
|
|
|
+ method: 'post',
|
|
|
+ data: {
|
|
|
+ pageSize: this.size,
|
|
|
+ pageNum: this.page,
|
|
|
+ devBid: this.devBid,
|
|
|
+ },
|
|
|
+ });
|
|
|
+ this.juanmoList = res;
|
|
|
+ },
|
|
|
+ },
|
|
|
+ onLoad(query) {
|
|
|
+ this.devBid = query.devBid;
|
|
|
+ this.devBid && this.init();
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+<style scoped lang="scss">
|
|
|
+uni-page-body {
|
|
|
+ position: relative;
|
|
|
+ height: 100%;
|
|
|
+}
|
|
|
+.icon {
|
|
|
+ width: 40rpx;
|
|
|
+ height: 40rpx;
|
|
|
+}
|
|
|
+.greenhouse-page {
|
|
|
+ background: linear-gradient(
|
|
|
+ 180deg,
|
|
|
+ #ffffff00 0%,
|
|
|
+ #eff2fa 23.64%,
|
|
|
+ #eff2fa 100%
|
|
|
+ ),
|
|
|
+ linear-gradient(102deg, #bfeadd 6.77%, #b8f1e7 40.15%, #b9eef5 84.02%);
|
|
|
+ height: 100%;
|
|
|
+ width: 100%;
|
|
|
+ overflow-x: hidden;
|
|
|
+ overflow-y: scroll;
|
|
|
+ .greenhouse-top {
|
|
|
+ text-align: center;
|
|
|
+ margin: 0 auto;
|
|
|
+ margin-top: 18rpx;
|
|
|
+ padding: 0 30rpx;
|
|
|
+ }
|
|
|
+ .greenhouse-bottom {
|
|
|
+ width: calc(100% - 128rpx);
|
|
|
+ padding: 32rpx 32rpx 1rpx 32rpx;
|
|
|
+ background: #ffffff;
|
|
|
+ border-radius: 16rpx;
|
|
|
+ margin: 0 auto;
|
|
|
+ margin-top: 32rpx;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|