diff --git a/src/views/modules/screen/screendeptinfo-add-or-update.vue b/src/views/modules/screen/screendeptinfo-add-or-update.vue index b46748e..c67278d 100644 --- a/src/views/modules/screen/screendeptinfo-add-or-update.vue +++ b/src/views/modules/screen/screendeptinfo-add-or-update.vue @@ -4,12 +4,12 @@ - + {{dataForm.deptName}} @@ -141,21 +141,25 @@ export default { 'deptIdList': function (val) { if (val.length !== 0) { this.dataForm.deptId = val[val.length - 1] + + let casLabelVal = this.$refs['deptLabel'].getCheckedNodes()[0].pathLabels + this.dataForm.deptName = casLabelVal[val.length - 1] } else { this.dataForm.deptId = '' + this.dataForm.deptName = '' } } }, 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(() => { }) + .get(`/sys/user/deptOptions/getByLoginUser`) + .then(({ data: res }) => { + if (res.code !== 0) { + return this.$message.error(res.msg) + } + this.options = res.data.options + }) + .catch(() => { }) }, methods: { init () { @@ -185,9 +189,6 @@ export default { if (!valid) { return false } - if(!this.dataForm.id){ - this.dataForm.deptName = this.$refs['dept'].inputValue.split('/').slice(-1).toString().replace(/\s+/g,''); - } this.$http[!this.dataForm.id ? 'post' : 'put']('/sys/screendeptinfo/', this.dataForm).then(({ data: res }) => { if (res.code !== 0) { return this.$message.error(res.msg) @@ -199,11 +200,11 @@ export default { onClose: () => { this.visible = false this.$emit('refreshDataList') + this.deptIdList = [] } }) }).catch(() => {}) }) - this.deptIdList = [] }, 1000, { 'leading': true, 'trailing': false }) } } diff --git a/src/views/modules/screen/screendeptinfo.vue b/src/views/modules/screen/screendeptinfo.vue index 29fec07..5592f03 100644 --- a/src/views/modules/screen/screendeptinfo.vue +++ b/src/views/modules/screen/screendeptinfo.vue @@ -62,7 +62,7 @@ export default { deleteIsBatch: true }, dataForm: { - id: '', + id: '' }, options: [], deptIdList: [] @@ -82,14 +82,14 @@ export default { }, 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(() => { }) + .get(`/sys/user/deptOptions/getByLoginUser`) + .then(({ data: res }) => { + if (res.code !== 0) { + return this.$message.error(res.msg) + } + this.options = res.data.options + }) + .catch(() => { }) } } diff --git a/src/views/modules/user/unauthorized.vue b/src/views/modules/user/unauthorized.vue index a762a84..7e39b50 100644 --- a/src/views/modules/user/unauthorized.vue +++ b/src/views/modules/user/unauthorized.vue @@ -169,7 +169,7 @@ export default { streetId: '', communityId: '', gridId: '', - deptId:'', + deptId: '', realName: '', mobile: '', identityNo: '', @@ -210,19 +210,19 @@ export default { this.dataForm.communityId = '' this.dataForm.gridId = '' this.dataForm.deptId = '' - }else + } else if (val.length === 1) { this.dataForm.streetId = this.deptIdList[0] this.dataForm.communityId = '' this.dataForm.gridId = '' this.dataForm.deptId = this.deptIdList[0] - }else + } else if (val.length === 2) { this.dataForm.streetId = this.deptIdList[0] this.dataForm.communityId = this.deptIdList[1] this.dataForm.gridId = '' this.dataForm.deptId = this.deptIdList[1] - }else + } else if (val.length === 3) { this.dataForm.streetId = this.deptIdList[0] this.dataForm.communityId = this.deptIdList[1]