src/views/trainExam/modifiedGrades.vue
@@ -1,91 +1,74 @@
/*
 * @Author: Morpheus
 * @Date: 2021-07-05 16:31:54
 * @Last Modified by: liu
 * @Last Modified time: 2021-11-23 13:55:09
 * menu-name 成绩修改管理
 */
/* * @Author: Morpheus * @Date: 2021-07-05 16:31:54 * @Last Modified by: liu *
@Last Modified time: 2021-11-23 13:55:09 * menu-name 成绩修改管理 */
<template>
  <el-row class="morpheus-box">
    <el-col
      :span="24"
      :class="[
        'recruitmentManagement',
        $store.state.control.windowWidth >= 1024 ? 'oneRowSearch' : '',
      ]"
  <basic-container
    :class="[
      'exam-card-body',
      $store.state.control.screenSize == 1366 ? 'smallSize' : 'normalSize',
      $store.state.control.windowWidth >= 1024 ? 'tooRowSearch1' : ''
    ]"
  >
    <avue-crud
      v-model="obj"
      class="company-box tablesss"
      :option="questionBankOption"
      :search.sync="questionBankSearch"
      :table-loading="questionBankLoading"
      :data="questionBankData"
      :permission="permissionList"
      ref="questionBankCrud"
      :page.sync="questionBankPage"
      @on-load="questionBankOnLoad"
      @selection-change="selectionChange"
      @search-change="questionBankSearchChange"
      @search-reset="questionBankSearchReset"
      @current-change="questionBankCurrentChange"
      @size-change="questionBankSizeChange"
      @row-update="questionBankRowUpdate"
      @refresh-change="refreshChange"
    >
      <el-card>
        <div
          :class="[
            'exam-card-body',
            $store.state.control.windowWidth >= 1024 ? 'oneRowSearch' : '',
          ]"
        >
          <avue-crud
            v-model="obj"
            class="company-box"
            :option="questionBankOption"
            :search.sync="questionBankSearch"
            :table-loading="questionBankLoading"
            :data="questionBankData"
            :permission="permissionList"
            ref="questionBankCrud"
            :page.sync="questionBankPage"
            @on-load="questionBankOnLoad"
            @selection-change="selectionChange"
            @search-change="questionBankSearchChange"
            @search-reset="questionBankSearchReset"
            @current-change="questionBankCurrentChange"
            @size-change="questionBankSizeChange"
            @row-update="questionBankRowUpdate"
            @refresh-change="refreshChange"
          >
            <template slot-scope="{ row }" slot="status">
              <el-tag class="dtype">
                {{
                  row.status == 2
                    ? "审核通过"
                    : row.status == 3
                    ? "审核不通过"
                    : "待审核"
                }}
                <i class="zc" v-if="row.status == 2"></i>
                <i class="yj" v-if="row.status == 3"></i>
                <i class="gz" v-if="row.status == 1"></i>
              </el-tag>
            </template>
            <!-- 自定义按钮 -->
            <template slot="menuLeft">
              <el-button
                type="primary"
                size="small"
                plain
                v-if="checks"
                icon="el-icon-collection-tag"
                @click="handleBatchAudit"
                >批量审批
              </el-button>
              <!--图例 components-->
              <span>
                <Legend :datas="datalistLIU"></Legend>
              </span>
            </template>
      <template slot-scope="{ row }" slot="status">
        <el-tag class="dtype">
          {{
            row.status == 2
              ? "审核通过"
              : row.status == 3
              ? "审核不通过"
              : "待审核"
          }}
          <i class="zc" v-if="row.status == 2"></i>
          <i class="yj" v-if="row.status == 3"></i>
          <i class="gz" v-if="row.status == 1"></i>
        </el-tag>
      </template>
      <!-- 自定义按钮 -->
      <template slot="menuLeft">
        <el-button
          type="primary"
          size="small"
          plain
          v-if="checks"
          icon="el-icon-collection-tag"
          @click="handleBatchAudit"
          >批量审批
        </el-button>
        <!--图例 components-->
        <span>
          <Legend :datas="datalistLIU"></Legend>
        </span>
      </template>
            <template slot-scope="{ type, size, row }" slot="menu">
              <el-button
                :type="type"
                :size="size"
                icon="el-icon-folder-checked"
                v-if="permission.score_audit_check || check"
                @click="handleAudit(row)"
                >审核
              </el-button>
            </template>
          </avue-crud>
        </div>
      </el-card>
    </el-col>
      <template slot-scope="{ type, size, row }" slot="menu">
        <el-button
          :type="type"
          :size="size"
          icon="el-icon-folder-checked"
          v-if="permission.score_audit_check || check"
          @click="handleAudit(row)"
          >审核
        </el-button>
      </template>
    </avue-crud>
    <el-dialog
      title="成绩修改审核"
      :visible.sync="dialogFormVisible"
