Explorar el Código

入库检斤记录时间筛选

gjy hace 3 años
padre
commit
444d13689b
Se han modificado 1 ficheros con 83 adiciones y 2 borrados
  1. 83 2
      src/views/houseSelfCollect/weightCheckRecord.vue

+ 83 - 2
src/views/houseSelfCollect/weightCheckRecord.vue

@@ -22,10 +22,13 @@
         </el-col>
         <el-col :span="12" class="bg-right">
           <div style="display:flex">
-            <el-select v-model="warehouseName" placeholder="请选择仓库名" @change="warehouseNameChange">
+            <el-select style='margin-right:5px;width:40%' v-model="warehouseName" placeholder="请选择仓库名" @change="warehouseNameChange">
               <el-option v-for="item in warehouseList" :key="item.id" :label="item.warehouseName"
                 :value="item.warehouseName"></el-option>
             </el-select>
+             <el-date-picker v-model="value2" type="daterange" align="right" unlink-panels range-separator="至"
+          start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="pickerOptions">
+        </el-date-picker>
             <el-input :placeholder="warehousingType == 1 ? '可按业务编号、合同编号/移库编号、车牌号查找':'可按业务编号、车牌号、客户名查找'" clearable
               v-model="searchKeyWord" class="search_css"></el-input>
             <!-- <el-input placeholder="可按业务编号、车牌号、客户名查找" clearable v-model="searchKeyWord"></el-input> -->
@@ -162,9 +165,53 @@
         // binNumberId: '', //仓位Id
         // warehouseType: '',
         compId: '',
+        pickerOptions: {
+          shortcuts: [{
+              text: '本周',
+              onClick(picker) {
+                const end = new Date()
+                const start = new Date()
+                var thisDay = start.getDay()
+                var thisDate = start.getDate()
+                if (thisDay != 0) {
+                  start.setDate(thisDate - thisDay)
+                }
+                picker.$emit('pick', [start, end])
+              },
+            },
+            {
+              text: '本月',
+              onClick(picker) {
+                const end = new Date()
+                const start = new Date()
+                start.setDate(1)
+                picker.$emit('pick', [start, end])
+              },
+            },
+            {
+              text: '本季度',
+              onClick(picker) {
+                var oDate = new Date()
+
+                var thisYear = oDate.getFullYear()
+                var thisMonth = oDate.getMonth() + 1
+
+                var n = Math.ceil(thisMonth / 3) // 季度
+
+                var Month = n * 3 - 1
+
+                var start = new Date(thisYear, Month - 2, 1)
+                var end = new Date()
+
+                picker.$emit('pick', [start, end])
+              },
+            },
+          ],
+        },
         //分页
         currentPage: 1,
         pageSize: 10,
+        value2:[],
         deptCircularPage: {},
         deptBudgetTotal: 0,
         warehouseList: [], //仓库
@@ -216,6 +263,8 @@
         jjSelectPrintList: [],
         printSeparately: false,
         onePrint: false,
+        startDate:'',
+        endDate:''
       }
     },
     activated() {
@@ -263,8 +312,38 @@
         } else {
           this.printSeparately = false
         }
+      },
+       dateFormat(fmt, date) {
+        let ret
+        const opt = {
+          'Y+': date.getFullYear().toString(), // 年
+          'm+': (date.getMonth() + 1).toString(), // 月
+          'd+': date.getDate().toString(), // 日
+          'H+': date.getHours().toString(), // 时
+          // "M+": date.getMinutes().toString(),         // 分
+          // "S+": date.getSeconds().toString()          // 秒
+          // 有其他格式化字符需求可以继续添加,必须转化成字符串
+        }
+        for (let k in opt) {
+          ret = new RegExp('(' + k + ')').exec(fmt)
+          if (ret) {
+            fmt = fmt.replace(
+              ret[1],
+              ret[1].length == 1 ? opt[k] : opt[k].padStart(ret[1].length, '0')
+            )
+          }
+        }
+        return fmt
       },
       lookup() {
+        if (this.value2) {
+          this.startDate = this.dateFormat('YYYY-mm-dd', this.value2[0])
+          this.endDate = this.dateFormat('YYYY-mm-dd', this.value2[1])
+        } else {
+          this.startDate = ''
+          this.endDate = ''
+        }
+        this.currentPage = 1
         this.getList()
       },
       changeType(val) {
@@ -460,7 +539,9 @@
             warehouseName: this.warehouseName,
             managementType: 1,
             serviceManagementType: this.warehousingType,
-            statusType: this.choice
+            statusType: this.choice,
+            startDate: this.startDate,
+            endDate: this.endDate,
           })
           .toPromise()
           .then((response) => {