Pārlūkot izejas kodu

調整新增學校時的欄位

upon 1 gadu atpakaļ
vecāks
revīzija
70ee3baa86

+ 19 - 2
TEAMModelBI/ClientApp/src/view/created/created.vue

@@ -252,11 +252,15 @@
                 <p class="repetition-hint" v-if="repetition.code">该学校简码已存在,请检查学校信息</p>
               </template>
             </el-form-item>
+            <el-form-item label="規模版本" class="school-detailedly">
+              <el-input v-model="item.scaleVersion" placeholder="規模版本" />
+            </el-form-item>
           </el-form>
           <div class="confirmarea">
             <el-button type="primary" @click="verifyBase()" v-if="verifyForstate.state ===false">数据核验</el-button>
             <el-button type="success" @click="createdSchool()" :loading="createdSchoolLoading" v-else-if="verifyForstate.state===true && verifyForstate.pass===true ">{{ $t(`schoolManages.createSchools.submit`) }}</el-button>
             <!-- <el-button @click="closeandreturn('close', 'school')">重置</el-button> -->
+            <el-button @click="test_scaleVersion()">規模版本111</el-button>
             <el-button @click="resetForm()">重置</el-button>
           </div>
         </div>
@@ -329,6 +333,7 @@
               <el-button type="primary" v-if="verifyForstate.state ===false">数据核验</el-button>
               <el-button type="success" @click="createdSchool()" :loading="createdSchoolLoading" v-else-if="verifyForstate.state===true && verifyForstate.pass===true ">{{ $t(`schoolManages.createSchools.submit`) }}</el-button>
               <!-- <el-button @click="closeandreturn('close', 'school')">重置</el-button> -->
+              <el-button @click="test_scaleVersion()">規模版本</el-button>
               <el-button @click="resetForm()">重置</el-button>
             </div>
           </el-form>
@@ -1126,9 +1131,11 @@ export default {
           lang: schoolForm.value[0].lang === '1' ? 'zh-CN' : schoolForm.value[0].lang === '2' ? 'zh-TW' : schoolForm.value[0].lang === '3' ? 'en-US' : 'zh-CN',
           areaId: schoolForm.value[i].areaIdcreated,
           code: schoolForm.value[i].code,
-          modules:schoolForm.value[i].modules === 'default' ? []:['art']
+          modules:schoolForm.value[i].modules === 'default' ? []:['art'],
+          scaleVersion:schoolForm.value[i].scaleVersion
         })
       }
+      debugger;
       let parameter = { biSchools: datas, lang: schoolForm.value[0].lang === '1' ? 'zh-CN' : schoolForm.value[0].lang === '2' ? 'zh-TW' : schoolForm.value[0].lang === '3' ? 'en-US' : 'zh-CN' }
       console.log(schoolForm.value[0].lang)
       console.log(parameter, '创建学校最后的数据格式')
@@ -1167,6 +1174,12 @@ export default {
       schoolForm.value[0].modules  = 'default'
       provinceOptions.value.provinceValue = ''
     }
+
+    function test_scaleVersion (){
+      debugger;
+      alert(schoolForm.value[0].scaleVersion);
+    }
+
     //处理取消和确认并返回
     function closeandreturn (val, name) {
       let showState = selectModels.value
@@ -1606,6 +1619,7 @@ export default {
       //向表单赋值
       schoolForm.value[0].name = value.name
       schoolForm.value[0].code = value.code
+      debugger
       let periodList = []
       if (value.period !== null) {
         value.period.includes('21') ? periodList.push('小学') : ''
@@ -1681,6 +1695,7 @@ export default {
         }
         verifySchool.close()
       }).catch((error) => {
+        debugger;
         ElMessage.error('API异常,数据核验失败')
         verifySchool.close()
       })
@@ -1737,6 +1752,7 @@ export default {
         console.log(res.length, '核验数据')
         res.length == 0 ? (verifyForstate.value.state = true, verifyForstate.value.pass = true, ElMessage.success('数据已通过核验,可执行创校')) : (verifyForstate.value.state = false, verifyForstate.value.pass = false, ElMessage.error('数据未通过核验,BB学校资料库已存在此学校代码或简码。'))
       }).catch((error) => {
+        debugger;
         ElMessage.error('API异常,数据核验失败')
       })
       console.log(verifyData, '准备核验的数据')
@@ -2033,7 +2049,8 @@ export default {
       timer,
       selectSchoolstate,
       selectModels,
-      virtualSchoolform
+      virtualSchoolform,
+      test_scaleVersion
     }
   },
 }

+ 2 - 2
TEAMModelBI/Controllers/BINormal/AreaRelevantController.cs

@@ -193,7 +193,7 @@ namespace TEAMModelBI.Controllers.BINormal
                         return Ok(new { state = 401, msg = "区域已经规定了,不能切换能能力" });
                 }
 
-                School tempSchool = await cosmosClient.GetContainer(Constant.TEAMModelOS, "School").ReadItemAsync<School>($"{schoolId}", new PartitionKey($"{code}"));
+                SchoolScaleVersion tempSchool = await cosmosClient.GetContainer(Constant.TEAMModelOS, "School").ReadItemAsync<SchoolScaleVersion>($"{schoolId}", new PartitionKey($"{code}"));
                 if (bool.Parse($"{isDefault}") == true)
                 {
                     tempSchool.areaId = null;
@@ -234,7 +234,7 @@ namespace TEAMModelBI.Controllers.BINormal
                         }
                     }
                 }
-                School school = await cosmosClient.GetContainer(Constant.TEAMModelOS, "School").ReplaceItemAsync<School>(tempSchool, tempSchool.id, new PartitionKey($"{code}"));
+                SchoolScaleVersion school = await cosmosClient.GetContainer(Constant.TEAMModelOS, "School").ReplaceItemAsync<SchoolScaleVersion>(tempSchool, tempSchool.id, new PartitionKey($"{code}"));
 
                 //创建/修改学校信息中间件
                 //_ = _httpTrigger.RequestHttpTrigger(new { school = $"{school}" }, _option.Location, "set-sc-birelation");

+ 8 - 2
TEAMModelBI/Controllers/BISchool/BatchSchoolController.cs

@@ -193,7 +193,7 @@ namespace TEAMModelBI.Controllers.BISchool
                         if (createSchoolInfo.id != null)
                         {
                             string campusId = Guid.NewGuid().ToString();
-                            School upSchool = new()
+                            SchoolScaleVersion upSchool = new()
                             {
                                 id = createSchoolInfo.id,
                                 name = bischool.name,
@@ -219,6 +219,7 @@ namespace TEAMModelBI.Controllers.BISchool
                                 //modules=bischool.modules,
                                 openLessonRecord = (_option.Location.Contains("Global")) ? false : true,
                                 createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
+                                scaleVersion = bischool.scaleVersion
 
                             };
                             scInfos.Add(createSchoolInfo);
@@ -228,7 +229,7 @@ namespace TEAMModelBI.Controllers.BISchool
                             upSc.Add(upSchool.id);
 
                             //创建学校
-                            await cosmosClient.GetContainer(Constant.TEAMModelOS, "School").CreateItemAsync<School>(upSchool, new PartitionKey(upSchool.code));
+                            await cosmosClient.GetContainer(Constant.TEAMModelOS, "School").CreateItemAsync<SchoolScaleVersion>(upSchool, new PartitionKey(upSchool.code));
                             //创建学校信息中间件
                             //_ = _httpTrigger.RequestHttpTrigger(new { school = $"{upSchool}" }, _option.Location, "set-sc-birelation");
                             await BIStats.SetSchoolBIRelation(cosmosClient, blobClient, tableClient, _dingDing, upSchool);
@@ -1972,10 +1973,15 @@ namespace TEAMModelBI.Controllers.BISchool
             /// </summary>
             public string standard { get; set; }
             /// <summary>
+            /// 規模版本
+            /// </summary>
+            public string scaleVersion { get; set; }
+            /// <summary>
             /// 手动增加的模块 ["art"]
             /// </summary>
             //public List<string> modules { get; set; } = new List<string>();
         }
+        
 
         /// <summary>
         /// 学段类型和学段名称

+ 1 - 1
TEAMModelBI/Controllers/BISchool/SchoolController.cs

