liyg 2 years ago
parent
commit
1203f8aa16

+ 159 - 357
src/views/TMS/components/domesticMine/wagonLoadAdd.vue

@@ -1,5 +1,5 @@
 <template>
-  <!-- 国产矿导入-->
+  <!-- 国产矿导入3-->
   <div class="addWagonLoad">
     <page-title>返回</page-title>
     <div class="cp">
@@ -13,10 +13,6 @@
           <el-button  type="primary">导入车皮号(Excel)</el-button>
       </el-upload>
       <div style="margin-right:200px;">当前导入数量:{{tableData.length}}</div>
-      <!-- <el-button type="primary" @click="exportData()"><i class="el-icon-download"></i>下载Excel模板</el-button> -->
-    </div>
-    <div>
-      <span style="color:red">导入数据中的 品名、发货单位、车号、发站 是必须的</span>
     </div>
     <div class="table item">
       <el-table
@@ -35,15 +31,15 @@
         </el-table-column>
         <el-table-column
         align="center"
-          prop="materialName"
+          prop="productName"
           label="品  名"
-          width="180px">
+          width="240px">
         </el-table-column>
         <el-table-column
         align="center"
-          prop="supplierName"
-          label="发货单位"
-          width="180px">
+          prop="mineral"
+          label="矿种"
+          width="100px">
         </el-table-column>
         <el-table-column
         align="center"
@@ -53,8 +49,8 @@
         </el-table-column>
         <el-table-column
         align="center"
-          prop="sendDate"
-          label="发货日期"
+          prop="unloadPoint"
+          label="卸货地点"
           width="180px">
         </el-table-column>
         <el-table-column
@@ -75,82 +71,8 @@
           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">
-          <span class="text">是否知道采购订单号:</span>
-          <el-switch
-            v-model="matching"
-            active-color="#27d452"
-            inactive-color="#e1e3e6"
-          >
-          </el-switch>
-    </div>
-    <div class="material item">
-      <span class="text">物资:</span>
-      <el-input v-model="materialName" disabled> </el-input>
-      <el-button type="primary" @click="ondrawer(1)">浏览</el-button>
-    </div>
-
-    <div class="forwardingUnit item">
-      <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 item" v-if="matching">
-      <span class="text">卸货点:</span>
-      <el-input v-model="unloadPointName" disabled> </el-input>
-      <el-button type="primary" @click="ondrawer(3)">浏览</el-button>
-    </div> -->
-    <div class="fromOther">
-      <!-- <el-form :inline="true" class="demo-form-inline" label-width="80px" style="margin-left:500px;">
-        <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> -->
-      
-    </div>
-    <!-- <div class="remark from" v-if="matching">
-      <span class="text">船名/备注:</span>
-      <el-input
-        v-model="remark"
-        @blur="onBlur"
-        placeholder="可输入船名\备注重新匹配采购订单"
-      >
-      </el-input>
-      <span class="span"></span>
-    </div>
-    <div class="purchaseOrder from" v-if="matching" >
-      <span class="text" style="width:140px">采购订单号:</span>
-      <el-input
-        v-model="purchaseOrderNo"
-        placeholder="请选择物资和发货单位"
-        disabled
-      >
-      </el-input>
-      <span class="span"></span>
-    </div> -->
     <div class="form">
       <div class="form_box" style="margin-right: 10rem;margin-top:20px">
         <el-form>
@@ -174,46 +96,10 @@
         <dil-form :formId="364" 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>
+      <el-button type="primary" :loading="isLoading"  @click="makeSure">确定</el-button>
     </div>
-    <!-- 模态窗口 -->
-    <el-drawer :visible.sync="drawer" :direction="direction" size="30%">
-      <el-input
-        placeholder="请输入内容"
-        v-model="inputText"
-        style="margin-top: 0rem; margin-right: 0.1rem; width: 230px"
-        clearable
-      ></el-input>
-      <el-button
-        type="primary"
-        class="btn"
-        @click="onClick(a)"
-        style="margin-bottom: 0.9375rem"
-      >
-        <i class="el-icon-search"></i>查询
-      </el-button>
-      <div v-show="a == 1">
-        <dilTable
-          v-bind.sync="frist"
-          @radio-change="currentRadioChange1"
-        ></dilTable>
-      </div>
-      <div v-show="a == 2">
-        <dilTable
-          v-bind.sync="secend"
-          @radio-change="currentRadioChange2"
-        ></dilTable>
-      </div>
-       <div v-show="a == 3">
-        <dilTable
-          v-bind.sync="unloadPoint"
-          @radio-change="currentRadioChange3"
-        ></dilTable>
-      </div>
-    </el-drawer>
   </div>
 </template>
 
