Ver Fonte

产房信息详情 接口完成

linan há 5 anos atrás
pai
commit
1375bb63ed

+ 1 - 1
src/api/deliveryRoomManagement.js

@@ -3,4 +3,4 @@ import { ajaxTest } from "../sdk/ajax";
 let ajax = ajaxTest
 
 /* 个体数据 */
-export const reqDeliveryRoomList = (data) => ajax("get", "/api/statistic", data)
+export const reqDeliveryRoomInfo = (data) => ajax("get", "/api/statistic", data)

+ 3 - 10
src/sdk/ajax.js

@@ -40,23 +40,16 @@ export const ajax = function (type = "post", url, params) {
 
 /* 测试服务的 ajax封装 */
 export const ajaxTest = function (type = "post", url, params) {
-    let token = localStorage.getItem("token")
     return new Promise((resole, reject) => {
         axios({
             method: type,
-            url: "http://192.168.1.116:31288" + url,
+            url: "http://119.3.84.55:31288" + url,
+            // url: url,
             params,
             headers: {
-                'Content-Type': 'application/x-www-form-urlencoded',
-				'x-auth-token': token
+                'Content-Type': 'application/json',
             }
         }).then((res) => {
-            switch(res.data.errCode) {
-                case 'request_not_authorize': // 登录过期
-                    let url = window.location.protocol + "//" + window.location.host + "/#/login"
-                    window.location.replace(url)
-                    break;
-            }
             resole(res.data);
         }).catch((err) => {
             reject(err.data);

+ 2 - 12
src/views/deliveryRoomManagement/DeliveryRoom.vue

@@ -45,7 +45,7 @@ import typeImgUrl_2 from "@/assets/deliveryRoom_2.png";
 import typeImgUrl_3 from "@/assets/deliveryRoom_3.png";
 import typeImgUrl_4 from "@/assets/deliveryRoom_4.png";
 
-import { reqDeliveryRoomList } from "@/api/deliveryRoomManagement.js"
+// import { reqDeliveryRoomList } from "@/api/deliveryRoomManagement.js"
 
 // 每页数据条数
 const pageSize = 10;
@@ -99,19 +99,9 @@ export default {
         };
     },
     created() {
-        this.getDeliveryRoomList()
     },
     methods: {
-        // 请求厂房列表
-        getDeliveryRoomList(data) {
-            reqDeliveryRoomList(data)
-                .then(res => {
-                    console.log(res);
-                })
-                .catch(err => {
-                    console.error( err);
-                });
-        },
+        
         toDetail() {
             this.$router.push({path: "Detail"})
         },

+ 35 - 24
src/views/deliveryRoomManagement/detail/Detail.vue

@@ -53,28 +53,10 @@
             <article class="right">
                 <div class="contianer">
                     <el-carousel height="250px" indicator-position="none">
-                        <el-carousel-item>
+                        <el-carousel-item v-for="item in images" :key="item">
                             <img
                                 @click="toSowDetail"
-                                src="https://ns-strategy.cdn.bcebos.com/ns-strategy/upload/fc_big_pic/part-00044-516.jpg"
-                            />
-                        </el-carousel-item>
-                        <el-carousel-item>
-                            <img
-                                @click="toSowDetail"
-                                src="https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1451307779,3128056523&fm=26&gp=0.jpg"
-                            />
-                        </el-carousel-item>
-                        <el-carousel-item>
-                            <img
-                                @click="toSowDetail"
-                                src="https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=1510260968,1676318121&fm=26&gp=0.jpg"
-                            />
-                        </el-carousel-item>
-                        <el-carousel-item>
-                            <img
-                                @click="toSowDetail"
-                                src="https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=3523098162,3587342676&fm=26&gp=0.jpg"
+                                :src="'http://119.3.84.55:31288/' + item"
                             />
                         </el-carousel-item>
                     </el-carousel>
@@ -84,10 +66,10 @@
 
         <footer class="footer">
             <div class="h">
-                <chart-a></chart-a>
+                <chart-a :dataArr="hoursD" :timeArr="hoursT"></chart-a>
             </div>
             <div class="d">
-                <chart-b></chart-b>
+                <chart-b :dataArr="daysD" :timeArr="daysT"></chart-b>
             </div>
         </footer>
     </div>
@@ -97,6 +79,9 @@
 import chart_a from "./charts/chart_a";
 import chart_b from "./charts/chart_b";
 
+import { reqDeliveryRoomInfo } from "@/api/deliveryRoomManagement.js"
+
+
 // 时间选择器配置
 const pickerOptions = {
     // 禁用时间
@@ -138,11 +123,37 @@ export default {
     data() {
         return {
             date: "",
-            pickerOptions
+            pickerOptions,
+            images: [],
+            hoursD: [],
+            hoursT: [],
+            daysD: [],
+            daysT: [],
         };
     },
-    created() {},
+    created() {
+        this.getDeliveryRoomInfo({bedNo: "10086-1"})
+    },
     methods: {
+        // 请求厂房列表
+        getDeliveryRoomInfo(data) {
+            reqDeliveryRoomInfo(data)
+                .then(res => {
+                    this.images = res.value.images
+                    res.value.thours.forEach(item => {
+                        this.hoursD.push(item.temperature.toFixed(2))
+                        this.hoursT.push(item.timestamp.substr(0,14))
+                    });
+                    res.value.tdays.forEach(item => {
+                        this.daysD.push(item.temperature.toFixed(2))
+                        this.daysT.push(item.timestamp.substr(0,10))
+                    });
+                    
+                })
+                .catch(err => {
+                    console.error( err);
+                });
+        },
         pickerChange(value) {
             console.log(value);
             // this.date = Math.floor(new Date(value[0]).getTime() / 1000)

+ 10 - 33
src/views/deliveryRoomManagement/detail/charts/chart_a.vue

@@ -7,12 +7,15 @@
 <script>
 export default {
     name: "chart_a",
-    props: [
-        'tagId'
-    ],
+    props: {
+        dataArr: { type: Array },
+        timeArr: { type: Array }
+    },
     data() {
-        return {
-        };
+        return {};
+    },
+    dataArr() {
+        this.drawChart();
     },
     mounted() {
         this.drawChart();
@@ -65,33 +68,7 @@ export default {
                 xAxis: {
                     type: "category",
                     boundaryGap: false,
-                    data: [
-                        "七小时前",
-                        "六小时前",
-                        "五小时前",
-                        "四小时前",
-                        "三小时前",
-                        "两小时前",
-                        "七小时前",
-                        "六小时前",
-                        "五小时前",
-                        "四小时前",
-                        "三小时前",
-                        "两小时前",
-                        "七小时前",
-                        "六小时前",
-                        "五小时前",
-                        "四小时前",
-                        "三小时前",
-                        "两小时前",
-                        "七小时前",
-                        "六小时前",
-                        "五小时前",
-                        "四小时前",
-                        "三小时前",
-                        "两小时前",
-                        "当前"
-                    ]
+                    data: this.timeArr
                 },
                 yAxis: {
                     type: "value",
@@ -104,7 +81,7 @@ export default {
                     {
                         name: "时间",
                         type: "line",
-                        data: [32.5,32.66,32.52, 32.6, 32.4, 32.5, 32.4, 32.6, 32.4,32.66,32.52, 32.6, 32.4, 32.5,32.5, 32.4, 32.6, 32.4, 32.4, 32.5, 32.4, 32.6, 32.4,32.66,32.52, 32.6, 32.4],
+                        data: this.dataArr,
                         markPoint: {
                             data: [
                                 { type: "max", name: "最大值" },

+ 8 - 31
src/views/deliveryRoomManagement/detail/charts/chart_b.vue

@@ -8,16 +8,19 @@
 export default {
     name: "chart_b",
     props: {
+        dataArr: { type: Array},
+        timeArr: { type: Array}
     },
     data() {
         return {
         };
     },
-    created() {
-        
+    watch: {
+        dataArr() {
+            this.drawChart();
+        }
     },
     mounted() {
-        
         this.drawChart();
     },
     methods: {
@@ -69,33 +72,7 @@ export default {
                 xAxis: {
                     type: "category",
                     boundaryGap: false,
-                    data: [
-                       "七小时前",
-                        "六小时前",
-                        "五小时前",
-                        "四小时前",
-                        "三小时前",
-                        "两小时前",
-                        "七小时前",
-                        "六小时前",
-                        "五小时前",
-                        "四小时前",
-                        "三小时前",
-                        "两小时前",
-                        "七小时前",
-                        "六小时前",
-                        "五小时前",
-                        "四小时前",
-                        "三小时前",
-                        "两小时前",
-                        "七小时前",
-                        "六小时前",
-                        "五小时前",
-                        "四小时前",
-                        "三小时前",
-                        "两小时前",
-                        "当前"
-                    ]
+                    data: this.timeArr
                 },
                 yAxis: {
                     type: "value",
@@ -108,7 +85,7 @@ export default {
                     {
                         name: "时间",
                         type: "line",
-                        data: [32.6, 32.4, 32.5, 32.4, 32.5,32.66,32.6, 32.4, 32.4, 32.5, 32.4,32.52, 32.6, 32.4,32.69,32.52, 32.6, 32.4, 32.5,32.5, 32.4,  32.6, 32.4,32.6,32.52, 32.6, 32.4],
+                        data: this.dataArr,
                         markPoint: {
                             data: [
                                 { type: "max", name: "最大值" },

+ 9 - 11
vue.config.js

@@ -15,16 +15,14 @@ module.exports = {
   },
   devServer: {
     disableHostCheck: true
-    // proxy: {
-    //   '^/': {                //这里最好有一个 /
-    //     target: 'http://115.238.57.190:8010',         // 服务器端接口地址
-    //     ws: true,            //如果要代理 websockets,配置这个参数
-    //     // 如果是https接口,需要配置这个参数
-    //     changeOrigin: true,  //是否跨域
-    //     pathRewrite: {
-    //       '^/api': ''
-    //     }
-    //   }
-    // }
+  //   proxy: {
+  //     '^/': {                //这里最好有一个 /
+  //       target: 'http://119.3.84.55:31288',         // 服务器端接口地址
+  //       ws: true,            //如果要代理 websockets,配置这个参数
+  //       // 如果是https接口,需要配置这个参数
+  //       changeOrigin: true //是否跨域
+        
+  //     }
+  //   }
   }
 }