修复已交和待批的bug,完成加时、导出成绩、导出未交名单的功能
This commit is contained in:
parent
793e29afbb
commit
50185cd723
|
|
@ -33,7 +33,9 @@ Node 安装 18 及以上
|
||||||
```shell
|
```shell
|
||||||
# Prod Environment
|
# Prod Environment
|
||||||
pnpm build
|
pnpm build
|
||||||
```
|
4.导出功能的依赖
|
||||||
|
```shell
|
||||||
|
npm install xlsx file-saver
|
||||||
|
|
||||||
|
|
||||||
## 技术栈
|
## 技术栈
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@
|
||||||
"dayjs": "^1.11.10",
|
"dayjs": "^1.11.10",
|
||||||
"docx": "^8.5.0",
|
"docx": "^8.5.0",
|
||||||
"echarts": "^5.4.3",
|
"echarts": "^5.4.3",
|
||||||
|
"file-saver": "^2.0.5",
|
||||||
"lodash-es": "^4.17.21",
|
"lodash-es": "^4.17.21",
|
||||||
"mockjs": "^1.1.0",
|
"mockjs": "^1.1.0",
|
||||||
"pinia": "^2.1.7",
|
"pinia": "^2.1.7",
|
||||||
|
|
@ -5135,6 +5136,12 @@
|
||||||
"node": "^10.12.0 || >=12.0.0"
|
"node": "^10.12.0 || >=12.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/file-saver": {
|
||||||
|
"version": "2.0.5",
|
||||||
|
"resolved": "https://registry.npmmirror.com/file-saver/-/file-saver-2.0.5.tgz",
|
||||||
|
"integrity": "sha512-P9bmyZ3h/PRG+Nzga+rbdI4OEpNDzAVyy74uVO9ATgzLK6VtAsYybF/+TOCvrc0MO793d6+42lLyZTw7/ArVzA==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/filelist": {
|
"node_modules/filelist": {
|
||||||
"version": "1.0.4",
|
"version": "1.0.4",
|
||||||
"resolved": "https://registry.npmmirror.com/filelist/-/filelist-1.0.4.tgz",
|
"resolved": "https://registry.npmmirror.com/filelist/-/filelist-1.0.4.tgz",
|
||||||
|
|
@ -11370,6 +11377,7 @@
|
||||||
"version": "0.18.5",
|
"version": "0.18.5",
|
||||||
"resolved": "https://registry.npmmirror.com/xlsx/-/xlsx-0.18.5.tgz",
|
"resolved": "https://registry.npmmirror.com/xlsx/-/xlsx-0.18.5.tgz",
|
||||||
"integrity": "sha512-dmg3LCjBPHZnQp5/F/+nnTa+miPJxUXB6vtk42YjBBKayDNagxGEeIdWApkYPOf3Z3pm3k62Knjzp7lMeTEtFQ==",
|
"integrity": "sha512-dmg3LCjBPHZnQp5/F/+nnTa+miPJxUXB6vtk42YjBBKayDNagxGEeIdWApkYPOf3Z3pm3k62Knjzp7lMeTEtFQ==",
|
||||||
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"adler-32": "~1.3.0",
|
"adler-32": "~1.3.0",
|
||||||
"cfb": "~1.2.1",
|
"cfb": "~1.2.1",
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@
|
||||||
"dayjs": "^1.11.10",
|
"dayjs": "^1.11.10",
|
||||||
"docx": "^8.5.0",
|
"docx": "^8.5.0",
|
||||||
"echarts": "^5.4.3",
|
"echarts": "^5.4.3",
|
||||||
|
"file-saver": "^2.0.5",
|
||||||
"lodash-es": "^4.17.21",
|
"lodash-es": "^4.17.21",
|
||||||
"mockjs": "^1.1.0",
|
"mockjs": "^1.1.0",
|
||||||
"pinia": "^2.1.7",
|
"pinia": "^2.1.7",
|
||||||
|
|
|
||||||
|
|
@ -90,4 +90,6 @@ export default {
|
||||||
findPostProblem:(data)=>request.post('/problem/findPostProblem',data),
|
findPostProblem:(data)=>request.post('/problem/findPostProblem',data),
|
||||||
updateSetup:(data)=>request.post('/problem/updateSetup',data),
|
updateSetup:(data)=>request.post('/problem/updateSetup',data),
|
||||||
findStudentSubmit:(data)=>request.post('/problem/findStudentSubmit',data),
|
findStudentSubmit:(data)=>request.post('/problem/findStudentSubmit',data),
|
||||||
|
addTime:(data)=>request.post('/problem/addTime',data),
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
const emit =
|
const emit =
|
||||||
defineEmits(['clickDelete','clickReview'])
|
defineEmits(['clickEdit','clickReview'])
|
||||||
const onEdit = ()=>{
|
const onEdit = ()=>{
|
||||||
emit('clickEdit')
|
emit('clickEdit')
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,6 @@ const loading = ref(true)
|
||||||
const ScoringRubricList =
|
const ScoringRubricList =
|
||||||
ref([])
|
ref([])
|
||||||
const role=userStore.getRole()
|
const role=userStore.getRole()
|
||||||
const route = useRoute()
|
|
||||||
const paginationReactive = reactive({
|
const paginationReactive = reactive({
|
||||||
page: 1,
|
page: 1,
|
||||||
pageSize: 50,
|
pageSize: 50,
|
||||||
|
|
|
||||||
|
|
@ -16,17 +16,17 @@
|
||||||
<!-- style="--n-width: 50px;margin-left:15px">-->
|
<!-- style="--n-width: 50px;margin-left:15px">-->
|
||||||
<!-- 加时-->
|
<!-- 加时-->
|
||||||
<!-- </n-button>-->
|
<!-- </n-button>-->
|
||||||
<n-modal
|
<!-- <n-modal-->
|
||||||
v-model:show="showModal"
|
<!-- v-model:show="showModal"-->
|
||||||
:mask-closable="false"
|
<!-- :mask-closable="false"-->
|
||||||
preset="dialog"
|
<!-- preset="dialog"-->
|
||||||
title="删除"
|
<!-- title="删除"-->
|
||||||
content="将删除该学生,确认?"
|
<!-- content="将删除该学生,确认?"-->
|
||||||
positive-text="确认"
|
<!-- positive-text="确认"-->
|
||||||
negative-text="取消"
|
<!-- negative-text="取消"-->
|
||||||
@positive-click="onDelete"
|
<!-- @positive-click="onDelete"-->
|
||||||
@negative-click="closes"
|
<!-- @negative-click="closes"-->
|
||||||
/>
|
<!-- />-->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -43,7 +43,7 @@ const onBack = ()=>{
|
||||||
const onReview = ()=>{
|
const onReview = ()=>{
|
||||||
emit('clickReview')
|
emit('clickReview')
|
||||||
}
|
}
|
||||||
const onAddTime = ()=>{
|
// const onDelete = ()=>{
|
||||||
emit('clickAddTime')
|
// emit('clickDelete')
|
||||||
}
|
// }
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
<!-- 打回-->
|
<!-- 打回-->
|
||||||
<!-- </n-button>-->
|
<!-- </n-button>-->
|
||||||
<n-button type="primary" size="small"
|
<n-button type="primary" size="small"
|
||||||
@click="addTime"
|
@click="onAddTime"
|
||||||
style="--n-width: 50px;margin-left:15px">
|
style="--n-width: 50px;margin-left:15px">
|
||||||
加时
|
加时
|
||||||
</n-button>
|
</n-button>
|
||||||
|
|
@ -37,12 +37,12 @@ const emit =
|
||||||
defineEmits(['clickReview','clickBack','clickAddTime'])
|
defineEmits(['clickReview','clickBack','clickAddTime'])
|
||||||
const showModal=ref(false)
|
const showModal=ref(false)
|
||||||
|
|
||||||
const onBack = ()=>{
|
// const onBack = ()=>{
|
||||||
emit('clickBack')
|
// emit('clickBack')
|
||||||
}
|
// }
|
||||||
const onReview = ()=>{
|
// const onReview = ()=>{
|
||||||
emit('clickReview')
|
// emit('clickReview')
|
||||||
}
|
// }
|
||||||
const onAddTime = ()=>{
|
const onAddTime = ()=>{
|
||||||
emit('clickAddTime')
|
emit('clickAddTime')
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
label-placement="left"style="margin-top: 15px;margin-left: 2%">
|
label-placement="left"style="margin-top: 15px;margin-left: 2%">
|
||||||
<n-form
|
<n-form
|
||||||
ref="problemInfoRef"
|
ref="problemInfoRef"
|
||||||
:model="problemInfoValue"
|
:model="addTimeValue"
|
||||||
:rules="problemAddRules"
|
:rules="problemAddRules"
|
||||||
label-placement="left"
|
label-placement="left"
|
||||||
label-align="right"
|
label-align="right"
|
||||||
|
|
@ -30,7 +30,7 @@
|
||||||
<!-- <n-form-item label="有效时段:"-->
|
<!-- <n-form-item label="有效时段:"-->
|
||||||
<!-- path="timeFrom">-->
|
<!-- path="timeFrom">-->
|
||||||
<!-- <n-date-picker-->
|
<!-- <n-date-picker-->
|
||||||
<!-- v-model:formatted-value="problemInfoValue.timeFrom"-->
|
<!-- v-model:formatted-value="addTimeValue.timeFrom"-->
|
||||||
<!-- style="width: 350px"-->
|
<!-- style="width: 350px"-->
|
||||||
<!-- type="datetime"-->
|
<!-- type="datetime"-->
|
||||||
<!-- input-readonly-->
|
<!-- input-readonly-->
|
||||||
|
|
@ -40,15 +40,14 @@
|
||||||
<!-- :actions="['confirm']"-->
|
<!-- :actions="['confirm']"-->
|
||||||
<!-- />-->
|
<!-- />-->
|
||||||
<!-- </n-form-item>-->
|
<!-- </n-form-item>-->
|
||||||
<n-form-item label="结束时间:"
|
<n-form-item label="加时:">
|
||||||
path="timeTo">
|
|
||||||
<n-date-picker
|
<n-date-picker
|
||||||
v-model:formatted-value="problemInfoValue.timeTo"
|
v-model:formatted-value="addTimeValue.endTime"
|
||||||
style="width: 300px"
|
style="width: 280px"
|
||||||
type="datetime"
|
type="datetime"
|
||||||
input-readonly
|
input-readonly
|
||||||
placeholder="请选择结束时间"
|
placeholder="请选择结束时间"
|
||||||
format="yyyy-MM-dd HH:mm"
|
format="yyyy-MM-dd HH:mm:ss"
|
||||||
update-value-on-close
|
update-value-on-close
|
||||||
:actions="['confirm']"
|
:actions="['confirm']"
|
||||||
/>
|
/>
|
||||||
|
|
@ -58,7 +57,7 @@
|
||||||
<!-- <n-form-item label="允许补交:"-->
|
<!-- <n-form-item label="允许补交:"-->
|
||||||
<!-- path="allow">-->
|
<!-- path="allow">-->
|
||||||
<!-- <n-checkbox-->
|
<!-- <n-checkbox-->
|
||||||
<!-- v-model:checked="problemInfoValue.allow"-->
|
<!-- v-model:checked="addTimeValue.allow"-->
|
||||||
<!-- @update="allow"-->
|
<!-- @update="allow"-->
|
||||||
<!-- ></n-checkbox>-->
|
<!-- ></n-checkbox>-->
|
||||||
<!-- </n-form-item>-->
|
<!-- </n-form-item>-->
|
||||||
|
|
@ -81,52 +80,63 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import {useRouter} from "vue-router";
|
import { useRoute, useRouter } from 'vue-router'
|
||||||
import {ref} from "vue";
|
import {ref} from "vue";
|
||||||
import api from "@/api/admin";
|
import api from "@/api/admin";
|
||||||
import { useTagsStore } from '@/store'
|
import { useTagsStore } from '@/store'
|
||||||
import StandardsList
|
const route = useRoute()
|
||||||
from '@/views/admin/problem/components/StandardList.vue'
|
const { classId,problemId,studentId, history } =
|
||||||
import RichTextEditor
|
route.query
|
||||||
from '@/components/common/RichTextEditor.vue'
|
|
||||||
const tagsStore = useTagsStore()
|
const tagsStore = useTagsStore()
|
||||||
const path=ref('')
|
const path=ref('')
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const rules=ref(null)
|
const rules=ref(null)
|
||||||
const problemInfoValue = ref({
|
|
||||||
name: '',
|
const addTimeValue = ref({
|
||||||
timeFrom: [],
|
title: '',
|
||||||
timeTo: [],
|
startTime: [],
|
||||||
allow:true
|
endTime: [],
|
||||||
});
|
allow:false
|
||||||
|
})
|
||||||
|
const loading = ref(true)
|
||||||
const problemInfoRef = ref(null)
|
const problemInfoRef = ref(null)
|
||||||
const descEditorHeight = ref('160px')
|
|
||||||
const problemName = ref('作业标题')
|
|
||||||
const cancel = ()=>{
|
const cancel = ()=>{
|
||||||
tagsStore.removeTag(path.value)
|
tagsStore.removeTag(path.value)
|
||||||
router.push({path: 'problem-list'})
|
|
||||||
}
|
}
|
||||||
const onAdd = ()=>{
|
const onAdd = ()=>{
|
||||||
router.push({name: 'AdminProblemPostClass'})
|
router.push({name: 'AdminProblemPostClass'})
|
||||||
}
|
}
|
||||||
|
const queryByPage = async () => {
|
||||||
|
loading.value = true
|
||||||
|
try {
|
||||||
|
const res = await api.findPostProblem({
|
||||||
|
problemId:problemId,
|
||||||
|
classId:classId
|
||||||
|
})
|
||||||
|
addTimeValue.value=res.data
|
||||||
|
console.log(addTimeValue.value)
|
||||||
|
} catch (err) {
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
const submit =async ()=>{
|
const submit =async ()=>{
|
||||||
if(problemInfoValue.value.name!==''){
|
|
||||||
try {
|
try {
|
||||||
await api.Addproblem({
|
await api.addTime({
|
||||||
...problemInfoValue.value
|
...addTimeValue.value,
|
||||||
|
problemId:problemId,
|
||||||
|
studentId:studentId
|
||||||
})
|
})
|
||||||
$message.success("添加课程成功")
|
$message.success("加时成功")
|
||||||
tagsStore.removeTag(path.value)
|
tagsStore.removeTag(path.value)
|
||||||
await router.push({name: 'AdminProblemList'})
|
// await router.push({name: 'AdminProblemList'})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
tagsStore.removeTag(path.value)
|
tagsStore.removeTag(path.value)
|
||||||
await router.push({name: 'AdminProblemList'})
|
// await router.push({name: 'AdminProblemList'})
|
||||||
}
|
}
|
||||||
}else {
|
|
||||||
$message.error("作业名称不能为空")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
onMounted(()=>{
|
onMounted(()=>{
|
||||||
path.value=router.currentRoute.value.fullPath
|
path.value=router.currentRoute.value.fullPath
|
||||||
|
queryByPage()
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -130,23 +130,6 @@ const updateSetup =async ()=>{
|
||||||
const onAdd = ()=>{
|
const onAdd = ()=>{
|
||||||
router.push({name: 'AdminProblemPostClass'})
|
router.push({name: 'AdminProblemPostClass'})
|
||||||
}
|
}
|
||||||
const submit =async ()=>{
|
|
||||||
if(problemInfoValue.value.name!==''){
|
|
||||||
try {
|
|
||||||
await api.Addproblem({
|
|
||||||
...problemInfoValue.value
|
|
||||||
})
|
|
||||||
$message.success("添加课程成功")
|
|
||||||
tagsStore.removeTag(path.value)
|
|
||||||
await router.push({name: 'AdminProblemList'})
|
|
||||||
} catch (err) {
|
|
||||||
tagsStore.removeTag(path.value)
|
|
||||||
await router.push({name: 'AdminProblemList'})
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
$message.error("作业名称不能为空")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const queryByPage = async () => {
|
const queryByPage = async () => {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,6 @@ const options1=ref([])
|
||||||
const role=userStore.getRole()
|
const role=userStore.getRole()
|
||||||
const teacherId=ref()
|
const teacherId=ref()
|
||||||
const selectedStatus=ref("")
|
const selectedStatus=ref("")
|
||||||
const today = new Date();
|
|
||||||
const filteredData =ref([]);
|
const filteredData =ref([]);
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const { courseId, history } = route.query
|
const { courseId, history } = route.query
|
||||||
|
|
@ -329,9 +328,16 @@ const onChangePage = (page) => {
|
||||||
onMounted(()=>{
|
onMounted(()=>{
|
||||||
queryByPage(paginationReactive.page)
|
queryByPage(paginationReactive.page)
|
||||||
})
|
})
|
||||||
// watch(route, () => {
|
watch(
|
||||||
// filterData()
|
()=>router.currentRoute.value.fullPath,
|
||||||
// })
|
()=>{
|
||||||
|
if
|
||||||
|
(router.currentRoute.value.fullPath==='/admin/problem/problem-list') {
|
||||||
|
queryByPage(paginationReactive.page)
|
||||||
|
search(paginationReactive.page)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,8 @@
|
||||||
style='justify-content: flex-end'>
|
style='justify-content: flex-end'>
|
||||||
<n-form-item
|
<n-form-item
|
||||||
v-if="selectedStatus==='weijiao'" style='margin-left: 10px;margin-right: 20px'>
|
v-if="selectedStatus==='weijiao'" style='margin-left: 10px;margin-right: 20px'>
|
||||||
<n-button type="primary" style="margin-right: 10px" @click="exportUnsubmitted">导出未交名单</n-button>
|
<n-button type="primary"
|
||||||
|
style="margin-right: 10px" @click="exportWeijiaoTable">导出未交名单</n-button>
|
||||||
|
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
<n-form-item v-else style='margin-left: 10px;margin-right: 20px'>
|
<n-form-item v-else style='margin-left: 10px;margin-right: 20px'>
|
||||||
|
|
@ -77,6 +78,7 @@
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
:pagination="paginationReactive"
|
:pagination="paginationReactive"
|
||||||
:row-key="rowKey"
|
:row-key="rowKey"
|
||||||
|
:rows="tableData"
|
||||||
:scroll-x="900"
|
:scroll-x="900"
|
||||||
@update:page="onChangePage"
|
@update:page="onChangePage"
|
||||||
@update:page-size="onUpdatePageSize"
|
@update:page-size="onUpdatePageSize"
|
||||||
|
|
@ -87,6 +89,8 @@
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import {onMounted, reactive, ref, watch} from "vue";
|
import {onMounted, reactive, ref, watch} from "vue";
|
||||||
|
import { saveAs } from 'file-saver';
|
||||||
|
import * as XLSX from 'xlsx';
|
||||||
import {useRoute, useRouter} from 'vue-router'
|
import {useRoute, useRouter} from 'vue-router'
|
||||||
import api from "@/api/admin";
|
import api from "@/api/admin";
|
||||||
import ProblemStudentAction
|
import ProblemStudentAction
|
||||||
|
|
@ -110,7 +114,6 @@ const submitList =
|
||||||
ref([])
|
ref([])
|
||||||
const studentList =
|
const studentList =
|
||||||
reactive([])
|
reactive([])
|
||||||
const filteredStudentList=ref(studentList)
|
|
||||||
const { classId,problemId, history } = route.query
|
const { classId,problemId, history } = route.query
|
||||||
const paginationReactive = reactive({
|
const paginationReactive = reactive({
|
||||||
page: 1,
|
page: 1,
|
||||||
|
|
@ -134,19 +137,19 @@ const updateColumns=()=>{
|
||||||
{
|
{
|
||||||
key: 'chineseName',
|
key: 'chineseName',
|
||||||
title: '姓名',
|
title: '姓名',
|
||||||
width: '50',
|
width: '80',
|
||||||
align:'center',
|
align:'center',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'readTime',
|
key: 'readTime',
|
||||||
title: '领取时间',
|
title: '领取时间',
|
||||||
width: '100',
|
width: '300',
|
||||||
align:'center'
|
align:'center'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'submissionStatus',
|
key: 'submissionStatus',
|
||||||
title: '状态',
|
title: '状态',
|
||||||
width: '300',
|
width: '100',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'actions',
|
key: 'actions',
|
||||||
|
|
@ -157,7 +160,7 @@ const updateColumns=()=>{
|
||||||
ProblemStudentAction2,
|
ProblemStudentAction2,
|
||||||
{
|
{
|
||||||
onClickAddTime: () =>
|
onClickAddTime: () =>
|
||||||
addTime(row)
|
onAddTime(row)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -216,7 +219,7 @@ const updateColumns=()=>{
|
||||||
}
|
}
|
||||||
// 根据 selectedStatus 过滤数据
|
// 根据 selectedStatus 过滤数据
|
||||||
const studentInfoValue = ref({
|
const studentInfoValue = ref({
|
||||||
studentId:'',
|
id:0,
|
||||||
studentNo:'',
|
studentNo:'',
|
||||||
chineseName:'',
|
chineseName:'',
|
||||||
readTime:[],
|
readTime:[],
|
||||||
|
|
@ -274,10 +277,11 @@ const onEditClass = async (classId)=>{
|
||||||
const id=1
|
const id=1
|
||||||
await router.push({name: 'StudentEdits', params: {clId: id}, query: {id: clId}})
|
await router.push({name: 'StudentEdits', params: {clId: id}, query: {id: clId}})
|
||||||
}
|
}
|
||||||
const addTime=async ()=>{
|
const onAddTime=async (studentId)=>{
|
||||||
// const {id} = classId
|
const {id} = studentId
|
||||||
const id=1
|
await router.push({name:
|
||||||
await router.push({name: 'AdminProblemAddTime', params: {clId: id}, query: {id: clId}})
|
'AdminProblemAddTime', query: {classId:
|
||||||
|
classId,problemId:problemId,studentId:id}})
|
||||||
}
|
}
|
||||||
const onReview=async ()=>{
|
const onReview=async ()=>{
|
||||||
// const {id} = classId
|
// const {id} = classId
|
||||||
|
|
@ -318,6 +322,63 @@ const onUpdatePageSize = (pageSize) => {
|
||||||
paginationReactive.page = 1;
|
paginationReactive.page = 1;
|
||||||
queryByPage(1)
|
queryByPage(1)
|
||||||
}
|
}
|
||||||
|
const tableRef = ref(null);
|
||||||
|
|
||||||
|
const exportScores = () => {
|
||||||
|
// 1. 获取表格数据
|
||||||
|
const data = filteredData.value;
|
||||||
|
|
||||||
|
// 2. 定义表头
|
||||||
|
const headers = columns.value.map(column => column.title);
|
||||||
|
|
||||||
|
// 3. 转换为二维数组
|
||||||
|
const worksheetData = [headers];
|
||||||
|
data.forEach(row => {
|
||||||
|
const rowData = columns.value.map(column => row[column.key]);
|
||||||
|
worksheetData.push(rowData);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 4. 生成 Excel 文件
|
||||||
|
const worksheet = XLSX.utils.aoa_to_sheet(worksheetData);
|
||||||
|
const workbook = XLSX.utils.book_new();
|
||||||
|
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
|
||||||
|
|
||||||
|
// 5. 导出文件
|
||||||
|
const excelBuffer = XLSX.write(workbook, {
|
||||||
|
bookType: 'xlsx',
|
||||||
|
type: 'array'
|
||||||
|
});
|
||||||
|
const blob = new Blob([excelBuffer], { type: 'application/octet-stream' });
|
||||||
|
saveAs(blob, '导出成绩.xlsx');
|
||||||
|
};
|
||||||
|
// 导出 Excel 函数
|
||||||
|
const exportWeijiaoTable = () => {
|
||||||
|
// 1. 获取表格数据
|
||||||
|
const data = filteredData.value;
|
||||||
|
|
||||||
|
// 2. 定义表头
|
||||||
|
const headers = columns.value.map(column => column.title);
|
||||||
|
|
||||||
|
// 3. 转换为二维数组
|
||||||
|
const worksheetData = [headers];
|
||||||
|
data.forEach(row => {
|
||||||
|
const rowData = columns.value.map(column => row[column.key]);
|
||||||
|
worksheetData.push(rowData);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 4. 生成 Excel 文件
|
||||||
|
const worksheet = XLSX.utils.aoa_to_sheet(worksheetData);
|
||||||
|
const workbook = XLSX.utils.book_new();
|
||||||
|
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
|
||||||
|
|
||||||
|
// 5. 导出文件
|
||||||
|
const excelBuffer = XLSX.write(workbook, {
|
||||||
|
bookType: 'xlsx',
|
||||||
|
type: 'array'
|
||||||
|
});
|
||||||
|
const blob = new Blob([excelBuffer], { type: 'application/octet-stream' });
|
||||||
|
saveAs(blob, '导出未交名单.xlsx');
|
||||||
|
};
|
||||||
const rowKey = (rowData) => {
|
const rowKey = (rowData) => {
|
||||||
return rowData.id
|
return rowData.id
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -161,6 +161,17 @@ public class ProblemController {
|
||||||
problemServiceI.findProblemByCourseIdAndClassId(pmProblem);
|
problemServiceI.findProblemByCourseIdAndClassId(pmProblem);
|
||||||
return RespBean.ok("查询作业列表成功",dataGrid);
|
return RespBean.ok("查询作业列表成功",dataGrid);
|
||||||
|
|
||||||
|
}
|
||||||
|
@PostMapping(
|
||||||
|
"/addTime")
|
||||||
|
public RespBean addTime(@RequestBody PMPostProblem pmPostProblem){
|
||||||
|
int num =
|
||||||
|
problemServiceI.editSubmitReport(pmPostProblem.getEndTime(),pmPostProblem.getProblemId(),pmPostProblem.getStudentId());
|
||||||
|
if(num == 1)
|
||||||
|
return RespBean.ok("加时成功");
|
||||||
|
else
|
||||||
|
return RespBean.error("加时失败");
|
||||||
|
|
||||||
}
|
}
|
||||||
@PostMapping("/findProblemById")
|
@PostMapping("/findProblemById")
|
||||||
public RespBean findProblemById(@RequestBody PMProblem pmProblem){
|
public RespBean findProblemById(@RequestBody PMProblem pmProblem){
|
||||||
|
|
@ -205,9 +216,9 @@ public class ProblemController {
|
||||||
int num =
|
int num =
|
||||||
problemServiceI.editPostProblem(pmPostProblem.getClassId(),pmPostProblem.getProblemId(),pmPostProblem.getStartTime(),pmPostProblem.getEndTime(),pmPostProblem.getAllow());
|
problemServiceI.editPostProblem(pmPostProblem.getClassId(),pmPostProblem.getProblemId(),pmPostProblem.getStartTime(),pmPostProblem.getEndTime(),pmPostProblem.getAllow());
|
||||||
if(num == 1)
|
if(num == 1)
|
||||||
return RespBean.ok("修改课程名称成功");
|
return RespBean.ok("修改作业设置成功");
|
||||||
else
|
else
|
||||||
return RespBean.error("修改课程名称失败");
|
return RespBean.error("修改作业设置失败");
|
||||||
}
|
}
|
||||||
//获取作业列表
|
//获取作业列表
|
||||||
@GetMapping("/getExamList")
|
@GetMapping("/getExamList")
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,12 @@ import com.example.aes.problem.model.PMStudentSubmit;
|
||||||
import com.example.aes.problem.model.SubmitReport;
|
import com.example.aes.problem.model.SubmitReport;
|
||||||
import com.example.aes.user.dao.BaseDaoI;
|
import com.example.aes.user.dao.BaseDaoI;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface SubmitReportDaoI extends BaseDaoI<SubmitReport> {
|
public interface SubmitReportDaoI extends BaseDaoI<SubmitReport> {
|
||||||
public List<Object[]> findWeijiaoList(PMStudentSubmit pmStudentSubmit);
|
public List<Object[]> findWeijiaoList(PMStudentSubmit pmStudentSubmit);
|
||||||
public List<Object[]> findYijiaoList(PMStudentSubmit pmStudentSubmit);
|
public List<Object[]> findYijiaoList(PMStudentSubmit pmStudentSubmit);
|
||||||
|
public int updateAddTime(LocalDateTime addTime,int problemId,int studentId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -336,8 +336,12 @@ public class ProblemDaoImpl extends BaseDaoImpl<Problem> implements ProblemDaoI{
|
||||||
// "COUNT(CASE WHEN sr.submissionTime IS NULL THEN 1 END) AS weijiao " +
|
// "COUNT(CASE WHEN sr.submissionTime IS NULL THEN 1 END) AS weijiao " +
|
||||||
"FROM Problem p " +
|
"FROM Problem p " +
|
||||||
"INNER JOIN PostProblem pp ON p.id = pp.problemId " +
|
"INNER JOIN PostProblem pp ON p.id = pp.problemId " +
|
||||||
"LEFT JOIN SubmitReport sr ON " +
|
"left join Classstudents cs" +
|
||||||
"p.id = sr.problemId " +
|
" " +
|
||||||
|
"on pp.classId=cs.classId " +
|
||||||
|
"LEFT JOIN SubmitReport sr " +
|
||||||
|
"ON cs" +
|
||||||
|
".userId = sr.studentId " +
|
||||||
"WHERE pp.classId =:classId "+
|
"WHERE pp.classId =:classId "+
|
||||||
"AND p.courseId =:courseId "+
|
"AND p.courseId =:courseId "+
|
||||||
"AND NOW() < pp.startTime " +
|
"AND NOW() < pp.startTime " +
|
||||||
|
|
@ -351,37 +355,47 @@ public class ProblemDaoImpl extends BaseDaoImpl<Problem> implements ProblemDaoI{
|
||||||
// "COUNT(CASE WHEN sr.submissionTime IS NULL THEN 1 END) AS weijiao " +
|
// "COUNT(CASE WHEN sr.submissionTime IS NULL THEN 1 END) AS weijiao " +
|
||||||
"FROM Problem p " +
|
"FROM Problem p " +
|
||||||
"INNER JOIN PostProblem pp ON p.id = pp.problemId " +
|
"INNER JOIN PostProblem pp ON p.id = pp.problemId " +
|
||||||
"LEFT JOIN SubmitReport sr ON " +
|
"left join Classstudents cs" +
|
||||||
"p.id = sr.problemId " +
|
" " +
|
||||||
|
"on pp.classId=cs.classId " +
|
||||||
|
"LEFT JOIN SubmitReport sr " +
|
||||||
|
"ON cs" +
|
||||||
|
".userId = sr.studentId " +
|
||||||
"WHERE pp.classId =:classId "+
|
"WHERE pp.classId =:classId "+
|
||||||
"AND p.courseId =:courseId "+
|
"AND p.courseId =:courseId "+
|
||||||
"AND NOW() >= pp.startTime " +
|
" and NOW() BETWEEN pp" +
|
||||||
"and NOW()<=pp.endTime " +
|
".startTime AND pp.endTime " +
|
||||||
"GROUP BY p.id, p.title, pp" +
|
"GROUP BY p.id, p.title, pp" +
|
||||||
".startTime, pp.endTime";
|
".startTime, pp.endTime";
|
||||||
}else if(selectedStatus.equals("completed")){
|
}else if(selectedStatus.equals("completed")){
|
||||||
|
hql = "SELECT p.id as id, p.title as title, pp.startTime as startTime, pp.endTime as endTime, " +
|
||||||
|
"COUNT(CASE WHEN sr.score IS NULL AND sr.autoscore IS NOT NULL THEN 1 END) AS daipi, " +
|
||||||
|
"COUNT(CASE WHEN sr.submissionTime IS NOT NULL THEN 1 END) AS yijiao " +
|
||||||
|
// "COUNT(CASE WHEN sr.submissionTime IS NULL THEN 1 END) AS weijiao " +
|
||||||
|
"FROM Problem p " +
|
||||||
|
"INNER JOIN PostProblem pp ON p.id = pp.problemId " +
|
||||||
|
"left join Classstudents cs" +
|
||||||
|
" " +
|
||||||
|
"on pp.classId=cs.classId " +
|
||||||
|
"LEFT JOIN SubmitReport sr " +
|
||||||
|
"ON cs" +
|
||||||
|
".userId = sr.studentId " +
|
||||||
|
"WHERE pp.classId =:classId "+
|
||||||
|
"AND p.courseId = :courseId " +
|
||||||
|
"AND NOW() > pp.endTime " + // 确保 endTime 是 pp 的字段
|
||||||
|
"GROUP BY p.id, p.title, pp.startTime, pp.endTime";
|
||||||
|
}else{
|
||||||
hql = "SELECT p.id as id, p.title as title, pp.startTime as startTime, pp.endTime as endTime, " +
|
hql = "SELECT p.id as id, p.title as title, pp.startTime as startTime, pp.endTime as endTime, " +
|
||||||
"COUNT(CASE WHEN sr.score IS NULL AND sr.autoscore IS NOT NULL THEN 1 END) AS daipi, " +
|
"COUNT(CASE WHEN sr.score IS NULL AND sr.autoscore IS NOT NULL THEN 1 END) AS daipi, " +
|
||||||
"COUNT(CASE WHEN sr.submissionTime IS NOT NULL THEN 1 END) AS yijiao " +
|
"COUNT(CASE WHEN sr.submissionTime IS NOT NULL THEN 1 END) AS yijiao " +
|
||||||
// "COUNT(CASE WHEN sr.submissionTime IS NULL THEN 1 END) AS weijiao " +
|
|
||||||
"FROM Problem p " +
|
"FROM Problem p " +
|
||||||
"INNER JOIN PostProblem pp ON p.id = pp.problemId " +
|
"INNER JOIN PostProblem pp ON p.id = pp.problemId " +
|
||||||
"LEFT JOIN SubmitReport sr ON " +
|
"left join Classstudents cs" +
|
||||||
"p.id = sr.problemId " +
|
" " +
|
||||||
"WHERE pp.classId =:classId "+
|
"on pp.classId=cs.classId " +
|
||||||
"AND p.courseId =:courseId "+
|
"LEFT JOIN SubmitReport sr " +
|
||||||
"AND NOW() > endTime " +
|
"ON cs" +
|
||||||
"GROUP BY p.id, p.title, pp" +
|
".userId = sr.studentId " +
|
||||||
".startTime, pp.endTime";
|
|
||||||
}else{
|
|
||||||
hql = "SELECT p.id as id, p.title as title, pp.startTime as startTime, pp.endTime as endTime," +
|
|
||||||
"COUNT(CASE WHEN sr.score IS NULL AND sr.autoscore IS NOT NULL THEN 1 END) AS daipi," +
|
|
||||||
"COUNT(CASE WHEN sr" +
|
|
||||||
".submissionTime IS NOT NULL THEN 1 END) AS yijiao " +
|
|
||||||
"FROM Problem p " +
|
|
||||||
"INNER JOIN PostProblem pp ON p.id = pp.problemId " +
|
|
||||||
"LEFT JOIN SubmitReport sr ON " +
|
|
||||||
"p.id = sr.problemId " +
|
|
||||||
"WHERE pp.classId =:classId "+
|
"WHERE pp.classId =:classId "+
|
||||||
"AND p.courseId =:courseId "+
|
"AND p.courseId =:courseId "+
|
||||||
"GROUP BY p.id, p.title, pp" +
|
"GROUP BY p.id, p.title, pp" +
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import com.example.aes.user.dao.impl.BaseDaoImpl;
|
||||||
import org.hibernate.Query;
|
import org.hibernate.Query;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Repository("SubmitReportDao")
|
@Repository("SubmitReportDao")
|
||||||
|
|
@ -22,7 +23,7 @@ String chineseName=
|
||||||
String hql="SELECT u.chineseName," +
|
String hql="SELECT u.chineseName," +
|
||||||
"u.studentNo, sr" +
|
"u.studentNo, sr" +
|
||||||
".readTime," +
|
".readTime," +
|
||||||
"sr.submissionStatus " +
|
"sr.submissionStatus,u.id " +
|
||||||
"FROM Classstudents cs left " +
|
"FROM Classstudents cs left " +
|
||||||
"join Users u on cs" +
|
"join Users u on cs" +
|
||||||
".userId=u.id "+
|
".userId=u.id "+
|
||||||
|
|
@ -36,6 +37,7 @@ String chineseName=
|
||||||
"and " +
|
"and " +
|
||||||
"pp.problemId " +
|
"pp.problemId " +
|
||||||
"=:problemId" +
|
"=:problemId" +
|
||||||
|
" and sr.problemId=:problemId" +
|
||||||
" and sr" +
|
" and sr" +
|
||||||
".submissionTime is null and " +
|
".submissionTime is null and " +
|
||||||
"u.studentNo like :studentNo " +
|
"u.studentNo like :studentNo " +
|
||||||
|
|
@ -57,6 +59,20 @@ String chineseName=
|
||||||
return query.getResultList();
|
return query.getResultList();
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
public int updateAddTime(LocalDateTime addTime,int problemId,int studentId){
|
||||||
|
String hql= "UPDATE SubmitReport sr SET" +
|
||||||
|
" sr.addTime= :addTime "
|
||||||
|
+ "WHERE sr.problemId = " +
|
||||||
|
":problemId" +
|
||||||
|
" AND sr.studentId= :studentId";
|
||||||
|
Query q = this.getCurrentSession().createQuery(hql);
|
||||||
|
q.setParameter("addTime",addTime);
|
||||||
|
q.setParameter("problemId",problemId);
|
||||||
|
q.setParameter("studentId",studentId);
|
||||||
|
int num = q.executeUpdate();
|
||||||
|
return num;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
public List<Object[]> findYijiaoList(PMStudentSubmit pmStudentSubmit){
|
public List<Object[]> findYijiaoList(PMStudentSubmit pmStudentSubmit){
|
||||||
int classId= pmStudentSubmit.getClassId();
|
int classId= pmStudentSubmit.getClassId();
|
||||||
int problemId= pmStudentSubmit.getProblemId();
|
int problemId= pmStudentSubmit.getProblemId();
|
||||||
|
|
@ -70,7 +86,7 @@ String chineseName=
|
||||||
"sr.submissionStatus," +
|
"sr.submissionStatus," +
|
||||||
" COALESCE(sr.score," +
|
" COALESCE(sr.score," +
|
||||||
" sr.autoscore) " +
|
" sr.autoscore) " +
|
||||||
"AS finalScore " +
|
"AS finalScore ,u.id " +
|
||||||
"FROM Classstudents cs left " +
|
"FROM Classstudents cs left " +
|
||||||
"join Users u on cs" +
|
"join Users u on cs" +
|
||||||
".userId=u.id "+
|
".userId=u.id "+
|
||||||
|
|
@ -84,6 +100,7 @@ String chineseName=
|
||||||
"and " +
|
"and " +
|
||||||
"pp.problemId " +
|
"pp.problemId " +
|
||||||
"=:problemId" +
|
"=:problemId" +
|
||||||
|
" and sr.problemId=:problemId" +
|
||||||
" and sr" +
|
" and sr" +
|
||||||
".submissionTime is not null " +
|
".submissionTime is not null " +
|
||||||
"and " +
|
"and " +
|
||||||
|
|
|
||||||
|
|
@ -19,4 +19,5 @@ public class PMPostProblem{
|
||||||
private LocalDateTime endTime;
|
private LocalDateTime endTime;
|
||||||
private List<Integer> classList;
|
private List<Integer> classList;
|
||||||
private Boolean allow;
|
private Boolean allow;
|
||||||
|
private int studentId;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import java.time.LocalDateTime;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class PMStudentSubmit {
|
public class PMStudentSubmit {
|
||||||
|
private int id;
|
||||||
private String chineseName;
|
private String chineseName;
|
||||||
private String studentNo;
|
private String studentNo;
|
||||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
|
|
||||||
|
|
@ -316,18 +316,22 @@ public class ProblemServiceImpl implements ProblemServiceI {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
public int editSubmitReport(LocalDateTime addTime,int problemId,int studentId){
|
||||||
|
return studentSubmitDao.updateAddTime(addTime,problemId,studentId);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
public DataGrid findProblemByCourseIdAndClassId(PMProblem pmProblem){
|
public DataGrid findProblemByCourseIdAndClassId(PMProblem pmProblem){
|
||||||
DataGrid dg = new DataGrid();
|
DataGrid dg = new DataGrid();
|
||||||
int totalLines;
|
|
||||||
List<Object[]> theProblemList;
|
List<Object[]> theProblemList;
|
||||||
totalLines= (int) postProblemDao.getPostProblemNum(pmProblem.getCourseId(),pmProblem.getClassId());
|
// totalLines= (int) postProblemDao.getPostProblemNum(pmProblem.getCourseId(),pmProblem.getClassId());
|
||||||
int page= pmProblem.getPageNum();
|
int page= pmProblem.getPageNum();
|
||||||
|
|
||||||
int studentNum=
|
int studentNum=
|
||||||
classesDao.findClassById(pmProblem.getClassId()).get(0).getStudentNum();
|
classesDao.findClassById(pmProblem.getClassId()).get(0).getStudentNum();
|
||||||
theProblemList=
|
theProblemList=
|
||||||
problemDao.getProblemsByPage(pmProblem.getCourseId(),pmProblem.getClassId(),pmProblem.getSelectedStatus(),pmProblem.getPageNum(), pmProblem.getPageSize());
|
problemDao.getProblemsByPage(pmProblem.getCourseId(),pmProblem.getClassId(),pmProblem.getSelectedStatus(),pmProblem.getPageNum(), pmProblem.getPageSize());
|
||||||
// totalLines=theProblemList.size();
|
int totalLines=theProblemList.size();
|
||||||
if ((page-1)*pmProblem.getPageSize()>=totalLines){
|
if ((page-1)*pmProblem.getPageSize()>=totalLines){
|
||||||
pmProblem.setPageNum(1);
|
pmProblem.setPageNum(1);
|
||||||
}
|
}
|
||||||
|
|
@ -520,7 +524,8 @@ public class ProblemServiceImpl implements ProblemServiceI {
|
||||||
pmStudentSubmit.setStudentNo((String) p[1]);
|
pmStudentSubmit.setStudentNo((String) p[1]);
|
||||||
pmStudentSubmit.setReadTime((LocalDateTime) p[2]);
|
pmStudentSubmit.setReadTime((LocalDateTime) p[2]);
|
||||||
pmStudentSubmit.setSubmissionStatus((String) p[3]);
|
pmStudentSubmit.setSubmissionStatus((String) p[3]);
|
||||||
pmStudentSubmitList.add(pmStudentSubmit);
|
pmStudentSubmit.setId((int) p[4]);
|
||||||
|
pmStudentSubmitList.add(pmStudentSubmit);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -536,6 +541,7 @@ public class ProblemServiceImpl implements ProblemServiceI {
|
||||||
pmStudentSubmit.setSubmitTime((LocalDateTime) p[2]);
|
pmStudentSubmit.setSubmitTime((LocalDateTime) p[2]);
|
||||||
pmStudentSubmit.setSubmissionStatus((String) p[3]);
|
pmStudentSubmit.setSubmissionStatus((String) p[3]);
|
||||||
pmStudentSubmit.setFinalScore((float) p[4]);
|
pmStudentSubmit.setFinalScore((float) p[4]);
|
||||||
|
pmStudentSubmit.setId((int) p[5]);
|
||||||
pmStudentSubmitList.add(pmStudentSubmit);
|
pmStudentSubmitList.add(pmStudentSubmit);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -49,4 +49,5 @@ public interface ProblemServiceI {
|
||||||
LocalDateTime startTime,LocalDateTime endTime,boolean allow);
|
LocalDateTime startTime,LocalDateTime endTime,boolean allow);
|
||||||
public DataGrid findWeijiaoList(PMStudentSubmit pmStudentSubmit);
|
public DataGrid findWeijiaoList(PMStudentSubmit pmStudentSubmit);
|
||||||
public DataGrid findYijiaoList(PMStudentSubmit pmStudentSubmit);
|
public DataGrid findYijiaoList(PMStudentSubmit pmStudentSubmit);
|
||||||
|
public int editSubmitReport(LocalDateTime addTime,int problemId,int studentId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue