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
44b00f0f
Commit
44b00f0f
authored
Nov 28, 2024
by
liwei
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
2891b068
8c49eba2
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
1592 additions
and
0 deletions
+1592
-0
AccountDetail.vue
...SharingAndExchange/catalogingManagement/AccountDetail.vue
+61
-0
AccountModal.vue
...aSharingAndExchange/catalogingManagement/AccountModal.vue
+129
-0
AddUserModal.vue
...aSharingAndExchange/catalogingManagement/AddUserModal.vue
+95
-0
DeptTree.vue
.../dataSharingAndExchange/catalogingManagement/DeptTree.vue
+183
-0
MoveTreeModal.vue
...SharingAndExchange/catalogingManagement/MoveTreeModal.vue
+97
-0
UpdateTreeModal.vue
...aringAndExchange/catalogingManagement/UpdateTreeModal.vue
+115
-0
index.vue
...ews/dataSharingAndExchange/catalogingManagement/index.vue
+274
-0
institution.data.ts
...aringAndExchange/catalogingManagement/institution.data.ts
+168
-0
institutionData.ts
...haringAndExchange/catalogingManagement/institutionData.ts
+358
-0
moveUser.vue
.../dataSharingAndExchange/catalogingManagement/moveUser.vue
+112
-0
No files found.
src/views/dataSharingAndExchange/catalogingManagement/AccountDetail.vue
0 → 100644
View file @
44b00f0f
<
template
>
<PageWrapper
:title=
"`用户` + userId + `的资料`"
content=
"这是用户资料详情页面。本页面仅用于演示相同路由在tab中打开多个页面并且显示不同的数据"
contentBackground
@
back=
"goBack"
>
<template
#
extra
>
<a-button
type=
"primary"
danger
>
禁用账号
</a-button>
<a-button
type=
"primary"
>
修改密码
</a-button>
</
template
>
<
template
#
footer
>
<a-tabs
default-active-key=
"detail"
v-model:activeKey=
"currentKey"
>
<a-tab-pane
key=
"detail"
tab=
"用户资料"
/>
<a-tab-pane
key=
"logs"
tab=
"操作日志"
/>
</a-tabs>
</
template
>
<div
class=
"pt-4 m-4 desc-wrap"
>
<
template
v-if=
"currentKey == 'detail'"
>
<div
v-for=
"i in 10"
:key=
"i"
>
这是用户
{{
userId
}}
资料Tab
</div>
</
template
>
<
template
v-if=
"currentKey == 'logs'"
>
<div
v-for=
"i in 10"
:key=
"i"
>
这是用户
{{
userId
}}
操作日志Tab
</div>
</
template
>
</div>
</PageWrapper>
</template>
<
script
lang=
"ts"
setup
>
import
{
ref
}
from
'vue'
;
import
{
useRoute
}
from
'vue-router'
;
import
{
PageWrapper
}
from
'@/components/Page'
;
import
{
useGo
}
from
'@/hooks/web/usePage'
;
import
{
useTabs
}
from
'@/hooks/web/useTabs'
;
import
{
Tabs
}
from
'ant-design-vue'
;
defineOptions
({
name
:
'AccountDetail'
});
const
ATabs
=
Tabs
;
const
ATabPane
=
Tabs
.
TabPane
;
const
route
=
useRoute
();
const
go
=
useGo
();
// 此处可以得到用户ID
const
userId
=
ref
(
route
.
params
?.
id
);
const
currentKey
=
ref
(
'detail'
);
const
{
setTitle
}
=
useTabs
();
// TODO
// 本页代码仅作演示,实际应当通过userId从接口获得用户的相关资料
// 设置Tab的标题(不会影响页面标题)
setTitle
(
'详情:用户'
+
userId
.
value
);
// 页面左侧点击返回链接时的操作
function
goBack
()
{
// 本例的效果时点击返回始终跳转到账号列表页,实际应用时可返回上一页
go
(
'/system/account'
);
}
</
script
>
<
style
></
style
>
src/views/dataSharingAndExchange/catalogingManagement/AccountModal.vue
0 → 100644
View file @
44b00f0f
<
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
{
accountFormSchema
}
from
'./institution.data'
;
import
{
getDeptList
}
from
'@/api/system/dept/dept'
;
import
{
addUserApi
,
UserDetailApi
,
UserUpdataApi
}
from
'@/api/system/user/user'
import
{
encryptTwo
}
from
'../../../../src/utils/jsencrypt.js'
import
{
useMessage
}
from
'@/hooks/web/useMessage'
;
import
{
TreeData
}
from
"@/views/system/institution/institutionData"
;
defineOptions
({
name
:
'AccountModal'
});
const
emit
=
defineEmits
([
'success'
,
'register'
]);
const
{
createMessage
}
=
useMessage
();
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
:
accountFormSchema
,
showActionButtonGroup
:
false
,
actionColOptions
:
{
span
:
23
,
},
});
//初始化弹框
const
[
registerModal
,
{
setModalProps
,
closeModal
}]
=
useModalInner
(
async
(
data
)
=>
{
resetFields
();
setModalProps
({
confirmLoading
:
false
});
isUpdate
.
value
=
!!
data
?.
isUpdate
;
isMove
.
value
=
!!
data
?.
isMove
;
if
(
unref
(
isUpdate
))
{
// 获取行数据的id
rowId
.
value
=
data
.
record
.
businessId
;
// 塞值
setFieldsValue
({
...
data
.
record
,
});
}
const
treeList
=
handleTree
(
TreeData
,
'businessId'
,
undefined
,
undefined
,
undefined
)
updateSchema
([
{
field
:
'institutionId'
,
componentProps
:
{
treeData
:
treeList
},
},
]);
});
const
getTitle
=
computed
(()
=>
(
!
unref
(
isUpdate
)
?
'新增账号'
:
'编辑账号'
));
function
handleTree
(
data
,
id
,
parentId
,
children
,
rootId
)
{
id
=
id
||
'id'
parentId
=
parentId
||
'parentId'
children
=
children
||
'children'
rootId
=
rootId
||
Math
.
min
.
apply
(
Math
,
data
.
map
(
item
=>
{
return
item
[
parentId
]
}))
||
0
// 对源数据深度克隆
const
cloneData
=
JSON
.
parse
(
JSON
.
stringify
(
data
))
// 循环所有项
const
treeData
=
cloneData
.
filter
(
father
=>
{
const
branchArr
=
cloneData
.
filter
(
child
=>
{
// 返回每一项的子级数组
return
father
[
id
]
===
child
[
parentId
]
})
branchArr
.
length
>
0
?
father
.
children
=
branchArr
:
''
// 返回第一层
return
father
[
parentId
]
===
rootId
})
return
treeData
!==
''
?
treeData
:
data
}
/**确定按钮*/
async
function
handleSubmit
()
{
try
{
//拿到表单内容
const
values
=
await
validate
();
//通过表单获取的institutionId去查找相同TreeData中的institutionId的institutionName
const
institutionName
=
TreeData
.
find
(
item
=>
item
.
businessId
===
values
.
institutionId
).
institutionName
values
.
institutionName
=
institutionName
setModalProps
({
confirmLoading
:
true
});
// 编辑
if
(
unref
(
isUpdate
))
{
values
.
businessId
=
rowId
.
value
//修改列表值
emit
(
'success'
,
{
isUpdate
:
unref
(
isUpdate
),
values
:
{
...
values
,
id
:
rowId
.
value
}
});
createMessage
.
success
(
'编辑成功'
);
closeModal
();
}
else
{
//根据institutionId去查找相同TreeData中的institutionId的institutionName
const
institutionName
=
TreeData
.
find
(
item
=>
item
.
businessId
===
values
.
institutionId
).
institutionName
const
paramsAdd
=
{
username
:
values
.
username
,
name
:
values
.
name
,
institutionId
:
values
.
institutionId
,
institutionName
:
institutionName
,
createDate
:
formatDate
(
new
Date
())
}
emit
(
'success'
,
{
isUpdate
:
unref
(
isUpdate
),
values
:
{
...
paramsAdd
}
});
createMessage
.
success
(
'新增成功'
);
closeModal
();
}
}
finally
{
setModalProps
({
confirmLoading
:
false
});
}
}
// 格式化日期
function
formatDate
(
date
)
{
const
year
=
date
.
getFullYear
();
const
month
=
String
(
date
.
getMonth
()
+
1
).
padStart
(
2
,
'0'
);
// 月份从0开始,需要加1
const
day
=
String
(
date
.
getDate
()).
padStart
(
2
,
'0'
);
const
hours
=
String
(
date
.
getHours
()).
padStart
(
2
,
'0'
);
const
minutes
=
String
(
date
.
getMinutes
()).
padStart
(
2
,
'0'
);
const
seconds
=
String
(
date
.
getSeconds
()).
padStart
(
2
,
'0'
);
return
`
${
year
}
-
${
month
}
-
${
day
}
${
hours
}
:
${
minutes
}
:
${
seconds
}
`
;
}
</
script
>
src/views/dataSharingAndExchange/catalogingManagement/AddUserModal.vue
0 → 100644
View file @
44b00f0f
<
template
>
<BasicModal
width=
"50%"
v-bind=
"$attrs"
@
register=
"registerModal"
:title=
"getTitle"
@
ok=
"handleSubmit"
>
<BasicTable
@
register=
"registerTable"
></BasicTable>
</BasicModal>
</
template
>
<
script
lang=
"ts"
setup
>
import
{
BasicModal
,
useModalInner
}
from
'@/components/Modal'
;
import
{
BasicForm
,
useForm
}
from
'@/components/Form'
;
import
{
reactive
,
unref
,
onDeactivated
,
onMounted
,
ref
}
from
'vue'
;
import
{
BasicTable
,
useTable
,
TableAction
}
from
'@/components/Table'
;
import
{
useMessage
}
from
'@/hooks/web/useMessage'
;
import
{
useModal
}
from
'@/components/Modal'
;
import
{
addUserData
,
columns
,
searchFormSchema
,
TreeData
}
from
'./institutionData'
;
import
{
useGo
}
from
'@/hooks/web/usePage'
;
import
{
downloadByData
}
from
'@/utils/file/download'
;
import
{
useRoute
,
onBeforeRouteLeave
}
from
'vue-router'
;
import
{
useFilterStore
}
from
'@/store/modules/filterData'
;
import
{
useUserStore
}
from
"@/store/modules/user"
;
import
{
userData
}
from
"@/views/system/institution/institutionData"
;
defineOptions
({
name
:
'AccountManagement'
});
const
{
createMessage
}
=
useMessage
();
const
filterStore
=
useFilterStore
();
const
route
=
useRoute
();
const
go
=
useGo
();
const
[
registerMoveUser
,
{
openModal
:
openMoveUserModal
}]
=
useModal
();
const
searchInfo
=
reactive
<
Recordable
>
({});
const
emit
=
defineEmits
([
'success'
,
'register'
]);
const
tableData
=
ref
([])
const
isAdd
=
ref
(
true
)
const
[
registerTable
,
{
reload
,
updateTableDataRecord
,
getSearchInfo
,
getForm
,
getRowSelection
}]
=
useTable
({
title
:
'添加用户'
,
api
:
async
(
params
)
=>
{
const
response
=
{
pageNu
:
"1"
,
pageSize
:
"10"
,
pages
:
"1"
,
total
:
tableData
.
value
.
length
,
code
:
''
,
message
:
''
,
data
:
[],
};
var
data
=
[]
data
=
tableData
.
value
if
(
params
.
name
!=
undefined
&&
params
.
name
!=
''
&&
params
.
name
!=
null
){
//过滤出名字包含params.name的数据
data
=
data
.
filter
((
item
)
=>
item
.
name
.
includes
(
params
.
name
));
}
if
(
params
.
username
!=
undefined
&&
params
.
username
!=
''
&&
params
.
username
!=
null
){
data
=
data
.
filter
((
item
)
=>
item
.
username
.
includes
(
params
.
username
));
}
return
{
...
response
,
data
:
data
};
},
rowKey
:
'businessId'
,
columns
,
rowSelection
:
true
,
formConfig
:
{
labelWidth
:
100
,
schemas
:
searchFormSchema
,
autoSubmitOnEnter
:
true
,
},
useSearchForm
:
true
,
showTableSetting
:
false
,
bordered
:
true
,
handleSearchInfoFn
(
info
)
{
return
info
;
},
});
//初始化弹框
const
[
registerModal
,
{
setModalProps
,
closeModal
}]
=
useModalInner
(
async
(
data
)
=>
{
setModalProps
({
confirmLoading
:
false
});
isAdd
.
value
=
!!
data
?.
isAdd
;
});
/** 新增成功*/
function
handleSubmit
()
{
const
rowSelection
=
getRowSelection
().
selectedRowKeys
;
if
(
rowSelection
.
length
>
0
){
//已选中
//根据选中的查询用户 然后进行添加
let
data
=
[]
data
=
tableData
.
value
.
filter
((
item
)
=>
rowSelection
.
includes
(
item
.
businessId
));
emit
(
'success'
,
{
isAdd
:
unref
(
isAdd
),
values
:
{
...
data
},
length
:
rowSelection
.
length
});
closeModal
();
}
}
onMounted
(()
=>
{
tableData
.
value
=
addUserData
});
</
script
>
src/views/dataSharingAndExchange/catalogingManagement/DeptTree.vue
0 → 100644
View file @
44b00f0f
<
template
>
<div
class=
"m-4 mr-0 overflow-hidden bg-white"
>
<BasicTree
title=
"部门列表"
ref=
"treeRef"
toolbar
search
treeWrapperClassName=
"h-[calc(100%-35px)] overflow-auto"
:clickRowToExpand=
"false"
:defaultExpandAll=
"true"
:treeData=
"treeData"
:fieldNames=
"
{ key: 'businessId', title: 'institutionName' }"
@select="handleSelect"
:actionList="actionList"
/>
</div>
<MoveTreeModal
@
register=
"registerMoveTreeModel"
@
success=
"handleSuccess"
/>
<UpdateTreeModal
@
register=
"registerModal"
@
success=
"handleSuccess"
/>
</
template
>
<
script
lang=
"ts"
setup
>
import
{
h
,
nextTick
,
onMounted
,
ref
,
unref
}
from
'vue'
;
import
{
BasicTree
,
TreeActionItem
,
TreeActionType
,
TreeItem
}
from
'@/components/Tree'
;
import
{
getDeptList
}
from
'@/api/system/dept/dept'
;
import
{
Nullable
}
from
"@vben/types"
;
import
{
TreeData
}
from
"@/views/system/institution/institutionData"
;
import
{
DeleteOutlined
,
PlusOutlined
,
EditOutlined
,
FolderOutlined
}
from
"@ant-design/icons-vue"
;
import
{
Modal
}
from
"ant-design-vue"
;
import
{
useMessage
}
from
'@/hooks/web/useMessage'
;
import
MoveTreeModal
from
'./MoveTreeModal.vue'
;
import
UpdateTreeModal
from
'./UpdateTreeModal.vue'
;
import
{
useModal
}
from
"@/components/Modal"
;
defineOptions
({
name
:
'DeptTree'
});
const
emit
=
defineEmits
([
'select'
]);
const
{
createMessage
}
=
useMessage
();
const
treeData
=
ref
<
TreeItem
[]
>
([]);
const
treeRef
=
ref
<
Nullable
<
TreeActionType
>>
(
null
);
const
[
registerModal
,
{
openModal
}]
=
useModal
();
const
[
registerMoveTreeModel
,
{
openModal
:
openMoveTreeModel
}]
=
useModal
();
function
getTree
()
{
const
tree
=
unref
(
treeRef
);
if
(
!
tree
)
{
throw
new
Error
(
'tree is null!'
);
}
return
tree
;
}
async
function
fetch
()
{
const
data
=
TreeData
treeData
.
value
=
handleTree
(
data
,
'businessId'
,
undefined
,
undefined
,
undefined
)
await
nextTick
(()
=>
{
getTree
().
expandAll
(
true
)
})
}
function
handleTree
(
data
,
id
,
parentId
,
children
,
rootId
)
{
id
=
id
||
'id'
parentId
=
parentId
||
'parentId'
children
=
children
||
'children'
rootId
=
rootId
||
Math
.
min
.
apply
(
Math
,
data
.
map
(
item
=>
{
return
item
[
parentId
]
}))
||
0
// 对源数据深度克隆
const
cloneData
=
JSON
.
parse
(
JSON
.
stringify
(
data
))
// 循环所有项
const
treeData
=
cloneData
.
filter
(
father
=>
{
const
branchArr
=
cloneData
.
filter
(
child
=>
{
// 返回每一项的子级数组
return
father
[
id
]
===
child
[
parentId
]
})
branchArr
.
length
>
0
?
father
.
children
=
branchArr
:
''
// 返回第一层
return
father
[
parentId
]
===
rootId
})
return
treeData
!==
''
?
treeData
:
data
}
function
handleSelect
(
keys
)
{
emit
(
'select'
,
keys
[
0
]);
}
onMounted
(()
=>
{
fetch
();
});
/** 成功回调函数*/
function
handleSuccess
()
{
}
// 树的操作列表
const
actionList
=
[
{
//新增
render
:
(
node
)
=>
{
return
h
(
PlusOutlined
,
{
class
:
'ml-2'
,
onClick
:
()
=>
{
handleAdd
(
node
);
},
});
},
},
{
//修改
render
:
(
node
)
=>
{
return
h
(
EditOutlined
,
{
class
:
'ml-2'
,
onClick
:
()
=>
{
handleUpdate
(
node
);
},
});
},
},
{
//删除
render
:
(
node
)
=>
{
return
h
(
DeleteOutlined
,
{
class
:
'ml-2'
,
onClick
:
()
=>
{
handleDelete
(
node
);
},
});
},
},
{
//移动
render
:
(
node
)
=>
{
return
h
(
FolderOutlined
,
{
class
:
'ml-2'
,
onClick
:
()
=>
{
handleMove
(
node
);
},
});
},
},
];
// 新增节点
const
handleAdd
=
(
node
)
=>
{
openModal
(
true
,
{
isAdd
:
true
,
record
:
node
,
});
};
// 修改节点
const
handleUpdate
=
(
node
)
=>
{
openModal
(
true
,
{
isUpdate
:
true
,
record
:
node
,
});
};
// 移动节点
const
handleMove
=
(
node
)
=>
{
openMoveTreeModel
(
true
,
{
isMove
:
true
,
record
:
node
,
});
};
// 删除节点
const
handleDelete
=
(
node
)
=>
{
Modal
.
confirm
({
title
:
'确认删除'
,
content
:
'确定要删除此节点吗?'
,
okText
:
'确认'
,
cancelText
:
'取消'
,
onOk
()
{
// 执行删除逻辑
createMessage
.
success
(
'删除成功!'
)
},
onCancel
()
{
console
.
log
(
'取消删除'
);
createMessage
.
info
(
'取消删除'
)
},
});
};
</
script
>
src/views/dataSharingAndExchange/catalogingManagement/MoveTreeModal.vue
0 → 100644
View file @
44b00f0f
<
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
{
AddTreeSchema
,
MoveFormSchema
}
from
'./institution.data'
;
import
{
useMessage
}
from
'@/hooks/web/useMessage'
;
import
{
TreeData
}
from
"@/views/system/institution/institutionData"
;
defineOptions
({
name
:
'AccountModal'
});
const
emit
=
defineEmits
([
'success'
,
'register'
]);
const
{
createMessage
}
=
useMessage
();
const
isUpdate
=
ref
(
true
);
const
isMove
=
ref
(
false
);
const
rowId
=
ref
(
''
)
const
form
=
ref
([])
//获取接口数据并放在下拉框里(这里是打开了一个弹框)
//初始化表单
const
[
registerForm
,
{
setFieldsValue
,
updateSchema
,
resetFields
,
validate
}]
=
useForm
({
labelWidth
:
100
,
baseColProps
:
{
lg
:
12
,
md
:
24
},
schemas
:
MoveFormSchema
,
showActionButtonGroup
:
false
,
actionColOptions
:
{
span
:
23
,
},
});
//初始化弹框
const
[
registerModal
,
{
setModalProps
,
closeModal
}]
=
useModalInner
(
async
(
data
)
=>
{
resetFields
();
setModalProps
({
confirmLoading
:
false
});
form
.
value
=
data
.
record
const
formData
=
{
institutionId
:
data
.
record
.
parentId
,
}
// 塞值
setFieldsValue
({
...
formData
,
});
const
treeList
=
handleTree
(
TreeData
,
'businessId'
,
undefined
,
undefined
,
undefined
)
updateSchema
([
{
field
:
'institutionId'
,
componentProps
:
{
treeData
:
treeList
},
},
]);
});
const
getTitle
=
computed
(()
=>
(
'移动'
));
function
handleTree
(
data
,
id
,
parentId
,
children
,
rootId
)
{
id
=
id
||
'id'
parentId
=
parentId
||
'parentId'
children
=
children
||
'children'
rootId
=
rootId
||
Math
.
min
.
apply
(
Math
,
data
.
map
(
item
=>
{
return
item
[
parentId
]
}))
||
0
// 对源数据深度克隆
const
cloneData
=
JSON
.
parse
(
JSON
.
stringify
(
data
))
// 循环所有项
const
treeData
=
cloneData
.
filter
(
father
=>
{
const
branchArr
=
cloneData
.
filter
(
child
=>
{
// 返回每一项的子级数组
return
father
[
id
]
===
child
[
parentId
]
})
branchArr
.
length
>
0
?
father
.
children
=
branchArr
:
''
// 返回第一层
return
father
[
parentId
]
===
rootId
})
return
treeData
!==
''
?
treeData
:
data
}
/**确定按钮*/
async
function
handleSubmit
()
{
const
values
=
await
validate
();
createMessage
.
success
(
'移动成功'
)
closeModal
()
}
// 格式化日期
function
formatDate
(
date
)
{
const
year
=
date
.
getFullYear
();
const
month
=
String
(
date
.
getMonth
()
+
1
).
padStart
(
2
,
'0'
);
// 月份从0开始,需要加1
const
day
=
String
(
date
.
getDate
()).
padStart
(
2
,
'0'
);
const
hours
=
String
(
date
.
getHours
()).
padStart
(
2
,
'0'
);
const
minutes
=
String
(
date
.
getMinutes
()).
padStart
(
2
,
'0'
);
const
seconds
=
String
(
date
.
getSeconds
()).
padStart
(
2
,
'0'
);
return
`
${
year
}
-
${
month
}
-
${
day
}
${
hours
}
:
${
minutes
}
:
${
seconds
}
`
;
}
</
script
>
src/views/dataSharingAndExchange/catalogingManagement/UpdateTreeModal.vue
0 → 100644
View file @
44b00f0f
<
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
{
AddTreeSchema
}
from
'./institution.data'
;
import
{
useMessage
}
from
'@/hooks/web/useMessage'
;
import
{
TreeData
}
from
"@/views/system/institution/institutionData"
;
defineOptions
({
name
:
'AccountModal'
});
const
emit
=
defineEmits
([
'success'
,
'register'
]);
const
{
createMessage
}
=
useMessage
();
const
isUpdate
=
ref
(
true
);
const
isMove
=
ref
(
false
);
const
isAdd
=
ref
(
false
);
const
rowId
=
ref
(
''
);
//获取接口数据并放在下拉框里(这里是打开了一个弹框)
//初始化表单
const
[
registerForm
,
{
setFieldsValue
,
updateSchema
,
resetFields
,
validate
}]
=
useForm
({
labelWidth
:
100
,
baseColProps
:
{
lg
:
12
,
md
:
24
},
schemas
:
AddTreeSchema
,
showActionButtonGroup
:
false
,
actionColOptions
:
{
span
:
23
,
},
});
//初始化弹框
const
[
registerModal
,
{
setModalProps
,
closeModal
}]
=
useModalInner
(
async
(
data
)
=>
{
resetFields
();
setModalProps
({
confirmLoading
:
false
});
//修改
isAdd
.
value
=
!!
data
?.
isAdd
;
//修改
isUpdate
.
value
=
!!
data
?.
isUpdate
;
if
(
unref
(
isUpdate
))
{
//修改
// 获取行数据的id
rowId
.
value
=
data
.
record
.
businessId
;
const
formData
=
{
institutionId
:
data
.
record
.
parentId
,
institutionName
:
data
.
record
.
anotherName
,
code
:
data
.
record
.
code
}
// 塞值
setFieldsValue
({
...
formData
,
});
}
else
if
(
unref
(
isAdd
)){
//新增
}
const
treeList
=
handleTree
(
TreeData
,
'businessId'
,
undefined
,
undefined
,
undefined
)
updateSchema
([
{
field
:
'institutionId'
,
componentProps
:
{
treeData
:
treeList
},
},
]);
});
const
getTitle
=
computed
(()
=>
(
!
unref
(
isUpdate
)
?
'新增机构'
:
'编辑机构'
));
function
handleTree
(
data
,
id
,
parentId
,
children
,
rootId
)
{
id
=
id
||
'id'
parentId
=
parentId
||
'parentId'
children
=
children
||
'children'
rootId
=
rootId
||
Math
.
min
.
apply
(
Math
,
data
.
map
(
item
=>
{
return
item
[
parentId
]
}))
||
0
// 对源数据深度克隆
const
cloneData
=
JSON
.
parse
(
JSON
.
stringify
(
data
))
// 循环所有项
const
treeData
=
cloneData
.
filter
(
father
=>
{
const
branchArr
=
cloneData
.
filter
(
child
=>
{
// 返回每一项的子级数组
return
father
[
id
]
===
child
[
parentId
]
})
branchArr
.
length
>
0
?
father
.
children
=
branchArr
:
''
// 返回第一层
return
father
[
parentId
]
===
rootId
})
return
treeData
!==
''
?
treeData
:
data
}
/**确定按钮*/
async
function
handleSubmit
()
{
const
values
=
await
validate
();
if
(
unref
(
isUpdate
)){
createMessage
.
success
(
'修改成功'
)
closeModal
()
}
else
if
(
!
unref
(
isUpdate
)){
createMessage
.
success
(
'新增成功'
)
closeModal
()
}
}
// 格式化日期
function
formatDate
(
date
)
{
const
year
=
date
.
getFullYear
();
const
month
=
String
(
date
.
getMonth
()
+
1
).
padStart
(
2
,
'0'
);
// 月份从0开始,需要加1
const
day
=
String
(
date
.
getDate
()).
padStart
(
2
,
'0'
);
const
hours
=
String
(
date
.
getHours
()).
padStart
(
2
,
'0'
);
const
minutes
=
String
(
date
.
getMinutes
()).
padStart
(
2
,
'0'
);
const
seconds
=
String
(
date
.
getSeconds
()).
padStart
(
2
,
'0'
);
return
`
${
year
}
-
${
month
}
-
${
day
}
${
hours
}
:
${
minutes
}
:
${
seconds
}
`
;
}
</
script
>
src/views/dataSharingAndExchange/catalogingManagement/index.vue
0 → 100644
View file @
44b00f0f
<
template
>
<PageWrapper
dense
contentFullHeight
fixedHeight
contentClass=
"flex"
>
<DeptTree
class=
"w-1/4 xl:w-1/5"
@
select=
"handleSelect"
/>
<BasicTable
@
register=
"registerTable"
class=
"w-3/4 xl:w-4/5"
:searchInfo=
"searchInfo"
>
<template
#
toolbar
>
<a-button
type=
"primary"
@
click=
"handleCreate"
>
新增
</a-button>
<a-button
type=
"primary"
@
click=
"handleDeleteBatch"
>
批量删除
</a-button>
<a-button
type=
"primary"
@
click=
"handleMoveBatch"
>
批量移动
</a-button>
</
template
>
<
template
#
bodyCell=
"{ column, record }"
>
<template
v-if=
"column.key === 'action'"
>
<TableAction
:actions=
"[
{
// icon: 'clarity:note-edit-line',
label: '编辑',
onClick: handleEdit.bind(null, record),
},
{
color: 'error',
label: '删除',
popConfirm: {
title: '是否确认删除',
placement: 'left',
confirm: handleDelete.bind(null, record),
},
},
{
label: '移动',
onClick: handleMove.bind(null, record),
},
]"
/>
</
template
>
</template>
</BasicTable>
<AccountModal
@
register=
"registerModal"
@
success=
"handleSuccess"
/>
<MoveUser
@
register=
"registerMoveUser"
@
success=
"handleMoveSuccess"
/>
<AddUserModal
@
register=
"registerAddUserModal"
@
success=
"handleAddSuccess"
/>
</PageWrapper>
</template>
<
script
lang=
"ts"
setup
>
import
{
reactive
,
unref
,
onDeactivated
,
onMounted
,
ref
}
from
'vue'
;
import
{
BasicTable
,
useTable
,
TableAction
}
from
'@/components/Table'
;
import
{
getAccountList
,
deleteUser
,
exportUserList
}
from
'@/api/system/user/user'
;
import
{
PageWrapper
}
from
'@/components/Page'
;
import
DeptTree
from
'./DeptTree.vue'
;
import
{
useMessage
}
from
'@/hooks/web/useMessage'
;
import
{
useModal
}
from
'@/components/Modal'
;
import
AccountModal
from
'./AccountModal.vue'
;
import
importModal
from
'./importModal.vue'
;
import
MoveUser
from
'./moveUser.vue'
;
import
{
columns
,
searchFormSchema
}
from
'./institution.data'
;
import
{
useGo
}
from
'@/hooks/web/usePage'
;
import
{
downloadByData
}
from
'@/utils/file/download'
;
import
{
useRoute
,
onBeforeRouteLeave
}
from
'vue-router'
;
import
{
useFilterStore
}
from
'@/store/modules/filterData'
;
import
{
useUserStore
}
from
"@/store/modules/user"
;
import
{
getMenuListByPage
}
from
"@/api/system/menu/menu"
;
import
{
userData
}
from
"@/views/system/institution/institutionData"
;
import
AddUserModal
from
'./AddUserModal.vue'
;
import
user
from
"../../../../mock/sys/user"
;
import
{
forEach
}
from
"lodash-es"
;
defineOptions
({
name
:
'AccountManagement'
});
const
{
createMessage
,
createConfirm
}
=
useMessage
();
const
filterStore
=
useFilterStore
();
const
route
=
useRoute
();
const
go
=
useGo
();
const
[
registerModal
,
{
openModal
}]
=
useModal
();
const
[
registerAddUserModal
,
{
openModal
:
addUserModal
}]
=
useModal
();
const
[
registerMoveUser
,
{
openModal
:
openMoveUserModal
}]
=
useModal
();
const
searchInfo
=
reactive
<
Recordable
>
({});
const
tableData
=
ref
([])
const
[
registerTable
,
{
reload
,
updateTableDataRecord
,
getSearchInfo
,
getForm
,
getRowSelection
}]
=
useTable
({
title
:
'用户管理列表'
,
api
:
async
(
params
)
=>
{
console
.
log
(
params
)
const
response
=
{
pageNu
:
"1"
,
pageSize
:
"10"
,
pages
:
"1"
,
total
:
tableData
.
value
.
length
,
code
:
''
,
message
:
''
,
data
:
[],
};
//过滤data中的数据,取出等于params.deptId的数据
var
data
=
[]
//按照部门筛选 如果有进行过滤相应部门的 没有就赋值全部
if
(
params
.
institutionId
!=
undefined
&&
params
.
institutionId
!=
''
){
data
=
tableData
.
value
.
filter
((
item
)
=>
item
.
institutionId
===
params
.
institutionId
);
}
else
{
data
=
tableData
.
value
}
if
(
params
.
name
!=
undefined
&&
params
.
name
!=
''
&&
params
.
name
!=
null
){
//过滤出名字包含params.name的数据
data
=
data
.
filter
((
item
)
=>
item
.
name
.
includes
(
params
.
name
));
}
if
(
params
.
username
!=
undefined
&&
params
.
username
!=
''
&&
params
.
username
!=
null
){
data
=
data
.
filter
((
item
)
=>
item
.
username
.
includes
(
params
.
username
));
}
return
{
...
response
,
data
:
data
};
},
rowKey
:
'businessId'
,
columns
,
rowSelection
:
true
,
formConfig
:
{
labelWidth
:
120
,
schemas
:
searchFormSchema
,
autoSubmitOnEnter
:
true
,
resetFunc
:
()
=>
{
searchInfo
.
institutionId
=
''
},
},
useSearchForm
:
true
,
showTableSetting
:
false
,
bordered
:
true
,
handleSearchInfoFn
(
info
)
{
return
info
;
},
actionColumn
:
{
width
:
150
,
title
:
'操作'
,
dataIndex
:
'action'
,
},
});
/** 新增按钮*/
function
handleCreate
()
{
addUserModal
(
true
,
{
isAdd
:
true
,
});
}
/**批量移动*/
function
handleMoveBatch
()
{
const
rowSelection
=
getRowSelection
().
selectedRowKeys
;
openMoveUserModal
(
true
,
{
idList
:
rowSelection
,
isMove
:
true
,
});
}
/** 移动按钮*/
function
handleMove
(
record
:
Recordable
)
{
openMoveUserModal
(
true
,
{
record
,
isMove
:
true
,
});
}
/** 编辑按钮*/
function
handleEdit
(
record
:
Recordable
)
{
openModal
(
true
,
{
record
,
isUpdate
:
true
,
});
}
/**批量删除*/
function
handleDeleteBatch
()
{
createConfirm
({
iconType
:
'warning'
,
title
:
'确认删除'
,
content
:
'确认批量删除选中数据吗?'
,
onOk
()
{
const
rowSelection
=
getRowSelection
().
selectedRowKeys
;
for
(
let
i
=
0
;
i
<
rowSelection
.
length
;
i
++
){
tableData
.
value
.
splice
(
tableData
.
value
.
findIndex
(
item
=>
item
.
businessId
===
rowSelection
[
i
]),
1
);
}
createMessage
.
success
(
'删除成功!'
);
reload
();
},
});
}
/** 删除按钮*/
function
handleDelete
(
record
:
Recordable
)
{
tableData
.
value
.
splice
(
tableData
.
value
.
findIndex
(
item
=>
item
.
businessId
===
record
.
businessId
),
1
);
createMessage
.
success
(
'删除成功!'
);
reload
();
}
/** 导出按钮*/
async
function
handleExport
()
{
const
params
=
Object
.
assign
({},
getSearchInfo
(),
getForm
().
getFieldsValue
());
const
data
=
await
exportUserList
(
params
);
downloadByData
(
data
,
'用户列表'
+
'.xlsx'
);
}
/** 导入成功*/
function
handleImportSuccess
()
{
reload
();
}
/** 新增/编辑成功*/
function
handleSuccess
({
isUpdate
,
values
})
{
if
(
isUpdate
)
{
// 注意:updateTableDataRecord要求表格的rowKey属性为string并且存在于每一行的record的keys中
//修改表单的值
const
result
=
updateTableDataRecord
(
values
.
businessId
,
values
);
reload
();
}
else
{
tableData
.
value
.
push
(
values
)
reload
();
}
}
/** 移动*/
function
handleMoveSuccess
({
isMove
,
values
})
{
const
rowSelection
=
getRowSelection
().
selectedRowKeys
;
if
(
rowSelection
.
length
>
0
){
//批量移动
for
(
let
i
=
0
;
i
<
rowSelection
.
length
;
i
++
){
const
result
=
updateTableDataRecord
(
values
[
i
].
institutionId
,
values
[
i
]);
}
}
else
{
//单个移动
const
result
=
updateTableDataRecord
(
values
.
businessId
,
values
);
}
reload
();
}
/** 添加用户*/
function
handleAddSuccess
({
isAdd
,
values
,
length
})
{
if
(
length
>
0
){
//批量添加
for
(
let
i
=
0
;
i
<
length
;
i
++
){
tableData
.
value
.
push
(
values
[
i
])
}
}
reload
();
}
/** 部门树的select*/
function
handleSelect
(
institutionId
=
''
)
{
searchInfo
.
institutionId
=
institutionId
;
reload
();
}
function
handleView
(
record
:
Recordable
)
{
go
(
'/system/account_detail/'
+
record
.
id
);
}
onMounted
(()
=>
{
tableData
.
value
=
userData
const
path
=
route
.
path
if
(
filterStore
.
getSearchParams
[
path
])
{
if
(
JSON
.
parse
(
filterStore
.
getSearchParams
[
path
]
!==
{})){
const
params
=
JSON
.
parse
(
filterStore
.
getSearchParams
[
path
])
getForm
().
setFieldsValue
({
page
:
params
.
page
,
pageSize
:
params
.
pageSize
,
username
:
params
.
username
,
flag
:
params
.
flag
,
})
searchInfo
.
institutionId
=
params
.
institutionId
}
}
});
onBeforeRouteLeave
((
to
,
from
,
next
)
=>
{
const
params
=
Object
.
assign
({},
getSearchInfo
(),
getForm
().
getFieldsValue
());
filterStore
.
setSearchParams
(
{
path
:
from
.
path
,
param
:
{
...
params
}
}
)
next
();
// 允许导航
});
</
script
>
src/views/dataSharingAndExchange/catalogingManagement/institution.data.ts
0 → 100644
View file @
44b00f0f
import
{
getAllRoleList
}
from
'@/api/system/role/role'
;
import
{
BasicColumn
,
FormSchema
}
from
'@/components/Table'
;
import
{
h
}
from
"vue"
;
import
{
Tag
}
from
"ant-design-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
columns
:
BasicColumn
[]
=
[
{
title
:
'姓名'
,
dataIndex
:
'name'
,
width
:
150
,
},
{
title
:
'登录名'
,
dataIndex
:
'username'
,
width
:
150
,
},
{
title
:
'创建时间'
,
dataIndex
:
'createDate'
,
width
:
150
,
},
{
title
:
'所属机构'
,
dataIndex
:
'institutionName'
,
width
:
150
,
// customRender: ({ value }) => {
// return deptMap[value];
// },
},
];
export
const
searchFormSchema
:
FormSchema
[]
=
[
{
field
:
'name'
,
label
:
'姓名'
,
component
:
'Input'
,
componentProps
:
{
placeholder
:
'请输入姓名'
,
},
colProps
:
{
span
:
7
},
},
{
field
:
'username'
,
label
:
'登录名'
,
component
:
'Input'
,
componentProps
:
{
placeholder
:
'请输入登录名'
,
},
colProps
:
{
span
:
7
},
},
];
export
const
accountFormSchema
:
any
[]
=
[
{
field
:
'name'
,
label
:
'姓名'
,
component
:
'Input'
,
colProps
:
{
lg
:
24
,
md
:
24
},
rules
:
[
{
required
:
true
,
message
:
'请输入姓名'
,
},
],
},
{
field
:
'username'
,
label
:
'登录名'
,
component
:
'Input'
,
colProps
:
{
lg
:
24
,
md
:
24
},
rules
:
[
{
required
:
true
,
message
:
'请输入登录名'
,
},
],
},
{
field
:
'username'
,
label
:
'用户名称'
,
component
:
'Input'
,
colProps
:
{
lg
:
24
,
md
:
24
},
rules
:
[
{
required
:
true
,
message
:
'请输入登录名'
,
},
],
},
{
field
:
'institutionId'
,
label
:
'所属机构'
,
component
:
'TreeSelect'
,
colProps
:
{
lg
:
24
,
md
:
24
},
componentProps
:
{
fieldNames
:
{
label
:
'institutionName'
,
value
:
'businessId'
,
},
getPopupContainer
:
()
=>
document
.
body
,
},
required
:
true
,
},
];
/**移动*/
export
const
MoveFormSchema
:
any
[]
=
[
{
field
:
'institutionId'
,
label
:
'目标机构'
,
component
:
'TreeSelect'
,
colProps
:
{
lg
:
24
,
md
:
24
},
componentProps
:
{
fieldNames
:
{
label
:
'institutionName'
,
value
:
'businessId'
,
},
getPopupContainer
:
()
=>
document
.
body
,
},
required
:
true
,
},
]
/**新增*/
export
const
AddTreeSchema
:
any
[]
=
[
{
field
:
'institutionName'
,
label
:
'机构名称'
,
component
:
'Input'
,
colProps
:
{
lg
:
24
,
md
:
24
},
rules
:
[
{
required
:
true
,
message
:
'请输入姓名'
,
},
],
},
{
field
:
'institutionId'
,
label
:
'上级机构'
,
component
:
'TreeSelect'
,
colProps
:
{
lg
:
24
,
md
:
24
},
componentProps
:
{
fieldNames
:
{
label
:
'institutionName'
,
value
:
'businessId'
,
},
getPopupContainer
:
()
=>
document
.
body
,
},
required
:
true
,
},
{
field
:
'code'
,
label
:
'机构编码'
,
component
:
'Input'
,
colProps
:
{
lg
:
24
,
md
:
24
},
rules
:
[
{
required
:
true
,
message
:
'请输入机构编码'
,
},
],
},
]
src/views/dataSharingAndExchange/catalogingManagement/institutionData.ts
0 → 100644
View file @
44b00f0f
import
{
getAllRoleList
}
from
'@/api/system/role/role'
;
import
{
BasicColumn
,
FormSchema
}
from
'@/components/Table'
;
import
{
h
}
from
"vue"
;
import
{
Tag
}
from
"ant-design-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
columns
:
BasicColumn
[]
=
[
{
title
:
'姓名'
,
dataIndex
:
'name'
,
width
:
150
,
},
{
title
:
'登录名'
,
dataIndex
:
'username'
,
width
:
150
,
},
{
title
:
'用户角色'
,
dataIndex
:
'roleName'
,
width
:
150
,
},
{
title
:
'创建时间'
,
dataIndex
:
'createDate'
,
width
:
150
,
},
];
export
const
searchFormSchema
:
FormSchema
[]
=
[
{
field
:
'name'
,
label
:
'姓名'
,
component
:
'Input'
,
componentProps
:
{
placeholder
:
'请输入姓名'
,
},
colProps
:
{
span
:
7
},
},
{
field
:
'username'
,
label
:
'登录名'
,
component
:
'Input'
,
componentProps
:
{
placeholder
:
'请输入登录名'
,
},
colProps
:
{
span
:
7
},
},
];
export
const
TreeData
:
any
[]
=
[
{
"delFlag"
:
"0"
,
"flag"
:
"1"
,
"businessId"
:
100
,
"institutionName"
:
"机构管理"
,
"anotherName"
:
"机构管理"
,
"parentId"
:
0
,
"code"
:
"DataGovernanceDep_product1"
,
"ancestors"
:
"0"
,
"orderNum"
:
0
,
"children"
:
[
],
"selectType"
:
null
,
icon
:
'ion:settings-outline'
,
},
{
"delFlag"
:
"0"
,
"flag"
:
"1"
,
"businessId"
:
101
,
"institutionName"
:
"数据平台治理部"
,
"anotherName"
:
"数据平台治理部"
,
"parentId"
:
100
,
"code"
:
"DataGovernanceDep_product2"
,
"ancestors"
:
"0,100"
,
"orderNum"
:
1
,
"children"
:
[
],
"selectType"
:
null
,
icon
:
'ion:settings-outline'
,
},
{
"delFlag"
:
"0"
,
"flag"
:
"1"
,
"businessId"
:
107
,
"institutionName"
:
"数据资源管理部"
,
"anotherName"
:
"数据资源管理部"
,
"parentId"
:
100
,
"code"
:
"DataGovernanceDep_product3"
,
"ancestors"
:
"0,100"
,
"orderNum"
:
2
,
"children"
:
[
],
"selectType"
:
null
,
icon
:
'ion:settings-outline'
,
},
{
"delFlag"
:
"0"
,
"flag"
:
"1"
,
"businessId"
:
102
,
"institutionName"
:
"研发部门"
,
"anotherName"
:
"研发部门"
,
"parentId"
:
101
,
"code"
:
"DataGovernanceDep_product4"
,
"ancestors"
:
"0,100,101"
,
"orderNum"
:
1
,
"children"
:
[
],
"selectType"
:
null
,
icon
:
'ion:settings-outline'
,
},
{
"delFlag"
:
"0"
,
"flag"
:
"1"
,
"businessId"
:
103
,
"institutionName"
:
"市场部门"
,
"anotherName"
:
"市场部门"
,
"parentId"
:
101
,
"code"
:
"DataGovernanceDep_product5"
,
"ancestors"
:
"0,100,101"
,
"orderNum"
:
2
,
"children"
:
[
],
"selectType"
:
null
,
icon
:
'ion:settings-outline'
,
},
{
"delFlag"
:
"0"
,
"flag"
:
"1"
,
"businessId"
:
104
,
"institutionName"
:
"测试部门"
,
"anotherName"
:
"测试部门"
,
"parentId"
:
101
,
"code"
:
"DataGovernanceDep_product6"
,
"ancestors"
:
"0,100,101"
,
"orderNum"
:
3
,
"children"
:
[
],
"selectType"
:
null
,
icon
:
'ion:settings-outline'
,
},
{
"delFlag"
:
"0"
,
"flag"
:
"1"
,
"businessId"
:
105
,
"institutionName"
:
"财务部门"
,
"anotherName"
:
"财务部门"
,
"parentId"
:
101
,
"code"
:
"DataGovernanceDep_product7"
,
"ancestors"
:
"0,100,101"
,
"orderNum"
:
4
,
"children"
:
[
],
"selectType"
:
null
,
icon
:
'ion:settings-outline'
,
},
{
"delFlag"
:
"0"
,
"flag"
:
"1"
,
"businessId"
:
106
,
"institutionName"
:
"运维部门"
,
"anotherName"
:
"运维部门"
,
"parentId"
:
101
,
"code"
:
"DataGovernanceDep_product8"
,
"ancestors"
:
"0,100,101"
,
"orderNum"
:
5
,
"children"
:
[
],
"selectType"
:
null
,
icon
:
'ion:settings-outline'
,
},
{
"delFlag"
:
"0"
,
"flag"
:
"1"
,
"businessId"
:
202
,
"institutionName"
:
"数据部门"
,
"anotherName"
:
"数据部门"
,
"parentId"
:
107
,
"code"
:
"DataGovernanceDep_product9"
,
"ancestors"
:
"0,100,107"
,
"orderNum"
:
1
,
"children"
:
[
],
"selectType"
:
null
,
icon
:
'ion:settings-outline'
,
},
{
"delFlag"
:
"0"
,
"flag"
:
"0"
,
"businessId"
:
203
,
"institutionName"
:
"检查部门"
,
"anotherName"
:
"检查部门"
,
"parentId"
:
107
,
"code"
:
"DataGovernanceDep_product10"
,
"ancestors"
:
"0,100,107"
,
"orderNum"
:
2
,
"children"
:
[
],
"selectType"
:
null
,
icon
:
'ion:settings-outline'
,
},
];
export
const
userData
:
any
[]
=
[
{
"delFlag"
:
"0"
,
"flag"
:
"1"
,
"businessId"
:
309
,
"username"
:
"yonghu1"
,
"nickName"
:
"测试用户1"
,
"userType"
:
"1"
,
"name"
:
"测试用户1"
,
"createDate"
:
"2024-10-24 10:04:04"
,
"institutionId"
:
105
,
"institutionName"
:
"财务部门"
,
"code"
:
"123f"
,
"identity"
:
"1"
,
"roleIds"
:
null
,
"roleNames"
:
"三级用户"
,
"roleList"
:
null
,
"menuList"
:
[
]
},
{
"delFlag"
:
"0"
,
"flag"
:
"1"
,
"businessId"
:
310
,
"username"
:
"yonghu2"
,
"nickName"
:
"测试用户2"
,
"userType"
:
"1"
,
"name"
:
"测试用户2"
,
"createDate"
:
"2024-10-25 10:05:05"
,
"sex"
:
"0"
,
"institutionId"
:
105
,
"institutionName"
:
"财务部门"
,
"code"
:
"123a"
,
"identity"
:
"1"
,
"roleIds"
:
null
,
"roleNames"
:
null
,
"roleList"
:
null
,
"menuList"
:
[
]
},
{
"delFlag"
:
"0"
,
"flag"
:
"1"
,
"businessId"
:
317
,
"username"
:
"yonghu3"
,
"nickName"
:
"测试用户3"
,
"userType"
:
"1"
,
"name"
:
"测试用户3"
,
"createDate"
:
"2024-10-26 10:06:06"
,
"sex"
:
"1"
,
"institutionId"
:
102
,
"institutionName"
:
"研发部门"
,
"code"
:
"123c"
,
"identity"
:
"1"
,
"roleIds"
:
null
,
"roleNames"
:
"超级管理员"
,
"roleList"
:
null
,
"menuList"
:
[]
},
{
"delFlag"
:
"0"
,
"flag"
:
"1"
,
"businessId"
:
318
,
"username"
:
"yonghu4"
,
"nickName"
:
"测试用户4"
,
"userType"
:
"1"
,
"name"
:
"测试用户4"
,
"createDate"
:
"2024-10-26 10:06:06"
,
"sex"
:
"1"
,
"institutionId"
:
102
,
"institutionName"
:
"研发部门"
,
"code"
:
"123b"
,
"identity"
:
"1"
,
"roleIds"
:
null
,
"roleNames"
:
"超级管理员"
,
"roleList"
:
null
,
"menuList"
:
[]
},
{
"delFlag"
:
"0"
,
"flag"
:
"1"
,
"businessId"
:
319
,
"username"
:
"yonghu5"
,
"nickName"
:
"测试用户5"
,
"userType"
:
"1"
,
"name"
:
"测试用户5"
,
"createDate"
:
"2024-10-26 10:06:06"
,
"sex"
:
"1"
,
"institutionId"
:
102
,
"institutionName"
:
"研发部门"
,
"code"
:
"123x"
,
"identity"
:
"1"
,
"roleIds"
:
null
,
"roleNames"
:
"超级管理员"
,
"roleList"
:
null
,
"menuList"
:
[]
}
];
export
const
addUserData
:
any
[]
=
[
{
"delFlag"
:
"0"
,
"flag"
:
"1"
,
"businessId"
:
400
,
"username"
:
"tianjia1"
,
"nickName"
:
"添加用户1"
,
"userType"
:
"1"
,
"name"
:
"添加用户1"
,
"roleName"
:
"工作区访客"
,
"createDate"
:
"2024-10-24 10:04:04"
,
"institutionId"
:
null
,
"institutionName"
:
""
,
"code"
:
"123f"
,
"identity"
:
"1"
,
"roleIds"
:
null
,
"roleNames"
:
"三级用户"
,
"roleList"
:
null
,
"menuList"
:
[
]
},
{
"delFlag"
:
"0"
,
"flag"
:
"1"
,
"businessId"
:
402
,
"username"
:
"tianjia2"
,
"nickName"
:
"添加用户2"
,
"userType"
:
"1"
,
"name"
:
"添加用户2"
,
"roleName"
:
"工作区访客"
,
"createDate"
:
"2024-10-25 10:05:05"
,
"sex"
:
"0"
,
"institutionId"
:
null
,
"institutionName"
:
""
,
"code"
:
"123a"
,
"identity"
:
"1"
,
"roleIds"
:
null
,
"roleNames"
:
null
,
"roleList"
:
null
,
"menuList"
:
[
]
},
{
"delFlag"
:
"0"
,
"flag"
:
"1"
,
"businessId"
:
403
,
"username"
:
"tianjia3"
,
"nickName"
:
"添加用户3"
,
"userType"
:
"1"
,
"name"
:
"添加用户3"
,
"roleName"
:
"工作区访客"
,
"createDate"
:
"2024-10-26 10:06:06"
,
"sex"
:
"1"
,
"institutionId"
:
null
,
"institutionName"
:
""
,
"code"
:
"123c"
,
"identity"
:
"1"
,
"roleIds"
:
null
,
"roleNames"
:
"超级管理员"
,
"roleList"
:
null
,
"menuList"
:
[]
},
];
export
const
accountFormSchema
:
any
[]
=
[
];
src/views/dataSharingAndExchange/catalogingManagement/moveUser.vue
0 → 100644
View file @
44b00f0f
<
template
>
<BasicModal
v-bind=
"$attrs"
@
register=
"registerModal"
:title=
"getTitle"
@
ok=
"handleSubmit"
minHeight=
"50"
>
<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
{
accountFormSchema
,
MoveFormSchema
,
resetPasswordFormSchema
}
from
'./institution.data'
;
import
{
getDeptList
}
from
'@/api/system/dept/dept'
;
import
{
resetUserPwd
}
from
'@/api/system/user/user'
import
{
encryptTwo
}
from
'../../../../src/utils/jsencrypt.js'
import
{
useMessage
}
from
'@/hooks/web/useMessage'
;
import
{
TreeData
,
userData
}
from
"@/views/system/institution/institutionData"
;
defineOptions
({
name
:
'AccountModal'
});
const
emit
=
defineEmits
([
'success'
,
'register'
]);
const
{
createMessage
}
=
useMessage
();
const
isUpdate
=
ref
(
true
);
const
rowId
=
ref
(
''
);
const
idList
=
ref
([])
const
rowData
=
ref
([])
//获取接口数据并放在下拉框里(这里是打开了一个弹框)
//初始化表单
const
[
registerForm
,
{
setFieldsValue
,
updateSchema
,
resetFields
,
validate
}]
=
useForm
({
labelWidth
:
100
,
baseColProps
:
{
span
:
24
},
schemas
:
MoveFormSchema
,
showActionButtonGroup
:
false
,
actionColOptions
:
{
span
:
23
,
},
});
//初始化弹框
const
[
registerModal
,
{
setModalProps
,
closeModal
}]
=
useModalInner
(
async
(
data
)
=>
{
//每次点击弹窗 需要清空存储的数据
rowData
.
value
=
[]
//重置表单数据
resetFields
();
setModalProps
({
confirmLoading
:
false
});
if
(
data
.
idList
!=
null
&&
data
.
idList
!=
undefined
&&
data
.
idList
.
length
>
0
){
//批量移动
//根据id查用户信息
idList
.
value
=
data
.
idList
;
//过滤出userData中businessId与idList相等的数据
const
result
=
userData
.
filter
(
item
=>
data
.
idList
.
includes
(
item
.
businessId
));
result
.
forEach
(
item
=>
{
rowData
.
value
.
push
(
item
)
})
}
else
{
rowData
.
value
.
push
(
data
.
record
)
//单个移动
rowId
.
value
=
data
.
record
.
businessId
;
setFieldsValue
({
...
data
.
record
,
});
}
const
treeList
=
handleTree
(
TreeData
,
'businessId'
,
undefined
,
undefined
,
undefined
)
updateSchema
([
{
field
:
'institutionId'
,
componentProps
:
{
treeData
:
treeList
},
},
]);
});
const
getTitle
=
computed
(()
=>
(
'移动用户'
));
/**确定按钮*/
async
function
handleSubmit
()
{
try
{
//校验并得到表单数据
const
values
=
await
validate
();
setModalProps
({
confirmLoading
:
true
});
//拿到表单里修改后的值 进行修改赋值 传给父组件
console
.
log
(
'rowData.value:'
,
rowData
.
value
)
rowData
.
value
.
forEach
(
item
=>
{
item
.
institutionId
=
values
.
institutionId
})
emit
(
'success'
,
{
values
:
{
...
rowData
.
value
}})
createMessage
.
success
(
'移动成功'
);
closeModal
();
}
finally
{
setModalProps
({
confirmLoading
:
false
});
}
}
/**数组对象转成树*/
function
handleTree
(
data
,
id
,
parentId
,
children
,
rootId
)
{
id
=
id
||
'id'
parentId
=
parentId
||
'parentId'
children
=
children
||
'children'
rootId
=
rootId
||
Math
.
min
.
apply
(
Math
,
data
.
map
(
item
=>
{
return
item
[
parentId
]
}))
||
0
// 对源数据深度克隆
const
cloneData
=
JSON
.
parse
(
JSON
.
stringify
(
data
))
// 循环所有项
const
treeData
=
cloneData
.
filter
(
father
=>
{
const
branchArr
=
cloneData
.
filter
(
child
=>
{
// 返回每一项的子级数组
return
father
[
id
]
===
child
[
parentId
]
})
branchArr
.
length
>
0
?
father
.
children
=
branchArr
:
''
// 返回第一层
return
father
[
parentId
]
===
rootId
})
return
treeData
!==
''
?
treeData
:
data
}
</
script
>
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