|
@@ -2,9 +2,12 @@
|
|
<a-select
|
|
<a-select
|
|
placeholder="请选择科目"
|
|
placeholder="请选择科目"
|
|
allowClear
|
|
allowClear
|
|
|
|
+ show-search
|
|
:value="valueStr"
|
|
:value="valueStr"
|
|
|
|
+ @search="handleSearch"
|
|
@change="handleChange"
|
|
@change="handleChange"
|
|
style="width: 140px"
|
|
style="width: 140px"
|
|
|
|
+ :filter-option="false"
|
|
>
|
|
>
|
|
<a-select-option
|
|
<a-select-option
|
|
v-for="(item, index) in optionList"
|
|
v-for="(item, index) in optionList"
|
|
@@ -26,20 +29,27 @@ const emit = defineEmits(["update:value"]);
|
|
|
|
|
|
let optionList = $ref<{ id: number; name: string }[]>([]);
|
|
let optionList = $ref<{ id: number; name: string }[]>([]);
|
|
|
|
|
|
-watch(() => props.rootOrgId, fetchData);
|
|
|
|
|
|
+watch(
|
|
|
|
+ () => props.rootOrgId,
|
|
|
|
+ () => fetchData()
|
|
|
|
+);
|
|
onMounted(fetchData);
|
|
onMounted(fetchData);
|
|
-async function fetchData() {
|
|
|
|
|
|
+async function fetchData(searchStr = "") {
|
|
if (typeof props.rootOrgId === "number") {
|
|
if (typeof props.rootOrgId === "number") {
|
|
const res = await getCourseList({
|
|
const res = await getCourseList({
|
|
rootOrgId: props.rootOrgId,
|
|
rootOrgId: props.rootOrgId,
|
|
enable: true,
|
|
enable: true,
|
|
|
|
+ name: searchStr,
|
|
pageNo: 1,
|
|
pageNo: 1,
|
|
pageSize: 100,
|
|
pageSize: 100,
|
|
});
|
|
});
|
|
optionList = res.data.content;
|
|
optionList = res.data.content;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-const valueStr = computed(() => {
|
|
|
|
|
|
+async function handleSearch(searchStr: string) {
|
|
|
|
+ fetchData(searchStr);
|
|
|
|
+}
|
|
|
|
+let valueStr = computed(() => {
|
|
let res: undefined | number | string = props.value ?? undefined;
|
|
let res: undefined | number | string = props.value ?? undefined;
|
|
// if (typeof res === "number") res = props.value + "";
|
|
// if (typeof res === "number") res = props.value + "";
|
|
return res as undefined | string;
|
|
return res as undefined | string;
|