|
|
<template>
|
|
|
<Select v-model="_fieldModel" @on-change="selectChange" clearable>
|
|
|
<Select v-model="brandId" @on-change="selectChange" clearable>
|
|
|
<Option :value="-1">全部</Option>
|
|
|
<Option v-for="option in optionList" :value="option.brandId" :key="option.brandId">
|
|
|
{{option.brandName}}
|
...
|
...
|
@@ -14,43 +14,27 @@ |
|
|
export default {
|
|
|
name: 'SelectBrand',
|
|
|
props: {
|
|
|
fieldLabel: {
|
|
|
type: String
|
|
|
},
|
|
|
|
|
|
fieldModel: {
|
|
|
type: [String, Number]
|
|
|
},
|
|
|
|
|
|
labelSpan: {
|
|
|
type: [String, Number],
|
|
|
default: 6
|
|
|
},
|
|
|
|
|
|
fieldSpan: {
|
|
|
type: [String, Number],
|
|
|
default: 18
|
|
|
value: {
|
|
|
type: Number,
|
|
|
default: 0
|
|
|
}
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
brandId: this.value,
|
|
|
optionList: []
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
_fieldModel() {
|
|
|
return this.fieldModel;
|
|
|
}
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
const err_msg = '获取品牌列表失败。';
|
|
|
|
|
|
service.getBrand().then((res) => {
|
|
|
let code = _.get(res, 'data.code');
|
|
|
|
|
|
if(code === 200) {
|
|
|
return this.optionList = res.data.data;
|
|
|
if (code === 200) {
|
|
|
this.optionList = res.data.data;
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
return this.$Message.error(err_msg);
|
|
|
}, (error) => {
|
|
|
this.$Message.error(error.message);
|
...
|
...
|
@@ -58,10 +42,10 @@ |
|
|
},
|
|
|
methods: {
|
|
|
selectChange(val) {
|
|
|
this.$emit('on-change', val);
|
|
|
this.$emit('input', val);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
...
|
...
|
|