查询作业修改
This commit is contained in:
parent
bf783cf940
commit
c72d103082
|
@ -11,6 +11,7 @@ let chapterId = null
|
|||
export const useGetHomework = async (node) => {
|
||||
/**
|
||||
* node
|
||||
* 左侧选择章节的节点数据
|
||||
*/
|
||||
if (!node) return
|
||||
curNode = node
|
||||
|
@ -26,7 +27,10 @@ export const useGetHomework = async (node) => {
|
|||
chapterId = rows[0].id
|
||||
}
|
||||
|
||||
return await getHomeWorkList()
|
||||
return new Promise(async (resolve) =>{
|
||||
const res = await getHomeWorkList()
|
||||
resolve({res,chapterId})
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -139,7 +139,6 @@ import { useToolState } from '@/store/modules/tool'
|
|||
import MoveFile from '@/components/move-file/index.vue'
|
||||
import FileListItem from '@/views/prepare/container/file-list-item.vue'
|
||||
import { getSmarttalkPage, moveSmarttalk } from '@/api/file'
|
||||
import { homeworklist, listEntpcourse } from '@/api/teaching/classwork'
|
||||
import { toTimeText } from '@/utils/date'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { parseCataByNode, creatPPT, asyncLocalFile } from '@/utils/talkFile'
|
||||
|
@ -148,8 +147,9 @@ import SetHomework from './container/set-homework.vue'
|
|||
import outLink from '@/utils/linkConfig'
|
||||
import { createWindow } from '@/utils/tool'
|
||||
import { cloneDeep } from 'lodash'
|
||||
import { delClasswork, addEntpcourse } from '@/api/teaching/classwork'
|
||||
import { delClasswork } from '@/api/teaching/classwork'
|
||||
import { getSelfReserv, startClass } from '@/api/classManage'
|
||||
import { useGetHomework } from '@/hooks/useGetHomework'
|
||||
const toolStore = useToolState()
|
||||
const fs = require('fs')
|
||||
const { ipcRenderer } = window.electron || {}
|
||||
|
@ -428,44 +428,11 @@ export default {
|
|||
this.initHomeWork()
|
||||
await this.asyncAllFile()
|
||||
},
|
||||
// 获取作业
|
||||
async initHomeWork() {
|
||||
|
||||
if (this.uploadData.levelSecondId) {
|
||||
// 获取作业列表所需ID 可能存在没有
|
||||
let { rows } = await this.getChapterId()
|
||||
if (rows.length > 0) {
|
||||
this.entpcourseid = rows[0].id
|
||||
} else {
|
||||
await this.createEntpcourse()
|
||||
let { rows } = await this.getChapterId()
|
||||
this.entpcourseid = rows[0].id
|
||||
}
|
||||
|
||||
// 查询作业
|
||||
this.getHomeWorkList()
|
||||
}
|
||||
},
|
||||
// 创建新的entpcourse
|
||||
createEntpcourse() {
|
||||
// 参照 web AIx 传入参数
|
||||
var cform = {}
|
||||
cform.entpid = this.userStore.deptId
|
||||
cform.level = 1
|
||||
cform.parentid = 0
|
||||
cform.dictid = 0
|
||||
cform.evalid = this.currentNode.id
|
||||
cform.evalparentid = 0
|
||||
cform.edusubject = this.currentNode.edusubject
|
||||
cform.edudegree = this.currentNode.edudegree
|
||||
cform.edustage = this.currentNode.edustage
|
||||
cform.coursetype = '课标学科'
|
||||
cform.coursetitle = this.currentNode.itemtitle
|
||||
cform.coursedesc = ''
|
||||
cform.status = ''
|
||||
cform.dflag = 0
|
||||
cform.edituserid = this.userStore.userId
|
||||
cform.createblankfile = 'yes'
|
||||
return addEntpcourse(cform)
|
||||
const { res, chapterId } = await useGetHomework(this.currentNode)
|
||||
this.entpcourseid = chapterId
|
||||
this.currentWorkList = cloneDeep(res)
|
||||
},
|
||||
openReserv() {
|
||||
this.$refs['reservDialog'].openDialog()
|
||||
|
@ -495,79 +462,6 @@ export default {
|
|||
cookieData: { ...configObj.data }
|
||||
})
|
||||
},
|
||||
// 根据教材章节单元ID 查询作业列表所需ID
|
||||
getChapterId() {
|
||||
return listEntpcourse({
|
||||
evalid: this.uploadData.levelSecondId,
|
||||
edituserid: this.userStore.userId,
|
||||
pageSize: 500
|
||||
})
|
||||
},
|
||||
|
||||
// 查询作业列表
|
||||
getHomeWorkList() {
|
||||
homeworklist({
|
||||
entpcourseid: this.entpcourseid,
|
||||
edituserid: this.userStore.userId,
|
||||
pageSize: 100
|
||||
}).then((res) => {
|
||||
//以下代码 参照AIx web端 作业布置
|
||||
let list = []
|
||||
for (var i = 0; i < res.rows.length; i++) {
|
||||
res.rows[i].taskconfig = []
|
||||
|
||||
// 找child
|
||||
for (var j = 0; j < res.rows.length; j++) {
|
||||
if (res.rows[j].parentid == res.rows[i].id) {
|
||||
var ss = []
|
||||
if (res.rows[j].classworkdatastudentids != null) {
|
||||
ss = JSON.parse('[' + res.rows[j].classworkdatastudentids + ']')
|
||||
}
|
||||
var js = {
|
||||
id: res.rows[j].id,
|
||||
classid: res.rows[j].classid,
|
||||
classcaption: res.rows[j].classcaption,
|
||||
parentid: 0,
|
||||
worktype: '',
|
||||
workkey: res.rows[j].workkey,
|
||||
worktag: '',
|
||||
entpcourseid: 0,
|
||||
evalid: 0,
|
||||
edusubject: '',
|
||||
edudegree: '',
|
||||
workdate: '',
|
||||
title: '',
|
||||
workcodes: '',
|
||||
studentlist: ss,
|
||||
deaddate: res.rows[j].deaddate,
|
||||
timelength: res.rows[j].timelength,
|
||||
weights: res.rows[j].weights,
|
||||
feedtype: res.rows[j].feedtype
|
||||
}
|
||||
res.rows[i].taskconfig.push(js)
|
||||
}
|
||||
}
|
||||
res.rows[i].fileShowName = res.rows[i].uniquekey
|
||||
|
||||
// 注意slideid>0的,这一些作业是添加到PPT页面的,所以在作业管理中不能出现
|
||||
// 2024-05-15,酉阳,jackyshen
|
||||
if (res.rows[i].classid == 0 && res.rows[i].slideid == 0) {
|
||||
list.push(res.rows[i])
|
||||
}
|
||||
|
||||
// 如果是习题训练任务,则检查一共有多少道
|
||||
if (res.rows[i].entpcourseworklist != '') {
|
||||
res.rows[i].entpcourseworklistarray = JSON.parse(
|
||||
'[' + res.rows[i].entpcourseworklist + ']'
|
||||
)
|
||||
} else {
|
||||
res.rows[i].entpcourseworklistarray = []
|
||||
}
|
||||
}
|
||||
// 深度克隆
|
||||
this.currentWorkList = cloneDeep(list)
|
||||
})
|
||||
},
|
||||
getWeekday1(date) {
|
||||
const weekdays = ['周日', '周一', '周二', '周三', '周四', '周五', '周六']
|
||||
const weekday = new Date(date).getDay()
|
||||
|
@ -586,7 +480,7 @@ export default {
|
|||
ElMessage.success('操作成功')
|
||||
this.isLoading = false
|
||||
await this.asyncAllFile()
|
||||
this.getHomeWorkList()
|
||||
this.initHomeWork()
|
||||
})
|
||||
.catch(() => {
|
||||
this.isLoading = false
|
||||
|
|
|
@ -118,7 +118,7 @@ const closeHomework = () => {
|
|||
|
||||
|
||||
const changeChapter = async (data)=>{
|
||||
const res = await useGetHomework(data)
|
||||
const { res } = await useGetHomework(data)
|
||||
dataList.value = res
|
||||
let cata = parseCataByNode(data)
|
||||
|
||||
|
|
Loading…
Reference in New Issue