This commit is contained in:
aixianling
2024-06-20 18:31:15 +08:00
parent 36c4466f09
commit 67aa5264ef
6 changed files with 104 additions and 21 deletions

View File

@@ -39,6 +39,9 @@ export default {
return {
height: '600px',
stores: [],
cameras: [],
storeKeyGoods: [],
categorySales: [],
columns: {
品类销售情况: [
{label: "品类", prop: "secondCategoryName"},
@@ -60,6 +63,7 @@ export default {
}
},
computed: {
refs: v => v.$parent.getItemRefs(),
storeList: v => {
const list = []
let group = []
@@ -77,22 +81,48 @@ export default {
},
methods: {
getData() {
const refs = this.$parent.getItemRefs();
const cameras = refs['c82d439e-a316-4d0e-8792-d2513a950f11'].dataChart
const storeKeyGoods = refs['6f6e3050-b084-4694-83c0-0d351346f426'].dataChart
const categorySales = refs['58fd4d5f-2ac3-444c-8a2c-361b8c8c3e6e'].dataChart
this.stores = JSON.parse(window.$glob.stores || "[]").map(store => {
const cameraStore = cameras.find(e => e.storeCode == store)
this.stores = this.stores.map(store => {
const cameraStore = this.cameras.find(e => e.storeCode == store)
const {storeName = "仟吉门店", storeCameraVOList: camera = []} = cameraStore
const keyGoods = storeKeyGoods.filter(e => e.storeCode == store)
const categorySale = categorySales.filter(e => e.storeCode == store)
const keyGoods = this.storeKeyGoods.filter(e => e.storeCode == store)
const categorySale = this.categorySales.filter(e => e.storeCode == store)
return {storeName, camera: camera.map(e => e.url), keyGoods, categorySale}
})
}
},
getCameras() {
return $http.post("/api/store/camera/list", {
storeCodes: this.stores
}).then(res => {
if (res?.data) {
this.cameras = res.data?.records || []
}
})
},
getStoreKeyGoods() {
return $http.post("/api/store/camera/list", {
storeCodes: this.stores
}).then(res => {
if (res?.data) {
this.storeKeyGoods = res.data
}
})
},
getCategorySales() {
return $http.post("/api/store/camera/list", {
storeCodes: this.stores
}).then(res => {
if (res?.data) {
this.categorySales = res.data
}
})
},
},
mounted() {
async mounted() {
this.height = `${this.$el.clientHeight}px`
this.getData()
this.stores = JSON.parse(window.$glob.stores || "[]")
while (!$http) await $wait()
Promise.all([this.getCameras(), this.getStoreKeyGoods(), this.getCategorySales()]).then(() => this.getData())
}
}
</script>