@@ -225,7 +111,7 @@ export default {
   components: { PageTitle },
   data() {
     return {
-      disable:true,
+      isLoading:false,
       file:null,
       list: [],
       form1: {},
@@ -250,9 +136,6 @@ export default {
       //表格数据
       tableData:[],
       unloadPointName:null,
-      //物资集合和供应商映射,相当于本地缓存,减少请求次数
-      materialMap:new Map(),
-      supplierMap:new Map(),
       materials:[],
       suppliers:[],
       unloadPointId:null,
@@ -298,39 +181,6 @@ export default {
     this.form1.resultLoadingDate=new Date();
   },
   methods: {
-    currentRadioChange1(selection) {
-      this.input = null;
-      this.materialName = selection.materialName;
-      this.materialId = selection.materialId;
-      if (this.matching) {
-        this.getPurchaseOrderNo();
-      }
-    },
-    currentRadioChange2(selection) {
-      this.supplierName = selection.supplierName;
-      this.supplierId = selection.supplierId;
-      if (this.matching) {
-        this.getPurchaseOrderNo();
-      }
-    },
-    currentRadioChange3(selection) {
-      this.unloadPointId = selection.warehouseId;
-      this.unloadPointName = selection.warehouseName;
-    },
-    ondrawer(num) {
-      this.drawer = true;
-      this.a = num;
-      if (num == 2) {
-        this.secend.requestUrl =
-          "/api/v1/uc/getSupplierMesByMaterialId?apiId=247&materialId=" +
-          this.materialId;
-      }
-    },
-    onBlur() {
-      if (this.matching) {
-        this.getPurchaseOrderNo();
-      }
-    },
     getPurchaseOrderNo() {
       console.log(this.matching);
       let map = {
@@ -362,39 +212,6 @@ export default {
         });
       }
     },
-    //发站弹出层
-    handleSelectSendStation(item) {
-      this.sendStationId = item.arrivalId;
-      this.sendStation = item.arrivalName;
-    },
-    //以下是发站边输边查搜索
-    querySearchSendStation(queryString, cb) {
-      this.axios
-        .get("/api/v1/uc/getArrivalByLike?index=" + this.sendStation)
-        .then((res) => {
-          if (res.data.code == "200") {
-            var restaurantsSupplier = res.data.data;
-            console.log(restaurantsSupplier)
-            var results = queryString
-              ? restaurantsSupplier.filter(
-                  this.createFilterSendStation(queryString)
-                )
-              : restaurantsSupplier;
-            // 调用 callback 返回建议列表的数据
-            cb(results);
-          }
-        });
-    },
-    //发站
-    createFilterSendStation(queryString) {
-      return (restaurantsSupplier) => {
-        return (
-          restaurantsSupplier.arrivalName
-            .toLowerCase()
-            .indexOf(queryString.toLowerCase()) > -1
-        );
-      };
-    },
     //到站弹出层
     handleSelectToTheStation(item) {
       this.toTheStationId = item.arrivalId;
@@ -428,98 +245,29 @@ export default {
         );
       };
     },
-    onClick(a) {
-      if (a == 1) {
-        this.frist.requestUrl =
-          "/api/v1/uc/queryAPOMaterialByLike?apiId=244&startNum=050&index=" +
-          this.inputText;
-      } else if (a == 2) {
-        this.secend.requestUrl =
-          "/api/v1/uc/getSupplierMesByMaterialId?apiId=247&materialId=" +
-          this.materialId +
-          "&index=" +
-          this.inputText;
-      } else if (a == 3) {
-        this.unloadPoint.requestUrl =
-          "/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 if (this.input.length < 7) {
+    // 确定
+    makeSure() {
+      let that=this;
+      this.isLoading=true;
+      if (this.tableData.length <= 0  || !this.toTheStationId || !this.form1.resultLoadingDate){
+        if (this.tableData.length <= 0) {
           this.$message({
             type: "warning",
-            message: "车皮号长度不足7位数,请重新输入!",
+            message: "请导入数据!",
           });
-        } else if (this.input.length > 7) {
+        } else if (!this.toTheStationId) {
           this.$message({
             type: "warning",
-            message: "车皮号长度超过7位数,请重新输入!",
+            message: "请选择到站!",
           });
-        }
-      }
-    },
-    onclick(index) {
-      this.list.splice(index, 1);
-    },
-    // 确定
-    makeSure() {
-      this.disable=true;
-      let that=this;
-      if (this.tableData.length <= 0  || !this.toTheStationId || this.form1.resultLoadingDate){
-        if (this.tableData.length <= 0) {
+        }else if (!this.form1.resultLoadingDate) {
           this.$message({
             type: "warning",
-            message: "请导入数据!",
+            message: "请选择装车时间!",
           });
-        } else {
-            this.disable=false;
-            if (this.toTheStationId) {
-              if (this.form1.resultLoadingDate) {
-              } else {
-                this.$message({
-                  type: "warning",
-                  message: "请选择装车时间!",
-                });
-              }
-            } else {
-              this.$message({
-                type: "warning",
-                message: "请选择到站!",
-              });
-            }
         }
+        this.isLoading=false;
+        return;
       }
       //绑定通用字段
       this.tableData.forEach((row)=>{
@@ -543,10 +291,15 @@ export default {
               type: "success",
               message: "新增成功",
             });
-            this.$router.push("/wagonLoadMine");
+            this.cancel();
+          }else{
+            this.$message({
+              type: "error", 
+              message: res.data.data,
+            });
           }
+          this.isLoading=false;
         });
-      
     },
     cancel() {
       this.$router.push("/wagonLoadMine");
@@ -560,95 +313,144 @@ export default {
           type: "warning",
         });
         return
+      }
+      this.tableData=[];
+      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]]);//只取第一页
+        let index=1;
+        for(index=1;index<rows.length;index++){
+          if(typeof workbook.Sheets[workbook.SheetNames[0]]['A'+index] !='undefined'){
+            index++;
+            break;
+           }
         }
