表格样式完成

This commit is contained in:
aixianling
2024-06-27 14:41:30 +08:00
parent b141098b71
commit f667bf2d69

View File

@@ -1,26 +1,25 @@
<script>
export default {
name: "AppKgTable",
label: "表格",
components: {
tableColumn: {
functional: true,
props: {
column: {default: () => ({})}
},
render(h, vm) {
const config = vm.props.column
return h('el-table-column', {props: config}, h('template', {
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'}}, '周边库存情况') :
config.children?.map(col => h('table-column', {props: {column: col}})) || h('span', row[config.prop] || '')
h('span', row[config.prop] || '')
}
}
}))
},
}
},
}
export default {
name: "AppKgTable",
label: "表格",
components: {tableColumn},
data() {
return {
tableData: [
@@ -30,14 +29,12 @@ export default {
],
columns: [
{label: "重点单品", prop: "name"},
{label: "当日目标", prop: "targetNum", width: "70px"},
{label: "销售数量", prop: "saleNum", width: "70px"},
{label: "库存数量", prop: "stockNum", width: "70px"},
{label: "预计销售数量", prop: "preSaleNum"},
{label: "当日目标", prop: "targetNum", width: 70},
{label: "销售数量", prop: "saleNum", width: 70},
{
label: "合并表头示例", children: [
{"label": "当日目标", "prop": "targetNum", "width": "70px"},
{"label": "销售数量", "prop": "saleNum", "width": "70px"},
{label: "库存数量", prop: "stockNum", width: "70px"},
{label: "预计销售数量", prop: "preSaleNum"},
]
},
{label: "提醒", custom: 1, width: 70, align: 'center', prop: "remind"},