This commit is contained in:
parent
e62643b4e9
commit
90b20cc1aa
|
@ -0,0 +1,19 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
export function getCertificateList(query) {
|
||||
return request({
|
||||
url: '/certificate/certificate/',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function createCertificate(data) {
|
||||
return request({
|
||||
url: '/certificate/certificate/',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -64,7 +64,7 @@
|
|||
</el-table-column>
|
||||
<el-table-column label="当前状态">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.status}}
|
||||
{{ scope.row.state}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建人">
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="当前状态">
|
||||
<template slot-scope="scope">{{ scope.row.status}}</template>
|
||||
<template slot-scope="scope">{{ scope.row.state}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建人">
|
||||
<template slot-scope="scope">{{ scope.row.create_by_.name}}</template>
|
||||
|
@ -105,7 +105,7 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="当前状态">
|
||||
<template slot-scope="scope">{{ scope.row.status}}</template>
|
||||
<template slot-scope="scope">{{ scope.row.state}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="是否可派差">
|
||||
<template slot-scope="scope">
|
||||
|
@ -165,12 +165,12 @@ export default {
|
|||
return {
|
||||
listLoading: true,
|
||||
listQuery: {
|
||||
status: "已受理",
|
||||
state: "已受理",
|
||||
},
|
||||
listQuery_project: {
|
||||
page: 1,
|
||||
page_size: 20,
|
||||
status:"待策划"
|
||||
state:"待策划"
|
||||
},
|
||||
projectData: { count: 0, results: [] },
|
||||
};
|
||||
|
@ -193,7 +193,7 @@ export default {
|
|||
},
|
||||
resetFilter() {
|
||||
this.listQuery = {
|
||||
status: "已受理",
|
||||
state: "已受理",
|
||||
};
|
||||
this.getCertappList_();
|
||||
},
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="当前状态">
|
||||
<template slot-scope="scope">{{ scope.row.status}}</template>
|
||||
<template slot-scope="scope">{{ scope.row.state}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="审核组成员">
|
||||
<template slot-scope="scope" v-if="scope.row.members">
|
||||
|
@ -139,7 +139,7 @@
|
|||
</el-table-column>
|
||||
<el-table-column label="当前状态">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.status}}
|
||||
{{ scope.row.state}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="审核组成员">
|
||||
|
|
|
@ -88,7 +88,7 @@
|
|||
</el-table-column>
|
||||
<el-table-column label="当前状态">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.status}}
|
||||
{{ scope.row.state}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建人">
|
||||
|
|
|
@ -93,6 +93,7 @@ export default {
|
|||
props: [],
|
||||
data() {
|
||||
return {
|
||||
// steps:['申请', '受理', ''],
|
||||
activeName:'Basic',
|
||||
certapp:null,
|
||||
certappdata:null,
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
</el-table-column>
|
||||
<el-table-column label="当前状态">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.status}}
|
||||
{{ scope.row.state}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建人">
|
||||
|
|
|
@ -15,13 +15,8 @@
|
|||
<template slot-scope="scope" v-if="scope.row.certunit_">{{ scope.row.certunit_.name }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="证书信息">
|
||||
<template slot-scope="scope">
|
||||
<!-- <el-button
|
||||
type="danger"
|
||||
size="small"
|
||||
:disabled="!checkPermission(['certapps_update'])"
|
||||
@click="handleDelete(scope)"
|
||||
>删除</el-button> -->
|
||||
<template slot-scope="scope" v-if="scope.row.certificate_">
|
||||
{{scope.row.certificate_.number}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="认证决定">
|
||||
|
@ -45,8 +40,9 @@
|
|||
title="发证"
|
||||
:visible.sync="drawerVisible"
|
||||
direction="rtl"
|
||||
:close-on-click-modal="false">
|
||||
<span>我来啦!</span>
|
||||
:close-on-click-modal="false"
|
||||
:with-header="false">
|
||||
|
||||
</el-drawer>
|
||||
|
||||
</div>
|
||||
|
@ -58,6 +54,7 @@ import { accessCertapp, getCertapp } from "@/api/certapp"
|
|||
import { getCertappunitList, accessCertappunit } from "@/api/certappunit"
|
||||
import { getCertunitList } from "@/api/certunit";
|
||||
import checkPermission from "@/utils/permission";
|
||||
import { createCertificate } from "@/api/certificate"
|
||||
export default {
|
||||
name: "issue",
|
||||
props:['certapp'],
|
||||
|
@ -128,8 +125,11 @@ getDictList({type__code:'cert_decision', pageoff:true}).then(res=>{
|
|||
});
|
||||
},
|
||||
handleIssue(scope){
|
||||
this.drawerVisible = true
|
||||
|
||||
// this.drawerVisible = true
|
||||
createCertificate({certunit:scope.row.certunit, first_send:'2020-06-19', used_start:'2020-06-19', used_end:'2021-11-11'}).then(res=>{
|
||||
this.$message.success('成功')
|
||||
this.getUnitList()
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
</el-table-column>
|
||||
<el-table-column label="当前状态">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.status}}
|
||||
{{ scope.row.state}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建人">
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
</div>
|
||||
<div class="text item">
|
||||
<span class="span">当前状态</span>
|
||||
{{project.status}}
|
||||
{{project.state}}
|
||||
</div>
|
||||
<div class="text item" v-if="project.assign_by_">
|
||||
<span class="span">下达人</span>
|
||||
|
@ -111,7 +111,7 @@
|
|||
</template>
|
||||
</el-table-column>-->
|
||||
<el-table-column label="当前状态">
|
||||
<template slot-scope="scope">{{ scope.row.status}}</template>
|
||||
<template slot-scope="scope">{{ scope.row.state}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="受理/确认人">
|
||||
<template
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="当前状态">
|
||||
<template slot-scope="scope">{{ scope.row.status}}</template>
|
||||
<template slot-scope="scope">{{ scope.row.state}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建人">
|
||||
<template slot-scope="scope">{{ scope.row.create_by_.name}}</template>
|
||||
|
@ -105,7 +105,7 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="当前状态">
|
||||
<template slot-scope="scope">{{ scope.row.status}}</template>
|
||||
<template slot-scope="scope">{{ scope.row.state}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="是否可派差">
|
||||
<template slot-scope="scope">
|
||||
|
@ -165,12 +165,12 @@ export default {
|
|||
return {
|
||||
listLoading: true,
|
||||
listQuery: {
|
||||
status: "已受理",
|
||||
state: "已受理",
|
||||
},
|
||||
listQuery_project: {
|
||||
page: 1,
|
||||
page_size: 20,
|
||||
status:"待策划"
|
||||
state:"待策划"
|
||||
},
|
||||
projectData: { count: 0, results: [] },
|
||||
};
|
||||
|
@ -193,7 +193,7 @@ export default {
|
|||
},
|
||||
resetFilter() {
|
||||
this.listQuery = {
|
||||
status: "已受理",
|
||||
state: "已受理",
|
||||
};
|
||||
this.getCertappList_();
|
||||
},
|
||||
|
|
|
@ -95,7 +95,7 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="当前状态">
|
||||
<template slot-scope="scope">{{ scope.row.status}}</template>
|
||||
<template slot-scope="scope">{{ scope.row.state}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建人">
|
||||
<template slot-scope="scope">{{ scope.row.create_by_.name}}</template>
|
||||
|
@ -170,7 +170,7 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="当前状态">
|
||||
<template slot-scope="scope">{{ scope.row.status}}</template>
|
||||
<template slot-scope="scope">{{ scope.row.state}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="是否可派差">
|
||||
<template slot-scope="scope">
|
||||
|
@ -195,7 +195,7 @@
|
|||
@click="planProject(scope)"
|
||||
>计划</el-button>
|
||||
<el-button
|
||||
v-if="scope.row.status !='待现场审核'"
|
||||
v-if="scope.row.state !='待现场审核'"
|
||||
type="primary"
|
||||
size="small"
|
||||
:disabled="!checkPermission(['project_assgin'])||!scope.row.can_paichai"
|
||||
|
@ -270,7 +270,7 @@ export default {
|
|||
listQuery_project: {
|
||||
page: 1,
|
||||
page_size: 20,
|
||||
status: "待策划",
|
||||
state: "待策划",
|
||||
planoff: true,
|
||||
},
|
||||
listQuery2: {
|
||||
|
@ -326,7 +326,7 @@ export default {
|
|||
},
|
||||
resetFilter() {
|
||||
this.listQuery = {
|
||||
status: "已受理",
|
||||
state: "已受理",
|
||||
};
|
||||
this.getCertappList_();
|
||||
},
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
</div>
|
||||
<div class="text item">
|
||||
<span class="span">当前状态</span>
|
||||
{{project.status}}
|
||||
{{project.state}}
|
||||
</div>
|
||||
<div class="text item" v-if="project.assign_by_">
|
||||
<span class="span">任务下达人</span>
|
||||
|
@ -145,7 +145,7 @@
|
|||
</template>
|
||||
</el-table-column>-->
|
||||
<el-table-column label="当前状态">
|
||||
<template slot-scope="scope">{{ scope.row.status}}</template>
|
||||
<template slot-scope="scope">{{ scope.row.state}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="受理/确认人">
|
||||
<template
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="当前状态">
|
||||
<template slot-scope="scope">{{ scope.row.status}}</template>
|
||||
<template slot-scope="scope">{{ scope.row.state}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建人">
|
||||
<template slot-scope="scope">{{ scope.row.create_by_.name}}</template>
|
||||
|
@ -111,7 +111,7 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="当前状态">
|
||||
<template slot-scope="scope">{{ scope.row.status}}</template>
|
||||
<template slot-scope="scope">{{ scope.row.state}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建人">
|
||||
<template slot-scope="scope">{{ scope.row.create_by_.name}}</template>
|
||||
|
@ -139,7 +139,7 @@ export default {
|
|||
tableData: [],
|
||||
listLoading: true,
|
||||
listQuery: {
|
||||
status: "已受理",
|
||||
state: "已受理",
|
||||
},
|
||||
deptOptions: [],
|
||||
field_list: [],
|
||||
|
@ -166,7 +166,7 @@ export default {
|
|||
},
|
||||
resetFilter() {
|
||||
this.listQuery = {
|
||||
status: "已受理",
|
||||
state: "已受理",
|
||||
};
|
||||
this.getList();
|
||||
},
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="当前状态" >
|
||||
<template slot-scope="scope">{{ scope.row.status}}</template>
|
||||
<template slot-scope="scope">{{ scope.row.state}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建人">
|
||||
<template slot-scope="scope">{{ scope.row.create_by_.name}}</template>
|
||||
|
@ -44,7 +44,7 @@
|
|||
<template slot-scope="scope">
|
||||
<el-button-group>
|
||||
<el-button
|
||||
v-if="scope.row.status == '创建中'"
|
||||
v-if="scope.row.state == '创建中'"
|
||||
type="warning"
|
||||
size="small"
|
||||
:disabled="!checkPermission(['project_assign'])"
|
||||
|
@ -127,7 +127,7 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="当前状态">
|
||||
<template slot-scope="scope">{{ scope.row.status}}</template>
|
||||
<template slot-scope="scope">{{ scope.row.state}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建人">
|
||||
<template slot-scope="scope">{{ scope.row.create_by_.name}}</template>
|
||||
|
@ -193,7 +193,7 @@ export default {
|
|||
listQuery: {
|
||||
page:1,
|
||||
page_size:20,
|
||||
status: "已受理",
|
||||
state: "已受理",
|
||||
},
|
||||
listQuery_project: {
|
||||
page:1,
|
||||
|
@ -262,7 +262,7 @@ export default {
|
|||
},
|
||||
resetFilter() {
|
||||
this.listQuery = {
|
||||
status: "已受理",
|
||||
state: "已受理",
|
||||
};
|
||||
this.getCertappList_();
|
||||
},
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
# Generated by Django 3.0.7 on 2020-10-09 03:06
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('system', '0031_delete_bscodeset'),
|
||||
('certificate', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterModelOptions(
|
||||
name='certificate',
|
||||
options={'verbose_name': '证书', 'verbose_name_plural': '证书'},
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='certificate',
|
||||
name='enterprise',
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='certificate',
|
||||
name='number',
|
||||
field=models.CharField(default=1, max_length=100, verbose_name='证书编号'),
|
||||
preserve_default=False,
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='certificate',
|
||||
name='state',
|
||||
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='system.Dict', verbose_name='证书状态'),
|
||||
preserve_default=False,
|
||||
),
|
||||
]
|
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 3.0.7 on 2020-10-09 03:42
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('certificate', '0002_auto_20201009_1106'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RenameField(
|
||||
model_name='certificate',
|
||||
old_name='state',
|
||||
new_name='status',
|
||||
),
|
||||
]
|
|
@ -0,0 +1,20 @@
|
|||
# Generated by Django 3.0.7 on 2020-10-09 07:50
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('crm', '0015_certunit_testorgs'),
|
||||
('certificate', '0003_auto_20201009_1142'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='certificate',
|
||||
name='certunit',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='certificate_certunit', to='crm.Certunit', verbose_name='关联单元'),
|
||||
),
|
||||
]
|
|
@ -8,8 +8,16 @@ class Certificate(CommonAModel):
|
|||
"""
|
||||
证书表
|
||||
"""
|
||||
certunit = models.ForeignKey('crm.Certunit', on_delete=models.CASCADE, null=True, blank=True, verbose_name='关联单元')
|
||||
enterprise = models.ForeignKey('crm.Enterprise', on_delete=models.CASCADE, verbose_name='所属公司')
|
||||
number = models.CharField('证书编号', max_length=100)
|
||||
certunit = models.ForeignKey('crm.Certunit', on_delete=models.CASCADE, null=True, blank=True, verbose_name='关联单元', related_name='certificate_certunit')
|
||||
first_send = models.DateField('证书首发时间')
|
||||
used_start = models.DateField('有效期开始')
|
||||
used_end = models.DateField('有效期结束')
|
||||
status = models.ForeignKey(Dict, verbose_name='证书状态', on_delete=models.CASCADE)
|
||||
|
||||
class Meta:
|
||||
verbose_name = '证书'
|
||||
verbose_name_plural = verbose_name
|
||||
|
||||
def __str__(self):
|
||||
return self.number
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
from rest_framework import serializers
|
||||
|
||||
from .models import *
|
||||
from apps.system.serializers import DictSerializer
|
||||
|
||||
|
||||
class CertificateSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
model = Certificate
|
||||
fields = '__all__'
|
||||
|
||||
class CertificateCreateSerializer(serializers.ModelSerializer):
|
||||
number = serializers.CharField(read_only = True)
|
||||
status = serializers.CharField(read_only = True)
|
||||
class Meta:
|
||||
model = Certificate
|
||||
fields = '__all__'
|
||||
|
||||
class CertificateSimpleSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
model = Certificate
|
||||
fields = ['id', 'number']
|
|
@ -0,0 +1,10 @@
|
|||
from django.urls import path, include
|
||||
from .views import *
|
||||
from rest_framework import routers
|
||||
|
||||
router = routers.DefaultRouter()
|
||||
router.register('certificate', CertificateViewSet, basename="certificate")
|
||||
|
||||
urlpatterns = [
|
||||
path('', include(router.urls))
|
||||
]
|
|
@ -1,3 +1,38 @@
|
|||
from apps.certificate.serializers import CertificateSerializer
|
||||
import re
|
||||
from django.http import request
|
||||
from rest_framework.views import APIView
|
||||
from django.shortcuts import render
|
||||
|
||||
from rest_framework.serializers import ModelSerializer
|
||||
from rest_framework.viewsets import ModelViewSet, GenericViewSet
|
||||
from rest_framework.response import Response
|
||||
from rest_framework import status
|
||||
from .models import *
|
||||
from apps.system.models import Dict
|
||||
from apps.system.permission_data import RbacFilterSet
|
||||
from apps.system.mixins import CreateUpdateCustomMixin, OptimizationMixin
|
||||
import random
|
||||
from rest_framework.decorators import action
|
||||
from utils.pagination import PageOrNot
|
||||
from .serializers import *
|
||||
from rest_framework.exceptions import ParseError, NotAuthenticated
|
||||
from django.utils import timezone
|
||||
# Create your views here.
|
||||
|
||||
class CertificateViewSet(PageOrNot, OptimizationMixin, ModelViewSet):
|
||||
perms_map = {'get': 'certificate_view', 'post':'certificate_create', 'put':'certificate_update'}
|
||||
queryset = Certificate.objects.all()
|
||||
serializer_class = CertificateSerializer
|
||||
ordering = ['-create_time']
|
||||
|
||||
def create(self, request, *args, **kwargs):
|
||||
"""
|
||||
证书颁发
|
||||
"""
|
||||
serializer = CertificateCreateSerializer(data=request.data)
|
||||
serializer.is_valid(raise_exception=True)
|
||||
if Certificate.objects.filter(certunit__id=request.data['certunit']).exists():
|
||||
return Response('该认证单元已存在证书', status = status.HTTP_400_BAD_REQUEST)
|
||||
serializer.save(create_by = self.request.user, number = 'ZS' + str(random.randrange(2000,3000)), status = Dict.objects.get(code='validate_01'))
|
||||
headers = self.get_success_headers(serializer.data)
|
||||
return Response(serializer.data, status=status.HTTP_201_CREATED, headers=headers)
|
|
@ -9,6 +9,7 @@ from apps.system.permission_data import RbacFilterSet
|
|||
from apps.system.mixins import CreateUpdateCustomMixin, OptimizationMixin
|
||||
from rest_framework.response import Response
|
||||
from rest_framework import status
|
||||
from rest_framework.decorators import action
|
||||
# Create your views here.
|
||||
|
||||
class EnterpriseViewSet(CreateUpdateCustomMixin, OptimizationMixin, ModelViewSet):
|
||||
|
|
|
@ -37,9 +37,6 @@ class TestOrgNotice(CommonBModel):
|
|||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
class DetectionTask(CommonBModel):
|
||||
|
||||
testorg = models.ForeignKey(TestOrg,verbose_name='检测机构', related_name='detectionTask_testorg', on_delete=models.DO_NOTHING)
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -5,10 +5,10 @@ class CertAppFilter(filters.FilterSet):
|
|||
noproject = filters.BooleanFilter(field_name='project', lookup_expr='isnull')
|
||||
class Meta:
|
||||
model = CertApp
|
||||
fields = ['status', 'noproject']
|
||||
fields = ['state', 'noproject']
|
||||
|
||||
class ProjectFilter(filters.FilterSet):
|
||||
planoff = filters.BooleanFilter(field_name='plan', lookup_expr='isnull')
|
||||
class Meta:
|
||||
model = Project
|
||||
fields = ['plan', 'planoff', 'status', 'certapp_project__member_certapp__user']
|
||||
fields = ['plan', 'planoff', 'state', 'certapp_project__member_certapp__user']
|
|
@ -0,0 +1,14 @@
|
|||
# Generated by Django 3.0.7 on 2020-10-09 03:04
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('project', '0034_evaluationdetail_result'),
|
||||
('project', '0039_auto_20200929_1605'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
]
|
|
@ -0,0 +1,23 @@
|
|||
# Generated by Django 3.0.7 on 2020-10-09 07:18
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('project', '0040_merge_20201009_1104'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='certapp',
|
||||
name='status',
|
||||
field=models.CharField(choices=[('申请', '申请'), ('受理', '受理'), ('策划', '策划'), ('现场审核', '现场审核'), ('产品检测', '产品检测'), ('评定', '评定'), ('出证', '出证'), ('归档', '归档')], default='申请', max_length=50, verbose_name='申请状态'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='project',
|
||||
name='status',
|
||||
field=models.CharField(choices=[('创建中', '创建中'), ('待策划', '待策划'), ('策划中', '策划中'), ('审核任务已下达', '审核任务已下达'), ('审核任务已接受', '审核任务已接受'), ('待现场审核', '待现场审核'), ('现场审核中', '现场审核中'), ('任务已反馈', '任务已反馈'), ('归档', '归档')], default='创建中', max_length=50, verbose_name='项目状态'),
|
||||
),
|
||||
]
|
|
@ -0,0 +1,23 @@
|
|||
# Generated by Django 3.0.7 on 2020-10-09 07:50
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('project', '0041_auto_20201009_1518'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RenameField(
|
||||
model_name='certapp',
|
||||
old_name='status',
|
||||
new_name='state',
|
||||
),
|
||||
migrations.RenameField(
|
||||
model_name='project',
|
||||
old_name='status',
|
||||
new_name='state',
|
||||
),
|
||||
]
|
|
@ -15,7 +15,7 @@ class Project(CommonBModel):
|
|||
"""
|
||||
认证项目
|
||||
"""
|
||||
status_choices = (
|
||||
state_choices = (
|
||||
('创建中', '创建中'),
|
||||
('待策划', '待策划'),
|
||||
('策划中', '策划中'),
|
||||
|
@ -23,9 +23,10 @@ class Project(CommonBModel):
|
|||
('审核任务已接受', '审核任务已接受'),
|
||||
('待现场审核', '待现场审核'),
|
||||
('现场审核中', '现场审核中'),
|
||||
('任务已反馈', '任务已反馈')
|
||||
('任务已反馈', '任务已反馈'),
|
||||
('归档', '归档')
|
||||
)
|
||||
status = models.CharField('项目状态', choices=status_choices, default='创建中', max_length=50)
|
||||
state = models.CharField('项目状态', choices=state_choices, default='创建中', max_length=50)
|
||||
number = models.CharField('项目编号', max_length = 100, null=True, blank=True)
|
||||
auditee = models.ForeignKey(Enterprise, related_name='project_auditee', on_delete=models.DO_NOTHING, verbose_name='受审核方')
|
||||
auditee_v = JSONField(verbose_name='受审核方', default=dict)
|
||||
|
@ -50,13 +51,15 @@ class CertApp(CommonBModel):
|
|||
"""
|
||||
认证受理
|
||||
"""
|
||||
status_choices = (
|
||||
('草稿', '草稿'),
|
||||
('已申请', '已申请'),
|
||||
('已受理', '已受理'),
|
||||
('进行中', '进行中'),
|
||||
('已中止', '已中止'),
|
||||
('已完成', '已完成')
|
||||
state_choices = (
|
||||
('申请', '申请'),
|
||||
('受理', '受理'),
|
||||
('策划', '策划'),
|
||||
('现场审核', '现场审核'),
|
||||
('产品检测', '产品检测'),
|
||||
('评定', '评定'),
|
||||
('出证', '出证'),
|
||||
('归档', '归档'),
|
||||
)
|
||||
result_choices = (
|
||||
('未评审', '未评审'),
|
||||
|
@ -71,7 +74,7 @@ class CertApp(CommonBModel):
|
|||
applicant_v = JSONField(verbose_name='申请方')
|
||||
applicant = models.ForeignKey(Enterprise, related_name='certapp_applicant', on_delete=models.DO_NOTHING)
|
||||
|
||||
status = models.CharField('申请状态', choices=status_choices, default='草稿', max_length=50)
|
||||
state = models.CharField('申请状态', choices=state_choices, default='申请', max_length=50)
|
||||
evresult = models.CharField('评审结论', choices = result_choices, default='未评审', max_length=50)
|
||||
evremark = models.TextField('备注', blank=True)
|
||||
level = models.ForeignKey(Dict, verbose_name='业务级别', related_name='certapp_level', on_delete=models.DO_NOTHING, default=Dict.objects.get(code='ybxm').id)
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from apps.project.filters import CertAppFilter
|
||||
from apps.plan.models import Plan
|
||||
from rest_framework import serializers
|
||||
|
||||
|
@ -56,10 +57,11 @@ class CertappSerializer(serializers.ModelSerializer):
|
|||
return queryset
|
||||
|
||||
from apps.crm.serializers import CertunitSimpleSerializer
|
||||
from apps.certificate.models import Certificate
|
||||
class CertappunitSerializer(serializers.ModelSerializer):
|
||||
certunit_ = CertunitSimpleSerializer(source = 'certunit', read_only=True)
|
||||
decision_ = DictSimpleSerializer(source = 'decision', read_only=True)
|
||||
|
||||
certificate_ = serializers.SerializerMethodField()
|
||||
class Meta:
|
||||
model = Certappunit
|
||||
fields = '__all__'
|
||||
|
@ -70,6 +72,13 @@ class CertappunitSerializer(serializers.ModelSerializer):
|
|||
queryset = queryset.select_related('certunit','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
|
||||
|
|
|
@ -77,7 +77,7 @@ class CertappViewset(PageOrNot, RbacFilterSet, ModelViewSet):
|
|||
queryset = CertApp.objects.all()
|
||||
serializer_class = CertappSerializer
|
||||
ordering = ['-create_time']
|
||||
filterset_fields = ['status', 'project']
|
||||
filterset_fields = ['state', 'project']
|
||||
# filterset_class = CertAppFilter
|
||||
|
||||
|
||||
|
@ -99,7 +99,7 @@ class CertappViewset(PageOrNot, RbacFilterSet, ModelViewSet):
|
|||
完成受理
|
||||
"""
|
||||
obj = self.get_object()
|
||||
obj.status = '已受理'
|
||||
obj.state = '策划'
|
||||
obj.save()
|
||||
return Response(status=status.HTTP_200_OK)
|
||||
|
||||
|
@ -127,6 +127,7 @@ class CertappViewset(PageOrNot, RbacFilterSet, ModelViewSet):
|
|||
instance = self.get_object()
|
||||
instance.conclusion = Dict.objects.get(pk=request.data['conclusion'])
|
||||
instance.score = request.data['score']
|
||||
instance.state = '出证'
|
||||
instance.save()
|
||||
instance.nonitems.clear()
|
||||
instance.nonitems.add(*request.data['nonitems'])
|
||||
|
@ -196,7 +197,7 @@ class ProjectViewSet(RbacFilterSet, ModelViewSet):
|
|||
if self.request.user is not None:
|
||||
instance = serializer.save(create_by = self.request.user, belong_dept=self.request.user.dept)
|
||||
if 'certapps' in postdata and postdata['certapps']:
|
||||
CertApp.objects.filter(pk__in = postdata['certapps']).update(project=instance, status='进行中')
|
||||
CertApp.objects.filter(pk__in = postdata['certapps']).update(project=instance, state='进行中')
|
||||
headers = self.get_success_headers(serializer.data)
|
||||
return Response(serializer.data, status=status.HTTP_201_CREATED, headers=headers)
|
||||
else:
|
||||
|
@ -209,12 +210,12 @@ class ProjectViewSet(RbacFilterSet, ModelViewSet):
|
|||
项目流转
|
||||
"""
|
||||
obj = self.get_object()
|
||||
if obj.status == '创建中':
|
||||
obj.status = '待策划'
|
||||
if obj.state == '创建中':
|
||||
obj.state = '待策划'
|
||||
obj.save()
|
||||
return Response(status=status.HTTP_200_OK)
|
||||
elif obj.status == '策划中' and obj.can_paichai:
|
||||
obj.status = '待现场审核'
|
||||
elif obj.state == '策划中' and obj.can_paichai:
|
||||
obj.state = '待现场审核'
|
||||
obj.save()
|
||||
return Response(status=status.HTTP_200_OK)
|
||||
else:
|
||||
|
@ -233,8 +234,8 @@ class ProjectViewSet(RbacFilterSet, ModelViewSet):
|
|||
objs = Project.objects.filter(pk__in=projects)
|
||||
for i in objs:
|
||||
i.plan=plan
|
||||
if i.status == '待策划':
|
||||
i.status == '策划中'
|
||||
if i.state == '待策划':
|
||||
i.state == '策划中'
|
||||
i.save()
|
||||
return Response(status=status.HTTP_200_OK)
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ urlpatterns = [
|
|||
path('plan/', include('apps.plan.urls')),
|
||||
path('audit/', include('apps.audit.urls')),
|
||||
path('laboratory/', include('apps.laboratory.urls')),
|
||||
path('certificate/', include('apps.certificate.urls')),
|
||||
# path('accessment/', include('apps.accessment.urls')),
|
||||
path('docs/', include_docs_urls(title="接口文档",
|
||||
authentication_classes=[], permission_classes=[])),
|
||||
|
|
Loading…
Reference in New Issue