diff --git a/src/views/modules/sys/partyorg-add-or-update.vue b/src/views/modules/sys/partyorg-add-or-update.vue index 7a0a41d..8d1f645 100644 --- a/src/views/modules/sys/partyorg-add-or-update.vue +++ b/src/views/modules/sys/partyorg-add-or-update.vue @@ -110,6 +110,7 @@ export default { }, methods: { init () { + this.dataForm.allDeptIdArr = [] this.visible = true this.getOrgTypeOptions() this.getOptions() @@ -142,8 +143,15 @@ export default { }).catch(() => { }) }, allDeptIdsChangeHandle (value, selectedData) { - this.dataForm.deptName = this.$refs['org'].getCheckedNodes()[0].label - this.dataForm.deptId = this.$refs['org'].getCheckedNodes()[0].value + let len = 'value' + value + // len.length == 5 表示 未勾选任何所属机构 + if (5 < len.length) { + this.dataForm.deptName = this.$refs['org'].getCheckedNodes()[0].label + this.dataForm.deptId = this.$refs['org'].getCheckedNodes()[0].value + } else { + this.dataForm.deptId = '' + this.dataForm.deptName = '' + } }, // 地图相关 position (position) { diff --git a/src/views/modules/sys/partyorg.vue b/src/views/modules/sys/partyorg.vue index f24d28b..039f0e8 100644 --- a/src/views/modules/sys/partyorg.vue +++ b/src/views/modules/sys/partyorg.vue @@ -2,8 +2,19 @@
- - + + + + + + {{ $t('query') }} @@ -12,11 +23,11 @@ {{ $t('add') }} - {{ $t('deleteBatch') }} + {{ $t('export') }} - @@ -53,13 +64,38 @@ export default { getDataListURL: '/sys/partyorg/page', getDataListIsPage: true, deleteURL: '/sys/partyorg', - deleteIsBatch: true + deleteIsBatch: true, + exportURL: '/sys/partyorg/export', }, dataForm: { - id: '' - } + id: '', + deptId: '' + }, + options: [] } }, + methods: { + deptIdChangeHandle (value, selectedData) { + let len = 'value' + value + // len.length == 5 表示 未勾选任何所属机构 + if (5 < len.length) { + this.dataForm.deptId = this.$refs['org'].getCheckedNodes()[0].value + } else { + this.dataForm.deptId = '' + } + }, + }, + created () { + this.$http + .get(`/sys/user/deptOptions/getByLoginUser`) + .then(({ data: res }) => { + if (res.code !== 0) { + return this.$message.error(res.msg) + } + this.options = res.data.options + }) + .catch(() => { }) + }, components: { AddOrUpdate }