feat: use Rate

This commit is contained in:
xingyu4j
2025-10-09 17:07:30 +08:00
parent 5e1187bab5
commit 9520d7016e
2 changed files with 17 additions and 12 deletions

View File

@@ -70,23 +70,16 @@ export function useFormSchema(): VbenFormSchema[] {
},
rules: 'required',
},
// TODO @xingyu无法使用 Rate 组件,会报 TypeError: Cannot read properties of undefined (reading 'prefixCls')
{
fieldName: 'descriptionScores',
label: '描述星级',
component: 'InputNumber',
componentProps: {
placeholder: '请选择描述星级',
},
component: 'Rate',
rules: z.number().min(1).max(5).default(5),
},
{
fieldName: 'benefitScores',
label: '服务星级',
component: 'InputNumber',
componentProps: {
placeholder: '请选择服务星级',
},
component: 'Rate',
rules: z.number().min(1).max(5).default(5),
},
{
@@ -204,12 +197,18 @@ export function useGridColumns<T = MallCommentApi.Comment>(
{
field: 'descriptionScores',
title: '商品评分',
minWidth: 90,
minWidth: 150,
slots: {
default: 'descriptionScores',
},
},
{
field: 'benefitScores',
title: '服务评分',
minWidth: 90,
minWidth: 150,
slots: {
default: 'benefitScores',
},
},
{
field: 'content',

View File

@@ -6,7 +6,7 @@ import { h } from 'vue';
import { confirm, DocAlert, Page, prompt, useVbenModal } from '@vben/common-ui';
import { message, Textarea } from 'ant-design-vue';
import { message, Rate, Textarea } from 'ant-design-vue';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import {
@@ -129,6 +129,12 @@ const [Grid, gridApi] = useVbenVxeGrid({
</template>
<FormModal @success="handleRefresh" />
<Grid table-title="评论列表">
<template #descriptionScores="{ row }">
<Rate v-model:value="row.descriptionScores" :disabled="true" />
</template>
<template #benefitScores="{ row }">
<Rate v-model:value="row.benefitScores" :disabled="true" />
</template>
<template #toolbar-tools>
<TableAction
:actions="[