|
@@ -9,6 +9,7 @@ const props = withDefaults(
|
|
|
placeholder?: string
|
|
placeholder?: string
|
|
|
type?: "select" | "checkbox" | "radio"
|
|
type?: "select" | "checkbox" | "radio"
|
|
|
valueIsNumber?: boolean
|
|
valueIsNumber?: boolean
|
|
|
|
|
+ exclude?: string[] | string // 需要排除的值,统一转成string处理
|
|
|
listeners?: any
|
|
listeners?: any
|
|
|
}>(),
|
|
}>(),
|
|
|
{
|
|
{
|
|
@@ -30,7 +31,20 @@ function onChange(v: any) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function getData() {
|
|
function getData() {
|
|
|
- return appStore.dictStore.getDict(props.dictType)
|
|
|
|
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
|
|
+ appStore.dictStore
|
|
|
|
|
+ .getDict(props.dictType)
|
|
|
|
|
+ .then((res: any[]) => {
|
|
|
|
|
+ if (props.exclude) {
|
|
|
|
|
+ const exList = typeof props.exclude === "string" ? [props.exclude] : props.exclude
|
|
|
|
|
+ res = res.filter((item: any) => !exList.includes(item.value + ""))
|
|
|
|
|
+ }
|
|
|
|
|
+ resolve(res)
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch((err) => {
|
|
|
|
|
+ reject(err)
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
</script>
|
|
</script>
|
|
|
<template>
|
|
<template>
|