Merge pull request 'baigl' (#266) from baigl into main
Reviewed-on: #266
This commit is contained in:
commit
93a5ffef20
|
@ -26,9 +26,9 @@
|
|||
<!-- <el-button type="primary" icon="Postcard" @click="handleNewClassWorkDialog" style="margin-left: 20px; margin-top: 10px">{{initDataProps.queryType!=='single'?'设计新作业':'设计新活动'}}</el-button>
|
||||
<el-button v-if="initDataProps.queryType!=='single'" type="success" icon="Promotion" @click="handleTaskAssignToAllClass()" style="margin-left: 20px; margin-top: 10px">一键推送</el-button>
|
||||
<el-button type="danger" icon="delete" @click="handleDelete" style="margin-left: 20px; margin-top: 10px">删除</el-button> -->
|
||||
<el-button type="primary" @click="handleNewClassWorkDialog" style="margin-left: 20px; margin-top: 10px">设计新作业</el-button>
|
||||
<el-button type="success" @click="handleTaskAssignToAllClass()" style="margin-left: 20px; margin-top: 10px">一键推送</el-button>
|
||||
<el-button type="danger" @click="handleDelete" style="margin-left: 20px; margin-top: 10px">删除</el-button>
|
||||
<el-button type="primary" style="margin-left: 20px; margin-top: 10px" @click="handleNewClassWorkDialog">设计新作业</el-button>
|
||||
<el-button type="success" style="margin-left: 20px; margin-top: 10px" @click="handleTaskAssignToAllClass()">一键推送</el-button>
|
||||
<el-button type="danger" style="margin-left: 20px; margin-top: 10px" @click="handleDelete">删除</el-button>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
@ -71,14 +71,14 @@
|
|||
<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 v-html="scope.row.title" style="max-width: 200px" class="singe-line"></div>
|
||||
<div class="singe-line" style="max-width: 200px" v-html="scope.row.title"></div>
|
||||
</div>
|
||||
<div>
|
||||
<div v-if="scope.row.status == '10'">
|
||||
<el-button text @click="handleWorkTitleEdit(scope.row, scope.$index)" v-hasPermi="['teaching:classwork:edit']">编辑</el-button>
|
||||
<el-button v-hasPermi="['teaching:classwork:edit']" text @click="handleWorkTitleEdit(scope.row, scope.$index)">编辑</el-button>
|
||||
</div>
|
||||
<div v-else>
|
||||
<el-button text @click="handleWorkTitleEdit(scope.row, scope.$index)" v-hasPermi="['teaching:classwork:edit']">查看详情</el-button>
|
||||
<el-button v-hasPermi="['teaching:classwork:edit']" text @click="handleWorkTitleEdit(scope.row, scope.$index)">查看详情</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -112,19 +112,19 @@
|
|||
<el-table-column label="题目内容" align="left" >
|
||||
<template #default="scope">
|
||||
<div>
|
||||
<div v-html="scope.row.titleFormat" style="overflow: hidden; text-overflow: ellipsis; font-weight:700"></div>
|
||||
<div v-html="scope.row.workdescFormat" style="overflow: hidden; text-overflow: ellipsis; margin-top: 6px;"></div>
|
||||
<div style="overflow: hidden; text-overflow: ellipsis; font-weight:700" v-html="scope.row.titleFormat"></div>
|
||||
<div style="overflow: hidden; text-overflow: ellipsis; margin-top: 6px;" v-html="scope.row.workdescFormat"></div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="分值" align="center" width="180">
|
||||
<template #default="scope">
|
||||
<el-input-number v-model="scope.row.score" :min="1" :max="100" :disabled="taskParams.viewkey=='作业反馈'||checkTaskAssigned(currentTask)"></el-input-number >
|
||||
<el-input-number v-model="scope.row.score" :min="1" :max="100" :disabled="checkTaskAssigned(currentWorkEdit.currentTask)"></el-input-number >
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" width="100">
|
||||
<template #default="scope">
|
||||
<el-button @click="handleWorkConfigQuizMinus(scope.$index)" :disabled="taskParams.viewkey=='作业反馈'||checkTaskAssigned(currentTask)">删除</el-button>
|
||||
<el-button :disabled="checkTaskAssigned(currentWorkEdit.currentTask)" @click="handleWorkConfigQuizMinus(scope.$index)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
@ -133,9 +133,9 @@
|
|||
<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"
|
||||
@click="handleWorkEdit2ClassWorkQuizAdd" :disabled="taskParams.viewkey=='作业反馈'||checkTaskAssigned(currentTask)">添加作业</el-button>
|
||||
<el-button type="primary" style="margin-left: auto" @click="submitStudy('submit')"
|
||||
:disabled="taskParams.viewkey=='作业反馈'||checkTaskAssigned(currentTask)">确 定</el-button>
|
||||
: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>
|
||||
|
||||
</div>
|
||||
|
@ -143,10 +143,10 @@
|
|||
|
||||
<!-- 作业说明编辑 -->
|
||||
<el-dialog v-model="currentWorkEdit.workTitleEdit" title="作业说明编辑" width="70%" append-to-body>
|
||||
<el-input v-model="currentTitle" type="textarea" rows="5" placeholder="请输入作业说明" :disabled="taskParams.viewkey=='作业反馈'||checkTaskAssigned(currentTask)"/>
|
||||
<el-input v-model="currentWorkEdit.currentTitle" type="textarea" rows="5" placeholder="请输入作业说明" :disabled="checkTaskAssigned(currentWorkEdit.currentTask)"/>
|
||||
<div slot="footer" class="dialog-footer" style="text-align: right; margin-top: 20px;">
|
||||
<el-button type="primary" @click="submitWorkTitle('submit')"
|
||||
:disabled="taskParams.viewkey=='作业反馈'||checkTaskAssigned(currentTask)">确 定</el-button>
|
||||
<el-button type="primary" :disabled="checkTaskAssigned(currentWorkEdit.currentTask)"
|
||||
@click="submitWorkTitle('submit')">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
|
@ -154,9 +154,12 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onMounted, ref, toRaw,watch, reactive } from 'vue'
|
||||
import { onMounted, ref, toRaw,watch, reactive, getCurrentInstance } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
import ChooseTextbook from '@/components/choose-textbook/index.vue'
|
||||
import { homeworklist, listEntpcoursework, listClassworkeval } from '@/api/teaching/classwork'
|
||||
import { homeworklist, delClasswork } from '@/api/teaching/classwork'
|
||||
import { listEntpcoursework, listClassworkeval,updateClasswork } from '@/api/classTask'
|
||||
|
||||
import { useGetHomework } from '@/hooks/useGetHomework'
|
||||
import { processList } from '@/hooks/useProcessList'
|
||||
|
@ -164,6 +167,7 @@ import { processList } from '@/hooks/useProcessList'
|
|||
import { getCurrentTime } from '@/utils/date'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
const userStore = useUserStore().user
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
const props = defineProps({
|
||||
initDataProps: {
|
||||
|
@ -232,6 +236,30 @@ const getData = (data) => {
|
|||
localStorage.setItem('unitId', JSON.stringify({ levelFirstId, levelSecondId}))
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除按钮操作 TODO 待完善
|
||||
* */
|
||||
const handleDelete =() => {
|
||||
let rows = proxy.$refs.taskTable.getSelectionRows();
|
||||
if (rows.length > 0) {
|
||||
proxy.$modal.confirm('是否确认选中的学习任务?').then(()=> {
|
||||
let ids = [];
|
||||
for (let i = 0; i < rows.length; i++) {
|
||||
ids.push(rows[i].id);
|
||||
}
|
||||
return delClasswork(ids.join(','));
|
||||
}).then(() => {
|
||||
setTimeout(() => {
|
||||
getTaskList();
|
||||
}, 1500);
|
||||
proxy.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {})
|
||||
}else{
|
||||
proxy.$modal.alertWarning("请选择删除项")
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* 1.获取作业列表
|
||||
*/
|
||||
|
@ -422,6 +450,54 @@ const handleWorkEdit = (row, index) =>{
|
|||
}
|
||||
};
|
||||
|
||||
// 作业内容编辑-确认
|
||||
const submitWorkTitle = () => {
|
||||
console.log(taskList.value)
|
||||
console.log(currentWorkEdit)
|
||||
// ? taskList是新组合的,有的变成子项了, 根据currentIndex获取不到,下面判断暂弃!
|
||||
// if (taskList.value[currentWorkEdit.currentIndex].title == currentWorkEdit.currentTitle) {
|
||||
// currentWorkEdit.workTitleEdit = false;
|
||||
// return;
|
||||
// }
|
||||
taskList.value&&taskList.value.forEach((item)=>{
|
||||
if(item.children.length>0){
|
||||
item.children.map(_item=>{
|
||||
if(_item.title == currentWorkEdit.currentTitle){
|
||||
currentWorkEdit.workTitleEdit = false;
|
||||
return;
|
||||
}
|
||||
})
|
||||
}else{
|
||||
if(item.title == currentWorkEdit.currentTitle){
|
||||
currentWorkEdit.workTitleEdit = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log('有更改!')
|
||||
// 有修改时才进行更新
|
||||
taskList.value[currentWorkEdit.currentIndex].title = currentWorkEdit.currentTitle;
|
||||
updateClasswork({id: taskList.value[currentWorkEdit.currentIndex].id, title: currentWorkEdit.currentTitle}).then(response => {
|
||||
ElMessage("修改成功");
|
||||
currentWorkEdit.workTitleEdit = false;
|
||||
//this.getClassWorkAllList();
|
||||
});
|
||||
};
|
||||
|
||||
// 当前是否为已推送作业
|
||||
const checkTaskAssigned = (row) => {
|
||||
console.log(row,'checkTaskAssigned')
|
||||
// 只要有一个taskconfig的id不为0,就是已推送过任务了
|
||||
let bAssigned = false;
|
||||
for (let i=0; i<row.taskconfig.length; i++) {
|
||||
if (row.taskconfig[i].id != 0) {
|
||||
bAssigned = true;
|
||||
return bAssigned;
|
||||
}
|
||||
}
|
||||
return bAssigned;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* 表格子项背景暗调
|
||||
|
|
|
@ -106,10 +106,7 @@ const menuList = [{
|
|||
icon: 'icon-jiaoxuefansi',
|
||||
isOuter: true,
|
||||
path: '/teaching/classtaskassign?titleName=作业布置&openDialog=newClassTask',
|
||||
// path: '/newClassTask'
|
||||
//path: '/classTaskAssign'
|
||||
//isOuter: true,
|
||||
//path: '/teaching/classtaskassign?titleName=作业布置&&openDialog=newClassTask'
|
||||
// path: '/newClassTask',
|
||||
id: '2-1'
|
||||
},
|
||||
{
|
||||
|
@ -117,8 +114,8 @@ const menuList = [{
|
|||
icon: 'icon-xiezuo1',
|
||||
isOuter: true,
|
||||
path: '/teaching/classtaskassign?titleName=作业布置',
|
||||
// path: '/classTaskAssign',
|
||||
id: '2-2'
|
||||
// path: '/classTaskAssign'
|
||||
},
|
||||
{
|
||||
name: '作业批改',
|
||||
|
|
Loading…
Reference in New Issue