Ver código fonte

加入试卷列表搜索功能

OnePsycho 4 anos atrás
pai
commit
d852c5de98

+ 7 - 0
TEAMModelOS/ClientApp/src/api/evaluation.js

@@ -0,0 +1,7 @@
+import { fetch, post } from '@/api/http'
+
+export default {
+    getFilterCount: function (data) {        
+        return post('/item/cond-count', data)
+    }
+}

+ 22 - 19
TEAMModelOS/ClientApp/src/view/evaluation/bank/TestPaperList.vue

@@ -1,7 +1,11 @@
 <template>
 	<div class="pl-container" ref="plContainer">
 		<!-- 条件筛选部分 -->
-		<BaseFilter ref="baseFilter" @onChange="onFilterChange" :filterCounts="filterCounts" :isFilterPaper="isFilterPaper"  v-if="!isPreview"></BaseFilter>
+		<BaseFilter ref="baseFilter" @onChange="onFilterChange" :filterCounts="filterCounts"
+		 :isFilterPaper="isFilterPaper"
+		 @onSearchChange="onSearchChange"
+		 @onCloseSearch="onCloseSearch"
+		   v-if="!isPreview"></BaseFilter>
 
 		<!-- 空数据展示 -->
 		<div v-if="paperList.length === 0" class="no-data-text">
@@ -142,6 +146,7 @@
 				filterParams: {},
 				findCountParams: {},
 				originList: [],
+				originRes:[],
 				schoolInfo: {},
 				filterSort: 'createTime',
 				evaluationInfo: null,
@@ -277,6 +282,7 @@
 					this.getItemsCount(list,filterKey)
 					this.paperList = list
 					this.originList = list
+					this.originRes = JSON.parse(JSON.stringify(list))
 					this.totalNum = list.length
 					this.pageChange(1)
 					setTimeout(() => {
@@ -291,6 +297,20 @@
 				})
 			},
 			
+			/* 搜索词汇发生变化 */
+			onSearchChange(val) {
+				this.originList = this.originRes.filter(i => i.name.indexOf(val) > -1)
+				this.totalNum = this.originList.length
+				this.pageChange(1)
+			},
+			/* 关闭搜索 */
+			onCloseSearch() {
+				this.$refs.baseFilter.searchVal = ''
+				this.originList = JSON.parse(JSON.stringify(this.originRes))
+				this.totalNum = this.originList.length
+				this.pageChange(1)
+			},
+			
 			/* 获取所有学段下的试题总数 */
 			getPeriodCount(papers){
 				let periodIdArr = this.periodList.map(i => i.id)
@@ -349,24 +369,7 @@
 				console.log('要下载的试卷', fullPaperJson)
 			},
 			
-			// async renderAnswerSheet(paper){
-			// 	this.dataLoading = true
-			// 	try{
-			// 		let fullPaperJson = this.fullPaperJson.id === paper.id ? this.fullPaperJson : await this.$evTools.getFullPaper(paper)
-			// 		// this.isShowSheet = true
-			// 		this.dataLoading = false
-			// 		this.$router.push({
-			// 			name: 'answerSheet',
-			// 			params: {
-			// 				paper: fullPaperJson
-			// 			}
-			// 		})
-			// 	}catch(e){
-			// 		this.$Message.error(this.$t('evaluation.paperList.paperErrorTip'))
-			// 		this.dataLoading = false
-			// 	}
-				
-			// },
+
 
 			/**
 			 * 删除试卷

+ 19 - 103
TEAMModelOS/ClientApp/src/view/evaluation/components/BaseFilter.vue

@@ -38,6 +38,8 @@
 					<Icon type="md-arrow-round-down" />
 				</Radio>
 			</RadioGroup>
+			<!-- 试卷列表的搜索功能 -->
+			<Input v-model="searchVal" clearable  placeholder="输入试卷名称进行搜索..." style="width: 300px" @on-click="onCloseSearch" @on-change="onSearchChange"/>
 		</div>
 	</div>
 </template>
@@ -67,6 +69,7 @@
 				userId: "",
 				schoolCode: "",
 				schoolInfo: {},
+				searchVal:'',
 				isShowSchoolBank: false,
 				isShowUploadList: false,
 				exersicesType: this.$GLOBAL.EXERCISE_TYPES(),
@@ -257,6 +260,15 @@
 				});
 				return list;
 			},
+			
+			/* 搜索词汇发生变化 */
+			onSearchChange() {
+				this.$emit('onSearchChange',this.searchVal)
+			},
+			/* 关闭搜索 */
+			onCloseSearch() {
+				this.$emit('onCloseSearch')
+			},
 		},
 
 		mounted() {},
