From 5be9679fb4288936b576cf3d1f1548af1c4151b8 Mon Sep 17 00:00:00 2001 From: feiyu02 <risaku@163.com> Date: 星期一, 21 七月 2025 15:31:21 +0800 Subject: [PATCH] 2025.7.21 任务管理-监管地图功能(待完成) --- src/components/search-option/FYOptionScene.vue | 67 +++++++++++++++++++-------------- 1 files changed, 38 insertions(+), 29 deletions(-) diff --git a/src/components/search-option/FYOptionScene.vue b/src/components/search-option/FYOptionScene.vue index 437b2b3..9815fd8 100644 --- a/src/components/search-option/FYOptionScene.vue +++ b/src/components/search-option/FYOptionScene.vue @@ -1,8 +1,9 @@ <template> - <el-form-item label="鍦烘櫙绫诲瀷"> + <el-form-item :label="label" :prop="prop"> <el-select - v-model="selectedOptions" - placeholder="鍦烘櫙绫诲瀷" + :model-value="value" + @change="handleChange" + :placeholder="label" style="width: 150px" > <el-option @@ -23,51 +24,59 @@ // 鏄惁鍦ㄩ閫夐」澶勬坊鍔犫�滃叏閮ㄢ�濋�夐」 allOption: { type: Boolean, - default: true, + default: true + }, + label: { + type: String, + default: '鍦烘櫙绫诲瀷' }, // 1:椋炵窘鐜绯荤粺锛�2锛氶缇界洃绠$郴缁燂紱 type: { - type: Number, - default: 1, + type: Number || String, + default: 1 }, // 杩斿洖缁撴灉 value: Object, // 鏄惁榛樿杩斿洖鍒濆閫夐」 initValue: { type: Boolean, - default: true, + default: true }, + // form琛ㄥ崟缁戝畾灞炴�у悕 + prop: { + type: String, + default: '_scenetype' + }, + // 鍒囨崲 type 鍚庯紝褰撳墠閫夐」鏄惁娓呯┖ + sourceInit: { + type: Boolean, + default: false + } }, emits: ['update:value'], data() { return { - sceneTypes: enumScene(this.type, this.allOption), - selectedOptions: {}, + // sceneTypes: enumScene(this.type, this.allOption), }; }, - watch: { - selectedOptions: { - handler(nVal, oVal) { - if (nVal != oVal) { - this.$emit('update:value', nVal); - } - }, - deep: true, - }, - value: { - handler(nVal, oVal) { - if (nVal != oVal) { - this.selectedOptions = nVal; - } - }, - deep: true, - immediate: true - }, + computed: { + sceneTypes() { + if (this.sourceInit) { + // 褰撳洜涓簍ype鎴栬�卆llOption鍙傛暟鍙樺寲寮曡捣閫夐」鍙樻洿鏃讹紝娓呯┖褰撳墠閫夐」 + this.handleChange(); + } + return enumScene(this.type, this.allOption); + } + }, + methods: { + handleChange(value) { + this.$emit('update:value', value); + } }, mounted() { if (this.initValue) { - this.selectedOptions = this.sceneTypes[0]; + this.handleChange(this.sceneTypes[0]); } - }, + } }; </script> -- Gitblit v1.9.3