解决文件地址、行政区划customRender无效BUG问题

This commit is contained in:
zjl 2024-12-16 13:07:07 +08:00
parent c4661aedae
commit 8896ad533a
2 changed files with 23 additions and 4 deletions

View File

@ -44,7 +44,7 @@
import editDialog from './edit.vue';
import { TableAction } from '@/components/Table';
import { renderIcon } from '@/utils';
import { useMessage, useDialog } from 'naive-ui';
import { useMessage, useDialog, NTag } from 'naive-ui';
/**
* 定义参数变量
@ -65,28 +65,47 @@
title: '城市级别',
key: 'level',
width: 100,
customRender({ record }) {
render(record) {
let levelText = '';
let color = '';
switch (record.level) {
case 0:
levelText = '省份';
color = 'success';
break;
case 1:
levelText = '城市';
color = 'primary';
break;
case 2:
levelText = '县区';
color = 'warning';
break;
case 3:
levelText = '街道';
color = 'info';
break;
case 4:
levelText = '居委会';
color = 'error';
break;
default:
break;
}
return h('span', levelText || '-');
// return h('span', levelText || '-');
return h(
NTag,
{
style: {
marginRight: '6px',
},
bordered: false,
type: color,
},
{
default: () => levelText,
},
);
},
},
{

View File

@ -77,7 +77,7 @@ export const columns = [
title: '文件大小',
key: 'fileSize',
width: 100,
customRender({ record }) {
render(record) {
return h('span', record.fileSize + 'B');
},
},