ljh 2 years ago
parent
commit
3781d38c8c

+ 52 - 3
chuanyi-admin/src/api/system/dict.js

@@ -1,9 +1,58 @@
 import request from '@/utils/request'
 
-// 获取部门列表
-export function getDictList() {
+// 分页获取字典列表数据
+export function getPageDictList(query) {
+  return request({
+    url: '/dict/queryPage',
+    method: 'get',
+    params: query
+  })
+}
+
+// 全量获取字典列表数据
+export function getAllDictList() {
   return request({
     url: '/dict/queryAll',
-    method: 'get'
+    method: 'get',
+    params: {
+      page: 1,
+      num: 999
+    }
+  })
+}
+
+// 根据id或字典key条件查询
+export function getDictDetailByIdorKey(query) {
+  return request({
+    url: '/dict/queryByIdorKey',
+    method: 'get',
+    params: query
+  })
+}
+
+// 根编辑字典
+export function editDict(data) {
+  return request({
+    url: '/dict/updateById',
+    method: 'post',
+    data
+  })
+}
+
+// 新增字典
+export function addDict(data) {
+  return request({
+    url: '/dict/addDict',
+    method: 'post',
+    data
+  })
+}
+
+// 删除字典
+export function delDict(data) {
+  return request({
+    url: '/dict/deleteById',
+    method: 'post',
+    data
   })
 }

+ 46 - 0
chuanyi-admin/src/api/system/dictType.js

@@ -0,0 +1,46 @@
+import request from '@/utils/request'
+
+// 查询所有字典类型
+export function getAllDictType(query) {
+  return request({
+    url: '/dict/queryType',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询字典类型对应数据
+export function getAllDictTypeByType(query) {
+  return request({
+    url: '/dict/queryByType',
+    method: 'get',
+    params: query
+  })
+}
+
+// 编辑字典类型
+export function editDictType(data) {
+  return request({
+    url: '/dict/updateById',
+    method: 'post',
+    data
+  })
+}
+
+// 新增字典类型
+export function addDictType(data) {
+  return request({
+    url: '/dict/addDictType',
+    method: 'post',
+    data
+  })
+}
+
+// 删除字典类型
+export function delDictType(query) {
+  return request({
+    url: '/dict/deleteDictTypeById',
+    method: 'get',
+    params: query
+  })
+}

+ 1 - 1
chuanyi-admin/src/components/Pagination/index.vue

@@ -30,7 +30,7 @@ export default {
     },
     limit: {
       type: Number,
-      default: 20
+      default: 10
     },
     pageSizes: {
       type: Array,

+ 2 - 2
chuanyi-admin/src/components/SelectTree/index.vue

@@ -7,7 +7,7 @@
       :value="parentId"
       @input="handelInput"
     >
-      <div slot="value-label" slot-scope="{ node }">{{ node.raw.id == 0 ? '主菜单' : node.raw.departmentName }}</div>
+      <div slot="value-label" slot-scope="{ node }">{{ node.raw.id==0?'主菜单':node.raw[keyName] }}</div>
     </treeselect>
   </div>
 </template>
@@ -35,7 +35,7 @@ export default {
     keyName: {
       type: String
     },
-    // 选中部门
+    // 回显id
     parentId: {
       type: Number
     }

+ 4 - 0
chuanyi-admin/src/main.js

@@ -14,6 +14,10 @@ import './utils/error-log'
 import * as filters from './filters'
 import Pagination from '@/components/Pagination'
 
+import XEUtils from 'xe-utils'
+import VXEUtils from 'vxe-utils'
+
+Vue.use(VXEUtils, XEUtils, { mounts: ['cookie'] })
 /**
  * If you don't want to use mock-server
  * you want to use MockJs for mock api

+ 13 - 0
chuanyi-admin/src/router/index.js

@@ -103,6 +103,19 @@ export const constantRoutes = [
         meta: { title: '分配菜单', activeMenu: '/system/role' }
       }
     ]
+  },
+  {
+    path: '/system/dict/dict-detail',
+    component: Layout,
+    hidden: true,
+    children: [
+      {
+        path: 'role/:keyType',
+        component: () => import('@/views/system/dict/dict-detail'),
+        name: 'DictDetail',
+        meta: { title: '字典详情', activeMenu: '/system/dict' }
+      }
+    ]
   }
 ]
 

+ 3 - 4
chuanyi-admin/src/views/system/dept/index.vue

@@ -35,7 +35,7 @@
             <template slot-scope="scope">
               <el-button size="mini" type="text" icon="el-icon-edit" @click="handelEdit(scope.row.id)">修改
               </el-button>
-              <el-button size="mini" type="text" icon="el-icon-delete" @click="handelDel(scope.row.id)">删除
+              <el-button size="mini" type="text" icon="el-icon-delete" :disabled="!multiple" @click="handelDel(scope.row.id)">删除
               </el-button>
             </template>
           </el-table-column>
@@ -100,7 +100,6 @@
 <script>
 import { getDeptList, addDept, getDeptById, editDept, delDept, getAllSonMenuList } from '@/api/system/dept.js'
 import selectTree from '@/components/SelectTree'
-import XEUtils from 'xe-utils'
 export default {
   components: { selectTree },
   data() {
@@ -122,7 +121,7 @@ export default {
       title: '',
       // 弹出框表单
       form: {},
-      // 菜单类别
+      // 部门树数据
       options: [],
       // 表单验证
       rules: {
@@ -155,7 +154,7 @@ export default {
       getDeptList(this.queryParams).then(res => {
         if (res.code === 200) {
           const data = res.data
-          this.deptList = XEUtils.toArrayTree(data.departmentList)
+          this.deptList = this.$utils.toArrayTree(data.departmentList)
           this.total = data.count
           this.getOptionsList()
         }

+ 348 - 0
chuanyi-admin/src/views/system/dict/dict-detail.vue

@@ -0,0 +1,348 @@
+<template>
+  <div class="sy-content">
+    <el-row>
+      <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>
+          <el-form-item label="字典值" prop="dictKeyType">
+            <el-input v-model="queryParams.dictKeyType" placeholder="请输入字典值" clear />
+          </el-form-item>
+          <el-form-item>
+            <el-button type="primary" icon="el-icon-search" size="mini" @click="handelSearch">搜索</el-button>
+            <el-button icon="el-icon-refresh" size="mini" @click="handelReset">重置</el-button>
+          </el-form-item>
+        </el-form>
+
+        <el-button size="mini" icon="el-icon-plus" type="primary" plain @click="handelAdd">新增</el-button>
+        <el-button
+          type="danger"
+          plain
+          icon="el-icon-circle-close"
+          size="mini"
+          :disabled="multiple"
+          @click="handelDelAll"
+        >批量删除</el-button>
+
+        <!-- 表格数据信息 -->
+        <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="sortNum" label="排序号" align="center" prop="sortNum" />
+          <el-table-column label="操作" align="center" width="250" class-name="small-padding fixed-width">
+            <template slot-scope="scope">
+              <el-button size="mini" type="text" icon="el-icon-edit" @click="handelEdit(scope.row)">修改
+              </el-button>
+              <el-button
+                size="mini"
+                type="text"
+                icon="el-icon-delete"
+                :disabled="!multiple"
+                @click="handelDel(scope.row.id)"
+              >删除
+              </el-button>
+            </template>
+          </el-table-column>
+        </el-table>
+
+        <!-- 分页信息 -->
+        <pagination
+          v-show="total > 0"
+          :total="total"
+          :page.sync="queryParams.page"
+          :limit.sync="queryParams.limit"
+          align="right"
+          @pagination="getPageDictList"
+        />
+      </el-col>
+    </el-row>
+
+    <!-- 弹出框 -->
+    <!-- <el-dialog :title="title" :visible.sync="dialogVisible" width="35%" append-to-body>
+        <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+          <el-row>
+            <el-col :span="12">
+              <el-form-item label="字典描述" prop="description">
+                <el-input v-model="form.description" clearable placeholder="请输入字典名称" />
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="字典类型" prop="dictKeyValue">
+                <el-input v-model="form.dictKeyValue" clearable placeholder="请输入字典名称" />
+              </el-form-item>
+            </el-col>
+          </el-row>
+          <el-row>
+            <el-col :span="12">
+              <el-form-item label="字典值" prop="dictKeyType">
+                <el-input v-model="form.dictKeyType" clearable placeholder="请输入字典值" />
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="显示排序" prop="sortNum">
+                <el-input-number v-model="form.sortNum" placeholder="0" controls-position="right" :min="1" :max="10" />
+              </el-form-item>
+            </el-col>
+          </el-row>
+        </el-form>
+        <span slot="footer" class="dialog-footer">
+          <el-button type="primary" @click="handelSubmit('form')">确 定</el-button>
+          <el-button @click="handelCancel('form')">取 消</el-button>
+        </span>
+      </el-dialog> -->
+    <el-dialog :title="title" :visible.sync="dialogVisible" width="35%" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-row>
+          <el-col :span="24">
+            <el-form-item label="上级字典" prop="parentId">
+              <selectTree v-model="form.parentId" :options="options" placeholder="请选择上级字典" :key-name="keyName" />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row>
+          <el-col :span="24">
+            <el-form-item label="字典名称" prop="dictValue">
+              <el-input v-model="form.dictValue" clearable placeholder="请输入字典名称" />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row>
+          <el-col :span="12">
+            <el-form-item label="字典值" prop="dictKey">
+              <el-input v-model="form.dictKey" clearable placeholder="请输入字典值" />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="显示排序" prop="sortNum">
+              <el-input-number v-model="form.sortNum" placeholder="0" controls-position="right" :min="1" :max="10" />
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+      <span slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="handelSubmit('form')">确 定</el-button>
+        <el-button @click="handelCancel('form')">取 消</el-button>
+      </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { getPageDictList, getAllDictList } from '@/api/system/dict.js'
+import { getAllDictType, editDictType, addDictType, delDictType } from '@/api/system/dictType.js'
+import selectTree from '@/components/SelectTree'
+export default {
+  components: { selectTree },
+  data() {
+    return {
+      // 遮罩层
+      loading: false,
+      // 查询参数
+      queryParams: {
+        page: 1,
+        num: 10
+      },
+      // 总条数
+      total: 0,
+      // 表格数据
+      dictList: [],
+      // 弹出框
+      dialogVisible: false,
+      // 弹出框标题
+      title: '',
+      // 弹出框表单
+      form: {},
+      // 字典树数据
+      options: [],
+      // 表单验证
+      rules: {
+        description: [
+          { required: true, message: '字典名称不能为空', trigger: 'blur' }
+        ],
+        dictKeyType: [
+          { required: true, message: '字典值不能为空', trigger: 'blur' }
+        ],
+        sortNum: [
+          { required: true, message: '排序不能为空', trigger: ['change', 'blur'] }
+        ]
+      },
+      // 控制批量删除按钮
+      multiple: true,
+      // 删除字典id集合
+      ids: [],
+      // 自定义treeselect键名
+      keyName: null
+    }
+  },
+  created() {
+    this.handelSearch()
+  },
+  methods: {
+    /** 查询所有字典类型 */
+    getAllDictType() {
+      getAllDictType(this.queryParams).then(res => {
+        const data = res.data
+        this.dictList = data.dictTypes
+        this.total = data.count
+      })
+    },
+    /** 分页获取字典列表数据 */
+    getPageDictList() {
+      getPageDictList(this.queryParams).then(res => {
+        const data = res.data
+        this.dictList = this.$utils.toArrayTree(data.dictPage)
+        this.total = data.count
+        this.getAllDictList()
+      })
+    },
+    /** 全量获取字典列表数据 */
+    getAllDictList() {
+      getAllDictList().then(res => {
+        const data = res.data
+        this.options = this.$utils.toArrayTree(data.dicts)
+        this.keyName = 'dictValue'
+      })
+    },
+    /** 搜索 */
+    handelSearch() {
+      this.queryParams.page = 1
+      this.getPageDictList()
+    },
+    /** 重置按钮操作 */
+    handelReset() {
+      this.$refs['queryForm'].resetFields()
+      this.handelSearch()
+    },
+    /** 新增按钮 */
+    handelAdd() {
+      this.dialogVisible = true
+      this.title = '添加字典'
+      this.reset()
+    },
+    /** 修改按钮 */
+    handelEdit(id) {
+      // this.queryParams.dictKey = id
+      // getDictDetailByIdorKey(this.queryParams).then(res => {
+      //   const data = res.data
+      //   this.form = data.dicts[0]
+      // })
+      // this.dialogVisible = true
+      // this.title = '修改字典'
+    },
+    /** 表格多选 */
+    handleSelectionChange(val) {
+      this.ids = val.map(item => item.id)
+      this.multiple = !val.length
+    },
+    /** 删除按钮 */
+    handelDel(id) {
+      this.$confirm('是否删除该字典?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        this.ids.push(id)
+        this.delDictType()
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: '已取消删除'
+        })
+      })
+    },
+    /** 批量删除 */
+    handelDelAll() {
+      this.$confirm('是否批量删除字典?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        this.delDictType()
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: '已取消删除'
+        })
+      })
+    },
+    /** 删除接口 */
+    delDictType() {
+      delDictType(this.ids).then(res => {
+        if (res.code === 200) {
+          this.$message({
+            type: 'success',
+            message: '删除成功'
+          })
+          this.getPageDictList()
+        }
+      })
+    },
+    /** 表单提交 */
+    handelSubmit(formName) {
+      this.$refs[formName].validate((valid) => {
+        if (valid) {
+          if (this.title === '添加字典') {
+            addDictType(this.form).then(res => {
+              if (res.code === 200) {
+                this.$message({
+                  message: res.data,
+                  type: 'success'
+                })
+                this.getAllDictType()
+                this.dialogVisible = false
+              }
+            })
+          } else {
+            editDictType(this.form).then(res => {
+              if (res.code === 200) {
+                this.$message({
+                  message: res.data,
+                  type: 'success'
+                })
+                this.getAllDictType()
+                this.dialogVisible = false
+              }
+            })
+            // editDict(this.form).then(res => {
+            //   if (res.code === 200) {
+            //     this.$message({
+            //       message: res.data,
+            //       type: 'success'
+            //     })
+            //     this.getPageDictList()
+            //     this.dialogVisible = false
+            //   }
+            // })
+          }
+        }
+      })
+    },
+    /** 表单取消 */
+    handelCancel() {
+      this.dialogVisible = false
+      this.reset()
+    },
+    /** 表单重置 */
+    reset() {
+      if (this.$refs['form']) {
+        this.$refs['form'].resetFields()
+      }
+    },
+    /** 选择字典类型跳转 */
+    hendelTo(row) {
+      console.log(row)
+    }
+  }
+}
+</script>
+
+  <style lang="scss" rel="stylesheet/scss" scoped>
+
+  </style>

