import { productBrandQuery } from '@/api/productBrand' const ProductBrand = { template: ` {{ item.brandName }} `, props: { value: { type: String, defatut: '' }, id: { type: String, default: '' }, placeholder:{ type: String, default: '请选择产品品牌' }, sysFlag: { type: String, default: '' }, brandType: { type: String, default: '' }, disabled: { type: Boolean, default: false } }, data() { return { defaultVal: this.value, productBrandList: [] }; }, mounted() { this.getProductBrand() }, watch: { value(newValue, oldValue) { this.defaultVal = newValue }, brandType(newValue,oldValue){ this.handleChange(undefined) this.getProductBrand() } }, methods: { filterOption (input, option) { return ( option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0 ) }, handleChange(value) { this.defaultVal = value; const row = this.productBrandList.find(item => item.brandSn == value) this.$emit('input', value); this.$emit('change', value, this.id, row); }, // 产品品牌列表, sysFlag: 1 箭冠 0 自建 getProductBrand () { productBrandQuery({ 'sysFlag': this.sysFlag, 'brandType': this.brandType }).then(res => { if (res.status == 200) { this.productBrandList = res.data } else { this.productBrandList = [] } }) }, }, }; export default ProductBrand