Ver Fonte

Merge branch 'develop' of http://52.130.252.100:10000/TEAMMODEL/TEAMModelOS into develop

XW há 2 anos atrás
pai
commit
542f038993

+ 58 - 0
TEAMModelBI/Controllers/BINormal/BusinessController.cs

@@ -275,5 +275,63 @@ namespace TEAMModelBI.Controllers.BINormal
             return Ok(new { state = RespondCode.Ok, bizConfig });
             return Ok(new { state = RespondCode.Ok, bizConfig });
         }
         }
 
 
+        /// <summary>
+        /// 查询所有学校 如果传企业ID则查询与企业没有关联的学校
+        /// </summary>
+        /// <param name="jsonElement"></param>
+        /// <returns></returns>
+        [ProducesDefaultResponseType]
+        [HttpPost("get-schools")]
+        public async Task<IActionResult> GetSchools(JsonElement jsonElement)
+        {
+            jsonElement.TryGetProperty("id", out JsonElement id);
+            jsonElement.TryGetProperty("site", out JsonElement site);
+            var cosmosClient = _azureCosmos.GetCosmosClient();
+            var tableClient = _azureStorage.GetCloudTableClient();
+            var blobClient = _azureStorage.GetBlobContainerClient(containerName: "0-public");
+            if ($"{site}".Equals(BIConst.Global))
+            {
+                cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
+                tableClient = _azureStorage.GetCloudTableClient(BIConst.Global);
+                blobClient = _azureStorage.GetBlobContainerClient(containerName: "0-public", BIConst.Global);
+            }
+
+            List<OpenSchool> openSchools = new();
+
+            await foreach (var item in cosmosClient.GetContainer("TEAMModelOS", "School").GetItemQueryIterator<OpenSchool>(queryText: "select c.id,c.code,c.name,c.picture from c", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("Base") }))
+            {
+                openSchools.Add(item);
+            }
+            BizConfig bizConfig = new();
+            if (!string.IsNullOrEmpty($"id"))
+            {
+                var response = await cosmosClient.GetContainer("TEAMModelOS", "Normal").ReadItemStreamAsync($"{id}", new PartitionKey("BizConfig"));
+                if (response.Status == RespondCode.Ok)
+                {
+                    using var json = await JsonDocument.ParseAsync(response.ContentStream);
+                    bizConfig = json.ToObject<BizConfig>();
+                    if (bizConfig.schools.Count > 0)
+                    {
+                        foreach (var item in bizConfig.schools)
+                        {
+                            var temp = openSchools.Find(f => f.id.Equals(item.id));
+                            if (temp != null)
+                                openSchools.Remove(temp);
+                        }
+                    }
+                }
+            }
+
+            return Ok(new { state = RespondCode.Ok , openSchools });
+        }
+
+
+        public record OpenSchool
+        {
+            public string id { get; set; }
+            public string code { get; set; }
+            public string name { get; set; }
+            public string picture { get; set; }
+        }
     }
     }
 }
 }

+ 0 - 38
TEAMModelBI/Controllers/BISchool/SchoolController.cs

@@ -1067,36 +1067,6 @@ namespace TEAMModelBI.Controllers.BISchool
             }
             }
         }
         }
 
 
-        /// <summary>
-        /// 查询所有学校  第三方开放平台关联学校显示所有学校
-        /// </summary>
-        /// <param name="jsonElement"></param>
-        /// <returns></returns>
-        [HttpPost("get-applyschools")]
-        public async Task<IActionResult> GetApplySchools(JsonElement jsonElement)
-        {
-            jsonElement.TryGetProperty("site", out JsonElement site);
-            var cosmosClient = _azureCosmos.GetCosmosClient();
-            var tableClient = _azureStorage.GetCloudTableClient();
-            var blobClient = _azureStorage.GetBlobContainerClient(containerName: "0-public");
-            if ($"{site}".Equals(BIConst.Global))
-            {
-                cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
-                tableClient = _azureStorage.GetCloudTableClient(BIConst.Global);
-                blobClient = _azureStorage.GetBlobContainerClient(containerName: "0-public", BIConst.Global);
-            }
-
-            List<ApplySchool> applySchools = new();
-
-            await foreach (var item in cosmosClient.GetContainer("TEAMModelOS", "School").GetItemQueryIterator<ApplySchool>(queryText: "select c.id,c.code,c.name,c.picture from c", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("Base") }))
-            {
-                applySchools.Add(item);
-            }
-
-            return Ok(new { state = 200, applySchools });
-        }
-
-
         /// <summary>
         /// <summary>
         /// 通过学校Id查询详情   数据管理工具——查询工具
         /// 通过学校Id查询详情   数据管理工具——查询工具
         /// </summary>
         /// </summary>
@@ -2023,14 +1993,6 @@ namespace TEAMModelBI.Controllers.BISchool
 
 
         #endregion
         #endregion
 
 
-        public record ApplySchool
-        {
-            public string id { get; set; }
-            public string code { get; set; }
-            public string name { get; set; }
-            public string picture { get; set; }
-        }
-
         /// <summary>
         /// <summary>
         /// 未加入区域的学校
         /// 未加入区域的学校
         /// </summary>
         /// </summary>

+ 30 - 1
TEAMModelOS/ClientApp/src/view/research-center/ResearchMgt.vue

@@ -230,6 +230,8 @@ export default {
       subjectIndexArr: [],
       subjectIndexArr: [],
       tagIndexArr: [],
       tagIndexArr: [],
       tagList: [],
       tagList: [],
+      apiTags: [],
+      oldNewTags: [],
       analysisArr: [vm.$t('lessonRecord.count1'), vm.$t('lessonRecord.count2'), vm.$t('lessonRecord.count3'), vm.$t('lessonRecord.count4'), vm.$t('lessonRecord.count5'), vm.$t('lessonRecord.count6'), vm.$t('lessonRecord.count7')],
       analysisArr: [vm.$t('lessonRecord.count1'), vm.$t('lessonRecord.count2'), vm.$t('lessonRecord.count3'), vm.$t('lessonRecord.count4'), vm.$t('lessonRecord.count5'), vm.$t('lessonRecord.count6'), vm.$t('lessonRecord.count7')],
       analysisCount: [],
       analysisCount: [],
       isEdit: false,
       isEdit: false,
@@ -694,6 +696,7 @@ export default {
           this.$nextTick(() => {
           this.$nextTick(() => {
             this.$refs.baseForm.tags = res.setting.lessonTag
             this.$refs.baseForm.tags = res.setting.lessonTag
             this.tagList = res.setting.lessonTag
             this.tagList = res.setting.lessonTag
+            this.apiTags = this._.cloneDeep(this.tagList)
           })
           })
         }
         }
       })
       })
@@ -948,11 +951,34 @@ export default {
         this.$Message.warning(this.$t('lessonRecord.tagTip2'))
         this.$Message.warning(this.$t('lessonRecord.tagTip2'))
         return
         return
       }
       }
+      let oldVal = this.tags[this.curEditIndex]
+      let newVal = this.curEditTag
+      if (oldVal) {
+        if (this.oldNewTags.find(i => i._new === oldVal)) {
+          this.oldNewTags.find(i => i._new === oldVal)._new = newVal
+        } else {
+          this.oldNewTags.push({
+            _old: oldVal,
+            _new: newVal
+          })
+        }
+      }
       this.tags[this.curEditIndex] = this.curEditTag
       this.tags[this.curEditIndex] = this.curEditTag
       this.curEditIndex = -1
       this.curEditIndex = -1
     },
     },
     /* 删除类别 */
     /* 删除类别 */
     onDeleteTag(item, index) {
     onDeleteTag(item, index) {
+      if (this.apiTags.includes(item)) {
+        if (this.oldNewTags.find(i => i._new === item)) {
+          this.oldNewTags.find(i => i._new === item)._new = null
+        } else {
+          this.oldNewTags.push({
+            _old: item,
+            _new: null
+          })
+        }
+      }
+
       this.tags.splice(index, 1)
       this.tags.splice(index, 1)
       this.curEditIndex = -1
       this.curEditIndex = -1
     },
     },
@@ -973,12 +999,15 @@ export default {
       this.$api.lessonRecord.setLessonTags({
       this.$api.lessonRecord.setLessonTags({
         schoolId: this.$store.state.userInfo.schoolCode,
         schoolId: this.$store.state.userInfo.schoolCode,
         opt: 'UpsertLessonTag',
         opt: 'UpsertLessonTag',
-        lessonTag: saveTags
+        lessonTag: saveTags,
+        old_new: this.oldNewTags
       }).then(res => {
       }).then(res => {
         if (!res.error) {
         if (!res.error) {
           this.$Message.success(this.$t('lessonRecord.saveSuc'))
           this.$Message.success(this.$t('lessonRecord.saveSuc'))
           this.tagLoading = false
           this.tagLoading = false
           this.categoryModal = false
           this.categoryModal = false
+          this.apiTags = res.setting.lessonTag
+          this.oldNewTags = []
         }
         }
       })
       })
     }
     }