From efab3f80163a7ea2c0a7b47dc3f1cd809e6708e4 Mon Sep 17 00:00:00 2001 From: wanggongfeng <1305282856@qq.com> Date: Wed, 20 Oct 2021 17:48:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=93=81=E6=B7=BB=E5=8A=A0=E6=89=80?= =?UTF-8?q?=E5=B1=9E=E9=83=A8=E9=97=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../acitveproductinfo-add-or-update.vue | 19 +-------- .../modules/points/acitveproductinfo.vue | 39 ++++++++++++++++++- 2 files changed, 39 insertions(+), 19 deletions(-) diff --git a/src/views/modules/points/acitveproductinfo-add-or-update.vue b/src/views/modules/points/acitveproductinfo-add-or-update.vue index e9f654bd..749edf41 100644 --- a/src/views/modules/points/acitveproductinfo-add-or-update.vue +++ b/src/views/modules/points/acitveproductinfo-add-or-update.vue @@ -53,7 +53,7 @@ v-model="dataForm.deptIdsArr" :options="options" :props="{ checkStrictly: true }" - @visible-change="changeHandle" + @change="changeHandle" style="width:50%;" > @@ -164,22 +164,7 @@ export default { }).catch(() => {}) }, changeHandle (value, selectedData) { - let allDeptIds = '0,' - let allDeptNames = '市北区委-' - if (this.$refs['name']._data.checkedValue !== null && this.$refs['name']._data.checkedValue.length > 0) { - let nameArrStr = this.$refs['name']._data.inputValue - let nameArr = nameArrStr.split(' / ') - for (var i = 0; i < this.$refs['name']._data.checkedValue.length; i++) { - allDeptIds += this.$refs['name']._data.checkedValue[i] + ',' - allDeptNames += nameArr[i] + '-' - } - } - this.dataForm.allDeptIds = allDeptIds.length > 0 ? allDeptIds.substring(0, allDeptIds.length - 1) : allDeptIds - this.dataForm.allDeptNames = allDeptNames.length > 0 ? allDeptNames.substring(0, allDeptNames.length - 1) : allDeptNames - this.dataForm.parentDeptIds = this.dataForm.allDeptIds.substring(0, this.dataForm.allDeptIds.lastIndexOf(',')) - this.dataForm.parentDeptNames = this.dataForm.allDeptNames.substring(0, this.dataForm.allDeptNames.lastIndexOf('-')) - this.dataForm.deptId = this.dataForm.allDeptIds.substring(this.dataForm.allDeptIds.lastIndexOf(',')).replace(',', '') - this.dataForm.deptName = this.dataForm.allDeptNames.substring(this.dataForm.allDeptNames.lastIndexOf('-')).replace('-', '') + this.dataForm.deptId = value[value.length - 1] }, // 上传图片 handleAvatarSuccess (res, file) { diff --git a/src/views/modules/points/acitveproductinfo.vue b/src/views/modules/points/acitveproductinfo.vue index 7e01986f..a4801ca7 100644 --- a/src/views/modules/points/acitveproductinfo.vue +++ b/src/views/modules/points/acitveproductinfo.vue @@ -11,6 +11,15 @@ + + + +
@@ -114,7 +123,8 @@ export default { name: '', state: '', startTime: '', - endTime: '' + endTime: '', + deptId: '' }, updateForm: { id: '', @@ -139,7 +149,9 @@ export default { return time.getTime() < new Date(EndDateVal + ' 00:00:00').getTime() } } - } + }, + ids: [], + options: [] } }, filters: { @@ -155,7 +167,30 @@ export default { AddOrUpdate, acitveproductinfoexchangedialog }, + created: function () { + this.getOptions() + }, + watch: { + ids: function (val) { + if (val.length === 0) { + this.dataForm.deptId = '' + } else { + this.dataForm.deptId = this.ids[val.length - 1] + } + } + }, methods: { + getOptions () { + 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(() => {}) + }, btKeyUpname (e) { e.target.value = e.target.value.replace(/[`~!@#$%^&*()_+=<>?:"{}|·~!@#¥%……&*()——+={}|《》?:“”【】、;‘’,。、]/g, '') this.dataForm.name = e.target.value