wech 2 年之前
父節點
當前提交
fa0b60ebf7

+ 1 - 1
config/index.js

@@ -21,7 +21,7 @@ module.exports = {
     },
 
     // Various Dev Server settings
-    host: '192.168.1.77', // can be overwritten by process.env.HOST
+    host: '192.168.1.201', // can be overwritten by process.env.HOST
     port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
     autoOpenBrowser: false,
     https:false,

文件差異過大導致無法顯示
+ 35811 - 0
package-lock.json


+ 1 - 1
src/global.js

@@ -1,6 +1,6 @@
 // const BASE_URL = 'https://wxt.rltest.cn/?s=smart_wx_api';
 // const BASE_URL = '//api.card.jskedejiaoyu.com/?s=smart_wx_api';
-const BASE_URL = 'https://api.wxt.renlianiot.com/?s=smart_wx_api';
+const BASE_URL = 'http://127.0.0.1:8000/WxApi';
 
  export default{
     BASE_URL

+ 1 - 1
src/pages/kede/common/layout_yys.vue

@@ -5,7 +5,7 @@
         <router-view></router-view>
     </div>
     <van-tabbar route>
-        <van-tabbar-item replace to="/yys_devices" icon="card">设备</van-tabbar-item>
+        <van-tabbar-item replace to="/yys_dev_level1" icon="card">设备</van-tabbar-item>
         <van-tabbar-item replace to="/yys_alarms" icon="bell">计划</van-tabbar-item>
         <van-tabbar-item replace to="/yys_location" icon="map-marked">位置</van-tabbar-item>
         <!-- <van-tabbar-item replace to="/yys_fences" icon="aim">围栏</van-tabbar-item> -->

+ 7 - 0
src/pages/kede/yys/alarms/add.vue

@@ -19,6 +19,7 @@
                 label="计划名称"
                 placeholder="请输入计划名称"
                 clearable
+                required
             />
             <van-field
                 v-model="formData.device_name"
@@ -26,6 +27,7 @@
                 label="风场名称"
                 placeholder="请输入风场名称"
                 clearable
+                required
             />
             <van-field
                 v-model="formData.device_name"
@@ -33,6 +35,7 @@
                 label="风场编号"
                 placeholder="请输入风场编号"
                 clearable
+                required
             />
             <van-field
                 v-model="formData.device_name"
@@ -40,6 +43,7 @@
                 label="部件类型"
                 placeholder="请输入部件类型"
                 clearable
+                required
             />
              <van-field
                 v-model="formData.device_name"
@@ -47,6 +51,7 @@
                 label="工作位置"
                 placeholder="请输入工作位置"
                 clearable
+                required
             />
             <van-field
                 v-model="formData.device_name"
@@ -68,6 +73,7 @@
                 label="紧固模式"
                 placeholder="请输入紧固模式"
                 clearable
+                required
             />
             <van-field
                 v-model="formData.device_name"
@@ -82,6 +88,7 @@
                 label="扭矩"
                 placeholder="请输入扭矩"
                 clearable
+                required
             />
             <van-field
                 v-model="formData.device_name"

+ 211 - 0
src/pages/kede/yys/devices/level1.vue

@@ -0,0 +1,211 @@
+<template>
+  <div>
+    <!-- <van-nav-bar title="我的设备" left-text="返回" left-arrow @click-left="$router.replace('yys_more')" /> -->
+    <van-sticky>
+      <van-search v-model="keywords" show-action placeholder="请输入设备编号关键词搜索" @search="onSearch">
+        <template #action>
+          <div @click="onSearch">搜索</div>
+        </template>
+      </van-search>
+    </van-sticky>
+
+    <van-pull-refresh v-model="refreshing" @refresh="onRefresh" style="padding-bottom: 1rem;">
+      <template v-if="list.length">
+        <van-list ref="deviceList" v-model="loading" :finished="finished" :error.sync="error" finished-text="没有更多了"
+          error-text="请求失败,点击重新加载" @load="onLoad">
+          <van-cell v-for="item in list" :key="item.id" :title="item.imei" :value="'更多'"
+            @click="showDetail(item.id)" size="large" is-link>
+            <template #title>
+              <span class="custom-title">{{item.depart_name}}</span>
+              <!-- <van-tag type="danger" v-if="item.alarm_state > 0">告警</van-tag> -->
+            </template>
+          </van-cell>
+        </van-list>
+      </template>
+      <van-empty v-else description="暂无数据" />
+    </van-pull-refresh>
+
+    <van-action-sheet v-model="showActions" :actions="actions" @select="onSelect" close-on-click-action />
+  </div>
+</template>
+
+<script type="text/babel">
+import Vue from 'vue';
+import { ActionSheet, Notify, NavBar, PullRefresh, Tag, Icon, Dialog, Empty, List, CellGroup, Cell, Search, Sticky } from 'vant';
+
+Vue.use(ActionSheet);
+Vue.use(NavBar);
+Vue.use(Tag);
+Vue.use(Icon);
+Vue.use(Dialog);
+Vue.use(Notify);
+Vue.use(Empty);
+Vue.use(List);
+Vue.use(CellGroup);
+Vue.use(Cell);
+Vue.use(Search);
+Vue.use(PullRefresh);
+Vue.use(Sticky);
+
+export default {
+  data() {
+    return {
+      error: false,
+      loading: false,
+      finished: false,
+      refreshing: false,
+      keywords: '', // 搜索关键字
+      showBindBtn: true,
+      list: [],
+      limit: 10,
+      page: 1,
+      showActions: false,
+      showDialog: false, // 显示修改设备名称dialog
+      currentDeviceInfo: {}, // 当前设备信息
+      device_name: '', // 设备名称
+      userid: null,
+      openid: null,
+      actions: [{
+        name: '解除绑定',
+        action: 'unbind',
+      },
+        /* { 
+          name: '补卡',
+          action: 'makeupCard',
+        } */
+      ],
+    };
+  },
+  created() {
+    this.userid = localStorage.getItem("yysUserid");
+    this.openid = localStorage.getItem("openid");
+
+    this.onRefresh();
+  },
+  methods: {
+    /**
+     * 获取设备列表
+     */
+    onLoad() {
+
+      let params = {
+        page: this.page,
+        limit: this.limit,
+        imei: this.keywords
+      }
+      // this.$http.post('login&openid=' + openid, JSON.stringify(postData))
+      //   .then(resp => {
+
+      //   })
+      let resp = {
+        status: 200,
+        data: {
+          success: true, message: "获取成功", data: {
+            total: "311",
+            limit: 10,
+            page: 3,
+            list: [
+              { id: "371", "depart_name": "智能仓储" },
+              { id: "372", "depart_name": "液压工具" },
+              { id: "373", "depart_name": "特种吊具" },
+              { id: "374", "depart_name": "其他工具" },
+            ]
+          }
+        }
+      }
+
+
+      // this.$http.post("/getDevices&userid=" + this.userid + '&openid=' + this.openid, JSON.stringify(params)).then(resp => {
+      this.loading = false;
+      this.refreshing = false;
+
+      if (resp.status !== 200 || !resp.data || !resp.data.success) {
+        this.$notify(resp.data.message)
+        return;
+      }
+
+      this.list = resp.data.data.list;
+      if (this.list.length >= resp.data.data.total) {
+        this.finished = true;
+      }
+      this.page += 1;
+
+      // })
+      // .catch(resp => {
+      //   this.loading = false;
+      //   this.refreshing = false;
+      //   this.error = true;
+      // });
+
+    },
+    /**
+     * 显示详情
+     */
+    showDetail(id) {
+      let query = {
+        id: id
+      }
+      this.$router.push({ path: "/yys_dev_level2", query: query });
+    },
+    /**
+     * 跳转绑定设备页面
+     */
+    goPage(name, query = {}) {
+      this.$router.push({ name: name, query: query });
+    },
+    /**
+     * 显示选项
+     */
+    showActionSheet(info) {
+      this.showActions = true;
+      this.currentDeviceInfo = info;
+    },
+    // 选中action
+    onSelect(item) {
+      let action = item.action
+
+      if (action == 'unbind') { // 解绑
+        this.beforeUnbindDevice(this.currentDeviceInfo);
+      }
+
+    },
+    // 搜索
+    onSearch() {
+      this.onRefresh();
+    },
+    // 下拉刷新
+    onRefresh() {
+      this.list = [];
+      this.limit = 10;
+      this.page = 1;
+
+      this.finished = false;
+      this.loading = true;
+      this.onLoad();
+    },
+  }
+};
+</script>
+<style scoped="less">
+.custom-title {
+  font-size: 0.8em;
+}
+
+.fl-buttomright-button {
+  position: fixed;
+  bottom: 24px;
+  right: 16px;
+  display: flex;
+  flex-direction: column;
+  border-radius: 50%;
+  height: 54px;
+  width: 54px;
+  background-color: #2196f3;
+  box-shadow: 0 0 6px gray;
+  font-size: 14px;
+  justify-content: center;
+  align-items: center;
+  color: white;
+  padding: 12px;
+}
+</style>

+ 211 - 0
src/pages/kede/yys/devices/level2.vue

@@ -0,0 +1,211 @@
+<template>
+  <div>
+    <!-- <van-nav-bar title="我的设备" left-text="返回" left-arrow @click-left="$router.replace('yys_more')" /> -->
+    <van-sticky>
+      <van-search v-model="keywords" show-action placeholder="请输入设备编号关键词搜索" @search="onSearch">
+        <template #action>
+          <div @click="onSearch">搜索</div>
+        </template>
+      </van-search>
+    </van-sticky>
+
+    <van-pull-refresh v-model="refreshing" @refresh="onRefresh" style="padding-bottom: 1rem;">
+      <template v-if="list.length">
+        <van-list ref="deviceList" v-model="loading" :finished="finished" :error.sync="error" finished-text="没有更多了"
+          error-text="请求失败,点击重新加载" @load="onLoad">
+          <van-cell v-for="item in list" :key="item.id" :title="item.imei" :value="'更多'"
+            @click="showDetail(item.id)" size="large" is-link>
+            <template #title>
+              <span class="custom-title">{{item.depart_name}}</span>
+              <!-- <van-tag type="danger" v-if="item.alarm_state > 0">告警</van-tag> -->
+            </template>
+          </van-cell>
+        </van-list>
+      </template>
+      <van-empty v-else description="暂无数据" />
+    </van-pull-refresh>
+
+    <van-action-sheet v-model="showActions" :actions="actions" @select="onSelect" close-on-click-action />
+  </div>
+</template>
+
+<script type="text/babel">
+import Vue from 'vue';
+import { ActionSheet, Notify, NavBar, PullRefresh, Tag, Icon, Dialog, Empty, List, CellGroup, Cell, Search, Sticky } from 'vant';
+
+Vue.use(ActionSheet);
+Vue.use(NavBar);
+Vue.use(Tag);
+Vue.use(Icon);
+Vue.use(Dialog);
+Vue.use(Notify);
+Vue.use(Empty);
+Vue.use(List);
+Vue.use(CellGroup);
+Vue.use(Cell);
+Vue.use(Search);
+Vue.use(PullRefresh);
+Vue.use(Sticky);
+
+export default {
+  data() {
+    return {
+      error: false,
+      loading: false,
+      finished: false,
+      refreshing: false,
+      keywords: '', // 搜索关键字
+      showBindBtn: true,
+      list: [],
+      limit: 10,
+      page: 1,
+      showActions: false,
+      showDialog: false, // 显示修改设备名称dialog
+      currentDeviceInfo: {}, // 当前设备信息
+      device_name: '', // 设备名称
+      userid: null,
+      openid: null,
+      actions: [{
+        name: '解除绑定',
+        action: 'unbind',
+      },
+        /* { 
+          name: '补卡',
+          action: 'makeupCard',
+        } */
+      ],
+    };
+  },
+  created() {
+    this.userid = localStorage.getItem("yysUserid");
+    this.openid = localStorage.getItem("openid");
+
+    this.onRefresh();
+  },
+  methods: {
+    /**
+     * 获取设备列表
+     */
+    onLoad() {
+
+      let params = {
+        page: this.page,
+        limit: this.limit,
+        imei: this.keywords
+      }
+      // this.$http.post('login&openid=' + openid, JSON.stringify(postData))
+      //   .then(resp => {
+
+      //   })
+      let resp = {
+        status: 200,
+        data: {
+          success: true, message: "获取成功", data: {
+            total: "311",
+            limit: 10,
+            page: 3,
+            list: [
+              { id: "1", "depart_name": "液压泵" },
+              { id: "2", "depart_name": "中控液压扳手" },
+              { id: "3", "depart_name": "液压扳手" },
+              { id: "4", "depart_name": "机舱吊具" },
+            ]
+          }
+        }
+      }
+
+
+      // this.$http.post("/getDevices&userid=" + this.userid + '&openid=' + this.openid, JSON.stringify(params)).then(resp => {
+      this.loading = false;
+      this.refreshing = false;
+
+      if (resp.status !== 200 || !resp.data || !resp.data.success) {
+        this.$notify(resp.data.message)
+        return;
+      }
+
+      this.list = resp.data.data.list;
+      if (this.list.length >= resp.data.data.total) {
+        this.finished = true;
+      }
+      this.page += 1;
+
+      // })
+      // .catch(resp => {
+      //   this.loading = false;
+      //   this.refreshing = false;
+      //   this.error = true;
+      // });
+
+    },
+    /**
+     * 显示详情
+     */
+    showDetail(id) {
+      let query = {
+        id: id
+      }
+      this.$router.push({ path: "/yys_devices", query: query });
+    },
+    /**
+     * 跳转绑定设备页面
+     */
+    goPage(name, query = {}) {
+      this.$router.push({ name: name, query: query });
+    },
+    /**
+     * 显示选项
+     */
+    showActionSheet(info) {
+      this.showActions = true;
+      this.currentDeviceInfo = info;
+    },
+    // 选中action
+    onSelect(item) {
+      let action = item.action
+
+      if (action == 'unbind') { // 解绑
+        this.beforeUnbindDevice(this.currentDeviceInfo);
+      }
+
+    },
+    // 搜索
+    onSearch() {
+      this.onRefresh();
+    },
+    // 下拉刷新
+    onRefresh() {
+      this.list = [];
+      this.limit = 10;
+      this.page = 1;
+
+      this.finished = false;
+      this.loading = true;
+      this.onLoad();
+    },
+  }
+};
+</script>
+<style scoped="less">
+.custom-title {
+  font-size: 0.8em;
+}
+
+.fl-buttomright-button {
+  position: fixed;
+  bottom: 24px;
+  right: 16px;
+  display: flex;
+  flex-direction: column;
+  border-radius: 50%;
+  height: 54px;
+  width: 54px;
+  background-color: #2196f3;
+  box-shadow: 0 0 6px gray;
+  font-size: 14px;
+  justify-content: center;
+  align-items: center;
+  color: white;
+  padding: 12px;
+}
+</style>

+ 1 - 1
src/pages/kede/yys/location.vue

@@ -471,7 +471,7 @@ export default {
                     message:"获取成功",
                     data:[
                         {"imei":"869678041008494","device_name":"测试液压泵1","device_type":"0","state":"使用中","loc_mode":"M1","loc_ploy":"1","online_time":"1655943942","longitude":"119.201478","latitude":"30.191538","wifi_online_time":"1662004623","wifi_longitude":"119.200662","wifi_latitude":"30.191734","alarm_state":"1","isAlarm":"1","time":"1662004623","lat":30.186001,"lng":120.194101,"awayTime":"4小时","date_time":"2022-09-01 11:57:03"},
-                        {"imei":"869678041006811","device_name":"测试液压泵3","device_type":"0","state":"待检","loc_mode":"M1","loc_ploy":"1","online_time":"1655943941","longitude":"120.201400","latitude":"30.192840","wifi_online_time":"1655950726","wifi_longitude":"120.200644","wifi_latitude":"30.191814","alarm_state":"0","isAlarm":"0","time":"1655950726","lat":30.185682,"lng":120.194083,"awayTime":"2月","date_time":"2022-06-23 10:18:46"}
+                        {"imei":"869678041006811","device_name":"测试液压泵3","device_type":"0","state":"待检","loc_mode":"M1","loc_ploy":"1","online_time":"1655943941","longitude":"120.21201","latitude":"30.2084","wifi_online_time":"1655950726","wifi_longitude":"120.200644","wifi_latitude":"30.191814","alarm_state":"0","isAlarm":"0","time":"1655950726","lat":30.185682,"lng":120.194083,"awayTime":"2月","date_time":"2022-06-23 10:18:46"}
                     ]
                 }
             }

+ 1 - 1
src/pages/kede/yys/more.vue

@@ -31,7 +31,7 @@
                 <div class="padding-top-20"></div>
 
                 <van-cell-group >
-                    <van-cell is-link icon="bell" to="yys_devices">
+                    <van-cell is-link icon="bell" to="yys_dev_level1">
                         <template #title>
                             <span class="custom-title">设备管理</span>
                         </template>

+ 18 - 0
src/router/index.js

@@ -235,6 +235,24 @@ export default new Router({
           },
         },
         {
+          path: "/yys_dev_level1",
+          name:"yys_dev_level1",
+          component: () => import("@/pages/kede/yys/devices/level1"),   
+          meta: {
+            role: 'yys',
+            keepAlive: true,
+          },
+        },
+        {
+          path: "/yys_dev_level2",
+          name:"yys_dev_level2",
+          component: () => import("@/pages/kede/yys/devices/level2"),
+          meta: {
+            role: 'yys',
+            keepAlive: true,
+          },
+        },
+        {
           path: "/yys_alarms",
           name:"yys_alarms",
           component: () => import("@/pages/kede/yys/alarms"),