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 5710d5b4
authored
Nov 07, 2023
by
胡悦
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
提交优化
1 parent
c7125f7d
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
83 additions
and
27 deletions
src/main.ts
src/shims-vue.d.ts
src/type/index.ts
src/views/condition/ConditionEditor.vue
src/views/project/AddProject.vue
src/views/project/Project.vue
src/views/projectApi/AddApi.vue
src/views/projectApi/ApiList.vue
src/main.ts
View file @
5710d5b
...
@@ -7,6 +7,7 @@ import "element-plus/theme-chalk/el-loading.css";
...
@@ -7,6 +7,7 @@ import "element-plus/theme-chalk/el-loading.css";
import
"element-plus/theme-chalk/el-message.css"
;
import
"element-plus/theme-chalk/el-message.css"
;
import
"element-plus/theme-chalk/el-notification.css"
;
import
"element-plus/theme-chalk/el-notification.css"
;
import
"element-plus/theme-chalk/el-message-box.css"
;
import
"element-plus/theme-chalk/el-message-box.css"
;
import
"element-plus/theme-chalk/el-form.css"
;
const
app
=
createApp
(
App
);
const
app
=
createApp
(
App
);
// 防止重复快速点击自定义全局指令
// 防止重复快速点击自定义全局指令
app
.
directive
(
"preventReClick"
,
{
app
.
directive
(
"preventReClick"
,
{
...
...
src/shims-vue.d.ts
View file @
5710d5b
/*
* @Description:
* @Author: huyue
* @Date: 2023-08-31 11:35:41
* @LastEditors: huyue
* @LastEditTime: 2023-11-01 14:06:23
*/
/* eslint-disable */
/* eslint-disable */
declare
module
'*.vue'
{
declare
module
'*.vue'
{
import
type
{
DefineComponent
}
from
'vue'
import
type
{
DefineComponent
}
from
'vue'
const
component
:
DefineComponent
<
{},
{},
any
>
const
component
:
DefineComponent
<
{},
{},
any
>
export
default
component
export
default
component
}
}
declare
module
'*.js'
declare
module
'js-beautify'
{
declare
module
'js-beautify'
{
// beautify_js:any
// beautify_js:any
const
beautify_js
:(
a
:
any
)
=>
any
const
beautify_js
:(
a
:
any
)
=>
any
...
...
src/type/index.ts
View file @
5710d5b
...
@@ -4,7 +4,7 @@ import { ProjectApi } from './index';
...
@@ -4,7 +4,7 @@ import { ProjectApi } from './index';
* @Author: huyue
* @Author: huyue
* @Date: 2023-01-16 17:23:14
* @Date: 2023-01-16 17:23:14
* @LastEditors: huyue
* @LastEditors: huyue
* @LastEditTime: 2023-
07-24 14:21:35
* @LastEditTime: 2023-
11-01 15:08:46
*/
*/
/**
/**
* 存放公共的类型声明文件
* 存放公共的类型声明文件
...
@@ -30,7 +30,7 @@ export interface ProjectItem {
...
@@ -30,7 +30,7 @@ export interface ProjectItem {
//项目分类里api
//项目分类里api
export
interface
ProjectApi
{
export
interface
ProjectApi
{
id
?:
number
;
id
?:
number
;
projectId
:
number
;
projectId
?
:
number
;
method
:
string
;
method
:
string
;
url
:
string
;
url
:
string
;
baseUrl
?:
string
;
baseUrl
?:
string
;
...
@@ -38,6 +38,8 @@ export interface ProjectApi {
...
@@ -38,6 +38,8 @@ export interface ProjectApi {
content
:
string
;
content
:
string
;
createDate
?:
Date
;
createDate
?:
Date
;
updateDate
?:
Date
;
updateDate
?:
Date
;
username
?:
string
;
businessType
:
number
|
string
;
}
}
//项目条件判断
//项目条件判断
...
@@ -66,6 +68,7 @@ export interface ProjectApiSearch {
...
@@ -66,6 +68,7 @@ export interface ProjectApiSearch {
size
:
number
;
size
:
number
;
projectId
:
any
;
projectId
:
any
;
url
?:
string
;
url
?:
string
;
businessType
?:
string
;
}
}
export
interface
CopyProject
{
export
interface
CopyProject
{
...
@@ -110,3 +113,16 @@ export interface ModelDelete {
...
@@ -110,3 +113,16 @@ export interface ModelDelete {
export
interface
IsUnique
{
export
interface
IsUnique
{
uniqueName
:
string
uniqueName
:
string
}
}
export
interface
DialogData
{
dialogFormVisible
:
boolean
,
form
?:
Partial
<
formData
>
,
environmentList
:
EnvList
[]
}
export
interface
formData
{
id
?:
number
,
addr
?:
string
}
export
interface
EnvList
{
id
:
number
;
addr
:
string
;
}
\ No newline at end of file
\ No newline at end of file
src/views/condition/ConditionEditor.vue
View file @
5710d5b
...
@@ -70,7 +70,7 @@
...
@@ -70,7 +70,7 @@
</
template
>
</
template
>
<
script
lang=
"ts"
>
<
script
lang=
"ts"
>
import
{
defineComponent
,
ref
}
from
"vue"
;
import
{
defineComponent
,
nextTick
,
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"
;
...
@@ -198,7 +198,7 @@ export default defineComponent({
...
@@ -198,7 +198,7 @@ export default defineComponent({
};
};
//添加到编辑器内容区
//添加到编辑器内容区
const
addToEditor
=
()
=>
{
const
addToEditor
=
async
()
=>
{
if
(
!
editorIp
.
value
||
!
editorEnv
.
value
)
{
if
(
!
editorIp
.
value
||
!
editorEnv
.
value
)
{
ElMessage
({
ElMessage
({
type
:
"error"
,
type
:
"error"
,
...
@@ -212,6 +212,8 @@ export default defineComponent({
...
@@ -212,6 +212,8 @@ export default defineComponent({
[
editorIp
.
value
]:
editorEnv
.
value
,
[
editorIp
.
value
]:
editorEnv
.
value
,
});
});
editorDom
.
value
.
setEditorContent
();
editorDom
.
value
.
setEditorContent
();
await
nextTick
()
beautifulCodeFn
()
};
};
onBeforeRouteLeave
(()
=>
{
onBeforeRouteLeave
(()
=>
{
sessionStorage
.
removeItem
(
"conditionItem"
);
sessionStorage
.
removeItem
(
"conditionItem"
);
...
...
src/views/project/AddProject.vue
View file @
5710d5b
...
@@ -116,13 +116,14 @@ export default defineComponent({
...
@@ -116,13 +116,14 @@ export default defineComponent({
id
:
parseInt
(
routerParams
.
id
as
string
),
id
:
parseInt
(
routerParams
.
id
as
string
),
};
};
let
{
code
}
=
await
projectEdit
(
params
);
let
{
code
}
=
await
projectEdit
(
params
);
statusCode
=
code
;
statusCode
=
code
as
unknown
as
string
|
number
;
message
=
code
===
200
?
"编辑成功"
:
"编辑失败,请稍后再试"
;
message
=
code
===
200
?
"编辑成功"
:
statusCode
==
'-1'
?
'存在相同的项目名称'
:
"编辑失败,请稍后再试"
;
}
else
{
}
else
{
//新增
//新增
let
{
code
}
=
await
projectAdd
(
ruleForm
);
// let { code } = await projectAdd(ruleForm);
statusCode
=
code
;
let
result
=
await
projectAdd
(
ruleForm
)
message
=
code
===
200
?
"添加成功"
:
"添加失败,请稍后再试"
;
statusCode
=
result
.
code
as
unknown
as
string
;
message
=
result
.
code
===
200
?
"添加成功"
:
statusCode
==
'-1'
?
'存在相同的项目名称'
:
"添加失败,请稍后再试"
;
}
}
if
(
statusCode
===
200
)
{
if
(
statusCode
===
200
)
{
ElMessage
({
ElMessage
({
...
...
src/views/project/Project.vue
View file @
5710d5b
...
@@ -104,7 +104,7 @@ import { ElMessage, ElMessageBox } from "element-plus";
...
@@ -104,7 +104,7 @@ 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
{
getProjectList
,
projectDel
}
from
"@/api/project"
;
import
{
getProjectList
,
projectDel
}
from
"@/api/project"
;
import
{
getConfig
}
from
"@/api/config
"
;
import
{
projectApiAdd
}
from
"@/api/projectApi
"
;
import
{
getConditionList
}
from
"@/api/condition"
;
import
{
getConditionList
}
from
"@/api/condition"
;
import
{
ProjectItem
,
ConditionItem
}
from
"@/type/index"
;
import
{
ProjectItem
,
ConditionItem
}
from
"@/type/index"
;
...
...
src/views/projectApi/AddApi.vue
View file @
5710d5b
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
/>
/>
</div>
</div>
<div
class=
"rt-content"
>
<div
class=
"rt-content"
>
<h3
class=
"info"
>
接口信息
</h3>
<h3
class=
"info"
>
{{
routerParams
.
baseUrl
}}
环境
接口信息
</h3>
<div
class=
"option"
>
<div
class=
"option"
>
<div
class=
"name"
>
method:get
</div>
<div
class=
"name"
>
method:get
</div>
<!--
<div
class=
"wrap"
>
<!--
<div
class=
"wrap"
>
...
@@ -36,7 +36,21 @@
...
@@ -36,7 +36,21 @@
</div>
</div>
</div>
</div>
<div
class=
"option"
>
<div
class=
"option"
>
<div
class=
"name"
>
模板
</div>
<div
class=
"name required"
>
业务类型
</div>
<div
class=
"wrap"
>
<!-- <el-input v-model="remark" placeholder="请输入描述"> </el-input> -->
<el-select
v-model=
"businessType"
class=
"m-2"
placeholder=
"Select"
>
<el-option
v-for=
"item in businessTypeList"
:key=
"item.value"
:label=
"item.name"
:value=
"item.value"
/>
</el-select>
</div>
</div>
<div
class=
"option"
>
<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> -->
<el-select
v-model=
"selectModel"
@
change=
"selectModelChange"
class=
"m-2"
placeholder=
"Select"
>
<el-select
v-model=
"selectModel"
@
change=
"selectModelChange"
class=
"m-2"
placeholder=
"Select"
>
...
@@ -121,6 +135,25 @@ export default defineComponent({
...
@@ -121,6 +135,25 @@ export default defineComponent({
modelList
.
push
(...
data
);
modelList
.
push
(...
data
);
}
}
};
};
/** 业务类型 */
const
businessType
=
ref
(
""
)
const
businessTypeList
=
reactive
([{
name
:
'SCRM'
,
value
:
1
},{
name
:
'SAAS+'
,
value
:
2
},{
name
:
'小程序'
,
value
:
3
},{
name
:
'其他'
,
value
:
0
}])
/** */
//获取路由参数(新增的情况)
//获取路由参数(新增的情况)
let
routerQuery
=
route
.
query
;
let
routerQuery
=
route
.
query
;
let
queryKeysLength
=
Object
.
keys
(
routerQuery
).
length
;
let
queryKeysLength
=
Object
.
keys
(
routerQuery
).
length
;
...
@@ -129,7 +162,7 @@ export default defineComponent({
...
@@ -129,7 +162,7 @@ export default defineComponent({
let
storageEditItem
=
let
storageEditItem
=
window
.
sessionStorage
.
getItem
(
"editApiItem"
)
&&
window
.
sessionStorage
.
getItem
(
"editApiItem"
)
&&
JSON
.
parse
(
window
.
sessionStorage
.
getItem
(
"editApiItem"
)
||
""
);
JSON
.
parse
(
window
.
sessionStorage
.
getItem
(
"editApiItem"
)
||
""
);
let
routerParams
=
storageEditItem
||
{};
let
routerParams
=
reactive
(
storageEditItem
||
{})
let
keysLength
=
Object
.
keys
(
routerParams
).
length
;
let
keysLength
=
Object
.
keys
(
routerParams
).
length
;
if
(
keysLength
>
0
)
{
if
(
keysLength
>
0
)
{
//编辑
//编辑
...
@@ -137,17 +170,11 @@ export default defineComponent({
...
@@ -137,17 +170,11 @@ export default defineComponent({
remark
.
value
=
routerParams
.
remark
as
string
;
remark
.
value
=
routerParams
.
remark
as
string
;
url
.
value
=
routerParams
.
url
as
string
;
url
.
value
=
routerParams
.
url
as
string
;
method
.
value
=
routerParams
.
method
as
string
;
method
.
value
=
routerParams
.
method
as
string
;
businessType
.
value
=
routerParams
.
businessType
as
string
;
}
}
const
userInfo
=
const
userInfo
=
window
.
sessionStorage
.
getItem
(
"userInfo"
)
&&
window
.
sessionStorage
.
getItem
(
"userInfo"
)
&&
JSON
.
parse
(
window
.
sessionStorage
.
getItem
(
"userInfo"
)
||
""
);
JSON
.
parse
(
window
.
sessionStorage
.
getItem
(
"userInfo"
)
||
""
);
// 是否管理员
// const isAdmin = userInfo && userInfo.roleId === 1 ? true : false;
// const disabled = ref(
// storageEditItem && storageEditItem.projectId === 1 && !isAdmin
// ? true
// : false
// );
const
disabled
=
userInfo
.
auth
==
"readonly"
?
true
:
false
;
const
disabled
=
userInfo
.
auth
==
"readonly"
?
true
:
false
;
// 格式化代码
// 格式化代码
const
beautifulCodeFn
=
()
=>
{
const
beautifulCodeFn
=
()
=>
{
...
@@ -155,9 +182,9 @@ export default defineComponent({
...
@@ -155,9 +182,9 @@ export default defineComponent({
};
};
//保存代码
//保存代码
const
saveCodeFn
=
async
()
=>
{
const
saveCodeFn
=
async
()
=>
{
if
(
!
url
.
value
||
!
remark
.
value
||
!
editorContent
.
value
)
{
if
(
!
url
.
value
||
!
remark
.
value
||
!
businessType
.
value
&&
businessType
.
value
!=
'0'
||
!
editorContent
.
value
)
{
return
ElMessage
({
return
ElMessage
({
message
:
"请把信息补充完整
url,content,描述
"
,
message
:
"请把信息补充完整"
,
type
:
"error"
,
type
:
"error"
,
});
});
}
}
...
@@ -177,6 +204,7 @@ export default defineComponent({
...
@@ -177,6 +204,7 @@ export default defineComponent({
remark
:
remark
.
value
,
remark
:
remark
.
value
,
content
:
editorContent
.
value
,
content
:
editorContent
.
value
,
username
:
userInfo
.
name
,
username
:
userInfo
.
name
,
businessType
:
businessType
.
value
};
};
let
{
code
}
=
await
projectApiAdd
(
params
);
let
{
code
}
=
await
projectApiAdd
(
params
);
if
(
code
===
200
)
{
if
(
code
===
200
)
{
...
@@ -204,6 +232,7 @@ export default defineComponent({
...
@@ -204,6 +232,7 @@ export default defineComponent({
url
:
url
.
value
,
url
:
url
.
value
,
remark
:
remark
.
value
,
remark
:
remark
.
value
,
username
:
userInfo
.
name
,
username
:
userInfo
.
name
,
businessType
:
businessType
.
value
}
as
ProjectApi
;
}
as
ProjectApi
;
let
{
code
}
=
await
projectApiEdit
(
params
);
let
{
code
}
=
await
projectApiEdit
(
params
);
if
(
code
===
200
)
{
if
(
code
===
200
)
{
...
@@ -261,10 +290,6 @@ export default defineComponent({
...
@@ -261,10 +290,6 @@ export default defineComponent({
onBeforeRouteLeave
(()
=>
{
onBeforeRouteLeave
(()
=>
{
sessionStorage
.
removeItem
(
"editApiItem"
);
sessionStorage
.
removeItem
(
"editApiItem"
);
});
});
// watch(editorContent, (newVal, prevCount) => {
// console.log("newVal: ", newVal);
// // console.log("prevCount: ", prevCount);
// });
return
{
return
{
methodsOptions
,
methodsOptions
,
method
,
method
,
...
@@ -278,7 +303,10 @@ export default defineComponent({
...
@@ -278,7 +303,10 @@ export default defineComponent({
disabled
,
disabled
,
selectModel
,
selectModel
,
modelList
,
modelList
,
selectModelChange
selectModelChange
,
businessType
,
businessTypeList
,
routerParams
};
};
},
},
components
:
{
components
:
{
...
...
src/views/projectApi/ApiList.vue
View file @
5710d5b
This diff is collapsed.
Click to expand it.
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