@@ -108,15 +91,15 @@
      width="900px"
      @close="closeDialog"
    >
    <avue-form
      ref="formBatchAudit"
      v-model="batchAudit"
      :option="optionBatchAudit"
      @reset-change="emptytChange"
      @submit="submitBatchAudit"
    ></avue-form>
      <avue-form
        ref="formBatchAudit"
        v-model="batchAudit"
        :option="optionBatchAudit"
        @reset-change="emptytChange"
        @submit="submitBatchAudit"
      ></avue-form>
    </el-dialog>
  </el-row>
  </basic-container>
</template>
<script>
@@ -124,14 +107,14 @@
  getList,
  update,
  applyAudit,
  batchAudit,
  batchAudit
} from "@/api/examapi/modifiedGrades";
import { mapGetters } from "vuex";
import { getRoleDetail } from "@/api/system/role";
import Legend from "@/components/liu-legend/Legend";
export default {
  components: {
    Legend,
    Legend
  },
  data() {
    return {
@@ -139,22 +122,22 @@
      datalistLIU: [
        {
          color: "#29C093",
          text: "审核通过",
          text: "审核通过"
        },
        {
          color: "#F34A4A",
          text: "审核不通过",
          text: "审核不通过"
        },
        {
          color: "#F48F57",
          text: "待审核",
        },
          text: "待审核"
        }
      ],
      Audit: {},
      dialogFormVisible: false,
      dialogBatchAudit: false,
      batchAudit: {
        number: 0,
        number: 0
      },
      optionBatchAudit: {
        height: "auto",
@@ -180,7 +163,7 @@
            span: 24,
            value: 0,
            disabled: true,
            labelWidth: 110,
            labelWidth: 110
          },
          {
            label: "审核状态",
@@ -196,31 +179,31 @@
              {
                required: true,
                message: "请选择审核类型",
                trigger: "blur",
              },
                trigger: "blur"
              }
            ],
            dicData: [
              {
                label: "待审核",
                value: 1,
                value: 1
              },
              {
                label: "审核通过",
                value: 2,
                value: 2
              },
              {
                label: "审核不通过",
                value: 3,
              },
            ],
                value: 3
              }
            ]
          },
          {
            label: "审核明细",
            span: 24,
            type: "textarea",
            prop: "auditDetail",
          },
        ],
            prop: "auditDetail"
          }
        ]
      },
      choiceList: [],
      optionAudit: {
@@ -256,34 +239,34 @@
              {
                required: true,
                message: "请选择审核类型",
                trigger: "blur",
              },
                trigger: "blur"
              }
            ],
            dicData: [
              {
                label: "待审核",
                value: 1,
                value: 1
              },
              {
                label: "审核通过",
                value: 2,
                value: 2
              },
              {
                label: "审核不通过",
                value: 3,
              },
            ],
                value: 3
              }
            ]
          },
          {
            label: "审核明细",
            span: 24,
            type: "textarea",
            prop: "auditDetail",
          },
        ],
            prop: "auditDetail"
          }
        ]
      },
      obj: {
        name: "张三",
        name: "张三"
      },
      questionBankOption: {
        // 操作栏多余按钮去除
@@ -317,7 +300,7 @@
            prop: "examTime",
            search: true,
            searchSpan: 4,
            type:"date",
            type: "date",
            format: "yyyy-MM-dd",
            valueFormat: "yyyy-MM-dd",
            viewDisplay: true,
@@ -338,11 +321,11 @@
              {
                required: true,
                message: "请输入试卷名称",
                trigger: "blur",
              },
                trigger: "blur"
              }
            ],
            width: 90,
            overHidden:true,
            overHidden: true
          },
          {
            label: "姓名",
@@ -368,10 +351,10 @@
              {
                required: true,
                message: "请输入试卷名称",
                trigger: "blur",
              },
                trigger: "blur"
              }
            ],
            width: 80,
            width: 80
            // overHidden:true,
          },
