liyg 2 years ago
parent
commit
9e69d3ff2d

+ 2 - 2
config/index.js

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

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

@@ -1,9 +1,8 @@
 <template>
-  <!-- 添加车皮装车实绩 -->
+  <!-- 国产矿导入-->
   <div class="addWagonLoad">
     <page-title>返回</page-title>
     <div class="cp">
-      <span >车皮号:</span>
       <el-upload style="margin: 8px;"
           class="upload-excel"
           action=""
@@ -11,15 +10,21 @@
           :show-file-list="false"
           accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"
           :auto-upload="false">
-          <el-button  type="primary">导入</el-button>
+          <el-button  type="primary">导入车皮号(Excel)</el-button>
       </el-upload>
-      <span >当前导入数量:{{tableData.length}}</span>
+      <div style="margin-right:200px;">当前导入数量:{{tableData.length}}</div>
+       <!-- <el-button type="primary" @click="exportData()"
+        ><i class="el-icon-download"></i>下载导入模板</el-button> -->
+    </div>
+    <div>
+      <span style="color:red">导入数据中的 品名、发货单位、车号、发站 是必须的</span>
     </div>
     <div class="table item">
       <el-table
         stripe
         :data="tableData"
-        style="width: 100%">
+        style="width: 100%"
+        id="domesticTable">
         <el-table-column
         type="index"
         width="50"
@@ -216,6 +221,7 @@
 <script>
 import PageTitle from "@/components/Page/Title";
 import { sjTime, isNumber } from "@/utils/sharedJsFile";
