From bafbaaa6005063e607f1c240829087ae01880643 Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Wed, 28 Jul 2021 14:47:40 +0800
Subject: [PATCH] 考试审核新增

---
 src/views/trainExam/index.vue  |  287 +++++++++++++++++++++++++++++++
 src/router/views/index.js      |   14 +
 src/api/trainExam/trainExam.js |   62 ++++++
 src/views/trainExam/data.js    |  160 +++++++++++++++++
 4 files changed, 523 insertions(+), 0 deletions(-)

diff --git a/src/api/trainExam/trainExam.js b/src/api/trainExam/trainExam.js
new file mode 100644
index 0000000..d9455ae
--- /dev/null
+++ b/src/api/trainExam/trainExam.js
@@ -0,0 +1,62 @@
+import request from '@/router/axios';
+
+export const getList = (current, size, params) => {
+    return request({
+        url: '/api/trainExam/page',
+        method: 'get',
+        params: {
+            ...params,
+            current,
+            size
+        }
+    })
+}
+
+export const remove = (ids) => {
+    return request({
+        url: '/api/trainExam/remove',
+        method: 'post',
+        params: {
+            ids,
+        }
+    })
+}
+
+export const add = (row) => {
+    return request({
+        url: '/api/trainExam/submit',
+        method: 'post',
+        data: row
+    })
+}
+
+export const update = (row) => {
+    return request({
+        url: '/api/trainExam/update',
+        method: 'post',
+        data: row
+    })
+}
+
+
+export const updateAudit = (row) => {
+    return request({
+        url: '/api/trainExam/update-audit',
+        method: 'post',
+        data: row
+    })
+}
+
+
+
+
+
+export const getDetail = (id) => {
+    return request({
+        url: '/api/trainExam/detail',
+        method: 'get',
+        params: {
+            id,
+        }
+    })
+}
\ No newline at end of file
diff --git a/src/router/views/index.js b/src/router/views/index.js
index aa2510c..62849a4 100644
--- a/src/router/views/index.js
+++ b/src/router/views/index.js
@@ -633,5 +633,19 @@
             component: () =>
                 import ( /* webpackChunkName: "views" */ '@/views/trainingRegistration/index')
         }]
+    },
+    {
+        path: '/trainExam',
+        component: Layout,
+        redirect: '/trainExam/index',
+        children: [{
+            path: 'index',
+            name: '考试申请',
+            meta: {
+                i18n: 'dict'
+            },
+            component: () =>
+                import ( /* webpackChunkName: "views" */ '@/views/trainExam/index')
+        }]
     }
 ]
