<template>
|
<div class="app-container">
|
<el-card shadow="never" class="box-card filter-card">
|
<!--搜索条件-->
|
<div class="filter-container">
|
<el-form :inline="true" :model="filterForm" size="small">
|
<el-form-item label="顶级单位">
|
<el-select v-model="filterForm.orgId" placeholder="选择顶级单位" @change="search(1)">
|
<el-option
|
v-for="org in this.rootOrgList" :key="org.id" :label="org.dept_name" :value="org.id"/>
|
</el-select>
|
</el-form-item>
|
<!-- <el-form-item label="发起时间">-->
|
<!-- <el-date-picker v-model="filterFrom.startTime" type="date" placeholder="选择开始日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd" style="width: 177px" />-->
|
<!-- - <el-date-picker v-model="filterFrom.finishTime" style="width: 177px" type="date" placeholder="选择结束日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd" />-->
|
<!-- </el-form-item>-->
|
<el-form-item label="题库大类">
|
<el-select v-model="filterForm.rootCatalog" placeholder="题库大类" clearable>
|
<el-option
|
v-for="dict in dict.type.question_root_catalog"
|
:key="dict.value"
|
:label="dict.label"
|
:value="dict.value"
|
/>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="试卷名称">
|
<el-input v-model="filterForm.content" placeholder="试卷名称关键词" clearable/>
|
</el-form-item>
|
<el-form-item>
|
<my-button-v2 site="filter" name="搜索" @click="search(1)" />
|
<my-button-v2 site="filter" name="重置" @click="reset()" />
|
</el-form-item>
|
</el-form>
|
</div>
|
</el-card>
|
<!--列表-->
|
<my-table-v3 ref="myTable" :filter="filterForm" :table="table" />
|
<!--添加/编辑弹窗-->
|
<add v-if="editSetting.show" :setting="editSetting" @close="editSetting.show=false" @search="search" />
|
</div>
|
</template>
|
|
<script>
|
import { listOrgRoot } from '@/api/system/dept'
|
import {deletePaper} from "@/api/etaa/paper";
|
import myTableV3 from '@/views/components/myTableV3';
|
import myButtonV2 from '@/views/components/myButtonV2'
|
import {isEmptyValue} from "@/utils/StringUtils";
|
import add from "./add";
|
|
export default {
|
name: "Paper",
|
components: {myTableV3, myButtonV2, add},
|
dicts: ['question_root_catalog'],
|
data(){
|
return {
|
/** 搜索条件*/
|
filterForm: {
|
orgId: null,
|
rootCatalog: null,
|
rootCatalogName: null, // 临时存放名字
|
majorCatalog: null,
|
content: null
|
},
|
|
table: {
|
autoLoad: false,
|
showIndex: false, // 是否显示序号
|
expand: false, // 是否显示详情数据
|
checkBox: false, // 是否显示复选框
|
url: globalConf.baseUrl + '/etaa/paper/list', // 请求地址
|
// 工具条
|
tools: {
|
columnsCtrl: {// 列控制按钮
|
show: true
|
},
|
generalExport: {// 通用导出按钮
|
show: false
|
},
|
custom: [ // 自定义工具条按钮
|
{
|
name: '添加',
|
checkPermission: 'etaa:paper:add',
|
myType: 'danger',
|
click: ()=> {
|
this.handleRAdd();
|
}
|
},
|
{
|
name: '导出参数',
|
click: ()=> {
|
|
}
|
}
|
]
|
},
|
columns: [
|
{ title: '名称', field: 'name', align: 'left', width: 190 },
|
{ title: '大类', field: 'parameter.rootCatalogName', align: 'left', width: 100 },
|
{ title: '小类', field: 'majorCatalogName', align: 'left', width: 80 },
|
{ title: '组卷策略', field: 'paperPolicy', align: 'left', width: 90 },
|
{ title: '策略详情', field: 'policyContent', align: 'left', width: 150 },
|
{ title: '题量', field: 'questionCount', align: 'left', width: 60 },
|
{ title: '总分', field: 'scoreTotal', align: 'left', width: 60 },
|
{ title: '分值详情', field: 'scorePolicy', align: 'left', width: 120 },
|
{ title: '难度', field: 'difficultLevel', align: 'left', width: 70 },
|
{ title: '状态', field: 'dataStatus', align: 'left', width: 60, formatter: row => {
|
let title = '';
|
let type = 'primary';
|
switch (row.dataStatus) {
|
case 0:
|
title = '正常'
|
break
|
case 1:
|
title = '禁用'
|
type = 'warn'
|
break
|
case 2:
|
title = '删除'
|
type = 'danger'
|
break
|
}
|
return { value: title, type: type }
|
}
|
},
|
{ title: '创建时间', field: 'parameter.createTimeName', align: 'left', width: 170 },
|
{ title: '创建人', field: 'parameter.createUserName', align: 'left', width: 90 },
|
{ title: '备注', field: 'summary', align: 'left', width: 160 }
|
],
|
// 操作信息
|
operation: {
|
show: true, // 显示操作列
|
width: '100', // 列宽
|
attr: [
|
{
|
title: '编辑',
|
checkPermission: 'etaa:paper:edit',
|
events: row => {
|
this.handleUpdate(row)
|
}
|
},
|
{
|
title: '删除',
|
checkPermission: 'etaa:paper:remove:query',
|
events: row => {
|
this.handleDelete(row.id);
|
}
|
}
|
]
|
},
|
paging: {
|
show: true, // 显示分页
|
// 分页信息
|
page: {
|
small: false,
|
pageNum: 1,
|
pageSize: platformPageSize,
|
total: 0
|
}
|
}
|
},
|
|
// 添加&编辑窗口
|
editSetting: {
|
id: null,
|
title: '',
|
show: false
|
},
|
|
// 2022-12-30 根机构列表,个人只能列出自己所在根机构
|
rootOrgList:[],
|
// 2022-12-30 超级管理员选择的顶级机构ID
|
selectedRootOrgId: undefined,
|
}
|
},
|
|
created() {
|
this.getRootOrgList();
|
},
|
|
methods: {
|
/** 获取顶级机构列表选择框 2022-12-30 */
|
getRootOrgList(){
|
listOrgRoot().then(response => {
|
this.rootOrgList = response.data;
|
this.selectedRootOrgId = this.rootOrgList[0].id;
|
this.filterForm.orgId = this.selectedRootOrgId;
|
}).then(() => {
|
// this.listCatalogTree();
|
this.search(1);
|
}).catch(function() {
|
});
|
},
|
|
// 重置
|
reset() {
|
this.filterForm = {
|
orgId: this.selectedRootOrgId,
|
rootCatalog: null,
|
rootCatalogName: null,
|
majorCatalog: null,
|
content: null
|
}
|
this.search(1)
|
},
|
|
// 查询table列表
|
search(pageNum) {
|
if(isEmptyValue(this.filterForm.orgId)){
|
return;
|
} else {
|
if (pageNum != undefined) {
|
this.$refs.myTable.search({ pageNum: pageNum })
|
} else {
|
this.$refs.myTable.search()
|
}
|
}
|
},
|
|
handleRAdd(){
|
if(isEmptyValue(this.selectedRootOrgId)){
|
this.$message.warning("请先选择一个顶级机构");
|
return;
|
}
|
// if(isEmptyValue(this.filterForm.rootCatalog)){
|
// this.$message.warning("请先选择题库大类");
|
// return;
|
// }
|
this.editSetting.id = null;
|
this.editSetting.title = "添加试卷";
|
this.editSetting.rootCatalog = this.filterForm.rootCatalog;
|
this.editSetting.orgId = this.selectedRootOrgId;
|
this.editSetting.show = true;
|
},
|
|
handleDelete(id){
|
this.$modal.confirm("确定要删除试卷吗?仅在测试时可以,正式只能禁用").then(()=>{
|
deletePaper(id).then(response => {
|
this.search(1);
|
this.$message.success("删除成功!");
|
});
|
}).catch(() => {});
|
}
|
}
|
}
|
</script>
|
|
<style scoped>
|
|
</style>
|