保安服务企业管理-验收版本
Administrator
2021-09-11 cad34c9b72d1825638d4711a3e2d84105064c116
新增缴费记录
2 files added
446 ■■■■■ changed files
src/api/exam/examPayment.js 52 ●●●●● patch | view | raw | blame | history
src/views/exam/examPayment.vue 394 ●●●●● patch | view | raw | blame | history
src/api/exam/examPayment.js
New file
@@ -0,0 +1,52 @@
import request from '@/router/axios';
export const getExamPaymentList = (current, size, params) => {
    return request({
        url: '/api/examPayment/page',
        method: 'get',
        params: {
            ...params,
            current,
            size
        }
    })
}
export const remove = (ids) => {
    return request({
        url: '/api/examPayment/remove',
        method: 'post',
        params: {
            ids,
        }
    })
}
export const add = (row) => {
    return request({
        url: '/api/examPayment/submit',
        method: 'post',
        data: row
    })
}
export const update = (row) => {
    return request({
        url: '/api/examPayment/submit',
        method: 'post',
        data: row
    })
}
export const getExamPayment = (id) => {
    return request({
        url: '/api/examPayment/detail',
        method: 'get',
        params: {
            id,
        }
    })
}
src/views/exam/examPayment.vue
New file
@@ -0,0 +1,394 @@
/*
 * @Author: Morpheus
 * @Date: 2021-07-05 16:31:54
 * @Last Modified by: Morpheus
 * @Last Modified time: 2021-07-18 19:44:47
 * menu-name 考试缴费管理
 */
<template>
  <el-row class="morpheus-box">
    <el-col :span="24" class="recruitmentManagement">
      <el-card>
        <div class="exam-card-body">
          <avue-crud
            v-model="obj"
            class="company-box"
            :option="questionBankOption"
            :permission="permissionList"
            :search.sync="questionBankSearch"
            :table-loading="questionBankLoading"
            :data="questionBankData"
            ref="questionBankCrud"
            :page.sync="questionBankPage"
            @on-load="questionBankOnLoad"
            @selection-change="questionBankSelectionChange"
            @search-change="questionBankSearchChange"
            @search-reset="questionBankSearchReset"
            @current-change="questionBankCurrentChange"
            @size-change="questionBankSizeChange"
            @row-del="rowDel"
            @row-update="questionBankRowUpdate"
          >
            <template slot-scope="{ row }" slot="sex">
              <el-tag v-if="row.sex == 1">男</el-tag>
              <el-tag v-if="row.sex == 2">女</el-tag>
            </template>
            <!-- 自定义按钮 -->
            <template slot="menuLeft">
              <!-- <el-button type="danger"
                                       size="mini"
                                       icon="el-icon-delete"
                                       plain
                                       @click="handleDelete">新增
                            </el-button> -->
              <!-- <el-button type="danger"
                                       size="mini"
                                       icon="el-icon-delete"
                                       plain
                                       @click="handleDelete">删除
                            </el-button> -->
              <el-button
                type="success"
                size="small"
                plain
                icon="el-icon-upload2"
                v-if="permission.performance_import"
                @click="handleImport"
                >缴费凭证批量上传
              </el-button>
            </template>
            <template slot-scope="{ row }" slot="menu">
              <el-button
                style="display:none"
                type="text"
                size="mini"
                icon="el-icon-collection"
                class="start-kaoshi"
                v-if="permission.performance_print"
                :disabled="row.qualified==1"
                @click="securityPrint(row)"
                >保安证打印
              </el-button>
            </template>
          </avue-crud>
          <el-dialog
              title="缴费凭证批量上传"
              append-to-body
              :visible.sync="excelBox"
              width="555px"
            >
            <avue-form
              :option="excelOption"
              v-model="excelForm"
              :upload-after="uploadAfter"
            >
            </avue-form>
          </el-dialog>
        </div>
      </el-card>
    </el-col>
  </el-row>
