Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
bigDataSystem
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张伯涛
bigDataSystem
Commits
244dd030
Commit
244dd030
authored
Nov 22, 2024
by
liwei
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
53964ae5
c01f4a4d
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
624 additions
and
88 deletions
+624
-88
callerManage.data.ts
...Config/businessGrouping/groupDetails/callerManage.data.ts
+162
-0
index.vue
...age/gatewayConfig/businessGrouping/groupDetails/index.vue
+209
-6
mobileModal.vue
...tewayConfig/businessGrouping/groupDetails/mobileModal.vue
+59
-0
mock.ts
...anage/gatewayConfig/businessGrouping/groupDetails/mock.ts
+72
-0
index.vue
...ce/serviceManage/gatewayConfig/businessGrouping/index.vue
+6
-1
MenuDrawer.vue
src/views/system/menu/MenuDrawer.vue
+51
-37
index.vue
src/views/system/menu/index.vue
+44
-38
menu.data.ts
src/views/system/menu/menu.data.ts
+21
-6
No files found.
src/views/dataService/serviceManage/gatewayConfig/businessGrouping/groupDetails/callerManage.data.ts
0 → 100644
View file @
244dd030
import
{
getAllRoleList
}
from
'@/api/system/role/role'
;
import
{
BasicColumn
,
FormSchema
}
from
'@/components/Table'
;
import
{
h
}
from
'vue'
;
import
{
Switch
}
from
'ant-design-vue'
;
import
{
useMessage
}
from
'@/hooks/web/useMessage'
;
import
{
changeFlagApi
}
from
'@/api/system/user/user'
;
// 引入开关组件
type
CheckedType
=
boolean
|
string
|
number
;
/** 列表筛选项*/
export
const
searchFormSchema
:
FormSchema
[]
=
[
{
field
:
'name'
,
label
:
''
,
component
:
'Input'
,
colProps
:
{
span
:
4
},
componentProps
:
{
placeholder
:
'输入关键字搜索'
,
},
},
];
export
const
detailSchemas
:
FormSchema
[]
=
[
{
field
:
'name'
,
label
:
''
,
component
:
'Input'
,
colProps
:
{
span
:
4
},
componentProps
:
{
placeholder
:
'输入关键字搜索'
,
},
},
];
/** api列表展示字段*/
export
const
detailsColumns
:
BasicColumn
[]
=
[
{
title
:
'API名称'
,
dataIndex
:
'name'
,
width
:
120
,
},
{
title
:
'路径'
,
dataIndex
:
'path'
,
width
:
120
,
},
{
title
:
'状态'
,
dataIndex
:
'flag'
,
width
:
120
,
},
{
title
:
'创建时间'
,
dataIndex
:
'createTime'
,
width
:
120
,
},
{
title
:
'更新时间'
,
dataIndex
:
'upDateTime'
,
width
:
120
,
},
{
title
:
'拥有者'
,
dataIndex
:
'Owner'
,
width
:
120
,
},
]
/** executor列表展示字段*/
export
const
detailsColumns2
:
BasicColumn
[]
=
[
{
title
:
'IP地址'
,
dataIndex
:
'IP'
,
width
:
120
,
},
{
title
:
'路径'
,
dataIndex
:
'path'
,
width
:
120
,
},
]
/** 列表展示字段*/
export
const
columns
:
BasicColumn
[]
=
[
{
title
:
'业务分组名称'
,
dataIndex
:
'name'
,
width
:
120
,
slots
:
{
customRender
:
'name'
},
},
{
title
:
'关联API路由数'
,
dataIndex
:
'apiRoutNum'
,
width
:
120
,
},
{
title
:
'关联executor数'
,
dataIndex
:
'executorNum'
,
width
:
120
,
},
];
/**详情基本信息-展示字段*/
export
const
refundSchema
:
DescItem
[]
=
[
{
field
:
'groupingName'
,
label
:
'业务分组名称'
,
},
{
field
:
'description'
,
label
:
'描述'
,
},
{
field
:
'bind'
,
label
:
'绑定运行环境'
,
},
];
export
const
refundData
=
{
groupingName
:
'默认业务分组'
,
description
:
'-'
,
bind
:
'否'
,
};
/**新建文件夹 表单*/
export
const
createDocumentFormSchema
:
FormSchema
[]
=
[
{
field
:
'moveTo'
,
label
:
'移动至'
,
component
:
'Select'
,
defaultValue
:
'默认分组'
,
colProps
:
{
lg
:
24
,
md
:
24
},
rules
:
[
{
required
:
true
,
message
:
'请选择移动目标文件夹'
,
},
],
componentProps
:
{
options
:
[
{
label
:
'默认分组'
,
value
:
'默认分组'
,
},
{
label
:
'test1'
,
value
:
'test1'
,
},
{
label
:
'test2'
,
value
:
'test2'
,
},
],
},
},
];
// const [registerTable] = useTable({
// title: '可编辑单元格示例',
// api: demoListApi,
// columns: columns,
// showIndexColumn: false,
// bordered: true,
// });
src/views/dataService/serviceManage/gatewayConfig/businessGrouping/groupDetails/index.vue
View file @
244dd030
<
template
>
<
template
>
<page-wrapper>
<PageWrapper
>
分组详情
<div
class=
"callerManage_details"
>
</page-wrapper>
<div
class=
"header"
>
</
template
>
<Icon
@
click=
"handleGoBack"
class=
"backBtn"
icon=
"ant-design:left-outlined"
:size=
"20"
:color=
"'#666C81'"
/>
<Icon
icon=
"ant-design:partition-outlined"
:size=
"20"
:color=
"'#AFBAFE'"
/>
<div
class=
"header_info"
>
<div>
默认业务分组
</div>
<div>
业务分组
</div>
</div>
</div>
<step-header
title=
"基本信息"
/>
<!--
<BasicForm
@
register=
"registerForm"
>
-->
<!--
<template
#
tokenTime=
"
{ field, model }">-->
<!--
<InputNumber
style=
"width: 55px"
v-if=
"tokenTimeEidt"
v-model:value=
"model[field]"
></InputNumber>
-->
<!--
<span
v-else
>
{{
model
[
field
]
}}
天
</span>
-->
<!--
<EditOutlined
@
click=
"handleTokenTimeEdit"
/>
-->
<!--
</
template
>
-->
<!-- <template #userKey="{ field, model }">-->
<!-- <Input style="width: 300px" v-if="userKeyEidt" v-model:value="model[field]"></Input>-->
<!-- <span v-else> {{ model[field] }} </span> -->
<!-- <EditOutlined @click="handleUserKeyEdit" />-->
<!-- </template>-->
<!-- </BasicForm>-->
<Description
size=
"middle"
:bordered=
"false"
:column=
"2"
:data=
"refundData"
:schema=
"refundSchema"
/>
<step-header
title=
"关联API"
/>
<BasicTable
@
register=
"registerTable"
:rowSelection=
"rowSelection"
>
<
template
#
bodyCell=
"{ column, record }"
>
<template
v-if=
"column.key === 'action'"
>
<TableAction
:actions=
"[
{
label: '移动',
onClick: mobile.bind(null, record),
},
]"
/>
</
template
>
</template>
<
template
#
toolbar
>
<a-button
type=
"primary"
:disabled=
"getRowSelectionApi().selectedRowKeys
<
=
0
"
@
click=
"mobile"
>
移动
</a-button>
</
template
>
</BasicTable>
<step-header
title=
"关联executor"
/>
<BasicTable
@
register=
"registerTable2"
:rowSelection=
"rowSelection"
>
<
template
#
bodyCell=
"{ column, record }"
>
<template
v-if=
"column.key === 'action'"
>
<TableAction
:actions=
"[
{
// label: '删除',
icon: 'ant-design:delete-outlined',
color: 'error',
<
script
setup
lang=
"ts"
>
popConfirm: {
title: '是否确认删除',
placement: 'left',
confirm: handleDelete.bind(null, record),
},
}
]"
/>
</
template
>
</template>
<
template
#
toolbar
>
<a-button
type=
"primary"
:disabled=
"getRowSelectionExecutor().selectedRowKeys
<
=
0
"
@
click=
"handleDelete"
>
删除
</a-button>
<a-button
type=
"primary"
@
click=
"handleAdd"
>
添加
</a-button>
</
template
>
</BasicTable>
</div>
<mobileModal
@
register=
"registerMobileModal"
/>
</PageWrapper>
</template>
<
script
lang=
"ts"
setup
>
import
{
InputNumber
,
Input
}
from
'ant-design-vue'
;
import
Icon
from
'@/components/Icon/Icon.vue'
;
import
{
useModal
}
from
'@/components/Modal'
;
import
mobileModal
from
"./mobileModal.vue"
import
{
EditOutlined
}
from
'@ant-design/icons-vue'
;
import
{
router
}
from
"@/router"
;
import
{
Description
}
from
'@/components/Description'
;
import
{
BasicForm
,
useForm
}
from
'@/components/Form'
;
import
{
detailsColumns
,
refundSchema
,
detailSchemas
,
refundData
,
detailsColumns2
}
from
"./callerManage.data"
;
import
StepHeader
from
"@/components/stepHeader.vue"
;
import
{
tableListDetails
,
tableListDetails2
}
from
"./mock"
;
import
{
BasicTable
,
useTable
,
TableAction
}
from
'@/components/Table'
;
import
{
ref
}
from
"vue"
;
import
PageWrapper
from
"@/components/Page/src/PageWrapper.vue"
;
import
PageWrapper
from
"@/components/Page/src/PageWrapper.vue"
;
</
script
>
// const [registerForm, { setFieldsValue, updateSchema, resetFields, validate }] = useForm({
// labelWidth: 100,
// baseColProps: { lg: 12, md: 24 },
// schemas: formSchema,
// showActionButtonGroup: false,
// actionColOptions: {
// span: 23,
// },
// });
const
tokenTimeEidt
=
ref
(
false
);
function
handleTokenTimeEdit
()
{
tokenTimeEidt
.
value
=
!
tokenTimeEidt
.
value
}
const
userKeyEidt
=
ref
(
false
);
function
handleUserKeyEdit
()
{
userKeyEidt
.
value
=
!
userKeyEidt
.
value
}
/**API 表格 */
const
[
registerTable
,
{
reload
,
updateTableDataRecord
,
getSearchInfo
,
getForm
,
getRowSelection
:
getRowSelectionApi
}]
=
useTable
({
api
:
async
(
params
)
=>
{
const
response
=
{
pageNu
:
"1"
,
pageSize
:
"10"
,
pages
:
"1"
,
total
:
tableListDetails
.
length
,
code
:
''
,
message
:
''
,
data
:
tableListDetails
,
};
return
{
...
response
};
},
columns
:
detailsColumns
,
formConfig
:
{
showActionButtonGroup
:
true
,
//搜索栏Button取消
labelWidth
:
120
,
schemas
:
detailSchemas
,
autoSubmitOnEnter
:
true
,
},
showIndexColumn
:
false
,
//列表序号取消
rowSelection
:
true
,
//列表复选框
useSearchForm
:
true
,
showTableSetting
:
false
,
bordered
:
true
,
actionColumn
:
{
width
:
120
,
title
:
'操作'
,
dataIndex
:
'action'
,
},
});
/**Executor 表格 */
const
[
registerTable2
,
{
getRowSelection
:
getRowSelectionExecutor
}]
=
useTable
({
api
:
async
(
params
)
=>
{
const
response
=
{
pageNu
:
"1"
,
pageSize
:
"10"
,
pages
:
"1"
,
total
:
tableListDetails2
.
length
,
code
:
''
,
message
:
''
,
data
:
tableListDetails2
,
};
return
{
...
response
};
},
rowSelection
:
true
,
columns
:
detailsColumns2
,
formConfig
:
{
showActionButtonGroup
:
true
,
labelWidth
:
120
,
schemas
:
detailSchemas
,
autoSubmitOnEnter
:
true
,
},
showIndexColumn
:
false
,
//列表序号取消
useSearchForm
:
true
,
showTableSetting
:
false
,
bordered
:
true
,
actionColumn
:
{
width
:
120
,
title
:
'操作'
,
dataIndex
:
'action'
,
},
});
function
handleGoBack
()
{
router
.
go
(
-
1
);
}
/**API表单 移动 弹窗 */
const
[
registerMobileModal
,{
openModal
:
openMobileModal
}]
=
useModal
();
function
mobile
(){
openMobileModal
(
true
,
{});
}
/**Executor表单 删除 */
function
handleDelete
()
{
console
.
log
(
'点击了删除'
)
}
</
script
>
<
style
scoped
lang=
"scss"
>
.callerManage_details
{
background-color
:
white
;
padding
:
20px
;
.header
{
display
:
flex
;
align-items
:
center
;
padding-bottom
:
20px
;
.backBtn
{
cursor
:
pointer
;
}
.header_info
{
padding-left
:
15px
;
}
}
}
</
style
>
src/views/dataService/serviceManage/gatewayConfig/businessGrouping/groupDetails/mobileModal.vue
0 → 100644
View file @
244dd030
<
template
>
<BasicModal
width=
"40%"
v-bind=
"$attrs"
@
register=
"registerModal"
:title=
"getTitle"
@
ok=
"handleSubmit"
>
<BasicForm
@
register=
"registerForm"
/>
</BasicModal>
</
template
>
<
script
lang=
"ts"
setup
>
import
{
ref
,
computed
,
unref
,
reactive
}
from
'vue'
;
import
{
BasicModal
,
useModalInner
}
from
'@/components/Modal'
;
import
{
BasicForm
,
useForm
}
from
'@/components/Form'
;
import
{
createDocumentFormSchema
}
from
'./callerManage.data.ts'
;
defineOptions
({
name
:
'AccountModal'
});
const
emit
=
defineEmits
([
'success'
,
'register'
]);
const
isUpdate
=
ref
(
true
);
const
isMove
=
ref
(
false
);
const
rowId
=
ref
(
''
);
//获取接口数据并放在下拉框里(这里是打开了一个弹框)
//初始化表单
const
[
registerForm
,
{
setFieldsValue
,
updateSchema
,
resetFields
,
validate
}]
=
useForm
({
labelWidth
:
100
,
baseColProps
:
{
lg
:
12
,
md
:
24
},
schemas
:
createDocumentFormSchema
,
showActionButtonGroup
:
false
,
actionColOptions
:
{
span
:
23
,
},
});
//初始化弹框
const
[
registerModal
,
{
setModalProps
,
closeModal
}]
=
useModalInner
(
async
(
data
)
=>
{
resetFields
();
setModalProps
({
confirmLoading
:
false
});
var
formData
=
{}
if
(
data
.
record
===
null
||
data
.
record
===
undefined
){
formData
=
{
standardsTree
:
'100'
}
}
else
{
formData
=
{
standardsTree
:
data
.
record
.
businessId
}
}
// 塞值
setFieldsValue
({
...
formData
,
});
});
const
getTitle
=
computed
(()
=>
(
'移动'
));
/**确定按钮*/
async
function
handleSubmit
()
{
closeModal
()
}
</
script
>
<
style
lang=
"scss"
scoped
>
</
style
>
src/views/dataService/serviceManage/gatewayConfig/businessGrouping/groupDetails/mock.ts
0 → 100644
View file @
244dd030
/**api */
export
const
tableList
:
any
[]
=
[
{
businessId
:
1
,
name
:
'默认分组'
,
apiRoutNum
:
'17'
,
executorNum
:
'28'
,
},
{
businessId
:
2
,
name
:
'test1'
,
apiRoutNum
:
'17'
,
executorNum
:
'28'
,
},
{
businessId
:
3
,
name
:
'test2'
,
apiRoutNum
:
'17'
,
executorNum
:
'28'
,
},
]
export
const
tableListDetails
:
any
[]
=
[
{
businessId
:
1
,
name
:
'赛文'
,
path
:
'M78/07'
,
flag
:
'以上线'
,
createTime
:
'2023-12-05 15:00:00'
,
upDateTime
:
'2023-12-05 15:00:00'
,
Owner
:
'团'
,
},
{
businessId
:
1
,
name
:
'赛文'
,
path
:
'M78/07'
,
flag
:
'以上线'
,
createTime
:
'2023-12-05 15:00:00'
,
upDateTime
:
'2023-12-05 15:00:00'
,
Owner
:
'团'
,
},{
businessId
:
1
,
name
:
'赛文'
,
path
:
'M78/07'
,
flag
:
'以上线'
,
createTime
:
'2023-12-05 15:00:00'
,
upDateTime
:
'2023-12-05 15:00:00'
,
Owner
:
'团'
,
},
]
/** executor */
export
const
tableListDetails2
:
any
[]
=
[
{
businessId
:
1
,
IP
:
'雷欧'
,
path
:
'L77/06'
,
},
{
businessId
:
1
,
IP
:
'雷欧'
,
path
:
'L77/06'
,
},
{
businessId
:
1
,
IP
:
'雷欧'
,
path
:
'L77/06'
,
},
]
src/views/dataService/serviceManage/gatewayConfig/businessGrouping/index.vue
View file @
244dd030
...
@@ -9,10 +9,12 @@
...
@@ -9,10 +9,12 @@
<TableAction
<TableAction
:actions=
"[
:actions=
"[
{
{
// label: '编辑',
icon: 'clarity:note-edit-line',
icon: 'clarity:note-edit-line',
onClick: handleEdit.bind(null, record),
onClick: handleEdit.bind(null, record),
},
},
{
{
// label: '删除',
icon: 'ant-design:delete-outlined',
icon: 'ant-design:delete-outlined',
color: 'error',
color: 'error',
...
@@ -89,7 +91,7 @@ const [registerTable, { reload, updateTableDataRecord, getSearchInfo, getForm,ge
...
@@ -89,7 +91,7 @@ const [registerTable, { reload, updateTableDataRecord, getSearchInfo, getForm,ge
});
});
/**新建按钮 */
/**新建按钮 */
const
[
registerCreateDocumentModal
,
{
openModal
:
openCreateDocumentModal
}]
=
useModal
();
const
[
registerCreateDocumentModal
,
{
openModal
:
openCreateDocumentModal
}]
=
useModal
();
function
handleNew
(){
function
handleNew
(){
openCreateDocumentModal
(
true
,
{
openCreateDocumentModal
(
true
,
{
});
});
...
@@ -112,6 +114,9 @@ function editApi(record: any) {
...
@@ -112,6 +114,9 @@ function editApi(record: any) {
console
.
log
(
'点击触发editApi'
,
record
)
console
.
log
(
'点击触发editApi'
,
record
)
router
.
push
({
router
.
push
({
path
:
'/dataService/serviceManage/gatewayConfig/businessGrouping/groupDetails'
,
path
:
'/dataService/serviceManage/gatewayConfig/businessGrouping/groupDetails'
,
query
:
{
businessId
:
record
.
businessId
,
}
});
});
}
}
...
...
src/views/system/menu/MenuDrawer.vue
View file @
244dd030
...
@@ -15,9 +15,8 @@
...
@@ -15,9 +15,8 @@
import
{
BasicForm
,
useForm
}
from
'@/components/Form'
;
import
{
BasicForm
,
useForm
}
from
'@/components/Form'
;
import
{
formSchema
}
from
'./menu.data'
;
import
{
formSchema
}
from
'./menu.data'
;
import
{
BasicDrawer
,
useDrawerInner
}
from
'@/components/Drawer'
;
import
{
BasicDrawer
,
useDrawerInner
}
from
'@/components/Drawer'
;
import
{
menuDetailApi
,
menuUpdataApi
,
getMenuList
,
addMenuApi
}
from
"@/api/system/menu/menu"
;
import
{
menuDetailApi
,
menuUpdataApi
,
getMenuList
,
addMenuApi
}
from
'@/api/system/menu/menu'
;
import
{
useMessage
}
from
"@/hooks/web/useMessage"
;
import
{
useMessage
}
from
'@/hooks/web/useMessage'
;
defineOptions
({
name
:
'MenuDrawer'
});
defineOptions
({
name
:
'MenuDrawer'
});
const
emit
=
defineEmits
([
'success'
,
'register'
]);
const
emit
=
defineEmits
([
'success'
,
'register'
]);
...
@@ -41,30 +40,30 @@
...
@@ -41,30 +40,30 @@
// 获取行数据的菜单id
// 获取行数据的菜单id
menuId
.
value
=
data
.
record
.
businessId
;
menuId
.
value
=
data
.
record
.
businessId
;
// 通过id获取菜单详情信息
// 通过id获取菜单详情信息
menuDetailApi
(
menuId
.
value
).
then
(
res
=>
{
menuDetailApi
(
menuId
.
value
).
then
(
(
res
)
=>
{
const
form
=
res
.
data
const
form
=
res
.
data
;
// 塞值
// 塞值
setFieldsValue
({
setFieldsValue
({
...
form
,
...
form
,
});
});
})
})
;
}
}
if
(
unref
(
isAdd
)){
if
(
unref
(
isAdd
))
{
// 通过id获取菜单详情信息
// 通过id获取菜单详情信息
const
id
=
data
.
record
.
businessId
const
id
=
data
.
record
.
businessId
;
const
params
=
{
const
params
=
{
parentId
:
id
,
parentId
:
id
,
}
}
;
// 塞值
// 塞值
setFieldsValue
({
setFieldsValue
({
...
params
,
...
params
,
});
});
}
}
var
treeData
=
[]
var
treeData
=
[]
;
const
res
=
await
getMenuList
();
const
res
=
await
getMenuList
();
const
menu
=
{
businessId
:
0
,
parentId
:
0
,
menuName
:
'主类目'
,
children
:
[]
}
const
menu
=
{
businessId
:
0
,
parentId
:
0
,
menuName
:
'主类目'
,
children
:
[]
};
menu
.
children
=
handleTree
(
res
.
data
,
'businessId'
,
undefined
,
undefined
,
undefined
)
menu
.
children
=
handleTree
(
res
.
data
,
'businessId'
,
undefined
,
undefined
,
undefined
);
treeData
.
push
(
menu
)
treeData
.
push
(
menu
)
;
updateSchema
({
updateSchema
({
field
:
'parentId'
,
field
:
'parentId'
,
componentProps
:
{
treeData
},
componentProps
:
{
treeData
},
...
@@ -77,15 +76,18 @@
...
@@ -77,15 +76,18 @@
const
formData
=
await
validate
();
const
formData
=
await
validate
();
setDrawerProps
({
confirmLoading
:
true
});
setDrawerProps
({
confirmLoading
:
true
});
// 编辑
// 编辑
if
(
unref
(
isUpdate
))
{
if
(
unref
(
isUpdate
))
{
formData
.
businessId
=
menuId
.
value
formData
.
businessId
=
menuId
.
value
;
menuUpdataApi
(
formData
).
then
(
res
=>
{
menuUpdataApi
(
formData
).
then
(
(
res
)
=>
{
if
(
res
.
code
===
200
)
{
if
(
res
.
code
===
200
)
{
createMessage
.
success
(
'编辑成功'
);
createMessage
.
success
(
'编辑成功'
);
closeDrawer
();
closeDrawer
();
emit
(
'success'
,
{
isUpdate
:
unref
(
isUpdate
),
values
:
{
...
formData
,
businessId
:
menuId
.
value
}
});
emit
(
'success'
,
{
isUpdate
:
unref
(
isUpdate
),
values
:
{
...
formData
,
businessId
:
menuId
.
value
},
});
}
}
})
})
;
}
else
{
}
else
{
//新增
//新增
const
paramsAdd
=
{
const
paramsAdd
=
{
...
@@ -102,14 +104,18 @@
...
@@ -102,14 +104,18 @@
path
:
formData
.
path
,
path
:
formData
.
path
,
perms
:
formData
.
perms
,
perms
:
formData
.
perms
,
component
:
formData
.
component
,
component
:
formData
.
component
,
}
remarks
:
formData
.
remarks
,
addMenuApi
(
paramsAdd
).
then
(
res
=>
{
};
if
(
res
.
code
===
200
){
addMenuApi
(
paramsAdd
).
then
((
res
)
=>
{
if
(
res
.
code
===
200
)
{
createMessage
.
success
(
'新增成功'
);
createMessage
.
success
(
'新增成功'
);
closeDrawer
();
closeDrawer
();
emit
(
'success'
,
{
isUpdate
:
unref
(
isUpdate
),
values
:
{
...
formData
,
businessId
:
menuId
.
value
}
});
emit
(
'success'
,
{
isUpdate
:
unref
(
isUpdate
),
values
:
{
...
formData
,
businessId
:
menuId
.
value
},
});
}
}
})
})
;
}
}
}
finally
{
}
finally
{
setDrawerProps
({
confirmLoading
:
false
});
setDrawerProps
({
confirmLoading
:
false
});
...
@@ -118,22 +124,30 @@
...
@@ -118,22 +124,30 @@
/**结构转换方法*/
/**结构转换方法*/
function
handleTree
(
data
,
id
,
parentId
,
children
,
rootId
)
{
function
handleTree
(
data
,
id
,
parentId
,
children
,
rootId
)
{
id
=
id
||
'id'
id
=
id
||
'id'
;
parentId
=
parentId
||
'parentId'
parentId
=
parentId
||
'parentId'
;
children
=
children
||
'children'
children
=
children
||
'children'
;
rootId
=
rootId
||
Math
.
min
.
apply
(
Math
,
data
.
map
(
item
=>
{
return
item
[
parentId
]
}))
||
0
rootId
=
rootId
||
Math
.
min
.
apply
(
Math
,
data
.
map
((
item
)
=>
{
return
item
[
parentId
];
}),
)
||
0
;
// 对源数据深度克隆
// 对源数据深度克隆
const
cloneData
=
JSON
.
parse
(
JSON
.
stringify
(
data
))
const
cloneData
=
JSON
.
parse
(
JSON
.
stringify
(
data
))
;
// 循环所有项
// 循环所有项
const
treeData
=
cloneData
.
filter
(
father
=>
{
const
treeData
=
cloneData
.
filter
(
(
father
)
=>
{
const
branchArr
=
cloneData
.
filter
(
child
=>
{
const
branchArr
=
cloneData
.
filter
(
(
child
)
=>
{
// 返回每一项的子级数组
// 返回每一项的子级数组
return
father
[
id
]
===
child
[
parentId
]
return
father
[
id
]
===
child
[
parentId
]
;
})
})
;
branchArr
.
length
>
0
?
father
.
children
=
branchArr
:
''
branchArr
.
length
>
0
?
(
father
.
children
=
branchArr
)
:
''
;
// 返回第一层
// 返回第一层
return
father
[
parentId
]
===
rootId
return
father
[
parentId
]
===
rootId
;
})
})
;
return
treeData
!==
''
?
treeData
:
data
return
treeData
!==
''
?
treeData
:
data
;
}
}
</
script
>
</
script
>
src/views/system/menu/index.vue
View file @
244dd030
...
@@ -9,17 +9,17 @@
...
@@ -9,17 +9,17 @@
<TableAction
<TableAction
:actions=
"[
:actions=
"[
{
{
label:'新增',
label:
'新增',
onClick: handleAdd.bind(null, record),
onClick: handleAdd.bind(null, record),
},
},
{
{
// icon: 'clarity:note-edit-line',
// icon: 'clarity:note-edit-line',
label:'修改',
label:
'修改',
onClick: handleEdit.bind(null, record),
onClick: handleEdit.bind(null, record),
},
},
{
{
// icon: 'ant-design:delete-outlined',
// icon: 'ant-design:delete-outlined',
label:'删除',
label:
'删除',
color: 'error',
color: 'error',
popConfirm: {
popConfirm: {
title: '是否确认删除',
title: '是否确认删除',
...
@@ -40,12 +40,12 @@
...
@@ -40,12 +40,12 @@
import
{
useDrawer
}
from
'@/components/Drawer'
;
import
{
useDrawer
}
from
'@/components/Drawer'
;
import
MenuDrawer
from
'./MenuDrawer.vue'
;
import
MenuDrawer
from
'./MenuDrawer.vue'
;
import
{
columns
,
searchFormSchema
}
from
'./menu.data'
;
import
{
columns
,
searchFormSchema
}
from
'./menu.data'
;
import
{
deleteById
,
getMenuListByPage
}
from
"@/api/system/menu/menu"
;
import
{
deleteById
,
getMenuListByPage
}
from
'@/api/system/menu/menu'
;
import
{
useMessage
}
from
"@/hooks/web/useMessage"
;
import
{
useMessage
}
from
'@/hooks/web/useMessage'
;
import
{
ref
,
reactive
,
unref
,
onDeactivated
,
onMounted
,
nextTick
}
from
'vue'
;
import
{
ref
,
reactive
,
unref
,
onDeactivated
,
onMounted
,
nextTick
}
from
'vue'
;
import
{
useRoute
,
onBeforeRouteLeave
}
from
'vue-router'
;
import
{
useRoute
,
onBeforeRouteLeave
}
from
'vue-router'
;
import
{
useFilterStore
}
from
'@/store/modules/filterData'
;
import
{
useFilterStore
}
from
'@/store/modules/filterData'
;
import
{
useUserStore
}
from
"@/store/modules/user"
;
import
{
useUserStore
}
from
'@/store/modules/user'
;
defineOptions
({
name
:
'MenuManagement'
});
defineOptions
({
name
:
'MenuManagement'
});
const
filterStore
=
useFilterStore
();
const
filterStore
=
useFilterStore
();
...
@@ -53,7 +53,7 @@
...
@@ -53,7 +53,7 @@
const
{
createMessage
}
=
useMessage
();
const
{
createMessage
}
=
useMessage
();
const
[
registerDrawer
,
{
openDrawer
}]
=
useDrawer
();
const
[
registerDrawer
,
{
openDrawer
}]
=
useDrawer
();
const
treeData
=
ref
();
const
treeData
=
ref
();
const
[
registerTable
,
{
reload
,
expandAll
,
getForm
}]
=
useTable
({
const
[
registerTable
,
{
reload
,
expandAll
,
getForm
}]
=
useTable
({
title
:
'菜单列表'
,
title
:
'菜单列表'
,
api
:
async
(
params
)
=>
{
api
:
async
(
params
)
=>
{
const
response
=
await
getMenuListByPage
(
params
);
const
response
=
await
getMenuListByPage
(
params
);
...
@@ -85,29 +85,37 @@
...
@@ -85,29 +85,37 @@
/**改变列表结构 列表->树*/
/**改变列表结构 列表->树*/
function
transformData
(
data
)
{
function
transformData
(
data
)
{
treeData
.
value
=
handleTree
(
data
,
'businessId'
,
undefined
,
undefined
,
undefined
)
treeData
.
value
=
handleTree
(
data
,
'businessId'
,
undefined
,
undefined
,
undefined
);
return
treeData
.
value
return
treeData
.
value
;
}
}
/**结构转换方法*/
/**结构转换方法*/
function
handleTree
(
data
,
id
,
parentId
,
children
,
rootId
)
{
function
handleTree
(
data
,
id
,
parentId
,
children
,
rootId
)
{
id
=
id
||
'id'
id
=
id
||
'id'
;
parentId
=
parentId
||
'parentId'
parentId
=
parentId
||
'parentId'
;
children
=
children
||
'children'
children
=
children
||
'children'
;
rootId
=
rootId
||
Math
.
min
.
apply
(
Math
,
data
.
map
(
item
=>
{
return
item
[
parentId
]
}))
||
0
rootId
=
rootId
||
Math
.
min
.
apply
(
Math
,
data
.
map
((
item
)
=>
{
return
item
[
parentId
];
}),
)
||
0
;
// 对源数据深度克隆
// 对源数据深度克隆
const
cloneData
=
JSON
.
parse
(
JSON
.
stringify
(
data
))
const
cloneData
=
JSON
.
parse
(
JSON
.
stringify
(
data
))
;
// 循环所有项
// 循环所有项
const
treeData
=
cloneData
.
filter
(
father
=>
{
const
treeData
=
cloneData
.
filter
(
(
father
)
=>
{
const
branchArr
=
cloneData
.
filter
(
child
=>
{
const
branchArr
=
cloneData
.
filter
(
(
child
)
=>
{
// 返回每一项的子级数组
// 返回每一项的子级数组
return
father
[
id
]
===
child
[
parentId
]
return
father
[
id
]
===
child
[
parentId
]
;
})
})
;
branchArr
.
length
>
0
?
father
.
children
=
branchArr
:
''
branchArr
.
length
>
0
?
(
father
.
children
=
branchArr
)
:
''
;
// 返回第一层
// 返回第一层
return
father
[
parentId
]
===
rootId
return
father
[
parentId
]
===
rootId
;
})
})
;
return
treeData
!==
''
?
treeData
:
data
return
treeData
!==
''
?
treeData
:
data
;
}
}
/**新增*/
/**新增*/
...
@@ -152,31 +160,29 @@
...
@@ -152,31 +160,29 @@
/**进入页面的初始化方法*/
/**进入页面的初始化方法*/
onMounted
(()
=>
{
onMounted
(()
=>
{
const
path
=
route
.
path
const
path
=
route
.
path
;
if
(
filterStore
.
getSearchParams
[
path
])
{
if
(
filterStore
.
getSearchParams
[
path
])
{
if
(
JSON
.
parse
(
filterStore
.
getSearchParams
[
path
]
!==
{}))
{
if
(
JSON
.
parse
(
filterStore
.
getSearchParams
[
path
]
!==
{}))
{
const
params
=
JSON
.
parse
(
filterStore
.
getSearchParams
[
path
])
const
params
=
JSON
.
parse
(
filterStore
.
getSearchParams
[
path
])
;
getForm
().
setFieldsValue
({
getForm
().
setFieldsValue
({
page
:
params
.
page
,
page
:
params
.
page
,
pageSize
:
params
.
pageSize
,
pageSize
:
params
.
pageSize
,
menuName
:
params
.
menuName
,
menuName
:
params
.
menuName
,
flag
:
params
.
flag
,
flag
:
params
.
flag
,
})
})
;
}
}
}
}
});
});
/**离开路由前调用的钩子函数*/
/**离开路由前调用的钩子函数*/
onBeforeRouteLeave
((
to
,
from
,
next
)
=>
{
onBeforeRouteLeave
((
to
,
from
,
next
)
=>
{
const
params
=
Object
.
assign
({},
getForm
().
getFieldsValue
());
const
params
=
Object
.
assign
({},
getForm
().
getFieldsValue
());
filterStore
.
setSearchParams
(
filterStore
.
setSearchParams
({
{
path
:
from
.
path
,
path
:
from
.
path
,
param
:
{
param
:
{
...
params
,
...
params
},
}
});
}
)
next
();
// 允许导航
next
();
// 允许导航
});
});
</
script
>
</
script
>
src/views/system/menu/menu.data.ts
View file @
244dd030
import
{
BasicColumn
,
FormSchema
}
from
'@/components/Table'
;
import
{
BasicColumn
,
FormSchema
}
from
'@/components/Table'
;
import
{
h
}
from
'vue'
;
import
{
h
}
from
'vue'
;
import
{
Switch
,
Tag
}
from
'ant-design-vue'
;
import
{
Switch
,
Tag
}
from
'ant-design-vue'
;
import
Icon
from
'@/components/Icon/Icon.vue'
;
import
Icon
from
'@/components/Icon/Icon.vue'
;
import
{
useMessage
}
from
"@/hooks/web/useMessage"
;
import
{
useMessage
}
from
'@/hooks/web/useMessage'
;
import
{
setMenuStatus
}
from
"@/api/system/menu/menu"
;
import
{
setMenuStatus
}
from
'@/api/system/menu/menu'
;
export
const
columns
:
BasicColumn
[]
=
[
export
const
columns
:
BasicColumn
[]
=
[
{
{
...
@@ -65,12 +65,12 @@ export const columns: BasicColumn[] = [
...
@@ -65,12 +65,12 @@ export const columns: BasicColumn[] = [
path
:
record
.
path
,
path
:
record
.
path
,
perms
:
record
.
perms
,
perms
:
record
.
perms
,
component
:
record
.
component
,
component
:
record
.
component
,
}
}
;
setMenuStatus
(
params
)
setMenuStatus
(
params
)
.
then
(()
=>
{
.
then
(()
=>
{
record
.
flag
=
newStatus
;
record
.
flag
=
newStatus
;
const
text
=
record
.
flag
===
'1'
?
'启用'
:
'停用'
const
text
=
record
.
flag
===
'1'
?
'启用'
:
'停用'
;
createMessage
.
success
(
text
+
`成功`
);
createMessage
.
success
(
text
+
`成功`
);
})
})
.
catch
(()
=>
{
.
catch
(()
=>
{
// createMessage.error('操作失败');
// createMessage.error('操作失败');
...
@@ -260,4 +260,19 @@ export const formSchema: FormSchema[] = [
...
@@ -260,4 +260,19 @@ export const formSchema: FormSchema[] = [
],
],
ifShow
:
({
values
})
=>
!
isButton
(
values
.
menuType
),
ifShow
:
({
values
})
=>
!
isButton
(
values
.
menuType
),
},
},
{
field
:
'remarks'
,
label
:
'菜单类型标记'
,
component
:
'Select'
,
componentProps
:
{
placeholder
:
'请选择菜单类型'
,
options
:
[
{
label
:
'第一模块'
,
value
:
'1'
},
{
label
:
'第二模块'
,
value
:
'2'
},
{
label
:
'第三模块'
,
value
:
'3'
},
{
label
:
'第四模块'
,
value
:
'4'
},
{
label
:
'公共'
,
value
:
'5'
},
],
},
},
];
];
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