liqk 2 lat temu
rodzic
commit
6dee8de48e

+ 1 - 12
TEAMModelOS.SDK/Models/Cosmos/Common/ArtExam.cs

@@ -13,19 +13,8 @@ namespace TEAMModelOS.SDK.Models.Cosmos.Common
         {
         {
             pk = "ArtExam";
             pk = "ArtExam";
         }
         }
-        public string infoId { get; set; }
         public string activityId { get; set; }
         public string activityId { get; set; }
-        public string schoolId { get; set; }
-        public string name { get; set; }
-        public string blob { get; set; }
-        public int count { get; set; }
-        public string periodId { get; set; }
-        public string periodName { get; set; }
-        public List<string> periodTypes { get; set; } = new List<string>();
-        public string subjectId { get; set; }
-        public string subjectBindId { get; set; }
-        public long createTime { get; set; }
-        public List<string> gradeIds { get; set; } = new List<string>();
+        public JsonElement JsonElement { get; set; }
 
 
 
 
     }
     }

+ 4 - 1
TEAMModelOS/ClientApp/src/view/artexam/Mgt.vue

@@ -14,7 +14,10 @@
                 <div style="height:calc(100% - 50px)">
                 <div style="height:calc(100% - 50px)">
                     <vuescroll>
                     <vuescroll>
                         <div :class="['art-item', curIndex == index ? 'art-item-active' : '']" v-for="(item,index) in artList" :key="item.id" @click="selectArt(index)">
                         <div :class="['art-item', curIndex == index ? 'art-item-active' : '']" v-for="(item,index) in artList" :key="item.id" @click="selectArt(index)">
-                            <p class="art-name">{{item.name}}</p>
+                            <p class="art-name">
+                                {{item.name}}
+                                <Tag v-if="item.owner === 'area'" color="warning">区级</Tag>
+                            </p>
                             <p class="art-date">
                             <p class="art-date">
                                 <Icon type="md-time" size="16" />{{$jsFn.dateFormat(item.startTime)}}-{{$jsFn.dateFormat(item.endTime)}}
                                 <Icon type="md-time" size="16" />{{$jsFn.dateFormat(item.startTime)}}-{{$jsFn.dateFormat(item.endTime)}}
                             </p>
                             </p>

+ 27 - 23
TEAMModelOS/Controllers/Common/AreaController.cs

@@ -370,8 +370,8 @@ namespace TEAMModelOS.Controllers
                     studies.Add(study);
                     studies.Add(study);
                 }
                 }
                 //areaStudy.targets = allName;
                 //areaStudy.targets = allName;
-/*                var atn = allName.ToJsonString().ToObject<List<JsonElement>>();
-                areaStudy.targets = atn;*/
+                /*                var atn = allName.ToJsonString().ToObject<List<JsonElement>>();
+                                areaStudy.targets = atn;*/
                 await client.GetContainer("TEAMModelOS", "Common").UpsertItemAsync(areaStudy, new PartitionKey($"{areaStudy.code}"));
                 await client.GetContainer("TEAMModelOS", "Common").UpsertItemAsync(areaStudy, new PartitionKey($"{areaStudy.code}"));
                 var ids = studies.Select(s => new { s.id, s.school, s.examId, s.surveyId });
                 var ids = studies.Select(s => new { s.id, s.school, s.examId, s.surveyId });
                 return Ok(new { id, ids, code = (int)HttpStatusCode.OK, acId = areaStudy.id });
                 return Ok(new { id, ids, code = (int)HttpStatusCode.OK, acId = areaStudy.id });
@@ -396,7 +396,6 @@ namespace TEAMModelOS.Controllers
                 if (!request.TryGetProperty("art", out JsonElement art)) return BadRequest();
                 if (!request.TryGetProperty("art", out JsonElement art)) return BadRequest();
                 if (!request.TryGetProperty("artExam", out JsonElement artExam)) return BadRequest();
                 if (!request.TryGetProperty("artExam", out JsonElement artExam)) return BadRequest();
                 var client = _azureCosmos.GetCosmosClient();
                 var client = _azureCosmos.GetCosmosClient();
-                List<ArtExam> am = artExam.ToObject<List<ArtExam>>();
                 var (userid, _, _, school) = HttpContext.GetAuthTokenInfo();
                 var (userid, _, _, school) = HttpContext.GetAuthTokenInfo();
                 //获取区级以下所有学校编码和基础信息
                 //获取区级以下所有学校编码和基础信息
                 List<string> baseIds = new();
                 List<string> baseIds = new();
@@ -410,7 +409,7 @@ namespace TEAMModelOS.Controllers
                         {
                         {
                             JsonElement account = accounts.Current;
                             JsonElement account = accounts.Current;
                             baseIds.Add(account.GetProperty("id").GetString());
                             baseIds.Add(account.GetProperty("id").GetString());
-                            
+
                         }
                         }
                     }
                     }
                 }
                 }
