huangtao 4 år sedan
förälder
incheckning
8d8ef177aa

+ 4 - 4
src/router/menu.js

@@ -43,10 +43,10 @@ export default [
         path: '/examManagement/list',
         meta: { title: '考试列表' },
       },
-      {
-        path: '/examManagement/detail',
-        meta: { title: '考试详情' },
-      },
+      // {
+      //   path: '/examManagement/detail',
+      //   meta: { title: '考试详情' },
+      // },
       {
         meta: { title: '新建考试' },
         path: '/examManagement/create',

+ 223 - 11
src/views/examManagement/examManagementDetail.vue

@@ -1,15 +1,19 @@
 <template>
-  <div class="app-container">
+  <div class="app-container" ref="tableBody">
     <div class="common-card">
-      <div>这里是考试详情</div>
-    </div>
-    <div class="common-card a-card-margin-top">
-      <div>这里是内容</div>
+      <!-- 考试详情 -->
+      <div class="exam-detail-info">
+        <div class=""></div>
+      </div>
+      <!-- 考试题目列表 -->
+      <div></div>
     </div>
   </div>
 </template>
 
 <script>
+import { mapGetters } from 'vuex';
+import { ENGINEERING_WORK_LIST, EXAM_QUESTION_TYPE } from '@/common/Constant';
 export default {
   name: 'examManagementDetail',
   props: {},
@@ -19,22 +23,230 @@ export default {
     // }
   },
   data() {
-    return {};
+    return {
+      examDetailData: {}, // 单场考试的详情信息
+      examQuestionList: [], // 单场考试的试题列表
+      examQuestionType: [], // 所属题目类型列表
+      engineeringWorkList: [], // 工种数据列表
+      tableHeight: 400, // 表格高度
+      columns: [], // form表单的列参数
+      pagination: {
+        pageSize: 7,
+        current: 1,
+        total: 0,
+      }, // 分页参数
+      loading: false, // 是否展示加载动画
+    };
   },
-  created() {
+  created() {},
+  mounted() {
     this.initDataFun(); //初始化数据
   },
-  mounted() {},
   beforeDestroy() {},
   watch: {},
-  computed: {},
+  computed: {
+    // 是否选择了数据
+    ...mapGetters(['screenHeight']),
+  },
   methods: {
     //初始化数据
-    initDataFun() {},
+    initDataFun() {
+      if (!this.$route.query.id) {
+        this.$message.error('页面异常,请重新进入');
+        return;
+      }
+      let params = {
+        id: this.$route.query.id,
+      };
+      console.log(params);
+      // this.$_http
+      //   .get(this.$_API.INTERFACE_GET_EXAM_DETAIL, { params })
+      //   .then((res) => {
+      //     console.log(res);
+      //     this.tableData = res.data;
+      //     this.pagination.total = res.pagination.total;
+      //   })
+      //   .catch((err) => {
+      //     console.log(err);
+      //   })
+      //   .finally(() => {
+      //     this.loading = false;
+      //   });
+      this.examDetailData = {
+        id: 5,
+        examCode: 'TradeCode 5',
+        examName: '期末考试',
+        startTime: '2021-06-14 12:00:00',
+        status: '未开始',
+      };
+      // 题目分类
+      this.examQuestionType = EXAM_QUESTION_TYPE;
+
+      // 工种类别
+      this.engineeringWorkList = ENGINEERING_WORK_LIST;
+      // 表单的列的配置参数
+      this.columns = [
+        {
+          title: '题目编号',
+          dataIndex: 'questionCode',
+          key: 'questionCode',
+          scopedSlots: { customRender: 'questionCode' },
+        },
+        {
+          title: '题目',
+          dataIndex: 'questionDescription',
+          key: 'questionDescription',
+        },
+        {
+          title: '题目类别',
+          dataIndex: 'questionTypeTxt',
+          key: 'questionTypeTxt',
+          width: 150,
+        },
+        {
+          title: '工种',
+          dataIndex: 'engineeringWorkTxt',
+          key: 'engineeringWorkTxt',
+          width: 150,
+        },
+        {
+          title: '操作',
+          dataIndex: 'action',
+          key: 'action',
+          scopedSlots: { customRender: 'action' },
+          with: 200,
+        },
+      ];
+      this.getQusetionsListFun(); // 查询:题目列表数据
+      this.examQuestionList = [{}];
+    }, // 查询:题目列表数据
+    getQusetionsListFun() {
+      // 列表数据
+      const resData = [
+        {
+          id: 1,
+          questionCode: 'TradeCode 0',
+          questionDescription:
+            '这是一段描述,关于这个应用的描述文字内容,这是一段描述,关于这个应用的描述文字内容,这是一段描述,关于这个应用的描述文字内容',
+          questionType: 'TianKong',
+          engineeringWork: 'QiaoSuiGong',
+        },
+        {
+          id: 2,
+          questionCode: 'TradeCode 1',
+          questionDescription: '这是一段描述,关于这个应用的描述文字内容',
+          questionType: 'DanXuan',
+          engineeringWork: 'QiaoSuiGong',
+        },
+        {
+          id: 3,
+          questionCode: 'TradeCode 2',
+          questionDescription: '这是一段描述,关于这个应用的描述文字内容',
+          questionType: 'DuoXuan',
+          engineeringWork: 'QiaoSuiGong',
+        },
+        {
+          id: 4,
+          questionCode: 'TradeCode 3',
+          questionDescription: '这是一段描述,关于这个应用的描述文字内容',
+          questionType: 'PanDuan',
+          engineeringWork: 'QiaoSuiGong',
+        },
+        {
+          id: 5,
+          questionCode: 'TradeCode 4',
+          questionDescription: '这是一段描述,关于这个应用的描述文字内容',
+          questionType: 'TianKong',
+          engineeringWork: 'QiaoSuiGong',
+        },
+        {
+          id: 6,
+          questionCode: 'TradeCode 5',
+          questionDescription: '这是一段描述,关于这个应用的描述文字内容',
+          questionType: 'TianKong',
+          engineeringWork: 'QiaoSuiGong',
+        },
+        {
+          id: 7,
+          questionCode: 'TradeCode 6',
+          questionDescription: '这是一段描述,关于这个应用的描述文字内容',
+          questionType: 'TianKong',
+          engineeringWork: 'QiaoSuiGong',
+        },
+        {
+          id: 8,
+          questionCode: 'TradeCode 7',
+          questionDescription: '这是一段描述,关于这个应用的描述文字内容',
+          questionType: 'TianKong',
+          engineeringWork: 'QiaoSuiGong',
+        },
+        {
+          id: 9,
+          questionCode: 'TradeCode 8',
+          questionDescription: '这是一段描述,关于这个应用的描述文字内容',
+          questionType: 'TianKong',
+          engineeringWork: 'QiaoSuiGong',
+        },
+        {
+          id: 10,
+          questionCode: 'TradeCode 9',
+          questionDescription: '这是一段描述,关于这个应用的描述文字内容',
+          questionType: 'TianKong',
+          engineeringWork: 'QiaoSuiGong',
+        },
+        {
+          id: 11,
+          questionCode: 'TradeCode 10',
+          questionDescription: '这是一段描述,关于这个应用的描述文字内容',
+          questionType: 'TianKong',
+          engineeringWork: 'QiaoSuiGong',
+        },
+        {
+          id: 12,
+          questionCode: 'TradeCode 11',
+          questionDescription: '这是一段描述,关于这个应用的描述文字内容',
+          questionType: 'TianKong',
+          engineeringWork: 'QiaoSuiGong',
+        },
+        {
+          id: 13,
+          questionCode: 'TradeCode 12',
+          questionDescription: '这是一段描述,关于这个应用的描述文字内容',
+          questionType: 'TianKong',
+          engineeringWork: 'QiaoSuiGong',
+        },
+        {
+          id: 14,
+          questionCode: 'TradeCode 13',
+          questionDescription: '这是一段描述,关于这个应用的描述文字内容',
+          questionType: 'TianKong',
+          engineeringWork: 'QiaoSuiGong',
+        },
+      ];
+      this.pagination.total = resData.length;
+      resData.forEach((item) => {
+        this.engineeringWorkList.forEach((it) => {
+          if (item.engineeringWork === it.value) {
+            item.engineeringWorkTxt = it.title;
+          }
+        });
+        this.defaultType.forEach((it) => {
+          if (item.questionType === it.code) {
+            item.questionTypeTxt = it.title;
+          }
+        });
+      });
+      this.examQuestionList = [...resData];
+    },
   },
 };
 </script>
 
 <style lang="less"></style>
 
-<style lang="less" scoped></style>
+<style lang="less" scoped>
+@import '~@/styles/common/variable.less';
+.exam-detail-info {
+  width: 100%;
+}
+</style>

+ 77 - 34
src/views/examManagement/examManagementList.vue

@@ -36,7 +36,7 @@
     <!-- 表单 -->
     <div class="common-card a-card-margin-top">
       <!-- 清空、批量删除 -->
-      <div class="exam-question-edit-row">
+      <div class="exam-edit-row">
         <a-button
           type="primary"
           :disabled="!hasSelected"
@@ -45,11 +45,11 @@
         >
           清空
         </a-button>
-        <span v-if="hasSelected" class="exam-question-edit-checkedtxt">
+        <span v-if="hasSelected" class="exam-edit-checkedtxt">
           {{ `已选择 ${selectedRowKeys.length} 项` }}
         </span>
         <a-button
-          class="exam-question-edit-delete"
+          class="exam-edit-delete"
           type="primary"
           :disabled="!hasSelected"
           :loading="loading"
@@ -89,7 +89,14 @@
         <template slot="action" slot-scope="text, record">
           <a @click="toQuestionDetailFun(record)">详情</a>
           <a-divider type="vertical" />
-          <a @click="deleteQuestionFun(record)">删除</a>
+          <a
+            :class="{
+              'exam-delete': true,
+              'exam-delete-disable': record.status !== '未开始',
+            }"
+            @click="deleteQuestionFun(record)"
+            >删除</a
+          >
         </template>
       </a-table>
     </div>
@@ -303,21 +310,40 @@ export default {
     // 操作:详情
     toQuestionDetailFun(record) {
       console.log('查看某个试题的详情', record);
+      this.$router.push({
+        path: '/examManagement/detail',
+        query: { id: record.id },
+      });
     },
     // 操作:删除
     deleteQuestionFun(record) {
-      console.log('删除某个试题', record);
-      // this.$_http
-      //   .get(this.$_API.INTERFACE_POST_EXAMS_QUESTION_DELETE)
-      //   .then((res) => {
-      //     console.log(res);
-      //   })
-      //   .catch((err) => {
-      //     console.log(err);
-      //   })
-      //   .finally(() => {
-      //     this.loading = false;
-      //   });
+      if (record.status !== '未开始') {
+        return;
+      }
+      // let that = this
+      this.$confirm({
+        title: '删除',
+        content: `确认删除编号为 ${record.examCode} 的考试吗?`,
+        okText: '确认',
+        cancelText: '取消',
+        onOk() {
+          // let params = {
+          //   id: record.id,
+          // };
+          // that.$_http
+          //   .post(that.$_API.INTERFACE_POST_EXAMS_QUESTION_DELETE, params)
+          //   .then((res) => {
+          //     console.log(res);
+          //   })
+          //   .catch((err) => {
+          //     console.log(err);
+          //   })
+          //   .finally(() => {
+          //     that.loading = false;
+          //   });
+        },
+        onCancel() {},
+      });
     },
     // 操作:清空选择
     handleClearSelectDataFun() {
@@ -331,21 +357,31 @@ export default {
     },
     // 操作:批量删除
     handleDeleteSelectDataFun() {
-      console.log('批量删除', this.selectedRowKeys);
-      this.loading = true;
-      this.selectedRowKeys = [];
-      this.loading = false;
-      // this.$_http
-      //   .get(this.$_API.INTERFACE_POST_EXAMS_QUESTION_DELETE_LIST)
-      //   .then((res) => {
-      //     console.log(res);
-      //   })
-      //   .catch((err) => {
-      //     console.log(err);
-      //   })
-      //   .finally(() => {
-      //     this.loading = false;
-      //   });
+      let that = this;
+      this.$confirm({
+        title: '批量删除',
+        content: `确认批量删除吗?`,
+        okText: '确认',
+        cancelText: '取消',
+        onOk() {
+          console.log('批量删除', that.selectedRowKeys);
+          that.loading = true;
+          that.selectedRowKeys = [];
+          that.loading = false;
+          // that.$_http
+          //   .post(that.$_API.INTERFACE_POST_EXAMS_QUESTION_DELETE_LIST, params)
+          //   .then((res) => {
+          //     console.log(res);
+          //   })
+          //   .catch((err) => {
+          //     console.log(err);
+          //   })
+          //   .finally(() => {
+          //     that.loading = false;
+          //   });
+        },
+        onCancel() {},
+      });
     },
   },
 };
@@ -388,12 +424,12 @@ export default {
       color: @mainColorBlack65;
     }
   }
