优化更新
This commit is contained in:
@@ -150,20 +150,20 @@ class ParamService(BaseService[Param]):
|
||||
width: 100,
|
||||
// 方式一:直接使用后端返回的 typeText 字段
|
||||
render(record) {
|
||||
return h(ElTag,
|
||||
{ type: record.row.type == 0 ? 'primary' : 'warning' },
|
||||
{ default: () => record.row.typeText });
|
||||
return h(NTag,
|
||||
{ type: record.type == 0 ? 'primary' : 'warning', bordered: false },
|
||||
{ default: () => record.typeText });
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '状态',
|
||||
prop: 'status',
|
||||
title: '状态',
|
||||
key: 'status',
|
||||
width: 100,
|
||||
// 方式二:直接使用后端返回的 statusText 字段
|
||||
render(record) {
|
||||
return h(ElTag,
|
||||
{ type: record.row.status == 1 ? 'success' : 'danger' },
|
||||
{ default: () => record.row.statusText });
|
||||
return h(NTag,
|
||||
{ type: record.status == 1 ? 'success' : 'error', bordered: false },
|
||||
{ default: () => record.statusText });
|
||||
},
|
||||
},
|
||||
```
|
||||
@@ -309,8 +309,8 @@ const options = [
|
||||
// 业务字段为数字
|
||||
formData.type = 0;
|
||||
|
||||
// el-option 绑定时需要转换
|
||||
<el-option :value="Number(item.value)" />
|
||||
// n-select 绑定时需要转换
|
||||
<n-select :value="Number(item.value)" />
|
||||
```
|
||||
|
||||
搜索表单中的 `options` 的 `value` 为字符串 `'0'`/`'1'`,后端 `page_eq_fields` 中的 `type` 字段期望数字。前端 API 传参时自动转换。
|
||||
|
||||
Reference in New Issue
Block a user