feat: dict utils【f7810df5】

This commit is contained in:
YunaiV
2025-03-26 19:52:44 +08:00
parent 0d9fe44cba
commit bcf4b831bc
3 changed files with 199 additions and 17 deletions

View File

@@ -1,10 +1,11 @@
import { h } from 'vue';
import { setupVbenVxeTable, useVbenVxeGrid } from '@vben/plugins/vxe-table';
import { useDictStore } from '#/store';
import { Button, Image, Tag } from 'ant-design-vue';
import { getDictObj } from '#/utils/dict';
import { useVbenForm } from './form';
setupVbenVxeTable({
@@ -77,13 +78,12 @@ setupVbenVxeTable({
// TODO @芋艿:后续研究下,看看有没优解
vxeUI.renderer.add('CellDict', {
renderTableDefault(renderOpts, params) {
const dictStore = useDictStore();
const { props } = renderOpts;
const { column, row } = params;
if (!props) {
return '';
}
const dict = dictStore.getDictData(props.type, row[column.field]);
const dict = getDictObj(props.type, row[column.field]);
// 转义
if (dict) {
if (`${dict.colorType}` === 'primary') dict.colorType = 'processing';