fix: repair emoji resource selects

This commit is contained in:
hy 2026-04-24 13:29:54 +08:00
parent 69fe442306
commit d0fcfe2151

View File

@ -1,5 +1,5 @@
<script lang="ts" setup> <script lang="ts" setup>
import { reactive, ref } from 'vue'; import { computed, reactive, ref } from 'vue';
import { useAccessStore } from '@vben/stores'; import { useAccessStore } from '@vben/stores';
@ -35,7 +35,6 @@ import {
Modal, Modal,
Pagination, Pagination,
Select, Select,
SelectOption,
Switch, Switch,
Table, Table,
message, message,
@ -56,6 +55,24 @@ const coverInputRef = ref<HTMLInputElement>();
const sourceInputRef = ref<HTMLInputElement>(); const sourceInputRef = ref<HTMLInputElement>();
const sysOriginOptions = getAllowedSysOrigins(accessStore.accessCodes || []); const sysOriginOptions = getAllowedSysOrigins(accessStore.accessCodes || []);
const groupOptions = computed(() =>
groupList.value.map((item) => ({
label: item.groupName,
value: item.id,
})),
);
const emojiTypeOptions = EMOJI_TYPE_OPTIONS.map((item) => ({
label: item.name,
value: item.value,
}));
const emojiSourceTypeOptions = EMOJI_SOURCE_TYPE_OPTIONS.map((item) => ({
label: item.name,
value: item.value,
}));
const shelfStatusOptions = PRODUCT_SHOWCASE_OPTIONS.map((item) => ({
label: item.name,
value: item.value as any,
}));
const query = reactive<Record<string, any>>({ const query = reactive<Record<string, any>>({
cursor: 1, cursor: 1,
@ -289,56 +306,32 @@ loadData(true);
<Select <Select
v-model:value="query.groupId" v-model:value="query.groupId"
:loading="groupLoading" :loading="groupLoading"
:options="groupOptions"
allow-clear allow-clear
option-label-prop="label"
placeholder="分组" placeholder="分组"
style="width: 160px" style="width: 160px"
@change="loadData(true)" @change="loadData(true)"
> />
<SelectOption
v-for="item in groupList"
:key="item.id"
:value="item.id"
:label="`${item.groupName}`">
{{ item.groupName }}
</SelectOption>
</Select>
</InlineFilterField> </InlineFilterField>
<InlineFilterField label="类型"> <InlineFilterField label="类型">
<Select <Select
v-model:value="query.type" v-model:value="query.type"
:options="emojiTypeOptions"
allow-clear allow-clear
option-label-prop="label"
placeholder="类型" placeholder="类型"
style="width: 140px" style="width: 140px"
@change="loadData(true)" @change="loadData(true)"
> />
<SelectOption
v-for="item in EMOJI_TYPE_OPTIONS"
:key="item.value"
:value="item.value"
:label="`${item.name}`">
{{ item.name }}
</SelectOption>
</Select>
</InlineFilterField> </InlineFilterField>
<InlineFilterField label="状态"> <InlineFilterField label="状态">
<Select <Select
v-model:value="query.shelfStatus" v-model:value="query.shelfStatus"
:options="shelfStatusOptions"
allow-clear allow-clear
option-label-prop="label"
placeholder="状态" placeholder="状态"
style="width: 140px" style="width: 140px"
@change="loadData(true)" @change="loadData(true)"
> />
<SelectOption
v-for="item in PRODUCT_SHOWCASE_OPTIONS"
:key="String(item.value)"
:value="item.value"
:label="`${item.name}`">
{{ item.name }}
</SelectOption>
</Select>
</InlineFilterField> </InlineFilterField>
<Button :loading="loading" type="primary" @click="loadData(true)"> <Button :loading="loading" type="primary" @click="loadData(true)">
搜索 搜索
@ -417,32 +410,21 @@ loadData(true);
<div class="form-grid"> <div class="form-grid">
<div class="form-item"> <div class="form-item">
<label class="form-label">分组</label> <label class="form-label">分组</label>
<Select option-label-prop="label" <Select
v-model:value="form.groupId" v-model:value="form.groupId"
:loading="groupLoading" :loading="groupLoading"
:options="groupOptions"
placeholder="请选择分组" placeholder="请选择分组"
> />
<SelectOption
v-for="item in groupList"
:key="item.id"
:value="item.id"
:label="`${item.groupName}`">
{{ item.groupName }}
</SelectOption>
</Select>
</div> </div>
<div class="form-item"> <div class="form-item">
<label class="form-label">资源类型</label> <label class="form-label">资源类型</label>
<Select option-label-prop="label" v-model:value="form.sourceType" placeholder="资源类型"> <Select
<SelectOption v-model:value="form.sourceType"
v-for="item in EMOJI_SOURCE_TYPE_OPTIONS" :options="emojiSourceTypeOptions"
:key="item.value" placeholder="资源类型"
:value="item.value" />
:label="`${item.name}`">
{{ item.name }}
</SelectOption>
</Select>
</div> </div>
<div class="form-item"> <div class="form-item">
@ -492,28 +474,20 @@ loadData(true);
<div class="form-item"> <div class="form-item">
<label class="form-label">类型</label> <label class="form-label">类型</label>
<Select option-label-prop="label" v-model:value="form.type" placeholder="类型"> <Select
<SelectOption v-model:value="form.type"
v-for="item in EMOJI_TYPE_OPTIONS" :options="emojiTypeOptions"
:key="item.value" placeholder="类型"
:value="item.value" />
:label="`${item.name}`">
{{ item.name }}
</SelectOption>
</Select>
</div> </div>
<div class="form-item"> <div class="form-item">
<label class="form-label">上架</label> <label class="form-label">上架</label>
<Select option-label-prop="label" v-model:value="form.shelfStatus" placeholder="上架"> <Select
<SelectOption v-model:value="form.shelfStatus"
v-for="item in PRODUCT_SHOWCASE_OPTIONS" :options="shelfStatusOptions"
:key="String(item.value)" placeholder="上架"
:value="item.value" />
:label="`${item.name}`">
{{ item.name }}
</SelectOption>
</Select>
</div> </div>
<div class="form-item"> <div class="form-item">