@@ -289,7 +289,7 @@ namespace TEAMModelBI.Controllers.BISchool
                     {
                         int index = schoolCodes.IndexOf(tempCode);
                         string code = codes[index];
-                        School school = await cosmosClient.GetContainer(Constant.TEAMModelOS, "School").ReadItemAsync<School>(tempCode, new PartitionKey($"{code}"));
+                        SchoolScaleVersion school = await cosmosClient.GetContainer(Constant.TEAMModelOS, "School").ReadItemAsync<SchoolScaleVersion>(tempCode, new PartitionKey($"{code}"));
                         if (school != null)
                         {
                             if (isManyArea)

+ 1 - 1
TEAMModelBI/Controllers/Census/SchoolController.cs

@@ -982,7 +982,7 @@ namespace TEAMModelBI.Controllers.Census
             {
                 schInBIRel.Add(item);
             }
-            await foreach (School school in cosmosClient.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<School>(queryText: $"SELECT * FROM c WHERE c.areaId='{areaId}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("Base") }))
+            await foreach (SchoolScaleVersion school in cosmosClient.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<School>(queryText: $"SELECT * FROM c WHERE c.areaId='{areaId}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("Base") }))
             {
                 string schId = school.id.ToString();
                 if (!schInBIRel.Contains(schId))

+ 8 - 0
TEAMModelOS.SDK/Models/Cosmos/BI/BISchool/BIRelation.cs

@@ -114,4 +114,12 @@ namespace TEAMModelOS.SDK.Models.Cosmos.BI.BISchool
         /// </summary>
         public string picture { get; set; }
     }
+
+    public class BIRelationScaleVersion : BIRelation
+    {
+        /// <summary>
+        /// 規模版本
+        /// </summary>
+        public string scaleVersion { get; set; }
+    }
 }

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

@@ -174,5 +174,12 @@ namespace TEAMModelOS.SDK.Models
     public class VirtualBase : School
     {
         public string areaName { get; set; }
-    } 
+    }
+    public class SchoolScaleVersion : School
+    {
+        /// <summary>
+        /// 規模版本
+        /// </summary>
+        public string scaleVersion { get; set; }
+    }
 }

+ 7 - 6
TEAMModelOS.SDK/Models/Service/BI/BIStats.cs

@@ -445,7 +445,7 @@ namespace TEAMModelOS.SDK.Models.Service.BI
         /// <param name="cosmosClient"></param>
         /// <param name="school"></param>
         /// <returns></returns>
-        public static async Task SetScStatsInfo(CosmosClient cosmosClient, DingDing _dingDing, School school)
+        public static async Task SetScStatsInfo(CosmosClient cosmosClient, DingDing _dingDing, SchoolScaleVersion school)
         {
             try
             {
@@ -506,17 +506,17 @@ namespace TEAMModelOS.SDK.Models.Service.BI
         /// <param name="_dingDing"></param>
         /// <param name="school"></param>
         /// <returns></returns>
-        public static async Task SetSchoolBIRelation(CosmosClient cosmosClient, BlobContainerClient blobClient, CloudTableClient tableClient, DingDing _dingDing, School school)
+        public static async Task SetSchoolBIRelation(CosmosClient cosmosClient, BlobContainerClient blobClient, CloudTableClient tableClient, DingDing _dingDing, SchoolScaleVersion school)
         {
             try
             {
                 string type = "";
-                BIRelation bIRelation = new();
+                BIRelationScaleVersion bIRelation = new();
                 var resBiRel = await cosmosClient.GetContainer(Constant.TEAMModelOS, "School").ReadItemStreamAsync(school.id, new PartitionKey("BIRel"));
                 if (resBiRel.Status == 200)
                 {
                     using var fileJson = await JsonDocument.ParseAsync(resBiRel.ContentStream);
-                    bIRelation = fileJson.ToObject<BIRelation>();
+                    bIRelation = fileJson.ToObject<BIRelationScaleVersion>();
                 }
                 else
                 {
@@ -540,15 +540,16 @@ namespace TEAMModelOS.SDK.Models.Service.BI
                 bIRelation.scale = school.scale;
                 bIRelation.upDate = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
                 bIRelation.areaName = aName;
+                bIRelation.scaleVersion = school.scaleVersion;
 
                 if (resBiRel.Status == 200)
                 {
-                    await cosmosClient.GetContainer(Constant.TEAMModelOS, "School").ReplaceItemAsync<BIRelation>(bIRelation, bIRelation.id, new PartitionKey("BIRel"));
+                    await cosmosClient.GetContainer(Constant.TEAMModelOS, "School").ReplaceItemAsync<BIRelationScaleVersion>(bIRelation, bIRelation.id, new PartitionKey("BIRel"));
                     type = "update";
                 }
                 else
                 {
-                    await cosmosClient.GetContainer(Constant.TEAMModelOS, "School").CreateItemAsync<BIRelation>(bIRelation, new PartitionKey("BIRel"));
+                    await cosmosClient.GetContainer(Constant.TEAMModelOS, "School").CreateItemAsync<BIRelationScaleVersion>(bIRelation, new PartitionKey("BIRel"));
                     type = "add";
                 }