-        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.disable=false;
-            that.tableData=[];
-            if((typeof rows[0]['车号'])=='undefined'){
-               that.$message({
-                message: "导入Excel格式错误,车号不能为空!",
+        console.log('表头行数:'+index);
+        //校验表头
+        if( workbook.Sheets[workbook.SheetNames[0]]['A'+index].v!='序号'
+        || workbook.Sheets[workbook.SheetNames[0]]['B'+index].v!='发站'
+        || workbook.Sheets[workbook.SheetNames[0]]['C'+index].v!='到站'
+        || workbook.Sheets[workbook.SheetNames[0]]['D'+index].v!='发货日期'
+        || workbook.Sheets[workbook.SheetNames[0]]['E'+index].v!='到货日期'
+        || workbook.Sheets[workbook.SheetNames[0]]['F'+index].v!='卸货地点'
+        || workbook.Sheets[workbook.SheetNames[0]]['G'+index].v!='品名'
+        || (workbook.Sheets[workbook.SheetNames[0]]['I'+index].v!='计费\n吨位'
+        && workbook.Sheets[workbook.SheetNames[0]]['I'+index].v!='计费吨位'
+        && workbook.Sheets[workbook.SheetNames[0]]['I'+index].v!='计费&#10;吨位')
+        || workbook.Sheets[workbook.SheetNames[0]]['J'+index].v!='车号'
+        || workbook.Sheets[workbook.SheetNames[0]]['K'+index].v!='计量吨位'
+        || workbook.Sheets[workbook.SheetNames[0]]['L'+index].v!='计费吨位合计'){
+          if(workbook.Sheets[workbook.SheetNames[0]]['A'+index].v!='序号'){
+             that.$message({
+                message: "表格格式错误:序号错误",
                 type: "warning",
-              });
-              return;
-            }
-            if((typeof rows[0]['品  名'])=='undefined' && (typeof rows[0]['品名'])=='undefined' && (typeof rows[0]['物资'])=='undefined'){
-               that.$message({
-                message: "导入Excel格式错误,品名不能为空!",
+            });
+          }else if(workbook.Sheets[workbook.SheetNames[0]]['B'+index].v!='发站'){
+             that.$message({
+                message: "表格格式错误:发站错误",
                 type: "warning",
-              });
-              return;
-            }
-            if((typeof rows[0]['发货单位'])=='undefined'){
-               that.$message({
-                message: "导入Excel格式错误,发货单位不能为空!",
+            });
+          }else if(workbook.Sheets[workbook.SheetNames[0]]['C'+index].v!='到站'){
+             that.$message({
+                message: "表格格式错误:到站错误",
                 type: "warning",
-              });
-              return;
+            });
+          }else if(workbook.Sheets[workbook.SheetNames[0]]['D'+index].v!='发货日期'){
+             that.$message({
+                message: "表格格式错误:发货日期错误",
+                type: "warning",
+            });
+          }else if(workbook.Sheets[workbook.SheetNames[0]]['E'+index].v!='到货日期'){
+             that.$message({
+                message: "表格格式错误:到货日期错误",
+                type: "warning",
+            });
+          }else if(workbook.Sheets[workbook.SheetNames[0]]['F'+index].v!='卸货地点'){
+             that.$message({
+                message: "表格格式错误:卸货地点错误",
+                type: "warning",
+            });
+          }else if(workbook.Sheets[workbook.SheetNames[0]]['G'+index].v!='品名'){
+             that.$message({
+                message: "表格格式错误:品名错误",
+                type: "warning",
+            });
+          }else if(workbook.Sheets[workbook.SheetNames[0]]['I'+index].v!='计费\n吨位' 
+          && workbook.Sheets[workbook.SheetNames[0]]['I'+index].v!='计费吨位'
+          && workbook.Sheets[workbook.SheetNames[0]]['I'+index].v!='计费&#10;吨位'){
+             that.$message({
+                message: "表格格式错误:计费吨位错误",
+                type: "warning",
+            });
+          }else if(workbook.Sheets[workbook.SheetNames[0]]['J'+index].v!='车号'){
+             that.$message({
+                message: "表格格式错误:车号错误",
+                type: "warning",
+            });
+          }else if(workbook.Sheets[workbook.SheetNames[0]]['K'+index].v!='计量吨位'){
+             that.$message({
+                message: "表格格式错误:计量吨位错误",
+                type: "warning",
+            });
+          }else if(workbook.Sheets[workbook.SheetNames[0]]['L'+index].v!='计费吨位合计'){
+             that.$message({
+                message: "表格格式错误:计费吨位合计错误",
+                type: "warning",
+            });
+          }
+          return;
+        }
+        //读取表格
+        for(let i=1;i<=rows.length+1;i++){
+          let row=workbook.Sheets[workbook.SheetNames[0]]['A'+i];
+          if(row!='undefined' && row!=null && typeof row.v=='number' 
+              && workbook.Sheets[workbook.SheetNames[0]]['B'+i]!='undefined'
+            && workbook.Sheets[workbook.SheetNames[0]]['B'+i]!=null
+              && workbook.Sheets[workbook.SheetNames[0]]['C'+i]!='undefined'
+            && workbook.Sheets[workbook.SheetNames[0]]['C'+i]!=null
+              && workbook.Sheets[workbook.SheetNames[0]]['D'+i]!='undefined'
+            && workbook.Sheets[workbook.SheetNames[0]]['D'+i]!=null
+              && workbook.Sheets[workbook.SheetNames[0]]['E'+i]!='undefined'
+            && workbook.Sheets[workbook.SheetNames[0]]['E'+i]!=null
+              && workbook.Sheets[workbook.SheetNames[0]]['F'+i]!='undefined'
+            && workbook.Sheets[workbook.SheetNames[0]]['F'+i]!=null
+              && workbook.Sheets[workbook.SheetNames[0]]['G'+i]!='undefined'
+            && workbook.Sheets[workbook.SheetNames[0]]['G'+i]!=null
+              && workbook.Sheets[workbook.SheetNames[0]]['J'+i]!='undefined'
+            && workbook.Sheets[workbook.SheetNames[0]]['J'+i]!=null){
+            let tableRow={
+              sendStation:workbook.Sheets[workbook.SheetNames[0]]['B'+i].v,
+              arrivalStation:workbook.Sheets[workbook.SheetNames[0]]['C'+i].v,
+              sendDate:sjTime(workbook.Sheets[workbook.SheetNames[0]]['D'+i].v),
+              arrivalDate:workbook.Sheets[workbook.SheetNames[0]]['E'+i].v,
+              unloadPoint:workbook.Sheets[workbook.SheetNames[0]]['F'+i].v,
+              productName:workbook.Sheets[workbook.SheetNames[0]]['G'+i].v,
+              wagonNo:workbook.Sheets[workbook.SheetNames[0]]['J'+i].v,
+              weight:workbook.Sheets[workbook.SheetNames[0]]['I'+i].v,
+              mineral:workbook.Sheets[workbook.SheetNames[0]]['H'+i].v,
             }
-            if((typeof rows[0]['发站']) =='undefined'){
-               that.$message({
-                message: "导入Excel格式错误,发站不能为空!",
+            if((tableRow.wagonNo+"").length!=7){
+              that.$message({
+                message: "存在车皮号长度不等于7:"+tableRow.wagonNo,
                 type: "warning",
               });
-              return;
+              continue;
             }
+            that.tableData.push(tableRow);
           }
-          //绑定数据
-          rows.forEach((row,index) => {
-            let carNumber=row['车号'];
-            let currentRow=index+1;
-            if((typeof carNumber)!="undefined" && carNumber.length == 7){
-              //表格数据
-              let temp={
-                number:row['序号'],
-                materialName:row['品  名'],
-                supplierName:row['发货单位'],
-                sendDate:row['发货日期'],
-                sendStation:row['发站'],
-                arrivalStation:row['到站'],
-                wagonNo:row['车号'],
-                weight:row['标重']
-              }
-              if(typeof temp.materialName=='undefined' || temp.materialName==null){
-                temp.materialName=row['品名'];
-              }
-              if(typeof temp.materialName=='undefined' || temp.materialName==null){
-                temp.materialName=row['物资'];
-              }
-              //判断校验
-              if((typeof temp.wagonNo)=='undefined' ||
-                  (typeof temp.materialName)=='undefined'||
-                  (typeof temp.supplierName)=='undefined'||
-                  (typeof temp.sendStation)=='undefined'){
-                console.log("数据异常:");
-                console.log(row);
-                return;//退出当前循环,不导入表格
-              }
-              
-              that.tableData.push(temp);
-            }
-            else{
-              console.log("第"+currentRow+ "行车皮号异常!");
-              return;
-            }
-        });
-        };
-        reader.readAsBinaryString(file.raw); //以二进制方式读取
+        }
+        console.log(that.tableData);
+      };
+      reader.readAsBinaryString(file.raw); //以二进制方式读取
     },
   },
 };

+ 203 - 449
src/views/TMS/components/importedEmergency/addWagonLoadEmergency.vue

@@ -1,47 +1,7 @@
 <template>
-  <!-- 海港-老区轨道衡新增装车  -->
+  <!-- 海港-老区轨道衡新增装车2 -->
   <div class="addWagonLoad">
     <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;"
@@ -55,18 +15,12 @@
       </el-upload>
       <span >当前导入数量:{{tableData.length}}</span>
     </div>
-    <div>
-      <span style="color:red">导入数据中的 车皮号 是必须的</span>
-    </div>
-    <div class="table item"
-        style="width:680px;
-        height:300px;
-        float:left;
-        overflow:auto" >
+    <div class="table item">
       <el-table
         stripe
         :data="tableData"
-        style="width: 100%">
+        style="width: 100%"
+        id="domesticTable">
         <el-table-column
         type="index"
         width="50"
@@ -78,86 +32,48 @@
         </el-table-column>
         <el-table-column
         align="center"
-          prop="makeDate"
-          label="制票日期"
-          width="120px">
+          prop="productName"
+          label="品  名"
+          width="240px">
+        </el-table-column>
+        <el-table-column
+        align="center"
+          prop="mineral"
+          label="矿种"
+          width="100px">
         </el-table-column>
         <el-table-column
         align="center"
           prop="wagonNo"
-          label="车皮号"
-          width="120px">
+          label="车号"
+          width="180px">
         </el-table-column>
         <el-table-column
         align="center"
-          prop="materialName"
-          label="物资"
+          prop="unloadPoint"
+          label="卸货地点"
           width="180px">
         </el-table-column>
         <el-table-column
         align="center"
-          prop="mineral"
-          label="矿种"
-          width="120px">
+          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="80px"
+        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="cp">
-      <span style="width:80px">车皮号:</span>
-      <el-input
-        placeholder="请输入内容"
-        v-model="input"
-        @change="onchang"
-        clearable
-      >
-      </el-input>
-    </div>
-    <div class="cpList">
-      <div class="list">
-        <span 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 class="material from">
-      <span class="text">物资:</span>
-      <el-input v-model="materialName" disabled> </el-input>
-      <el-button type="primary" @click="ondrawer(1)">浏览</el-button>
-    </div>
-
-    <div class="forwardingUnit from">
-      <span class="text">发货单位:</span>
-      <el-input v-model="supplierName" disabled> </el-input>
-      <el-button type="primary" @click="ondrawer(2)">浏览</el-button>
-    </div>
-    <div class="remark from">
-      <span class="text">船名:</span>
-      <el-input class="el-input" v-model="remark" @blur="onBlur"> </el-input>
-      <span class="span"></span>
-    </div>
-    <div class="forwardingUnit from">
-      <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;">
@@ -195,50 +111,14 @@
                   </el-form-item>
                </div>
           </el-form>
-            <dil-form :formId="102" v-model="form1" ref="from1"></dil-form>
+            <dil-form :formId="387" 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>
+          <el-button type="primary" :loading="isLoading" @click="makeSure">确定</el-button>
         </div>
     </div>
-    
-    <!-- 模态窗口 -->
-    <el-drawer :visible.sync="drawer" :direction="direction" size="30%">
-      <el-input
-        placeholder="请输入内容"
-        v-model="inputText"
-        style="margin-top: 0.625rem; margin-left: 1.25rem;width:250px"
-        clearable
-      ></el-input>
-      <el-button
-        type="primary"
-        class="btn"
-        @click="onClick(a)"
-        style="margin-bottom: 0.9375rem"
-      >
-        <i class="el-icon-search"></i>查询
-      </el-button>
-      <div v-show="a == 1">
-        <dilTable
-          v-bind.sync="frist"
-          @radio-change="currentRadioChange1"
-        ></dilTable>
-      </div>
-      <div v-show="a == 2">
-        <dilTable
-          v-bind.sync="secend"
-          @radio-change="currentRadioChange2"
-        ></dilTable>
-      </div>
-      <div v-show="a == 4">
-        <dilTable
-          v-bind.sync="unloadPoint"
-          @radio-change="currentRadioChange4"
-        ></dilTable>
-      </div>
-    </el-drawer>
   </div>
 </template>
 
