实验室检验
This commit is contained in:
parent
6a6e6d859b
commit
ab52d48f5d
|
@ -51,16 +51,15 @@ export function createcompleteCertappunit(id,data) {
|
|||
data
|
||||
})
|
||||
}
|
||||
export function testlistCertappunit(query) {
|
||||
export function getTasklist(query) {
|
||||
return request({
|
||||
url: `/project/certappunit/testlist/`,
|
||||
url: '/project/tasklist/',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
// export function createAccess(data) {
|
||||
// return request({
|
||||
// url: '/accessment/certass/',
|
||||
|
|
|
@ -83,20 +83,7 @@
|
|||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="检测状态" prop="inspectionstate">
|
||||
<el-select placeholder="请选择检测状态" v-model="formData.inspectionstate" filterable allow-create :style="{width: '100%'}"
|
||||
>
|
||||
<el-option
|
||||
v-for="(item, index) in inspectionOptions"
|
||||
:key="index"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
:disabled="item.disabled"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="8">
|
||||
<el-form-item label="确认的收费方式" prop="password">
|
||||
<el-select placeholder="请选择收费方式" v-model="formData.charge" filterable allow-create :style="{width: '100%'}"
|
||||
|
@ -194,21 +181,7 @@
|
|||
}
|
||||
|
||||
],
|
||||
inspectionOptions:[
|
||||
{
|
||||
label: "待检测",
|
||||
value: "待检测",
|
||||
},
|
||||
{
|
||||
label: "在检测",
|
||||
value: "在检测",
|
||||
}
|
||||
,
|
||||
{
|
||||
label: "已检测",
|
||||
value: "已检测",
|
||||
}
|
||||
],
|
||||
|
||||
conclusionOptions:[
|
||||
{
|
||||
label: "合格",
|
||||
|
|
|
@ -135,10 +135,10 @@ export default {
|
|||
getList() {
|
||||
this.listLoading = true;
|
||||
|
||||
getTasklist().then((response) => {
|
||||
getTasklist(this.listQuery).then((response) => {
|
||||
|
||||
if (response.data) {
|
||||
this.tableData = response.data;
|
||||
this.tableData = response.data.results;
|
||||
|
||||
}
|
||||
this.listLoading = false;
|
||||
|
|
|
@ -89,7 +89,28 @@ class CertappunitSerializer(serializers.ModelSerializer):
|
|||
certificate = certificates[0]
|
||||
return {'id':certificate.id,'number':certificate.number}
|
||||
return None
|
||||
class CertappunitSerializerx(serializers.ModelSerializer):
|
||||
certunit_ = CertunitSimpleSerializer(source = 'certunit', read_only=True)
|
||||
decision_ = DictSimpleSerializer(source = 'decision', read_only=True)
|
||||
testorg_ = TestOrgSerializer(source = 'testorg', read_only=True)
|
||||
|
||||
certificate_ = serializers.SerializerMethodField()
|
||||
class Meta:
|
||||
model = Certappunit
|
||||
fields = '__all__'
|
||||
|
||||
@staticmethod
|
||||
def setup_eager_loading(queryset):
|
||||
""" Perform necessary eager loading of data. """
|
||||
queryset = queryset.select_related('certunit','testorg','decision')
|
||||
return queryset
|
||||
|
||||
def get_certificate_(self, obj):
|
||||
certificates = Certificate.objects.filter(certunit = obj.certunit).order_by('-create_time')
|
||||
if certificates.exists():
|
||||
certificate = certificates[0]
|
||||
return {'id':certificate.id,'number':certificate.number}
|
||||
return None
|
||||
class EvaluationDetailSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
model = EvaluationDetail
|
||||
|
|
|
@ -10,6 +10,8 @@ router.register('certappunit', CertappunitViewset, basename="certappunit")
|
|||
router.register('evaluationdetail', EvaluationDetailViewset, basename="evaluationdetail")
|
||||
router.register('project', ProjectViewSet, basename="project")
|
||||
urlpatterns = [
|
||||
path('tasklist/', TaskList.as_view()),
|
||||
path('', include(router.urls)),
|
||||
|
||||
|
||||
path('', include(router.urls))
|
||||
]
|
|
@ -8,6 +8,7 @@ from rest_framework.response import Response
|
|||
from rest_framework import status
|
||||
from .models import *
|
||||
from .serializers import *
|
||||
from apps.crm.models import Certunit
|
||||
from apps.system.models import Dict
|
||||
from apps.laboratory.models import TestOrg
|
||||
from apps.system.permission_data import RbacFilterSet
|
||||
|
@ -101,6 +102,10 @@ class CertappViewset(PageOrNot, RbacFilterSet, ModelViewSet):
|
|||
obj = serializer.save(create_by = self.request.user, belong_dept=self.request.user.dept, state='受理')
|
||||
CertAppFlow.objects.create(certapp = obj, handler=self.request.user, data=serializer.data, operation='创建申请', state='申请')
|
||||
headers = self.get_success_headers(serializer.data)
|
||||
if postdata.field_code=='QMS':
|
||||
|
||||
instance,_ = Certunit.objects.get_or_create(enterprise = Enterprise.objects.get(pk=request.data['enterprise']))
|
||||
Certappunit.objects.create(certunit=instance, certapp=obj)
|
||||
return Response(serializer.data, status=status.HTTP_201_CREATED, headers=headers)
|
||||
|
||||
@action(methods=['put'], detail=True, perms_map={'put':'certapp_complete'},
|
||||
|
@ -261,15 +266,6 @@ class CertappunitViewset(PageOrNot, ModelViewSet):
|
|||
obj.charge = request.data['charge']
|
||||
obj.save()
|
||||
return Response(status=status.HTTP_200_OK)
|
||||
@action(methods=['get'], detail=True, perms_map={'get':'certapp_testlist'}, url_name='certappunit_testlist')
|
||||
def testlist(self, request, pk=None):
|
||||
"""
|
||||
实验室任务列表
|
||||
"""
|
||||
|
||||
queryset = Certappunit.objects.filter(teststate__in=['待实验室检验', '到样检测中'])
|
||||
return queryset
|
||||
|
||||
|
||||
@action(methods=['put'], detail=True, perms_map={'put':'certapp_teststate'}, url_name='certappunit_teststate')
|
||||
def teststate(self, request, pk=None):
|
||||
|
@ -318,16 +314,15 @@ class CertappunitViewset(PageOrNot, ModelViewSet):
|
|||
|
||||
class TaskList(ListAPIView):
|
||||
"""
|
||||
我的审核项目
|
||||
实验室任务
|
||||
"""
|
||||
perms_map = {'get': 'myaudittask_view'}
|
||||
serializer_class = ProjectSerializerX
|
||||
filterset_class = ProjectFilter
|
||||
search_fields = ['auditee__name', 'plan__name']
|
||||
ordering=['-pk']
|
||||
perms_map = {'get': 'certapptasklist_view'}
|
||||
serializer_class = CertappunitSerializerx
|
||||
filterset_fields = ['certapp','teststate','id','inspectionstate']
|
||||
ordering= ['-id']
|
||||
|
||||
def get_queryset(self):
|
||||
queryset = Project.objects.filter(certapp_project__member_certapp__user=self.request.user).distinct()
|
||||
queryset = Certappunit.objects.filter(teststate__in=['待实验室检验', '到样检测中'])
|
||||
if hasattr(self.get_serializer_class(), 'setup_eager_loading'):
|
||||
queryset = self.get_serializer_class().setup_eager_loading(queryset)
|
||||
return queryset
|
||||
|
|
Loading…
Reference in New Issue