fix:部门管理列表

This commit is contained in:
zhangzhiqiang
2022-12-01 16:24:44 +08:00
parent 8bc9086cd1
commit e4bda3cc41
9 changed files with 141 additions and 12 deletions

View File

@@ -85,7 +85,7 @@
<el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
</div>
</el-dialog>
<!--表格渲染-->
<!--表格渲染 :load="getDeptDatas" 点击事件 row-key需要指定唯一的数据id-->
<el-table
ref="table"
v-loading="crud.loading"
@@ -93,13 +93,13 @@
:load="getDeptDatas"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
:data="crud.data"
row-key="id"
row-key="dept_id"
@select="crud.selectChange"
@select-all="crud.selectAllChange"
@selection-change="crud.selectionChangeHandler"
>
<el-table-column :selectable="checkboxT" type="selection" width="55" />
<!-- <el-table-column label="编码" prop="code" />-->
<!-- <el-table-column label="编码" prop="code" />-->
<el-table-column label="名称" prop="name" />
<el-table-column label="排序" prop="deptSort" />
<el-table-column label="状态" align="center" prop="enabled">
@@ -146,6 +146,7 @@ import CRUD, { crud, form, header, presenter } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import { getDeptvo } from '../../../api/system/dept'
const defaultForm = {
id: null,
@@ -163,7 +164,7 @@ export default {
name: 'Dept',
components: { Treeselect, crudOperation, rrOperation, udOperation },
cruds() {
return CRUD({ title: '部门', url: 'api/dept', crudMethod: { ...crudDept }})
return CRUD({ title: '部门', url: 'api/dept/vo', crudMethod: { ...crudDept }})
},
mixins: [presenter(), header(), form(defaultForm), crud()],
// 设置数据字典
@@ -195,9 +196,9 @@ export default {
},
methods: {
getDeptDatas(tree, treeNode, resolve) {
const params = { pid: tree.id }
const params = { pid: tree.dept_id }
setTimeout(() => {
crudDept.getDepts(params).then(res => {
crudDept.getDeptvo(params).then(res => {
resolve(res.content)
})
}, 100)
@@ -235,6 +236,7 @@ export default {
},
getDepts() {
crudDept.getDepts({ enabled: true }).then(res => {
debugger
this.depts = res.content.map(function(obj) {
if (obj.hasChildren) {
obj.children = null