需求完成

This commit is contained in:
2024-11-03 10:27:14 +08:00
parent 1b28903621
commit f1620c710f
3 changed files with 46 additions and 16 deletions

View File

@@ -65,7 +65,7 @@ window.evenRowBGC = (color = "#09265B") => `transparent;background-image: linear
Vue.prototype.$marketBoard = Vue.observable({ Vue.prototype.$marketBoard = Vue.observable({
screenId: '5b1849ac-4fc3-451a-844c-3362b47341ef', screenId: '5b1849ac-4fc3-451a-844c-3362b47341ef',
goodsCategoryId: "", thirdGoods: {},
search: {"groupCodeList": [], "currentDate": "20240701", "compareDate": "20240630", "hourNum": "18"} search: {"groupCodeList": [], "currentDate": "20240701", "compareDate": "20240630", "hourNum": "18"}
}) })
Vue.prototype.$multipleStoreBoard = Vue.observable({ Vue.prototype.$multipleStoreBoard = Vue.observable({

View File

@@ -41,6 +41,9 @@ export default {
this.tableData = res.data?.records || [] this.tableData = res.data?.records || []
} }
}) })
},
relevanceMapData(selectGoods) {
this.$set(this.$marketBoard, 'thirdGoods', selectGoods)
} }
}, },
watch: { watch: {
@@ -49,6 +52,17 @@ export default {
this.getTableData() this.getTableData()
} }
} }
},
mounted() {
document.addEventListener('click', evt => {
const mapElement = document.querySelector('.AppMap')
if (!this.$el.contains(evt.target) && !mapElement.contains(evt.target)) {
this.relevanceMapData()
}
})
},
beforeDestroy() {
document.removeEventListener('click', this.relevanceMapData)
} }
} }
</script> </script>
@@ -62,7 +76,7 @@ export default {
</el-select> </el-select>
</template> </template>
</app-sub-title> </app-sub-title>
<scroll-table :table-data="tableData" :columns="columns"/> <scroll-table :table-data="tableData" :columns="columns" @click="relevanceMapData" @click.native.stop/>
<!--<dv-scroll-board :config="tableConfig"/>--> <!--<dv-scroll-board :config="tableConfig"/>-->
</section> </section>
</template> </template>
@@ -72,6 +86,7 @@ export default {
color: #fff; color: #fff;
box-sizing: border-box; box-sizing: border-box;
} }
.AppKeyGoods .dv-scroll-board, .AppKeyGoods .scrollTable { .AppKeyGoods .dv-scroll-board, .AppKeyGoods .scrollTable {
height: calc(100% - 60px) !important; height: calc(100% - 60px) !important;
} }

View File

@@ -6,18 +6,24 @@ export default {
return { return {
map: null, map: null,
layers: [], layers: [],
geoJson: null geoJson: null,
} }
}, },
computed: { computed: {
search: v => v.$marketBoard.search search: v => v.$marketBoard.search,
thirdGoods: v => v.$marketBoard.thirdGoods || {}
}, },
watch: { watch: {
search: { search: {
deep: true, handler() { deep: true, handler() {
this.getData().then(() => this.refreshData()) this.getData().then(() => this.refreshData())
} }
} },
thirdGoods: {
deep: true, handler() {
this.getData().then(() => this.refreshData())
}
},
}, },
methods: { methods: {
loadLib() { loadLib() {
@@ -25,13 +31,19 @@ export default {
'/presource/datascreen/js/turf.min.js', '/presource/datascreen/js/turf.min.js',
].map(e => $loadScript('js', e))) ].map(e => $loadScript('js', e)))
}, },
getContent([x, y, bakeStockAmt = 0, preSaleNum = 0, stockNum = 0] = []) {
if (this.thirdGoods.thirdGoodsCode) {
return [`库存数量:${stockNum}`]
}
return [`现烤库存金额:${bakeStockAmt}`, `现烤销售机会:${preSaleNum}`]
},
getData() { getData() {
const {$http, $waitFor} = window const {$http, $waitFor} = window
const {groupCodeList, currentDate, hourNum} = this.search const {search: {groupCodeList, currentDate, hourNum}, thirdGoods: {thirdGoodsCode}} = this
const maps = [] const maps = []
return $waitFor($http).then(() => Promise.all([ return $waitFor($http).then(() => Promise.all([
$http.post("/data-boot/la/screen/marketBoard/storeReport", { $http.post("/data-boot/la/screen/marketBoard/storeReport", {
groupCodeList, currentDate, hourNum groupCodeList, currentDate, hourNum, thirdGoodsCode
}).then(res => { }).then(res => {
if (res?.data) { if (res?.data) {
return this.layers = res.data || [] return this.layers = res.data || []
@@ -70,9 +82,9 @@ export default {
borderRadius: 2, borderRadius: 2,
padding: 8, padding: 8,
position: 'right', position: 'right',
formatter: params => { formatter: (params) => {
const {name, value: [x, y, bakeStockAmt = 0, preSaleNum = 0]} = params const {name, value} = params
return `{a|${name}\n现烤库存金额:${bakeStockAmt}\n现烤销售机会${preSaleNum}}` return `{a|${name}\n${this.getContent(value).join("\n")}}`
}, },
rich: { rich: {
a: {color: '#fff', fontSize: 12, lineHeight: 14} a: {color: '#fff', fontSize: 12, lineHeight: 14}
@@ -94,8 +106,8 @@ export default {
], ],
tooltip: { tooltip: {
trigger: 'item', formatter: params => { trigger: 'item', formatter: params => {
const {name, marker, value: [x, y, bakeStockAmt = 0, preSaleNum = 0]} = params const {name, marker, value} = params
return `${marker} ${name}<br/>现烤库存金额:${bakeStockAmt}<br/>现烤销售机会:${preSaleNum}` return `${marker} ${name}<br/>${this.getContent(value).join("<br/>")}`
}, },
}, },
}) })
@@ -111,8 +123,9 @@ export default {
convertData(layers) { convertData(layers) {
const result = {normal: [], abnormal: []} const result = {normal: [], abnormal: []}
layers.forEach(e => { layers.forEach(e => {
const item = {name: e.storeName, storeCode: e.storeCode, value: [e.longitude, e.latitude, e.bakeStockAmt, e.preSaleNum]} const item = {name: e.storeName, storeCode: e.storeCode, value: [e.longitude, e.latitude, e.bakeStockAmt, e.preSaleNum, e.stockNum]}
if (e.bakeStockAmt > 0) { // 有库存或者有现烤库存金额 就算正常
if (e.bakeStockAmt > 0 || e.stockNum > 0) {
result.normal.push(item) result.normal.push(item)
} else { } else {
result.abnormal.push(item) result.abnormal.push(item)
@@ -121,8 +134,10 @@ export default {
return Object.values(result).map(data => ({data})) return Object.values(result).map(data => ({data}))
}, },
refreshData() { refreshData() {
this.map.setOption({series: this.convertData(this.layers)}) const {thirdGoods: {goodsName}} = this
} const title = {left: 20, top: 20, text: goodsName ? `{sub|选择产品:}${goodsName}` : '', textStyle: {color: "#fff", rich: {sub: {color: "#fff", fontSize: 16}}}}
this.map.setOption({title, series: this.convertData(this.layers)})
},
}, },
mounted() { mounted() {
this.loadLib().then(() => Promise.all([ this.loadLib().then(() => Promise.all([