Files
kengee-data-screen/src/views/AppKeyGoods.vue

94 lines
2.7 KiB
Vue
Raw Normal View History

<script>
export default {
name: "AppKeyGoods",
label: "市场看板-重点单品",
data() {
return {
tableData: [],
2024-06-29 13:30:06 +08:00
columns: [
2024-07-16 12:16:43 +08:00
{label: "重点单品", prop: "goodsName"},
{label: "销售数量", prop: "saleNum", width: 70},
2024-07-05 17:36:16 +08:00
{label: "库存数量", prop: "stockNum", width: 70},
2024-07-10 13:55:30 +08:00
{label: "销售目标", prop: "targetSaleNum", width: 70},
2024-06-29 13:41:43 +08:00
{label: "销售达成", prop: "saleAchieveRate"},
2024-10-22 10:08:51 +08:00
],
goodsCategoryId: ""
}
},
2024-06-29 13:30:06 +08:00
computed: {
2024-07-05 17:36:16 +08:00
search: v => v.$marketBoard.search,
2024-10-22 10:08:51 +08:00
dicts: v => window.$dicts || {},
2024-07-05 17:36:16 +08:00
tableConfig: v => {
return {
headerBGC: 'rgba(13, 48, 99, 0.6)',
// headerBGC: '#003B51',
oddRowBGC: window.evenRowBGC(), evenRowBGC: "transparent",
header: v.columns.map(e => e.label),
columnWidth: v.columns.map(e => e.width || "0;flex:1;min-width:0;"),
align: v.columns.map(e => e.align || "left"),
data: v.tableData.map(e => v.columns.map(column => e[column.prop])),
}
},
2024-06-29 13:30:06 +08:00
},
methods: {
getTableData() {
const {$http, $waitFor} = window
2024-10-22 10:08:51 +08:00
const {goodsCategoryId} = this
2024-10-22 10:54:10 +08:00
$waitFor($http).then(() => $http.post("/data-boot/la/screen/marketBoard/marketKeyGoods", {
2024-10-22 10:08:51 +08:00
...this.search, limit: 999, goodsCategoryId
2024-06-29 13:30:06 +08:00
})).then(res => {
if (res?.data) {
this.tableData = res.data?.records || []
}
})
2024-11-03 10:27:14 +08:00
},
relevanceMapData(selectGoods) {
this.$set(this.$marketBoard, 'thirdGoods', selectGoods)
2024-06-29 13:30:06 +08:00
}
},
2024-07-10 13:55:30 +08:00
watch: {
search: {
2024-07-10 13:55:30 +08:00
immediate: true, deep: true, handler() {
this.getTableData()
}
}
2024-11-03 10:27:14 +08:00
},
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>
<template>
<section class="AppKeyGoods">
2024-10-22 10:08:51 +08:00
<app-sub-title text="重点单品">
<template #right>
<el-select placeholder="全部" v-model="goodsCategoryId" size="small" clearable class="AppSelect" @change="getTableData">
<el-option v-for="(op,i) in dicts.品类" :key="i" v-bind="op"/>
</el-select>
</template>
</app-sub-title>
2024-11-03 10:27:14 +08:00
<scroll-table :table-data="tableData" :columns="columns" @click="relevanceMapData" @click.native.stop/>
2024-08-05 03:28:19 +08:00
<!--<dv-scroll-board :config="tableConfig"/>-->
</section>
</template>
<style>
.AppKeyGoods {
color: #fff;
box-sizing: border-box;
}
2024-11-03 10:27:14 +08:00
2024-10-22 10:54:10 +08:00
.AppKeyGoods .dv-scroll-board, .AppKeyGoods .scrollTable {
height: calc(100% - 60px) !important;
}
</style>