From 46566d05cb156d40323078133191595d2a2f11c4 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期四, 10 十月 2024 17:27:04 +0800
Subject: [PATCH] 巡查任务管理界面开发中

---
 src/components/search-option/FYOptionTime.vue |   51 ++++++++++++++++++---------------------------------
 1 files changed, 18 insertions(+), 33 deletions(-)

diff --git a/src/components/search-option/FYOptionTime.vue b/src/components/search-option/FYOptionTime.vue
index fdea90c..ac1292c 100644
--- a/src/components/search-option/FYOptionTime.vue
+++ b/src/components/search-option/FYOptionTime.vue
@@ -1,8 +1,9 @@
 <template>
-  <el-form-item label="鏃堕棿">
+  <el-form-item label="鏃堕棿" :prop="prop">
     <el-date-picker
-      v-model="selectedOptions"
-      type="month"
+      v-model="date"
+      @change="handleChange"
+      :type="type"
       placeholder="閫夋嫨鏃堕棿"
       style="width: 150px"
     />
@@ -10,9 +11,10 @@
 </template>
 
 <script>
-import dayjs from 'dayjs'
+import dayjs from 'dayjs';
 
-const MONTH = 'month'
+const MONTH = 'month';
+const DATE = 'date';
 
 export default {
   props: {
@@ -26,44 +28,27 @@
     initValue: {
       type: Boolean,
       default: true
-    }
+    },
+    prop: String
   },
   emits: ['update:value'],
   data() {
     return {
-      selectedOptions: ''
-    }
+      date: this.value
+    };
   },
-  watch: {
-    selectedOptions: {
-      handler(nVal, oVal) {
-        if (nVal != oVal) {
-          this.$emit('update:value', nVal)
-        }
-      }
-    },
-    value: {
-      handler(nVal, oVal) {
-        if (nVal != oVal) {
-          this.selectedOptions = nVal
-        }
-      }
-    }
+  computed:{
   },
   methods: {
-    timeFormat() {
-      switch (this.type) {
-        case MONTH:
-          return 'YYYY-MM'
-        default:
-          return 'YYYY-MM'
-      }
-    }
+    handleChange(value) {
+      this.$emit('update:value', value);
+    },
   },
   mounted() {
     if (this.initValue) {
-      this.selectedOptions = new Date()
+      this.date = new Date()
+      this.handleChange(this.date);
     }
   }
-}
+};
 </script>

--
Gitblit v1.9.3