@@ -402,11 +385,11 @@
              {
                required: true,
                message: "请输入所属公司",
                trigger: "blur",
              },
                trigger: "blur"
              }
            ],
            width: 200,
            overHidden:true
            overHidden: true
          },
          {
@@ -431,10 +414,10 @@
              {
                required: true,
                message: "请输入保安姓名",
                trigger: "blur",
              },
                trigger: "blur"
              }
            ],
            width: 140,
            width: 140
          },
          {
@@ -453,13 +436,12 @@
            editDisplay: true,
            // 表单编辑时是否为查看模式
            editDetail: false,
            width: 88,
            width: 88
          },
          {
            label: "修改后理论成绩",
            width:110,
            width: 110,
            prop: "newScore",
            slot: true,
            // 表单新增时是否禁止
@@ -478,28 +460,28 @@
              {
                required: true,
                message: "请输入修改后理论成绩",
                trigger: "blur",
              },
            ],
                trigger: "blur"
              }
            ]
          },
          {
            label: "笔试答题图片",
            prop: "url",
            labelWidth:110,
            type: 'upload',
            dataType: 'string',
            width:98,
            labelWidth: 110,
            type: "upload",
            dataType: "string",
            width: 98,
            span: 24,
            limit:5,
            listType: 'picture-card',
            disabled:true,
            tip: '只能上传jpg/png文件,最多上传5张',
            limit: 5,
            listType: "picture-card",
            disabled: true,
            tip: "只能上传jpg/png文件,最多上传5张",
            propsHttp: {
              res: 'data',
              res: "data",
              url: "url"
            },
            action: "/api/blade-resource/oss/endpoint/put-files",
            action: "/api/blade-resource/oss/endpoint/put-files"
          },
          {
@@ -520,9 +502,9 @@
            // 表单编辑时是否可见
            editDisplay: true,
            // 表单编辑时是否为查看模式
            width:200,
            width: 200,
            editDetail: false,
            overHidden: true,
            overHidden: true
          },
          {
            label: "申请理由",
@@ -540,8 +522,8 @@
            editDisplay: true,
            // 表单编辑时是否为查看模式
            editDetail: false,
            minWidth:70,
            overHidden:true
            minWidth: 70,
            overHidden: true
          },
          {
@@ -565,7 +547,7 @@
            // 表单编辑时是否为查看模式
            editDetail: false,
            viewDisplay: false,
            width: 130,
            width: 130
          },
          {
@@ -589,7 +571,7 @@
            // 表单编辑时是否为查看模式
            editDetail: false,
            viewDisplay: false,
            width: 130,
            width: 130
          },
          {
@@ -602,16 +584,16 @@
            dicData: [
              {
                label: "待审核",
                value: 1,
                value: 1
              },
              {
                label: "审核通过",
                value: 2,
                value: 2
              },
              {
                label: "审核不通过",
                value: 3,
              },
                value: 3
              }
            ],
            // 表单新增时是否禁止
            addDisabled: false,
@@ -625,7 +607,7 @@
            editDisplay: true,
            // 表单编辑时是否为查看模式
            editDetail: false,
            width: 110,
            width: 110
          },
          {
@@ -644,9 +626,9 @@
            editDisplay: true,
            // 表单编辑时是否为查看模式
            editDetail: false,
            width: 68,
          },
        ],
            width: 68
          }
        ]
      },
      questionBankSearch: {},
      questionBankLoading: true,
