z_yu 3 years ago
parent
commit
e61b25aada
  1. 84
      src/views/archivesManage/recycleBin/index.vue

84
src/views/archivesManage/recycleBin/index.vue

@ -1,21 +1,15 @@
<template>
<div class="app-container">
<el-row class="container-main" :gutter="20">
<!--侧边部门数据-->
<!--左侧树状数据-->
<el-col class="container-left" :xs="9" :sm="6" :md="5" :lg="4" :xl="4">
<span class="right-top-line" />
<span class="left-bottom-line" />
<div class="head-container" style="color:#fff">
档案门类
</div>
<el-tree
:data="deptDatas"
:load="getDeptDatas"
:props="defaultProps"
:expand-on-click-node="false"
lazy
@node-click="handleNodeClick"
/>
<el-tree ref="archivesTree" v-loading="crud.loading" :data="crud.data" :props="defaultProps" node-key="id" :expand-on-click-node="false" highlight-current @node-click="handleNodeClick" />
</el-col>
<!--用户数据-->
<el-col class="container-right" :xs="15" :sm="18" :md="19" :lg="20" :xl="20">
@ -96,19 +90,20 @@
</template>
<script>
import { getDepts, getDeptSuperior } from '@/api/system/dept'
import CRUD, { presenter, header, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import pagination from '@crud/Pagination'
import data1 from '../lendManage/data1.json'
import crudCategory from '@/api/category/category'
export default {
// name: 'User',
name: 'RecycleBin',
components: { rrOperation, pagination },
cruds() {
return CRUD({
title: '用户',
url: 'api/users',
title: '门类',
url: 'api/archives-type/menu',
crudMethod: { ...crudCategory },
optShow: {
add: false,
edit: false,
@ -131,7 +126,9 @@ export default {
depts: [],
deptDatas: [],
level: 3,
defaultProps: { children: 'children', label: 'name', isLeaf: 'leaf' }
// defaultProps: { children: 'children', label: 'name', isLeaf: 'leaf' }
defaultProps: { children: 'children', label: 'cnName' }
}
},
created() {
@ -142,62 +139,9 @@ export default {
getData() {
this.tableData = data1.rows
},
//
getDeptDatas(node, resolve) {
const sort = 'id,desc'
const params = { sort: sort }
if (typeof node !== 'object') {
if (node) {
params['name'] = node
}
} else if (node.level !== 0) {
params['pid'] = node.data.id
}
setTimeout(() => {
getDepts(params).then(res => {
if (resolve) {
resolve(res.content)
} else {
this.deptDatas = res.content
}
})
}, 100)
},
getDepts() {
getDepts({ enabled: true }).then(res => {
this.depts = res.content.map(function(obj) {
if (obj.hasChildren) {
obj.children = null
}
return obj
})
})
},
getSupDepts(deptId) {
getDeptSuperior(deptId).then(res => {
const date = res.content
this.buildDepts(date)
this.depts = date
})
},
buildDepts(depts) {
depts.forEach(data => {
if (data.children) {
this.buildDepts(data.children)
}
if (data.hasChildren && !data.children) {
data.children = null
}
})
},
//
//
handleNodeClick(data) {
if (data.pid === 0) {
this.query.deptId = null
} else {
this.query.deptId = data.id
}
this.crud.toQuery()
console.log(data)
},
//
handleDelete() {

Loading…
Cancel
Save