瀏覽代碼

Мелкие доработки

Book Pauk 2 年之前
父節點
當前提交
548f18430d
共有 2 個文件被更改,包括 15 次插入2 次删除
  1. 8 2
      client/components/Search/Search.vue
  2. 7 0
      client/components/Search/SelectDateDialog/SelectDateDialog.vue

+ 8 - 2
client/components/Search/Search.vue

@@ -408,6 +408,7 @@ class Search {
     };
     };
 
 
     searchDate = '';
     searchDate = '';
+    prevManualDate = '';
 
 
     //settings
     //settings
     showCounts = true;
     showCounts = true;
@@ -977,6 +978,10 @@ class Search {
     updateSearchDate(toLocal) {
     updateSearchDate(toLocal) {
         if (toLocal) {
         if (toLocal) {
             let local = this.search.date || '';
             let local = this.search.date || '';
+
+            if (this.isManualDate(local) || !local)
+                this.prevManualDate = local;
+
             if (this.isManualDate(local))
             if (this.isManualDate(local))
                 local = 'manual';
                 local = 'manual';
 
 
@@ -1004,8 +1009,9 @@ class Search {
     dateSelectItemClick(itemValue) {
     dateSelectItemClick(itemValue) {
         if (itemValue == 'manual') {
         if (itemValue == 'manual') {
             if (!this.isManualDate(this.search.date)) {
             if (!this.isManualDate(this.search.date)) {
-                this.search.date = '';
-                this.searchDate = '';
+                this.search.date = this.prevManualDate;
+                if (!this.search.date)
+                    this.searchDate = '';
             }
             }
             this.selectDateDialogVisible = true
             this.selectDateDialogVisible = true
         }
         }

+ 7 - 0
client/components/Search/SelectDateDialog/SelectDateDialog.vue

@@ -96,7 +96,14 @@ class SelectDateDialog {
         this.to = this.splitDate.to;
         this.to = this.splitDate.to;
     }
     }
 
 
+    isManualDate(date) {
+        return date && utils.isDigit(date[0]) && utils.isDigit(date[1]);
+    }
+
     get splitDate() {
     get splitDate() {
+        if (!this.isManualDate(this.date))
+            return {from: '', to: ''};
+
         const [from = '', to = ''] = (this.date || '').split(',');
         const [from = '', to = ''] = (this.date || '').split(',');
         return {from, to};
         return {from, to};
     }
     }