@@ -655,10 +637,10 @@
        pageSize: 10,
        currentPage: 1,
        total: 16,
        ...this.$store.state.control.changePageSize,
        ...this.$store.state.control.changePageSize
      },
      questionBankQuery: {},
      questionBankSelectionList: [],
      questionBankSelectionList: []
    };
  },
  created() {
@@ -674,11 +656,11 @@
    //判断是否为超级管理员
    if (this.userInfo.role_name == "administrator") {
      this.checks = true;
      this.questionBankOption.tip = true
      this.questionBankOption.tip = true;
    }
  },
  mounted() {
    this.$store.commit("setWindowSizeHeightAdd");
  },
  computed: {
    ...mapGetters(["userInfo", "permission"]),
@@ -687,9 +669,9 @@
        addBtn: this.vaildData(null, false),
        viewBtn: this.vaildData(this.permission.score_audit_view, false),
        delBtn: this.vaildData(null, false),
        editBtn: this.vaildData(this.permission.score_audit_edit, false),
        editBtn: this.vaildData(this.permission.score_audit_edit, false)
      };
    },
    }
  },
  methods: {
    getNewTime() {
@@ -749,7 +731,7 @@
        id: row.id,
        status: row.status,
        auditDetail: row.auditDetail,
        auditUser: this.userInfo.Id,
        auditUser: this.userInfo.Id
      };
      applyAudit(data).then(
@@ -758,11 +740,11 @@
          this.questionBankOnLoad(this.questionBankPage);
          this.$message({
            type: "success",
            message: "操作成功!",
            message: "操作成功!"
          });
          done();
        },
        (error) => {
        error => {
          window.console.log(error);
          loading();
        }
@@ -773,7 +755,7 @@
      if (this.choiceList.length == 0) {
        this.$message({
          message: "未选择考试的人员",
          type: "warning",
          type: "warning"
        });
        return;
      }
@@ -785,7 +767,7 @@
      this.choiceList = [];
      for (let k in list) {
        this.choiceList.push({
          id: list[k].id,
          id: list[k].id
        });
      }
    },
@@ -794,8 +776,8 @@
      var that = this;
      //获取当前登录人员的角色信息
      var roleIds = this.userInfo.role_id.split(",");
      roleIds.forEach((roleId) => {
        getRoleDetail(roleId).then((res) => {
      roleIds.forEach(roleId => {
        getRoleDetail(roleId).then(res => {
          var roleAlias = res.data.data.roleAlias;
          if (roleAlias == "保安公司管理员" || roleAlias == "保安") {
            //如果是保安公司管理员
@@ -814,11 +796,12 @@
            page.currentPage,
            page.pageSize,
            Object.assign(params, this.questionBankQuery)
          ).then((res) => {
          ).then(res => {
            const data = res.data.data;
            that.questionBankPage.total = data.total;
            that.questionBankData = data.records;
            that.questionBankLoading = false;
            this.$store.commit("setWindowSizeHeightAdd");
            that.questionBankSelectionClear();
          });
        });
@@ -852,17 +835,17 @@
    questionBankRowUpdate(row, index, done, loading) {
      update({
        id: row.id,
        newScore: row.newScore,
        newScore: row.newScore
      }).then(
        () => {
          this.questionBankOnLoad(this.questionBankPage);
          this.$message({
            type: "success",
            message: "操作成功!",
            message: "操作成功!"
          });
          done();
        },
        (error) => {
        error => {
          window.console.log(error);
          loading();
        }
@@ -883,7 +866,7 @@
        ids: str,
        status: row.status,
        auditDetail: row.auditDetail,
        auditUser: this.userInfo.Id,
        auditUser: this.userInfo.Id
      };
      //提交申请
      batchAudit(data).then(
@@ -893,13 +876,13 @@
          that.dialogBatchAudit = false;
          this.$message({
            type: "success",
            message: "操作成功",
            message: "操作成功"
          });
          //清除选项
          that.$refs.questionBankCrud.toggleSelection();
          done();
        },
        (error) => {
        error => {
          window.console.log(error);
          loading();
        }
@@ -907,8 +890,8 @@
    },
    refreshChange() {
      this.questionBankOnLoad(this.questionBankPage, this.questionBankQuery);
    },
  },
    }
  }
};
</script>