| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <template>
- <Table :data="classList" :columns="columns" selection-mode="multiple" row-key="classId"
- :selected-rows="selectedClasses" @selection-change="handleSelectionChange"/>
- </template>
- <script setup name="ClassStatisticTable">
- import {useInjectPaperClassStatisticCondition} from "@/views/dz/papers/hooks/usePaperClassStatisticCondition.js";
- import Table from '@/components/Table/index.vue';
- import consts from "@/utils/consts.js";
- const props = defineProps({
- exactMode: Boolean
- })
- const {classList, selectedClasses} = useInjectPaperClassStatisticCondition()
- const ids = ref([]);
- const single = ref(true);
- const multiple = ref(true);
- const columns = props.exactMode ? [
- {label: '班级名称', prop: 'className'},
- {label: '总人数', prop: 'total'},
- ...consts.config.exactColumns
- ] : [
- {label: '班级名称', prop: 'className'},
- {label: '总人数', prop: 'total'},
- ...consts.config.fullColumns
- ]
- function handleSelectionChange(selection) {
- ids.value = selection.map((item) => item.classId);
- single.value = selection.length != 1;
- multiple.value = !selection.length;
- selectedClasses.value = selection
- }
- </script>
- <style scoped>
- </style>
|