Просмотр исходного кода

Merge branch 'master' of https://git.steerinfo.com/DAL-DAZHOU/icore-pass

luobang 2 лет назад
Родитель
Сommit
3e044b9e73

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

@@ -186,9 +186,6 @@ export default {
         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) {
@@ -198,6 +195,12 @@ export default {
                 vertical: 'center',//竖直居中
                 wrapText: true,//自动换行
               },
+              border: { // 设置边框
+                  top: { style: 'thin' },
+                  bottom: { style: 'thin' },
+                  left: { style: 'thin' },
+                  right: { style: 'thin' }
+              }
             }
           }
        })

+ 265 - 6
src/views/statisticalReport/components/tableItem.vue

@@ -28,7 +28,7 @@
           <span class="empty-desc">暂无数据</span>
         </div>
       </template>
-      <div slot="append">
+      <div slot="append" style="width: 100%">
         <div class="appendSlot" style="margin-top:20px">
           <span
             v-for="item in downStockStringArr"
@@ -55,6 +55,184 @@
             >{{ item.value }}</span
           >
         </div>
+        <el-divider></el-divider>
+        <!-- 库存表 -->
+        <table v-show="false">
+          <tr>
+            <td colspan="22">{{downStockString}}</td>
+          </tr>
+          <tr>
+            <td colspan="22">{{stockString}}</td>
+          </tr>
+          <tr>
+            <td colspan="22">{{runStockString}}</td>
+          </tr>
+          <tr>
+            <td colspan="22"></td>
+          </tr>
+        </table>
+        <!-- 万州港装车数据 -->
+        <div class="appendSlot">
+             <el-table
+          ref="loadTable"
+          highlight-current-row
+          border
+          show-summary
+          :data="loadTable"
+          :span-method="objectSpanMethod1"
+          :row-style="{height:'40px'}"
+          style="font-size: 18px">
+          <el-table-column label="万州港发货信息">
+          <el-table-column
+          align="center"
+            prop="materialName"
+            width="200px"
+            label="物资名">
+          </el-table-column>
+          <el-table-column
+          align="center"
+            prop="resultForeignShipName"
+            width="200px"
+            label="船号">
+          </el-table-column>
+           <el-table-column
+          align="center"
+            prop="num"
+            width="200px"
+            label="装车量">
+          </el-table-column>
+           <el-table-column
+          align="center"
+            prop="time"
+            width="200px"
+            label="时间">
+          </el-table-column>
+          </el-table-column>
+          <el-table-column>
+          </el-table-column>
+          <el-table-column label="进口矿水联运情况简报">
+             <el-table-column>
+            </el-table-column>
+            <el-table-column>
+            </el-table-column>
+            <el-table-column>
+            </el-table-column>
+            <el-table-column>
+            </el-table-column>
+          </el-table-column>
+        </el-table>
+        </div >
+        <el-divider></el-divider>
+        <!-- 等闸线 -->
+        <div class="appendSlot">
+             <el-table
+          highlight-current-row
+          border
+          :data="controlLinesTable"
+          :row-style="{height:'40px'}"
+          style="font-size: 12px">
+          <!-- 4 -->
+          <el-table-column
+          align="center"
+            prop="lineDate4"
+            width="100px"
+            label="日期">
+          </el-table-column>
+          <el-table-column
+          align="center"
+            prop="up4"
+            width="80px"
+            label="上行等闸数">
+          </el-table-column>
+           <el-table-column
+          align="center"
+            prop="down4"
+            width="80px"
+            label="下行等闸数">
+          </el-table-column>
+           <el-table-column
+          align="center"
+            prop="count4"
+            width="80px"
+            label="总计">
+          </el-table-column>
+          <!-- 3 -->
+          <el-table-column
+          align="center"
+            prop="lineDate3"
+            width="100px"
+            label="日期">
+          </el-table-column>
+          <el-table-column
+          align="center"
+            prop="up3"
+            width="80px"
+            label="上行等闸数">
+          </el-table-column>
+           <el-table-column
+          align="center"
+            prop="down3"
+            width="80px"
+            label="下行等闸数">
+          </el-table-column>
+           <el-table-column
+          align="center"
+            prop="count3"
+            width="80px"
+            label="总计">
+          </el-table-column>
+          <!-- 2 -->
+          <el-table-column
+          align="center"
+            prop="lineDate2"
+            width="100px"
+            label="日期">
+          </el-table-column>
+          <el-table-column
+          align="center"
+            prop="up2"
+            width="80px"
+            label="上行等闸数">
+          </el-table-column>
+           <el-table-column
+          align="center"
+            prop="down2"
+            width="80px"
+            label="下行等闸数">
+          </el-table-column>
+           <el-table-column
+          align="center"
+            prop="count2"
+            width="80px"
+            label="总计">
+          </el-table-column>
+          <!-- 1 -->
+          <el-table-column
+          align="center"
+            prop="lineDate1"
+            width="100px"
+            label="日期">
+          </el-table-column>
+          <el-table-column
+          align="center"
+            prop="up1"
+            width="80px"
+            label="上行等闸数">
+          </el-table-column>
+           <el-table-column
+          align="center"
+            prop="down1"
+            width="80px"
+            label="下行等闸数">
+          </el-table-column>
+           <el-table-column
+          align="center"
+            prop="count1"
+            width="80px"
+            label="总计">
+          </el-table-column>
+        </el-table>
+        </div >
       </div>
     </el-table>
   </div>
