From 49e8a69a09a1b33545b77eb47b3a8f8d1ce0c261 Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Sat, 07 Aug 2021 18:03:10 +0800
Subject: [PATCH] 样式
---
src/views/exam/startexam.vue | 868 ++++++++++++++++++++++++++++-----------------------------
1 files changed, 430 insertions(+), 438 deletions(-)
diff --git a/src/views/exam/startexam.vue b/src/views/exam/startexam.vue
index 37abb00..07cfd3d 100644
--- a/src/views/exam/startexam.vue
+++ b/src/views/exam/startexam.vue
@@ -6,32 +6,31 @@
* menu-name 考试管理
*/
<template>
- <el-row class="morpheus-box-paper">
- <el-col :span="24">
- <el-card>
-
- <div class="exam-card-body">
-
- <avue-crud v-model="form"
- 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-save="questionBankRowSave"
- @row-update="questionBankRowUpdate"
- @row-del="questionBankRowDel">
-
- <!-- 自定义按钮 -->
- <!-- <template slot="menuLeft">
+ <el-row class="morpheus-box-paper">
+ <el-col :span="24">
+ <el-card>
+ <div class="exam-card-body">
+ <avue-crud
+ v-model="form"
+ 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-save="questionBankRowSave"
+ @row-update="questionBankRowUpdate"
+ @row-del="questionBankRowDel"
+ >
+ <!-- 自定义按钮 -->
+ <!-- <template slot="menuLeft">
<el-button type="danger"
size="mini"
icon="el-icon-delete"
@@ -52,437 +51,430 @@
</el-button>
</template> -->
- <template slot="menuLeft">
- <el-button type="danger"
- size="small"
- icon="el-icon-delete"
- @click="questionBankHandleDelete">删 除
- </el-button>
- </template>
+ <template slot="menuLeft">
+ <el-button
+ type="danger"
+ size="small"
+ icon="el-icon-delete"
+ @click="questionBankHandleDelete"
+ >删 除
+ </el-button>
+ </template>
- <template slot-scope="{row}"
- slot="examStatus">
- <el-tag>{{row.examStatus == 0 ? '已发布' : '草稿'}}</el-tag>
- </template>
+ <template slot-scope="{ row }" slot="examStatus">
+ <el-tag>{{ row.examStatus == 0 ? "已发布" : "草稿" }}</el-tag>
+ </template>
- <template slot-scope="{row}"
- slot="menu">
-
- <el-button type="text"
- size="mini"
- icon="el-icon-collection"
- class="start-kaoshi"
-
- @click="startExam(row)">报名清册
- </el-button>
- </template>
-
- </avue-crud>
-
- </div>
-
- </el-card>
- </el-col>
- </el-row>
+ <template slot-scope="{ row }" slot="menu">
+ <el-button
+ type="text"
+ size="mini"
+ icon="el-icon-collection"
+ class="start-kaoshi"
+ @click="startExam(row)"
+ >报名清册
+ </el-button>
+ </template>
+ </avue-crud>
+ </div>
+ </el-card>
+ </el-col>
+ </el-row>
</template>
<script>
-import {
- getList,
- add,
- remove,
- update
-} from "@/api/examapi/examination";
-
+import { getList, add, remove, update } from "@/api/examapi/examination";
export default {
- data () {
+ data() {
+ var validatePass = (rule, value, callback) => {
+ console.log(value);
+ if (value == undefined || value == "") {
+ callback(new Error("请输入分数"));
+ return;
+ } else if (value !== "" && isNaN(value) == true) {
+ callback(new Error("请输入数字"));
+ } else if (value <= 0) {
+ callback(new Error("分数设置请大于0"));
+ } else {
+ callback();
+ }
+ };
- var validatePass = (rule, value, callback) => {
- console.log(value)
- if (value == undefined || value == '') {
- callback(new Error('请输入分数'));
- return;
- } else if (value !== '' && isNaN(value) == true) {
- callback(new Error('请输入数字'));
- } else if (value <= 0) {
- callback(new Error('分数设置请大于0'));
- } else {
- callback();
- }
- };
+ return {
+ form: {},
+ questionBankOption: {
+ // 操作栏多余按钮去除
+ delBtn: true,
+ editBtn: true,
+ addBtn: true,
+ selection: true,
+ menu: true,
+ // 导出按钮
+ excelBtn: false,
+ viewBtn: true,
- return {
- form: {},
- questionBankOption: {
- // 操作栏多余按钮去除
- delBtn: true,
- editBtn: true,
- addBtn: true,
- selection: true,
- menu: true,
- // 导出按钮
- excelBtn: false,
- viewBtn: true,
+ // title: '题库',
- // title: '题库',
+ align: "center",
+ height: "auto",
+ calcHeight: 80,
+ tip: false,
+ searchShow: true,
+ searchMenuSpan: 4,
+ index: true,
+ indexLabel: "序号",
+ //dialogType: 'drawer',
+ dialogClickModal: false,
+ // 操作栏宽度
+ menuWidth: 280,
- align: 'center',
- height: 'auto',
- calcHeight: 80,
- tip: false,
- searchShow: true,
- searchMenuSpan: 4,
- index: true,
- indexLabel: '序号',
- //dialogType: 'drawer',
- dialogClickModal: false,
- // 操作栏宽度
- menuWidth: 280,
+ labelWidth: 140,
- labelWidth: 140,
-
- column: [
- {
- label: "考试名称",
- prop: "examName",
- search: true,
- searchSpan: 5,
- slot: true,
- // 表单新增时是否禁止
- addDisabled: false,
- // 表单新增时是否可见
- addDisplay: true,
- // 表单新增时是否为查看模式
- addDetail: false,
- // 表单编辑时是否禁止
- editDisabled: true,
- // 表单编辑时是否可见
- editDisplay: true,
- // 表单编辑时是否为查看模式
- editDetail: false,
- rules: [{
- required: true,
- message: "请输入试卷名称",
- trigger: "blur"
- }]
- },
- // {
- // label: "试卷分数",
- // prop: "totalScore",
- // slot: true,
- // // 表单新增时是否禁止
- // addDisabled: false,
- // // 表单新增时是否可见
- // addDisplay: true,
- // // 表单新增时是否为查看模式
- // addDetail: false,
- // // 表单编辑时是否禁止
- // editDisabled: false,
- // // 表单编辑时是否可见
- // editDisplay: true,
- // // 表单编辑时是否为查看模式
- // editDetail: false,
-
- // rules: [{ validator: validatePass, required: true, trigger: 'blur' }],
- // width: 100
- // },
- {
- label: "考试时间",
- prop: "examTime",
- type: "daterange",
- // span: 24,
- 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,
- // display: false,
- hide: true,
- rules: [{
- required: true,
- message: "请选择考试时间",
- trigger: "blur"
- }],
- width: 250
- },
- {
- label: "考试开始时间",
- prop: "startTime",
- type: "datetime",
- // span: 24,
- format: 'yyyy-MM-dd HH:mm:ss',
- valueFormat: 'yyyy-MM-dd HH:mm:ss',
- // 表单新增时是否禁止
- addDisabled: false,
- // 表单新增时是否可见
- addDisplay: false,
- // 表单新增时是否为查看模式
- addDetail: false,
- // 表单编辑时是否禁止
- editDisabled: false,
- // 表单编辑时是否可见
- editDisplay: false,
- // 表单编辑时是否为查看模式
- editDetail: false,
- width: 180
- },
- {
- label: "考试结束时间",
- prop: "endTime",
- type: "datetime",
- // span: 24,
- format: 'yyyy-MM-dd HH:mm:ss',
- valueFormat: 'yyyy-MM-dd HH:mm:ss',
- // 表单新增时是否禁止
- addDisabled: false,
- // 表单新增时是否可见
- addDisplay: false,
- // 表单新增时是否为查看模式
- addDetail: false,
- // 表单编辑时是否禁止
- editDisabled: false,
- // 表单编辑时是否可见
- editDisplay: false,
- // 表单编辑时是否为查看模式
- editDetail: false,
- width: 180
- },
- {
- label: "创建人",
- prop: "creator",
- slot: true,
- // 表单新增时是否禁止
- addDisabled: true,
- // 表单新增时是否可见
- addDisplay: false,
- // 表单新增时是否为查看模式
- addDetail: false,
- // 表单编辑时是否禁止
- editDisabled: true,
- // 表单编辑时是否可见
- editDisplay: false,
- // 表单编辑时是否为查看模式
- editDetail: false,
- hide: true,
- display: false,
- },
- {
- label: "备注",
- prop: "remark",
- span: 24,
- slot: true,
- // 表单新增时是否禁止
- addDisabled: false,
- // 表单新增时是否可见
- addDisplay: true,
- // 表单新增时是否为查看模式
- addDetail: false,
- // 表单编辑时是否禁止
- editDisabled: false,
- // 表单编辑时是否可见
- editDisplay: true,
- // 表单编辑时是否为查看模式
- editDetail: false
- },
- {
- label: "注意事项",
- prop: "examAttention",
- type: "textarea",
- span: 24,
- slot: true,
- // 表单新增时是否禁止
- addDisabled: false,
- // 表单新增时是否可见
- addDisplay: true,
- // 表单新增时是否为查看模式
- addDetail: false,
- // 表单编辑时是否禁止
- editDisabled: false,
- // 表单编辑时是否可见
- editDisplay: true,
- // 表单编辑时是否为查看模式
- editDetail: false,
- width: 240
- },
-
- ]
- },
- questionBankSearch: {},
- questionBankLoading: true,
- questionBankData: [
+ column: [
+ {
+ label: "考试名称",
+ prop: "examName",
+ search: true,
+ searchSpan: 4,
+ slot: true,
+ // 表单新增时是否禁止
+ addDisabled: false,
+ // 表单新增时是否可见
+ addDisplay: true,
+ // 表单新增时是否为查看模式
+ addDetail: false,
+ // 表单编辑时是否禁止
+ editDisabled: true,
+ // 表单编辑时是否可见
+ editDisplay: true,
+ // 表单编辑时是否为查看模式
+ editDetail: false,
+ rules: [
+ {
+ required: true,
+ message: "请输入试卷名称",
+ trigger: "blur",
+ },
],
- questionBankPage: {
- pageSize: 10,
- currentPage: 1,
- total: 16
- },
- questionBankQuery: {},
- questionBankSelectionList: [],
+ },
+ // {
+ // label: "试卷分数",
+ // prop: "totalScore",
+ // slot: true,
+ // // 表单新增时是否禁止
+ // addDisabled: false,
+ // // 表单新增时是否可见
+ // addDisplay: true,
+ // // 表单新增时是否为查看模式
+ // addDetail: false,
+ // // 表单编辑时是否禁止
+ // editDisabled: false,
+ // // 表单编辑时是否可见
+ // editDisplay: true,
+ // // 表单编辑时是否为查看模式
+ // editDetail: false,
+
+ // rules: [{ validator: validatePass, required: true, trigger: 'blur' }],
+ // width: 100
+ // },
+ {
+ label: "考试时间",
+ prop: "examTime",
+ type: "daterange",
+ // span: 24,
+ 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,
+ // display: false,
+ hide: true,
+ rules: [
+ {
+ required: true,
+ message: "请选择考试时间",
+ trigger: "blur",
+ },
+ ],
+ width: 250,
+ },
+ {
+ label: "考试开始时间",
+ prop: "startTime",
+ type: "datetime",
+ // span: 24,
+ format: "yyyy-MM-dd HH:mm:ss",
+ valueFormat: "yyyy-MM-dd HH:mm:ss",
+ // 表单新增时是否禁止
+ addDisabled: false,
+ // 表单新增时是否可见
+ addDisplay: false,
+ // 表单新增时是否为查看模式
+ addDetail: false,
+ // 表单编辑时是否禁止
+ editDisabled: false,
+ // 表单编辑时是否可见
+ editDisplay: false,
+ // 表单编辑时是否为查看模式
+ editDetail: false,
+ width: 180,
+ },
+ {
+ label: "考试结束时间",
+ prop: "endTime",
+ type: "datetime",
+ // span: 24,
+ format: "yyyy-MM-dd HH:mm:ss",
+ valueFormat: "yyyy-MM-dd HH:mm:ss",
+ // 表单新增时是否禁止
+ addDisabled: false,
+ // 表单新增时是否可见
+ addDisplay: false,
+ // 表单新增时是否为查看模式
+ addDetail: false,
+ // 表单编辑时是否禁止
+ editDisabled: false,
+ // 表单编辑时是否可见
+ editDisplay: false,
+ // 表单编辑时是否为查看模式
+ editDetail: false,
+ width: 180,
+ },
+ {
+ label: "创建人",
+ prop: "creator",
+ slot: true,
+ // 表单新增时是否禁止
+ addDisabled: true,
+ // 表单新增时是否可见
+ addDisplay: false,
+ // 表单新增时是否为查看模式
+ addDetail: false,
+ // 表单编辑时是否禁止
+ editDisabled: true,
+ // 表单编辑时是否可见
+ editDisplay: false,
+ // 表单编辑时是否为查看模式
+ editDetail: false,
+ hide: true,
+ display: false,
+ },
+ {
+ label: "备注",
+ prop: "remark",
+ span: 24,
+ slot: true,
+ // 表单新增时是否禁止
+ addDisabled: false,
+ // 表单新增时是否可见
+ addDisplay: true,
+ // 表单新增时是否为查看模式
+ addDetail: false,
+ // 表单编辑时是否禁止
+ editDisabled: false,
+ // 表单编辑时是否可见
+ editDisplay: true,
+ // 表单编辑时是否为查看模式
+ editDetail: false,
+ },
+ {
+ label: "注意事项",
+ prop: "examAttention",
+ type: "textarea",
+ span: 24,
+ slot: true,
+ // 表单新增时是否禁止
+ addDisabled: false,
+ // 表单新增时是否可见
+ addDisplay: true,
+ // 表单新增时是否为查看模式
+ addDetail: false,
+ // 表单编辑时是否禁止
+ editDisabled: false,
+ // 表单编辑时是否可见
+ editDisplay: true,
+ // 表单编辑时是否为查看模式
+ editDetail: false,
+ width: 240,
+ },
+ ],
+ },
+ questionBankSearch: {},
+ questionBankLoading: true,
+ questionBankData: [],
+ questionBankPage: {
+ pageSize: 10,
+ currentPage: 1,
+ total: 16,
+ },
+ questionBankQuery: {},
+ questionBankSelectionList: [],
+ };
+ },
+ created() {},
+ mounted() {},
+ computed: {
+ ids() {
+ let ids = [];
+ this.questionBankSelectionList.forEach((ele) => {
+ ids.push(ele.id);
+ });
+ return ids.join(",");
+ },
+ },
+ watch: {},
+ methods: {
+ questionBankOnLoad(page, params = {}) {
+ this.questionBankLoading = false;
+ getList(
+ page.currentPage,
+ page.pageSize,
+ Object.assign(params, this.questionBankQuery)
+ ).then((res) => {
+ const data = res.data.data;
+ this.questionBankPage.total = data.total;
+ this.questionBankData = data.records;
+ this.questionBankLoading = false;
+ this.questionBankSelectionClear();
+ });
+ },
+ 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;
+ },
+
+ startExam(row) {
+ //正式考试
+ if (row.examType == 1) {
+ this.$router.push({
+ path: `/applydetailed`,
+ query: row,
+ });
+ }
+
+ //模拟考试
+ if (row.examType == 2) {
+ this.$router.push({
+ path: `/trainApply`,
+ query: row,
+ });
+ }
+ },
+ // 新增
+ questionBankRowSave(row, done, loading) {
+ row.startTime = row.examTime[0];
+ row.endTime = row.examTime[1];
+ row.examTime = JSON.stringify(row.examTime);
+ add(row).then(
+ () => {
+ this.questionBankOnLoad(this.questionBankPage);
+ this.$message({
+ type: "success",
+ message: "操作成功!",
+ });
+ done();
+ },
+ (error) => {
+ window.console.log(error);
+ loading();
}
+ );
},
- created () {
-
-
+ questionBankRowUpdate(row, index, done, loading) {
+ if (Array.isArray(row.examTime) != true) {
+ row.examTime = row.examTime.split(",");
+ }
+ row.startTime = row.examTime[0];
+ row.endTime = row.examTime[1];
+ row.examTime = JSON.stringify(row.examTime);
+ update(row).then(
+ () => {
+ this.questionBankOnLoad(this.questionBankPage);
+ this.$message({
+ type: "success",
+ message: "操作成功!",
+ });
+ done();
+ },
+ (error) => {
+ window.console.log(error);
+ loading();
+ }
+ );
},
- mounted () {
-
-
+ questionBankRowDel(row) {
+ this.$confirm("确定将选择数据删除?", {
+ confirmButtonText: "确定",
+ cancelButtonText: "取消",
+ type: "warning",
+ })
+ .then(() => {
+ return remove(row.id);
+ })
+ .then(() => {
+ this.questionBankOnLoad(this.questionBankPage);
+ this.$message({
+ type: "success",
+ message: "操作成功!",
+ });
+ });
},
- computed: {
- ids () {
- let ids = [];
- this.questionBankSelectionList.forEach(ele => {
- ids.push(ele.id);
- });
- return ids.join(",");
- },
+ questionBankHandleDelete() {
+ if (this.questionBankSelectionList.length === 0) {
+ this.$message.warning("请选择至少一条数据");
+ return;
+ }
+ this.$confirm("确定将选择数据删除?", {
+ confirmButtonText: "确定",
+ cancelButtonText: "取消",
+ type: "warning",
+ })
+ .then(() => {
+ return remove(this.ids);
+ })
+ .then(() => {
+ this.questionBankOnLoad(this.questionBankPage);
+ this.$message({
+ type: "success",
+ message: "操作成功!",
+ });
+ this.$refs.questionBankCrud.toggleSelection();
+ });
},
- watch: {
-
- },
- methods: {
- questionBankOnLoad (page, params = {}) {
- this.questionBankLoading = false;
- getList(page.currentPage, page.pageSize, Object.assign(params, this.questionBankQuery)).then(res => {
- const data = res.data.data;
- this.questionBankPage.total = data.total;
- this.questionBankData = data.records;
- this.questionBankLoading = false;
- this.questionBankSelectionClear();
- });
- },
- 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;
- },
-
- startExam (row) {
- //正式考试
- if(row.examType==1){
- this.$router.push({
- path: `/applydetailed`,
- query: row
- })
- }
-
- //模拟考试
- if(row.examType==2){
- this.$router.push({
- path: `/trainApply`,
- query: row
- })
- }
- },
- // 新增
- questionBankRowSave (row, done, loading) {
- row.startTime = row.examTime[0]
- row.endTime = row.examTime[1]
- row.examTime = JSON.stringify(row.examTime)
- add(row).then(() => {
- this.questionBankOnLoad(this.questionBankPage);
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- done();
- }, error => {
- window.console.log(error);
- loading();
- });
- },
- questionBankRowUpdate (row, index, done, loading) {
- if (Array.isArray(row.examTime) != true) {
- row.examTime = row.examTime.split(",")
- }
- row.startTime = row.examTime[0]
- row.endTime = row.examTime[1]
- row.examTime = JSON.stringify(row.examTime)
- update(row).then(() => {
- this.questionBankOnLoad(this.questionBankPage);
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- done();
- }, error => {
- window.console.log(error);
- loading();
- });
- },
- questionBankRowDel (row) {
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- })
- .then(() => {
- return remove(row.id);
- })
- .then(() => {
- this.questionBankOnLoad(this.questionBankPage);
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- });
- },
- questionBankHandleDelete () {
- if (this.questionBankSelectionList.length === 0) {
- this.$message.warning("请选择至少一条数据");
- return;
- }
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- })
- .then(() => {
- return remove(this.ids);
- })
- .then(() => {
- this.questionBankOnLoad(this.questionBankPage);
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.$refs.questionBankCrud.toggleSelection();
- });
- },
- }
-}
+ },
+};
</script>
<style lang="scss" scoped>
-
</style>
--
Gitblit v1.9.3