feat: 整合xpack'组织管理'

This commit is contained in:
fit2cloud-chenyw
2021-05-31 14:07:12 +08:00
parent dccfd6ec27
commit 1ffbe36c3c
6 changed files with 112 additions and 22 deletions

View File

@@ -41,13 +41,10 @@
<script>
import LayoutContent from '@/components/business/LayoutContent'
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import { LOAD_CHILDREN_OPTIONS, LOAD_ROOT_OPTIONS } from '@riophae/vue-treeselect'
import { getDeptTree, treeByDeptId, addDept, editDept } from '@/api/system/dept'
export default {
components: { LayoutContent, Treeselect },
components: { LayoutContent },
data() {
return {
defaultForm: { deptId: null, top: true, pid: null },
@@ -100,7 +97,7 @@ export default {
},
// 获取弹窗内部门数据
loadDepts({ action, parentNode, callback }) {
if (action === LOAD_ROOT_OPTIONS && !this.form.pid) {
if (action === 'LOAD_ROOT_OPTIONS' && !this.form.pid) {
const _self = this
treeByDeptId(0).then(res => {
const results = res.data.map(node => {
@@ -114,7 +111,7 @@ export default {
})
}
if (action === LOAD_CHILDREN_OPTIONS) {
if (action === 'LOAD_CHILDREN_OPTIONS') {
const _self = this
getDeptTree(parentNode.id).then(res => {
parentNode.children = res.data.map(function(obj) {

View File

@@ -92,10 +92,8 @@
<script>
import LayoutContent from '@/components/business/LayoutContent'
import TreeTable from '@/components/business/tree-table'
import Treeselect from '@riophae/vue-treeselect'
import { formatCondition, formatQuickCondition } from '@/utils/index'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import { LOAD_CHILDREN_OPTIONS, LOAD_ROOT_OPTIONS } from '@riophae/vue-treeselect'
import { checkPermission } from '@/utils/permission'
import { getDeptTree, addDept, editDept, delDept, loadTable } from '@/api/system/dept'
@@ -103,8 +101,7 @@ export default {
name: 'MsOrganization',
components: {
LayoutContent,
TreeTable,
Treeselect
TreeTable
},
data() {
return {
@@ -361,7 +358,7 @@ export default {
// 获取弹窗内部门数据
loadDepts({ action, parentNode, callback }) {
if (action === LOAD_ROOT_OPTIONS) {
if (action === 'LOAD_ROOT_OPTIONS') {
const _self = this
!this.depts && getDeptTree('0').then(res => {
_self.depts = res.data.map(node => _self.normalizer(node))
@@ -369,7 +366,7 @@ export default {
})
}
if (action === LOAD_CHILDREN_OPTIONS) {
if (action === 'LOAD_CHILDREN_OPTIONS') {
const _self = this
getDeptTree(parentNode.id).then(res => {
parentNode.children = res.data.map(function(obj) {

View File

@@ -71,16 +71,17 @@
<script>
import LayoutContent from '@/components/business/LayoutContent'
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
// import Treeselect from '@riophae/vue-treeselect'
// import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import { PHONE_REGEX } from '@/utils/validate'
import { LOAD_CHILDREN_OPTIONS, LOAD_ROOT_OPTIONS } from '@riophae/vue-treeselect'
// import { LOAD_CHILDREN_OPTIONS, LOAD_ROOT_OPTIONS } from '@riophae/vue-treeselect'
import { getDeptTree, treeByDeptId } from '@/api/system/dept'
import { allRoles } from '@/api/system/role'
import { addUser, editUser } from '@/api/system/user'
export default {
components: { LayoutContent, Treeselect },
// components: { LayoutContent, Treeselect },
components: { LayoutContent },
data() {
return {
form: {
@@ -211,7 +212,7 @@ export default {
},
// 获取弹窗内部门数据
loadDepts({ action, parentNode, callback }) {
if (action === LOAD_ROOT_OPTIONS && !this.form.deptId) {
if (action === 'LOAD_ROOT_OPTIONS' && !this.form.deptId) {
const _self = this
treeByDeptId(0).then(res => {
const results = res.data.map(node => {
@@ -225,7 +226,7 @@ export default {
})
}
if (action === LOAD_CHILDREN_OPTIONS) {
if (action === 'LOAD_CHILDREN_OPTIONS') {
const _self = this
getDeptTree(parentNode.id).then(res => {
parentNode.children = res.data.map(function(obj) {
@@ -279,6 +280,9 @@ export default {
this.$router.push({ name: 'system-user' })
},
filterData(instanceId) {
if (!this.depts) {
return
}
const results = this.depts.map(node => {
if (node.hasChildren) {
node.children = null

View File

@@ -162,7 +162,7 @@
import LayoutContent from '@/components/business/LayoutContent'
import ComplexTable from '@/components/business/complex-table'
import { checkPermission } from '@/utils/permission'
// import { checkPermission } from '@/utils/permission'
import { formatCondition, formatQuickCondition } from '@/utils/index'
import { PHONE_REGEX } from '@/utils/validate'
import { LOAD_CHILDREN_OPTIONS, LOAD_ROOT_OPTIONS } from '@riophae/vue-treeselect'
@@ -183,13 +183,13 @@ export default {
buttons: [
{
label: this.$t('commons.edit'), icon: 'el-icon-edit', type: 'primary', click: this.edit,
show: checkPermission(['user:edit'])
show: this.checkPermission(['user:edit'])
}, {
label: this.$t('commons.delete'), icon: 'el-icon-delete', type: 'danger', click: this.del,
show: checkPermission(['user:del'])
show: this.checkPermission(['user:del'])
}, {
label: this.$t('member.edit_password'), icon: 'el-icon-s-tools', type: 'success', click: this.editPassword,
show: checkPermission(['user:editPwd'])
show: this.checkPermission(['user:editPwd'])
}
],
searchConfig: {