@@ -275,109 +287,13 @@
 	};
 </script>
 
-<style scoped>
-	.filter-wrap {
-		width: 100%;
-		padding: 20px;
-		background: #fff;
-	}
-
-	.filter-wrap .filter-item:first-child {
-		margin-top: 0px;
-	}
-
-	.filter-wrap .filter-item {
-		margin-top: 10px;
-		display: flex;
-	}
-
-	.filter-wrap .filter-title {
-		font-size: 16px;
-		font-weight: bold;
-		margin-right: 10px;
-		min-width: 40px;
-	}
-
-	.filter-wrap .ivu-radio-group {
-		padding-bottom: 4px;
+<style>
+	.filter-wrap .filter-item .ivu-input{
+		border-radius: 100px;
+		padding: 4px 12px;
 	}
-
-	.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: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-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-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-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: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-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 .filter-item .ivu-input-wrapper{
+		margin-left: 30px;
 	}
 </style>

+ 88 - 82
TEAMModelOS/ClientApp/src/view/syllabus/Syllabus.vue

@@ -198,7 +198,7 @@
 		<Modal v-model="isRelateContentModal" width="900" class="tree-modal add-volume-modal choose-content-modal">
 			<ChooseContent v-if="isRelateContentModal" ref="chooseContentRef" :showSyllabus="false"
 				@previewPaper="onPreviewPaper"></ChooseContent>
-			<Button slot="footer" @click="onRelateContent" style="margin-bottom: 20px;" class="modal-btn">确认</Button>
+			<Button slot="footer" @click="onRelateContent" style="margin-bottom: 20px;" class="modal-btn" :loading="isRelateLoading">确认</Button>
 		</Modal>
 
 		<!-- 选择共编、分享弹窗 -->
@@ -273,6 +273,7 @@
 				isLoading: false,
 				isSearchVolume: false,
 				isAddLoading: false,
+				isRelateLoading:false,
 				isShowLinkModal: false,
 				isUploadModal: false,
 				isAddTreeModal: false,
@@ -885,15 +886,12 @@
 						res => {
 							if (res.error == null) {
 								r(res)
-								this.$Message.success('保存成功!')
 							} else {
 								r(res.error)
-								this.$Message.error(this.$t('evaluation.paperList.saveFail'))
 							}
 						},
 						err => {
 							j(err)
-							this.$Message.error(this.$t('evaluation.paperList.saveFail'))
 						}
 					)
 				})
@@ -925,102 +923,110 @@
 				})
 			},
 			/* 获取关联的试卷数据 */
-			async onSelectPaper() {
-				let list = this.$refs.chooseContentRef.$refs.paperListRef.checkedPaperList
-				if (!list.length) return
-				let curResourceArr = this.$refs.treeRef.curData.rnodes
-				// 拿到关联的个人试卷
-				let privatePapers = list.filter(i => i.scope === 'private')
-				let privateSas = await this.$tools.getPrivateSas()
-				// 如果是在校本课纲关联的个人试卷 则需要进行入库操作
-				if (this.isSchool && privatePapers.length) {
-					let schoolPaperList = await this.getSchoolPaperList()
-					console.log(privatePapers)
-					let promiseArr = []
-					privatePapers.forEach(async paper => {
-						if(schoolPaperList.map(i => i.name).includes(paper.name)){
-							this.$Modal.confirm({
-								title: '提示',
-								content: '校本试卷库中已存在名称为' + paper.name + '的试卷,是否继续操作覆盖原试卷?',
-								onOk: async () => {
-									// 继续进行操作完成试卷覆盖
-									// 拿到试卷的index.json 先完善学段科目年级信息后 去进行上传覆盖操作
-									let indexJsonFile = await this.$tools.getFile(this.$evTools.getBlobHost() + '/' + paper.code.replace('Paper-','') + paper.blob + '/index.json' + privateSas.sas)
-									let paperIndexJson = JSON.parse(indexJsonFile)
-									paperIndexJson.periodId = this.periodList[this.currentPeriodIndex].id
-									paperIndexJson.subjectId = this.subjectList[this.activeSubjectIndex].id
-									paperIndexJson.subjectName = this.subjectList[this.activeSubjectIndex].name
-									paperIndexJson.gradeIds = [this.curVolume.gradeId + '']
-									paperIndexJson.scope = 'school'
-									paperIndexJson.code = this.$store.state.userInfo.schoolCode
-									console.log(paperIndexJson)
-									promiseArr.push(this.savePaperToSchoolBlob(paperIndexJson,paper.scoring,true))
-								},
-								onCancel: () => {
-									// 取消则无法关联当前试卷到节点
-									curResourceArr.splice(curResourceArr.map(i => i.id).indexOf(paper.id),1)
+			onSelectPaper() {
+				return new Promise(async (r,j) => {
+					let list = this.$refs.chooseContentRef.$refs.paperListRef.checkedPaperList
+					if (!list.length) return
+					let curResourceArr = this.$refs.treeRef.curData.rnodes
+					// 拿到关联的个人试卷
+					let privatePapers = list.filter(i => i.scope === 'private')
+					let privateSas = await this.$tools.getPrivateSas()
+					// 如果是在校本课纲关联的个人试卷 则需要进行入库操作
+					if (this.isSchool && privatePapers.length) {
+						let schoolPaperList = await this.getSchoolPaperList()
+						console.log(privatePapers)
+						let promiseArr = []
+						privatePapers.forEach(async paper => {
+							if(schoolPaperList.map(i => i.name).includes(paper.name)){
+								this.$Modal.confirm({
+									title: '提示',
+									content: '校本试卷库中已存在名称为' + paper.name + '的试卷,是否继续操作覆盖原试卷?',
+									onOk: async () => {
+										// 继续进行操作完成试卷覆盖
+										// 拿到试卷的index.json 先完善学段科目年级信息后 去进行上传覆盖操作
+										let indexJsonFile = await this.$tools.getFile(this.$evTools.getBlobHost() + '/' + paper.code.replace('Paper-','') + paper.blob + '/index.json' + privateSas.sas)
+										let paperIndexJson = JSON.parse(indexJsonFile)
+										paperIndexJson.periodId = this.periodList[this.currentPeriodIndex].id
+										paperIndexJson.subjectId = this.subjectList[this.activeSubjectIndex].id
+										paperIndexJson.subjectName = this.subjectList[this.activeSubjectIndex].name
+										paperIndexJson.gradeIds = [this.curVolume.gradeId + '']
+										paperIndexJson.scope = 'school'
+										paperIndexJson.code = this.$store.state.userInfo.schoolCode
+										console.log(paperIndexJson)
+										promiseArr.push(this.savePaperToSchoolBlob(paperIndexJson,paper.scoring,true))
+									},
+									onCancel: () => {
+										// 取消则无法关联当前试卷到节点
+										curResourceArr.splice(curResourceArr.map(i => i.id).indexOf(paper.id),1)
+									}
+								})
+							}else{
+								// 拿到试卷的index.json 先完善学段科目年级信息后 去进行上传覆盖操作
+								let indexJsonFile = await this.$tools.getFile(this.$evTools.getBlobHost() + '/' + paper.code.replace('Paper-','') + paper.blob + '/index.json' + privateSas.sas)
+								let paperIndexJson = JSON.parse(indexJsonFile)
+								paperIndexJson.periodId = this.periodList[this.currentPeriodIndex].id
+								paperIndexJson.subjectId = this.subjectList[this.activeSubjectIndex].id
+								paperIndexJson.subjectName = this.subjectList[this.activeSubjectIndex].name
+								paperIndexJson.gradeIds = [this.curVolume.gradeId + '']
+								paperIndexJson.scope = 'school'
+								paperIndexJson.code = this.$store.state.userInfo.schoolCode
+								console.log(paperIndexJson)
+								promiseArr.push(this.savePaperToSchoolBlob(paperIndexJson,paper.scoring))
+							}
+							
+						})
+						Promise.all(promiseArr).then(result => {
+							console.log(result)
+							list.forEach(i => {
+								if (!curResourceArr.filter(j => j.type === 'paper').map(k => k.id).includes(i.id)) {
+									curResourceArr.push({
+										type: 'paper',
+										title: i.name,
+										id: i.id,
+										code: 'Paper-' + this.$store.state.userInfo.schoolCode,
+										scope: 'school',
+										cntr:this.$store.state.userInfo.schoolCode,
+										link: [i.blob]
+									})
 								}
 							})
-						}else{
-							// 拿到试卷的index.json 先完善学段科目年级信息后 去进行上传覆盖操作
-							let indexJsonFile = await this.$tools.getFile(this.$evTools.getBlobHost() + '/' + paper.code.replace('Paper-','') + paper.blob + '/index.json' + privateSas.sas)
-							let paperIndexJson = JSON.parse(indexJsonFile)
-							paperIndexJson.periodId = this.periodList[this.currentPeriodIndex].id
-							paperIndexJson.subjectId = this.subjectList[this.activeSubjectIndex].id
-							paperIndexJson.subjectName = this.subjectList[this.activeSubjectIndex].name
-							paperIndexJson.gradeIds = [this.curVolume.gradeId + '']
-							paperIndexJson.scope = 'school'
-							paperIndexJson.code = this.$store.state.userInfo.schoolCode
-							console.log(paperIndexJson)
-							promiseArr.push(this.savePaperToSchoolBlob(paperIndexJson,paper.scoring))
-						}
-						
-					})
-					Promise.all(promiseArr).then(result => {
-						console.log(result)
+							r(200)
+						})
+					}else{
 						list.forEach(i => {
 							if (!curResourceArr.filter(j => j.type === 'paper').map(k => k.id).includes(i.id)) {
 								curResourceArr.push({
 									type: 'paper',
 									title: i.name,
 									id: i.id,
-									code: 'Paper-' + this.$store.state.userInfo.schoolCode,
-									scope: 'school',
-									cntr:this.$store.state.userInfo.schoolCode,
+									code: i.code,
+									scope: i.scope,
+									cntr: i.scope === 'school' ? this.$store.state.userInfo.schoolCode : this
+										.$store.state
+										.userInfo.TEAMModelId,
 									link: [i.blob]
 								})
 							}
 						})
-					})
-				}else{
-					list.forEach(i => {
-						if (!curResourceArr.filter(j => j.type === 'paper').map(k => k.id).includes(i.id)) {
-							curResourceArr.push({
-								type: 'paper',
-								title: i.name,
-								id: i.id,
-								code: i.code,
-								scope: i.scope,
-								cntr: i.scope === 'school' ? this.$store.state.userInfo.schoolCode : this
-									.$store.state
-									.userInfo.TEAMModelId,
-								link: [i.blob]
-							})
-						}
-					})
-				}
+						r(200)
+					}
+				})
+				
 			},
 			/* 点击确认 去获取关联的内容数据、试题试卷数据 */
 			onRelateContent() {
+				this.isRelateLoading = true
 				let curResourceArr = this.$refs.treeRef.curData.rnodes
 				this.onSelectFile().then(res => {
 					this.onSelectQuestion()
-					this.onSelectPaper()
-					// this.$refs.treeRef.curData.rnodes = this.relateFiles
-					console.log(this.curNode)
-					this.isRelateContentModal = false
-					this.hasModify = true
-					this.modifyIdArr.push(this.curChapter.data.id)
+					this.onSelectPaper().then(result => {
+						setTimeout(() => {
+							this.isRelateLoading = false
+							this.isRelateContentModal = false
+							this.hasModify = true
+							this.modifyIdArr.push(this.curChapter.data.id)
+						},500)
+					})
 				}).catch(err => {
 					this.$Message.error(err)
 				})