liyg 3 роки тому
батько
коміт
7874b2d96d

+ 2 - 2
config/index.js

@@ -65,14 +65,14 @@ let proxyTable = {
   },
   // 所有数据的请求域名地址
   "/api/v1": {
-    target: "http://172.16.33.166:80",
+    target: "http://172.16.33.162:80",
     ws: true,
     pathRewrite: {
       "^/api/v1": "/api/v1"
     }
   },
   "/views/api/v1": {
-    target: "http://172.16.33.166:80",
+    target: "http://172.16.33.162:80",
     // target: "http://192.168.1.109:8080",
     ws: true,
     pathRewrite: {

+ 7 - 4
src/components/Page/Title/index.vue

@@ -2,11 +2,14 @@
   <div
     class="page-title"
     :class="{ 'show-border-buttom': showBorderBottom }"
-    @click="onClickBack"
   >
-    <i class="el-icon-back" v-if="showIcon"></i>
-    <span>{{ title }}</span>
-    <slot></slot>
+    <div  
+    style="width:10%"
+    @click="onClickBack">
+         <i class="el-icon-back" v-if="showIcon"></i>
+        <span>{{ title }}</span>
+        <slot></slot>
+    </div>
   </div>
 </template>
 

+ 197 - 124
src/views/TMS/components/domesticMine/wagonLoadAdd.vue

@@ -1,19 +1,19 @@
 <template>
   <!-- 添加车皮装车实绩 -->
   <div class="addWagonLoad">
-    <page-title>新增</page-title>
+    <page-title>返回</page-title>
     <div class="cp">
       <span >车皮号:</span>
       <el-upload style="margin: 8px;"
           class="upload-excel"
           action=""
-          :on-change="importfile"
+          :on-change="importExcel"
           :show-file-list="false"
           accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"
           :auto-upload="false">
           <el-button  type="primary">导入</el-button>
       </el-upload>
-      <span >当前车皮号数量:{{list.length}}</span>
+      <span >当前导入数量:{{tableData.length}}</span>
       <!-- <el-input
         placeholder="请输入内容"
         v-model="input"
@@ -22,15 +22,83 @@
       >
       </el-input> -->
     </div>
-    <div class="cpList">
+    <!-- <div class="cpList">
       <div class="list">
         <div class="cpList1" v-for="(item, i) in list" :key="i">
           {{ item }}
           <i class="el-icon-close itu" @click="onclick(i)"></i>
         </div>
       </div>
+    </div> -->
+    <div class="table item">
+      <el-table
+        stripe
+        :data="tableData"
+        style="width: 100%">
+        <el-table-column
+        type="index"
+        width="50"
+        prop="number"
+        label="序号"
+        align="center"
+        fixed="left"
+        :resizable="false">
+        </el-table-column>
+        <el-table-column
+        align="center"
+          prop="materialName"
+          label="物资"
+          width="180px">
+        </el-table-column>
+        <el-table-column
+        align="center"
+          prop="supplierName"
+          label="发货单位"
+          width="180px">
+        </el-table-column>
+        <el-table-column
+        align="center"
+          prop="wagonNo"
+          label="车号"
+          width="180px">
+        </el-table-column>
+        <el-table-column
+        align="center"
+          prop="sendDate"
+          label="发货日期"
+          width="180px">
+        </el-table-column>
+        <el-table-column
+        align="center"
+          prop="sendStation"
+          label="火车发站"
+          width="180px">
+        </el-table-column>
+        <el-table-column
+        align="center"
+        width="180px"
+          prop="arrivalStation"
+          label="火车到站">
+        </el-table-column>
+         <el-table-column
+         align="center"
+        width="180px"
+          prop="weight"
+          label="标重">
+        </el-table-column>
+        <!-- <el-table-column
+        align="center"
+        width="100px"
+          fixed="right"
+          label="操作">
+          <template slot-scope="scope">
+            <el-button @click="handleClick(scope.row)" type="text" size="small">查看</el-button>
+            <el-button type="text" size="small">编辑</el-button>
+          </template>
+        </el-table-column> -->
+      </el-table>
     </div>
-    <div class="matching item">
+    <!-- <div class="matching item">
           <span class="text">是否知道采购订单号:</span>
           <el-switch
             v-model="matching"
@@ -54,9 +122,9 @@
       <span class="text">卸货点:</span>
       <el-input v-model="unloadPointName" disabled> </el-input>
       <el-button type="primary" @click="ondrawer(3)">浏览</el-button>
-    </div>
+    </div> -->
     <div class="fromOther">
-      <el-form :inline="true" class="demo-form-inline" label-width="80px" style="margin-left:500px;">
+      <!-- <el-form :inline="true" class="demo-form-inline" label-width="80px" style="margin-left:500px;">
         <el-form-item label="发站:">
           <el-autocomplete
             class="inline-input"
@@ -71,8 +139,8 @@
             </template>
           </el-autocomplete>
         </el-form-item>
-      </el-form>
-      <el-form :inline="true" class="demo-form-inline" label-width="80px" style="margin-left:500px;">
+      </el-form> -->
+      <el-form :inline="true" class="demo-form-inline" label-width="80px" style="margin-left:500px;margin-top:30px">
         <el-form-item label="到站:">
           <el-autocomplete
             class="inline-input"
@@ -185,7 +253,14 @@ export default {
       supplierId: null,
       //物资id
       materialId: null,
+      //表格数据
+      tableData:[],
       unloadPointName:null,
+      //物资集合和供应商映射,相当于本地缓存,减少请求次数
+      materialMap:new Map(),
+      supplierMap:new Map(),
+      materials:[],
+      suppliers:[],
       unloadPointId:null,
       //是否需要打开模态窗口
       drawer: false,
@@ -225,6 +300,9 @@ export default {
       arrivalStationId: 1,
     };
   },
+  mounted(){
+    this.form1.resultLoadingDate=new Date();
+  },
   methods: {
     currentRadioChange1(selection) {
       this.input = null;
@@ -423,38 +501,16 @@ export default {
     },
     // 确定
     makeSure() {
-      let state = 0;
-      if (
-        this.list.length > 0 &&
-        this.sendStationId &&
-        this.toTheStationId &&
-        this.form1.resultLoadingDate
-      ) {
-        state = 1;
-      } else {
-        if (this.list.length == 0) {
+      let that=this;
+      if (this.tableData.length <= 0  || !this.toTheStationId || this.form1.resultLoadingDate){
+        if (this.tableData.length <= 0) {
           this.$message({
             type: "warning",
-            message: "请输入车皮号!",
+            message: "请导入数据!",
           });
         } else {
-          if (this.sendStationId) {
             if (this.toTheStationId) {
               if (this.form1.resultLoadingDate) {
-                if (this.supplierId) {
-                  if (this.materialId) {
-                  } else {
-                    this.$message({
-                      type: "warning",
-                      message: "请选择物资",
-                    });
-                  }
-                } else {
-                  this.$message({
-                    type: "warning",
-                    message: "请选择发货单位",
-                  });
-                }
               } else {
                 this.$message({
                   type: "warning",
@@ -467,57 +523,36 @@ export default {
                 message: "请选择到站!",
               });
             }
-          } else {
+        }
+      }
+      //绑定通用字段
+      this.tableData.forEach((row)=>{
+        row.resultType=3;
+        row.resultLoadingDate=sjTime(that.form1.resultLoadingDate);
+        row.arrivalStationId=that.form1.arrivalStationId;
+        row.resultRemarks=that.form1.resultRemarks;
+      })
+      console.log(that.tableData);
+      //请求添加
+      this.axios
+        .post("/api/v1/tms/addDomesticLoadResult", that.tableData)
+        .then((res) => {
+          console.log(res);
+          if (res.data.code == "200") {
             this.$message({
-              type: "warning",
-              message: "请选择发站!",
+              type: "success",
+              message: "新增成功",
             });
+            this.$router.push("/wagonLoadMine");
           }
-        }
-      }
-      if (state == 1) {
-        let map = {
-          wagonNoList: this.list,
-          sendStationId: this.sendStationId,
-          arrivalStationId: this.toTheStationId,
-          resultLoadingDate: sjTime(this.form1.resultLoadingDate),
-          resultRemarks: this.form1.resultRemarks,
-          resultType: 3,
-          sendUnitId: this.supplierId,
-          materialId: this.materialId,
-        };
-        if (this.matching) {
-          map = {
-            wagonNoList: this.list,
-            sendStationId: this.sendStationId,
-            arrivalStationId: this.toTheStationId,
-            resultLoadingDate: sjTime(this.form1.resultLoadingDate),
-            resultRemarks: this.form1.resultRemarks,
-            resultType: 3,
-            sendUnitId: this.supplierId,
-            materialId: this.materialId,
-            purchaseOrderRailPlanId: this.purchaseOrderId,
-          };
-        }
-        this.axios
-          .post("/api/v1/tms/addDomesticLoadResult", map)
-          .then((res) => {
-            console.log(res);
-            if (res.data.code == "200") {
-              this.$message({
-                type: "success",
-                message: "新增成功",
-              });
-              this.$router.push("/wagonLoadMine");
-            }
-          });
-      }
+        });
+      
     },
     cancel() {
       this.$router.push("/wagonLoadMine");
     },
-    // excel表上传
-    importfile(file) {//导入文件
+    // 导入excel
+    async importExcel(file) {
       let that=this;
       if (!file) {
         alert('文件错误,请重新选择');
@@ -527,66 +562,102 @@ export default {
         var data=null;
         var workbook=null;
         //设置读取操作
-        reader.onload = function (e) {
+        reader.onload =async function (e) {
           console.log(e);
           data = e.target.result;
           workbook= XLSX.read(data, {
               type: 'binary'
           });
-          console.log(workbook.SheetNames.length);
           //读取表格
           let rows= XLSX.utils.sheet_to_json(workbook.Sheets[workbook.SheetNames[0]]);//只取第一页
           console.log(rows);
-          //绑定品名和发货单位
+          //清空
           if(rows.length>0){
-            that.list=[];
-            that.materialName=rows[0]['品  名'];
-            that.supplierName=rows[0]['发货单位'];
-            that.setIdForName();
+            that.tableData=[];
+            if((typeof rows[0]['车号'])=='undefined'){
+              that.$message({
+                message: "导入Excel格式错误!",
+                type: "warning",
+              });
+              return;
+            }
           }
-          //绑定车号
-          rows.forEach((row,index) => {
+          //绑定数据
+          rows.forEach(async (row,index) => {
             let carNumber=row['车号'];
-            if((typeof carNumber)!="undefined" && carNumber.length > 6)
-              that.list.push(carNumber);
-            else
-              console.log(carNumber+"不符合格式");
-          });
+            if((typeof carNumber)!="undefined" && carNumber.length > 6){
+            //查询数据库中的对于物资和发货单位
+            let materialName=row['品  名'];
+            let supplierName=row['发货单位'];
+            let material;
+            let supplier;
+            if((typeof material)=="undefined" || material==null){
+                await that.axios.post("/api/v1/uc/queryAPOMaterialByLike?apiId=244&startNum=050&index=" +
+                    materialName).then((res)=>{
+                      if(res.data.code == "200" && res.data.data &&res.data.data.list.length > 0 ) {
+                        //赋值
+                        material={
+                            materialId:res.data.data.list[0].materialId,
+                            materialName:res.data.data.list[0].materialName
+                        };
+                      }else{
+                        this.$message.error("绑定品名失败,请检查数据!");
+                        material=null;
+                      }
+                });
+            }
+            if((typeof supplier)=="undefined" || supplier==null){
+                //绑定发货单位id
+                await that.axios.post("/api/v1/uc/getSupplierMesByMaterialId?apiId=247&index=" +
+                    supplierName).then((res)=>{
+                      if(res.data.code == "200" && res.data.data &&res.data.data.list.length > 0 ) {
+                        //赋值
+                        supplier={
+                          supplierId:res.data.data.list[0].supplierId,
+                          supplierName:res.data.data.list[0].supplierName
+                        }
+                      }else{
+                        supplier=null;
+                        this.$message.error("绑定发货单位失败,请检查数据!");
+                      }
+                });
+            }
+            //表格数据
+            let temp={
+              number:row['序号'],
+              materialId:material.materialId,
+              materialName:material.materialName,
+              sendUnitId:supplier.supplierId,
+              supplierName:supplier.supplierName,
+              sendDate:row['发货日期'],
+              sendStation:row['发站'],
+              arrivalStation:row['到站'],
+              wagonNo:row['车号'],
+              weight:row['标重']
+            }
+            that.tableData.push(temp);
+          }
+          else
+            console.log("车号"+carNumber+"不符合格式");
+        });
         };
         reader.readAsBinaryString(file.raw); //以二进制方式读取
     },
-    //导入的时候为品名和发货单位绑定id
-    setIdForName(){
-      let that=this;
-      //绑定品名id
-      that.axios.post("/api/v1/uc/queryAPOMaterialByLike?apiId=244&startNum=050&index=" +
-          that.materialName).then((res)=>{
-            console.log(res.data.data);
-            if(res.data.code == "200" && res.data.data &&res.data.data.list.length > 0 ) {
-              that.materialId=res.data.data.list[0].materialId;
-              that.materialName=res.data.data.list[0].materialName;
-            }else{
-              that.materialId=null;
-              that.materialName=null;
-              this.$message.error("绑定品名失败,请手动选择!");
-            }
-            
+    indexOfMaterial(materialName,materials){
+      materials.forEach((item,index)=>{
+        console.log(item);
+          if(item.materialName==materialName)
+            return index;
       });
-      //绑定发货单位id
-      that.axios.post("/api/v1/uc/getSupplierMesByMaterialId?apiId=247&index=" +
-          that.supplierName).then((res)=>{
-            console.log(res.data.data);
-            if(res.data.code == "200" && res.data.data &&res.data.data.list.length > 0 ) {
-              that.supplierId=res.data.data.list[0].supplierId;
-              that.supplierName=res.data.data.list[0].supplierName;
-            }else{
-              that.supplierId=null;
-              that.supplierName=null;
-              this.$message.error("绑定发货单位失败,请手动选择!");
-            }
+      return -1;
+    },
+    indexOfSupplier(supplierName,suppliers){
+      suppliers.forEach((item,index)=>{
+          if(item.supplierName==supplierName)
+            return index;
       });
-    }
-
+      return -1;
+    },
   },
 };
 </script>
@@ -752,11 +823,13 @@ export default {
   .button_box {
     display: flex;
     justify-content: center;
-    padding-top: 30px;
+    margin-top: 30px;
+    margin-bottom: 30px;
   }
    .fromOther  .el-input__inner{
     width: 250px;
   }
+ 
 }
 </style>
 

+ 1 - 1
src/views/TMS/components/domesticMine/wagonLoadMine.vue

@@ -10,7 +10,7 @@
         <i class="el-icon-plus"></i>新增
       </el-button>
       <el-button type="primary" @click="btnclick(1)">
-        <i class="el-icon-edit-outline"></i>补录
+        <i class="el-icon-edit-outline"></i>配单
       </el-button>
     </div>
 

+ 109 - 19
src/views/TMS/components/domesticMine/wagonLoadbu.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="wagonLoadbu">
     <page-title>返回</page-title>
-    <div class="top">
+    <!-- <div class="top">
       <div class="text">物资:</div>
       <el-select
         v-model="materialId"
@@ -34,14 +34,42 @@
           :value="item.supplierId">
         </el-option>
       </el-select>
-    </div>
-    <div class="wagonLoadbu_table">
+    </div> -->
+     <div class="purchaseOrder_table">
+      <div class="search" style="display:flex">
+        <div style="margin-top: 18px;margin-left:10px">
+          <el-label>物资名:</el-label>
+        </div>
+        <el-input
+        placeholder="请输入物资名"
+        v-model="search1"
+        style="margin: 10px; width:10%"
+        clearable
+        ></el-input>
+        <div style="margin-top: 18px;margin-left:10px">
+          <el-label>外轮船名:</el-label>
+        </div>
+        <el-input
+          placeholder="请输入外轮船名"
+          v-model="search2"
+          style="margin: 10px;width:10%"
+          clearable
+        ></el-input>
+      <el-button
+        type="primary"
+        class="btn"
+        @click="searchOrder()"
+        style="margin: 10px;">
+        <i class="el-icon-search"></i>查询
+      </el-button>
+      </div>
       <dilTable
-        v-bind.sync="option"
-        @selection-change="selectionChange"
+        v-bind.sync="purchaseOption"
+        @radio-change="orderChange"
       ></dilTable>
     </div>
-    <!-- <div class="material form">
+
+    <div class="material form">
       <span class="text">物资:</span>
       <el-input v-model="materialName" disabled> </el-input>
       <el-button type="primary" @click="ondrawer(1)">浏览</el-button>
@@ -51,12 +79,12 @@
       <span class="text">发货单位:</span>
       <el-input v-model="supplierName" disabled> </el-input>
       <el-button type="primary" @click="ondrawer(2)">浏览</el-button>
-    </div> -->
-    <div class="forwardingUnit form">
+    </div>
+    <!-- <div class="forwardingUnit form">
       <span class="text">卸货点:</span>
       <el-input v-model="unloadPointName" disabled> </el-input>
       <el-button type="primary" @click="ondrawer(3)">浏览</el-button>
-    </div>
+    </div> -->
     <div class="remark form">
       <span class="text" >船名(备注):</span>
       <el-input v-model="remark" @blur="onBlur" > </el-input>
@@ -68,6 +96,15 @@
       <dil-form :formId="361" v-model="form1" ref="from1"></dil-form>
       </div>
     </div>
+    <div class="wagonLoadbu_table">
+      <dilTable
+        v-bind.sync="option"
+        @selection-change="selectionChange"
+        @row-click="selectionChange"
+      ></dilTable>
+    </div>
+    
+    
     <div class="button_box">
       <el-button @click="cancel">取消</el-button>
       <el-button type="primary" @click="makeSure">确定</el-button>
@@ -117,12 +154,24 @@ export default {
   data() {
     return {
       form1: {},
+      con:null,
+      purchaseOption:{
+         // 表格请求数据的地址
+        requestUrl: "/api/v1/tms/findPurchaseOrderList?apiId=81",
+        // 控制选择单列
+        selectionType: "radio",
+        map:[]
+      },
       option: {
         // 表格请求数据的地址
         requestUrl: "/api/v1/tms/getTmstrainWagonLoad?apiId=209&resultType=10",
         // 控制显示多选列
-        selectionType: "select"
+        selectionType: "select",
+        pageSize:50,
       },
+      //查询用数据
+      search1:null,
+      search2:null,
       //多选选中的数据
       selecTionListMap: [],
       //船名
@@ -142,6 +191,7 @@ export default {
       //发货单位选项
       supplierNames:[],
       //卸货点
+      unloadPointId:null,
       unloadPointName:null,
       //是否需要打开模态窗口
       drawer: false,
@@ -173,10 +223,16 @@ export default {
     makeSure() {
       if(this.selecTionListMap.length <= 0){
         this.$message({
-          message: "请选择需要补录的装车信息!",
+          message: "请选择需要配单的装车信息!",
           type: "warning",
         });
-      }else{
+      }else if(!this.purchaseOrderId){
+         this.$message({
+          message: "请选择采购订单!",
+          type: "warning",
+        });
+      }
+      else{
         let map = {
           resultIdList:this.selecTionListMap,
           purchaseOrderId:this.purchaseOrderId,
@@ -186,7 +242,7 @@ export default {
           console.log(res.data.data)
           if(res.data.code == "200"){
             this.$message({
-              message: "补录成功!",
+              message: "配单成功!",
               type: "success",
             });
             this.cancel();
@@ -199,6 +255,18 @@ export default {
     cancel() {
       this.$router.push("/wagonLoadMine");
     },
+    //采购订单表格选中
+    orderChange(selection){
+      console.log(selection);
+      this.purchaseOrderId=selection.purchaseOrderId;
+      this.form1 = { purchaseOrderNo: selection.purchaseOrderNo };
+      this.materialId=selection.materialId;
+      this.materialName=selection.materialName;
+      this.supplierId=selection.supplierId;
+      this.supplierName=selection.supplierName;
+      this.remark=selection.resultForeignShipName;
+      this.tableChange();
+    },
     //表格选中
     selectionChange(selection) {
       this.selecTionListMap = [];
@@ -212,11 +280,13 @@ export default {
       this.materialName = selection.materialName;
       this.materialId = selection.materialId;
       this.getPurchaseOrderNo();
+      this.tableChange();
     },
     currentRadioChange2(selection) {
       this.supplierName = selection.supplierName;
       this.supplierId = selection.supplierId;
       this.getPurchaseOrderNo();
+      this.tableChange();
     },
     currentRadioChange3(selection) {
       this.unloadPointId = selection.warehouseId;
@@ -264,6 +334,21 @@ export default {
         });
       }
     },
+    searchOrder(){
+      if((typeof this.search1)!="undefined" && (typeof this.search2)!='undefined'){
+        let requestUrl="/api/v1/tms/findPurchaseOrderList?apiId=81";
+        if(this.search1!=null){
+            requestUrl+=("&materialName="+this.search1);
+        }
+        if(this.search2!=null){
+            requestUrl+=("&resultForeignShipName="+this.search2);
+        }
+        this.purchaseOption.requestUrl=requestUrl;
+      }else{
+        this.purchaseOption.requestUrl=
+        "/api/v1/tms/findPurchaseOrderList?apiId=81"
+      }
+    },
     onClick(a) {
       if (a == 1) {
         this.frist.requestUrl =
@@ -281,6 +366,7 @@ export default {
       }
     },
     searchMaterialName(index=''){
+      //根据name查询物资名
       let that=this;
       that.axios.post("api/v1/uc/queryAPOMaterialByLike?apiId=244&startNum=050&index="+index).then((res)=>{
           console.log(res);
@@ -293,6 +379,7 @@ export default {
       });
     },
     searchSupplierName(index=''){
+      //根据name查询发货单位
       let that=this;
       that.axios.post("/api/v1/uc/getSupplierMesByMaterialId?apiId=247&materialId="+that.materialId+"&index="+index).then((res)=>{
            console.log(res);
@@ -303,11 +390,14 @@ export default {
           }
       });
     },
-    supplierIdChange(){
-      this.option.requestUrl=
-      "/api/v1/tms/getTmstrainWagonLoad?apiId=209&resultType=10&materialId="
-      +this.materialId+"&supplierId="
-      +this.supplierId;
+    tableChange(){
+      //重新查询配单车辆
+      if(typeof this.materialId !='undefined'&& this.materialId!=null && typeof this.supplierId!='undefined' && this.supplierId!=null){
+         this.option.requestUrl=
+          "/api/v1/tms/getTmstrainWagonLoad?apiId=209&resultType=10&materialId="
+          +this.materialId+"&supplierId="
+          +this.supplierId;
+      }
     }
   },
 };
@@ -474,7 +564,7 @@ export default {
   .button_box {
     display: flex;
     justify-content: center;
-    margin-top: 30px;
+    margin: 30px;
   }
 }
 </style>