Your Name 1 年之前
父节点
当前提交
b0b5d17a61
共有 3 个文件被更改,包括 201 次插入107 次删除
  1. 5 1
      src/api.js
  2. 2 1
      src/views/papers/canvasDrawer.vue
  3. 194 105
      src/views/tasks/Index.vue

+ 5 - 1
src/api.js

@@ -185,5 +185,9 @@ export default {
 		return axios.get(`${baseURL}/api/admin/papers/task/students/download`, {
 			params: params, responseType: "blob"
 		});
-	},
+    },
+    // 重新识别
+    reTryMarkPaper: params => {
+        return axios.post(`${baseURL}/api/admin/papers/retrymark`, params)
+    },
 }

+ 2 - 1
src/views/papers/canvasDrawer.vue

@@ -308,7 +308,8 @@
                             this.redrawAll();
                         })
                     }else{
-                        this.curArea = {x:this.downX,y:this.downY,w:this.rectWidth,h:this.rectHeight}
+                        this.curArea = {x:this.downX,y:this.downY,w:this.rectWidth,h:this.rectHeight};
+                        this.recTarget = 2;
                     }
                 }
             },

+ 194 - 105
src/views/tasks/Index.vue

@@ -68,7 +68,8 @@
         <el-image :src="curStudentRecImg">
           <div slot="error" class="image-slot">
             <i class="el-icon-picture-outline"></i>
-          </div></el-image>
+          </div>
+        </el-image>
       </el-form>
       <div slot="footer" class="dialog-footer">
         <el-button @click="showAnsVisible = false">关 闭</el-button>
@@ -84,7 +85,7 @@
             <el-col :span="6">识别异常:</el-col>
           </el-row> -->
           <el-form :inline="true">
-            <el-form-item label="姓名" >
+            <el-form-item label="姓名">
               <el-input size="mini" placeholder="请输入姓名/考号" v-model="queryName" clearable></el-input>
             </el-form-item>
             <el-form-item label="识别异常">
@@ -96,8 +97,9 @@
             <el-form-item>
               <el-button type="primary" size="mini" @click=searchMarkData>搜索</el-button>
               <el-button size="mini" @click="reSetMarkData">重置</el-button>
-              <el-button @click="downloadObjectiveResult(curTaskId)" type="warning" size="mini" icon="el-icon-download">导出</el-button>
-              <!-- <el-button size="mini" type="warning" icon="el-icon-printer">试卷扫描</el-button>  -->
+              <el-button @click="downloadObjectiveResult(curTaskId)" type="warning" size="mini" icon="el-icon-download">
+                导出</el-button>
+              <el-button @click="reTryMark" size="mini" type="success" icon="el-icon-printer">重新识别</el-button>
             </el-form-item>
           </el-form>
           <el-row>
@@ -108,11 +110,17 @@
               </el-tabs>
             </el-col>
           </el-row>
-          <el-table v-loading="loading" :data="studentsList" style="width: 100%; margin-top: 10px" height="60vh">
+          <el-table v-loading="loading" 
+            :data="studentsList" 
+            style="width: 100%; margin-top: 10px"
+            @selection-change="handleSelectionChange" 
+            height="60vh">
+            <el-table-column type="selection" width="45" v-if="activeName==100"></el-table-column>
             <el-table-column align="center" prop="student_no" label="姓名" width="80" />
             <el-table-column align="center" prop="student_no" label="考号" width="150">
               <template slot-scope="scope">
-                  <el-button type="text" @click="showStudentImgs(scope.row)" size="mini">{{scope.row.student_no}}</el-button>
+                <el-button type="text" @click="showStudentImgs(scope.row)" size="mini">{{scope.row.student_no}}
+                </el-button>
               </template>
             </el-table-column>
             <el-table-column align="center" prop="objective_score" label="得分" />
@@ -141,25 +149,22 @@
               </template>
             </el-table-column>
           </el-table>
-          <Page ref="pageButton" :current="recPage" :page_size="recPageSize" :total="recTotal" @pageChange="goRecPage" />
+          <Page ref="pageButton" :current="recPage" :page_size="recPageSize" :total="recTotal"
+            @pageChange="goRecPage" />
         </el-col>
         <el-col :span="8">
           <div style="height:85vh;overflow-y:scroll;position: relative;">
