zhouj1203@hotmail.com 4 年 前
コミット
aeef0c36e5

+ 67 - 1
TEAMModelOS.SDK/Module/AzureCosmosDBV3/AzureCosmosDBV3Repository.cs

@@ -288,7 +288,7 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
         {
             CosmosModelInfo container = await InitializeCollection<T>();
             list.ForEach(x => { x.ttl = ttl; });
-            list = await SaveOrUpdateAll(list);
+            list = await DeleteTTlALL(list);
             if (container.cache && RedisHelper.Instance != null)
             {
                 list.ForEach(async x => {
@@ -297,7 +297,67 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
             }
             return list;
         }
+        private async Task<List<T>> DeleteTTlALL<T>(List<T> enyites) where T : ID
+        {
+            //await Task.Run(() => Parallel.ForEach(entities, new ParallelOptions { MaxDegreeOfParallelism = 2 }, (item) =>
+            //{
+            //    Task.WaitAll(Update(item));
+            //}));
 
+            int pages = (int)Math.Ceiling((double)enyites.Count / pageSize);
+            CosmosModelInfo container = await InitializeCollection<T>();
+            bool flag = false;
+            if (RedisHelper.Exists(CacheCosmosPrefix + container.container.Id))
+            {
+                flag = true;
+            }
+            string partitionKey = GetPartitionKey<T>();
+            Type type = typeof(T);
+            Stopwatch stopwatch = Stopwatch.StartNew();
+            for (int i = 0; i < pages; i++)
+            {
+                List<T> lists = enyites.Skip((i) * pageSize).Take(pageSize).ToList();
+                List<KeyValuePair<PartitionKey, Stream>> itemsToInsert = new List<KeyValuePair<PartitionKey, Stream>>();
+                lists.ForEach(async x =>
+                {
+                    x.pk = type.Name;
+                    //x.ttl = null;
+                    MemoryStream stream = new MemoryStream();
+                    await JsonSerializer.SerializeAsync(stream, x, new JsonSerializerOptions { IgnoreNullValues = true });
+                    object o = type.GetProperty(partitionKey).GetValue(x, null);
+                    KeyValuePair<PartitionKey, Stream> keyValue = new KeyValuePair<PartitionKey, Stream>(new PartitionKey(o.ToString()), stream);
+                    itemsToInsert.Add(keyValue);
+                });
+                List<Task> tasks = new List<Task>(lists.Count);
+                itemsToInsert.ForEach(item =>
+                {
+                    tasks.Add(container.container.UpsertItemStreamAsync(item.Value, item.Key)
+                        .ContinueWith((Task<ResponseMessage> task) =>
+                        {
+                            //using (ResponseMessage response = task.Result)
+                            //{
+                            //    if (!response.IsSuccessStatusCode)
+                            //    {
+                            //    }
+                            //}
+                        }
+                        ));
+                });
+                await Task.WhenAll(tasks);
+                if (container.cache && RedisHelper.Instance != null)
+                {
+                    lists.ForEach(async x => {
+                        await RedisHelper.HSetAsync(CacheCosmosPrefix + container.container.Id, x.id, x);
+                    });
+                }
+            }
+            if (container.cache && RedisHelper.Instance != null && !flag)
+            {
+                await RedisHelper.ExpireAsync(CacheCosmosPrefix + container.container.Id, timeoutSeconds);
+            }
+            stopwatch.Stop();
+            return enyites;
+        }
 
         public async Task<List<IdPk>> DeleteAll<T>(List<IdPk> ids) where T : ID
         {
@@ -750,6 +810,7 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
             {
                 CosmosModelInfo container = await InitializeCollection<T>();
                 entity.pk = container.type.Name;
+                entity.ttl = null;
                 ItemResponse<T> response = await container.container.CreateItemAsync<T>(entity);
                 if (container.cache && RedisHelper.Instance != null)
                 {
@@ -791,6 +852,7 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
                 lists.ForEach(async x =>
                 {
                     x.pk = type.Name;
+                    x.ttl = null;
                     MemoryStream stream = new MemoryStream();
                     await JsonSerializer.SerializeAsync(stream, x, new JsonSerializerOptions { IgnoreNullValues = true });
                     object o = type.GetProperty(partitionKey).GetValue(x, null);
@@ -831,6 +893,7 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
         {
             CosmosModelInfo container = await InitializeCollection<T>();
             entity.pk = container.type.Name;
+            entity.ttl = null;
             ItemResponse<T> response = await container.container.UpsertItemAsync(item: entity);
             if (container.cache && RedisHelper.Instance != null)
             {
@@ -870,6 +933,7 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
                 lists.ForEach(async x =>
                 {
                     x.pk = type.Name;
+                    x.ttl = null;
                     MemoryStream stream = new MemoryStream();
                     await JsonSerializer.SerializeAsync(stream, x, new JsonSerializerOptions { IgnoreNullValues = true });
                      object o = type.GetProperty(partitionKey).GetValue(x, null);
@@ -912,6 +976,7 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
             string partitionKey = GetPartitionKey<T>();
             Type type = typeof(T);
             entity.pk = type.Name;
+            entity.ttl = null;
             object o = type.GetProperty(partitionKey).GetValue(entity, null);
             ItemResponse<T> response = await container.container.ReplaceItemAsync(entity, entity.id, new PartitionKey(o.ToString()));
             if (container.cache && RedisHelper.Instance != null)
@@ -958,6 +1023,7 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
                 lists.ForEach(async x =>
                 {
                     x.pk = type.Name;
+                    x.ttl = null;
                     MemoryStream stream = new MemoryStream();
                     await JsonSerializer.SerializeAsync(stream, x, new JsonSerializerOptions { IgnoreNullValues = true });
                     object o = type.GetProperty(partitionKey).GetValue(x, null);

+ 8 - 2
TEAMModelOS.Service/Models/SchoolInfo/Survey.cs

@@ -51,8 +51,8 @@ namespace TEAMModelOS.Service.Models
         [ProtoMember(7)]
         public long endTime { get; set; }
         public long createTime { get; set; } // 问卷发布时间
-        public List<Item> items{ get; set; }
-      
+        public List<Item> items { get; set; }
+
     }
     public class Item {
         public string stem { get; set; }
@@ -64,5 +64,11 @@ namespace TEAMModelOS.Service.Models
         public int order { get; set; }
         public string description { get; set; } = null;
         public List<CodeValue> options { get; set; }
+        public List<CodeVal> result { get; set; }
+    }
+
+    public class CodeVal{
+        public string code { get; set; }
+        public int value { get; set; }
     }
 }

+ 4 - 0
TEAMModelOS.Service/Models/TeacherInfo/CoursePlan.cs

@@ -38,6 +38,10 @@ namespace TEAMModelOS.Service.Models
         /// 助教
         /// </summary>
         public List<Assistant> assistant { get; set; }
+        /// <summary>
+        /// 学期代码
+        /// </summary>
+        public string semesterCode { get; set; }
     }
 
     public class Assistant { 

+ 5 - 0
TEAMModelOS/ClientApp/src/api/index.js

@@ -109,6 +109,11 @@ export default {
         return post('api/school/GetAllSchool', data)
     },
 
+    // 取得所有學校(只取基本資料)
+    GetAllSchoolBaesInfo: function (data) {
+        return post('/api/School/GetAllSchoolBaesInfo', data)
+    },
+
     // 根据条件获取学段
     FindPeriodsByDict: function (data) {
         return post('api/period/FindPeriodsByDict', data)

+ 1 - 2
TEAMModelOS/ClientApp/src/common/ImportExcel.vue

@@ -54,7 +54,6 @@
                         key: this.headerKeys[index]
                     }
                 })
-                console.log(this.tableColumn)
             },
             //获取上传的文件
             handleBeforeUpload(file) {
@@ -101,7 +100,7 @@
                     if (flag) {
                         // 处理表格导入数据类型
                         this.tableData = [...results]
-                        this.$Message.info('导入成功')
+                        //this.$Message.info('文件读取成功')
                         this.tableLoading = false
                         this.$emit('getTableData', this.tableData)
                     } else {

+ 12 - 130
TEAMModelOS/ClientApp/src/components/app-root.vue

@@ -11,143 +11,25 @@
         components: {
             'nav-menu': NavMenu,
         },
+        provide () {    //父组件中通过provide来提供变量,在子组件中通过inject来注入变量。                                             
+            return {
+                reload: this.reload                                              
+            }
+        },
         methods: {
-            
-            /**设置用户角色权限 */
-            // setUser(roleCode) {
-            //     console.log(typeof roleCode)
-            //     this.$access.reset()
-            //     switch (roleCode) {
-            //         case '0':
-            //             this.$access.setLoginUserInfo(this.adminRole)
-            //             this.$router.push({
-            //                 name:'totalIndex'
-            //             })
-            //             break
-            //         case '1':
-            //             this.$access.setLoginUserInfo(this.teacherRole)
-            //             this.$router.push({
-            //                 name:'courseManage'
-            //             })
-            //             break
-            //         case '2':
-            //             this.$access.setLoginUserInfo(this.teacherAnalysis)
-            //             this.$router.push({
-            //                 name:'totalIndex'
-            //             })
-            //             break
-            //         case '3':
-            //             this.$access.setLoginUserInfo(this.teacherContent)
-            //             this.$router.push({
-            //                 name:'courseManage'
-            //             })
-            //             break
-            //         case '4':
-            //             this.$access.setLoginUserInfo(this.teacherSyllabus)
-            //             this.$router.push({
-            //                 name:'courseManage'
-            //             })
-            //             break
-            //         case '5':
-            //             this.$access.setLoginUserInfo(this.teacherSchoolSettingRead)
-            //             this.$router.push({
-            //                 name:'system'
-            //             })
-            //             break
-            //         case '6':
-            //             this.$access.setLoginUserInfo(this.teacherSchoolSettingUpd)
-            //             this.$router.push({
-            //                 name:'system'
-            //             })
-            //             break
-            //         case '7':
-            //             this.$access.setLoginUserInfo(this.teacherStudentRead)
-            //             this.$router.push({
-            //                 name:'studentAccount'
-            //             })
-            //             break
-            //         case '8':
-            //             this.$access.setLoginUserInfo(this.teacherStudentUpd)
-            //             this.$router.push({
-            //                 name:'studentAccount'
-            //             })
-            //             break
-            //         default:
-            //             this.$access.setLoginUserInfo(this.adminRole)
-            //             localStorage.setItem('roleCode',0)
-            //             break
-            //     }
-            // },
+            reload() {
+                this.isRouterAlive = false
+                this.$nextTick(function () {
+                    this.isRouterAlive = true
+                })
+            }
         },
         data() {
             return {
-                // //管理员
-                // adminRole: {
-                //     "userId": "boDH1#1856",
-                //     "roles": ["admin"],
-                //     "permissions": [],
-                //     "isLogin": true
-                // },
-                // //教师
-                // teacherRole: {
-                //     "userId": "boDH1#1856",
-                //     "roles": ["teacher"],
-                //     "permissions": [],
-                //     "isLogin": true
-                // },
-                // //可以编辑校本资源的老师
-                // teacherContent: {
-                //     "userId": "boDH1#1856",
-                //     "roles": ["teacher"],
-                //     "permissions": ['content-school-upd'],
-                //     "isLogin": true
-                // },
-                // //可以查看学情的教师
-                // teacherAnalysis: {
-                //     "userId": "boDH1#1856",
-                //     "roles": ["teacher"],
-                //     "permissions": ['analysis'],
-                //     "isLogin": true
-                // },
-                // //可以编辑校本课纲的老师
-                // teacherSyllabus: {
-                //     "userId": "boDH1#1856",
-                //     "roles": ["teacher"],
-                //     "permissions": ['school_syllabus'],
-                //     "isLogin": true
-                // },
-                // //可以查看区班校的老师
-                // teacherSchoolSettingRead: {
-                //     "userId": "boDH1#1856",
-                //     "roles": ["teacher"],
-                //     "permissions": ['schoolSetting-read'],
-                //     "isLogin": true
-                // },
-                // //可以编辑区班校的老师
-                // teacherSchoolSettingUpd: {
-                //     "userId": "boDH1#1856",
-                //     "roles": ["teacher"],
-                //     "permissions": ['schoolSetting-upd'],
-                //     "isLogin": true
-                // },
-                // //可以编辑学生账号的老师
-                // teacherStudentRead: {
-                //     "userId": "boDH1#1856",
-                //     "roles": ["teacher"],
-                //     "permissions": ['student-read'],
-                //     "isLogin": true
-                // },
-                // //可以编辑学生账号的老师
-                // teacherStudentUpd: {
-                //     "userId": "boDH1#1856",
-                //     "roles": ["teacher"],
-                //     "permissions": ['student-upd'],
-                //     "isLogin": true
-                // }
+                isRouterAlive:true
             }
         },
         created() {
-            // this.setUser(localStorage.getItem('roleCode'))
         }
     }
 </script>

+ 4 - 0
TEAMModelOS/ClientApp/src/components/learnactivity/BaseHwTable.less

@@ -144,6 +144,10 @@
         .ivu-input-wrapper {
             width: 60%;
         }
+		
+		textarea{
+			padding-left: 10px;
+		}
 
 
         .ivu-input, .ivu-input-number, .ivu-input-number-input {

+ 34 - 27
TEAMModelOS/ClientApp/src/components/learnactivity/BaseHwTable.vue

@@ -20,7 +20,7 @@
                     <div class="used-comments">
                         <p>常用评语</p>
                         <Select v-model="currentUsedComment" @on-change="onUsedCommentChange">
-                            <Option v-for="(item,index) in usedCommentList" :value="index" :key="index">{{ item.comment }}</Option>
+                            <Option v-for="(item,index) in usedCommentList" :value="index" :key="index">{{ item }}</Option>
                         </Select>
                     </div>
 
@@ -103,7 +103,7 @@
     import EmptyBox from '@/common/EmptyData'
     import BasePackage from '@/common/BasePackage'
     export default {
-        props: ['studentsList'],
+        props: ['studentsList','hwId'],
         components: { BasePackage , EmptyBox },
         data() {
             return {
@@ -161,10 +161,10 @@
                         filters: [],
                         filterMultiple: false,
                         filterMethod (val, row) {
-                            return row.classroom.code === val
+                            return row.classroomName === val
                         },
                         render: (h, params) => {
-                            return h('span', params.row.classroom.name)
+                            return h('span', params.row.classroomName)
                         },
                     },
                     {
@@ -200,10 +200,10 @@
                         width: 80,
                         render: (h, params) => {
                             let that = this
-                            return params.row.score > 0 ?
+                            return params.row.submissionBool  ?
                                 h('span', {
                                     domProps: {
-                                        title: '下载作业'
+                                        title: '评分'
                                     },
                                     style: {
                                         cursor: 'pointer',
@@ -215,6 +215,7 @@
                                             that.currentStudent = params.row
                                             that.currentScore = params.row.score
                                             that.currentComment = params.row.teacherComments ? params.row.teacherComments.comment : ''
+											that.getLatestComments()
                                             that.setScoreModal = true
                                         }
                                     },
@@ -232,10 +233,7 @@
                                     },
                                     on: {
                                         click: function () {
-                                            that.currentStudent = params.row
-                                            that.currentScore = params.row.score
-                                            that.currentComment = params.row.teacherComments ? params.row.teacherComments.comment : ''
-                                            that.setScoreModal = true
+                                            that.$Message.warning('暂未提交作业!无法进行评分!')
                                         }
                                     },
                                 })
@@ -260,6 +258,7 @@
                                         that.currentStudent = params.row
                                         that.currentScore = params.row.score
                                         that.currentComment = params.row.teacherComments ? params.row.teacherComments.comment : ''
+										that.getLatestComments()
                                         that.setScoreModal = true
                                     }
                                 },
@@ -344,7 +343,6 @@
              * @param list
              */
             onFileSelectChange(list) {
-                console.log(list)
                 this.downloadList = list.map(item => item.blobUrl)
             },
 
@@ -370,7 +368,7 @@
              * @param val
              */
             onUsedCommentChange(val) {
-                this.currentComment = this.usedCommentList.length && val !== undefined  ? this.usedCommentList[val].comment : ''
+                this.currentComment = this.usedCommentList.length && val !== undefined  ? this.usedCommentList[val] : ''
             },
 
             /**
@@ -390,8 +388,8 @@
 
 
                     let scoreParams = {
-                        id: this.currentStudent.id,
-                        homeWorkId: this.currentStudent.homeWorkId,
+                        studentId: this.currentStudent.code,
+                        homeWorkId: this.hwId,
                         TEAMModelId: this.userInfo.TEAMModelId,
                         score: this.currentScore,
                         comments: this.currentComment
@@ -404,15 +402,18 @@
                         }
 
                         this.onSaveComment(params).then(res => {
-                            this.usedCommentList = res[0].comment
+                            this.usedCommentList = res.result.data.comment
                             this.$Message.success('保存成功')
                         })
                     }
 
                     /* 同时发送评分以及评语请求 */
                     this.onApiScore(scoreParams).then(res => {
-                        let curIndex = this.tableData.map(item => item.id).indexOf(this.currentStudent.id)
-                        this.$set(this.tableData, curIndex, res)
+						this.currentStudent.score = res.score
+						this.currentStudent.teacherComments = res.tchCmt
+                        let curIndex = this.tableData.map(item => item.code).indexOf(this.currentStudent.code)
+						// 打分之后 更新最新的 分数以及评语
+                        this.$set(this.tableData, curIndex, this.currentStudent)
                         this.$Message.success('点评成功!')
                         this.isScoreLoading = false
                         this.setScoreModal = false
@@ -485,13 +486,19 @@
                     }
                 )
             },
+			
+			// 获取教师最新的常用评语
+			getLatestComments(){
+				this.currentUsedComment = null
+				this.findTeacherComments(this.$store.state.userInfo.TEAMModelId).then(res => {
+				    this.usedCommentList = res.length ? res[0].comment : []
+				})
+			}
 
         },
 
         mounted() {
-            this.findTeacherComments(this.$store.state.userInfo.TEAMModelId).then(res => {
-                this.usedCommentList = res.length ? res[0].comment : []
-            })
+            this.getLatestComments()
         },
         watch: {
             studentsList: {
@@ -499,15 +506,15 @@
                     /** 编辑回显 */
                     if (newValue) {
                         this.tableData = newValue
-
+						console.log(newValue)
                         this.filterData = []
-                        let list = newValue.map(item => item.classroom)
+                        let list = newValue.map(item => item.classroomName)
                         list.forEach(i => {
-                            if (this.filterData.map(j => j.value).indexOf(i.code) === -1) {
-                                this.filterData.push({
-                                    value: i.code,
-                                    label:i.name
-                                })
+                            if (this.filterData.map(j => j.value).indexOf(i) === -1) {
+                                this.filterData.push({ 
+									value :i,
+									label :i
+								})
                             }
                         })
                         this.columns[2].filters = this.filterData

+ 2 - 2
TEAMModelOS/ClientApp/src/components/questionnaire/BaseQnBar.vue

@@ -43,14 +43,14 @@
                     },
                     xAxis: [{
                         type: 'category',
-                        data: data.map(item => item.option),
+                        data: data.map(item => item.code),
                         axisTick: {
                             show: false
                         },
                         axisLabel: {
                             show: true,
                             textStyle: {
-                                color: "#B0ABAB",
+                                color: "#6d6a6a",
                             }
                         },
                     }],

+ 2 - 15
TEAMModelOS/ClientApp/src/components/questionnaire/BaseQnForm.vue

@@ -161,24 +161,11 @@
 							/** 替换问卷对象格式 */
 							this.qnForm.target.forEach(item => {
 								target.push({
-									classroomCode: item,
-									classroomName: this.classRooms.filter(i => i.classroomCode === item)[0].classroomName
+									classroomCode: item.classroomCode,
+									classroomName: this.classRooms.filter(i => i.classroomCode === item.classroomCode)[0].classroomName
 								})
 							})
 							params.target = target
-							// this.isBtnLoading = true
-							// this.saveorUpdataQn({
-							// 	survey: params,
-							// 	reset: false
-							// }).then(res => {
-							// 	this.$Message.success((this.isEdit && this.editInfo.id) ? '修改成功!' : '添加成功!')
-							// 	this.qnFormEdit = false
-							// 	this.$emit('onAddSuccess')
-							// 	this.isBtnLoading = false
-							// }).catch(error => {
-							// 	console.log(error)
-							// 	this.isBtnLoading = false
-							// })
 							resolve(params)
 						} else {
 							this.$Message.error('请将信息填写完整')

+ 5 - 3
TEAMModelOS/ClientApp/src/components/questionnaire/BaseQuestionnaire.vue

@@ -50,9 +50,9 @@
 						<!-- 数据分析 -->
 						<transition name="indexFade">
 						      <div v-show="curIndexList.includes(index)">
-								  <BaseQnBar :barId="'bar' + index" :barData="item.result" v-if="curIndexList.includes(index)&& (item.type === 'Single' || item.type ==='Multiple')"></BaseQnBar>
+								  <BaseQnBar :barId="'bar' + index" :barData="item.result || []" v-if="curIndexList.includes(index) && (item.type === 'Single' || item.type ==='Multiple')"></BaseQnBar>
 							  </div>
-						    </transition>
+						</transition>
 						<!-- 工具栏 -->
 						<div class="qn-tools">
 							<div class="qn-tools-item" @click="onItemEdit(item,index)">
@@ -63,7 +63,7 @@
 								<Icon type="md-trash" />
 								<span>移除</span>
 							</div>
-							<div class="qn-tools-item" @click="onItemAnalysis(index)" v-if="editItem.status === 0 && (item.type === 'Single' || item.type ==='Multiple')">
+							<div class="qn-tools-item" @click="onItemAnalysis(index)" v-if="editItem.status === 300 && (item.type === 'Single' || item.type ==='Multiple')">
 								<Icon type="md-podium" />
 								<span>统计数据</span>
 							</div>
@@ -251,6 +251,8 @@
 					/** 编辑回显 */
 					if (newValue) {
 						this.items = newValue.items || []
+						this.isShowAllAnalysis = false
+						this.curIndexList = []
 						console.log(newValue);
 					} else {
 						/** 新增 */

+ 6 - 0
TEAMModelOS/ClientApp/src/view/newcourse/CoursePlan.less

@@ -141,4 +141,10 @@
     .label{
         margin-right:5px; 
     }
+}
+.error-tips-wrap{
+    width:100%;
+    height:50px;
+    line-height:50px;
+
 }

+ 132 - 14
TEAMModelOS/ClientApp/src/view/newcourse/CoursePlan.vue

@@ -142,6 +142,7 @@
                             </template>
                         </Table>
                     </div>
+                    <Loading v-if="isLoading" bgColor="rgba(103, 103, 103, 0.27)"></Loading>
                 </vuescroll>
             </div>
         </div>
@@ -152,6 +153,17 @@
                @on-ok="importCus"
                @on-cancel="cancelImport">
             <ImportExcel ref="impXls" :headerKeys="headerKeys" :headerTitles="headerTitles" @getTableData="getTableData"></ImportExcel>
+            <div class="error-tips-wrap">
+                <span style="color:#ed4014;" v-if="errorCourse.length > 0">
+                    <span>错误课程:</span><span>{{errorCourse.join(',')}}</span>
+                </span>
+                <span style="margin-left:30px;color:#ff9900" v-if="errorClass.length > 0">
+                    <span>错误班级:</span><span>{{errorClass.join(',')}}</span>
+                </span>
+                <span style="margin-left:30px;color:#2db7f5" v-if="errorTeacher.length > 0">
+                    <span>错误授课老师:</span><span>{{errorTeacher.join(',')}}</span>
+                </span>
+            </div>
         </Modal>
         <Modal v-model="setCusStatus"
                title="设置课程"
@@ -180,8 +192,10 @@
         components: {
             NoData,Loading,ImportExcel
         },
+        inject:['reload'],  
         data() {
             return {
+                isLoading: false,
                 coursePlan: {},
                 courseList:[],
                 cusItem: {
@@ -190,9 +204,12 @@
                     row: {},
                     day:''
                 },
+                errorClass: [],
+                errorCourse: [],
+                errorTeacher: [],
                 excelData:[],
-                headerKeys:['classroomCode','courseName','courseCode','MON','TUE','WED','THU','FRI','SAT','SUN'],
-                headerTitles:['班级','课程名称','课程编码','星期一','星期二','星期三','星期四','星期五','星期六','星期日'],
+                headerKeys:['classroomCode','courseName','courseCode','teacher','MON','TUE','WED','THU','FRI','SAT','SUN'],
+                headerTitles:['班级','课程名称','课程编码','授课老师','星期一','星期二','星期三','星期四','星期五','星期六','星期日'],
                 importCusStatus: false,
                 setCusStatus: false,
                 semesterTree:[],
@@ -203,7 +220,8 @@
                 classList: [],
                 classListShow: [],
                 curClassIndex: 0,
-                tableData:[],
+                tableData: [],
+                importData:[],
                 timeColumns: [
                     {
                         title: ' ',
@@ -275,6 +293,7 @@
             },
             //确认设置课程
             confirmSetCus() {
+                this.isLoading = true
                 let requestData = {
                     courseId: this.cusItem.courseId,
                     classroomCode: this.classListShow[this.curClassIndex].classroomCode,
@@ -288,18 +307,20 @@
                 }
                 this.$api.courseMgmt.upsertAllPlan([requestData]).then(
                     (res) => {
-                        this.$set(this.tableData[this.cusItem.row._index].weeklies[this.cusItem.day], 'courseName',this.courseList.filter((item) => {
+                        this.$set(this.classListShow[this.curClassIndex].classPlan[this.cusItem.row._index].weeklies[this.cusItem.day], 'courseName',this.courseList.filter((item) => {
                             return item.id == this.cusItem.courseId
                         })[0].courseName)
 
-                        this.$set(this.tableData[this.cusItem.row._index].weeklies[this.cusItem.day], 'teacher', this.cusTeaList.filter((item) => {
+                        this.$set(this.classListShow[this.curClassIndex].classPlan[this.cusItem.row._index].weeklies[this.cusItem.day], 'teacher', this.cusTeaList.filter((item) => {
                             return item.id == this.cusItem.teacher
                         })[0].name)
 
                         this.$Message.success('设置成功!')
+                        this.isLoading = false
                     },
                     (err) => {
                         console.log('error')
+                        this.isLoading = false
                     }
                 )
             },
@@ -312,6 +333,69 @@
             //处理表格导入的数据
             getTableData(data) {
                 this.excelData = data
+                console.log('-----')
+                console.log(data)
+                let keys = ['MON','TUE','WED','THU','FRI','SAT','SUN']
+                for (let itemData of data) {
+                    //验证教室code
+                    let classroom = this.classList.filter((item) => {
+                        return item.classroomCode == itemData.classroomCode
+                    })
+                    if (classroom.length == 0) {
+                        this.errorClass.push(itemData.classroomCode)
+                        continue
+                    }
+                    //验证教师id
+                    let teacher = this.$store.state.teachers.teacherList.filter((item) => {
+                        return item.id == itemData.teacher
+                    })
+                    if (teacher.length == 0) {
+                        this.errorTeacher.push(itemData.teacher)
+                        continue
+                    }
+                    //验证课程编码
+                    let courseId = ''
+                    let course = this.courseList.filter((item) => {
+                        return item.courseCode == itemData.courseCode
+                    })
+                    if (course.length > 0) {
+                        courseId = course[0].id
+                    } else {
+                        this.errorCourse.push(itemData.courseCode)
+                        continue
+                    }
+                    
+                    
+                    for (let key of keys) {
+                        if (itemData[key]) {
+                            console.log(itemData[key])
+                            let indexes = itemData[key].toString().split(',')
+                            console.log(indexes)
+                            for (let index of indexes) {
+                                let reqItem = {
+                                    classroomCode: itemData.classroomCode,
+                                    courseId: courseId,
+                                    code: teacher[0].id,
+                                    courseTime: {}
+                                }
+                                reqItem.courseTime.label = this.tableData[parseInt(index) - 1].label
+                                reqItem.courseTime.time = this.tableData[parseInt(index) - 1].time
+                                reqItem.courseTime.day = key
+                                this.importData.push(reqItem)
+                            }
+                        }
+                    }
+                    //this.importData.push(reqItem)
+                }
+                if (this.errorClass.length > 0 || this.errorCourse.length > 0 || this.errorTeacher.length > 0) {
+                    this.$Message.error({
+                        content: '错误数据不能导入,请检查数据是否正确',
+                        duration: 5,
+                    })
+                } else {
+                    this.$Message.info('文件读取成功')
+                }
+                console.log(this.importData)
             },
             //显示导入课程
             showImportCus() {
@@ -320,14 +404,43 @@
             //确认导入课程
             importCus() {
                 this.$refs['impXls'].file = undefined
+                this.errorClass.length = 0
+                this.errorCourse.length = 0
+                this.errorTeacher.length = 0
+                this.isLoading = true
+                this.$api.courseMgmt.upsertAllPlan(this.importData).then(
+                    (res) => {
+                        if (res.error == null) {
+                            this.$Message.success('导入成功!')
+                            this.reload()
+                        } else {
+                            this.$Message.error('API ERROR!')
+                        }
+                        
+                        this.isLoading = false
+                    },
+                    (err) => {
+                        this.$Message.error('API ERROR!')
+                        this.isLoading = false
+                    }
+                )
             },
             cancelImport() {
                 this.$refs['impXls'].file = undefined
+                this.errorClass.length = 0
+                this.errorCourse.length = 0
+                this.errorTeacher.length = 0
+                this.importData.length = 0
             },
             selectClass(index) {
                 this.curClassIndex = index
-                if (!this.classListShow.isFull) {
+                this.isLoading = true
+                if (!this.classListShow[this.curClassIndex].isFull) {
                     this.findClassPlan()
+                } else {
+                    setTimeout(() => {
+                        this.isLoading = false
+                    },500)
                 }
             },
             //根据上下午合并单元格
@@ -355,6 +468,7 @@
             },
             //根据班级查询课程安排
             findClassPlan() {
+                
                 if (this.classListShow.length > 0) {
                     let requestData = {
                         classroomCode: this.classListShow[this.curClassIndex].classroomCode
@@ -362,7 +476,9 @@
                     this.$api.courseMgmt.findPlan(requestData).then(
                         (res) => {
                             if (res.error == null) {
-                                this.$set(this.classListShow[this.curClassIndex], 'classPlan', [...this.tableData])
+                                let jStr = JSON.stringify(this.tableData)
+                                console.log(jStr)
+                                this.$set(this.classListShow[this.curClassIndex], 'classPlan', JSON.parse(jStr))
                                 for (let planItem of res.result.data) {
                                     let course = this.courseList.filter((item) => {
                                         return item.id == planItem.courseId
@@ -375,27 +491,29 @@
                                     for (let timeItem of planItem.courseTimes) {
                                         //可优化
                                         for (let i = 0; i < this.classListShow[this.curClassIndex].classPlan.length; i++) {
-                                            if (this.tableData[i].time == timeItem.time) {
-                                                this.$set(this.classListShow[this.curClassIndex].classPlan[i].weeklies[timeItem.day], 'courseName', courseName)
-                                                this.$set(this.classListShow[this.curClassIndex].classPlan[i].weeklies[timeItem.day], 'teacher', teacherName)
+                                            if (this.classListShow[this.curClassIndex].classPlan[i].time == timeItem.time) {
+                                                //this.$set(this.classListShow[this.curClassIndex].classPlan[i].weeklies[timeItem.day], 'courseName', courseName)
+                                                //this.$set(this.classListShow[this.curClassIndex].classPlan[i].weeklies[timeItem.day], 'teacher', teacherName)
+                                                this.classListShow[this.curClassIndex].classPlan[i].weeklies[timeItem.day].teacher = teacherName
+                                                this.classListShow[this.curClassIndex].classPlan[i].weeklies[timeItem.day].courseName = courseName
                                                 break
                                             }
                                         }
                                     }
                                 }
-                                console.log('0.0.0.0')
-                                console.log(this.tableData)
                                 this.classListShow[this.curClassIndex].isFull = true
+                                this.isLoading = false
                             } else {
                                 this.$Message.error('API error!')
+                                this.isLoading = false
                             }
                         },
                         (err) => {
-
+                            this.isLoading = false
                         }
                     )
                 } else {
-
+                    this.isLoading = false
                 }
             }
         },

+ 8 - 8
TEAMModelOS/ClientApp/src/view/questionnaire/ManageQuestionnaire.vue

@@ -30,7 +30,7 @@
 								<div class="qn-item-info">
 									<span class="qn-item-nums">
 										<Icon type="md-time" size="14" style="margin-right:5px" />{{ $tools.formatTime(item.startTime) }}</span>
-									<span class="qn-item-status" :style="{ background: (item.state === 100 ? '#0BADD4' : item.state === 200 ? '#0fb68b' : '#949594')}">{{ item.state === 100 ? '待发布' : item.state === 200 ? '进行中' : '已结束' }}</span>
+									<span class="qn-item-status" :style="{ background: (item.status === 100 ? '#0BADD4' : item.status === 200 ? '#0fb68b' : '#949594')}">{{ item.status === 100 ? '待发布' : item.status === 200 ? '进行中' : '已结束' }}</span>
 								</div>
 							</div>
 						</div>
@@ -40,13 +40,13 @@
 			</div>
 
 			<!-- 问卷基础信息展示 -->
-			<div class="qn-col qn-info-box" v-show="currentQn.state !== 300">
+			<div class="qn-col qn-info-box">
 				<div class="qn-box-header">
 					<span>问卷详情</span>
 					<div class="qn-box-header-tools">
-						<span class="qn-box-header-tools-tool" v-show="currentQn.state !== 300 && qnList.length">
+						<span class="qn-box-header-tools-tool" v-show="currentQn.status !== 300 && qnList.length">
 							<Icon type="md-create" size="18" title="编辑" @click="onEditQn" /></span>
-						<span class="qn-box-header-tools-tool" v-show="currentQn.state === 200 && qnList.length">
+						<span class="qn-box-header-tools-tool" v-show="currentQn.status === 200 && qnList.length">
 							<Icon type="md-undo" size="18" title="取消发布" @click="onCancelQn" style="margin-left:8px;" /></span>
 					</div>
 				</div>
@@ -61,11 +61,11 @@
 			</div>
 
 			<!-- 问卷提交数据 -->
-			<div class="qn-col qn-data-box" :style="{ width: currentQn.state !== 300 ? '55%' : '85%' }">
+			<div class="qn-col qn-data-box">
 				<div class="qn-box-header">
 					<span>问卷数据</span>
 					<div class="qn-box-header-tools" v-show="!isEmptyData">
-						<div class="qn-box-header-tools-tool" style="margin-right: 25px;" v-show="currentQn.state !== 300">
+						<div class="qn-box-header-tools-tool" style="margin-right: 25px;" v-show="currentQn.status !== 300">
 							<Icon type="md-list-box" color="#dcdcdc" />
 							<Dropdown @on-click="onAddItem">
 								<Button>
@@ -79,7 +79,7 @@
 								</DropdownMenu>
 							</Dropdown>
 						</div>
-						<div class="qn-box-header-tools-tool" style="margin-right: 25px;" @click="onShowAllAnalysis" v-show="currentQn.state === 300 || currentQn.state === 0">
+						<div class="qn-box-header-tools-tool" style="margin-right: 25px;" @click="onShowAllAnalysis" v-show="currentQn.status === 300 || currentQn.status === 0">
 							<Icon type="md-podium" color="#dcdcdc" />
 							<span>查看统计数据</span>
 						</div>
@@ -121,7 +121,7 @@
 				qnList: [],
 				studentsList: [],
 				currentQn: {
-					state: 100
+					status: 100
 				},
 				editItem: {},
 				activeQnIndex: null,

+ 34 - 18
TEAMModelOS/ClientApp/src/view/selflearning/ManageHomeWork.vue

@@ -25,7 +25,7 @@
                             <div class="hw-item-info">
                                 <span class="hw-item-nums"><Icon type="md-time" size="14" style="margin-right:5px"/>{{ $tools.formatTime(item.startTime) }}</span>
                                 <span class="hw-item-status"
-                                      :style="{ background: (item.state === 100 ? '#0BADD4' : item.state === 200 ? '#0fb68b' : '#949594')}">{{ item.state === 100 ? '待发布' : item.state === 200 ? '进行中' : '已结束' }}</span>
+                                      :style="{ background: (item.status === 100 ? '#0BADD4' : item.status === 200 ? '#0fb68b' : '#949594')}">{{ item.status === 100 ? '待发布' : item.status === 200 ? '进行中' : '已结束' }}</span>
                             </div>
                         </div>
                     </div>
@@ -35,12 +35,12 @@
         </div>
 
         <!-- 作业基础信息展示 -->
-        <div class="hw-col hw-info-box" v-show="currentHw.state !== 300">
+        <div class="hw-col hw-info-box" v-show="currentHw.status !== 300">
             <div class="hw-box-header">
                 <span>作业详情</span>
                 <div class="hw-box-header-tools">
-                    <span class="hw-box-header-tools-tool" v-show="currentHw.state !== 300 && hwList.length" ><Icon type="md-create" size="18" title="编辑" @click="onEditHw" /></span>
-                    <span class="hw-box-header-tools-tool" v-show="currentHw.state === 200 && hwList.length"><Icon type="md-undo" size="18" title="取消发布" @click="onCancelHw" style="margin-left:8px;" /></span>
+                    <span class="hw-box-header-tools-tool" v-show="currentHw.status !== 300 && hwList.length" ><Icon type="md-create" size="18" title="编辑" @click="onEditHw" /></span>
+                    <span class="hw-box-header-tools-tool" v-show="currentHw.status === 200 && hwList.length"><Icon type="md-undo" size="18" title="取消发布" @click="onCancelHw" style="margin-left:8px;" /></span>
                 </div>
             </div>
             <vuescroll ref="hwDetailsScroll">
@@ -54,7 +54,7 @@
         </div>
 
         <!-- 作业提交数据 -->
-        <div class="hw-col hw-data-box" :style="{ width: currentHw.state !== 300 ? '55%' : '85%' }">
+        <div class="hw-col hw-data-box" :style="{ width: currentHw.status !== 300 ? '55%' : '85%' }">
             <div class="hw-box-header">
                 <span>作业数据</span>
                 <div class="hw-box-header-tools">
@@ -63,10 +63,10 @@
             </div>
             <vuescroll>
                 <div class="hw-data-wrap">
-                    <div v-if="hwList.length === 0 || currentHw.state === 100">
+                    <div v-if="hwList.length === 0 || currentHw.status === 100">
                         <EmptyBox :top="50"></EmptyBox>
                     </div>
-                    <BaseHwTable :studentsList="studentsList" v-else></BaseHwTable>
+                    <BaseHwTable :studentsList="studentsList" :hwId="currentHw.id" v-else></BaseHwTable>
                 </div>
             </vuescroll>
         </div>
@@ -100,7 +100,7 @@
                 editable:false,
                 hwList: [],
                 studentsList:[],
-                currentHw: {state:0},
+                currentHw: {status:0},
                 editItem: {},
                 activeHwIndex:0,
                 addHwModal:false,
@@ -194,7 +194,7 @@
             onHwClick(item, index) {
                 this.currentHw = item
                 this.activeHwIndex = index
-                if (item.id) this.getHwStudents(item.id)
+                if (item.id) this.getHwStudents(item.id , item.target)
                 this.$refs.hwForm.hwFormEdit = false
                 //this.backToTop('hwDetailsScroll')
             },
@@ -204,27 +204,43 @@
              * 获取作业关联的学生清单
              * @param hwId 作业ID
              */
-            async getHwStudents(hwId) {
+            async getHwStudents(hwId,target) {
 				let records  = await this.getHwRecord(hwId)
-				console.log(records)
+				this.isLoading = true
 				//  先查找 作业发布对象关联的学生清单 然后再去判断学生的作答情况
-				this.$api.courseMgmt.getClassroomStudent({ classroomCode: 'HBCN0102' , schoolCode:'HBCN' }).then(res => {
+				this.$api.courseMgmt.getClassroomStudent({ classroomCode: target.map(i => i.classroomCode) , schoolCode:'HBCN' }).then(res => {
 				    if (!res.error && res.result.data) {
-					    let list = res.result.extend.students
+					    let list = res.result.data
+						let infoList = res.result.extend.students
+						list.forEach(i => {
+							i.name = infoList.filter(j => j.studentId === i.code)[0].name
+							i.classroomName = target.filter(k => k.classroomCode === i.id)[0].classroomName
+						})
 						// 要根据作答情况 结合两张表 处理表格显示的数据 
 						if(records.length){
 							records.forEach(item => {
 								list.forEach(i => {
 									// 如果学生已提交 则添加提交信息 如果未提交则跳过
-								    if(i.studentId !== item.code) return
-									i.submissionBool = true
-									i.submissionTime = item.submitTime
-									i.classroom = item.classroom
+								    if(i.code === item.code && i.id === item.classroom.code){
+										i.submissionBool = true
+										i.submissionTime = item.submitTime
+										i.teacherComments = item.tchCmt
+										i.studentComments = item.stuCmt
+										i.score = item.score
+										i.content = item.content
+									}else{
+										i.submissionBool = false
+										i.submissionTime = null
+										i.teacherComments = []
+										i.studentComments = []
+										i.score = 0
+										i.content = []
+									}
 								})
 							})
 						}
-						console.log(list)
 				        this.studentsList = list
+						this.isLoading = false
 				    } else {
 				        this.$Message.error('获取数据失败')
 				    }

+ 8 - 0
TEAMModelOS/ClientApp/src/view/teachermgmt/Index.vue

@@ -87,11 +87,19 @@ export default {
     //              console.log(res.result.data);
     //      })
     //}
+    // 取得所有學校資料
+    //getAllSchoolBaesInfoTest() {
+    //    this.$api.GetAllSchoolBaesInfo({}).then(
+    //          res => {
+    //            console.log(res.result.data);
+    //      })
+    //}
   },
   mounted() {
       console.log(this.user)
       this.setSchoolUser()
       this.getSchoolSettingAuthorityList()
+      this.getAllSchoolBaesInfoTest()
   },
 }
 </script>

+ 4 - 4
TEAMModelOS/Controllers/School/ClassStudentController.cs

@@ -33,12 +33,12 @@ namespace TEAMModelOS.Controllers
         /// <param name="request"></param>
         /// <returns></returns>
         [HttpPost("find")]
-        public async Task<BaseJosnRPCResponse> find(JosnRPCRequest<Dictionary<string,string>> request) {
+        public async Task<BaseJosnRPCResponse> find(JosnRPCRequest<Dictionary<string,object>> request) {
             JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
             // 班级编码
-            if (request.@params.TryGetValue("classroomCode", out string classroomCode)
+            if (request.@params.TryGetValue("classroomCode", out object classroomCode)
                 ///学校编码
-                 && request.@params.TryGetValue("schoolCode", out string schoolCode)
+                 && request.@params.TryGetValue("schoolCode", out object schoolCode)
                 )
             {
                 List<ClassStudent> classroomStudents = await _cosmos.FindByDict<ClassStudent>(new Dictionary<string, object> { { "id", classroomCode }});
@@ -54,7 +54,7 @@ namespace TEAMModelOS.Controllers
                     {
                         if (!classroomStudents.Select(m=>m.code).Contains(x.studentId))
                         {
-                            newClassStudents.Add(new ClassStudent() { id = classroomCode, code = x.studentId });
+                            newClassStudents.Add(new ClassStudent() { id = x.classroomCode, code = x.studentId });
                         }
                         var stu = new { x.id, x.name, x.code, x.seatNo, x.studentId, x.classroomCode };
                         stus.Add(stu);

+ 13 - 1
TEAMModelOS/Controllers/School/SchoolController.cs

@@ -76,6 +76,18 @@ namespace TEAMModelOS.Controllers
             else {
                 return builder.Data(null).build();
             }
-        }               
+        }
+        /// <summary>
+        /// 取得所有學校基本資料("id","schoolCode","schoolName")
+        /// </summary>
+        /// <param name="GetAllSchoolBaesInfo"></param>
+        /// <returns></returns>
+        [HttpPost("GetAllSchoolBaesInfo")]
+        public async Task<BaseJosnRPCResponse> GetAllSchoolBaesInfo(JosnRPCRequest<Dictionary<string, object>> request)
+        {
+            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
+            List<School> sc = await _cosmosrepository.FindSQL<School>("SELECT c.id, c.schoolCode, c.schoolName FROM c WHERE c.pk='School'");
+            return builder.Data(sc).build();
+        }
     }
 }