牛逼已成

This commit is contained in:
2024-06-29 13:30:06 +08:00
parent 6fb8506f4f
commit fda8e1e999
2 changed files with 37 additions and 22 deletions

View File

@@ -36,6 +36,25 @@ Vue.prototype.$multipleStoreBoard = Vue.observable({
Vue.prototype.$storeBoard = Vue.observable({ Vue.prototype.$storeBoard = Vue.observable({
search: {} search: {}
}) })
Vue.component("tableColumn", {
props: {
column: {default: () => ({})}
},
render(h) {
const config = this.$props.column
return h('el-table-column', {props: config},
config.children?.map(col => h("tableColumn", {props: {column: col}})) || h('template', {
slotScope: {
default: ({row}) => {
config.custom ? h('div', {style: {color: row.preSaleNum > row.stockNum ? 'red' : '#fff'}}, '周边库存情况') :
h('span', row[config.prop] || '')
}
}
}))
},
})
export default Promise.all([ export default Promise.all([
import("./fetch"), import("./fetch"),
...libs.map(url => new Promise(resolve => { ...libs.map(url => new Promise(resolve => {

View File

@@ -1,29 +1,11 @@
<script> <script>
const tableColumn = {
props: {
column: {default: () => ({})}
},
render(h) {
const config = this.$props.column
return h('el-table-column', {props: config},
config.children?.map(col => h(tableColumn, {props: {column: col}})) || h('template', {
slotScope: {
default: ({row}) => {
config.custom ? h('div', {style: {color: row.preSaleNum > row.stockNum ? 'red' : '#fff'}}, '周边库存情况') :
h('span', row[config.prop] || '')
}
}
}))
},
}
export default { export default {
name: "AppKeyGoods", name: "AppKeyGoods",
label: "市场看板-重点单品", label: "市场看板-重点单品",
components: {tableColumn},
data() { data() {
return { return {
tableData: [], tableData: [],
columns:[ columns: [
{label: "重点单品", prop: "name"}, {label: "重点单品", prop: "name"},
{label: "销售额", prop: "targetNum", width: "70px"}, {label: "销售额", prop: "targetNum", width: "70px"},
{label: "库存数量", prop: "saleNum", width: "70px"}, {label: "库存数量", prop: "saleNum", width: "70px"},
@@ -32,15 +14,29 @@ export default {
] ]
} }
}, },
methods:{ computed: {
search: v => v.$marketBoard.search
},
methods: {
getTableData() {
const {$http, $waitFor} = window
$waitFor($http).then(() => $http.post("/data-boot/la/screen/marketBoard/marketKeyGoods", {
...this.search, limit: 999
})).then(res => {
if (res?.data) {
this.tableData = res.data?.records || []
}
})
}
},
created() {
this.getTableData()
} }
} }
</script> </script>
<template> <template>
<section class="AppKeyGoods"> <section class="AppKeyGoods">
<div class="subTitle" v-text="'表格标题'"/>
<el-table :data="tableData" size="mini" header-cell-class-name="tableHeader" cell-class-name="tableCell" max-height="440px" show-summary stripe> <el-table :data="tableData" size="mini" header-cell-class-name="tableHeader" cell-class-name="tableCell" max-height="440px" show-summary stripe>
<table-column v-for="(column,i) in columns" :key="i" :column="column"/> <table-column v-for="(column,i) in columns" :key="i" :column="column"/>
</el-table> </el-table>