作业布置:新增推送、批量推送
This commit is contained in:
parent
68388b9c86
commit
f0313653e6
|
@ -100,6 +100,17 @@ export const getCurrentTime = (format)=> {
|
||||||
if(format == 'MMDD'){
|
if(format == 'MMDD'){
|
||||||
return `${month}${day}`;
|
return `${month}${day}`;
|
||||||
}
|
}
|
||||||
|
if(format == 'HH'){
|
||||||
|
return `${hours}`;
|
||||||
|
}
|
||||||
|
if(format == 'HH+3'){
|
||||||
|
//往后延时3个小时
|
||||||
|
const hours = (now.getHours()+3).toString().padStart(2, '0');
|
||||||
|
return `${hours}`
|
||||||
|
}
|
||||||
|
if(format == 'mm'){
|
||||||
|
return `${minutes}`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
@ -92,7 +92,7 @@
|
||||||
<el-table-column v-if="props.initDataProps.queryType!=='single'" label="推送配置" align="left" min-width="16%">
|
<el-table-column v-if="props.initDataProps.queryType!=='single'" label="推送配置" align="left" min-width="16%">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<div style="display: flex">
|
<div style="display: flex">
|
||||||
<el-button link icon="Setting" @click="scope.row.status == '10' ? openClassWorkConfigDialog(scope.row, -1,'item') : ''" :style="formatStyle(scope.row)" v-hasPermi="['teaching:classwork:edit']">{{scope.row.status == '10'? '推送' : '已推送'}}</el-button>
|
<el-button v-hasPermi="['teaching:classwork:edit']" link icon="Setting" :style="formatStyle(scope.row)" @click="scope.row.status == '10' ? openClassWorkConfigDialog(scope.row, -1,'item') : ''">{{scope.row.status == '10'? '推送' : '已推送'}}</el-button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
@ -149,21 +149,106 @@
|
||||||
@click="submitWorkTitle('submit')">确 定</el-button>
|
@click="submitWorkTitle('submit')">确 定</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 推送作业的配置对话框 -->
|
||||||
|
<el-dialog v-model="workConfDialogOpen" title="作业布置推送配置" width="60%" append-to-body>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="24">
|
||||||
|
<!-- <div style="display: flex; justify-content: space-between; padding-bottom: 8px; border-bottom: 1px solid silver">
|
||||||
|
<div style="padding-left: 30px">作业布置配置详细参数</div>
|
||||||
|
</div> -->
|
||||||
|
<el-form ref="classWorkConfigFormRef" :model="classWorkConfigForm" label-width="100px" style="margin-top: 30px">
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="班级" prop="grade">
|
||||||
|
<el-scrollbar max-height="300px" style="width: 100%">
|
||||||
|
<el-tree
|
||||||
|
ref="treeRef" :props="defaultProps" :load="getLoad" node-key="id" highlight-current show-checkbox
|
||||||
|
lazy @check="handleCheckChange" />
|
||||||
|
</el-scrollbar>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="选中学生">
|
||||||
|
<div style="max-height: 150px; overflow: auto">
|
||||||
|
<template v-for="(item, index) in classWorkConfigForm.studentlist" :key="item" >
|
||||||
|
<el-tag :label="item.studentid" size="large" closable style="margin: 3px" @close="handleClassDialogClassStudentRemove(item, index)">{{ item.name }}</el-tag>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="完成要求">
|
||||||
|
<el-radio-group v-model="classWorkConfigForm.feedtype">
|
||||||
|
<el-radio label="必做">必做</el-radio>
|
||||||
|
<el-radio label="选做">选做</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="截止日期">
|
||||||
|
<el-date-picker v-model="classWorkConfigForm.deaddate" type="date" placeholder="选择日期"></el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="16">
|
||||||
|
<el-form-item label="截止时间">
|
||||||
|
<el-input-number v-model="classWorkConfigForm.deadhour" :min="8" :max="22"></el-input-number> 点
|
||||||
|
<el-input-number v-model="classWorkConfigForm.deadmin" :min="0" :max="60" :step="15" style="margin-left: 10px"></el-input-number> 分
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="推荐用时">
|
||||||
|
<el-input-number v-model="classWorkConfigForm.timelength" :min="1"></el-input-number>分钟
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="分值" v-show="false">
|
||||||
|
<el-input-number v-model="classWorkConfigForm.weights" :min="1"></el-input-number>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<div slot="footer" class="dialog-footer" style="text-align: right">
|
||||||
|
<el-button @click="handleWorkConfigUpdate('cancel')">取消</el-button>
|
||||||
|
<!-- <el-button type="primary" @click="handleTaskAssignToAllClassType()" :loading="classWorkToStudent_Loading">{{classWorkToStudent_Loading?'推送中……':'推送'}}</el-button> -->
|
||||||
|
<el-button type="primary" @click="handleTaskAssignToAllClassType()" >{{'推送'}}</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, ref, toRaw,watch, reactive, getCurrentInstance } from 'vue'
|
import { onMounted, ref,watch, reactive, getCurrentInstance,nextTick } from 'vue'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
|
|
||||||
import ChooseTextbook from '@/components/choose-textbook/index.vue'
|
import ChooseTextbook from '@/components/choose-textbook/index.vue'
|
||||||
import { homeworklist, delClasswork } from '@/api/teaching/classwork'
|
import { homeworklist, delClasswork } from '@/api/teaching/classwork'
|
||||||
import { listEntpcoursework, listClassworkeval,updateClasswork,getEvaluationclue } from '@/api/classTask'
|
import { listEntpcoursework, listClassworkeval,updateClasswork,getEvaluationclue } from '@/api/classTask'
|
||||||
|
import { listClassmain, listClassgroup } from '@/api/classManage/index'
|
||||||
|
import { saveByClassWorkArray } from '@/api/teaching/classwork'
|
||||||
|
|
||||||
import { useGetHomework } from '@/hooks/useGetHomework'
|
import { useGetHomework } from '@/hooks/useGetHomework'
|
||||||
import { processList } from '@/hooks/useProcessList'
|
import { processList } from '@/hooks/useProcessList'
|
||||||
|
import { uniqBy, groupBy } from 'lodash'
|
||||||
import { getCurrentTime } from '@/utils/date'
|
import { getCurrentTime } from '@/utils/date'
|
||||||
import useUserStore from '@/store/modules/user'
|
import useUserStore from '@/store/modules/user'
|
||||||
const userStore = useUserStore().user
|
const userStore = useUserStore().user
|
||||||
|
@ -210,6 +295,22 @@ const workConfObj = reactive({
|
||||||
quizlist: [], // 习题list
|
quizlist: [], // 习题list
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 推送相关
|
||||||
|
const defaultProps = ref({
|
||||||
|
children: 'children',
|
||||||
|
label: 'label',
|
||||||
|
isLeaf: 'leaf'
|
||||||
|
});
|
||||||
|
const gradeList = ref([]);// 学生节点
|
||||||
|
const workConfDialogOpen = ref(false);// 推送配置弹窗
|
||||||
|
const classWorkConfigForm = reactive({
|
||||||
|
formRowsType: '',//
|
||||||
|
formRowsList: null,
|
||||||
|
//
|
||||||
|
feedtype: '必做',
|
||||||
|
studentlist: [], //需要推送的学生list
|
||||||
|
}); // 推送作业配置
|
||||||
|
|
||||||
|
|
||||||
// ---------------------------------------------------
|
// ---------------------------------------------------
|
||||||
|
|
||||||
|
@ -579,6 +680,367 @@ const isJson = (str) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取班级
|
||||||
|
const getGradeList = async() => {
|
||||||
|
let { rows } = await listClassmain({
|
||||||
|
classuserid: userStore.userId,
|
||||||
|
pageSize: 100,
|
||||||
|
status: 'open'
|
||||||
|
})
|
||||||
|
rows.forEach((item) => {
|
||||||
|
item.label = item.caption
|
||||||
|
item.level = 0
|
||||||
|
item.leaf = false
|
||||||
|
item.children = []
|
||||||
|
item.classstudentlist = JSON.parse('[' + item.classstudentlist + ']')
|
||||||
|
item.classstudentlist.forEach((el) => {
|
||||||
|
el.classid = item.id
|
||||||
|
})
|
||||||
|
})
|
||||||
|
return rows
|
||||||
|
};
|
||||||
|
// 获取节点下一级
|
||||||
|
const getLoad = async (node, resolve) =>{
|
||||||
|
// 获取一级节点 班级
|
||||||
|
if (node.level == 0) {
|
||||||
|
gradeList.value = await getGradeList()
|
||||||
|
resolve(gradeList.value)
|
||||||
|
}
|
||||||
|
// 获取二级节点 小组
|
||||||
|
if (node.level == 1) {
|
||||||
|
listClassgroup({ classid: node.key, orderby: 'orderidx', pageSize: 100 }).then((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,
|
||||||
|
leaf: false,
|
||||||
|
...item,
|
||||||
|
level: 1,
|
||||||
|
// children 小组学生 三级节点 这样就不用再从接口拿
|
||||||
|
children: studentGroup
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
resolve(ary)
|
||||||
|
} else {
|
||||||
|
// 班级下面没有小组 直接取学生
|
||||||
|
let students = node.data.classstudentlist
|
||||||
|
students.forEach((item) => {
|
||||||
|
item.label = item.name
|
||||||
|
item.level = 2
|
||||||
|
item.leaf = true
|
||||||
|
})
|
||||||
|
resolve(students)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 三级节点 小组学生
|
||||||
|
if (node.level == 2) {
|
||||||
|
resolve(node.data.children)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//节点勾选后触发 拿学生
|
||||||
|
const handleCheckChange = (data, checked) => {
|
||||||
|
classWorkConfigForm.studentlist = [];
|
||||||
|
// 选中节点集合
|
||||||
|
let checkNodes = checked.checkedNodes
|
||||||
|
let ary = []
|
||||||
|
checkNodes.forEach((item) => {
|
||||||
|
// 一级节点 班级
|
||||||
|
if (item.level == 0) {
|
||||||
|
ary = [...ary, ...item.classstudentlist]
|
||||||
|
}
|
||||||
|
// 二级节点 班级下面的小组
|
||||||
|
if (item.level == 1) {
|
||||||
|
ary = [...ary, ...item.children]
|
||||||
|
}
|
||||||
|
// 三级节点 小组下面的学生
|
||||||
|
if (item.level == 2) {
|
||||||
|
ary = [...ary, item]
|
||||||
|
}
|
||||||
|
})
|
||||||
|
classWorkConfigForm.studentlist = uniqBy(ary, 'studentid')
|
||||||
|
};
|
||||||
|
// 从已经选中的学生中删除
|
||||||
|
const handleClassDialogClassStudentRemove = (item,index) => {
|
||||||
|
classWorkConfigForm.studentlist.splice(index, 1);
|
||||||
|
// 同步删除 [班级、班级]小组]中对应的该学生
|
||||||
|
proxy.$refs.treeRef.setChecked(item.id, false, true);
|
||||||
|
//TODO 后续再看 ,待完善
|
||||||
|
// const ids = this.$refs.treeRef.getCheckedKeys();
|
||||||
|
// console.log(ids)
|
||||||
|
// console.log(ids.filter((_item)=>_item == item.id),'???????')
|
||||||
|
// if(ids&&ids.filter((_item)=>_item == item.id).length>0){
|
||||||
|
// console.log(ids,'?====?')
|
||||||
|
// console.log(item.id,'?=item.id===?')
|
||||||
|
// // 个人多组的情况,再次删除该个人?为啥没删除掉呢
|
||||||
|
// this.$refs.treeRef.setChecked(item.id, false, true);
|
||||||
|
// // setCheckedKeys
|
||||||
|
// }
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理在作业推送前的任务配置
|
||||||
|
*/
|
||||||
|
const openClassWorkConfigDialog = (row, configindex, type) => {
|
||||||
|
// 初始
|
||||||
|
workConfDialogOpen.value = true;
|
||||||
|
classWorkConfigForm.formRowsType = '';//
|
||||||
|
classWorkConfigForm.formRowsList = null;
|
||||||
|
if(type == 'list'){
|
||||||
|
classWorkConfigForm.formRowsType = 'list';
|
||||||
|
classWorkConfigForm.formRowsList = row;
|
||||||
|
}else{
|
||||||
|
classWorkConfigForm.formRowsType = 'item';
|
||||||
|
classWorkConfigForm.formRowsList = [row];
|
||||||
|
}
|
||||||
|
// TODO 重复推送?待完善
|
||||||
|
// if (configindex > -1) {
|
||||||
|
// this.handleClassDialogConfigShow(configindex, 0)
|
||||||
|
// }
|
||||||
|
|
||||||
|
classWorkConfigForm.deaddate = getCurrentTime('YYYY-MM-DD');
|
||||||
|
classWorkConfigForm.deadhour = getCurrentTime('HH+3');//当前时间 往后延时3个小时;
|
||||||
|
classWorkConfigForm.deadmin = getCurrentTime('mm');
|
||||||
|
classWorkConfigForm.timelength = 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 推送配置:保存配置
|
||||||
|
* @param key 'cancel' or 'submit'
|
||||||
|
*/
|
||||||
|
const handleWorkConfigUpdate = (key,row) => {
|
||||||
|
if (key == 'cancel') {
|
||||||
|
workConfDialogOpen.value = false;
|
||||||
|
} else if (key == 'submit') {
|
||||||
|
|
||||||
|
// 2024-04-08, by jackyshen
|
||||||
|
// 注意,这里的逻辑较复杂。不能以this.classWorkConfigForm.classlist为准,需要从选中的学生要找出班级列表
|
||||||
|
var clist = [];
|
||||||
|
var cidlist = [];
|
||||||
|
for (var i=0; i< classWorkConfigForm.studentlist.length; i++) {
|
||||||
|
if (cidlist.indexOf(classWorkConfigForm.studentlist[i].classid) == -1) {
|
||||||
|
// 再找班级名称,为了在UI上能展示出哪个班级
|
||||||
|
var clsname = '';
|
||||||
|
for (var d = 0; d<gradeList.value.length; d++) {
|
||||||
|
if (gradeList.value[d].id == classWorkConfigForm.studentlist[i].classid) {
|
||||||
|
clsname = gradeList.value[d].caption;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
clist.push({id: classWorkConfigForm.studentlist[i].classid, caption: clsname});
|
||||||
|
cidlist.push(classWorkConfigForm.studentlist[i].classid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 20240408,酉阳教委,207
|
||||||
|
// 如果index > -1,则是已有的配置方案。删除后再添加
|
||||||
|
// 为什么尼?
|
||||||
|
// 因为存在多个班级的问题,在修改过程中,如果添加了新的班级学生,则需要删除原来的,再添加新的。
|
||||||
|
// 好,就这么愉快的决定
|
||||||
|
// if (classWorkConfigForm.index > -1) {
|
||||||
|
// classWorkConfigForm.classWorkConfigList.splice(classWorkConfigForm.activeClassWorkIndex);
|
||||||
|
// }
|
||||||
|
// 处理小时和分钟
|
||||||
|
var hh = classWorkConfigForm.deadhour;
|
||||||
|
hh = "0"+hh;
|
||||||
|
hh = hh.substr(hh.length-2, 2);
|
||||||
|
var mm = classWorkConfigForm.deadmin;
|
||||||
|
mm = "0"+mm;
|
||||||
|
mm = mm.substr(mm.length-2, 2);
|
||||||
|
|
||||||
|
// 处理日期
|
||||||
|
classWorkConfigForm.deaddate = '' + classWorkConfigForm.deaddate;
|
||||||
|
if (isNaN(classWorkConfigForm.deaddate.substring(0,4))) {
|
||||||
|
var dd = new Date(classWorkConfigForm.deaddate);
|
||||||
|
var year = dd.getFullYear(); //年份
|
||||||
|
var month = dd.getMonth() + 1; //月份(0-11)
|
||||||
|
month = "0"+month;
|
||||||
|
month = month.substr(month.length-2,2);
|
||||||
|
var day = dd.getDate(); //天数(1到31)
|
||||||
|
day = "0"+day;
|
||||||
|
day = day.substr(day.length-2,2);
|
||||||
|
|
||||||
|
classWorkConfigForm.deaddate = year+'-'+month+'-'+day;
|
||||||
|
}
|
||||||
|
|
||||||
|
classWorkConfigForm.classWorkConfigList = [];
|
||||||
|
// 新建的配置方案
|
||||||
|
for (var i=0; i<clist.length; i++) {
|
||||||
|
classWorkConfigForm.classWorkConfigList.push({
|
||||||
|
id: 0,
|
||||||
|
classid: clist[i].id,
|
||||||
|
classcaption: clist[i].caption, // 班级名称
|
||||||
|
parentid: 0,
|
||||||
|
worktype: '',
|
||||||
|
workkey: classWorkConfigForm.workkey,
|
||||||
|
worktag: '',
|
||||||
|
entpcourseid: 0,
|
||||||
|
evalid: 0,
|
||||||
|
edusubject: '',
|
||||||
|
edudegree: '',
|
||||||
|
workdate: '',
|
||||||
|
title: '',
|
||||||
|
workcodes: '',
|
||||||
|
studentlist: classWorkConfigForm.studentlist,
|
||||||
|
timelength: classWorkConfigForm.timelength,
|
||||||
|
weights: classWorkConfigForm.weights,
|
||||||
|
feedtype: classWorkConfigForm.feedtype,
|
||||||
|
deaddate: classWorkConfigForm.deaddate+' '+hh+":"+mm,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if(classWorkConfigForm.formRowsType == 'list'){
|
||||||
|
// 一键推送:list推送
|
||||||
|
for(var d=0;d<classWorkConfigForm.formRowsList.length;d++){
|
||||||
|
classWorkConfigForm.rowid = classWorkConfigForm.formRowsList[d].id;
|
||||||
|
|
||||||
|
// 20240308,by jackyshen
|
||||||
|
// 注意,这是要把 classWorkConfigForm.classWorkConfigList保存给taskList[i]
|
||||||
|
// 这个 classWorkConfigForm.classWorkConfigList里面,包括了多个配置策略(多班级、多学生)
|
||||||
|
for (var i=0; i<taskList.value.length; i++) {
|
||||||
|
if (taskList.value[i].id == classWorkConfigForm.rowid) {
|
||||||
|
taskList.value[i].taskconfig = classWorkConfigForm.classWorkConfigList;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
// 单个推送:item推送
|
||||||
|
classWorkConfigForm.rowid = classWorkConfigForm.formRowsList[0].id;
|
||||||
|
|
||||||
|
// 20240308,by jackyshen
|
||||||
|
// 注意,这是要把 classWorkConfigForm.classWorkConfigList保存给taskList[i]
|
||||||
|
// 这个 classWorkConfigForm.classWorkConfigList里面,包括了多个配置策略(多班级、多学生)
|
||||||
|
for (var i=0; i<taskList.value.length; i++) {
|
||||||
|
if (taskList.value[i].id == classWorkConfigForm.rowid) {
|
||||||
|
taskList.value[i].taskconfig = classWorkConfigForm.classWorkConfigList;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 重置
|
||||||
|
classWorkConfigForm.id = 0;
|
||||||
|
classWorkConfigForm.index = -1;
|
||||||
|
classWorkConfigForm.selclassid = 0;
|
||||||
|
classWorkConfigForm.classlist = [];
|
||||||
|
classWorkConfigForm.studentlist = [];
|
||||||
|
classWorkConfigForm.feedtype = '必做';
|
||||||
|
classWorkConfigForm.workkey = '';
|
||||||
|
classWorkConfigForm.selgroupid = 0;
|
||||||
|
classWorkConfigForm.classGroups = [];
|
||||||
|
classWorkConfigForm.availableStudents = [];
|
||||||
|
classWorkConfigForm.deaddate = getCurrentTime('YYYY-MM-DD');
|
||||||
|
classWorkConfigForm.deadhour = getCurrentTime('HH+3');
|
||||||
|
classWorkConfigForm.deadmin = getCurrentTime('mm');
|
||||||
|
classWorkConfigForm.timelength = 1;
|
||||||
|
classWorkConfigForm.weights = 1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 推送
|
||||||
|
*/
|
||||||
|
const handleTaskAssignToAllClassType = async() => {
|
||||||
|
if(classWorkConfigForm.studentlist.length == 0){
|
||||||
|
return proxy.$modal.msgWarning('请选择需要推送的学生!');
|
||||||
|
}
|
||||||
|
// this.classWorkToStudent_Loading = true;
|
||||||
|
|
||||||
|
// 保存配置
|
||||||
|
handleWorkConfigUpdate('submit', '')
|
||||||
|
const { chapterId } = await useGetHomework(courseObj.node)
|
||||||
|
// this.entpcourseid = chapterId
|
||||||
|
|
||||||
|
console.log(taskList.value,'===============this.taskListthis.taskList')
|
||||||
|
var ttt = [];
|
||||||
|
for (var i=0; i<taskList.value.length; i++) {
|
||||||
|
// 20240408, by jackyshen
|
||||||
|
// 这里根据taskconfig.classWorkList来优化,其中包括了多个班级、多个学生
|
||||||
|
for (var t=0; t<taskList.value[i].taskconfig.length; t++) {
|
||||||
|
if (taskList.value[i].taskconfig[t].id == 0) {
|
||||||
|
|
||||||
|
ttt.push({
|
||||||
|
id: 0,
|
||||||
|
parentid: taskList.value[i].id,
|
||||||
|
classid: taskList.value[i].taskconfig[t].classid,
|
||||||
|
classcourseid: 0,
|
||||||
|
entpcourseid: chapterId,
|
||||||
|
studentlist: JSON.stringify(taskList.value[i].taskconfig[t].studentlist),
|
||||||
|
feedback: taskList.value[i].taskconfig[t].feedtype,
|
||||||
|
workkey: taskList.value[i].taskconfig[t].workkey,
|
||||||
|
timelength: taskList.value[i].taskconfig[t].timelength,
|
||||||
|
weights: taskList.value[i].taskconfig[t].weights,
|
||||||
|
deaddate: taskList.value[i].taskconfig[t].deaddate,
|
||||||
|
workdate: getCurrentTime('YYYY-MM-DD'),
|
||||||
|
uniquekey: taskList.value[i].uniquekey,
|
||||||
|
entpcourseworklist: '['+taskList.value[i].entpcourseworklist+']', // 当前任务所包含的题目,必须是JSON格式
|
||||||
|
needMsgNotifine: 'false',
|
||||||
|
msgkey: 'newclasswork',
|
||||||
|
title: taskList.value[i].title,
|
||||||
|
status:'1',
|
||||||
|
msgcontent: '', // 这个在服务端里会写入classwork的json
|
||||||
|
teachername: userStore.nickName,
|
||||||
|
unixstamp: new Date().getTime(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log(ttt,'===============ttt')
|
||||||
|
|
||||||
|
if(ttt.length == 0){
|
||||||
|
proxy.$modal.msgError('您还未进行作业配置,请配置后再推送');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var wForm = {};
|
||||||
|
wForm.classworkarray = JSON.stringify(ttt);
|
||||||
|
saveByClassWorkArray(wForm).then(response => {
|
||||||
|
console.log(response,'===============response');
|
||||||
|
// this.classWorkToStudent_Loading = false;
|
||||||
|
workConfDialogOpen.value = false;
|
||||||
|
proxy.$modal.msgSuccess("作业推送成功");
|
||||||
|
// 清空班级树状勾选项内容
|
||||||
|
proxy.$refs.treeRef.setCheckedKeys([]);
|
||||||
|
// 刷新作业布置页面
|
||||||
|
nextTick(() => {
|
||||||
|
getTaskList();
|
||||||
|
})
|
||||||
|
}).catch((error) =>{
|
||||||
|
// this.classWorkToStudent_Loading = false;
|
||||||
|
workConfDialogOpen.value = false;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 一键推送
|
||||||
|
*/
|
||||||
|
const handleTaskAssignToAllClass = () => {
|
||||||
|
let rows = proxy.$refs.taskTable.getSelectionRows();
|
||||||
|
if (rows.length > 0) {
|
||||||
|
proxy.$modal.confirm('是否确认推送选中的学习任务?').then(()=> {
|
||||||
|
}).then(() => {
|
||||||
|
// 弹出配置窗口 ,让用户配置推送策略
|
||||||
|
openClassWorkConfigDialog(rows, -1,'list')
|
||||||
|
}).catch(() => {})
|
||||||
|
}else{
|
||||||
|
return proxy.$modal.alertWarning("请选择需要推送的任务!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 作业说明编辑-确认
|
// 作业说明编辑-确认
|
||||||
const submitWorkTitle = () => {
|
const submitWorkTitle = () => {
|
||||||
|
|
Loading…
Reference in New Issue