mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-11-08 19:00:42 +08:00
chore: 优化代码生成模板
This commit is contained in:
@@ -1,59 +1,58 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="gi_page">
|
<div class="table-page">
|
||||||
<a-card title="${businessName}管理" class="general-card">
|
<GiTable
|
||||||
<GiTable
|
ref="tableRef"
|
||||||
ref="tableRef"
|
row-key="id"
|
||||||
row-key="id"
|
title="${businessName}管理"
|
||||||
:data="dataList"
|
:data="dataList"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
:scroll="{ x: '100%', y: '100%', minWidth: 1000 }"
|
:scroll="{ x: '100%', y: '100%', minWidth: 1000 }"
|
||||||
:pagination="pagination"
|
:pagination="pagination"
|
||||||
:disabled-tools="['size']"
|
:disabled-tools="['size']"
|
||||||
:disabled-column-keys="['name']"
|
:disabled-column-keys="['name']"
|
||||||
@refresh="search"
|
@refresh="search"
|
||||||
>
|
>
|
||||||
<template #custom-left>
|
<template #custom-left>
|
||||||
<#list fieldConfigs as fieldConfig>
|
<#list fieldConfigs as fieldConfig>
|
||||||
<#if fieldConfig.showInQuery>
|
<#if fieldConfig.showInQuery>
|
||||||
<a-input v-model="queryForm.${fieldConfig.fieldName}" placeholder="请输入${fieldConfig.comment}" allow-clear @change="search">
|
<a-input v-model="queryForm.${fieldConfig.fieldName}" placeholder="请输入${fieldConfig.comment}" allow-clear @change="search">
|
||||||
<template #prefix><icon-search /></template>
|
<template #prefix><icon-search /></template>
|
||||||
</a-input>
|
</a-input>
|
||||||
</#if>
|
</#if>
|
||||||
</#list>
|
</#list>
|
||||||
<a-button @click="reset">重置</a-button>
|
<a-button @click="reset">重置</a-button>
|
||||||
</template>
|
</template>
|
||||||
<template #custom-right>
|
<template #custom-right>
|
||||||
<a-button v-permission="['${apiModuleName}:${apiName}:add']" type="primary" @click="onAdd">
|
<a-button v-permission="['${apiModuleName}:${apiName}:add']" type="primary" @click="onAdd">
|
||||||
<template #icon><icon-plus /></template>
|
<template #icon><icon-plus /></template>
|
||||||
<span>新增</span>
|
<span>新增</span>
|
||||||
|
</a-button>
|
||||||
|
<a-tooltip content="导出">
|
||||||
|
<a-button v-permission="['${apiModuleName}:${apiName}:export']" class="gi_hover_btn-border" @click="onExport">
|
||||||
|
<template #icon>
|
||||||
|
<icon-download />
|
||||||
|
</template>
|
||||||
</a-button>
|
</a-button>
|
||||||
<a-tooltip content="导出">
|
</a-tooltip>
|
||||||
<a-button v-permission="['${apiModuleName}:${apiName}:export']" class="gi_hover_btn-border" @click="onExport">
|
</template>
|
||||||
<template #icon>
|
<template #name="{ record }">
|
||||||
<icon-download />
|
<a-link @click="onDetail(record)">{{ record.name }}</a-link>
|
||||||
</template>
|
</template>
|
||||||
</a-button>
|
<template #action="{ record }">
|
||||||
</a-tooltip>
|
<a-space>
|
||||||
</template>
|
<a-link v-permission="['${apiModuleName}:${apiName}:update']" @click="onUpdate(record)">修改</a-link>
|
||||||
<template #name="{ record }">
|
<a-link
|
||||||
<a-link @click="onDetail(record)">{{ record.name }}</a-link>
|
v-permission="['${apiModuleName}:${apiName}:delete']"
|
||||||
</template>
|
status="danger"
|
||||||
<template #action="{ record }">
|
:disabled="record.disabled"
|
||||||
<a-space>
|
@click="onDelete(record)"
|
||||||
<a-link v-permission="['${apiModuleName}:${apiName}:update']" @click="onUpdate(record)">修改</a-link>
|
>
|
||||||
<a-link
|
删除
|
||||||
v-permission="['${apiModuleName}:${apiName}:delete']"
|
</a-link>
|
||||||
status="danger"
|
</a-space>
|
||||||
:disabled="record.disabled"
|
</template>
|
||||||
@click="onDelete(record)"
|
</GiTable>
|
||||||
>
|
|
||||||
删除
|
|
||||||
</a-link>
|
|
||||||
</a-space>
|
|
||||||
</template>
|
|
||||||
</GiTable>
|
|
||||||
</a-card>
|
|
||||||
|
|
||||||
<${classNamePrefix}AddModal ref="${classNamePrefix}AddModalRef" @save-success="search" />
|
<${classNamePrefix}AddModal ref="${classNamePrefix}AddModalRef" @save-success="search" />
|
||||||
<${classNamePrefix}DetailDrawer ref="${classNamePrefix}DetailDrawerRef" />
|
<${classNamePrefix}DetailDrawer ref="${classNamePrefix}DetailDrawerRef" />
|
||||||
@@ -88,16 +87,6 @@ const {
|
|||||||
handleDelete
|
handleDelete
|
||||||
} = useTable((p) => list${classNamePrefix}({ ...queryForm, page: p.page, size: p.size }), { immediate: true })
|
} = useTable((p) => list${classNamePrefix}({ ...queryForm, page: p.page, size: p.size }), { immediate: true })
|
||||||
|
|
||||||
// 重置
|
|
||||||
const reset = () => {
|
|
||||||
<#list fieldConfigs as fieldConfig>
|
|
||||||
<#if fieldConfig.showInQuery>
|
|
||||||
queryForm.${fieldConfig.fieldName} = undefined
|
|
||||||
</#if>
|
|
||||||
</#list>
|
|
||||||
search()
|
|
||||||
}
|
|
||||||
|
|
||||||
const columns: TableInstanceColumns[] = [
|
const columns: TableInstanceColumns[] = [
|
||||||
<#if fieldConfigs??>
|
<#if fieldConfigs??>
|
||||||
<#list fieldConfigs as fieldConfig>
|
<#list fieldConfigs as fieldConfig>
|
||||||
@@ -116,6 +105,16 @@ const columns: TableInstanceColumns[] = [
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
// 重置
|
||||||
|
const reset = () => {
|
||||||
|
<#list fieldConfigs as fieldConfig>
|
||||||
|
<#if fieldConfig.showInQuery>
|
||||||
|
queryForm.${fieldConfig.fieldName} = undefined
|
||||||
|
</#if>
|
||||||
|
</#list>
|
||||||
|
search()
|
||||||
|
}
|
||||||
|
|
||||||
// 删除
|
// 删除
|
||||||
const onDelete = (item: ${classNamePrefix}Resp) => {
|
const onDelete = (item: ${classNamePrefix}Resp) => {
|
||||||
return handleDelete(() => delete${classNamePrefix}(item.id), {
|
return handleDelete(() => delete${classNamePrefix}(item.id), {
|
||||||
|
|||||||
Reference in New Issue
Block a user