前端权限

This commit is contained in:
caoqianming 2021-03-18 10:15:00 +08:00
parent b4350e8949
commit 610becb715
2 changed files with 6 additions and 14 deletions

View File

@ -17,7 +17,6 @@
:props="{ key : 'id' , label: 'name' }" :props="{ key : 'id' , label: 'name' }"
/> />
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="contentup()">确认</el-button> <el-button type="primary" @click="contentup()">确认</el-button>
</span> </span>
@ -118,13 +117,6 @@
</el-table> </el-table>
</el-card> </el-card>
<el-dialog
:visible.sync="dialogVisible"
title="主动上报"
:close-on-click-modal="false"
>
<taskinit ref="taskinit" @handleChose="chooseComplete"></taskinit>
</el-dialog>
<el-drawer title="记录" :visible.sync="drawer" :with-header="false"> <el-drawer title="记录" :visible.sync="drawer" :with-header="false">
<recorddo <recorddo
ref="recorddo" ref="recorddo"
@ -254,10 +246,9 @@ export default {
console.log(this.contents) console.log(this.contents)
if(this.contents.length>0){ if(this.contents.length>0){
createself({contents:this.contents} createself({contents:this.contents}
).then((res) => { ).then((res) => {
alert(1) this.centerDialogVisible = false
}); });
}else{ }else{
this.$message.error('请选择清单!') this.$message.error('请选择清单!')

View File

@ -122,6 +122,7 @@ class RecordViewSet(RbacFilterSet, PageOrNot, CreateUpdateCustomMixin, ModelView
@action(methods=['get'], detail=False, perms_map = {'get':'*'}) @action(methods=['get'], detail=False, perms_map = {'get':'*'})
def todos(self, request, *args, **kwargs): def todos(self, request, *args, **kwargs):
dept = request.user.belong_dept dept = request.user.belong_dept
objs = Record.objects.filter(is_deleted=False, belong_dept=dept)
toup = Record.objects.filter(is_deleted=False, belong_dept=dept, state='待上报').count() toup = Record.objects.filter(is_deleted=False, belong_dept=dept, state='待上报').count()
tozg = Record.objects.filter(is_delete=False,belong_dept=dept,state='待整改').count() tozg = Record.objects.filter(is_delete=False,belong_dept=dept,state='待整改').count()
return Response({'toup':toup, 'tozg':tozg}) return Response({'toup':toup, 'tozg':tozg})
@ -132,7 +133,7 @@ class RecordViewSet(RbacFilterSet, PageOrNot, CreateUpdateCustomMixin, ModelView
instance.save() instance.save()
return Response(status=status.HTTP_200_OK) return Response(status=status.HTTP_200_OK)
@action(methods=['post'], detail=False, perms_map = {'post':'record_creates'}) @action(methods=['post'], detail=False, perms_map = {'post':'record_createself'})
def createself(self, request, *args, **kwargs): def createself(self, request, *args, **kwargs):
contents = request.data['contents'] contents = request.data['contents']
rlist = [] rlist = []
@ -142,7 +143,7 @@ class RecordViewSet(RbacFilterSet, PageOrNot, CreateUpdateCustomMixin, ModelView
Record.objects.bulk_create(rlist) Record.objects.bulk_create(rlist)
return Response(status=status.HTTP_200_OK) return Response(status=status.HTTP_200_OK)
@action(methods=['put'], detail=True, perms_map = {'post':'record_up'}) @action(methods=['put'], detail=True, perms_map = {'put':'record_up'})
def up(self, request, *args, **kwargs): def up(self, request, *args, **kwargs):
""" """
上报 上报
@ -165,7 +166,7 @@ class RecordViewSet(RbacFilterSet, PageOrNot, CreateUpdateCustomMixin, ModelView
return Response(status=status.HTTP_200_OK) return Response(status=status.HTTP_200_OK)
return Response('记录状态错误', status=status.HTTP_400_BAD_REQUEST) return Response('记录状态错误', status=status.HTTP_400_BAD_REQUEST)
@action(methods=['put'], detail=True, perms_map = {'post':'record_reject'}) @action(methods=['put'], detail=True, perms_map = {'put':'record_reject'})
def reject(self, request, *args, **kwargs): def reject(self, request, *args, **kwargs):
""" """
驳回 驳回
@ -183,7 +184,7 @@ class RecordViewSet(RbacFilterSet, PageOrNot, CreateUpdateCustomMixin, ModelView
return Response('请填写备注', status=status.HTTP_400_BAD_REQUEST) return Response('请填写备注', status=status.HTTP_400_BAD_REQUEST)
return Response('记录状态错误', status=status.HTTP_400_BAD_REQUEST) return Response('记录状态错误', status=status.HTTP_400_BAD_REQUEST)
@action(methods=['put'], detail=True, perms_map = {'post':'record_confirm'}) @action(methods=['put'], detail=True, perms_map = {'put':'record_confirm'})
def confirm(self, request, *args, **kwargs): def confirm(self, request, *args, **kwargs):
""" """
确认 确认