|
@@ -8,7 +8,7 @@
|
|
|
<ul>
|
|
|
<li
|
|
|
:class="{
|
|
|
- checkedExamQuestionType: checkedExamQuestionType === item.code,
|
|
|
+ checkedExamQuestionType: checkedExamQuestionType === item.id,
|
|
|
}"
|
|
|
v-for="(item, index) in examQuestionType"
|
|
|
:key="index"
|
|
@@ -18,6 +18,22 @@
|
|
|
</li>
|
|
|
</ul>
|
|
|
</div>
|
|
|
+ <div class="filter-condition-box a-card-margin-top">
|
|
|
+ <span>所属类别:</span>
|
|
|
+ <ul>
|
|
|
+ <li
|
|
|
+ :class="{
|
|
|
+ checkedExamQuestionType:
|
|
|
+ checkedExamQuestionConditionType === item.id,
|
|
|
+ }"
|
|
|
+ v-for="(item, index) in examQuestionConditionType"
|
|
|
+ :key="index"
|
|
|
+ @click="handleExamQuestionConditionTypeFun(item)"
|
|
|
+ >
|
|
|
+ {{ item.name }}
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+ </div>
|
|
|
<div class="border-line"></div>
|
|
|
<div class="filter-other-box">
|
|
|
<span class="filter-other-title">其它选项:</span>
|
|
@@ -29,7 +45,7 @@
|
|
|
<a-select-option
|
|
|
v-for="(item, index) in engineeringWorkList"
|
|
|
:key="index"
|
|
|
- :value="item.code"
|
|
|
+ :value="item.id"
|
|
|
>
|
|
|
{{ item.name }}
|
|
|
</a-select-option>
|
|
@@ -69,14 +85,16 @@
|
|
|
selectedRowKeys: selectedRowKeys,
|
|
|
onChange: onSelectChange,
|
|
|
}"
|
|
|
- :pagination="pagination"
|
|
|
- @change="handleTableChange"
|
|
|
+ :pagination="false"
|
|
|
>
|
|
|
- <template slot="questionType" slot-scope="text, record">
|
|
|
- <span>{{ record.questionTypeTxt }}</span>
|
|
|
+ <template slot="type" slot-scope="text, record">
|
|
|
+ <span>{{ record.typeTxt }}</span>
|
|
|
</template>
|
|
|
- <template slot="engineeringWork" slot-scope="text, record">
|
|
|
- <span>{{ record.engineeringWorkTxt }}</span>
|
|
|
+ <template slot="engineerTypes" slot-scope="text, record">
|
|
|
+ <span>{{ record.engineerTypesTxt }}</span>
|
|
|
+ </template>
|
|
|
+ <template slot="typeCondition" slot-scope="text, record">
|
|
|
+ <span>{{ record.typeConditionTxt }}</span>
|
|
|
</template>
|
|
|
<template slot="action" slot-scope="text, record">
|
|
|
<a @click="toQuestionDetailFun(record)">详情</a>
|
|
@@ -84,23 +102,36 @@
|
|
|
<a @click="deleteQuestionFun(record)">删除</a>
|
|
|
</template>
|
|
|
</a-table>
|
|
|
+ <!-- 分页 -->
|
|
|
+ <div class="a-pagination-display">
|
|
|
+ <a-pagination
|
|
|
+ v-model="pagination.current"
|
|
|
+ :pageSize="pagination.pageSize"
|
|
|
+ :total.sync="pagination.total"
|
|
|
+ show-less-items
|
|
|
+ show-quick-jumper
|
|
|
+ @change="getQusetionsListFun"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</a-spin>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import { EXAM_QUESTION_TYPE } from '@/common/Constant';
|
|
|
import { mapGetters } from 'vuex';
|
|
|
-import { ENGINEERING_WORK_LIST, EXAM_QUESTION_TYPE } from '@/common/Constant';
|
|
|
-import { QUESTIONLISTRES } from '@/common/resData';
|
|
|
+import { pathParams } from '@/filters';
|
|
|
export default {
|
|
|
name: 'examQuestionList',
|
|
|
props: {},
|
|
|
components: {},
|
|
|
data() {
|
|
|
return {
|
|
|
- examQuestionType: [], // 所属题目类型列表
|
|
|
- checkedExamQuestionType: '', // 所选题目类型
|
|
|
+ examQuestionType: [], // 题目类目列表
|
|
|
+ checkedExamQuestionType: '', // 所选题目类目类型
|
|
|
+ examQuestionConditionType: [], // 题目类别列表
|
|
|
+ checkedExamQuestionConditionType: '', // 所选题目类别类型
|
|
|
engineeringWorkList: [], // 工种数据列表
|
|
|
engineeringWorkChooseValue: '', // 所选工种
|
|
|
tableHeight: 400, // 表格高度
|
|
@@ -129,7 +160,11 @@ export default {
|
|
|
},
|
|
|
computed: {
|
|
|
// 是否选择了数据
|
|
|
- ...mapGetters(['screenHeight']),
|
|
|
+ ...mapGetters([
|
|
|
+ 'screenHeight',
|
|
|
+ 'GET_ENGINEERING_WORK_LIST',
|
|
|
+ 'GET_EXAM_QUESTION_TYPE_CONDITION',
|
|
|
+ ]),
|
|
|
// 判断是否有行被选择
|
|
|
hasSelected() {
|
|
|
return this.selectedRowKeys.length > 0;
|
|
@@ -140,131 +175,126 @@ export default {
|
|
|
initTableHeightFun() {
|
|
|
this.tableHeight =
|
|
|
this.$refs.tableBody.offsetHeight -
|
|
|
- (this.$refs.filterCard.offsetHeight + 48 * 4);
|
|
|
+ (this.$refs.filterCard.offsetHeight + 48 * 4 - 5);
|
|
|
},
|
|
|
//初始化数据
|
|
|
initDataFun() {
|
|
|
- this.loading = true;
|
|
|
- // 题目分类
|
|
|
- this.examQuestionType = [
|
|
|
- { name: '全部', code: '' },
|
|
|
- ...EXAM_QUESTION_TYPE,
|
|
|
+ // 题目类目
|
|
|
+ this.examQuestionType = [{ name: '全部', id: '' }, ...EXAM_QUESTION_TYPE];
|
|
|
+ // 题目类别
|
|
|
+ this.examQuestionConditionType = [
|
|
|
+ { name: '全部', id: '' },
|
|
|
+ ...this.GET_EXAM_QUESTION_TYPE_CONDITION,
|
|
|
];
|
|
|
- this.checkedExamQuestionType = this.examQuestionType[0].code;
|
|
|
// 工种类别
|
|
|
- this.engineeringWorkList = ENGINEERING_WORK_LIST;
|
|
|
- this.engineeringWorkChooseValue = this.engineeringWorkList[0].code;
|
|
|
+ this.engineeringWorkList = [
|
|
|
+ { name: '不限', id: '' },
|
|
|
+ ...this.GET_ENGINEERING_WORK_LIST,
|
|
|
+ ];
|
|
|
// 表单的列的配置参数
|
|
|
this.columns = [
|
|
|
{
|
|
|
title: '题目编号',
|
|
|
- dataIndex: 'questionCode',
|
|
|
- key: 'questionCode',
|
|
|
- // width: 200,
|
|
|
+ dataIndex: 'id',
|
|
|
+ key: 'id',
|
|
|
},
|
|
|
{
|
|
|
title: '题目',
|
|
|
- dataIndex: 'questionDescription',
|
|
|
- key: 'questionDescription',
|
|
|
- // width: 700,
|
|
|
+ dataIndex: 'content',
|
|
|
+ key: 'content',
|
|
|
},
|
|
|
{
|
|
|
title: '题目类别',
|
|
|
- dataIndex: 'questionType',
|
|
|
- key: 'questionType',
|
|
|
- scopedSlots: { customRender: 'questionType' },
|
|
|
- // width: 200,
|
|
|
+ dataIndex: 'type',
|
|
|
+ key: 'type',
|
|
|
+ scopedSlots: { customRender: 'type' },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '题目分类',
|
|
|
+ dataIndex: 'typeCondition',
|
|
|
+ key: 'typeCondition',
|
|
|
+ scopedSlots: { customRender: 'typeCondition' },
|
|
|
},
|
|
|
{
|
|
|
title: '工种',
|
|
|
- dataIndex: 'engineeringWork',
|
|
|
- key: 'engineeringWork',
|
|
|
- scopedSlots: { customRender: 'engineeringWork' },
|
|
|
- // width: 200,
|
|
|
+ dataIndex: 'engineerTypes',
|
|
|
+ key: 'engineerTypes',
|
|
|
+ scopedSlots: { customRender: 'engineerTypes' },
|
|
|
},
|
|
|
{
|
|
|
title: '操作',
|
|
|
dataIndex: 'action',
|
|
|
key: 'action',
|
|
|
scopedSlots: { customRender: 'action' },
|
|
|
- // with: 200,
|
|
|
},
|
|
|
];
|
|
|
this.getQusetionsListFun(); // 查询:题目列表数据
|
|
|
},
|
|
|
- // 查询:工种列表
|
|
|
- getTableListFun() {
|
|
|
+ // 初始化分页参数
|
|
|
+ initPagination() {
|
|
|
+ this.pagination.current = 1;
|
|
|
+ this.pagination.pageSize = 7;
|
|
|
+ this.pagination.total = 0;
|
|
|
+ },
|
|
|
+ // 查询:题目列表数据
|
|
|
+ getQusetionsListFun() {
|
|
|
this.loading = true;
|
|
|
+ let params = {
|
|
|
+ page: this.pagination.current,
|
|
|
+ size: this.pagination.pageSize,
|
|
|
+ type: this.checkedExamQuestionType,
|
|
|
+ typeCondition: this.checkedExamQuestionConditionType,
|
|
|
+ engineerTypes: this.engineeringWorkChooseValue,
|
|
|
+ };
|
|
|
this.$_http
|
|
|
- .get(this.$_API.INTERFACE_GET_ENGINEERINGWORK_LIST)
|
|
|
+ .get(this.$_API.INTERFACE_GET_EXAMS_QUESTION_LIST, { params })
|
|
|
.then((res) => {
|
|
|
- this.tableData = res.data;
|
|
|
+ let resData = res.data.content;
|
|
|
+ resData.forEach((item) => {
|
|
|
+ this.examQuestionType.forEach((it) => {
|
|
|
+ if (item.type === it.code) {
|
|
|
+ item.typeTxt = it.name;
|
|
|
+ }
|
|
|
+ }); // 题目类目
|
|
|
+ this.examQuestionConditionType.forEach((it) => {
|
|
|
+ if (item.typeCondition === it.id) {
|
|
|
+ item.typeConditionTxt = it.name;
|
|
|
+ }
|
|
|
+ }); // 题目类别
|
|
|
+ item.engineerTypesTxt = this.engineeringWorkList[0].name;
|
|
|
+ this.engineeringWorkList.forEach((it) => {
|
|
|
+ if (item.engineerTypes === it.id) {
|
|
|
+ item.engineerTypesTxt = it.name;
|
|
|
+ }
|
|
|
+ }); // 工种
|
|
|
+ });
|
|
|
+ this.pagination.total = res.data.totalElements; // 总条数
|
|
|
+ this.tableData = resData;
|
|
|
+ this.loading = false;
|
|
|
})
|
|
|
.catch(() => {
|
|
|
this.loading = false;
|
|
|
});
|
|
|
},
|
|
|
- // 操作:选择某个题目类型
|
|
|
+ // 操作:选择某个题目类目
|
|
|
handleExamQuestionTypeFun(item) {
|
|
|
- console.log('选择某个题目类型', item);
|
|
|
- if (this.checkedExamQuestionType === item.code) {
|
|
|
+ if (this.checkedExamQuestionType === item.id) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.checkedExamQuestionType = item.id;
|
|
|
+ this.getQusetionsListFun(); // 查询:题目列表数据
|
|
|
+ },
|
|
|
+ // 操作:选择某个题目类别
|
|
|
+ handleExamQuestionConditionTypeFun(item) {
|
|
|
+ if (this.checkedExamQuestionConditionType === item.id) {
|
|
|
return;
|
|
|
}
|
|
|
- this.checkedExamQuestionType = item.code;
|
|
|
+ this.checkedExamQuestionConditionType = item.id;
|
|
|
+ this.getQusetionsListFun(); // 查询:题目列表数据
|
|
|
},
|
|
|
// 操作:选择了某个工种
|
|
|
handleChangeEngineeringWorkValue() {
|
|
|
- console.log('选择了某个工种', this.engineeringWorkChooseValue);
|
|
|
- },
|
|
|
- // 查询:题目列表数据
|
|
|
- getQusetionsListFun() {
|
|
|
- // 列表数据
|
|
|
- const resData = QUESTIONLISTRES.data;
|
|
|
- setTimeout(() => {
|
|
|
- resData.forEach((item) => {
|
|
|
- EXAM_QUESTION_TYPE.forEach((it) => {
|
|
|
- if (item.questionType === it.code) {
|
|
|
- item.questionTypeTxt = it.name;
|
|
|
- }
|
|
|
- });
|
|
|
- ENGINEERING_WORK_LIST.forEach((it) => {
|
|
|
- if (item.engineeringWork === it.code) {
|
|
|
- item.engineeringWorkTxt = it.name;
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
- this.pagination.total = resData.length;
|
|
|
- this.tableData = [...resData];
|
|
|
- this.loading = false;
|
|
|
- }, 1500);
|
|
|
- },
|
|
|
- // 查询:表格某页的数据
|
|
|
- handleTableChange(pagination) {
|
|
|
- this.loading = true;
|
|
|
- setTimeout(() => {
|
|
|
- const pager = { ...this.pagination };
|
|
|
- pager.current = pagination.current;
|
|
|
- this.pagination = pager;
|
|
|
- this.loading = false;
|
|
|
- }, 1500);
|
|
|
- // let params = {
|
|
|
- // pagination: pagination,
|
|
|
- // questionType: this.checkedExamQuestionType,
|
|
|
- // engineeringWork: this.engineeringWorkChooseValue
|
|
|
- // };
|
|
|
- // this.$_http
|
|
|
- // .get(this.$_API.INTERFACE_GET_USER_ADMIN_USERS, { 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.getQusetionsListFun(); // 查询:题目列表数据
|
|
|
},
|
|
|
// 操作:详情
|
|
|
toQuestionDetailFun(record) {
|
|
@@ -272,36 +302,40 @@ export default {
|
|
|
},
|
|
|
// 操作:删除
|
|
|
deleteQuestionFun(record) {
|
|
|
- // let that = this
|
|
|
+ let that = this;
|
|
|
this.$confirm({
|
|
|
title: '删除',
|
|
|
- content: `确认删除编号为 ${record.questionCode} 的题目吗?`,
|
|
|
+ content: `确认删除编号为 ${record.id} 的题目吗?`,
|
|
|
okText: '确认',
|
|
|
cancelText: '取消',
|
|
|
onOk() {
|
|
|
- // let params = {
|
|
|
- // id: record.id,
|
|
|
- // };
|
|
|
- // that.$_http
|
|
|
- // .delete(that.$_API.INTERFACE_DELETE_EXAMS_QUESTION_DELETE, params)
|
|
|
- // .then((res) => {
|
|
|
- // console.log(res);
|
|
|
- // })
|
|
|
- // .catch((err) => {
|
|
|
- // console.log(err);
|
|
|
- // })
|
|
|
- // .finally(() => {
|
|
|
- // that.loading = false;
|
|
|
- // });
|
|
|
+ that.loading = true;
|
|
|
+ let params = {
|
|
|
+ questionId: record.id,
|
|
|
+ };
|
|
|
+ that.$_http
|
|
|
+ .delete(
|
|
|
+ pathParams(
|
|
|
+ that.$_API.INTERFACE_DELETE_EXAMS_QUESTION_DELETE,
|
|
|
+ params
|
|
|
+ )
|
|
|
+ )
|
|
|
+ .then(() => {
|
|
|
+ that.loading = false;
|
|
|
+ that.$message.success('删除题目成功');
|
|
|
+ that.initPagination(); // 初始化分页参数
|
|
|
+ that.getQusetionsListFun(); // 查询:题目列表数据
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ that.loading = false;
|
|
|
+ });
|
|
|
},
|
|
|
onCancel() {},
|
|
|
});
|
|
|
},
|
|
|
// 操作:清空选择
|
|
|
handleClearSelectDataFun() {
|
|
|
- this.loading = true;
|
|
|
this.selectedRowKeys = [];
|
|
|
- this.loading = false;
|
|
|
},
|
|
|
// 操作:多选变化时
|
|
|
onSelectChange(selectedRowKeys) {
|
|
@@ -316,23 +350,21 @@ export default {
|
|
|
okText: '确认',
|
|
|
cancelText: '取消',
|
|
|
onOk() {
|
|
|
- console.log('批量删除', that.selectedRowKeys);
|
|
|
that.loading = true;
|
|
|
- setTimeout(() => {
|
|
|
- that.selectedRowKeys = [];
|
|
|
- that.loading = false;
|
|
|
- }, 1500);
|
|
|
- // that.$_http
|
|
|
- // .delete(that.$_API.INTERFACE_DELETE_EXAMS_QUESTION_DELETE_LIST, params)
|
|
|
- // .then((res) => {
|
|
|
- // console.log(res);
|
|
|
- // })
|
|
|
- // .catch((err) => {
|
|
|
- // console.log(err);
|
|
|
- // })
|
|
|
- // .finally(() => {
|
|
|
- // that.loading = false;
|
|
|
- // });
|
|
|
+ that.$_http
|
|
|
+ .delete(that.$_API.INTERFACE_DELETE_EXAMS_QUESTION_DELETE_LIST, {
|
|
|
+ data: that.selectedRowKeys,
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ that.selectedRowKeys = [];
|
|
|
+ that.loading = false;
|
|
|
+ that.$message.success('批量删除题目成功');
|
|
|
+ that.initPagination(); // 初始化分页参数
|
|
|
+ that.getQusetionsListFun(); // 查询:题目列表数据
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ that.loading = false;
|
|
|
+ });
|
|
|
},
|
|
|
onCancel() {},
|
|
|
});
|