文件结构调整,支持插件自动化 (#1824)
* Update index.vue 多个详情页之间切换tab,页面没有重新渲染 * feature:新增同步API功能 * feature: 同步表数据 * feature:新增同步API功能 * feature: 增加V2插件注册 * feature:给Enter的依赖结构增加单独的New 方便引用 * feature: 调整关联属性的选择模式 * feature: 增加component组件和name的映射插件,防止keepalive的懒加载失效。 * update: PluginInitializeRouter && 修复TypePluginInitializeMenu ast 类型错误 * update: 测试文件的astType 类型错误 * feature: 文件变更自动同步componentName.json。 * feature: 文件变更自动同步componentName.json。 * feat: UI美化 * feat: 自动化页面顺序调整 * feature:修改404页面 * update: PluginInitializeMenu * update: Plugin template * fixed systemApi 重复声明 * api.vue:update:修改API分组为下拉列表 * update: import添加注释 * update: plugin_enter_test.go 增加测试用例 * update: ast 预览文件路径 * update: config Autocode 新增Module字段以及如果为空的情况下自动获取运行目录下的go.mod文件 * update: auto_code_package.go 完善调用ast工具类的封装使用 * update: auto_code_template.go Create方法和修正SysAutoCodeHistory * feat:调整自动化package为模板,增加初始化配置信息,调整页面信息。 * update: ast PreviewPath MkdirAll * update: ast type错误, PluginEnter and PackageModuleEnter add TemplatePath模版路径 * update: autoCodePackage and autoCodeTemplate bug修正 * update: PackageInitializeRouter 传入两个路由组 * update: PackageModuleEnter 处理空变量时与type冲突注入 * update: Package 模版更新 * update: utils/ast 优化统一 * update: 注入内容修复错误 * fix: 修复注释错误 * update: plugin 模版 完成 * feature: 文件watch功能只在development下开启 * update: viper.go.template 因为viper不区分配置的key的大小写所以用package * update: ast 测试代码规范化 * update: package 删除api和router多余导包 * update: plugin template * update: auto_code_package 问题修复 * update: ast 测试插件的预览功能 * update: gorm_biz 更新注册方式 * update: go.mod tidy * remove: plugin template gen main.go.template * update: ast 重构, 分离读取和写入步骤支持 * update: AutoCodePackageApi 传入参数错误修复 * rename: sys_autocode_history.go => sys_auto_code_history.go * update: 预览无需落盘, 创建落盘,抽离公共参数 * update: api.go.tpl 导包位置fmt 和package js位置存放错误 * update: 测试用例修复 and PackageInitializeGorm 重构 * update: ast 新增相对路径, 代码生成器历史回滚功能 * update: ast 工具类回滚失败修复以及测试文件 * update: 代码生成器历史 回滚问题修复 * update: 代码生成器模版忽略.DS_Store * featute: 自动化GORM结构的注入和剔除 * feature: 插件模板调整 * feature: 增加公告插件示例,调整代码模板。 * feature: 自动注册插件V2。 --------- Co-authored-by: zayn <972858472@qq.com> Co-authored-by: SliverHorn <sliver_horn@qq.com> Co-authored-by: krank <emosick@qq.com> Co-authored-by: cjk <wlicjk@126.com> Co-authored-by: piexlMax(奇淼 <qimiaojiangjizhao@gmail.com> Co-authored-by: maxwell <zhong.maxwell@gmail.com>
This commit is contained in:
co-authored by
zayn
SliverHorn
krank
cjk
piexlMax(奇淼
maxwell
parent
6b3a9024d3
commit
6e4dc10c49
@@ -2,14 +2,10 @@
|
||||
<div>
|
||||
<div class="w-full h-screen bg-gray-50 flex items-center justify-center">
|
||||
<div class="flex flex-col items-center text-2xl gap-4">
|
||||
<img src="../../assets/notFound.png">
|
||||
<p>页面被神秘力量吸走了(如果您是开源版请联系我们修复)</p>
|
||||
<p style="font-size:18px;line-height:40px;">常见问题为当前此角色无当前路由,如果确定要使用本路由,请到角色管理进行分配</p>
|
||||
<p>↓</p>
|
||||
<img
|
||||
src="../../assets/qm.png"
|
||||
class="w-16 h-16 mt-20"
|
||||
>
|
||||
<img class="w-1/3" src="../../assets/404.png">
|
||||
<p class="text-lg">页面被神秘力量吸走了</p>
|
||||
<p class="text-lg">常见问题为当前此角色无当前路由,如果确定要使用本路由,请到角色管理进行分配</p>
|
||||
<p>项目地址:<a href="https://github.com/flipped-aurora/gin-vue-admin" target="_blank" class="text-blue-600 ">https://github.com/flipped-aurora/gin-vue-admin</a></p>
|
||||
<el-button @click="toDashboard">返回首页</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -18,11 +18,19 @@
|
||||
placeholder="描述"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="API组">
|
||||
<el-input
|
||||
v-model="searchInfo.apiGroup"
|
||||
placeholder="api组"
|
||||
/>
|
||||
<el-form-item label="API分组">
|
||||
<el-select
|
||||
v-model="searchInfo.apiGroup"
|
||||
clearable
|
||||
placeholder="请选择"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in apiGroupOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="请求">
|
||||
<el-select
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="w-full">
|
||||
<el-select
|
||||
v-model="metaData.icon"
|
||||
clearable
|
||||
filterable
|
||||
placeholder="请选择"
|
||||
class="w-full"
|
||||
>
|
||||
<template #prefix>
|
||||
<el-icon>
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
type="primary"
|
||||
icon="plus"
|
||||
@click="addMenu(0)"
|
||||
>新增根菜单</el-button>
|
||||
>
|
||||
新增根菜单
|
||||
</el-button>
|
||||
<el-icon
|
||||
class="cursor-pointer"
|
||||
@click="
|
||||
@@ -14,7 +16,9 @@
|
||||
'https://www.bilibili.com/video/BV1kv4y1g7nT/?p=4&vd_source=f2640257c21e3b547a790461ed94875e'
|
||||
)
|
||||
"
|
||||
><VideoCameraFilled /></el-icon>
|
||||
>
|
||||
<VideoCameraFilled />
|
||||
</el-icon>
|
||||
</div>
|
||||
|
||||
<!-- 由于此处菜单跟左侧列表一一对应所以不需要分页 pageSize默认999 -->
|
||||
@@ -110,19 +114,25 @@
|
||||
link
|
||||
icon="plus"
|
||||
@click="addMenu(scope.row.ID)"
|
||||
>添加子菜单</el-button>
|
||||
>
|
||||
添加子菜单
|
||||
</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
link
|
||||
icon="edit"
|
||||
@click="editMenu(scope.row.ID)"
|
||||
>编辑</el-button>
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
link
|
||||
icon="delete"
|
||||
@click="deleteMenu(scope.row.ID)"
|
||||
>删除</el-button>
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -137,11 +147,15 @@
|
||||
<div class="flex justify-between items-center">
|
||||
<span class="text-lg">{{ dialogTitle }}</span>
|
||||
<div>
|
||||
<el-button @click="closeDialog">取 消</el-button>
|
||||
<el-button @click="closeDialog">
|
||||
取 消
|
||||
</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
@click="enterDialog"
|
||||
>确 定</el-button>
|
||||
>
|
||||
确 定
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -154,216 +168,251 @@
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
label-position="top"
|
||||
label-width="85px"
|
||||
>
|
||||
<el-form-item
|
||||
label="路由Name"
|
||||
prop="path"
|
||||
style="width: 30%"
|
||||
>
|
||||
<el-input
|
||||
v-model="form.name"
|
||||
autocomplete="off"
|
||||
placeholder="唯一英文字符串"
|
||||
@change="changeName"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
prop="path"
|
||||
style="width: 30%"
|
||||
>
|
||||
<template #label>
|
||||
<span style="display: inline-flex; align-items: center">
|
||||
<span>路由Path</span>
|
||||
<el-checkbox
|
||||
v-model="checkFlag"
|
||||
style="margin-left: 12px; height: auto"
|
||||
>添加参数</el-checkbox>
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<el-input
|
||||
v-model="form.path"
|
||||
:disabled="!checkFlag"
|
||||
autocomplete="off"
|
||||
placeholder="建议只在后方拼接参数"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="是否隐藏"
|
||||
style="width: 30%"
|
||||
>
|
||||
<el-select
|
||||
v-model="form.hidden"
|
||||
placeholder="是否在列表隐藏"
|
||||
>
|
||||
<el-option
|
||||
:value="false"
|
||||
label="否"
|
||||
/>
|
||||
<el-option
|
||||
:value="true"
|
||||
label="是"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="父节点ID"
|
||||
style="width: 30%"
|
||||
>
|
||||
<el-cascader
|
||||
v-model="form.parentId"
|
||||
style="width: 100%"
|
||||
:disabled="!isEdit"
|
||||
:options="menuOption"
|
||||
:props="{
|
||||
checkStrictly: true,
|
||||
label: 'title',
|
||||
value: 'ID',
|
||||
disabled: 'disabled',
|
||||
emitPath: false,
|
||||
}"
|
||||
:show-all-levels="false"
|
||||
filterable
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="文件路径"
|
||||
prop="component"
|
||||
style="width: 60%"
|
||||
>
|
||||
<el-input
|
||||
v-model="form.component"
|
||||
autocomplete="off"
|
||||
placeholder="页面:view/xxx/xx.vue 插件:plugin/xx/xx.vue"
|
||||
@blur="fmtComponent"
|
||||
/>
|
||||
<span style="font-size: 12px; margin-right: 12px">如果菜单包含子菜单,请创建router-view二级路由页面或者</span><el-button
|
||||
style="margin-top: 4px"
|
||||
@click="form.component = 'view/routerHolder.vue'"
|
||||
>点我设置</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="展示名称"
|
||||
prop="meta.title"
|
||||
style="width: 30%"
|
||||
>
|
||||
<el-input
|
||||
v-model="form.meta.title"
|
||||
autocomplete="off"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="图标"
|
||||
prop="meta.icon"
|
||||
style="width: 30%"
|
||||
>
|
||||
<icon
|
||||
:meta="form.meta"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="排序标记"
|
||||
prop="sort"
|
||||
style="width: 30%"
|
||||
>
|
||||
<el-input
|
||||
v-model.number="form.sort"
|
||||
autocomplete="off"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
prop="meta.activeName"
|
||||
style="width: 30%"
|
||||
>
|
||||
<template #label>
|
||||
<div>
|
||||
<span> 高亮菜单 </span>
|
||||
<el-tooltip
|
||||
content="注:当到达此路由时候,指定左侧菜单指定name会处于活跃状态(亮起),可为空,为空则为本路由Name。"
|
||||
placement="top"
|
||||
effect="light"
|
||||
<el-row class="w-full">
|
||||
<el-col :span="16">
|
||||
<el-form-item
|
||||
label="文件路径"
|
||||
prop="component"
|
||||
>
|
||||
<el-select
|
||||
v-model="form.component"
|
||||
filterable
|
||||
allow-create
|
||||
autocomplete="off"
|
||||
style="width: 100%"
|
||||
placeholder="页面:view/xxx/xx.vue 插件:plugin/xx/xx.vue"
|
||||
default-first-option
|
||||
@change="fmtComponent"
|
||||
>
|
||||
<el-icon><QuestionFilled /></el-icon>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
</template>
|
||||
<el-input
|
||||
v-model="form.meta.activeName"
|
||||
:placeholder="form.name"
|
||||
autocomplete="off"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="KeepAlive"
|
||||
prop="meta.keepAlive"
|
||||
style="width: 30%"
|
||||
>
|
||||
<el-select
|
||||
v-model="form.meta.keepAlive"
|
||||
style="width: 100%"
|
||||
placeholder="是否keepAlive缓存页面"
|
||||
>
|
||||
<el-option
|
||||
:value="false"
|
||||
label="否"
|
||||
/>
|
||||
<el-option
|
||||
:value="true"
|
||||
label="是"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="CloseTab"
|
||||
prop="meta.closeTab"
|
||||
style="width: 30%"
|
||||
>
|
||||
<el-select
|
||||
v-model="form.meta.closeTab"
|
||||
style="width: 100%"
|
||||
placeholder="是否自动关闭tab"
|
||||
>
|
||||
<el-option
|
||||
:value="false"
|
||||
label="否"
|
||||
/>
|
||||
<el-option
|
||||
:value="true"
|
||||
label="是"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item style="width: 30%">
|
||||
<template #label>
|
||||
<div>
|
||||
<span> 是否为基础页面 </span>
|
||||
<el-tooltip
|
||||
content="此项选择为是,则不会展示左侧菜单以及顶部信息。"
|
||||
placement="top"
|
||||
effect="light"
|
||||
<el-option
|
||||
v-for="(item,path) in pathOptions"
|
||||
:key="path"
|
||||
:label="path"
|
||||
:value="path"
|
||||
/>
|
||||
</el-select>
|
||||
<span style="font-size: 12px; margin-right: 12px">如果菜单包含子菜单,请创建router-view二级路由页面或者</span><el-button
|
||||
style="margin-top: 4px"
|
||||
@click="form.component = 'view/routerHolder.vue'"
|
||||
>
|
||||
<el-icon><QuestionFilled /></el-icon>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
</template>
|
||||
点我设置
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item
|
||||
label="展示名称"
|
||||
prop="meta.title"
|
||||
>
|
||||
<el-input
|
||||
v-model="form.meta.title"
|
||||
autocomplete="off"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row class="w-full">
|
||||
<el-col :span="8">
|
||||
<el-form-item
|
||||
label="路由Name"
|
||||
prop="path"
|
||||
>
|
||||
<el-input
|
||||
v-model="form.name"
|
||||
autocomplete="off"
|
||||
placeholder="唯一英文字符串"
|
||||
@change="changeName"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item
|
||||
prop="path"
|
||||
>
|
||||
<template #label>
|
||||
<span style="display: inline-flex; align-items: center">
|
||||
<span>路由Path</span>
|
||||
<el-checkbox
|
||||
v-model="checkFlag"
|
||||
style="margin-left: 12px; height: auto"
|
||||
>添加参数</el-checkbox>
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<el-select
|
||||
v-model="form.meta.defaultMenu"
|
||||
style="width: 100%"
|
||||
placeholder="是否为基础页面"
|
||||
>
|
||||
<el-option
|
||||
:value="false"
|
||||
label="否"
|
||||
/>
|
||||
<el-option
|
||||
:value="true"
|
||||
label="是"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-input
|
||||
v-model="form.path"
|
||||
:disabled="!checkFlag"
|
||||
autocomplete="off"
|
||||
placeholder="建议只在后方拼接参数"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item
|
||||
label="是否隐藏"
|
||||
>
|
||||
<el-select
|
||||
v-model="form.hidden"
|
||||
style="width: 100%"
|
||||
placeholder="是否在列表隐藏"
|
||||
>
|
||||
<el-option
|
||||
:value="false"
|
||||
label="否"
|
||||
/>
|
||||
<el-option
|
||||
:value="true"
|
||||
label="是"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row class="w-full">
|
||||
<el-col :span="8">
|
||||
<el-form-item
|
||||
label="父节点ID"
|
||||
>
|
||||
<el-cascader
|
||||
v-model="form.parentId"
|
||||
style="width: 100%"
|
||||
:disabled="!isEdit"
|
||||
:options="menuOption"
|
||||
:props="{
|
||||
checkStrictly: true,
|
||||
label: 'title',
|
||||
value: 'ID',
|
||||
disabled: 'disabled',
|
||||
emitPath: false,
|
||||
}"
|
||||
:show-all-levels="false"
|
||||
filterable
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item
|
||||
label="图标"
|
||||
prop="meta.icon"
|
||||
>
|
||||
<icon
|
||||
:meta="form.meta"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item
|
||||
label="排序标记"
|
||||
prop="sort"
|
||||
>
|
||||
<el-input
|
||||
v-model.number="form.sort"
|
||||
autocomplete="off"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row class="w-full">
|
||||
<el-col :span="8">
|
||||
<el-form-item
|
||||
prop="meta.activeName"
|
||||
>
|
||||
<template #label>
|
||||
<div>
|
||||
<span> 高亮菜单 </span>
|
||||
<el-tooltip
|
||||
content="注:当到达此路由时候,指定左侧菜单指定name会处于活跃状态(亮起),可为空,为空则为本路由Name。"
|
||||
placement="top"
|
||||
effect="light"
|
||||
>
|
||||
<el-icon><QuestionFilled /></el-icon>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
</template>
|
||||
<el-input
|
||||
v-model="form.meta.activeName"
|
||||
:placeholder="form.name"
|
||||
autocomplete="off"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item
|
||||
label="KeepAlive"
|
||||
prop="meta.keepAlive"
|
||||
>
|
||||
<el-select
|
||||
v-model="form.meta.keepAlive"
|
||||
style="width: 100%"
|
||||
placeholder="是否keepAlive缓存页面"
|
||||
>
|
||||
<el-option
|
||||
:value="false"
|
||||
label="否"
|
||||
/>
|
||||
<el-option
|
||||
:value="true"
|
||||
label="是"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item
|
||||
label="CloseTab"
|
||||
prop="meta.closeTab"
|
||||
>
|
||||
<el-select
|
||||
v-model="form.meta.closeTab"
|
||||
style="width: 100%"
|
||||
placeholder="是否自动关闭tab"
|
||||
>
|
||||
<el-option
|
||||
:value="false"
|
||||
label="否"
|
||||
/>
|
||||
<el-option
|
||||
:value="true"
|
||||
label="是"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row class="w-full">
|
||||
<el-col :span="8">
|
||||
<el-form-item>
|
||||
<template #label>
|
||||
<div>
|
||||
<span> 是否为基础页面 </span>
|
||||
<el-tooltip
|
||||
content="此项选择为是,则不会展示左侧菜单以及顶部信息。"
|
||||
placement="top"
|
||||
effect="light"
|
||||
>
|
||||
<el-icon><QuestionFilled /></el-icon>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<el-select
|
||||
v-model="form.meta.defaultMenu"
|
||||
style="width: 100%"
|
||||
placeholder="是否为基础页面"
|
||||
>
|
||||
<el-option
|
||||
:value="false"
|
||||
label="否"
|
||||
/>
|
||||
<el-option
|
||||
:value="true"
|
||||
label="是"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div>
|
||||
<div class="flex items-center gap-2">
|
||||
@@ -371,7 +420,9 @@
|
||||
type="primary"
|
||||
icon="edit"
|
||||
@click="addParameter(form)"
|
||||
>新增菜单参数</el-button>
|
||||
>
|
||||
新增菜单参数
|
||||
</el-button>
|
||||
<el-icon
|
||||
class="cursor-pointer"
|
||||
@click="
|
||||
@@ -379,7 +430,9 @@
|
||||
'https://www.bilibili.com/video/BV1kv4y1g7nT?p=9&vd_source=f2640257c21e3b547a790461ed94875e'
|
||||
)
|
||||
"
|
||||
><VideoCameraFilled /></el-icon>
|
||||
>
|
||||
<VideoCameraFilled />
|
||||
</el-icon>
|
||||
</div>
|
||||
<el-table
|
||||
:data="form.parameters"
|
||||
@@ -439,7 +492,9 @@
|
||||
type="danger"
|
||||
icon="delete"
|
||||
@click="deleteParameter(form.parameters, scope.$index)"
|
||||
>删除</el-button>
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -450,14 +505,17 @@
|
||||
type="primary"
|
||||
icon="edit"
|
||||
@click="addBtn(form)"
|
||||
>新增可控按钮
|
||||
>
|
||||
新增可控按钮
|
||||
</el-button>
|
||||
<el-icon
|
||||
class="cursor-pointer"
|
||||
@click="
|
||||
toDoc('https://www.gin-vue-admin.com/guide/web/button-auth.html')
|
||||
"
|
||||
><QuestionFilled /></el-icon>
|
||||
>
|
||||
<QuestionFilled />
|
||||
</el-icon>
|
||||
<el-icon
|
||||
class="cursor-pointer"
|
||||
@click="
|
||||
@@ -465,7 +523,9 @@
|
||||
'https://www.bilibili.com/video/BV1kv4y1g7nT?p=11&vd_source=f2640257c21e3b547a790461ed94875e'
|
||||
)
|
||||
"
|
||||
><VideoCameraFilled /></el-icon>
|
||||
>
|
||||
<VideoCameraFilled />
|
||||
</el-icon>
|
||||
</div>
|
||||
|
||||
<el-table
|
||||
@@ -503,7 +563,9 @@
|
||||
type="danger"
|
||||
icon="delete"
|
||||
@click="deleteBtn(form.menuBtn, scope.$index)"
|
||||
>删除</el-button>
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -524,16 +586,27 @@ import {
|
||||
import icon from '@/view/superAdmin/menu/icon.vue'
|
||||
import WarningBar from '@/components/warningBar/warningBar.vue'
|
||||
import { canRemoveAuthorityBtnApi } from '@/api/authorityBtn'
|
||||
import { reactive, ref } from 'vue'
|
||||
import { reactive, ref, onMounted } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { QuestionFilled, VideoCameraFilled } from '@element-plus/icons-vue'
|
||||
import pathInfo from '@/pathInfo.json'
|
||||
|
||||
import { toDoc } from '@/utils/doc'
|
||||
import { toLowerCase } from '@/utils/stringFun'
|
||||
|
||||
defineOptions({
|
||||
name: 'Menus',
|
||||
})
|
||||
|
||||
const pathOptions = reactive({})
|
||||
|
||||
onMounted(()=>{
|
||||
for (let pathInfoKey in pathInfo) {
|
||||
// 取消掉最前面的 /src/
|
||||
pathOptions[pathInfoKey.replace(/^\/src\//, '')] = pathInfo[pathInfoKey]
|
||||
}
|
||||
})
|
||||
|
||||
const rules = reactive({
|
||||
path: [{ required: true, message: '请输入菜单name', trigger: 'blur' }],
|
||||
component: [{ required: true, message: '请输入文件路径', trigger: 'blur' }],
|
||||
@@ -578,6 +651,7 @@ const addParameter = (form) => {
|
||||
|
||||
const fmtComponent = () => {
|
||||
form.value.component = form.value.component.replace(/\\/g, '/')
|
||||
form.value.name = toLowerCase(pathOptions[form.value.component])
|
||||
}
|
||||
|
||||
// 删除参数
|
||||
|
||||
@@ -139,22 +139,22 @@
|
||||
<el-checkbox v-model="middleDate.primaryKey" />
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="索引类型"
|
||||
prop="fieldIndexType"
|
||||
label="索引类型"
|
||||
prop="fieldIndexType"
|
||||
>
|
||||
<el-select
|
||||
v-model="middleDate.fieldIndexType"
|
||||
:disabled="middleDate.fieldType === 'json'"
|
||||
style="width:100%"
|
||||
placeholder="请选择字段索引类型"
|
||||
clearable
|
||||
v-model="middleDate.fieldIndexType"
|
||||
:disabled="middleDate.fieldType === 'json'"
|
||||
style="width:100%"
|
||||
placeholder="请选择字段索引类型"
|
||||
clearable
|
||||
>
|
||||
<el-option
|
||||
v-for="item in typeIndexOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
:disabled="canSelect(item.value)"
|
||||
v-for="item in typeIndexOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
:disabled="canSelect(item.value)"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
@@ -171,7 +171,7 @@
|
||||
<el-switch v-model="middleDate.clearable" />
|
||||
</el-form-item>
|
||||
<el-form-item label="隐藏查询条件">
|
||||
<el-switch :disabled="!middleDate.fieldSearchType" v-model="middleDate.fieldSearchHide" />
|
||||
<el-switch v-model="middleDate.fieldSearchHide" :disabled="!middleDate.fieldSearchType" />
|
||||
</el-form-item>
|
||||
<el-form-item label="校验失败文案">
|
||||
<el-input v-model="middleDate.errorText" />
|
||||
@@ -202,30 +202,65 @@
|
||||
</el-select>
|
||||
</el-col>
|
||||
|
||||
|
||||
<el-col
|
||||
:span="7"
|
||||
>
|
||||
<el-input
|
||||
v-model="middleDate.dataSource.table"
|
||||
placeholder="数据源表"
|
||||
/>
|
||||
<el-col :span="7">
|
||||
<el-select
|
||||
v-model="middleDate.dataSource.table" placeholder="请选择数据源表"
|
||||
filterable allow-create @focus="getDBTableList" @change="selectDB"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dbTableList" :key="item.tableName" :label="item.tableName"
|
||||
:value="item.tableName"
|
||||
/>
|
||||
</el-select>
|
||||
<!-- <el-input v-model="middleDate.dataSource.table" placeholder="数据源表" /> -->
|
||||
</el-col>
|
||||
<el-col
|
||||
:span="7"
|
||||
>
|
||||
<el-input
|
||||
v-model="middleDate.dataSource.label"
|
||||
placeholder="展示用字段"
|
||||
/>
|
||||
<el-col :span="7">
|
||||
<el-select v-model="middleDate.dataSource.value" placeholder="请先选择需要存储的数据">
|
||||
<template #label="{ value }">
|
||||
<span>存储: </span>
|
||||
<span style="font-weight: bold">{{ value }}</span>
|
||||
</template>
|
||||
<el-option v-for="item in dbColumnList" :key="item.columnName" :value="item.columnName">
|
||||
<span style="float: left"> <el-tag :type="item.isPrimary ? 'primary' : 'info'">
|
||||
{{ item.isPrimary ? "主 键" : "非主键" }}
|
||||
</el-tag> {{ item.columnName }}</span>
|
||||
<span
|
||||
style="
|
||||
float: right;
|
||||
margin-left:5px;
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 13px;
|
||||
"
|
||||
>
|
||||
类型:{{ item.type }} <block v-if="item.comment != ''">,字段说明:{{ item.comment }}</block>
|
||||
</span>
|
||||
</el-option>
|
||||
</el-select>
|
||||
<!-- <el-input v-model="middleDate.dataSource.value" placeholder="存储用字段" /> -->
|
||||
</el-col>
|
||||
<el-col
|
||||
:span="7"
|
||||
>
|
||||
<el-input
|
||||
v-model="middleDate.dataSource.value"
|
||||
placeholder="存储用字端"
|
||||
/>
|
||||
<el-col :span="7">
|
||||
<el-select v-model="middleDate.dataSource.label" placeholder="请先选择需要展示的数据">
|
||||
<template #label="{ value }">
|
||||
<span>展示: </span>
|
||||
<span style="font-weight: bold">{{ value }}</span>
|
||||
</template>
|
||||
<el-option v-for="item in dbColumnList" :key="item.columnName" :value="item.columnName">
|
||||
<span style="float: left"> <el-tag :type="item.isPrimary ? 'primary' : 'info'">
|
||||
{{ item.isPrimary ? "主 键" : "非主键" }}
|
||||
</el-tag> {{ item.columnName }}</span>
|
||||
<span
|
||||
style="
|
||||
float: right;
|
||||
margin-left:5px;
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 13px;
|
||||
"
|
||||
>
|
||||
类型:{{ item.type }} <span v-if="item.comment != ''">,字段说明:{{ item.comment }}</span>
|
||||
</span>
|
||||
</el-option>
|
||||
</el-select>
|
||||
<!-- <el-input v-model="middleDate.dataSource.label" placeholder="展示用字段" /> -->
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-collapse-item>
|
||||
@@ -239,6 +274,7 @@ import { getSysDictionaryList } from '@/api/sysDictionary'
|
||||
import WarningBar from '@/components/warningBar/warningBar.vue'
|
||||
import { ref } from 'vue'
|
||||
import { ElMessageBox } from 'element-plus'
|
||||
import {getColumn, getTable} from "@/api/autoCode";
|
||||
|
||||
defineOptions({
|
||||
name: 'FieldDialog'
|
||||
@@ -357,6 +393,45 @@ const associationChange = (val) => {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const dbTableList = ref([])
|
||||
|
||||
const getDBTableList = async () => {
|
||||
const res = await getTable()
|
||||
console.log(res);
|
||||
if (res.code === 0) {
|
||||
let list = res.data.tables; // 确保这里正确获取到 tables 数组
|
||||
dbTableList.value = list.map(item => ({
|
||||
tableName: item.tableName,
|
||||
value: item.tableName // 这里假设 value 也是 tableName,如果不同请调整
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
const dbColumnList = ref([])
|
||||
const selectDB = async (val) => {
|
||||
middleDate.value.dataSource.table = val
|
||||
const res = await getColumn({
|
||||
tableName: val
|
||||
})
|
||||
console.log(res)
|
||||
if (res.code === 0) {
|
||||
let list = res.data.columns; // 确保这里正确获取到 tables 数组
|
||||
dbColumnList.value = list.map(item => ({
|
||||
columnName: item.columnName,
|
||||
value: item.columnName,
|
||||
type: item.dataType,
|
||||
isPrimary: item.primaryKey,
|
||||
comment: item.columnComment
|
||||
}));
|
||||
if (dbColumnList.value.length > 0) {
|
||||
middleDate.value.dataSource.label = dbColumnList.value[0].columnName
|
||||
middleDate.value.dataSource.value = dbColumnList.value[0].columnName
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const fieldDialogFrom = ref(null)
|
||||
defineExpose({ fieldDialogFrom })
|
||||
</script>
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
title="此功能为开发环境使用,不建议发布到生产,具体使用效果请点我观看。"
|
||||
/>
|
||||
<div class="gva-search-box">
|
||||
<div class="text-lg mb-2 text-gray-600">使用AI创建</div>
|
||||
<div class="relative">
|
||||
<el-input v-model="prompt" type="textarea" :rows="5" :maxlength="100" :placeholder="`【Beta】试试描述你的表,让AI帮你完成。\n目前正在测试阶段,遇到问题请及时反馈。\n此功能需要到插件市场个人中心获取自己的AI-Path,把AI-Path填入config.yaml下的autocode-->ai-path,重启项目即可使用。`" resize="none" />
|
||||
<div class="flex absolute right-2 bottom-2">
|
||||
@@ -31,29 +32,19 @@
|
||||
</div>
|
||||
<!-- 从数据库直接获取字段 -->
|
||||
<div class="gva-search-box">
|
||||
<el-collapse
|
||||
v-model="activeNames"
|
||||
class="mb-3"
|
||||
<div class="text-lg mb-2 text-gray-600">从数据库创建</div>
|
||||
<el-form
|
||||
ref="getTableForm"
|
||||
:inline="true"
|
||||
:model="dbform"
|
||||
label-width="120px"
|
||||
>
|
||||
<el-collapse-item name="1">
|
||||
<template #title>
|
||||
<div class="text-xl pl-4 flex items-center">
|
||||
点这里从现有数据库创建代码
|
||||
<el-icon>
|
||||
<pointer />
|
||||
</el-icon>
|
||||
</div>
|
||||
</template>
|
||||
<el-form
|
||||
ref="getTableForm"
|
||||
style="margin-top:24px"
|
||||
:inline="true"
|
||||
:model="dbform"
|
||||
label-width="120px"
|
||||
>
|
||||
<el-row class="w-full">
|
||||
<el-col :span="6">
|
||||
<el-form-item
|
||||
label="业务库"
|
||||
prop="selectDBtype"
|
||||
class="w-full"
|
||||
>
|
||||
<template #label>
|
||||
<el-tooltip
|
||||
@@ -69,6 +60,7 @@
|
||||
clearable
|
||||
placeholder="选择业务库"
|
||||
@change="getDbFunc"
|
||||
class="w-full"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dbList"
|
||||
@@ -84,15 +76,19 @@
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item
|
||||
label="数据库名"
|
||||
prop="structName"
|
||||
class="w-full"
|
||||
>
|
||||
<el-select
|
||||
v-model="dbform.dbName"
|
||||
clearable
|
||||
filterable
|
||||
placeholder="请选择数据库"
|
||||
class="w-full"
|
||||
@change="getTableFunc"
|
||||
>
|
||||
<el-option
|
||||
@@ -103,13 +99,17 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item
|
||||
label="表名"
|
||||
prop="structName"
|
||||
class="w-full"
|
||||
>
|
||||
<el-select
|
||||
v-model="dbform.tableName"
|
||||
:disabled="!dbform.dbName"
|
||||
class="w-full"
|
||||
filterable
|
||||
placeholder="请选择表"
|
||||
>
|
||||
@@ -121,20 +121,27 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button
|
||||
type="primary"
|
||||
@click="getColumnFunc"
|
||||
>
|
||||
使用此表创建
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item
|
||||
class="w-full"
|
||||
>
|
||||
<div class="flex justify-end w-full">
|
||||
<el-button
|
||||
type="primary"
|
||||
@click="getColumnFunc"
|
||||
>
|
||||
使用此表
|
||||
</el-button>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-collapse-item>
|
||||
</el-collapse>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</div>
|
||||
<div class="gva-search-box">
|
||||
<!-- 初始版本自动化代码工具 -->
|
||||
<div class="text-lg mb-2 text-gray-600">自动化结构</div>
|
||||
<el-form
|
||||
ref="autoCodeForm"
|
||||
:rules="rules"
|
||||
@@ -142,191 +149,230 @@
|
||||
label-width="120px"
|
||||
:inline="true"
|
||||
>
|
||||
<el-form-item
|
||||
label="Struct名称"
|
||||
prop="structName"
|
||||
>
|
||||
<el-input
|
||||
v-model="form.structName"
|
||||
placeholder="首字母自动转换大写"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="TableName"
|
||||
prop="tableName"
|
||||
>
|
||||
<el-input
|
||||
v-model="form.tableName"
|
||||
placeholder="指定表名(非必填)"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
prop="abbreviation"
|
||||
>
|
||||
<template #label>
|
||||
<el-tooltip
|
||||
content="简称会作为入参对象名和路由group"
|
||||
placement="bottom"
|
||||
effect="light"
|
||||
<el-row class="w-full">
|
||||
<el-col :span="6">
|
||||
<el-form-item
|
||||
label="结构名称"
|
||||
prop="structName"
|
||||
class="w-full"
|
||||
>
|
||||
<div> Struct简称 <el-icon><QuestionFilled /></el-icon> </div>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
<el-input
|
||||
v-model="form.abbreviation"
|
||||
placeholder="请输入Struct简称"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="Struct中文名称"
|
||||
prop="description"
|
||||
>
|
||||
<el-input
|
||||
v-model="form.description"
|
||||
placeholder="中文描述作为自动api描述"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
prop="packageName"
|
||||
>
|
||||
<template #label>
|
||||
<el-tooltip
|
||||
content="生成文件的默认名称(建议为驼峰格式,首字母小写,如sysXxxXxxx)"
|
||||
placement="bottom"
|
||||
effect="light"
|
||||
<el-input
|
||||
v-model="form.structName"
|
||||
placeholder="首字母自动转换大写"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item
|
||||
label="TableName"
|
||||
class="w-full"
|
||||
>
|
||||
<div> 文件名称 <el-icon><QuestionFilled /></el-icon> </div>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
<el-input
|
||||
v-model="form.packageName"
|
||||
placeholder="请输入文件名称"
|
||||
@blur="toLowerCaseFunc(form,'packageName')"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="Package(包)"
|
||||
prop="package"
|
||||
>
|
||||
<el-select
|
||||
v-model="form.package"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in pkgs"
|
||||
:key="item.ID"
|
||||
:value="item.packageName"
|
||||
:label="item.packageName"
|
||||
/>
|
||||
</el-select>
|
||||
<el-icon
|
||||
class="cursor-pointer ml-2 text-gray-600"
|
||||
@click="getPkgs"
|
||||
>
|
||||
<refresh />
|
||||
</el-icon>
|
||||
<el-icon
|
||||
class="cursor-pointer ml-2 text-gray-600"
|
||||
@click="goPkgs"
|
||||
>
|
||||
<document-add />
|
||||
</el-icon>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="业务库"
|
||||
prop="businessDB"
|
||||
>
|
||||
<template #label>
|
||||
<el-tooltip
|
||||
content="注:需要提前到db-list自行配置多数据库,此项为空则会使用gva本库创建自动化代码(global.GVA_DB),填写后则会创建指定库的代码(global.MustGetGlobalDBByDBName(dbname))"
|
||||
placement="bottom"
|
||||
effect="light"
|
||||
<template #label>
|
||||
<el-tooltip
|
||||
content="简称会作为入参对象名和路由group"
|
||||
placement="bottom"
|
||||
effect="light"
|
||||
>
|
||||
<div> 结构简称 <el-icon><QuestionFilled /></el-icon> </div>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
<el-input
|
||||
v-model="form.abbreviation"
|
||||
placeholder="请输入Struct简称"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item
|
||||
label="中文名称"
|
||||
prop="description"
|
||||
class="w-full"
|
||||
>
|
||||
<div> 业务库 <el-icon><QuestionFilled /></el-icon> </div>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
<el-select
|
||||
v-model="form.businessDB"
|
||||
placeholder="选择业务库"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dbList"
|
||||
:key="item.aliasName"
|
||||
:value="item.aliasName"
|
||||
:label="item.aliasName"
|
||||
:disabled="item.disable"
|
||||
<el-input
|
||||
v-model="form.description"
|
||||
placeholder="中文描述作为自动api描述"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item
|
||||
label="表名"
|
||||
prop="tableName"
|
||||
class="w-full"
|
||||
>
|
||||
<div>
|
||||
<span>{{ item.aliasName }}</span>
|
||||
<span style="float:right;color:#8492a6;font-size:13px">{{ item.dbName }}</span>
|
||||
</div>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<div>
|
||||
<el-form-item>
|
||||
<template #label>
|
||||
<el-tooltip
|
||||
content="注:会自动在结构体global.Model其中包含主键和软删除相关操作配置"
|
||||
placement="bottom"
|
||||
effect="light"
|
||||
<el-input
|
||||
v-model="form.tableName"
|
||||
placeholder="指定表名(非必填)"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row class="w-full">
|
||||
<el-col :span="6">
|
||||
<el-form-item
|
||||
prop="packageName"
|
||||
class="w-full"
|
||||
>
|
||||
<template #label>
|
||||
<el-tooltip
|
||||
content="生成文件的默认名称(建议为驼峰格式,首字母小写,如sysXxxXxxx)"
|
||||
placement="bottom"
|
||||
effect="light"
|
||||
>
|
||||
<div> 文件名称 <el-icon><QuestionFilled /></el-icon> </div>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
<el-input
|
||||
v-model="form.packageName"
|
||||
placeholder="请输入文件名称"
|
||||
@blur="toLowerCaseFunc(form,'packageName')"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item
|
||||
label="选择模板"
|
||||
prop="package"
|
||||
class="w-full relative"
|
||||
>
|
||||
<el-select
|
||||
v-model="form.package"
|
||||
class="w-full pr-12"
|
||||
>
|
||||
<div> 使用GVA结构 <el-icon><QuestionFilled /></el-icon> </div>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
<el-checkbox
|
||||
v-model="form.gvaModel"
|
||||
@change="useGva"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<template #label>
|
||||
<el-tooltip
|
||||
content="注:会自动在结构体添加 created_by updated_by deleted_by,方便用户进行资源权限控制"
|
||||
placement="bottom"
|
||||
effect="light"
|
||||
<el-option
|
||||
v-for="item in pkgs"
|
||||
:key="item.ID"
|
||||
:value="item.packageName"
|
||||
:label="item.packageName"
|
||||
/>
|
||||
</el-select>
|
||||
<span class="absolute right-0">
|
||||
<el-icon
|
||||
class="cursor-pointer ml-2 text-gray-600"
|
||||
@click="getPkgs"
|
||||
>
|
||||
<refresh />
|
||||
</el-icon>
|
||||
<el-icon
|
||||
class="cursor-pointer ml-2 text-gray-600"
|
||||
@click="goPkgs"
|
||||
>
|
||||
<document-add />
|
||||
</el-icon>
|
||||
</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item
|
||||
label="业务库"
|
||||
prop="businessDB"
|
||||
class="w-full"
|
||||
>
|
||||
<template #label>
|
||||
<el-tooltip
|
||||
content="注:需要提前到db-list自行配置多数据库,此项为空则会使用gva本库创建自动化代码(global.GVA_DB),填写后则会创建指定库的代码(global.MustGetGlobalDBByDBName(dbname))"
|
||||
placement="bottom"
|
||||
effect="light"
|
||||
>
|
||||
<div> 业务库 <el-icon><QuestionFilled /></el-icon> </div>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
<el-select
|
||||
v-model="form.businessDB"
|
||||
placeholder="选择业务库"
|
||||
class="w-full"
|
||||
>
|
||||
<div> 创建资源标识 <el-icon><QuestionFilled /></el-icon> </div>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
<el-checkbox v-model="form.autoCreateResource" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<template #label>
|
||||
<el-tooltip
|
||||
content="注:把自动生成的API注册进数据库"
|
||||
placement="bottom"
|
||||
effect="light"
|
||||
>
|
||||
<div> 自动创建API <el-icon><QuestionFilled /></el-icon> </div>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
<el-checkbox v-model="form.autoCreateApiToSql" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<template #label>
|
||||
<el-tooltip
|
||||
content="注:把自动生成的菜单注册进数据库"
|
||||
placement="bottom"
|
||||
effect="light"
|
||||
>
|
||||
<div> 自动创建菜单 <el-icon><QuestionFilled /></el-icon></div>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
<el-checkbox v-model="form.autoCreateMenuToSql" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<template #label>
|
||||
<el-tooltip
|
||||
content="注:自动同步数据库表结构,如果不需要可以选择关闭。"
|
||||
placement="bottom"
|
||||
effect="light"
|
||||
>
|
||||
<div> 同步表结构 <el-icon><QuestionFilled /></el-icon></div>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
<el-checkbox v-model="form.autoMigrate" />
|
||||
</el-form-item>
|
||||
</div>
|
||||
<el-option
|
||||
v-for="item in dbList"
|
||||
:key="item.aliasName"
|
||||
:value="item.aliasName"
|
||||
:label="item.aliasName"
|
||||
:disabled="item.disable"
|
||||
>
|
||||
<div>
|
||||
<span>{{ item.aliasName }}</span>
|
||||
<span style="float:right;color:#8492a6;font-size:13px">{{ item.dbName }}</span>
|
||||
</div>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="3">
|
||||
<el-form-item>
|
||||
<template #label>
|
||||
<el-tooltip
|
||||
content="注:会自动在结构体global.Model其中包含主键和软删除相关操作配置"
|
||||
placement="bottom"
|
||||
effect="light"
|
||||
>
|
||||
<div> 使用GVA结构 <el-icon><QuestionFilled /></el-icon> </div>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
<el-checkbox
|
||||
v-model="form.gvaModel"
|
||||
@change="useGva"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="3">
|
||||
<el-form-item>
|
||||
<template #label>
|
||||
<el-tooltip
|
||||
content="注:把自动生成的API注册进数据库"
|
||||
placement="bottom"
|
||||
effect="light"
|
||||
>
|
||||
<div> 自动创建API <el-icon><QuestionFilled /></el-icon> </div>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
<el-checkbox v-model="form.autoCreateApiToSql" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="3">
|
||||
<el-form-item>
|
||||
<template #label>
|
||||
<el-tooltip
|
||||
content="注:把自动生成的菜单注册进数据库"
|
||||
placement="bottom"
|
||||
effect="light"
|
||||
>
|
||||
<div> 自动创建菜单 <el-icon><QuestionFilled /></el-icon></div>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
<el-checkbox v-model="form.autoCreateMenuToSql" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="3">
|
||||
<el-form-item>
|
||||
<template #label>
|
||||
<el-tooltip
|
||||
content="注:自动同步数据库表结构,如果不需要可以选择关闭。"
|
||||
placement="bottom"
|
||||
effect="light"
|
||||
>
|
||||
<div> 同步表结构 <el-icon><QuestionFilled /></el-icon></div>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
<el-checkbox v-model="form.autoMigrate" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="3">
|
||||
<el-form-item>
|
||||
<template #label>
|
||||
<el-tooltip
|
||||
content="注:会自动在结构体添加 created_by updated_by deleted_by,方便用户进行资源权限控制"
|
||||
placement="bottom"
|
||||
effect="light"
|
||||
>
|
||||
<div> 创建资源标识 <el-icon><QuestionFilled /></el-icon> </div>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
<el-checkbox v-model="form.autoCreateResource" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</div>
|
||||
<!-- 组件列表 -->
|
||||
|
||||
@@ -10,11 +10,15 @@
|
||||
type="primary"
|
||||
icon="plus"
|
||||
@click="openDialog('addApi')"
|
||||
>新增</el-button>
|
||||
>
|
||||
新增
|
||||
</el-button>
|
||||
<el-icon
|
||||
class="cursor-pointer"
|
||||
@click="toDoc('https://www.bilibili.com/video/BV1kv4y1g7nT?p=3&vd_source=f2640257c21e3b547a790461ed94875e')"
|
||||
><VideoCameraFilled /></el-icon>
|
||||
>
|
||||
<VideoCameraFilled />
|
||||
</el-icon>
|
||||
</div>
|
||||
<el-table :data="tableData">
|
||||
<el-table-column
|
||||
@@ -29,6 +33,12 @@
|
||||
width="150"
|
||||
prop="packageName"
|
||||
/>
|
||||
<el-table-column
|
||||
align="left"
|
||||
label="模板"
|
||||
width="150"
|
||||
prop="template"
|
||||
/>
|
||||
<el-table-column
|
||||
align="left"
|
||||
label="展示名"
|
||||
@@ -54,11 +64,12 @@
|
||||
type="primary"
|
||||
link
|
||||
@click="deleteApiFunc(scope.row)"
|
||||
>删除</el-button>
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
</div>
|
||||
|
||||
<el-drawer
|
||||
@@ -66,7 +77,7 @@
|
||||
size="40%"
|
||||
:show-close="false"
|
||||
>
|
||||
<warning-bar title="新增Pkg用于自动化代码使用" />
|
||||
<warning-bar title="模板package会创建集成于项目本体中的代码包,模板plugin会创建插件包" />
|
||||
<el-form
|
||||
ref="pkgForm"
|
||||
:model="form"
|
||||
@@ -82,6 +93,17 @@
|
||||
autocomplete="off"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="模板"
|
||||
prop="template"
|
||||
>
|
||||
<el-select
|
||||
v-model="form.template"
|
||||
>
|
||||
<el-option v-for="template in templatesOptions" :label="template" :value="template" :key="template"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item
|
||||
label="展示名"
|
||||
prop="label"
|
||||
@@ -105,11 +127,15 @@
|
||||
<div class="flex justify-between items-center">
|
||||
<span class="text-lg">创建Package</span>
|
||||
<div>
|
||||
<el-button @click="closeDialog">取 消</el-button>
|
||||
<el-button @click="closeDialog">
|
||||
取 消
|
||||
</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
@click="enterDialog"
|
||||
>确 定</el-button>
|
||||
type="primary"
|
||||
@click="enterDialog"
|
||||
>
|
||||
确 定
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -122,6 +148,7 @@ import {
|
||||
createPackageApi,
|
||||
getPackageApi,
|
||||
deletePackageApi,
|
||||
getTemplatesApi
|
||||
} from '@/api/autoCode'
|
||||
import { ref } from 'vue'
|
||||
import WarningBar from '@/components/warningBar/warningBar.vue'
|
||||
@@ -135,9 +162,20 @@ defineOptions({
|
||||
|
||||
const form = ref({
|
||||
packageName: '',
|
||||
template: '',
|
||||
label: '',
|
||||
desc: '',
|
||||
})
|
||||
const templatesOptions = ref([])
|
||||
|
||||
const getTemplates = async ()=>{
|
||||
const res = await getTemplatesApi()
|
||||
if (res.code === 0){
|
||||
templatesOptions.value = res.data
|
||||
}
|
||||
}
|
||||
|
||||
getTemplates()
|
||||
|
||||
const validateNum = (rule, value, callback) => {
|
||||
if ((/^\d+$/.test(value[0]))) {
|
||||
@@ -152,6 +190,10 @@ const rules = ref({
|
||||
{ required: true, message: '请输入包名', trigger: 'blur' },
|
||||
{ validator: validateNum, trigger: 'blur' }
|
||||
],
|
||||
template:[
|
||||
{ required: true, message: '请选择模板', trigger: 'change' },
|
||||
{ validator: validateNum, trigger: 'blur' }
|
||||
]
|
||||
})
|
||||
|
||||
const dialogFormVisible = ref(false)
|
||||
@@ -163,6 +205,7 @@ const closeDialog = () => {
|
||||
dialogFormVisible.value = false
|
||||
form.value = {
|
||||
packageName: '',
|
||||
template: '',
|
||||
label: '',
|
||||
desc: '',
|
||||
}
|
||||
|
||||
@@ -1,353 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="gva-table-box">
|
||||
<el-form
|
||||
label-width="140px"
|
||||
class="w-[680px]"
|
||||
>
|
||||
<el-form-item label="插件名">
|
||||
<el-input
|
||||
v-model="form.plugName"
|
||||
placeholder="必填(英文大写字母开头)"
|
||||
@blur="titleCase"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="路由组">
|
||||
<el-input
|
||||
v-model="form.routerGroup"
|
||||
placeholder="将会作为插件路由组使用"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="使用全局属性">
|
||||
<el-checkbox v-model="form.hasGlobal" />
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
v-if="form.hasGlobal"
|
||||
label="全局属性"
|
||||
>
|
||||
<div
|
||||
v-for="(i,k) in form.global"
|
||||
:key="k"
|
||||
class="plug-row"
|
||||
>
|
||||
<span>
|
||||
<el-input
|
||||
v-model="i.key"
|
||||
placeholder="key 必填"
|
||||
/>
|
||||
</span>
|
||||
<span>
|
||||
<el-select
|
||||
class="w-32"
|
||||
v-model="i.type"
|
||||
placeholder="type 必填"
|
||||
>
|
||||
<el-option
|
||||
label="string"
|
||||
value="string"
|
||||
/>
|
||||
<el-option
|
||||
label="int"
|
||||
value="int"
|
||||
/>
|
||||
<el-option
|
||||
label="float32"
|
||||
value="float32"
|
||||
/>
|
||||
<el-option
|
||||
label="float64"
|
||||
value="float64"
|
||||
/>
|
||||
<el-option
|
||||
label="bool"
|
||||
value="bool"
|
||||
/>
|
||||
</el-select>
|
||||
</span>
|
||||
<span>
|
||||
<el-input
|
||||
v-model="i.desc"
|
||||
placeholder="备注 必填"
|
||||
/>
|
||||
</span>
|
||||
<span>
|
||||
<el-button
|
||||
:icon="Plus"
|
||||
circle
|
||||
@click="addkv(form.global)"
|
||||
/>
|
||||
</span>
|
||||
<span>
|
||||
<el-button
|
||||
:icon="Minus"
|
||||
circle
|
||||
@click="minkv(form.global,k)"
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="使用Request">
|
||||
<el-checkbox v-model="form.hasRequest" />
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
v-if="form.hasRequest"
|
||||
label="Request"
|
||||
>
|
||||
<div
|
||||
v-for="(i,k) in form.request"
|
||||
:key="k"
|
||||
class="plug-row"
|
||||
>
|
||||
<span>
|
||||
<el-input
|
||||
v-model="i.key"
|
||||
placeholder="key 必填"
|
||||
/>
|
||||
</span>
|
||||
<span>
|
||||
<el-select
|
||||
v-model="i.type"
|
||||
class="w-32"
|
||||
placeholder="type 必填"
|
||||
>
|
||||
<el-option
|
||||
label="string"
|
||||
value="string"
|
||||
/>
|
||||
<el-option
|
||||
label="int"
|
||||
value="int"
|
||||
/>
|
||||
<el-option
|
||||
label="float32"
|
||||
value="float32"
|
||||
/>
|
||||
<el-option
|
||||
label="float64"
|
||||
value="float64"
|
||||
/>
|
||||
<el-option
|
||||
label="bool"
|
||||
value="bool"
|
||||
/>
|
||||
</el-select>
|
||||
</span>
|
||||
<span>
|
||||
<el-input
|
||||
v-model="i.desc"
|
||||
placeholder="备注 必填"
|
||||
/>
|
||||
</span>
|
||||
<span>
|
||||
<el-button
|
||||
:icon="Plus"
|
||||
circle
|
||||
@click="addkv(form.request)"
|
||||
/>
|
||||
</span>
|
||||
<span>
|
||||
<el-button
|
||||
:icon="Minus"
|
||||
circle
|
||||
@click="minkv(form.request,k)"
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="使用Response">
|
||||
<el-checkbox v-model="form.hasResponse" />
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
v-if="form.hasResponse"
|
||||
label="Response"
|
||||
>
|
||||
<div
|
||||
v-for="(i,k) in form.response"
|
||||
:key="k"
|
||||
class="plug-row"
|
||||
>
|
||||
<span>
|
||||
<el-input
|
||||
v-model="i.key"
|
||||
placeholder="key 必填"
|
||||
/>
|
||||
</span>
|
||||
<span>
|
||||
<el-select
|
||||
v-model="i.type"
|
||||
class="w-32"
|
||||
placeholder="type 必填"
|
||||
>
|
||||
<el-option
|
||||
label="string"
|
||||
value="string"
|
||||
/>
|
||||
<el-option
|
||||
label="int"
|
||||
value="int"
|
||||
/>
|
||||
<el-option
|
||||
label="float32"
|
||||
value="float32"
|
||||
/>
|
||||
<el-option
|
||||
label="float64"
|
||||
value="float64"
|
||||
/>
|
||||
<el-option
|
||||
label="bool"
|
||||
value="bool"
|
||||
/>
|
||||
</el-select>
|
||||
</span>
|
||||
<span>
|
||||
<el-input
|
||||
v-model="i.desc"
|
||||
placeholder="备注 必填"
|
||||
/>
|
||||
</span>
|
||||
<span>
|
||||
<el-button
|
||||
:icon="Plus"
|
||||
circle
|
||||
@click="addkv(form.response)"
|
||||
/>
|
||||
</span>
|
||||
<span>
|
||||
<el-button
|
||||
:icon="Minus"
|
||||
circle
|
||||
@click="minkv(form.response,k)"
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button
|
||||
type="primary"
|
||||
@click="createPlug"
|
||||
>创建</el-button>
|
||||
<el-icon
|
||||
class="cursor-pointer ml-3"
|
||||
@click="toDoc('https://www.bilibili.com/video/BV1kv4y1g7nT?p=13&vd_source=f2640257c21e3b547a790461ed94875e')"
|
||||
><VideoCameraFilled /></el-icon>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { toUpperCase } from '@/utils/stringFun'
|
||||
|
||||
import {
|
||||
Plus,
|
||||
Minus, VideoCameraFilled
|
||||
} from '@element-plus/icons-vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
|
||||
import { createPlugApi } from '@/api/autoCode.js'
|
||||
|
||||
import { reactive } from 'vue'
|
||||
import { toDoc } from '@/utils/doc'
|
||||
|
||||
const form = reactive({
|
||||
plugName: '',
|
||||
routerGroup: '',
|
||||
hasGlobal: true,
|
||||
hasRequest: true,
|
||||
hasResponse: true,
|
||||
global: [{
|
||||
key: '',
|
||||
type: '',
|
||||
desc: '',
|
||||
}],
|
||||
request: [{
|
||||
key: '',
|
||||
type: '',
|
||||
desc: '',
|
||||
}],
|
||||
response: [{
|
||||
key: '',
|
||||
type: '',
|
||||
desc: '',
|
||||
}]
|
||||
})
|
||||
|
||||
const titleCase = () => {
|
||||
form.plugName = toUpperCase(form.plugName)
|
||||
}
|
||||
|
||||
const createPlug = async() => {
|
||||
if (!form.plugName || !form.routerGroup) {
|
||||
ElMessage.error('插件名称和插件路由组为必填项')
|
||||
return
|
||||
}
|
||||
if (form.hasGlobal) {
|
||||
const intercept = form.global.some(i => {
|
||||
if (!i.key || !i.type) {
|
||||
return true
|
||||
}
|
||||
})
|
||||
if (intercept) {
|
||||
ElMessage.error('全局属性的key和type为必填项')
|
||||
return
|
||||
}
|
||||
}
|
||||
if (form.hasRequest) {
|
||||
const intercept = form.request.some(i => {
|
||||
if (!i.key || !i.type) {
|
||||
return true
|
||||
}
|
||||
})
|
||||
if (intercept) {
|
||||
ElMessage.error('请求属性的key和type为必填项')
|
||||
return
|
||||
}
|
||||
}
|
||||
if (form.hasResponse) {
|
||||
const intercept = form.response.some(i => {
|
||||
if (!i.key || !i.type) {
|
||||
return true
|
||||
}
|
||||
})
|
||||
if (intercept) {
|
||||
ElMessage.error('响应属性的key和type为必填项')
|
||||
return
|
||||
}
|
||||
}
|
||||
const res = await createPlugApi(form)
|
||||
if (res.code === 0) {
|
||||
ElMessageBox('创建成功,插件已自动写入后端plugin目录下,请按照自己的逻辑进行创造')
|
||||
}
|
||||
}
|
||||
|
||||
const addkv = (arr) => {
|
||||
arr.push({
|
||||
key: '',
|
||||
value: '',
|
||||
})
|
||||
}
|
||||
|
||||
const minkv = (arr, key) => {
|
||||
if (arr.length === 1) {
|
||||
ElMessage.warning('至少有一个全局属性')
|
||||
return
|
||||
}
|
||||
arr.splice(key, 1)
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.plug-row{
|
||||
@apply flex items-center w-full;
|
||||
&+&{
|
||||
@apply mt-3;
|
||||
}
|
||||
&>span{
|
||||
@apply ml-2;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user