lyc-dev #94

Merged
lyc merged 5 commits from lyc-dev into main 2024-08-02 14:51:00 +08:00
4 changed files with 106 additions and 28 deletions
Showing only changes of commit df84893509 - Show all commits

View File

@ -17,3 +17,12 @@ export function listEntpcourse(query) {
params: query params: query
}) })
} }
// 布置作业
export function saveByClassWorkArray(data) {
return request({
url: '/education/classwork/saveByClassWorkArray',
method: 'post',
data: data
})
}

View File

@ -158,6 +158,12 @@ const getSubject = async () => {
curBookId.value = subjectList.value[0].id curBookId.value = subjectList.value[0].id
} }
const isHaveUnit = (id) => {
return evaluationList.value.some(item => {
return item.rootid == id
})
}
const getTreeData = () => { const getTreeData = () => {
// //
let upData = transData(volumeOne.value) let upData = transData(volumeOne.value)

View File

@ -11,26 +11,28 @@
<div> <div>
<el-form :model="form" label-width="80px"> <el-form :model="form" label-width="80px">
<el-form-item label="班级"> <el-form-item label="班级">
<el-tree ref="treeRef" :data="treeData" :props="defaultProps" :load="getLoad" node-key="id" <el-scrollbar max-height="200px" style="width: 100%;">
@check="handleCheckChange" lazy show-checkbox /> <el-tree ref="treeRef" :data="treeData" :props="defaultProps" :load="getLoad" node-key="id"
@check="handleCheckChange" lazy show-checkbox />
</el-scrollbar>
</el-form-item> </el-form-item>
<el-form-item label="选中学生"> <el-form-item label="选中学生">
<el-scrollbar max-height="200px"> <el-scrollbar max-height="200px">
<el-tag v-for="(tag, index) in studentList" :key="tag.studentid" closable type="primary" <el-tag v-for="(tag, index) in studentList" :key="tag.studentid" closable type="primary"
@close="delStudent(index)"> @close="delStudent(index)">
{{ tag.name }} {{ tag.name }}
</el-tag> </el-tag>
</el-scrollbar> </el-scrollbar>
</el-form-item> </el-form-item>
<el-form-item label="完成要求"> <el-form-item label="完成要求">
<el-radio-group v-model="form.feedtype"> <el-radio-group v-model="form.feedback">
<el-radio value="必做" size="large">必做</el-radio> <el-radio value="必做" size="large">必做</el-radio>
<el-radio value="选做" size="large">选做</el-radio> <el-radio value="选做" size="large">选做</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="截时间"> <el-form-item label="截时间">
<el-date-picker v-model="endTime" value-format="YYYY-MM-DD HH:mm:ss" type="datetime" placeholder="请选择截至时间" <el-date-picker v-model="form.deaddate" value-format="YYYY-MM-DD HH:mm" format="YYYY-MM-DD HH:mm"
@change="changeTime" /> time-format="HH:mm" type="datetime" placeholder="请选择截止时间" @change="changeTime" />
</el-form-item> </el-form-item>
<el-form-item label="推荐用时"> <el-form-item label="推荐用时">
<el-input-number v-model="form.timelength" :min="1" :max="500" /> <el-input-number v-model="form.timelength" :min="1" :max="500" />
@ -41,7 +43,7 @@
<template #footer> <template #footer>
<div class="dialog-footer"> <div class="dialog-footer">
<el-button @click="cloneDialog">取消</el-button> <el-button @click="cloneDialog">取消</el-button>
<el-button type="primary" @click="dialogVisible = false"> <el-button type="primary" @click="onSubmit">
确定 确定
</el-button> </el-button>
</div> </div>
@ -50,14 +52,22 @@
</template> </template>
<script> <script>
import { ElMessage } from 'element-plus'
import { listClassmain, listClassgroup } from '@/api/classManage/index' import { listClassmain, listClassgroup } from '@/api/classManage/index'
import { saveByClassWorkArray } from '@/api/teaching/classwork'
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
import { uniqBy, cloneDeep } from 'lodash' import { uniqBy } from 'lodash'
export default { export default {
props: { props: {
modelValue: { modelValue: {
type: Boolean, type: Boolean,
default: false default: false
},
entpcourseid: {
default: ''
},
row: {
default: ''
} }
}, },
data() { data() {
@ -80,19 +90,18 @@ export default {
studentList: [], studentList: [],
// //
form: { form: {
feedtype: '必做', feedback: '必做',
endTime: '', deaddate: '',
timelength: 1 timelength: 1
}, },
endTime: ''
} }
}, },
created() { created() {
// //
this.endTime = this.getCurrentDate() + ' ' + '10:00:00' this.form.deaddate = this.getCurrentDate() + ' ' + '10:00:00'
this.userInfo = useUserStore().user this.userInfo = useUserStore().user
this.getGradeList()
}, },
methods: { methods: {
// //
@ -104,6 +113,9 @@ export default {
item.level = 0 item.level = 0
item.children = [] item.children = []
item.classstudentlist = JSON.parse("[" + item.classstudentlist + "]") item.classstudentlist = JSON.parse("[" + item.classstudentlist + "]")
item.classstudentlist.forEach(el => {
el.classId = item.id
})
}) })
console.log(list) console.log(list)
this.gradeList = list this.gradeList = list
@ -111,21 +123,22 @@ export default {
}) })
}, },
getLoad(node, resolve) { getLoad(node, resolve) {
console.log(node.level)
if (node.level == 0) return resolve([]) if (node.level == 0) return resolve([])
//
if (node.level == 1) { if (node.level == 1) {
listClassgroup({ classid: node.key, orderby: 'orderidx', pageSize: 100 }).then(res => { listClassgroup({ classid: node.key, orderby: 'orderidx', pageSize: 100 }).then(res => {
console.log(res)
if (res.rows.length > 0) { if (res.rows.length > 0) {
let ary = [] let ary = []
res.rows.forEach(item => { res.rows.forEach(item => {
if (item.parentid === 0) { if (item.parentid === 0) {
//studentGroup
let studentGroup = JSON.parse("[" + item.studentlist + "]") let studentGroup = JSON.parse("[" + item.studentlist + "]")
studentGroup.forEach(el => { studentGroup.forEach(el => {
el.label = el.name el.label = el.name
el.leaf = true el.leaf = true
el.level = 2, el.level = 2,
el.id = el.studentid el.id = el.studentid
el.classId = item.classid
}) })
ary.push({ ary.push({
label: item.groupname, label: item.groupname,
@ -135,7 +148,6 @@ export default {
}) })
} }
}) })
// console.log(ary)
resolve(ary) resolve(ary)
} }
else { else {
@ -143,6 +155,7 @@ export default {
} }
}) })
} }
//
if (node.level == 2) { if (node.level == 2) {
resolve(node.data.children) resolve(node.data.children)
} }
@ -170,14 +183,58 @@ export default {
delStudent(index) { delStudent(index) {
this.studentList.splice(index, 1) this.studentList.splice(index, 1)
}, },
//
cloneDialog() {
this.$emit('on-close')
},
// //
changeTime(value) { changeTime(value) {
console.log(value, 100) console.log(value, 100)
}, },
onSubmit() {
/**
* studentlist
* deaddate
* feedtype
* timelength
*/
// AIx web
let ary = [
{
id: 0,
parentid: this.row.id,
classid: this.studentList[0].classId,
classcourseid: 0,
entpcourseid: this.entpcourseid,
studentlist: JSON.stringify(this.studentList),
feedback: this.form.feedback,
workkey: "",
timelength: this.form.timelength,
weights: 1,
deaddate: this.form.deaddate,
workdate: this.getCurrentDate(),
uniquekey: this.row.id,
entpcourseworklist: "[" + this.row.entpcourseworklist + "]",
needMsgNotifine: 'false',
msgkey: 'newclasswork',
title: "作业任务",
msgcontent: '',
teachername: this.userInfo.nickName,
unixstamp: new Date().getTime(),
}
]
let obj = {
classworkarray: JSON.stringify(ary)
}
saveByClassWorkArray(obj).then(() => {
ElMessage.success('操作成功')
this.cloneDialog()
})
},
//
cloneDialog() {
this.$emit('on-close')
},
// //
getCurrentDate() { getCurrentDate() {
const now = new Date(); const now = new Date();
@ -190,6 +247,9 @@ export default {
watch: { watch: {
modelValue(val) { modelValue(val) {
this.dialogVisible = val this.dialogVisible = val
if (val) {
this.getGradeList()
}
} }
} }
} }

View File

@ -58,7 +58,7 @@
</div> </div>
<MoveFile v-model="isMoveDialogOpen" @on-submit="chooseMoveCata" /> <MoveFile v-model="isMoveDialogOpen" @on-submit="chooseMoveCata" />
<uploadDialog v-model="isDialogOpen" @submit-file="submitFile" /> <uploadDialog v-model="isDialogOpen" @submit-file="submitFile" />
<SetHomework v-model="setDialog" @on-close="closeHomework" /> <SetHomework v-model="setDialog" :entpcourseid="entpcourseid" :row="row" @on-close="closeHomework" />
</div> </div>
</template> </template>
<script setup> <script setup>
@ -115,7 +115,8 @@ export default {
entpcourseid: '', entpcourseid: '',
timerId: null, timerId: null,
// //
setDialog: false setDialog: false,
row: ''
} }
}, },
computed: { computed: {
@ -363,12 +364,14 @@ export default {
} }
// //
let ary = uniqBy([...this.currentFileList, ...list], 'id') let ary = uniqBy([...this.currentFileList, ...list], 'id')
console.log(ary,1000)
// //
this.currentFileList = cloneDeep(ary) this.currentFileList = cloneDeep(ary)
}) })
}, },
// //
openSet(){ openSet(row){
this.row = row
this.setDialog = true this.setDialog = true
}, },
closeHomework(){ closeHomework(){