|
@@ -0,0 +1,83 @@
|
|
|
+<template>
|
|
|
+ <div class="choose-markers">
|
|
|
+ <el-button type="primary" :disabled="!subjectCode || !mainNumber" @click="modalVisible = true"
|
|
|
+ >选择评卷员{{ confirmResult?.length ? `(已选${confirmResult.length}人)` : '' }}</el-button
|
|
|
+ >
|
|
|
+ <base-dialog v-model="modalVisible" title="选择评卷员" :width="600" class="marker-dialog">
|
|
|
+ <vxe-table
|
|
|
+ :max-height="tableMaxHeight"
|
|
|
+ :column-config="{ resizable: true }"
|
|
|
+ :tree-config="{ childrenField: 'markers', rowField: 'id', expandAll: true }"
|
|
|
+ :data="tableData"
|
|
|
+ :checkbox-config="{ highlight: false }"
|
|
|
+ :scroll-y="{ enabled: true }"
|
|
|
+ @checkbox-change="selectChangeEvent"
|
|
|
+ >
|
|
|
+ <vxe-column type="checkbox" title="ID" width="280" tree-node></vxe-column>
|
|
|
+ <vxe-column field="showName" title="姓名"></vxe-column>
|
|
|
+ </vxe-table>
|
|
|
+ <template #footer>
|
|
|
+ <div class="flex justify-end">
|
|
|
+ <confirm-button
|
|
|
+ :disabled="!chooseResult.length"
|
|
|
+ @confirm="confirm"
|
|
|
+ @cancel="modalVisible = false"
|
|
|
+ ></confirm-button>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </base-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script name="ChooseMarkers" lang="ts" setup>
|
|
|
+import { watch, ref, computed } from 'vue'
|
|
|
+import useFetch from '@/hooks/useFetch'
|
|
|
+import { ElButton } from 'element-plus'
|
|
|
+import BaseDialog from '../element/BaseDialog.vue'
|
|
|
+import { VxeTableEvents } from 'vxe-table'
|
|
|
+import ConfirmButton from '@/components/common/ConfirmButton.vue'
|
|
|
+import { cloneDeep } from 'lodash-es'
|
|
|
+
|
|
|
+const emits = defineEmits(['user-list'])
|
|
|
+const tableMaxHeight = window.innerHeight - 150 + 'px'
|
|
|
+const modalVisible = ref(false)
|
|
|
+const { fetch: fetchMarkers, result } = useFetch('adminGetMarkers')
|
|
|
+const tableData = computed(() => {
|
|
|
+ return (result.value || []).map((item: any) => {
|
|
|
+ item.showName = `第${item.markingGroupNumber}组`
|
|
|
+ !item.id && (item.id = '_' + item.markingGroupNumber)
|
|
|
+ item.markers = (item.markers || []).map((v: any) => {
|
|
|
+ v.showName = v.loginName + '-' + v.name
|
|
|
+ return v
|
|
|
+ })
|
|
|
+ return item
|
|
|
+ })
|
|
|
+})
|
|
|
+const props = defineProps<{
|
|
|
+ subjectCode: string | number | undefined
|
|
|
+ mainNumber: string | number | undefined
|
|
|
+}>()
|
|
|
+watch([() => props.subjectCode, () => props.mainNumber], (valArr) => {
|
|
|
+ if (valArr[0] && valArr[1]) {
|
|
|
+ fetchMarkers({ subjectCode: valArr[0], mainNumber: valArr[1] })
|
|
|
+ }
|
|
|
+})
|
|
|
+const chooseResult = ref<any>([])
|
|
|
+const confirmResult = ref<any>([])
|
|
|
+const selectChangeEvent: VxeTableEvents.CheckboxChange<any> = ({ $table }) => {
|
|
|
+ const records = $table.getCheckboxRecords()
|
|
|
+ console.info(`勾选${records.length}个树形节点`, records)
|
|
|
+ chooseResult.value = records.filter((item) => !!item.loginName)
|
|
|
+}
|
|
|
+const confirm = () => {
|
|
|
+ confirmResult.value = cloneDeep(chooseResult.value)
|
|
|
+ emits('user-list', [...confirmResult.value])
|
|
|
+ modalVisible.value = false
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.choose-markers {
|
|
|
+ max-height: 100vh;
|
|
|
+}
|
|
|
+</style>
|