浏览代码

Merge branch 'release/v1.0.2' into feature/running_trajectory

duanxiaoduan 1 年之前
父节点
当前提交
e22cba0cd6
共有 1 个文件被更改,包括 22 次插入1 次删除
  1. 22 1
      src/views/statisticalAnalysis/inventoryManagement/pasture/index.vue

+ 22 - 1
src/views/statisticalAnalysis/inventoryManagement/pasture/index.vue

@@ -49,7 +49,7 @@
       </el-tab-pane>
       <el-tab-pane label="用料分析" name="second">
         <div class="search">
-          <el-date-picker v-model="tab2.table.getdataListParm.parammaps.inputDatetime" :clearable="false" class="inputDatetime filter-item" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" style="width: 245px;" :picker-options="pickerOptions" />
+          <el-date-picker v-model="tab2.table.getdataListParm.parammaps.inputDatetime" :clearable="false" class="inputDatetime filter-item" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" style="width: 245px;" :picker-options="pickerOptions2" />
           <el-button class="el-icon-arrow-left elIconArrowLeft" :disabled="Beforedisabled2" @click="handleBefore2" />
           <el-button class="el-icon-arrow-right elIconArrowRight" :disabled="Nextdisabled2" @click="handleNext2" />
           <span style="margin-left: 10px;">统计类型:</span>
@@ -202,6 +202,27 @@ export default {
           }
           return time.getTime() > Date.now()
         }
+      },
+      pickerOptions2: {
+        onPick: ({ maxDate, minDate }) => {
+          this.pickerMinDate = minDate.getTime()
+          if (maxDate) {
+            this.pickerMinDate = ''
+          }
+        },
+        // 限制不能选择今天之后的日期
+        disabledDate: (time) => {
+          if (this.pickerMinDate !== '') {
+            const one = 31 * 24 * 3600 * 1000
+            const minTime = this.pickerMinDate - one
+            let maxTime = this.pickerMinDate + one
+            // if (maxTime > new Date()) {
+            //   maxTime = new Date()
+            // }
+            return time.getTime() < minTime || time.getTime() > maxTime
+          }
+          // return time.getTime() > Date.now()
+        }
       },
       fileComment: [{ 'label': '商务文件评分', 'children': [{ 'label': '1' }, { 'label': '2' }, { 'label': '管理员' }] }],
       displayList:[{id:'1',name:'理论'},{id:'2',name:'实际'}],//列表显示