From d6e6f8b5b31e132e4597eb531168d3e88f3bda72 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期五, 04 七月 2025 17:26:49 +0800
Subject: [PATCH] 2025.7.4 动态溯源

---
 src/components/monitor/FactorRadio.vue |   71 ++++++++++++++++++++++++++++++-----
 1 files changed, 60 insertions(+), 11 deletions(-)

diff --git a/src/components/monitor/FactorRadio.vue b/src/components/monitor/FactorRadio.vue
index ce67151..e133e8e 100644
--- a/src/components/monitor/FactorRadio.vue
+++ b/src/components/monitor/FactorRadio.vue
@@ -1,32 +1,59 @@
 <template>
-  <BaseCard>
+  <transition
+    name="el-zoom-in-left"
+    @before-enter="onBeforeEnter"
+    @after-leave="onAfterLeave"
+  >
+    <BaseCard v-show="show" direction="left">
+      <template #content>
+        <!-- <el-collapse-transition> -->
+        <el-radio-group v-model="radio" size="default" @change="handleChange">
+          <el-radio v-for="(item, i) in options" :key="i" :value="item.value">{{
+            item.label
+          }}</el-radio>
+        </el-radio-group>
+        <!-- </el-collapse-transition> -->
+        <span @click="show = !show" class="btn-show">
+          <el-icon v-if="show"><ArrowLeftBold /></el-icon>
+          <el-icon v-else><ArrowRightBold /></el-icon>
+        </span>
+      </template>
+    </BaseCard>
+  </transition>
+  <BaseCard v-show="btnShow">
     <template #content>
-      <el-radio-group v-model="radio" size="default" @change="handleChange">
-        <el-radio v-for="(item, i) in options" :key="i" :value="item.value">{{
-          item.label
-        }}</el-radio>
-      </el-radio-group>
+      <el-row @click="show = !show" class="btn-show">
+        <font-awesome-icon icon="fa-check-circle" />
+        <el-icon v-if="show"><ArrowLeftBold /></el-icon>
+        <el-icon v-else><ArrowRightBold /></el-icon>
+      </el-row>
     </template>
   </BaseCard>
 </template>
 
 <script>
 // 鐩戞祴鍥犲瓙鍗曢�夋
-import { radioOptions } from '@/constant/radio-options';
+import { radioOptions, defaultOptions } from '@/constant/radio-options';
 import { TYPE0 } from '@/constant/device-type';
 
 export default {
   props: {
+    modelValue: {
+      type: String,
+      default: defaultOptions(TYPE0).value
+    },
     deviceType: {
       type: String,
       // type0: 杞﹁浇鎴栨棤浜烘満; type1:鏃犱汉鑸�
       default: TYPE0
     }
   },
-  emits: ['change'],
+  emits: ['change', 'update:modelValue'],
   data() {
     return {
-      radio: radioOptions(TYPE0)[0].value
+      radio: defaultOptions(TYPE0).value,
+      show: true,
+      btnShow: false
     };
   },
   computed: {
@@ -38,22 +65,44 @@
     deviceType(nV, oV) {
       if (nV != oV) {
         this.radio = this.options[0].value;
+        this.$emit('update:modelValue', this.radio);
+      }
+    },
+    modelValue(nV, oV) {
+      if (nV != oV) {
+        this.radio = nV;
       }
     }
   },
   methods: {
     handleChange(value) {
-      this.$emit('change', value);
+      const item = this.options.find((v) => v.value == value);
+      this.$emit('change', item.value, item);
+      this.$emit('update:modelValue', item.value);
       // todo 鍦板浘3d鍥惧儚鍒囨崲灞曠ず鐩戞祴鍥犲瓙
+    },
+    onBeforeEnter() {
+      this.btnShow = false;
+    },
+    onAfterLeave() {
+      this.btnShow = true;
     }
   }
 };
 </script>
 <style scoped>
-.el-radio {
+:deep(.el-radio) {
   --el-radio-text-color: white;
   --el-color-primary: #23dad1;
   margin-right: 10px;
   height: initial;
 }
+
+.btn-show {
+  cursor: pointer;
+  padding: 4px 0;
+}
+.btn-show:hover {
+  color: #23dad1;
+}
 </style>

--
Gitblit v1.9.3