Browse Source

商品添加所属部门

master
wanggongfeng 4 years ago
parent
commit
efab3f8016
  1. 19
      src/views/modules/points/acitveproductinfo-add-or-update.vue
  2. 39
      src/views/modules/points/acitveproductinfo.vue

19
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%;"
>
</el-cascader>
@ -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) {

39
src/views/modules/points/acitveproductinfo.vue

@ -11,6 +11,15 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="用户部门" label-width="90px">
<el-cascader
v-model="ids"
:options="options"
:props="{ checkStrictly: true }"
clearable
>
</el-cascader>
</el-form-item>
<br/>
<el-form-item label="兑换开始时间"
prop="startTime" label-width="100px">
@ -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

Loading…
Cancel
Save