|
@@ -5,13 +5,24 @@
|
|
}" :header-cell-style="{
|
|
}" :header-cell-style="{
|
|
...headerCellStyle,
|
|
...headerCellStyle,
|
|
...props.headerCellStyle
|
|
...props.headerCellStyle
|
|
- }">
|
|
|
|
- <el-table-column v-for="item in columns" :key="item.prop" :label="item.label" :prop="item.prop" show-overflow-tooltip :width="item.width || ''">
|
|
|
|
|
|
+ }">
|
|
|
|
+ <el-table-column v-for="item in columns" :key="item.prop" :label="item.label" :prop="item.prop"
|
|
|
|
+ show-overflow-tooltip :width="item.width || ''">
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
- <div class="percent-box" v-if="item.type === 'percentDom'">
|
|
|
|
- <div class="inner" :style="{ width: scope.row[item.prop] + '%' }"></div>
|
|
|
|
- </div>
|
|
|
|
- <div v-else class="ellipsis-box">{{ scope.row[item.prop] + (item.prop == 'percent' ? '%' : '') }}</div>
|
|
|
|
|
|
+ <el-tooltip placement="top" effect="light" v-if="item.type === 'percentDom' && props.showTooltip">
|
|
|
|
+ <div class="percent-box">
|
|
|
|
+ <div class="inner" :style="{ width: scope.row[item.prop] + '%' }"></div>
|
|
|
|
+ </div>
|
|
|
|
+ <template #content>
|
|
|
|
+ {{ scope.row['name'] }}<br>
|
|
|
|
+ TGI: {{ scope.row['tgi'] }}<br>
|
|
|
|
+ 本特征卸载用户占比: {{ scope.row['percent'] }}%
|
|
|
|
+ </template>
|
|
|
|
+ </el-tooltip>
|
|
|
|
+ <div class="percent-box" v-if="item.type === 'percentDom' && !props.showTooltip">
|
|
|
|
+ <div class="inner" :style="{ width: scope.row[item.prop] + '%' }"></div>
|
|
|
|
+ </div>
|
|
|
|
+ <div v-if="item.type !== 'percentDom'" class="ellipsis-box">{{ scope.row[item.prop] + (item.prop == 'percent' ? '%' : '') }}</div>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-table>
|
|
@@ -37,7 +48,7 @@ const headerCellStyle = ref({
|
|
|
|
|
|
const props = defineProps({
|
|
const props = defineProps({
|
|
data: {
|
|
data: {
|
|
- type: Array,
|
|
|
|
|
|
+ type: Array as PropType<any[]>,
|
|
default: () => []
|
|
default: () => []
|
|
},
|
|
},
|
|
columns: {
|
|
columns: {
|
|
@@ -51,11 +62,15 @@ const props = defineProps({
|
|
},
|
|
},
|
|
cellStyle: {
|
|
cellStyle: {
|
|
type: Object,
|
|
type: Object,
|
|
- default: () => {}
|
|
|
|
|
|
+ default: () => { }
|
|
},
|
|
},
|
|
headerCellStyle: {
|
|
headerCellStyle: {
|
|
type: Object,
|
|
type: Object,
|
|
- default: () => {}
|
|
|
|
|
|
+ default: () => { }
|
|
|
|
+ },
|
|
|
|
+ showTooltip: {
|
|
|
|
+ type: Boolean,
|
|
|
|
+ default: false
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
|
|
@@ -68,9 +83,9 @@ const state = reactive<BasicTableProps>({
|
|
})
|
|
})
|
|
const { getDataList, currentChangeHandle, sizeChangeHandle, tableStyle } = useTable(state);
|
|
const { getDataList, currentChangeHandle, sizeChangeHandle, tableStyle } = useTable(state);
|
|
const newData = ref(props.data);
|
|
const newData = ref(props.data);
|
|
-watch(props.data, () => {
|
|
|
|
- newData.value = props.data;
|
|
|
|
-});
|
|
|
|
|
|
+watch(() => props.data, (newVal) => {
|
|
|
|
+ newData.value = newVal;
|
|
|
|
+}, { immediate: true, deep: true });
|
|
</script>
|
|
</script>
|
|
<style scoped lang="scss">
|
|
<style scoped lang="scss">
|
|
.percent-box {
|
|
.percent-box {
|
|
@@ -84,6 +99,7 @@ watch(props.data, () => {
|
|
background: rgba(109, 173, 249, 1);
|
|
background: rgba(109, 173, 249, 1);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
.ellipsis-box {
|
|
.ellipsis-box {
|
|
width: 100%;
|
|
width: 100%;
|
|
overflow: hidden;
|
|
overflow: hidden;
|