123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- import { dealerProductBrandQuery } from '@/api/dealerProductBrand'
- const ProductBrand = {
- template: `
- <a-select
- placeholder="请选择产品品牌"
- :id="id"
- allowClear
- :value="defaultVal"
- :showSearch="true"
- @change="handleChange"
- option-filter-prop="children"
- :dropdownMatchSelectWidth="false"
- :filter-option="filterOption">
- <a-select-option v-for="item in productBrandList" :key="item.brandSn" :value="item.brandSn">{{ item.brandName }}</a-select-option>
- </a-select>
- `,
- props: {
- value: {
- type: String,
- defatut: ''
- },
- id: {
- type: String,
- default: ''
- },
- sysFlag: {
- type: String,
- default: '1'
- }
- },
- data() {
- return {
- defaultVal: this.value,
- productBrandList: []
- };
- },
- mounted() {
- this.getProductBrand()
- },
- watch: {
- value(newValue, oldValue) {
- this.defaultVal = newValue
- }
- },
- methods: {
- filterOption (input, option) {
- return (
- option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
- )
- },
- handleChange(value) {
- this.defaultVal = value;
- this.$emit('change', value);
- this.$emit('input', value);
- },
- // 产品品牌列表, sysFlag: 1 箭冠 0 自建
- getProductBrand () {
- dealerProductBrandQuery({ 'sysFlag': this.sysFlag }).then(res => {
- if (res.status == 200) {
- this.productBrandList = res.data
- } else {
- this.productBrandList = []
- }
- })
- },
- },
- };
- export default ProductBrand
|