liyg 2 gadi atpakaļ
vecāks
revīzija
a39ae96aa0

+ 2 - 2
config/index.js

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

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

@@ -96,7 +96,7 @@ export default {
       else
         this.axios
           .post("/api/v1/tms/addApproveWagonPlease", approveWagonPlease)
-          .then(() => {
+          .then((res) => {
             if(res.data.code=="200"){
             this.$message({
               type: "success",

+ 89 - 6
src/views/TMS/components/domesticMine/wagonLoadAdd.vue

@@ -3,21 +3,31 @@
   <div class="addWagonLoad">
     <page-title>新增</page-title>
     <div class="cp">
-      <span style="width:80px">车皮号:</span>
-      <el-input
+      <span >车皮号:</span>
+      <el-upload style="margin: 8px;"
+          class="upload-excel"
+          action=""
+          :on-change="importfile"
+          :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>
+      <!-- <el-input
         placeholder="请输入内容"
         v-model="input"
         @change="onchang"
         clearable
       >
-      </el-input>
+      </el-input> -->
     </div>
     <div class="cpList">
       <div class="list">
-        <span class="cpList1" v-for="(item, i) in list" :key="i">
+        <div class="cpList1" v-for="(item, i) in list" :key="i">
           {{ item }}
           <i class="el-icon-close itu" @click="onclick(i)"></i>
-        </span>
+        </div>
       </div>
     </div>
     <div class="matching item">
@@ -154,6 +164,7 @@ export default {
   components: { PageTitle },
   data() {
     return {
+      file:null,
       list: [],
       form1: {},
       input: "",
@@ -505,6 +516,77 @@ export default {
     cancel() {
       this.$router.push("/wagonLoadMine");
     },
+    // excel表上传
+    importfile(file) {//导入文件
+      let that=this;
+      if (!file) {
+        alert('文件错误,请重新选择');
+        return
+        }
+        var reader = new FileReader();
+        var data=null;
+        var workbook=null;
+        //设置读取操作
+        reader.onload = 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();
+          }
+          //绑定车号
+          rows.forEach((row,index) => {
+            let carNumber=row['车号'];
+            if((typeof carNumber)!="undefined" && carNumber.length > 6)
+              that.list.push(carNumber);
+            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("绑定品名失败,请手动选择!");
+            }
+            
+      });
+      //绑定发货单位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("绑定发货单位失败,请手动选择!");
+            }
+      });
+    }
+
   },
 };
 </script>
@@ -539,10 +621,11 @@ export default {
       padding: 0.625rem;
       display: flex;
       flex-wrap: wrap;
+      overflow:auto;
       .cpList1 {
         background-color: #c9c7c7;
         height: 1.875rem;
-        margin-right: 0.5rem;
+        margin: 0.5rem;
         padding: 0.625rem;
         display: flex;
         align-items: center;

+ 88 - 4
src/views/TMS/components/domesticMine/wagonLoadbu.vue

@@ -1,14 +1,47 @@
 <template>
   <div class="wagonLoadbu">
     <page-title>返回</page-title>
+    <div class="top">
+      <div class="text">物资:</div>
+      <el-select
+        v-model="materialId"
+        filterable
+        remote
+        reserve-keyword
+        placeholder="选择物资名"
+        :remote-method="searchMaterialName"
+        @change="searchSupplierName();getPurchaseOrderNo()">
+        <el-option
+          v-for="item in materialNames"
+          :key="item.materialId"
+          :label="item.materialName"
+          :value="item.materialId">
+        </el-option>
+      </el-select>
+      <div class="text">发货单位:</div>
+       <el-select
+        v-model="supplierId"
+        filterable
+        remote
+        reserve-keyword
+        placeholder="选择发货单位"
+        :remote-method="searchSupplierName"
+        @change="getPurchaseOrderNo();supplierIdChange()">
+        <el-option
+          v-for="item in supplierNames"
+          :key="item.supplierId"
+          :label="item.supplierName"
+          :value="item.supplierId">
+        </el-option>
+      </el-select>
+    </div>
     <div class="wagonLoadbu_table">
       <dilTable
         v-bind.sync="option"
         @selection-change="selectionChange"
       ></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>
@@ -18,7 +51,7 @@
       <span class="text">发货单位:</span>
       <el-input v-model="supplierName" disabled> </el-input>
       <el-button type="primary" @click="ondrawer(2)">浏览</el-button>
-    </div>
+    </div> -->
     <div class="forwardingUnit form">
       <span class="text">卸货点:</span>
       <el-input v-model="unloadPointName" disabled> </el-input>
@@ -88,7 +121,7 @@ export default {
         // 表格请求数据的地址
         requestUrl: "/api/v1/tms/getTmstrainWagonLoad?apiId=209&resultType=10",
         // 控制显示多选列
-        selectionType: "select",
+        selectionType: "select"
       },
       //多选选中的数据
       selecTionListMap: [],
@@ -104,6 +137,12 @@ export default {
       supplierId: null,
       //物资id
       materialId: null,
+      //物资选项
+      materialNames:[],
+      //发货单位选项
+      supplierNames:[],
+      //卸货点
+      unloadPointName:null,
       //是否需要打开模态窗口
       drawer: false,
       a: 1,
@@ -126,6 +165,9 @@ export default {
       },
     };
   },
+  mounted(){
+    this.searchMaterialName('');
+  },
   methods: {
     //确定
     makeSure() {
@@ -238,6 +280,35 @@ export default {
           "/api/v1/uc/getUnloadingMesByLike?apiId=347&index=" + this.inputText;
       }
     },
+    searchMaterialName(index=''){
+      let that=this;
+      that.axios.post("api/v1/uc/queryAPOMaterialByLike?apiId=244&startNum=050&index="+index).then((res)=>{
+          console.log(res);
+          if (res.data.code == "200" && res.data.data) {
+            that.materialNames=res.data.data.list;
+          } else {
+            this.$message.error("请求失败");
+          }
+         
+      });
+    },
+    searchSupplierName(index=''){
+      let that=this;
+      that.axios.post("/api/v1/uc/getSupplierMesByMaterialId?apiId=247&materialId="+that.materialId+"&index="+index).then((res)=>{
+           console.log(res);
+          if (res.data.code == "200" && res.data.data) {
+            that.supplierNames=res.data.data.list;
+          }else{
+            this.$message.error("请求失败");
+          }
+      });
+    },
+    supplierIdChange(){
+      this.option.requestUrl=
+      "/api/v1/tms/getTmstrainWagonLoad?apiId=209&resultType=10&materialId="
+      +this.materialId+"&supplierId="
+      +this.supplierId;
+    }
   },
 };
 </script>
@@ -247,6 +318,19 @@ export default {
   color: #606266;
   font-size: 0.675rem;
   font-weight: 500;
+  .top {
+    display: flex;
+    margin:0.375rem;
+    .el-select{
+      width: 15%;
+      // height: 2%;
+    }
+    .text {
+      text-align: left; 
+      margin-top: 0.5rem;
+      margin-left:0.375rem;
+    }
+  }
   .cp {
     width: 49%;
     display: flex;