liyg 2 anni fa
parent
commit
c8c6bc6cc0

+ 161 - 3
src/views/statisticalReport/components/Ship_dynamic_table.vue

@@ -152,13 +152,19 @@ export default {
       input: "",
       //万州港库存信息
       stockString: null,
-      stockStringArr: []
+      downStockString:null,
+      runStockString:null,
+      stockStringArr: [],
+      downStockStringArr: [],
+      runStockStringArr:[]
     };
   },
   created() {},
   mounted() {
     this.initialization();
     this.getStockString();
+    this.getDownStockString();
+    this.getRunStockList();
     // console.log(this.$refs.excelDom);
   },
   methods: {
@@ -179,6 +185,24 @@ export default {
         let tables = document.getElementById("pdfDom");
         let table_book = XLSX.utils.table_to_book(tables);
         console.log("table_book:",table_book);
+        console.log("sheet:",table_book.Sheets.Sheet1);
+        table_book.Sheets.Sheet1=this.appendOne(table_book.Sheets.Sheet1,this.downStockString);
+        table_book.Sheets.Sheet1=this.appendOne(table_book.Sheets.Sheet1,this.stockString);
+        table_book.Sheets.Sheet1=this.appendOne(table_book.Sheets.Sheet1,this.runStockString);
+        //这里遍历单元格给单元格对象设置属性,s为控制样式的属性
+        Object.keys(table_book.Sheets.Sheet1).forEach((key) => {
+          if (key.indexOf('!') < 0) {
+            table_book.Sheets.Sheet1[key].s = {
+              alignment: {//对齐方式
+                horizontal: 'center',//水平居中
+                vertical: 'center',//竖直居中
+                wrapText: true,//自动换行
+              },
+            }
+          }
+       })
+       console.log("sheet:",table_book.Sheets.Sheet1);
+        //导出
         var table_write = XLSX.write(table_book, {
             bookType: "xlsx",
             bookSST: true,
@@ -194,6 +218,32 @@ export default {
         }
         return table_write;
     },
+    appendOne(Sheet,row){
+      //从后面新增1行,并行合并
+        let seArr=Sheet['!fullref'].split(":");
+        let length=parseInt(seArr[1].replace(/[^0-9]/ig,""));
+        let endCol=seArr[1].replace(length,"");
+        //新增行
+        length++;
+        Sheet['A'+length]={
+          t: "s",
+          v: row
+        };
+        Sheet['!fullref']=seArr[0]+':'+endCol+length;
+        Sheet['!ref']=seArr[0]+':'+endCol+length;
+        //行合并
+        Sheet['!merges'].push({
+          s:{
+            c:0,
+            r:length-1
+          },
+          e:{
+            c:21,
+            r:length-1
+          }
+        });
+        return Sheet;
+    },
     initialization() {
       this.axios.post("/api/v1/tms/selectAllShipDynamaics").then(res => {
         if (res.data.code == "200") {
@@ -279,11 +329,119 @@ export default {
                 });
               }
             });
-            console.log("arr:", this.stockStringArr);
+            this.stockString='';
+            this.stockStringArr.forEach((item)=>{
+              this.stockString+=item.value;
+            });
+            console.log("this.stockString:", this.stockString);
           } else {
           }
         });
