|
@@ -63,13 +63,14 @@ export default {
|
|
|
wrapperCol: { span: 16 }
|
|
|
},
|
|
|
dealerLevelList: [],
|
|
|
- subDealerSn: ''
|
|
|
+ subDealerSn: '',
|
|
|
+ isRelation: '' // 是否已被关联过
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- handleDisassociate (val) {
|
|
|
- console.log('选中', val)
|
|
|
+ handleDisassociate (val, parentDealerSn) {
|
|
|
this.subDealerSn = val.key
|
|
|
+ this.isRelation = parentDealerSn
|
|
|
},
|
|
|
// 保存
|
|
|
handleSave () {
|
|
@@ -84,18 +85,34 @@ export default {
|
|
|
subDealerSn: _this.subDealerSn,
|
|
|
parentDealerSn: _this.nowData && _this.nowData.dealerSn ? _this.nowData.dealerSn : undefined
|
|
|
}
|
|
|
- bindRelation(formData).then(res => {
|
|
|
- if (res.status == 200) {
|
|
|
- _this.$message.success(res.message)
|
|
|
- _this.$emit('ok', formData.parentDealerSn)
|
|
|
- _this.isShow = false
|
|
|
- }
|
|
|
- })
|
|
|
+ if (_this.isRelation) {
|
|
|
+ _this.$confirm({
|
|
|
+ title: '提示',
|
|
|
+ content: '确认要解除原有绑定关系,建立新的绑定关系吗?',
|
|
|
+ centered: true,
|
|
|
+ closable: true,
|
|
|
+ onOk () {
|
|
|
+ _this.handleBind(formData)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ _this.handleBind(formData)
|
|
|
+ }
|
|
|
} else {
|
|
|
return false
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ handleBind (formData) {
|
|
|
+ const _this = this
|
|
|
+ bindRelation(formData).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ _this.$message.success(res.message)
|
|
|
+ _this.$emit('ok', formData.parentDealerSn)
|
|
|
+ _this.isShow = false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
filterOption (input, option) {
|
|
|
return (
|
|
|
option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
|