src/views/exam/singleperformance.vue
@@ -1,73 +1,66 @@
/*
 * @Author: Morpheus
 * @Date: 2021-07-05 16:31:54
 * @Last Modified by: liu
 * @Last Modified time: 2021-11-23 14:18:07
 * menu-name 成绩查看
 */
/* * @Author: Morpheus * @Date: 2021-07-05 16:31:54 * @Last Modified by: liu *
@Last Modified time: 2021-11-23 14:18:07 * menu-name 成绩查看 */
<template>
  <el-row class="morpheus-box-score">
    <el-col :span="24">
      <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"
            ref="questionBankCrud"
            :page.sync="questionBankPage"
            @on-load="questionBankOnLoad"
            @selection-change="questionBankSelectionChange"
            @search-change="questionBankSearchChange"
            @search-reset="questionBankSearchReset"
            @current-change="questionBankCurrentChange"
            @size-change="questionBankSizeChange"
            @row-update="questionBankRowUpdate"
          >
            <template slot-scope="{ row }" slot="learnGrade">
              {{ row.learnGrade == -1 ? "暂未录入" : row.learnGrade }}
            </template>
            <template slot-scope="{ row }" slot="theoryGrade">
              {{ row.learnGrade == -1 ? "" : row.theoryGrade }}
            </template>
            <template slot-scope="{ row }" slot="allGrade">
              {{ row.learnGrade == -1 ? "" : row.allGrade }}
            </template>
            <template slot-scope="{ row }" slot="qualified">
              {{
                row.learnGrade == -1
                  ? ""
                  : row.qualified == 0
                  ? "合格"
                  : row.qualified == 1
                  ? "不合格"
                  : ""
              }}
            </template>
  <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"
      ref="questionBankCrud"
      :page.sync="questionBankPage"
      @on-load="questionBankOnLoad"
      @selection-change="questionBankSelectionChange"
      @search-change="questionBankSearchChange"
      @search-reset="questionBankSearchReset"
      @current-change="questionBankCurrentChange"
      @size-change="questionBankSizeChange"
      @row-update="questionBankRowUpdate"
    >
      <template slot-scope="{ row }" slot="learnGrade">
        {{ row.learnGrade == -1 ? "暂未录入" : row.learnGrade }}
      </template>
      <template slot-scope="{ row }" slot="theoryGrade">
        {{ row.learnGrade == -1 ? "" : row.theoryGrade }}
      </template>
      <template slot-scope="{ row }" slot="allGrade">
        {{ row.learnGrade == -1 ? "" : row.allGrade }}
      </template>
      <template slot-scope="{ row }" slot="qualified">
        {{
          row.learnGrade == -1
            ? ""
            : row.qualified == 0
            ? "合格"
            : row.qualified == 1
            ? "不合格"
            : ""
        }}
      </template>
            <template slot-scope="{ row }" slot="menu">
              <el-button
                type="text"
                size="mini"
                icon="el-icon-collection"
                class="start-kaoshi"
                :disabled="row.qualified == 1"
                v-if="permission.singleperformance_print"
                @click="securityPrint(row)"
                >保安证打印
              </el-button>
            </template>
      <template slot-scope="{ row }" slot="menu">
        <el-button
          type="text"
          size="mini"
          icon="el-icon-collection"
          class="start-kaoshi"
          :disabled="row.qualified == 1"
          v-if="permission.singleperformance_print"
          @click="securityPrint(row)"
          >保安证打印
        </el-button>
      </template>
            <!-- 自定义按钮 -->
            <!-- <template slot="menuLeft">
      <!-- 自定义按钮 -->
      <!-- <template slot="menuLeft">
                            <el-button type="danger"
                                       size="mini"
                                       icon="el-icon-delete"
@@ -87,11 +80,8 @@
                                       @click="handleDelete">导出
                            </el-button>
                        </template> -->
          </avue-crud>
        </div>
      </el-card>
    </el-col>
  </el-row>
    </avue-crud>
  </basic-container>
