表格样式
This commit is contained in:
@@ -2,15 +2,44 @@
|
|||||||
export default {
|
export default {
|
||||||
name: "AppKgTable",
|
name: "AppKgTable",
|
||||||
label: "表格",
|
label: "表格",
|
||||||
data(){
|
components: {
|
||||||
return{
|
tableColumn: {
|
||||||
tableData:[],
|
functional: true,
|
||||||
columns:[
|
props: {
|
||||||
|
column: {default: () => ({})}
|
||||||
|
},
|
||||||
|
render(h, vm) {
|
||||||
|
const config = vm.props.column
|
||||||
|
return h('el-table-column', {props: config}, 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] || '')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
tableData: [
|
||||||
|
{name: "商品1", targetNum: 100, saleNum: 50, stockNum: 20, preSaleNum: 30, remind: 1},
|
||||||
|
{name: "商品2", targetNum: 100, saleNum: 50, stockNum: 20, preSaleNum: 30, remind: 0},
|
||||||
|
{name: "商品3", targetNum: 100, saleNum: 50, stockNum: 20, preSaleNum: 30, remind: 1},
|
||||||
|
],
|
||||||
|
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"},
|
||||||
{label: "库存数量", prop: "stockNum", width: "70px"},
|
{label: "库存数量", prop: "stockNum", width: "70px"},
|
||||||
{label: "预计销售数量", prop: "preSaleNum"},
|
{label: "预计销售数量", prop: "preSaleNum"},
|
||||||
|
{
|
||||||
|
label: "合并表头示例", children: [
|
||||||
|
{"label": "当日目标", "prop": "targetNum", "width": "70px"},
|
||||||
|
{"label": "销售数量", "prop": "saleNum", "width": "70px"},
|
||||||
|
]
|
||||||
|
},
|
||||||
{label: "提醒", custom: 1, width: 70, align: 'center', prop: "remind"},
|
{label: "提醒", custom: 1, width: 70, align: 'center', prop: "remind"},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -21,18 +50,13 @@ export default {
|
|||||||
<template>
|
<template>
|
||||||
<section class="AppKgTable">
|
<section class="AppKgTable">
|
||||||
<div class="subTiltle" v-text="'表格标题'"/>
|
<div class="subTiltle" v-text="'表格标题'"/>
|
||||||
<el-table :data="tableData" size="mini" header-cell-class-name="tableHeader" cell-class-name="tableCell" max-height="440px">
|
<el-table :data="tableData" size="mini" header-cell-class-name="tableHeader" cell-class-name="tableCell" max-height="440px" show-summary stripe>
|
||||||
<el-table-column v-for="column in columns" v-bind="column" :key="column.prop">
|
<table-column v-for="(column,i) in columns" :key="i" :column="column"/>
|
||||||
<template v-slot="{row}">
|
|
||||||
<div v-if="column.custom" :style="{color: row.preSaleNum > row.stockNum ? 'red' : '#fff'}" v-text="'周边库存情况'"/>
|
|
||||||
<span v-else v-text="row[column.prop] || ''"/>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
</el-table>
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style>
|
||||||
.AppKgTable {
|
.AppKgTable {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
@@ -45,7 +69,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.AppKgTable .el-table tr {
|
.AppKgTable .el-table tr {
|
||||||
background: transparent;
|
background-color: transparent !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.AppKgTable .el-table {
|
.AppKgTable .el-table {
|
||||||
@@ -53,6 +77,16 @@ export default {
|
|||||||
border-color: transparent;
|
border-color: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.AppKgTable .el-table .el-table__footer-wrapper tr {
|
||||||
|
background: linear-gradient(90deg, rgba(1, 196, 236, 0.5) 0%, rgba(1, 196, 236, 0.01) 100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.AppKgTable .el-table .el-table__footer-wrapper .is-leaf {
|
||||||
|
color: #66FFFF;
|
||||||
|
background: transparent;
|
||||||
|
border-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
.AppKgTable .el-table:before {
|
.AppKgTable .el-table:before {
|
||||||
background: transparent;
|
background: transparent;
|
||||||
}
|
}
|
||||||
@@ -62,6 +96,23 @@ export default {
|
|||||||
border-color: transparent !important;
|
border-color: transparent !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.AppKgTable .el-table tr.el-table__row--striped {
|
||||||
|
--odd-bg: #09265B;
|
||||||
|
background-color: #081F48;
|
||||||
|
background-image: linear-gradient(
|
||||||
|
-45deg, var(--odd-bg) 0, var(--odd-bg) 10%, transparent 10%, transparent 50%,
|
||||||
|
var(--odd-bg) 50%, var(--odd-bg) 60%, transparent 60%, transparent);
|
||||||
|
background-size: 10px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.AppKgTable .el-table tr.el-table__row--striped .tableCell {
|
||||||
|
background-color: transparent !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.AppKgTable .el-table tr:hover > .tableCell {
|
||||||
|
background-color: rgba(255, 255, 255, .1) !important;
|
||||||
|
}
|
||||||
|
|
||||||
.AppKgTable .subTiltle {
|
.AppKgTable .subTiltle {
|
||||||
line-height: 20px;
|
line-height: 20px;
|
||||||
width: fit-content;
|
width: fit-content;
|
||||||
|
|||||||
Reference in New Issue
Block a user