Forráskód Böngészése

管理员可修改评审分数,修改管理员评分管理占比错误

SanHQin 1 éve
szülő
commit
95397163e4

+ 4 - 6
src/components/pages/disAdmin/score.vue

@@ -539,9 +539,9 @@ export default {
 				let total = (parseFloat(score.first)+parseFloat(score.second)+parseFloat(score.third))/3
 				if(total>=90){
 					one[0]++;
-				}else if(total>=75 && total<=89){
+				}else if(total>=75 && total<90){
 					two[0]++;
-				}else if(total>=60 && total<=74){
+				}else if(total>=60 && total<75){
 					three[0]++;
 				}else{
 					four[0]++;
@@ -569,7 +569,6 @@ export default {
 			let three = [0,0];
 			let four = [0,0];
 			let five = [0,0]
-
 			score.forEach(i=>{
 				let sum = i.sum;
 				if(!sum){
@@ -577,9 +576,9 @@ export default {
 				}
 				if(parseFloat(sum)>=90){
 					return one[0]++
-				}else if(parseFloat(sum)>=75 && parseFloat(sum)<=89){
+				}else if(parseFloat(sum)>=75 && parseFloat(sum)<90){
 					return two[0]++;
-				}else if(parseFloat(sum)>=60 && parseFloat(sum)<=74){
+				}else if(parseFloat(sum)>=60 && parseFloat(sum)<75){
 					return three[0]++;
 				}else{
 					return four[0]++;
@@ -852,7 +851,6 @@ export default {
 					const start = (this.page - 1) * 10;
           const end = start + 10;
           let result = p.slice(start, end);
-					console.log(result)
 
 					result.forEach(i=>{
 						let typeName = i.typename;

+ 146 - 11
src/components/pages/race/eventCenter/anliDetail.vue

@@ -88,7 +88,7 @@
           </div>.
 					<div
 					v-if="['0','2'].includes(tType)"
-					@click="upperOne()"
+					@click="changeProject(1)"
 					class="clickBtn"
 					style="
 							position: absolute;
@@ -97,7 +97,7 @@
 
 						<div
 						v-if="['0','2'].includes(tType)"
-						@click="nextOne()"
+						@click="changeProject(0)"
 						class="clickBtn"
 						style="
 							position: absolute;
@@ -146,11 +146,11 @@
         	  <div>平台案例填写</div>
         	</div>
 				</div>
-				<div :class="['navBoxBtn',psDialog?'':'noPsDialog']" v-if="psDialog || isNavTop >= 300 && ['0','2'].includes(tType)">
+				<div :class="['navBoxBtn',psDialog?'':'noPsDialog']" v-if="psDialog && isNavTop >= 300 && ['0','2'].includes(tType)">
 
-					<div @click="upperOne()" class="clickBtn">上一个</div>
+					<div @click="changeProject(1)" class="clickBtn">上一个</div>
 
-					<div @click="nextOne()" class="clickBtn">下一个</div>
+					<div @click="changeProject(0)" class="clickBtn">下一个</div>
 
 					<div @click="
               goTo(
@@ -2413,7 +2413,18 @@
             <div>{{ scoreDetail[0].uname }}</div>
           </div>
           <div class="psBox">
-            <div>
+						<div v-if="['0'].includes(tType)" v-for="(item,index) in allScoreDetail">
+							<span>{{item.name}}评分(总分100分)</span>
+              <el-input
+                class="number"
+								placeholder="请输入评分"
+                v-model.number="allScoreDetail[index].score.first"
+                @change="adminSetScore(index)"
+                :controls="false"
+								:min="0"
+              ></el-input>
+						</div>
+            <div v-if="['2'].includes(tType)">
               <!-- <span>总分</span -->
 							<span>评分(总分100分)</span>
               <el-input
@@ -2833,6 +2844,7 @@ export default {
           sumScore: 0,
         },
       ],
+			allScoreDetail:[],
       psDialog: false,
     };
   },
@@ -2841,7 +2853,23 @@ export default {
       done();
     },
     async goTo(path) {
-			if(this.tType == 1 || await this.addScore('back')){
+			if(['0','1'].includes(this.tType) || await this.addScore('back')){
+				if(['0'].includes(this.tType) && this.allScoreDetail.length!=0){
+					return this.$confirm('是否保存当前评分', '提示', {
+						distinguishCancelAndClose: true,
+        	  confirmButtonText: '保存',
+        	  cancelButtonText: '不保存',
+        	  type: 'info'
+        	}).then(async () => {
+						if(await this.adminAddScore()){
+							this.$router.push(path);
+						}
+        	}).catch((action) => {
+        	  if(action==='cancel'){
+							this.$router.push(path);
+						}
+        	});
+				}
 				this.$router.push(path);
 			}
     },
@@ -2880,6 +2908,11 @@ export default {
       this.scoreDetail[0].scoreAll.third = this.scoreDetail[0].scoreAll.first;
       this.$forceUpdate();
     },
+		adminSetScore(index){
+			this.allScoreDetail[index].score.second = this.allScoreDetail[index].score.first;
+			this.allScoreDetail[index].score.third = this.allScoreDetail[index].score.first;
+			this.$forceUpdate();
+		},
     isNumber(e, t) {
       if (e.includes(".")) {
         this.$message.error("暂时不支持小数点评分");
@@ -2955,6 +2988,100 @@ export default {
           console.error(err);
         });
     },
+		adminGetScore(id){
+			this.allScoreDetail = [];
+			let params = {
+				rid:id
+			}
+			this.ajax.get(this.$store.state.api + "selectScoreByAdmin", params).then(res => {
+				if(res.data[0].length>0){
+					let allScoreData = res.data[0];
+					allScoreData.forEach(i=>{
+						i.score = JSON.parse(i.score);
+					})
+					this.allScoreDetail = allScoreData;
+				}
+			}).catch(err=>{
+				console.error(err)
+			})
+		},
+		adminAddScore(showInfo=true){
+			return new Promise((resolve,reject)=>{
+				let flag = false;
+				this.allScoreDetail.forEach(i=>{
+					if(flag)return;
+					if (i.score.first == "") {
+						flag = true;
+      		  this.$message.error("请填写案例评分");
+      		  return reject(false);
+      		}
+					let newValue = parseFloat(i.score.first);
+					if(!newValue){
+						flag = true;
+						this.$message.error("请输入分数,请重新评分")
+						return reject(false)
+						//this.scoreDetail[0].scoreAll.first = '';
+					}
+					if(newValue<0){
+						flag = true;
+						this.$message.error("当前评分小于0,请重新评分")
+						return reject(false)
+						// this.scoreDetail[0].scoreAll.first = '';
+					}
+					if(newValue>100){
+						flag = true;
+						this.$message.error("当前评分超出最高分,请重新评分")
+						return reject(false)
+					}
+				})
+				let updateCount = 0;
+				this.allScoreDetail.forEach(async i=>{
+					let params = [
+      		  {
+      		    rid: this.aid,
+      		    suser: i.scorer,
+      		    s: JSON.stringify(i.score),
+      		  },
+      		];
+      		let result = await this.ajax.post(this.$store.state.api + "addScore", params);
+				})
+				this.allScoreDetail = [];
+				this.adminGetScore(this.aid)
+				this.$message.success("保存成功")
+				return resolve(true)
+			})
+		},
+		changeProject(status=0){
+			if(['0'].includes(this.tType) && this.allScoreDetail.length!=0){
+				return this.$confirm('是否保存当前评分', '提示', {
+					distinguishCancelAndClose: true,
+      	  confirmButtonText: '保存',
+      	  cancelButtonText: '不保存',
+      	  type: 'info'
+      	}).then(async () => {
+					if(await this.adminAddScore()){
+						if(status==0){
+							this.nextOne();
+						}else{
+							this.upperOne();
+						}
+					}
+      	}).catch((action) => {
+      	  if(action==='cancel'){
+						if(status==0){
+							this.nextOne();
+						}else{
+							this.upperOne();
+						}
+					}
+      	});
+			}
+			if(status==0){
+				this.nextOne();
+			}else{
+				this.upperOne();
+			}
+		},
 		async nextOne(){
 			if(['0','1'].includes(this.tType) || await this.addScore(false)){
 				const allScoreList = JSON.parse(sessionStorage.getItem("allScoreList"))
@@ -2975,8 +3102,11 @@ export default {
               content: "",
             };
             this.scoreDetail[0].sumScore = 0;
-					if (!['0','1'].includes(this.tType)) {
+					if (['0','2'].includes(this.tType)) {
    				  this.psDialog = true;
+						if(['0'].includes(this.tType)){
+							this.adminGetScore(this.aid);
+						}
    				  this.getScore(this.aid);
    				}
 				})
@@ -3004,8 +3134,11 @@ export default {
               content: "",
             };
             this.scoreDetail[0].sumScore = 0;
-					if (!['0','1'].includes(this.tType)) {
+					if (['0','2'].includes(this.tType)) {
    				  this.psDialog = true;
+						 if(['0'].includes(this.tType)){
+							this.adminGetScore(this.aid);
+						}
    				  this.getScore(this.aid);
    				}
 				})
@@ -3052,7 +3185,6 @@ export default {
       this.ajax
         .post(this.$store.state.api + "addScore", params)
         .then((res) => {
-					console.log(showInfo)
 					if(showInfo!="back"?showInfo:false){
 						this.$message({
             	message: "评分成功",
@@ -4273,9 +4405,12 @@ export default {
     this.selectAnLi();
   },
   mounted() {
-    if (['2'].includes(this.tType)) {
+    if (['2','0'].includes(this.tType)) {
       this.psDialog = true;
       this.getScore(this.aid);
+			if(['0'].includes(this.tType)){
+				this.adminGetScore(this.aid);
+			}
     }
   },
 };