From 7aa0edff758a41437a104d816d63ea4f2fd914bc Mon Sep 17 00:00:00 2001 From: yujt Date: Wed, 5 Aug 2020 10:36:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=A7=E5=B1=8F=E6=98=BE=E7=A4=BA=E6=9C=BA?= =?UTF-8?q?=E6=9E=84=E7=BB=B4=E6=8A=A4=E5=8A=9F=E8=83=BD=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../screen/screendeptinfo-add-or-update.vue | 31 ++++++++++--------- src/views/modules/screen/screendeptinfo.vue | 18 +++++------ src/views/modules/user/unauthorized.vue | 8 ++--- 3 files changed, 29 insertions(+), 28 deletions(-) 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]