From aa1f56d5ef2d48b980a2fab3e88379efbe09b0d1 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期二, 26 十二月 2023 17:04:27 +0800
Subject: [PATCH] 评估任务模块新增任务状态管理逻辑

---
 src/components/search-option/FYOptionTime.vue |   44 +++++++++++++++-----------------------------
 1 files changed, 15 insertions(+), 29 deletions(-)

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

--
Gitblit v1.9.3