|
@@ -4,11 +4,11 @@
|
|
|
<el-col :span="24">
|
|
|
<!-- 表单查询 -->
|
|
|
<el-form ref="queryForm" :model="queryParams" :inline="true" size="small">
|
|
|
- <el-form-item label="字典名称" prop="description">
|
|
|
- <el-input v-model="queryParams.description" placeholder="请输入字典名称" clear />
|
|
|
+ <el-form-item label="字典名称" prop="dictValue">
|
|
|
+ <el-input v-model="queryParams.dictValue" placeholder="请输入字典名称" clear />
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="字典值" prop="dictKeyType">
|
|
|
- <el-input v-model="queryParams.dictKeyType" placeholder="请输入字典值" clear />
|
|
|
+ <el-form-item label="字典值" prop="dictKey">
|
|
|
+ <el-input v-model="queryParams.dictKey" placeholder="请输入字典值" clear />
|
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handelSearch">搜索</el-button>
|
|
@@ -29,12 +29,8 @@
|
|
|
<!-- 表格数据信息 -->
|
|
|
<el-table v-loading="loading" :data="dictList" row-key="id" @selection-change="handleSelectionChange">
|
|
|
<el-table-column type="selection" width="50" align="center" />
|
|
|
- <el-table-column key="description" label="字典名称" align="center" prop="description" />
|
|
|
- <el-table-column key="dictKeyType" label="字典值" align="center" prop="dictKeyType">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-link type="primary" @click="hendelTo(scope.row)">{{ scope.row.dictKeyType }}</el-link>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
+ <el-table-column key="dictValue" label="字典名称" align="center" prop="dictValue" />
|
|
|
+ <el-table-column key="dictKey" label="字典值" align="center" prop="dictKey" />
|
|
|
<el-table-column key="sortNum" label="排序号" align="center" prop="sortNum" />
|
|
|
<el-table-column label="操作" align="center" width="250" class-name="small-padding fixed-width">
|
|
|
<template slot-scope="scope">
|
|
@@ -59,7 +55,7 @@
|
|
|
:page.sync="queryParams.page"
|
|
|
:limit.sync="queryParams.limit"
|
|
|
align="right"
|
|
|
- @pagination="getPageDictList"
|
|
|
+ @pagination="getDictListByType"
|
|
|
/>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
@@ -135,8 +131,8 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { getPageDictList, getAllDictList } from '@/api/system/dict.js'
|
|
|
-import { getAllDictType, editDictType, addDictType, delDictType } from '@/api/system/dictType.js'
|
|
|
+import { getPageDictList, getAllDictList, getDictListByType, delDict, addDict } from '@/api/system/dict.js'
|
|
|
+import { getAllDictType, editDictType } from '@/api/system/dictType.js'
|
|
|
import selectTree from '@/components/SelectTree'
|
|
|
export default {
|
|
|
components: { selectTree },
|
|
@@ -147,7 +143,9 @@ export default {
|
|
|
// 查询参数
|
|
|
queryParams: {
|
|
|
page: 1,
|
|
|
- num: 10
|
|
|
+ num: 10,
|
|
|
+ // 字典类型
|
|
|
+ keyType: null
|
|
|
},
|
|
|
// 总条数
|
|
|
total: 0,
|
|
@@ -182,9 +180,21 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
+ const { id, dictKeyType } = this.$route.query
|
|
|
+ this.form.dictTypeId = id
|
|
|
+ this.queryParams.keyType = dictKeyType
|
|
|
this.handelSearch()
|
|
|
},
|
|
|
methods: {
|
|
|
+ /** 根据类型查字典列表数据 */
|
|
|
+ getDictListByType() {
|
|
|
+ getDictListByType(this.queryParams).then(res => {
|
|
|
+ const data = res.data
|
|
|
+ this.dictList = this.$utils.toArrayTree(data.dicts)
|
|
|
+ this.total = data.count
|
|
|
+ this.getAllDictList()
|
|
|
+ })
|
|
|
+ },
|
|
|
/** 查询所有字典类型 */
|
|
|
getAllDictType() {
|
|
|
getAllDictType(this.queryParams).then(res => {
|
|
@@ -213,7 +223,7 @@ export default {
|
|
|
/** 搜索 */
|
|
|
handelSearch() {
|
|
|
this.queryParams.page = 1
|
|
|
- this.getPageDictList()
|
|
|
+ this.getDictListByType()
|
|
|
},
|
|
|
/** 重置按钮操作 */
|
|
|
handelReset() {
|
|
@@ -274,13 +284,13 @@ export default {
|
|
|
},
|
|
|
/** 删除接口 */
|
|
|
delDictType() {
|
|
|
- delDictType(this.ids).then(res => {
|
|
|
+ delDict(this.ids).then(res => {
|
|
|
if (res.code === 200) {
|
|
|
this.$message({
|
|
|
type: 'success',
|
|
|
message: '删除成功'
|
|
|
})
|
|
|
- this.getPageDictList()
|
|
|
+ this.getDictListByType()
|
|
|
}
|
|
|
})
|
|
|
},
|
|
@@ -289,13 +299,14 @@ export default {
|
|
|
this.$refs[formName].validate((valid) => {
|
|
|
if (valid) {
|
|
|
if (this.title === '添加字典') {
|
|
|
- addDictType(this.form).then(res => {
|
|
|
+ console.log(this.form)
|
|
|
+ addDict(this.form).then(res => {
|
|
|
if (res.code === 200) {
|
|
|
this.$message({
|
|
|
message: res.data,
|
|
|
type: 'success'
|
|
|
})
|
|
|
- this.getAllDictType()
|
|
|
+ this.getDictListByType()
|
|
|
this.dialogVisible = false
|
|
|
}
|
|
|
})
|
|
@@ -306,20 +317,10 @@ export default {
|
|
|
message: res.data,
|
|
|
type: 'success'
|
|
|
})
|
|
|
- this.getAllDictType()
|
|
|
+ this.getDictListByType()
|
|
|
this.dialogVisible = false
|
|
|
}
|
|
|
})
|
|
|
- // editDict(this.form).then(res => {
|
|
|
- // if (res.code === 200) {
|
|
|
- // this.$message({
|
|
|
- // message: res.data,
|
|
|
- // type: 'success'
|
|
|
- // })
|
|
|
- // this.getPageDictList()
|
|
|
- // this.dialogVisible = false
|
|
|
- // }
|
|
|
- // })
|
|
|
}
|
|
|
}
|
|
|
})
|
|
@@ -343,6 +344,6 @@ export default {
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
- <style lang="scss" rel="stylesheet/scss" scoped>
|
|
|
+<style lang="scss" rel="stylesheet/scss" scoped>
|
|
|
|
|
|
- </style>
|
|
|
+</style>
|