Browse Source

Merge branch 'develop6.0-tmd' of http://52.130.252.100:10000/TEAMMODEL/TEAMModelOS into develop6.0-tmd

XW 3 years ago
parent
commit
a92c84f69a

+ 1 - 1
TEAMModelBI/Models/AssistSchool.cs

@@ -19,7 +19,7 @@ namespace TEAMModelBI.Models
         public int scale { get; set; }
         public int scale { get; set; }
         public string standard { get; set; }
         public string standard { get; set; }
         public string areaId { get; set; }
         public string areaId { get; set; }
-        public List<SchoolTeacherRoles> assists { get; set; }
+        public List<SchoolTeacherRoles> assists { get; set; } = new List<SchoolTeacherRoles>();
         public int serial { get; set; } //软体
         public int serial { get; set; } //软体
         public int service { get; set; } //服务
         public int service { get; set; } //服务
         public int hard { get; set; } //硬体
         public int hard { get; set; } //硬体

+ 1 - 0
TEAMModelOS.SDK/Models/Cosmos/Normal/Ability.cs

@@ -97,6 +97,7 @@ namespace TEAMModelOS.SDK.Models
         public string id { get; set; }
         public string id { get; set; }
         public List<string> type { get; set; } = new List<string>();
         public List<string> type { get; set; } = new List<string>();
         public string stddesc { get; set; }
         public string stddesc { get; set; }
