Przeglądaj źródła

Merge branch 'develop3.0-tmd' of http://106.12.23.251:10080/TEAMMODEL/TEAMModelOS into develop3.0-tmd

CrazyIter_Bin 4 lat temu
rodzic
commit
1136823f08

+ 21 - 14
TEAMModelOS.SDK/DI/AzureCosmos/Inner/SQLHelper.cs

@@ -93,7 +93,7 @@ namespace TEAMModelOS.SDK.DI.AzureCosmos.Inner
                 }
                 else if (keyValuePair.Value is null)
                 {
-                    keyValuePairs.Add(keyValuePair.Key, keyValuePair.Value);
+                    //keyValuePairs.Add(keyValuePair.Key, keyValuePair.Value);
                 }
             }
 
@@ -727,20 +727,27 @@ namespace TEAMModelOS.SDK.DI.AzureCosmos.Inner
                 }
                 else
                 {
-                    Type s = value.GetType();
-                    TypeCode typeCode = Type.GetTypeCode(s);
+                    if (value != null)
+                    {
+                        Type s = value.GetType();
+                        TypeCode typeCode = Type.GetTypeCode(s);
 
-                    return typeCode switch
-                    {
-                        TypeCode.String => logicOper + " c." + key + CompareOpers[compareOperNum] + " @" + key1,// + "\'" + value.ToString() + "\'",
-                        TypeCode.Char => logicOper + " c." + key + CompareOpers[compareOperNum] + " @" + key1,//  + "\'"  + value.ToString() + "\'",
-                        TypeCode.Int32 => logicOper + "  c." + key + CompareOpers[compareOperNum] + " @" + key1,// + int.Parse(value.ToString()),
-                        TypeCode.Double => logicOper + "  c." + key + CompareOpers[compareOperNum] + " @" + key1,// + double.Parse(value.ToString()),
-                        TypeCode.Boolean => logicOper + "  c." + key + CompareOpers[compareOperNum] + " @" + key1,//  + bool.Parse(value.ToString()),
-                        TypeCode.DateTime => logicOper + "  c." + key + CompareOpers[compareOperNum] + " @" + key1,//  + (DateTime)value,
-                        TypeCode.Int64 => logicOper + "  c." + key + CompareOpers[compareOperNum] + " @" + key1,// + long.Parse(value.ToString()),
-                        _ => null,
-                    };
+                        return typeCode switch
+                        {
+                            TypeCode.String => logicOper + " c." + key + CompareOpers[compareOperNum] + " @" + key1,// + "\'" + value.ToString() + "\'",
+                            TypeCode.Char => logicOper + " c." + key + CompareOpers[compareOperNum] + " @" + key1,//  + "\'"  + value.ToString() + "\'",
+                            TypeCode.Int32 => logicOper + "  c." + key + CompareOpers[compareOperNum] + " @" + key1,// + int.Parse(value.ToString()),
+                            TypeCode.Double => logicOper + "  c." + key + CompareOpers[compareOperNum] + " @" + key1,// + double.Parse(value.ToString()),
+                            TypeCode.Boolean => logicOper + "  c." + key + CompareOpers[compareOperNum] + " @" + key1,//  + bool.Parse(value.ToString()),
+                            TypeCode.DateTime => logicOper + "  c." + key + CompareOpers[compareOperNum] + " @" + key1,//  + (DateTime)value,
+                            TypeCode.Int64 => logicOper + "  c." + key + CompareOpers[compareOperNum] + " @" + key1,// + long.Parse(value.ToString()),
+                            _ => null,
+                        };
+                    }
+                    else {
+                        return logicOper + " c." + key + CompareOpers[compareOperNum] + " @" + key1;
+                    }
+                    
                 }
             }
         }

+ 5 - 5
TEAMModelOS.SDK/Models/Cosmos/Common/Knowledge.cs

@@ -71,13 +71,13 @@ namespace TEAMModelOS.SDK.Models
         ///  来自于标准表 Rowkey
         /// </summary>
         
-        [Required(ErrorMessage = "{0} 必须填写")]
-        public string knowledgeId { get; set; }
+/*        [Required(ErrorMessage = "{0} 必须填写")]
+        public string knowledgeId { get; set; }*/
 
         /// <summary>
         /// 0 标准,1自建,2.....
         /// </summary>
-        
+
         [Required(ErrorMessage = "{0} 必须填写")]
         public int source { get; set; }
 
@@ -87,7 +87,7 @@ namespace TEAMModelOS.SDK.Models
         ///[Required(ErrorMessage = "{0} 必须填写")]
         
         public string periodId { get; set; }
-        public int ownCount { get; set; }
-        public int openCount { get; set; }
+/*        public int ownCount { get; set; }
+        public int openCount { get; set; }*/
     }
 }

+ 12 - 12
TEAMModelOS/ClientApp/src/utils/evTools.js

