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