-    }
+    },
+    getDownStockString() {
+      let that = this;
+      this.axios
+        .post("/api/v1/wmsh/getDownPortStockList")
+        .then(res => {
+          console.log(res);
+          if (res.status == "200") {
+            let resultActualInstallations = 0;
+            res.data.data.forEach(e => {
+              resultActualInstallations =
+                resultActualInstallations + e.gmTonnage;
+            });
+            
+            this.downStockStringArr.push({
+              class: "normalFirst",
+              value: "下游港口库存" + resultActualInstallations.toFixed(2) + "吨:"
+            });
+
+            let materialName = res.data.data[0].materialName;
+            this.downStockStringArr.push({
+              class: "black",
+              value: materialName + res.data.data[0].totalTonnage + "吨:"
+            });
+
+            res.data.data.forEach(e => {
+              if (e.materialName == materialName) {
+                this.downStockStringArr.push({
+                  class: "normal",
+                  value:
+                    " “" + e.resultForeignShipName + "”" + e.gmTonnage + "吨 "
+                });
+              } else {
+                materialName = e.materialName;
+                this.downStockStringArr.push({
+                  class: "black",
+                  value: ";" + materialName + e.totalTonnage + "吨:"
+                });
+                this.downStockStringArr.push({
+                  class: "normal",
+                  value:
+                    " “" + e.resultForeignShipName + "”" + e.gmTonnage + "吨 "
+                });
+              }
+            });
+            this.downStockString='';
+            this.downStockStringArr.forEach((item)=>{
+              this.downStockString+=item.value;
+            });
+            console.log("this.downStockString:", this.downStockString);
+          }
+        });
+    },
+   getRunStockList(){
+      let that = this;
+      this.axios
+        .post("/api/v1/wmsh/getRunStockList")
+        .then(res => {
+          console.log(res);
+          if (res.status == "200") {
+            let resultActualInstallations = 0;
+            res.data.data.forEach(e => {
+              resultActualInstallations =
+                resultActualInstallations + e.gmTonnage;
+            });
+
+            this.runStockStringArr.push({
+              class: "normalFirst",
+              value: "在途库存" + resultActualInstallations.toFixed(2) + "吨:"
+            });
+
+            let materialName = res.data.data[0].materialName;
+            this.runStockStringArr.push({
+              class: "black",
+              value: materialName + res.data.data[0].totalTonnage + "吨:"
+            });
+
+            res.data.data.forEach(e => {
+              if (e.materialName == materialName) {
+                this.runStockStringArr.push({
+                  class: "normal",
+                  value:
+                    " “" + e.resultForeignShipName + "”" + e.gmTonnage + "吨 "
+                });
+              } else {
+                materialName = e.materialName;
+                this.runStockStringArr.push({
+                  class: "black",
+                  value: ";" + materialName + e.totalTonnage + "吨:"
+                });
+                this.runStockStringArr.push({
+                  class: "normal",
+                  value:
+                    " “" + e.resultForeignShipName + "”" + e.gmTonnage + "吨 "
+                });
+              }
+            });
+            this.runStockString='';
+            this.runStockStringArr.forEach((item)=>{
+              this.runStockString+=item.value;
+            });
+            console.log("this.runStockString:", this.runStockString);
+          }
+        });
+   },
   }
 };
 </script>

+ 7 - 1
src/views/statisticalReport/components/controlLines.vue

