Commit 5c9c28db authored by leon's avatar leon

feat: table header click

parent 85a8d99c
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<view class='tr' :class="[sticky ? 'table_header_sticky' : 'table_header']" <view class='tr' :class="[sticky ? 'table_header_sticky' : 'table_header']"
v-if="elementInfo.table.tableHeader.showHeader"> v-if="elementInfo.table.tableHeader.showHeader">
<template v-for="(item, index) in elementInfo.table.column"> <template v-for="(item, index) in elementInfo.table.column">
<view class="th th_style" :class="[index == 0 && !sticky ? 'row_fixed': '']" :key="index"> <view class="th th_style" :class="[index == 0 && !sticky ? 'row_fixed': '']" :key="index" @tap="headerClick(item)">
{{item.title}} {{item.title}}
</view> </view>
</template> </template>
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
:style="[tableCellStyle(index, cellIndex)]" :data-column="index" :data-row="cellIndex"> :style="[tableCellStyle(index, cellIndex)]" :data-column="index" :data-row="cellIndex">
<template v-if="item.slots.customRender == 'rank'">{{index + 1}}</template> <template v-if="item.slots.customRender == 'rank'">{{index + 1}}</template>
<template v-else-if="item.slots.customRender == 'picture'"> <template v-else-if="item.slots.customRender == 'picture'">
<u-image :height="100" mode="aspectFit" <u-image :height="elementInfo.table.imageHeight || 100" mode="aspectFit"
:src="`${cell[item.dataIndex]}?${new Date().getTime()}`" crossOrigin="anonymous" :src="`${cell[item.dataIndex]}?${new Date().getTime()}`" crossOrigin="anonymous"
style="width:100%" @click="imageClick(cellIndex, item.dataIndex)"></u-image> style="width:100%" @click="imageClick(cellIndex, item.dataIndex)"></u-image>
</template> </template>
...@@ -72,7 +72,8 @@ ...@@ -72,7 +72,8 @@
titlePostion: cellTitlePostion, titlePostion: cellTitlePostion,
titleFontSize: cellTitleFontSize, titleFontSize: cellTitleFontSize,
cellRowHeight, cellRowHeight,
titleColor: cellTitleColor titleColor: cellTitleColor,
cellPadding
} = this.elementInfo.table.tableCell } = this.elementInfo.table.tableCell
const { const {
headerRowHeight, headerRowHeight,
...@@ -99,7 +100,8 @@ ...@@ -99,7 +100,8 @@
'--cell-justify-content': this.align[cellTitlePostion], '--cell-justify-content': this.align[cellTitlePostion],
'--cell-font-size': `${cellTitleFontSize || 14}px`, '--cell-font-size': `${cellTitleFontSize || 14}px`,
'--cell-row-height': `${cellRowHeight || 30}px`, '--cell-row-height': `${cellRowHeight || 30}px`,
'--cell-color': cellTitleColor '--cell-color': cellTitleColor,
'--cell-padding': `${cellPadding || 10}px`
} }
}, },
}, },
...@@ -224,6 +226,20 @@ ...@@ -224,6 +226,20 @@
}) })
}, },
headerClick(e) {
const {
index,
data
} = this.elementInfo.child
const paramName = this.elementInfo.table.tableHeader.headerParams
const value = e.dataIndex
uni.$emit('handleLinkParams', {
index,
paramName,
value: value
})
},
// 图片增加点击事件,查看全部图片 // 图片增加点击事件,查看全部图片
imageClick(index, key) { imageClick(index, key) {
const images = [] const images = []
...@@ -317,14 +333,14 @@ ...@@ -317,14 +333,14 @@
flex: var(--cell-width); flex: var(--cell-width);
font-size: 28rpx; font-size: 28rpx;
color: $u-main-color; color: $u-main-color;
padding: 10px 0px; padding: var(--cell-padding) 0px;
background-color: rgb(245, 246, 248); background-color: rgb(245, 246, 248);
} }
.td { .td {
flex: var(--cell-width); flex: var(--cell-width);
align-self: stretch; align-self: stretch;
padding: 10px 0px; padding: var(--cell-padding) 0px;
font-size: 28rpx; font-size: 28rpx;
color: $u-content-color; color: $u-content-color;
display: flex; display: flex;
......
...@@ -177,7 +177,6 @@ ...@@ -177,7 +177,6 @@
paramName, paramName,
data data
} = this.elementInfo.child } = this.elementInfo.child
console.log(this.tabsValue)
if (this.elementInfo.child.type === 'param') { if (this.elementInfo.child.type === 'param') {
uni.$emit('handleLinkParams', { uni.$emit('handleLinkParams', {
index, index,
...@@ -201,7 +200,6 @@ ...@@ -201,7 +200,6 @@
var label = value var label = value
this.elementData.dataList.series.forEach(item => { this.elementData.dataList.series.forEach(item => {
if (item.value === value) { if (item.value === value) {
console.log(item)
label = item.name label = item.name
} }
}) })
......
...@@ -309,7 +309,6 @@ ...@@ -309,7 +309,6 @@
handlePage() { handlePage() {
var idstr = this.idList[this.indexs] var idstr = this.idList[this.indexs]
const url = "/pages/details/details?id=" + idstr + "&idList=" + this.idList const url = "/pages/details/details?id=" + idstr + "&idList=" + this.idList
console.log(url)
uni.redirectTo({ uni.redirectTo({
url: url url: url
}) })
......
...@@ -274,7 +274,7 @@ ...@@ -274,7 +274,7 @@
async getGlobalData(info) { async getGlobalData(info) {
const that = this const that = this
const dataUrl = info.dataUrl.replace(/^(\/(dashboardCharts|dashboardAPI))?/, '') const dataUrl = info.dataUrl.replace(/^(\/(dashboardCharts|dashboardAPI))?/, '')
const dataFormatter = this.$u.common.filterRequestParams({...info.dataFormatter}) const dataFormatter = that.$u.common.filterRequestParams({...info.dataFormatter})
let res = await that.$u.api[`${info.dataMethod.toLowerCase()}Http`](dataUrl, dataFormatter, { let res = await that.$u.api[`${info.dataMethod.toLowerCase()}Http`](dataUrl, dataFormatter, {
custom: { loading: false } custom: { loading: false }
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment