|
@@ -16,8 +16,10 @@
|
|
|
popper-class="custom-select-popper"
|
|
|
:teleported="false"
|
|
|
clearable
|
|
|
+ filterable
|
|
|
+ @input="fetchFilteredUnits"
|
|
|
>
|
|
|
- <el-option v-for="unit in units" :key="unit.id" :label="unit.unit_name" :value="unit.unit_name" />
|
|
|
+ <el-option v-for="unit in filteredUnits" :key="unit.id" :label="unit.unit_name" :value="unit.unit_name" />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="登记人" label-width="200px">
|
|
@@ -40,6 +42,7 @@ const newTask = reactive({
|
|
|
registrar: ''
|
|
|
});
|
|
|
const units = ref([]);
|
|
|
+const filteredUnits = ref([]);
|
|
|
|
|
|
const props = defineProps<{
|
|
|
eventId?: string;
|
|
@@ -60,11 +63,11 @@ const fetchUser = async () => {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-const fetchUnits = async () => {
|
|
|
+const fetchUnits = async (searchTerm) => {
|
|
|
try {
|
|
|
- const response = await getUnits();
|
|
|
+ const response = await getUnits({ search: searchTerm });
|
|
|
if (response.code === 200) {
|
|
|
- units.value = response.data;
|
|
|
+ filteredUnits.value = response.data;
|
|
|
} else {
|
|
|
console.error('获取单位数据失败:', response.msg);
|
|
|
}
|