Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dsk-cr20g
Project
Project
Details
Activity
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
Administrator
dsk-cr20g
Commits
912a1656
Commit
912a1656
authored
Aug 29, 2023
by
huangjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
*
parent
78853fe7
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
233 additions
and
457 deletions
+233
-457
package.json
dsk-operate-ui/package.json
+1
-0
enterpriseManagement.js
...e-ui/src/api/enterpriseManagement/enterpriseManagement.js
+38
-0
login.js
dsk-operate-ui/src/api/login.js
+11
-3
Navbar.vue
dsk-operate-ui/src/layout/components/Navbar.vue
+12
-12
index.vue
dsk-operate-ui/src/views/enterpriseManagement/index.vue
+116
-282
programme.vue
dsk-operate-ui/src/views/enterpriseManagement/programme.vue
+21
-138
login.vue
dsk-operate-ui/src/views/login.vue
+34
-22
No files found.
dsk-operate-ui/package.json
View file @
912a1656
...
...
@@ -74,6 +74,7 @@
"connect"
:
"3.6.6"
,
"eslint"
:
"7.15.0"
,
"eslint-plugin-vue"
:
"7.2.0"
,
"js-base64"
:
"^3.7.5"
,
"lint-staged"
:
"10.5.3"
,
"runjs"
:
"4.4.2"
,
"sass"
:
"1.32.13"
,
...
...
dsk-operate-ui/src/api/enterpriseManagement/enterpriseManagement.js
View file @
912a1656
...
...
@@ -38,8 +38,46 @@ export function getTenantPackage(param) {
})
}
//租户列表
export
function
getTenantList
(
param
)
{
return
request
({
url
:
'/system/tenant/list'
,
method
:
'get'
,
params
:
param
})
}
//获取租户详情
export
function
getTenant
(
id
)
{
return
request
({
url
:
'/system/tenant/'
+
id
,
method
:
'get'
,
})
}
//修改租户
export
function
editTenant
(
data
)
{
return
request
({
url
:
'/system/tenant/'
,
method
:
'PUT'
,
data
:
data
,
})
}
//新增租户
export
function
saveTenant
(
data
)
{
return
request
({
url
:
'/system/tenant/'
,
method
:
'POST'
,
data
:
data
,
})
}
//删除租户
export
function
deleteTenant
(
ids
)
{
return
request
({
url
:
'/system/tenant/'
+
ids
,
method
:
'Delete'
,
})
}
dsk-operate-ui/src/api/login.js
View file @
912a1656
...
...
@@ -59,13 +59,21 @@ export function getCodeImg() {
}
//获取租户企业列表
export
function
getTenants
(
data
)
{
export
function
getTenants
()
{
return
request
({
url
:
'/user/tenants
?userName='
+
data
,
url
:
'/user/tenants
'
,
method
:
'post'
,
})
}
//
// 获取默认租户
export
function
defaultTenantid
()
{
return
request
({
url
:
'/user/default/tenant'
,
method
:
'post'
,
})
}
// 切换租户
export
function
changeTenants
(
data
)
{
return
request
({
...
...
dsk-operate-ui/src/layout/components/Navbar.vue
View file @
912a1656
...
...
@@ -86,8 +86,7 @@ export default {
methods
:
{
getTetant
(){
this
.
tenantId
=
getTenantid
()
getTenants
(
localStorage
.
getItem
(
'userphone'
)).
then
(
res
=>
{
// getTenants('15823584612').then(res=>{
getTenants
().
then
(
res
=>
{
if
(
res
.
code
==
200
){
this
.
tenanlist
=
res
.
data
}
...
...
@@ -105,16 +104,17 @@ export default {
}).
catch
(()
=>
{});
},
getorther
(
id
){
changeTenants
(
id
).
then
(
res
=>
{
console
.
log
(
res
)
if
(
res
.
code
==
200
){
setToken
(
res
.
data
.
token
)
setTenantid
(
id
)
store
.
commit
(
'SET_TOKEN'
,
res
.
data
.
token
)
location
.
reload
();
this
.
$router
.
push
({
path
:
this
.
redirect
||
"/"
}).
catch
(()
=>
{});
}
})
if
(
id
!=
this
.
tenantId
){
changeTenants
(
id
).
then
(
res
=>
{
if
(
res
.
code
==
200
){
setToken
(
res
.
data
.
token
)
setTenantid
(
id
)
store
.
commit
(
'SET_TOKEN'
,
res
.
data
.
token
)
location
.
reload
();
this
.
$router
.
push
({
path
:
this
.
redirect
||
"/"
}).
catch
(()
=>
{});
}
})
}
}
}
}
...
...
dsk-operate-ui/src/views/enterpriseManagement/index.vue
View file @
912a1656
This diff is collapsed.
Click to expand it.
dsk-operate-ui/src/views/enterpriseManagement/programme.vue
View file @
912a1656
...
...
@@ -41,7 +41,7 @@
<right-toolbar
:showSearch
.
sync=
"showSearch"
@
queryTable=
"getList"
></right-toolbar>
</el-row>
<el-table
v-loading=
"loading"
:data=
"
role
List"
@
selection-change=
"handleSelectionChange"
>
<el-table
v-loading=
"loading"
:data=
"
pack
List"
@
selection-change=
"handleSelectionChange"
>
<el-table-column
type=
"selection"
width=
"55"
align=
"center"
/>
<el-table-column
label=
"序号"
width=
"60"
>
<template
slot-scope=
"scope"
>
...
...
@@ -74,7 +74,7 @@
</
template
>
</el-table-column>
<el-table-column
label=
"操作"
align=
"center"
class-name=
"small-padding fixed-width"
>
<
template
slot-scope=
"scope"
v-if=
"scope.row.packageId !== 1"
>
<
template
slot-scope=
"scope"
>
<el-button
size=
"mini"
type=
"text"
...
...
@@ -147,8 +147,7 @@
</template>
<
script
>
import
{
listRole
,
getRole
,
delRole
,
addRole
,
updateRole
,
dataScope
,
changeRoleStatus
,
deptTreeSelect
}
from
"@/api/system/role"
;
import
{
treeselect
as
menuTreeselect
,
roleMenuTreeselect
}
from
"@/api/system/menu"
;
import
{
treeselect
as
menuTreeselect
}
from
"@/api/system/menu"
;
import
{
addTenantPackage
,
getTenantPackage
,
detailTenantPackage
,
saveTenantPackage
,
deleteTenantPackage
}
from
"@/api/enterpriseManagement/enterpriseManagement"
;
...
...
@@ -171,8 +170,8 @@
showSearch
:
true
,
// 总条数
total
:
0
,
//
角色
表格数据
role
List
:
[],
//
方案
表格数据
pack
List
:
[],
// 弹出层标题
title
:
""
,
// 是否显示弹出层
...
...
@@ -182,32 +181,8 @@
menuExpand
:
false
,
menuNodeAll
:
false
,
deptExpand
:
true
,
deptNodeAll
:
false
,
// 日期范围
dateRange
:
[],
// 数据范围选项
dataScopeOptions
:
[
{
value
:
"1"
,
label
:
"全部数据权限"
},
{
value
:
"2"
,
label
:
"自定数据权限"
},
{
value
:
"3"
,
label
:
"本部门数据权限"
},
{
value
:
"4"
,
label
:
"本部门及以下数据权限"
},
{
value
:
"5"
,
label
:
"仅本人数据权限"
}
],
// 菜单列表
menuOptions
:
[],
// 部门列表
...
...
@@ -247,7 +222,7 @@
getList
()
{
this
.
loading
=
true
;
getTenantPackage
(
this
.
queryParams
).
then
(
response
=>
{
this
.
role
List
=
response
.
rows
;
this
.
pack
List
=
response
.
rows
;
this
.
total
=
response
.
total
;
this
.
loading
=
false
;
}
...
...
@@ -268,39 +243,11 @@
checkedKeys
.
unshift
.
apply
(
checkedKeys
,
halfCheckedKeys
);
return
checkedKeys
;
},
// 所有部门节点数据
getDeptAllCheckedKeys
()
{
// 目前被选中的部门节点
let
checkedKeys
=
this
.
$refs
.
dept
.
getCheckedKeys
();
// 半选中的部门节点
let
halfCheckedKeys
=
this
.
$refs
.
dept
.
getHalfCheckedKeys
();
checkedKeys
.
unshift
.
apply
(
checkedKeys
,
halfCheckedKeys
);
return
checkedKeys
;
},
/** 根据角色ID查询菜单树结构 */
getRoleMenuTreeselect
(
roleId
)
{
return
roleMenuTreeselect
(
roleId
).
then
(
response
=>
{
this
.
menuOptions
=
response
.
menus
;
return
response
;
});
},
/** 根据角色ID查询部门树结构 */
getDeptTree
(
roleId
)
{
return
deptTreeSelect
(
roleId
).
then
(
response
=>
{
this
.
deptOptions
=
response
.
data
.
depts
;
return
response
;
});
},
// 取消按钮
cancel
()
{
this
.
open
=
false
;
this
.
reset
();
},
// 取消按钮(数据权限)
cancelDataScope
()
{
this
.
openDataScope
=
false
;
this
.
reset
();
},
// 表单重置
reset
()
{
if
(
this
.
$refs
.
menu
!=
undefined
)
{
...
...
@@ -309,7 +256,6 @@
this
.
menuExpand
=
false
,
this
.
menuNodeAll
=
false
,
this
.
deptExpand
=
true
,
this
.
deptNodeAll
=
false
,
this
.
form
=
{
packageId
:
undefined
,
packageName
:
undefined
,
...
...
@@ -333,44 +279,20 @@
},
// 多选框选中数据
handleSelectionChange
(
selection
)
{
this
.
ids
=
selection
.
map
(
item
=>
item
.
rol
eId
)
this
.
ids
=
selection
.
map
(
item
=>
item
.
packag
eId
)
this
.
single
=
selection
.
length
!=
1
this
.
multiple
=
!
selection
.
length
},
// 更多操作触发
handleCommand
(
command
,
row
)
{
switch
(
command
)
{
case
"handleDataScope"
:
this
.
handleDataScope
(
row
);
break
;
case
"handleAuthUser"
:
this
.
handleAuthUser
(
row
);
break
;
default
:
break
;
}
},
// 树权限(展开/折叠)
handleCheckedTreeExpand
(
value
,
type
)
{
if
(
type
==
'menu'
)
{
let
treeList
=
this
.
menuOptions
;
for
(
let
i
=
0
;
i
<
treeList
.
length
;
i
++
)
{
this
.
$refs
.
menu
.
store
.
nodesMap
[
treeList
[
i
].
id
].
expanded
=
value
;
}
}
else
if
(
type
==
'dept'
)
{
let
treeList
=
this
.
deptOptions
;
for
(
let
i
=
0
;
i
<
treeList
.
length
;
i
++
)
{
this
.
$refs
.
dept
.
store
.
nodesMap
[
treeList
[
i
].
id
].
expanded
=
value
;
}
let
treeList
=
this
.
menuOptions
;
for
(
let
i
=
0
;
i
<
treeList
.
length
;
i
++
)
{
this
.
$refs
.
menu
.
store
.
nodesMap
[
treeList
[
i
].
id
].
expanded
=
value
;
}
},
// 树权限(全选/全不选)
handleCheckedTreeNodeAll
(
value
,
type
)
{
if
(
type
==
'menu'
)
{
this
.
$refs
.
menu
.
setCheckedNodes
(
value
?
this
.
menuOptions
:
[]);
}
else
if
(
type
==
'dept'
)
{
this
.
$refs
.
dept
.
setCheckedNodes
(
value
?
this
.
deptOptions
:
[]);
}
this
.
$refs
.
menu
.
setCheckedNodes
(
value
?
this
.
menuOptions
:
[]);
},
// 树权限(父子联动)
handleCheckedTreeConnect
(
value
,
type
)
{
...
...
@@ -393,7 +315,6 @@
this
.
disabled
=
false
this
.
reset
();
const
packageId
=
row
.
packageId
// const roleMenu = this.getRoleMenuTreeselect(packageId);
this
.
getMenuTreeselect
();
detailTenantPackage
(
packageId
).
then
(
response
=>
{
response
.
data
.
menuIds
=
response
.
data
.
menuIds
.
split
(
','
)
...
...
@@ -424,32 +345,6 @@
this
.
handleUpdate
(
row
)
this
.
disabled
=
true
},
/** 选择角色权限范围触发 */
dataScopeSelectChange
(
value
)
{
if
(
value
!==
'2'
)
{
this
.
$refs
.
dept
.
setCheckedKeys
([]);
}
},
/** 分配数据权限操作 */
handleDataScope
(
row
)
{
this
.
reset
();
const
deptTreeSelect
=
this
.
getDeptTree
(
row
.
roleId
);
getRole
(
row
.
roleId
).
then
(
response
=>
{
this
.
form
=
response
.
data
;
this
.
openDataScope
=
true
;
this
.
$nextTick
(()
=>
{
deptTreeSelect
.
then
(
res
=>
{
this
.
$refs
.
dept
.
setCheckedKeys
(
res
.
data
.
checkedKeys
);
});
});
this
.
title
=
"分配数据权限"
;
});
},
/** 分配用户操作 */
handleAuthUser
:
function
(
row
)
{
const
roleId
=
row
.
roleId
;
this
.
$router
.
push
(
"/system/role-auth/user/"
+
roleId
);
},
/** 提交按钮 */
submitForm
:
function
()
{
this
.
$refs
[
"form"
].
validate
(
valid
=>
{
...
...
@@ -474,33 +369,21 @@
}
});
},
/** 提交按钮(数据权限) */
submitDataScope
:
function
()
{
if
(
this
.
form
.
roleId
!=
undefined
)
{
this
.
form
.
deptIds
=
this
.
getDeptAllCheckedKeys
();
dataScope
(
this
.
form
).
then
(
response
=>
{
this
.
$modal
.
msgSuccess
(
"修改成功"
);
this
.
openDataScope
=
false
;
this
.
getList
();
});
}
},
/** 删除按钮操作 */
handleDelete
(
row
)
{
const
packageIds
=
row
.
packageId
||
this
.
ids
;
this
.
$modal
.
confirm
(
'是否确认删除方案为数据项?'
).
then
(
function
()
{
return
deleteTenantPackage
(
packageIds
);
}).
then
(()
=>
{
this
.
getList
();
this
.
$modal
.
msgSuccess
(
"删除成功"
);
let
_this
=
this
this
.
$modal
.
confirm
(
'是否确认删除选中的方案数据项?'
).
then
(
function
()
{
deleteTenantPackage
(
packageIds
).
then
(
res
=>
{
if
(
res
.
code
==
200
){
_this
.
getList
();
_this
.
$message
.
success
(
"删除成功"
);
}
else
{
_this
.
$message
.
error
(
res
.
msg
);
}
});
}).
catch
(()
=>
{});
},
/** 导出按钮操作 */
handleExport
()
{
this
.
download
(
'system/role/export'
,
{
...
this
.
queryParams
},
`role_
${
new
Date
().
getTime
()}
.xlsx`
)
}
}
};
</
script
>
...
...
dsk-operate-ui/src/views/login.vue
View file @
912a1656
...
...
@@ -71,12 +71,14 @@
</
template
>
<
script
>
import
{
getCodeImg
,
getTenants
,
changeTenants
}
from
"@/api/login"
;
import
Cookies
from
"js-cookie"
;
import
{
encrypt
,
decrypt
}
from
'@/utils/jsencrypt'
import
{
setTenantid
}
from
'@/utils/auth'
import
store
from
'@/store'
import
{
changeTenants
,
defaultTenantid
,
getCodeImg
,
getTenants
}
from
'@/api/login'
import
Cookies
from
'js-cookie'
import
{
decrypt
,
encrypt
}
from
'@/utils/jsencrypt'
import
{
Base64
}
from
'js-base64'
import
{
getTenantid
,
setTenantid
,
setToken
}
from
'@/utils/auth'
export
default
{
export
default
{
name
:
"Login"
,
data
()
{
return
{
...
...
@@ -106,6 +108,7 @@ export default {
register
:
false
,
redirect
:
undefined
,
tenanlist
:[],
defalutId
:
''
,
//默认租户id
};
},
watch
:
{
...
...
@@ -136,7 +139,8 @@ export default {
const
rememberMe
=
Cookies
.
get
(
'rememberMe'
)
this
.
loginForm
=
{
username
:
username
===
undefined
?
this
.
loginForm
.
username
:
username
,
password
:
password
===
undefined
?
this
.
loginForm
.
password
:
decrypt
(
password
),
// password: password === undefined ? this.loginForm.password : decrypt(password),
password
:
password
===
undefined
?
this
.
loginForm
.
password
:
Base64
.
encode
(
password
),
rememberMe
:
rememberMe
===
undefined
?
false
:
Boolean
(
rememberMe
)
};
},
...
...
@@ -146,18 +150,25 @@ export default {
this
.
loading
=
true
;
if
(
this
.
loginForm
.
rememberMe
)
{
Cookies
.
set
(
"username"
,
this
.
loginForm
.
username
,
{
expires
:
30
});
Cookies
.
set
(
"password"
,
encrypt
(
this
.
loginForm
.
password
),
{
expires
:
30
});
// Cookies.set("password", encrypt(this.loginForm.password), { expires: 30 });
Cookies
.
set
(
"password"
,
Base64
.
encode
(
this
.
loginForm
.
password
),
{
expires
:
30
});
Cookies
.
set
(
'rememberMe'
,
this
.
loginForm
.
rememberMe
,
{
expires
:
30
});
}
else
{
Cookies
.
remove
(
"username"
);
Cookies
.
remove
(
"password"
);
Cookies
.
remove
(
'rememberMe'
);
}
this
.
$store
.
dispatch
(
"Login"
,
this
.
loginForm
).
then
(()
=>
{
let
froms
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
loginForm
))
froms
.
password
=
Base64
.
encode
(
this
.
loginForm
.
password
)
this
.
$store
.
dispatch
(
"Login"
,
froms
).
then
(()
=>
{
localStorage
.
setItem
(
'userphone'
,
this
.
loginForm
.
username
)
this
.
$router
.
push
({
path
:
this
.
redirect
||
"/"
}).
catch
(()
=>
{});
// this.goin()
defaultTenantid
().
then
(
res
=>
{
if
(
res
.
data
.
tenantId
==
""
||
res
.
data
.
tenantId
==
null
){
//无默认企业id
this
.
goin
()
}
else
{
this
.
$router
.
push
({
path
:
this
.
redirect
||
"/"
}).
catch
(()
=>
{});
}
})
}).
catch
(()
=>
{
this
.
loading
=
false
;
if
(
this
.
captchaEnabled
)
{
...
...
@@ -169,29 +180,30 @@ export default {
},
goin
(){
this
.
tenantId
=
-
1
getTenants
(
this
.
loginForm
.
username
).
then
(
res
=>
{
if
(
res
.
code
==
200
){
getTenants
().
then
(
res
=>
{
if
(
res
.
code
==
200
&&
res
.
data
!=
[]
){
this
.
tenanlist
=
res
.
data
if
(
this
.
tenanlist
.
length
>
1
){
this
.
islog
=
true
}
else
{
setTenantid
(
this
.
tenanlist
[
0
].
tenantId
)
this
.
changeTenants
(
this
.
tenanlist
[
0
].
tenantId
)
}
else
{
//只有一条就是登录返回的id 直接进入系统
this
.
$router
.
push
({
path
:
this
.
redirect
||
"/"
}).
catch
(()
=>
{});
}
}
})
},
tochose
(){
setTenantid
(
this
.
tenantId
)
this
.
changeTenants
(
this
.
tenantId
)
},
changeTenants
(
tenantId
){
changeTenants
(
tenantId
).
then
(
res
=>
{
if
(
res
.
code
==
200
){
this
.
$router
.
push
({
path
:
this
.
redirect
||
"/"
}).
catch
(()
=>
{});
changeTenants
(
tenantId
)
{
changeTenants
(
tenantId
).
then
(
res
=>
{
if
(
res
.
code
==
200
)
{
setToken
(
res
.
data
.
token
)
setTenantid
(
tenantId
)
store
.
commit
(
'SET_TOKEN'
,
res
.
data
.
token
)
this
.
$router
.
push
({
path
:
this
.
redirect
||
'/'
}).
catch
(()
=>
{})
}
})
}
,
}
}
};
</
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