Commit 68aa2bc0 by 陈羽

update: 商户选择增加校验

parent f476f24b
......@@ -146,7 +146,7 @@ export default {
delDepart(index, arr) {
const that = this;
arr.splice(index, 1);
const keys = arr.map(ele => ele.storeGroupId);
const keys = arr.map(ele => ele.relationId);
that.setCheckedKeys(keys);
},
......@@ -272,6 +272,7 @@ export default {
this.groupIds.push(node.data);
if (node.isLeaf) {
this.$refs.groupTree.setChecked(node, true);
this.$emit('checkGroupIds', this.$refs.groupTree.getCheckedNodes());
}
});
});
......
......@@ -47,7 +47,9 @@
</div>
<div class="select-search-input cursor-pointer" slot="reference">
<div>
<el-input placeholder="请搜索选择商户" maxlength="50" :disabled="type === 'edit'" v-model="partForm.searchSelect" @keyup.native="value => querySearchAsync(value, searchSelect)"> </el-input>
<el-form-item prop="searchSelect">
<el-input placeholder="请搜索选择商户" maxlength="50" :disabled="type === 'edit'" v-model="partForm.searchSelect" @keyup.native="querySearchAsync('search')"> </el-input>
</el-form-item>
</div>
</div>
</el-popover>
......@@ -71,7 +73,7 @@
</p>
</el-form-item>
<el-form-item label="企业类型"> <el-radio v-model="partForm.wxEnterpriseType" :label="0" :disabled="type === 'edit'">总部</el-radio> <el-radio v-model="partForm.wxEnterpriseType" :label="1" :disabled="type === 'edit'">代理</el-radio> </el-form-item>
<el-button type="primary" style="display:block;margin:38px 0 0 128px;" @click="addShow = true" :disabled="!(enterpriseId && partForm.storeGroup.length)">授权校验并{{ type === 'edit' ? '保存' : '新建' }}</el-button>
<el-button type="primary" style="display:block;margin:38px 0 0 128px;" @click="addShow = true" :disabled="!(enterpriseId && partForm.storeGroup.length && partForm.searchSelect)">授权校验并{{ type === 'edit' ? '保存' : '新建' }}</el-button>
</el-form>
</div>
</div>
......@@ -92,6 +94,15 @@ import errMsg from '@/common/js/error';
export default {
name: 'authMerchantAdd',
data() {
const checkEnterpriseId = (rule, value, callback) => {
if (!value) {
callback(new Error('请先搜索商户!'));
} else if (!this.enterpriseId) {
callback(new Error('请选择商户!'));
} else {
callback();
}
};
return {
bgHeight: window.screen.availHeight - 104 + 'px',
// 面包屑参数
......@@ -119,6 +130,9 @@ export default {
searchSelect: '',
storeGroup: []
},
rules: {
searchSelect: [{ required: true, validator: checkEnterpriseId, trigger: 'blur' }]
},
checkedList: [],
dailogForm: {},
searchArray: [],
......@@ -139,6 +153,7 @@ export default {
handleSelect(item) {
this.enterpriseId = item.enterpriseId;
this.dailogForm = { ...item };
this.$refs.form.validateField('searchSelect');
},
async querySearchAsync(type) {
const that = this;
......@@ -146,6 +161,9 @@ export default {
that.searchArray = [];
return false;
}
if (type === 'search') {
that.enterpriseId = '';
}
const res = await that.getSearchList(that.partForm.searchSelect);
that.searchArray = res;
if (type === 'edit' && res[0]) {
......
......@@ -235,7 +235,6 @@ export default {
});
},
showDetail(item) {
console.log(item);
this.confirmDetailShow = true;
}
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment