签入版本

This commit is contained in:
2026-10-10 19:17:02 +08:00
parent 3423dea03f
commit 32f941b631
232 changed files with 4264 additions and 6251 deletions
@@ -23,8 +23,8 @@
| `ui/src/views/{app}/{name}/index.vue` | index.vue.tpl | 列表页(含搜索、表格、新增/编辑/详情弹窗、导入导出按钮) |
| `ui/src/views/{app}/{name}/edit.vue` | edit.vue.tpl | 编辑弹窗(新增/复用) |
| `ui/src/views/{app}/{name}/detail.vue` | detail.vue.tpl | 详情弹窗 |
| `ui/src/views/{app}/{name}/columns.ts` | columns.ts.tpl | 表格列配置(含图片 ElAvatar、选项 ElTag、链接等渲染) |
| `ui/src/views/{app}/{name}/querySchemas.ts` | querySchemas.ts.tpl | 查询表单配置(按字段类型自动选 Input/Select/InputNumber/DatePicker) |
| `ui/src/views/{app}/{name}/columns.ts` | columns.ts.tpl | 表格列配置(含图片 NAvatar、选项 NTag、链接等渲染) |
| `ui/src/views/{app}/{name}/querySchemas.ts` | querySchemas.ts.tpl | 查询表单配置(按字段类型自动选 NInput/NSelect/NInputNumber/NDatePicker) |
### 前端文件(ui2/ 树形模板 — 4 个文件)
@@ -64,7 +64,7 @@ public function getTableList(): array
| 类型 | VARCHAR |
| 匹配 | 注释或字段名匹配 `/图片\|封面\|头像\|logo\|icon\|image\|avatar\|photo/i` |
识别后:`is_image = true`,归入 `file_fields`,前端用 ElAvatar 渲染。
识别后:`is_image = true`,归入 `file_fields`,前端用 NAvatar 渲染。
### 富文本字段
@@ -102,7 +102,7 @@ public function getTableList(): array
标签颜色映射:
| 选项值 | 标签颜色 | Element Plus type |
| 选项值 | 标签颜色 | 标签 type |
|--------|---------|-------------------|
| 1 | 绿色 | `success` |
| 2 | 红色 | `danger` |
@@ -107,7 +107,7 @@ $field = [
'default' => 0, // 默认值
'is_image' => false, // 是否为图片字段
'is_rich_text' => false, // 是否为富文本字段
'choices' => [ // 选项列表(有值时可生成 ElTag 渲染)
'choices' => [ // 选项列表(有值时可生成 NTag 渲染)
['value' => 0, 'label' => '正常', 'type' => 'success'],
['value' => 1, 'label' => '禁用', 'type' => 'danger'],
],
@@ -159,18 +159,18 @@ class <?php echo $model_class_name ?>Logic extends BaseLogic
```typescript
import { h } from 'vue';
import { ElAvatar, ElTag } from 'element-plus';
import { NTag, NAvatar } from 'naive-ui';
export const columns = [
{ type: 'selection' },
{ label: 'ID', prop: 'id', fixed: 'left', width: 50 },
{ title: 'ID', key: 'id', fixed: 'left', width: 50 },
<?php foreach ($list_fields as $field): ?>
{
label: '<?php echo $field['label'] ?>',
prop: '<?php echo $field['camel_name'] ?>',
title: '<?php echo $field['label'] ?>',
key: '<?php echo $field['camel_name'] ?>',
<?php if ($field['is_image']): ?>
render(record) {
return h(ElAvatar, { size: 48, src: record.row.<?php echo $field['camel_name'] ?> });
return h(NAvatar, { size: 48, src: record.<?php echo $field['camel_name'] ?>, round: false });
},
<?php elseif ($field['choices']): ?>
render(record) {
@@ -179,8 +179,8 @@ export const columns = [
<?php echo $choice['value'] ?>: { text: '<?php echo $choice['label'] ?>', type: '<?php echo $choice['type'] ?>' },
<?php endforeach; ?>
};
const s = map[record.row.<?php echo $field['camel_name'] ?>];
return h(ElTag, { type: s?.type || 'info' }, { default: () => s?.text });
const s = map[record.<?php echo $field['camel_name'] ?>];
return h(NTag, { bordered: false, type: s?.type || 'info' }, { default: () => s?.text });
},
<?php endif; ?>
},
@@ -221,8 +221,8 @@ export const columns = [
| `index.vue` | 列表页 | 导入 columns.ts、querySchemas.ts |
| `edit.vue` | 编辑弹窗 | 被 index.vue 动态加载 |
| `detail.vue` | 详情弹窗 | 被 index.vue 动态加载 |
| `columns.ts` | 表格列配置 | 被 index.vue 导入,含 ElTag/ElAvatar 渲染 |
| `querySchemas.ts` | 查询表单配置 | 被 index.vue 导入,含 Select/Input/DatePicker 组件 |
| `columns.ts` | 表格列配置 | 被 index.vue 导入,含 NTag/NAvatar 渲染 |
| `querySchemas.ts` | 查询表单配置 | 被 index.vue 导入,含 NSelect/NInput/NDatePicker 组件 |
## 相关文档