\ No newline at end of file
diff --git a/src/views/trainExam/data.js b/src/views/trainExam/data.js
new file mode 100644
index 0000000..fa767af
--- /dev/null
+++ b/src/views/trainExam/data.js
@@ -0,0 +1,160 @@
+export var infoColumn = [{
+        label: "申请单位名称",
+
+        prop: "deptId",
+        type: "tree",
+        dicUrl: "/api/blade-system/dept/lazy-tree-type?deptCategory=3&parentId=1418458374477549569",
+        width: 180,
+        hide: true,
+        viewDisplay: false,
+        props: {
+            label: "title",
+            value: "id"
+        },
+        rules: [{
+            required: true,
+            message: "请选择申请单位名称",
+            trigger: "blur"
+        }]
+    }, {
+        label: "申请单位名称",
+        prop: "deptName",
+        type: "select",
+        dicUrl: "/api/blade-system/dept/tree",
+        width: 180,
+        editDisplay: false,
+        addDisplay: false
+    },
+    {
+        label: "考试名称",
+        searchSpan: 5,
+        width: 180,
+        prop: "trainExamName",
+        search: true,
+    },
+
+    {
+        label: "开始时间",
+        prop: "startTime",
+        type: "datetime",
+        format: "yyyy-MM-dd HH:mm:ss",
+        valueFormat: "yyyy-MM-dd HH:mm:ss",
+        width: 180,
+        rules: [{
+            required: true,
+            message: "请选择开始时间",
+            trigger: "blur"
+        }]
+    },
+    {
+        label: "结束时间",
+        prop: "endTime",
+        type: "datetime",
+        width: 180,
+        format: "yyyy-MM-dd HH:mm:ss",
+        valueFormat: "yyyy-MM-dd HH:mm:ss",
+        rules: [{
+            required: true,
+            message: "请选择结束时间",
+            trigger: "click"
+        }]
+    },
+    {
+        label: "申请时间",
+        prop: "createTime",
+        type: "datetime",
+        width: 180,
+        editDisplay: false,
+        addDisplay: false,
+        format: "yyyy-MM-dd HH:mm:ss",
+        valueFormat: "yyyy-MM-dd HH:mm:ss",
+        rules: [{
+            required: true,
+            message: "请选择结束时间",
+            trigger: "click"
+        }]
+    },
+    {
+        label: "审核时间",
+        prop: "auditTime",
+        type: "datetime",
+        width: 180,
+        editDisplay: false,
+        addDisplay: false,
+        format: "yyyy-MM-dd HH:mm:ss",
+        valueFormat: "yyyy-MM-dd HH:mm:ss",
+        rules: [{
+            required: true,
+            message: "请选择结束时间",
+            trigger: "click"
+        }]
+    },
+    {
+        label: "审核状态",
+        search: true,
+        searchSpan: 5,
+        prop: "auditStatus",
+        slot: true,
+        editDisplay: false,
+        addDisplay: false,
+        type: "select",
+        rules: [{
+            required: true,
+            message: "请选择审核类型",
+            trigger: "blur"
+        }],
+        dicData: [{
+                label: "审核通过",
+                value: 1
+            },
+            {
+                label: "不通过",
+                value: 2
+            },
+            {
+                label: "待审核",
+                value: 3
+            }
+        ]
+    },
+    {
+        label: "审核明细",
+        editDisplay: false,
+        addDisplay: false,
+        prop: "auditDetail"
+    }
+]
+
+
+export var auditColumn = [{
+        label: "审核状态",
+        search: true,
+        searchSpan: 5,
+        span: 24,
+        prop: "auditStatus",
+        slot: true,
+        editDisplay: false,
+        addDisplay: false,
+        type: "select",
+        rules: [{
+            required: true,
+            message: "请选择审核类型",
+            trigger: "blur"
+        }],
+        dicData: [{
+                label: "审核通过",
+                value: 1
+            },
+            {
+                label: "不通过",
+                value: 2
+            }
+        ]
+    },
+    {
+        label: "审核明细",
+        span: 24,
+        type: "textarea",
+        prop: "auditDetail"
+    }
+]
\ No newline at end of file
diff --git a/src/views/trainExam/index.vue b/src/views/trainExam/index.vue
new file mode 100644
index 0000000..3f20da8
--- /dev/null
+++ b/src/views/trainExam/index.vue
@@ -0,0 +1,287 @@
+<template>
+  <basic-container class="hasButOne">
+    <avue-crud
+      :option="option"
+      :table-loading="loading"
+      :data="data"
+      :page.sync="page"
+      ref="crud"
+      @row-del="rowDel"
+      v-model="form"
+      :permission="permissionList"
+      @row-update="rowUpdate"
+      @row-save="rowSave"
+      :before-open="beforeOpen"
+      @filter="filterChange"
+      @search-change="searchChange"
+      @search-reset="searchReset"
+      @selection-change="selectionChange"
+      @current-change="currentChange"
+      @size-change="sizeChange"
+      @refresh-change="refreshChange"
+      @on-load="onLoad"
+    >
+      <template slot-scope="{ type,row }" slot="menu">
+        <el-button
+          :type="type"
+          size="small"
+          icon="el-icon-folder-checked"
+          @click="handleAudit(row)"
+          >审核
+        </el-button>
+      </template>
+    </avue-crud>
+
+    <el-dialog title="考试申请审核" 
+      :visible.sync="dialogFormVisible" 
+      modal-append-to-body='false'
+      append-to-body='true'
+      :close-on-click-model="true">
+      <avue-form ref="formAudit" v-model="Audit" :option="optionAudit" @reset-change="emptytChange" @submit="submit"></avue-form>
+    </el-dialog>
+  </basic-container>
+</template>
+
+<script>
+import { infoColumn,auditColumn } from "./data";
+import {
+  getList,
+  remove,
+  update,
+  updateAudit,
+  add,
+  getDetail,
+} from "@/api/trainExam/trainExam";
+import { mapGetters } from "vuex";
+
+export default {
+  data() {
+    return {
+      form: {},
+      Audit:{},
+      query: {},
+      loading: true,
+      deptCategory: "",
+      deptId: "",
+      userId: "",
+      dialogFormVisible: false,
+      page: {
+        pageSize: 10,
+        currentPage: 1,
+        total: 0,
+      },
+      selectionList: [],
+      optionAudit:{
+        height: "auto",
+        calcHeight: 30,
+        dialogWidth: 1000,
+        tip: false,
+        searchShow: true,
+        searchMenuSpan: 6,
+        border: false,
+        index: true,
+        stripe: true,
+        viewBtn: true,
+        addBtn: true,
+        selection: true,
+        excelBtn: false,
+        menuWidth: 230,
+        dialogClickModal: false,
+        column: auditColumn,
+      },
+      option: {
+        height: "auto",
+        calcHeight: 30,
+        dialogWidth: 1000,
+        tip: false,
+        searchShow: true,
+        searchMenuSpan: 6,
+        border: false,
+        index: true,
+        stripe: true,
+        viewBtn: true,
+        addBtn: true,
+        selection: true,
+        excelBtn: false,
+        menuWidth: 230,
+        labelWidth: "120",
+        dialogClickModal: false,
+        column: infoColumn,
+      },
+      data: [],
+    };
+  },
+  computed: {
+    ...mapGetters(["permission"]),
+    permissionList() {
+      return {
+        addBtn: this.vaildData(this.permission.notice_add, false),
+        viewBtn: this.vaildData(this.permission.notice_view, false),
+        delBtn: this.vaildData(null, false),
+        editBtn: this.vaildData(this.permission.notice_edit, false),
+      };
+    },
+    ids() {
+      let ids = [];
+      this.selectionList.forEach((ele) => {
+        ids.push(ele.id);
+      });
+      return ids.join(",");
+    },
+  },
+  mounted() {},
+  methods: {
+    rowSave(row, done, loading) {
+      row.category = 1;
+      row.deptId = this.deptId;
+      add(row).then(
+        () => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!",
+          });
+          done();
+        },
+        (error) => {
+          window.console.log(error);
+          loading();
+        }
+      );
+    },
+    rowUpdate(row, index, done, loading) {
+      update(row).then(
+        () => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!",
+          });
+          done();
+        },
+        (error) => {
+          window.console.log(error);
+          loading();
+        }
+      );
+    },
+    rowDel(row) {
+      this.$confirm("确定将选择数据删除?", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          return remove(row.id);
+        })
+        .then(() => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!",
+          });
+        });
+    },
+    searchReset() {
+      this.query = {};
+      this.onLoad(this.page);
+    },
+    searchChange(params, done) {
+      this.query = params;
+      this.page.currentPage = 1;
+      this.onLoad(this.page, params);
+      done();
+    },
+    selectionChange(list) {
+      this.selectionList = list;
+    },
+    selectionClear() {
+      this.selectionList = [];
+      this.$refs.crud.toggleSelection();
+    },
+    handleDelete() {
+      if (this.selectionList.length === 0) {
+        this.$message.warning("请选择至少一条数据");
+        return;
+      }
+      this.$confirm("确定将选择数据删除?", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          return remove(this.ids);
+        })
+        .then(() => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!",
+          });
+          this.$refs.crud.toggleSelection();
+        });
+    },
+    //审核
+    submit(row,done,loading){
+      updateAudit(row).then(
+        () => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!",
+          });
+          done();
+        },
+        (error) => {
+          window.console.log(error);
+          loading();
+        }
+      );
+    },
+    handleAudit(row){
+        this.dialogFormVisible = true;
+        this.Audit = row;
+    },
+    beforeOpen(done, type) {
+      if (["edit", "view"].includes(type)) {
+        getDetail(this.form.id).then((res) => {
+          this.form = res.data.data;
+        });
+      }
+      done();
+    },
+    currentChange(currentPage) {
+      this.page.currentPage = currentPage;
+    },
+    sizeChange(pageSize) {
+      this.page.pageSize = pageSize;
+    },
+    refreshChange() {
+      this.onLoad(this.page, this.query);
+    },
+    onLoad(page, params = {}) {
+      this.deptId = JSON.parse(
+        window.localStorage.getItem("saber-userInfo")
+      ).content.dept_id;
+
+      this.userId = JSON.parse(
+        window.localStorage.getItem("saber-userInfo")
+      ).content.user_id;
+
+        this.loading = true;
+        getList(page.currentPage, page.pageSize, params).then(
+            (res) => {
+            const data = res.data.data;
+            this.page.total = data.total;
+            this.data = data.records;
+            this.loading = false;
+            this.selectionClear();
+            }
+        );
+    },
+  },
+};
+</script>
+
+<style>
+</style>

--
Gitblit v1.9.3