</template>
<script>
@@ -119,7 +109,7 @@
    return {
      obj: {
        name: "张三",
        name: "张三"
      },
      questionBankOption: {
        // 操作栏多余按钮去除
@@ -172,11 +162,11 @@
              {
                required: true,
                message: "请输入试卷名称",
                trigger: "blur",
              },
                trigger: "blur"
              }
            ],
            // overHidden:true,
            width: 230,
            width: 230
          },
          {
            label: "用户名",
@@ -200,10 +190,10 @@
              {
                required: true,
                message: "请输入保安姓名",
                trigger: "blur",
              },
                trigger: "blur"
              }
            ],
            width: 160,
            width: 160
          },
          {
            label: "所属公司",
@@ -232,10 +222,10 @@
              {
                required: true,
                message: "请输入所属公司",
                trigger: "blur",
              },
                trigger: "blur"
              }
            ],
            width: 250,
            width: 250
          },
          {
            label: "考试开始时间",
@@ -257,7 +247,7 @@
            // 表单编辑时是否可见
            editDisplay: true,
            // 表单编辑时是否为查看模式
            editDetail: false,
            editDetail: false
          },
          {
            label: "考试结束时间",
@@ -279,7 +269,7 @@
            // 表单编辑时是否可见
            editDisplay: true,
            // 表单编辑时是否为查看模式
            editDetail: false,
            editDetail: false
          },
          {
            label: "状态",
@@ -291,12 +281,12 @@
            dicData: [
              {
                label: "发布成绩",
                value: 2,
                value: 2
              },
              {
                label: "考试中",
                value: 3,
              },
                value: 3
              }
            ],
            // 表单新增时是否禁止
            addDisabled: false,
@@ -314,9 +304,9 @@
              {
                required: true,
                message: "请输入考试名称",
                trigger: "blur",
              },
            ],
                trigger: "blur"
              }
            ]
          },
          {
            label: "理论成绩",
@@ -333,7 +323,7 @@
            // 表单编辑时是否可见
            editDisplay: true,
            // 表单编辑时是否为查看模式
            editDetail: false,
            editDetail: false
          },
          {
            label: "实操成绩",
@@ -352,8 +342,8 @@
            // 表单编辑时是否为查看模式
            editDetail: false,
            rules: [
              { validator: validatePass, required: true, trigger: "blur" },
            ],
              { validator: validatePass, required: true, trigger: "blur" }
            ]
          },
          {
            label: "总成绩",
@@ -375,9 +365,9 @@
              {
                required: true,
                message: "请输入考试名称",
                trigger: "blur",
              },
            ],
                trigger: "blur"
              }
            ]
          },
          {
            label: "是否合格",
@@ -389,16 +379,16 @@
            dicData: [
              {
                label: "合格",
                value: 0,
                value: 0
              },
              {
                label: "不合格",
                value: 1,
                value: 1
              },
              {
                label: "暂未录实操成绩",
                value: 2,
              },
                value: 2
              }
            ],
            // 表单新增时是否禁止
            addDisabled: false,
@@ -416,11 +406,11 @@
              {
                required: true,
                message: "请输入考试名称",
                trigger: "blur",
              },
            ],
          },
        ],
                trigger: "blur"
              }
            ]
          }
        ]
      },
      questionBankSearch: {},
      questionBankLoading: true,
@@ -429,10 +419,10 @@
        pageSize: 10,
        currentPage: 1,
        total: 16,
        ...this.$store.state.control.changePageSize,
        ...this.$store.state.control.changePageSize
      },
      questionBankQuery: {},
      questionBankSelectionList: [],
      questionBankSelectionList: []
    };
  },
  computed: {
@@ -446,12 +436,14 @@
        excelBtn: this.vaildData(
          this.permission.singleperformance_export,
          false
        ),
        )
      };
    },
    }
  },
  created() {},
  mounted() {},
  mounted() {
    this.$store.commit("setWindowSizeHeightAdd");
  },
  methods: {
    //保安证证查看
    securityPrint(row) {
@@ -459,7 +451,7 @@
      obj["name"] = "保安证";
      this.$router.push({
        path: `/exam/papers`,
        query: obj,
        query: obj
      });
    },
    questionBankOnLoad(page, params = {}) {
@@ -467,8 +459,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 == "保安公司管理员" ||
@@ -484,11 +476,12 @@
            page.currentPage,
            page.pageSize,
            Object.assign(params, this.query)
          ).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();
          });
        });
@@ -522,25 +515,24 @@
      update({
        theoryGrade: row.theoryGrade,
        learnGrade: row.learnGrade,
        id: row.id,
        id: row.id
      }).then(
        () => {
          this.questionBankOnLoad(this.questionBankPage);
          this.$message({
            type: "success",
            message: "操作成功!",
            message: "操作成功!"
          });
          done();
        },
        (error) => {
        error => {
          window.console.log(error);
          loading();
        }
      );
    },
  },
    }
  }
};
</script>
<style lang="scss" scoped>
</style>
<style lang="scss" scoped></style>