@@ -250,7 +130,7 @@ export default {
   components: { PageTitle },
   data() {
     return {
-      disable:true,
+      isLoading:false,
       list: [],
       form1: {},
       tableData:[],
@@ -280,28 +160,6 @@ export default {
       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",
-        mapList1: [],
-      },
-      secend: {
-        requestUrl:
-          "/api/v1/uc/getSupplierMesByMaterialId?apiId=247&materialId=",
-        selectionType: "radio",
-        mapList2: [],
-      },
-      unloadPoint: {
-        requestUrl: "/api/v1/uc/getUnloadingMesByLike?apiId=374",
-        selectionType: "radio",
-      },
       sendStationId:2,
       toTheStationId:1,
       sendStation:"万州港",
@@ -312,79 +170,6 @@ export default {
     this.form1.resultLoadingDate=new Date();
   },
   methods: {
-    currentRadioChange1(selection) {
-      this.input = null;
-      this.materialName = selection.materialName;
-      this.materialId = selection.materialId;
-      this.getPurchaseOrderNo();
-    },
-    currentRadioChange2(selection) {
-      this.supplierName = selection.supplierName;
-      this.supplierId = selection.supplierId;
-      this.getPurchaseOrderNo();
-    },
-    currentRadioChange4(selection) {
-      this.unloadPointId = selection.warehouseId;
-      this.unloadPointName = selection.warehouseName;
-    },
-    ondrawer(num) {
-      this.drawer = true;
-      this.a = num;
-      if (num == 2) {
-        this.secend.requestUrl =
-          "/api/v1/uc/getSupplierMesByMaterialId?apiId=247&materialId=" +
-          this.materialId;
-      }
-    },
-    onBlur() {
-      this.getPurchaseOrderNo();
-    },
-    getPurchaseOrderNo() {
-      let map = {
-        materialId: this.materialId,
-        supplierId: this.supplierId,
-      };
-      if (this.remark) {
-        map.remark = this.remark;
-      }
-      console.log(this.map);
-      if (this.materialId && this.supplierId) {
-        this.axios.post("/api/v1/oms/selectNewOrderId", map).then((res) => {
-          console.log(res);
-          if (res.data.code == "200") {
-            if (res.data.data == null) {
-              this.$message({
-                message: "没有匹配的采购订单号!",
-                type: "warning",
-              });
-              this.form1 = [];
-            } else {
-              this.remark = res.data.data.remark;
-              this.purchaseOrderId = res.data.data.purchaseOrderId;
-              this.form1 = { purchaseOrderNo: res.data.data.purchaseOrderNo };
-            }
-          } else {
-            this.$message.error("请求失败");
-          }
-        });
-      }
-    },
-    onClick(a) {
-      if (a == 1) {
-        this.frist.requestUrl =
-          "/api/v1/uc/queryAPOMaterialByLike?apiId=244&startNum=050&index=" +
-          this.inputText;
-      } else if (a == 2) {
-        this.secend.requestUrl =
-          "/api/v1/uc/getSupplierMesByMaterialId?apiId=247&materialId=" +
-          this.materialId +
-          "&index=" +
-          this.inputText;
-      } else if (a == 4) {
-        this.unloadPoint.requestUrl =
-          "/api/v1/uc/getUnloadingMesByLike?apiId=374&index=" + this.inputText;
-      }
-    },
     //发站弹出层
     handleSelectSendStation(item) {
       this.sendStationId = item.arrivalId;
@@ -451,170 +236,53 @@ 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 {
+    // 确定
+    makeSure() {
+      this.isLoading=true;
+      if (this.tableData.length <= 0  || 
+          !this.sendStationId ||
+          !this.toTheStationId ||
+          !this.form1.resultLoadingDate){
+        if (this.tableData.length <= 0) {
           this.$message({
             type: "warning",
-            message: "车皮号长度不足7位数,请重新输入!",
+            message: "请导入数据!",
           });
-        }
-      }
-    },
-    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.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) {
+        }else{
           this.$message({
             type: "warning",
-            message: "请输入车皮号!",
+            message: "除备注外皆为必填!",
           });
-        } else {
-          if (this.materialId) {
-                if (this.purchaseOrderId) {
-                  if (this.form1.resultIsclear) {
-                    if (this.form1.resultClass) {
-                      if (this.sendStationId) {
-                        if (this.toTheStationId) {
-                          if (this.form1.resultLoadingDate) {
-                          } 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 {
-                  this.$message({
-                    type: "warning",
-                    message: "请选择采购订单号!",
-                  });
-                }
-            }  else {
-            this.$message({
-              type: "warning",
-              message: "请选择采购订单号!",
-            });
-          }
+          this.isLoading=false;
+          return;
         }
       }
-      if(state == 1){
-        let map = {
-          wagonNoList:this.list,
-          // unloadingPointId:this.unloadPointId,
-          purchaseOrderRailPlanId:this.purchaseOrderId,
-          materialId:this.materialId,
-          sendUnitId:this.supplierId,
-          resultIsclear:this.form1.resultIsclear,
-          resultClass: this.form1.resultClass,
-          sendStationId: this.sendStationId,
-          arrivalStationId: this.toTheStationId,
-          resultLoadingDate: sjTime(this.form1.resultLoadingDate),
-          resultRemarks: this.form1.resultRemarks,
-          userId:getCookie("userId"),
-          resultType:2,
-        }
-        console.log(map);
-        this.axios.post('/api/v1/tms/insertTmstrainLoadingResult',map).then((res)=>{
-          console.log(res);
-          if(res.data.code == "200"){
-            this.$message({
-              type: "success",
-              message: "新增成功",
-            });
-            this.cancel();
-          }
-        })
+      let map = {
+        list:this.tableData,
+        sendStationId: this.sendStationId,
+        arrivalStationId: this.toTheStationId,
+        resultLoadingDate: sjTime(this.form1.resultLoadingDate),
+        resultRemarks: this.form1.resultRemarks,
+        userId:getCookie("userId"),
+        resultType:2,
       }
+      console.log(map);
+      this.axios.post('/api/v1/tms/insertTmstrainLoadingResult',map).then((res)=>{
+        console.log(res);
+        if(res.data.code == "200"){
+          this.$message({
+            type: "success",
+            message: "新增成功",
+          });
+          this.cancel();
+        }else {
+          this.$message({
+              type: "error", 
+              message: res.data.data,
+          });
+        }
+        this.isLoading=false;
+      })
     },
     // 取消
     cancel() {
@@ -629,67 +297,153 @@ export default {
           type: "warning",
         });
         return
+      }
+      this.tableData=[];
+      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]]);//只取第一页
+        let index=1;
+        for(index=1;index<rows.length;index++){
+          if(typeof workbook.Sheets[workbook.SheetNames[0]]['A'+index] !='undefined'){
+            index++;
+            break;
+           }
         }
-        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'){
+        console.log('表头行数:'+index);
+        //校验表头
+        if( workbook.Sheets[workbook.SheetNames[0]]['A'+index].v!='序号'
+        || workbook.Sheets[workbook.SheetNames[0]]['B'+index].v!='发站'
+        || workbook.Sheets[workbook.SheetNames[0]]['C'+index].v!='到站'
+        || workbook.Sheets[workbook.SheetNames[0]]['D'+index].v!='发货日期'
+        || workbook.Sheets[workbook.SheetNames[0]]['E'+index].v!='到货日期'
+        || workbook.Sheets[workbook.SheetNames[0]]['F'+index].v!='卸货地点'
+        || workbook.Sheets[workbook.SheetNames[0]]['G'+index].v!='品名'
+        || (workbook.Sheets[workbook.SheetNames[0]]['I'+index].v!='计费\n吨位'
+        && workbook.Sheets[workbook.SheetNames[0]]['I'+index].v!='计费吨位'
+        && workbook.Sheets[workbook.SheetNames[0]]['I'+index].v!='计费&#10;吨位')
+        || workbook.Sheets[workbook.SheetNames[0]]['J'+index].v!='车号'
+        || workbook.Sheets[workbook.SheetNames[0]]['K'+index].v!='计量吨位'
+        || workbook.Sheets[workbook.SheetNames[0]]['L'+index].v!='计费吨位合计'){
+          if(workbook.Sheets[workbook.SheetNames[0]]['A'+index].v!='序号'){
+             that.$message({
+                message: "表格格式错误:序号错误",
+                type: "warning",
+            });
+          }else if(workbook.Sheets[workbook.SheetNames[0]]['B'+index].v!='发站'){
+             that.$message({
+                message: "表格格式错误:发站错误",
+                type: "warning",
+            });
+          }else if(workbook.Sheets[workbook.SheetNames[0]]['C'+index].v!='到站'){
+             that.$message({
+                message: "表格格式错误:到站错误",
+                type: "warning",
+            });
+          }else if(workbook.Sheets[workbook.SheetNames[0]]['D'+index].v!='发货日期'){
+             that.$message({
+                message: "表格格式错误:发货日期错误",
+                type: "warning",
+            });
+          }else if(workbook.Sheets[workbook.SheetNames[0]]['E'+index].v!='到货日期'){
+             that.$message({
+                message: "表格格式错误:到货日期错误",
+                type: "warning",
+            });
+          }else if(workbook.Sheets[workbook.SheetNames[0]]['F'+index].v!='卸货地点'){
+             that.$message({
+                message: "表格格式错误:卸货地点错误",
+                type: "warning",
+            });
+          }else if(workbook.Sheets[workbook.SheetNames[0]]['G'+index].v!='品名'){
+             that.$message({
+                message: "表格格式错误:品名错误",
+                type: "warning",
+            });
+          }else if(workbook.Sheets[workbook.SheetNames[0]]['I'+index].v!='计费\n吨位' 
+          && workbook.Sheets[workbook.SheetNames[0]]['I'+index].v!='计费吨位'
+          && workbook.Sheets[workbook.SheetNames[0]]['I'+index].v!='计费&#10;吨位'){
+             that.$message({
+                message: "表格格式错误:计费吨位错误",
+                type: "warning",
+            });
+          }else if(workbook.Sheets[workbook.SheetNames[0]]['J'+index].v!='车号'){
+             that.$message({
+                message: "表格格式错误:车号错误",
+                type: "warning",
+            });
+          }else if(workbook.Sheets[workbook.SheetNames[0]]['K'+index].v!='计量吨位'){
+             that.$message({
+                message: "表格格式错误:计量吨位错误",
+                type: "warning",
+            });
+          }else if(workbook.Sheets[workbook.SheetNames[0]]['L'+index].v!='计费吨位合计'){
+             that.$message({
+                message: "表格格式错误:计费吨位合计错误",
+                type: "warning",
+            });
+          }
+          return;
+        }
+        //读取表格
+        for(let i=1;i<=rows.length+1;i++){
+          let row=workbook.Sheets[workbook.SheetNames[0]]['A'+i];
+          if(row!='undefined' && row!=null && typeof row.v=='number' 
+              && workbook.Sheets[workbook.SheetNames[0]]['B'+i]!='undefined'
+            && workbook.Sheets[workbook.SheetNames[0]]['B'+i]!=null
+              && workbook.Sheets[workbook.SheetNames[0]]['C'+i]!='undefined'
+            && workbook.Sheets[workbook.SheetNames[0]]['C'+i]!=null
+              && workbook.Sheets[workbook.SheetNames[0]]['D'+i]!='undefined'
+            && workbook.Sheets[workbook.SheetNames[0]]['D'+i]!=null
+              && workbook.Sheets[workbook.SheetNames[0]]['E'+i]!='undefined'
+            && workbook.Sheets[workbook.SheetNames[0]]['E'+i]!=null
+              && workbook.Sheets[workbook.SheetNames[0]]['F'+i]!='undefined'
+            && workbook.Sheets[workbook.SheetNames[0]]['F'+i]!=null
+              && workbook.Sheets[workbook.SheetNames[0]]['G'+i]!='undefined'
+            && workbook.Sheets[workbook.SheetNames[0]]['G'+i]!=null
+              && workbook.Sheets[workbook.SheetNames[0]]['J'+i]!='undefined'
+            && workbook.Sheets[workbook.SheetNames[0]]['J'+i]!=null){
+            let tableRow={
+              sendStation:workbook.Sheets[workbook.SheetNames[0]]['B'+i].v,
+              arrivalStation:workbook.Sheets[workbook.SheetNames[0]]['C'+i].v,
+              sendDate:sjTime(workbook.Sheets[workbook.SheetNames[0]]['D'+i].v),
+              arrivalDate:workbook.Sheets[workbook.SheetNames[0]]['E'+i].v,
+              unloadPoint:workbook.Sheets[workbook.SheetNames[0]]['F'+i].v,
+              productName:workbook.Sheets[workbook.SheetNames[0]]['G'+i].v,
+              wagonNo:workbook.Sheets[workbook.SheetNames[0]]['J'+i].v,
+              weight:workbook.Sheets[workbook.SheetNames[0]]['I'+i].v,
+              mineral:workbook.Sheets[workbook.SheetNames[0]]['H'+i].v,
+            }
+            if((tableRow.wagonNo+"").length!=7){
               that.$message({
-                message: "车皮号不存在!请参考下方格式!",
+                message: "存在车皮号长度不等于7:"+tableRow.wagonNo,
                 type: "warning",
               });
-              return;
+              continue;
             }
+            that.tableData.push(tableRow);
           }
-          //绑定数据
-          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{
-              let errorNumb=index+1;
-              console.log("第"+errorNumb+ "行车皮号异常!");
-              return;
-            }
-        });
-        };
-        reader.readAsBinaryString(file.raw); //以二进制方式读取
+        }
+        console.log(that.tableData);
+      };
+      reader.readAsBinaryString(file.raw); //以二进制方式读取
     },
     //采购订单表格选中
     orderChange(selection){
       console.log(selection);
       this.purchaseOrderId=selection.purchaseOrderId;
       this.form1 = { 
-        purchaseOrderNo: selection.purchaseOrderNo ,
-        resultLoadingDate:new Date() };
+        purchaseOrderNo: selection.purchaseOrderNo,
+        resultLoadingDate:new Date() 
+        };
       this.materialId=selection.materialId;
       this.materialName=selection.materialName;
       this.supplierId=selection.supplierId;

