소스 검색

全体教师选项添加

OnePsycho 3 년 전
부모
커밋
27ee05d58c

+ 3 - 2
TEAMModelOS.SDK/TEAMModelOS.SDK.csproj

@@ -11,6 +11,7 @@
 
 
   <ItemGroup>
+    <PackageReference Include="CHTCHSConv" Version="1.0.0" />
     <PackageReference Include="HTEXLib" Version="5.2111.41" />
     <PackageReference Include="AspectCore.Extensions.Reflection" Version="2.2.0" />
     <PackageReference Include="Azure.Cosmos" Version="4.0.0-preview3" />
@@ -36,7 +37,7 @@
     <PackageReference Include="Microsoft.Azure.Cosmos.Table" Version="2.0.0-preview" />
     <PackageReference Include="System.Net.Http.Json" Version="5.0.0" />
     <PackageReference Include="NPinyin.Core" Version="3.0.0" />
-	  <PackageReference Include="PinYinConverterCore" Version="1.0.2" />
-	  <PackageReference Include="CHTCHSConv" Version="1.0.0" />
+    <PackageReference Include="VueCliMiddleware" Version="5.0.0" />
+
   </ItemGroup>
 </Project>

+ 14 - 3
TEAMModelOS/ClientApp/src/common/BaseClassSelect.vue

@@ -6,7 +6,7 @@
 		</RadioGroup>
 		<el-cascader v-if="targetType === 'student'" v-model="defaultArr" ref="demoCascader" :key="modelKey" :props="props" :options="csOptions" @change="treeChange" :show-all-levels="false" clearable popper-class="myCascader"
 			filterable></el-cascader>
-		<Select v-model="groupArr" multiple v-if="targetType === 'research'" @on-change="onGroupChange">
+		<Select v-model="groupArr" multiple v-if="targetType === 'research'" @on-change="onGroupChange" :loading="optionsLoading" not-found-text="">
 			<Option v-for="(item, index) in groupList" :value="item.id" :key="index">{{ item.name }}</Option>
 		</Select>	
 	</div>
@@ -47,7 +47,8 @@
 				preCheckType:'',
 				privateClassType:'school',
 				schoolClasses:[],
-				teachClasses:[]
+				teachClasses:[],
+				optionsLoading:true,
 			};
 		},
 		created() {
@@ -55,7 +56,15 @@
 		},
 		methods: {
 			/* 选择教研组发生变化 */
-			onGroupChange(){
+			onGroupChange(val){
+				let newOption = val.length ? val[val.length - 1] : ''
+				if(!newOption){
+					this.groupArr = []
+				}else if(val.includes('TeacherAll') && newOption !== 'TeacherAll'){
+					this.groupArr = val.filter(i => i !== 'TeacherAll')
+				}else if(newOption === 'TeacherAll'){
+					this.groupArr = ['TeacherAll']
+				}
 				this.$emit('onChange', this.groupArr)
 			},
 			/* 发布对象流程发生变化 */
@@ -132,6 +141,8 @@
 			            this.schoolClasses = res.groupLists.filter(i => i.type === 'class')
 			            this.teachClasses = res.groupLists.filter(i => i.type === 'teach')
 						this.groupList = res.groupLists.filter(i => i.type === 'research')
+						this.groupList.unshift({ id:'TeacherAll',name: this.$t('vote.allTeacher') })
+						this.optionsLoading = false
 			        },
 			        err => {
 			            this.$Messag.error('查询发布对象失败')

+ 13 - 11
TEAMModelOS/ClientApp/src/components/questionnaire/BaseQnForm.vue

@@ -461,17 +461,19 @@
 						if(!this.groupList.length){
 							this.groupList = await this.findResearchList()
 						}
-						console.log(this.groupList);
-						console.log(item.tchLists);
-						let groupNameArr = []
-						item.tchLists.forEach(i => {
-							let findObj = this.groupList.find(j => j.id === i)
-							if (findObj) {
-								groupNameArr.push(findObj)
-							}
-						})
-						console.log(groupNameArr);
-						this.classNameArr = groupNameArr
+						if(item.tchLists.includes('TeacherAll')){
+							this.classNameArr = [{ name:this.$t('vote.allTeacher') }]
+						}else{
+							let groupNameArr = []
+							item.tchLists.forEach(i => {
+								let findObj = this.groupList.find(j => j.id === i)
+								if (findObj) {
+									groupNameArr.push(findObj)
+								}
+							})
+							console.log(groupNameArr);
+							this.classNameArr = groupNameArr
+						}
 					} else {
 						this.classNameArr = item.classes.length ? await this.getClassNameByIds(item.classes) : item
 							.stuLists.length ? await this.getClassNameByIds(item.stuLists) : []

+ 1 - 1
TEAMModelOS/ClientApp/src/components/questionnaire/BaseSsTable.vue

@@ -45,7 +45,7 @@
                     {
                         title: vm.$t('survey.questionaire.className'),
                         render: (h, params) => {
-                            return h('span', params.row.classroomName)
+                            return h('span', params.row.classroomName === 'TeacherAll' ? vm.$t('vote.allTeacher') : params.row.classroomName)
                         },
                     },
                     {

+ 41 - 61
TEAMModelOS/ClientApp/src/components/vote/BaseVoteForm.vue

@@ -232,16 +232,18 @@
 				areaId: sessionStorage.getItem('areaId'),
 			}
 		},
-		created() {
-			this.findResearchList()
+		async created() {
+			await this.findResearchList()
 			if (this.isAreaVote) {
 				this.getAreaTargets()
 			}
 		},
 		methods: {
+			/* 选择变化 */
 			treeChange(data) {
 				console.log('选择数据', this.schoolTarget)
 			},
+			/* 获取区级的发布对象 */
 			getAreaTargets() {
 				this.$api.ability.findAreaGroup({
 					id: this.areaId
@@ -279,32 +281,30 @@
 					}
 				)
 			},
+			/* 发布对象类型变化 */
 			onClassTypeChange(val) {
 				this.voteForm.classes = []
 			},
-
+			/* 发布对象变化 */
 			onTargetChange(data) {
 				this.voteForm.classes = data
 				this.voteForm.targets = this.getCurScope === 'school' ? [] : data
 			},
-
+			/* 修改开始时间 */
 			onChangeSTime(val) {
 				let endTime = this.voteForm.endTime || Date.now()
 				if (new Date(val).getTime() >= new Date(endTime).getTime()) {
 					this.voteForm.endTime = null
 				}
 			},
-
+			/* 修改结束时间 */
 			onChangeEndTime(val) {
 				if (val.indexOf('00:00') > 0) {
 					val = val.replace('00:00', '23:59')
 					this.voteForm.endTime = val
 				}
 			},
-			/**
-			 * 提交新增投票表单
-			 * @param name FormName
-			 */
+			/* 提交保存 */
 			async handleSubmit(name) {
 				this.isBtnLoading = true
 				let hasTargets = (!this.isAreaVote && this.voteForm.classes.length) || (this.isAreaVote && this.schoolTarget.length)
@@ -434,7 +434,7 @@
 					}
 				})
 			},
-
+			/* 初始化编辑器 */
 			initEditors() {
 				console.log('进入编辑起初始化')
 				console.log(this.voteOptions)
@@ -481,8 +481,7 @@
 					}
 				})
 			},
-
-			// 模拟选项聚焦事件
+			/* 模拟选项聚焦事件 */
 			optionClick(index) {
 				console.log(index)
 				let allToolbars = document.getElementsByClassName('option-editor')
@@ -499,8 +498,7 @@
 					currentToolBar.style.visibility = 'visible'
 				}, 100)
 			},
-
-			// 删除选项
+			/* 删除选项 */
 			deleteOption(index) {
 				this.voteOptions.splice(index, 1)
 				this.voteOptionsContent.splice(index, 1)
@@ -510,8 +508,7 @@
 					this.initEditors()
 				})
 			},
-
-			// 添加选项
+			/* 添加选项 */
 			onAddOption() {
 				let that = this
 				let newIndex = this.voteOptions.length
@@ -550,28 +547,17 @@
 					this.$Message.warning(this.$t('vote.form.optionNumsTip'))
 				}
 			},
-
-			// 提取富文本内容中的文本
+			/* 提取富文本内容中的文本 */
 			getSimpleText(html) {
 				var r = /<(?!img|video|audio).*?>/g;
 				return html.replace(r, "");
 			},
-
-			/**
-			 * 重置表单
-			 * @param name
-			 */
+			/* 重置操作 */
 			handleReset(name) {
 				this.$refs[name].resetFields();
 				this.descriptionEditor.txt.clear()
-
 			},
-
-
-			/**
-			 * 重置表单
-			 * @param name
-			 */
+			/* 取消操作 */
 			handleCancel() {
 				// 如果是新增的问卷点击取消编辑 则需要进行特殊处理
 				if (!this.curVoteItem.id) {
@@ -581,7 +567,6 @@
 				this.doRender(this.editInfo)
 
 			},
-
 			/** 附件上传之前钩子 限制附件上传个数 */
 			handleBeforeUpload() {
 				const check = this.uploadList.length < 5;
@@ -592,11 +577,7 @@
 				}
 				return check;
 			},
-
-			/**
-			 * 新增投票或者编辑投票
-			 * @param data
-			 */
+			/* API保存操作 */
 			saveorUpdateVote(data) {
 				return new Promise((r, j) => {
 					if (this.curVoteItem.owner !== 'area') {
@@ -619,14 +600,10 @@
 				})
 
 			},
-
-			/**
-			 * 回显投票详情
-			 * @param item
-			 */
+			/* 渲染投票对象表单 */
 			async doRender(item) {
 				console.log('需要渲染的投票对象', item)
-				
+				// await this.findResearchList()
 				// 如果是区级投票
 				if(this.isAreaVote){
 					this.classNameArr = item.targets.map(i => {
@@ -636,15 +613,18 @@
 					})
 				}else{
 					if (item.targetType === 'research') {
-						console.log(this.groupList);
-						let groupNameArr = []
-						item.tchLists.forEach(i => {
-							let findObj = this.groupList.find(j => j.id === i)
-							if (findObj) {
-								groupNameArr.push(findObj)
-							}
-						})
-						this.classNameArr = groupNameArr
+						if(item.tchLists.includes('TeacherAll')){
+							this.classNameArr = [{ name:this.$t('vote.allTeacher') }]
+						}else{
+							let groupNameArr = []
+							item.tchLists.forEach(i => {
+								let findObj = this.groupList.find(j => j.id === i)
+								if (findObj) {
+									groupNameArr.push(findObj)
+								}
+							})
+							this.classNameArr = groupNameArr
+						}
 					} else {
 						this.classNameArr = item.classes.length ? await this.getClassNameByIds(item.classes) : item
 							.stuLists.length ? await this.getClassNameByIds(item.stuLists) : []
@@ -692,7 +672,6 @@
 					this.$refs.voteForm.validateField('description')
 				})
 			},
-
 			/* 根据班级ID集合换取班级名称 */
 			getClassNameByIds(ids) {
 				return new Promise((r, j) => {
@@ -708,16 +687,19 @@
 					})
 				})
 			},
