Prechádzať zdrojové kódy

Merge branch 'purchaseDev' of http://172.16.100.139/new-business/drp-web into purchaseDev

002390 2 rokov pred
rodič
commit
862d257d4f

+ 16 - 0
src/api/WMS/historical-route.js

@@ -0,0 +1,16 @@
+// 历史轨迹
+import request from "@/utils/request";
+
+// 查询地址
+const queryAddress = (data) => {
+    return request({
+      url: `/geocode/repo`,
+      method: "post",
+      data,
+    });
+  }
+
+  export default {
+    queryAddress,
+    
+  }

+ 1 - 1
src/permission.js

@@ -8,7 +8,7 @@ import { isRelogin } from '@/utils/request'
 
 NProgress.configure({ showSpinner: false })
 
-const whiteList = ['/login', '/register', '/test01', '/canteenAddFood', '/canteenAddMenu', '/menuScreen', '/foodScreen']
+const whiteList = ['/login', '/register', '/test01', '/canteenAddFood', '/canteenAddMenu', '/menuScreen', '/foodScreen','/business/wms/historical-route']
 
 router.beforeEach((to, from, next) => {
   NProgress.start()

+ 6 - 1
src/router/index.js

@@ -156,7 +156,12 @@ export const constantRoutes = [
       }
 
     ]
-  }
+  },
+  {
+    path: '/business/wms/historical-route',
+    component: () => import('@/views/WMS/historical-route'),
+    hidden: false
+  },
 
 ]
 

+ 217 - 0
src/views/WMS/historical-route/index.vue

