Parcourir la source

refactor(公告): 将发布时间范围选择拆分为独立的开始和结束时间字段

yz il y a 2 mois
Parent
commit
f191c23bc9
1 fichiers modifiés avec 30 ajouts et 20 suppressions
  1. 30 20
      src/views/announcement/index.vue

+ 30 - 20
src/views/announcement/index.vue

@@ -101,20 +101,32 @@ export default {
                         }]
                     },
                     {
-                        label: "发布时间",
-                        prop: "publishTime",
-                        type: "daterange",
+                        label: "开始时间",
+                        prop: "publishTimeStart",
+                        type: "date",
                         format: "yyyy-MM-dd",
                         valueFormat: "yyyy-MM-dd",
-                        rangeSeparator: "至",
-                        startPlaceholder: "开始时间",
-                        endPlaceholder: "结束时间",
-                        overHidden: true,
+                        placeholder: "请选择开始时间",
                         search: true,
-                        hide: true,  // 在表格中隐藏,只用于搜索
-                        addDisplay: false,  // 新增时不显示
-                        editDisplay: false, // 编辑时不显示
-                        viewDisplay: false  // 查看时不显示
+                        searchSpan: 6,
+                        hide: true,
+                        addDisplay: false,
+                        editDisplay: false,
+                        viewDisplay: false
+                    },
+                    {
+                        label: "结束时间",
+                        prop: "publishTimeEnd",
+                        type: "date",
+                        format: "yyyy-MM-dd",
+                        valueFormat: "yyyy-MM-dd",
+                        placeholder: "请选择结束时间",
+                        search: true,
+                        searchSpan: 6,
+                        hide: true,
+                        addDisplay: false,
+                        editDisplay: false,
+                        viewDisplay: false
                     },
                     {
                         label: "经销商",
@@ -423,18 +435,16 @@ export default {
             this.onLoad(this.page, this.query);
         },
         onLoad(page, params = {}) {
-            const { publishTime } = this.query;
+            const { publishTimeStart, publishTimeEnd } = this.query;
             let values = {
                 ...params,
+                ...this.query
             };
-            if (publishTime) {
-                values = {
-                    ...params,
-                    publishTimeStart: publishTime[0],
-                    publishTimeEnd: publishTime[1],
-                    ...this.query
-                };
-                values.publishTime = null;
+            if (publishTimeStart) {
+                values.publishTimeStart = publishTimeStart;
+            }
+            if (publishTimeEnd) {
+                values.publishTimeEnd = publishTimeEnd;
             }
             this.loading = true;
             getList(page.currentPage, page.pageSize, values).then(res => {