+ 78 - 98
chuanyi-admin/src/views/system/dict/index.vue

@@ -4,8 +4,11 @@
       <el-col :span="24">
         <!-- 表单查询 -->
         <el-form ref="queryForm" :model="queryParams" :inline="true" size="small">
-          <el-form-item label="部门名称" prop="departmentName">
-            <el-input v-model="queryParams.departmentName" placeholder="请输入部门名称" clear />
+          <el-form-item label="字典名称" prop="description">
+            <el-input v-model="queryParams.description" placeholder="请输入字典名称" clear />
+          </el-form-item>
+          <el-form-item label="字典值" prop="dictKeyType">
+            <el-input v-model="queryParams.dictKeyType" placeholder="请输入字典值" clear />
           </el-form-item>
           <el-form-item>
             <el-button type="primary" icon="el-icon-search" size="mini" @click="handelSearch">搜索</el-button>
@@ -24,18 +27,26 @@
         >批量删除</el-button>
 
         <!-- 表格数据信息 -->
-        <el-table v-loading="loading" :data="deptList" row-key="id" @selection-change="handleSelectionChange">
+        <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="departmentName" label="部门名称" align="center" prop="departmentName" />
-          <el-table-column key="departmentDescribe" label="部门描述" align="center" prop="departmentDescribe" />
-          <el-table-column key="departmentNum" label="排序号" align="center" prop="departmentNum" />
-          <el-table-column key="updateTime" label="更新时间" align="center" prop="updateTime" />
-          <el-table-column key="createTime" label="创建时间" align="center" prop="createTime" />
+          <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="sortNum" label="排序号" align="center" prop="sortNum" />
           <el-table-column label="操作" align="center" width="250" class-name="small-padding fixed-width">
             <template slot-scope="scope">
