瀏覽代碼

Merge branch 'develop3.0-tmd' of http://106.12.23.251:10080/TEAMMODEL/TEAMModelOS into develop3.0-tmd

CrazyIter_Bin 4 年之前
父節點
當前提交
69be2fb2ee

+ 1 - 1
TEAMModelOS.SDK/Models/Cosmos/School/Course.cs

@@ -55,7 +55,7 @@ namespace TEAMModelOS.SDK.Models
     public class Schedule
     {
         public string classId { get; set; }
-        public Teachers teacher { get; set; } = new Teachers();
+        public string teacherId { get; set; }
         public string stulist { get; set; }
         public List<timeInfo> time { get; set; } = new List<timeInfo>();
         public string notice { get; set; }

+ 4 - 1
TEAMModelOS/ClientApp/src/api/courseMgmt.js

@@ -56,14 +56,17 @@ export default {
         return post('/school/teacher/get-teacher-all', data)
     },
     //获取教师标准课程列表 (废弃原来courseManagement)
+    // (课程数据结构调整后校本和个人课程结构相同,用统一的API,此API废弃)
     getSchoolCusMgt: function (data) {
         return post('/school/course/find-course', data)
     },
     //获取教师个人课程列表
+    // (课程数据结构调整后校本和个人课程结构相同,用统一的API,此API废弃)
     getPrivateCusMgt: function (data) {
         return post('/school/course/find-teacher-course', data)
     },
-    //新增/修改个人课程
+    //新增/修改个人课程 
+    // (课程数据结构调整后校本和个人课程结构相同,用统一的API,此API废弃)
     upsertPrivateCus: function (data) {
         return post('/school/course/upsert-teacher-course', data)
     },

+ 19 - 17
TEAMModelOS/ClientApp/src/common/BaseLayout.vue

@@ -109,19 +109,20 @@ export default {
                             role: 'admin',
                             permission: 'classroom-upd|classroom-read'
                         },
-                        {
-                            icon: 'iconfont icon-kecheng',
-                            name: this.$t('system.menu.cusSetting'),
-                            router: '/home/ManageCourse',
-                            tag: 'x',
-                            role: 'admin',
-                            permission: 'course-read|course-upd',
-                        },
+                        //课程设置
+                        // {
+                        //     icon: 'iconfont icon-kecheng',
+                        //     name: this.$t('system.menu.cusSetting'),
+                        //     router: '/home/ManageCourse',
+                        //     tag: 'x',
+                        //     role: 'admin',
+                        //     permission: 'course-read|course-upd',
+                        // },
                         {
                             icon: 'iconfont icon-kecheng',
                             name: '课程管理',
                             router: '/home/NewCusMgt',
-                            tag: '+',
+                            tag: '',
                             role: 'admin',
                             permission: '',
                         },
@@ -133,14 +134,15 @@ export default {
                         //   role:'admin',
                         //   permission:'',
                         //},
-                        {
-                            icon: 'iconfont icon-schedule',
-                            name: this.$t('system.menu.cusPlanMgt'),
-                            router: '/home/NewCoursePlan',
-                            tag: 'x',
-                            role: 'admin',
-                            permission: 'coursePlan-read|coursePlan-upd',
-                        },
+                        // 排课管理
+                        // {
+                        //     icon: 'iconfont icon-schedule',
+                        //     name: this.$t('system.menu.cusPlanMgt'),
+                        //     router: '/home/NewCoursePlan',
+                        //     tag: 'x',
+                        //     role: 'admin',
+                        //     permission: 'coursePlan-read|coursePlan-upd',
+                        // },
                         {
                             icon: 'iconfont icon-auth',
                             name: this.$t('system.menu.authMgt'),

+ 1 - 2
TEAMModelOS/ClientApp/src/view/newcourse/MgtStuList.vue

@@ -76,7 +76,7 @@
             </div>
         </Split>
         <!-- 创建名单 -->
-        <Modal v-model="addStuStatus" :title="$t('cusMgt.addStu')" width="1200" @on-ok="confirmAddStu" class-name="dark-iview-modal" :loading="modalLoading">
+        <Modal v-model="addStuStatus" title="创建自定义名单" width="1200" @on-ok="confirmAddStu" class-name="dark-iview-modal" :loading="modalLoading">
             <div class="dark-iview-input list-name-box">
                 <span>名称:</span>
                 <Input v-model="listName" placeholder="请输入名单名称..." style="width: 300px" />
@@ -178,7 +178,6 @@ export default {
             }
         },
         confirmAddStu() {
-            console.log(this.selections)
             if (!this.listName) {
                 this.$Message.warning('请输入名单名称')
                 this.modalLoading = false

+ 4 - 0
TEAMModelOS/ClientApp/src/view/newcourse/MyCourse.less

@@ -176,4 +176,8 @@
         margin-left: 5px;
         vertical-align: text-top;
     }
+}
+.list-name-box{
+    color: #a5a5a5;
+    margin-bottom: -30px;
 }

+ 155 - 251
TEAMModelOS/ClientApp/src/view/newcourse/MyCourse.vue

@@ -11,14 +11,15 @@
                             <div slot="extra">
                                 <transition name="fade">
                                     <div style="margin-top:5px;">
+                                        <Icon type="md-add" v-show="listType == 'private'" class="add-icon" :title="$t('cusMgt.addCus')" @click="addCusStatus = true" />
                                         <Icon type="md-create" v-show="(listType == 'school' && courseListS.length) || (listType == 'private' && courseListP.length) " class="add-icon" :title="$t('cusMgt.editCus')" @click="editCus()" />
-                                        <Icon type="md-add" v-show="listType == 'private'" class="add-icon" :title="$t('cusMgt.addCus')" @click="showAddCourse()" />
                                         <Icon type="md-trash" v-show="listType == 'private'" class="add-icon" :title="$t('cusMgt.delCus')" @click="delCourse" />
                                     </div>
                                 </transition>
                             </div>
+                            <!-- 标准课程列表 -->
                             <TabPane :label="$t('cusMgt.scCus')" name="school">
-                                <div v-for="(item,index) in courseListS" :key="index" @click="selectCourse(index)" :class="index === curCusIndex ? 'course-list-item block-bg block-bg-active':'course-list-item block-bg'">
+                                <div v-for="(item,index) in courseListShow" :key="index" @click="selectCourse(index)" :class="index === curCusIndex ? 'course-list-item block-bg block-bg-active':'course-list-item block-bg'">
                                     <p class="course-name">
                                         {{item.name}}
                                         <Icon type="ios-information-circle-outline" @click="toggleCusInfo" :title="$t('cusMgt.cusInfo')" />
@@ -32,15 +33,16 @@
                                     <EmptyData :top="150" :textContent="$t('cusMgt.noScCus')"></EmptyData>
                                 </div>
                             </TabPane>
+                            <!-- 个人课程列表 -->
                             <TabPane :label="$t('cusMgt.privCus')" name="private">
-                                <div v-for="(item,index) in courseListP" :key="index" @click="selectCourse(index)" :class="index === curCusIndex ? 'course-list-item block-bg block-bg-active':'course-list-item block-bg'">
+                                <div v-for="(item,index) in courseListShow" :key="index" @click="selectCourse(index)" :class="index === curCusIndex ? 'course-list-item block-bg block-bg-active':'course-list-item block-bg'">
                                     <p class="course-name">
                                         {{item.name}}
                                         <Icon type="ios-information-circle-outline" @click="toggleCusInfo" :title="$t('cusMgt.cusInfo')" />
                                     </p>
                                     <p class="course-code">
                                         <Icon type="md-pricetags" />
-                                        {{item.id}}
+                                        {{item.no}}
                                     </p>
                                 </div>
                                 <div v-if="courseListP.length == 0">
@@ -58,9 +60,9 @@
                         <div class="course-classroom-list-header">
                             <span class="course-classroom-label">{{$t('courseManage.classroom.classroomList')}}</span>
                             <Icon custom="iconfont icon-schedule" v-show="listType == 'school'" class="add-icon" size="16" title="课表模式" />
-                            <Icon type="md-add" v-show="listType == 'private'" class="add-icon" @click="addClassroom()" />
-                            <Icon type="md-create" v-show="listType == 'private'" class="add-icon" @click="editClassStatus = true" />
-                            <Icon type="md-trash" v-show="listType == 'private'" class="add-icon" @click="deleteClass()" />
+                            <Icon type="md-add" v-show="listType == 'private'" class="add-icon" @click="newSlStatus = true" />
+                            <Icon type="md-create" v-show="listType == 'private' && teaClassList.length" class="add-icon" @click="editClassStatus = true" />
+                            <Icon type="md-trash" v-show="listType == 'private' && teaClassList.length" class="add-icon" @click="removeStuList()" />
                         </div>
                         <div class="course-classroom-list-content">
                             <vuescroll>
@@ -77,7 +79,7 @@
                                         <span :class="item.stulist ? 'class-name':'def-class-name'">{{item.stulist ? item.listName : '默认名单'}}</span>
                                     </p>
                                 </div>
-                                <EmptyData v-if="teaClassList.length == 0" :top="160" :textContent="$t('cusMgt.noCusClass')"></EmptyData>
+                                <EmptyData v-if="teaClassList.length == 0" :top="160" textContent="暂无上课名单"></EmptyData>
                             </vuescroll>
                         </div>
                     </div>
@@ -215,19 +217,21 @@
                         <Input v-if="listType == 'school' && courseListS[curCusIndex]" v-model="courseListS[curCusIndex].name" :disabled="true" style="width:100%" :placeholder="$t('cusMgt.cusName')" :clearable="true"></Input>
                         <Input v-else-if="listType == 'private' && courseListP[curCusIndex]" v-model="courseListP[curCusIndex].name" :disabled="baseEditStatus" style="width:100%" :placeholder="$t('cusMgt.cusName')" :clearable="true"></Input>
                     </FormItem>
-                    <FormItem :label="$t('cusMgt.cusCode')" prop="id" class="disabled-iview-select">
+                    <FormItem :label="$t('cusMgt.cusCode')" prop="no" class="disabled-iview-select">
                         <Input v-if="listType == 'school' && courseListS[curCusIndex]" v-model="courseListS[curCusIndex].no" :disabled="true" style="width:100%" :placeholder="$t('cusMgt.cusCode')" :clearable="true"></Input>
-                        <Input v-else-if="listType == 'private' && courseListP[curCusIndex]" v-model="courseListP[curCusIndex].no" :disabled="true" style="width:100%" :placeholder="$t('cusMgt.cusCode')" :clearable="true"></Input>
+                        <Input v-else-if="listType == 'private' && courseListP[curCusIndex]" v-model="courseListP[curCusIndex].no" :disabled="baseEditStatus" style="width:100%" :placeholder="$t('cusMgt.cusCode')" :clearable="true"></Input>
                     </FormItem>
                     <FormItem :label="$t('courseManage.base.courseNotice')">
-                        <div ref="courseNotice" v-show="!baseEditStatus"></div>
+                        <!-- 暂时注释课程公告功能 -->
+                        <span>课程公告暂未处理</span>
+                        <!-- <div ref="courseNotice" v-show="!baseEditStatus"></div>
                         <div v-show="baseEditStatus" style="height:fit-content;color:white;font-size:16px;padding-left:10px;width:100%;">
                             <vuescroll>
                                 <div v-if="listType == 'school' && courseListS[curCusIndex] && checkNotice(courseListS[curCusIndex].notice)" v-html="courseListS[curCusIndex][0].notice" style=""></div>
                                 <div v-else-if="listType == 'private' && courseListP[curCusIndex] && checkNotice(courseListP[curCusIndex].notice)" v-html="courseListP[curCusIndex].notice" style=""></div>
                                 <div v-else style="">{{$t('cusMgt.noNotice')}}</div>
                             </vuescroll>
-                        </div>
+                        </div> -->
                     </FormItem>
                     <FormItem label="">
                         <Button style="width:100%;margin-top:10px;" @click="edNotice">{{baseEditStatus ? $t('cusMgt.edit') : $t('cusMgt.save')}}</Button>
@@ -235,38 +239,23 @@
                 </Form>
             </div>
         </Drawer>
-        <Modal v-model="newPrivateStatus" :title="$t('courseManage.classroom.personalClassroomTitle')" @on-ok="confirmNewClass" class-name="dark-iview-modal dark-iview-form">
-            <Form ref="personalClassroom" :model="privateClass" label-position="top" label-colon>
-                <FormItem :label="$t('cusMgt.className')" prop="name">
-                    <Input v-model="privateClass.name" :placeholder="$t('courseManage.classroom.classroomName')">
-                    </Input>
-                </FormItem>
-                <FormItem :label="$t('courseManage.classroom.invitationCode')" prop="id">
-                    <span style="font-size:18px;color:white;">{{privateClass.id}}</span>
-                </FormItem>
-            </Form>
+        <!-- 创建名单 -->
+        <Modal v-model="newSlStatus" title="创建自定义名单" width="1200" @on-ok="confirmCreateList" class-name="dark-iview-modal" :loading="modalLoading">
+            <div class="dark-iview-input list-name-box">
+                <span>名称:</span>
+                <Input v-model="listName" placeholder="请输入名单名称..." style="width: 300px" />
+            </div>
+            <StudentList @getSelectInfo="(selction)=>{createStuList = selction}"></StudentList>
         </Modal>
-        <!-- 编辑名单信息 -->
-        <!-- <Modal v-model="editClassStatus" :title="$t('cusMgt.editClassInfo')" @on-ok="confirmUpdClass" class-name="dark-iview-modal dark-iview-form">
-            <Form v-if="editClassStatus" ref="personalClassroom" :model="courseListP[curCusIndex].classes[curClassIndex]" label-position="top" label-colon>
-                <FormItem :label="$t('cusMgt.className')" prop="name">
-                    <Input v-model="courseListP[curCusIndex].classes[curClassIndex].name" :placeholder="$t('courseManage.classroom.classroomName')">
-                    </Input>
-                </FormItem>
-                <FormItem :label="$t('courseManage.classroom.invitationCode')" prop="id">
-                    <span style="font-size:18px;color:white;">{{courseListP[curCusIndex].classes[curClassIndex].id}}</span>
-                </FormItem>
-            </Form>
-        </Modal> -->
         <Modal v-model="addCusStatus" :title="$t('cusMgt.addCus')" @on-ok="confirmAddCus" class-name="dark-iview-modal dark-iview-form">
             <Form ref="addCusInfo" :model="addCusInfo" :rules="ruleAddCus">
-                <FormItem prop="courseName" :label="$t('cusMgt.cusName')">
-                    <Input type="text" v-model="addCusInfo.courseName" :placeholder="$t('cusMgt.nameHolder')"></Input>
+                <FormItem prop="name" :label="$t('cusMgt.cusName')">
+                    <Input type="text" v-model="addCusInfo.name" :placeholder="$t('cusMgt.nameHolder')"></Input>
                 </FormItem>
             </Form>
             <Form ref="addCusInfo" :model="addCusInfo" :rules="ruleAddCus">
-                <FormItem prop="courseCode" :label="$t('cusMgt.cusCode')">
-                    <Input type="text" v-model="addCusInfo.courseCode" :placeholder="$t('cusMgt.codeHolder')"></Input>
+                <FormItem prop="no" :label="$t('cusMgt.cusCode')">
+                    <Input type="text" v-model="addCusInfo.no" :placeholder="$t('cusMgt.codeHolder')"></Input>
                 </FormItem>
             </Form>
         </Modal>
@@ -325,6 +314,7 @@ export default {
                     value: 'sl'
                 }
             ],
+            modalLoading: true,
             curAcType: 'ev',
             evList: [],//评测列表
             voteList: [],//投票列表
@@ -333,6 +323,7 @@ export default {
             slList: [],//自主学习
             delSelection: [],
             selections: [],
+            createStuList: [],//创建自定义名单学生列表
             classList: [],
             tableHeight: 100,
             classColumn: [
@@ -401,7 +392,7 @@ export default {
             showQrStatus: false,
             showCusInfo: false,
             listLoading: false,
-            newPrivateStatus: false,
+            newSlStatus: false,
             stuLoading: false,
             selectClassStatus: false,
             listType: 'school',
@@ -413,27 +404,21 @@ export default {
             curClassIndex: 0,
             courseListS: [],
             courseListP: [],
+            courseListShow: [],
             addCusInfo: {
-                courseName: '',
-                courseCode: ''
+                name: '',
+                no: '',
+                id: ''
             },
+            listName: '',
             ruleAddCus: {
-                courseName: [
+                name: [
                     { required: true, message: this.$t('cusMgt.nameHolder'), trigger: 'change' }
                 ],
-                courseCode: [
+                no: [
                     { required: true, validator: validateCode, trigger: 'change' }
                 ]
             },
-            privateClass: {
-                id: '',
-                name: '',
-                notice: ''
-            },
-            sysClass: {
-                id: '',
-                name: ''
-            },
             stuList: []
         }
     },
@@ -441,19 +426,9 @@ export default {
         //获取学生名单
         getStuList() {
             this.tabName = 'stus'
-            let schedule = {}
-            // 获取当前schedule
-            if (this.listType == 'school') {
-                if (this.courseListS[this.curCusIndex] && this.courseListS[this.curCusIndex].schedule && this.courseListS[this.curCusIndex].schedule[this.curClassIndex]) {
-                    schedule = this.courseListS[this.curCusIndex].schedule[this.curClassIndex]
-                }
-            } else if (this.listType == 'private') {
-                if (this.courseListP[this.curCusIndex] && this.courseListP[this.curCusIndex].schedule && this.courseListP[this.curCusIndex].schedule[this.curClassIndex]) {
-                    schedule = this.courseListP[this.curCusIndex].schedule[this.curClassIndex]
-                }
-            }
+            let schedule = this.teaClassList[this.curClassIndex]
             //先判断自定义名单
-            if (schedule.stulist && !schedule.fullStu) {
+            if (schedule && schedule.stulist && !schedule.fullStu) {
                 //TODO 学生id换详细信息
                 this.stuLoading = true
                 this.$api.courseMgmt.findStuSummary({
@@ -481,7 +456,7 @@ export default {
                 return
             }
             //教室默认名单
-            if (schedule.classId && !schedule.students) {
+            if (schedule && schedule.classId && !schedule.students) {
                 //TODO 根据班级id查询学生信息
                 this.findClassStu()
             }
@@ -491,20 +466,15 @@ export default {
             this.stuLoading = true
             let params = {
                 'school_code': this.listType == 'school' ? this.$store.state.userInfo.schoolCode : this.$store.state.userInfo.TEAMModelId,
-                'ids': [this.classList[this.curClassIndex].id],
+                'ids': [this.teaClassList[this.curClassIndex].classId],
                 //school:校本班级 teacher:私人课程校本名单 private:私人课程动态名单
                 'scope': this.listType
             }
             this.$api.schoolSetting.getClassroomStudent(params).then(
                 (res) => {
                     if (!res.error) {
-                        if (res.classrooms.length > 0) {
-                            if (this.listType == 'school') {
-                                this.$set(this.courseListS[this.curCusIndex][this.curClassIndex], 'students', res.classrooms[0].students)
-                            }
-                            else {
-                                this.$set(this.courseListP[this.curCusIndex].classes[this.curClassIndex], 'students', res.classrooms[0].students)
-                            }
+                        if (res.stus.length > 0) {
+                            this.$set(this.courseListShow[this.curCusIndex].schedule[this.curClassIndex], 'students', res.stus[0])
                         }
                     } else {
                         this.$Message.error('API error!')
@@ -576,7 +546,7 @@ export default {
                         })
                         this.evList = res.examInfo
                     } else {
-                        this$Message.error('API ERROR!')
+                        this.$Message.error('API ERROR!')
                     }
                 }
             )
@@ -731,71 +701,18 @@ export default {
                 return true
             }
         },
-        //确认修改班级信息
-        confirmUpdClass() {
-            this.listLoading = true
-            this.courseListP[this.curCusIndex].code = this.$store.state.userInfo.TEAMModelId
-            this.$api.courseMgmt.upsertPrivateCus({
-                course: this.courseListP[this.curCusIndex],
-                option: 'update'
-            }).then(
-                (res) => {
-                    if (!res.error) {
-                        this.$Message.success(this.$t('cusMgt.editOk'))
-                    } else {
-                        this.$Message.error(this.$t('cusMgt.editErr'))
-                    }
-                },
-                (err) => {
-                    this.$Message.error(this.$t('cusMgt.editErr'))
-                }
-            ).finally(() => {
-                this.listLoading = false
-                this.editClassStatus = false
-            })
-        },
-        //删除上课班级
-        deleteClass() {
+        //移除课程名单
+        removeStuList() {
             let _this = this
-            let delClass = this._.cloneDeep(this.classList[this.curClassIndex])
             this.$Modal.confirm({
                 title: this.$t('cusMgt.delClassTitle'),
-                content: `${this.$t('cusMgt.delStuContent')}${this.classList[this.curClassIndex].name}?`,
+                content: `${this.$t('cusMgt.delStuContent')}${this.teaClassList[this.curClassIndex].listName}?`,
                 onOk: function () {
                     _this.listLoading = true
                     let index = _this.curClassIndex
                     _this.curClassIndex = 0
-                    _this.courseListP[_this.curCusIndex].classes.splice(index, 1)
-                    _this.courseListP[_this.curCusIndex].code = _this.$store.state.userInfo.TEAMModelId
-                    _this.$api.courseMgmt.upsertPrivateCus({
-                        course: _this.courseListP[_this.curCusIndex],
-                        option: 'update'
-                    }).then(
-                        (res) => {
-                            if (!res.error) {
-                                //删除个人班级数据
-                                _this.$api.schoolSetting.delClassroom({
-                                    id: delClass.id,
-                                    scope: delClass.scope,
-                                    school_code: _this.$store.state.userInfo.TEAMModelId
-                                }).then(
-                                    res => {
-                                        _this.$Message.success(this.$t('cusMgt.delOk'))
-                                    },
-                                    err => {
-                                        _this.$Message.error(this.$t('cusMgt.delErr'))
-                                    }
-                                )
-                            } else {
-                                _this.$Message.error(this.$t('cusMgt.delErr'))
-                            }
-                        },
-                        (err) => {
-                            _this.$Message.error(this.$t('cusMgt.delErr'))
-                        }
-                    ).finally(() => {
-                        _this.listLoading = false
-                    })
+                    _this.courseListShow[_this.curCusIndex].schedule.splice(index, 1)
+                   _this.updCusInfo()
                 }
             })
         },
@@ -803,57 +720,19 @@ export default {
             this.toggleCusInfo()
             this.edNotice()
         },
-        //保存个人课程
-        saveNotice() {
-            this.listLoading = true
-            this.courseListP[this.curCusIndex].code = this.$store.state.userInfo.TEAMModelId
-            this.$api.courseMgmt.upsertPrivateCus({
-                course: this.courseListP[this.curCusIndex],
-                option: 'update'
-            }).then(
-                (res) => {
-                    if (!res.error) {
-                        this.$Message.success(this.$t('cusMgt.editOk'))
-                    } else {
-                        this.$Message.error(this.$t('cusMgt.editErr'))
-                    }
-                },
-                (err) => {
-                    this.$Message.error(this.$t('cusMgt.editErr'))
-                }
-            ).finally(() => {
-                this.listLoading = false
-                this.baseEditStatus = !this.baseEditStatus
-            })
+        toggleCusInfo() {
+            this.showCusInfo = !this.showCusInfo
         },
         edNotice() {
             if (this.baseEditStatus) {
                 this.baseEditStatus = !this.baseEditStatus
                 this.initEditor()
             } else {
-                if (this.listType == 'private') {
-                    this.saveNotice()
-                } else {
-                    this.baseEditStatus = !this.baseEditStatus
-                    this.courseListS[this.curCusIndex][this.curClassIndex].code = this.$store.state.userInfo.schoolCode
-                    this.$api.courseMgmt.upsertNotice(this.courseListS[this.curCusIndex][this.curClassIndex]).then(
-                        res => {
-                            if (!res.error) {
-                                this.$Message.success(this.$t('cusMgt.saveOk'))
-                            } else {
-                                this.$Message.error(this.$t('cusMgt.saveErr'))
-                            }
-                        },
-                        err => {
-                            this.$Message.error(this.$t('cusMgt.saveErr'))
-                        }
-                    )
-                }
+                this.updCusInfo()
+                this.baseEditStatus = !this.baseEditStatus
             }
         },
-        toggleCusInfo() {
-            this.showCusInfo = !this.showCusInfo
-        },
+        
         //初始化富文本编辑器
         initEditor() {
             if (!this.noticeEditor) {
@@ -911,46 +790,68 @@ export default {
             let cName = this.classList[this.curClassIndex].name
             this.createQRCode(`http://teammodelos-test.chinacloudsites.cn/joinclass?tId=${tId}&cId=${cId}&tName=${tName}&cName=${cName}`)
         },
-
-        //添加上课班级
-        addClassroom() {
-            let randomCode = 'P'
-            for (let i = 0; i < 8; i++) {
-                randomCode += this.$jsFn.getBtwRandom(0, 9)
+        //确认添加自定义名单
+        confirmCreateList() {
+            if (!this.listName) {
+                this.$Message.warning('请输入名单名称')
+                this.modalLoading = false
+                setTimeout(() => {
+                    this.modalLoading = true
+                }, 0)
+            } else {
+                let stuList = {
+                    name: this.listName,
+                    id: this.$tools.guid(),
+                    code: this.$store.state.userInfo.TEAMModelId,
+                    students: this.createStuList.map(item => { //这里没有学生名字, 需要先查看id集合再查学生信息?
+                        return {
+                            id: item.id,
+                            code: item.code //学生所在学校的编码,这里先传当前学校编码,暂无未考虑跨校名单
+                        }
+                    }),
+                    tmids: [],
+                    course: null
+                }
+                this.saveStuList(stuList)
             }
-            this.privateClass.id = randomCode
-            this.newPrivateStatus = true
         },
-        //确认添加上课班级
-        confirmNewClass() {
-            this.privateClass['scope'] = 'private'
-            this.privateClass['code'] = this.$store.state.userInfo.TEAMModelId
-            this.privateClass['teacher'] = {
-                id: this.$store.state.userInfo.TEAMModelId,
-                name: this.$store.state.userInfo.name
+        // 保存名单
+        saveStuList(stuList) {
+            let params = {
+                stuList,
+                scope: "private"
             }
-            this.courseListP[this.curCusIndex].classes.push(this._.cloneDeep(this.privateClass))
-            this.courseListP[this.curCusIndex].code = this.$store.state.userInfo.TEAMModelId
-            this.$api.courseMgmt.upsertPrivateCus({
-                course: this.courseListP[this.curCusIndex],
-                option: 'update'
-            }).then(
-                (res) => {
-                    if (!res.error) {
-                        this.$Message.success(this.$t('cusMgt.saveOk'))
-                    } else {
-                        this.$Message.error(this.$t('cusMgt.saveErr'))
-                    }
+            this.$api.courseMgmt.upsertStulist(params).then(
+                res => {
+                    this.newSlStatus = false
+                    //TODO 添加到当前课程schedule
+                    this.courseListShow[this.curCusIndex].schedule = this.courseListShow[this.curCusIndex].schedule || []
+                    this.courseListShow[this.curCusIndex].schedule.push({
+                        classId: '',
+                        notice: '',
+                        listName: this.listName,
+                        stulist: stuList.id,
+                        teacher: {
+                            id: this.$store.state.userInfo.TEAMModelId,
+                            name: this.$store.state.userInfo.name
+                        },
+                        time:[]
+                    })
+                    this.updCusInfo()
                 },
-                (err) => {
-                    this.$Message.error(this.$t('cusMgt.saveErr'))
+                err => {
+                    this.modalLoading = false
+                    setTimeout(() => {
+                        this.modalLoading = true
+                    }, 0)
                 }
             )
         },
         //课程选项卡点击事件
         tabClick(name) {
             this.curCusIndex = 0
-            this.changeClassroom(0)
+            this.courseListShow = name == 'school' ? this.courseListS : this.courseListP
+            this.selectCourse(0)
         },
         changeClassroom(index) {
             this.curClassIndex = index
@@ -980,15 +881,15 @@ export default {
                 content: `确认删除${this.courseListP[this.curCusIndex].name}吗?`,
                 onOk: () => {
                     this.$api.courseMgmt.deleteCourse({
-                        id: this.courseListP[this.curCusIndex].id,
-                        code: this.$store.state.userInfo.TEAMModelId,
-                        scope: this.courseListP[this.curCusIndex].scope
+                        id: this.courseListShow[this.curCusIndex].id,
+                        code: this.courseListShow[this.curCusIndex].code.replace('Course-', ''),
+                        scope: 'private'
                     }).then(
                         res => {
                             if (!res.error) {
                                 let index = this.curCusIndex
                                 this.curCusIndex = 0
-                                this.courseListP.splice(index, 1)
+                                this.courseListShow.splice(index, 1)
                                 this.$Message.success('删除成功!')
                             } else {
                                 this.$Message.error('删除失败!')
@@ -1004,36 +905,35 @@ export default {
         selectCourse(index) {
             this.curClassIndex = 0
             this.curCusIndex = index
-            if ((this.listType == 'school' && !this.courseListS[this.curCusIndex].schedule) || (this.listType == 'school' && !this.courseListS[this.curCusIndex].schedule)) {
+            if (!this.courseListShow[this.curCusIndex].schedule) {
                 this.getCusInfo()
             } else {
                 this.changeClassroom(0)
             }
         },
-        //添加个人课程
-        showAddCourse() {
-            this.addCusStatus = true
-        },
+        // 新增个人课程
         confirmAddCus() {
             this.$refs['addCusInfo'].validate((valid) => {
                 if (valid) {
                     let requestData = {
                         option: 'insert',
+                        scope: 'private',
                         course: {
-                            name: this.addCusInfo.courseName,
-                            id: this.addCusInfo.courseCode,
+                            name: this.addCusInfo.name,
+                            no: this.addCusInfo.no,
+                            id: this.$tools.guid(),
                             code: this.$store.state.userInfo.TEAMModelId,
-                            classes: [],
+                            schedule: [],
                             scope: 'private'
                         }
                     }
-                    this.$api.courseMgmt.upsertPrivateCus(requestData).then(
+                    this.$api.courseMgmt.saveOrUpdateCourse(requestData).then(
                         (res) => {
                             if (res.error == null) {
-                                this.$Message.success('保存成功!')
+                                this.$Message.success('添加成功!')
                                 this.courseListP.push(requestData.course)
                             } else {
-                                this.$Message.success('保存失败!')
+                                this.$Message.success('添加失败!')
                             }
                         },
                         (err) => {
@@ -1045,6 +945,24 @@ export default {
                 }
             })
         },
+        // 更新个人课程
+        updCusInfo() {
+            this.courseListShow[this.curCusIndex].code = this.courseListShow[this.curCusIndex].code.replace('Course-', '')
+            this.$api.courseMgmt.saveOrUpdateCourse({
+                course: this.courseListShow[this.curCusIndex],
+                option: 'update',
+                scope: this.courseListShow[this.curCusIndex].scope || 'private'
+            }).then(
+                res => {
+                    this.$Message.success('更新成功')
+                    // this.isUpd = false
+                }
+            ).catch(() => {
+                this.$Message.error('更新失败')
+            }).finally(()=>{
+                this.listLoading = false
+            })
+        },
         //获取标准课程列表(调整)
         //获取个人和校本课程列表,API调整后没有进行分开处理
         getCourseList() {
@@ -1063,7 +981,13 @@ export default {
                         this.courseListP = res.courses.filter(item => {
                             return item.scope == 'private'
                         })
-                        // this.selectCourse(0)
+                        //设置当前课程列表
+                        if (this.courseListS.length > 0) {
+                            this.courseListShow = this.courseListS
+                        } else {
+                            this.tabName = 'private'
+                            this.courseListShow = this.courseListP
+                        }
                         this.getCusInfo()
                     } else {
                         this.$Message.error('API ERROR!')
@@ -1088,7 +1012,6 @@ export default {
                     if (!res.error) {
                         if (res.courses && res.courses.length > 0) {
                             res.courses[0].schedule = res.courses[0].schedule ? res.courses[0].schedule : []
-
                             // 获取自定义名单信息
                             let ids = res.courses[0].schedule.map(item => {
                                 return item.stulist
@@ -1135,6 +1058,7 @@ export default {
                         } else {
                             this.$set(this.courseListP, this.curCusIndex, res.courses[0])
                         }
+                        this.changeClassroom(0)
                     }
                 }
             )
@@ -1158,9 +1082,7 @@ export default {
 
         this.$nextTick(() => {
             let dom = document.getElementById('table-height')
-            console.log(dom)
-            console.log(dom.offsetHeight)
-            this.tableHeight = dom.offsetHeight - 60
+            this.tableHeight = dom.offsetHeight - 50
         })
     },
     computed: {
@@ -1174,35 +1096,17 @@ export default {
         },
         //课程名单 —— schedule
         teaClassList() {
-            if (this.listType == 'school') {
-                if (this.courseListS.length > 0 && this.courseListS[this.curCusIndex] && this.courseListS[this.curCusIndex].schedule) {
-                    return this.courseListS[this.curCusIndex].schedule.filter(item => {
-                        return item.teacher.id == this.$store.state.userInfo.TEAMModelId
-                    })
-                } else {
-                    return []
-                }
-            } else if (this.listType == 'private') {
-                if (this.courseListP.length > 0 && this.courseListP[this.curCusIndex] && this.courseListP[this.curCusIndex].schedule) {
-                    return this.courseListP[this.curCusIndex].schedule
-                } else {
-                    return []
-                }
+            if (this.courseListShow.length > 0 && this.courseListShow[this.curCusIndex] && this.courseListShow[this.curCusIndex].schedule) {
+                return this.courseListShow[this.curCusIndex].schedule.filter(item => {
+                    return item.teacher.id == this.$store.state.userInfo.TEAMModelId
+                })
+            } else {
+                return []
             }
         },
         students() {
-            if (this.listType == 'school') {
-                if (this.courseListS[this.curCusIndex] && this.courseListS[this.curCusIndex].schedule && this.courseListS[this.curCusIndex].schedule[this.curClassIndex]) {
-                    return this.courseListS[this.curCusIndex].schedule[this.curClassIndex].students
-                } else {
-                    return []
-                }
-            } else if (this.listType == 'private') {
-                if (this.courseListP[this.curCusIndex] && this.courseListP[this.curCusIndex].schedule && this.courseListP[this.curCusIndex].schedule[this.curClassIndex]) {
-                    return this.courseListP[this.curCusIndex].schedule[this.curClassIndex].students
-                } else {
-                    return []
-                }
+            if (this.courseListShow[this.curCusIndex] && this.courseListShow[this.curCusIndex].schedule && this.courseListShow[this.curCusIndex].schedule[this.curClassIndex]) {
+                return this.courseListShow[this.curCusIndex].schedule[this.curClassIndex].students
             } else {
                 return []
             }

+ 2 - 2
TEAMModelOS/Controllers/Common/ExamController.cs

@@ -276,7 +276,7 @@ namespace TEAMModelOS.Controllers
             try
             {
                 if (!requert.TryGetProperty("code", out JsonElement code)) return BadRequest();
-                var query = $"select c.id,c.name,c.code,c.period,c.startTime,c.endTime,c.stuCount,c.type,c.progress,c.examType,c.createTime, c.subjects, c.grades, c.scope from c ";
+                var query = $"select c.id,c.name,c.code,c.period,c.startTime,c.endTime,c.stuCount,c.type,c.progress,c.examType,c.createTime, c.subjects, c.grades, c.scope,c.targetClassIds from c ";
                 if (requert.TryGetProperty("classIds", out JsonElement classIds)) {
                     List<string> ids = classIds.ToObject<List<string>>();
                     HashSet<string> strs = new HashSet<string>();
@@ -292,7 +292,7 @@ namespace TEAMModelOS.Controllers
                         strs.Add($"array_contains(c.targetClassIds,'{ssr}')");
                     }
                     string ss = string.Join(" or ", strs);
-                    query = $"select c.id,c.name,c.code,c.period,c.startTime,c.endTime,c.stuCount,c.type,c.progress,c.examType,c.createTime, c.subjects, c.grades, c.scope from c where ({ss})";
+                    query = $"select c.id,c.name,c.code,c.period,c.startTime,c.endTime,c.stuCount,c.type,c.progress,c.examType,c.createTime, c.subjects, c.grades, c.scope,c.targetClassIds from c where ({ss})";
                 };
                 var client = _azureCosmos.GetCosmosClient();
                 List<ExamInfo> examInfo = new List<ExamInfo>();                

+ 58 - 96
TEAMModelOS/Controllers/School/ClassRoomController.cs

@@ -396,9 +396,12 @@ namespace TEAMModelOS.Controllers
                 var client = _azureCosmos.GetCosmosClient();
                 List<object> stus = new List<object>();
                 List<string> stuIds = new List<string>();
-                List<(string id, string name, string pic, string code,string classId,string groupId,string groupName,string no)> listStudent = new List<(string id, string name, string pic, string code, string classId, string groupId, string groupName, string no)>();
+                
                 for (int i = 0; i < ids.GetArrayLength(); i++)
                 {
+                    List<object> scList = new List<object>();
+                    List<object> suList = new List<object>();
+                    List<(string id, string name, string pic, string code, string classId, string groupId, string groupName, string no)> listStudent = new List<(string id, string name, string pic, string code, string classId, string groupId, string groupName, string no)>();
                     await foreach (var item in client.GetContainer("TEAMModelOS", "Student").GetItemQueryStreamIterator(
                         queryText: $"select c.id,c.name,c.classId,c.code,c.groupId,c.groupName,c.no,c.picture from c where c.classId = '{ids[i].GetString()}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base-{schoolId}") }))
                     {
@@ -412,15 +415,30 @@ namespace TEAMModelOS.Controllers
                                 stuIds.Add(account.GetProperty("id").GetString());
                                 listStudent.Add((account.GetProperty("id").GetString(),
                                     account.GetProperty("name").GetString(), 
-                                    account.GetProperty("classId").GetString(),
+                                    account.GetProperty("picture").GetString(),
                                     account.GetProperty("code").GetString(), 
-                                    account.GetProperty("groupId").GetString(), 
-                                    account.GetProperty("groupName").GetString(),
-                                    account.GetProperty("no").GetString(), 
-                                    account.GetProperty("picture").GetString()));
+                                    account.GetProperty("classId").GetString(), 
+                                    account.GetProperty("groupId").GetString(),
+                                    account.GetProperty("groupName").GetString(), 
+                                    account.GetProperty("no").GetString()));
                             }
+                            var scinfos = listStudent.Select(o =>
+                                        new
+                                        {
+                                            o.id,
+                                            o.name,
+                                            o.pic,
+                                            o.code,
+                                            o.classId,
+                                            o.groupId,
+                                            o.groupName,
+                                            o.no
+                                        });
+                            scList.AddRange(scinfos);
+                            stus.Add(scList);
                         }
                     }
+                    List<(string id, string code, string stuId)> listStuList = new List<(string id, string code, string stuId)>();
                     if (scope.ToString().Equals("school", StringComparison.OrdinalIgnoreCase))
                     {
                         List<StuList> stuLists = new List<StuList>();
@@ -438,30 +456,29 @@ namespace TEAMModelOS.Controllers
                                     {
                                         if (!stuIds.Contains(stu.id))
                                         {
-                                            listStudent.Add((stu.id,
-                                                    default,
-                                                    default,
+                                            listStuList.Add((stu.id,
                                                     stu.code,
-                                                    default,
-                                                    default,
-                                                    default,
-                                                    default));
+                                                    stuList.id));
                                         }
                                     }
                                     else
                                     {
-                                        listStudent.Add((stu.id,
-                                                    default,
-                                                    default,
+                                        listStuList.Add((stu.id,
                                                     stu.code,
-                                                    default,
-                                                    default,
-                                                    default,
-                                                    default));
+                                                    stuList.id));
                                     }
                                 }
+                                
                             }
-
+                            var infos = listStuList.Select(o =>
+                                        new
+                                        {
+                                            o.id,
+                                            o.code,
+                                            o.stuId
+                                        });
+                            suList.AddRange(infos);
+                            stus.Add(suList);
                         }
                     }
                     else {
@@ -481,97 +498,42 @@ namespace TEAMModelOS.Controllers
                                     {
                                         if (!stuIds.Contains(students.id))
                                         {
-                                            listStudent.Add((students.id,
-                                                default,
-                                                default,
-                                                students.code,
-                                                default,
-                                                default,
-                                                default,
-                                                default));
+                                            listStuList.Add((students.id,
+                                                    students.code,
+                                                    stuList.id));
                                         }
                                     }
                                     else
                                     {
-                                        listStudent.Add((students.id,
-                                                default,
-                                                default,
-                                                students.code,
-                                                default,
-                                                default,
-                                                default,
-                                                default));
+                                        listStuList.Add((students.id,
+                                                    students.code,
+                                                    stuList.id));
                                     }
                                 }
                                 if (stuList.tmids.Count > 0)
                                 {
                                     foreach (string tid in stuList.tmids)
                                     {
-                                        listStudent.Add((tid,
-                                                 default,
-                                                 default,
-                                                 default,
-                                                 default,
-                                                 default,
-                                                 default,
-                                                 default));
+                                        listStuList.Add((tid,
+                                                    default,
+                                                    stuList.id));
                                     }
-                                }
+                                }                               
                             }
-
+                            var infos = listStuList.Select(o =>
+                                       new
+                                       {
+                                           o.id,
+                                           o.code,
+                                           o.stuId
+                                       });
+                            suList.AddRange(infos);
+                            stus.Add(suList);
                         }
                     }
-                 }
-                var infos = listStudent.Select(o =>
-                                        new
-                                        {
-                                            o.id,
-                                            o.name,
-                                            o.pic,
-                                            o.classId,
-                                            o.code,
-                                            o.groupId,
-                                            o.groupName,
-                                            o.no
-                                        });
-                stus.AddRange(infos);
-                /* //ids.Add(id[i].ToJsonString());
-                 info += ids[i].ToJsonString() + ",";*/
 
-                //AzureCosmosQuery cosmosDbQuery = SQLHelper.GetSQL(dict, sql);
-                /*if (scope.ToString().Equals("school", StringComparison.OrdinalIgnoreCase))
-                {
-                    await foreach (var item in client.GetContainer("TEAMModelOS", "School").GetItemQueryStreamIterator(
-                    queryText: $"select c.name,c.id,c.students,c.code from c where c.id in ({info[0..^1]})", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Class-{school_code}") }))
-                    {
-                        using var json = await JsonDocument.ParseAsync(item.ContentStream);
-                        if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
-                        {
-                            foreach (var obj in json.RootElement.GetProperty("Documents").EnumerateArray())
-                            {
-                                classrooms.Add(obj.ToObject<object>());
-                            }
-                        }
-                    }
-                }
-                else
-                {
-                    await foreach (var item in client.GetContainer("TEAMModelOS", "Teacher").GetItemQueryStreamIterator(
-                    queryText: $"select c.name,c.id,c.students,c.code from c where c.id in ({info[0..^1]})", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Class-{school_code}") }))
-                    {
-                        using var json = await JsonDocument.ParseAsync(item.ContentStream);
-                        if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
-                        {
-                            foreach (var obj in json.RootElement.GetProperty("Documents").EnumerateArray())
-                            {
-                                classrooms.Add(obj.ToObject<object>());
-                            }
-                        }
-                    }
-                }*/
+                }               
                 return Ok(new { stus });
-                /*List<Classroom> sc = await _azureCosmos.FindByDict<Classroom>(request);
-                return builder.Data(sc).build();*/
             }
             catch (Exception ex)
             {