@@ -9,7 +9,7 @@ export default {
 		return new Promise((r,j) => {
 			let itemJson = {
 				id:item.id,
-				pId:item.pId || '',
+				pid:item.pid || null,
 				exercise:{
 					answer:item.answer,
 					explain:item.explain,
@@ -41,7 +41,7 @@ export default {
 		return new Promise((r,j) => {
 			let cosmosItem  = {
 				id:item.id,
-				pId:item.pId || '',
+				pid:item.pid || null,
 				code:item.code,
 				scope:item.scope,
 				score:0,
@@ -129,7 +129,7 @@ export default {
 						jsonData.exercise.code = list[i].code
 						jsonData.exercise.option = jsonData.item[0].option
 						jsonData.exercise.id = list[i].id
-						jsonData.exercise.pId = jsonData.pId
+						jsonData.exercise.pid = jsonData.pid
 						r(jsonData.exercise)
 					}else{
 						r(null)
@@ -198,7 +198,7 @@ export default {
 					jsonData.exercise.code = code
 					jsonData.exercise.option = jsonData.item[0].option
 					jsonData.exercise.id = jsonData.id
-					jsonData.exercise.pId = jsonData.pId
+					jsonData.exercise.pid = jsonData.pid
 					r(jsonData.exercise)
 				}))
 			})
@@ -235,7 +235,7 @@ export default {
 							itemJson.exercise.question = itemJson.item[0].question
 							itemJson.exercise.option = itemJson.item[0].option
 							itemJson.exercise.id = itemJson.id 
-							itemJson.exercise.pId = itemJson.pId 
+							itemJson.exercise.pid = itemJson.pid 
 							itemJson.exercise.score = item.scoring ? item.scoring.score : 0,
 							resolve(itemJson.exercise)
 						}))
@@ -245,13 +245,13 @@ export default {
 						console.log(res)
 						res.forEach((resItem,resIndex) => {
 							resItem.children = []
-							if(resItem.pId){
-								let pItem = res.filter(i => i.id === resItem.pId)[0]
+							if(resItem.pid){
+								let pItem = res.filter(i => i.id === resItem.pid)[0]
 								pItem.children.push(resItem)
 								pItem.score = pItem.score + resItem.score
 							}
 						})
-						jsonData.item = res.filter(i => !i.pId)
+						jsonData.item = res.filter(i => !i.pid)
 						r(jsonData)
 					})
 				}
@@ -285,7 +285,7 @@ export default {
 							itemJson.exercise.question = itemJson.item[0].question
 							itemJson.exercise.option = itemJson.item[0].option
 							itemJson.exercise.id = itemJson.id 
-							itemJson.exercise.pId = itemJson.pId 
+							itemJson.exercise.pid = itemJson.pid 
 							itemJson.exercise.score = item.scoring ? item.scoring.score : 0,
 							// jsonData.item.push(itemJson.exercise)
 							resolve(itemJson.exercise)
@@ -295,13 +295,13 @@ export default {
 					Promise.all(promiseArr).then(res => {
 						res.forEach((resItem,resIndex) => {
 							resItem.children = []
-							if(resItem.pId){
-								let pItem = res.filter(i => i.id === resItem.pId)[0]
+							if(resItem.pid){
+								let pItem = res.filter(i => i.id === resItem.pid)[0]
 								pItem.children.push(resItem)
 								pItem.score = pItem.score + resItem.score
 							}
 						})
-						jsonData.item = res.filter(i => !i.pId)
+						jsonData.item = res.filter(i => !i.pid)
 						r(jsonData)
 					})
 				}

+ 1 - 1
TEAMModelOS/ClientApp/src/view/evaluation/bank/ExerciseList.vue

@@ -331,7 +331,7 @@
 					type: this.deleteFalse(this.filterType),
 					field: this.deleteFalse(this.filterField),
 					scope: this.curScope,
-					pId:''
+					pid:null
 				};
 				this.getExerciseList(this.filterParams);
 			},

+ 1 - 1
TEAMModelOS/ClientApp/src/view/evaluation/components/BaseEditExercise.vue

@@ -331,7 +331,7 @@
 								child.gradeIds = exerciseItem.gradeIds
 								child.subjectId = exerciseItem.subjectId
 								child.scope = exerciseItem.scope
-								child.pId = exerciseItem.id
+								child.pid = exerciseItem.id
 							})
 							console.log(exerciseItem)
 							exerciseItem.children  = await this.saveChildrens(exerciseItem.children)

+ 343 - 376
TEAMModelOS/ClientApp/src/view/evaluation/components/BaseFilter.vue

@@ -1,413 +1,380 @@
 <template>
-  <div class="filter-wrap">
-    <div class="filter-item" v-show="!isShowSchoolBank">
-      <span class="filter-title">来源:</span>
-      <RadioGroup
-        v-model="filterOrigin"
-        type="button"
-        @on-change="filterOriginChange"
-      >
-        <Radio :label="schoolCode" v-if="isShowSchoolBank">校本试卷库</Radio>
-        <Radio :label="userId">个人试卷库</Radio>
-        <Radio :label="schoolCode" v-if="!isShowSchoolBank && hasSchool"
-          >校本试卷库</Radio
-        >
-      </RadioGroup>
-    </div>
-    <div class="filter-item" v-show="isShowSchoolBank || (filterOrigin === schoolCode)">
-      <span class="filter-title">学段:</span>
-      <RadioGroup
-        v-model="filterPeriod"
-        type="button"
-        @on-change="filterPeriodChange"
-      >
-        <Radio
-          v-for="(item, index) in periodList"
-          :key="index"
-          :label="index"
-          >{{ item.name }}</Radio
-        >
-      </RadioGroup>
-    </div>
-    <div class="filter-item" v-show="isShowSchoolBank || (filterOrigin === schoolCode)">
-      <span class="filter-title">年级:</span>
-      <CheckboxGroup
-        v-model="filterGrade"
-        border
-        @on-change="filterGradeChange"
-      >
-        <Checkbox lable="all">全部</Checkbox>
-        <Checkbox
-          v-for="(item, index) in gradeList"
-          :key="index"
-          :label="item.id"
-          >{{ item.name }}</Checkbox
-        >
-      </CheckboxGroup>
-    </div>
-    <div class="filter-item" v-show="isShowSchoolBank || (filterOrigin === schoolCode)">
-      <span class="filter-title">科目:</span>
-      <CheckboxGroup
-        v-model="filterSubject"
-        border
-        @on-change="filterSubjectChange"
-      >
-        <Checkbox lable="all">全部</Checkbox>
-        <Checkbox
-          v-for="(item, index) in subjectList"
-          :key="index"
-          :label="item.id"
-          >{{ item.name }}</Checkbox
-        >
-      </CheckboxGroup>
-    </div>
-    <div class="filter-item">
-      <span class="filter-title">排序:</span>
-      <RadioGroup
-        v-model="filterSort"
-        type="button"
-        @on-change="filterSortChange"
-      >
-        <Radio label="createTime"
-          >新增时间<Icon type="md-arrow-round-down"
-        /></Radio>
-        <Radio label="useCount"
-          >使用次数<Icon type="md-arrow-round-down"
-        /></Radio>
-      </RadioGroup>
-    </div>
-  </div>
+	<div class="filter-wrap">
+		<div class="filter-item" v-show="!isShowSchoolBank">
+			<span class="filter-title">来源:</span>
+			<RadioGroup v-model="filterOrigin" type="button" @on-change="filterOriginChange">
+				<Radio :label="schoolCode" v-if="isShowSchoolBank">校本试卷库</Radio>
+				<Radio :label="userId">个人试卷库</Radio>
+				<Radio :label="schoolCode" v-if="!isShowSchoolBank && hasSchool">校本试卷库</Radio>
+			</RadioGroup>
+		</div>
+		<div class="filter-item" v-show="(isShowSchoolBank || (filterOrigin === schoolCode)) &&  hasSchool">
+			<span class="filter-title">学段:</span>
+			<RadioGroup v-model="filterPeriod" type="button" @on-change="filterPeriodChange">
+				<Radio v-for="(item, index) in periodList" :key="index" :label="index">{{ item.name }}</Radio>
+			</RadioGroup>
+		</div>
+		<div class="filter-item" v-show="(isShowSchoolBank || (filterOrigin === schoolCode)) &&  hasSchool">
+			<span class="filter-title">年级:</span>
+			<CheckboxGroup v-model="filterGrade" border @on-change="filterGradeChange">
+				<Checkbox lable="all">全部</Checkbox>
+				<Checkbox v-for="(item, index) in gradeList" :key="index" :label="item.id">{{ item.name }}</Checkbox>
+			</CheckboxGroup>
+		</div>
+		<div class="filter-item" v-show="(isShowSchoolBank || (filterOrigin === schoolCode)) &&  hasSchool">
+			<span class="filter-title">科目:</span>
+			<CheckboxGroup v-model="filterSubject" border @on-change="filterSubjectChange">
+				<Checkbox lable="all">全部</Checkbox>
+				<Checkbox v-for="(item, index) in subjectList" :key="index" :label="item.id">{{ item.name }}</Checkbox>
+			</CheckboxGroup>
+		</div>
+		<div class="filter-item">
+			<span class="filter-title">排序:</span>
+			<RadioGroup v-model="filterSort" type="button" @on-change="filterSortChange">
+				<Radio label="createTime">新增时间
+					<Icon type="md-arrow-round-down" />
+				</Radio>
+				<Radio label="useCount">使用次数
+					<Icon type="md-arrow-round-down" />
+				</Radio>
+			</RadioGroup>
+		</div>
+	</div>
 </template>
 <script>
-export default {
-  components: {},
-  props: {
-    period: {
-      type: String,
-      default: "",
-    },
-    subject: {
-      type: String,
-      default: "",
-    },
-    isFilterPaper: {
-      type: Boolean,
-      default: false,
-    },
-  },
-  data() {
-    return {
-      userId: "",
-      schoolCode: "",
-      schoolInfo: {},
-      isShowSchoolBank: false,
-      isShowUploadList: false,
-      exersicesType: {
-        Single: "单选",
-        Multiple: "多选",
-        Judge: "判断",
-        Complete: "填空",
-        Subjective: "问答",
-        Compose: "综合题",
-      },
-      exersicesDiff: ["容易", "较易", "一般", "较难", "困难"],
-      diffColors: ["#32CF74", "#E8BE15", "#F19300", "#EB5E00", "#D30000"],
-      filterType: ["all"],
-      filterOrigin: "",
-      filterDiff: ["all"],
-      filterField: ["all"],
-      filterSort: "createTime",
-      filterPeriod: 0,
-      filterGrade: [false],
-      filterSubject: [false],
-      collapseList: [],
-      periodList: [],
-      gradeList: [],
-      subjectList: [],
-      filterParams: {},
-    };
-  },
-  created() {
-    this.isShowSchoolBank = this.$route.name === "schoolBank";
-    this.getSchoolInfo();
-    this.$EventBus.$on("showSchoolBank", (val) => {
-      if (val) {
-        this.isShowSchoolBank = val;
-        this.filterOrigin = this.schoolCode;
-      } else {
-        this.isShowSchoolBank = false;
-      }
-    });
-  },
-  methods: {
-    /** 获取区班校信息 */
-    getSchoolInfo() {
-      this.$store.dispatch("user/getSchoolProfile").then((res) => {
-        let schoolBaseInfo = res.school_base;
-        if (schoolBaseInfo) {
-          this.schoolInfo = schoolBaseInfo;
-          this.schoolCode = schoolBaseInfo.id;
-          this.userId = this.$store.state.userInfo.TEAMModelId;
-          this.filterOrigin = this.isShowSchoolBank
-            ? this.$store.state.userInfo.schoolCode
-            : this.$store.state.userInfo.TEAMModelId;
-          this.periodList = schoolBaseInfo.period;
-          if (schoolBaseInfo.period.length) {
-            this.gradeList = schoolBaseInfo.period[0].grades;
-            this.subjectList = schoolBaseInfo.period[0].subjects;
-          }
-        }
-		this.doFilter();
-      }).catch(err => {
-		  console.log(err)
-		  this.doFilter();
-	  })
-    },
+	export default {
+		components: {},
+		props: {
+			period: {
+				type: String,
+				default: "",
+			},
+			subject: {
+				type: String,
+				default: "",
+			},
+			isFilterPaper: {
+				type: Boolean,
+				default: false,
+			},
+		},
+		data() {
+			return {
+				userId: "",
+				schoolCode: "",
+				schoolInfo: {},
+				isShowSchoolBank: false,
+				isShowUploadList: false,
+				exersicesType: {
+					Single: "单选",
+					Multiple: "多选",
+					Judge: "判断",
+					Complete: "填空",
+					Subjective: "问答",
+					Compose: "综合题",
+				},
+				exersicesDiff: ["容易", "较易", "一般", "较难", "困难"],
+				diffColors: ["#32CF74", "#E8BE15", "#F19300", "#EB5E00", "#D30000"],
+				filterType: ["all"],
+				filterOrigin: "",
+				filterDiff: ["all"],
+				filterField: ["all"],
+				filterSort: "createTime",
+				filterPeriod: 0,
+				filterGrade: [false],
+				filterSubject: [false],
+				collapseList: [],
+				periodList: [],
+				gradeList: [],
+				subjectList: [],
+				filterParams: {},
+			};
+		},
+		created() {
+			this.isShowSchoolBank = this.$route.name === "schoolBank";
+			this.userId = this.$store.state.userInfo.TEAMModelId;
+			this.getSchoolInfo();
+			this.$EventBus.$on("showSchoolBank", (val) => {
+				if (val) {
+					this.isShowSchoolBank = val;
+					this.filterOrigin = this.schoolCode;
+				} else {
+					this.isShowSchoolBank = false;
+					this.filterOrigin = this.$store.state.userInfo.TEAMModelId;
+				}
+			});
+		},
+		methods: {
+			/** 获取区班校信息 */
+			getSchoolInfo() {
+				this.$store.dispatch("user/getSchoolProfile").then((res) => {
+					let schoolBaseInfo = res.school_base;
+					if (schoolBaseInfo) {
+						this.schoolInfo = schoolBaseInfo;
+						this.schoolCode = schoolBaseInfo.id;
+						this.userId = this.$store.state.userInfo.TEAMModelId;
+						this.filterOrigin = this.isShowSchoolBank ?
+							this.$store.state.userInfo.schoolCode :
+							this.$store.state.userInfo.TEAMModelId;
+						this.periodList = schoolBaseInfo.period;
+						if (schoolBaseInfo.period.length) {
+							this.gradeList = schoolBaseInfo.period[0].grades;
+							this.subjectList = schoolBaseInfo.period[0].subjects;
+						}
+					}
+					this.doFilter();
+				}).catch(err => {
+					console.log(err)
+					this.doFilter();
+				})
+			},
 
-    /** 执行筛选条件获取数据 */
-    doFilter() {
-      /** 定义查询接口的参数规格 */
-      this.filterParams = {
-        filterSort: this.filterSort,
-        code: (this.isShowSchoolBank || (this.filterOrigin === this.schoolCode)) ? this.$store.state.userInfo.schoolCode : this.$store.state.userInfo.TEAMModelId,
-        periodId: (this.isShowSchoolBank || (this.filterOrigin === this.schoolCode)) && this.periodList.length ? [this.periodList[this.filterPeriod].id] : [],
-        gradeIds: (this.isShowSchoolBank || (this.filterOrigin === this.schoolCode)) ?
-        	this.deleteFalse(this.filterGrade) : [],
-        subjectId: (this.isShowSchoolBank || (this.filterOrigin === this.schoolCode)) ?
-        	this.deleteFalse(this.filterSubject) : [],
-        level: this.deleteFalse(this.filterDiff),
-        type: this.deleteFalse(this.filterType),
-        field: this.deleteFalse(this.filterField)
-      };
+			/** 执行筛选条件获取数据 */
+			doFilter() {
+				/** 定义查询接口的参数规格 */
+				this.filterParams = {
+					filterSort: this.filterSort,
+					code: (this.isShowSchoolBank || (this.filterOrigin === this.schoolCode)) ? this.$store.state.userInfo.schoolCode :
+						this.$store.state.userInfo.TEAMModelId,
+					periodId: (this.isShowSchoolBank || (this.filterOrigin === this.schoolCode)) && this.periodList.length ? [this.periodList[
+						this.filterPeriod].id] : [],
+					gradeIds: (this.isShowSchoolBank || (this.filterOrigin === this.schoolCode)) ?
+						this.deleteFalse(this.filterGrade) : [],
+					subjectId: (this.isShowSchoolBank || (this.filterOrigin === this.schoolCode)) ?
+						this.deleteFalse(this.filterSubject) : [],
+					level: this.deleteFalse(this.filterDiff),
+					type: this.deleteFalse(this.filterType),
+					field: this.deleteFalse(this.filterField)
+				};
 
-      this.$emit("onChange", this.filterParams);
-    },
+				this.$emit("onChange", this.filterParams);
+			},
 
-    /**
-     * 筛选学段条件
-     * @param val
-     */
-    filterPeriodChange(val) {
-      // this.filterPeriod = this.periodList[val].periodCode
-      this.gradeList = this.schoolInfo.period[val].grades;
-      this.subjectList = this.schoolInfo.period[val].subjects;
-      this.filterGrade = [false];
-      this.filterSubject = [false];
-      this.doFilter();
-    },
+			/**
+			 * 筛选学段条件
+			 * @param val
+			 */
+			filterPeriodChange(val) {
+				// this.filterPeriod = this.periodList[val].periodCode
+				this.gradeList = this.schoolInfo.period[val].grades;
+				this.subjectList = this.schoolInfo.period[val].subjects;
+				this.filterGrade = [false];
+				this.filterSubject = [false];
+				this.doFilter();
+			},
 
-    /**
-     * 筛选年级
-     * @param val
-     */
-    filterGradeChange(val) {
-      if (val.length > 1 && val.indexOf(false) === 0) {
-        this.filterGrade.splice(val.indexOf(false), 1);
-      } else if (val.indexOf(false) > -1 || val.length === 0) {
-        this.filterGrade = [false];
-      }
-      this.doFilter();
-    },
+			/**
+			 * 筛选年级
+			 * @param val
+			 */
+			filterGradeChange(val) {
+				if (val.length > 1 && val.indexOf(false) === 0) {
+					this.filterGrade.splice(val.indexOf(false), 1);
+				} else if (val.indexOf(false) > -1 || val.length === 0) {
+					this.filterGrade = [false];
+				}
+				this.doFilter();
+			},
 
-    /**
-     * 筛选科目
-     * @param val
-     */
-    filterSubjectChange(val) {
-      if (val.length > 1 && val.indexOf(false) === 0) {
-        this.filterSubject.splice(val.indexOf(false), 1);
-      } else if (val.indexOf(false) > -1 || val.length === 0) {
-        this.filterSubject = [false];
-      }
-      this.doFilter();
-    },
+			/**
+			 * 筛选科目
+			 * @param val
+			 */
+			filterSubjectChange(val) {
+				if (val.length > 1 && val.indexOf(false) === 0) {
+					this.filterSubject.splice(val.indexOf(false), 1);
+				} else if (val.indexOf(false) > -1 || val.length === 0) {
+					this.filterSubject = [false];
+				}
+				this.doFilter();
+			},
 
-    /**
-     * 根据题库加载题目
-     * @param val
-     */
-    filterOriginChange(origin) {
-      this.filterOrigin = origin;
-      this.doFilter();
-    },
+			/**
+			 * 根据题库加载题目
+			 * @param val
+			 */
+			filterOriginChange(origin) {
+				this.filterOrigin = origin;
+				this.doFilter();
+			},
 
-    /**
-     * 筛选题型
-     * @param val
-     */
-    filterTypeChange(val) {
-      if (val.length > 1 && val.indexOf("all") === 0) {
-        this.filterType.splice(val.indexOf("all"), 1);
-      } else if (val.indexOf("all") > -1 || val.length === 0) {
-        this.filterType = ["all"];
-      }
-      this.doFilter();
-    },
+			/**
+			 * 筛选题型
+			 * @param val
+			 */
+			filterTypeChange(val) {
+				if (val.length > 1 && val.indexOf("all") === 0) {
+					this.filterType.splice(val.indexOf("all"), 1);
+				} else if (val.indexOf("all") > -1 || val.length === 0) {
+					this.filterType = ["all"];
+				}
+				this.doFilter();
+			},
 
-    /**
-     * 筛选难度
-     * @param val
-     */
-    filterDiffChange(val) {
-      if (val.length > 1 && val.indexOf("all") === 0) {
-        this.filterDiff.splice(val.indexOf("all"), 1);
-      } else if (val.indexOf("all") > -1 || val.length === 0) {
-        this.filterDiff = ["all"];
-      }
-      this.doFilter();
-    },
+			/**
+			 * 筛选难度
+			 * @param val
+			 */
+			filterDiffChange(val) {
+				if (val.length > 1 && val.indexOf("all") === 0) {
+					this.filterDiff.splice(val.indexOf("all"), 1);
+				} else if (val.indexOf("all") > -1 || val.length === 0) {
+					this.filterDiff = ["all"];
+				}
+				this.doFilter();
+			},
 
-    /**
-     * 筛选认知层次
-     * @param val
-     */
-    filterFieldChange(val) {
-      if (val.length > 1 && val.indexOf("all") === 0) {
-        this.filterField.splice(val.indexOf("all"), 1);
-      } else if (val.indexOf("all") > -1 || val.length === 0) {
-        this.filterField = ["all"];
-      }
-      this.doFilter();
-    },
+			/**
+			 * 筛选认知层次
+			 * @param val
+			 */
+			filterFieldChange(val) {
+				if (val.length > 1 && val.indexOf("all") === 0) {
+					this.filterField.splice(val.indexOf("all"), 1);
+				} else if (val.indexOf("all") > -1 || val.length === 0) {
+					this.filterField = ["all"];
+				}
+				this.doFilter();
+			},
 
-    /**
-     * 排序条件更换
-     * @param val
-     */
-    filterSortChange(val) {
-      this.doFilter(1);
-    },
+			/**
+			 * 排序条件更换
+			 * @param val
+			 */
+			filterSortChange(val) {
+				this.doFilter(1);
+			},
 
-    /**
-     * 删除筛选条件里面的False值与All值
-     * @param arr
-     */
-    deleteFalse(arr) {
-      let list = JSON.parse(JSON.stringify(arr));
-      list.forEach((item, index) => {
-        if (!item || item === "all") list.splice(index, 1);
-      });
-      return list;
-    },
-  },
+			/**
+			 * 删除筛选条件里面的False值与All值
+			 * @param arr
+			 */
+			deleteFalse(arr) {
+				let list = JSON.parse(JSON.stringify(arr));
+				list.forEach((item, index) => {
+					if (!item || item === "all") list.splice(index, 1);
+				});
+				return list;
+			},
+		},
 
-  mounted() {},
-  computed: {
-    hasSchool() {
-      let user = JSON.parse(
-        decodeURIComponent(localStorage.user_profile, "utf-8")
-      );
-      return (
-	    user.schools &&
-        user.schools.length &&
-        user.schools.filter((i) => i.status === "join").length > 0
-      );
-    },
-  },
-};
+		mounted() {},
+		computed: {
+			hasSchool() {
+				let user = JSON.parse(
+					decodeURIComponent(localStorage.user_profile, "utf-8")
+				);
+				return (
+					user.schools &&
+					user.schools.length &&
+					user.schools.filter((i) => i.status === "join").length > 0
+				);
+			},
+		},
+	};
 </script>
 
 <style scoped>
-.filter-wrap {
-  width: 100%;
-  padding: 20px;
-  background: #fff;
-}
+	.filter-wrap {
+		width: 100%;
+		padding: 20px;
+		background: #fff;
+	}
 
-.filter-wrap .filter-item:first-child {
-  margin-top: 0px;
-}
+	.filter-wrap .filter-item:first-child {
+		margin-top: 0px;
+	}
 
-.filter-wrap .filter-item {
-  margin-top: 10px;
-}
+	.filter-wrap .filter-item {
+		margin-top: 10px;
+	}
 
-.filter-wrap .filter-title {
-  font-size: 16px;
-  font-weight: bold;
-  margin-right: 10px;
-}
+	.filter-wrap .filter-title {
+		font-size: 16px;
+		font-weight: bold;
+		margin-right: 10px;
+	}
 
-.filter-wrap .ivu-radio-group {
-  padding-bottom: 4px;
-}
+	.filter-wrap .ivu-radio-group {
+		padding-bottom: 4px;
+	}
 
-.filter-wrap .ivu-radio-wrapper {
-  padding: 0 10px;
-  margin-left: 15px;
-  height: 28px;
-  line-height: 28px;
-  box-shadow: none !important;
-  border: none !important;
-  font-size: 14px;
-  border-radius: 0 !important;
-}
+	.filter-wrap .ivu-radio-wrapper {
+		padding: 0 10px;
+		margin-left: 15px;
+		height: 28px;
+		line-height: 28px;
+		box-shadow: none !important;
+		border: none !important;
+		font-size: 14px;
+		border-radius: 0 !important;
+	}
 
-.filter-wrap .ivu-radio-wrapper .ivu-icon {
-  margin-bottom: 2px;
-}
+	.filter-wrap .ivu-radio-wrapper .ivu-icon {
+		margin-bottom: 2px;
+	}
 
-.filter-wrap .ivu-radio-wrapper:after,
-.ivu-radio-group-button .ivu-radio-wrapper:before {
-  content: none;
-}
+	.filter-wrap .ivu-radio-wrapper:after,
+	.ivu-radio-group-button .ivu-radio-wrapper:before {
+		content: none;
+	}
 
-.filter-wrap .ivu-radio-group-item {
-  border-radius: 5px !important;
-}
+	.filter-wrap .ivu-radio-group-item {
+		border-radius: 5px !important;
+	}
 
-.filter-wrap .ivu-radio-wrapper-checked {
-  background: rgb(16, 171, 231);
-  box-shadow: none !important;
-  color: white;
-}
+	.filter-wrap .ivu-radio-wrapper-checked {
+		background: rgb(16, 171, 231);
+		box-shadow: none !important;
+		color: white;
+	}
 
-.filter-wrap .ivu-radio-group-button .ivu-radio-wrapper-checked:hover {
-  color: #fff !important;
-}
+	.filter-wrap .ivu-radio-group-button .ivu-radio-wrapper-checked:hover {
+		color: #fff !important;
+	}
 
-.filter-wrap .ivu-checkbox-group {
-  padding-bottom: 4px;
-  display: inline-block;
-}
+	.filter-wrap .ivu-checkbox-group {
+		padding-bottom: 4px;
+		display: inline-block;
+	}
 
-.filter-wrap .ivu-checkbox-inner,
-.filter-wrap .ivu-checkbox-checked,
-.filter-wrap .ivu-checkbox {
-  display: none;
-}
+	.filter-wrap .ivu-checkbox-inner,
+	.filter-wrap .ivu-checkbox-checked,
+	.filter-wrap .ivu-checkbox {
+		display: none;
+	}
 
-.filter-wrap .ivu-checkbox-wrapper {
-  padding: 0 10px;
-  margin-left: 15px;
-  height: 28px;
-  line-height: 28px;
-  box-shadow: none !important;
-  border: none !important;
-  font-size: 14px;
-  border-radius: 0 !important;
-}
+	.filter-wrap .ivu-checkbox-wrapper {
+		padding: 0 10px;
+		margin-left: 15px;
+		height: 28px;
+		line-height: 28px;
+		box-shadow: none !important;
+		border: none !important;
+		font-size: 14px;
+		border-radius: 0 !important;
+	}
 
-.filter-wrap .ivu-checkbox-wrapper .ivu-icon {
-  margin-bottom: 2px;
-}
+	.filter-wrap .ivu-checkbox-wrapper .ivu-icon {
+		margin-bottom: 2px;
+	}
 
-.filter-wrap .ivu-checkbox-wrapper:after,
-.ivu-checkbox-group-button .ivu-checkbox-wrapper:before {
-  content: none;
-}
+	.filter-wrap .ivu-checkbox-wrapper:after,
+	.ivu-checkbox-group-button .ivu-checkbox-wrapper:before {
+		content: none;
+	}
 
-.filter-wrap .ivu-checkbox-group-item {
-  border-radius: 5px !important;
-}
+	.filter-wrap .ivu-checkbox-group-item {
+		border-radius: 5px !important;
+	}
 
-.filter-wrap .ivu-checkbox-wrapper-checked {
-  background: rgb(16, 171, 231);
-  box-shadow: none !important;
-  color: white;
-}
+	.filter-wrap .ivu-checkbox-wrapper-checked {
+		background: rgb(16, 171, 231);
+		box-shadow: none !important;
+		color: white;
+	}
 
-.filter-wrap .ivu-checkbox-group-button .ivu-checkbox-wrapper-checked:hover {
-  color: #fff !important;
-}
+	.filter-wrap .ivu-checkbox-group-button .ivu-checkbox-wrapper-checked:hover {
+		color: #fff !important;
+	}
 </style>

+ 1 - 1
TEAMModelOS/ClientApp/src/view/evaluation/index/CreateExercises.vue

@@ -348,7 +348,7 @@
 							child.subjectId = exerciseItem.subjectId
 							child.scope = exerciseItem.scope
 							child.code = exerciseItem.code
-							child.pId = exerciseItem.id
+							child.pid = exerciseItem.id
 						})
 						exerciseItem.children  = await this.saveChildrens(exerciseItem.children)
 					}