-              <el-button size="mini" type="text" icon="el-icon-edit" @click="handelEdit(scope.row.id)">修改
+              <el-button size="mini" type="text" icon="el-icon-edit" @click="handelEdit(scope.row)">修改
               </el-button>
-              <el-button size="mini" type="text" icon="el-icon-delete" @click="handelDel(scope.row.id)">删除
+              <el-button
+                size="mini"
+                type="text"
+                icon="el-icon-delete"
+                :disabled="!multiple"
+                @click="handelDel(scope.row.id)"
+              >删除
               </el-button>
             </template>
           </el-table-column>
@@ -48,7 +59,7 @@
           :page.sync="queryParams.page"
           :limit.sync="queryParams.limit"
           align="right"
-          @pagination="getDeptList"
+          @pagination="getAllDictType"
         />
       </el-col>
     </el-row>
@@ -57,34 +68,26 @@
     <el-dialog :title="title" :visible.sync="dialogVisible" width="35%" append-to-body>
       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
         <el-row>
-          <el-col :span="24">
-            <el-form-item label="上级部门" prop="parentId">
-              <selectTree v-model="form.parentId" :options="options" placeholder="请选择上级部门" :name="name" />
+          <el-col :span="12">
+            <el-form-item label="字典描述" prop="description">
+              <el-input v-model="form.description" clearable placeholder="请输入字典名称" />
             </el-form-item>
           </el-col>