-              <el-button style="position:absolute;top:0px;left:100px;" size="small" type="warning" icon="el-icon-printer">试卷扫描</el-button>
-              <span style="position:absolute;top:0px;right:40px;color:green;">成功上传:{{fileList.length}}</span>
-              <el-upload
-                class="upload-demo"
-                action="http://test.scxjc.club/api/admin/papers/uploadpaper"
-                :on-success="handleUploadSuccess"
-                :file-list="fileList"
-                list-type="picture"
-                :data="{taskid:taskid}"
-                multiple
-                >
-                <el-button size="small" type="primary">点击上传</el-button>
-                <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div>
-              </el-upload>
-              <img v-if="fileList.length<1" src="../../assets/scanner.png" alt="" style="position:absolute;left: 50%;transform: translate(-50%,120px)">
+            <el-button style="position:absolute;top:0px;left:100px;" size="small" type="warning" icon="el-icon-printer">
+              试卷扫描</el-button>
+            <span style="position:absolute;top:0px;right:40px;color:green;">成功上传:{{fileList.length}}</span>
+            <el-upload class="upload-demo" action="http://test.scxjc.club/api/admin/papers/uploadpaper"
+              :on-success="handleUploadSuccess" :file-list="fileList" list-type="picture" :data="{taskid:taskid}"
+              multiple>
+              <el-button size="small" type="primary">点击上传</el-button>
+              <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div>
+            </el-upload>
+            <img v-if="fileList.length<1" src="../../assets/scanner.png" alt=""
+              style="position:absolute;left: 50%;transform: translate(-50%,120px)">
           </div>
         </el-col>
       </el-row>
@@ -167,6 +172,26 @@
         <el-button type="primary" @click="closeUploadDialog">关 闭</el-button>
       </div>
     </el-dialog>
+    <!-- 重新识别 -->
+    <el-dialog title="重新识别" :visible.sync="remarkDialogVisible" width="60%" @close="closeRemarkDialog">
+      <el-form :inline="true">
+        <el-form-item label="考号噪声参数">
+          <el-input-number v-model="form.khVoiceNum" :min="1" :max="5"></el-input-number>
+        </el-form-item>
+        <el-form-item label="考号填涂比例阈值">
+          <el-input-number v-model="form.khFillRate" :min="1" :max="5"></el-input-number>
+        </el-form-item>
+        <el-form-item label="题目噪声参数">
+          <el-input-number v-model="form.tmVoiceNum" :min="1" :max="5"></el-input-number>
+        </el-form-item>
+        <el-form-item label="题目填涂比例阈值">
+          <el-input-number v-model="form.tmFillRate" :min="1" :max="5"></el-input-number>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="doReTryMark">确 定</el-button>
+      </div>
+    </el-dialog>
   </section>
 </template>
 <script>
@@ -181,7 +206,12 @@
         queryParams: {
           page: 1,
         },
-        form: {},
+        form: {
+          khVoiceNum:5,
+          khFillRate:3.0,
+          tmVoiceNum:3,
+          tmFillRate:1.8
+        },
         form1: {},
         form2: {},
         list: [{}, {}],
@@ -191,23 +221,25 @@
         doctorList: [],
         rules: {},
         uploadDialogVisible: false,
-        fileList:[],
-        papersList:[],
-        taskid:null,
-        timer:null,
-        studentsList:[],
-        showAnsVisible:false,
-        curStudentRecImg:"",
-        activeName:"1",
-        curTaskId:null,
-        recPage:1,
-        recPageSize:20,
-        recTotal:0,
-        recParams:{},
-        recSucTotal:0,
-        recErrTotal:0,
-        queryName:"",
-        queryMarkStatus:null
+        remarkDialogVisible:false,
+        fileList: [],
+        papersList: [],
+        taskid: null,
+        timer: null,
+        studentsList: [],
+        showAnsVisible: false,
+        curStudentRecImg: "",
+        activeName: "1",
+        curTaskId: null,
+        recPage: 1,
+        recPageSize: 20,
+        recTotal: 0,
+        recParams: {},
+        recSucTotal: 0,
+        recErrTotal: 0,
+        queryName: "",
+        queryMarkStatus: null,
+        selectException:[]
       };
     },
     methods: {
@@ -245,12 +277,12 @@
         }
         this.recPage = this.$refs.pageButton.page;
         this.recParams = {
-          task_id:this.curTaskId,
-          page:this.recPage,
-          page_size:this.recPageSize,
-          status:this.activeName,
-          name:this.queryName,
-          err_status:this.queryMarkStatus
+          task_id: this.curTaskId,
+          page: this.recPage,
+          page_size: this.recPageSize,
+          status: this.activeName,
+          name: this.queryName,
+          err_status: this.queryMarkStatus
         }
         window.clearInterval(this.timer);
         this.openUploadPaper(this.curTaskId)