+ 6 - 3
TEAMModelOS/ClientApp/src/view/evaluation/index/CreatePaper.vue

@@ -61,7 +61,7 @@
 									<AutoCreate :subjectCode="propSubject" @goToPreview="goToPreview" @autoQuestions="getAutoQuestions"></AutoCreate>
 								</TabPane>
 								<TabPane label="备选题目" name="manual" v-if="evaluationInfo.createType == 'manual'" :index="2" tab="createTest">
-									<ManualCreate :questionList="questionList" :subjectId="propSubject" :selQue="evaluationInfo.item" @goToPreview="goToPreview"
+									<ManualCreate :questionList="questionList" :subjectCode="propSubject" :periodCode="propPeriod" :selQue="evaluationInfo.item" @goToPreview="goToPreview"
 									 @selectedQuestion="getSelectedQuestion"></ManualCreate>
 								</TabPane>
 								<TabPane label="导入说明" name="import" v-if="evaluationInfo.createType == 'import'" :index="3" tab="createTest">
@@ -89,7 +89,7 @@
 </template>
 <script>
 	import blobTool from '@/utils/blobTool.js'
-	import AutoCreate from '@/view/learnactivity/AutoCreate.vue'
+	import AutoCreate from '@/view/learnactivity/AutoCreateNew.vue'
 	import ManualCreate from '@/view/learnactivity/ManualCreate.vue'
 	import ImportCreate from '@/view/learnactivity/ImportCreate.vue'
 	import TeacherPreview from '@/view/learnactivity/TeacherPreview.vue'
