|
@@ -0,0 +1,68 @@
|
|
|
|
+import { dealerProductBrandQuery } from '@/api/dealerProductBrand'
|
|
|
|
+const ProductBrand = {
|
|
|
|
+ template: `
|
|
|
|
+ <a-select
|
|
|
|
+ placeholder="请选择产品品牌"
|
|
|
|
+ :id="id"
|
|
|
|
+ allowClear
|
|
|
|
+ :value="defaultVal"
|
|
|
|
+ :showSearch="true"
|
|
|
|
+ @change="handleChange"
|
|
|
|
+ option-filter-prop="children"
|
|
|
|
+ :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
|