Kaynağa Gözat

修改装车作业

liyg 2 yıl önce
ebeveyn
işleme
a68a7ba909

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

@@ -14,22 +14,7 @@
           <el-button  type="primary">导入</el-button>
       </el-upload>
       <span >当前导入数量:{{tableData.length}}</span>
-      <!-- <el-input
-        placeholder="请输入内容"
-        v-model="input"
-        @change="onchang"
-        clearable
-      >
-      </el-input> -->
     </div>
-    <!-- <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
@@ -185,7 +170,7 @@
 
     <div class="button_box">
       <el-button @click="cancel">取消</el-button>
-      <el-button type="primary" @click="makeSure">确定</el-button>
+      <el-button type="primary" :disabled="disable"  @click="makeSure">确定</el-button>
     </div>
     <!-- 模态窗口 -->
     <el-drawer :visible.sync="drawer" :direction="direction" size="30%">
@@ -232,6 +217,7 @@ export default {
   components: { PageTitle },
   data() {
     return {
+      disable:true,
       file:null,
       list: [],
       form1: {},
@@ -501,6 +487,7 @@ export default {
     },
     // 确定
     makeSure() {
+      this.disable=true;
       let that=this;
       if (this.tableData.length <= 0  || !this.toTheStationId || this.form1.resultLoadingDate){
         if (this.tableData.length <= 0) {
@@ -509,6 +496,7 @@ export default {
             message: "请导入数据!",
           });
         } else {
+            this.disable=false;
             if (this.toTheStationId) {
               if (this.form1.resultLoadingDate) {
               } else {
@@ -577,6 +565,7 @@ export default {
           console.log(rows);
           //清空
           if(rows.length>0){
+            that.disable=false;
             that.tableData=[];
             if((typeof rows[0]['车号'])=='undefined'){
               that.$message({
@@ -589,7 +578,7 @@ export default {
           //绑定数据
           rows.forEach((row,index) => {
             let carNumber=row['车号'];
-            if((typeof carNumber)!="undefined" && carNumber.length > 6){
+            if((typeof carNumber)!="undefined" && carNumber.length == 7){
               //表格数据
               let temp={
                 number:row['序号'],

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

@@ -40,7 +40,7 @@
         v-bind.sync="purchaseOption"
         @radio-change="orderChange"
       ></dilTable>
-    </div>
+      </div>
     <!-- <div class="material form">
       <span class="text">物资:</span>
       <el-input v-model="materialName" disabled> </el-input>

+ 331 - 121
src/views/TMS/components/importedEmergency/addWagonLoadEmergency.vue

@@ -1,10 +1,122 @@
 <template>
   <!-- 添加车皮装车实绩 -->
   <div class="addWagonLoad">
-    <page-title>新增</page-title>
- 
+    <page-title>返回</page-title>
+    <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>
+      <!-- <el-button 
+      type="primary"
+      class="btn" 
+      @click="makeSure" 
+      style="margin: 10px;">确认配单
+      </el-button> -->
+      </div>
+      <!-- 采购订单号 -->
+      <dilTable
+        v-bind.sync="purchaseOption"
+        @radio-change="orderChange"
+      ></dilTable>
+    </div>
     <div class="cp">
-      <span style="width:80px">车皮号:</span>
+      <span >车皮号:</span>
+      <el-upload style="margin: 8px;"
+          class="upload-excel"
+          action=""
+          :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 >当前导入数量:{{tableData.length}}</span>
+    </div>
+    <div class="table item"
+        style="width:680px;
+        height:300px;
+        float:left;
+        overflow:auto" >
+      <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="makeDate"
+          label="制票日期"
+          width="120px">
+        </el-table-column>
+        <el-table-column
+        align="center"
+          prop="wagonNo"
+          label="车号"
+          width="120px">
+        </el-table-column>
+        <el-table-column
+        align="center"
+          prop="materialName"
+          label="物资"
+          width="180px">
+        </el-table-column>
+        <el-table-column
+        align="center"
+          prop="mineral"
+          label="矿种"
+          width="120px">
+        </el-table-column>
+         <el-table-column
+         align="center"
+        width="80px"
+          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="cp">
+      <span style="width:80px">车皮号:</span>
       <el-input
         placeholder="请输入内容"
         v-model="input"
@@ -42,51 +154,53 @@
       <span class="text">卸货点:</span>
       <el-input v-model="unloadPointName" disabled> </el-input>
       <el-button type="primary" @click="ondrawer(4)">浏览</el-button>
+    </div> -->
+    <div class="right" 
+    style="margin-top:10px
+           float:right;">
+        <div class="form">
+          <div class="form_box" style="margin-right: 10rem">
+            <el-form>
+               <div class="preview-group">
+                  <el-form-item label="发站:">
+                    <el-autocomplete
+                      class="inline-input"
+                      v-model="sendStation"
+                      :fetch-suggestions="querySearchSendStation"
+                      placeholder="请输入发站名称"
+                      :trigger-on-focus="false"
+                      @select="handleSelectSendStation"
+                    >
+                      <template slot-scope="{ item }">
+                        <div class="name">{{ item.arrivalName }}</div>
+                      </template>
+                    </el-autocomplete>
+                  </el-form-item>
+                  <el-form-item label="到站:">
+                    <el-autocomplete
+                      class="inline-input"
+                      v-model="toTheStation"
+                      :fetch-suggestions="querySearchToTheStation"
+                      placeholder="请输入到站名称"
+                      :trigger-on-focus="false"
+                      @select="handleSelectToTheStation"
+                    >
+                      <template slot-scope="{ item }">
+                        <div class="name">{{ item.arrivalName }}</div>
+                      </template>
+                    </el-autocomplete>
+                  </el-form-item>
+               </div>
+          </el-form>
+            <dil-form :formId="102" v-model="form1" ref="from1"></dil-form>
+          </div>
+        </div>
+        <div class="button-box">
+          <el-button @click="cancel">取消</el-button>
+          <el-button type="primary" :disabled="disable" @click="makeSure">确定</el-button>
+        </div>
     </div>
-    <div class="fromOther">
-      <el-form :inline="true" class="demo-form-inline" label-width="80px" style="margin-left:550px;">
-        <el-form-item label="发站:">
-          <el-autocomplete
-            class="inline-input"
-            v-model="sendStation"
-            :fetch-suggestions="querySearchSendStation"
-            placeholder="请输入发站名称"
-            :trigger-on-focus="false"
-            @select="handleSelectSendStation"
-          >
-            <template slot-scope="{ item }">
-              <div class="name">{{ item.arrivalName }}</div>
-            </template>
-          </el-autocomplete>
-        </el-form-item>
-      </el-form>
-      <el-form :inline="true" class="demo-form-inline" label-width="80px" style="margin-left:550px;">
-        <el-form-item label="到站:">
-          <el-autocomplete
-            class="inline-input"
-            v-model="toTheStation"
-            :fetch-suggestions="querySearchToTheStation"
-            placeholder="请输入到站名称"
-            :trigger-on-focus="false"
-            @select="handleSelectToTheStation"
-          >
-            <template slot-scope="{ item }">
-              <div class="name">{{ item.arrivalName }}</div>
-            </template>
-          </el-autocomplete>
-        </el-form-item>
-      </el-form>
-    </div>
-    <div class="form">
-      <div class="form_box" style="margin-right: 10rem">
-        <dil-form :formId="254" v-model="form1" ref="from1"></dil-form>
-      </div>
-    </div>
-    <div class="button-box">
-      <el-button @click="cancel">取消</el-button>
-      <el-button type="primary" @click="makeSure">确定</el-button>
-    </div>
-
+    
     <!-- 模态窗口 -->
     <el-drawer :visible.sync="drawer" :direction="direction" size="30%">
       <el-input
@@ -127,13 +241,15 @@
 
 <script>
 import PageTitle from "@/components/Page/Title";
-import { sjTime,isNumber } from "@/utils/sharedJsFile";
+import { sjTime } from "@/utils/sharedJsFile";
 export default {
   components: { PageTitle },
   data() {
     return {
+      disable:true,
       list: [],
       form1: {},
+      tableData:[],
       input: "",
       value: undefined,
       //船名
@@ -154,9 +270,19 @@ export default {
       unloadPointId: null,
       //卸货点名称
       unloadPointName: null,
+      //查询
+      search1:null,
+      search2:null,
       a: 1,
       direction: "rtl",
       inputText: "",
+      purchaseOption:{
+         // 表格请求数据的地址
+        requestUrl: "/api/v1/tms/findPurchaseOrderList?apiId=81",
+        // 控制选择单列
+        selectionType: "radio",
+        pageSize:5,
+      },
       frist: {
         requestUrl: "/api/v1/uc/queryAPOMaterialByLike?apiId=244&startNum=050",
         selectionType: "radio",
@@ -172,17 +298,12 @@ export default {
         requestUrl: "/api/v1/uc/getUnloadingMesByLike?apiId=374",
         selectionType: "radio",
       },
-      sendStationId:null,
+      sendStationId:2,
       toTheStationId:1,
-      sendStation:null,
+      sendStation:"万州港",
       toTheStation:"老区轨道衡"
     };
   },
-  created(){
-    this.form1 = {
-      arrivalStationId:1,
-    }
-  },
   methods: {
     currentRadioChange1(selection) {
       this.input = null;
@@ -257,50 +378,6 @@ export default {
           "/api/v1/uc/getUnloadingMesByLike?apiId=374&index=" + this.inputText;
       }
     },
-    onchang() {
-      var state = false;
-      var cptop = this.input.substring(0, 2);
-      var cptop1 = this.input.substring(0, 3);
-      if (
-        cptop == "45" ||
-        cptop == "46" ||
-        cptop == "42" ||
-        cptop == "47" ||
-        cptop == "15" ||
-        cptop == "16" ||
-        cptop == "17" ||
-        cptop == "18"
-      ) {
-        state = true;
-      } else if (
-        cptop1 == "140" ||
-        cptop1 == "141" ||
-        cptop1 == "142" ||
-        cptop1 == "143" ||
-        cptop1 == "145"
-      ) {
-        state = true;
-      } else {
-        this.$message({
-          type: "warning",
-          message: "车皮号格式不对,请重新输入!",
-        });
-      }
-      if (state) {
-        if (this.input.length == 7) {
-          this.list.push(this.input);
-          this.input = "";
-        } else {
-          this.$message({
-            type: "warning",
-            message: "车皮号长度不足7位数,请重新输入!",
-          });
-        }
-      }
-    },
-    onclick(index) {
-      this.list.splice(index, 1);
-    },
     //发站弹出层
     handleSelectSendStation(item) {
       this.sendStationId = item.arrivalId;
@@ -367,21 +444,84 @@ export default {
         );
       };
     },
+    onchang() {
+      var state = false;
+      var cptop = this.input.substring(0, 2);
+      var cptop1 = this.input.substring(0, 3);
+      if (
+        cptop == "45" ||
+        cptop == "46" ||
+        cptop == "42" ||
+        cptop == "47" ||
+        cptop == "15" ||
+        cptop == "16" ||
+        cptop == "17" ||
+        cptop == "18"
+      ) {
+        state = true;
+      } else if (
+        cptop1 == "140" ||
+        cptop1 == "141" ||
+        cptop1 == "142" ||
+        cptop1 == "143" ||
+        cptop1 == "145"
+      ) {
+        state = true;
+      } else {
+        this.$message({
+          type: "warning",
+          message: "车皮号格式不对,请重新输入!",
+        });
+      }
+      if (state) {
+        if (this.input.length == 7) {
+          this.list.push(this.input);
+          this.input = "";
+        } else {
+          this.$message({
+            type: "warning",
+            message: "车皮号长度不足7位数,请重新输入!",
+          });
+        }
+      }
+    },
+    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(index) {
+      this.list.splice(index, 1);
+    },
     // 确定
     makeSure() {
+      this.disable=true;
       let state = 0;
       if (
         this.list.length > 0 &&
         this.materialId &&
         this.supplierId &&
-        this.unloadPointId &&
         this.purchaseOrderId &&
+        this.form1.resultIsclear &&
+        this.form1.resultClass &&
         this.sendStationId &&
         this.toTheStationId &&
         this.form1.resultLoadingDate
       ) {
         state = 1;
       } else {
+        this.disable=false;
         console.log(this.list.length);
         if (this.list.length == 0) {
           this.$message({
@@ -390,9 +530,9 @@ export default {
           });
         } else {
           if (this.materialId) {
-            if (this.supplierId) {
-              if (this.unloadPointId) {
                 if (this.purchaseOrderId) {
+                  if (this.form1.resultIsclear) {
+                    if (this.form1.resultClass) {
                       if (this.sendStationId) {
                         if (this.toTheStationId) {
                           if (this.form1.resultLoadingDate) {
@@ -415,24 +555,24 @@ export default {
                         });
                       }
                     } else {
+                      this.$message({
+                        type: "warning",
+                        message: "请选择班别!",
+                      });
+                    }
+                  } else {
+                    this.$message({
+                      type: "warning",
+                      message: "请选择是否清场!",
+                    });
+                  }
+                } else {
                   this.$message({
                     type: "warning",
                     message: "该物资没有采购订单号!",
                   });
                 }
-              } else {
-                this.$message({
-                  type: "warning",
-                  message: "请选择卸货地点!",
-                });
-              }
-            } else {
-              this.$message({
-                type: "warning",
-                message: "请选择发货单位!",
-              });
-            }
-          } else {
+            }  else {
             this.$message({
               type: "warning",
               message: "请选择物资!",
@@ -443,7 +583,7 @@ export default {
       if(state == 1){
         let map = {
           wagonNoList:this.list,
-          unloadingPointId:this.unloadPointId,
+          // unloadingPointId:this.unloadPointId,
           purchaseOrderRailPlanId:this.purchaseOrderId,
           materialId:this.materialId,
           sendUnitId:this.supplierId,
@@ -455,6 +595,7 @@ export default {
           resultRemarks: this.form1.resultRemarks,
           resultType:2,
         }
+        console.log(map);
         this.axios.post('/api/v1/tms/insertTmstrainLoadingResult',map).then((res)=>{
           console.log(res);
           if(res.data.code == "200"){
@@ -462,7 +603,7 @@ export default {
               type: "success",
               message: "新增成功",
             });
-            this.$router.go(-1);
+            this.cancel();
           }
         })
       }
@@ -471,6 +612,77 @@ export default {
     cancel() {
       this.$router.go(-1);
     },
+    // 导入excel
+    importExcel(file) {
+      let that=this;
+      if (!file) {
+        that.$message({
+          message: "文件错误!",
+          type: "warning",
+        });
+        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);
+          //读取表格
+          let rows= XLSX.utils.sheet_to_json(workbook.Sheets[workbook.SheetNames[0]]);//只取第一页
+          console.log(rows);
+          //清空
+          if(rows.length>0){
+            that.list=[];
+            that.tableData=[];
+            that.disable=false;
+            if((typeof rows[0]['车皮号'])=='undefined'){
+              that.$message({
+                message: "导入Excel格式错误!",
+                type: "warning",
+              });
+              return;
+            }
+          }
+          //绑定数据
+          rows.forEach((row,index) => {
+            let carNumber=row['车皮号'];
+            if((typeof carNumber)!="undefined" && carNumber.length == 7){
+              //车号表
+              that.list.push(carNumber);
+              //表格数据
+              let temp={
+                number:row['序号'],
+                makeDate:row['制票日期'],
+                materialName:row['品名'],
+                wagonNo:row['车皮号'],
+                mineral:row['矿种'],
+                weight:row['计费&#10;吨位']
+              }
+              that.tableData.push(temp);
+            }
+            else{
+              console.log("车号"+carNumber+"不是7位数!");
+            }
+        });
+        };
+        reader.readAsBinaryString(file.raw); //以二进制方式读取
+    },
+    //采购订单表格选中
+    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;
+    },
   },
 };
 </script>
@@ -597,7 +809,6 @@ export default {
     .form_box {
       width: 340px;
       margin-left: 37%;
-     
       margin-right: 20px;
       .el-form {
         .preview-group {
@@ -615,8 +826,7 @@ export default {
               }
               .el-textarea{
                 .el-textarea__inner{
-                  width: 220px;
-                
+                  width: 225px;     
                   margin-top: 0.03rem;
                 }
               }
@@ -631,7 +841,7 @@ export default {
     justify-content: center;
     padding-top: 30px;
   }
-  .fromOther .el-input__inner{
+  .formOther  .el-input__inner{
     width: 250px;
   }
 }

+ 269 - 66
src/views/TMS/components/importedMine/addWagonLoad.vue

@@ -1,8 +1,121 @@
 <template>
   <!-- 添加车皮装车实绩 -->
   <div class="addWagonLoad">
-    <page-title>新增</page-title>
+    <page-title>返回</page-title>
+    <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>
+      <!-- <el-button 
+      type="primary"
+      class="btn" 
+      @click="makeSure" 
+      style="margin: 10px;">确认配单
+      </el-button> -->
+      </div>
+      <!-- 采购订单号 -->
+      <dilTable
+        v-bind.sync="purchaseOption"
+        @radio-change="orderChange"
+      ></dilTable>
+    </div>
     <div class="cp">
+      <span >车皮号:</span>
+      <el-upload style="margin: 8px;"
+          class="upload-excel"
+          action=""
+          :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 >当前导入数量:{{tableData.length}}</span>
+    </div>
+    <div class="table item"
+        style="width:680px;
+        height:300px;
+        float:left;
+        overflow:auto" >
+      <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="makeDate"
+          label="制票日期"
+          width="120px">
+        </el-table-column>
+        <el-table-column
+        align="center"
+          prop="wagonNo"
+          label="车号"
+          width="120px">
+        </el-table-column>
+        <el-table-column
+        align="center"
+          prop="materialName"
+          label="物资"
+          width="180px">
+        </el-table-column>
+        <el-table-column
+        align="center"
+          prop="mineral"
+          label="矿种"
+          width="120px">
+        </el-table-column>
+         <el-table-column
+         align="center"
+        width="80px"
+          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="cp">
       <span style="width:80px">车皮号:</span>
       <el-input
         placeholder="请输入内容"
@@ -41,50 +154,53 @@
       <span class="text">卸货点:</span>
       <el-input v-model="unloadPointName" disabled> </el-input>
       <el-button type="primary" @click="ondrawer(4)">浏览</el-button>
+    </div> -->
+    <div class="right" 
+    style="margin-top:10px
+           float:right;">
+        <div class="form">
+          <div class="form_box" style="margin-right: 10rem">
+            <el-form>
+               <div class="preview-group">
+                  <el-form-item label="发站:">
+                    <el-autocomplete
+                      class="inline-input"
+                      v-model="sendStation"
+                      :fetch-suggestions="querySearchSendStation"
+                      placeholder="请输入发站名称"
+                      :trigger-on-focus="false"
+                      @select="handleSelectSendStation"
+                    >
+                      <template slot-scope="{ item }">
+                        <div class="name">{{ item.arrivalName }}</div>
+                      </template>
+                    </el-autocomplete>
+                  </el-form-item>
+                  <el-form-item label="到站:">
+                    <el-autocomplete
+                      class="inline-input"
+                      v-model="toTheStation"
+                      :fetch-suggestions="querySearchToTheStation"
+                      placeholder="请输入到站名称"
+                      :trigger-on-focus="false"
+                      @select="handleSelectToTheStation"
+                    >
+                      <template slot-scope="{ item }">
+                        <div class="name">{{ item.arrivalName }}</div>
+                      </template>
+                    </el-autocomplete>
+                  </el-form-item>
+               </div>
+          </el-form>
+            <dil-form :formId="102" v-model="form1" ref="from1"></dil-form>
+          </div>
+        </div>
+        <div class="button-box">
+          <el-button @click="cancel">取消</el-button>
+          <el-button type="primary" :disabled="disable" @click="makeSure">确定</el-button>
+        </div>
     </div>
-    <div class="fromOther">
-      <el-form :inline="true" class="demo-form-inline" label-width="80px" style="margin-left:550px;">
-        <el-form-item label="发站:">
-          <el-autocomplete
-            class="inline-input"
-            v-model="sendStation"
-            :fetch-suggestions="querySearchSendStation"
-            placeholder="请输入发站名称"
-            :trigger-on-focus="false"
-            @select="handleSelectSendStation"
-          >
-            <template slot-scope="{ item }">
-              <div class="name">{{ item.arrivalName }}</div>
-            </template>
-          </el-autocomplete>
-        </el-form-item>
-      </el-form>
-      <el-form :inline="true" class="demo-form-inline" label-width="80px" style="margin-left:550px;">
-        <el-form-item label="到站:">
-          <el-autocomplete
-            class="inline-input"
-            v-model="toTheStation"
-            :fetch-suggestions="querySearchToTheStation"
-            placeholder="请输入到站名称"
-            :trigger-on-focus="false"
-            @select="handleSelectToTheStation"
-          >
-            <template slot-scope="{ item }">
-              <div class="name">{{ item.arrivalName }}</div>
-            </template>
-          </el-autocomplete>
-        </el-form-item>
-      </el-form>
-    </div>
-    <div class="form">
-      <div class="form_box" style="margin-right: 10rem">
-        <dil-form :formId="102" v-model="form1" ref="from1"></dil-form>
-      </div>
-    </div>
-    <div class="button-box">
-      <el-button @click="cancel">取消</el-button>
-      <el-button type="primary" @click="makeSure">确定</el-button>
-    </div>
+    
     <!-- 模态窗口 -->
     <el-drawer :visible.sync="drawer" :direction="direction" size="30%">
       <el-input
@@ -130,8 +246,10 @@ export default {
   components: { PageTitle },
   data() {
     return {
+      disable:true,
       list: [],
       form1: {},
+      tableData:[],
       input: "",
       value: undefined,
       //船名
@@ -152,9 +270,19 @@ export default {
       unloadPointId: null,
       //卸货点名称
       unloadPointName: null,
+      //查询
+      search1:null,
+      search2:null,
       a: 1,
       direction: "rtl",
       inputText: "",
+      purchaseOption:{
+         // 表格请求数据的地址
+        requestUrl: "/api/v1/tms/findPurchaseOrderList?apiId=81",
+        // 控制选择单列
+        selectionType: "radio",
+        pageSize:5,
+      },
       frist: {
         requestUrl: "/api/v1/uc/queryAPOMaterialByLike?apiId=244&startNum=050",
         selectionType: "radio",
@@ -357,17 +485,33 @@ 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(index) {
       this.list.splice(index, 1);
     },
     // 确定
     makeSure() {
+      this.disable=true;
       let state = 0;
       if (
         this.list.length > 0 &&
         this.materialId &&
         this.supplierId &&
-        this.unloadPointId &&
         this.purchaseOrderId &&
         this.form1.resultIsclear &&
         this.form1.resultClass &&
@@ -377,6 +521,7 @@ export default {
       ) {
         state = 1;
       } else {
+        this.disable=false;
         console.log(this.list.length);
         if (this.list.length == 0) {
           this.$message({
@@ -385,13 +530,11 @@ export default {
           });
         } else {
           if (this.materialId) {
-            if (this.supplierId) {
-              if (this.unloadPointId) {
                 if (this.purchaseOrderId) {
                   if (this.form1.resultIsclear) {
-                    if (this.form1.resultIsclear) {
-                      if (this.form1.sendStationId) {
-                        if (this.form1.arrivalStationId) {
+                    if (this.form1.resultClass) {
+                      if (this.sendStationId) {
+                        if (this.toTheStationId) {
                           if (this.form1.resultLoadingDate) {
                           } else {
                             this.$message({
@@ -429,19 +572,7 @@ export default {
                     message: "该物资没有采购订单号!",
                   });
                 }
-              } else {
-                this.$message({
-                  type: "warning",
-                  message: "请选择卸货地点!",
-                });
-              }
-            } else {
-              this.$message({
-                type: "warning",
-                message: "请选择发货单位!",
-              });
-            }
-          } else {
+            }  else {
             this.$message({
               type: "warning",
               message: "请选择物资!",
@@ -452,7 +583,7 @@ export default {
       if(state == 1){
         let map = {
           wagonNoList:this.list,
-          unloadingPointId:this.unloadPointId,
+          // unloadingPointId:this.unloadPointId,
           purchaseOrderRailPlanId:this.purchaseOrderId,
           materialId:this.materialId,
           sendUnitId:this.supplierId,
@@ -464,6 +595,7 @@ export default {
           resultRemarks: this.form1.resultRemarks,
           resultType:1,
         }
+        console.log(map);
         this.axios.post('/api/v1/tms/insertTmstrainLoadingResult',map).then((res)=>{
           console.log(res);
           if(res.data.code == "200"){
@@ -471,7 +603,7 @@ export default {
               type: "success",
               message: "新增成功",
             });
-            this.$router.push("/wagonLoad");
+            this.cancel();
           }
         })
       }
@@ -480,6 +612,77 @@ export default {
     cancel() {
       this.$router.go(-1);
     },
+    // 导入excel
+    importExcel(file) {
+      let that=this;
+      if (!file) {
+        that.$message({
+          message: "文件错误!",
+          type: "warning",
+        });
+        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);
+          //读取表格
+          let rows= XLSX.utils.sheet_to_json(workbook.Sheets[workbook.SheetNames[0]]);//只取第一页
+          console.log(rows);
+          //清空
+          if(rows.length>0){
+            that.list=[];
+            that.tableData=[];
+            that.disable=false;
+            if((typeof rows[0]['车皮号'])=='undefined'){
+              that.$message({
+                message: "导入Excel格式错误!",
+                type: "warning",
+              });
+              return;
+            }
+          }
+          //绑定数据
+          rows.forEach((row,index) => {
+            let carNumber=row['车皮号'];
+            if((typeof carNumber)!="undefined" && carNumber.length == 7){
+              //车号表
+              that.list.push(carNumber);
+              //表格数据
+              let temp={
+                number:row['序号'],
+                makeDate:row['制票日期'],
+                materialName:row['品名'],
+                wagonNo:row['车皮号'],
+                mineral:row['矿种'],
+                weight:row['计费&#10;吨位']
+              }
+              that.tableData.push(temp);
+            }
+            else{
+              console.log("车号"+carNumber+"不是7位数!");
+            }
+        });
+        };
+        reader.readAsBinaryString(file.raw); //以二进制方式读取
+    },
+    //采购订单表格选中
+    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;
+    },
   },
 };
 </script>
@@ -638,7 +841,7 @@ export default {
     justify-content: center;
     padding-top: 30px;
   }
-  .fromOther  .el-input__inner{
+  .formOther  .el-input__inner{
     width: 250px;
   }
 }