Commit 9a837160 by 胡悦

修复bug

1 parent a6f130c9
...@@ -301,6 +301,7 @@ export default { ...@@ -301,6 +301,7 @@ export default {
this.hasLocation = false this.hasLocation = false
this.$root.eventBus.$on('params', (params) => { this.$root.eventBus.$on('params', (params) => {
this.activeName = 'first' this.activeName = 'first'
this.isVisible = false
this.merchantId = params.merchantId this.merchantId = params.merchantId
// 标记merchantId改变 // 标记merchantId改变
this.IdChange = [1, 1, 1] this.IdChange = [1, 1, 1]
......
...@@ -34,7 +34,8 @@ ...@@ -34,7 +34,8 @@
ref="addParams" ref="addParams"
label-width="120px"> label-width="120px">
<gl-form-item label="分组名称:" prop="groupName"> <gl-form-item label="分组名称:" prop="groupName">
<gl-input name="groupName" placeholder="请输入名称" v-model="addParams.groupName"></gl-input> <gl-input name="groupName" placeholder="请输入名称" data-vv-as="分组名称" v-validate="'required|max: 64'" v-model="addParams.groupName"></gl-input>
<span v-show="errorBags.has('groupName')" class="error">{{ errorBags.first('groupName') }}</span>
</gl-form-item> </gl-form-item>
<gl-form-item label="业务类型:" prop="businessCode"> <gl-form-item label="业务类型:" prop="businessCode">
<gl-select <gl-select
...@@ -50,6 +51,7 @@ ...@@ -50,6 +51,7 @@
:value="item.confId"> :value="item.confId">
</gl-option> </gl-option>
</gl-select> </gl-select>
<span v-show="errorBags.has('businessCode')" class="error">{{ errorBags.first('businessCode') }}</span>
</gl-form-item> </gl-form-item>
</gl-form> </gl-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
...@@ -69,9 +71,7 @@ export default { ...@@ -69,9 +71,7 @@ export default {
}, },
watch: { watch: {
dialogVisible(val) { dialogVisible(val) {
if (!val) { this.$validator.errors.clear()
this.$refs['addParams'].resetFields()
}
} }
}, },
data() { data() {
...@@ -83,11 +83,10 @@ export default { ...@@ -83,11 +83,10 @@ export default {
}, },
rules: { rules: {
groupName: [ groupName: [
{ required: true, message: '请输入分组名称', trigger: 'blur' }, { required: true }
{ max: 64, message: '长度最多64个字符', trigger: 'blur' }
], ],
businessCode: [ businessCode: [
{ required: true, message: '请选择业务类型', trigger: 'change' } { required: true }
] ]
}, },
businessList: [], businessList: [],
...@@ -210,8 +209,9 @@ export default { ...@@ -210,8 +209,9 @@ export default {
}, },
// 新增分组 // 新增分组
handleSubmit(formName) { handleSubmit(formName) {
this.$refs[formName].validate((valid) => { // this.$refs[formName].validate((valid) => {
if (valid) { this.$validator.validateAll().then((result) => {
if (result) {
this.createGroup(this.addParams) this.createGroup(this.addParams)
} else { } else {
return false return false
......
...@@ -78,6 +78,7 @@ ...@@ -78,6 +78,7 @@
:name="`item.merchantType${idx+1}`" :name="`item.merchantType${idx+1}`"
v-validate="item.merchantId || item.merchantType ? 'required' : ''" v-validate="item.merchantId || item.merchantType ? 'required' : ''"
:data-vv-as="`子商户类型`" :data-vv-as="`子商户类型`"
:disabled="item.disabledMerchantChild"
clearable clearable
placeholder="请选择"> placeholder="请选择">
<gl-option <gl-option
...@@ -138,6 +139,12 @@ export default { ...@@ -138,6 +139,12 @@ export default {
watch: { watch: {
addDialogVisible(val) { addDialogVisible(val) {
this.$validator.errors.clear() this.$validator.errors.clear()
if (!val) {
setTimeout(() => {
this.addList = []
this.addForm = { merchantId: '', merchantType: '' }
}, 400)
}
}, },
'addForm.merchantId'(val) { 'addForm.merchantId'(val) {
if (!val) { if (!val) {
...@@ -187,10 +194,7 @@ export default { ...@@ -187,10 +194,7 @@ export default {
// 显示隐藏添加商户按钮 // 显示隐藏添加商户按钮
showAddDialog(t) { showAddDialog(t) {
this.$emit('addData', t) this.$emit('addData', t)
setTimeout(() => {
this.addList = []
this.addForm = { merchantId: '', merchantType: '' }
}, 400)
}, },
// 添加更多按钮 // 添加更多按钮
addMore() { addMore() {
...@@ -201,7 +205,8 @@ export default { ...@@ -201,7 +205,8 @@ export default {
label: '子商户' + (this.addList.length + 1), label: '子商户' + (this.addList.length + 1),
merchantId: '', merchantId: '',
merchantType: '', merchantType: '',
show: true show: true,
disabledMerchantChild: false
}) })
} else { } else {
const len = this.addList.length - 1 const len = this.addList.length - 1
...@@ -269,7 +274,6 @@ export default { ...@@ -269,7 +274,6 @@ export default {
// } // }
// list = arr.filter(item => !index.includes(item.merchantId)) // list = arr.filter(item => !index.includes(item.merchantId))
list = [...arr].filter(item => [...this.addList].every(obj => obj.merchantId !== item.merchantId)) list = [...arr].filter(item => [...this.addList].every(obj => obj.merchantId !== item.merchantId))
console.log(list)
// this.businessChildList = index.length ? list : arr // this.businessChildList = index.length ? list : arr
this.businessChildList = list this.businessChildList = list
}).catch(err => { }).catch(err => {
...@@ -291,6 +295,19 @@ export default { ...@@ -291,6 +295,19 @@ export default {
} }
}, },
changeMerchantChild(val) { changeMerchantChild(val) {
if (val) {
this.businessChildList.forEach(i => {
let index = ''
if (i.merchantId == val && i.merchantType !== null) {
this.addList.forEach((v, j) => {
v.merchantId === val
index = j
})
this.addList[index].merchantType = i.merchantType
this.addList[index].disabledMerchantChild = true
}
})
}
this.businessChildList = [] this.businessChildList = []
}, },
// 获取商户类型列表 // 获取商户类型列表
......
...@@ -210,6 +210,8 @@ export default { ...@@ -210,6 +210,8 @@ export default {
this.$root.eventBus.$on('params', (params) => { this.$root.eventBus.$on('params', (params) => {
this.groupId = params.groupId this.groupId = params.groupId
this.getList() this.getList()
this.addDialogVisible = false
this.dialogVisible_search = false
// this.searchParams.groupId = params.groupId // this.searchParams.groupId = params.groupId
}) })
// this.loadingGetList() // this.loadingGetList()
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!