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