Просмотр исходного кода

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

002201 1 год назад
Родитель
Сommit
f6c282905d

+ 259 - 101
src/views/WMS/historical-route/index.vue

@@ -1,69 +1,145 @@
 <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="gpsLongitude"
-      label="经度"
-      width="180">
-      </el-table-column>
-      <el-table-column
-      prop="gpsLatitude"
-      label="纬度"
-      width="180">
-      </el-table-column>
-      <el-table-column
-      prop="address"
-      label="地址">
-        </el-table-column>
-      </el-table>
-    </el-timeline>
+  <el-tabs v-model="activeName" type="border-card" @tab-click="handleClick" stretch="true" >
+
+    <el-tab-pane label="温湿度信息" name="first">
+      <!-- 单据信息 -->
+      <el-timeline>
+        <el-timeline>
+          <el-descriptions>
+            <el-descriptions-item label="订单编号">{{this.basicData.billCode}}</el-descriptions-item>
+            <el-descriptions-item label="车牌号">{{this.basicData.plateNumber}}</el-descriptions-item>
+          </el-descriptions>
+          <el-descriptions>
+            <el-descriptions-item label="开始时间">{{this.basicData.startTime}}</el-descriptions-item>
+            <el-descriptions-item label="结束时间">{{this.basicData.endTime}}</el-descriptions-item>
+          </el-descriptions>
+        </el-timeline>
+      </el-timeline>
+      
+      <el-timeline>
+        <!-- 数据表 -->
+        <h2>订单温湿度列表</h2>
+        <el-table
+          :data="tableData2"
+          stripe
+          height="300"
+          border
+          style="width: 97%">
+          <el-table-column
+          prop="temperature"
+          label="温度"
+          align="center"
+          width="300">
+          </el-table-column>
+          <el-table-column
+          prop="humidity"
+          label="湿度"
+          align="center"
+          width="300">
+          </el-table-column>
+          <el-table-column
+          prop="hisDate"
+          label="时间点"
+          align="center"
+          width="400">
+          </el-table-column>
+          <el-table-column
+          prop="address"
+          label="地址">
+          </el-table-column>
+        </el-table>
+        <br><br><br>
+        <!-- 折线图 -->
+        <h2>订单的温湿度折线图</h2>
+
+      </el-timeline>
 
-    <el-timeline>
-      <br><br><br>
-      <h1>温湿度折线图</h1>
       <div class="echart" id="mychart" :style="myChartStyle"></div>
-      <br><br><br>
-      <h1>历史轨迹</h1>
-    </el-timeline>
-    <!-- <el-timeline>
-      <input type="button" value="查询" @click="aaa" />
-    </el-timeline> -->
-    <div id="container"></div>
-    <!-- <iframe :src = url width="100%" height="1000"> </iframe> -->
-  </div>
+
+    </el-tab-pane>
+
+    <el-tab-pane label="运输信息" name="second">
+
+      <!-- 单据信息 -->
+      <el-timeline>
+        <el-timeline>
+          <el-descriptions>
+            <el-descriptions-item label="订单编号">{{this.basicData.billCode}}</el-descriptions-item>
+            <el-descriptions-item label="车牌号">{{this.basicData.plateNumber}}</el-descriptions-item>
+          </el-descriptions>
+          <el-descriptions>
+            <el-descriptions-item label="开始时间">{{this.basicData.startTime}}</el-descriptions-item>
+            <el-descriptions-item label="结束时间">{{this.basicData.endTime}}</el-descriptions-item>
+          </el-descriptions>
+        </el-timeline>
+      </el-timeline>
+      
+      <!-- 地图 -->
+      <div id="container"></div>
+
+      <!-- 订单温湿度列表 -->
+      <el-timeline>
+        <br>
+        <h2>订单温湿度列表</h2>
+        <el-table
+        :data="tableData1"
+        height="200"
+        style="width: 97%">
+        <el-table-column
+        prop="maxTemperature"
+        label="温度最大值"
+        align="center"
+        width="150">
+        </el-table-column>
+        <el-table-column
+        prop="avgTemperature"
+        label="温度平均值"
+        align="center"
+        width="150">
+        </el-table-column>
+        <el-table-column
+        prop="minTemperature"
+        label="温度最小值"
+        align="center"
+        width="150">
+        </el-table-column>
+        <el-table-column
+        prop="maxHumidity"
+        label="湿度最大值"
+        align="center"
+        width="150">
+        </el-table-column>
+        <el-table-column
+        prop="avgHumidity"
+        label="湿度平均值"
+        align="center"
+        width="150">
+        </el-table-column>
+        <el-table-column
+        prop="minHumidity"
+        label="湿度最小值"
+        align="center"
+        width="150">
+        </el-table-column>
+        <el-table-column
+        prop="startTime"
+        label="开始时间"
+        align="center"
+        min-width="250">
+        </el-table-column>
+        <el-table-column
+        prop="endTime"
+        align="center"
+        label="结束时间"
+        min-width="250">
+        </el-table-column>
+        </el-table>
+      </el-timeline>
+
+    </el-tab-pane>
+
+  </el-tabs>
+
 </template>
 
 <script>
@@ -73,20 +149,41 @@ import AMapLoader from '@amap/amap-jsapi-loader'
   }
 import historyApi from '@/api/WMS/historical-route'
 import * as echarts from "echarts";
-// import {queryAddress,} from '@/api/WMS/historical-route'
+
 export default {
   data() {
     return {
+      basicData:{
+        billCode: "",
+        plateNumber: "",
+        startTime: "",
+        endTime: ""
+      },
+      //标签页
+      activeName: 'first',
       //地图对象
       map: null,
+      //图表
       myChart: {},
       xData: [], //横坐标
       temperatureData: [], //温度数据
       humidityData: [], //湿度数据
       myChartStyle: { float: "left", width: "100%", height: "400px" }, //图表样式
       position: [],
-      // url: '',
-      tableData:[],
+      //运输信息表单数据
+      tableData1:[],
+      //运输信息表单数据准备
+      modelData1:[{
+        maxTemperature:"",
+        avgTemperature:"",
+        minTemperature:"",
+        maxHumidity:"",
+        avgHumidity:"",
+        minHumidity:"",
+        startTime:"",
+        endTime:""
+      }],
+      tableData2:[],
       resData:[],
       resX:[],
       resYTemperature:[],
@@ -96,16 +193,22 @@ export default {
         plateNumber: "",
         startTime: "",
         endTime: ""
-      }
+      },
+      option:{}
     };
   },
   mounted() {
-    //渲染图表
-    this.initEcharts();
     //DOM初始化完成进行地图初始化
-    this.initMap()
+    this.initMap();
+    // this.initEcharts();
   },
   methods: {
+    //切换标签页时执行
+    handleClick(tab, event) {
+      console.log(tab, event);
+      this.handleGeocodeRepo(this.carMessage);
+    },
+    //地图初始化
     initMap() {
       AMapLoader.load({
         key: 'f953210b2d5276ffbf5a2bc01ef80f55', // 申请好的Web端开发者Key,首次调用 load 时必填
@@ -126,13 +229,27 @@ export default {
     },
     //渲染图表
     initEcharts() {
-      const option = {
+      this.option = {
+        tooltip: {
+          trigger: 'axis'
+        },
+        grid: {
+          left: '3%',
+          right: '4%',
+          bottom: '5%',
+          containLabel: true
+        },
+        toolbox: {
+          feature: {
+            saveAsImage: {}
+          }
+        },
         xAxis: {
-        data: this.xData
+          data: this.xData
         },
         legend: { // 图例
-        data: ["温度", "湿度/100"],
-        bottom: "0%"
+          data: ["温度", "湿度/100"],
+          // bottom: "0%"
         },
         yAxis: {},
         series: [
@@ -146,7 +263,7 @@ export default {
             textStyle: {
               fontSize: 16
             }
-          }
+          },
         },
         {
           name: "湿度/100",
@@ -162,20 +279,18 @@ export default {
         }
         ]
       };
+      this.windowSize();
+    },
+     //随着屏幕大小调节图表
+    windowSize() {
       this.myChart = echarts.init(document.getElementById("mychart"));
-      this.myChart.setOption(option);
-      //随着屏幕大小调节图表
+      this.myChart.setOption(this.option);
       window.addEventListener("resize", () => {
         this.myChart.resize();
       });
     },
-    //查询按钮
-    handleQuery() {
-      // window.location.href = ''
-      this.handleGeocodeRepo(this.carMessage);
-    },
-    handleGeocodeRepo(data) {
 
+    handleGeocodeRepo(data) {
       // let data = {
       //     billCode: "CS01",
       //     plateNumber: "湘A79D2R",
@@ -216,11 +331,10 @@ export default {
                   this.resYTemperature[0] = res.data[i].temperature;
                   this.resYHumidity[0] = res.data[i].humidity / 100;
                   //定义递增值
-                  let increment = Math.trunc((j - i) / 15);
+                  let increment = Math.trunc((j - i) / 14);
+                  //途径点数据
                   for (let z = i + increment; z < j; z = z + increment) {
                   // for (let z = i; z < j; z++) {
-                    // console.log("i",i)
-                    // text += `&via[${count}][id][${z}]&via[${count}][lnglat]=${data[z].gpsLongitude},${data[z].gpsLatitude}` ;
                     if(data[z].gpsLongitude != 0 && data[z].gpsLatitude != 0) {
                       path.push([data[z].gpsLongitude, data[z].gpsLatitude]);
                       this.resData[count + 1] = res.data[z];
@@ -240,24 +354,67 @@ export default {
                     route = new AMap.DragRoute(map, path, AMap.DrivingPolicy.LEAST_FEE); //构造拖拽导航类
                     route.search(); //查询导航路径并开启拖拽导航
                   });
-                  // 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.tableData2 = this.resData;
                   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);
+                  //计算订单温湿度列表值
+                  let maxT = data[i].temperature;
+                  let maxH = data[i].humidity;
+                  let minT = data[i].temperature;
+                  let minH = data[i].humidity;
+                  let aggT = 0;
+                  let aggH = 0;
+                  // let test1 = 0;
+                  // let test2 = 0;
+                  for (let x = i; x < j; x++) {
+                    //温度最大值
+                    if (res.data[x].temperature > maxT) {
+                      maxT = res.data[x].temperature;
+                    }
+                    //湿度最大值
+                    if (res.data[x].humidity > maxH) {
+                      maxH = res.data[x].humidity;
+                    }
+                    //温度最小值
+                    if (res.data[x].temperature < minT) {
+                      minT = res.data[x].temperature
+                    }
+                    //湿度最小值
+                    if (res.data[x].humidity < minH) {
+                      minH = res.data[x].humidity
+                    }
+                    // test1 += res.data[x].temperature + ", "
+                    // test2 += res.data[x].humidity + ", "
+                    aggT += parseFloat(res.data[x].temperature);
+                    aggH += parseFloat(res.data[x].humidity);
+                  }
+                  // console.log(aggT, 'aggt');
+                  // console.log(aggH, 'aggh');
+                  // console.log(test1, 'test');
+                  // console.log(test2, 'test2');
+                  // console.log(i, 'i')
+                  // console.log(j, 'j')
+                  let avgT = aggT / (j - i);
+                  let avgH = aggH / (j - i);
+                  //对订单温湿度列表进行赋值
+                  this.modelData1[0].maxTemperature = maxT;
+                  this.modelData1[0].maxHumidity = maxH;
+                  this.modelData1[0].minTemperature = minT;
+                  this.modelData1[0].minHumidity = minH;
+                  this.modelData1[0].avgTemperature = avgT.toFixed(2);
+                  this.modelData1[0].avgHumidity = avgH.toFixed(1);
+                  this.modelData1[0].startTime = res.data[i].hisDate;
+                  this.modelData1[0].endTime = res.data[j].hisDate;
+                  this.tableData1 = this.modelData1;
+                  //对基础数据进行赋值
+                  this.basicData.billCode = this.resData[i].billCode;
+                  this.basicData.plateNumber = this.resData[i].measuringPointName;
+                  this.basicData.startTime = this.modelData1[0].startTime
+                  this.basicData.endTime = this.modelData1[0].endTime
+                  //渲染图表
                   this.initEcharts();
-                  // console.log(text,'text')
                   return;
                 }
               }
@@ -271,7 +428,7 @@ export default {
   created() {
     console.log(this.$route.query,'this.$route')
     this.carMessage = this.$route.query;
-    this.handleQuery();
+    this.handleGeocodeRepo(this.carMessage);
   }
 };
 </script>
@@ -283,4 +440,5 @@ export default {
   width: 1000;
   height: 800px;
 }
-</style>
+</style>
+

+ 22 - 4
src/views/purchase/DemandSummary/add.vue

@@ -63,11 +63,19 @@
               :disabled="scope.row.status !== '1' || lineDisable"
               active-value="Y"
               inactive-value="N"
+              @change="clean(scope.row, '选择补单供应商')"
               active-color="#13ce66"
               inactive-color="#a1a3a9">
             </el-switch>
           </template>
         </el-table-column>
+        <el-table-column show-overflow-tooltip label="补单供应商" align="center"  prop="additionalSupplierName" width="200px">
+          <template slot-scope="scope">
+              <el-input clearable :disabled="scope.row.isReplenishment == 'N' || lineDisable" size="mini" v-model="scope.row.additionalSupplierName" @clear="clean(scope.row, '选择补单供应商')" @focus="chooseMxHW(scope.$index, 'SUPPLIER_PARAM', true, '选择补单供应商')">
+                <el-button size="mini" :disabled="scope.row.isReplenishment == 'N' || lineDisable" slot="append" icon="el-icon-more" @click="chooseMxHW(scope.$index, 'SUPPLIER_PARAM', true, '选择补单供应商')"></el-button>
+              </el-input>
+          </template>
+        </el-table-column>
         <el-table-column show-overflow-tooltip label="需求单单号" align="center" prop="code" width="150"/>
         <el-table-column show-overflow-tooltip label="供应仓库" align="center" prop="lastWarehouseName" width="150"/>
         <el-table-column show-overflow-tooltip label="供应货位" align="center" prop="lastAllocationName" width="150"/>
@@ -75,7 +83,7 @@
         <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="200">
           <template slot-scope="scope">
-            <el-input clearable :disabled="scope.row.status !== '1' || lineDisable" size="mini" v-model="scope.row.deliveryAllocationName" @clear="clean(scope.row)" @focus="chooseMxHW(scope.$index, 'ALLOCATION_PARAM', true, '收货货位', scope.row.deliveryWarehouse)">
+            <el-input clearable :disabled="scope.row.status !== '1' || lineDisable" size="mini" v-model="scope.row.deliveryAllocationName" @clear="clean(scope.row, '收货货位')" @focus="chooseMxHW(scope.$index, 'ALLOCATION_PARAM', true, '收货货位', scope.row.deliveryWarehouse)">
               <el-button size="mini" :disabled="scope.row.status !== '1' || lineDisable" slot="append" icon="el-icon-more" @click="chooseMxHW(scope.$index, 'ALLOCATION_PARAM', true, '收货货位', scope.row.deliveryWarehouse)"></el-button>
             </el-input>
           </template>
@@ -298,11 +306,21 @@ export default {
         this.tableList[this.tableIndex].deliveryAllocationName = selection[0].name
         this.tableList[this.tableIndex].deliveryAllocation = selection[0].id
       }
+      if (this.referCondition.title == '选择补单供应商') {
+        this.tableList[this.tableIndex].additionalSupplierName = selection[0].name
+        this.tableList[this.tableIndex].additionalSupplier = selection[0].id
+      }
     },
     // 清空选中的货位
-    clean(row) {
-      row.deliveryAllocation = ''
-      row.deliveryAllocationName = ''
+    clean(row, title) {
+      if (title == '收货货位') {
+        row.deliveryAllocation = ''
+        row.deliveryAllocationName = ''
+      }
+      if (title == '选择补单供应商') {
+        row.additionalSupplier = ''
+        row.additionalSupplierName = ''
+      }
     }
   }
 }

+ 15 - 8
src/views/purchase/PurchaseDemandList/add.vue

@@ -212,7 +212,7 @@
           <el-table-column show-overflow-tooltip label="物料编码" align="center" prop="materialCode" width="230px">
             <template slot-scope="scope">
               <el-form-item class="hang" :prop="'puDemandItemList.' + scope.$index + '.' + 'materialCode'" :rules="{ required: true, message: '请选择物料编码', trigger: 'blur' }">
-                <el-input clearable :disabled="sonDisable" size="mini" v-model="scope.row.materialCode" @paste.native="pasteMe($event, scope)">
+                <el-input clearable :disabled="sonDisable" size="mini" v-model="scope.row.materialCode" @paste.native="pasteMe($event, scope, scope.$index)">
                   <el-button size="mini" :disabled="sonDisable" slot="append" icon="el-icon-more" @click="chooseMaterial(scope.$index)"></el-button>
                 </el-input>
               </el-form-item>
@@ -256,7 +256,7 @@
             </el-table-column>
             <el-table-column show-overflow-tooltip label="预留周期" align="center" prop="reservedPeriod" width="150px">
               <template slot-scope="scope">
-                <el-form-item class="hang" :prop="'puDemandItemList.' + scope.$index + '.' + 'reservedPeriod'" :rules="{ required: scope.row.reservedProportion !== '', message: '请填写预留周期', trigger: 'blur' }">
+                <el-form-item class="hang" :prop="'puDemandItemList.' + scope.$index + '.' + 'reservedPeriod'" :rules="{ required: scope.row.reservedProportion && scope.row.reservedProportion !== '' , message: '请填写预留周期', trigger: 'blur' }">
                   <el-input type="number" min="0" clearable :readonly="sonDisable" size="mini" v-model="scope.row.reservedPeriod"></el-input>
                 </el-form-item>
               </template>
@@ -738,11 +738,11 @@ export default {
         scope.row.reservedQty = Math.ceil(scope.row.reservedProportion.replace('%', '') / 100 * scope.row.qty)
       }
       // 如果选择预留比例,预留周期必填
-      if(scope.row.reservedQty && scope.row.reservedQty !== 0) {
-        this.isYl = true
-      } else {
-        this.isYl = false
-      }
+      // if(scope.row.reservedQty && scope.row.reservedQty !== 0) {
+      //   this.isYl = true
+      // } else {
+      //   this.isYl = false
+      // }
     },
     copy() {
       this.$modal.msgSuccess("复制成功");
@@ -1184,7 +1184,7 @@ export default {
       }
     },
     // 粘贴来的数据
-    pasteMe(e, scope) {
+    pasteMe(e, scope, index) {
       e.preventDefault() //阻止默认粘贴事件
       let source = e.clipboardData.getData("Text");
       console.log('scope', scope.column.property)
@@ -1196,6 +1196,9 @@ export default {
       console.log('列表的数组',this.basicForm.puDemandItemList)
       rows.forEach(item => {
         console.log('items',item)
+        // getRefer({ type: 'MATERIAL_PARAM', code: item }).then(res => {
+
+        // })
         this.basicForm.puDemandItemList.push(this.basicForm.puDemandItemList[scope.$index])
       })
       console.log('列表', this.basicForm.puDemandItemList)
@@ -1471,6 +1474,10 @@ export default {
 .hang ::v-deep .el-form-item__content{
   margin-left: 0px !important;
 }
+.el-table ::v-deep .el-form-item__error{
+  padding-top: 0;
+  top: 70%
+}
 .el-table ::v-deep .success-row {
   background: #f11616;
 }