From 326cdff899f5d6451bb1981eeda629a88bfe9e75 Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Mon, 17 Jan 2022 17:42:01 +0800
Subject: [PATCH] 报名列表修改,考试成绩修改,成绩申请修改修改

---
 src/views/trainExam/performance.vue |  413 +++++++++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 348 insertions(+), 65 deletions(-)

diff --git a/src/views/trainExam/performance.vue b/src/views/trainExam/performance.vue
index 2adcbd4..587fb02 100644
--- a/src/views/trainExam/performance.vue
+++ b/src/views/trainExam/performance.vue
@@ -103,7 +103,7 @@
 
             <template slot-scope="{ type, size, row }" slot="menu">
               <el-button
-                style="display:none"
+                style="display: none"
                 icon="el-icon-s-flag"
                 @click="absent(row)"
                 :size="size"
@@ -127,7 +127,7 @@
               >
               <el-button
                 icon="el-icon-edit"
-                v-if="row.isPaper==6"
+                v-if="row.isPaper == 6"
                 @click="securityPaperApply(row)"
                 :size="size"
                 :type="type"
@@ -170,7 +170,7 @@
       :before-close="dialogBeforeClose"
     >
       <div>
-        <el-form
+        <!-- <el-form
           ref="gradeForm"
           :model="gradeForm"
           :rules="rules"
@@ -236,6 +236,57 @@
             </el-col>
           </el-row>
 
+          <el-form-item
+            prop="businessLicense"
+            label="笔试答题图片"
+            label-width="108px"
+          >
+            <el-upload
+              list-type="picture-card"
+              action=""
+              :show-file-list="true"
+              :file-list="gradeForm.fileList"
+              :limit="limit"
+              :auto-upload="true"
+              :http-request="httpRequest"
+            >
+              <i class="el-icon-plus"></i>
+              <div slot="file" slot-scope="{ file }">
+                <img
+                  class="el-upload-list__item-thumbnail"
+                  :src="file.url"
+                  alt=""
+                />
+                <span class="el-upload-list__item-actions">
+                  <span
+                    class="el-upload-list__item-preview"
+                    @click="handlePictureCardPreview(file)"
+                  >
+                    <i class="el-icon-zoom-in"></i>
+                  </span>
+                  <span
+                    v-if="!disabled"
+                    class="el-upload-list__item-delete"
+                    @click="handleRemove(file)"
+                  >
+                    <i class="el-icon-delete"></i>
+                  </span>
+                </span>
+              </div>
+              <div class="el-upload__tip" slot="tip">
+                请上传笔试答题图片,只能上传jpg/png文件,最多上传5张图片
+              </div>
+            </el-upload>
+            <el-dialog :visible.sync="dialogVisible" 
+              :modal="true"
+              :modal-append-to-body="true"
+              :append-to-body="true"
+              :close-on-click-modal="false"
+              :close-on-press-escape="false">
+              <img width="100%" :src="dialogImageUrl" alt="">
+            </el-dialog>
+          </el-form-item>
+
           <el-form-item label="修改理由" label-width="108px">
             <el-input
               type="textarea"
@@ -252,7 +303,14 @@
             >
             <el-button @click="gradeBoxVisible = false">取 消</el-button>
           </el-form-item>
-        </el-form>
+        </el-form> -->
+        <avue-form 
+        ref="form"
+        :option="option" 
+        v-model="form" 
+        @reset-change="emptytChange"
+        @submit="submit"> 
+        </avue-form>
       </div>
     </el-dialog>
 
@@ -283,9 +341,13 @@
 } from "@/api/examapi/performance";
 import { mapGetters } from "vuex";
 import { getRoleDetail } from "@/api/system/role";
-import { securityApply,add} from "@/api/accreditationRecords/accreditationRecords";
+import {
+  securityApply,
+  add,
+} from "@/api/accreditationRecords/accreditationRecords";
 import Qs from "qs";
 import { getToken } from "@/util/auth";
+import { putFile,removeFile } from "@/api/resource/oss";
 export default {
   components: {
     baoanz,
@@ -321,6 +383,157 @@
     };
 
     return {
+      option: {
+        height: "auto",
+        calcHeight: 30,
+        dialogWidth: 1000,
+        tip: false,
+        searchShow: true,
+        searchMenuSpan: 6,
+        border: true,
+        index: true,
+        stripe: true,
+        viewBtn: false,
+        addBtn: false,
+        editBtn: false,
+        selection: true,
+        excelBtn: false,
+        menuWidth: 230,
+        dialogClickModal: false,
+        column: [
+          {
+            label: "考试名称",
+            prop: "examName",
+            labelWidth:110,
+            disabled: true,
+            rules: [
+              {
+                required: true,
+                message: "请输入考试名称",
+                trigger: "blur",
+              },
+            ],
+          },
+          {
+            label: "姓名",
+            prop: "securityName",
+            labelWidth:110,
+            disabled: true,
+            rules: [
+              {
+                required: true,
+                message: "请输入姓名",
+                trigger: "blur",
+              },
+            ],
+          },
+          {
+            label: "身份证号",
+            prop: "account",
+            labelWidth:110,
+            disabled: true,
+            rules: [
+              {
+                required: true,
+                message: "请输入身份证号",
+                trigger: "blur",
+              },
+            ],
+          },
+          {
+            label: "准考证号",
+            prop: "candidateNo",
+            labelWidth:110,
+            disabled: true,
+            rules: [
+              {
+                required: false,
+                message: "请输入准考证号",
+                trigger: "blur",
+              },
+            ],
+          },
+          {
+            label: "原理论成绩",
+            prop: "theoryGrade",
+            labelWidth:110,
+            disabled: true,
+            rules: [
+              {
+                required: false,
+                message: "请输入原理论成绩",
+                trigger: "blur",
+              },
+            ],
+          },
+          {
+            label: "修改考试成绩",
+            prop: "editGrades",
+            labelWidth:110,
+            rules: [
+              {
+                required: true,
+                message: "请输入修改考试成绩",
+                trigger: "blur",
+              },
+            ],
+          },
+          {
+            label: "实操成绩",
+            prop: "learnGrade",
+            labelWidth:110,
+            disabled: true,
+            rules: [
+              {
+                required: false,
+                message: "请输入实操成绩",
+                trigger: "blur",
+              },
+            ],
+          },
+          {
+            label: "总成绩",
+            prop: "allGrade",
+            labelWidth:110,
+            disabled: true,
+            rules: [
+              {
+                required: false,
+                message: "请输入总成绩",
+                trigger: "blur",
+              },
+            ],
+          },
+          {
+            label: "笔试答题图片",
+            prop: "url",
+            labelWidth:110,
+            type: 'upload',
+            dataType: 'string',
+            span: 24,
+            limit:5,
+            listType: 'picture-card',
+            tip: '只能上传jpg/png文件,最多上传5张',
+            propsHttp: {
+              res: 'data',
+              url: "url"
+            },
+            action: "/api/blade-resource/oss/endpoint/put-files",
+          },
+          {
+            label: "修改理由",
+            labelWidth:110,
+            span: 24,
+            type: "textarea",
+            prop: "editReason",
+          },
+        ],
+      },
+      form: {},
+      limit:5,
+      dialogImageUrl: '',
+      dialogVisible: false,
+      disabled: false,
       rules: {
         editGrades: [
           { validator: validatePass2, required: true, trigger: "blur" },
@@ -337,6 +550,7 @@
         allGrade: "",
         editGrades: "",
         editReason: "",
+        fileList:[],
       },
       gradeBoxVisible: false,
       dialogVisiblezhengjian: false,
@@ -357,7 +571,7 @@
         selection: true,
         reserveSelection: true,
         selectable: (row) => {
-          if (row.qualified != "0" || row.isPaper==6) {
+          if (row.qualified != "0" || row.isPaper == 6) {
             return false;
           } else {
             return true;
@@ -407,11 +621,12 @@
             viewDisplay: false,
           },
           {
-            label: "考试名称",
-            prop: "examName",
-            search: true,
-            searchSpan: 5,
-            slot: true,
+            label: "考试时间",
+            prop: "startTime",
+            type: "datetime",
+            format: "yyyy-MM-dd",
+            valueFormat: "yyyy-MM-dd",
+            width: 90,
             viewDisplay: true,
             // 表单新增时是否禁止
             addDisabled: false,
@@ -433,14 +648,13 @@
                 trigger: "blur",
               },
             ],
-            width: 200,
-            overHidden:true,
+            overHidden: true,
           },
           {
             label: "姓名",
             prop: "securityName",
             search: true,
-            searchSpan: 3,
+            searchSpan: 4,
             slot: true,
             viewDisplay: true,
             // 表单新增时是否禁止
@@ -498,7 +712,7 @@
             prop: "candidateNo",
             search: true,
             searchSpan: 4,
-            hide:true,
+            hide: true,
             slot: true,
             // 表单新增时是否禁止
             addDisabled: false,
@@ -526,11 +740,17 @@
             prop: "avatar",
             type: "upload",
             listType: "picture-img",
-            width:60,
+            width: 60,
+            editDisabled: false,
+            // 表单编辑时是否可见
+            editDisplay: false,
+            // 表单编辑时是否为查看模式
+            editDetail: false,
           },
           {
             label: "所属公司",
             prop: "companyName",
+            sortable: true,
             search: true,
             searchSpan: 4,
             // dicUrl: '/api/blade-system/dept/tree',
@@ -611,7 +831,7 @@
             type: "select",
             slot: true,
             search: true,
-            searchSpan: 3,
+            searchSpan: 4,
             width: 80,
             dicData: [
               {
@@ -664,7 +884,7 @@
             editDisplay: true,
             // 表单编辑时是否为查看模式
             editDetail: false,
-            width: 68,
+            width: 95,
           },
           {
             label: "实操成绩",
@@ -683,7 +903,7 @@
             editDisplay: true,
             // 表单编辑时是否为查看模式
             editDetail: false,
-            width: 68,
+            width: 95,
             rules: [
               { validator: validatePass, required: true, trigger: "blur" },
             ],
@@ -705,8 +925,7 @@
             editDisplay: true,
             // 表单编辑时是否为查看模式
             editDetail: false,
-            
-            width: 58,
+            width: 80,
           },
           {
             label: "是否合格",
@@ -716,7 +935,7 @@
             hide: true,
             search: true,
             searchSpan: 3,
-            width: 68,
+            width: 90,
             dicData: [
               {
                 label: "合格",
@@ -754,9 +973,9 @@
             label: "是否合格",
             prop: "qualifieds",
             type: "select",
-            // search: true,
+            sortable: true,
             searchSpan: 3,
-            width: 68,
+            width: 100,
             dicData: [
               {
                 label: "合格",
@@ -846,8 +1065,8 @@
       questionBankSearch: {},
       questionBankLoading: true,
       questionBankData: [],
-      sort:"",
-      sortName:"",
+      sort: "",
+      sortName: "",
       questionBankPage: {
         pageSize: 10,
         currentPage: 1,
@@ -935,6 +1154,67 @@
     },
   },
   methods: {
+    //提交考试成绩修改申请
+    submit(row, done, loading) {
+      var that = this;
+      row['createUser'] = this.userInfo.Id;
+      console.log(row,1234660);
+      updateGrade(row).then(
+        () => {
+          that.$refs.form.resetFields();
+          that.$message({
+            type: "success",
+            message: "操作成功!",
+          });
+          that.gradeBoxVisible = false;
+          
+          done();
+        },
+        (error) => {
+          window.console.log(error);
+          done();
+        }
+      );
+    },
+    //自定义上传
+    httpRequest(opt) {
+      var that = this;
+      const file = opt.file;
+      // 根据后台需求数据格式
+      const form = new FormData();
+      // 文件对象
+      form.append("file", file);
+      putFile(form).then((res) => {
+        that.gradeForm.fileList.push({
+          name:res.data.data.name,
+          url:res.data.data.url
+        })
+        console.log(that.gradeForm.fileList,365441);
+      });
+      console.log(that.gradeForm.fileList,11122222);
+    },
+    //图片展示
+    handlePictureCardPreview(file) {
+      this.dialogImageUrl = file.url;
+      this.dialogVisible = true;
+    },
+    //图片删除
+    handleRemove(file) {
+      var index = [];
+      //遍历图片集合,获取下标
+      this.gradeForm.fileList.forEach(function (img,i){
+        if(img.name==file.name){
+          index.push(i);
+          //存储对象中删除
+          removeFile(img.name);
+        }
+      })
+      // console.log(index,222333);
+      //删除
+      for (var i = 0; i < index.length; i++) {
+        this.gradeForm.fileList.splice(index[i]-i,1);
+      }
+    },
     selectionChange(list) {
       // this.selectionList = list;
       this.choiceList = [];
@@ -992,27 +1272,38 @@
       };
       this.dialogVisiblezhengjian = true;
     },
+    //关闭dialog
+    dialogBeforeClose(done){
+      this.gradeForm.fileList = [];
+      done();
+    },
     closezhengjian() {
       this.dialogVisiblezhengjian = false;
     },
     //排序
     sortChange(value) {
-      if(value.order=="ascending"){
+      if (value.order == "ascending") {
         this.sort = "asc";
       }
-      if(value.order=="descending"){
+      if (value.order == "descending") {
         this.sort = "desc";
       }
       this.sortName = value.prop;
       //字段匹配
-      if(value.prop=="theoryGrade"){
+      if (value.prop == "theoryGrade") {
         this.sortName = "theory_grade";
       }
-      if(value.prop=="learnGrade"){
+      if (value.prop == "learnGrade") {
         this.sortName = "learn_grade";
       }
-      if(value.prop=="allGrade"){
+      if (value.prop == "allGrade") {
         this.sortName = "all_grade";
+      }
+      if (value.prop == "qualifieds") {
+        this.sortName = "qualified";
+      }
+      if (value.prop == "companyName") {
+        this.sortName = "companyName";
       }
       this.questionBankOnLoad(this.questionBankPage);
     },
@@ -1034,10 +1325,10 @@
           }
           that.questionBankLoading = false;
           params["examType"] = 2;
-          if(this.sort){
+          if (this.sort) {
             params["sort"] = this.sort;
           }
-          if(this.sortName){
+          if (this.sortName) {
             params["sortName"] = this.sortName;
           }
           getList(
@@ -1074,17 +1365,17 @@
       });
     },
     //补证申请
-    securityPaperApply(row,done,loading){
+    securityPaperApply(row, done, loading) {
       this.$confirm("当前保安员已制证,确定要继续申请制证?", {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
         type: "warning",
       }).then(() => {
         const data = {
-          createUser:this.userInfo.user_id,
-          type:2,
-          userId:row.userId
-        }
+          createUser: this.userInfo.user_id,
+          type: 2,
+          userId: row.userId,
+        };
         add(data).then(
           () => {
             this.questionBankOnLoad(this.questionBankPage);
@@ -1128,28 +1419,18 @@
 
     // 修改考试成绩
     modifiedGrades(row) {
-      var {
-        id,
-        examName,
-        securityName,
-        account,
-        candidateNo,
-        theoryGrade,
-        learnGrade,
-        allGrade,
-      } = row;
-
-      this.gradeForm.examName = examName;
-      this.gradeForm.securityName = securityName;
-      this.gradeForm.account = account;
-      this.gradeForm.candidateNo = candidateNo;
-      this.gradeForm.theoryGrade = theoryGrade;
-      this.gradeForm.learnGrade = learnGrade;
-      this.gradeForm.allGrade = allGrade;
-      this.gradeForm.editGrades = "";
-      this.gradeForm.editReason = "";
-      this.gradeForm.id = id;
-
+      console.log(row,97998);
+      this.form = {
+        id:null,
+        examScoreId:row.id,
+        examName:row.examName,
+        candidateNo:row.candidateNo,
+        account:row.account,
+        securityName:row.securityName,
+        theoryGrade:row.theoryGrade,
+        learnGrade:row.learnGrade,
+        allGrade:row.allGrade,
+      }
       this.gradeBoxVisible = true;
     },
 
@@ -1237,10 +1518,11 @@
       );
     },
     handleTemplate() {
-      window.open(`/api/examScore/export-template?${
-            this.website.tokenHeader
-          }=${getToken()}&`
-        );
+      window.open(
+        `/api/examScore/export-template?${
+          this.website.tokenHeader
+        }=${getToken()}&`
+      );
     },
     handleImport() {
       this.excelBox = true;
@@ -1294,7 +1576,8 @@
         // console.log(data,11225111);
         //序列号url形式,用&拼接
         data = Qs.stringify(data);
-        window.open(`/api/examScore/export-examScore?${
+        window.open(
+          `/api/examScore/export-examScore?${
             this.website.tokenHeader
           }=${getToken()}&` + data
         );

--
Gitblit v1.9.3