@@ -420,19 +419,22 @@ namespace TEAMModelOS.Controllers
                 areaArt.owner = "area";
                 areaArt.owner = "area";
                 areaArt.ttl = -1;
                 areaArt.ttl = -1;
                 areaArt.scope = "school";
                 areaArt.scope = "school";
-                areaArt.code = "Study-" + id.GetString();
+                areaArt.code = "Art-" + id.GetString();
                 areaArt.createTime = now;
                 areaArt.createTime = now;
                 areaArt.creatorId = userid;
                 areaArt.creatorId = userid;
-                areaArt.progress = "pending";              
+                areaArt.progress = "pending";
                 if (string.IsNullOrEmpty(areaArt.id))
                 if (string.IsNullOrEmpty(areaArt.id))
                 {
                 {
                     areaArt.id = Guid.NewGuid().ToString();
                     areaArt.id = Guid.NewGuid().ToString();
                 }
                 }
-                foreach (var aExam in am) {
-                    aExam.id = Guid.NewGuid().ToString();
-                    aExam.activityId = areaArt.id;
-                    await client.GetContainer("TEAMModelOS", "Common").UpsertItemAsync(aExam, new PartitionKey("{ArtExam}"));
-                }
+                ArtExam aExam = new();
+                aExam.id = Guid.NewGuid().ToString();
+                aExam.activityId = areaArt.id;
+                aExam.ttl = -1;
+                aExam.code = "ArtExam";
+                aExam.JsonElement = artExam;
+                await client.GetContainer("TEAMModelOS", "Common").UpsertItemAsync(aExam, new PartitionKey("ArtExam"));
+
                 foreach (string scId in baseIds)
                 foreach (string scId in baseIds)
                 {
                 {
                     ArtEvaluation ae = art.ToObject<ArtEvaluation>();
                     ArtEvaluation ae = art.ToObject<ArtEvaluation>();
@@ -440,13 +442,13 @@ namespace TEAMModelOS.Controllers
                     ae.school = scId;
                     ae.school = scId;
                     ae.owner = "area";
                     ae.owner = "area";
                     ae.ttl = -1;
                     ae.ttl = -1;
-                    ae.code = "Study-" + scId;
+                    ae.code = "Art-" + scId;
                     ae.createTime = now;
                     ae.createTime = now;
                     ae.creatorId = userid;
                     ae.creatorId = userid;
                     ae.publish = 1;
                     ae.publish = 1;
                     ae.progress = "pending";
                     ae.progress = "pending";
                     ae.pId = areaArt.id;
                     ae.pId = areaArt.id;
-                    ae.scope = "school";                    
+                    ae.scope = "school";
                     if (string.IsNullOrEmpty(ae.id))
                     if (string.IsNullOrEmpty(ae.id))
                     {
                     {
                         ae.id = Guid.NewGuid().ToString();
                         ae.id = Guid.NewGuid().ToString();
@@ -463,7 +465,7 @@ namespace TEAMModelOS.Controllers
                                 areaStudy.targets = atn;*/
                                 areaStudy.targets = atn;*/
                 await client.GetContainer("TEAMModelOS", "Common").UpsertItemAsync(areaArt, new PartitionKey($"{areaArt.code}"));
                 await client.GetContainer("TEAMModelOS", "Common").UpsertItemAsync(areaArt, new PartitionKey($"{areaArt.code}"));
                 //var ids = studies.Select(s => new { s.id, s.school, s.examId, s.surveyId });
                 //var ids = studies.Select(s => new { s.id, s.school, s.examId, s.surveyId });
-                return Ok(new {code = (int)HttpStatusCode.OK, arts });
+                return Ok(new { code = (int)HttpStatusCode.OK, arts });
             }
             }
             catch (Exception ex)
             catch (Exception ex)
             {
             {
@@ -534,7 +536,7 @@ namespace TEAMModelOS.Controllers
                 var query = $"select c.id,c.name,c.type,c.startTime,c.endTime,c.presenter,c.topic,c.address,c.owner,c.school from c order by c.createTime desc";
                 var query = $"select c.id,c.name,c.type,c.startTime,c.endTime,c.presenter,c.topic,c.address,c.owner,c.school from c order by c.createTime desc";
 
 
 
 
-                await foreach (var item in client.GetContainer("TEAMModelOS", "Common").GetItemQueryStreamIterator(queryText: query, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"art-{id}") }))
+                await foreach (var item in client.GetContainer("TEAMModelOS", "Common").GetItemQueryStreamIterator(queryText: query, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Art-{id}") }))
                 {
                 {
 
 
                     using var json = await JsonDocument.ParseAsync(item.ContentStream);
                     using var json = await JsonDocument.ParseAsync(item.ContentStream);
@@ -611,7 +613,7 @@ namespace TEAMModelOS.Controllers
                 if (ids.Count > 0)
                 if (ids.Count > 0)
                 {
                 {
                     foreach ((string s, string c) in ids)
                     foreach ((string s, string c) in ids)
-                    {                      
+                    {
                         await client.GetContainer("TEAMModelOS", "Common").DeleteItemStreamAsync(s.ToString(), new PartitionKey($"{c}"));
                         await client.GetContainer("TEAMModelOS", "Common").DeleteItemStreamAsync(s.ToString(), new PartitionKey($"{c}"));
                     }
                     }
                 }
                 }
@@ -640,8 +642,8 @@ namespace TEAMModelOS.Controllers
                 List<Study> studies = new();
                 List<Study> studies = new();
                 List<(string id, string name)> ps = await getInfo(client, areaId.GetString());
                 List<(string id, string name)> ps = await getInfo(client, areaId.GetString());
                 //List<string> aName = new();
                 //List<string> aName = new();
-                List< Survey > trSurveys = new();
-                List< ExamLite> trExams = new();
+                List<Survey> trSurveys = new();
+                List<ExamLite> trExams = new();
                 List<Study> moreInfo = new();
                 List<Study> moreInfo = new();
                 List<Homework> works = new();
                 List<Homework> works = new();
                 //提取研修相关老师活动记录
                 //提取研修相关老师活动记录
@@ -663,7 +665,7 @@ namespace TEAMModelOS.Controllers
                         }
                         }
                     }
                     }
 
 
-                    
+
                     foreach (Study stu in studies)
                     foreach (Study stu in studies)
                     {
                     {
                         if (!string.IsNullOrEmpty(stu.surveyId))
                         if (!string.IsNullOrEmpty(stu.surveyId))
@@ -712,7 +714,7 @@ namespace TEAMModelOS.Controllers
                     }
                     }
 
 
                 }
                 }
