From afbf287f31db7e14f7fc890f2674f281fdbef3bd Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Fri, 13 Aug 2021 08:43:00 +0800
Subject: [PATCH] 报名考试修改

---
 src/views/trainingRegistration/index.vue |  193 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 191 insertions(+), 2 deletions(-)

diff --git a/src/views/trainingRegistration/index.vue b/src/views/trainingRegistration/index.vue
index c0b9909..51fb7b9 100644
--- a/src/views/trainingRegistration/index.vue
+++ b/src/views/trainingRegistration/index.vue
@@ -40,6 +40,14 @@
           
           >考试申请
         </el-button>
+        <el-button
+          type="primary"
+          size="small"
+          plain
+          icon="el-icon-folder-checked"
+          @click="handleImport"
+          >清册导入
+        </el-button>
       </template>
       <template slot-scope="{ type, size, row }" slot="menu">
         <el-button
@@ -50,6 +58,14 @@
           >取消报名</el-button
         >
         <el-button
+          :type="type"
+          size="small"
+          icon="el-icon-receiving"
+          :disabled="row.candidateNo==''"
+          @click="handlePrint(row)"
+          >准考证打印
+        </el-button>
+        <el-button
           icon="el-icon-folder-checked"
           style="display: none"
           @click="affirmApply(row)"
@@ -59,6 +75,42 @@
         >
       </template>
     </avue-crud>
+
+    <el-dialog
+        title="清册数据导入"
+        append-to-body
+        :visible.sync="excelBox"
+        width="555px"
+        >
+        <avue-form
+            :option="excelOption"
+            v-model="excelForm"
+            :upload-after="uploadAfter"
+        >
+            <template slot="excelTemplate">
+            <el-button type="primary" @click="handleTemplate">
+                点击下载<i class="el-icon-download el-icon--right"></i>
+            </el-button>
+            </template>
+        </avue-form>
+    </el-dialog>
+
+
+    <el-dialog
+      title="考试申请"
+      append-to-body
+      :visible.sync="dialogExamFormVisible"
+      width="1000px"
+      @close='closeDialog'
+    >
+      <avue-form
+        ref="formExamApply"
+        v-model="examApply"
+        :option="optionExamApply"
+        @reset-change="emptytChange"
+        @submit="submitExamApply"
+      ></avue-form>
+    </el-dialog>
   </basic-container>
 </template>
 
@@ -69,13 +121,90 @@
   adddata,
   update,
   remove,
-  cancelTrain
+  cancelTrain,
+  addExam
 } from "@/api/trainingRegistration/trainingRegistration";
 
 export default {
   data() {
     return {
       loading: true,
+      excelBox:false,
+      dialogExamFormVisible:false,
+      optionExamApply: {
+        height: "auto",
+        filterBtn: true,
+        calcHeight: 30,
+        dialogWidth: 950,
+        tip: false,
+        searchShow: true,
+        searchMenuSpan: 6,
+        border: false,
+        index: true,
+        stripe: true,
+        viewBtn: true,
+        selection: true,
+        excelBtn: false,
+        menuWidth: 380,
+        dialogClickModal: false,
+        column: [
+          {
+            label: "考试时间",
+            prop: "examTime",
+            type: "daterange",
+            format: "yyyy-MM-dd HH:mm:ss",
+            valueFormat: "yyyy-MM-dd HH:mm:ss",
+            startPlaceholder: "考试开始时间",
+            endPlaceholder: "考试结束时间",
+            // 表单新增时是否禁止
+            addDisabled: false,
+            // 表单新增时是否可见
+            addDisplay: true,
+            // 表单新增时是否为查看模式
+            addDetail: false,
+            // 表单编辑时是否禁止
+            editDisabled: false,
+            // 表单编辑时是否可见
+            editDisplay: true,
+            // 表单编辑时是否为查看模式
+            editDetail: false,
+            rules: [
+              {
+                required: true,
+                message: "请选择考试时间",
+                trigger: "blur",
+              },
+            ],
+            span: 24,
+          },
+        ],
+      },
+      excelForm: {},
+      excelOption: {
+          submitBtn: false,
+          emptyBtn: false,
+          column: [
+          {
+              label: "模板上传",
+              prop: "excelFile",
+              type: "upload",
+              drag: true,
+              loadText: "模板上传中,请稍等",
+              span: 24,
+              propsHttp: {
+              res: "data",
+              },
+              tip: "请上传 .xls,.xlsx 标准格式文件",
+              action: "/api/trainingRegistration/import-trainingRegistration",
+          },
+          {
+              label: "模板下载",
+              prop: "excelTemplate",
+              formslot: true,
+              span: 24,
+          },
+          ],
+      },
       selectionList: [],
       page: {
         pageSize: 10,
@@ -92,7 +221,7 @@
         height: 583,
         index: true,
         labelWidth: "120",
-        menuWidth: 100,
+        menuWidth: 200,
         align: "center",
         selection: true,
         column: column,
@@ -112,6 +241,15 @@
     },
   },
   methods: {
+    //准考证查看
+    handlePrint(row) {
+        var obj = row;
+        obj["name"] = "准考证信息";
+        this.$router.push({
+            path: `/applyexam/papers`,
+            query: obj,
+        });
+    },
     sizeChange(val) {
       this.page1.currentPage = 1;
       this.page1.pageSize = val;
@@ -287,6 +425,57 @@
         this.loading = false;
       });
     },
+    handleImport() {
+      this.excelBox = true;
+    },
+
+    handleTemplate() {
+        window.open(
+            `/api/trainingRegistration/export-template`
+        );
+    },
+    uploadAfter(res, done, loading, column) {
+        window.console.log(column);
+        this.excelBox = false;
+        this.refreshChange();
+        done();
+    },
+
+    //生成考试弹窗
+    handleBatchExam(){
+      this.dialogExamFormVisible = true;
+      if (this.selectionList.length === 0) {
+        this.ids = "";
+      }
+    },
+    //生成考试
+    submitExamApply(row, done, loading){
+      var that = this;
+      var startTime = row.examTime[0];
+      var endTime = row.examTime[1];
+      var examTime = JSON.stringify(row.examTime);
+      console.log(this.ids,111);
+      addExam(this.ids, examTime, startTime, endTime).then(
+        () => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!",
+          });
+          that.$refs.formExamApply.resetFields();
+          that.dialogExamFormVisible = false;
+          done();
+        },
+        (error) => {
+          window.console.log(error);
+          loading();
+        }
+      );
+    },
+    //关闭窗口清除数据
+    closeDialog(){
+      this.$refs.formExamApply.resetFields();
+    },
   },
   mounted() {
     // this.Ourdata = data;

--
Gitblit v1.9.3