Merge pull request 'lyc-dev' (#94) from lyc-dev into main
This commit is contained in:
commit
1be862a0f2
|
@ -17,3 +17,20 @@ export function listEntpcourse(query) {
|
||||||
params: query
|
params: query
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 布置作业
|
||||||
|
export function saveByClassWorkArray(data) {
|
||||||
|
return request({
|
||||||
|
url: '/education/classwork/saveByClassWorkArray',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除classwork 作业
|
||||||
|
export function delClasswork(id) {
|
||||||
|
return request({
|
||||||
|
url: '/education/classwork/' + id,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
|
@ -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)
|
||||||
|
|
|
@ -87,7 +87,7 @@
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="item-popover-item">
|
<div class="item-popover-item">
|
||||||
<el-button text @click="deleteTalk(item)">
|
<el-button text @click="deleteHomework(item)">
|
||||||
<i class="iconfont icon-shanchu"></i>
|
<i class="iconfont icon-shanchu"></i>
|
||||||
<span>删除</span>
|
<span>删除</span>
|
||||||
</el-button>
|
</el-button>
|
||||||
|
@ -159,7 +159,7 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
emits: { 'on-move': null, 'on-delete': null, 'on-set': null },
|
emits: { 'on-move': null, 'on-delete': null, 'on-set': null, 'on-delhomework': null },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
listenList: []
|
listenList: []
|
||||||
|
@ -248,6 +248,10 @@ export default {
|
||||||
//布置
|
//布置
|
||||||
setHomeWork(item) {
|
setHomeWork(item) {
|
||||||
this.$emit('on-set', item)
|
this.$emit('on-set', item)
|
||||||
|
},
|
||||||
|
// 删除作业
|
||||||
|
deleteHomework(item){
|
||||||
|
this.$emit('on-delhomework', item)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<el-dialog v-model="dialogVisible" center top="10vh" width="600px" :show-close="false"
|
<el-dialog v-model="dialogVisible" center top="10vh" width="600px" :show-close="false" append-to-body
|
||||||
style="border-radius: 10px; padding: 10px 15px;">
|
style="border-radius: 10px; padding: 10px 15px;">
|
||||||
|
|
||||||
<template #header>
|
<template #header>
|
||||||
<div class="homerwork-header flex">
|
<div class="homerwork-header flex">
|
||||||
<span>布置作业</span>
|
<span>布置作业</span>
|
||||||
|
@ -9,12 +8,14 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<div>
|
<div>
|
||||||
<el-form :model="form" label-width="80px">
|
<el-form :model="form" label-width="80px" ref="ruleForm" :rules="rules">
|
||||||
<el-form-item label="班级">
|
<el-form-item label="班级" prop="grade">
|
||||||
<el-tree ref="treeRef" :data="treeData" :props="defaultProps" :load="getLoad" node-key="id"
|
<el-scrollbar max-height="200px" style="width: 100%;">
|
||||||
|
<el-tree ref="treeRef" :data="gradeList" :props="defaultProps" :load="getLoad" node-key="id"
|
||||||
@check="handleCheckChange" lazy show-checkbox />
|
@check="handleCheckChange" lazy show-checkbox />
|
||||||
|
</el-scrollbar>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="选中学生">
|
<el-form-item label="选中学生" prop="student">
|
||||||
<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)">
|
||||||
|
@ -22,17 +23,17 @@
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="完成要求">
|
<el-form-item label="完成要求" prop="feedback">
|
||||||
<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="截止时间" prop="deaddate">
|
||||||
<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="请选择截止时间" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="推荐用时">
|
<el-form-item label="推荐用时" prop="timelength">
|
||||||
<el-input-number v-model="form.timelength" :min="1" :max="500" />
|
<el-input-number v-model="form.timelength" :min="1" :max="500" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
@ -41,7 +42,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('ruleForm')">
|
||||||
确定
|
确定
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -50,17 +51,27 @@
|
||||||
</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, groupBy } from 'lodash'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
modelValue: {
|
modelValue: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
|
},
|
||||||
|
entpcourseid: {
|
||||||
|
default: ''
|
||||||
|
},
|
||||||
|
row: {
|
||||||
|
default: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
defaultProps: {
|
defaultProps: {
|
||||||
|
@ -80,21 +91,30 @@ export default {
|
||||||
studentList: [],
|
studentList: [],
|
||||||
// 表单
|
// 表单
|
||||||
form: {
|
form: {
|
||||||
feedtype: '必做',
|
feedback: '必做',
|
||||||
endTime: '',
|
deaddate: '',
|
||||||
timelength: 1
|
timelength: 1
|
||||||
},
|
},
|
||||||
endTime: ''
|
// 表单规则
|
||||||
|
rules: {
|
||||||
|
grade: [
|
||||||
|
{ validator: this.validateGrade, trigger: 'blur' }
|
||||||
|
],
|
||||||
|
student: [
|
||||||
|
{ validator: this.validateStudent, trigger: 'blur' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
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: {
|
||||||
|
|
||||||
// 获取班级列表
|
// 获取班级列表
|
||||||
getGradeList() {
|
getGradeList() {
|
||||||
listClassmain({ classuserid: this.userInfo.userId, pageSize: 100, status: 'open' }).then(res => {
|
listClassmain({ classuserid: this.userInfo.userId, pageSize: 100, status: 'open' }).then(res => {
|
||||||
|
@ -104,28 +124,31 @@ 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)
|
|
||||||
this.gradeList = list
|
this.gradeList = list
|
||||||
this.treeData = list
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
// 获取节点下一级
|
||||||
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 +158,6 @@ export default {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// console.log(ary)
|
|
||||||
resolve(ary)
|
resolve(ary)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -143,23 +165,28 @@ export default {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
// 三级节点 小组学生
|
||||||
if (node.level == 2) {
|
if (node.level == 2) {
|
||||||
resolve(node.data.children)
|
resolve(node.data.children)
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
//节点勾选后触发 拿学生
|
||||||
handleCheckChange(data, checked) {
|
handleCheckChange(data, checked) {
|
||||||
this.studentList = []
|
this.studentList = []
|
||||||
// 选中节点集合
|
// 选中节点集合
|
||||||
let checkNodes = checked.checkedNodes
|
let checkNodes = checked.checkedNodes
|
||||||
let ary = []
|
let ary = []
|
||||||
checkNodes.forEach(item => {
|
checkNodes.forEach(item => {
|
||||||
|
// 一级节点 班级
|
||||||
if (item.level == 0) {
|
if (item.level == 0) {
|
||||||
ary = [...ary, ...(item.classstudentlist)]
|
ary = [...ary, ...(item.classstudentlist)]
|
||||||
}
|
}
|
||||||
|
// 二级节点 班级下面的小组
|
||||||
if (item.level == 1) {
|
if (item.level == 1) {
|
||||||
ary = [...ary, ...(item.children)]
|
ary = [...ary, ...(item.children)]
|
||||||
}
|
}
|
||||||
|
// 三级节点 小组下面的学生
|
||||||
if (item.level == 2) {
|
if (item.level == 2) {
|
||||||
ary = [...ary, item]
|
ary = [...ary, item]
|
||||||
}
|
}
|
||||||
|
@ -170,13 +197,59 @@ export default {
|
||||||
delStudent(index) {
|
delStudent(index) {
|
||||||
this.studentList.splice(index, 1)
|
this.studentList.splice(index, 1)
|
||||||
},
|
},
|
||||||
|
onSubmit(formName) {
|
||||||
|
|
||||||
|
this.$refs[formName].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
/**
|
||||||
|
* 分班
|
||||||
|
* studentList 为选中的所有学生 这些学生可能来自不同班级
|
||||||
|
*/
|
||||||
|
let gradeObj = groupBy(this.studentList, 'classId')
|
||||||
|
// 处理要提交的参数
|
||||||
|
let ary = []
|
||||||
|
for (const value in gradeObj) {
|
||||||
|
//这些参数 参照AIx web端 作业推送
|
||||||
|
let obj = {
|
||||||
|
id: 0,
|
||||||
|
parentid: this.row.id,
|
||||||
|
classid: value,
|
||||||
|
classcourseid: 0,
|
||||||
|
entpcourseid: this.entpcourseid,
|
||||||
|
studentlist: JSON.stringify(gradeObj[value]),
|
||||||
|
feedback: this.form.feedback,
|
||||||
|
workkey: "",
|
||||||
|
timelength: this.form.timelength,
|
||||||
|
weights: 1,
|
||||||
|
deaddate: this.form.deaddate,
|
||||||
|
workdate: this.getCurrentDate(),
|
||||||
|
uniquekey: this.row.uniquekey,
|
||||||
|
entpcourseworklist: "[" + this.row.entpcourseworklist + "]",
|
||||||
|
needMsgNotifine: 'false',
|
||||||
|
msgkey: 'newclasswork',
|
||||||
|
title: "作业任务",
|
||||||
|
msgcontent: '',
|
||||||
|
teachername: this.userInfo.nickName,
|
||||||
|
unixstamp: new Date().getTime(),
|
||||||
|
}
|
||||||
|
ary.push(obj)
|
||||||
|
}
|
||||||
|
saveByClassWorkArray({
|
||||||
|
classworkarray: JSON.stringify(ary)
|
||||||
|
}).then(() => {
|
||||||
|
ElMessage.success('操作成功')
|
||||||
|
this.cloneDialog()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
// 关闭弹窗
|
// 关闭弹窗
|
||||||
cloneDialog() {
|
cloneDialog() {
|
||||||
this.$emit('on-close')
|
this.$emit('on-close')
|
||||||
},
|
this.studentList = []
|
||||||
//
|
this.$refs['ruleForm'].resetFields();
|
||||||
changeTime(value) {
|
|
||||||
console.log(value, 100)
|
|
||||||
},
|
},
|
||||||
// 获取当前年月日
|
// 获取当前年月日
|
||||||
getCurrentDate() {
|
getCurrentDate() {
|
||||||
|
@ -185,13 +258,33 @@ export default {
|
||||||
const month = now.getMonth() + 1; // 月份是从0开始的,所以需要+1
|
const month = now.getMonth() + 1; // 月份是从0开始的,所以需要+1
|
||||||
const day = now.getDate()
|
const day = now.getDate()
|
||||||
return `${year}-${month.length == 2 ? month : '0' + month}-${day.length == 2 ? day : '0' + day}`;
|
return `${year}-${month.length == 2 ? month : '0' + month}-${day.length == 2 ? day : '0' + day}`;
|
||||||
|
},
|
||||||
|
validateGrade(rule, value, callback) {
|
||||||
|
if (this.studentList.length == 0) {
|
||||||
|
callback(new Error('请勾选班级或者学生'));
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
callback()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
validateStudent(rule, value, callback) {
|
||||||
|
if (this.studentList.length == 0) {
|
||||||
|
callback(new Error('学生不能为空'));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
callback()
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
modelValue(val) {
|
modelValue(val) {
|
||||||
this.dialogVisible = val
|
this.dialogVisible = val
|
||||||
|
if (val) {
|
||||||
|
this.getGradeList()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -65,8 +65,9 @@
|
||||||
@on-move="onMoveSingleFile"
|
@on-move="onMoveSingleFile"
|
||||||
@on-delete="deleteTalk"
|
@on-delete="deleteTalk"
|
||||||
@on-set="openSet"
|
@on-set="openSet"
|
||||||
|
@on-delhomework="delhomework"
|
||||||
>
|
>
|
||||||
<el-checkbox label="" :value="item" />
|
<el-checkbox label="" :value="item" v-if="!item.uniquekey"/>
|
||||||
</file-list-item>
|
</file-list-item>
|
||||||
</el-checkbox-group>
|
</el-checkbox-group>
|
||||||
<file-oper-batch
|
<file-oper-batch
|
||||||
|
@ -82,7 +83,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>
|
||||||
|
@ -106,6 +107,7 @@ import SetHomework from './container/set-homework.vue'
|
||||||
import outLink from '@/utils/linkConfig'
|
import outLink from '@/utils/linkConfig'
|
||||||
import { createWindow } from '@/utils/tool'
|
import { createWindow } from '@/utils/tool'
|
||||||
import { uniqBy, cloneDeep } from 'lodash'
|
import { uniqBy, cloneDeep } from 'lodash'
|
||||||
|
import { delClasswork } from '@/api/teaching/classwork'
|
||||||
|
|
||||||
const { ipcRenderer } = window.electron || {}
|
const { ipcRenderer } = window.electron || {}
|
||||||
|
|
||||||
|
@ -147,7 +149,8 @@ export default {
|
||||||
entpcourseid: '',
|
entpcourseid: '',
|
||||||
timerId: null,
|
timerId: null,
|
||||||
// 布置作业弹窗
|
// 布置作业弹窗
|
||||||
setDialog: false
|
setDialog: false,
|
||||||
|
row: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -309,9 +312,10 @@ export default {
|
||||||
this.uploadData.textbookId = data.textBook.curBookId
|
this.uploadData.textbookId = data.textBook.curBookId
|
||||||
await this.asyncAllFile()
|
await this.asyncAllFile()
|
||||||
if (this.uploadData.levelSecondId) {
|
if (this.uploadData.levelSecondId) {
|
||||||
// 获取作业列表所需ID
|
// 获取作业列表所需ID 可能存在没有
|
||||||
const res = await this.getChapterId()
|
const { rows } = await this.getChapterId()
|
||||||
this.entpcourseid = res.rows[0].id
|
if(!rows.length) return
|
||||||
|
this.entpcourseid = rows[0].id
|
||||||
// 查询作业
|
// 查询作业
|
||||||
this.getHomeWorkList()
|
this.getHomeWorkList()
|
||||||
}
|
}
|
||||||
|
@ -339,7 +343,7 @@ export default {
|
||||||
pageSize: 500
|
pageSize: 500
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
//
|
// 清除查询作业列表定时器
|
||||||
createTimer() {
|
createTimer() {
|
||||||
this.timerId = setInterval(() => {
|
this.timerId = setInterval(() => {
|
||||||
this.getHomeWorkList()
|
this.getHomeWorkList()
|
||||||
|
@ -412,9 +416,22 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 打开布置作业窗口
|
// 打开布置作业窗口
|
||||||
openSet() {
|
openSet(row) {
|
||||||
|
this.row = row
|
||||||
this.setDialog = true
|
this.setDialog = true
|
||||||
},
|
},
|
||||||
|
// 删除作业
|
||||||
|
delhomework(item){
|
||||||
|
this.isLoading = true
|
||||||
|
delClasswork(item.id).then( async res =>{
|
||||||
|
ElMessage.success('操作成功')
|
||||||
|
this.isLoading = false
|
||||||
|
await this.asyncAllFile()
|
||||||
|
this.getHomeWorkList()
|
||||||
|
}).catch(()=>{
|
||||||
|
this.isLoading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
closeHomework() {
|
closeHomework() {
|
||||||
this.setDialog = false
|
this.setDialog = false
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue