yijianjun 1 kuukausi sitten
vanhempi
commit
4c6e496428

+ 2 - 2
src/views/modules/load-forecasting-v2/components/add-or-update.vue

@@ -75,7 +75,7 @@
             </el-input>
           </el-form-item>
         </el-col>
-        <el-col :span="24">
+        <!-- <el-col :span="24">
           <el-form-item
             label="当前用户数量"
             prop="userCount"
@@ -90,7 +90,7 @@
               :readonly="type == 'view'"
             />
           </el-form-item>
-        </el-col>
+        </el-col> -->
         <el-col :span="24">
           <el-form-item
             label="开始时间"

+ 60 - 11
src/views/modules/load-forecasting-v2/index.vue

@@ -143,16 +143,43 @@
                 height: '40px',
               }"
               class="item-label"
-              >时间范围</label
+              >开始时间</label
             >
             <el-date-picker
-              size="large"
-              v-model="searchForm.dateRange"
-              type="daterange"
-              value-format="yyyy-MM-dd"
-              range-separator="至"
-              start-placeholder="开始日期"
-              end-placeholder="结束日期"
+              v-model="searchForm.start_time_start"
+              :type="dateTypeMap[searchForm.dimension]"
+              :value-format="dateTypeFormatMap[searchForm.dimension]"
+              placeholder="请选择开始时间"
+              :picker-options="startPickerOptions"
+            />
+          </div>
+          <div
+            :style="{
+              alignItems: 'center',
+              margin: '0 10px 0 0',
+              display: 'flex',
+            }"
+          >
+            <label
+              :style="{
+                margin: '0 10px 0 0',
+                whiteSpace: 'nowrap',
+                color: '#666',
+                display: 'inline-block',
+                lineHeight: '40px',
+                fontSize: 'inherit',
+                fontWeight: '500',
+                height: '40px',
+              }"
+              class="item-label"
+              >结束时间</label
+            >
+            <el-date-picker
+              v-model="searchForm.end_time_end"
+              :type="dateTypeMap[searchForm.dimension]"
+              :value-format="dateTypeFormatMap[searchForm.dimension]"
+              placeholder="请选择结束时间"
+              :picker-options="endPickerOptions"
             />
           </div>
           <el-button class="search" type="success" @click="search()">
@@ -251,7 +278,7 @@
               {{ scope.row.userGrowthRate + '%' }}
             </template>
           </el-table-column>
-          <el-table-column :resizable="true" :sortable="true" prop="userCount" label="当前用户数量" />
+          <!-- <el-table-column :resizable="true" :sortable="true" prop="userCount" label="当前用户数量" /> -->
           <el-table-column :resizable="true" :sortable="true" prop="result" label="预测结果">
             <template slot-scope="scope">
               {{ scope.row.result == '0' ? '待预测' : scope.row.result == '1' ? '成功' : '失败' }}
@@ -349,6 +376,16 @@ export default {
         regionId: null,
         dateRange: [],
       },
+      dateTypeMap: {
+        daily: 'date',
+        monthly: 'month',
+        yearly: 'year',
+      },
+      dateTypeFormatMap: {
+        daily: 'yyyy-MM-dd',
+        monthly: 'yyyy-MM',
+        yearly: 'yyyy',
+      },
       dataList: [],
       pageIndex: 1,
       pageSize: 10,
@@ -356,6 +393,20 @@ export default {
       dataListLoading: false,
       dataListSelections: [],
       layouts: ['prev', 'pager', 'next', 'sizes'],
+      startPickerOptions: {
+        disabledDate: time => {
+          if (!this.searchForm.end_time_end) return false;
+          const endTime = new Date(this.searchForm.end_time_end);
+          return time.getTime() > endTime.getTime();
+        },
+      },
+      endPickerOptions: {
+        disabledDate: time => {
+          if (!this.searchForm.start_time_start) return false;
+          const start = new Date(this.searchForm.start_time_start);
+          return time.getTime() < start.getTime();
+        },
+      },
     };
   },
   async created() {
@@ -373,8 +424,6 @@ export default {
         order: 'desc',
         ...this.searchForm,
         dimension: this.searchForm.dimension || null,
-        start_time_start: this.searchForm.dateRange[0],
-        end_time_end: this.searchForm.dateRange[1],
       };
       this.$http({
         url: '/predict-conf/page',