+ 200 - 447
src/views/TMS/components/importedMine/addWagonLoad.vue

@@ -1,47 +1,7 @@
 <template>
-  <!-- 万州港-达州新增装车 -->
+  <!-- 万州港-达州新增装车1 -->
   <div class="addWagonLoad">
     <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;"
@@ -55,18 +15,12 @@
       </el-upload>
       <span >当前导入数量:{{tableData.length}}</span>
     </div>
-    <div>
-      <span style="color:red">导入数据中的 车皮号 是必须的</span>
-    </div>
-    <div class="table item"
-        style="width:680px;
-        height:300px;
-        float:left;
-        overflow:auto" >
+    <div class="table item">
       <el-table
         stripe
         :data="tableData"
-        style="width: 100%">
+        style="width: 100%"
+        id="domesticTable">
         <el-table-column
         type="index"
         width="50"
@@ -78,86 +32,48 @@
         </el-table-column>
         <el-table-column
         align="center"
-          prop="makeDate"
-          label="制票日期"
-          width="120px">
+          prop="productName"
+          label="品  名"
+          width="240px">
+        </el-table-column>
+        <el-table-column
+        align="center"
+          prop="mineral"
+          label="矿种"
+          width="100px">
         </el-table-column>
         <el-table-column
         align="center"
           prop="wagonNo"
-          label="车皮号"
-          width="120px">
+          label="车号"
+          width="180px">
         </el-table-column>
         <el-table-column
         align="center"
-          prop="materialName"
-          label="物资"
+          prop="unloadPoint"
+          label="卸货地点"
           width="180px">
         </el-table-column>
         <el-table-column
         align="center"
-          prop="mineral"
-          label="矿种"
-          width="120px">
+          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="80px"
+        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="cp">
-      <span style="width:80px">车皮号:</span>
-      <el-input
-        placeholder="请输入内容"
-        v-model="input"
-        @change="onchang"
-        clearable
-      >
-      </el-input>
-    </div>
-    <div class="cpList">
-      <div class="list">
-        <span 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 class="material from">
-      <span class="text">物资:</span>
-      <el-input v-model="materialName" disabled> </el-input>
-      <el-button type="primary" @click="ondrawer(1)">浏览</el-button>
-    </div>
-
-    <div class="forwardingUnit from">
-      <span class="text">发货单位:</span>
-      <el-input v-model="supplierName" disabled> </el-input>
-      <el-button type="primary" @click="ondrawer(2)">浏览</el-button>
-    </div>
-    <div class="remark from">
-      <span class="text">船名:</span>
-      <el-input class="el-input" v-model="remark" @blur="onBlur"> </el-input>
-      <span class="span"></span>
-    </div>
-    <div class="forwardingUnit from">
-      <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;">
@@ -195,50 +111,14 @@
                   </el-form-item>
                </div>
           </el-form>
-            <dil-form :formId="102" v-model="form1" ref="from1"></dil-form>
+            <dil-form :formId="387" 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>
+          <el-button type="primary" :loading="isLoading" @click="makeSure">确定</el-button>
         </div>
     </div>
-    
-    <!-- 模态窗口 -->
-    <el-drawer :visible.sync="drawer" :direction="direction" size="30%">
-      <el-input
-        placeholder="请输入内容"
-        v-model="inputText"
-        style="margin-top: 0.625rem; margin-left: 1.25rem;width:250px"
-        clearable
-      ></el-input>
-      <el-button
-        type="primary"
-        class="btn"
-        @click="onClick(a)"
-        style="margin-bottom: 0.9375rem"
-      >
-        <i class="el-icon-search"></i>查询
-      </el-button>
-      <div v-show="a == 1">
-        <dilTable
-          v-bind.sync="frist"
-          @radio-change="currentRadioChange1"
-        ></dilTable>
-      </div>
-      <div v-show="a == 2">
-        <dilTable
-          v-bind.sync="secend"
-          @radio-change="currentRadioChange2"
-        ></dilTable>
-      </div>
-      <div v-show="a == 4">
-        <dilTable
-          v-bind.sync="unloadPoint"
-          @radio-change="currentRadioChange4"
-        ></dilTable>
-      </div>
-    </el-drawer>
   </div>
 </template>
 
