This commit is contained in:
parent
34dea64d3d
commit
d01a56caec
|
@ -16,17 +16,17 @@
|
||||||
:value="item.value"
|
:value="item.value"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="value"
|
v-model="value"
|
||||||
type="daterange"
|
type="daterange"
|
||||||
align="right"
|
align="right"
|
||||||
unlink-panels
|
unlink-panels
|
||||||
range-separator="至"
|
range-separator="至"
|
||||||
start-placeholder="开始日期"
|
start-placeholder="开始日期"
|
||||||
end-placeholder="结束日期"
|
end-placeholder="结束日期"
|
||||||
:picker-options="pickerOptions">
|
:picker-options="pickerOptions"
|
||||||
</el-date-picker>
|
/>
|
||||||
<el-input
|
<el-input
|
||||||
v-model="listQuery.search"
|
v-model="listQuery.search"
|
||||||
placeholder="输入用户名或用户单位名搜索"
|
placeholder="输入用户名或用户单位名搜索"
|
||||||
style="width: 200px;"
|
style="width: 200px;"
|
||||||
|
@ -39,30 +39,29 @@
|
||||||
icon="el-icon-refresh-left"
|
icon="el-icon-refresh-left"
|
||||||
@click="resetFilter"
|
@click="resetFilter"
|
||||||
>刷新重置</el-button>
|
>刷新重置</el-button>
|
||||||
<el-button type="primary" icon="el-icon-download" @click="exportTest" >导出Excel</el-button>
|
<el-button type="primary" icon="el-icon-download" @click="exportTest">导出Excel</el-button>
|
||||||
<div style="margin-top:10px">
|
<div style="margin-top:10px" />
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<el-table
|
<el-table
|
||||||
|
v-loading="listLoading"
|
||||||
:data="tableData.results"
|
:data="tableData.results"
|
||||||
style="width: 100%;margin-top:10px;"
|
style="width: 100%;margin-top:10px;"
|
||||||
border
|
border
|
||||||
stripe
|
stripe
|
||||||
fit
|
fit
|
||||||
v-loading="listLoading"
|
|
||||||
highlight-current-row
|
highlight-current-row
|
||||||
max-height="600"
|
max-height="600"
|
||||||
@sort-change="changeSort"
|
@sort-change="changeSort"
|
||||||
>
|
>
|
||||||
<el-table-column type="index" width="50"></el-table-column>
|
<el-table-column type="index" width="50" />
|
||||||
<el-table-column align="left" label="类型">
|
<el-table-column align="left" label="类型">
|
||||||
<template slot-scope="scope">{{ scope.row.type }}</template>
|
<template slot-scope="scope">{{ scope.row.type }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column align="left" label="用户">
|
<el-table-column align="left" label="用户">
|
||||||
<template slot-scope="scope" v-if="scope.row.consumer_detail">{{ scope.row.consumer_detail.name }}</template>
|
<template v-if="scope.row.consumer_detail" slot-scope="scope">{{ scope.row.consumer_detail.name }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column align="left" label="单位">
|
<el-table-column align="left" label="单位">
|
||||||
<template slot-scope="scope" v-if="scope.row.consumer_detail">{{ scope.row.consumer_detail.company_name }}</template>
|
<template v-if="scope.row.consumer_detail" slot-scope="scope">{{ scope.row.consumer_detail.company_name }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column align="left" label="工作类别">
|
<el-table-column align="left" label="工作类别">
|
||||||
<template slot-scope="scope">{{ scope.row.workscope_name }}</template>
|
<template slot-scope="scope">{{ scope.row.workscope_name }}</template>
|
||||||
|
@ -70,16 +69,16 @@
|
||||||
<el-table-column align="left" label="所属考试">
|
<el-table-column align="left" label="所属考试">
|
||||||
<template slot-scope="scope">{{ scope.row.exam_name }}</template>
|
<template slot-scope="scope">{{ scope.row.exam_name }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column align="left" label="是否通过" sortable='custom' prop="is_pass">
|
<el-table-column align="left" label="是否通过" sortable="custom" prop="is_pass">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-tag v-if="scope.row.is_pass" type="success">是</el-tag>
|
<el-tag v-if="scope.row.is_pass" type="success">是</el-tag>
|
||||||
<el-tag v-else type="danger">否</el-tag>
|
<el-tag v-else type="danger">否</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column align="left" label="得分" sortable='custom' prop="score">
|
<el-table-column align="left" label="得分" sortable="custom" prop="score">
|
||||||
<template slot-scope="scope">{{ scope.row.score }}</template>
|
<template slot-scope="scope">{{ scope.row.score }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column align="left" label="耗时(时分秒)" sortable='custom' prop="took">
|
<el-table-column align="left" label="耗时(时分秒)" sortable="custom" prop="took">
|
||||||
<template slot-scope="scope">{{ scope.row.took_format }}</template>
|
<template slot-scope="scope">{{ scope.row.took_format }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column align="left" label="答题时间">
|
<el-table-column align="left" label="答题时间">
|
||||||
|
@ -88,32 +87,32 @@
|
||||||
<el-table-column align="center" label="操作" fixed="right">
|
<el-table-column align="center" label="操作" fixed="right">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button
|
<el-button
|
||||||
v-if="scope.row.type=='正式考试'&&scope.row.candidate_==null"
|
v-if="scope.row.type=='正式考试'&&scope.row.candidate_==null"
|
||||||
type="primary"
|
type="primary"
|
||||||
size="small"
|
size="small"
|
||||||
@click="handleIssue(scope)"
|
|
||||||
plain
|
plain
|
||||||
|
@click="handleIssue(scope)"
|
||||||
>发证</el-button>
|
>发证</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
v-if="scope.row.type=='正式考试'"
|
v-if="scope.row.type=='正式考试'"
|
||||||
type="primary"
|
type="primary"
|
||||||
size="small"
|
size="small"
|
||||||
@click="handleExport(scope)"
|
|
||||||
plain
|
plain
|
||||||
|
@click="handleExport(scope)"
|
||||||
>生成Word</el-button>
|
>生成Word</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
v-if="scope.row.type=='正式考试'"
|
v-if="scope.row.type=='正式考试'"
|
||||||
type="warning"
|
type="warning"
|
||||||
size="small"
|
size="small"
|
||||||
@click="handleExport2(scope)"
|
|
||||||
plain
|
plain
|
||||||
|
@click="handleExport2(scope)"
|
||||||
>重新生成</el-button>
|
>重新生成</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
v-if="scope.row.type=='正式考试'"
|
v-if="scope.row.type=='正式考试'"
|
||||||
type="danger"
|
type="danger"
|
||||||
size="small"
|
size="small"
|
||||||
@click="handleDelete(scope)"
|
|
||||||
plain
|
plain
|
||||||
|
@click="handleDelete(scope)"
|
||||||
>删除</el-button>
|
>删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
@ -129,176 +128,179 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getExamTestlist, exportTest, exportwTest, deleteExamtest, issue } from "@/api/examtest";
|
import { getExamTestlist, exportTest, exportwTest, deleteExamtest, issue } from '@/api/examtest'
|
||||||
import checkPermission from "@/utils/permission";
|
import checkPermission from '@/utils/permission'
|
||||||
import Pagination from "@/components/Pagination";
|
import Pagination from '@/components/Pagination'
|
||||||
|
|
||||||
const listQuery = {
|
const listQuery = {
|
||||||
page: 1,
|
page: 1,
|
||||||
limit: 20,
|
limit: 20,
|
||||||
type:'正式考试',
|
type: '正式考试',
|
||||||
workscope__can_examself: false,
|
workscope__can_examself: false,
|
||||||
search:''
|
search: ''
|
||||||
};
|
}
|
||||||
export default {
|
export default {
|
||||||
components: { Pagination },
|
components: { Pagination },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
listQuery: Object.assign({}, listQuery),
|
listQuery: Object.assign({}, listQuery),
|
||||||
tableData: {
|
tableData: {
|
||||||
count:0,
|
count: 0,
|
||||||
results:[],
|
results: []
|
||||||
},
|
},
|
||||||
listLoading: true,
|
listLoading: true,
|
||||||
typeOptions: [
|
typeOptions: [
|
||||||
{ key: "自助模考", label: "自助模考", value: "自助模考" },
|
{ key: '自助模考', label: '自助模考', value: '自助模考' },
|
||||||
{ key: "押卷模考", label: "押卷模考", value: "押卷模考"},
|
{ key: '押卷模考', label: '押卷模考', value: '押卷模考' },
|
||||||
{ key: "正式考试", label: "正式考试", value: "正式考试"},
|
{ key: '正式考试', label: '正式考试', value: '正式考试' }
|
||||||
],
|
],
|
||||||
passOptions: [
|
passOptions: [
|
||||||
{ key: true, label: "通过", value: true },
|
{ key: true, label: '通过', value: true },
|
||||||
{ key: false, label: "未通过", value: false},
|
{ key: false, label: '未通过', value: false }
|
||||||
],
|
],
|
||||||
pickerOptions: {
|
pickerOptions: {
|
||||||
shortcuts: [{
|
shortcuts: [{
|
||||||
text: '最近一天',
|
text: '最近一天',
|
||||||
onClick(picker) {
|
onClick(picker) {
|
||||||
const end = new Date();
|
const end = new Date()
|
||||||
const start = new Date();
|
const start = new Date()
|
||||||
start.setTime(start.getTime() - 3600 * 1000 * 24);
|
start.setTime(start.getTime() - 3600 * 1000 * 24)
|
||||||
picker.$emit('pick', [start, end]);
|
picker.$emit('pick', [start, end])
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
text: '最近一周',
|
text: '最近一周',
|
||||||
onClick(picker) {
|
onClick(picker) {
|
||||||
const end = new Date();
|
const end = new Date()
|
||||||
const start = new Date();
|
const start = new Date()
|
||||||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
|
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
|
||||||
picker.$emit('pick', [start, end]);
|
picker.$emit('pick', [start, end])
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
text: '最近一个月',
|
text: '最近一个月',
|
||||||
onClick(picker) {
|
onClick(picker) {
|
||||||
const end = new Date();
|
const end = new Date()
|
||||||
const start = new Date();
|
const start = new Date()
|
||||||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
|
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
|
||||||
picker.$emit('pick', [start, end]);
|
picker.$emit('pick', [start, end])
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
text: '最近三个月',
|
text: '最近三个月',
|
||||||
onClick(picker) {
|
onClick(picker) {
|
||||||
const end = new Date();
|
const end = new Date()
|
||||||
const start = new Date();
|
const start = new Date()
|
||||||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
|
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
|
||||||
picker.$emit('pick', [start, end]);
|
picker.$emit('pick', [start, end])
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
value: '',
|
value: ''
|
||||||
};
|
}
|
||||||
},
|
},
|
||||||
computed: {},
|
computed: {},
|
||||||
watch:{
|
watch: {
|
||||||
value:'setTimeRange',
|
value: 'setTimeRange'
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getQuery();
|
this.getQuery()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
checkPermission,
|
checkPermission,
|
||||||
getQuery() {
|
getQuery() {
|
||||||
if(this.$route.params.exam){
|
if (this.$route.params.exam) {
|
||||||
this.listQuery.exam = this.$route.params.exam;
|
this.listQuery.exam = this.$route.params.exam
|
||||||
this.getList()
|
this.getList()
|
||||||
}else{
|
} else {
|
||||||
this.getList()
|
this.getList()
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
getList() {
|
getList() {
|
||||||
this.listLoading = true;
|
this.listLoading = true
|
||||||
getExamTestlist(this.listQuery).then(response => {
|
getExamTestlist(this.listQuery).then(response => {
|
||||||
this.tableData = response.data;
|
this.tableData = response.data
|
||||||
this.listLoading = false;
|
this.listLoading = false
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
handleFilter() {
|
handleFilter() {
|
||||||
this.listQuery.page = 1;
|
this.listQuery.page = 1
|
||||||
this.getList();
|
this.getList()
|
||||||
},
|
},
|
||||||
resetFilter() {
|
resetFilter() {
|
||||||
this.listQuery = {
|
this.listQuery = {
|
||||||
page: 1,
|
page: 1,
|
||||||
limit: 20,
|
limit: 20,
|
||||||
type:'正式考试',
|
type: '正式考试',
|
||||||
search:'',
|
search: ''
|
||||||
};
|
}
|
||||||
this.value = []
|
this.value = []
|
||||||
this.getList();
|
this.getList()
|
||||||
},
|
},
|
||||||
handleExport(scope) {
|
handleExport(scope) {
|
||||||
const loading = this.$loading({text: '正在生成word...',});
|
const loading = this.$loading({ text: '正在生成word...' })
|
||||||
exportwTest(scope.row.id).then(res=>{
|
exportwTest(scope.row.id).then(res => {
|
||||||
loading.close()
|
loading.close()
|
||||||
window.open(res.data.path, "_blank");
|
window.open(res.data.path, '_blank')
|
||||||
}).catch(e=>{loading.close()})
|
}).catch(e => { loading.close() })
|
||||||
},
|
},
|
||||||
handleDelete(scope){
|
handleDelete(scope) {
|
||||||
this.$confirm("确认删除该考试记录吗?将丢失数据!", "警告", {
|
this.$confirm('确认删除该考试记录吗?将丢失数据!', '警告', {
|
||||||
confirmButtonText: "确认",
|
confirmButtonText: '确认',
|
||||||
cancelButtonText: "取消",
|
cancelButtonText: '取消',
|
||||||
type: "error"
|
type: 'error'
|
||||||
})
|
})
|
||||||
.then(async () => {
|
.then(async() => {
|
||||||
await deleteExamtest(scope.row.id);
|
await deleteExamtest(scope.row.id)
|
||||||
this.getList()
|
this.getList()
|
||||||
this.$message({
|
this.$message({
|
||||||
type: "success",
|
type: 'success',
|
||||||
message: "成功删除!"
|
message: '成功删除!'
|
||||||
});
|
})
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
console.error(err);
|
console.error(err)
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
handleExport2(scope) {
|
handleExport2(scope) {
|
||||||
const loading = this.$loading({text: '正在重新生成word...',});
|
const loading = this.$loading({ text: '正在重新生成word...' })
|
||||||
exportwTest(scope.row.id, {anew:true}).then(res=>{
|
exportwTest(scope.row.id, { anew: true }).then(res => {
|
||||||
loading.close()
|
loading.close()
|
||||||
window.open(res.data.path, "_blank");
|
window.open(res.data.path, '_blank')
|
||||||
}).catch(e=>{loading.close()})
|
}).catch(e => { loading.close() })
|
||||||
},
|
},
|
||||||
exportTest() {
|
exportTest() {
|
||||||
const loading = this.$loading();
|
const loading = this.$loading()
|
||||||
exportTest(this.listQuery).then(response => {
|
exportTest(this.listQuery).then(response => {
|
||||||
loading.close()
|
loading.close()
|
||||||
window.open(response.data.path, "_blank");
|
window.open(response.data.path, '_blank')
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
handleIssue(scope) {
|
handleIssue(scope) {
|
||||||
const loading = this.$loading({text: '正在发证..',});
|
if (scope.row.is_pass === true) {
|
||||||
issue(scope.row.id).then(res=>{
|
const loading = this.$loading({ text: '正在发证..' })
|
||||||
loading.close()
|
issue(scope.row.id).then(res => {
|
||||||
this.$message.success('发证成功')
|
loading.close()
|
||||||
scope.row.candidate_ = res.data
|
this.$message.success('发证成功')
|
||||||
}).catch(e=>{loading.close()})
|
scope.row.candidate_ = res.data
|
||||||
|
}).catch(e => { loading.close() })
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.$message.error('未通过考试,发证失败!')
|
||||||
|
}
|
||||||
},
|
},
|
||||||
setTimeRange(){
|
setTimeRange() {
|
||||||
this.listQuery.start = this.value[0],
|
this.listQuery.start = this.value[0],
|
||||||
this.listQuery.end = this.value[1],
|
this.listQuery.end = this.value[1],
|
||||||
this.getList()
|
this.getList()
|
||||||
},
|
},
|
||||||
changeSort (val) {
|
changeSort(val) {
|
||||||
if(val.order == 'ascending'){
|
if (val.order == 'ascending') {
|
||||||
this.listQuery.ordering = val.prop
|
this.listQuery.ordering = val.prop
|
||||||
}else{
|
} else {
|
||||||
this.listQuery.ordering = '-' + val.prop
|
this.listQuery.ordering = '-' + val.prop
|
||||||
}
|
}
|
||||||
|
|
||||||
this.getList()
|
|
||||||
|
|
||||||
},
|
this.getList()
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,81 +1,81 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<div style="margin-top:10px">
|
<div style="margin-top:10px">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="listQuery.search"
|
v-model="listQuery.search"
|
||||||
placeholder="输入考试名称进行搜索"
|
placeholder="输入考试名称进行搜索"
|
||||||
style="width: 300px;"
|
style="width: 300px;"
|
||||||
class="filter-item"
|
class="filter-item"
|
||||||
@keyup.enter.native="handleFilter"
|
@keyup.enter.native="handleFilter"
|
||||||
/>
|
/>
|
||||||
<el-button type="primary" @click="handleAdd" icon="el-icon-plus" v-if ="checkPermission(['exam_create'])">新增</el-button>
|
<el-button v-if="checkPermission(['exam_create'])" type="primary" icon="el-icon-plus" @click="handleAdd">新增</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
class="filter-item"
|
class="filter-item"
|
||||||
type="primary"
|
type="primary"
|
||||||
icon="el-icon-refresh-left"
|
icon="el-icon-refresh-left"
|
||||||
@click="resetFilter"
|
@click="resetFilter"
|
||||||
>刷新重置</el-button>
|
>刷新重置</el-button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-table
|
<el-table
|
||||||
:data="tableData.results"
|
v-loading="listLoading"
|
||||||
style="width: 100%;margin-top:10px;"
|
:data="tableData.results"
|
||||||
border
|
style="width: 100%;margin-top:10px;"
|
||||||
fit
|
border
|
||||||
v-loading="listLoading"
|
fit
|
||||||
highlight-current-row
|
highlight-current-row
|
||||||
max-height="600"
|
max-height="600"
|
||||||
row-key="id"
|
row-key="id"
|
||||||
default-expand-all
|
default-expand-all
|
||||||
>
|
>
|
||||||
<el-table-column label="考试名称">
|
<el-table-column label="考试名称">
|
||||||
<template slot-scope="scope">{{ scope.row.name }}</template>
|
<template slot-scope="scope">{{ scope.row.name }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="考试编号">
|
<el-table-column label="考试编号">
|
||||||
<template slot-scope="scope">{{ scope.row.code }}</template>
|
<template slot-scope="scope">{{ scope.row.code }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="考试地点">
|
<el-table-column label="考试地点">
|
||||||
<template slot-scope="scope">{{ scope.row.place }}</template>
|
<template slot-scope="scope">{{ scope.row.place }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="工作类别">
|
<el-table-column label="工作类别">
|
||||||
<template slot-scope="scope">{{ scope.row.workscope_name }}</template>
|
<template slot-scope="scope">{{ scope.row.workscope_name }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="参考机会">
|
<el-table-column label="参考机会">
|
||||||
<template slot-scope="scope">{{ scope.row.chance }}</template>
|
<template slot-scope="scope">{{ scope.row.chance }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="开启时间">
|
<el-table-column label="开启时间">
|
||||||
<template slot-scope="scope">{{ scope.row.opentime }}</template>
|
<template slot-scope="scope">{{ scope.row.opentime }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="关闭时间">
|
<el-table-column label="关闭时间">
|
||||||
<template slot-scope="scope">{{ scope.row.closetime }}</template>
|
<template slot-scope="scope">{{ scope.row.closetime }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="创建人">
|
<el-table-column label="创建人">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{ scope.row.create_admin_username }}</span>
|
<span>{{ scope.row.create_admin_username }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column align="center" label="操作" fixed="right">
|
<el-table-column align="center" label="操作" fixed="right">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
size="small"
|
size="small"
|
||||||
@click="handleView(scope)"
|
:disabled="!checkPermission(['exam_view'])"
|
||||||
:disabled="!checkPermission(['exam_view'])"
|
@click="handleView(scope)"
|
||||||
>详情</el-button>
|
>详情</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
size="small"
|
size="small"
|
||||||
@click="handleEdit(scope)"
|
:disabled="!checkPermission(['exam_update'])"
|
||||||
:disabled="!checkPermission(['exam_update'])"
|
@click="handleEdit(scope)"
|
||||||
>编辑</el-button>
|
>编辑</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
type="danger"
|
type="danger"
|
||||||
size="small"
|
size="small"
|
||||||
@click="handleDelete(scope)"
|
:disabled="!checkPermission(['exam_delete'])"
|
||||||
:disabled="!checkPermission(['exam_delete'])"
|
@click="handleDelete(scope)"
|
||||||
>删除</el-button>
|
>删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
<pagination
|
<pagination
|
||||||
v-show="tableData.count>0"
|
v-show="tableData.count>0"
|
||||||
:total="tableData.count"
|
:total="tableData.count"
|
||||||
|
@ -83,142 +83,153 @@
|
||||||
:limit.sync="listQuery.limit"
|
:limit.sync="listQuery.limit"
|
||||||
@pagination="getList"
|
@pagination="getList"
|
||||||
/>
|
/>
|
||||||
<el-dialog :visible.sync="dialogVisible" :title="dialogType==='edit'?'编辑考试':'新增考试'" >
|
<el-dialog :visible.sync="dialogVisible" :title="dialogType==='edit'?'编辑考试':'新增考试'">
|
||||||
<el-form :model="exam" label-width="80px" :rules="rule1" ref="examForm">
|
<el-form ref="examForm" :model="exam" label-width="80px" :rules="rule1">
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="名称" prop="name">
|
<el-form-item label="名称" prop="name">
|
||||||
<el-input v-model="exam.name" placeholder="名称" />
|
<el-input v-model="exam.name" placeholder="名称" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="考试地点" prop="place">
|
<el-form-item label="考试地点" prop="place">
|
||||||
<el-input v-model="exam.place" placeholder="考试地点" />
|
<el-input v-model="exam.place" placeholder="考试地点" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-row>
|
<el-row>
|
||||||
|
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="工作类别" prop="workscope" >
|
<el-form-item label="工作类别" prop="workscope">
|
||||||
<el-select v-model="exam.workscope" placeholder="请选择工作类别" style="width:100%">
|
<el-select v-model="exam.workscope" placeholder="请选择工作类别" style="width:100%">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in workscopeOptions"
|
v-for="item in workscopeOptions"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:label="item.name"
|
:label="item.name"
|
||||||
:value="item.id"
|
:value="item.id"
|
||||||
></el-option>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="选定试卷" prop="paper" >
|
<el-form-item label="选定试卷" prop="paper">
|
||||||
<el-select v-model="exam.paper" placeholder="可指定试卷" style="width:100%" clearable>
|
<el-select v-model="exam.paper" placeholder="可指定试卷" style="width:100%" clearable>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in paperOptions"
|
v-for="item in paperOptions"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:label="item.name"
|
:label="item.name"
|
||||||
:value="item.id"
|
:value="item.id"
|
||||||
></el-option>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="开启时间" prop="opentime">
|
<el-form-item label="开启时间" prop="opentime">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="exam.opentime"
|
v-model="exam.opentime"
|
||||||
type="datetime"
|
type="datetime"
|
||||||
placeholder="开启时间"
|
placeholder="开启时间"
|
||||||
style="width:100%">
|
style="width:100%"
|
||||||
</el-date-picker>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="关闭时间" prop="closetime">
|
<el-form-item label="关闭时间" prop="closetime">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="exam.closetime"
|
v-model="exam.closetime"
|
||||||
type="datetime"
|
type="datetime"
|
||||||
placeholder="关闭时间"
|
placeholder="关闭时间"
|
||||||
style="width:100%"
|
style="width:100%"
|
||||||
></el-date-picker>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="参考机会" prop="chance">
|
<el-form-item label="参考机会" prop="chance">
|
||||||
<el-input-number v-model="exam.chance" placeholder="参考机会" :min="1"/>
|
<el-input-number v-model="exam.chance" placeholder="参考机会" :min="1" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="仅培训班学员" prop="only_vip" label-width="100px">
|
<el-form-item label="仅培训班学员" prop="only_vip" label-width="100px">
|
||||||
<el-switch v-model="exam.only_vip"></el-switch>
|
<el-switch v-model="exam.only_vip" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="自动发证" prop="auto_issue">
|
<el-form-item label="自动发证" prop="auto_issue">
|
||||||
<el-switch v-model="exam.auto_issue"></el-switch>
|
<el-switch v-model="exam.auto_issue" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="证书模板">
|
<el-form-item label="证书模板">
|
||||||
<el-select v-model="exam.cert_template" placeholder="证书模板" clearable>
|
|
||||||
<el-option v-for="item in certTemplateOptions" :key="item.value">{{ item.label }}</el-option>
|
<el-select v-if=" uploadUrl=='https://qw.ctc-zc.com/api'" v-model="exam.cert_template" placeholder="证书模板" clearable>
|
||||||
</el-select>
|
<el-option
|
||||||
</el-form-item>
|
v-for="item in certTemplateOptionsqw"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</el-select>
|
||||||
|
<el-select v-else v-model="exam.cert_template" placeholder="证书模板" clearable>
|
||||||
|
<el-option
|
||||||
|
v-for="item in certTemplateOptions"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-divider></el-divider>
|
|
||||||
<el-row>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="监考人姓名" prop="proctor_name" label-width="120px">
|
|
||||||
<el-input v-model="exam.proctor_name" placeholder="监考人姓名" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="监考人联系方式" prop="proctor_phone" label-width="120px">
|
|
||||||
<el-input v-model="exam.proctor_phone" placeholder="监考人联系方式" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
|
|
||||||
|
<el-divider />
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="监考人姓名" prop="proctor_name" label-width="120px">
|
||||||
|
<el-input v-model="exam.proctor_name" placeholder="监考人姓名" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="监考人联系方式" prop="proctor_phone" label-width="120px">
|
||||||
|
<el-input v-model="exam.proctor_phone" placeholder="监考人联系方式" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<el-form-item label="培训名称" prop="train_name">
|
<el-form-item label="培训名称" prop="train_name">
|
||||||
<el-input v-model="exam.train_name" placeholder="培训名称" />
|
<el-input v-model="exam.train_name" placeholder="培训名称" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="培训开始" prop="train_start_date">
|
<el-form-item label="培训开始" prop="train_start_date">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="exam.train_start_date"
|
v-model="exam.train_start_date"
|
||||||
type="date"
|
type="date"
|
||||||
placeholder="培训开始"
|
placeholder="培训开始"
|
||||||
value-format="yyyy-MM-dd"
|
value-format="yyyy-MM-dd"
|
||||||
style="width:100%">
|
style="width:100%"
|
||||||
</el-date-picker>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="培训结束" prop="train_end_date">
|
<el-form-item label="培训结束" prop="train_end_date">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="exam.train_end_date"
|
v-model="exam.train_end_date"
|
||||||
type="date"
|
type="date"
|
||||||
placeholder="培训结束"
|
placeholder="培训结束"
|
||||||
value-format="yyyy-MM-dd"
|
value-format="yyyy-MM-dd"
|
||||||
style="width:100%"
|
style="width:100%"
|
||||||
></el-date-picker>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
|
|
||||||
</el-form>
|
</el-form>
|
||||||
<div style="text-align:right;">
|
<div style="text-align:right;">
|
||||||
|
@ -230,77 +241,80 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getexamlist, createexam, deleteexam, updateexam} from "@/api/exam";
|
import { getexamlist, createexam, deleteexam, updateexam } from '@/api/exam'
|
||||||
import { getWorkScopeAll, getPaperList } from "@/api/examtest"
|
import { getWorkScopeAll, getPaperList } from '@/api/examtest'
|
||||||
import { deepClone } from "@/utils";
|
import { deepClone } from '@/utils'
|
||||||
import checkPermission from "@/utils/permission";
|
import checkPermission from '@/utils/permission'
|
||||||
import Pagination from "@/components/Pagination"
|
import Pagination from '@/components/Pagination'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const defaultexam = {
|
const defaultexam = {
|
||||||
id: "",
|
id: '',
|
||||||
name: "",
|
name: '',
|
||||||
place: "",
|
place: '',
|
||||||
opentime: null,
|
opentime: null,
|
||||||
closetime: null,
|
closetime: null,
|
||||||
chance:3,
|
chance: 3,
|
||||||
only_vip:false,
|
only_vip: false,
|
||||||
cert_template:null,
|
cert_template: null,
|
||||||
auto_issue:false
|
auto_issue: false
|
||||||
};
|
}
|
||||||
const listQuery = {
|
const listQuery = {
|
||||||
page: 1,
|
page: 1,
|
||||||
limit: 20,
|
limit: 20,
|
||||||
search: ""
|
search: ''
|
||||||
}
|
}
|
||||||
export default {
|
export default {
|
||||||
components: { Pagination },
|
components: { Pagination },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
selects:[],
|
uploadUrl: process.env.VUE_APP_BASE_API,
|
||||||
|
selects: [],
|
||||||
exam: {
|
exam: {
|
||||||
id: "",
|
id: '',
|
||||||
name: "",
|
name: ''
|
||||||
},
|
},
|
||||||
certTemplateOptions:[
|
certTemplateOptionsqw: [
|
||||||
{value: 1, label: "模板1"},
|
{ value: 3, label: '气味评价证书' },
|
||||||
{value: 2, label: "模板2"}
|
{ value: 4, label: '气味检验证书' }
|
||||||
],
|
],
|
||||||
listQuery:listQuery,
|
certTemplateOptions: [
|
||||||
tableData: {count:0},
|
{ value: 1, label: '模板1' },
|
||||||
|
{ value: 2, label: '模板2' }
|
||||||
|
],
|
||||||
|
listQuery: listQuery,
|
||||||
|
tableData: { count: 0 },
|
||||||
listLoading: true,
|
listLoading: true,
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
dialogType: "new",
|
dialogType: 'new',
|
||||||
workscopeOptions:[],
|
workscopeOptions: [],
|
||||||
paperOptions:[],
|
paperOptions: [],
|
||||||
rule1: {
|
rule1: {
|
||||||
name: [{ required: true, message: "请输入", trigger: "blur" }],
|
name: [{ required: true, message: '请输入', trigger: 'blur' }],
|
||||||
place: [{ required: true, message: "请输入", trigger: "change" }],
|
place: [{ required: true, message: '请输入', trigger: 'change' }],
|
||||||
workscope: [{ required: true, message: "请选择", trigger: "change" }],
|
workscope: [{ required: true, message: '请选择', trigger: 'change' }],
|
||||||
opentime: [{ required: true, message: "请选择", trigger: "change" }],
|
opentime: [{ required: true, message: '请选择', trigger: 'change' }],
|
||||||
closetime: [{ required: true, message: "请选择", trigger: "change" }],
|
closetime: [{ required: true, message: '请选择', trigger: 'change' }],
|
||||||
proctor_name: [{ required: true, message: "请输入", trigger: "change" }],
|
proctor_name: [{ required: true, message: '请输入', trigger: 'change' }],
|
||||||
proctor_phone: [{ required: true, message: "请输入", trigger: "change" }],
|
proctor_phone: [{ required: true, message: '请输入', trigger: 'change' }],
|
||||||
chance: [{ required: true, message: "请输入", trigger: "change" }]
|
chance: [{ required: true, message: '请输入', trigger: 'change' }]
|
||||||
},
|
}
|
||||||
};
|
}
|
||||||
},
|
},
|
||||||
computed: {},
|
computed: {},
|
||||||
created() {
|
created() {
|
||||||
this.getList();
|
this.getList()
|
||||||
this.getworkscopeOptions();
|
this.getworkscopeOptions()
|
||||||
this.getPaperOptions();
|
this.getPaperOptions()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
checkPermission,
|
checkPermission,
|
||||||
getworkscopeOptions(){
|
getworkscopeOptions() {
|
||||||
getWorkScopeAll({can_exam:true}).then(res=>{
|
getWorkScopeAll({ can_exam: true }).then(res => {
|
||||||
this.workscopeOptions = res.data
|
this.workscopeOptions = res.data
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getPaperOptions(){
|
getPaperOptions() {
|
||||||
getPaperList({pageoff:true}).then(res=>{
|
getPaperList({ pageoff: true }).then(res => {
|
||||||
this.paperOptions = res.data
|
this.paperOptions = res.data
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -309,82 +323,81 @@ export default {
|
||||||
getexamlist(this.listQuery).then(response => {
|
getexamlist(this.listQuery).then(response => {
|
||||||
this.tableData = response.data
|
this.tableData = response.data
|
||||||
this.listLoading = false
|
this.listLoading = false
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
resetFilter() {
|
resetFilter() {
|
||||||
this.listQuery = {
|
this.listQuery = {
|
||||||
page: 1,
|
page: 1,
|
||||||
limit: 20,
|
limit: 20,
|
||||||
search: ""
|
search: ''
|
||||||
};
|
}
|
||||||
this.getList();
|
this.getList()
|
||||||
},
|
},
|
||||||
handleFilter() {
|
handleFilter() {
|
||||||
this.listQuery.page = 1;
|
this.listQuery.page = 1
|
||||||
this.getList();
|
this.getList()
|
||||||
},
|
},
|
||||||
handleAdd() {
|
handleAdd() {
|
||||||
this.exam = Object.assign({}, defaultexam);
|
this.exam = Object.assign({}, defaultexam)
|
||||||
this.dialogType = "new";
|
this.dialogType = 'new'
|
||||||
this.dialogVisible = true;
|
this.dialogVisible = true
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs["examForm"].clearValidate();
|
this.$refs['examForm'].clearValidate()
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
handleEdit(scope) {
|
handleEdit(scope) {
|
||||||
this.exam = Object.assign({}, scope.row); // copy obj
|
this.exam = Object.assign({}, scope.row) // copy obj
|
||||||
this.dialogType = "edit";
|
this.dialogType = 'edit'
|
||||||
this.dialogVisible = true;
|
this.dialogVisible = true
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs["examForm"].clearValidate();
|
this.$refs['examForm'].clearValidate()
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
handleDelete(scope) {
|
handleDelete(scope) {
|
||||||
this.$confirm("确认删除该考试吗?将丢失数据!", "警告", {
|
this.$confirm('确认删除该考试吗?将丢失数据!', '警告', {
|
||||||
confirmButtonText: "确认",
|
confirmButtonText: '确认',
|
||||||
cancelButtonText: "取消",
|
cancelButtonText: '取消',
|
||||||
type: "error"
|
type: 'error'
|
||||||
})
|
})
|
||||||
.then(async () => {
|
.then(async() => {
|
||||||
await deleteexam(scope.row.id);
|
await deleteexam(scope.row.id)
|
||||||
this.getList()
|
this.getList()
|
||||||
this.$message({
|
this.$message({
|
||||||
type: "success",
|
type: 'success',
|
||||||
message: "成功删除!"
|
message: '成功删除!'
|
||||||
});
|
})
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
// console.error(err);
|
// console.error(err);
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
handleView(scope){
|
handleView(scope) {
|
||||||
this.$router.push({name:'ExamTest2', params:{exam:scope.row.id}})
|
this.$router.push({ name: 'ExamTest2', params: { exam: scope.row.id }})
|
||||||
|
|
||||||
},
|
},
|
||||||
async confirmexam(form) {
|
async confirmexam(form) {
|
||||||
this.$refs[form].validate(valid => {
|
this.$refs[form].validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
const isEdit = this.dialogType === "edit";
|
const isEdit = this.dialogType === 'edit'
|
||||||
if (isEdit) {
|
if (isEdit) {
|
||||||
updateexam(this.exam.id, this.exam).then(() => {
|
updateexam(this.exam.id, this.exam).then(() => {
|
||||||
this.getList();
|
this.getList()
|
||||||
this.dialogVisible = false;
|
this.dialogVisible = false
|
||||||
this.$message.success('成功')
|
this.$message.success('成功')
|
||||||
});
|
})
|
||||||
} else {
|
} else {
|
||||||
createexam(this.exam).then(res => {
|
createexam(this.exam).then(res => {
|
||||||
// this.exam = res.data
|
// this.exam = res.data
|
||||||
// this.tableData.unshift(this.exam)
|
// this.tableData.unshift(this.exam)
|
||||||
this.getList();
|
this.getList()
|
||||||
this.dialogVisible = false;
|
this.dialogVisible = false
|
||||||
this.$message.success('成功')
|
this.$message.success('成功')
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -13,22 +13,20 @@
|
||||||
type="primary"
|
type="primary"
|
||||||
icon="el-icon-refresh-left"
|
icon="el-icon-refresh-left"
|
||||||
@click="resetFilter"
|
@click="resetFilter"
|
||||||
>刷新重置</el-button
|
>刷新重置</el-button>
|
||||||
>
|
|
||||||
<el-button
|
<el-button
|
||||||
|
v-if="checkPermission(['certificate_create'])&&uploadUrl!='https://qw.ctc-zc.com/api'"
|
||||||
type="primary"
|
type="primary"
|
||||||
@click="handleAdd"
|
@click="handleAdd"
|
||||||
v-if="checkPermission(['certificate_create'])"
|
>手动创建</el-button>
|
||||||
>手动创建</el-button
|
|
||||||
>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-table
|
<el-table
|
||||||
|
v-loading="listLoading"
|
||||||
:data="tableData.results"
|
:data="tableData.results"
|
||||||
style="width: 100%; margin-top: 10px"
|
style="width: 100%; margin-top: 10px"
|
||||||
border
|
border
|
||||||
fit
|
fit
|
||||||
v-loading="listLoading"
|
|
||||||
highlight-current-row
|
highlight-current-row
|
||||||
max-height="600"
|
max-height="600"
|
||||||
row-key="id"
|
row-key="id"
|
||||||
|
@ -58,8 +56,7 @@
|
||||||
<el-table-column label="手动创建">
|
<el-table-column label="手动创建">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span v-if="scope.row.is_manual">是</span>
|
<span v-if="scope.row.is_manual">是</span>
|
||||||
<span v-else>否</span></template
|
<span v-else>否</span></template>
|
||||||
>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="创建人">
|
<el-table-column label="创建人">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
|
@ -69,20 +66,29 @@
|
||||||
<el-table-column align="center" label="操作" fixed="right">
|
<el-table-column align="center" label="操作" fixed="right">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button
|
<el-button
|
||||||
|
v-if="uploadUrl=='https://qw.ctc-zc.com/api'"
|
||||||
type="primary"
|
type="primary"
|
||||||
size="small"
|
size="small"
|
||||||
@click="handleView(scope)"
|
|
||||||
icon="el-icon-more"
|
icon="el-icon-more"
|
||||||
plain="true"
|
plain="true"
|
||||||
></el-button>
|
@click="handleDialogissue(scope)"
|
||||||
|
/>
|
||||||
<el-button
|
<el-button
|
||||||
|
v-else
|
||||||
|
type="primary"
|
||||||
|
size="small"
|
||||||
|
icon="el-icon-more"
|
||||||
|
plain="true"
|
||||||
|
@click="handleView(scope)"
|
||||||
|
/>
|
||||||
|
<el-button
|
||||||
|
v-if="checkPermission(['certificate_update'])"
|
||||||
type="primary"
|
type="primary"
|
||||||
size="small"
|
size="small"
|
||||||
plain="true"
|
plain="true"
|
||||||
@click="handleEdit(scope)"
|
|
||||||
icon="el-icon-edit"
|
icon="el-icon-edit"
|
||||||
v-if="checkPermission(['certificate_update'])"
|
@click="handleEdit(scope)"
|
||||||
></el-button>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
@ -98,11 +104,11 @@
|
||||||
:title="dialogType === 'update' ? '编辑' : '新增'"
|
:title="dialogType === 'update' ? '编辑' : '新增'"
|
||||||
>
|
>
|
||||||
<el-form
|
<el-form
|
||||||
|
ref="candidateForm"
|
||||||
:model="candidate"
|
:model="candidate"
|
||||||
label-width="80px"
|
label-width="80px"
|
||||||
label-position="right"
|
label-position="right"
|
||||||
:rules="candidateRule"
|
:rules="candidateRule"
|
||||||
ref="candidateForm"
|
|
||||||
>
|
>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
|
@ -135,8 +141,7 @@
|
||||||
type="date"
|
type="date"
|
||||||
placeholder="选择日期"
|
placeholder="选择日期"
|
||||||
value-format="yyyy-MM-dd"
|
value-format="yyyy-MM-dd"
|
||||||
>
|
/>
|
||||||
</el-date-picker>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="有效期始" prop="start_date">
|
<el-form-item label="有效期始" prop="start_date">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
|
@ -144,8 +149,7 @@
|
||||||
type="date"
|
type="date"
|
||||||
placeholder="选择日期"
|
placeholder="选择日期"
|
||||||
value-format="yyyy-MM-dd"
|
value-format="yyyy-MM-dd"
|
||||||
>
|
/>
|
||||||
</el-date-picker>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="有效期止" prop="end_date">
|
<el-form-item label="有效期止" prop="end_date">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
|
@ -153,8 +157,7 @@
|
||||||
type="date"
|
type="date"
|
||||||
placeholder="选择日期"
|
placeholder="选择日期"
|
||||||
value-format="yyyy-MM-dd"
|
value-format="yyyy-MM-dd"
|
||||||
>
|
/>
|
||||||
</el-date-picker>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="考试时间" prop="examtest_date">
|
<el-form-item label="考试时间" prop="examtest_date">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
|
@ -162,8 +165,7 @@
|
||||||
type="date"
|
type="date"
|
||||||
placeholder="选择日期"
|
placeholder="选择日期"
|
||||||
value-format="yyyy-MM-dd"
|
value-format="yyyy-MM-dd"
|
||||||
>
|
/>
|
||||||
</el-date-picker>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="照片" prop="photo">
|
<el-form-item label="照片" prop="photo">
|
||||||
<el-upload
|
<el-upload
|
||||||
|
@ -179,8 +181,8 @@
|
||||||
v-if="candidate.photo"
|
v-if="candidate.photo"
|
||||||
:src="candidate.photo"
|
:src="candidate.photo"
|
||||||
class="avatar"
|
class="avatar"
|
||||||
/>
|
>
|
||||||
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
<i v-else class="el-icon-plus avatar-uploader-icon" />
|
||||||
</el-upload>
|
</el-upload>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
@ -188,9 +190,29 @@
|
||||||
</el-form>
|
</el-form>
|
||||||
<div style="text-align: right">
|
<div style="text-align: right">
|
||||||
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
|
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
|
||||||
<el-button type="primary" @click="confirmCandidate('candidateForm')"
|
<el-button
|
||||||
>确认</el-button
|
type="primary"
|
||||||
>
|
@click="confirmCandidate('candidateForm')"
|
||||||
|
>确认</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
<el-dialog
|
||||||
|
:visible.sync="dialogVisibleissue"
|
||||||
|
width="1000px"
|
||||||
|
title="证书查看"
|
||||||
|
>
|
||||||
|
<el-card shadow="never" style="width:100%;height:100%;background-color: black;">
|
||||||
|
<el-image :src="src" style="width:531px;height:809;margin:10px 230px" />
|
||||||
|
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
<div style="text-align: right">
|
||||||
|
<el-button type="danger" @click="dialogVisibleissue = false">取消</el-button>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
@click="downCandidate"
|
||||||
|
>下载</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
|
@ -224,113 +246,141 @@
|
||||||
import {
|
import {
|
||||||
getCandidateList,
|
getCandidateList,
|
||||||
createCandidate,
|
createCandidate,
|
||||||
updateCandidate,
|
updateCandidate
|
||||||
} from "@/api/candidate";
|
} from '@/api/candidate'
|
||||||
import { deepClone } from "@/utils";
|
import { deepClone } from '@/utils'
|
||||||
import { upUrl, upHeaders } from "@/api/file";
|
import { upUrl, upHeaders } from '@/api/file'
|
||||||
import checkPermission from "@/utils/permission";
|
import checkPermission from '@/utils/permission'
|
||||||
import Pagination from "@/components/Pagination";
|
import Pagination from '@/components/Pagination'
|
||||||
|
|
||||||
const listQuery = {
|
const listQuery = {
|
||||||
page: 1,
|
page: 1,
|
||||||
limit: 20,
|
limit: 20,
|
||||||
search: "",
|
search: ''
|
||||||
};
|
}
|
||||||
export default {
|
export default {
|
||||||
components: { Pagination },
|
components: { Pagination },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
uploadUrl: process.env.VUE_APP_BASE_API,
|
||||||
upHeaders: upHeaders(),
|
upHeaders: upHeaders(),
|
||||||
upUrl: upUrl(),
|
upUrl: upUrl(),
|
||||||
listQuery: listQuery,
|
listQuery: listQuery,
|
||||||
tableData: { count: 0 },
|
tableData: { count: 0 },
|
||||||
listLoading: true,
|
listLoading: true,
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
dialogType: "create",
|
dialogType: 'create',
|
||||||
candidate: { photo: "" },
|
dialogVisibleissue: false,
|
||||||
|
src: null,
|
||||||
|
name: '',
|
||||||
|
candidate: { photo: '' },
|
||||||
candidateRule: {
|
candidateRule: {
|
||||||
number: [{ required: true, message: "请输入编号", trigger: "blur" }],
|
number: [{ required: true, message: '请输入编号', trigger: 'blur' }]
|
||||||
},
|
}
|
||||||
};
|
}
|
||||||
},
|
},
|
||||||
computed: {},
|
computed: {},
|
||||||
created() {
|
created() {
|
||||||
this.getList();
|
this.getList()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
checkPermission,
|
checkPermission,
|
||||||
handleAvatarSuccess(res, file) {
|
handleAvatarSuccess(res, file) {
|
||||||
this.candidate.photo = res.data.path;
|
this.candidate.photo = res.data.path
|
||||||
},
|
},
|
||||||
beforeAvatarUpload(file) {
|
beforeAvatarUpload(file) {
|
||||||
const isLt2M = file.size / 1024 / 1024 < 2;
|
const isLt2M = file.size / 1024 / 1024 < 2
|
||||||
if (!isLt2M) {
|
if (!isLt2M) {
|
||||||
this.$message.error("上传图片大小不能超过 2MB!");
|
this.$message.error('上传图片大小不能超过 2MB!')
|
||||||
}
|
}
|
||||||
return isLt2M;
|
return isLt2M
|
||||||
},
|
},
|
||||||
getList() {
|
getList() {
|
||||||
this.listLoading = true;
|
this.listLoading = true
|
||||||
getCandidateList(this.listQuery).then((response) => {
|
getCandidateList(this.listQuery).then((response) => {
|
||||||
this.tableData = response.data;
|
this.tableData = response.data
|
||||||
this.listLoading = false;
|
this.listLoading = false
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
resetFilter() {
|
resetFilter() {
|
||||||
this.listQuery = {
|
this.listQuery = {
|
||||||
page: 1,
|
page: 1,
|
||||||
limit: 20,
|
limit: 20,
|
||||||
search: "",
|
search: ''
|
||||||
};
|
}
|
||||||
this.getList();
|
this.getList()
|
||||||
},
|
},
|
||||||
handleFilter() {
|
handleFilter() {
|
||||||
this.listQuery.page = 1;
|
this.listQuery.page = 1
|
||||||
this.getList();
|
this.getList()
|
||||||
},
|
},
|
||||||
handleView(scope) {
|
handleView(scope) {
|
||||||
window.open(
|
window.open(
|
||||||
"https://apitest.ahctc.cn/crm/candidate/img?id=" + scope.row.id
|
'https://apitest.ahctc.cn/crm/candidate/img?id=' + scope.row.id
|
||||||
// "http://localhost:8000/crm/candidate/img?id=" + scope.row.id
|
// "http://localhost:8000/crm/candidate/img?id=" + scope.row.id
|
||||||
);
|
)
|
||||||
|
},
|
||||||
|
// 气味分析证书展示
|
||||||
|
handleDialogissue(scope) {
|
||||||
|
if(scope.row.photo==null)
|
||||||
|
{
|
||||||
|
this.$message({
|
||||||
|
message: '请先点击编辑上传证书人员照片!',
|
||||||
|
type: 'warning'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
this.dialogVisibleissue = true
|
||||||
|
this.src = 'https://qw.ctc-zc.com' + scope.row.path
|
||||||
|
this.name = scope.row.workscope_name
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
handleAdd() {
|
handleAdd() {
|
||||||
this.dialogVisible = true;
|
this.dialogVisible = true
|
||||||
this.dialogType = "create";
|
this.dialogType = 'create'
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs["candidateForm"].clearValidate();
|
this.$refs['candidateForm'].clearValidate()
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
handleEdit(scope) {
|
handleEdit(scope) {
|
||||||
this.candidate = scope.row;
|
this.candidate = scope.row
|
||||||
this.dialogType = "update";
|
this.dialogType = 'update'
|
||||||
this.dialogVisible = true;
|
this.dialogVisible = true
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs["candidateForm"].clearValidate();
|
this.$refs['candidateForm'].clearValidate()
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
confirmCandidate(form) {
|
confirmCandidate(form) {
|
||||||
this.$refs[form].validate((valid) => {
|
this.$refs[form].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
const isEdit = this.dialogType === "update";
|
const isEdit = this.dialogType === 'update'
|
||||||
if (isEdit) {
|
if (isEdit) {
|
||||||
updateCandidate(this.candidate.id, this.candidate).then(() => {
|
updateCandidate(this.candidate.id, this.candidate).then(() => {
|
||||||
this.getList();
|
this.getList()
|
||||||
this.dialogVisible = false;
|
this.dialogVisible = false
|
||||||
this.$message.success("成功");
|
this.$message.success('成功')
|
||||||
});
|
})
|
||||||
} else {
|
} else {
|
||||||
createCandidate(this.candidate).then((res) => {
|
createCandidate(this.candidate).then((res) => {
|
||||||
this.getList();
|
this.getList()
|
||||||
this.dialogVisible = false;
|
this.dialogVisible = false
|
||||||
this.$message.success("成功");
|
this.$message.success('成功')
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
},
|
// 下载证书
|
||||||
};
|
downCandidate() {
|
||||||
|
var a = document.createElement('a');
|
||||||
|
a.href = this.src ;
|
||||||
|
a.download = this.src ;
|
||||||
|
a.target="_blank"
|
||||||
|
a.click()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue