From 6121f0db7c443a599591470479344e356f84b472 Mon Sep 17 00:00:00 2001 From: Kubbo <390378816@qq.com> Date: Sun, 7 Jul 2024 11:27:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=A7=E6=8F=90=E4=BA=A4=E4=B8=80=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/inject.js | 2 +- src/views/AppMultipleStoreBoard.vue | 28 +++++++ src/views/AppMultipleStoreBoardFilter.vue | 91 +++++++++++++++++++++++ src/views/AppRealtimePanel.vue | 3 +- src/views/AppStoresTable.vue | 89 +++++++++++++--------- 5 files changed, 175 insertions(+), 38 deletions(-) create mode 100644 src/views/AppMultipleStoreBoard.vue create mode 100644 src/views/AppMultipleStoreBoardFilter.vue diff --git a/src/utils/inject.js b/src/utils/inject.js index 484ce02..e18d376 100644 --- a/src/utils/inject.js +++ b/src/utils/inject.js @@ -61,7 +61,7 @@ Vue.prototype.$marketBoard = Vue.observable({ search: {"groupCodeList": ["20011061"], "currentDate": "20240701", "compareDate": "20240630", "hourNum": "18"} }) Vue.prototype.$multipleStoreBoard = Vue.observable({ - search: {} + search: {"groupCodeList": [], "hourNum": "", type: "1"} }) Vue.prototype.$storeBoard = Vue.observable({ search: {} diff --git a/src/views/AppMultipleStoreBoard.vue b/src/views/AppMultipleStoreBoard.vue new file mode 100644 index 0000000..6c4d21b --- /dev/null +++ b/src/views/AppMultipleStoreBoard.vue @@ -0,0 +1,28 @@ + + + + + diff --git a/src/views/AppMultipleStoreBoardFilter.vue b/src/views/AppMultipleStoreBoardFilter.vue new file mode 100644 index 0000000..430f9d8 --- /dev/null +++ b/src/views/AppMultipleStoreBoardFilter.vue @@ -0,0 +1,91 @@ + + + + + diff --git a/src/views/AppRealtimePanel.vue b/src/views/AppRealtimePanel.vue index 0c6d078..5b37b18 100644 --- a/src/views/AppRealtimePanel.vue +++ b/src/views/AppRealtimePanel.vue @@ -36,8 +36,9 @@ export default { }, getValue(item) { let result = this.info[item.prop] - if (item.unit == "%") result = (result * 100 || 0) + "%" + if (item.unit == "%") result = (result * 100 || 0).toFixed(2)+ "%" if (item.calc) result = item.calc() + if (/^-?\d+(\.\d+)?$/.test(result)) result = Number(result).toFixed(2) return result } }, diff --git a/src/views/AppStoresTable.vue b/src/views/AppStoresTable.vue index 4d7b8ec..a9ffbf1 100644 --- a/src/views/AppStoresTable.vue +++ b/src/views/AppStoresTable.vue @@ -38,11 +38,6 @@ export default { data() { return { height: '600px', - search: { - type: '1', - categoryId: '', - hourNum: "" - }, stores: [], cameras: [], storeKeyGoods: [], @@ -50,17 +45,17 @@ export default { columns: { 品类销售情况: [ {label: "品类", prop: "secondCategoryName"}, - {label: "销售额", prop: "currentSaleAmt", width: '70px'}, - {label: "库存金额", prop: "currentStockAmt", width: '80px'}, - {label: "同/环比销售额", prop: "compareSaleAmt", width: '70px'}, - {label: "同/环比库存金额", prop: "compareStockAmt", width: '70px'}, - {label: "前四周日军销售额", prop: "avg4WeekSaleAmt", width: '70px'}, + {label: "销售额", prop: "currentSaleAmt", width: 70}, + {label: "库存金额", prop: "currentStockAmt", width: 80}, + {label: "同/环比销售额", prop: "compareSaleAmt", width: 70}, + {label: "同/环比库存金额", prop: "compareStockAmt", width: 70}, + {label: "前四周日军销售额", prop: "avg4WeekSaleAmt", width: 70}, ], 重点单品情况: [ {label: "重点单品", prop: "name"}, - {label: "当日目标", prop: "targetNum", width: "70px"}, - {label: "销售数量", prop: "saleNum", width: "70px"}, - {label: "库存数量", prop: "stockNum", width: "70px"}, + {label: "当日目标", prop: "targetNum", width: 70}, + {label: "销售数量", prop: "saleNum", width: 70}, + {label: "库存数量", prop: "stockNum", width: 70}, {label: "剩余时间预计销售数量", prop: "preSaleNum"}, {label: "提醒", custom: 1, width: 70, align: 'center', prop: "remind"}, ] @@ -69,6 +64,7 @@ export default { }, computed: { refs: v => v.$parent.getItemRefs(), + search: v => v.$multipleStoreBoard.search, storeList: v => { const list = [] let group = [] @@ -82,27 +78,35 @@ export default { } if (group.length > 0) list.push(group.reverse()) return list + }, + }, + watch: { + search: { + immediate: true, deep: true, handler() { + this.getData() + } } }, methods: { getData() { const {$http, $waitFor} = window console.log("筛选条件:", this.search) - $waitFor($http).then(() => this.getStores()) - .then(() => Promise.all([this.getCameras(), this.getStoreKeyGoods(), this.getCategorySales()])) - .then(() => { - this.stores = this.stores?.map(storeCode => { + $waitFor($http && this.search.groupCodeList.length > 0).then(() => this.getStores()) + .then(codes => Promise.all([this.getCameras(), this.getStoreKeyGoods(), this.getCategorySales()]).then(() => codes)) + .then((codes = []) => { + this.stores = codes?.map(storeCode => { const {storeCameraVOList = [], storeName} = this.cameras.find(e => e.storeCode == storeCode) || {} const keyGoods = this.storeKeyGoods.filter(e => e.storeCode == storeCode) || [] const categorySale = this.categorySales.filter(e => e.storeCode == storeCode) || [] return {storeCode, storeName, camera: storeCameraVOList.map(e => e.cameraUrl), keyGoods, categorySale} - }) || [] + }).filter(e => !!e.storeName) || [] }) }, getStores() { - return $http.get(`/data-boot/ca/screen/scStoreInfo/group/${this.search.groupCodeList}`).then(res => { + const {groupCodeList = []} = this.search + return $http.get(`/data-boot/ca/screen/scStoreInfo/group/${groupCodeList[0]}`).then(res => { if (res?.data) { - this.stores = res.data || [] + return res.data } }) }, @@ -137,12 +141,29 @@ export default { $glob.query = {storeCode: store.storeCode} const sid = "9f299712-5549-413b-a93b-7c3e3b5bfadb" $glob.group = sid - this.refs["ff6a5ca5-8cca-4fad-8058-a2ab2388236c"].$refs.main.groupId = sid + this.$storeBoard.query.storeCode = sid }, + getTableData(item, tag) { + const v = this + const datasource = { + 重点单品情况: "keyGoods", + 品类销售情况: "categorySale", + } + return { + headerBGC: 'rgba(13, 48, 99, 0.6)', + oddRowBGC: window.evenRowBGC(), evenRowBGC: "transparent", + header: v.columns[tag].map(e => e.label), + columnWidth: v.columns[tag].map(e => e.width || "0;flex:1;min-width:0;"), + align: v.columns[tag].map(e => e.align || "left"), + data: item[datasource[tag]].map(e => v.columns[tag].map(column => column.custom == 1 ? `
周边库存情况
` : e[column.prop])), + } + }, + getNearbyStores(evt) { + console.log(evt) + } }, mounted() { this.height = `${this.$el.clientHeight}px` - this.getData() } } @@ -153,25 +174,16 @@ export default {
-
+
- - - +
- - - - - +
@@ -179,12 +191,17 @@ export default { -