Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
9
91isoft_vue_manage
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_vue_manage
Commits
7c140b98
Commit
7c140b98
authored
Jan 05, 2021
by
张伯涛
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
字典和字典类型的增删改查,导出功能调节
parent
81c27d61
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
138 additions
and
122 deletions
+138
-122
data.js
src/api/system/dict/data.js
+17
-5
main.js
src/main.js
+6
-0
data.vue
src/views/system/dict/data.vue
+111
-92
index.vue
src/views/system/dict/index.vue
+4
-25
No files found.
src/api/system/dict/data.js
View file @
7c140b98
...
...
@@ -30,7 +30,10 @@ export function getDicts(dictType) {
export
function
checkDictLabelUnique
(
dictLabel
)
{
return
request
({
url
:
'/system/dict/data/checkDictLabelUnique?dictLabel='
+
dictLabel
,
method
:
'get'
method
:
'get'
,
headers
:
{
'Content-Type'
:
'application/x-www-form-urlencoded'
}
})
}
...
...
@@ -40,7 +43,10 @@ export function addData(data) {
return
request
({
url
:
'/system/dict/data/add'
,
method
:
'post'
,
data
:
data
data
:
data
,
headers
:
{
'Content-Type'
:
'application/x-www-form-urlencoded'
}
})
}
...
...
@@ -51,7 +57,10 @@ export function updateData(data) {
return
request
({
url
:
'/system/dict/data/update/'
+
businessId
,
method
:
'put'
,
data
:
data
data
:
data
,
headers
:
{
'Content-Type'
:
'application/x-www-form-urlencoded'
}
})
}
...
...
@@ -59,14 +68,17 @@ export function updateData(data) {
export
function
delData
(
dictCode
)
{
return
request
({
url
:
'/system/dict/data/deleteLogical/'
+
dictCode
,
method
:
'delete'
method
:
'delete'
,
headers
:
{
'Content-Type'
:
'application/x-www-form-urlencoded'
}
})
}
// 导出字典数据
export
function
exportData
(
query
)
{
return
request
({
url
:
'/system/dict/data/export'
+
query
.
dictType
,
url
:
'/system/dict/data/export
/
'
+
query
.
dictType
,
method
:
'get'
,
params
:
query
,
responseType
:
'blob'
...
...
src/main.js
View file @
7c140b98
...
...
@@ -62,6 +62,12 @@ Vue.prototype.$uploadFile = uploadPublic
Vue
.
prototype
.
$haveAuth
=
includePermission
// set ElementUI lang to EN
Vue
.
prototype
.
$axios
=
xhr
// 未解析的函数或方法 msgSuccess(),需添加以下代码
Vue
.
prototype
.
msgSuccess
=
function
(
msg
)
{
this
.
$message
({
showClose
:
true
,
message
:
msg
,
type
:
'success'
})
}
Vue
.
prototype
.
$parseDate
=
(
value
,
format
)
=>
{
if
(
!
value
||
value
===
''
)
{
return
'-'
...
...
src/views/system/dict/data.vue
View file @
7c140b98
<
template
>
<div
class=
"app-container"
>
<div
class=
"optionsContent"
>
<el-form
ref=
"queryForm"
style=
"width: 100%"
:model=
"queryParams"
:inline=
"true"
>
<el-form-item
label=
"字典名称"
prop=
"dictType"
>
<el-select
v-model=
"queryParams.dictType"
placeholder=
"请选择字典名称"
clearable
size=
"small"
>
<el-option
v-for=
"item in typeOptions"
:key=
"item.businessId"
:label=
"item.dictName"
:value=
"item.dictType"
/>
</el-select>
</el-form-item>
<el-form-item
label=
"字典标签"
prop=
"dictLabel"
>
<el-input
v-model=
"queryParams.dictLabel"
placeholder=
"请输入字典标签"
clearable
:maxlength=
"30"
size=
"small"
@
keyup
.
enter
.
native=
"handleQuery"
<el-form
v-show=
"showSearch"
ref=
"queryForm"
style=
"width: 100%"
:model=
"queryParams"
:inline=
"true"
>
<el-form-item
label=
"字典名称"
prop=
"dictType"
>
<el-select
v-model=
"queryParams.dictType"
placeholder=
"请选择字典名称"
clearable
size=
"small"
>
<el-option
v-for=
"item in typeOptions"
:key=
"item.businessId"
:label=
"item.dictName"
:value=
"item.dictType"
/>
</el-form-item>
<el-form-item
label=
"状态"
prop=
"status"
>
<el-select
v-model=
"queryParams.status"
placeholder=
"数据状态"
clearable
size=
"small"
>
<el-option
v-for=
"dict in statusOptions"
:key=
"dict.dictValue"
:label=
"dict.dictLabel"
:value=
"dict.dictValue"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button
type=
"primary"
size=
"small"
@
click=
"handleQuery"
>
查询
</el-button>
<!--
<el-button
size=
"small"
@
click=
"resetQuery"
>
重置
</el-button>
-->
</el-form-item>
</el-form>
<div
style=
"white-space: nowrap"
>
</el-select>
</el-form-item>
<el-form-item
label=
"字典标签"
prop=
"dictLabel"
>
<el-input
v-model=
"queryParams.dictLabel"
placeholder=
"请输入字典标签"
clearable
:maxlength=
"30"
size=
"small"
@
keyup
.
enter
.
native=
"handleQuery"
/>
</el-form-item>
<el-form-item
label=
"状态"
prop=
"flag"
>
<el-select
v-model=
"queryParams.flag"
placeholder=
"数据状态"
clearable
size=
"small"
>
<el-option
v-for=
"dict in statusOptions"
:key=
"dict.dictValue"
:label=
"dict.dictLabel"
:value=
"dict.dictValue"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button
type=
"primary"
size=
"small"
@
click=
"handleQuery"
>
搜索
</el-button>
<el-button
size=
"small"
@
click=
"resetQuery"
>
重置
</el-button>
</el-form-item>
</el-form>
<el-row
:gutter=
"10"
class=
"mb8"
>
<el-col
:span=
"1.5"
>
<el-button
v-hasPermi=
"['system:dict
Config
:add']"
v-hasPermi=
"['system:dict:add']"
type=
"primary"
size=
"small"
icon=
"el-icon-plus"
size=
"mini"
@
click=
"handleAdd"
>
新增
</el-button>
>
新增
</el-button>
</el-col>
<el-col
:span=
"1.5"
>
<el-button
v-hasPermi=
"['system:dict
Config:expor
t']"
v-hasPermi=
"['system:dict
:edi
t']"
type=
"success"
size=
"small"
icon=
"el-icon-edit"
size=
"mini"
:disabled=
"single"
@
click=
"handleUpdate"
>
修改
</el-button>
</el-col>
<el-col
:span=
"1.5"
>
<el-button
v-hasPermi=
"['system:dict:remove']"
type=
"danger"
icon=
"el-icon-delete"
size=
"mini"
:disabled=
"multiple"
@
click=
"handleDelete"
>
删除
</el-button>
</el-col>
<el-col
:span=
"1.5"
>
<el-button
type=
"warning"
icon=
"el-icon-download"
size=
"mini"
@
click=
"handleExport"
>
导出
</el-button>
<!--
<el-button
size=
"small"
@
click=
"resetQuery"
>
重置
</el-button>
-->
</div>
</div>
>
导出
</el-button>
</el-col>
<right-toolbar
:show-search
.
sync=
"showSearch"
@
queryTable=
"getList"
/>
</el-row>
<div
class=
"placeholder"
/>
<div
style=
"padding:10px"
>
<div
class=
"mb12 font-small-bold"
>
字典参数列表
</div>
<el-table
v-loading=
"loading"
:data=
"dataList"
border
>
<el-table-column
type=
"
index"
label=
"序号"
width=
"50
"
/>
<el-table
v-loading=
"loading"
:data=
"dataList"
border
@
selection-change=
"handleSelectionChange"
>
<el-table-column
type=
"
selection"
width=
"55"
align=
"center
"
/>
<!--
<el-table-column
:show-overflow-tooltip=
"true"
label=
"参数编码"
prop=
"dictCode"
>
-->
<!--
<template
slot-scope=
"scope"
>
-->
<!--
{{
scope
.
row
.
dictCode
||
'-'
}}
-->
<!--
</
template
>
-->
<!-- </el-table-column>-->
<el-table-column
:show-overflow-tooltip=
"true"
label=
"参数标签"
prop=
"dictLabel"
>
<el-table-column
label=
"字典编码"
align=
"center"
prop=
"businessId"
/>
<el-table-column
:show-overflow-tooltip=
"true"
label=
"字典标签"
prop=
"dictLabel"
>
<
template
slot-scope=
"scope"
>
{{
scope
.
row
.
dictLabel
||
'-'
}}
</
template
>
</el-table-column>
<el-table-column
:show-overflow-tooltip=
"true"
label=
"
参数
键值"
prop=
"dictValue"
>
<el-table-column
:show-overflow-tooltip=
"true"
label=
"
字典
键值"
prop=
"dictValue"
>
<
template
slot-scope=
"scope"
>
{{
scope
.
row
.
dictValue
||
'-'
}}
</
template
>
</el-table-column>
<el-table-column
:show-overflow-tooltip=
"true"
label=
"
参数
排序"
prop=
"dictSort"
>
<el-table-column
:show-overflow-tooltip=
"true"
label=
"
字典
排序"
prop=
"dictSort"
>
<
template
slot-scope=
"scope"
>
{{
isNaN
(
scope
.
row
.
dictSort
)
?
'-'
:
scope
.
row
.
dictSort
}}
</
template
>
</el-table-column>
<el-table-column
:show-overflow-tooltip=
"true"
label=
"备注"
prop=
"remark"
>
<el-table-column
label=
"状态"
align=
"center"
prop=
"flag"
:formatter=
"statusFormat"
/>
<el-table-column
:show-overflow-tooltip=
"true"
label=
"备注"
prop=
"remarks"
>
<
template
slot-scope=
"scope"
>
{{
scope
.
row
.
remark
||
'-'
}}
{{
scope
.
row
.
remark
s
||
'-'
}}
</
template
>
</el-table-column>
<el-table-column
:show-overflow-tooltip=
"true"
label=
"创建时间"
prop=
"create
Tim
e"
>
<el-table-column
:show-overflow-tooltip=
"true"
label=
"创建时间"
prop=
"create
Dat
e"
>
<
template
slot-scope=
"scope"
>
<span>
{{
scope
.
row
.
create
Tim
e
|
transformDateByFormat
(
'YYYY-MM-DD HH:mm'
)
}}
</span>
<span>
{{
scope
.
row
.
create
Dat
e
|
transformDateByFormat
(
'YYYY-MM-DD HH:mm'
)
}}
</span>
</
template
>
</el-table-column>
<el-table-column
label=
"操作"
class-name=
"small-padding fixed-width"
>
...
...
@@ -114,7 +143,6 @@
/>
</
template
>
</el-table-column>
<!-- <el-table-column label="状态" prop="status" :formatter="statusFormat" />-->
</el-table>
</div>
<pagination
...
...
@@ -126,7 +154,7 @@
/>
<!-- 添加或修改参数配置对话框 -->
<el-dialog
title=
"字典参数信息
"
:visible
.
sync=
"open"
width=
"500px"
append-to-body
>
<el-dialog
:title=
"title
"
:visible
.
sync=
"open"
width=
"500px"
append-to-body
>
<el-form
ref=
"form"
:model=
"form"
:rules=
"rules"
label-width=
"80px"
>
<el-form-item
label=
"字典类型"
>
<el-input
v-model
.
trim=
"form.dictType"
:disabled=
"true"
show-word-limit
maxlength=
"30"
placeholder=
"请输入字典类型"
/>
...
...
@@ -149,13 +177,13 @@
>
{{ dict.dictLabel }}
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item
label=
"备注"
prop=
"remark"
>
<el-input
v-model
.
trim=
"form.remark"
type=
"textarea"
show-word-limit
maxlength=
"200"
placeholder=
"请输入内容"
/>
<el-form-item
label=
"备注"
prop=
"remark
s
"
>
<el-input
v-model
.
trim=
"form.remark
s
"
type=
"textarea"
show-word-limit
maxlength=
"200"
placeholder=
"请输入内容"
/>
</el-form-item>
</el-form>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
type=
"primary"
@
click=
"submitForm"
>
确 定
</el-button>
<el-button
@
click=
"cancel"
>
取 消
</el-button>
<el-button
type=
"primary"
:loading=
"manageLoading"
:disabled=
"manageLoading"
@
click=
"submitForm"
>
确 定
</el-button>
</div>
</el-dialog>
</div>
...
...
@@ -205,6 +233,8 @@ export default {
single
:
true
,
// 非多个禁用
multiple
:
true
,
// 显示搜索条件
showSearch
:
true
,
// 总条数
total
:
0
,
// 字典表格数据
...
...
@@ -238,7 +268,8 @@ export default {
pageSize
:
10
,
dictName
:
undefined
,
dictType
:
undefined
,
status
:
''
status
:
''
,
flag
:
undefined
},
// 表单参数
form
:
{},
...
...
@@ -308,7 +339,7 @@ export default {
},
// 数据状态字典翻译
statusFormat
(
row
,
column
)
{
return
this
.
selectDictLabel
(
this
.
statusOptions
,
row
.
status
)
return
this
.
selectDictLabel
(
this
.
statusOptions
,
row
.
flag
)
},
// 取消按钮
cancel
()
{
...
...
@@ -318,16 +349,18 @@ export default {
// 表单重置
reset
()
{
this
.
form
=
{
bussinessId
:
undefined
,
dictCode
:
undefined
,
dictLabel
:
undefined
,
dictValue
:
undefined
,
dictSort
:
0
,
flag
:
'1'
,
status
:
'0'
,
remark
:
undefined
remark
s
:
undefined
}
this
.
resetForm
(
'form'
)
},
/**
查询
按钮操作 */
/**
搜索
按钮操作 */
handleQuery
()
{
this
.
queryParams
.
pageNum
=
1
this
.
getList
()
...
...
@@ -342,63 +375,49 @@ export default {
handleAdd
()
{
this
.
reset
()
this
.
open
=
true
this
.
title
=
'添加'
this
.
title
=
'添加
字典数据
'
this
.
form
.
dictType
=
this
.
queryParams
.
dictType
this
.
form
.
status
=
'0'
},
// 多选框选中数据
handleSelectionChange
(
selection
)
{
this
.
ids
=
selection
.
map
(
item
=>
item
.
dictCode
)
this
.
ids
=
selection
.
map
(
item
=>
item
.
businessId
)
this
.
single
=
selection
.
length
!==
1
this
.
multiple
=
!
selection
.
length
},
/** 修改按钮操作 */
handleUpdate
(
row
)
{
this
.
reset
()
const
dictCode
=
row
.
dictCode
||
this
.
ids
const
dictCode
=
row
.
businessId
||
this
.
ids
getData
(
dictCode
).
then
(
response
=>
{
this
.
form
=
response
.
data
this
.
form
.
dictLabelOne
=
response
.
data
.
dictLabel
this
.
open
=
true
this
.
title
=
'
字典数据信息
'
this
.
title
=
'
修改字典数据
'
})
},
/** 提交按钮 */
submitForm
:
function
()
{
this
.
$refs
[
'form'
].
validate
(
valid
=>
{
if
(
valid
)
{
this
.
manageLoading
=
true
if
(
this
.
form
.
dictCode
)
{
if
(
this
.
form
.
businessId
!==
undefined
)
{
updateData
(
this
.
form
).
then
(
response
=>
{
if
(
response
.
code
===
200
)
{
this
.
$message
({
message
:
'修改成功'
,
type
:
'success'
})
this
.
cancel
()
this
.
getList
()
}
this
.
manageLoading
=
false
}).
catch
(()
=>
{
this
.
manageLoading
=
false
})
this
.
msgSuccess
(
'修改成功'
)
this
.
open
=
false
this
.
getList
()
})
}
else
{
addData
(
this
.
form
).
then
(
response
=>
{
if
(
response
.
code
===
200
)
{
this
.
$message
({
message
:
'新增成功'
,
type
:
'success'
})
this
.
cancel
()
this
.
getList
()
}
this
.
manageLoading
=
false
}).
catch
(()
=>
{
this
.
manageLoading
=
false
})
this
.
msgSuccess
(
'新增成功'
)
this
.
open
=
false
this
.
getList
()
})
}
}
})
},
/** 删除按钮操作 */
handleDelete
(
row
)
{
const
dictCodes
=
row
.
dictCode
||
this
.
ids
const
dictCodes
=
row
.
businessId
||
this
.
ids
this
.
$confirm
(
'所选择数据被删除后不可再恢复,是否继续?'
,
'提示'
,
{
confirmButtonText
:
'确定'
,
cancelButtonText
:
'取消'
,
...
...
src/views/system/dict/index.vue
View file @
7c140b98
...
...
@@ -125,7 +125,7 @@
</
template
>
</el-table-column>
<el-table-column
label=
"状态"
align=
"center"
prop=
"flag"
:formatter=
"statusFormat"
/>
<el-table-column
label=
"备注"
prop=
"remark"
:show-overflow-tooltip=
"true"
>
<el-table-column
label=
"备注"
prop=
"remark
s
"
:show-overflow-tooltip=
"true"
>
<
template
slot-scope=
"scope"
>
{{
scope
.
row
.
remarks
||
'-'
}}
</
template
>
...
...
@@ -205,8 +205,8 @@
<!-- </el-option>-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<el-form-item
label=
"备注"
prop=
"remark"
>
<el-input
v-model
.
trim=
"form.remark"
maxlength=
"200"
type=
"textarea"
placeholder=
"请输入内容"
/>
<el-form-item
label=
"备注"
prop=
"remark
s
"
>
<el-input
v-model
.
trim=
"form.remark
s
"
maxlength=
"200"
type=
"textarea"
placeholder=
"请输入内容"
/>
</el-form-item>
</el-form>
<div
slot=
"footer"
class=
"dialog-footer"
>
...
...
@@ -417,7 +417,7 @@ export default {
dictName
:
undefined
,
dictType
:
undefined
,
status
:
'0'
,
remark
:
undefined
,
remark
s
:
undefined
,
flag
:
'1'
}
},
...
...
@@ -454,27 +454,6 @@ export default {
this
.
title
=
'修改字典类型'
})
},
// handleUpdate(row) {
// this.reset()
// this.form.dictName = row.dictName
// this.form.dictType = row.dictType
// this.form.remark = row.remark
// this.form.dictNameOne = row.dictName
// this.form.dictTypeOne = row.dictType
// this.form.businessId = row.businessId
// const parentId = row.parentId
// if (parentId) {
// this.form.parentId = parentId
// selectDictType(this.options.find(item => { return item.businessId === parentId }).dictType).then(response => {
// this.optionsDict = response.data
// })
// }
// if (row.dataId) {
// this.form.dataId = row.dataId
// }
// this.open = true
// this.title = 'update'
// },
/** 提交按钮 */
submitForm
()
{
this
.
$refs
[
'form'
].
validate
(
valid
=>
{
...
...
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