@@ -102,7 +102,13 @@ export default {
         });
     },
     update(row){
-         this.axios.post("/api/v1/tms/updateControlLine",row).then((res)=>{
+        if(row.up==''){
+          row.up=0
+        }
+        if(row.down==''){
+          row.down=0
+        }
+        this.axios.post("/api/v1/tms/updateControlLine",row).then((res)=>{
             this.$message.success("修改成功");
         });
     }

+ 129 - 1
src/views/statisticalReport/components/tableItem.vue

@@ -29,6 +29,15 @@
         </div>
       </template>
       <div slot="append">
+        <div class="appendSlot" style="margin-top:20px">
+          <span
+            v-for="item in downStockStringArr"
+            :class="item.class"
+            :key="item.value"
+            >{{ item.value }}</span
+          >
+        </div>
+        <el-divider></el-divider>
         <div class="appendSlot">
           <span
             v-for="item in stockStringArr"
@@ -37,6 +46,15 @@
             >{{ item.value }}</span
           >
         </div>
+        <el-divider></el-divider>
+        <div class="appendSlot">
+          <span
+            v-for="item in runStockStringArr"
+            :class="item.class"
+            :key="item.value"
+            >{{ item.value }}</span
+          >
+        </div>
       </div>
     </el-table>
   </div>
@@ -83,11 +101,17 @@ export default {
   data() {
     return {
       stockString: null,
-      stockStringArr: []
+      downStockString:null,
+      runStockString:null,
+      stockStringArr: [],
+      downStockStringArr: [],
+      runStockStringArr:[]
     };
   },
   mounted() {
     this.getStockString();
+    this.getDownStockString();
+    this.getRunStockList();
   },
   methods: {
     getStockString() {
@@ -166,6 +190,110 @@ export default {
           }
         });
     },
+    getDownStockString() {
+      let that = this;
+      this.axios
+        .post("/api/v1/wmsh/getDownPortStockList")
+        .then(res => {
+          console.log(res);
+          if (res.status == "200") {
+            let resultActualInstallations = 0;
+            res.data.data.forEach(e => {
+              resultActualInstallations =
+                resultActualInstallations + e.gmTonnage;
+            });
+            
+            this.downStockStringArr.push({
+              class: "normalFirst",
+              value: "下游港口库存" + resultActualInstallations.toFixed(2) + "吨:"
+            });
+
+            let materialName = res.data.data[0].materialName;
+            this.downStockStringArr.push({
+              class: "black",
+              value: materialName + res.data.data[0].totalTonnage + "吨:"
+            });
+
+            res.data.data.forEach(e => {
+              if (e.materialName == materialName) {
+                this.downStockStringArr.push({
+                  class: "normal",
+                  value:
+                    " “" + e.resultForeignShipName + "”" + e.gmTonnage + "吨 "
+                });
+              } else {
+                materialName = e.materialName;
+                this.downStockStringArr.push({
+                  class: "black",
+                  value: ";" + materialName + e.totalTonnage + "吨:"
+                });
+                this.downStockStringArr.push({
+                  class: "normal",
+                  value:
+                    " “" + e.resultForeignShipName + "”" + e.gmTonnage + "吨 "
+                });
+              }
+            });
+            console.log("arr:", this.downStockStringArr);
+            this.downStockString='';
+            this.downStockStringArr.forEach((item)=>{
+              downStockString+=item.value;
+            });
+          }
+        });
+    },
+   getRunStockList(){
+      let that = this;
+      this.axios
+        .post("/api/v1/wmsh/getRunStockList")
+        .then(res => {
+          console.log(res);
+          if (res.status == "200") {
+            let resultActualInstallations = 0;
+            res.data.data.forEach(e => {
+              resultActualInstallations =
+                resultActualInstallations + e.gmTonnage;
+            });
+
+            this.runStockStringArr.push({
+              class: "normalFirst",
+              value: "在途库存" + resultActualInstallations.toFixed(2) + "吨:"
+            });
+
+            let materialName = res.data.data[0].materialName;
+            this.runStockStringArr.push({
+              class: "black",
+              value: materialName + res.data.data[0].totalTonnage + "吨:"
+            });
+
+            res.data.data.forEach(e => {
+              if (e.materialName == materialName) {
+                this.runStockStringArr.push({
+                  class: "normal",
+                  value:
+                    " “" + e.resultForeignShipName + "”" + e.gmTonnage + "吨 "
+                });
+              } else {
+                materialName = e.materialName;
+                this.runStockStringArr.push({
+                  class: "black",
+                  value: ";" + materialName + e.totalTonnage + "吨:"
+                });
+                this.runStockStringArr.push({
+                  class: "normal",
+                  value:
+                    " “" + e.resultForeignShipName + "”" + e.gmTonnage + "吨 "
+                });
+              }
+            });
+            console.log("arr:", this.runStockStringArr);
+            this.runStockString='';
+            this.runStockStringArr.forEach((item)=>{
+              runStockString+=item.value;
+            });
+          }
+        });
+   },
     headerCellStyle({ row, column, rowIndex, columnIndex }) {
       let columnIndexList1 = [5];
       let columnIndexList2 = [6];