lyc-dev #153

Merged
lyc merged 6 commits from lyc-dev into main 2024-08-23 11:22:54 +08:00
4 changed files with 85 additions and 101 deletions
Showing only changes of commit 2279bbb904 - Show all commits

View File

@ -1,6 +1,6 @@
<template>
<el-dialog v-model="model" center top="10vh" width="600px" :show-close="false" append-to-body
style="border-radius: 10px; padding: 10px 15px;">
<el-dialog v-model="model" center top="10vh" width="600px" :show-close="false" destroy-on-close append-to-body
style="border-radius: 10px; padding: 10px 15px">
<template #header>
<div class="homerwork-header flex">
<span>{{ title }}</span>
@ -10,9 +10,9 @@
<div v-loading="setLoading">
<el-form :model="form" label-width="80px" ref="ruleFormRef" :rules="rules">
<el-form-item label="班级" prop="grade">
<el-scrollbar max-height="200px" style="width: 100%;">
<el-tree ref="treeRef" :props="defaultProps" :load="getLoad" node-key="id" :default-expanded-keys="defaultExpandedKeys"
@check="handleCheckChange" lazy show-checkbox />
<el-scrollbar max-height="200px" style="width: 100%">
<el-tree :props="defaultProps" :load="getLoad" node-key="id" highlight-current @check="handleCheckChange"
lazy show-checkbox />
</el-scrollbar>
</el-form-item>
<el-form-item label="选中学生" prop="student">
@ -37,14 +37,11 @@
<el-input-number v-model="form.timelength" :min="1" :max="500" />
</el-form-item>
</el-form>
</div>
<template #footer>
<div class="dialog-footer">
<el-button @click.stop="cloneDialog(ruleFormRef)">取消</el-button>
<el-button type="primary" @click.stop="onSubmit(ruleFormRef)">
确定
</el-button>
<el-button type="primary" @click.stop="onSubmit(ruleFormRef)"> 确定 </el-button>
</div>
</template>
</el-dialog>
@ -58,6 +55,7 @@ import { saveByClassWorkArray } from '@/api/teaching/classwork'
import useUserStore from '@/store/modules/user'
import { uniqBy, groupBy } from 'lodash'
const model = defineModel({ type: Boolean, default: false })
const props = defineProps({
entpcourseid: {
default: ''
@ -71,18 +69,14 @@ const props = defineProps({
}
})
const emit = defineEmits(['on-close', 'on-success'])
const model = defineModel({ type: Boolean, default: false })
const ruleFormRef = ref('')
//
const defaultProps = {
children: 'children',
label: 'label',
isLeaf: 'leaf',
isLeaf: 'leaf'
}
const treeRef = ref(null);
//
const defaultExpandedKeys = ref([])
// loading
const setLoading = ref(false)
//
@ -100,40 +94,37 @@ const form = reactive({
//
const validateGrade = (rule, value, callback) => {
if (studentList.value.length == 0) {
callback(new Error('请勾选班级或者学生'));
}
else {
callback(new Error('请勾选班级或者学生'))
} else {
callback()
}
}
const validateStudent = (rule, value, callback)=>{
const validateStudent = (rule, value, callback) => {
if (studentList.value.length == 0) {
callback(new Error('学生不能为空'));
}
else {
callback(new Error('学生不能为空'))
} else {
callback()
}
}
const rules = reactive({
grade: [
{ validator: validateGrade, trigger: 'blur' }
],
student: [
{ validator: validateStudent, trigger: 'blur' }
]
grade: [{ validator: validateGrade, trigger: 'blur' }],
student: [{ validator: validateStudent, trigger: 'blur' }]
})
//
const getGradeList = async ()=> {
let { rows } = await listClassmain({ classuserid: userInfo.userId, pageSize: 100, status: 'open' })
rows.forEach(item => {
const getGradeList = async () => {
let { rows } = await listClassmain({
classuserid: userInfo.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 => {
item.classstudentlist = JSON.parse('[' + item.classstudentlist + ']')
item.classstudentlist.forEach((el) => {
el.classId = item.id
})
})
@ -148,14 +139,14 @@ const getLoad = async (node, resolve) => {
}
//
if (node.level == 1) {
listClassgroup({ classid: node.key, orderby: 'orderidx', pageSize: 100 }).then(res => {
listClassgroup({ classid: node.key, orderby: 'orderidx', pageSize: 100 }).then((res) => {
if (res.rows.length > 0) {
let ary = []
res.rows.forEach(item => {
res.rows.forEach((item) => {
if (item.parentid === 0) {
//studentGroup
let studentGroup = JSON.parse("[" + item.studentlist + "]")
studentGroup.forEach(el => {
let studentGroup = JSON.parse('[' + item.studentlist + ']')
studentGroup.forEach((el) => {
el.label = el.name
el.leaf = true
el.level = 2
@ -173,11 +164,10 @@ const getLoad = async (node, resolve) => {
}
})
resolve(ary)
}
else {
} else {
//
let students = node.data.classstudentlist
students.forEach(item =>{
students.forEach((item) => {
item.label = item.name
item.level = 2
item.leaf = true
@ -190,22 +180,21 @@ const getLoad = async (node, resolve) => {
if (node.level == 2) {
resolve(node.data.children)
}
}
//
const handleCheckChange = (data, checked)=> {
const handleCheckChange = (data, checked) => {
studentList.value = []
//
let checkNodes = checked.checkedNodes
let ary = []
checkNodes.forEach(item => {
checkNodes.forEach((item) => {
//
if (item.level == 0) {
ary = [...ary, ...(item.classstudentlist)]
ary = [...ary, ...item.classstudentlist]
}
//
if (item.level == 1) {
ary = [...ary, ...(item.children)]
ary = [...ary, ...item.children]
}
//
if (item.level == 2) {
@ -219,9 +208,9 @@ const delStudent = (index) => {
studentList.value.splice(index, 1)
}
const onSubmit = (formEl)=> {
if(!formEl) return
formEl.validate(valid => {
const onSubmit = (formEl) => {
if (!formEl) return
formEl.validate((valid) => {
if (valid) {
/**
* 根据学生列表中的classId分班
@ -240,16 +229,16 @@ const onSubmit = (formEl)=> {
entpcourseid: props.entpcourseid,
studentlist: JSON.stringify(gradeObj[value]),
feedback: form.feedback,
workkey: "",
workkey: '',
timelength: form.timelength,
weights: 1,
deaddate: form.deaddate,
workdate: getCurrentDate(),
uniquekey: props.row.uniquekey,
entpcourseworklist: "[" + props.row.entpcourseworklist + "]",
entpcourseworklist: '[' + props.row.entpcourseworklist + ']',
needMsgNotifine: 'false',
msgkey: 'newclasswork',
title: "作业任务",
title: '作业任务',
msgcontent: '',
teachername: userInfo.nickName,
unixstamp: new Date().getTime(),
@ -260,12 +249,14 @@ const onSubmit = (formEl)=> {
setLoading.value = true
saveByClassWorkArray({
classworkarray: JSON.stringify(ary)
}).then(() => {
})
.then(() => {
setLoading.value = false
ElMessage.success('操作成功')
emit('on-success')
cloneDialog(formEl)
}).catch(()=>{
})
.catch(() => {
setLoading.value = false
})
} else {
@ -274,30 +265,32 @@ const onSubmit = (formEl)=> {
})
}
const expandedKeys = ref([])
const checkedKeys = ref([])
//
const cloneDialog = (formEl)=> {
const cloneDialog = (formEl) => {
studentList.value = []
treeRef.value.setCheckedKeys([])
defaultExpandedKeys.value = []
checkedKeys.value = []
expandedKeys.value = []
formEl.resetFields()
model.value = false
}
//
const getCurrentDate = ()=> {
const now = new Date();
const year = now.getFullYear();
let month = now.getMonth() + 1; // 0+1
const getCurrentDate = () => {
const now = new Date()
const year = now.getFullYear()
let month = now.getMonth() + 1 // 0+1
let day = now.getDate()
if(month < 10){
if (month < 10) {
month = '0' + month
}
if(day < 10){
if (day < 10) {
day = '0' + day
}
return `${year}-${month}-${day}`;
return `${year}-${month}-${day}`
}
onMounted(()=>{
onMounted(() => {
//
form.deaddate = getCurrentDate() + ' ' + '10:00:00'
})
@ -313,19 +306,18 @@ onMounted(()=>{
font-size: 20px;
cursor: pointer;
}
}
.el-tag {
margin-right: 10px;
margin-bottom: 10px;
}
.dialog-footer{
padding-bottom: 10px
.dialog-footer {
padding-bottom: 10px;
}
:deep(.el-checkbox){
transform : scale(1.3)
:deep(.el-checkbox) {
transform: scale(1.3);
}
</style>

View File

@ -114,7 +114,6 @@
v-model="setDialog"
:entpcourseid="entpcourseid"
:row="row"
@on-close="closeHomework"
/>
</div>
<reserv
@ -143,7 +142,7 @@ import { toTimeText } from '@/utils/date'
import { ElMessage } from 'element-plus'
import { parseCataByNode, creatPPT, asyncLocalFile } from '@/utils/talkFile'
import FileOperBatch from '@/views/prepare/container/file-oper-batch.vue'
import SetHomework from './container/set-homework.vue'
import SetHomework from '@/components/set-homework/index.vue'
import outLink from '@/utils/linkConfig'
import { createWindow } from '@/utils/tool'
import { cloneDeep } from 'lodash'
@ -487,10 +486,6 @@ export default {
this.isLoading = false
})
},
closeHomework() {
this.setDialog = false
},
// PDF-
async navtoPdf() {
// if (toolStore.isPdfWin) return this.$message.error('')

View File

@ -51,7 +51,7 @@
</el-scrollbar>
</div>
<SetHomework v-model="setDialog" :title="'推送作业'" :entpcourseid="entpcourseid" :row="curRow"
@on-close="closeHomework" />
@on-close="closeHomework" @on-success="successHomework"/>
</div>
<div class="homework flex" v-else>
<div class="unit-top flex">
@ -73,13 +73,12 @@
import { ref, onMounted, toRaw } from 'vue';
import { useRoute } from 'vue-router';
import useUserStore from '@/store/modules/user'
import { getSmarttalkPage, getPrepareById } from '@/api/file'
import SetHomework from '@/views/prepare/container/set-homework.vue'
import { getSmarttalkPage } from '@/api/file'
import SetHomework from '@/components/set-homework/index.vue'
import FileImage from '@/components/file-image/index.vue'
import { useGetHomework } from '@/hooks/useGetHomework'
import { ipcMsgSend, ipcMsgInvoke } from '@/utils/tool'
import { useToolState } from '@/store/modules/tool'
import { asyncLocalFile } from '@/utils/talkFile'
import Lesson from './lesson.vue';
import { parseCataByNode } from '@/utils/talkFile'
import outLink from '@/utils/linkConfig'
@ -97,11 +96,9 @@ const dataList = ref([])
const setDialog = ref(false)
//
const resourceList = ref([])
//
//
const curRow = ref('')
const sendHomework = (row) => {
curRow.value = row
setTimeout(() => {
@ -112,12 +109,13 @@ const sendHomework = (row) => {
//
const closeHomework = async() => {
ipcMsgSend('tool-sphere:set:ignore', true)
// im-(app|)
await ipcMsgInvoke('im-chat:msg', curRow.value.id, MsgEnum.HEADS.MSG_0016)
setDialog.value = false
}
//
const successHomework = ()=>{
// im-(app|)
ipcMsgInvoke('im-chat:msg', curRow.value.id, MsgEnum.HEADS.MSG_0016)
}
// change
const changeChapter = async (data)=>{
const { res } = await useGetHomework(data)
dataList.value = res

View File

@ -13,9 +13,8 @@
</template>
<script setup>
import { ref, onMounted, nextTick, markRaw, toRaw } from 'vue'
import { ref, onMounted, nextTick, toRaw } from 'vue'
import { useToolState } from '@/store/modules/tool'
import { parseCataByNode } from '@/utils/talkFile'
const emit = defineEmits(['changeChapter'])
const toolStore = useToolState()