@@ -263,7 +295,7 @@
             this.papersList = res.data.data;
             this.loading = false
           });
-        this.$api.getMarkTaskList().then(res=>{
+        this.$api.getMarkTaskList().then(res => {
           this.total = res.data.data.total;
           this.list = res.data.data.list;
         })
@@ -317,13 +349,13 @@
           this.doctorList = [];
         }
       },
-      searchMarkData(){
+      searchMarkData() {
         this.recParams.name = this.queryName;
         this.recParams.errStatus = this.queryMarkStatus;
         window.clearInterval(this.timer);
         this.openUploadPaper(this.curTaskId);
       },
-      reSetMarkData(){
+      reSetMarkData() {
         this.queryName = null;
         this.queryMarkStatus = null;
         this.queryParams.name = null;
@@ -338,22 +370,22 @@
         let that = this;
         this.loading = true;
         this.recParams = {
-          task_id:id,
-          page:this.recPage,
-          page_size:this.recPageSize,
-          status:this.activeName,
-          name:this.queryName,
-          err_status:this.queryMarkStatus
+          task_id: id,
+          page: this.recPage,
+          page_size: this.recPageSize,
+          status: this.activeName,
+          name: this.queryName,
+          err_status: this.queryMarkStatus
         }
-        this.$api.getMarkTaskStudents(this.recParams).then(res=>{
+        this.$api.getMarkTaskStudents(this.recParams).then(res => {
           this.studentsList = res.data.data.list;
-          this.studentsList.forEach(item=>{
+          this.studentsList.forEach(item => {
             let mark_status = item.mark_status;
-            if(mark_status!=1){
-              item.mark_status_name = this.$const.recErrorList.filter((ritem)=>{
+            if (mark_status != 1) {
+              item.mark_status_name = this.$const.recErrorList.filter((ritem) => {
                 return ritem.value == mark_status;
               })[0].label
-            }else{
+            } else {
               item.mark_status_name = "正常"
             }
           })
@@ -363,16 +395,16 @@
           this.loading = false;
         })
         window.clearInterval(this.timer);
-        this.timer = setInterval(function(){
-          that.$api.getMarkTaskStudents(that.recParams).then(res=>{
+        this.timer = setInterval(function () {
+          that.$api.getMarkTaskStudents(that.recParams).then(res => {
             that.studentsList = res.data.data.list;
-            that.studentsList.forEach(item=>{
+            that.studentsList.forEach(item => {
               let mark_status = item.mark_status;
-              if(mark_status!=1){
-                item.mark_status_name = that.$const.recErrorList.filter((ritem)=>{
+              if (mark_status != 1) {
+                item.mark_status_name = that.$const.recErrorList.filter((ritem) => {
                   return ritem.value == mark_status;
                 })[0].label
-              }else{
+              } else {
                 item.mark_status_name = "正常"
               }
             })
@@ -380,67 +412,73 @@
             that.recSucTotal = res.data.data.suc_total;
             that.recErrTotal = res.data.data.err_total;
           })
-        },4000)
+        }, 4000)
       },
-      closeUploadDialog(){
-        this.uploadDialogVisible=false;
+      closeUploadDialog() {
+        this.uploadDialogVisible = false;
         this.fileList = [];
         window.clearInterval(this.timer);
       },
+      closeRemarkDialog(){
+        this.remarkDialogVisible = false;
+      },
       handlePreview(file) {
         console.log(file);
       },
-      handleUploadSuccess(res,file,fileList){
-        if(!res.code){
-          if(fileList.every(item=>item.status=="success")){
-            fileList.map(item=>{
+      handleUploadSuccess(res, file, fileList) {
+        if (!res.code) {
+          if (fileList.every(item => item.status == "success")) {
+            fileList.map(item => {
               item.response && this.fileList.push({
-                "url":res.data.url,"name":res.data.name
+                "url": res.data.url,
+                "name": res.data.name
               })
             })
           }
         }
       },
-      delStudents(id,index){
-        this.$api.delMarkTaskStudents({id:id}).then(res=>{
+      delStudents(id, index) {
+        this.$api.delMarkTaskStudents({
+          id: id
+        }).then(res => {
           this.msgSuccess("删除成功!");
-          this.studentsList.splice(index,1)
+          this.studentsList.splice(index, 1)
         })
       },
-      handleRemove(e){
+      handleRemove(e) {
         console.log(e)
       },
-      showStudentImgs(row){
+      showStudentImgs(row) {
         this.curStudentRecImg = row.imgs;
         this.showAnsVisible = true;
       },
-      showCurRecImg(row){
-        this.curStudentRecImg = row.ans_imgs.replace(".png","_draw_ans.png");
+      showCurRecImg(row) {
+        this.curStudentRecImg = row.ans_imgs.replace(".png", "_draw_ans.png");
         this.showAnsVisible = true;
       },
-      showCurRecKhImg(row){
+      showCurRecKhImg(row) {
         let ext = row.ans_imgs.split("/").pop()
-        if(ext){
-          ext = "."+ext.split(".")[1]
+        if (ext) {
+          ext = "." + ext.split(".")[1]
         }
-        this.curStudentRecImg = row.ans_imgs.replace("_ans"+ext,"_sno"+ext);
+        this.curStudentRecImg = row.ans_imgs.replace("_ans" + ext, "_sno" + ext);
         this.showAnsVisible = true;
       },
-      
-      handleTabClick(tab,event){
+
+      handleTabClick(tab, event) {
         this.activeName = tab.name;
         this.recParams = {
-          task_id:this.curTaskId,
-          page:this.recPage,
-          page_size:this.recPageSize,
-          status:this.activeName,
-          name:this.queryName,
-          err_status:this.queryMarkStatus
+          task_id: this.curTaskId,
+          page: this.recPage,
+          page_size: this.recPageSize,
+          status: this.activeName,
+          name: this.queryName,
+          err_status: this.queryMarkStatus
         }
         window.clearInterval(this.timer);
         this.openUploadPaper(this.curTaskId)
       },
-      downloadObjectiveResult(task_id){
+      downloadObjectiveResult(task_id) {
         this.$api
           .downloadObjectiveResult({
             task_id: task_id
@@ -462,6 +500,55 @@
             document.body.removeChild(elink);
             this.download_loading = false;
           });
+      },
+      handleSelectionChange(val) {
+        this.selectException = [];
+        if(val.length > 0){
+          val.forEach(item=>{
+            let task_img = item.task_id+";;"+item.imgs+";;"+item.id;
+            this.selectException.push(task_img);
+          })
+          window.clearInterval(this.timer);
+        }
+      },
+      reTryMark(){
+        if(this.selectException.length < 1){
+          this.msgError("请选择需要重新识别的答卷!");
+        }else{
+          this.remarkDialogVisible = true;
+        }
+      },
+      doReTryMark(){
+        let urls = []
+        this.selectException.forEach(item=>{
+          item = item + ";;" + String(this.form.khVoiceNum) + ";;" + String(this.form.khFillRate);
+          item = item + ";;" + String(this.form.tmVoiceNum) + ";;" + String(this.form.tmFillRate);
+          urls.push(item);
+        })
+        let that = this;
+        this.$api.reTryMarkPaper({urls:urls}).then(res=>{
+          this.remarkDialogVisible = false;
+          this.getData();
+          window.clearInterval(this.timer);
+          this.timer = setInterval(function () {
+          that.$api.getMarkTaskStudents(that.recParams).then(res => {
+            that.studentsList = res.data.data.list;
+            that.studentsList.forEach(item => {
+              let mark_status = item.mark_status;
+              if (mark_status != 1) {
+                item.mark_status_name = that.$const.recErrorList.filter((ritem) => {
+                  return ritem.value == mark_status;
+                })[0].label
+              } else {
+                item.mark_status_name = "正常"
+              }
+            })
+            that.recTotal = res.data.data.total;
+            that.recSucTotal = res.data.data.suc_total;
+            that.recErrTotal = res.data.data.err_total;
+          })
+        }, 4000)
+        })
       }
     },
     created() {
@@ -471,19 +558,21 @@
   };
 </script>
 <style lang="scss">
-  .el-upload-list--picture .el-upload-list__item{
-    width:150px;
-    float:left;
-    margin-right:10px;
+  .el-upload-list--picture .el-upload-list__item {
+    width: 150px;
+    float: left;
+    margin-right: 10px;
     position: relative;
   }
-  .el-upload-list--picture .el-upload-list__item.is-success .el-upload-list__item-name{
-      position:absolute;
-      z-index:100;
-      height:70px;
-      line-height: 130px;
+
+  .el-upload-list--picture .el-upload-list__item.is-success .el-upload-list__item-name {
+    position: absolute;
+    z-index: 100;
+    height: 70px;
+    line-height: 130px;
   }
-  .el-upload-list--picture .el-upload-list__item-thumbnail{
-    width:125px;  
+
+  .el-upload-list--picture .el-upload-list__item-thumbnail {
+    width: 125px;
   }
 </style>