Browse Source

最终得分

SanHQin 1 tuần trước cách đây
mục cha
commit
cbfe496339

+ 2 - 2
src/components/pages/test/check/check.vue

@@ -65,7 +65,7 @@
         <div class="step_box">
           <div class="edit_top">
             <div class="op_btn">
-              <el-button type="primary" size="small" @click="publish">确定批改</el-button>
+              <el-button type="primary" size="small" @click="publish" v-if="false">确定批改</el-button>
             </div>
           </div>
           <topicVue :cJson="cJson" :title="title" :brief="brief" :checktype="2" :see="see" :isTeacher="1" :name="name" ref="topicVue"></topicVue>
@@ -259,4 +259,4 @@ export default {
   margin: 0 auto;
   box-sizing: border-box;
 }
-</style>
+</style>

+ 45 - 2
src/components/pages/test/examine/conpoments/personPage.vue

@@ -191,6 +191,8 @@
             <div>审核进度:{{ computedStep }}/{{ twoTarget }}</div>
             <div>自评分数:{{ DigSelfSco }}</div>
             <div>考核分数:{{ computedSco }}</div>
+            <div v-if="formula">最终得分:{{formulaScore}}</div>
+
           </div>
         </div>
         <div style="height:100%;overflow: auto;padding-bottom: 80px;">
@@ -460,7 +462,8 @@ export default {
       PageBaseDataTwo: [],
       remDig: false,
       timeSortList:[],
-      typeStatusList:["待办","已完成",'/']
+      typeStatusList:["待办","已完成",'/'],
+      formula:""
     };
   },
   watch: {
@@ -538,6 +541,45 @@ export default {
         return score;
       }
     },
+
+    formulaScore(){
+      let _result = "0.00"
+
+      if(this.formula && this.PageBaseData){
+        let scoreObj = {}
+        this.PageBaseData.forEach(i=>{
+          if(!scoreObj[i.id]){
+            scoreObj[i.id] = 0;
+          }
+
+          i.children.forEach(i2=>{
+            if(i2.sco2){
+              scoreObj[i.id]+=parseFloat(i2.sco2)
+            }
+          })
+        })
+
+        let formulaText = this.formula;
+        for (const key in scoreObj) {
+            if (scoreObj.hasOwnProperty(key)) {
+              const regex = new RegExp('\\b' + key + '\\b', 'g');
+              formulaText = formulaText.replace(regex, scoreObj[key]);
+            }
+        }
+
+        if(!formulaText)return _result;
+
+        try{
+          _result = eval(formulaText).toFixed(2)
+        }catch(e){
+          console.log(e)
+        }
+
+      }
+
+
+      return _result;
+    }
   },
   mounted() {
     this.getData();
@@ -1209,7 +1251,8 @@ ws['!rows'] = [
         .get(this.$store.state.api + "selectTestExamineBase", params)
         .then(res => {
           // console.log("selectTestExamineBase", res.data[0][0]);
-
+          this.formula = res.data[0][0].formula?res.data[0][0].formula:"";
+          console.log("formula",this.formula)
           this.PageBaseData = JSON.parse(res.data[0][0].json);
           this.PageBaseDataTwo = JSON.parse(res.data[0][0].json);
           // 处理数据来源