@@ -0,0 +1,217 @@
+<template>
+    <!-- 页面 -->
+    <div class="block">
+        <br>
+        <el-timeline>
+            <h1>表单</h1>
+            <el-table
+            :data="tableData"
+            height="250"
+            border
+            style="width: 97%">
+            <el-table-column
+            prop="billCode"
+            label="单据号"
+            width="90">
+            </el-table-column>
+            <el-table-column
+            prop="measuringPointName"
+            label="车牌号"
+            width="110">
+            </el-table-column>
+            <el-table-column
+            prop="temperature"
+            label="温度"
+            width="90">
+            </el-table-column>
+            <el-table-column
+            prop="humidity"
+            label="湿度"
+            width="90">
+            </el-table-column>
+            <el-table-column
+            prop="hisDate"
+            label="时间点"
+            width="180">
+            </el-table-column>
+            <el-table-column
+            prop="address"
+            label="地址"
+            >
+             </el-table-column>
+            </el-table>
+        </el-timeline>
+        <!-- <el-timeline>
+            <input type="button" value="查询" @click="handleQuery" />
+        </el-timeline> -->
+
+        <el-timeline>
+            <br><br><br>
+            <h1>温湿度曲线图</h1>
+            <div class="echart" id="mychart" :style="myChartStyle"></div>
+            <br><br><br>
+            <h1>路线</h1>
+        </el-timeline>
+        <iframe :src = url width="100%" height="1000"> </iframe>
+    </div>
+</template>
+
+<script>
+import historyApi from '@/api/WMS/historical-route'
+import * as echarts from "echarts";
+// import {queryAddress,} from '@/api/WMS/historical-route'
+export default {
+    data() {
+        return {
+            myChart: {},
+            xData: [], //横坐标
+            temperatureData: [], //温度数据
+            humidityData: [], //湿度数据
+            myChartStyle: { float: "left", width: "100%", height: "400px" }, //图表样式
+            position: [],
+            url: '',
+            tableData:[],
+            resData:[],
+            resX:[],
+            resYTemperature:[],
+            resYHumidity:[],
+            carMessage:{
+                billCode: "",
+                plateNumber: "",
+                startTime: "",
+                endTime: ""
+            }
+        };
+    },
+    mounted() {
+        //渲染
+        this.initEcharts();
+    },
+    methods: {
+        //渲染图标
+        initEcharts() {
+            const option = {
+                xAxis: {
+                data: this.xData
+                },
+                legend: { // 图例
+                data: ["温度", "湿度/100"],
+                bottom: "0%"
+                },
+                yAxis: {},
+                series: [
+                {
+                    name: "温度",
+                    data: this.temperatureData,
+                    type: "line", // 类型设置为折线图
+                    label: {
+                    show: true,
+                    position: "top",
+                    textStyle: {
+                        fontSize: 16
+                    }
+                    }
+                },
+                {
+                    name: "湿度/100",
+                    data: this.humidityData,
+                    type: "line", // 类型设置为折线图
+                    label: {
+                    show: true,
+                    position: "bottom",
+                    textStyle: {
+                        fontSize: 16
+                    }
+                    }
+                }
+                ]
+            };
+            this.myChart = echarts.init(document.getElementById("mychart"));
+            this.myChart.setOption(option);
+            //随着屏幕大小调节图表
+            window.addEventListener("resize", () => {
+                this.myChart.resize();
+            });
+        },
+        //查询按钮
+        handleQuery() {
+            // window.location.href = ''
+            this.handleGeocodeRepo(this.carMessage);
+           
+        },
+        handleGeocodeRepo(data) {
+
+            // let data = {
+            //     billCode: "CS01",
+            //     plateNumber: "湘A79D2R",
+            //     startTime: "2023-02-01",
+            //     endTime: "2023-02-02"
+            // }
+
+            console.log(data, 'data');
+            historyApi.queryAddress(data).then(res => {
+                console.log(res, 'res-----------------');
+                // //X轴时间数据
+                // this.xData = res.data.map(item => {return item.hisDate});
+                // //温度数据转换
+                // this.temperatureData = res.data.map(item => {return item.temperature});
+                // //湿度数据转换
+                // this.humidityData = res.data.map(item => {return item.humidity});
+                let { code, data } = res;
+                let text;
+                let count = 0;
+                if (code == 200) {
+                    //定义经纬度不为0的数组[i]为起点
+                    for (let i = 0; i < data.length; i++) {
+                        if (data[i].gpsLatitude != 0 && data[i].gpsLongitude != 0) {
+                            //定义经纬度不为0的数组[j]为终点
+                            for	(let j = data.length - 1; j > i; j--) {
+                                if (data[j].gpsLatitude != 0 && data[j].gpsLongitude != 0) {
+                                    for (let z = i; z < j; z = z + Math.trunc((j - i) / 2)) {
+                                        // console.log("i",i)
+                                        text += `&via[${count}][id][${z}]&via[${count}][lnglat]=${data[z].gpsLongitude},${data[z].gpsLatitude}` ;
+                                        this.resData[count] = res.data[z];
+                                        this.resX[count] = res.data[z].hisDate;
+                                        this.resYTemperature[count] = res.data[z].temperature;
+                                        this.resYHumidity[count] = res.data[z].humidity / 100;
+                                        count++;
+                                    }
+                                    // this.position = data;
+                                    // let url = `//uri.amap.com/navigation?from=${data[0].gpsLongitude},${data[0].gpsLatitude},startpoint&to=${data[data.length-1].gpsLongitude},${data[data.length-1].gpsLatitude},endpoint&via=${data[260].gpsLongitude},${data[260].gpsLatitude},midwaypoint&mode=car&policy=0&src=mypage&coordinate=gaode&callnative=0`
+                                    let url = `https://ditu.amap.com/dir?type=car&policy=1&from[lnglat]=${data[i].gpsLongitude},${data[i].gpsLatitude}&from[name]=startpoint&from[id]=${i}-from&to[lnglat]=${data[j].gpsLongitude},${data[j].gpsLatitude}&to[name]=endpoint&to[id]=${i}-to${text}&src=mypage&callnative=0&platform=pc&innersrc=uriapi`
+                                    console.log(url, 'url---------------------');
+                                    this.url = url;
+                                    this.xData = res.data.temperature;
+                                    this.tableData = this.resData;
+                                    // window.location.href = url;
+                                    // window.open(url, "newWindow", "width=1000,height=1000");
+                                    // window.location.reload();
+                                    this.xData = this.resX;
+                                    this.temperatureData = this.resYTemperature;
+                                    this.humidityData = this.resYHumidity;
+                                    // console.log('this.xData',this.xData);
+                                    // console.log('this.temperatureData',this.temperatureData);
+                                    // console.log('this.humidityData',this.humidityData);
+                                    this.initEcharts();
+                                    console.log(text,'text')
+                                    return;
+                                }
+                            }
+                        }
+                    }
+                }
+            })
+            // queryAddress({})
+        }
+    },
+    created() {
+        console.log(this.$route.query,'this.$route')
+        this.carMessage = this.$route.query;
+        this.handleQuery();
+    }
+};
+</script>
+
+<style>
+
+</style>

