From 0796eebe3520fafb0ac5d36ee584af81506d7e9c Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期六, 20 九月 2025 14:05:52 +0800 Subject: [PATCH] 2025.9.20 数据产品(待完成) --- src/components/search-option/FYOptionTopTask.vue | 41 +++++++++++++++++++++++++++++++++-------- 1 files changed, 33 insertions(+), 8 deletions(-) diff --git a/src/components/search-option/FYOptionTopTask.vue b/src/components/search-option/FYOptionTopTask.vue index 291094b..a6cdd0c 100644 --- a/src/components/search-option/FYOptionTopTask.vue +++ b/src/components/search-option/FYOptionTopTask.vue @@ -3,11 +3,11 @@ <el-select :model-value="formatedValue" @update:model-value="handleChange" - placeholder="鎬讳换鍔�" + :placeholder="label" style="width: 260px" > <el-option - v-for="s in topTasks" + v-for="s in filtedBeforeTask" :key="s.value" :label="s.label" :value="s.value" @@ -37,17 +37,44 @@ type: String, default: 'topTaskId' }, + // 閫夐」绛涢�夋潯浠讹紝绛涢�夋煇浠诲姟涔嬪墠鐨勭浉鍚岃鏀垮尯鍒掑唴鐨勪换鍔� + beforeTask: { + type: Object, + default: () => { + return {}; + } + } }, emits: ['update:value'], data() { return { selected: {}, - topTasks: [], + topTasks: [] }; }, computed: { + // 閫夋嫨妗嗕腑浣跨敤椤跺眰浠诲姟id浣滀负閫夐」鍊� formatedValue() { return this.value.tguid; + }, + // 鏌愪换鍔′箣鍓嶇殑鐩稿悓琛屾斂鍖哄垝鍐呯殑浠诲姟 + filtedBeforeTask() { + const filteredTasks = this.topTasks.filter((t) => { + return ( + (!this.beforeTask.provincecode || + this.beforeTask.provincecode == t.data.provincecode) && + (!this.beforeTask.citycode || + this.beforeTask.citycode == t.data.citycode) && + (!this.beforeTask.districtcode || + this.beforeTask.districtcode == t.data.districtcode) && + (!this.beforeTask.starttime || + t.data.starttime < this.beforeTask.starttime) + ); + }); + if (filteredTasks.length > 0) { + this.handleChange(filteredTasks[0]?.value); + } + return filteredTasks; } }, methods: { @@ -69,13 +96,11 @@ }, //鏌ヨ瀛愪换鍔$粺璁′俊鎭� handleChange(value) { - const task = this.topTasks.find( - (t) => t.data.tguid == value - ); - const param = task ? task.data : {} + const task = this.topTasks.find((t) => t.data.tguid == value); + const param = task ? task.data : {}; this.$emit('update:value', param); - }, + } }, mounted() { this.getOptions(); -- Gitblit v1.9.3