+        public int limit { get; set; } = 1;
         public List<AbilityStdTitle> titles { get; set; } = new List<AbilityStdTitle>();
         public List<AbilityStdTitle> titles { get; set; } = new List<AbilityStdTitle>();
     }
     }
     public class AbilityStdTitle { 
     public class AbilityStdTitle { 

+ 3 - 1
TEAMModelOS/ClientApp/src/common/BaseNotification.vue

@@ -236,7 +236,9 @@
 						routerInfo = {
 						routerInfo = {
 							name: "manageHomeWork",
 							name: "manageHomeWork",
 							params:{
 							params:{
-								id:body.sid
+								ac:{
+									id:body.sid
+								}
 							}
 							}
 						}
 						}
 						break;		
 						break;		

+ 5 - 2
TEAMModelOS/ClientApp/src/view/ability/Review.vue

@@ -453,9 +453,8 @@ export default {
       this.stdFileArr = abilityDetail.stds.map(i => [])
       this.stdFileArr = abilityDetail.stds.map(i => [])
       this.curTaskIndexArr = abilityDetail.stds.map(i => 0)
       this.curTaskIndexArr = abilityDetail.stds.map(i => 0)
       abilityDetail.uploads = this.reviewData.uploads
       abilityDetail.uploads = this.reviewData.uploads
-      console.log(abilityDetail.uploads)
       if (this.mode !== 'self') {
       if (this.mode !== 'self') {
-        this.stdFileArr = abilityDetail.uploads.map(i => i.urls)
+        this.stdFileArr = abilityDetail.stds.map(i => abilityDetail.uploads.find(j => j.stdid === i.id).urls)
         abilityDetail.targetId = this.reviewData.targetId
         abilityDetail.targetId = this.reviewData.targetId
         abilityDetail.targetName = this.reviewData.targetName
         abilityDetail.targetName = this.reviewData.targetName
       }
       }
@@ -488,7 +487,9 @@ export default {
     },
     },
 
 
     getFinalResult() {
     getFinalResult() {
+	  this.appraiseResultArr = this._.compact(this.appraiseResultArr)
       this.finalResult = this.appraiseResultArr.every(i => i === 'good') ? 2 : this.appraiseResultArr.some(i => i === 'bad') ? 0 : 1
       this.finalResult = this.appraiseResultArr.every(i => i === 'good') ? 2 : this.appraiseResultArr.some(i => i === 'bad') ? 0 : 1
+      console.log(this.appraiseResultArr)
       console.log(this.finalResult)
       console.log(this.finalResult)
     }
     }
 
 
@@ -496,6 +497,8 @@ export default {
   computed: {
   computed: {
     finalUpload() {
     finalUpload() {
 		/* 获取能力点下每个任务的数据(文件、评分等) */
 		/* 获取能力点下每个任务的数据(文件、评分等) */
+		console.log(this.data);
+		console.log(this.stdFileArr);
       return this.stdFileArr.map((i, stdIndex) => {
       return this.stdFileArr.map((i, stdIndex) => {
         return {
         return {
           "stdid": this.data.stds[stdIndex].id,
           "stdid": this.data.stds[stdIndex].id,

+ 16 - 52
TEAMModelOS/Controllers/School/SchoolTeacherController.cs

@@ -173,63 +173,27 @@ namespace TEAMModelOS.Controllers
                 var client = _azureCosmos.GetCosmosClient();
                 var client = _azureCosmos.GetCosmosClient();
                 //參數取得
                 //參數取得
                 if (!request.TryGetProperty("school_code", out JsonElement school_code)) return BadRequest();
                 if (!request.TryGetProperty("school_code", out JsonElement school_code)) return BadRequest();
-                request.TryGetProperty("ids", out JsonElement ids);
-                request.TryGetProperty("mode", out JsonElement mode);
-                request.TryGetProperty("pmAdd", out JsonElement pmAdd);
-                request.TryGetProperty("pmRmv", out JsonElement pmRmv);
-                List<string> pmAddList = new List<string>();
-                List<string> pmRmvList = new List<string>();
-                request.TryGetProperty("job", out JsonElement job);
-                if (mode.GetString() .Equals("multi"))
-                {
-                    foreach (var pm in pmAdd.EnumerateArray())
-                    {
-                        pmAddList.Add(pm.GetString());
-                    }
-                    foreach (var pm in pmRmv.EnumerateArray())
-                    {
-                        pmRmvList.Add(pm.GetString());
-                    }
-                } else 
-                {
-                    foreach (var pm in pmAdd.EnumerateArray())
-                    {
-                        pmAddList.Add(pm.GetString());
-                    }
+                request.TryGetProperty("ids", out JsonElement _ids);
+                request.TryGetProperty("job", out JsonElement _job);
+                request.TryGetProperty("permission", out JsonElement _permission);
+                if (!_permission.ValueKind.Equals(JsonValueKind.Array) || !_ids.ValueKind.Equals(JsonValueKind.Array)) {
+                    return BadRequest();
                 }
                 }
-
+                List<string> permission =_permission.ToObject<List<string>>();
+                List<string> ids = _ids.ToObject<List<string>>();
                 //更新權限
                 //更新權限
-                foreach (var id in ids.EnumerateArray())
+                List<SchoolTeacher> schoolTeachers = new List<SchoolTeacher>(); 
+                foreach (var id in ids)
                 {
                 {
-                    SchoolTeacher st = await client.GetContainer(Constant.TEAMModelOS, "School").ReadItemAsync<SchoolTeacher>(id.GetString(), new PartitionKey($"Teacher-{school_code}"));
-                    if(mode.GetString().Equals("multi"))
-                    {
-                        st.permissions = pmAddList;
-                        //foreach (var pm in pmRmvList)
-                        //{
-                        //    if(st.permissions.Contains(pm))
-                        //    {
-                        //        st.permissions.Remove(pm);
-                        //    }
-                        //}
-                        //foreach (var pm in pmAddList)
-                        //{
-                        //    if (!st.permissions.Contains(pm))
-                        //    {
-                        //        st.permissions.Add(pm);
-                        //    }
-                        //}
-                    } else
-                    {
-                        st.permissions = pmAddList;
-                        st.job = (!string.IsNullOrEmpty(job.GetString())) ? job.GetString() : null;
-                    }
-
-                    await client.GetContainer(Constant.TEAMModelOS, "School").ReplaceItemAsync<SchoolTeacher>(st, id.GetString(), new PartitionKey($"Teacher-{school_code}"));
+                    SchoolTeacher st = await client.GetContainer(Constant.TEAMModelOS, "School").ReadItemAsync<SchoolTeacher>(id, new PartitionKey($"Teacher-{school_code}"));
+                    st.permissions = permission;
+                    st.job = $"{_job}";
+                    await client.GetContainer(Constant.TEAMModelOS, "School").ReplaceItemAsync<SchoolTeacher>(st, id, new PartitionKey($"Teacher-{school_code}"));
+                    schoolTeachers.Add(st); 
                 }
                 }
-                return Ok(new {});
+                return Ok(new {teachers= schoolTeachers });
             }
             }
-            catch (Exception ex)
+            catch (Exception )
             {
             {
                 return BadRequest();
                 return BadRequest();
             }
             }