组长开始检查任务
This commit is contained in:
parent
c5cf912243
commit
841407953e
|
@ -37,9 +37,9 @@ const store = new Vuex.Store({
|
|||
// vuex_api: 'http://127.0.0.1:8000/api',
|
||||
// vuex_apifile: 'http://127.0.0.1:8000/api/file/',
|
||||
|
||||
vuex_host: 'http://testsearch.ctc.ac.cn',
|
||||
vuex_api: 'http://testsearch.ctc.ac.cn:8000/api',
|
||||
vuex_apifile: 'http://testsearch.ctc.ac.cn:8000/api/file/',
|
||||
vuex_host: 'https://testsearch.ctc.ac.cn',
|
||||
vuex_api: 'https://testsearch.ctc.ac.cn/api',
|
||||
vuex_apifile: 'https://testsearch.ctc.ac.cn/api/file/',
|
||||
|
||||
// 如果vuex_version无需保存到本地永久存储,无需lifeData.vuex_version方式
|
||||
// vuex_version: '1.0.1',
|
||||
|
|
|
@ -183,6 +183,21 @@ class InspectDeptViewSet(ListModelMixin, RetrieveModelMixin, GenericViewSet):
|
|||
perms_map = {'get':'*'}
|
||||
queryset = InspectDept.objects.all()
|
||||
serializer_class = InspectDeptSerializer
|
||||
|
||||
@action(methods=['put'], detail=True, perms_map = {'put':'inspectrecord_update'},
|
||||
permission_classes=[IsAdminUser|IsSubInspectTaskLeader])
|
||||
def start(self, request, *args, **kwargs):
|
||||
"""
|
||||
对该组织开始检查
|
||||
"""
|
||||
obj = self.get_object()
|
||||
if obj.state == '待检查':
|
||||
obj.state = '检查中'
|
||||
obj.start_date = timezone.now()
|
||||
obj.save()
|
||||
return Response(InspectDeptSerializer(instance=obj).data, status=status.HTTP_200_OK)
|
||||
return Response('状态错误', status=status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
@action(methods=['put'], detail=True, perms_map = {'put':'inspectrecord_update'},
|
||||
permission_classes=[IsAdminUser|IsSubInspectTaskLeader])
|
||||
def up(self, request, *args, **kwargs):
|
||||
|
@ -248,11 +263,4 @@ class InspectRecordViewSet(PageOrNot, ModelViewSet):
|
|||
serializer = InspectRecordCheckSerializer(instance, data=request.data)
|
||||
serializer.is_valid(raise_exception=True)
|
||||
serializer.save(checker=request.user, checked=True, check_time=timezone.now())
|
||||
# 修改状态
|
||||
insd = InspectDept.objects.get(subtask=instance.subtask, dept=instance.dept)
|
||||
if insd.state == '待检查':
|
||||
insd.state = '检查中'
|
||||
insd.start_date = timezone.now()
|
||||
insd.save()
|
||||
return Response(status=status.HTTP_200_OK)
|
||||
return Response('任务状态错误', status=status.HTTP_400_BAD_REQUEST)
|
Loading…
Reference in New Issue