|
@@ -123,26 +123,33 @@ export default {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- async searchTable (queryParam) {
|
|
|
|
- this.dataSource = []
|
|
|
|
- this.list = []
|
|
|
|
- this.disabled = true
|
|
|
|
- this.spinning = true
|
|
|
|
- // 品类列表
|
|
|
|
- let listData = await dealerUpsList(queryParam).then(res => res.data)
|
|
|
|
- this.$emit('loaded', listData)
|
|
|
|
- this.dataSource = listData
|
|
|
|
- if (!listData) {
|
|
|
|
- listData = []
|
|
|
|
- }
|
|
|
|
|
|
+ // 组装数据
|
|
|
|
+ formatData (listData, queryParam) {
|
|
// 格式化数据
|
|
// 格式化数据
|
|
let ret = []
|
|
let ret = []
|
|
let no = 0
|
|
let no = 0
|
|
listData.map((item, i) => {
|
|
listData.map((item, i) => {
|
|
- const sub = item.rebateScopeList || [{ productBrandName: null, productTypeName1: null, productTypeName2: null, productTypeName3: null }]
|
|
|
|
|
|
+ let sub = item.rebateScopeList || [{ productBrandName: null, productTypeName1: null, productTypeName2: null, productTypeName3: null }]
|
|
const sup = item.rebateDealerList.find(b => b.rebateParentType == 'SUPERIORS')
|
|
const sup = item.rebateDealerList.find(b => b.rebateParentType == 'SUPERIORS')
|
|
this.checkedDealerSn.push(sup)
|
|
this.checkedDealerSn.push(sup)
|
|
-
|
|
|
|
|
|
+ const rebateDealerList = item.rebateDealerList
|
|
|
|
+ // 筛选条件
|
|
|
|
+ sub = sub.filter(s => {
|
|
|
|
+ let cs = true
|
|
|
|
+ let bs = true
|
|
|
|
+ const plen = Object.keys(queryParam).length
|
|
|
|
+ const xi = queryParam.productBrandSn ? 3 : 2
|
|
|
|
+ bs = queryParam.productBrandSn ? s.productBrandSn == queryParam.productBrandSn : true
|
|
|
|
+ if (plen == xi) {
|
|
|
|
+ cs = queryParam.productTypeSn1 == s.productTypeSn1
|
|
|
|
+ } else if (plen == xi + 1) {
|
|
|
|
+ cs = queryParam.productTypeSn1 == s.productTypeSn1 && queryParam.productTypeSn2 == s.productTypeSn2
|
|
|
|
+ } else if (plen == xi + 2) {
|
|
|
|
+ cs = queryParam.productTypeSn1 == s.productTypeSn1 && queryParam.productTypeSn2 == s.productTypeSn2 && queryParam.productTypeSn3 == s.productTypeSn3
|
|
|
|
+ }
|
|
|
|
+ console.log(queryParam, bs, cs, xi, plen)
|
|
|
|
+ return queryParam.productBrandSn ? bs && cs : cs
|
|
|
|
+ })
|
|
// 组织展开数据
|
|
// 组织展开数据
|
|
sub.map((a, j) => {
|
|
sub.map((a, j) => {
|
|
if (j == 0) {
|
|
if (j == 0) {
|
|
@@ -153,17 +160,30 @@ export default {
|
|
a.no = no + j + 1
|
|
a.no = no + j + 1
|
|
a.sup = sup
|
|
a.sup = sup
|
|
a.superDealerName = sup.parentDealer.dealerName
|
|
a.superDealerName = sup.parentDealer.dealerName
|
|
- a.rebateDealerList = item.rebateDealerList
|
|
|
|
|
|
+ a.rebateDealerList = rebateDealerList
|
|
})
|
|
})
|
|
no = no + sub.length
|
|
no = no + sub.length
|
|
ret = ret.concat(sub)
|
|
ret = ret.concat(sub)
|
|
})
|
|
})
|
|
console.log(ret)
|
|
console.log(ret)
|
|
this.list = ret
|
|
this.list = ret
|
|
- this.showEmpty = this.list.length <= 0
|
|
|
|
- this.tableHeight = (this.showEmpty ? 0 : this.maxHeight) + 'px'
|
|
|
|
- this.spinning = false
|
|
|
|
- this.disabled = false
|
|
|
|
|
|
+ },
|
|
|
|
+ searchTable (queryParam) {
|
|
|
|
+ this.dataSource = []
|
|
|
|
+ this.list = []
|
|
|
|
+ this.disabled = true
|
|
|
|
+ this.spinning = true
|
|
|
|
+ // 品类列表
|
|
|
|
+ dealerUpsList(queryParam).then(res => {
|
|
|
|
+ this.$emit('loaded', res.data || [])
|
|
|
|
+ this.dataSource = res.data || []
|
|
|
|
+ // 处理数据
|
|
|
|
+ this.formatData(this.dataSource, queryParam)
|
|
|
|
+ this.showEmpty = this.dataSource.length <= 0
|
|
|
|
+ this.tableHeight = (this.showEmpty ? 0 : this.maxHeight) + 'px'
|
|
|
|
+ this.spinning = false
|
|
|
|
+ this.disabled = false
|
|
|
|
+ })
|
|
},
|
|
},
|
|
handleEdit (record) {
|
|
handleEdit (record) {
|
|
const row = this.dataSource.find(item => item.dealerUpsSn == record.dealerUpsSn && item.dealerSn == record.dealerSn)
|
|
const row = this.dataSource.find(item => item.dealerUpsSn == record.dealerUpsSn && item.dealerSn == record.dealerSn)
|