-        </el-row>
-        <el-row>
-          <el-col :span="24">
-            <el-form-item label="部门名称" prop="departmentName">
-              <el-input v-model="form.departmentName" clearable placeholder="请输入部门名称" />
+          <el-col :span="12">
+            <el-form-item label="字典类型" prop="dictKeyValue">
+              <el-input v-model="form.dictKeyValue" clearable placeholder="请输入字典名称" />
             </el-form-item>
           </el-col>
         </el-row>
         <el-row>
           <el-col :span="12">
-            <el-form-item label="部门描述" prop="departmentDescribe">
-              <el-input v-model="form.departmentDescribe" clearable placeholder="请输入部门描述" />
+            <el-form-item label="字典值" prop="dictKeyType">
+              <el-input v-model="form.dictKeyType" clearable placeholder="请输入字典值" />
             </el-form-item>
           </el-col>
           <el-col :span="12">
-            <el-form-item label="显示排序" prop="departmentNum">
-              <el-input-number
-                v-model="form.departmentNum"
-                placeholder="0"
-                controls-position="right"
-                :min="1"
-                :max="10"
-              />
+            <el-form-item label="显示排序" prop="sortNum">
+              <el-input-number v-model="form.sortNum" placeholder="0" controls-position="right" :min="1" :max="10" />
             </el-form-item>
           </el-col>
         </el-row>