-                                        
+
                 var survey = trSurveys.Select(s => new
                 var survey = trSurveys.Select(s => new
                 {
                 {
                     ansCount = s.answers.Count,
                     ansCount = s.answers.Count,
@@ -731,7 +733,7 @@ namespace TEAMModelOS.Controllers
                     lateCount = records.Where(h => !string.IsNullOrEmpty(h.sign) && h.sign.Equals("2")).ToList().Count,
                     lateCount = records.Where(h => !string.IsNullOrEmpty(h.sign) && h.sign.Equals("2")).ToList().Count,
                     //acount = records.Where(h => h.aTime > 0).ToList().Count
                     //acount = records.Where(h => h.aTime > 0).ToList().Count
                 };
                 };
-                return Ok(new { survey, work = twork, exam, info, studies = moreInfo.Select(m =>  m ), teac });
+                return Ok(new { survey, work = twork, exam, info, studies = moreInfo.Select(m => m), teac });
             }
             }
             catch (Exception e)
             catch (Exception e)
             {
             {
@@ -1140,10 +1142,12 @@ namespace TEAMModelOS.Controllers
                 if (!request.TryGetProperty("pk", out JsonElement pk)) return BadRequest();
                 if (!request.TryGetProperty("pk", out JsonElement pk)) return BadRequest();
                 var client = _azureCosmos.GetCosmosClient();
                 var client = _azureCosmos.GetCosmosClient();
                 var aresponse = await client.GetContainer("TEAMModelOS", "Common").ReadItemStreamAsync(id.ToString(), new PartitionKey($"{pk}-{code}"));
                 var aresponse = await client.GetContainer("TEAMModelOS", "Common").ReadItemStreamAsync(id.ToString(), new PartitionKey($"{pk}-{code}"));
-                if (aresponse.Status == 200) {
+                if (aresponse.Status == 200)
+                {
                     using var json = await JsonDocument.ParseAsync(aresponse.ContentStream);
                     using var json = await JsonDocument.ParseAsync(aresponse.ContentStream);
                     Study study = json.ToObject<Study>();
                     Study study = json.ToObject<Study>();
-                    if (study.tchLists.Count > 0) { 
+                    if (study.tchLists.Count > 0)
+                    {
                         foreach (var list in study.tchLists)
                         foreach (var list in study.tchLists)
                         {
                         {
                             await client.GetContainer("TEAMModelOS", "Teacher").DeleteItemStreamAsync(list, new PartitionKey($"GroupList-{code}"));
                             await client.GetContainer("TEAMModelOS", "Teacher").DeleteItemStreamAsync(list, new PartitionKey($"GroupList-{code}"));