|
@@ -21,7 +21,7 @@ const ProductType = {
|
|
|
return []
|
|
|
}
|
|
|
},
|
|
|
- placeholder:{
|
|
|
+ placeholder: {
|
|
|
type: String,
|
|
|
default: '请选择产品分类'
|
|
|
},
|
|
@@ -35,7 +35,7 @@ const ProductType = {
|
|
|
},
|
|
|
isAll: {
|
|
|
type: Boolean,
|
|
|
- default: true
|
|
|
+ default: false
|
|
|
},
|
|
|
// 是否显示全分类
|
|
|
showAllType: {
|
|
@@ -57,35 +57,35 @@ const ProductType = {
|
|
|
mounted () {
|
|
|
const a = this.$store.state.app.productTypeAllList
|
|
|
// 如果有缓存
|
|
|
- if(this.isAll && a){
|
|
|
+ if (this.isAll && a) {
|
|
|
this.productTypeList = a || []
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
this.getProductType()
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- filter(inputValue, path) {
|
|
|
+ filter (inputValue, path) {
|
|
|
console.log(inputValue, path)
|
|
|
- return path.some(option => option.productTypeName.indexOf(inputValue) > -1);
|
|
|
+ return path.some(option => option.productTypeName.indexOf(inputValue) > -1)
|
|
|
},
|
|
|
- setDefValue(defaultVal,row){
|
|
|
- this.handleChange(defaultVal,row)
|
|
|
+ setDefValue (defaultVal, row) {
|
|
|
+ this.handleChange(defaultVal, row)
|
|
|
},
|
|
|
- handleChange (value,row) {
|
|
|
+ handleChange (value, row) {
|
|
|
this.defaultVal = value
|
|
|
- this.$emit('change', this.defaultVal, this.id,row)
|
|
|
+ this.$emit('change', this.defaultVal, this.id, row)
|
|
|
this.$emit('input', this.defaultVal)
|
|
|
},
|
|
|
- showALLtype(){
|
|
|
+ showALLtype () {
|
|
|
// 是否显示全分类
|
|
|
const hasAll = this.productTypeList.some(item => item.productTypeSn == 'ALL')
|
|
|
- if(this.showAllType&&!hasAll){
|
|
|
- this.productTypeList.unshift({productTypeName:'全分类',productTypeSn:'ALL',children:[{productTypeName:'全分类',productTypeSn:'ALL'}]})
|
|
|
+ if (this.showAllType && !hasAll) {
|
|
|
+ this.productTypeList.unshift({ productTypeName: '全分类', productTypeSn: 'ALL', children: [{ productTypeName: '全分类', productTypeSn: 'ALL' }] })
|
|
|
}
|
|
|
},
|
|
|
// 产品分类 列表
|
|
|
getProductType () {
|
|
|
- if(this.isAll){
|
|
|
+ if (this.isAll) {
|
|
|
productTypeQueryAll({}).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
if (res.data && res.data.length > 0) {
|
|
@@ -103,7 +103,7 @@ const ProductType = {
|
|
|
// 是否显示全分类
|
|
|
this.showALLtype()
|
|
|
})
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
productTypeQuery({}).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
this.productTypeList = res.data
|
|
@@ -132,7 +132,7 @@ const ProductType = {
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
- },
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|