@@ -105,13 +283,18 @@ export default {
       runStockString:null,
       stockStringArr: [],
       downStockStringArr: [],
-      runStockStringArr:[]
+      runStockStringArr:[],
+      spanArr:[],
+      loadTable:[],
+      controlLinesTable:[]
     };
   },
   mounted() {
     this.getStockString();
     this.getDownStockString();
     this.getRunStockList();
+    this.searchLoadData();
+    this.getControlLines();
   },
   methods: {
     getStockString() {
@@ -187,6 +370,10 @@ export default {
               }
             });
             console.log("arr:", this.stockStringArr);
+            this.stockString='';
+            this.stockStringArr.forEach((item)=>{
+              this.stockString+=item.value;
+            });
           }
         });
     },
@@ -237,7 +424,7 @@ export default {
             console.log("arr:", this.downStockStringArr);
             this.downStockString='';
             this.downStockStringArr.forEach((item)=>{
-              downStockString+=item.value;
+              this.downStockString+=item.value;
             });
           }
         });
@@ -289,7 +476,7 @@ export default {
             console.log("arr:", this.runStockStringArr);
             this.runStockString='';
             this.runStockStringArr.forEach((item)=>{
-              runStockString+=item.value;
+              this.runStockString+=item.value;
             });
           }
         });
@@ -389,7 +576,79 @@ export default {
           colspan: 17
         };
       }
-    }
+    },
+    //查询装车数据
+    searchLoadData(){
+      let map={
+
+      };
+      this.axios.post('/api/v1/tms/getLoadData',map).then((res)=>{
+        if(res.data.code == "200"){
+          this.getSpanArr(res.data.data);
+          this.loadTable=res.data.data;
+          this.count=0;
+          this.loadTable.forEach((item)=>{
+            this.count+=item.num;
+          });
+        }else {
+          this.$message({
+              type: "error", 
+              message: res.data.data,
+          });
+        }
+      })
+    },
+    //处理数据,得到合并数组
+    getSpanArr(data) {
+        this.spanArr=[];
+        for (let i = 0; i < data.length; i++) {
+            if (i == 0) {
+                this.spanArr.push(1);
+                this.spanIndex = 0;
+            } else {
+                // 判断当前行与前一行内容是否相同
+                if (data[i].materialName == data[i - 1].materialName) {
+                    this.spanArr[this.spanIndex] += 1; // 相同的话,当前下标所代表的值加一,例如:第一列的前三行可合并
+                    this.spanArr.push(0);// 记录完毕后,再往数组里添加一个元素0,作为下一次合并的初始值
+                } else {
+                    this.spanArr.push(1); // 否则,依旧是一行
+                    this.spanIndex = i;
+                }
+            }
+        }
+    },
+    objectSpanMethod1({ row, column, rowIndex, columnIndex }) {
+        if (columnIndex === 0) {
+            const _row = this.spanArr[rowIndex]; // 行数
+            const _col = _row > 0 ? 1 : 0; // 列数
+            return {
+                rowspan: _row,
+                colspan: _col
+            };
+        }else if(rowIndex===0 && columnIndex === 3){
+           return {
+                rowspan: this.loadTable.length,
+                colspan: 1
+            };
+        }
+    },
+    //查询控制线数据
+    getControlLines(){
+      let map={
+        year:new Date().getFullYear(),
+        month:new Date().getMonth()+1
+      };
+      this.axios.post('/api/v1/tms/getControlLinesTable',map).then((res)=>{
+        if(res.data.code == "200"){
+          this.controlLinesTable=res.data.data;
+        }else {
+          this.$message({
+              type: "error", 
+              message: res.data.data,
+          });
+        }
+      })
+    },
   }
 };
 </script>
@@ -406,7 +665,7 @@ export default {
 <style lang="scss" scoped>
 .el-table {
   .appendSlot {
-    margin-left: 10%;
+    margin-left: 5%;
     font-size: 18px;
     line-height: 20px;
     .normalFirst {