-  .exam-question-edit-row {
+  .exam-edit-row {
     margin-bottom: @paddingMarginVal;
-    .exam-question-edit-checkedtxt {
+    .exam-edit-checkedtxt {
       margin-left: @paddingMarginVal;
     }
-    .exam-question-edit-delete {
+    .exam-edit-delete {
       margin-left: @paddingMarginVal;
     }
   }
@@ -406,5 +442,12 @@ export default {
   .exam-status-red {
     color: #d43030;
   }
+  .exam-delete {
+    cursor: pointer;
+  }
+  .exam-delete-disable {
+    cursor: no-drop;
+    color: #a6a6a6;
+  }
 }
 </style>

+ 49 - 27
src/views/examQuestionManagement/examQuestionList.vue

@@ -351,18 +351,30 @@ export default {
     },
     // 操作:删除
     deleteQuestionFun(record) {
-      console.log('删除某个试题', record);
-      // this.$_http
-      //   .get(this.$_API.INTERFACE_POST_EXAMS_QUESTION_DELETE)
-      //   .then((res) => {
-      //     console.log(res);
-      //   })
-      //   .catch((err) => {
-      //     console.log(err);
-      //   })
-      //   .finally(() => {
-      //     this.loading = false;
-      //   });
+      // let that = this
+      this.$confirm({
+        title: '删除',
+        content: `确认删除编号为 ${record.questionCode} 的题目吗?`,
+        okText: '确认',
+        cancelText: '取消',
+        onOk() {
+          // let params = {
+          //   id: record.id,
+          // };
+          // that.$_http
+          //   .post(that.$_API.INTERFACE_POST_EXAMS_QUESTION_DELETE, params)
+          //   .then((res) => {
+          //     console.log(res);
+          //   })
+          //   .catch((err) => {
+          //     console.log(err);
+          //   })
+          //   .finally(() => {
+          //     that.loading = false;
+          //   });
+        },
+        onCancel() {},
+      });
     },
     // 操作:清空选择
     handleClearSelectDataFun() {
@@ -376,21 +388,31 @@ export default {
     },
     // 操作:批量删除
     handleDeleteSelectDataFun() {
-      console.log('批量删除', this.selectedRowKeys);
-      this.loading = true;
-      this.selectedRowKeys = [];
-      this.loading = false;
-      // this.$_http
-      //   .get(this.$_API.INTERFACE_POST_EXAMS_QUESTION_DELETE_LIST)
-      //   .then((res) => {
-      //     console.log(res);
-      //   })
-      //   .catch((err) => {
-      //     console.log(err);
-      //   })
-      //   .finally(() => {
-      //     this.loading = false;
-      //   });
+      let that = this;
+      this.$confirm({
+        title: '批量删除',
+        content: `确认批量删除吗?`,
+        okText: '确认',
+        cancelText: '取消',
+        onOk() {
+          console.log('批量删除', that.selectedRowKeys);
+          that.loading = true;
+          that.selectedRowKeys = [];
+          that.loading = false;
+          // that.$_http
+          //   .post(that.$_API.INTERFACE_POST_EXAMS_QUESTION_DELETE_LIST, params)
+          //   .then((res) => {
+          //     console.log(res);
+          //   })
+          //   .catch((err) => {
+          //     console.log(err);
+          //   })
+          //   .finally(() => {
+          //     that.loading = false;
+          //   });
+        },
+        onCancel() {},
+      });
     },
   },
 };