luobang 3 年之前
父節點
當前提交
6b2d26bb6c
共有 3 個文件被更改,包括 154 次插入17 次删除
  1. 1 0
      build/utils.js
  2. 2 1
      config/index.js
  3. 151 16
      src/views/statisticalReport/components/defendCapacity/getCapacityByDefend.vue

+ 1 - 0
build/utils.js

@@ -20,6 +20,7 @@ let devModules = ['all']
 // let devModules = ['index','appoint','sale','RMS','statisticalReport'];
 // let devModules = ['index','appoint','WMS'];
 // let devModules = ['index','inward']
+// let devModules = ['all']
 // let devModules = ['index','sale']
 // let devModules = ['index','SporadicManage','RMS','statisticalReport']
 // let devModules = ['index','inward','statisticalReport']

+ 2 - 1
config/index.js

@@ -65,6 +65,7 @@ let proxyTable = {
   // 所有数据的请求域名地址
   "/api/v1": {
     target: "http://172.16.33.166:8080",
+    // target: "http://192.168.1.109:8080",
     ws: true,
     pathRewrite: {
       "^/api/v1": "/api/v1"
@@ -72,7 +73,7 @@ let proxyTable = {
   },
   "/views/api/v1": {
     target: "http://172.16.33.166:8080",
-    // target: "http://192.168.1.115:8019",
+    // target: "http://192.168.1.109:8080",
     ws: true,
     pathRewrite: {
       "^/views/api/v1": "/api/v1"

+ 151 - 16
src/views/statisticalReport/components/defendCapacity/getCapacityByDefend.vue

@@ -1,46 +1,181 @@
 <template>
   <!-- 抽查车牌号页面 -->
   <div class="homeworkPath">
-    <div class="top">
-      <el-input placeholder="请输入车牌号" v-model="input" clearable>
+    <div class="timerSelect">
+      <el-date-picker
+        v-model="startTime"
+        type="datetime"
+        placeholder="选择开始日期"
+      >
+      </el-date-picker>
+      <span>至</span>
+      <el-date-picker
+        v-model="endTime"
+        type="datetime"
+        placeholder="选择结束日期"
+      >
+      </el-date-picker>
+
+      <el-button type="primary" class="btn" @click="onclickSearch">
+        <i class="el-icon-search"></i>查询
+      </el-button>
+      <el-button type="primary" @click="exportData()"
+        ><i class="el-icon-download"></i>导出(Excel)</el-button
+      >
+      <span style="margin-left: 1rem">合计车数:</span>
+      <el-input
+        v-model="totalCapacity"
+        :disabled="true"
+        style="width: 100px"
+      ></el-input>
+    </div>
+    <div class="input_box" style="width:225px;margin-left:30px;margin-top:20px">
+      <el-input placeholder="请输入车牌号/出厂门岗" v-model="input" clearable>
       </el-input>
       <el-button type="primary" class="btn" @click="onclick">
         <i class="el-icon-search"></i>查询
       </el-button>
     </div>
-    <dilTable v-bind.sync="option"></dilTable>
+    <div class="table">
+      <dilTable ref="excelDom" v-bind.sync="option" @func="func"></dilTable>
+    </div>
   </div>
 </template>
 
 <script>
+import { sjTime } from "@/utils/sharedJsFile";
+import { getCookie } from "@/utils/util.js";
 export default {
-  name: "homeworkPath",
   data() {
     return {
-      restaurants: [],
+      totalNumber: null,
+      totalCapacity: null,
+      startTime: null,
+      endTime: null,
       input: "",
+      tableTitle: "汽车抽查报表",
       option: {
         // 表格请求数据的地址
-        requestUrl: "api/v1/tms/getCapacityByDefend?apiId=469"
-      }
+        requestUrl: "api/v1/tms/getCapacityByDefend?apiId=474",
+      },
     };
   },
-  created() {},
+  created() {
+    if (
+      getCookie("orgCode") == "dagangadmin" ||
+      getCookie("orgCode") == "zidonghuabu"
+    ) {
+      this.option.requestUrl =
+        "/api/v1/tms/getCapacityByDefend?apiId=474&startTime=null&endTime=null&i=" +
+        new Date();
+    } else if (getCookie("orgCode") == "baiweibu") {
+      this.option.requestUrl =
+        "/api/v1/tms/getCapacityByDefend?apiId=474&orderType=13&startTime=null&endTime=null&i=" +
+        new Date();
+    } else {
+      this.option.requestUrl =
+        "/api/v1/tms/getCapacityByDefend?apiId=474&userId=" +
+        getCookie("orgCode") +
+        "&startTime=null&endTime=null&i=" +
+        new Date();
+    }
+  },
   methods: {
+    func(res) {
+      console.log(res);
+      var resultNetWeightTotal = 0;
+      var currentCapacityTotal = 0;
+      res.list.forEach((e) => {
+        currentCapacityTotal++;
+        resultNetWeightTotal = resultNetWeightTotal + e.resultNetWeight;
+      });
+      this.totalNumber = resultNetWeightTotal.toFixed(2) + "t";
+      this.totalCapacity = currentCapacityTotal;
+    },
     onclick() {
       this.option.requestUrl =
-        "api/v1/tms/getCapacityByDefend?apiId=469&con=" + this.input;
-    }
-  }
+        "/api/v1/tms/getCapacityByDefend?apiId=474&con=" + this.input;
+    },
+    getRequestUrl() {
+      if (
+        getCookie("orgCode") == "dagangadmin" ||
+        getCookie("orgCode") == "zidonghuabu"
+      ) {
+        this.option.requestUrl =
+          "/api/v1/tms/getCapacityByDefend?apiId=474&startTime=null&endTime=null&i=" +
+          new Date();
+      } else if (getCookie("orgCode") == "baoweibu") {
+        this.option.requestUrl =
+          "/api/v1/tms/getCapacityByDefend?apiId=474&startTime=null&endTime=null&i=" +
+          new Date();
+      } else {
+        this.option.requestUrl =
+          "/api/v1/tms/getCapacityByDefend?apiId=474&userId=" +
+          getCookie("orgCode") +
+          "&startTime=null&endTime=null&i=" +
+          new Date();
+      }
+    },
+
+    // 添加开始结束时间筛选
+    onclickSearch() {
+      console.log("aaaa");
+      let startTime = null;
+      let endTime = null;
+      if (this.startTime) {
+        startTime = sjTime(this.startTime);
+        // console.log("startTime", startTime);
+      }
+      if (this.endTime) {
+        endTime = sjTime(this.endTime);
+        // console.log("endTime", endTime);
+      }
+      if (startTime && endTime) {
+        if (startTime < endTime) {
+          if (
+            getCookie("orgCode") == "dagangadmin" ||
+            getCookie("orgCode") == "zidonghuabu"
+          ) {
+            this.option.requestUrl =
+              "/api/v1/tms/getCapacityByDefend?apiId=474&startTime=" +
+              startTime +
+              "&endTime=" +
+              endTime +
+              "&i=" +
+              new Date();
+          } else if (getCookie("orgCode") == "baoweibu") {
+            this.option.requestUrl =
+              "/api/v1/tms/getCapacityByDefend?apiId=474&startTime=" +
+              startTime +
+              "&endTime=" +
+              endTime +
+              "&i=" +
+              new Date();
+          }
+        } else {
+          this.startTime = null;
+          this.endTime = null;
+          this.$message.warning("开始时间要比结束时间早");
+        }
+      } else {
+        this.getRequestUrl();
+      }
+    },
+  },
 };
 </script>
 <style lang="scss" scoped>
 .homeworkPath {
-  .top {
-    padding: 1.25rem 1.875rem;
-    .el-input {
-      width: 20%;
-    }
+  .timerSelect {
+    margin-top: 30px;
+    margin-left: 30px;
   }
 }
+// .input_box {
+// //   margin-top: -40px;
+// //   .el-input {
+// //     width: 240px;
+// //     margin-left: 760px;
+// //   }
+// }
 </style>