@@ -98,12 +101,8 @@
 </template>
 
 <script>
-import { getDeptList, addDept, getDeptById, editDept, delDept, getAllSonMenuList } from '@/api/system/dept.js'
-import { getDictList } from '@/api/system/dict.js'
-import selectTree from '@/components/SelectTree'
-import XEUtils from 'xe-utils'
+import { getAllDictType, editDictType, addDictType, delDictType } from '@/api/system/dictType.js'
 export default {
-  components: { selectTree },
   data() {
     return {
       // 遮罩层
@@ -116,67 +115,51 @@ export default {
       // 总条数
       total: 0,
       // 表格数据
-      deptList: [],
+      dictList: [],
       // 弹出框
       dialogVisible: false,
       // 弹出框标题
       title: '',
       // 弹出框表单
       form: {},
-      // 菜单类别
+      // 字典树数据
       options: [],
       // 表单验证
       rules: {
-        departmentName: [
-          { required: true, message: '部门单名称不能为空', trigger: 'blur' }
+        description: [
+          { required: true, message: '字典名称不能为空', trigger: 'blur' }
         ],
-        departmentDescribe: [
-          { required: true, message: '部门描述不能为空', trigger: 'blur' }
+        dictKeyType: [
+          { required: true, message: '字典值不能为空', trigger: 'blur' }
         ],
-        departmentNum: [
+        sortNum: [
           { required: true, message: '排序不能为空', trigger: ['change', 'blur'] }
         ]
       },
-      // 修改菜单id
-      id: null,
       // 控制批量删除按钮
       multiple: true,
-      // 删除部门id集合
+      // 删除字典id集合
       ids: [],
       // 自定义treeselect键名
-      name: null
+      keyName: null
     }
   },
   created() {
     this.handelSearch()
-    getDictList().then(res => {
-      console.log(res)
-    })
   },
   methods: {
-    /** 获取表格数据 */
-    getDeptList() {
-      getDeptList(this.queryParams).then(res => {
-        if (res.code === 200) {
-          const data = res.data
-          this.deptList = XEUtils.toArrayTree(data.departmentList)
-          this.total = data.count
-          this.getOptionsList()
-        }
-      })
-    },
-    /** 获取上级部门 */
-    getOptionsList() {
-      getAllSonMenuList().then(res => {
+    /** 查询所有字典类型 */
+    getAllDictType() {
+      getAllDictType(this.queryParams).then(res => {
         const data = res.data
-        this.options = data
-        this.name = 'departmentName'
+        this.dictList = data.dictTypes
+        this.total = data.count
       })
     },
     /** 搜索 */
     handelSearch() {
       this.queryParams.page = 1
-      this.getDeptList()
+      this.getAllDictType()
     },
     /** 重置按钮操作 */
     handelReset() {
@@ -186,17 +169,14 @@ export default {
     /** 新增按钮 */
     handelAdd() {
       this.dialogVisible = true
-      this.title = '添加部门'
+      this.title = '添加字典'
       this.reset()
     },
     /** 修改按钮 */
-    handelEdit(id) {
-      this.id = id
-      getDeptById({ id }).then(res => {
-        this.form = res.data
-      })
+    handelEdit(row) {
+      this.form = row
       this.dialogVisible = true
-      this.title = '修改部门'
+      this.title = '修改字典'
     },
     /** 表格多选 */
     handleSelectionChange(val) {
@@ -205,20 +185,13 @@ export default {
     },
     /** 删除按钮 */
     handelDel(id) {
-      this.$confirm('是否删除该部门?', '提示', {
+      this.$confirm('是否删除该字典?', '提示', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         type: 'warning'
       }).then(() => {
-        delDept([id]).then(res => {
-          if (res.code === 200) {
-            this.$message({
-              type: 'success',
-              message: '删除成功'
-            })
-            this.getDeptList()
-          }
-        })
+        this.ids.push(id)
+        this.delDictType()
       }).catch(() => {
         this.$message({
           type: 'info',
@@ -228,20 +201,12 @@ export default {
     },
     /** 批量删除 */
     handelDelAll() {
-      this.$confirm('是否批量删除部门?', '提示', {
+      this.$confirm('是否批量删除字典?', '提示', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         type: 'warning'
       }).then(() => {
-        delDept(this.ids).then(res => {
-          if (res.code === 200) {
-            this.$message({
-              type: 'success',
-              message: '删除成功'
-            })
-            this.getDeptList()
-          }
-        })
+        this.delDictType()
       }).catch(() => {
         this.$message({
           type: 'info',
@@ -249,30 +214,41 @@ export default {
         })
       })
     },
+    /** 删除接口 */
+    delDictType() {
+      delDictType(this.ids).then(res => {
+        if (res.code === 200) {
+          this.$message({
+            type: 'success',
+            message: '删除成功'
+          })
+          this.getAllDictType()
+        }
+      })
+    },
     /** 表单提交 */
     handelSubmit(formName) {
       this.$refs[formName].validate((valid) => {
         if (valid) {
-          if (this.title === '添加部门') {
-            addDept(this.form).then(res => {
+          if (this.title === '添加字典') {
+            addDictType(this.form).then(res => {
               if (res.code === 200) {
                 this.$message({
                   message: res.data,
                   type: 'success'
                 })
-                this.getDeptList()
+                this.getAllDictType()
                 this.dialogVisible = false
               }
             })
           } else {
-            this.form.id = this.id
-            editDept(this.form).then(res => {
+            editDictType(this.form).then(res => {
               if (res.code === 200) {
                 this.$message({
                   message: res.data,
                   type: 'success'
                 })
-                this.getDeptList()
+                this.getAllDictType()
                 this.dialogVisible = false
               }
             })
@@ -290,6 +266,10 @@ export default {
       if (this.$refs['form']) {
         this.$refs['form'].resetFields()
       }
+    },
+    /** 选择字典类型跳转 */
+    hendelTo(row) {
+      this.$router.push('/system/dict/dict-detail/role/' + row.dictKeyType)
     }
   }
 }