</template>
<script>
import { getExamPaymentList, update,remove } from "@/api/exam/examPayment";
import { mapGetters } from "vuex";
import { getRoleDetail } from "@/api/system/role";
export default {
  data() {
    return {
      obj: {
        name: "张三",
      },
      excelBox: false,
      questionBankOption: {
        // 操作栏多余按钮去除
        delBtn: true,
        editBtn: false,
        addBtn: false,
        selection: false,
        viewBtn: true,
        // title: '成绩',
        align: "center",
        height: "auto",
        calcHeight: 80,
        tip: false,
        searchShow: true,
        searchMenuSpan: 4,
        index: true,
        indexLabel: "序号",
        dialogClickModal: false,
        // 操作栏宽度
        menu: true,
        menuWidth: 186,
        labelWidth: 120,
        column: [
              // {
              //     label: "缴费类型",
              //     prop: "type",
              //     dicData:[
              //       {
              //         label:"公司缴费",
              //         value: 1
              //       },
              //       {
              //         label:"个人缴费",
              //         value: 2
              //       }
              //     ],
              //     searchSpan: 4,
              //     search: true,
              //     type: "select",
              // },
              {
                  label: "缴费人",
                  prop: "realName",
                  search:true,
                  searchSpan:4,
              },
              {
                  label: "身份证号",
                  prop: "idCardNo",
                  search:true,
                  searchSpan:4,
              },
              {
                  label: "性别",
                  prop: "sex",
                  slot:true,
                  dicData: [
                    {
                      label:"男",
                      value:1
                    },
                    {
                      label:"女",
                      value:2
                    }
                  ],
              },
              {
                  label: "联系方式",
                  prop: "phone",
              },
              {
                  label: "所在单位",
                  prop: "deptName",
                  search:true,
                  searchSpan:6,
              },
              // {
              //     label: "缴费状态",
              //     prop: "paymentStatus",
              //     searchSpan: 4,
              //     search: true,
              //     dicData: [
              //       {
              //         label:"已缴费",
              //         value:1
              //       },
              //       {
              //         label:"未缴费",
              //         value:2
              //       },
              //       {
              //         label:"部分缴费",
              //         value:3
              //       },
              //     ],
              //     type: "select",
              // },
              {
                  label: "缴费凭证",
                  prop: "certificateUrl",
                  overHidden: true,
                  type: "upload",
                  listType: "picture-img",
              },
              {
                  label: "缴费时间",
                  prop: "paymentTime",
                  type: "date",
                  format: "yyyy-MM-dd",
                  valueFormat: "yyyy-MM-dd",
                  labelWidth: 120,
                  searchSpan: 4,
                  // search: true,
                  overHidden: true,
                  rules: [
                      {
                          required: true,
                          message: "请输入时间",
                          trigger: "click",
                      },
                  ],
              },
          ],
      },
      questionBankSearch: {},
      questionBankLoading: true,
      questionBankData: [],
      questionBankPage: {
        pageSize: 10,
        currentPage: 1,
        total: 16,
      },
      questionBankQuery: {},
      questionBankSelectionList: [],
      excelForm: {},
      excelOption: {
        submitBtn: false,
        emptyBtn: false,
        column: [
          {
            label: "模板上传",
            prop: "excelFile",
            type: "upload",
            drag: true,
            loadText: "模板上传中,请稍等",
            span: 24,
            propsHttp: {
              res: "data",
            },
            tip: "请上传 zip 压缩文件",
            action: "/api/blade-resource/oss/endpoint/put-file-exam-payment-zip",
          }
        ],
      },
    };
  },
  computed:{
    ...mapGetters(["userInfo", "permission"]),
    permissionList() {
      return {
        addBtn: this.vaildData(null, false),
        viewBtn: this.vaildData(this.permission.notice_view, false),
        delBtn: this.vaildData(this.permission.notice_delete, false),
        editBtn: this.vaildData(this.permission.performance__edit, false),
        excelBtn: this.vaildData(this.permission.performance_export, false),
      };
    },
  },
  created() {},
  mounted() {},
  methods: {
    questionBankOnLoad(page, params = {}) {
      //判断角色,如果是保安公司管理员或保安,只能查看当前公司的考试成绩
      var that = this;
      //获取当前登录人员的角色信息
      var roleIds = this.userInfo.role_id.split(",");
      roleIds.forEach((roleId) => {
        getRoleDetail(roleId).then((res) => {
            var roleAlias = res.data.data.roleAlias;
            if (
              roleAlias == "保安公司管理员" ||
              roleAlias == "保安" ||
              roleAlias == "未持证保安"
            ) {
              //如果是保安公司管理员
              params["deptId"] = that.userInfo.dept_id;
            }
            that.questionBankLoading = false;
            params["examType"] = 1;
            getExamPaymentList(
              page.currentPage,
              page.pageSize,
              Object.assign(params, this.query)
            ).then((res) => {
              const data = res.data.data;
              that.questionBankPage.total = data.total;
              that.questionBankData = data.records;
              that.questionBankLoading = false;
              that.questionBankSelectionClear();
            });
        })
      });
    },
     rowDel(row) {
      this.$confirm("确定删除当前缴费数据?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          return remove(row.id);
        })
        .then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
        });
    },
    questionBankSelectionClear() {
      this.questionBankSelectionList = [];
      this.$refs.questionBankCrud.toggleSelection();
    },
    questionBankSelectionChange(list) {
      this.questionBankSelectionList = list;
    },
    questionBankSearchChange(params, done) {
      this.questionBankQuery = params;
      this.questionBankPage.currentPage = 1;
      this.questionBankOnLoad(this.questionBankPage, params);
      done();
    },
    questionBankSearchReset() {
      this.questionBankQuery = {};
      this.questionBankOnLoad(this.questionBankPage);
    },
    questionBankCurrentChange(currentPage) {
      this.questionBankPage.currentPage = currentPage;
    },
    questionBankSizeChange(pageSize) {
      this.questionBankPage.pageSize = pageSize;
    },
    questionBankRowUpdate(row, index, done, loading) {
      // debugger;
      update({
        theoryGrade: row.theoryGrade,
        learnGrade: row.learnGrade,
        examId: row.examId,
        id: row.id,
      }).then(
        () => {
          this.questionBankOnLoad(this.questionBankPage);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
          done();
        },
        (error) => {
          window.console.log(error);
          loading();
        }
      );
    },
    handleImport() {
      this.excelBox = true;
    },
    uploadAfter(res, done, loading, column) {
      window.console.log(column);
      this.excelBox = false;
      this.refreshChange();
      done();
    },
    refreshChange() {
      this.questionBankOnLoad(this.page, this.query);
    },
  },
};
</script>
<style lang="scss" scoped>
</style>