lyc-dev #94
|
@ -17,3 +17,12 @@ export function listEntpcourse(query) {
|
|||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 布置作业
|
||||
export function saveByClassWorkArray(data) {
|
||||
return request({
|
||||
url: '/education/classwork/saveByClassWorkArray',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
|
@ -158,6 +158,12 @@ const getSubject = async () => {
|
|||
curBookId.value = subjectList.value[0].id
|
||||
}
|
||||
|
||||
const isHaveUnit = (id) => {
|
||||
return evaluationList.value.some(item => {
|
||||
return item.rootid == id
|
||||
})
|
||||
}
|
||||
|
||||
const getTreeData = () => {
|
||||
//数据过滤
|
||||
let upData = transData(volumeOne.value)
|
||||
|
|
|
@ -11,8 +11,10 @@
|
|||
<div>
|
||||
<el-form :model="form" label-width="80px">
|
||||
<el-form-item label="班级">
|
||||
<el-scrollbar max-height="200px" style="width: 100%;">
|
||||
<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 label="选中学生">
|
||||
<el-scrollbar max-height="200px">
|
||||
|
@ -23,14 +25,14 @@
|
|||
</el-scrollbar>
|
||||
</el-form-item>
|
||||
<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-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="截至时间">
|
||||
<el-date-picker v-model="endTime" value-format="YYYY-MM-DD HH:mm:ss" type="datetime" placeholder="请选择截至时间"
|
||||
@change="changeTime" />
|
||||
<el-form-item label="截止时间">
|
||||
<el-date-picker v-model="form.deaddate" value-format="YYYY-MM-DD HH:mm" format="YYYY-MM-DD HH:mm"
|
||||
time-format="HH:mm" type="datetime" placeholder="请选择截止时间" @change="changeTime" />
|
||||
</el-form-item>
|
||||
<el-form-item label="推荐用时">
|
||||
<el-input-number v-model="form.timelength" :min="1" :max="500" />
|
||||
|
@ -41,7 +43,7 @@
|
|||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="cloneDialog">取消</el-button>
|
||||
<el-button type="primary" @click="dialogVisible = false">
|
||||
<el-button type="primary" @click="onSubmit">
|
||||
确定
|
||||
</el-button>
|
||||
</div>
|
||||
|
@ -50,14 +52,22 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { listClassmain, listClassgroup } from '@/api/classManage/index'
|
||||
import { saveByClassWorkArray } from '@/api/teaching/classwork'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import { uniqBy, cloneDeep } from 'lodash'
|
||||
import { uniqBy } from 'lodash'
|
||||
export default {
|
||||
props: {
|
||||
modelValue: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
entpcourseid: {
|
||||
default: ''
|
||||
},
|
||||
row: {
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
|
@ -80,19 +90,18 @@ export default {
|
|||
studentList: [],
|
||||
// 表单
|
||||
form: {
|
||||
feedtype: '必做',
|
||||
endTime: '',
|
||||
feedback: '必做',
|
||||
deaddate: '',
|
||||
timelength: 1
|
||||
},
|
||||
endTime: ''
|
||||
|
||||
}
|
||||
},
|
||||
created() {
|
||||
//截至时间默认值
|
||||
this.endTime = this.getCurrentDate() + ' ' + '10:00:00'
|
||||
this.form.deaddate = this.getCurrentDate() + ' ' + '10:00:00'
|
||||
this.userInfo = useUserStore().user
|
||||
this.getGradeList()
|
||||
|
||||
},
|
||||
methods: {
|
||||
// 获取班级列表
|
||||
|
@ -104,6 +113,9 @@ export default {
|
|||
item.level = 0
|
||||
item.children = []
|
||||
item.classstudentlist = JSON.parse("[" + item.classstudentlist + "]")
|
||||
item.classstudentlist.forEach(el => {
|
||||
el.classId = item.id
|
||||
})
|
||||
})
|
||||
console.log(list)
|
||||
this.gradeList = list
|
||||
|
@ -111,21 +123,22 @@ export default {
|
|||
})
|
||||
},
|
||||
getLoad(node, resolve) {
|
||||
console.log(node.level)
|
||||
if (node.level == 0) return resolve([])
|
||||
// 获取二级节点 小组
|
||||
if (node.level == 1) {
|
||||
listClassgroup({ classid: node.key, orderby: 'orderidx', pageSize: 100 }).then(res => {
|
||||
console.log(res)
|
||||
if (res.rows.length > 0) {
|
||||
let ary = []
|
||||
res.rows.forEach(item => {
|
||||
if (item.parentid === 0) {
|
||||
//studentGroup 小组学生
|
||||
let studentGroup = JSON.parse("[" + item.studentlist + "]")
|
||||
studentGroup.forEach(el => {
|
||||
el.label = el.name
|
||||
el.leaf = true
|
||||
el.level = 2,
|
||||
el.id = el.studentid
|
||||
el.classId = item.classid
|
||||
})
|
||||
ary.push({
|
||||
label: item.groupname,
|
||||
|
@ -135,7 +148,6 @@ export default {
|
|||
})
|
||||
}
|
||||
})
|
||||
// console.log(ary)
|
||||
resolve(ary)
|
||||
}
|
||||
else {
|
||||
|
@ -143,6 +155,7 @@ export default {
|
|||
}
|
||||
})
|
||||
}
|
||||
// 三级节点 小组学生
|
||||
if (node.level == 2) {
|
||||
resolve(node.data.children)
|
||||
}
|
||||
|
@ -170,14 +183,58 @@ export default {
|
|||
delStudent(index) {
|
||||
this.studentList.splice(index, 1)
|
||||
},
|
||||
// 关闭弹窗
|
||||
cloneDialog() {
|
||||
this.$emit('on-close')
|
||||
},
|
||||
|
||||
//
|
||||
changeTime(value) {
|
||||
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() {
|
||||
const now = new Date();
|
||||
|
@ -190,6 +247,9 @@ export default {
|
|||
watch: {
|
||||
modelValue(val) {
|
||||
this.dialogVisible = val
|
||||
if (val) {
|
||||
this.getGradeList()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
</div>
|
||||
<MoveFile v-model="isMoveDialogOpen" @on-submit="chooseMoveCata" />
|
||||
<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>
|
||||
</template>
|
||||
<script setup>
|
||||
|
@ -115,7 +115,8 @@ export default {
|
|||
entpcourseid: '',
|
||||
timerId: null,
|
||||
// 布置作业弹窗
|
||||
setDialog: false
|
||||
setDialog: false,
|
||||
row: ''
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
@ -363,12 +364,14 @@ export default {
|
|||
}
|
||||
// 去重
|
||||
let ary = uniqBy([...this.currentFileList, ...list], 'id')
|
||||
console.log(ary,1000)
|
||||
// 深度克隆
|
||||
this.currentFileList = cloneDeep(ary)
|
||||
})
|
||||
},
|
||||
// 打开布置作业窗口
|
||||
openSet(){
|
||||
openSet(row){
|
||||
this.row = row
|
||||
this.setDialog = true
|
||||
},
|
||||
closeHomework(){
|
||||
|
|
Loading…
Reference in New Issue