@@ -250,7 +130,7 @@ export default {
   components: { PageTitle },
   data() {
     return {
-      disable:true,
+      isLoading:false,
       list: [],
       form1: {},
       tableData:[],
@@ -280,28 +160,6 @@ export default {
       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",
-        mapList1: [],
-      },
-      secend: {
-        requestUrl:
-          "/api/v1/uc/getSupplierMesByMaterialId?apiId=247&materialId=",
-        selectionType: "radio",
-        mapList2: [],
-      },
-      unloadPoint: {
-        requestUrl: "/api/v1/uc/getUnloadingMesByLike?apiId=374",
-        selectionType: "radio",
-      },
       sendStationId:2,
       toTheStationId:1,
       sendStation:"万州港",
@@ -312,79 +170,6 @@ export default {
     this.form1.resultLoadingDate=new Date();
   },
   methods: {
-    currentRadioChange1(selection) {
-      this.input = null;
-      this.materialName = selection.materialName;
-      this.materialId = selection.materialId;
-      this.getPurchaseOrderNo();
-    },
-    currentRadioChange2(selection) {
-      this.supplierName = selection.supplierName;
-      this.supplierId = selection.supplierId;
-      this.getPurchaseOrderNo();
-    },
-    currentRadioChange4(selection) {
-      this.unloadPointId = selection.warehouseId;
-      this.unloadPointName = selection.warehouseName;
-    },
-    ondrawer(num) {
-      this.drawer = true;
-      this.a = num;
-      if (num == 2) {
-        this.secend.requestUrl =
-          "/api/v1/uc/getSupplierMesByMaterialId?apiId=247&materialId=" +
-          this.materialId;
-      }
-    },
-    onBlur() {
-      this.getPurchaseOrderNo();
-    },
-    getPurchaseOrderNo() {
-      let map = {
-        materialId: this.materialId,
-        supplierId: this.supplierId,
-      };
-      if (this.remark) {
-        map.remark = this.remark;
-      }
-      console.log(this.map);
-      if (this.materialId && this.supplierId) {
-        this.axios.post("/api/v1/oms/selectNewOrderId", map).then((res) => {
-          console.log(res);
-          if (res.data.code == "200") {
-            if (res.data.data == null) {
-              this.$message({
-                message: "没有匹配的采购订单号!",
-                type: "warning",
-              });
-              this.form1 = [];
-            } else {
-              this.remark = res.data.data.remark;
-              this.purchaseOrderId = res.data.data.purchaseOrderId;
-              this.form1 = { purchaseOrderNo: res.data.data.purchaseOrderNo };
-            }
-          } else {
-            this.$message.error("请求失败");
-          }
-        });
-      }
-    },
-    onClick(a) {
-      if (a == 1) {
-        this.frist.requestUrl =
-          "/api/v1/uc/queryAPOMaterialByLike?apiId=244&startNum=050&index=" +
-          this.inputText;
-      } else if (a == 2) {
-        this.secend.requestUrl =
-          "/api/v1/uc/getSupplierMesByMaterialId?apiId=247&materialId=" +
-          this.materialId +
-          "&index=" +
-          this.inputText;
-      } else if (a == 4) {
-        this.unloadPoint.requestUrl =
-          "/api/v1/uc/getUnloadingMesByLike?apiId=374&index=" + this.inputText;
-      }
-    },
     //发站弹出层
     handleSelectSendStation(item) {
       this.sendStationId = item.arrivalId;
@@ -451,170 +236,53 @@ 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 {
+    // 确定
+    makeSure() {
+      this.isLoading=true;
+      if (this.tableData.length <= 0  || 
+          !this.sendStationId ||
+          !this.toTheStationId ||
+          !this.form1.resultLoadingDate){
+        if (this.tableData.length <= 0) {
           this.$message({
             type: "warning",
-            message: "车皮号长度不足7位数,请重新输入!",
+            message: "请导入数据!",
           });
-        }
-      }
-    },
-    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.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) {
+        }else{
           this.$message({
             type: "warning",
-            message: "请输入车皮号!",
+            message: "除备注外皆为必填!",
           });
-        } else {
-          if (this.materialId) {
-                if (this.purchaseOrderId) {
-                  if (this.form1.resultIsclear) {
-                    if (this.form1.resultClass) {
-                      if (this.sendStationId) {
-                        if (this.toTheStationId) {
-                          if (this.form1.resultLoadingDate) {
-                          } 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 {
-                  this.$message({
-                    type: "warning",
-                    message: "请选择采购订单号!",
-                  });
-                }
-            }  else {
-            this.$message({
-              type: "warning",
-              message: "请选择采购订单号!",
-            });
-          }
+          this.isLoading=false;
+          return;
         }
       }
-      if(state == 1){
-        let map = {
-          wagonNoList:this.list,
-          // unloadingPointId:this.unloadPointId,
-          purchaseOrderRailPlanId:this.purchaseOrderId,
-          materialId:this.materialId,
-          sendUnitId:this.supplierId,
-          resultIsclear:this.form1.resultIsclear,
-          resultClass: this.form1.resultClass,
-          sendStationId: this.sendStationId,
-          arrivalStationId: this.toTheStationId,
-          resultLoadingDate: sjTime(this.form1.resultLoadingDate),
-          resultRemarks: this.form1.resultRemarks,
-          userId:getCookie("userId"),
-          resultType:1,
-        }
-        console.log(map);
-        this.axios.post('/api/v1/tms/insertTmstrainLoadingResult',map).then((res)=>{
-          console.log(res);
-          if(res.data.code == "200"){
-            this.$message({
-              type: "success",
-              message: "新增成功",
-            });
-            this.cancel();
-          }
-        })
+      let map = {
+        list:this.tableData,
+        sendStationId: this.sendStationId,
+        arrivalStationId: this.toTheStationId,
+        resultLoadingDate: sjTime(this.form1.resultLoadingDate),
+        resultRemarks: this.form1.resultRemarks,
+        userId:getCookie("userId"),
+        resultType:1,
       }
+      console.log(map);
+      this.axios.post('/api/v1/tms/insertTmstrainLoadingResult',map).then((res)=>{
+        console.log(res);
+        if(res.data.code == "200"){
+          this.$message({
+            type: "success",
+            message: "新增成功",
+          });
+          this.cancel();
+        }else {
+          this.$message({
+              type: "error", 
+              message: res.data.data,
+          });
+        }
+        this.isLoading=false;
+      })
     },
     // 取消
     cancel() {
@@ -629,59 +297,144 @@ export default {
           type: "warning",
         });
         return
+      }
+      this.tableData=[];
+      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]]);//只取第一页
+        let index=1;
+        for(index=1;index<rows.length;index++){
+          if(typeof workbook.Sheets[workbook.SheetNames[0]]['A'+index] !='undefined'){
+            index++;
+            break;
+           }
         }
-        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'){
+        console.log('表头行数:'+index);
+        //校验表头
+        if( workbook.Sheets[workbook.SheetNames[0]]['A'+index].v!='序号'
+        || workbook.Sheets[workbook.SheetNames[0]]['B'+index].v!='发站'
+        || workbook.Sheets[workbook.SheetNames[0]]['C'+index].v!='到站'
+        || workbook.Sheets[workbook.SheetNames[0]]['D'+index].v!='发货日期'
+        || workbook.Sheets[workbook.SheetNames[0]]['E'+index].v!='到货日期'
+        || workbook.Sheets[workbook.SheetNames[0]]['F'+index].v!='卸货地点'
+        || workbook.Sheets[workbook.SheetNames[0]]['G'+index].v!='品名'
+        || (workbook.Sheets[workbook.SheetNames[0]]['I'+index].v!='计费\n吨位'
+        && workbook.Sheets[workbook.SheetNames[0]]['I'+index].v!='计费吨位'
+        && workbook.Sheets[workbook.SheetNames[0]]['I'+index].v!='计费&#10;吨位')
+        || workbook.Sheets[workbook.SheetNames[0]]['J'+index].v!='车号'
+        || workbook.Sheets[workbook.SheetNames[0]]['K'+index].v!='计量吨位'
+        || workbook.Sheets[workbook.SheetNames[0]]['L'+index].v!='计费吨位合计'){
+          if(workbook.Sheets[workbook.SheetNames[0]]['A'+index].v!='序号'){
+             that.$message({
+                message: "表格格式错误:序号错误",
+                type: "warning",
+            });
+          }else if(workbook.Sheets[workbook.SheetNames[0]]['B'+index].v!='发站'){
+             that.$message({
+                message: "表格格式错误:发站错误",
+                type: "warning",
+            });
+          }else if(workbook.Sheets[workbook.SheetNames[0]]['C'+index].v!='到站'){
+             that.$message({
+                message: "表格格式错误:到站错误",
+                type: "warning",
+            });
+          }else if(workbook.Sheets[workbook.SheetNames[0]]['D'+index].v!='发货日期'){
+             that.$message({
+                message: "表格格式错误:发货日期错误",
+                type: "warning",
+            });
+          }else if(workbook.Sheets[workbook.SheetNames[0]]['E'+index].v!='到货日期'){
+             that.$message({
+                message: "表格格式错误:到货日期错误",
+                type: "warning",
+            });
+          }else if(workbook.Sheets[workbook.SheetNames[0]]['F'+index].v!='卸货地点'){
+             that.$message({
+                message: "表格格式错误:卸货地点错误",
+                type: "warning",
+            });
+          }else if(workbook.Sheets[workbook.SheetNames[0]]['G'+index].v!='品名'){
+             that.$message({
+                message: "表格格式错误:品名错误",
+                type: "warning",
+            });
+          }else if(workbook.Sheets[workbook.SheetNames[0]]['I'+index].v!='计费\n吨位' 
+          && workbook.Sheets[workbook.SheetNames[0]]['I'+index].v!='计费吨位'
+          && workbook.Sheets[workbook.SheetNames[0]]['I'+index].v!='计费&#10;吨位'){
+             that.$message({
+                message: "表格格式错误:计费吨位错误",
+                type: "warning",
+            });
+          }else if(workbook.Sheets[workbook.SheetNames[0]]['J'+index].v!='车号'){
+             that.$message({
+                message: "表格格式错误:车号错误",
+                type: "warning",
+            });
+          }else if(workbook.Sheets[workbook.SheetNames[0]]['K'+index].v!='计量吨位'){
+             that.$message({
+                message: "表格格式错误:计量吨位错误",
+                type: "warning",
+            });
+          }else if(workbook.Sheets[workbook.SheetNames[0]]['L'+index].v!='计费吨位合计'){
+             that.$message({
+                message: "表格格式错误:计费吨位合计错误",
+                type: "warning",
+            });
+          }
+          return;
+        }
+        //读取表格
+        for(let i=1;i<=rows.length+1;i++){
+          let row=workbook.Sheets[workbook.SheetNames[0]]['A'+i];
+          if(row!='undefined' && row!=null && typeof row.v=='number' 
+              && workbook.Sheets[workbook.SheetNames[0]]['B'+i]!='undefined'
+            && workbook.Sheets[workbook.SheetNames[0]]['B'+i]!=null
+              && workbook.Sheets[workbook.SheetNames[0]]['C'+i]!='undefined'
+            && workbook.Sheets[workbook.SheetNames[0]]['C'+i]!=null
+              && workbook.Sheets[workbook.SheetNames[0]]['D'+i]!='undefined'
+            && workbook.Sheets[workbook.SheetNames[0]]['D'+i]!=null
+              && workbook.Sheets[workbook.SheetNames[0]]['E'+i]!='undefined'
+            && workbook.Sheets[workbook.SheetNames[0]]['E'+i]!=null
+              && workbook.Sheets[workbook.SheetNames[0]]['F'+i]!='undefined'
+            && workbook.Sheets[workbook.SheetNames[0]]['F'+i]!=null
+              && workbook.Sheets[workbook.SheetNames[0]]['G'+i]!='undefined'
+            && workbook.Sheets[workbook.SheetNames[0]]['G'+i]!=null
+              && workbook.Sheets[workbook.SheetNames[0]]['J'+i]!='undefined'
+            && workbook.Sheets[workbook.SheetNames[0]]['J'+i]!=null){
+            let tableRow={
+              sendStation:workbook.Sheets[workbook.SheetNames[0]]['B'+i].v,
+              arrivalStation:workbook.Sheets[workbook.SheetNames[0]]['C'+i].v,
+              sendDate:sjTime(workbook.Sheets[workbook.SheetNames[0]]['D'+i].v),
+              arrivalDate:workbook.Sheets[workbook.SheetNames[0]]['E'+i].v,
+              unloadPoint:workbook.Sheets[workbook.SheetNames[0]]['F'+i].v,
+              productName:workbook.Sheets[workbook.SheetNames[0]]['G'+i].v,
+              wagonNo:workbook.Sheets[workbook.SheetNames[0]]['J'+i].v,
+              weight:workbook.Sheets[workbook.SheetNames[0]]['I'+i].v,
+              mineral:workbook.Sheets[workbook.SheetNames[0]]['H'+i].v,
+            }
+            if((tableRow.wagonNo+"").length!=7){
               that.$message({
-                message: "车皮号不存在!请参考下方格式!",
+                message: "存在车皮号长度不等于7:"+tableRow.wagonNo,
                 type: "warning",
               });
-              return;
+              continue;
             }
+            that.tableData.push(tableRow);
           }
-          //绑定数据
-          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{
-              let errorNumb=index+1;
-              console.log("第"+errorNumb+ "行车皮号异常!");
-              return;
-            }
-        });
-        };
-        reader.readAsBinaryString(file.raw); //以二进制方式读取
+        }
+        console.log(that.tableData);
+      };
+      reader.readAsBinaryString(file.raw); //以二进制方式读取
     },
     //采购订单表格选中
     orderChange(selection){