增加管理员权限
This commit is contained in:
parent
9d483b942d
commit
1d7dfda3a3
|
|
@ -157,7 +157,7 @@ export const asyncRoutes = [
|
||||||
component: Layout,
|
component: Layout,
|
||||||
redirect: '/Qmanage/question',
|
redirect: '/Qmanage/question',
|
||||||
name: 'Qmanage',
|
name: 'Qmanage',
|
||||||
meta: { title: '题库管理', icon: 'table', perms: []},
|
meta: { title: '题库管理', icon: 'table'},
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'subject',
|
path: 'subject',
|
||||||
|
|
@ -175,7 +175,7 @@ export const asyncRoutes = [
|
||||||
path: 'question',
|
path: 'question',
|
||||||
name: 'question',
|
name: 'question',
|
||||||
component: () => import('@/views/question/question.vue'),
|
component: () => import('@/views/question/question.vue'),
|
||||||
meta: { title: '题目列表', icon: '', perms: ['question_manage'] }
|
meta: { title: '题目列表', icon: '', perms: ['question_view'] }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'question/create',
|
path: 'question/create',
|
||||||
|
|
@ -279,7 +279,7 @@ export const asyncRoutes = [
|
||||||
path: 'issue',
|
path: 'issue',
|
||||||
name: 'issue',
|
name: 'issue',
|
||||||
component: () => import('@/views/exam/issue.vue'),
|
component: () => import('@/views/exam/issue.vue'),
|
||||||
meta: { title: '出证记录', perms: ['candidate_view'] }
|
meta: { title: '出证记录', perms: ['certificate_view'] }
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
@click="handleAdd"
|
@click="handleAdd"
|
||||||
v-if="checkPermission(['candidate_create'])"
|
v-if="checkPermission(['certificate_create'])"
|
||||||
>手动创建</el-button
|
>手动创建</el-button
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -68,16 +68,20 @@
|
||||||
</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 type="primary" size="small" @click="handleView(scope)" icon="el-icon-more" plain=true
|
|
||||||
></el-button
|
|
||||||
>
|
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
size="small"
|
size="small"
|
||||||
plain=true
|
@click="handleView(scope)"
|
||||||
|
icon="el-icon-more"
|
||||||
|
plain="true"
|
||||||
|
></el-button>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
size="small"
|
||||||
|
plain="true"
|
||||||
@click="handleEdit(scope)"
|
@click="handleEdit(scope)"
|
||||||
icon="el-icon-edit"
|
icon="el-icon-edit"
|
||||||
v-if="checkPermission(['candidate_update'])"
|
v-if="checkPermission(['certificate_update'])"
|
||||||
></el-button>
|
></el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
@ -89,7 +93,10 @@
|
||||||
:limit.sync="listQuery.limit"
|
:limit.sync="listQuery.limit"
|
||||||
@pagination="getList"
|
@pagination="getList"
|
||||||
/>
|
/>
|
||||||
<el-dialog :visible.sync="dialogVisible" :title="dialogType === 'update' ? '编辑' : '新增'">
|
<el-dialog
|
||||||
|
:visible.sync="dialogVisible"
|
||||||
|
:title="dialogType === 'update' ? '编辑' : '新增'"
|
||||||
|
>
|
||||||
<el-form
|
<el-form
|
||||||
:model="candidate"
|
:model="candidate"
|
||||||
label-width="80px"
|
label-width="80px"
|
||||||
|
|
@ -109,7 +116,10 @@
|
||||||
<el-input v-model="candidate.ID_number" placeholder="身份证号" />
|
<el-input v-model="candidate.ID_number" placeholder="身份证号" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="工作类别" prop="workscope_name">
|
<el-form-item label="工作类别" prop="workscope_name">
|
||||||
<el-input v-model="candidate.workscope_name" placeholder="工作类别" />
|
<el-input
|
||||||
|
v-model="candidate.workscope_name"
|
||||||
|
placeholder="工作类别"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="单位" prop="company_name">
|
<el-form-item label="单位" prop="company_name">
|
||||||
<el-input v-model="candidate.company_name" placeholder="单位" />
|
<el-input v-model="candidate.company_name" placeholder="单位" />
|
||||||
|
|
@ -124,7 +134,8 @@
|
||||||
v-model="candidate.issue_date"
|
v-model="candidate.issue_date"
|
||||||
type="date"
|
type="date"
|
||||||
placeholder="选择日期"
|
placeholder="选择日期"
|
||||||
value-format="yyyy-MM-dd">
|
value-format="yyyy-MM-dd"
|
||||||
|
>
|
||||||
</el-date-picker>
|
</el-date-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="有效期始" prop="start_date">
|
<el-form-item label="有效期始" prop="start_date">
|
||||||
|
|
@ -132,7 +143,8 @@
|
||||||
v-model="candidate.start_date"
|
v-model="candidate.start_date"
|
||||||
type="date"
|
type="date"
|
||||||
placeholder="选择日期"
|
placeholder="选择日期"
|
||||||
value-format="yyyy-MM-dd">
|
value-format="yyyy-MM-dd"
|
||||||
|
>
|
||||||
</el-date-picker>
|
</el-date-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="有效期止" prop="end_date">
|
<el-form-item label="有效期止" prop="end_date">
|
||||||
|
|
@ -140,7 +152,8 @@
|
||||||
v-model="candidate.end_date"
|
v-model="candidate.end_date"
|
||||||
type="date"
|
type="date"
|
||||||
placeholder="选择日期"
|
placeholder="选择日期"
|
||||||
value-format="yyyy-MM-dd">
|
value-format="yyyy-MM-dd"
|
||||||
|
>
|
||||||
</el-date-picker>
|
</el-date-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="考试时间" prop="examtest_date">
|
<el-form-item label="考试时间" prop="examtest_date">
|
||||||
|
|
@ -148,7 +161,8 @@
|
||||||
v-model="candidate.examtest_date"
|
v-model="candidate.examtest_date"
|
||||||
type="date"
|
type="date"
|
||||||
placeholder="选择日期"
|
placeholder="选择日期"
|
||||||
value-format="yyyy-MM-dd">
|
value-format="yyyy-MM-dd"
|
||||||
|
>
|
||||||
</el-date-picker>
|
</el-date-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="照片" prop="photo">
|
<el-form-item label="照片" prop="photo">
|
||||||
|
|
@ -161,14 +175,16 @@
|
||||||
:before-upload="beforeAvatarUpload"
|
:before-upload="beforeAvatarUpload"
|
||||||
:headers="upHeaders"
|
:headers="upHeaders"
|
||||||
>
|
>
|
||||||
<img v-if="candidate.photo" :src="candidate.photo" class="avatar" />
|
<img
|
||||||
|
v-if="candidate.photo"
|
||||||
|
:src="candidate.photo"
|
||||||
|
class="avatar"
|
||||||
|
/>
|
||||||
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
</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">
|
||||||
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
|
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
|
||||||
|
|
@ -205,9 +221,13 @@
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
import { getCandidateList, createCandidate, updateCandidate } from "@/api/candidate";
|
import {
|
||||||
|
getCandidateList,
|
||||||
|
createCandidate,
|
||||||
|
updateCandidate,
|
||||||
|
} 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";
|
||||||
|
|
||||||
|
|
@ -227,7 +247,7 @@ export default {
|
||||||
listLoading: true,
|
listLoading: true,
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
dialogType: "create",
|
dialogType: "create",
|
||||||
candidate: {photo:''},
|
candidate: { photo: "" },
|
||||||
candidateRule: {
|
candidateRule: {
|
||||||
number: [{ required: true, message: "请输入编号", trigger: "blur" }],
|
number: [{ required: true, message: "请输入编号", trigger: "blur" }],
|
||||||
},
|
},
|
||||||
|
|
@ -240,7 +260,7 @@ export default {
|
||||||
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;
|
||||||
|
|
@ -282,7 +302,7 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
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(() => {
|
||||||
|
|
@ -306,7 +326,6 @@ createCandidate(this.candidate).then((res) => {
|
||||||
this.$message.success("成功");
|
this.$message.success("成功");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,14 +43,14 @@
|
||||||
@click="resetFilter"
|
@click="resetFilter"
|
||||||
>刷新重置</el-button>
|
>刷新重置</el-button>
|
||||||
<div style="margin-top:10px">
|
<div style="margin-top:10px">
|
||||||
<el-button type="primary" slot="reference" @click="handleAdd()">新增</el-button>
|
<el-button type="primary" slot="reference" @click="handleAdd()" v-if="checkPermission(['question_create'])">新增</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
@click="handleEnabled"
|
@click="handleEnabled"
|
||||||
>启用</el-button>
|
>启用</el-button>
|
||||||
<el-popover
|
<el-popover
|
||||||
placement="top"
|
placement="top"
|
||||||
width="160"
|
width="160"
|
||||||
v-if="checkPermission(['consumer_import'])"
|
v-if="checkPermission(['question_import'])"
|
||||||
v-model="popovervisible"
|
v-model="popovervisible"
|
||||||
>
|
>
|
||||||
<p>导入题目前,请下载模板并按格式录入.</p>
|
<p>导入题目前,请下载模板并按格式录入.</p>
|
||||||
|
|
@ -69,7 +69,7 @@
|
||||||
|
|
||||||
<el-button slot="reference">Excel导入</el-button>
|
<el-button slot="reference">Excel导入</el-button>
|
||||||
</el-popover>
|
</el-popover>
|
||||||
<el-button type="primary" icon="el-icon-download" @click="exportQuestion">导出Excel</el-button>
|
<el-button type="primary" icon="el-icon-download" @click="exportQuestion" v-if="checkPermission(['export_question'])">导出Excel</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
type="danger"
|
type="danger"
|
||||||
@click="handleDeletes(scope)"
|
@click="handleDeletes(scope)"
|
||||||
|
|
@ -127,7 +127,7 @@
|
||||||
size="small"
|
size="small"
|
||||||
@click="handleEdit(scope)"
|
@click="handleEdit(scope)"
|
||||||
icon="el-icon-edit"
|
icon="el-icon-edit"
|
||||||
:disabled="!checkPermission(['question_edit'])"
|
:disabled="!checkPermission(['question_update'])"
|
||||||
></el-button>
|
></el-button>
|
||||||
<el-button
|
<el-button
|
||||||
type="danger"
|
type="danger"
|
||||||
|
|
|
||||||
|
|
@ -715,8 +715,8 @@ class CandidateViewSet(RetrieveModelMixin, ListModelMixin, CreateModelMixin, Upd
|
||||||
出征记录:列表
|
出征记录:列表
|
||||||
"""
|
"""
|
||||||
perms_map = [
|
perms_map = [
|
||||||
{'get': '*'}, {'post': 'candidate_create'},
|
{'get': '*'}, {'post': 'certificate_create'},
|
||||||
{'put': 'candidate_update'}, {'delete': 'candidate_delete'}]
|
{'put': 'certificate_update'}, {'delete': 'certificate_delete'}]
|
||||||
queryset = Candidate.objects.filter(number__isnull=False)
|
queryset = Candidate.objects.filter(number__isnull=False)
|
||||||
serializer_class = CandidateSerializer
|
serializer_class = CandidateSerializer
|
||||||
pagination_class = CommonPagination
|
pagination_class = CommonPagination
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ class Menu(SoftCommonModel):
|
||||||
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name + '-' + str(self.sort)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = '功能权限表'
|
verbose_name = '功能权限表'
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue