牛逼已成
This commit is contained in:
@@ -36,6 +36,25 @@ Vue.prototype.$multipleStoreBoard = Vue.observable({
|
||||
Vue.prototype.$storeBoard = Vue.observable({
|
||||
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([
|
||||
import("./fetch"),
|
||||
...libs.map(url => new Promise(resolve => {
|
||||
|
||||
@@ -1,29 +1,11 @@
|
||||
<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 {
|
||||
name: "AppKeyGoods",
|
||||
label: "市场看板-重点单品",
|
||||
components: {tableColumn},
|
||||
data() {
|
||||
return {
|
||||
tableData: [],
|
||||
columns:[
|
||||
columns: [
|
||||
{label: "重点单品", prop: "name"},
|
||||
{label: "销售额", prop: "targetNum", 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>
|
||||
|
||||
<template>
|
||||
<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>
|
||||
<table-column v-for="(column,i) in columns" :key="i" :column="column"/>
|
||||
</el-table>
|
||||
|
||||
Reference in New Issue
Block a user