|
|
@ -1,6 +1,7 @@ |
|
|
|
<template> |
|
|
|
<template> |
|
|
|
<div class="my-table"> |
|
|
|
<div class="my-table"> |
|
|
|
<el-table :size="state.size.size" :data="page ? data.data : data" @selection-change="selectionChange" |
|
|
|
<el-table ref="table" :size="state.size.size" :data="page ? data.data : data" |
|
|
|
|
|
|
|
@selection-change="selectionChange" |
|
|
|
:height="height || (page ? state.size.pTableHeight : state.size.tableHeight)" highlight-current-row |
|
|
|
:height="height || (page ? state.size.pTableHeight : state.size.tableHeight)" highlight-current-row |
|
|
|
:row-key="rowKey" :tree-porps="treeProps"> |
|
|
|
:row-key="rowKey" :tree-porps="treeProps"> |
|
|
|
|
|
|
|
|
|
|
@ -31,11 +32,12 @@ |
|
|
|
|
|
|
|
|
|
|
|
<script lang="ts" setup> |
|
|
|
<script lang="ts" setup> |
|
|
|
import { useStore } from "vuex"; |
|
|
|
import { useStore } from "vuex"; |
|
|
|
import { reactive, onMounted, ref } from "vue"; |
|
|
|
import { reactive, onMounted, ref, watch, onUpdated } from "vue"; |
|
|
|
import { useI18n } from "vue3-i18n"; |
|
|
|
import { useI18n } from "vue3-i18n"; |
|
|
|
// import { PageExample } from "noob-mengyxu"; |
|
|
|
// import { PageExample } from "noob-mengyxu"; |
|
|
|
const { t } = useI18n(); |
|
|
|
const { t } = useI18n(); |
|
|
|
const { state } = useStore(); |
|
|
|
const { state } = useStore(); |
|
|
|
|
|
|
|
const table = ref(); |
|
|
|
|
|
|
|
|
|
|
|
const prop = defineProps({ |
|
|
|
const prop = defineProps({ |
|
|
|
data: { |
|
|
|
data: { |
|
|
@ -62,6 +64,10 @@ const prop = defineProps({ |
|
|
|
type: String, |
|
|
|
type: String, |
|
|
|
default: null, |
|
|
|
default: null, |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
selectKey: { |
|
|
|
|
|
|
|
type: String, |
|
|
|
|
|
|
|
default: null, |
|
|
|
|
|
|
|
}, |
|
|
|
treeProps: { |
|
|
|
treeProps: { |
|
|
|
type: Object, |
|
|
|
type: Object, |
|
|
|
default: null, |
|
|
|
default: null, |
|
|
@ -143,7 +149,21 @@ const formatterByDist = (dictKey, value) => { |
|
|
|
} |
|
|
|
} |
|
|
|
return mapping[value] == null ? value : mapping[value]; |
|
|
|
return mapping[value] == null ? value : mapping[value]; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const select = (n) => { |
|
|
|
|
|
|
|
if (n.selectKey && table.value) { |
|
|
|
|
|
|
|
n.data.forEach(e => { |
|
|
|
|
|
|
|
table.value.toggleRowSelection(e, e[n.selectKey]); |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
watch(prop, select); |
|
|
|
|
|
|
|
|
|
|
|
onMounted(() => { }); |
|
|
|
onMounted(() => { }); |
|
|
|
|
|
|
|
onUpdated(() => { |
|
|
|
|
|
|
|
select(prop) |
|
|
|
|
|
|
|
}) |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
<style lang="scss" scoped> |
|
|
|
<style lang="scss" scoped> |
|
|
|
.my-table * { |
|
|
|
.my-table * { |
|
|
|