Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
98afdfc0
authored
Mar 29, 2023
by
YunaiV
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
REVIEW 代码生成
parent
e6dac1eb
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
47 deletions
+29
-47
src/api/system/dict/dict.type.ts
+1
-1
src/views/infra/codegen/components/BasicInfoForm.vue
+4
-12
src/views/infra/codegen/components/ColumInfoForm.vue
+10
-16
src/views/infra/codegen/components/GenerateInfoForm.vue
+13
-17
src/views/system/dict/data.vue
+1
-1
No files found.
src/api/system/dict/dict.type.ts
View file @
98afdfc0
...
@@ -10,7 +10,7 @@ export type DictTypeVO = {
...
@@ -10,7 +10,7 @@ export type DictTypeVO = {
}
}
// 查询字典(精简)列表
// 查询字典(精简)列表
export
const
listSimpleDictType
=
()
=>
{
export
const
getSimpleDictTypeList
=
()
=>
{
return
request
.
get
({
url
:
'/system/dict-type/list-all-simple'
})
return
request
.
get
({
url
:
'/system/dict-type/list-all-simple'
})
}
}
...
...
src/views/infra/codegen/components/BasicInfoForm.vue
View file @
98afdfc0
...
@@ -11,7 +11,6 @@
...
@@ -11,7 +11,6 @@
<el-input
placeholder=
"请输入"
v-model=
"formData.tableComment"
/>
<el-input
placeholder=
"请输入"
v-model=
"formData.tableComment"
/>
</el-form-item>
</el-form-item>
</el-col>
</el-col>
<el-col
:span=
"12"
>
<el-col
:span=
"12"
>
<el-form-item
prop=
"className"
>
<el-form-item
prop=
"className"
>
<template
#
label
>
<template
#
label
>
...
@@ -25,7 +24,6 @@
...
@@ -25,7 +24,6 @@
</el-tooltip>
</el-tooltip>
</span>
</span>
</
template
>
</
template
>
<el-input
placeholder=
"请输入"
v-model=
"formData.className"
/>
<el-input
placeholder=
"请输入"
v-model=
"formData.className"
/>
</el-form-item>
</el-form-item>
</el-col>
</el-col>
...
@@ -43,13 +41,12 @@
...
@@ -43,13 +41,12 @@
</el-form>
</el-form>
</template>
</template>
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
import
{
CodegenTableVO
}
from
'@/api/infra/codegen/types
'
import
*
as
CodegenApi
from
'@/api/infra/codegen
'
import
{
PropType
}
from
'vue'
import
{
PropType
}
from
'vue'
const
emits
=
defineEmits
([
'update:basicInfo'
])
const
props
=
defineProps
({
const
props
=
defineProps
({
table
:
{
table
:
{
type
:
Object
as
PropType
<
Nullable
<
CodegenTableVO
>>
,
type
:
Object
as
PropType
<
Nullable
<
Codegen
Api
.
Codegen
TableVO
>>
,
default
:
()
=>
null
default
:
()
=>
null
}
}
})
})
...
@@ -62,7 +59,6 @@ const formData = ref({
...
@@ -62,7 +59,6 @@ const formData = ref({
author
:
''
,
author
:
''
,
remark
:
''
remark
:
''
})
})
const
rules
=
reactive
({
const
rules
=
reactive
({
tableName
:
[
required
],
tableName
:
[
required
],
tableComment
:
[
required
],
tableComment
:
[
required
],
...
@@ -70,6 +66,7 @@ const rules = reactive({
...
@@ -70,6 +66,7 @@ const rules = reactive({
author
:
[
required
]
author
:
[
required
]
})
})
/** 监听 table 属性,复制给 formData 属性 */
watch
(
watch
(
()
=>
props
.
table
,
()
=>
props
.
table
,
(
table
)
=>
{
(
table
)
=>
{
...
@@ -81,12 +78,7 @@ watch(
...
@@ -81,12 +78,7 @@ watch(
immediate
:
true
immediate
:
true
}
}
)
)
watch
(
()
=>
formData
.
value
,
(
val
)
=>
{
emits
(
'update:basicInfo'
,
val
)
}
)
defineExpose
({
defineExpose
({
validate
:
async
()
=>
unref
(
formRef
)?.
validate
()
validate
:
async
()
=>
unref
(
formRef
)?.
validate
()
})
})
...
...
src/views/infra/codegen/components/ColumInfoForm.vue
View file @
98afdfc0
...
@@ -114,28 +114,24 @@
...
@@ -114,28 +114,24 @@
</template>
</template>
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
import
{
PropType
}
from
'vue'
import
{
PropType
}
from
'vue'
import
{
CodegenColumnVO
}
from
'@/api/infra/codegen/types
'
import
*
as
CodegenApi
from
'@/api/infra/codegen
'
import
{
DictTypeVO
,
listSimpleDictType
}
from
'@/api/system/dict/dict.type'
import
*
as
DictDataApi
from
'@/api/system/dict/dict.type'
const
emits
=
defineEmits
([
'update:columns'
])
const
props
=
defineProps
({
const
props
=
defineProps
({
columns
:
{
columns
:
{
type
:
Array
as
unknown
as
PropType
<
CodegenColumnVO
[]
>
,
type
:
Array
as
unknown
as
PropType
<
Codegen
Api
.
Codegen
ColumnVO
[]
>
,
default
:
()
=>
null
default
:
()
=>
null
}
}
})
})
const
formData
=
ref
<
CodegenColumnVO
[]
>
([])
const
formData
=
ref
<
Codegen
Api
.
Codegen
ColumnVO
[]
>
([])
const
tableHeight
=
document
.
documentElement
.
scrollHeight
-
350
+
'px'
const
tableHeight
=
document
.
documentElement
.
scrollHeight
-
350
+
'px'
/** 查询字典下拉列表 */
/** 查询字典下拉列表 */
const
dictOptions
=
ref
<
DictTypeVO
[]
>
()
const
dictOptions
=
ref
<
Dict
DataApi
.
Dict
TypeVO
[]
>
()
const
getDictOptions
=
async
()
=>
{
const
getDictOptions
=
async
()
=>
{
dictOptions
.
value
=
await
listSimpleDictType
()
dictOptions
.
value
=
await
DictDataApi
.
getSimpleDictTypeList
()
}
}
onMounted
(
async
()
=>
{
await
getDictOptions
()
})
watch
(
watch
(
()
=>
props
.
columns
,
()
=>
props
.
columns
,
...
@@ -148,10 +144,8 @@ watch(
...
@@ -148,10 +144,8 @@ watch(
immediate
:
true
immediate
:
true
}
}
)
)
watch
(
()
=>
formData
.
value
,
onMounted
(
async
()
=>
{
(
val
)
=>
{
await
getDictOptions
()
emits
(
'update:columns'
,
val
)
})
}
)
</
script
>
</
script
>
src/views/infra/codegen/components/GenerateInfoForm.vue
View file @
98afdfc0
...
@@ -5,10 +5,10 @@
...
@@ -5,10 +5,10 @@
<el-form-item
prop=
"templateType"
label=
"生成模板"
>
<el-form-item
prop=
"templateType"
label=
"生成模板"
>
<el-select
v-model=
"formData.templateType"
@
change=
"tplSelectChange"
>
<el-select
v-model=
"formData.templateType"
@
change=
"tplSelectChange"
>
<el-option
<el-option
v-for=
"dict in getDictOptions(DICT_TYPE.INFRA_CODEGEN_TEMPLATE_TYPE)"
v-for=
"dict in get
Int
DictOptions(DICT_TYPE.INFRA_CODEGEN_TEMPLATE_TYPE)"
:key=
"
parseInt(dict.value)
"
:key=
"
dict.value
"
:label=
"dict.label"
:label=
"dict.label"
:value=
"
parseInt(dict.value)
"
:value=
"
dict.value
"
/>
/>
</el-select>
</el-select>
</el-form-item>
</el-form-item>
...
@@ -17,10 +17,10 @@
...
@@ -17,10 +17,10 @@
<el-form-item
prop=
"scene"
label=
"生成场景"
>
<el-form-item
prop=
"scene"
label=
"生成场景"
>
<el-select
v-model=
"formData.scene"
>
<el-select
v-model=
"formData.scene"
>
<el-option
<el-option
v-for=
"dict in getDictOptions(DICT_TYPE.INFRA_CODEGEN_SCENE)"
v-for=
"dict in get
Int
DictOptions(DICT_TYPE.INFRA_CODEGEN_SCENE)"
:key=
"
parseInt(dict.value)
"
:key=
"
dict.value
"
:label=
"dict.label"
:label=
"dict.label"
:value=
"
parseInt(dict.value)
"
:value=
"
dict.value
"
/>
/>
</el-select>
</el-select>
</el-form-item>
</el-form-item>
...
@@ -280,17 +280,16 @@
...
@@ -280,17 +280,16 @@
</el-form>
</el-form>
</template>
</template>
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
import
{
CodegenTableVO
}
from
'@/api/infra/codegen/types'
import
{
getIntDictOptions
,
DICT_TYPE
}
from
'@/utils/dict'
import
{
handleTree
}
from
'@/utils/tree'
import
*
as
CodegenApi
from
'@/api/infra/codegen'
import
*
as
MenuApi
from
'@/api/system/menu'
import
*
as
MenuApi
from
'@/api/system/menu'
import
{
PropType
}
from
'vue'
import
{
PropType
}
from
'vue'
import
{
getDictOptions
,
DICT_TYPE
}
from
'@/utils/dict'
import
{
handleTree
}
from
'@/utils/tree'
const
message
=
useMessage
()
// 消息弹窗
const
message
=
useMessage
()
// 消息弹窗
const
emits
=
defineEmits
([
'update:basicInfo'
])
const
props
=
defineProps
({
const
props
=
defineProps
({
table
:
{
table
:
{
type
:
Object
as
PropType
<
Nullable
<
CodegenTableVO
>>
,
type
:
Object
as
PropType
<
Nullable
<
Codegen
Api
.
Codegen
TableVO
>>
,
default
:
()
=>
null
default
:
()
=>
null
}
}
})
})
...
@@ -335,6 +334,7 @@ const menuTreeProps = {
...
@@ -335,6 +334,7 @@ const menuTreeProps = {
const
subSelectChange
=
()
=>
{
const
subSelectChange
=
()
=>
{
formData
.
value
.
subTableFkName
=
''
formData
.
value
.
subTableFkName
=
''
}
}
/** 选择生成模板触发 */
/** 选择生成模板触发 */
const
tplSelectChange
=
(
value
)
=>
{
const
tplSelectChange
=
(
value
)
=>
{
if
(
value
!==
1
)
{
if
(
value
!==
1
)
{
...
@@ -361,18 +361,14 @@ watch(
...
@@ -361,18 +361,14 @@ watch(
immediate
:
true
immediate
:
true
}
}
)
)
watch
(
()
=>
formData
.
value
,
(
val
)
=>
{
emits
(
'update:basicInfo'
,
val
)
}
)
onMounted
(
async
()
=>
{
onMounted
(
async
()
=>
{
try
{
try
{
const
resp
=
await
MenuApi
.
getSimpleMenusList
()
const
resp
=
await
MenuApi
.
getSimpleMenusList
()
menus
.
value
=
handleTree
(
resp
)
menus
.
value
=
handleTree
(
resp
)
}
catch
{}
}
catch
{}
})
})
defineExpose
({
defineExpose
({
validate
:
async
()
=>
unref
(
formRef
)?.
validate
()
validate
:
async
()
=>
unref
(
formRef
)?.
validate
()
})
})
...
...
src/views/system/dict/data.vue
View file @
98afdfc0
...
@@ -190,7 +190,7 @@ const handleExport = async () => {
...
@@ -190,7 +190,7 @@ const handleExport = async () => {
/** 查询字典(精简)列表 */
/** 查询字典(精简)列表 */
const
getDictList
=
async
()
=>
{
const
getDictList
=
async
()
=>
{
dicts
.
value
=
await
DictTypeApi
.
listSimpleDictType
()
dicts
.
value
=
await
DictTypeApi
.
getSimpleDictTypeList
()
}
}
/** 初始化 **/
/** 初始化 **/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment