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