|  | @@ -3,7 +3,11 @@
 | 
	
		
			
				|  |  |    <div class="loadCapacityDetail">
 | 
	
		
			
				|  |  |      <div class="frameCalculation">
 | 
	
		
			
				|  |  |        <span>装车开始时间</span>
 | 
	
		
			
				|  |  | -      <el-date-picker v-model="startTime" type="datetime" placeholder="选择日期">
 | 
	
		
			
				|  |  | +      <el-date-picker
 | 
	
		
			
				|  |  | +        v-model="startTime"
 | 
	
		
			
				|  |  | +        type="datetime"
 | 
	
		
			
				|  |  | +        placeholder="选择日期"
 | 
	
		
			
				|  |  | +      >
 | 
	
		
			
				|  |  |        </el-date-picker>
 | 
	
		
			
				|  |  |        <span>至</span>
 | 
	
		
			
				|  |  |        <el-date-picker v-model="endTime" type="datetime" placeholder="选择日期">
 | 
	
	
		
			
				|  | @@ -11,23 +15,39 @@
 | 
	
		
			
				|  |  |        <el-button type="primary" class="btn" @click="onclickSearch">
 | 
	
		
			
				|  |  |          <i class="el-icon-search"></i>查询
 | 
	
		
			
				|  |  |        </el-button>
 | 
	
		
			
				|  |  | -      <el-button type="primary" @click="exportData()"
 | 
	
		
			
				|  |  | +      <el-button type="primary" @click="exportSignleReport"
 | 
	
		
			
				|  |  |          ><i class="el-icon-download"></i>导出(Excel)</el-button
 | 
	
		
			
				|  |  |        >
 | 
	
		
			
				|  |  |        <span style="margin-left: 1rem;">合计净重:</span>
 | 
	
		
			
				|  |  | -      <el-input v-model="totalNumber" :disabled="true" style="width: 100px;"></el-input>
 | 
	
		
			
				|  |  | +      <el-input
 | 
	
		
			
				|  |  | +        v-model="totalNumber"
 | 
	
		
			
				|  |  | +        :disabled="true"
 | 
	
		
			
				|  |  | +        style="width: 100px;"
 | 
	
		
			
				|  |  | +      ></el-input>
 | 
	
		
			
				|  |  |        <span style="margin-left: 1rem;">合计车数:</span>
 | 
	
		
			
				|  |  | -      <el-input v-model="totalCapacity" :disabled="true" style="width: 100px;"></el-input>
 | 
	
		
			
				|  |  | -     
 | 
	
		
			
				|  |  | -       <el-input placeholder="请输入装机车牌号/可查询当天车辆数据" v-model="input" style="width: 220px;margin-left: 1rem;" clearable>
 | 
	
		
			
				|  |  | +      <el-input
 | 
	
		
			
				|  |  | +        v-model="totalCapacity"
 | 
	
		
			
				|  |  | +        :disabled="true"
 | 
	
		
			
				|  |  | +        style="width: 100px;"
 | 
	
		
			
				|  |  | +      ></el-input>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +      <el-input
 | 
	
		
			
				|  |  | +        placeholder="请输入装机车牌号/可查询当天车辆数据"
 | 
	
		
			
				|  |  | +        v-model="input"
 | 
	
		
			
				|  |  | +        style="width: 220px;margin-left: 1rem;"
 | 
	
		
			
				|  |  | +        clearable
 | 
	
		
			
				|  |  | +      >
 | 
	
		
			
				|  |  |        </el-input>
 | 
	
		
			
				|  |  | -         <el-button type="primary" class="btn" @click="onclickCapacity">
 | 
	
		
			
				|  |  | +      <el-button type="primary" class="btn" @click="onclickCapacity">
 | 
	
		
			
				|  |  |          <i class="el-icon-search"></i>查询
 | 
	
		
			
				|  |  |        </el-button>
 | 
	
		
			
				|  |  | -   
 | 
	
		
			
				|  |  |      </div>
 | 
	
		
			
				|  |  |      <div class="table">
 | 
	
		
			
				|  |  | -      <mergeRowTable ref="excelDom" v-bind.sync="option" @func="func"></mergeRowTable>
 | 
	
		
			
				|  |  | +      <mergeRowTable
 | 
	
		
			
				|  |  | +        ref="excelDom"
 | 
	
		
			
				|  |  | +        v-bind.sync="option"
 | 
	
		
			
				|  |  | +        @func="func"
 | 
	
		
			
				|  |  | +      ></mergeRowTable>
 | 
	
		
			
				|  |  |      </div>
 | 
	
		
			
				|  |  |    </div>
 | 
	
		
			
				|  |  |  </template>
 | 
	
	
		
			
				|  | @@ -42,15 +62,17 @@ export default {
 | 
	
		
			
				|  |  |        totalCapacity: null,
 | 
	
		
			
				|  |  |        startTime: null,
 | 
	
		
			
				|  |  |        endTime: null,
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |        input: "",
 | 
	
		
			
				|  |  |        tableTitle: "装机计重明细报表",
 | 
	
		
			
				|  |  |        option: {
 | 
	
		
			
				|  |  |          // 表格请求数据的地址
 | 
	
		
			
				|  |  |          requestUrl: "api/v1/tms/getLoaderForResultDetail?apiId=480",
 | 
	
		
			
				|  |  |          comparison: "orderNumber",
 | 
	
		
			
				|  |  | -        columnIndexs: [0, 1, 2, 4, 5, 6],
 | 
	
		
			
				|  |  | +        columnIndexs: [0, 1, 2, 4, 5, 6]
 | 
	
		
			
				|  |  |        },
 | 
	
		
			
				|  |  | +      inwardArr: [],
 | 
	
		
			
				|  |  | +      tableTitle: "装机计重明细",
 | 
	
		
			
				|  |  | +      totalArr: []
 | 
	
		
			
				|  |  |      };
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |    created() {
 | 
	
	
		
			
				|  | @@ -74,11 +96,98 @@ export default {
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |    methods: {
 | 
	
		
			
				|  |  | +    exportSignleReport() {
 | 
	
		
			
				|  |  | +      if (this.startTime && this.endTime) {
 | 
	
		
			
				|  |  | +        this.openFullScreen1();
 | 
	
		
			
				|  |  | +      } else {
 | 
	
		
			
				|  |  | +        this.$confirm(
 | 
	
		
			
				|  |  | +          "没有输入时间区间,系统将默认导出今天0点到24点的单个报表数据,是否继续?",
 | 
	
		
			
				|  |  | +          "提示",
 | 
	
		
			
				|  |  | +          {
 | 
	
		
			
				|  |  | +            confirmButtonText: "确定",
 | 
	
		
			
				|  |  | +            cancelButtonText: "取消",
 | 
	
		
			
				|  |  | +            type: "warning"
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  | +        )
 | 
	
		
			
				|  |  | +          .then(() => {
 | 
	
		
			
				|  |  | +            this.openFullScreen1();
 | 
	
		
			
				|  |  | +          })
 | 
	
		
			
				|  |  | +          .catch(() => {
 | 
	
		
			
				|  |  | +            this.$message.info("取消导出");
 | 
	
		
			
				|  |  | +          });
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    openFullScreen1() {
 | 
	
		
			
				|  |  | +      let startTime = null;
 | 
	
		
			
				|  |  | +      let endTime = null;
 | 
	
		
			
				|  |  | +      let orgCode = null;
 | 
	
		
			
				|  |  | +      if (this.startTime && this.endTime) {
 | 
	
		
			
				|  |  | +        startTime = sjTime(this.startTime);
 | 
	
		
			
				|  |  | +        endTime = sjTime(this.endTime);
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +      if (
 | 
	
		
			
				|  |  | +        getCookie("orgCode") != "dagangadmin" &&
 | 
	
		
			
				|  |  | +        getCookie("orgCode") != "zidonghuabu" &&
 | 
	
		
			
				|  |  | +        getCookie("orgCode") != "wuliuchuyunzhongxin"
 | 
	
		
			
				|  |  | +      ) {
 | 
	
		
			
				|  |  | +        orgCode = getCookie("orgCode");
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +      const loading = this.$loading({
 | 
	
		
			
				|  |  | +        lock: true,
 | 
	
		
			
				|  |  | +        text: "请等待导出",
 | 
	
		
			
				|  |  | +        spinner: "el-icon-loading",
 | 
	
		
			
				|  |  | +        background: "rgba(0, 0, 0, 0.7)"
 | 
	
		
			
				|  |  | +      });
 | 
	
		
			
				|  |  | +      this.axios
 | 
	
		
			
				|  |  | +        .post(
 | 
	
		
			
				|  |  | +          "/api/v1/tms/getLoaderForResultDetail?apiId=480&isPage=yes&startTime=" +
 | 
	
		
			
				|  |  | +            startTime +
 | 
	
		
			
				|  |  | +            "&endTime=" +
 | 
	
		
			
				|  |  | +            endTime +
 | 
	
		
			
				|  |  | +            "&orgCode=" +
 | 
	
		
			
				|  |  | +            orgCode
 | 
	
		
			
				|  |  | +        )
 | 
	
		
			
				|  |  | +        .then(res => {
 | 
	
		
			
				|  |  | +          this.totalArr = [];
 | 
	
		
			
				|  |  | +          this.inwardArr = [];
 | 
	
		
			
				|  |  | +          this.tableTitle = "装机计重明细统计";
 | 
	
		
			
				|  |  | +          this.inwardArr = res.data.data;
 | 
	
		
			
				|  |  | +          this.totalArr = this.totalArr.concat(this.inwardArr);
 | 
	
		
			
				|  |  | +          this.exportAllReportToExcel();
 | 
	
		
			
				|  |  | +          setTimeout(() => {
 | 
	
		
			
				|  |  | +            loading.close();
 | 
	
		
			
				|  |  | +          }, 2000);
 | 
	
		
			
				|  |  | +        });
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    exportAllReportToExcel() {
 | 
	
		
			
				|  |  | +      var title = this.tableTitle;
 | 
	
		
			
				|  |  | +      let tHeader = [];
 | 
	
		
			
				|  |  | +      let filterVal = [];
 | 
	
		
			
				|  |  | +      this.dataColumnData.forEach(e1 => {
 | 
	
		
			
				|  |  | +        if (tHeader.indexOf(e1.label) === -1) {
 | 
	
		
			
				|  |  | +          tHeader.push(e1.label);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (filterVal.indexOf(e1.prop) === -1) {
 | 
	
		
			
				|  |  | +          filterVal.push(e1.prop);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      });
 | 
	
		
			
				|  |  | +      //导出为excel
 | 
	
		
			
				|  |  | +      this.downloadLoading = true;
 | 
	
		
			
				|  |  | +      require.ensure([], () => {
 | 
	
		
			
				|  |  | +        const {
 | 
	
		
			
				|  |  | +          export_json_to_excel
 | 
	
		
			
				|  |  | +        } = require("@/assets/excel/Export2Excel.js"); //这里必须使用绝对路径,使用@/+存放export2Excel的路径
 | 
	
		
			
				|  |  | +        // let list = this.$refs.excelDom.dataTabel;
 | 
	
		
			
				|  |  | +        let data = this.totalArr.map(v => filterVal.map(j => v[j])); //3.formatJson格式转换
 | 
	
		
			
				|  |  | +        export_json_to_excel(tHeader, data, title); // (title)导出的表格名称
 | 
	
		
			
				|  |  | +      });
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  |      func(res) {
 | 
	
		
			
				|  |  | +      this.dataColumnData = res.columnData;
 | 
	
		
			
				|  |  |        console.log(res);
 | 
	
		
			
				|  |  |        var resultNetWeightTotal = 0;
 | 
	
		
			
				|  |  |        var currentCapacityTotal = 0;
 | 
	
		
			
				|  |  | -      res.list.forEach((e) => {
 | 
	
		
			
				|  |  | +      res.list.forEach(e => {
 | 
	
		
			
				|  |  |          currentCapacityTotal++;
 | 
	
		
			
				|  |  |          resultNetWeightTotal = resultNetWeightTotal + e.resultNetWeight;
 | 
	
		
			
				|  |  |        });
 | 
	
	
		
			
				|  | @@ -92,13 +201,13 @@ export default {
 | 
	
		
			
				|  |  |      getRequestUrl() {
 | 
	
		
			
				|  |  |        if (
 | 
	
		
			
				|  |  |          getCookie("orgCode") == "dagangadmin" ||
 | 
	
		
			
				|  |  | -        getCookie("orgCode") == "zidonghuabu"||
 | 
	
		
			
				|  |  | -        getCookie("orgCode")=="wuliuchuyunzhongxin"
 | 
	
		
			
				|  |  | +        getCookie("orgCode") == "zidonghuabu" ||
 | 
	
		
			
				|  |  | +        getCookie("orgCode") == "wuliuchuyunzhongxin"
 | 
	
		
			
				|  |  |        ) {
 | 
	
		
			
				|  |  |          this.option.requestUrl =
 | 
	
		
			
				|  |  |            "/api/v1/tms/getLoaderForResultDetail?apiId=480&startTime=null&endTime=null&i=" +
 | 
	
		
			
				|  |  |            new Date();
 | 
	
		
			
				|  |  | -      }  else {
 | 
	
		
			
				|  |  | +      } else {
 | 
	
		
			
				|  |  |          this.option.requestUrl =
 | 
	
		
			
				|  |  |            "/api/v1/tms/getLoaderForResultDetail?apiId=480&userId=" +
 | 
	
		
			
				|  |  |            getCookie("orgCode") +
 | 
	
	
		
			
				|  | @@ -150,8 +259,8 @@ export default {
 | 
	
		
			
				|  |  |        } else {
 | 
	
		
			
				|  |  |          this.getRequestUrl();
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  | -    },
 | 
	
		
			
				|  |  | -  },
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  |  };
 | 
	
		
			
				|  |  |  </script>
 | 
	
		
			
				|  |  |  <style lang="scss" scoped>
 |