Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
9
91isoft_web_vue3
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
张伯涛
91isoft_web_vue3
Commits
03d09ec5
Commit
03d09ec5
authored
Feb 19, 2024
by
张伯涛
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
字典
parent
1fd7457c
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
529 additions
and
151 deletions
+529
-151
index.ts
src/api/dict/index.ts
+41
-5
types.ts
src/api/dict/types.ts
+46
-18
index.ts
src/api/user/index.ts
+31
-27
types.ts
src/api/user/types.ts
+0
-1
index.ts
src/router/index.ts
+13
-0
commonField.ts
src/utils/commonField.ts
+4
-3
index.vue
src/views/system/dict/index.vue
+394
-93
index.vue
src/views/system/role/index.vue
+0
-4
No files found.
src/api/dict/index.ts
View file @
03d09ec5
...
@@ -18,20 +18,56 @@ export function getDictTypePage(
...
@@ -18,20 +18,56 @@ export function getDictTypePage(
queryParams
:
DictTypeQuery
queryParams
:
DictTypeQuery
):
AxiosPromise
<
DictTypePageResult
>
{
):
AxiosPromise
<
DictTypePageResult
>
{
return
request
({
return
request
({
url
:
"/
api/v1/dict/types/page
"
,
url
:
"/
system/dict/type/list
"
,
method
:
"get"
,
method
:
"get"
,
params
:
queryParams
,
params
:
queryParams
,
});
});
}
}
/** 获取字典选择框列表*/
export
function
selectDictType
(
dictType
)
{
return
request
({
url
:
"/system/dict/data/type/"
+
dictType
,
method
:
"get"
,
});
}
/** 导出字典类型*/
export
function
exportType
(
queryParams
:
DictTypeQuery
)
{
return
request
({
url
:
"/system/dict/type/export"
,
method
:
"get"
,
params
:
queryParams
,
responseType
:
"arraybuffer"
,
});
}
/** 修改字典类型*/
export
function
updateType
(
data
)
{
const
businessId
=
data
.
businessId
;
return
request
({
url
:
"/system/dict/type/update/"
+
businessId
,
method
:
"put"
,
data
:
data
,
headers
:
{},
});
}
/** 新增字典类型*/
export
function
addType
(
data
)
{
return
request
({
url
:
"/system/dict/type/add"
,
method
:
"post"
,
data
:
data
,
headers
:
{},
});
}
/**
/**
* 字典类型表单数据
* 字典类型表单数据
*
*
* @param id
* @param id
*/
*/
export
function
getDictTypeForm
(
i
d
:
number
):
AxiosPromise
<
DictTypeForm
>
{
export
function
getDictTypeForm
(
dictI
d
:
number
):
AxiosPromise
<
DictTypeForm
>
{
return
request
({
return
request
({
url
:
"/
api/v1/dict/types/"
+
id
+
"/form"
,
url
:
"/
system/dict/type/detail/"
+
dictId
,
method
:
"get"
,
method
:
"get"
,
});
});
}
}
...
@@ -66,9 +102,9 @@ export function updateDictType(id: number, data: DictTypeForm) {
...
@@ -66,9 +102,9 @@ export function updateDictType(id: number, data: DictTypeForm) {
/**
/**
* 删除字典类型
* 删除字典类型
*/
*/
export
function
deleteDictTypes
(
ids
:
string
)
{
export
function
deleteDictTypes
(
dictId
:
string
)
{
return
request
({
return
request
({
url
:
"/
api/v1/dict/types/"
+
ids
,
url
:
"/
system/dict/type/deleteLogical/"
+
dictId
,
method
:
"delete"
,
method
:
"delete"
,
});
});
}
}
...
...
src/api/dict/types.ts
View file @
03d09ec5
...
@@ -3,9 +3,25 @@
...
@@ -3,9 +3,25 @@
*/
*/
export
interface
DictTypeQuery
extends
PageQuery
{
export
interface
DictTypeQuery
extends
PageQuery
{
/**
/**
* 关键字(字典类型名称/编码)
* 字典名称
*/
dictName
?:
string
;
/**
* 字典类型
*/
dictType
?:
string
;
/**
* 状态
*/
flag
?:
string
;
/**
* 开始时间
*/
*/
keywords
?:
string
;
beginTime
?:
string
|
null
;
/**
* 结束时间
*/
endTime
?:
string
|
null
;
}
}
/**
/**
...
@@ -15,23 +31,27 @@ export interface DictTypePageVO {
...
@@ -15,23 +31,27 @@ export interface DictTypePageVO {
/**
/**
* 字典类型ID
* 字典类型ID
*/
*/
i
d
:
number
;
businessI
d
:
number
;
/**
/**
*
类型编码
*
字典名称
*/
*/
cod
e
:
string
;
dictNam
e
:
string
;
/**
/**
*
类型名称
*
字典类型
*/
*/
nam
e
:
string
;
dictTyp
e
:
string
;
/**
/**
* 状态
(1:启用;0:禁用)
* 状态
*/
*/
status
?:
number
;
flag
:
string
;
/**
/**
* 备注
* 备注
*/
*/
remark
?:
string
;
remarks
:
string
;
/**
* 创建时间
*/
createDate
:
Date
;
}
}
/**
/**
...
@@ -46,23 +66,31 @@ export interface DictTypeForm {
...
@@ -46,23 +66,31 @@ export interface DictTypeForm {
/**
/**
* 字典类型ID
* 字典类型ID
*/
*/
id
?:
number
;
businessId
?:
number
|
undefined
;
/**
/**
*
类型
名称
*
字典
名称
*/
*/
n
ame
?:
string
;
dictN
ame
?:
string
;
/**
/**
* 类型编码
* 字典类型
*/
dictType
?:
string
;
/**
* 父字典名称
*/
*/
code
?:
string
;
parentId
?:
number
|
undefined
;
/**
/**
*
类型状态:1:启用;0:禁用
*
父字典数据
*/
*/
status
:
number
;
dataId
?:
number
|
undefined
;
/**
/**
* 备注
* 备注
*/
*/
remark
?:
string
;
remarks
?:
string
;
status
?:
string
|
number
;
flag
?:
string
|
number
;
}
}
/**
/**
...
...
src/api/user/index.ts
View file @
03d09ec5
import
request
from
"@/utils/request"
;
import
request
from
"@/utils/request"
;
import
{
AxiosPromise
}
from
"axios"
;
import
{
AxiosPromise
}
from
"axios"
;
import
{
User
,
UserForm
,
UserInfo
,
UserPageVO
,
UserQuery
}
from
"./types"
;
import
{
User
,
UserForm
,
UserInfo
,
UserPageVO
,
UserQuery
}
from
"./types"
;
import
{
praseStrEmpty
}
from
'@/utils/common'
import
{
praseStrEmpty
}
from
"@/utils/common"
;
/**
/**
* 登录成功后获取用户信息(昵称、头像、权限集合和角色集合)
* 登录成功后获取用户信息(昵称、头像、权限集合和角色集合)
*/
*/
...
@@ -17,9 +17,11 @@ export function getUserInfoApi() {
...
@@ -17,9 +17,11 @@ export function getUserInfoApi() {
*
*
* @param queryParams
* @param queryParams
*/
*/
export
function
getUserPage
(
queryParams
:
UserQuery
):
AxiosPromise
<
PageResult
<
UserPageVO
[]
>>
{
export
function
getUserPage
(
queryParams
:
UserQuery
):
AxiosPromise
<
PageResult
<
UserPageVO
[]
>>
{
return
request
({
return
request
({
url
:
'/system/user/list'
,
url
:
"/system/user/list"
,
method
:
"get"
,
method
:
"get"
,
params
:
queryParams
,
params
:
queryParams
,
});
});
...
@@ -32,7 +34,7 @@ export function getUserPage(queryParams: UserQuery): AxiosPromise<PageResult<Use
...
@@ -32,7 +34,7 @@ export function getUserPage(queryParams: UserQuery): AxiosPromise<PageResult<Use
*/
*/
export
function
getUserForm
(
userId
:
number
):
AxiosPromise
<
UserForm
>
{
export
function
getUserForm
(
userId
:
number
):
AxiosPromise
<
UserForm
>
{
return
request
({
return
request
({
url
:
'/system/user/'
+
praseStrEmpty
(
userId
),
url
:
"/system/user/"
+
praseStrEmpty
(
userId
),
method
:
"get"
,
method
:
"get"
,
});
});
}
}
...
@@ -44,7 +46,7 @@ export function getUserForm(userId: number): AxiosPromise<UserForm> {
...
@@ -44,7 +46,7 @@ export function getUserForm(userId: number): AxiosPromise<UserForm> {
*/
*/
export
function
addUser
(
data
:
any
)
{
export
function
addUser
(
data
:
any
)
{
return
request
({
return
request
({
url
:
'/system/user/add'
,
url
:
"/system/user/add"
,
method
:
"post"
,
method
:
"post"
,
data
:
data
,
data
:
data
,
});
});
...
@@ -56,9 +58,9 @@ export function addUser(data: any) {
...
@@ -56,9 +58,9 @@ export function addUser(data: any) {
* @param id
* @param id
* @param data
* @param data
*/
*/
export
function
updateUser
(
data
:
UserForm
)
{
export
function
updateUser
(
data
:
UserForm
)
{
return
request
({
return
request
({
url
:
'/system/user/update'
,
url
:
"/system/user/update"
,
method
:
"put"
,
method
:
"put"
,
data
:
data
,
data
:
data
,
});
});
...
@@ -73,27 +75,27 @@ export function updateUser( data: UserForm) {
...
@@ -73,27 +75,27 @@ export function updateUser( data: UserForm) {
export
function
updateUserPassword
(
businessId
:
number
,
password
:
string
)
{
export
function
updateUserPassword
(
businessId
:
number
,
password
:
string
)
{
const
data
=
{
const
data
=
{
businessId
,
businessId
,
password
password
,
}
}
;
return
request
({
return
request
({
url
:
'/system/user/resetPassword'
,
url
:
"/system/user/resetPassword"
,
method
:
'put'
,
method
:
"put"
,
params
:
data
params
:
data
,
});
});
}
}
/**
/**
* 用户状态修改
* 用户状态修改
*
*
*/
*/
export
function
changeUserStatus
(
businessId
:
number
,
flag
:
string
)
{
export
function
changeUserStatus
(
businessId
:
number
,
flag
:
string
)
{
const
data
=
{
const
data
=
{
businessId
,
businessId
,
flag
flag
,
}
}
;
return
request
({
return
request
({
url
:
'/system/user/changeStatus'
,
url
:
"/system/user/changeStatus"
,
method
:
'put'
,
method
:
"put"
,
params
:
data
params
:
data
,
});
});
}
}
/**
/**
...
@@ -103,7 +105,7 @@ export function changeUserStatus(businessId: number,flag:string) {
...
@@ -103,7 +105,7 @@ export function changeUserStatus(businessId: number,flag:string) {
*/
*/
export
function
deleteUsers
(
id
:
number
)
{
export
function
deleteUsers
(
id
:
number
)
{
return
request
({
return
request
({
url
:
'/system/user/deleteLogical/'
+
id
,
url
:
"/system/user/deleteLogical/"
+
id
,
method
:
"delete"
,
method
:
"delete"
,
});
});
}
}
...
@@ -115,7 +117,7 @@ export function deleteUsers(id: number) {
...
@@ -115,7 +117,7 @@ export function deleteUsers(id: number) {
*/
*/
export
function
downloadTemplateApi
()
{
export
function
downloadTemplateApi
()
{
return
request
({
return
request
({
url
:
'/system/user/importTemplate'
,
url
:
"/system/user/importTemplate"
,
method
:
"get"
,
method
:
"get"
,
responseType
:
"arraybuffer"
,
responseType
:
"arraybuffer"
,
});
});
...
@@ -129,7 +131,7 @@ export function downloadTemplateApi() {
...
@@ -129,7 +131,7 @@ export function downloadTemplateApi() {
*/
*/
export
function
exportUser
(
queryParams
:
UserQuery
)
{
export
function
exportUser
(
queryParams
:
UserQuery
)
{
return
request
({
return
request
({
url
:
'/system/user/export'
,
url
:
"/system/user/export"
,
method
:
"get"
,
method
:
"get"
,
params
:
queryParams
,
params
:
queryParams
,
responseType
:
"arraybuffer"
,
responseType
:
"arraybuffer"
,
...
@@ -141,16 +143,18 @@ export function exportUser(queryParams: UserQuery) {
...
@@ -141,16 +143,18 @@ export function exportUser(queryParams: UserQuery) {
*
*
* @param file
* @param file
*/
*/
export
function
importUser
(
data
:
any
)
{
export
function
importUser
(
data
:
any
)
{
return
request
({
return
request
({
url
:
'/system/user/importExcel'
,
url
:
"/system/user/importExcel"
,
method
:
"post"
,
method
:
"post"
,
headers
:
{
headers
:
{
'Content-Type'
:
'multipart/form-data'
"Content-Type"
:
"multipart/form-data"
,
},
transformRequest
:
[
(
data
)
=>
{
return
data
;
},
},
transformRequest
:
[(
data
)
=>
{
],
return
data
}],
data
,
data
,
});
});
}
}
src/api/user/types.ts
View file @
03d09ec5
...
@@ -72,7 +72,6 @@ export interface UserQuery extends PageQuery {
...
@@ -72,7 +72,6 @@ export interface UserQuery extends PageQuery {
* 状态
* 状态
*/
*/
flag
?:
string
;
flag
?:
string
;
}
}
/**
/**
...
...
src/router/index.ts
View file @
03d09ec5
...
@@ -41,6 +41,19 @@ export const constantRoutes: RouteRecordRaw[] = [
...
@@ -41,6 +41,19 @@ export const constantRoutes: RouteRecordRaw[] = [
alwaysShow
:
false
,
alwaysShow
:
false
,
},
},
},
},
{
path
:
"dict/type/data/:dictId(
\\
d+)"
,
component
:
()
=>
import
(
"@/views/system/dict/data.vue"
),
name
:
"Data"
,
meta
:
{
title
:
"字典数据"
,
icon
:
""
,
affix
:
true
,
keepAlive
:
true
,
alwaysShow
:
false
,
hidden
:
true
,
},
},
{
{
path
:
"/401"
,
path
:
"/401"
,
component
:
()
=>
import
(
"@/views/error-page/401.vue"
),
component
:
()
=>
import
(
"@/views/error-page/401.vue"
),
...
...
src/utils/commonField.ts
View file @
03d09ec5
...
@@ -4,6 +4,7 @@ import {
...
@@ -4,6 +4,7 @@ import {
Edit
,
Edit
,
Search
,
Search
,
Share
,
Share
,
Refresh
,
Upload
,
Upload
,
Download
,
Download
,
}
from
"@element-plus/icons-vue"
;
}
from
"@element-plus/icons-vue"
;
...
@@ -34,9 +35,9 @@ export const commonField = {
...
@@ -34,9 +35,9 @@ export const commonField = {
cleanName
:
"清空"
,
cleanName
:
"清空"
,
viewName
:
"查看"
,
viewName
:
"查看"
,
size
:
"default"
,
size
:
"default"
,
smallSize
:
"
small
"
,
smallSize
:
"
default
"
,
queryIcon
:
"el-icon-search"
,
queryIcon
:
Search
,
resetIcon
:
"el-icon-refresh"
,
resetIcon
:
Refresh
,
addIcon
:
Plus
,
addIcon
:
Plus
,
delIcon
:
"el-icon-delete"
,
delIcon
:
"el-icon-delete"
,
importIcon
:
Upload
,
importIcon
:
Upload
,
...
...
src/views/system/dict/index.vue
View file @
03d09ec5
...
@@ -6,10 +6,14 @@ import {
...
@@ -6,10 +6,14 @@ import {
addDictType
,
addDictType
,
updateDictType
,
updateDictType
,
deleteDictTypes
,
deleteDictTypes
,
exportType
,
selectDictType
,
updateType
,
addType
,
}
from
"@/api/dict"
;
}
from
"@/api/dict"
;
import
{
DictTypePageVO
,
DictTypeQuery
,
DictTypeForm
}
from
"@/api/dict/types"
;
import
{
DictTypePageVO
,
DictTypeQuery
,
DictTypeForm
}
from
"@/api/dict/types"
;
import
{
commonField
}
from
"@/utils/commonField"
;
defineOptions
({
defineOptions
({
name
:
"DictType"
,
name
:
"DictType"
,
inheritAttrs
:
false
,
inheritAttrs
:
false
,
...
@@ -17,11 +21,30 @@ defineOptions({
...
@@ -17,11 +21,30 @@ defineOptions({
const
queryFormRef
=
ref
(
ElForm
);
const
queryFormRef
=
ref
(
ElForm
);
const
dataFormRef
=
ref
(
ElForm
);
const
dataFormRef
=
ref
(
ElForm
);
const
hasDictDelPerm
=
ref
([
"sys:dict:delete"
]);
const
hasDictRemovePerm
=
ref
([
"sys:dict:remove"
]);
const
hasDictResetPerm
=
ref
([
"sys:user:resetPwd"
]);
const
hasDictUpdatePerm
=
ref
([
"sys:dict:update"
]);
const
hasDictEditPerm
=
ref
([
"sys:dict:edit"
]);
const
hasDictAddPerm
=
ref
([
"sys:dict:add"
]);
const
exportHaspermi
=
ref
([
"sys:dict:export"
]);
const
loading
=
ref
(
false
);
const
loading
=
ref
(
false
);
const
manageLoading
=
ref
(
false
);
const
ids
=
ref
<
number
[]
>
([]);
const
ids
=
ref
<
number
[]
>
([]);
const
total
=
ref
(
0
);
const
total
=
ref
(
0
);
const
statusOptions
=
reactive
([
{
dictLabel
:
"正常"
,
dictValue
:
"1"
,
},
{
dictLabel
:
"停用"
,
dictValue
:
"0"
,
},
]);
const
dateRange
=
ref
([]);
// 日期范围
const
optionsDict
=
ref
([]);
const
options
=
ref
([]);
const
queryParams
=
reactive
<
DictTypeQuery
>
({
const
queryParams
=
reactive
<
DictTypeQuery
>
({
pageNum
:
1
,
pageNum
:
1
,
pageSize
:
10
,
pageSize
:
10
,
...
@@ -35,21 +58,45 @@ const dialog = reactive({
...
@@ -35,21 +58,45 @@ const dialog = reactive({
});
});
const
formData
=
reactive
<
DictTypeForm
>
({
const
formData
=
reactive
<
DictTypeForm
>
({
status
:
1
,
flag
:
"1"
,
parentId
:
""
,
});
});
const
rules
=
reactive
({
const
rules
=
reactive
({
name
:
[{
required
:
true
,
message
:
"请输入字典类型名称"
,
trigger
:
"blur"
}],
dictName
:
[
code
:
[{
required
:
true
,
message
:
"请输入字典类型编码"
,
trigger
:
"blur"
}],
{
required
:
true
,
message
:
"请输入字典名称"
,
trigger
:
[
"blur"
,
"change"
]
},
],
dictType
:
[
{
required
:
true
,
message
:
"请输入字典类型"
,
trigger
:
[
"blur"
,
"change"
]
},
],
dataId
:
[
{
required
:
true
,
message
:
"请输入父字典数据"
,
trigger
:
[
"blur"
,
"change"
],
},
],
});
});
/** 搜索按钮操作 */
function
queryBtn
()
{
queryParams
.
pageNum
=
1
;
handleQuery
();
}
/** 查询 */
/** 查询 */
function
handleQuery
()
{
function
handleQuery
()
{
loading
.
value
=
true
;
loading
.
value
=
true
;
if
(
dateRange
.
value
&&
dateRange
.
value
.
length
>
0
)
{
queryParams
.
beginTime
=
dateRange
.
value
[
0
];
queryParams
.
endTime
=
dateRange
.
value
[
1
];
}
else
{
queryParams
.
beginTime
=
null
;
queryParams
.
endTime
=
null
;
}
getDictTypePage
(
queryParams
)
getDictTypePage
(
queryParams
)
.
then
(({
data
})
=>
{
.
then
((
response
)
=>
{
dictTypeList
.
value
=
data
.
list
;
options
.
value
=
response
.
rows
;
total
.
value
=
data
.
total
;
dictTypeList
.
value
=
response
.
rows
;
total
.
value
=
response
.
total
;
})
})
.
finally
(()
=>
{
.
finally
(()
=>
{
loading
.
value
=
false
;
loading
.
value
=
false
;
...
@@ -61,15 +108,105 @@ function handleQuery() {
...
@@ -61,15 +108,105 @@ function handleQuery() {
*/
*/
function
resetQuery
()
{
function
resetQuery
()
{
queryFormRef
.
value
.
resetFields
();
queryFormRef
.
value
.
resetFields
();
dateRange
.
value
=
[];
queryParams
.
pageNum
=
1
;
queryParams
.
pageNum
=
1
;
handleQuery
();
queryParams
.
pageSize
=
10
;
queryParams
.
dictName
=
""
;
queryParams
.
dictType
=
""
;
queryParams
.
flag
=
""
;
queryBtn
();
}
}
/** 改变状态*/
function
handleStatusChange
(
row
)
{
const
text
=
row
.
flag
===
"1"
?
"启用"
:
"停用"
;
ElMessageBox
.
confirm
(
"是否确认操作?"
,
"警告"
,
{
confirmButtonText
:
"确定"
,
cancelButtonText
:
"取消"
,
type
:
"warning"
,
})
.
then
(()
=>
{
return
updateType
(
row
);
})
.
then
(()
=>
{
ElMessage
.
success
(
text
+
"成功"
);
})
.
catch
(
function
()
{
row
.
flag
=
row
.
flag
===
"0"
?
"1"
:
"0"
;
});
}
/** 动态表单验证*/
function
setRules
()
{
// if (formData.parentId !== null && formData.parentId !== "") {
// this.$set(rules, "dataId", [
// { required: true, message: "请输入父字典数据", trigger: "blur" },
// ]);
// } else {
// this.$delete(rules, "dataId");
// }
}
/** 清除已选择的*/
function
clearSelected
(
flag
)
{
// flag = true 为下拉框选项展开时的标识
if
(
flag
)
{
if
(
formData
.
dataId
)
{
// 如果找不到 下拉框选项中对应选中的选项 或者 下拉框选项中对应选中的选项 状态为1(停用)则将双向绑定的数据清空
if
(
!
optionsDict
.
find
((
item
)
=>
{
return
item
.
dictCode
===
formData
.
dataId
;
})
||
optionsDict
.
find
((
item
)
=>
{
return
item
.
dictCode
===
formData
.
dataId
;
}).
status
===
1
)
{
formData
.
dataId
=
""
;
}
}
}
}
/** 获取当前父字典数据*/
function
getOptions
(
val
)
{
console
.
log
(
"aaaaaaaaaa"
,
val
);
formData
.
dataId
=
""
;
selectDictType
(
options
.
value
.
find
((
item
)
=>
{
return
item
.
businessId
===
val
;
}).
dictType
).
then
((
response
)
=>
{
optionsDict
.
value
=
response
.
data
;
setRules
();
});
}
/** 行复选框选中 */
/** 行复选框选中 */
function
handleSelectionChange
(
selection
:
any
)
{
function
handleSelectionChange
(
selection
:
any
)
{
ids
.
value
=
selection
.
map
((
item
:
any
)
=>
item
.
id
);
ids
.
value
=
selection
.
map
((
item
:
any
)
=>
item
.
id
);
}
}
function
handleExport
()
{
ElMessageBox
.
confirm
(
"是否确认操作?"
,
"警告"
,
{
cancelButtonText
:
"取消"
,
confirmButtonText
:
"确定"
,
type
:
"warning"
,
}).
then
(()
=>
{
exportType
(
queryParams
).
then
((
response
:
any
)
=>
{
const
fileData
=
response
.
data
;
const
fileType
=
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8"
;
const
blob
=
new
Blob
([
fileData
],
{
type
:
fileType
});
const
downloadUrl
=
window
.
URL
.
createObjectURL
(
blob
);
const
downloadLink
=
document
.
createElement
(
"a"
);
downloadLink
.
href
=
downloadUrl
;
downloadLink
.
download
=
"字典类型信息"
+
".xls"
;
// 下载后文件名
document
.
body
.
appendChild
(
downloadLink
);
downloadLink
.
click
();
document
.
body
.
removeChild
(
downloadLink
);
window
.
URL
.
revokeObjectURL
(
downloadUrl
);
});
});
}
/**
/**
* 打开字典类型表单弹窗
* 打开字典类型表单弹窗
*
*
...
@@ -79,8 +216,15 @@ function openDialog(dicTypeId?: number) {
...
@@ -79,8 +216,15 @@ function openDialog(dicTypeId?: number) {
dialog
.
visible
=
true
;
dialog
.
visible
=
true
;
if
(
dicTypeId
)
{
if
(
dicTypeId
)
{
dialog
.
title
=
"修改字典类型"
;
dialog
.
title
=
"修改字典类型"
;
getDictTypeForm
(
dicTypeId
).
then
(({
data
})
=>
{
getDictTypeForm
(
dicTypeId
).
then
((
response
)
=>
{
Object
.
assign
(
formData
,
data
);
Object
.
assign
(
formData
,
response
.
data
);
getOptions
(
formData
.
parentId
);
formData
.
dataId
=
response
.
data
.
dataId
;
// nextTick(() => {
// if (response.data.dataId !== null) {
// formData.dataId = response.data.dataId.toString();
// }
// });
});
});
}
else
{
}
else
{
dialog
.
title
=
"新增字典类型"
;
dialog
.
title
=
"新增字典类型"
;
...
@@ -90,25 +234,39 @@ function openDialog(dicTypeId?: number) {
...
@@ -90,25 +234,39 @@ function openDialog(dicTypeId?: number) {
/** 字典类型表单提交 */
/** 字典类型表单提交 */
function
handleSubmit
()
{
function
handleSubmit
()
{
dataFormRef
.
value
.
validate
((
isValid
:
boolean
)
=>
{
dataFormRef
.
value
.
validate
((
isValid
:
boolean
)
=>
{
console
.
log
(
"isValid"
,
isValid
);
if
(
isValid
)
{
if
(
isValid
)
{
loading
.
value
=
false
;
manageLoading
.
value
=
true
;
const
dictTypeId
=
formData
.
id
;
const
temp
=
Object
.
assign
({},
formData
);
if
(
dictTypeId
)
{
if
(
!
temp
.
parentId
)
{
updateDictType
(
dictTypeId
,
formData
)
temp
.
dataId
=
""
;
.
then
(()
=>
{
}
if
(
dialog
.
title
===
"修改字典类型"
)
{
updateType
(
temp
)
.
then
((
response
)
=>
{
if
(
response
.
code
===
200
)
{
ElMessage
.
success
(
"修改成功"
);
ElMessage
.
success
(
"修改成功"
);
closeDialog
();
closeDialog
();
handleQuery
();
handleQuery
();
}
manageLoading
.
value
=
false
;
})
})
.
finally
(()
=>
(
loading
.
value
=
false
));
.
catch
(()
=>
{
manageLoading
.
value
=
false
;
});
}
else
{
}
else
{
addDictType
(
formData
)
addType
(
temp
)
.
then
(()
=>
{
.
then
((
response
)
=>
{
if
(
response
.
code
===
200
)
{
ElMessage
.
success
(
"新增成功"
);
ElMessage
.
success
(
"新增成功"
);
closeDialog
();
closeDialog
();
handleQuery
();
handleQuery
();
}
manageLoading
.
value
=
false
;
})
})
.
finally
(()
=>
(
loading
.
value
=
false
));
.
catch
(()
=>
{
manageLoading
.
value
=
false
;
});
}
}
}
}
});
});
...
@@ -123,21 +281,22 @@ function closeDialog() {
...
@@ -123,21 +281,22 @@ function closeDialog() {
/** 重置字典类型表单 */
/** 重置字典类型表单 */
function
resetForm
()
{
function
resetForm
()
{
dataFormRef
.
value
.
resetFields
();
dataFormRef
.
value
.
resetFields
();
dataFormRef
.
value
.
clearValidate
();
dataFormRef
.
value
.
resetFields
();
formData
.
dataId
=
""
;
formData
.
id
=
undefined
;
formData
.
parentId
=
undefined
;
formData
.
status
=
1
;
formData
.
businessId
=
undefined
;
formData
.
dictName
=
""
;
formData
.
dictType
=
""
;
formData
.
status
=
"0"
;
formData
.
remarks
=
""
;
formData
.
flag
=
"1"
;
}
}
/** 删除字典类型 */
/** 删除字典类型 */
function
handleDelete
(
dictTypeId
?:
number
)
{
function
handleDelete
(
row
)
{
const
dictTypeIds
=
[
dictTypeId
||
ids
.
value
].
join
(
","
);
const
dictTypeIds
=
row
.
businessId
;
if
(
!
dictTypeIds
)
{
ElMessage
.
warning
(
"请勾选删除项"
);
return
;
}
ElMessageBox
.
confirm
(
"
确认删除已选中的数据项
?"
,
"警告"
,
{
ElMessageBox
.
confirm
(
"
是否确认操作
?"
,
"警告"
,
{
confirmButtonText
:
"确定"
,
confirmButtonText
:
"确定"
,
cancelButtonText
:
"取消"
,
cancelButtonText
:
"取消"
,
type
:
"warning"
,
type
:
"warning"
,
...
@@ -179,36 +338,95 @@ onMounted(() => {
...
@@ -179,36 +338,95 @@ onMounted(() => {
<div
class=
"app-container"
>
<div
class=
"app-container"
>
<div
class=
"search-container"
>
<div
class=
"search-container"
>
<el-form
ref=
"queryFormRef"
:model=
"queryParams"
:inline=
"true"
>
<el-form
ref=
"queryFormRef"
:model=
"queryParams"
:inline=
"true"
>
<el-form-item
label=
"关键字"
prop=
"name"
>
<el-form-item
label=
"字典名称"
prop=
"dictName"
>
<el-input
v-model=
"queryParams.dictName"
placeholder=
"请输入字典名称"
clearable
:maxlength=
"30"
style=
"width: 200px"
@
keyup
.
enter=
"queryBtn"
/>
</el-form-item>
<el-form-item
label=
"字典类型"
prop=
"dictType"
>
<el-input
<el-input
v-model=
"queryParams.keywords"
v-model
.
trim=
"queryParams.dictType"
placeholder=
"字典类型名称/编码"
placeholder=
"请输入字典类型"
clearable
:maxlength=
"30"
style=
"width: 200px"
@
keyup
.
enter=
"queryBtn"
/>
</el-form-item>
<el-form-item
label=
"状态"
prop=
"flag"
>
<el-select
v-model=
"queryParams.flag"
placeholder=
"字典状态"
clearable
clearable
@
keyup
.
enter=
"handleQuery"
style=
"width: 200px"
>
<el-option
v-for=
"dict in statusOptions"
:key=
"dict.dictValue"
:label=
"dict.dictLabel"
:value=
"dict.dictValue"
/>
</el-select>
</el-form-item>
<el-form-item
label=
"创建时间"
>
<el-date-picker
v-model=
"dateRange"
style=
"width: 300px"
value-format=
"YYYY-MM-DD"
type=
"daterange"
range-separator=
"-"
start-placeholder=
"开始日期"
end-placeholder=
"结束日期"
/>
/>
</el-form-item>
</el-form-item>
<el-form-item>
<el-form-item>
<el-button
type=
"primary"
@
click=
"handleQuery()"
<!-- //查询按钮-->
><i-ep-search
/>
搜索
</el-button
<el-button
:class=
"commonField.queryClass"
:type=
"commonField.typePrimary"
:icon=
"commonField.queryIcon"
:size=
"commonField.smallSize"
@
click=
"queryBtn"
>
{{
commonField
.
queryName
}}
</el-button
>
<!-- //重置按钮-->
<el-button
:class=
"commonField.resetClass"
:icon=
"commonField.resetIcon"
:size=
"commonField.smallSize"
@
click=
"resetQuery"
>
{{
commonField
.
resetName
}}
</el-button
>
>
<el-button
@
click=
"resetQuery()"
><i-ep-refresh
/>
重置
</el-button>
</el-form-item>
</el-form-item>
</el-form>
</el-form>
</div>
</div>
<el-card
shadow=
"never"
class=
"table-container"
>
<el-card
shadow=
"never"
class=
"table-container"
>
<template
#
header
>
<template
#
header
>
<!-- //新增按钮-->
<el-button
<el-button
v-hasPerm=
"['sys:dict_type:add']"
v-hasPermi=
"hasDictAddPerm"
type=
"success"
:class=
"commonField.addClass"
:type=
"commonField.typePrimary"
:icon=
"commonField.addIcon"
:size=
"commonField.smallSize"
@
click=
"openDialog()"
@
click=
"openDialog()"
>
<i-ep-plus
/>
新增
</el-button
>
{{
commonField
.
addName
}}
</el-button
>
>
<!-- //导出-->
<el-button
<el-button
type=
"danger"
v-hasPermi=
"exportHaspermi"
:disabled=
"ids.length === 0"
:class=
"commonField.exportClass"
@
click=
"handleDelete()"
:type=
"commonField.typeSuccess"
><i-ep-delete
/>
删除
</el-button
:icon=
"commonField.exportIcon"
:size=
"commonField.smallSize"
@
click=
"handleExport"
>
{{
commonField
.
exportName
}}
</el-button
>
>
</
template
>
</
template
>
<el-table
<el-table
...
@@ -216,42 +434,79 @@ onMounted(() => {
...
@@ -216,42 +434,79 @@ onMounted(() => {
highlight-current-row
highlight-current-row
:data=
"dictTypeList"
:data=
"dictTypeList"
border
border
@
selection-change=
"handleSelectionChange"
>
>
<el-table-column
type=
"selection"
width=
"55"
align=
"center"
/>
<el-table-column
type=
"index"
label=
"序号"
width=
"55"
align=
"center"
/>
<el-table-column
label=
"字典类型名称"
prop=
"name"
width=
"200"
/>
<el-table-column
<el-table-column
label=
"字典类型编码"
prop=
"code"
width=
"200"
/>
label=
"字典名称"
<el-table-column
label=
"状态"
align=
"center"
width=
"100"
>
prop=
"dictName"
:show-overflow-tooltip=
"true"
>
<
template
#
default=
"scope"
>
<
template
#
default=
"scope"
>
<el-tag
v-if=
"scope.row.status === 1"
type=
"success"
>
启用
</el-tag>
{{
scope
.
row
.
dictName
||
"-"
}}
<el-tag
v-else
type=
"info"
>
禁用
</el-tag>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
<el-table-column
label=
"备注"
prop=
"remark"
align=
"center"
/>
<el-table-column
label=
"字典类型"
:show-overflow-tooltip=
"true"
>
<el-table-column
fixed=
"right"
label=
"操作"
align=
"center"
width=
"220"
>
<
template
#
default=
"scope"
>
<
template
#
default=
"scope"
>
<el-button
<router-link
type=
"primary"
v-if=
"scope.row.businessId"
link
:to=
"'/dict/type/data/' + scope.row.businessId"
size=
"small"
class=
"link-type"
@
click
.
stop=
"openDictDialog(scope.row)"
>
><i-ep-Collection
/>
字典数据
</el-button
<span
style=
"color: #03a487"
>
{{
scope
.
row
.
dictType
}}
</span>
</router-link>
<div
v-else
>
-
</div>
</
template
>
</el-table-column>
<el-table-column
label=
"状态"
align=
"center"
prop=
"flag"
>
<
template
#
default=
"scope"
>
<el-switch
v-model=
"scope.row.flag"
class=
"switchDisabledStyle"
inactive-value=
"0"
active-value=
"1"
@
click
.
native=
"handleStatusChange(scope.row)"
/>
</
template
>
</el-table-column>
<el-table-column
label=
"备注"
prop=
"remarks"
:show-overflow-tooltip=
"true"
>
<
template
#
default=
"scope"
>
{{
scope
.
row
.
remarks
||
"-"
}}
</
template
>
</el-table-column>
<el-table-column
label=
"创建时间"
:show-overflow-tooltip=
"true"
prop=
"createTime"
>
>
<
template
#
default=
"scope"
>
<span>
{{
scope
.
row
.
createDate
||
"-"
}}
</span>
</
template
>
</el-table-column>
<el-table-column
label=
"操作"
class-name=
"small-padding fixed-width"
>
<
template
#
default=
"scope"
>
<!-- //修改-->
<el-button
<el-button
v-hasPerm=
"['sys:dict_type:edit']"
v-hasPermi=
"hasDictUpdatePerm"
type=
"primary"
:class=
"commonField.updateClass"
:type=
"commonField.typeParent"
link
link
size=
"small
"
:size=
"commonField.size
"
@
click
.
stop=
"openDialog(scope.row.i
d)"
@
click
=
"openDialog(scope.row.businessI
d)"
>
<i-ep-edit
/>
编辑
</el-button
>
{{
commonField
.
updateName
}}
</el-button
>
>
<!-- //删除-->
<el-button
<el-button
v-hasPerm=
"['sys:dict_type:delete']"
v-hasPermi=
"hasDictDelPerm"
type=
"primary"
:class=
"commonField.delClass"
:type=
"commonField.typeParent"
link
link
size=
"small
"
:size=
"commonField.size
"
@
click
.
stop=
"handleDelete(scope.row.id
)"
@
click
=
"handleDelete(scope.row
)"
>
<i-ep-delete
/>
删除
</el-button
>
{{
commonField
.
deleteName
}}
</el-button
>
>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
...
@@ -276,33 +531,79 @@ onMounted(() => {
...
@@ -276,33 +531,79 @@ onMounted(() => {
ref=
"dataFormRef"
ref=
"dataFormRef"
:model=
"formData"
:model=
"formData"
:rules=
"rules"
:rules=
"rules"
label-width=
"
80px
"
label-width=
"
auto
"
>
>
<el-form-item
label=
"字典名称"
prop=
"
n
ame"
>
<el-form-item
label=
"字典名称"
prop=
"
dictN
ame"
>
<el-input
v-model=
"formData.
n
ame"
placeholder=
"请输入字典名称"
/>
<el-input
v-model=
"formData.
dictN
ame"
placeholder=
"请输入字典名称"
/>
</el-form-item>
</el-form-item>
<el-form-item
label=
"字典
编码"
prop=
"cod
e"
>
<el-form-item
label=
"字典
类型"
prop=
"dictTyp
e"
>
<el-input
v-model=
"formData.
code"
placeholder=
"请输入字典编码
"
/>
<el-input
v-model=
"formData.
dictType"
placeholder=
"请输入字典类型
"
/>
</el-form-item>
</el-form-item>
<el-form-item
label=
"状态"
prop=
"status"
>
<el-form-item
label=
"父字典名称"
>
<el-radio-group
v-model=
"formData.status"
>
<el-select
<el-radio
:label=
"1"
>
正常
</el-radio>
v-model=
"formData.parentId"
<el-radio
:label=
"0"
>
停用
</el-radio>
style=
"width: 100%"
</el-radio-group>
clearable
placeholder=
"请选择父字典名称"
@
change=
"getOptions"
>
<!-- @clear="setRules"-->
<el-option
v-for=
"item in options"
:key=
"item.businessId"
:label=
"item.dictName"
:value=
"item.businessId"
/>
</el-select>
</el-form-item>
</el-form-item>
<el-form-item
label=
"备注"
prop=
"remark"
>
<el-form-item
label=
"父字典数据"
v-if=
"formData.parentId"
prop=
"dataId"
>
<el-select
v-model=
"formData.dataId"
style=
"width: 100%"
clearable
placeholder=
"请选择父字典数据"
>
<!-- @visible-change="clearSelected"-->
<el-option
v-for=
"item in optionsDict"
:key=
"item.businessId"
:label=
"item.dictLabel"
:disabled=
"item.status == 1"
:value=
"item.businessId"
>
<span
style=
"float: left"
>
{{ item.dictLabel }}
</span>
<span
v-if=
"item.status === '1'"
style=
"
float: right;
color: #8492a6;
font-size: 12px;
padding-left: 10px;
"
>
{{ "已停用" }}
</span
>
</el-option>
</el-select>
</el-form-item>
<el-form-item
label=
"备注"
prop=
"remarks"
>
<el-input
<el-input
v-model=
"formData.remark"
v-model
.
trim=
"formData.remarks"
maxlength=
"200"
type=
"textarea"
type=
"textarea"
placeholder=
"字典类型备注"
placeholder=
"请输入内容"
:autosize=
"{ minRows: 2, maxRows: 4 }"
/>
/>
</el-form-item>
</el-form-item>
</el-form>
</el-form>
<
template
#
footer
>
<
template
#
footer
>
<div
class=
"dialog-footer"
>
<div
class=
"dialog-footer"
>
<el-button
type=
"primary"
@
click=
"handleSubmit"
>
确 定
</el-button>
<el-button
@
click=
"closeDialog"
>
取 消
</el-button>
<el-button
@
click=
"closeDialog"
>
取 消
</el-button>
<el-button
type=
"primary"
:loading=
"manageLoading"
:disabled=
"manageLoading"
@
click=
"handleSubmit"
>
确 定
</el-button
>
</div>
</div>
</
template
>
</
template
>
</el-dialog>
</el-dialog>
...
...
src/views/system/role/index.vue
View file @
03d09ec5
...
@@ -445,7 +445,6 @@ onMounted(() => {
...
@@ -445,7 +445,6 @@ onMounted(() => {
placeholder=
"角色名称"
placeholder=
"角色名称"
clearable
clearable
:maxlength=
"30"
:maxlength=
"30"
size=
"small"
style=
"width: 150px"
style=
"width: 150px"
@
keyup
.
enter=
"handleQuery"
@
keyup
.
enter=
"handleQuery"
/>
/>
...
@@ -455,7 +454,6 @@ onMounted(() => {
...
@@ -455,7 +454,6 @@ onMounted(() => {
v-model=
"queryParams.roleKey"
v-model=
"queryParams.roleKey"
placeholder=
"请输入权限字符"
placeholder=
"请输入权限字符"
clearable
clearable
size=
"small"
style=
"width: 150px"
style=
"width: 150px"
@
keyup
.
enter=
"handleQuery"
@
keyup
.
enter=
"handleQuery"
/>
/>
...
@@ -465,7 +463,6 @@ onMounted(() => {
...
@@ -465,7 +463,6 @@ onMounted(() => {
v-model=
"queryParams.flag"
v-model=
"queryParams.flag"
placeholder=
"请选择角色状态"
placeholder=
"请选择角色状态"
clearable
clearable
size=
"small"
style=
"width: 150px"
style=
"width: 150px"
>
>
<el-option
<el-option
...
@@ -504,7 +501,6 @@ onMounted(() => {
...
@@ -504,7 +501,6 @@ onMounted(() => {
v-loading=
"loading"
v-loading=
"loading"
:data=
"roleList"
:data=
"roleList"
highlight-current-row
highlight-current-row
border
>
>
<el-table-column
type=
"index"
label=
"序号"
width=
"90"
/>
<el-table-column
type=
"index"
label=
"序号"
width=
"90"
/>
<el-table-column
<el-table-column
...
...
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