feat:退还各自食堂
This commit is contained in:
1 parent
cf26ba2a74
commit
32d07535f5
4 files changed
+114
-116
No files matched your search
@@ -1,12 +1,7 @@
|
||||
<template>
|
||||
<el-select
|
||||
style="width: 100%"
|
||||
v-model="state.selectId"
|
||||
:placeholder="props.placeholder"
|
||||
clearable
|
||||
@visible-change="(e: boolean) => e && getDictOptions()"
|
||||
>
|
||||
<el-option v-for="v in state.dictList" :key="v.code" :label="v.label" :value="v.value" />
|
||||
<el-select style="width: 100%" v-model="state.selectId" :placeholder="props.placeholder" clearable
|
||||
@visible-change="(e: boolean) => e && getDictOptions()">
|
||||
<el-option v-for="v in filterDictList" :key="v.code" :label="v.label" :value="v.value" />
|
||||
</el-select>
|
||||
</template>
|
||||
|
||||
@@ -20,6 +15,7 @@ const selectId = defineModel()
|
||||
export type Props = {
|
||||
dictCode: string
|
||||
placeholder?: string
|
||||
hideIds?: string | Array<string>
|
||||
}
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
placeholder: "请选择",
|
||||
@@ -40,6 +36,21 @@ watch(
|
||||
{ immediate: true },
|
||||
)
|
||||
|
||||
const filterDictList = computed(() => {
|
||||
const hideKeys = props.hideIds
|
||||
// 排序
|
||||
const list = state.dictList?.sort((pren: any, next: any) => {
|
||||
return pren.sortOrder - next.sortOrder
|
||||
})
|
||||
if (!hideKeys) return list
|
||||
if (typeof hideKeys == "string") {
|
||||
return list.filter((p: any) => p.value != hideKeys)
|
||||
}
|
||||
if (Array.isArray(hideKeys)) {
|
||||
return list.filter((p: any) => !hideKeys.includes(p.value))
|
||||
}
|
||||
})
|
||||
|
||||
async function getDictOptions() {
|
||||
if (!props.dictCode) return []
|
||||
const dicts = dict().getDict(props.dictCode)
|
||||
@@ -60,7 +71,7 @@ async function getDictOptions() {
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.el-tag + .el-tag {
|
||||
.el-tag+.el-tag {
|
||||
margin-left: 10px;
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user