fix: edu/train
This commit is contained in:
parent
d2aba7d384
commit
553b2c9980
|
@ -16,8 +16,10 @@ VUE_APP_PJ = 'pf'
|
||||||
# VUE_APP_API_BASEURL = http://127.0.0.1:2226/api
|
# VUE_APP_API_BASEURL = http://127.0.0.1:2226/api
|
||||||
|
|
||||||
#测试环境
|
#测试环境
|
||||||
VUE_APP_API_BASEURL = http://49.232.14.174:2226/api
|
# VUE_APP_API_BASEURL = http://49.232.14.174:2226/api
|
||||||
VUE_APP_BASEURL = http://49.232.14.174:2226
|
VUE_APP_API_BASEURL = http://127.0.0.1:2226/api
|
||||||
|
# VUE_APP_BASEURL = http://49.232.14.174:2226
|
||||||
|
VUE_APP_BASEURL = http://127.0.0.1:2226
|
||||||
|
|
||||||
# #光子
|
# #光子
|
||||||
# VUE_APP_API_BASEURL = http://49.232.14.174:2250/api
|
# VUE_APP_API_BASEURL = http://49.232.14.174:2250/api
|
||||||
|
|
|
@ -118,7 +118,15 @@ export default {
|
||||||
return await http.post(
|
return await http.post(
|
||||||
`${config.API_URL}/edu/paper/`,
|
`${config.API_URL}/edu/paper/`,
|
||||||
data);
|
data);
|
||||||
}
|
},
|
||||||
|
},
|
||||||
|
upload: {
|
||||||
|
name:"上传试卷",
|
||||||
|
req: async function(data){
|
||||||
|
return await http.post(
|
||||||
|
`${config.API_URL}/edu/paper/upload`,
|
||||||
|
data);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
delete: {
|
delete: {
|
||||||
name: "删除",
|
name: "删除",
|
||||||
|
@ -169,5 +177,70 @@ export default {
|
||||||
`${config.API_URL}/edu/exam/${id}/`);
|
`${config.API_URL}/edu/exam/${id}/`);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
|
examrecord: {
|
||||||
|
list: {
|
||||||
|
name: "列表",
|
||||||
|
req: async function(data){
|
||||||
|
return await http.get(
|
||||||
|
`${config.API_URL}/edu/examrecord/`,
|
||||||
|
data
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
item: {
|
||||||
|
name: "获取详情",
|
||||||
|
req: async function(id){
|
||||||
|
return await http.get(
|
||||||
|
`${config.API_URL}/edu/examrecord/${id}/`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
delete: {
|
||||||
|
name: "删除",
|
||||||
|
req: async function(id){
|
||||||
|
return await http.delete(
|
||||||
|
`${config.API_URL}/edu/examrecord/${id}/`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
training: {
|
||||||
|
list: {
|
||||||
|
name: "列表",
|
||||||
|
req: async function(data){
|
||||||
|
return await http.get(
|
||||||
|
`${config.API_URL}/edu/training/`,
|
||||||
|
data
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
create: {
|
||||||
|
name: "创建",
|
||||||
|
req: async function(data){
|
||||||
|
return await http.post(
|
||||||
|
`${config.API_URL}/edu/training/`,
|
||||||
|
data
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
update: {
|
||||||
|
name: "更新",
|
||||||
|
req: async function(id, data){
|
||||||
|
return await http.put(
|
||||||
|
`${config.API_URL}/edu/training/${id}/`,
|
||||||
|
data
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
delete: {
|
||||||
|
name: "删除",
|
||||||
|
req: async function(id){
|
||||||
|
return await http.delete(
|
||||||
|
`${config.API_URL}/edu/training/${id}/`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -2422,6 +2422,26 @@ const routes = [
|
||||||
"perms": ["exam"]
|
"perms": ["exam"]
|
||||||
},
|
},
|
||||||
"component": "edu/exam"
|
"component": "edu/exam"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "train",
|
||||||
|
"path": "/edu/train",
|
||||||
|
"meta": {
|
||||||
|
"title": "线下培训",
|
||||||
|
"icon": "el-icon-notebook",
|
||||||
|
"perms": ["train"]
|
||||||
|
},
|
||||||
|
"component": "edu/train"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "examrecord",
|
||||||
|
"path": "/edu/examrecord",
|
||||||
|
"meta": {
|
||||||
|
"title": "考试记录",
|
||||||
|
"icon": "el-icon-notebook",
|
||||||
|
"perms": ["examrecord"]
|
||||||
|
},
|
||||||
|
"component": "edu/examrecord"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
@ -233,6 +233,12 @@ export default {
|
||||||
this.examForm = Object.assign({}, row);
|
this.examForm = Object.assign({}, row);
|
||||||
this.examDialog = true;
|
this.examDialog = true;
|
||||||
},
|
},
|
||||||
|
row_detail(row) {
|
||||||
|
this.$router.push({
|
||||||
|
path: "/edu/examrecord/",
|
||||||
|
query: { id: row.id },
|
||||||
|
});
|
||||||
|
},
|
||||||
table_del(row) {
|
table_del(row) {
|
||||||
this.$API.edu.exam.delete.req(row.id).then(() => {
|
this.$API.edu.exam.delete.req(row.id).then(() => {
|
||||||
this.handleQuery();
|
this.handleQuery();
|
||||||
|
|
|
@ -0,0 +1,120 @@
|
||||||
|
<template>
|
||||||
|
<el-container>
|
||||||
|
<el-header>
|
||||||
|
<div class="right-panel">
|
||||||
|
<el-input
|
||||||
|
style="margin-right: 5px"
|
||||||
|
v-model="query.search"
|
||||||
|
placeholder="考试名称或用户"
|
||||||
|
clearable
|
||||||
|
></el-input>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
icon="el-icon-search"
|
||||||
|
@click="handleQuery"
|
||||||
|
></el-button>
|
||||||
|
</div>
|
||||||
|
</el-header>
|
||||||
|
<el-main class="nopadding">
|
||||||
|
<scTable
|
||||||
|
ref="table"
|
||||||
|
:apiObj="apiObj"
|
||||||
|
row-key="id"
|
||||||
|
:query="query"
|
||||||
|
>
|
||||||
|
<el-table-column
|
||||||
|
label="考试名称"
|
||||||
|
prop="exam_name"
|
||||||
|
></el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="用户"
|
||||||
|
prop="create_by_name"
|
||||||
|
>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="得分"
|
||||||
|
prop="score"
|
||||||
|
></el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="总分"
|
||||||
|
prop="total_score"
|
||||||
|
></el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="耗时(秒)"
|
||||||
|
prop="took"
|
||||||
|
></el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="答题时间"
|
||||||
|
prop="start_time"
|
||||||
|
></el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="是否通过"
|
||||||
|
prop="is_pass"
|
||||||
|
:formatter="formatBoolean"
|
||||||
|
>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="操作"
|
||||||
|
fixed="right"
|
||||||
|
align="center"
|
||||||
|
width="150"
|
||||||
|
>
|
||||||
|
<template #default="scope">
|
||||||
|
|
||||||
|
<el-popconfirm
|
||||||
|
title="确定删除吗?"
|
||||||
|
@confirm="table_del(scope.row, scope.$index)"
|
||||||
|
>
|
||||||
|
<template #reference>
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
size="small"
|
||||||
|
v-auth="'examrecord.delete'"
|
||||||
|
type="danger"
|
||||||
|
>删除</el-button
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</el-popconfirm>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</scTable>
|
||||||
|
</el-main>
|
||||||
|
</el-container>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
paperOptions:[],
|
||||||
|
examDialog: false,
|
||||||
|
apiObj: this.$API.edu.examrecord.list,
|
||||||
|
query: {
|
||||||
|
search: "",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.getPaperOptions();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getPaperOptions() {
|
||||||
|
this.$API.edu.paper.list.req({
|
||||||
|
page: 0
|
||||||
|
}).then(res => {
|
||||||
|
this.paperOptions = res;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
formatBoolean(row) {
|
||||||
|
return row.isTrue ? '是' : '否';
|
||||||
|
},
|
||||||
|
handleQuery() {
|
||||||
|
this.$refs.table.queryData(this.query);
|
||||||
|
},
|
||||||
|
table_del(row) {
|
||||||
|
this.$API.edu.examrecord.delete.req(row.id).then(() => {
|
||||||
|
this.handleQuery();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
|
@ -157,6 +157,7 @@
|
||||||
<el-button type="primary" @click="choseQuestion"
|
<el-button type="primary" @click="choseQuestion"
|
||||||
>批量选择</el-button
|
>批量选择</el-button
|
||||||
>
|
>
|
||||||
|
<!-- <el-button type="primary" @click="uploadPaper">上传试题</el-button> -->
|
||||||
</div>
|
</div>
|
||||||
</el-header>
|
</el-header>
|
||||||
|
|
||||||
|
@ -214,16 +215,51 @@
|
||||||
></Question>
|
></Question>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<el-button type="primary" @click="choseConfirm"
|
<el-button type="primary" @click="choseConfirm"
|
||||||
>选择</el-button
|
>选择</el-button>
|
||||||
>
|
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
<!-- <el-button type="primary" @click="handleChoose1" icon="el-icon-plus" style="margin-right: 10px;">上传试题</el-button> -->
|
||||||
|
<el-dialog
|
||||||
|
v-model="impDialogVisible"
|
||||||
|
title="上传试题"
|
||||||
|
:left="'200px'"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
:height="'600px'"
|
||||||
|
>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-select v-model="impForm.question_types" style="margin-right: 10px;" placeholder="题目分类">
|
||||||
|
<el-option
|
||||||
|
v-for="item in type_list"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.name">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-col>
|
||||||
|
<sc-upload-file
|
||||||
|
v-model="impForm.doc_path"
|
||||||
|
:on-success="handleUpSuccess"
|
||||||
|
:multiple="false"
|
||||||
|
:limit="10"
|
||||||
|
tip="最多上传10个文件,单个文件不要超过10M"
|
||||||
|
>
|
||||||
|
<el-button type="primary" icon="el-icon-upload"> </el-button>
|
||||||
|
</sc-upload-file>
|
||||||
|
</el-row>
|
||||||
|
<div style="text-align: right">
|
||||||
|
<el-button type="danger" @click="impDialogVisible=false">取消</el-button>
|
||||||
|
<el-button type="primary" @click="impDialogVisible=false">确认</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
</el-container>
|
</el-container>
|
||||||
</el-drawer>
|
</el-drawer>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import Question from "./question";
|
import Question from "./question";
|
||||||
import { qTypeEnum, qLevelEnum } from "@/utils/enum";
|
import { qTypeEnum, qLevelEnum } from "@/utils/enum";
|
||||||
|
import { upload } from "@/api/model/edu"
|
||||||
|
|
||||||
const defaultForm = {
|
const defaultForm = {
|
||||||
name: "",
|
name: "",
|
||||||
danxuan_score: 2,
|
danxuan_score: 2,
|
||||||
|
@ -242,15 +278,24 @@ export default {
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
impForm:{
|
||||||
|
doc_path:'',
|
||||||
|
question_types:'',
|
||||||
|
},
|
||||||
qTypeEnum, qLevelEnum,
|
qTypeEnum, qLevelEnum,
|
||||||
mode: "add",
|
mode: "add",
|
||||||
isSaving: false,
|
isSaving: false,
|
||||||
questionCVisible: false,
|
questionCVisible: false,
|
||||||
|
impDialogVisible:false,
|
||||||
drawVisible: false,
|
drawVisible: false,
|
||||||
paperForm: Object.assign({}, defaultForm),
|
paperForm: Object.assign({}, defaultForm),
|
||||||
|
fileList: [],
|
||||||
|
type_list: []
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {},
|
mounted() {},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
open(mode = "add", data) {
|
open(mode = "add", data) {
|
||||||
if (mode == "add") {
|
if (mode == "add") {
|
||||||
|
@ -262,6 +307,19 @@ export default {
|
||||||
this.drawVisible = true;
|
this.drawVisible = true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
handleUpSuccess(res, file, filelist) {
|
||||||
|
let that =this;
|
||||||
|
if (res.code == 201){
|
||||||
|
that.impForm.doc_path = res.data.path;
|
||||||
|
console.log(that.impForm.doc_path);
|
||||||
|
} else {
|
||||||
|
this.$message.error(res.msg);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleRemove() {
|
||||||
|
this.fileList = [];
|
||||||
|
this.impForm.file = '';
|
||||||
|
},
|
||||||
choseQuestion() {
|
choseQuestion() {
|
||||||
this.questionCVisible = true;
|
this.questionCVisible = true;
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
|
@ -294,6 +352,9 @@ export default {
|
||||||
this.paperForm.detail.splice(index,1);
|
this.paperForm.detail.splice(index,1);
|
||||||
this.computeDetail();
|
this.computeDetail();
|
||||||
},
|
},
|
||||||
|
uploadPaper(){
|
||||||
|
this.impDialogVisible = true;
|
||||||
|
},
|
||||||
choseConfirm() {
|
choseConfirm() {
|
||||||
let sdata = this.$refs.QuestionChoseRef.checkList;
|
let sdata = this.$refs.QuestionChoseRef.checkList;
|
||||||
if (sdata.length == 0) {
|
if (sdata.length == 0) {
|
||||||
|
|
|
@ -0,0 +1,272 @@
|
||||||
|
<template>
|
||||||
|
<el-container>
|
||||||
|
<el-header>
|
||||||
|
<div class="left-panel">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
icon="el-icon-plus"
|
||||||
|
@click="table_add"
|
||||||
|
v-auth="'train.create'"
|
||||||
|
></el-button>
|
||||||
|
</div>
|
||||||
|
<div class="right-panel">
|
||||||
|
<el-input
|
||||||
|
style="margin-right: 5px"
|
||||||
|
v-model="query.search"
|
||||||
|
placeholder="名称"
|
||||||
|
clearable
|
||||||
|
></el-input>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
icon="el-icon-search"
|
||||||
|
@click="handleQuery"
|
||||||
|
></el-button>
|
||||||
|
</div>
|
||||||
|
</el-header>
|
||||||
|
<el-main class="nopadding">
|
||||||
|
<scTable
|
||||||
|
ref="table"
|
||||||
|
:apiObj="apiObj"
|
||||||
|
row-key="id"
|
||||||
|
:query="query"
|
||||||
|
>
|
||||||
|
<el-table-column
|
||||||
|
label="培训名称"
|
||||||
|
prop="name"
|
||||||
|
></el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="等级"
|
||||||
|
prop="level"
|
||||||
|
>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="时长(h)"
|
||||||
|
prop="duration"
|
||||||
|
></el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="开始时间"
|
||||||
|
prop="start_time"
|
||||||
|
></el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="结束时间"
|
||||||
|
prop="end_time"
|
||||||
|
></el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="地点"
|
||||||
|
prop="place"
|
||||||
|
></el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="内容描述"
|
||||||
|
prop="description"
|
||||||
|
></el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="参与部门"
|
||||||
|
prop="attend_departs"
|
||||||
|
></el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="是否公开"
|
||||||
|
width="80"
|
||||||
|
>
|
||||||
|
<template #default="scope">
|
||||||
|
<el-icon v-if="scope.row.is_public" color="green"
|
||||||
|
><CircleCheckFilled
|
||||||
|
/></el-icon>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="操作"
|
||||||
|
fixed="right"
|
||||||
|
align="center"
|
||||||
|
width="150"
|
||||||
|
>
|
||||||
|
<template #default="scope">
|
||||||
|
<!-- <el-button
|
||||||
|
link
|
||||||
|
size="small"
|
||||||
|
@click="table_edit(scope.row)"
|
||||||
|
v-auth="'exam.update'"
|
||||||
|
type="primary"
|
||||||
|
>编辑</el-button
|
||||||
|
> -->
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
size="small"
|
||||||
|
@click="row_detail(scope.row)"
|
||||||
|
type="primary"
|
||||||
|
>详情</el-button
|
||||||
|
>
|
||||||
|
<el-popconfirm
|
||||||
|
title="确定删除吗?"
|
||||||
|
@confirm="table_del(scope.row, scope.$index)"
|
||||||
|
>
|
||||||
|
<template #reference>
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
size="small"
|
||||||
|
v-auth="'exam.delete'"
|
||||||
|
type="danger"
|
||||||
|
>删除</el-button
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</el-popconfirm>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</scTable>
|
||||||
|
</el-main>
|
||||||
|
<el-dialog v-model="trainDialog" title="新增培训记录">
|
||||||
|
<el-form
|
||||||
|
:model="trainForm"
|
||||||
|
label-width="100px"
|
||||||
|
ref="questioncatForm"
|
||||||
|
>
|
||||||
|
<el-form-item label="培训名称" prop="name" required>
|
||||||
|
<el-input
|
||||||
|
v-model="trainForm.name"
|
||||||
|
clearable
|
||||||
|
></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="开始时间" prop="start_time" required>
|
||||||
|
<el-date-picker
|
||||||
|
v-model="trainForm.start_time"
|
||||||
|
type="datetime"
|
||||||
|
style="width:100%"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="结束时间" prop="end_time">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="trainForm.end_time"
|
||||||
|
type="datetime"
|
||||||
|
style="width:100%"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :span="8">
|
||||||
|
|
||||||
|
<!-- <el-form-item
|
||||||
|
label="级别"
|
||||||
|
prop="level"
|
||||||
|
required
|
||||||
|
>
|
||||||
|
<el-input-number
|
||||||
|
v-model="examForm.chance"
|
||||||
|
controls-position="right"
|
||||||
|
:min="1"
|
||||||
|
style="width: 100%"
|
||||||
|
></el-input-number>
|
||||||
|
</el-form-item> -->
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="16">
|
||||||
|
<el-form-item label="级别" prop="level" required>
|
||||||
|
<el-select
|
||||||
|
v-model="trainForm.level"
|
||||||
|
filterable
|
||||||
|
reserve-keyword
|
||||||
|
style="width: 100%"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in levelOptions"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item
|
||||||
|
label="是否公开"
|
||||||
|
prop="is_public"
|
||||||
|
required
|
||||||
|
>
|
||||||
|
<el-switch v-model="trainForm.is_public"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
:loading="examSaving"
|
||||||
|
@click="examSubmit()"
|
||||||
|
>保 存</el-button
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</el-container>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
const defaultExam = {chance: 1, is_public:false}
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
paperOptions:[],
|
||||||
|
examDialog: false,
|
||||||
|
apiObj: this.$API.edu.training.list,
|
||||||
|
query: {
|
||||||
|
search: "",
|
||||||
|
},
|
||||||
|
levelOptions:[
|
||||||
|
{key:'岗位',value:10},
|
||||||
|
{key:'班组',value:20},
|
||||||
|
{key:'部门',value:30},
|
||||||
|
{key:'公司',value:40}
|
||||||
|
],
|
||||||
|
examForm: Object.assign({}, defaultExam),
|
||||||
|
};
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.getPaperOptions();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getPaperOptions() {
|
||||||
|
this.$API.edu.paper.list.req({
|
||||||
|
page: 0
|
||||||
|
}).then(res => {
|
||||||
|
this.paperOptions = res;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleQuery() {
|
||||||
|
this.$refs.table.queryData(this.query);
|
||||||
|
},
|
||||||
|
table_add() {
|
||||||
|
this.examForm = Object.assign({}, defaultExam);
|
||||||
|
this.examDialog = true;
|
||||||
|
},
|
||||||
|
table_edit(row) {
|
||||||
|
this.examForm = Object.assign({}, row);
|
||||||
|
this.examDialog = true;
|
||||||
|
},
|
||||||
|
table_del(row) {
|
||||||
|
this.$API.edu.exam.delete.req(row.id).then(() => {
|
||||||
|
this.handleQuery();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
examSubmit() {
|
||||||
|
this.examSaving = true;
|
||||||
|
if (this.examForm.id){
|
||||||
|
this.$API.edu.exam.update.req(this.examForm.id, this.examForm).then(res=>{
|
||||||
|
this.$message.success("更新成功");
|
||||||
|
this.examSaving = false;
|
||||||
|
this.examDialog = false;
|
||||||
|
this.handleQuery();
|
||||||
|
}).catch(e=>{this.examSaving=false})
|
||||||
|
}else{
|
||||||
|
this.$API.edu.exam.create.req(this.examForm).then(res=>{
|
||||||
|
this.$message.success("创建成功");
|
||||||
|
this.examSaving = false;
|
||||||
|
this.examDialog = false;
|
||||||
|
this.handleQuery();
|
||||||
|
}).catch(err=>{
|
||||||
|
this.examSaving = false;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
Loading…
Reference in New Issue