|
@@ -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!='计费 吨位')
|
|
|
+ || 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!='计费 吨位'){
|
|
|
+ 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['计费 吨位']
|
|
|
- }
|
|
|
- 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;
|