@@ -243,7 +243,7 @@
 						if (i.children.length) {
 							i.children.forEach(j => {
 								j.id = this.$tools.guid()
-								j.pId = i.id
+								j.pid = i.id
 								j.scope = i.scope
 								j.code = code
 								j.level = 3
@@ -872,6 +872,9 @@
 			isSchool() {
 				return this.$route.name === 'newSchoolPaper'
 			},
+			propPeriod() {
+				return this.$route.name === 'newSchoolPaper' && this.subjectList.length ? this.schoolInfo.period[this.evaluationInfo.paperPeriod].id : null
+			},
 			propSubject() {
 				return this.$route.name === 'newSchoolPaper' && this.subjectList.length ? this.subjectList[this.evaluationInfo.paperSubject]
 					.id : null

+ 53 - 0
TEAMModelOS/ClientApp/src/view/learnactivity/AutoCreateNew.less

@@ -0,0 +1,53 @@
+.auto-create-container{
+	width: 100%;
+	min-height: 85vh;
+	background-color: #404040;
+	padding: 20px;
+	
+	.auto-create-title{
+		text-align: center;
+		color: #fff;
+		font-size: 20px;
+		font-weight: bold;
+		letter-spacing: 1px;
+	}
+	
+	.auto-filter-wrap{
+		color:#fff;
+		font-size:14px;
+		margin-top: 20px;
+		background-color: #515151;
+		padding: 10px 20px;
+		border-radius: 5px;
+		
+		.filter-wrap-item{
+			margin:25px 0;
+		}
+		
+		.filter-title{
+			margin:10px;
+		}
+		
+		.filter-content{
+			display:inline-flex;
+			
+			.ivu-checkbox-wrapper{
+				margin-right: 20px;
+			}
+			
+			.ivu-select-selection{
+				min-width: 100px;
+				color:
+				 #fff;
+				border-color: #7d7d7d;
+				background-color: transparent;
+			}
+			
+			&-text{
+				display: inline-table;
+				width: 40px;
+				text-align: center;
+			}
+		}
+	}
+}

+ 159 - 0
TEAMModelOS/ClientApp/src/view/learnactivity/AutoCreateNew.vue

@@ -0,0 +1,159 @@
+<template>
+	<div class="auto-create-container">
+		<p class="auto-create-title">设置自动出题条件</p>
+		<div class="auto-filter-wrap">
+			<div class="filter-wrap-item">
+				<span class="filter-title">题目来源 : </span>
+				<div class="filter-content">
+					<CheckboxGroup v-model="filterOrigin">
+						<Checkbox label="private">个人题库</Checkbox>
+						<Checkbox label="school">校本题库</Checkbox>
+					</CheckboxGroup>
+				</div>
+			</div>
+			<div class="filter-wrap-item">
+				<span class="filter-title">选择学段 : </span>
+				<div class="filter-content">
+					<Select v-model="periodCode" >
+						<Option v-for="item in periodList" :value="item.id" :key="item.id">{{ item.name }}</Option>
+					</Select>
+				</div>
+			</div>
+			<div class="filter-wrap-item">
+				<span class="filter-title">选择科目 : </span>
+				<div class="filter-content">
+					<Select v-model="subjectCode">
+						<Option v-for="item in subjectList" :value="item.id" :key="item.id">{{ item.name }}</Option>
+					</Select>
+				</div>
+			</div>
+			<Divider dashed />
+			<div class="filter-wrap-item" v-for="(item,index) in quInfos" :key="index">
+				<span class="filter-title">{{ item.label }} :</span>
+				<div class="filter-content">
+					<span class="filter-content-text">难度 </span>
+					<Select v-model="item.policy">
+						<Option v-for="item in diffList" :value="item.level" :key="item.level">{{ item.label }}</Option>
+					</Select>
+					<span class="filter-content-text">共 </span>
+					<InputNumber :max="10" :min="1" v-model="item.count"></InputNumber>
+					<span class="filter-content-text"> 道题 </span>
+				</div>
+			</div>
+		</div>
+		
+	</div>
+</template>
+
+<script>
+	export default{
+		name:'AutoCreate',
+		data(){
+			return {
+				filterOrigin:['private'],
+				periodList:[],
+				periodCode:'',
+				subjectList:[],
+				subjectCode:'',
+				quInfos:[{
+					type:'single',
+					label:'单选题',
+					count:0,
+					policy:'random'
+				},{
+					type:'multiple',
+					label:'多选题',
+					count:0,
+					policy:'random'
+				},{
+					type:'judge',
+					label:'判断题',
+					count:0,
+					policy:'random'
+				},{
+					type:'complete',
+					label:'填空题',
+					count:0,
+					policy:'random'
+				},{
+					type:'subjective',
+					label:'问答题',
+					count:0,
+					policy:'random'
+				},{
+					type:'compose',
+					label:'综合题',
+					count:0,
+					policy:'random'
+				}],
+				diffList:[
+                    {
+                        level: 'random',
+                        label: '随机',
+                        value: -1
+                    },
+                    {
+                        level: 'average',
+                        label: '平均分配',
+                        value: 0
+                    },
+                    {
+                        level: 'relativeEasy',
+                        label: '较易',
+                        value: 1
+                    },
+                    {
+                        level: 'easy',
+                        label: '容易',
+                        value: 2
+                    },
+                    {
+                        level: 'common',
+                        label: '一般',
+                        value: 3
+                    },
+                    {
+                        level: 'difficulty',
+                        label: '困难',
+                        value: 4
+                    },
+                    {
+                        level: 'relativeDifficulty',
+                        label: '较难',
+                        value: 5
+                    }
+                ]
+			}
+		},
+		created() {
+			this.getSchoolBaseInfo().then(res => {
+				if (!res) return
+				if(res.period.length){
+					this.periodList = res.period
+					this.periodCode = res.period[0].id
+					this.subjectList = res.period[0].subjects
+					this.subjectCode = this.subjectList.length ? this.subjectList[0].id : ''
+				}
+			})
+		},
+		methods:{
+			/** 获取当前学校基础数据 */
+			getSchoolBaseInfo() {
+				return new Promise((r, j) => {
+					this.$store.dispatch("user/getSchoolProfile").then((res) => {
+						let schoolBaseInfo = res.school_base;
+						if (schoolBaseInfo) {
+							r(schoolBaseInfo)
+						} else {
+							r(null)
+						}
+					});
+				})
+			},
+		}
+	}
+</script>
+
+<style lang="less">
+	@import "./AutoCreateNew.less";
+</style>

+ 11 - 8
TEAMModelOS/ClientApp/src/view/learnactivity/ManageEvaluation.vue

@@ -61,7 +61,8 @@
                     <div class="test-paper-detail">
                         <vuescroll ref="test-paper-detail" @handle-scroll="checkBackTop">
                             <!--试卷题目信息-->
-                            <TestPaper v-if="evaListShow[curEvaIndex] && evaListShow[curEvaIndex].papers" :paper="evaListShow[curEvaIndex].papers[curSubIndex]" style="color:#515a6e;margin-top:-30px;" :isShowTools="false" isExamPaper></TestPaper>
+                            <TestPaper v-if="evaListShow[curEvaIndex] && evaListShow[curEvaIndex].papers && evaListShow[curEvaIndex].papers[curSubIndex] && evaListShow[curEvaIndex].papers[curSubIndex].item" 
+                            :paper="evaListShow[curEvaIndex].papers[curSubIndex]" style="color:#515a6e;margin-top:-30px;" :isShowTools="false" isExamPaper></TestPaper>
                             <EmptyData v-else style="margin-top:60px;"></EmptyData>
                             
                             <!--返回顶部-->
@@ -72,8 +73,8 @@
                     </div>
                 </div>
                 <!-- 试卷评测打分 -->
-                <div :class="curBarIndex == 0 ? 'animated fadeIn evaluation-base-info':'evaluation-base-info animated fadeOutRight'" v-if="curBarIndex == 0">
-                    <Scoring :examPapers="examPaperList"></Scoring>
+                <div :class="curBarIndex == 0 ? 'animated fadeIn evaluation-base-info':'evaluation-base-info animated fadeOutRight'" v-show="curBarIndex == 0">
+                    <Scoring :examInfo="examPaperList"></Scoring>
                 </div>
                 <Loading :top="200" type="1" style="text-align:center" v-show="isLoading"></Loading>
             </div>
@@ -252,9 +253,9 @@
             },
             selectBar(index) {
                 this.curBarIndex = index
-                if (index == 0) {
-                    this.selectEvaluation(this.curEvaIndex)
-                }
+                //if (index == 0) {
+                //    this.selectEvaluation(this.curEvaIndex)
+                //}
             },
             dateFormat(timestamp) {
                 var date = new Date(timestamp)
@@ -289,12 +290,13 @@
             },
             //根据学段筛选评测
             filterByPeriod() {
-                this.selectEvaluation(0)
+                this.curEvaIndex = 0
                 if (this.filterPeriod) {
-                    this.evaListShow = this.evaluationList.filter(item => item.period.id == this.filterPeriod || !item.period)
+                    this.evaListShow = this.evaluationList.filter(item => item.period.id === this.filterPeriod)
                 } else {
                     this.evaListShow = [...this.evaluationList]
                 }
+                this.selectEvaluation(0)
             },
             selectEvaluation(index) {
                 this.curSubIndex = 0
@@ -339,6 +341,7 @@
                             for (let i = 0; i < dataInfo.papers.length; i++) {
                                 dataInfo.papers[i] = await this.$evTools.getFullPaper(dataInfo.papers[i])
                             }
+                            console.log('dataInfo',dataInfo)
                             this.examPaperList = dataInfo
                         } else {
                             this.$Message.error('API ERROR!')

+ 40 - 10
TEAMModelOS/ClientApp/src/view/learnactivity/ManualCreate.vue

@@ -51,7 +51,7 @@
                         <span class="manual-filter-label">来源:</span>
                         <CheckboxGroup v-model="manualFilter.code" style="display:inline-block;"  @on-change="checkAll($event,'type')">
                             <!--<Checkbox   label="all">全部</Checkbox>-->
-                            <Checkbox  :label="$store.state.userInfo.TEAMModelId">个人题库</Checkbox>
+                            <Checkbox  :label="$store.state.userInfo.TEAMModelId" v-if="!isSchool">个人题库</Checkbox>
                             <Checkbox  :label="$store.state.userInfo.schoolCode" :disabled="!hasSchool">校本题库</Checkbox>
                         </CheckboxGroup>
                     </div>
@@ -59,11 +59,11 @@
                     <Col :xs="24" :sm="24" :md="24" :lg="24" :xl="12">
                     <div class="manual-filter-item evaluation-attr-form">
                         <span class="manual-filter-label">学段:</span>
-                        <Select v-model="manualFilter.periodCode[0]" :disabled="!isPeriod"  size="small"  style="display: inline-block;width:100px"  @on-change="checkAll($event,'periodCode')">
+                        <Select v-model="manualFilter.periodCode[0]" :disabled="!isPeriod || isSchool"  size="small"  style="display: inline-block;width:100px"  @on-change="checkAll($event,'periodCode')">
                             <Option v-for="(item,index) in schoolPeriod" :value="item.id" :key="index">{{ item.name }}</Option>
                         </Select>
 						<span class="manual-filter-label" style="margin-left: 30px;">科目:</span>
-						<Select v-model="manualFilter.subjectCode[0]" :disabled="!isPeriod"  size="small"  style="display: inline-block;width:100px"  @on-change="checkAll($event,'subjectCode')">
+						<Select v-model="manualFilter.subjectCode[0]" :disabled="!isPeriod || isSchool"  size="small"  style="display: inline-block;width:100px"  @on-change="checkAll($event,'subjectCode')">
 						    <Option v-for="(item,index) in subjectList" :value="item.id" :key="index">{{ item.name }}</Option>
 						</Select>
                         
@@ -124,7 +124,11 @@
                     return []
                 }
             },
-			subjectId:{
+			subjectCode:{
+				type:String,
+				default:''
+			},
+			periodCode:{
 				type:String,
 				default:''
 			}
@@ -159,7 +163,7 @@
                 addKnowledgeStatus: false,
                 manualFilter: {
                     periodCode: [],
-                    code: [this.$store.state.userInfo.TEAMModelId],
+                    code: [],
                     points: ['all'],
                     type: ['all'],
                     level: ['all'],
@@ -191,6 +195,7 @@
              * @param field:字段名
              */
             checkAll(data, field) {
+				console.log('点击了筛选区域')
 				// 切换学段
 				if(field === 'periodCode'){
 					this.subjectList = this.schoolPeriod.filter(i => i.id === this.manualFilter.periodCode[0])[0].subjects
@@ -222,6 +227,7 @@
                 this.isLoading = true
                 this.questionList = []
                 if (this.manualFilter.code.length > 0) {
+					console.log(this.manualFilter.code)
 					for (let i = 0; i < this.manualFilter.code.length; i++) {
 						let code = this.manualFilter.code[i]
 						let scope = code === this.$store.state.userInfo.TEAMModelId ? 'private' : 'school'
@@ -241,6 +247,8 @@
                     this.isLoading = false
                 }
             },
+			
+			// 访问查询接口
             queryQuestion(scope, code) {
                 let queryData = {
                     "@DESC": "createTime",
@@ -257,15 +265,15 @@
                 return new Promise((resolve, reject) => {
                     this.$api.newEvaluation.FindExerciseList(queryData).then(async res => {
 						if(res.items.length){
-							// let list = await this.$evTools.getFullItem(res.items)
-							let list = res.items
-							resolve(list)
+							resolve(res.items)
 						}
                     }).catch((e) => {
                         reject(e);
                     });
                 });
             },
+			
+			/* 去除无效值 */
             deleteAll(data) {
                 if (data.length == 1) {
                     if (data[0] == 'all') {
@@ -277,6 +285,8 @@
                     return data
                 }
             },
+			
+			
             /*选择题目||取消选择题目*/
             async selectQuestion(data, info) {
                 this.groupList = { ...this.groupQuestion }
@@ -336,11 +346,21 @@
 				    this.groupList[groupResult[i][0].type] = groupResult[i].length
 				}
 			}
-		    this.queryQuestionByPage()
+			
+			this.manualFilter.code = this.isSchool ? [this.$store.state.userInfo.schoolCode] : [this.$store.state.userInfo.TEAMModelId]
+			
 			this.getSchoolBaseInfo().then(res => {
 				if (!res) return
 				this.schoolPeriod = res.period
+				if(this.isSchool && this.periodCode && this.subjectCode){
+					this.manualFilter.periodCode = [this.periodCode]
+					this.subjectList = this.schoolPeriod.filter(i => i.id === this.periodCode)[0].subjects
+					this.manualFilter.subjectCode = [this.subjectCode]
+				}
 			})
+			
+			this.queryQuestionByPage()
+			
 			this.$EventBus.$off('onPaperItemChange')
 		    this.$EventBus.$on('onPaperItemChange', data => {
 		        this.shoppingQuestionList = JSON.parse(JSON.stringify(data))
@@ -356,13 +376,23 @@
             isPeriod() {
                 return this.manualFilter.code.indexOf(this.$store.state.userInfo.schoolCode) > -1 
             },
+			isSchool(){
+				return this.$route.name === 'newSchoolPaper'
+			},
 			hasSchool() {
 				return this.$store.state.userInfo.hasSchool;
 			},
         },
 		watch:{
-			subjectId:{
+			periodCode:{
+				handler(n){
+					this.manualFilter.periodCode[0] = n
+					this.subjectList = this.schoolPeriod.filter(i => i.id === n)[0].subjects
+				}
+			},
+			subjectCode:{
 				handler(n){
+					this.manualFilter.subjectCode[0] = n
 					this.queryQuestionByPage()
 				}
 			}

+ 5 - 1
TEAMModelOS/ClientApp/src/view/learnactivity/PaperScore.less

@@ -46,9 +46,13 @@
 }
 
 
-.components-el-container .exercise-item:hover {
+.components-el-container .stu-answer-box:hover {
     border: 2px solid #01b4ef;
 }
+.components-el-container .stu-answer-box{
+    padding: 15px;
+    position: relative;
+}
 
 .components-el-container .exercise-item {
     position: relative;

+ 8 - 5
TEAMModelOS/ClientApp/src/view/learnactivity/PaperScore.vue

@@ -44,11 +44,11 @@
                         <div class="item-explain">
                             <span class="answer-title">【作 答 答 案】</span>
                             <!--学生作答答案显示区域-->
-                            <div class="item-explain-details" v-if="studentAnswer.answers && studentAnswer.answers.length">
+                            <div class="stu-answer-box item-explain-details" v-if="studentAnswer.answers && studentAnswer.answers.length">
                                 <!--问答题答案-->
                                 <div v-if="item.type === 'subjective'">
                                     <div v-for="(answerItem,answerIndex) in studentAnswer.answers[typeIndex + index]" :key="'an'+ answerIndex">
-                                        <span v-html="answerItem > 0 ? answerItem : '暂未作答'"></span><br />
+                                        <span v-html="(answerItem && answerItem.length) > 0 ? answerItem : '暂未作答'"></span><br />
                                     </div>
                                 </div>
                                 <!--填空题答案-->
@@ -271,7 +271,6 @@
         watch: {
             paper: {
                 handler(newValue, oldValue) {
-                    console.log('reviewPaper', newValue)
                     this.paperInfo = newValue
                 },
                 deep: true
@@ -302,8 +301,6 @@
                             });
                         }
                         this.dataLoading = false
-                        console.log('groupList', this.groupList)
-                        console.log('answer', this.studentAnswer)
                         this.$nextTick(() => {
                             window.MathJax.Hub.Queue(["Typeset", MathJax.Hub, this.$refs.mathJaxContainer]);
                         })
@@ -311,6 +308,12 @@
                 },
                 deep: true
             },
+            studentAnswer:{
+                handler(newValue, oldValue){
+                    console.log('学生作答数据',newValue)
+                },
+                deep:true
+            }
         },
         computed: {
             isError() {

+ 297 - 281
TEAMModelOS/ClientApp/src/view/learnactivity/Scoring.vue

@@ -2,12 +2,12 @@
     <div class="ev-scoring">
         <div class="ev-target-box dark-iview-select">
             <span class="filter-label">学科:</span>
-            <Select filterable v-model="chooseSubject" class="filter-select" size="small">
-                <Option v-for="(item,index) in examPapers.subjects" :value="item.id" :key="index" @click="selectActivity(index)">{{ item.name }}</Option>
+            <Select filterable v-model="chooseSubject" class="filter-select" size="small" @on-change="getCurPaper">
+                <Option v-for="(item,index) in examInfo.subjects" :value="item.id" :key="index">{{ item.name }}</Option>
             </Select>
             <span class="filter-label">年级:</span>
             <Select filterable v-model="chooseGrade" class="filter-select" size="small">
-                <Option v-for="(item,index) in examPapers.grades" :value="item.id" :key="index">{{ item.name }}</Option>
+                <Option v-for="(item,index) in examInfo.grades" :value="item.id" :key="index">{{ item.name }}</Option>
             </Select>
             <span style="margin-left:5px">班级:</span>
             <Select filterable v-model="chooseClass" class="filter-select" style="width:140px;" @on-change="getClassStudent" size="small">
@@ -23,23 +23,19 @@
             </span>
         </div>
         <div class="scoring-main-wrap dark-iview-table">
-            <Table v-show="!showTest" class="score-box" border :columns="tableColumn" height="750" :data="studentScore">
-                <template slot-scope="{ row,index }" :slot="'que'+qIndex" v-for="(item,qIndex) in quLen">
-                    <div @click="getStuScore(row,qIndex)">
-                        <Poptip trigger="hover" content="点击前往评分页面">
-                            <Icon size="20" style="cursor:pointer;" type="ios-create-outline" v-show="studentScore[row._index].data[qIndex] == -1" />
-                        </Poptip>
-                        <Poptip trigger="hover" content="点击查看试题详情">
-                            <span style="cursor:pointer;"  v-show="studentScore[row._index].data[qIndex] != -1">{{studentScore[row._index].data[qIndex]}}</span>
-                        </Poptip>
+            <Table v-show="!showTest" class="score-box" border :columns="tableColumn" :data="studentScore" :loading="tableLoading" :max-height="tableHeight">
+                <template slot-scope="{ row,index }" :slot="'qu'+qIndex" v-for="(item,qIndex) in quLen">
+                    <div :key="'qu'+qIndex">
+                        <Icon @click="getStuScore(row,qIndex)" size="20" style="cursor:pointer;" type="ios-create-outline" v-if="row.data[qIndex] == -1" />
+                        <span @click="getStuScore(row,qIndex)" style="cursor:pointer;" v-else>{{row.data[qIndex]}}</span>
                     </div>
                 </template>
                 <template slot-scope="{ row,index }" slot="total">
                     <strong>{{getcount(studentScore[row._index].data)}}</strong>
                 </template>
+                <Loading slot="loading" :top="-50"></Loading>
             </Table>
             <div class="dark-iview-table scoring-handle-box" v-show="showTest">
-                <!--<ReviewPaper :paper="paperInfo" :studentAnswer="chooseStudent" ref="exPaper" style="color:#515a6e;"> </ReviewPaper>-->
                 <PaperScore :paper="paperInfo" :studentAnswer="chooseStudent" ref="exPaper" style="color:#515a6e;"> </PaperScore>
                 <Loading :top="200" type="1" style="text-align:center" v-show="dataLoading"></Loading>
             </div>
@@ -47,304 +43,324 @@
     </div>
 </template>
 <script>
-    import ReviewPaper from '@/components/learnactivity/ReviewPaper.vue'
-    import PaperScore from './PaperScore.vue'
-    export default {
-        props: {
-            examPapers: {
-                type: Object,
-                default: () => {
-                    return {}
+import ReviewPaper from "@/components/learnactivity/ReviewPaper.vue";
+import PaperScore from "./PaperScore.vue";
+export default {
+    props: {
+        examInfo: {
+            type: Object,
+            default: () => {
+                return {};
+            },
+        },
+    },
+    components: {
+        ReviewPaper,
+        PaperScore,
+    },
+    data() {
+        return {
+            tableLoading: false,
+            tableHeight: 750,
+            isAllOpen: true,
+            showTest: false, //是否评分
+            studentData: [],
+            studentList: [],
+            dataLoading: false,
+            classData: [], //当前班级信息
+            chooseGrade: "",
+            chooseClass: "",
+            chooseSubject: "",
+            chooseStudent: {
+                id: "",
+                name: "",
+            },
+            scoreList: [
+                {
+                    title: "姓名",
+                    key: "name",
+                    fixed: "left",
+                    align: "center",
+                    minWidth: 150,
                 },
+                {
+                    title: "总分",
+                    slot: "total",
+                    align: "center",
+                    fixed: "right",
+                    width: 100,
+                },
+            ],
+            tableColumn: [],
+            studentScore: [],
+            studentAns: {},
+            quLen: [],
+            selectStudent: {},
+            studentName: "",
+            scoreTotal: 0,
+            paperInfo: {},
+        };
+    },
+    methods: {
+        getCurPaper() {
+
+            let paperInfo = this.examInfo.papers.find((item) => {
+                return item.subjectId == this.chooseSubject;
+            });
+            this.paperInfo = this._.cloneDeep(paperInfo)
+            console.log("paperInfo", this.paperInfo);
+            this.getClassStudent();
+        },
+        //点击学生题号前往评分页面
+        getStuScore(data) {
+            this.showTest = true;
+            this.chooseStudent.id = data.id;
+            this.chooseStudent.name = data.name;
+            let answerIndex = this.paperInfo[this.chooseClass].studentAns.studentIds.indexOf(data.id);
+            if (answerIndex >= 0) {
+                this.chooseStudent["scores"] = this.paperInfo[this.chooseClass].studentAns.studentScores[answerIndex];
+                this.chooseStudent["answers"] = this.paperInfo[this.chooseClass].studentAns.studentAnswers[answerIndex];
             }
         },
-        components: {
-            ReviewPaper, PaperScore
+        getStuName(data) {
+            if(data) this.chooseStudent.name = data.label;
         },
-        data() {
-            return {
-                isAllOpen: true,
-                showTest: false, //是否评分
-                curSubIndex: 0,
-                studentData: [],
-                studentList: [],
-                dataLoading: false,
-                classData: [], //当前班级信息
-                chooseGrade: "",
-                chooseClass: "",
-                chooseSubject: '',
-                chooseStudent: {
-                    id: '',
-                    name:''
-                },
-                scoreList: [
-                    {
-                        title: '姓名',
-                        key: 'name',
-                        fixed: 'left',
-                        align: 'center',
-                        minWidth: 150
-                    },
-                    {
-                        title: '总分',
-                        slot: 'total',
-                        align: 'center',
-                        fixed: 'right',
-                        width: 100
-                    }
-                ],
-                tableColumn: [],
-                studentScore: [],
-                studentAns: {},
-                quLen: [],
-                selectStudent: {},
-                studentName: '',
-                scoreTotal: 0,
-                paperInfo: {}
-            }
+        //分数求和
+        getcount(arr) {
+            return arr.reduce((total, item) => {
+                if (item !== -1) {
+                    return total + item;
+                } else {
+                    return total;
+                }
+            }, 0);
         },
-        methods: {
-            //点击学生题号前往评分页面
-            getStuScore(data, index) {
-                //this.showTest = false
-                //this.selectStudent = {}
-                //if (data.id) {
-                //    data.classId = this.chooseClass
-                //    data.className = this.getClassName(this.chooseClass)
-                //    data.queNo = index
-                //    this.showTest = true
-                //}
-                //this.selectStudent = { ...data }
-                this.showTest = true
-                this.chooseStudent.id = data.id
-                this.chooseStudent.name = data.name
-                let answerIndex = this.paperInfo[this.chooseClass].studentAns.studentIds.indexOf(data.id)
-                if (answerIndex >= 0) {
-                    this.chooseStudent['scores'] = this.paperInfo[this.chooseClass].studentAns.studentScores[answerIndex]
-                    this.chooseStudent['answers'] = this.paperInfo[this.chooseClass].studentAns.studentAnswers[answerIndex]
+        getClassStudent() {
+            this.tableLoading = true
+            if (!this.chooseClass) return;
+            let requestData = {
+                id: this.chooseClass,
+                scope: "school",
+                school_code: this.$store.state.userInfo.schoolCode,
+            };
+            this.$api.schoolSetting.getClassroomStudent(requestData).then((res) => {
+                if (!res.error) {
+                    if (!this.paperInfo[this.chooseClass]) {
+                        this.$set(this.paperInfo, this.chooseClass, {});
+                    }
+                    this.$set(this.paperInfo[this.chooseClass], "students", res.classrooms[0]);
+                    this.getAllStudentData();
+                } else {
+                    this.$Message.error("API ERROR!");
                 }
-            },
-            getStuName(data) {
-                this.chooseStudent.name = data.label
-            },
-            //分数求和
-            getcount(arr) {
-                return arr.reduce((total, item) => {
-                    if (item !== -1) {
-                        return total + item
-                    } else {
-                        return total
+            });
+        },
+        getAllStudentData() {
+            this.dataLoading = true;
+            let requestData = {
+                id: this.examInfo.id,
+                school: this.$store.state.user.schoolCode,
+                subjectId: this.chooseSubject,
+                classId: this.chooseClass,
+            };
+            this.$api.learnActivity.FindAllStudent(requestData).then(
+                (res) => {
+                    if (res.examClassResults.length > 0) {
+                        this.paperInfo[this.chooseClass]["studentAns"] = res.examClassResults[0];
+                        this.setTableData();
                     }
+                },
+                (err) => {
+                    this.$Message.error("API ERROR!");
+                }
+            ).finally(() => {
+                setTimeout(() => {
+                    this.dataLoading = false;
+                }, 400);
+            });
+        },
+        //初始化表单数据
+        setTableData() {
+            if (this.paperInfo[this.chooseClass]) {
+                let studentData = this.paperInfo[this.chooseClass]["students"];
+                let studentAns = this.paperInfo[this.chooseClass]["studentAns"];
 
-                }, 0)
-            },
-            //原getStudentDataInfo 获取班级学生
-            getClassStudent() {
-                if (!this.chooseClass) return
-                let requestData = {
-                    id: this.chooseClass,
-                    scope: "school",
-                    school_code: this.$store.state.userInfo.schoolCode
+                this.studentScore = [];
+                this.tableColumn = [...this.scoreList];
+                this.quLen = studentAns.studentAnswers[0];
+                for (let i = 0; i < studentAns.studentAnswers[0].length; i++) {
+                    let data = {
+                        title: "Q" + (i + 1),
+                        slot: "qu" + i,
+                        align: "center",
+                        minWidth: 150,
+                    };
+                    this.tableColumn.push(data);
                 }
-                this.$api.schoolSetting.getClassroomStudent(requestData).then(
-                    res => {
-                        if (!res.error) {
-                            if (!this.paperInfo[this.chooseClass]) {
-                                this.$set(this.paperInfo, this.chooseClass, {})
-                            }
-                            this.$set(this.paperInfo[this.chooseClass], 'students', res.classrooms[0])
-                            this.getAllStudentData()
-                        } else {
-                            this.$Message.error('API ERROR!')
+                console.log('column', this.tableColumn)
+                let ans = [];
+                for (let i = 0; i < studentAns.studentIds.length; i++) {
+                    for (let k = 0; k < studentData.students.length; k++) {
+                        let score = {};
+                        if (
+                            studentAns.studentIds[i] ==
+                            studentData.students[k].id
+                        ) {
+                            score.name = studentData.students[k].name;
+                            score.id = studentAns.studentIds[i];
+                            score.data = studentAns.studentScores[i];
+                            this.studentScore.push(score);
                         }
                     }
-                )
-            },
-            getAllStudentData() {
-                this.dataLoading = true
-                let requestData = {
-                    id: this.examPapers.id,
-                    school: this.$store.state.user.schoolCode,
-                    subjectId: this.chooseSubject,
-                    classId: this.chooseClass
                 }
-                this.$api.learnActivity.FindAllStudent(requestData).then(
-                    res => {
-                        if (res.examClassResults.length > 0) {
-                            //this.studentAns = res.examClassResults[0]//通过计算属性从元数据获取
-                            this.paperInfo[this.chooseClass]['studentAns'] = res.examClassResults[0]
-                            this.setTableData()
-                        }
-                    },
-                    err => {
-                        this.$Message.error('API ERROR!')
+                if (ans.length) {
+                    for (
+                        let k = 0;
+                        k < this.paperInfo.papers.item.length;
+                        k++
+                    ) {
+                        this.$set(
+                            this.paperInfo.papers.item[k],
+                            "answerData",
+                            ans[k]
+                        );
+                        this.$set(
+                            this.paperInfo.papers.item[k],
+                            "stuScore",
+                            score[k]
+                        );
                     }
-                ).finally(() => {
-                    setTimeout(() => {
-                        this.dataLoading = false
-                    }, 400)
-                })
-            },
-            //初始化表单数据
-            setTableData() {
-                if (this.paperInfo[this.chooseClass]) {
-                    let studentData = this.paperInfo[this.chooseClass]['students']
-                    let studentAns = this.paperInfo[this.chooseClass]['studentAns']
-
-                    this.studentScore = []
-                    this.tableColumn = [...this.scoreList]
-                    this.quLen = studentAns.studentAnswers[0]
-                    for (let i = 0; i < studentAns.studentAnswers[0].length; i++) {
-                        let data = {
-                            title: "Q" + (i + 1),
-                            slot: "que" + i,
-                            align: 'center',
-                            minWidth: 150
-                        }
-                        this.tableColumn.push(data)
+                }
+            }
+            setTimeout(() => {
+                this.tableLoading = false
+            }, 500)
+        },
+        getBack(data) {
+            if (data == "1") {
+                this.getClassStudent();
+            }
+            this.showTest = false;
+        },
+        //获取单个学生作答数据
+        getStudentInfo(data, index) {
+            this.dataLoading = true;
+            if (this.studentInfo !== undefined) {
+                this.studentName = this.studentInfo.name;
+                let filData = "";
+                filData = this.studentInfo.id;
+                let ans = [];
+                let score = [];
+                for (let i = 0; i < this.classDatas.studentIds.length; i++) {
+                    if (this.classDatas.studentIds[i] == filData) {
+                        ans = this.classDatas.studentAnswers[i];
+                        score = this.classDatas.studentScores[i];
                     }
-                    let ans = []
-                    for (let i = 0; i < studentAns.studentIds.length; i++) {
-                        for (let k = 0; k < studentData.students.length; k++) {
-                            let score = {}
-                            if (studentAns.studentIds[i] == studentData.students[k].id) {
-                                score.name = studentData.students[k].name
-                                score.id = studentAns.studentIds[i]
-                                score.data = studentAns.studentScores[i]
-                                this.studentScore.push(score)
-                            }
-                        }
+                }
+                if (ans.length) {
+                    for (let k = 0; k < this.paperInfo.papers.item.length; k++) {
+                        this.$set(this.paperInfo.papers.item[k], "answerData", ans[k]);
+                        this.$set(this.paperInfo.papers.item[k], "stuScore", score[k]);
                     }
-                    if (ans.length) {
-                        for (let k = 0; k < this.paperInfo.papers.item.length; k++) {
-                            this.$set(this.paperInfo.papers.item[k], 'answerData', ans[k])
-                            this.$set(this.paperInfo.papers.item[k], 'stuScore', score[k])
-                        }
+                }
+                this.dataLoading = false;
+            } else {
+                this.dataLoading = false;
+                this.$Message.warning("请先选择学生!");
+            }
+            this.selectIndex = index;
+        },
+        getAnswer(data) {
+            //处理学生作答信息
+            let listArr = [];
+            data.forEach(function (el, index) {
+                for (var i = 0; i < listArr.length; i++) {
+                    if (listArr[i].group == el.group) {
+                        listArr[i].listInfo.push(el);
+                        return;
                     }
                 }
-            },
-            getBack(data) {
-                if (data == '1') {
-                    this.getClassStudent()
+                listArr.push({
+                    group: el.group,
+                    listInfo: [el],
+                });
+            });
+            return listArr;
+        },
+    },
+    watch: {
+        examInfo: {
+            handler(n, o) {
+                console.log("接收数据examInfo:", n);
+                if (n.subjects && n.subjects.length) {
+                    this.chooseSubject = n.subjects[0].id;
                 }
-                this.showTest = false
-            },
-            //切換科目
-            selectActivity(index) {
-                this.curSubIndex = 0
-                this.curSubIndex = index
-                this.paperInfo = this.examPapers.papers.find((item) => {
-                    return item.subjectId == this.chooseSubject
-                }) 
-                this.getClassStudent()
-            },
-            //获取单个学生作答数据
-            getStudentInfo(data, index) {
-                this.dataLoading = true
-                if (this.studentInfo !== undefined) {
-                    this.studentName = this.studentInfo.name
-                    let filData = ''
-                    filData = this.studentInfo.id
-                    let ans = []
-                    let score = []
-                    for (let i = 0; i < this.classDatas.studentIds.length; i++) {
-                        if (this.classDatas.studentIds[i] == filData) {
-                            ans = this.classDatas.studentAnswers[i]
-                            score = this.classDatas.studentScores[i]
-                        }
-                    }
-                    if (ans.length) {
-                        for (let k = 0; k < this.paperInfo.papers.item.length; k++) {
-                            this.$set(this.paperInfo.papers.item[k], 'answerData', ans[k])
-                            this.$set(this.paperInfo.papers.item[k], 'stuScore', score[k])
-                        }
-                    }
-                    this.dataLoading = false
+                if (n.grades && n.grades.length) {
+                    this.chooseGrade = n.grades[0].id;
+                }
+                if (n.targetClassIds && n.targetClassIds.length) {
+                    this.chooseClass = n.targetClassIds[0];
+                }
+                if (n.papers && n.papers.length) {
+                    let res = n.papers.find((item) => {
+                        return item.subjectId == this.chooseSubject;
+                    });
+                    this.paperInfo = res ? this._.cloneDeep(res) : {};
                 } else {
-                    this.dataLoading = false
-                    this.$Message.warning('请先选择学生!')
+                    this.paperInfo = {};
                 }
-                this.selectIndex = index
+                this.getClassStudent();
             },
-            getAnswer(data) {  //处理学生作答信息
-                let listArr = []
-                data.forEach(function (el, index) {
-                    for (var i = 0; i < listArr.length; i++) {
-                        if (listArr[i].group == el.group) {
-                            listArr[i].listInfo.push(el);
-                            return;
-                        }
-                    }
-                    listArr.push({
-                        group: el.group,
-                        listInfo: [el]
-                    });
-                });
-                return listArr;
+            deep: true,
+        },
+        classList: {
+            handler(n, o) {
+                if (this.classList.length) {
+                    this.chooseClass = n[0].id;
+                    this.getClassStudent();
+                }
             },
-
-            
+            deep: true,
+        }
+    },
+    computed: {
+        students() {
+            if (this.paperInfo && this.paperInfo[this.chooseClass] && this.paperInfo[this.chooseClass]["students"]) {
+                return this.paperInfo[this.chooseClass]["students"].students;
+            } else {
+                return [];
+            }
         },
-        watch: {
-            examPapers: {
-                handler(n, o) {
-                    console.log('接收数据examPapers:', n)
-                    if (n.subjects && n.subjects.length) {
-                        this.chooseSubject = n.subjects[0].id
-                    }
-                    if (n.grades && n.grades.length) {
-                        this.chooseGrade = n.grades[0].id
-                    }
-                    if (n.targetClassIds && n.targetClassIds.length) {
-                        this.chooseClass = n.targetClassIds[0]
+        classList() {
+            if (this.examInfo && this.examInfo.targetClassIds) {
+                let classes = this.$store.state.user.schoolProfile.school_classes.filter(
+                    (item) => {
+                        return (this.examInfo.targetClassIds.indexOf(item.id) >= 0 && item.gradeId == this.chooseGrade);
                     }
-                    if (n.papers && n.papers.length) {
-                        let res = n.papers.find(item => {
-                            return item.subjectId == this.chooseSubject
-                        })
-                        this.paperInfo = res ? this._.cloneDeep(res) : {}
-                    } else {
-                        this.paperInfo = {}
-                    }
-                    this.getClassStudent()
-                },
-                deep: true
+                );
+                return classes;
+            } else {
+                return [];
             }
         },
-        computed: {
-            students() {
-                if (this.paperInfo && this.paperInfo[this.chooseClass] && this.paperInfo[this.chooseClass]['students']) {
-                    return this.paperInfo[this.chooseClass]['students'].students
-                } else {
-                    return []
-                } 
-            },
-            classList() {
-                if (this.examPapers && this.examPapers.targetClassIds) {
-                    return this.$store.state.user.schoolProfile.school_classes.filter(item => {
-                        return this.examPapers.targetClassIds.indexOf(item.id) >= 0
-                    })
-                } else {
-                    return []
-                }
-            }
-        }
-    }
+    },
+};
 </script>
 
 <style scoped lang="less">
 @import "./Scoring.less";
 </style>
 <style lang="less">
-    .scoring-main-wrap .ivu-table-fixed-body {
-        background:#353535;
-    }
-    .scoring-main-wrap .ivu-table-fixed-right::before, .scoring-main-wrap .ivu-table-fixed::before {
-        display:none;
-    }
-    .scoring-main-wrap .ivu-table-fixed-header thead tr th {
-        background: #404040;
-        border-color: #606060;
-        color: white;
-    }
+.scoring-main-wrap .ivu-table-fixed-body {
+    background: #353535;
+}
+.scoring-main-wrap .ivu-table-fixed-right::before,
+.scoring-main-wrap .ivu-table-fixed::before {
+    display: none;
+}
+.scoring-main-wrap .ivu-table-fixed-header thead tr th {
+    background: #404040;
+    border-color: #606060;
+    color: white;
+}
 </style>

+ 5 - 5
TEAMModelOS/Controllers/Item/ItemController.cs

@@ -263,6 +263,7 @@ namespace TEAMModelOS.Controllers
                 }*/
                 /*            dict.Add("@CURRPAGE", page.GetInt32());
                             dict.Add("@PAGESIZE", size.GetInt32());*/
+
                 dict.Add("@DESC", desc.ToString());
                 if (requert.TryGetProperty("periodId", out JsonElement periodId))
                 {
@@ -288,10 +289,9 @@ namespace TEAMModelOS.Controllers
                 {
                     dict.Add("gradeIds[*]", gradeIds);
                 }
-                if (requert.TryGetProperty("pId", out JsonElement pId))
-                {
-                    dict.Add("pId", pId);
-                }
+
+                dict.Add("pid", null);
+                
                 AzureCosmosQuery cosmosDbQuery = SQLHelper.GetSQL(dict, sql);
                 List<object> items = new List<object>();
                 if (scope.ToString().Equals("private"))
@@ -335,7 +335,7 @@ namespace TEAMModelOS.Controllers
             }
             catch (Exception e) {
                 await _dingDing.SendBotMsg($"OS,{_option.Location},item/Find()\n{e.Message}", GroupNames.醍摩豆服務運維群組);
-                return BadRequest();
+                return BadRequest(e.StackTrace);
             }
             
         }

+ 21 - 7
TEAMModelOS/Controllers/knowledge/KnowledgeController.cs

@@ -158,7 +158,7 @@ namespace TEAMModelOS.Controllers
         public async Task<IActionResult> Find(JsonElement requert)
         {
             var client = _azureCosmos.GetCosmosClient();
-            if (!requert.TryGetProperty("school_code", out JsonElement school_code)) return BadRequest();
+            if (!requert.TryGetProperty("code", out JsonElement school_code)) return BadRequest();
             if (!requert.TryGetProperty("type", out JsonElement type)) return BadRequest();
             if (!requert.TryGetProperty("periodId", out JsonElement period)) return BadRequest();
             if (!requert.TryGetProperty("subjectId", out JsonElement subjectCode)) return BadRequest();
@@ -237,18 +237,23 @@ namespace TEAMModelOS.Controllers
         {
             try
             {
-
+                var client = _azureCosmos.GetCosmosClient();
                 List<Knowledge> Knowledges = new List<Knowledge>();
                 if (request.IsNotEmpty())
                 {
 
-                    for (int i =0;i< request.Count;i++) {
-                        if (request[i].id ==null )
+                    foreach (Knowledge knowledge in request) {
+                        knowledge.code = "Knowledge-" + knowledge.code;
+                        if (knowledge.id == null)
                         {
-                            request[i].code = typeof(Knowledge).Name + "-" + request[i].code;
-                        }                       
+                            knowledge.id = Guid.NewGuid().ToString();
+                            await client.GetContainer("TEAMModelOS", "School").CreateItemAsync(knowledge, new PartitionKey($"{knowledge.code}"));
+                        }
+                        else {
+                            await client.GetContainer("TEAMModelOS", "School").ReplaceItemAsync(knowledge, knowledge.id, new PartitionKey($"{knowledge.code}"));
+                        }
                     }
-                    Knowledges = await SaveOrUpdateKnowledge(request);
+                    //Knowledges = await SaveOrUpdateKnowledge(request);
                     /*if (ts.Count > 0) builder.Data(ts).Extend(new Dictionary<string, object> { { "count", ts.Count } });
                     else {
                         return Ok(new { ResponseCode.FAILED, V = "失败!" });
@@ -275,6 +280,15 @@ namespace TEAMModelOS.Controllers
         [HttpPost("delete")]
         public async Task<IActionResult> Delete(JsonElement request)
         {
+            try {
+                var client = _azureCosmos.GetCosmosClient();
+                if (!request.TryGetProperty("code", out JsonElement code)) return BadRequest();
+                if (!request.TryGetProperty("id", out JsonElement id)) return BadRequest();
+                await client.GetContainer("TEAMModelOS", "School").DeleteItemStreamAsync(id.ToString(), new PartitionKey($"Knowledge-{code}"));
+            } catch (Exception ex) {
+                await _dingDing.SendBotMsg($"knowledge,{_option.Location},delete()\n{ex.Message}", GroupNames.醍摩豆服務運維群組);
+                return BadRequest();
+            }
             return Ok();
             //ResponseBuilder builder = ResponseBuilder.custom();
             //DeleteDelegate<Knowledge> deleteDelegate1 = Delete<Knowledge>;