Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
陆宇天
/
config-center-front
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
1
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit f651bf60
authored
Aug 31, 2023
by
匡雅琴
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
接口联调
1 parent
c484e271
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
115 additions
and
30 deletions
src/components/BackButton.vue
src/views/projectApi/AddApi.vue
src/views/publicConfig/AddConfig.vue
src/views/publicConfig/AddModel.vue
src/views/publicConfig/Public.vue
src/views/publicConfig/index.vue
src/components/BackButton.vue
View file @
f651bf6
...
@@ -25,9 +25,9 @@ import { Back } from "@element-plus/icons-vue";
...
@@ -25,9 +25,9 @@ import { Back } from "@element-plus/icons-vue";
</script> -->
</script> -->
<
style
lang=
"scss"
scoped
>
<
style
lang=
"scss"
scoped
>
.back-btn
{
.back-btn
{
//
position
:
fixed
;
position
:
fixed
;
//
top
:
80px
;
top
:
80px
;
//
left
:
100px
;
left
:
100px
;
}
}
.el-button
{
.el-button
{
border-radius
:
15px
;
border-radius
:
15px
;
...
...
src/views/projectApi/AddApi.vue
View file @
f651bf6
...
@@ -36,6 +36,20 @@
...
@@ -36,6 +36,20 @@
</div>
</div>
</div>
</div>
<div
class=
"option"
>
<div
class=
"option"
>
<div
class=
"name"
>
模板
</div>
<div
class=
"wrap"
>
<!-- <el-input v-model="remark" placeholder="请输入描述"> </el-input> -->
<el-select
v-model=
"selectModel"
class=
"m-2"
placeholder=
"Select"
>
<el-option
v-for=
"item in modelList"
:key=
"item.id"
:label=
"item.templateName"
:value=
"item.templateContent"
/>
</el-select>
</div>
</div>
<div
class=
"option"
>
<div
class=
"name"
>
描述
</div>
<div
class=
"name"
>
描述
</div>
<div
class=
"wrap"
>
<div
class=
"wrap"
>
<el-input
v-model=
"remark"
placeholder=
"请输入描述"
>
</el-input>
<el-input
v-model=
"remark"
placeholder=
"请输入描述"
>
</el-input>
...
@@ -54,10 +68,7 @@
...
@@ -54,10 +68,7 @@
@
click=
"saveCodeFn"
@
click=
"saveCodeFn"
>
保存代码
</el-button
>
保存代码
</el-button
>
>
<el-button
<el-button
type=
"warning"
v-preventReClick
@
click=
"$router.go(-1)"
type=
"warning"
v-preventReClick
@
click=
"$router.go(-1)"
>
返回列表
</el-button
>
返回列表
</el-button
>
>
<!-- <el-button type="danger" @click="clearCodeFn">清空代码</el-button> -->
<!-- <el-button type="danger" @click="clearCodeFn">清空代码</el-button> -->
...
@@ -68,13 +79,14 @@
...
@@ -68,13 +79,14 @@
</template>
</template>
<
script
lang=
"ts"
>
<
script
lang=
"ts"
>
import
{
defineComponent
,
ref
}
from
"vue"
;
import
{
defineComponent
,
onBeforeMount
,
reactive
,
ref
}
from
"vue"
;
import
AceEditor
from
"@/components/AceEditor.vue"
;
import
AceEditor
from
"@/components/AceEditor.vue"
;
import
{
ElMessage
,
ElMessageBox
}
from
"element-plus"
;
import
{
ElMessage
,
ElMessageBox
}
from
"element-plus"
;
import
"element-plus/theme-chalk/el-message.css"
;
import
"element-plus/theme-chalk/el-message.css"
;
import
"element-plus/theme-chalk/el-message-box.css"
;
import
"element-plus/theme-chalk/el-message-box.css"
;
import
{
onBeforeRouteLeave
,
useRoute
,
useRouter
}
from
"vue-router"
;
import
{
onBeforeRouteLeave
,
useRoute
,
useRouter
}
from
"vue-router"
;
import
{
projectApiAdd
,
projectApiEdit
}
from
"@/api/projectApi"
;
import
{
projectApiAdd
,
projectApiEdit
}
from
"@/api/projectApi"
;
import
{
getmodelList
}
from
"@/api/publicApi"
;
import
{
ProjectApi
}
from
"@/type"
;
import
{
ProjectApi
}
from
"@/type"
;
export
default
defineComponent
({
export
default
defineComponent
({
...
@@ -94,6 +106,21 @@ export default defineComponent({
...
@@ -94,6 +106,21 @@ export default defineComponent({
label
:
"get"
,
label
:
"get"
,
},
},
];
];
const
selectModel
=
ref
(
""
);
let
modelList
:
any
=
reactive
([]);
onBeforeMount
(()
=>
{
getModelList
();
});
// 获取模板数据
const
getModelList
=
async
()
=>
{
let
{
code
,
data
}
=
await
getmodelList
();
if
(
code
===
200
)
{
console
.
log
(
data
);
modelList
.
push
(...
data
);
}
};
//获取路由参数(新增的情况)
//获取路由参数(新增的情况)
let
routerQuery
=
route
.
query
;
let
routerQuery
=
route
.
query
;
let
queryKeysLength
=
Object
.
keys
(
routerQuery
).
length
;
let
queryKeysLength
=
Object
.
keys
(
routerQuery
).
length
;
...
@@ -243,6 +270,8 @@ export default defineComponent({
...
@@ -243,6 +270,8 @@ export default defineComponent({
saveCodeFn
,
saveCodeFn
,
clearCodeFn
,
clearCodeFn
,
disabled
,
disabled
,
selectModel
,
modelList
};
};
},
},
components
:
{
components
:
{
...
...
src/views/publicConfig/AddConfig.vue
View file @
f651bf6
...
@@ -10,7 +10,8 @@ import {
...
@@ -10,7 +10,8 @@ import {
import
type
{
FormInstance
,
FormRules
}
from
"element-plus"
;
import
type
{
FormInstance
,
FormRules
}
from
"element-plus"
;
import
{
ElMessage
,
ElMessageBox
}
from
"element-plus"
;
import
{
ElMessage
,
ElMessageBox
}
from
"element-plus"
;
import
{
configApiAdd
,
configApiEdit
,
configApiDelete
}
from
"@/api/publicApi"
;
import
{
configApiAdd
,
configApiEdit
,
configApiDelete
}
from
"@/api/publicApi"
;
import
{
Delete
}
from
"@element-plus/icons"
;
import
{
Delete
}
from
"@element-plus/icons-vue"
;
import
AceEditor
from
"@/components/AceEditor.vue"
;
const
ruleFormRef
=
ref
<
FormInstance
>
();
const
ruleFormRef
=
ref
<
FormInstance
>
();
...
@@ -37,7 +38,7 @@ let ruleForm = reactive({
...
@@ -37,7 +38,7 @@ let ruleForm = reactive({
remark
:
""
,
remark
:
""
,
});
});
const
isEdit
=
ref
<
boolean
>
(
false
)
const
isEdit
=
ref
<
boolean
>
(
false
)
;
watch
(
watch
(
()
=>
props
.
data
,
()
=>
props
.
data
,
...
@@ -46,13 +47,12 @@ watch(
...
@@ -46,13 +47,12 @@ watch(
// 获取编辑数据
// 获取编辑数据
let
keysLength
=
Object
.
keys
(
val
).
length
;
let
keysLength
=
Object
.
keys
(
val
).
length
;
isEdit
.
value
=
true
if
(
keysLength
>
0
)
{
console
.
log
(
3333333333
);
if
(
keysLength
>
0
)
{
isEdit
.
value
=
true
;
//编辑
//编辑
ruleForm
.
name
=
val
.
name
as
string
;
ruleForm
.
name
=
val
.
name
as
string
;
ruleForm
.
uniqueName
=
val
.
uniqueName
as
string
;
ruleForm
.
uniqueName
=
val
.
uniqueName
.
slice
(
1
)
as
string
;
ruleForm
.
remark
=
val
.
remark
as
string
;
ruleForm
.
remark
=
val
.
remark
as
string
;
ruleForm
.
content
=
val
.
content
as
string
;
ruleForm
.
content
=
val
.
content
as
string
;
}
}
...
@@ -95,9 +95,20 @@ const submitForm = async (formEl: FormInstance | undefined) => {
...
@@ -95,9 +95,20 @@ const submitForm = async (formEl: FormInstance | undefined) => {
let
message
;
let
message
;
let
statusCode
;
let
statusCode
;
// 新增
// 新增
let
{
code
}
=
await
configApiAdd
(
ruleForm
);
if
(
!
isEdit
.
value
)
{
statusCode
=
code
;
let
{
code
}
=
await
configApiAdd
(
ruleForm
);
message
=
code
===
200
?
"添加成功"
:
"添加失败,请稍后再试"
;
statusCode
=
code
;
message
=
code
===
200
?
"添加成功"
:
"添加失败,请稍后再试"
;
}
else
{
// 编辑
let
_params
=
{
...
ruleForm
,
id
:
props
.
data
.
id
,
};
let
{
code
}
=
await
configApiEdit
(
_params
);
statusCode
=
code
;
message
=
code
===
200
?
"编辑成功"
:
"编辑失败,请稍后再试"
;
}
if
(
statusCode
===
200
)
{
if
(
statusCode
===
200
)
{
ElMessage
({
ElMessage
({
type
:
"success"
,
type
:
"success"
,
...
@@ -129,9 +140,9 @@ const deletConfig = () => {
...
@@ -129,9 +140,9 @@ const deletConfig = () => {
let
{
code
}
=
await
configApiDelete
(
_params
);
let
{
code
}
=
await
configApiDelete
(
_params
);
if
(
code
===
200
)
{
if
(
code
===
200
)
{
ElMessage
({
ElMessage
({
type
:
'success'
,
type
:
"success"
,
message
:
'删除成功'
,
message
:
"删除成功"
,
})
})
;
emit
(
"configRefresh"
);
emit
(
"configRefresh"
);
}
}
})
})
...
@@ -151,7 +162,13 @@ const deletConfig = () => {
...
@@ -151,7 +162,13 @@ const deletConfig = () => {
<div
class=
"add-config"
>
<div
class=
"add-config"
>
<div
class=
"add-top"
>
<div
class=
"add-top"
>
<h3>
项目环境配置添加
</h3>
<h3>
项目环境配置添加
</h3>
<el-button
v-if=
"isEdit"
@
click=
"deletConfig"
type=
"danger"
:icon=
"Delete"
circle
/>
<el-button
v-if=
"isEdit"
@
click=
"deletConfig"
type=
"danger"
:icon=
"Delete"
circle
/>
</div>
</div>
<el-form
<el-form
ref=
"ruleFormRef"
ref=
"ruleFormRef"
...
@@ -169,7 +186,12 @@ const deletConfig = () => {
...
@@ -169,7 +186,12 @@ const deletConfig = () => {
</el-input>
</el-input>
</el-form-item>
</el-form-item>
<el-form-item
label=
"公共配置项内容"
prop=
"content"
>
<el-form-item
label=
"公共配置项内容"
prop=
"content"
>
<el-input
v-model=
"ruleForm.content"
type=
"textarea"
/>
<!-- <el-input v-model="ruleForm.content" type="textarea" /> -->
<AceEditor
class=
"ace_editor"
ref=
"editorDom"
v-model:content=
"ruleForm.content"
/>
</el-form-item>
</el-form-item>
<el-form-item
label=
"描述"
prop=
"remark"
>
<el-form-item
label=
"描述"
prop=
"remark"
>
<el-input
v-model=
"ruleForm.remark"
type=
"textarea"
/>
<el-input
v-model=
"ruleForm.remark"
type=
"textarea"
/>
...
@@ -207,5 +229,9 @@ const deletConfig = () => {
...
@@ -207,5 +229,9 @@ const deletConfig = () => {
width
:
800px
;
width
:
800px
;
padding
:
30px
104px
0
104px
;
padding
:
30px
104px
0
104px
;
}
}
.ace_editor
{
height
:
300px
;
width
:
700px
;
}
}
}
</
style
>
</
style
>
src/views/publicConfig/AddModel.vue
View file @
f651bf6
...
@@ -6,11 +6,13 @@ import {
...
@@ -6,11 +6,13 @@ import {
defineProps
,
defineProps
,
withDefaults
,
withDefaults
,
watch
,
watch
,
onUnmounted
}
from
"vue"
;
}
from
"vue"
;
import
type
{
FormInstance
,
FormRules
,
Action
}
from
"element-plus"
;
import
type
{
FormInstance
,
FormRules
,
Action
}
from
"element-plus"
;
import
{
ElMessage
,
ElMessageBox
}
from
"element-plus"
;
import
{
ElMessage
,
ElMessageBox
}
from
"element-plus"
;
import
{
modelApiAdd
,
modelApiEdit
,
modelApiDelete
}
from
"@/api/publicApi"
;
import
{
modelApiAdd
,
modelApiEdit
,
modelApiDelete
}
from
"@/api/publicApi"
;
import
{
Delete
}
from
"@element-plus/icons"
;
import
{
Delete
}
from
"@element-plus/icons"
;
import
AceEditor
from
"@/components/AceEditor.vue"
;
const
ruleFormRef
=
ref
<
FormInstance
>
();
const
ruleFormRef
=
ref
<
FormInstance
>
();
...
@@ -44,10 +46,8 @@ watch(
...
@@ -44,10 +46,8 @@ watch(
// 获取编辑数据
// 获取编辑数据
let
keysLength
=
Object
.
keys
(
val
).
length
;
let
keysLength
=
Object
.
keys
(
val
).
length
;
isEdit
.
value
=
true
;
if
(
keysLength
>
0
)
{
if
(
keysLength
>
0
)
{
console
.
log
(
666
);
isEdit
.
value
=
true
;
//编辑
//编辑
ruleForm
.
templateName
=
val
.
templateName
as
string
;
ruleForm
.
templateName
=
val
.
templateName
as
string
;
ruleForm
.
templateContent
=
val
.
templateContent
as
string
;
ruleForm
.
templateContent
=
val
.
templateContent
as
string
;
...
@@ -84,9 +84,11 @@ const resetForm = (formEl: FormInstance | undefined) => {
...
@@ -84,9 +84,11 @@ const resetForm = (formEl: FormInstance | undefined) => {
const
emit
=
defineEmits
([
"modelRefresh"
]);
const
emit
=
defineEmits
([
"modelRefresh"
]);
const
editorDom
=
ref
();
// 提交表单
// 提交表单
const
submitForm
=
async
(
formEl
:
FormInstance
|
undefined
)
=>
{
const
submitForm
=
async
(
formEl
:
FormInstance
|
undefined
)
=>
{
if
(
!
formEl
)
return
;
if
(
!
formEl
)
return
;
await
formEl
.
validate
(
async
(
valid
)
=>
{
await
formEl
.
validate
(
async
(
valid
)
=>
{
if
(
valid
)
{
if
(
valid
)
{
// console.log("submit!");
// console.log("submit!");
...
@@ -155,6 +157,10 @@ const deletModel = () => {
...
@@ -155,6 +157,10 @@ const deletModel = () => {
// })
// })
});
});
};
};
onUnmounted
(()
=>
{
isEdit
.
value
=
false
})
</
script
>
</
script
>
<
template
>
<
template
>
...
@@ -180,7 +186,12 @@ const deletModel = () => {
...
@@ -180,7 +186,12 @@ const deletModel = () => {
<el-input
v-model=
"ruleForm.templateName"
/>
<el-input
v-model=
"ruleForm.templateName"
/>
</el-form-item>
</el-form-item>
<el-form-item
label=
"模板内容"
prop=
"templateContent"
>
<el-form-item
label=
"模板内容"
prop=
"templateContent"
>
<el-input
v-model=
"ruleForm.templateContent"
type=
"textarea"
/>
<!--
<el-input
v-model=
"ruleForm.templateContent"
type=
"textarea"
/>
-->
<AceEditor
class=
"ace_editor"
ref=
"editorDom"
v-model:content=
"ruleForm.templateContent"
/>
</el-form-item>
</el-form-item>
<el-form-item
label=
"描述"
prop=
"remark"
>
<el-form-item
label=
"描述"
prop=
"remark"
>
<el-input
v-model=
"ruleForm.remark"
type=
"textarea"
/>
<el-input
v-model=
"ruleForm.remark"
type=
"textarea"
/>
...
@@ -215,5 +226,9 @@ const deletModel = () => {
...
@@ -215,5 +226,9 @@ const deletModel = () => {
width
:
800px
;
width
:
800px
;
padding
:
30px
104px
0
104px
;
padding
:
30px
104px
0
104px
;
}
}
.ace_editor
{
height
:
300px
;
width
:
700px
;
}
}
}
</
style
>
</
style
>
src/views/publicConfig/Public.vue
0 → 100644
View file @
f651bf6
<
script
setup
lang=
"ts"
>
import
{
ref
}
from
"vue"
</
script
>
<
template
>
<div>
公共配置
</div>
</
template
>
<
style
lang=
"scss"
scoped
></
style
>
src/views/publicConfig/index.vue
View file @
f651bf6
...
@@ -5,6 +5,7 @@ import ModelAdd from "./AddModel.vue";
...
@@ -5,6 +5,7 @@ import ModelAdd from "./AddModel.vue";
import
OperationRecord
from
"./OperationRecord.vue"
;
import
OperationRecord
from
"./OperationRecord.vue"
;
import
{
CirclePlus
,
ArrowDown
}
from
"@element-plus/icons"
;
import
{
CirclePlus
,
ArrowDown
}
from
"@element-plus/icons"
;
import
{
getmodelList
,
getconfigList
}
from
"@/api/publicApi"
;
import
{
getmodelList
,
getconfigList
}
from
"@/api/publicApi"
;
import
Public
from
'./Public.vue'
;
type
tabType
=
{
type
tabType
=
{
label
:
string
;
label
:
string
;
...
@@ -32,15 +33,20 @@ const tabData = reactive<tabType[]>([
...
@@ -32,15 +33,20 @@ const tabData = reactive<tabType[]>([
// label: "操作记录",
// label: "操作记录",
// tabComp: markRaw(OperationRecord),
// tabComp: markRaw(OperationRecord),
// },
// },
{
label
:
"空白页"
,
tabComp
:
markRaw
(
Public
),
}
]);
]);
// 最初展示menu
// 最初展示menu
let
currentTab
=
reactive
<
Comp
>
({
let
currentTab
=
reactive
<
Comp
>
({
tabComp
:
tabData
[
0
].
tabComp
,
tabComp
:
tabData
[
tabData
.
length
-
1
].
tabComp
,
});
});
// 添加公共模板
// 添加公共模板
const
addConfig
=
(
index
:
number
)
=>
{
const
addConfig
=
(
index
:
number
)
=>
{
propsData
=
{}
console
.
log
(
index
);
console
.
log
(
index
);
currentTab
.
tabComp
=
tabData
[
index
].
tabComp
;
currentTab
.
tabComp
=
tabData
[
index
].
tabComp
;
};
};
...
@@ -76,13 +82,13 @@ const getConfigData = async () => {
...
@@ -76,13 +82,13 @@ const getConfigData = async () => {
// 模板更新
// 模板更新
const
modelRefresh
=
()
=>
{
const
modelRefresh
=
()
=>
{
getModelData
()
getModelData
()
currentTab
.
tabComp
=
tabData
[
0
].
tabComp
;
currentTab
.
tabComp
=
tabData
[
tabData
.
length
-
1
].
tabComp
;
}
}
// 配置项更新
// 配置项更新
const
configRefresh
=
()
=>
{
const
configRefresh
=
()
=>
{
getConfigData
()
getConfigData
()
currentTab
.
tabComp
=
tabData
[
0
].
tabComp
;
currentTab
.
tabComp
=
tabData
[
tabData
.
length
-
1
].
tabComp
;
}
}
let
propsData
=
reactive
({})
let
propsData
=
reactive
({})
...
@@ -109,7 +115,7 @@ const clickSubItem = (index: number, item: any) => {
...
@@ -109,7 +115,7 @@ const clickSubItem = (index: number, item: any) => {
<el-tab-pane
label=
"操作记录"
></el-tab-pane>
<el-tab-pane
label=
"操作记录"
></el-tab-pane>
</el-tabs>
-->
</el-tabs>
-->
<div
v-for=
"(item, index) in tabData"
:key=
"index"
>
<div
v-for=
"(item, index) in tabData"
:key=
"index"
>
<div
class=
"menu-item"
>
<div
class=
"menu-item"
v-if=
"index !== tabData.length-1"
>
<div>
<div>
<el-icon><ArrowDown
/></el-icon>
<el-icon><ArrowDown
/></el-icon>
{{
item
.
label
}}
{{
item
.
label
}}
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment