Your Name 1 سال پیش
والد
کامیت
d5784dd32c
1فایلهای تغییر یافته به همراه68 افزوده شده و 9 حذف شده
  1. 68 9
      src/views/papers/cutPaper.vue

+ 68 - 9
src/views/papers/cutPaper.vue

@@ -9,15 +9,16 @@
     <el-row :gutter="20" style="margin-bottom:10px;">
       <el-col :span="18">
         <el-steps :active="stepNum" simple >
-          <el-step title="定标准点" icon="el-icon-edit"></el-step>
-          <el-step title="考号区域" icon="el-icon-upload"></el-step>
-          <el-step title="客观题" icon="el-icon-picture"></el-step>
+          <el-step title="定标准点" icon="el-icon-edit" @click.native="stepNum=1"></el-step>
+          <el-step title="考号区域" icon="el-icon-upload" @click.native="stepNum=2"></el-step>
+          <el-step title="客观题" icon="el-icon-picture" @click.native="stepNum=3"></el-step>
+          <el-step title="主观题" icon="el-icon-picture" @click.native="stepNum=4"></el-step>
         </el-steps>
       </el-col>
       <el-col :span="6">
         <el-button size="mini" type="primary" v-if="stepNum > 1" @click="stepNum-=1">上一步</el-button>
-        <el-button size="mini" type="primary" v-if="stepNum < 3" @click="nextStep">下一步</el-button>
-        <el-button size="mini" type="success" v-if="stepNum == 3" @click="updatePaperRecInfo">保存</el-button>
+        <el-button size="mini" type="primary" v-if="stepNum < 4" @click="nextStep">下一步</el-button>
+        <el-button size="mini" type="success" @click="updatePaperRecInfo">保存</el-button>
       </el-col>
     </el-row>
     <el-row>
@@ -55,6 +56,7 @@
               <el-image style="margin-bottom:20px 0px;border:1px solid #ccc;" height="60px" width="100%" :src="snoImg" :preview-src-list="[snoImg]"></el-image>
             </div>
           </el-card>
+          <!-- 客观题 -->
           <el-card class="box-card" v-if="stepNum==3">
             <div slot="header" class="clearfix">
               <span>标注客观题</span>
@@ -71,6 +73,22 @@
                 :preview-src-list="[item]"></el-image>
             </div>
           </el-card>
+          <!-- 主观题 -->
+          <el-card class="box-card" v-if="stepNum==4">
+            <div slot="header" class="clearfix">
+              <span>切割主观题</span>
+            </div>
+            <div v-if="subImgList.length>0"  v-for="(item,index) in subImgList">
+              <div style="margin-bottom:10px;" >
+                <el-input size="mini" v-model="item.qno"></el-input>
+                <i class="el-icon-delete" @click="subImgList.splice(index,1)"
+                  style="float:right;color:red;cursor: pointer;"></i>
+                <div class="clear"></div>
+              </div>
+              <el-image style="margin-bottom:20px 0px;border:1px solid #ccc;" width="100%" :src="item.qimg"
+                :preview-src-list="[item.qimg]"></el-image>
+            </div>
+          </el-card>
         </div>
       </el-col>
     </el-row>
@@ -342,7 +360,8 @@
         khOpen:false,
         stdPoints:null,
         khPointsCrop:{},
-        ansPointsCrop:{}
+        ansPointsCrop:{},
+        subImgList:[]
       };
     },
     watch: {
@@ -384,8 +403,8 @@
         };
         this.curPaperId = this.$route.query.id;
         this.$api.getPaperInfo(params).then((res) => {
-          console.log(res,333333333333)
           let imgs = JSON.parse(res.data.data.imgs);
+          let paperPieces = res.data.data.paperPieces;
           this.curPaperImg = imgs[0];
           this.stdPointImg = res.data.data.stdPointsImg;
           this.stdPoints = res.data.data.stdPoints?JSON.parse(res.data.data.stdPoints):{};
@@ -395,6 +414,15 @@
           this.ansPointsCrop = res.data.data.ansPointsCrop?[res.data.data.ansPointsCrop]:[];
           this.khType = res.data.data.khType;
           this.khLength = res.data.data.khLength;
+          let subQueImgList = [];
+          paperPieces.forEach((item,index)=>{
+            subQueImgList.push({
+              qno:item.qno,
+              qimg:item.imgs,
+              point:JSON.parse(item.imgs_points)
+            })
+          })
+          this.subImgList = subQueImgList;
           this.initCropper();
           this.loading = false;
         });
@@ -453,7 +481,8 @@
           stdQueList:this.stdQueList,
           khType:this.khType,
           khLength:this.khLength,
-          ansPointsCrop:this.ansPointsCrop
+          ansPointsCrop:this.ansPointsCrop,
+          subImgList:this.subImgList
         }
         this.$api.updatePaperInfo(params).then(res => {
           this.msgSuccess("成功!");
@@ -577,6 +606,20 @@
                   that.ansPointsCrop = khPointsCrop;
                   that.ansCardImgList.push(cropperImgData);
                 }
+                // 主观题
+                if(that.stepNum == 4){
+                  let khPointsCrop = {
+                    x:cropData.x,y:cropData.y,
+                    w:cropData.width,h:cropData.height
+                    }
+                  
+                  khPointsCrop["x"] = khPointsCrop["x"]-that.stdPoints["x"];
+                  khPointsCrop["y"] = khPointsCrop["y"]-that.stdPoints["y"];
+
+                  that.ansPointsCrop = khPointsCrop;
+                  let imgItem = {qno:null,qimg:cropperImgData,point:khPointsCrop};
+                  that.subImgList.push(imgItem);
+                }
               }
               that.myCropper.clear()
               this.cropper.clear()
@@ -743,8 +786,10 @@
               let khPointsCrop = JSON.parse(rst.data.khPointsCrop)
               let stdKhList = JSON.parse(rst.data.stdKhList);
               let khLength = rst.data.khLength;
+              // if(khPointsCrop.x < 10 || khPointsCrop.y < 10 ||khPointsCrop.w<50 
+              //   ||khPointsCrop.h<50||stdKhList.length!=khLength){
               if(khPointsCrop.x < 10 || khPointsCrop.y < 10 ||khPointsCrop.w<50 
-                ||khPointsCrop.h<50||stdKhList.length!=khLength){
+                ||khPointsCrop.h<50){
                 this.msgError("考号识别错误,请重编辑考号区域!");
                 return 
               }else{
@@ -762,6 +807,20 @@
             khPointsCrop:this.khPointsCrop
           }
           this.$api.updatePaperInfo(params).then(res => {
+            this.getData();
+          })
+          this.stepNum += 1
+        }
+        // 主观题
+        if(this.stepNum==4){
+          let params = {
+            id: this.$route.query.id,
+            ansPoints:this.ansCardImgList,
+            khPointsCrop:this.khPointsCrop,
+            subImgList:this.subImgList
+          }
+          this.$api.updatePaperInfo(params).then(res => {
+            this.getData();
           })
         }
       }