作业布置:列表逻辑改为usegetHomework里面,新增历史记录查看,新增历史记录的批阅详情查看

This commit is contained in:
白了个白 2024-10-17 10:19:22 +08:00
parent 7c539614fd
commit a1002a1f40
3 changed files with 257 additions and 579 deletions

View File

@ -35,7 +35,7 @@ export const editListItem = (row, courseObj) => {
fileHomeworkList: [],// 设计中的常规作业list
whiteboardObj: '',// 设计中的课堂展示对象
};
console.log('编辑的行', row);
//重新更新[新任务]中右侧列表数据
var listCourseWork = [];

View File

@ -71,6 +71,7 @@ const getHomeWorkList = async () => {
return await homeworklist({
entpcourseid: chapterId,
edituserid: userStore.user.userId,
orderby: "timestamp DESC",
pageSize: 100,
status: '10'
}).then((res) => {
@ -79,7 +80,25 @@ const getHomeWorkList = async () => {
for (var i = 0; i < res.rows.length; i++) {
res.rows[i].taskconfig = []
// 找child
// 处理任务类型的UI
// if (res.rows[i].worktype == '学习目标定位') {
// res.rows[i].workclass = 'success';
// res.rows[i].workcodesList = JSON.parse(res.rows[i].workcodes);
// } else
// 课标研读 目标设定 教材研读 框架梳理 学科定位 TODO 后续接入在添加
if (res.rows[i].worktype == '课堂展示') {
res.rows[i].workclass = 'primary';
} else if (res.rows[i].worktype == '框架梳理') {
res.rows[i].workclass = 'warning';
} else if (res.rows[i].worktype == '常规作业') {
res.rows[i].workclass = 'info';
} else if (res.rows[i].worktype == '习题训练') {
res.rows[i].workclass = 'danger';
} else {
res.rows[i].workclass = 'primary';
}
// 找child
for (var j = 0; j < res.rows.length; j++) {
if (res.rows[j].parentid == res.rows[i].id) {
var ss = []

View File

@ -36,6 +36,7 @@
<div style="flex: 1;overflow: hidden;">
<el-table
ref="taskTable"
v-loading="loading"
:data="taskList"
:tree-props="{checkStrictly: true}"
row-key="id"
@ -58,7 +59,7 @@
</div>
<div>
<div v-if="scope.row.status == '10'">
<el-button v-hasPermi="['teaching:classwork:edit']" text @click="newHandleWorkEdit2ClassWorkQuizAdd(scope.row, scope.$index)">编辑</el-button>
<el-button v-hasPermi="['teaching:classwork:edit']" text @click="handleWorkEditItem(scope.row)">编辑</el-button>
</div>
<div v-else>
<el-button v-hasPermi="['teaching:classwork:edit']" text @click="handleWorkEdit(scope.row, scope.$index)">查看详情</el-button>
@ -75,10 +76,10 @@
</div>
<div>
<div v-if="scope.row.status == '10'">
<el-button v-hasPermi="['teaching:classwork:edit']" text @click="handleWorkTitleEdit(scope.row, scope.$index)">编辑</el-button>
<el-button v-hasPermi="['teaching:classwork:edit']" text @click="handleWorkTitleEdit(scope.row, scope.$index,'edit')">编辑</el-button>
</div>
<div v-else>
<el-button v-hasPermi="['teaching:classwork:edit']" text @click="handleWorkTitleEdit(scope.row, scope.$index)">查看详情</el-button>
<el-button v-hasPermi="['teaching:classwork:edit']" text @click="handleWorkTitleEdit(scope.row, scope.$index,'query')">查看详情</el-button>
</div>
</div>
</div>
@ -92,10 +93,15 @@
<el-table-column v-if="props.initDataProps.queryType!=='single'" label="推送配置" align="left" min-width="16%">
<template #default="scope">
<div style="display: flex">
<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>
<el-button v-hasPermi="['teaching:classwork:edit']" link icon="Setting" :style="formatStyle(scope.row)" @click="scope.row.status == '10' ? openSet(scope.row,'item') : ''">{{scope.row.status == '10'? '推送' : '已推送'}}</el-button>
</div>
</template>
</el-table-column>
<el-table-column v-if="props.initDataProps.queryType!=='single'" label="历史推送" align="left" min-width="16%">
<template #default="scope">
<el-button @click="queryPushRecords(scope.row)">查看记录</el-button>
</template>
</el-table-column>
</el-table>
</div>
@ -197,8 +203,6 @@
<div slot="footer" class="dialog-footer" style="text-align: right; margin-top: 20px;">
<div style="display: flex">
<!-- <el-button v-if="currentTag=='习题训练'" style="margin-right: auto" type="primary"
:disabled="checkTaskAssigned(currentWorkEdit.currentTask)" @click="handleWorkEdit2ClassWorkQuizAdd">添加作业</el-button> -->
<el-button type="primary" style="margin-left: auto" :disabled="checkTaskAssigned(currentWorkEdit.currentTask)"
@click="submitStudy('submit')"> </el-button>
</div>
@ -206,94 +210,79 @@
</el-dialog>
<!-- 作业说明编辑 -->
<el-dialog v-model="currentWorkEdit.workTitleEdit" title="作业说明编辑" width="70%" append-to-body>
<el-input v-model="currentWorkEdit.currentTitle" type="textarea" rows="5" placeholder="请输入作业说明" :disabled="checkTaskAssigned(currentWorkEdit.currentTask)"/>
<el-dialog v-model="currentWorkEdit.workTitleEdit" title="作业说明" width="70%" append-to-body>
<el-input v-model="currentWorkEdit.currentTitle" type="textarea" rows="5" placeholder="请输入作业说明" :disabled="currentWorkEdit.currentType == 'query'?true:false"/>
<div slot="footer" class="dialog-footer" style="text-align: right; margin-top: 20px;">
<el-button type="primary" :disabled="checkTaskAssigned(currentWorkEdit.currentTask)"
@click="submitWorkTitle('submit')"> </el-button>
</div>
</el-dialog>
<!-- 推送作业的配置对话框 -->
<el-dialog v-model="workConfDialogOpen" title="作业布置推送配置" width="60%" append-to-body>
<el-row>
<el-col :span="24">
<el-form ref="classWorkConfigFormRef" :model="classWorkConfigForm" label-width="100px">
<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>
<!-- 已推送历史 -->
<el-dialog v-model="pushRecordsOpen" title="推送历史记录" width="80%" append-to-body>
<div style="flex: 1;overflow: hidden; min-height: 400px;">
<el-table
ref="pushRecordsRef"
:data="pushRecordsList"
v-loading="loading"
:tree-props="{checkStrictly: true}"
row-key="id"
style="width: 100%;height: 100%; border: 1px solid #dcdfe6;border-radius: 3px;flex:1"
:row-class-name="tableRowClassName"
>
<el-table-column type="index" label="序号" width="52" reserve-selection align="center" />
<el-table-column v-if="props.initDataProps.queryType!=='single'" label="创建时间" align="center" prop="timestamp" min-width="30%" sortable>
<template #default="scope">
<el-tag size="large">{{ scope.row.timestamp }}</el-tag>
</template>
</el-table-column>
<el-table-column label="作业名称" prop="uniquekey" min-width="18%" align="center">
</el-table-column>
<el-table-column label="作业类型'" align="center" prop="worktype" min-width="20%" sortable>
<template #default="scope">
<el-tag :type="scope.row.workclass" size="large">{{ scope.row.worktype }}</el-tag>
</template>
</el-table-column>
<el-table-column label="作业内容" align="center" min-width="20%">
<template #default="scope">
<div style="border: 1px solid #ccc; width: 100%; height: auto; display: flex; justify-content: space-between; padding-left: 10px">
<div style="display: flex; margin-top: 5px">
<el-tag v-if="scope.row.entpcourseworklistarray.length>0" effect="dark" type="warning" size="small" style="margin-left: 5px" round>{{ scope.row.entpcourseworklistarray.length }}</el-tag>
</div>
<div>
<el-button text @click="handleWorkEdit(scope.row, scope.$index)">查看详情</el-button>
</div>
</div>
</template>
</el-table-column>
<el-table-column v-if="props.initDataProps.queryType!=='single'" label="作业说明" align="center" min-width="36%">
<template #default="scope">
<div style="border: 1px solid #ccc; width: 100%; height: auto; display: flex; justify-content: space-between; padding-left: 10px">
<div style="display: flex; margin-top: 5px">
<div class="singe-line" style="max-width: 200px" v-html="scope.row.title"></div>
</div>
<div>
<el-button @click="handleWorkTitleEdit(scope.row, scope.$index, 'query')">查看详情</el-button>
</div>
</div>
</template>
</el-table-column>
<el-table-column v-if="props.initDataProps.queryType!=='single'" label="推送配置" align="left" min-width="16%">
<template #default="scope">
<div style="display: flex">
<el-button @click="onClickItem(scope.row)">批阅详情</el-button>
</div>
</template>
</el-table-column>
</el-table>
</div>
<div slot="footer" class="dialog-footer" style="text-align: right; margin-top: 20px;">
<el-button type="primary" @click="pushRecordsOpen = false"> </el-button>
</div>
</el-dialog>
<!-- 推送作业的配置对话框 -->
<SetHomework v-model="setDialog" :entpcourseid="entpcourseid" :rows="rowsList" @on-close="closeHomework" @on-success="successHomework"/>
<!-- 预览框 -->
<prevReadMsgDialog ref="prevReadMsgDialogRef" :bookobj="courseObj"/>
<!-- 其他附件预览框 acceptParams-->
@ -310,16 +299,20 @@ import { useRouter } from 'vue-router'
import ChooseTextbook from '@/components/choose-textbook/index.vue'
import { homeworklist, delClasswork } from '@/api/teaching/classwork'
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 { editListItem } from '@/hooks/useClassTask'
import { processList } from '@/hooks/useProcessList'
import { uniqBy, groupBy } from 'lodash'
import { getCurrentTime } from '@/utils/date'
import prevReadMsgDialog from '@/views/classTask/container/newTask/prevReadMsg-Dialog.vue'
import prevReadImgFileDialog from '@/views/classTask/container/classTask/prevReadImgFileDialog.vue'
import SetHomework from '@/components/set-homework/index.vue'
import {sessionStore} from '@/utils/store'
import {createWindow} from '@/utils/tool'
import { useToolState } from '@/store/modules/tool'
import {throttle,debounce } from '@/utils/comm'
const toolState = useToolState();
import useUserStore from '@/store/modules/user'
const userStore = useUserStore().user
const { proxy } = getCurrentInstance()
@ -349,13 +342,17 @@ const courseObj = reactive({
//
})
const taskList = ref([]);
const loading = ref(false);
const taskList = ref([]); //
const loading = ref(false);
const pushRecordsList = ref([]); //
const pushRecordsOpen = ref(false); //
const pushRecordsLoading = ref(false); // loading
//
const workEdit = ref(false);
const currentWorkEdit = reactive({
workTitleEdit: false,
currentType:'query',
currentTask: {},
currentTitle: '',
currentIndex: 0,
@ -371,21 +368,9 @@ const workConfObj = reactive({
});
//
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
}); //
const setDialog = ref(false); //
const rowsList = ref([]) //
const entpcourseid = ref('') // id
// ---------------------------------------------------
@ -411,6 +396,88 @@ const getData = (data) => {
// ID
localStorage.setItem('unitId', JSON.stringify({ levelFirstId, levelSecondId}))
//
initHomeWork();
}
/**
* 获取 entpcourseid
*/
const initHomeWork = async()=> {
const { res, chapterId } = await useGetHomework(courseObj.node);
console.log('entpcourseid', chapterId);
console.log('res', res);
entpcourseid.value = chapterId;
taskList.value = res;
}
/**
* 查看推送历史
*
*/
const queryPushRecords = (row) => {
//
console.log(row,'查看该行推送历史')
pushRecordsOpen.value = true;
pushRecordsLoading.value = true;
homeworklist({
entpcourseid: entpcourseid.value,
edituserid: userStore.userId,
parentid: row.id,
orderby: "timestamp DESC",
pageSize: 100,
status: '1' // 1 10
}).then((res) => {
if(res.rows&& res.rows.length>0){
for (var i = 0; i < res.rows.length; i++) {
res.rows[i].taskconfig = []
// UI
// if (res.rows[i].worktype == '') {
// res.rows[i].workclass = 'success';
// res.rows[i].workcodesList = JSON.parse(res.rows[i].workcodes);
// } else
// TODO
if (res.rows[i].worktype == '课堂展示') {
res.rows[i].workclass = 'primary';
} else if (res.rows[i].worktype == '框架梳理') {
res.rows[i].workclass = 'warning';
} else if (res.rows[i].worktype == '常规作业') {
res.rows[i].workclass = 'info';
} else if (res.rows[i].worktype == '习题训练') {
res.rows[i].workclass = 'danger';
} else {
res.rows[i].workclass = 'primary';
}
//
if (res.rows[i].entpcourseworklist != '') {
res.rows[i].entpcourseworklistarray = JSON.parse('[' + res.rows[i].entpcourseworklist + ']')
} else {
res.rows[i].entpcourseworklistarray = []
}
res.rows[i].fileShowName = res.rows[i].uniquekey
}
pushRecordsList.value = res.rows;
pushRecordsLoading.value = false;
}
}).catch((err) => {
pushRecordsLoading.value = false;
})
}
const debounceOpenWin = debounce(() => {
toolState.isTaskWin=true; //
createWindow('open-taskwin',{url:'/teachClassTask'}); //
}, 1000);
//
const onClickItem = (item) => {
console.log('防抖开启弹窗')
sessionStore.set('teachClassWorkItem', item); // item
debounceOpenWin();
}
/**
@ -441,10 +508,10 @@ const handleDelete =() => {
* 1.获取作业列表
*/
const getTaskList = async () => {
const { chapterId } = await useGetHomework(courseObj.node)
// this.entpcourseid = chapterId
//
homeworklist({entpcourseid: chapterId, orderby: "deaddate DESC" , edituserid: userStore.userId, pageSize: 500}).then(res => {
taskList.value = [];
loading.value = true;
homeworklist({entpcourseid: entpcourseid.value, orderby: "deaddate DESC" , edituserid: userStore.userId, pageSize: 500}).then(res => {
let model = [];
let mission = [];
@ -542,26 +609,14 @@ const getTaskList = async () => {
// /
const handleWorkTitleEdit = (row, index) => {
const handleWorkTitleEdit = (row, index, type) => {
currentWorkEdit.currentType = type;
currentWorkEdit.workTitleEdit = true;
currentWorkEdit.currentTask = row;
currentWorkEdit.currentTitle = row.title;
currentWorkEdit.currentIndex = index;
};
// --
let classtaskObj = reactive({
id: '', //
bookName: '', //
uniquekey: '', //
title: '', //
worktype: '', //
quizlist: [], //
chooseWorkLists: [],// list
fileHomeworkList: [],// list
whiteboardObj: '',//
})
/**
* 作业内容-查看详情
* */
@ -569,10 +624,7 @@ let classtaskObj = reactive({
console.log(row, index)
workEdit.value = true
currentWorkEdit.currentTask = row;
// currentWorkEdit.currentIndex = index;
currentTag.value = row.worktype;
// this.attainmentList = row.workcodesList?.attlist;
// this.courseQualityList = row.workcodesList?.qualist;
if (row.worktype == '框架梳理') {
// entpcourseworklistarray
var listCourseWork = [];
@ -652,457 +704,58 @@ let classtaskObj = reactive({
}
}
};
// -
const newHandleWorkEdit2ClassWorkQuizAdd = async (row, index) =>{
//[]
var listCourseWork = [];
for (var i=0; i < row.entpcourseworklistarray.length; i++) {
listCourseWork.push(row.entpcourseworklistarray[i]);
}
if (listCourseWork.length > 0) {
classtaskObj.id= row.id; //
classtaskObj.bookObj = courseObj; //
classtaskObj.bookName = row.evaltitle? row.evalparenttitle? row.evalparenttitle+'/'+row.evaltitle : row.evaltitle: row.evalparenttitle// :/
classtaskObj.uniquekey= row.uniquekey; //
classtaskObj.title= row.title; //
classtaskObj.worktype= row.worktype; //
classtaskObj.quizlist= []; //
classtaskObj.chooseWorkLists = []; // list
classtaskObj.fileHomeworkList = []; // list
classtaskObj.whiteboardObj = ''; //
if (row.worktype == '框架梳理') {
//
const res = await getEvaluationclue(listCourseWork[0].id);
if ( res.data==null || res.data==undefined ) {
return;
}
console.log('res.data', res.data);
// this.chooseWorkLists = [];
res.data.worktype = '框架梳理';
res.data.score = listCourseWork[0].score;
classtaskObj.chooseWorkLists.push(res.data);
//
ToNewClassTask(classtaskObj);
}
else if (row.worktype == '习题训练') {
const ids = listCourseWork.map(item => item.id).join(",");
listEntpcoursework({ids: ids, pageSize: 50}).then(idres => {
// for (var i=0; i<idres.rows.length; i++) {
// idres.rows[i].titletext = idres.rows[i].title.replace(/<[^>]+>/g, '');
// }
//
if(idres.rows&&idres.rows.length > 0){
processList(idres.rows);
//task
row.entpcourseworklistarray.forEach(item => {
const quizItem = idres.rows.find(quiz => quiz.id === item.id);
if (quizItem) {
quizItem.score = item.score;
quizItem.scoreOrigin = item.score;
}
});
classtaskObj.quizlist = idres.rows;
//
ToNewClassTask(classtaskObj);
/**
* 作业内容-前往作业设计 编辑页面
* @param row
*/
const handleWorkEditItem = (row) => {
editListItem(row, courseObj).then((obj) => {
if(obj){
//
router.push({
path: '/newClassTask',
query: {
classtaskObj: JSON.stringify(obj),
}
})
}
else if (row.worktype == '课堂展示') {
console.log('row.课堂展示', row.workcodes);
const workcodes = JSON.parse(row.workcodes);
classtaskObj.whiteboardObj = JSON.stringify(workcodes.json);
//
ToNewClassTask(classtaskObj);
}
else if (row.worktype == '常规作业') {
if(isJson(row.workcodes)){
classtaskObj.fileHomeworkList = JSON.parse(row.workcodes);
//
ToNewClassTask(classtaskObj);
}
}
}
};
/**
* 跳转 作业设计 进行编辑页面
* @param classtaskObj
*/
const ToNewClassTask = (classtaskObj) => {
router.push({
path: '/newClassTask',
query: {
classtaskObj: JSON.stringify(classtaskObj),
}
})
}
const isJson = (str) => {
if (typeof str == 'string') {
try {
let obj = JSON.parse(str)
if (typeof obj == 'object' && obj) {
return true
} else {
return false
}
} catch (e) {
return false
}
}
}
//
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);
}
}
// 20240408207
// 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(); //131
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++) {
// clist classWorkConfigForm.studentlist studentlistid
const clsStuList = classWorkConfigForm.studentlist&&classWorkConfigForm.studentlist.filter(item=>item.classid == clist[i].id);
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: clsStuList,
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;
// 20240308by jackyshen
// classWorkConfigForm.classWorkConfigListtaskList[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;
// 20240308by jackyshen
// classWorkConfigForm.classWorkConfigListtaskList[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: '', // classworkjson
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);
console.log(wForm,'推送的配置信息------------')
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;
});
};
}
/**
* 推送作业配置
* //list
*/
//
const openSet=(row, type)=> {
if(type == 'list'){
// row rows
rowsList.value = row;
setDialog.value = true;
}else{
// row row,
rowsList.value = [row];
setDialog.value = true;
}
}
/**
* 关闭布置作业窗口
*/
const closeHomework = () => {
rowsList.value = [];
setDialog.value = false;
}
/**
* 推送布置作业成功
*/
const successHomework = () => {
rowsList.value = [];
setDialog.value = false;
//
nextTick(() => {
getTaskList();
})
}
/**
* 一键推送
@ -1113,7 +766,7 @@ const handleTaskAssignToAllClass = () => {
proxy.$modal.confirm('是否确认推送选中的学习任务?').then(()=> {
}).then(() => {
//
openClassWorkConfigDialog(rows, -1,'list')
openSet(rows,'list');
}).catch(() => {})
}else{
return proxy.$modal.alertWarning("请选择需要推送的任务!");
@ -1214,10 +867,16 @@ const selectable=(row, index)=>{
onMounted(() => {
})
watch(() => courseObj.node, (newVal) => {
watch(() => courseObj.node, (newVal,oldVal) => {
console.log(courseObj,'课程选择')
//
getTaskList();
if(newVal&&oldVal){
console.log(newVal.id,'newVal')
console.log(oldVal.id,'oldVal')
if(newVal.id != oldVal.id){
//
// getTaskList();
}
}
})
</script>