修改检测能力

This commit is contained in:
shilixia 2020-10-21 15:10:33 +08:00
parent bf1152aa57
commit e8653fcaab
8 changed files with 63 additions and 31 deletions

View File

@ -50,4 +50,11 @@ export function importQualification(data) {
method: 'post',
data
})
}
}
export function getQualificationotherList(query) {
return request({
url: '/ability/qualificationother/',
method: 'get',
params: query
})
}

View File

@ -139,8 +139,12 @@
</el-table-column>
<el-table-column label="生效日期">
<template slot-scope="scope"
><span v-html="showlight(scope.row.sxrq.substring(0,10)) "></span
></template>
>
<span v-if="showlight(scope.row.sxrq).length>10" v-html="showlight(scope.row.sxrq.substring(0,10)) "></span
>
<span v-else v-html="showlight(scope.row.sxrq) "></span
>
</template>
</el-table-column>
<el-table-column

View File

@ -86,33 +86,33 @@
:filters="groupBy.sszx"
:filter-multiple="false"
>
<template slot-scope="scope">{{ scope.row.sszx }}</template>
<template slot-scope="scope">{{ scope.row.qualification_.sszx }}</template>
</el-table-column>
<el-table-column width="150" fixed label="CMA资质">
<template slot-scope="scope">
<span v-html="showlight(scope.row.cma)"></span>
<span v-html="showlight(scope.row.qualification_.cma)"></span>
</template>
</el-table-column>
<el-table-column width="150" fixed label="CNAS资质">
<template slot-scope="scope">
<span v-html="showlight(scope.row.cnas)"></span>
<span v-html="showlight(scope.row.qualification_.cnas)"></span>
</template>
</el-table-column>
<el-table-column width="1050" label="检验检测相关其他资质及校准资质">
<el-table-column label="其它资质" width="360">
<template slot-scope="scope">
<p style="border-bottom: 1px dashed blue" v-for="item in scope.row.otherqualification" v-html="showlight(item.name)" ></p>
<span v-html="showlight(scope.row.name)" ></span>
</template>
</el-table-column>
<el-table-column label="资质范围" width="690">
<template slot-scope="scope">
<p v-for="item in scope.row.otherqualification" style="border-bottom: 1px dashed blue " v-html="showlight(item.description)" ></p>
<span v-html="showlight(scope.row.description)" ></span>
</template>
</el-table-column>
</el-table-column>
<el-table-column fixed="right" width="200" label="主要服务">
<template slot-scope="scope">
<span v-html="showlight(scope.row.service)"></span>
<span v-html="showlight(scope.row.qualification_.service)"></span>
</template>
</el-table-column>
<el-table-column width="150" fixed="right" label="操作">
@ -181,7 +181,7 @@
}
</style>
<script>
import { getQualificationList, getQualificationGroup, createQualification, updateQualification, deleteQualification, importQualification } from "@/api/qualification";
import { getQualificationList,getQualificationotherList, getQualificationGroup, createQualification, updateQualification, deleteQualification, importQualification } from "@/api/qualification";
import checkPermission from "@/utils/permission"
import { upUrl, upHeaders } from "@/api/file"
import Pagination from "@/components/Pagination" // secondary package based on el-pagination
@ -275,7 +275,7 @@ export default {
},
getList() {
this.listLoading = true;
getQualificationList(this.listQuery).then(response => {
getQualificationotherList(this.listQuery).then(response => {
if (response.data) {
this.tableData = response.data
}

View File

@ -0,0 +1,17 @@
# Generated by Django 3.0.5 on 2020-10-21 06:48
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('ability', '0014_auto_20201020_1601'),
]
operations = [
migrations.RemoveField(
model_name='inspection',
name='type',
),
]

View File

@ -29,10 +29,7 @@ class Inspection(BaseModel):
"""
检验能力表
"""
type_choices = (
('center', '总部'),
('sub', '分子公司')
)
dlxh = models.TextField('大类序号', null=True,blank=True)
dlmc = models.TextField('大类名称', null=True,blank=True)
dxxh = models.TextField('对象序号', null=True,blank=True)
@ -43,8 +40,6 @@ class Inspection(BaseModel):
sm = models.TextField('说明', null=True,blank=True)
sxrq = models.TextField('生效日期', null=True,blank=True)
sszx = models.TextField('所属中心',null=True,blank=True)
type = models.CharField('所属类型', max_length=50,
choices=type_choices, default='center')
class CNAS(BaseModel):
"""

View File

@ -18,28 +18,28 @@ class CNASSerializer(serializers.ModelSerializer):
fields = '__all__'
class InspectionSerializer(serializers.ModelSerializer):
"""
检验能力反馈
检验能力反馈
"""
class Meta:
model = Inspection
fields = '__all__'
class QualificationotherSerializer(serializers.ModelSerializer):
class Meta:
model = Qualificationother
fields = '__all__'
class QualificationSerializer(serializers.ModelSerializer):
"""
资质能力序列化
"""
otherqualification = QualificationotherSerializer(source='other_qualification', many=True)
@staticmethod
def setup_eager_loading(queryset):
""" Perform necessary eager loading of data. """
queryset = queryset.prefetch_related('other_qualification',)
return queryset
class Meta:
model = Qualification
fields = '__all__'
class QualificationotherSerializer(serializers.ModelSerializer):
qualification_ = QualificationSerializer(source = 'qualification', read_only=True)
class Meta:
model = Qualificationother
fields = '__all__'
@staticmethod
def setup_eager_loading(queryset):
""" Perform necessary eager loading of data. """
queryset = queryset.select_related('qualification')
return queryset

View File

@ -1,11 +1,12 @@
from django.urls import path, include
from rest_framework import routers
from .views import CMAViewSet, CNASViewSet, QualificationViewSet,InspectionViewSet
from .views import CMAViewSet, CNASViewSet, QualificationViewSet,InspectionViewSet,QualificationotherViewSet
router = routers.DefaultRouter()
router.register('cma', CMAViewSet, basename="cma")
router.register('cnas', CNASViewSet, basename="cnas")
router.register('qualification', QualificationViewSet, basename="qualification")
router.register('qualificationother', QualificationotherViewSet, basename="qualificationother")
router.register('inspection', InspectionViewSet, basename="inspection")
urlpatterns = [
path('', include(router.urls))

View File

@ -170,6 +170,14 @@ class QualificationViewSet(ModelViewSet):
return Response(status = status.HTTP_200_OK)
else:
return Response('不支持非xlsx格式', status = status.HTTP_400_BAD_REQUEST)
class QualificationotherViewSet(ModelViewSet):
"""
资质能力增删改查
"""
perms_map = {'get': '*', 'post': 'qualificationother_create',
'put': 'qualificationother_update', 'delete': 'qualificationother_delete'}
queryset = Qualificationother.objects.all()
serializer_class = QualificationotherSerializer
class InspectionViewSet(ModelViewSet):
"""
CNAS检测能力增删改查