-
 			/* 查找学校检验组信息 */
 			findResearchList() {
-				this.$api.common.getActivityTarget({
-					tmdid: this.$store.state.userInfo.TEAMModelId,
-					schoolId: this.$store.state.userInfo.schoolCode,
-					opt: 'manage'
-				}).then(res => {
-					this.groupList = res.groupLists.filter(i => i.type === 'research')
+				return new Promise((r,j) => {
+					this.$api.common.getActivityTarget({
+						tmdid: this.$store.state.userInfo.TEAMModelId,
+						schoolId: this.$store.state.userInfo.schoolCode,
+						opt: 'manage'
+					}).then(res => {
+						this.groupList = res.groupLists.filter(i => i.type === 'research')
+						r(200)
+					})
 				})
+				
 			},
 		},
 		mounted() {
@@ -729,8 +711,6 @@
 			this.$editorTools.initSimpleEditor(descriptionEditor, this)
 			descriptionEditor.create()
 			this.descriptionEditor = descriptionEditor
-
-
 			if (this.editItem && this.editItem.name) {
 				console.log(this.editItem)
 				this.editInfo = JSON.parse(JSON.stringify(this.editItem))

+ 1 - 1
TEAMModelOS/ClientApp/src/components/vote/BaseVoteSsTable.vue

@@ -43,7 +43,7 @@
                     {
                         title: vm.$t('vote.className'),
                         render: (h, params) => {
-                            return h('span', params.row.classroomName)
+                            return h('span', params.row.classroomName === 'TeacherAll' ? vm.$t('vote.allTeacher') : params.row.classroomName)
                         },
                     },
                     {

+ 1 - 0
TEAMModelOS/ClientApp/src/locale/lang/en-US/vote.js

@@ -1,4 +1,5 @@
 export default {
+	allTeacher:'All Teachers',
 	noFindVote:'未查詢到當前活動!',
     noVoteData:'No polling data yet',
 	list:'Poll Activity List',

+ 1 - 0
TEAMModelOS/ClientApp/src/locale/lang/zh-CN/vote.js

@@ -1,4 +1,5 @@
 export default {
+	allTeacher:'所有老师',
 	noFindVote:'未查询到当前活动!',
 	noVoteData:'暂无投票数据',
     list:'投票活动列表',

+ 1 - 0
TEAMModelOS/ClientApp/src/locale/lang/zh-TW/vote.js

@@ -1,4 +1,5 @@
 export default {
+	allTeacher:'所有老師',
 	noFindVote:'未查詢到當前活動!',
 	noVoteData:'暫無投票數據',
 	list: '投票活動清單',

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

@@ -81,7 +81,7 @@
 						:curPeriodIndex="paperInfo.paperPeriod" :curSubjectIndex="paperInfo.paperSubject">
 					</BaseCreateChild>
 				</TabPane>
-				<TabPane :label="$t('evaluation.quickCreate')" name="name2" tab="newExerciseTab">
+				<TabPane :label="$t('evaluation.quickCreate')" name="name2" tab="newExerciseTab" v-if="isDevEnv">
 					<BasePasteTool></BasePasteTool>
 				</TabPane>
 			</Tabs>
@@ -399,6 +399,9 @@
 			isSchool() {
 				return this.$route.name === 'newSchoolPaper'
 			},
+			isDevEnv(){
+				return process.env.NODE_ENV === 'development'
+			}
 		},
 		watch: {
 			paper: {

+ 2 - 3
TEAMModelOS/TEAMModelOS.csproj

@@ -12,14 +12,13 @@
   </ItemGroup>
   <ItemGroup>
     <PackageReference Include="Caching.CSRedis" Version="3.6.50" />
+    <PackageReference Include="CHTCHSConv" Version="1.0.0" />
     <PackageReference Include="CSRedisCore" Version="3.6.5" />
     <PackageReference Include="DotNetZip" Version="1.15.0" />
     <PackageReference Include="HTEXLib" Version="5.2111.41" />
    
     <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.1" />
-    <PackageReference Include="PinYinConverterCore" Version="1.0.2" />
-	  <PackageReference Include="CHTCHSConv" Version="1.0.0" />
-    <PackageReference Include="VueCliMiddleware" Version="5.0.0" />
+	  <PackageReference Include="PinYinConverterCore" Version="1.0.2" />
   </ItemGroup>
   <ItemGroup>
     <None Remove="ClientApp\src\static\BaseDataDefault.json" />