检测资质修改导入

This commit is contained in:
shilixia 2020-10-20 11:24:29 +08:00
parent 588f88f180
commit 0bb202749b
3 changed files with 42 additions and 12 deletions

View File

@ -36,7 +36,7 @@
</el-col> </el-col>
</el-row> </el-row>
<div style="margin-top:10px"> <div style="margin-top:10px">
<el-button type="primary" icon="el-icon-plus" @click="handleAdd" v-if="checkPermission(['qualification_create'])">新增</el-button> <el-button type="primary" style="display:none" icon="el-icon-plus" @click="handleAdd" v-if="checkPermission(['qualification_create'])">新增</el-button>
<el-popover <el-popover
placement="top" placement="top"
@ -79,38 +79,46 @@
ref="filterTable" ref="filterTable"
@filter-change="filterChange" @filter-change="filterChange"
> >
<el-table-column type="index" width="50" /> <el-table-column fixed type="index" width="50" />
<el-table-column label="所属单位" <el-table-column fixed label="所属单位" width="150"
prop="sszx" prop="sszx"
column-key="sszx" column-key="sszx"
:filters="groupBy.sszx" :filters="groupBy.sszx"
:filter-multiple="false" :filter-multiple="false"
> >
<template slot-scope="scope">{{ scope.row.sszx }}</template> <template slot-scope="scope">{{ scope.row.sszx }}</template>
</el-table-column> </el-table-column>
<el-table-column label="CMA资质"> <el-table-column width="150" fixed label="CMA资质">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-html="showlight(scope.row.cma)"></span> <span v-html="showlight(scope.row.cma)"></span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="CNAS资质"> <el-table-column width="150" fixed label="CNAS资质">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-html="showlight(scope.row.cnas)"></span> <span v-html="showlight(scope.row.cnas)"></span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="其它资质"> <el-table-column width="1050" label="检验检测相关其他资质及校准资质">
<el-table-column label="其它资质" width="360">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-html="showlight(scope.row.other)" ></span> <p style="border-bottom: 1px dashed blue" v-for="item in scope.row.otherqualification" v-html="showlight(item.name)" ></p>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="主要服务"> <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>
</template>
</el-table-column>
</el-table-column>
<el-table-column fixed="right" width="200" label="主要服务">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-html="showlight(scope.row.service)"></span> <span v-html="showlight(scope.row.service)"></span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作"> <el-table-column width="150" fixed="right" label="操作">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
style="display:none"
:disabled="!checkPermission(['qualification_update'])" :disabled="!checkPermission(['qualification_update'])"
type="primary" type="primary"
size="small" size="small"

View File

@ -0,0 +1,19 @@
# Generated by Django 3.0.5 on 2020-10-20 01:20
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('ability', '0011_qualificationother'),
]
operations = [
migrations.AlterField(
model_name='qualificationother',
name='qualification',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='other_qualification', to='ability.Qualification'),
),
]

View File

@ -224,12 +224,14 @@ def import_qualification(path):
sheet = wb.worksheets[0] sheet = wb.worksheets[0]
i = 3 i = 3
max_row = sheet.max_row max_row = sheet.max_row
obj = {}
Qualificationother.objects.all().delete()
while i<max_row+1: while i<max_row+1:
sszx = sheet['b'+str(i)].value sszx = sheet['b'+str(i)].value
cma = sheet['c'+str(i)].value cma = sheet['c'+str(i)].value
cnas = sheet['d'+str(i)].value cnas = sheet['d'+str(i)].value
service = sheet['g'+str(i)].value service = sheet['g'+str(i)].value
name = sheet['g'+str(i)].value name = sheet['e'+str(i)].value
description = sheet['f'+str(i)].value description = sheet['f'+str(i)].value
if sszx: if sszx:
if Qualification.objects.filter(sszx=sszx).exists(): if Qualification.objects.filter(sszx=sszx).exists():
@ -240,9 +242,10 @@ def import_qualification(path):
qualification.cnas = cnas qualification.cnas = cnas
qualification.service = service qualification.service = service
qualification.save() qualification.save()
obj = qualification
Qualificationother.objects.create(qualification=qualification, name=name, description=description) Qualificationother.objects.create(qualification=qualification, name=name, description=description)
else: else:
Qualificationother.objects.create(qualification=qualification, name=name, description=description) Qualificationother.objects.create(qualification=obj, name=name, description=description)
i = i + 1 i = i + 1