Commit d523e73464decbc697663572baa792566dda75a8
1 parent
38cc6775
fix: 序号错误
Showing
1 changed file
with
9 additions
and
3 deletions
yudao-ui-admin-vue3/src/hooks/web/useVxeCrudSchemas.ts
| ... | ... | @@ -17,7 +17,7 @@ import { DescriptionsSchema } from '@/types/descriptions' |
| 17 | 17 | export type VxeCrudSchema = { |
| 18 | 18 | primaryKey?: string // 主键ID |
| 19 | 19 | primaryTitle?: string // 主键标题 默认为序号 |
| 20 | - primaryType?: VxeColumnPropTypes.Type // 不填写为数据库编号 null为不显示 还支持 "seq" | "radio" | "checkbox" | "expand" | "html" | null | |
| 20 | + primaryType?: VxeColumnPropTypes.Type | 'id' // 还支持 "id" | "seq" | "radio" | "checkbox" | "expand" | "html" | null | |
| 21 | 21 | action?: boolean // 是否开启表格内右侧操作栏插槽 |
| 22 | 22 | actionTitle?: string // 操作栏标题 默认为操作 |
| 23 | 23 | actionWidth?: string // 操作栏插槽宽度,一般2个字带图标 text 类型按钮 50-70 |
| ... | ... | @@ -187,12 +187,18 @@ const filterTableSchema = (crudSchema: VxeCrudSchema): VxeGridPropTypes.Columns |
| 187 | 187 | if (crudSchema.primaryKey && crudSchema.primaryType) { |
| 188 | 188 | const primaryTitle = crudSchema.primaryTitle ? crudSchema.primaryTitle : t('common.index') |
| 189 | 189 | const primaryWidth = primaryTitle.length * 30 + 'px' |
| 190 | - const tableSchemaItem = { | |
| 190 | + | |
| 191 | + let tableSchemaItem: { [x: string]: any } = { | |
| 191 | 192 | title: primaryTitle, |
| 192 | 193 | field: crudSchema.primaryKey, |
| 193 | - type: crudSchema.primaryType ? crudSchema.primaryType : null, | |
| 194 | 194 | width: primaryWidth |
| 195 | 195 | } |
| 196 | + if (crudSchema.primaryType != 'id') { | |
| 197 | + tableSchemaItem = { | |
| 198 | + ...tableSchemaItem, | |
| 199 | + type: crudSchema.primaryType | |
| 200 | + } | |
| 201 | + } | |
| 196 | 202 | tableSchema.push(tableSchemaItem) |
| 197 | 203 | } |
| 198 | 204 | ... | ... |