+import {getCookie} from "@/utils/util.js";
 export default {
   components: { PageTitle },
   data() {
@@ -523,10 +529,14 @@ export default {
         row.resultLoadingDate=sjTime(that.form1.resultLoadingDate);//装车日期
         row.resultRemarks=that.form1.resultRemarks;//备注
       })
-      console.log(that.tableData);
+      let data={
+        list:this.tableData,
+        userId:getCookie("userId")
+      }
+      console.log(data);
       //请求添加
       this.axios
-        .post("/api/v1/tms/addDomesticLoadResult", that.tableData)
+        .post("/api/v1/tms/addDomesticLoadResult", data)
         .then((res) => {
           console.log(res);
           if (res.data.code == "200") {
@@ -570,9 +580,30 @@ export default {
           if(rows.length>0){
             that.disable=false;
             that.tableData=[];
-            if((typeof rows[0]['车号'])=='undefined' || (typeof rows[0]['发站'])=='undefined' ){
-              that.$message({
-                message: "导入Excel格式错误,请参考下方表头格式!",
+            if((typeof rows[0]['车号'])=='undefined'){
+               that.$message({
+                message: "导入Excel格式错误,车号不能为空!",
+                type: "warning",
+              });
+              return;
+            }
+            if((typeof rows[0]['品  名'])=='undefined' && (typeof rows[0]['品名'])=='undefined' && (typeof rows[0]['物资'])=='undefined'){
+               that.$message({
+                message: "导入Excel格式错误,品名不能为空!",
+                type: "warning",
+              });
+              return;
+            }
+            if((typeof rows[0]['发货单位'])=='undefined'){
+               that.$message({
+                message: "导入Excel格式错误,发货单位不能为空!",
+                type: "warning",
+              });
+              return;
+            }
+            if((typeof rows[0]['发站']) =='undefined'){
+               that.$message({
+                message: "导入Excel格式错误,发站不能为空!",
                 type: "warning",
               });
               return;
@@ -599,6 +630,35 @@ export default {
               if(typeof temp.materialName=='undefined' || temp.materialName==null){
                 temp.materialName=row['物资'];
               }
+              //判断校验
+              if((typeof temp.wagonNo)=='undefined'){
+                that.$message({
+                  message: "车号不能为空!导入Excel停止!",
+                  type: "warning",
+                });
+                return;
+              }
+              if((typeof temp.materialName)=='undefined'){
+                that.$message({
+                  message: "品名不能为空!导入Excel停止!",
+                  type: "warning",
+                });
+                return;
+              }
+              if((typeof temp.supplierName)=='undefined'){
+                that.$message({
+                  message: "发货单位不能为空!导入Excel停止!",
+                  type: "warning",
+                });
+                return;
+              }
+              if((typeof temp.sendStation)=='undefined'){
+                that.$message({
+                  message: "发站不能为空!导入Excel停止!",
+                  type: "warning",
+                });
+                return;
+              }
               that.tableData.push(temp);
             }
             else{
@@ -607,6 +667,25 @@ export default {
         });
         };
         reader.readAsBinaryString(file.raw); //以二进制方式读取
+    },
+    //导出模板
+    exportData(){
+      let tables = document.getElementById("domesticTable");
+      let table_book = XLSX.utils.table_to_book(tables);
+      var table_write = XLSX.utils.write(table_book, {
+        bookType: "xlsx",
+        bookSST: true,
+        type: "array",
+      });
+      try {
+        this.$FileSaver.saveAs(
+          new Blob([table_write], { type: "application/octet-stream" }),
+          ".xlsx"
+        );
+      } catch (e) {
+        if (typeof console !== "undefined") console.log(e, table_write);
+      }
+      return table_write;
     }
   },
 };

+ 2 - 0
src/views/TMS/components/domesticMine/wagonLoadEdit.vue

@@ -51,6 +51,7 @@
 <script>
 import PageTitle from "@/components/Page/Title";
 import { sjTime } from "@/utils/sharedJsFile";
+import {getCookie} from "@/utils/util.js";
 export default {
   components: { PageTitle },
  data(){
@@ -168,6 +169,7 @@ export default {
         arrivalStationId: this.toTheStationId,
         resultLoadingDate: sjTime(this.form1.resultLoadingDate),
         resultRemarks: this.form1.resultRemarks,
+        userId:getCookie("userId"),
         resultType:3
       };
       console.log(tmstrainLoadingResult)

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

@@ -116,6 +116,7 @@
 
 <script>
 import PageTitle from "@/components/Page/Title";
+import {getCookie} from "@/utils/util.js";
 export default {
   components: { PageTitle },
   data() {
@@ -202,8 +203,10 @@ export default {
       else{
         let map = {
           resultIdList:this.selecTionListMap,
-          purchaseOrderId:this.purchaseOrderId
+          purchaseOrderId:this.purchaseOrderId,
+          userId:getCookie("userId")
         }
+        console.log(map);
         let that=this;
         this.axios.post('/api/v1/tms/updateDomesticLoadResult',map).then((res)=>{
           console.log(res.data.data)

+ 1 - 0
src/views/TMS/components/domesticMine/wagonUnLoadAdd.vue

@@ -173,6 +173,7 @@ export default {
         resultUnloadTime: sjTime(this.form1.resultUnloadTime),
         resultRemark: this.form1.resultRemark,
         unloadingPointId:this.unloadPointId,
+        insertUsername:getCookie("userId"),
         resultType: 3,
       };
       console.log(tmstrainWagonUnloadResult);

+ 3 - 1
src/views/TMS/components/domesticMine/wagonUnLoadEdit.vue

@@ -16,6 +16,7 @@
 <script>
 import PageTitle from "@/components/Page/Title";
 import { sjTime } from "@/utils/sharedJsFile";
+import {getCookie} from "@/utils/util.js";
 export default {
   components: { PageTitle },
   data() {
@@ -62,6 +63,7 @@ export default {
         unloadingPointId: this.form1.unloadingPointId,
         resultBigTicketWeight: this.form1.resultBigTicketWeight,
         resultRailHorizontalWeight: this.form1.resultRailHorizontalWeight,
+        updateUsername:getCookie("userId"),
         resultRemark: this.form1.resultRemark,
       };
       console.log(tmstrainWagonUnloadResult);
@@ -77,7 +79,7 @@ export default {
             "/api/v1/tms/upadteTmstrainWagonUnLoadResultByUnLoadingId",
             tmstrainWagonUnloadResult
           )
-          .then(() => {
+          .then((res) => {
             if (res.data.code == "200") {
               this.$message({
                 type: "success",

+ 3 - 1
src/views/TMS/components/importedEmergency/addWagonLoadEmergency.vue

@@ -1,5 +1,5 @@
 <template>
-  <!-- 添加车皮装车实绩 -->
+  <!-- 海港-老区轨道衡新增装车  -->
   <div class="addWagonLoad">
     <page-title>返回</page-title>
     <div class="purchaseOrder_table">
@@ -242,6 +242,7 @@
 <script>
 import PageTitle from "@/components/Page/Title";
 import { sjTime } from "@/utils/sharedJsFile";
+import {getCookie} from "@/utils/util.js";
 export default {
   components: { PageTitle },
   data() {
@@ -596,6 +597,7 @@ export default {
           arrivalStationId: this.toTheStationId,
           resultLoadingDate: sjTime(this.form1.resultLoadingDate),
           resultRemarks: this.form1.resultRemarks,
+          userId:getCookie("userId"),
           resultType:2,
         }
         console.log(map);

+ 2 - 0
src/views/TMS/components/importedEmergency/addWagonUnLoadEmergency.vue

@@ -91,6 +91,7 @@
 <script>
 import PageTitle from "@/components/Page/Title";
 import { sjTime,isNumber } from "@/utils/sharedJsFile";
+import { getCookie } from "@/utils/util.js";
 export default {
   components: { PageTitle },
   data() {
@@ -169,6 +170,7 @@ export default {
         resultUnloadTime: sjTime(this.form1.resultUnloadTime),
         resultRemark: this.form1.resultRemark,
         unloadingPointId:this.unloadPointId,
+        insertUsername:getCookie("userId"),
         resultType: 2,
       };
       console.log(tmstrainWagonUnloadResult);

+ 17 - 9
src/views/TMS/components/importedEmergency/editWagonLoadEmergency.vue

@@ -52,6 +52,7 @@
 <script>
 import PageTitle from "@/components/Page/Title";
 import { sjTime } from "@/utils/sharedJsFile";
+import {getCookie} from "@/utils/util.js";
 export default {
   components: { PageTitle },
   data() {
@@ -179,12 +180,12 @@ export default {
         resultLoadingDate: sjTime(this.form1.resultLoadingDate),
         batchId: this.form1.batchId,
         capacityId: this.form1.capacityId,
-        resultMaterialNumber: this.form1.resultMaterialNumber,
-        resultMaterialTheoryweight: this.form1.resultMaterialTheoryweight,
         resultRemarks: this.form1.resultRemarks,
+        purchaseOrderNo:this.form1.purchaseOrderNo,
+        userId:getCookie("userId"),
         resultType:2
       };
-      console.log(tmstrainLoadingResult)
+      console.log(tmstrainLoadingResult);
       if (
         tmstrainLoadingResult.resultWagonNo == null ||
         tmstrainLoadingResult.sendStationId == null ||
@@ -199,12 +200,19 @@ export default {
             "/api/v1/tms/upadteTmstrainLoadingResultByResultId",
             tmstrainLoadingResult
           )
-          .then(() => {
-            this.$message({
-              type: "success",
-              message: "修改成功!",
-            });
-            this.$router.go(-1);
+          .then((res) => {
+            if (res.data.code == "200") {
+              this.$message({
+                type: "success",
+                message: "修改成功!",
+              });
+              this.$router.go(-1);
+            }else{
+               this.$message({
+                type: "error",
+                message: res.data.data,
+              });
+            }
           });
     },
   },

+ 3 - 1
src/views/TMS/components/importedEmergency/editWagonUnLoadEmergency.vue

@@ -17,6 +17,7 @@
 <script>
 import PageTitle from "@/components/Page/Title";
 import { sjTime,isNumber } from "@/utils/sharedJsFile";
+import {getCookie} from "@/utils/util.js";
 export default {
   components: { PageTitle },
  data(){
@@ -59,6 +60,7 @@ export default {
         unloadingPointId: this.form1.unloadingPointId,
         resultBigTicketWeight: this.form1.resultBigTicketWeight,
         resultRailHorizontalWeight: this.form1.resultRailHorizontalWeight,
+        updateUsername:getCookie("userId"),
         resultRemark: this.form1.resultRemark
       };
       if (tmstrainWagonUnloadResult.resultWagonNo==null
@@ -70,7 +72,7 @@ export default {
           "/api/v1/tms/upadteTmstrainWagonUnLoadResultByUnLoadingId",
           tmstrainWagonUnloadResult
         )
-       .then(() => {
+       .then((res) => {
           this.$message({
             type: "success",  
             message: "修改成功!",

+ 3 - 1
src/views/TMS/components/importedMine/addWagonLoad.vue

@@ -1,5 +1,5 @@
 <template>
-  <!-- 添加车皮装车实绩 -->
+  <!-- 万州港-达州新增装车 -->
   <div class="addWagonLoad">
     <page-title>返回</page-title>
     <div class="purchaseOrder_table">
@@ -242,6 +242,7 @@
 <script>
 import PageTitle from "@/components/Page/Title";
 import { sjTime } from "@/utils/sharedJsFile";
+import {getCookie} from "@/utils/util.js";
 export default {
   components: { PageTitle },
   data() {
@@ -596,6 +597,7 @@ export default {
           arrivalStationId: this.toTheStationId,
           resultLoadingDate: sjTime(this.form1.resultLoadingDate),
           resultRemarks: this.form1.resultRemarks,
+          userId:getCookie("userId"),
           resultType:1,
         }
         console.log(map);

+ 2 - 0
src/views/TMS/components/importedMine/addWagonUnLoad.vue

@@ -94,6 +94,7 @@
 <script>
 import PageTitle from "@/components/Page/Title";
 import { sjTime,isNumber } from "@/utils/sharedJsFile";
+import { getCookie } from "@/utils/util.js";
 export default {
   components: { PageTitle },
   data() {
@@ -171,6 +172,7 @@ export default {
         resultUnloadTime: sjTime(this.form1.resultUnloadTime),
         resultRemark: this.form1.resultRemark,
         unloadingPointId:this.unloadPointId,
+        insertUsername:getCookie("userId"),
         resultType: 1,
       };
       console.log(tmstrainWagonUnloadResult);

+ 6 - 2
src/views/TMS/components/importedMine/editWagonLoad.vue

@@ -53,6 +53,7 @@
 <script>
 import PageTitle from "@/components/Page/Title";
 import { sjTime, isNumber } from "@/utils/sharedJsFile";
+import {getCookie} from "@/utils/util.js";
 export default {
   components: { PageTitle },
   data() {
@@ -176,11 +177,13 @@ export default {
         resultLoadingDate: sjTime(this.form1.resultLoadingDate),
         batchId: this.form1.batchId,
         capacityId: this.form1.capacityId,
-        resultMaterialNumber: this.form1.resultMaterialNumber,
         resultMaterialTheoryweight: this.form1.resultMaterialTheoryweight,
         resultRemarks: this.form1.resultRemarks,
+        purchaseOrderNo:this.form1.purchaseOrderNo,
+        userId:getCookie("userId"),
         resultType:1
       };
+      console.log(tmstrainLoadingResult);
       if (
         tmstrainLoadingResult.resultId ==null ||
         tmstrainLoadingResult.resultIsclear == null ||
@@ -202,6 +205,7 @@ export default {
                 type: "success",
                 message: "修改成功!",
               });
+                this.$router.go(-1);
             }else{
                this.$message({
                 type: "error",
@@ -209,7 +213,7 @@ export default {
               });
             }
 
-            this.$router.go(-1);
+          
           });
     },
   },

+ 2 - 0
src/views/TMS/components/importedMine/editWagonUnLoad.vue

@@ -18,6 +18,7 @@
 <script>
 import PageTitle from "@/components/Page/Title";
 import { sjTime } from "@/utils/sharedJsFile";
+import {getCookie} from "@/utils/util.js";
 export default {
   components: { PageTitle },
   data() {
@@ -63,6 +64,7 @@ export default {
         resultArrivalDate: sjTime(this.form1.resultArrivalDate),
         resultUnloadTime: sjTime(this.form1.resultUnloadTime),
         unloadingPointId: this.form1.unloadingPointId,
+        updateUsername:getCookie("userId"),
         resultRemark: this.form1.resultRemark,
       };
       console.log(tmstrainWagonUnloadResult);