作业布置:列表逻辑改为usegetHomework里面,新增历史记录查看,新增历史记录的批阅详情查看
This commit is contained in:
parent
7c539614fd
commit
a1002a1f40
|
@ -35,7 +35,7 @@ export const editListItem = (row, courseObj) => {
|
|||
fileHomeworkList: [],// 设计中的常规作业list
|
||||
whiteboardObj: '',// 设计中的课堂展示对象
|
||||
};
|
||||
|
||||
console.log('编辑的行', row);
|
||||
|
||||
//重新更新[新任务]中右侧列表数据
|
||||
var listCourseWork = [];
|
||||
|
|
|
@ -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 = []
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
// 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++) {
|
||||
// clist里面包含多个班级、多个班级的学生。选中的学生中 classWorkConfigForm.studentlist 包含多个班级的学生 studentlist赋值需要根据id判断筛选一下
|
||||
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;
|
||||
|
||||
// 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);
|
||||
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>
|
||||
|
|
Loading…
Reference in New Issue