调整大屏展示内容
This commit is contained in:
56
components/AiDvDialog.vue
Normal file
56
components/AiDvDialog.vue
Normal file
@@ -0,0 +1,56 @@
|
||||
<script>
|
||||
import AiDrag from "./AiDrag.vue";
|
||||
import AiDvSvg from "./layout/AiDvSvg/AiDvSvg.vue";
|
||||
|
||||
export default {
|
||||
name: "AiDvDialog",
|
||||
components: {AiDvSvg, AiDrag},
|
||||
props: {
|
||||
title: {default: "弹窗"},
|
||||
tableData: {default: () => []},
|
||||
columns: {type: [Array, Object]}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialog: false,
|
||||
detail: {}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
colConfigs() {
|
||||
let config = []
|
||||
if (!Array.isArray(this.columns)) {
|
||||
config = Object.entries(this.columns).map(([key, value]) => {
|
||||
return {...value, prop: key}
|
||||
})
|
||||
} else config = this.columns
|
||||
return config
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section class="AiDvDialog">
|
||||
<ai-drag v-if="dialog" :resizable="false">
|
||||
<ai-dv-svg :title="title" @close="dialog=false">
|
||||
<slot v-if="$slots.default"/>
|
||||
<el-table v-else class="simple" :data="tableData">
|
||||
<el-table-column v-for="item in colConfigs" :key="item.prop" :prop="item.prop" :label="item.label"/>
|
||||
</el-table>
|
||||
</ai-dv-svg>
|
||||
</ai-drag>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import "dv";
|
||||
|
||||
.AiDvDialog {
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
z-index: 999;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
</style>
|
||||
@@ -32,7 +32,7 @@
|
||||
:theme="theme"
|
||||
:isShowIndex="data.isShowIndex"
|
||||
:config="dvTableConfig"
|
||||
:data="values">
|
||||
:data="values" :simple="data.simple==1">
|
||||
</AiDvTable>
|
||||
<AiRanking
|
||||
v-else-if="currentType === 'AiRanking'"
|
||||
|
||||
62
components/dv.scss
Normal file
62
components/dv.scss
Normal file
@@ -0,0 +1,62 @@
|
||||
:deep(.el-table.simple) {
|
||||
font-size: 13px;
|
||||
color: #fff;
|
||||
background-color: transparent !important;
|
||||
|
||||
.el-table__header {
|
||||
background: rgba(33, 180, 253, 0.1);
|
||||
}
|
||||
|
||||
&::before {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
tr.el-table__row--striped td {
|
||||
background: rgba(33, 180, 253, 0.1) !important;
|
||||
}
|
||||
|
||||
.el-table th.el-table__cell {
|
||||
background: transparent !important;
|
||||
}
|
||||
|
||||
.el-table__header tr th:first-child .cell {
|
||||
padding-left: 20px !important;
|
||||
}
|
||||
|
||||
.el-table__header tr th.is-right .cell {
|
||||
padding-right: 20px !important;
|
||||
}
|
||||
|
||||
.el-table__body tr td.is-right .cell {
|
||||
padding-right: 20px !important;
|
||||
}
|
||||
|
||||
.el-table__body tr td:first-child .cell {
|
||||
padding-left: 20px !important;
|
||||
}
|
||||
|
||||
&.el-table--enable-row-hover .el-table__body tr:hover > td.el-table__cell {
|
||||
background-color: rgba(33, 180, 253, 0.1) !important;
|
||||
}
|
||||
|
||||
td.el-table__cell, th.el-table__cell.is-leaf {
|
||||
border-bottom: none !important;
|
||||
}
|
||||
|
||||
th.el-table__cell {
|
||||
background-color: transparent !important;
|
||||
}
|
||||
|
||||
tr {
|
||||
background-color: transparent !important;
|
||||
}
|
||||
|
||||
.el-table__cell {
|
||||
padding: 7px 0;
|
||||
color: #d0e1e8;
|
||||
}
|
||||
|
||||
.el-table__header tr .cell {
|
||||
color: #02FEFF !important;
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,9 @@
|
||||
const w = 12, h = 10, r = 200
|
||||
export default {
|
||||
name: "AiDvSvg",
|
||||
props: {
|
||||
title: {default: "慧智会言"},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
border: "",
|
||||
@@ -18,7 +21,7 @@ export default {
|
||||
this.width = width
|
||||
this.height = height
|
||||
this.getBorder(width, height)
|
||||
const vv = width - w, hh = height - h
|
||||
const vv = width - w
|
||||
this.box = {
|
||||
top: `m${vv - r + 33},${13 + h}l7,0l-2.5,-3l-7,0l2.5,3zm-1.5,0l-4.5,-5.5l-7,0l4.5,5.5l7,0zm-21,-7l6,7l7,0l-6,-7l-7,0z`,
|
||||
leftBottom: `m46.5,${height + 10}l7,0l-2.5,-3l-7,0l2.5,3zm-1.5,0l-4.5,-5.5l-7,0l4.5,5.5l7,0zm-21,-7l6,7l7,0l-6,-7l-7,0z`,
|
||||
@@ -96,7 +99,7 @@ export default {
|
||||
</svg>
|
||||
<div class="close" @click="$emit('close')"/>
|
||||
<div class="content">
|
||||
<div class="header">慧智会言</div>
|
||||
<div class="header" v-text="title"/>
|
||||
<slot/>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -1,163 +1,300 @@
|
||||
<template>
|
||||
<div class="aiDvTable" :class="'aiDvTable-' + theme + ' aiDvTable-' + size">
|
||||
<div class="header" :style="headerStyle">
|
||||
<section class="AiDvTable">
|
||||
<el-table v-if="simple" class="simple" :data="tableData">
|
||||
<el-table-column v-for="item in columns" :key="item.prop" v-bind="item"/>
|
||||
</el-table>
|
||||
<div v-else class="aiDvTable" :class="'aiDvTable-' + theme + ' aiDvTable-' + size">
|
||||
<div class="header" :style="headerStyle">
|
||||
<span
|
||||
v-for="(item, index) in header"
|
||||
:key="index"
|
||||
:style="{
|
||||
v-for="(item, index) in header"
|
||||
:key="index"
|
||||
:style="{
|
||||
width: config[index].width ? config[index].width + 'px' : '',
|
||||
textAlign: config[index].align,
|
||||
flex: config[index].width ? 'inherit' : 1
|
||||
}">
|
||||
{{ item.v }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="body">
|
||||
<div class="row" v-for="(item, index) in body" :class="[stripe === '1' ? 'stripe' : '']" :key="index">
|
||||
<div
|
||||
v-for="(column, i) in item"
|
||||
:key="i"
|
||||
:style="{
|
||||
</div>
|
||||
<div class="body">
|
||||
<div class="row" v-for="(item, index) in body" :class="[stripe === '1' ? 'stripe' : '']" :key="index">
|
||||
<div
|
||||
v-for="(column, i) in item"
|
||||
:key="i"
|
||||
:style="{
|
||||
color: config[i].color,
|
||||
textAlign: config[i].align,
|
||||
fontSize: config[i].fontSize,
|
||||
width: config[i].width ? config[i].width + 'px' : '',
|
||||
flex: config[i].width ? 'inherit' : 1
|
||||
}">
|
||||
<i v-if="isShowIndex === '1' && i === 0">{{ index + 1 }}</i>
|
||||
<render-slot
|
||||
v-if="config[i].render"
|
||||
:render="config[i].render"
|
||||
:row="item"
|
||||
:column="column">
|
||||
</render-slot>
|
||||
<span v-else :title="column" @click="onClick(config[i], item)">{{ column }}</span>
|
||||
<i v-if="isShowIndex === '1' && i === 0">{{ index + 1 }}</i>
|
||||
<render-slot
|
||||
v-if="config[i].render"
|
||||
:render="config[i].render"
|
||||
:row="item"
|
||||
:column="column">
|
||||
</render-slot>
|
||||
<span v-else :title="column" @click="onClick(config[i], item)">{{ column }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'AiDvTable',
|
||||
export default {
|
||||
name: 'AiDvTable',
|
||||
|
||||
components: {
|
||||
renderSlot: {
|
||||
functional: true,
|
||||
props: {
|
||||
render: Function,
|
||||
column: {type: [String, Number] },
|
||||
row: {type: [Array, Object] },
|
||||
},
|
||||
render: (h, data) => {
|
||||
let params = {
|
||||
row: data.props.row
|
||||
}
|
||||
if (data.props.column) {
|
||||
params.column = data.props.column
|
||||
}
|
||||
return data.props.render(h, params)
|
||||
components: {
|
||||
renderSlot: {
|
||||
functional: true,
|
||||
props: {
|
||||
render: Function,
|
||||
column: {type: [String, Number]},
|
||||
row: {type: [Array, Object]},
|
||||
},
|
||||
render: (h, data) => {
|
||||
let params = {
|
||||
row: data.props.row
|
||||
}
|
||||
if (data.props.column) {
|
||||
params.column = data.props.column
|
||||
}
|
||||
return data.props.render(h, params)
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
props: {
|
||||
data: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
|
||||
headerStyle: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
}
|
||||
},
|
||||
|
||||
props: {
|
||||
data: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
isShowIndex: {
|
||||
type: String,
|
||||
default: '0'
|
||||
},
|
||||
|
||||
headerStyle: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
},
|
||||
stripe: {
|
||||
type: String,
|
||||
default: '1'
|
||||
},
|
||||
|
||||
isShowIndex: {
|
||||
type: String,
|
||||
default: '0'
|
||||
},
|
||||
theme: {
|
||||
type: String,
|
||||
default: '0'
|
||||
},
|
||||
|
||||
stripe: {
|
||||
type: String,
|
||||
default: '1'
|
||||
},
|
||||
config: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
|
||||
theme: {
|
||||
type: String,
|
||||
default: '0'
|
||||
},
|
||||
size: {
|
||||
type: String,
|
||||
default: 'small'
|
||||
},
|
||||
simple: Boolean
|
||||
},
|
||||
|
||||
config: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
data() {
|
||||
return {
|
||||
header: [],
|
||||
body: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
columns: v => v.header.map((e, i) => {
|
||||
let item = {}
|
||||
Object.values(e).forEach(label => {
|
||||
const {align} = v.config[i]
|
||||
item.align = align
|
||||
item.prop = `col${i}`
|
||||
item.label = label
|
||||
})
|
||||
return item
|
||||
}),
|
||||
tableData: v => v.body.map(arr => {
|
||||
const item = {}
|
||||
Object.values(arr).forEach((value, i) => {
|
||||
item[`col${i}`] = value
|
||||
})
|
||||
return item
|
||||
})
|
||||
},
|
||||
watch: {
|
||||
data: {
|
||||
handler(v) {
|
||||
this.init(v)
|
||||
},
|
||||
deep: true,
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init(value) {
|
||||
if (!value.length) {
|
||||
this.header = []
|
||||
this.body = []
|
||||
|
||||
size: {
|
||||
type: String,
|
||||
default: 'small'
|
||||
return false
|
||||
}
|
||||
|
||||
const headerKey = Object.keys(value[0])[0]
|
||||
const bodyKey = Object.keys(value[0]).filter(v => {
|
||||
return v !== headerKey
|
||||
})
|
||||
|
||||
this.header = value.map(v => {
|
||||
return {
|
||||
v: v[headerKey]
|
||||
}
|
||||
})
|
||||
|
||||
this.body = bodyKey.map(v => {
|
||||
return value.map(e => e[v])
|
||||
})
|
||||
},
|
||||
|
||||
onClick(config, e) {
|
||||
if (config.click && typeof config.click === 'function') {
|
||||
return config.click.call(this, e)
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
data () {
|
||||
return {
|
||||
header: [],
|
||||
body: []
|
||||
<style lang="scss" scoped>
|
||||
@import "../../dv";
|
||||
|
||||
.aiDvTable {
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
|
||||
::-webkit-scrollbar {
|
||||
width: 5px;
|
||||
height: 14px;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-corner {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb {
|
||||
min-height: 20px;
|
||||
background-clip: content-box;
|
||||
box-shadow: 0 0 0 5px rgba(116, 148, 170, 0.5) inset;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-track {
|
||||
box-shadow: 1px 1px 5px rgba(116, 148, 170, 0.5) inset;
|
||||
}
|
||||
|
||||
.header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
font-size: 16px;
|
||||
padding: 0 16px;
|
||||
color: rgba(255, 255, 255, 0.7);
|
||||
background: rgba(70, 70, 70, 0.35);
|
||||
|
||||
span {
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
-o-text-overflow: ellipsis;
|
||||
|
||||
&:first-child {
|
||||
text-align: left;
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
watch: {
|
||||
data: {
|
||||
handler (v) {
|
||||
this.init(v)
|
||||
},
|
||||
deep: true,
|
||||
immediate: true
|
||||
.body {
|
||||
height: calc(100% - 40px);
|
||||
padding: 10px 0;
|
||||
overflow-y: auto;
|
||||
box-sizing: border-box;
|
||||
|
||||
.row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
height: 52px;
|
||||
padding: 0 16px;
|
||||
box-sizing: border-box;
|
||||
|
||||
&.stripe:nth-of-type(2n) {
|
||||
background: rgba(48, 48, 48, 0.4);
|
||||
}
|
||||
},
|
||||
|
||||
mounted () {
|
||||
},
|
||||
div {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex: 1;
|
||||
font-size: 16px;
|
||||
text-align: center;
|
||||
color: #ffffff;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
-o-text-overflow: ellipsis;
|
||||
|
||||
methods: {
|
||||
init (value) {
|
||||
if (!value.length) {
|
||||
this.header = []
|
||||
this.body = []
|
||||
|
||||
return false
|
||||
span {
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
-o-text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
const headerKey = Object.keys(value[0])[0]
|
||||
const bodyKey = Object.keys(value[0]).filter(v => {
|
||||
return v !== headerKey
|
||||
})
|
||||
i {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
line-height: 20px;
|
||||
margin-right: 10px;
|
||||
text-align: center;
|
||||
font-size: 12px;
|
||||
color: #18FEFE;
|
||||
font-style: normal;
|
||||
background: url(./asset/rankbg.png) no-repeat;
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
|
||||
this.header = value.map(v => {
|
||||
return {
|
||||
v: v[headerKey]
|
||||
}
|
||||
})
|
||||
|
||||
this.body = bodyKey.map(v => {
|
||||
return value.map(e => e[v])
|
||||
})
|
||||
},
|
||||
|
||||
onClick (config, e) {
|
||||
if (config.click && typeof config.click === 'function') {
|
||||
return config.click.call(this, e)
|
||||
&:first-child {
|
||||
justify-content: start;
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.aiDvTable {
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
&.aiDvTable-mini {
|
||||
.header {
|
||||
height: 36px;
|
||||
}
|
||||
|
||||
.row {
|
||||
height: 40px;
|
||||
}
|
||||
}
|
||||
|
||||
&.aiDvTable-1 {
|
||||
::-webkit-scrollbar {
|
||||
width: 5px;
|
||||
height: 14px;
|
||||
@@ -170,138 +307,26 @@
|
||||
::-webkit-scrollbar-thumb {
|
||||
min-height: 20px;
|
||||
background-clip: content-box;
|
||||
box-shadow: 0 0 0 5px rgba(116, 148, 170, 0.5) inset;
|
||||
box-shadow: 0 0 0 5px rgba(250, 181, 108, 0.5) inset;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-track {
|
||||
box-shadow: 1px 1px 5px rgba(116, 148, 170, 0.5) inset;
|
||||
box-shadow: 1px 1px 5px rgba(50, 181, 108, 0.5) inset;
|
||||
}
|
||||
|
||||
.header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
font-size: 16px;
|
||||
padding: 0 16px;
|
||||
color: rgba(255, 255, 255, 0.7);
|
||||
background: rgba(70, 70, 70, 0.35);
|
||||
|
||||
span {
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
-o-text-overflow:ellipsis;
|
||||
|
||||
&:first-child {
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
background: rgba(226, 121, 81, 0.2);
|
||||
}
|
||||
|
||||
.body {
|
||||
height: calc(100% - 40px);
|
||||
padding: 10px 0;
|
||||
overflow-y: auto;
|
||||
box-sizing: border-box;
|
||||
.row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
height: 52px;
|
||||
padding: 0 16px;
|
||||
box-sizing: border-box;
|
||||
|
||||
&.stripe:nth-of-type(2n) {
|
||||
background: rgba(48, 48, 48, 0.4);
|
||||
}
|
||||
|
||||
div {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex: 1;
|
||||
font-size: 16px;
|
||||
text-align: center;
|
||||
color: #ffffff;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
-o-text-overflow:ellipsis;
|
||||
|
||||
span {
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
-o-text-overflow:ellipsis;
|
||||
}
|
||||
|
||||
i {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
line-height: 20px;
|
||||
margin-right: 10px;
|
||||
text-align: center;
|
||||
font-size: 12px;
|
||||
color: #18FEFE;
|
||||
font-style: normal;
|
||||
background: url(./asset/rankbg.png) no-repeat;
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
|
||||
&:first-child {
|
||||
justify-content: start;
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.aiDvTable-mini {
|
||||
.header {
|
||||
height: 36px;
|
||||
}
|
||||
|
||||
.row {
|
||||
height: 40px;
|
||||
}
|
||||
}
|
||||
|
||||
&.aiDvTable-1 {
|
||||
::-webkit-scrollbar {
|
||||
width: 5px;
|
||||
height: 14px;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-corner {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb {
|
||||
min-height: 20px;
|
||||
background-clip: content-box;
|
||||
box-shadow: 0 0 0 5px rgba(250, 181, 108, 0.5) inset;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-track {
|
||||
box-shadow: 1px 1px 5px rgba(50, 181, 108, 0.5) inset;
|
||||
}
|
||||
.header {
|
||||
background: rgba(226, 121, 81, 0.2);
|
||||
}
|
||||
|
||||
.body {
|
||||
div {
|
||||
i {
|
||||
color: #FFA086;
|
||||
background: url(./asset/rankbg-dj.png) no-repeat;
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
div {
|
||||
i {
|
||||
color: #FFA086;
|
||||
background: url(./asset/rankbg-dj.png) no-repeat;
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user