mirror of
https://gitee.com/xiangheng/x_admin.git
synced 2025-10-08 01:20:57 +08:00
升级依赖,加入预览详情模板
This commit is contained in:
@@ -16,26 +16,26 @@
|
||||
"dependencies": {
|
||||
"@element-plus/icons-vue": "^2.3.1",
|
||||
"@highlightjs/vue-plugin": "^2.1.0",
|
||||
"@logicflow/core": "^2.0.6",
|
||||
"@logicflow/extension": "^2.0.10",
|
||||
"@vueuse/core": "^10.11.0",
|
||||
"@logicflow/core": "^2.0.9",
|
||||
"@logicflow/extension": "^2.0.13",
|
||||
"@vueuse/core": "^12.0.0",
|
||||
"@wangeditor/editor": "^5.1.23",
|
||||
"@wangeditor/editor-for-vue": "^5.1.12",
|
||||
"axios": "^1.7.7",
|
||||
"axios": "^1.7.8",
|
||||
"crypto-js": "^4.2.0",
|
||||
"css-color-function": "^1.3.3",
|
||||
"dayjs": "^1.11.13",
|
||||
"echarts": "^5.5.1",
|
||||
"element-plus": "^2.8.6",
|
||||
"element-plus": "^2.9.0",
|
||||
"highlight.js": "^11.10.0",
|
||||
"lodash-es": "^4.17.21",
|
||||
"nprogress": "^0.2.0",
|
||||
"pinia": "^2.2.1",
|
||||
"query-string": "^9.1.0",
|
||||
"pinia": "^2.2.8",
|
||||
"query-string": "^9.1.1",
|
||||
"vform3-builds": "^3.0.10",
|
||||
"vue": "^3.5.12",
|
||||
"vue": "^3.5.13",
|
||||
"vue-clipboard3": "^2.0.0",
|
||||
"vue-echarts": "^7.0.1",
|
||||
"vue-echarts": "^7.0.3",
|
||||
"vue-router": "^4.4.5",
|
||||
"vue3-video-play": "^1.3.2",
|
||||
"vuedraggable": "^4.1.0"
|
||||
@@ -45,28 +45,28 @@
|
||||
"@types/lodash-es": "^4.17.12",
|
||||
"@types/node": "^20.14.2",
|
||||
"@types/nprogress": "^0.2.3",
|
||||
"@vitejs/plugin-vue": "^5.1.4",
|
||||
"@vitejs/plugin-vue-jsx": "^4.0.1",
|
||||
"@vitejs/plugin-vue": "^5.2.1",
|
||||
"@vitejs/plugin-vue-jsx": "^4.1.1",
|
||||
"@vue/eslint-config-prettier": "^9.0.0",
|
||||
"@vue/eslint-config-typescript": "^13.0.0",
|
||||
"@vue/tsconfig": "^0.5.1",
|
||||
"@vue/tsconfig": "^0.7.0",
|
||||
"autoprefixer": "^10.4.20",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-plugin-vue": "^9.27.0",
|
||||
"execa": "^9.3.0",
|
||||
"fs-extra": "^11.2.0",
|
||||
"postcss": "^8.4.38",
|
||||
"prettier": "^3.3.3",
|
||||
"postcss": "^8.4.49",
|
||||
"prettier": "^3.4.1",
|
||||
"rollup-plugin-visualizer": "^5.12.0",
|
||||
"sass": "^1.77.8",
|
||||
"tailwindcss": "^3.4.13",
|
||||
"typescript": "~5.6.2",
|
||||
"unplugin-auto-import": "^0.18.3",
|
||||
"unplugin-vue-components": "^0.27.4",
|
||||
"vite": "^5.4.7",
|
||||
"sass": "^1.81.1",
|
||||
"tailwindcss": "^3.4.15",
|
||||
"typescript": "~5.7.2",
|
||||
"unplugin-auto-import": "^0.18.6",
|
||||
"unplugin-vue-components": "^0.27.5",
|
||||
"vite": "^6.0.2",
|
||||
"vite-plugin-compression": "^0.5.1",
|
||||
"vite-plugin-style-import": "^2.0.0",
|
||||
"vite-plugin-svg-icons": "^2.0.1",
|
||||
"vue-tsc": "^2.1.6"
|
||||
"vue-tsc": "^2.1.10"
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
@import 'tailwind.css';
|
||||
@import 'element.scss';
|
||||
@import 'dark.css';
|
||||
@import 'var.css';
|
||||
@use 'tailwind.css' as *;
|
||||
@use 'element.scss' as *;
|
||||
@use 'dark.css' as *;
|
||||
@use 'var.css' as *;
|
||||
|
||||
@import 'public.scss';
|
||||
@use 'public.scss' as *;
|
||||
|
@@ -48,7 +48,7 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="使用SDK" v-if="mode == 'edit'">
|
||||
<el-form-item label="使用SDK" v-if="mode == 'edit'&&formData.ProjectType=='web'">
|
||||
<highlight-code :code="code" lang="javascript"></highlight-code>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
@@ -37,12 +37,12 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="CreateTime" class="w-[430px]">
|
||||
<!-- <el-form-item label="创建时间" prop="CreateTime" class="w-[430px]">
|
||||
<daterange-picker
|
||||
v-model:startTime="queryParams.CreateTimeStart"
|
||||
v-model:endTime="queryParams.CreateTimeEnd"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="更新时间" prop="UpdateTime" class="w-[420px]">
|
||||
<daterange-picker
|
||||
v-model:startTime="queryParams.UpdateTimeStart"
|
||||
@@ -112,18 +112,18 @@
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column label="项目uuid" prop="ProjectKey" min-width="130" />
|
||||
<el-table-column label="项目名称" prop="ProjectName" min-width="130" />
|
||||
<el-table-column label="项目类型" prop="ProjectType" min-width="100">
|
||||
<el-table-column label="项目类型" prop="ProjectType" width="100">
|
||||
<template #default="{ row }">
|
||||
<dict-value :options="dictData.project_type" :value="row.ProjectType" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="是否启用" prop="Status" min-width="100">
|
||||
<el-table-column label="是否启用" prop="Status" width="100">
|
||||
<template #default="{ row }">
|
||||
<dict-value :options="dictData.status" :value="row.Status" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间" prop="CreateTime" min-width="130" />
|
||||
<el-table-column label="更新时间" prop="UpdateTime" min-width="130" />
|
||||
<!-- <el-table-column label="创建时间" prop="CreateTime" min-width="130" /> -->
|
||||
<el-table-column label="更新时间" prop="UpdateTime" width="180" />
|
||||
<el-table-column label="操作" width="120" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
|
@@ -59,11 +59,11 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="排序" prop="menuSort" min-width="60" />
|
||||
<el-table-column
|
||||
<!-- <el-table-column
|
||||
label="更新时间"
|
||||
prop="updateTime"
|
||||
min-width="120"
|
||||
></el-table-column>
|
||||
></el-table-column> -->
|
||||
<el-table-column label="操作" width="160" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
|
@@ -28,12 +28,12 @@ admin:{{{.ModuleName }}}:ImportFile
|
||||
|
||||
// 列表
|
||||
INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, paths, component, is_cache, is_show, is_disable, create_time, update_time) VALUES (0, 'C', '{{{ .FunctionName }}}', '{{{nameToPath .ModuleName }}}/index', '{{{nameToPath .ModuleName }}}/index', 0, 1, 0, now(), now());
|
||||
INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_show, is_disable, create_time, update_time) SELECT id, 'A', '{{{ .FunctionName }}}列表','admin:{{{ .ModuleName }}}:list', 0, 1, 0, now(), now() FROM x_system_auth_menu WHERE component='{{{nameToPath .ModuleName }}}/index';
|
||||
INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_show, is_disable, create_time, update_time) SELECT id, 'A', '{{{ .FunctionName }}}全部列表','admin:{{{ .ModuleName }}}:listAll', 0, 1, 0, now(), now() FROM x_system_auth_menu WHERE component='{{{nameToPath .ModuleName }}}/index';
|
||||
INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_show, is_disable, create_time, update_time) SELECT id, 'A', '{{{ .FunctionName }}}添加','admin:{{{ .ModuleName }}}:add', 0, 1, 0, now(), now() FROM x_system_auth_menu WHERE component='{{{nameToPath .ModuleName }}}/index';
|
||||
INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_show, is_disable, create_time, update_time) SELECT id, 'A', '{{{ .FunctionName }}}编辑','admin:{{{ .ModuleName }}}:edit', 0, 1, 0, now(), now() FROM x_system_auth_menu WHERE component='{{{nameToPath .ModuleName }}}/index';
|
||||
INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_show, is_disable, create_time, update_time) SELECT id, 'A', '{{{ .FunctionName }}}删除','admin:{{{ .ModuleName }}}:del', 0, 1, 0, now(), now() FROM x_system_auth_menu WHERE component='{{{nameToPath .ModuleName }}}/index';
|
||||
INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_show, is_disable, create_time, update_time) SELECT id, 'A', '{{{ .FunctionName }}}删除-批量','admin:{{{ .ModuleName }}}:delBatch', 0, 1, 0, now(), now() FROM x_system_auth_menu WHERE component='{{{nameToPath .ModuleName }}}/index';
|
||||
INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_show, is_disable, create_time, update_time) SELECT id, 'A', '{{{ .FunctionName }}}列表','admin:{{{ .ModuleName }}}:list', 0, 1, 0, now(), now() FROM x_system_auth_menu WHERE component='{{{nameToPath .ModuleName }}}/index';
|
||||
INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_show, is_disable, create_time, update_time) SELECT id, 'A', '{{{ .FunctionName }}}全部列表','admin:{{{ .ModuleName }}}:listAll', 0, 1, 0, now(), now() FROM x_system_auth_menu WHERE component='{{{nameToPath .ModuleName }}}/index';
|
||||
INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_show, is_disable, create_time, update_time) SELECT id, 'A', '{{{ .FunctionName }}}详情','admin:{{{ .ModuleName }}}:detail', 0, 1, 0, now(), now() FROM x_system_auth_menu WHERE component='{{{nameToPath .ModuleName }}}/index';
|
||||
INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_show, is_disable, create_time, update_time) SELECT id, 'A', '{{{ .FunctionName }}}导出excel','admin:{{{ .ModuleName }}}:ExportFile', 0, 1, 0, now(), now() FROM x_system_auth_menu WHERE component='{{{nameToPath .ModuleName }}}/index';
|
||||
INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_show, is_disable, create_time, update_time) SELECT id, 'A', '{{{ .FunctionName }}}导入excel','admin:{{{ .ModuleName }}}:ImportFile', 0, 1, 0, now(), now() FROM x_system_auth_menu WHERE component='{{{nameToPath .ModuleName }}}/index';
|
||||
|
284
server/admin/generator/tpl_utils/templates/vue/details.vue.tpl
Normal file
284
server/admin/generator/tpl_utils/templates/vue/details.vue.tpl
Normal file
@@ -0,0 +1,284 @@
|
||||
<template>
|
||||
<div class="edit-popup">
|
||||
<popup
|
||||
ref="popupRef"
|
||||
:title="popupTitle"
|
||||
:async="true"
|
||||
width="550px"
|
||||
:clickModalClose="true"
|
||||
:confirmButtonText="false"
|
||||
|
||||
@close="handleClose"
|
||||
>
|
||||
<el-form ref="formRef" :model="formData" label-width="84px" :rules="formRules">
|
||||
{{{- range .Columns }}}
|
||||
{{{- if .IsEdit }}}
|
||||
{{{- if ne (toUpperCamelCase .GoField) "Id" }}}
|
||||
{{{- if and (ne $.Table.TreeParent "") (eq (toUpperCamelCase .GoField) $.Table.TreeParent) }}}
|
||||
<el-form-item label="{{{ .ColumnComment }}}" prop="{{{ (toUpperCamelCase .GoField) }}}">
|
||||
<el-tree-select
|
||||
class="flex-1"
|
||||
v-model="formData.{{{ (toUpperCamelCase .GoField) }}}"
|
||||
:data="treeList"
|
||||
clearable
|
||||
node-key="{{{ .Table.TreePrimary }}}"
|
||||
:props="{ label: '{{{ .Table.TreeName }}}', value: '{{{ .Table.TreePrimary }}}', children: 'children' }"
|
||||
:default-expand-all="true"
|
||||
placeholder="请选择{{{ .ColumnComment }}}"
|
||||
check-strictly
|
||||
disabled
|
||||
/>
|
||||
</el-form-item>
|
||||
{{{- else if eq .HtmlType "input" }}}
|
||||
<el-form-item label="{{{ .ColumnComment }}}" prop="{{{ (toUpperCamelCase .GoField) }}}">
|
||||
<span v-text="formData.{{{ (toUpperCamelCase .GoField) }}}"></span>
|
||||
</el-form-item>
|
||||
{{{- else if eq .HtmlType "number" }}}
|
||||
<el-form-item label="{{{ .ColumnComment }}}" prop="{{{ (toUpperCamelCase .GoField) }}}">
|
||||
<span v-text="formData.{{{ (toUpperCamelCase .GoField) }}}"></span>
|
||||
</el-form-item>
|
||||
{{{- else if eq .HtmlType "textarea" }}}
|
||||
<el-form-item label="{{{ .ColumnComment }}}" prop="{{{ (toUpperCamelCase .GoField) }}}">
|
||||
<span v-text="formData.{{{ (toUpperCamelCase .GoField) }}}"></span>
|
||||
</el-form-item>
|
||||
{{{- else if eq .HtmlType "checkbox" }}}
|
||||
<el-form-item label="{{{ .ColumnComment }}}" prop="{{{ (toUpperCamelCase .GoField) }}}">
|
||||
|
||||
|
||||
{{{- if ne .DictType "" }}}
|
||||
<dict-value :options="dictData.{{{ .DictType }}}" :value="formData.{{{ (toUpperCamelCase .GoField) }}}" />
|
||||
{{!-- <el-checkbox
|
||||
v-for="(item, index) in dictData.{{{ .DictType }}}"
|
||||
:key="index"
|
||||
:label="item.name"
|
||||
:value="item.value"
|
||||
:disabled="!item.status"
|
||||
></el-checkbox> --}}
|
||||
{{{- else if ne .ListAllApi "" }}}
|
||||
<dict-value :options="listAllData.{{{pathToName .ListAllApi }}}" :value="formData.{{{ (toUpperCamelCase .GoField) }}}" />
|
||||
{{!-- <el-checkbox
|
||||
v-for="(item, index) in listAllData.{{{pathToName .ListAllApi }}}"
|
||||
:key="index"
|
||||
:label="item.Id"
|
||||
:value="item.Id"
|
||||
></el-checkbox> --}}
|
||||
|
||||
{{!-- <el-checkbox>请选择字典生成</el-checkbox> --}}
|
||||
{{{- end }}}
|
||||
|
||||
</el-form-item>
|
||||
{{{- else if eq .HtmlType "select" }}}
|
||||
<el-form-item label="{{{ .ColumnComment }}}" prop="{{{ (toUpperCamelCase .GoField) }}}">
|
||||
{{!-- <el-select class="flex-1" v-model="formData.{{{ (toUpperCamelCase .GoField) }}}" placeholder="请选择{{{ .ColumnComment }}}"> --}}
|
||||
{{{- if ne .DictType "" }}}
|
||||
<dict-value :options="dictData.{{{ .DictType }}}" :value="formData.{{{ (toUpperCamelCase .GoField) }}}" />
|
||||
{{!-- <el-option
|
||||
v-for="(item, index) in dictData.{{{ .DictType }}}"
|
||||
:key="index"
|
||||
:label="item.name"
|
||||
{{{- if eq .GoType "int" }}}
|
||||
:value="parseInt(item.value)"
|
||||
{{{- else }}}
|
||||
:value="item.value"
|
||||
{{{- end }}}
|
||||
clearable
|
||||
:disabled="!item.status"
|
||||
/> --}}
|
||||
{{{- else if ne .ListAllApi "" }}}
|
||||
<dict-value :options="listAllData.{{{pathToName .ListAllApi }}}" :value="formData.{{{ (toUpperCamelCase .GoField) }}}" />
|
||||
{{!-- <el-option
|
||||
v-for="(item, index) in listAllData.{{{pathToName .ListAllApi }}}"
|
||||
:key="index"
|
||||
:label="item.Id"
|
||||
{{{- if eq .GoType "int" }}}
|
||||
:value="parseInt(item.Id)"
|
||||
{{{- else }}}
|
||||
:value="String(item.Id)"
|
||||
{{{- end }}}
|
||||
clearable
|
||||
/> --}}
|
||||
|
||||
{{!-- <el-option label="请选择字典生成" value="" /> --}}
|
||||
{{{- end }}}
|
||||
{{!-- </el-select> --}}
|
||||
</el-form-item>
|
||||
{{{- else if eq .HtmlType "radio" }}}
|
||||
<el-form-item label="{{{ .ColumnComment }}}" prop="{{{ (toUpperCamelCase .GoField) }}}">
|
||||
{{!-- <el-radio-group v-model="formData.{{{ (toUpperCamelCase .GoField) }}}" placeholder="请选择{{{ .ColumnComment }}}"> --}}
|
||||
{{{- if ne .DictType "" }}}
|
||||
<dict-value :options="dictData.{{{ .DictType }}}" :value="formData.{{{ (toUpperCamelCase .GoField) }}}" />
|
||||
{{!-- <el-radio
|
||||
v-for="(item, index) in dictData.{{{ .DictType }}}"
|
||||
:key="index"
|
||||
:label="item.name"
|
||||
{{{- if eq .GoType "int" }}}
|
||||
:value="parseInt(item.value)"
|
||||
{{{- else }}}
|
||||
:value="item.value"
|
||||
{{{- end }}}
|
||||
:disabled="!item.status"
|
||||
></el-radio> --}}
|
||||
{{{- else if ne .ListAllApi "" }}}
|
||||
<dict-value :options="listAllData.{{{pathToName .ListAllApi }}}" :value="formData.{{{ (toUpperCamelCase .GoField) }}}" />
|
||||
{{!-- <el-radio
|
||||
v-for="(item, index) in listAllData.{{{ pathToName .ListAllApi }}}"
|
||||
:key="index"
|
||||
:label="item.name"
|
||||
{{{- if eq .GoType "int" }}}
|
||||
:value="parseInt(item.Id)"
|
||||
{{{- else }}}
|
||||
:value="item.Id"
|
||||
{{{- end }}}
|
||||
>
|
||||
{{ item.Id }}
|
||||
</el-radio> --}}
|
||||
|
||||
{{!-- <el-radio label="0">请选择字典生成</el-radio> --}}
|
||||
{{{- end }}}
|
||||
{{!-- </el-radio-group> --}}
|
||||
</el-form-item>
|
||||
{{{- else if eq .HtmlType "datetime" }}}
|
||||
<el-form-item label="{{{ .ColumnComment }}}" prop="{{{ (toUpperCamelCase .GoField) }}}">
|
||||
<span v-text="formData.{{{ (toUpperCamelCase .GoField) }}}"></span>
|
||||
{{!-- <el-date-picker
|
||||
class="flex-1 !flex"
|
||||
v-model="formData.{{{ (toUpperCamelCase .GoField) }}}"
|
||||
type="datetime"
|
||||
clearable
|
||||
value-format="YYYY-MM-DD hh:mm:ss"
|
||||
placeholder="请选择{{{ .ColumnComment }}}"
|
||||
/> --}}
|
||||
</el-form-item>
|
||||
{{{- else if eq .HtmlType "editor" }}}
|
||||
<el-form-item label="{{{ .ColumnComment }}}" prop="{{{ (toUpperCamelCase .GoField) }}}">
|
||||
<div v-html="formData.{{{ (toUpperCamelCase .GoField) }}}"></div>
|
||||
</el-form-item>
|
||||
{{{- else if eq .HtmlType "imageUpload" }}}
|
||||
<el-form-item label="{{{ .ColumnComment }}}" prop="{{{ (toUpperCamelCase .GoField) }}}">
|
||||
<image-contain
|
||||
:width="40"
|
||||
:height="40"
|
||||
:src="formData.{{{ (toUpperCamelCase .GoField) }}}"
|
||||
:preview-src-list="[formData.{{{ (toUpperCamelCase .GoField) }}}]"
|
||||
preview-teleported
|
||||
hide-on-click-modal
|
||||
/>
|
||||
</el-form-item>
|
||||
{{{- end }}}
|
||||
{{{- end }}}
|
||||
{{{- end }}}
|
||||
{{{- end }}}
|
||||
|
||||
</el-form>
|
||||
</popup>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import type { FormInstance } from 'element-plus'
|
||||
import { {{{ if and .Table.TreePrimary .Table.TreeParent }}}{{{ .ModuleName }}}_list_all,{{{ end }}} ,{{{ .ModuleName }}}_detail } from '@/api/{{{nameToPath .ModuleName }}}'
|
||||
import Popup from '@/components/popup/index.vue'
|
||||
import feedback from '@/utils/feedback'
|
||||
import { ref, shallowRef, computed, reactive } from 'vue'
|
||||
import type { PropType } from 'vue'
|
||||
defineProps({
|
||||
dictData: {
|
||||
type: Object as PropType<Record<string, any[]>>,
|
||||
default: () => ({})
|
||||
},
|
||||
listAllData:{
|
||||
type: Object as PropType<Record<string, any[]>>,
|
||||
default: () => ({})
|
||||
}
|
||||
})
|
||||
const emit = defineEmits(['success', 'close'])
|
||||
const formRef = shallowRef<FormInstance>()
|
||||
const popupRef = shallowRef<InstanceType<typeof Popup>>()
|
||||
{{{- if and .Table.TreePrimary .Table.TreeParent }}}
|
||||
const treeList = ref<any[]>([])
|
||||
{{{- end }}}
|
||||
|
||||
const popupTitle = computed(() => {
|
||||
return '预览{{{ .FunctionName }}}'
|
||||
})
|
||||
|
||||
const formData = reactive({
|
||||
{{{- range .Columns }}}
|
||||
{{{- if eq (toUpperCamelCase .GoField) $.PrimaryKey }}}
|
||||
{{{ $.PrimaryKey }}}: '',
|
||||
{{{- else if .IsEdit }}}
|
||||
{{{- if eq .HtmlType "checkbox" }}}
|
||||
{{{ (toUpperCamelCase .GoField) }}}: [],
|
||||
{{{- else if eq .HtmlType "number" }}}
|
||||
{{{ (toUpperCamelCase .GoField) }}}: null,
|
||||
{{{- else }}}
|
||||
{{{ (toUpperCamelCase .GoField) }}}: null,
|
||||
{{{- end }}}
|
||||
{{{- end }}}
|
||||
{{{- end }}}
|
||||
})
|
||||
|
||||
const formRules = {
|
||||
{{{- range .Columns }}}
|
||||
{{{- if and .IsEdit }}}
|
||||
{{{ (toUpperCamelCase .GoField) }}}: [
|
||||
{
|
||||
required: {{{- if eq .IsRequired 1}}} true {{{- else}}} false {{{- end }}},
|
||||
{{{- if or (eq .HtmlType "checkbox") (eq .HtmlType "datetime") (eq .HtmlType "radio") (eq .HtmlType "select") (eq .HtmlType "imageUpload") }}}
|
||||
message: '请选择{{{ .ColumnComment }}}',
|
||||
{{{- else }}}
|
||||
message: '请输入{{{ .ColumnComment }}}',
|
||||
{{{- end }}}
|
||||
trigger: ['blur']
|
||||
}
|
||||
],
|
||||
{{{- end }}}
|
||||
{{{- end }}}
|
||||
}
|
||||
|
||||
const open = () => {
|
||||
popupRef.value?.open()
|
||||
}
|
||||
|
||||
const setFormData = async (data: Record<string, any>) => {
|
||||
for (const key in formData) {
|
||||
if (data[key] != null && data[key] != undefined) {
|
||||
//@ts-ignore
|
||||
formData[key] = data[key]
|
||||
{{{- range .Columns }}}
|
||||
{{{- if eq .HtmlType "checkbox" }}}
|
||||
//@ts-ignore
|
||||
formData.{{{ (toUpperCamelCase .GoField) }}} = String(data.{{{ (toUpperCamelCase .GoField) }}}).split(',')
|
||||
{{{- end }}}
|
||||
{{{- end }}}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const getDetail = async (row: Record<string, any>) => {
|
||||
try {
|
||||
const data = await {{{ .ModuleName }}}_detail(row.{{{toUpperCamelCase .PrimaryKey }}})
|
||||
setFormData(data)
|
||||
} catch (error) {}
|
||||
}
|
||||
|
||||
const handleClose = () => {
|
||||
emit('close')
|
||||
}
|
||||
{{{- if and .Table.TreePrimary .Table.TreeParent }}}
|
||||
|
||||
const getLists = async () => {
|
||||
const data: any = await {{{ .ModuleName }}}_list_all()
|
||||
const item = { {{{ .Table.TreePrimary }}}: 0, {{{ .Table.TreeName }}}: '顶级', children: [] }
|
||||
item.children = data
|
||||
treeList.value.push(item)
|
||||
}
|
||||
|
||||
getLists()
|
||||
{{{- end }}}
|
||||
|
||||
defineExpose({
|
||||
open,
|
||||
setFormData,
|
||||
getDetail
|
||||
})
|
||||
</script>
|
@@ -163,7 +163,7 @@
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import type { FormInstance } from 'element-plus'
|
||||
import { {{{ if and .Table.TreePrimary .Table.TreeParent }}}{{{ .ModuleName }}}_lists,{{{ end }}} {{{ .ModuleName }}}_edit, {{{ .ModuleName }}}_add, {{{ .ModuleName }}}_detail } from '@/api/{{{nameToPath .ModuleName }}}'
|
||||
import { {{{ if and .Table.TreePrimary .Table.TreeParent }}}{{{ .ModuleName }}}_list_all,{{{ end }}} {{{ .ModuleName }}}_edit, {{{ .ModuleName }}}_add, {{{ .ModuleName }}}_detail } from '@/api/{{{nameToPath .ModuleName }}}'
|
||||
import Popup from '@/components/popup/index.vue'
|
||||
import feedback from '@/utils/feedback'
|
||||
import { ref, shallowRef, computed, reactive } from 'vue'
|
||||
@@ -272,7 +272,7 @@ const handleClose = () => {
|
||||
{{{- if and .Table.TreePrimary .Table.TreeParent }}}
|
||||
|
||||
const getLists = async () => {
|
||||
const data: any = await {{{ .ModuleName }}}_lists()
|
||||
const data: any = await {{{ .ModuleName }}}_list_all()
|
||||
const item = { {{{ .Table.TreePrimary }}}: 0, {{{ .Table.TreeName }}}: '顶级', children: [] }
|
||||
item.children = data
|
||||
treeList.value.push(item)
|
||||
|
@@ -176,8 +176,10 @@ func (tu templateUtil) GetTemplatePaths(genTpl string) []string {
|
||||
"gocode/service.go.tpl",
|
||||
"gocode/route.go.tpl",
|
||||
"gocode/controller.go.tpl",
|
||||
|
||||
"vue/api.ts.tpl",
|
||||
"vue/edit.vue.tpl",
|
||||
"vue/details.vue.tpl",
|
||||
|
||||
"uniapp/api.ts.tpl",
|
||||
"uniapp/edit.vue.tpl",
|
||||
@@ -235,6 +237,7 @@ func (tu templateUtil) GetFilePaths(tplCodeMap map[string]string, ModuleName str
|
||||
|
||||
"vue/api.ts.tpl": strings.Join([]string{"admin/src/api/", GenUtil.NameToPath(ModuleName), ".ts"}, ""), // "admin/src/api/%s.ts",
|
||||
"vue/edit.vue.tpl": strings.Join([]string{"admin/src/views/", GenUtil.NameToPath(ModuleName), "/edit.vue"}, ""), // "admin/src/views/%s/edit.vue",
|
||||
"vue/details.vue.tpl": strings.Join([]string{"admin/src/views/", GenUtil.NameToPath(ModuleName), "/details.vue"}, ""), // "admin/src/views/%s/details.vue",
|
||||
"vue/index.vue.tpl": strings.Join([]string{"admin/src/views/", GenUtil.NameToPath(ModuleName), "/index.vue"}, ""), // "admin/src/views/%s/index.vue",
|
||||
"vue/index-tree.vue.tpl": strings.Join([]string{"admin/src/views/", GenUtil.NameToPath(ModuleName), "/index.vue"}, ""), // "admin/src/views/%s/index-tree.vue",
|
||||
|
||||
|
@@ -42,14 +42,6 @@ func initRouter() *gin.Engine {
|
||||
})
|
||||
// 设置中间件
|
||||
r.Use(gin.Logger(), middleware.Cors(), middleware.ErrorRecover())
|
||||
r.GET("/api/admin/apiList", middleware.TokenAuth(), func(ctx *gin.Context) {
|
||||
var path = []string{}
|
||||
for _, route := range r.Routes() {
|
||||
// fmt.Printf("%s 127.0.0.1:%v%s\n", route.Method, config.Config.ServerPort, route.Path)
|
||||
path = append(path, route.Path)
|
||||
}
|
||||
response.Result(ctx, response.Success, path)
|
||||
})
|
||||
|
||||
// 演示模式
|
||||
if config.Config.DisallowModify {
|
||||
@@ -61,7 +53,7 @@ func initRouter() *gin.Engine {
|
||||
// 注册路由
|
||||
apiGroup := r.Group("/api")
|
||||
|
||||
router.RegisterGroup(apiGroup)
|
||||
router.RegisterGroup(apiGroup, r)
|
||||
|
||||
return r
|
||||
}
|
||||
|
@@ -2,14 +2,27 @@ package router
|
||||
|
||||
import (
|
||||
"x_admin/admin/common/captcha"
|
||||
"x_admin/core/response"
|
||||
"x_admin/middleware"
|
||||
"x_admin/router/admin"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func RegisterGroup(rg *gin.RouterGroup) {
|
||||
// 一下路由前缀为/api
|
||||
admin.RegisterGroup(rg)
|
||||
func RegisterGroup(api *gin.RouterGroup, rootRouter *gin.Engine) {
|
||||
|
||||
captcha.CaptchaRoute(rg)
|
||||
// /api/admin/apiList 获取所有接口
|
||||
api.GET("/admin/apiList", middleware.TokenAuth(), func(ctx *gin.Context) {
|
||||
var path = []string{}
|
||||
for _, route := range rootRouter.Routes() {
|
||||
// fmt.Printf("%s 127.0.0.1:%v%s\n", route.Method, config.Config.ServerPort, route.Path)
|
||||
path = append(path, route.Path)
|
||||
}
|
||||
response.Result(ctx, response.Success, path)
|
||||
})
|
||||
|
||||
// /api/admin
|
||||
admin.RegisterGroup(api)
|
||||
// /api/common/captcha 验证码
|
||||
captcha.CaptchaRoute(api)
|
||||
}
|
||||
|
5
x_err_sdk/.vscode/settings.json
vendored
Normal file
5
x_err_sdk/.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"cSpell.words": [
|
||||
"adtkcn"
|
||||
]
|
||||
}
|
Reference in New Issue
Block a user