+ 39 - 1
src/views/purchase/DemandSummary/add.vue

@@ -69,7 +69,13 @@
         <el-table-column show-overflow-tooltip label="业务类型" align="center" prop="billType" width="150"/>
         <el-table-column show-overflow-tooltip label="行状态" align="center" prop="status" width="150"/>
         <el-table-column show-overflow-tooltip label="收货仓库" align="center" prop="deliveryWarehouseName" width="150"/>
-        <el-table-column show-overflow-tooltip label="收货货位" align="center" prop="deliveryAllocationName" width="150"/>
+        <el-table-column show-overflow-tooltip label="收货货位" align="center" prop="deliveryAllocationName" width="200">
+          <template slot-scope="scope">
+            <el-input clearable :disabled="lineDisable" size="small" v-model="scope.row.deliveryAllocationName" @clear="clean(scope.row)" @focus="chooseMxHW(scope.$index, 'ALLOCATION_PARAM', true, '收货货位', scope.row.deliveryWarehouse)">
+              <el-button size="small" :disabled="lineDisable" slot="append" icon="el-icon-more" @click="chooseMxHW(scope.$index, 'ALLOCATION_PARAM', true, '收货货位', scope.row.deliveryWarehouse)"></el-button>
+            </el-input>
+          </template>
+        </el-table-column>
         <el-table-column show-overflow-tooltip label="采购员" align="center" prop="buyerName" width="150"/>
         <el-table-column show-overflow-tooltip label="制单人" align="center" prop="billMaker" width="150"/>
         <el-table-column show-overflow-tooltip label="审核人员" align="center" prop="approver" width="150"/>
@@ -114,13 +120,19 @@
         <el-button size="small" plain @click="back">返回</el-button>
       </el-col>
     </div>
+
+    <Refers ref="refer" @doSubmit="selectionsToInput" :single="true"/>
   </div>
 </template>
 
 <script>
+import Refers from '@/components/Refers/refers.vue'
 import {getSummaryDetail, shutDownSummary, editSummaryMx, reloadBatch } from '@/api/purchase/DemandSummary.js'
 export default {
   name: 'checkDemandSummary',
+  components: {
+    Refers
+  },
   props: ['pageStu','row', 'disable'],
   model: {
     prop: 'isList',
@@ -160,6 +172,12 @@ export default {
       tableList: [],
       ids: [],
       lineDisable: true,
+      tableIndex: '',
+      referCondition: {
+        type: '',
+        isPage: true,
+        title: ''
+      }
     }
   },
   created() {
@@ -233,6 +251,26 @@ export default {
       })
       
     },
+    // 明细行选择货位
+    chooseMxHW(index, type, isPage, title, stordocId) {
+      this.tableIndex = index
+      this.referCondition.type = type
+      this.referCondition.isPage = isPage
+      this.referCondition.title = title
+      this.referCondition.stordocId = stordocId
+      this.$refs.refer.init(this.referCondition)
+    },
+    selectionsToInput(selection) {
+      if (this.referCondition.title == '收货货位') {
+        this.tableList[this.tableIndex].deliveryAllocationName = selection[0].name
+        this.tableList[this.tableIndex].deliveryAllocation = selection[0].id
+      }
+    },
+    // 清空选中的货位
+    clean(row) {
+      row.deliveryAllocation = ''
+      row.deliveryAllocationName = ''
+    }
   }
 }
 </script>