id number
This commit is contained in:
parent
1086570fcc
commit
449ace26e2
|
@ -73,6 +73,7 @@ export function deleteConsumers(data) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export function importConsumer(data) {
|
export function importConsumer(data) {
|
||||||
return request({
|
return request({
|
||||||
url: `/crm/consumer/import/`,
|
url: `/crm/consumer/import/`,
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
<span>{{ scope.row.create_admin_name }}</span>
|
<span>{{ scope.row.create_admin_name }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column align="center" label="操作">
|
<el-table-column align="center" label="操作" fixed="right">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button-group>
|
<el-button-group>
|
||||||
<el-button
|
<el-button
|
||||||
|
|
|
@ -93,6 +93,7 @@
|
||||||
>刷新重置</el-button>
|
>刷新重置</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div style="margin-top:10px">
|
<div style="margin-top:10px">
|
||||||
|
|
||||||
<el-button type="primary" @click="handleAddUser" icon="el-icon-plus">新增</el-button>
|
<el-button type="primary" @click="handleAddUser" icon="el-icon-plus">新增</el-button>
|
||||||
<el-popover
|
<el-popover
|
||||||
type="primary"
|
type="primary"
|
||||||
|
@ -127,12 +128,22 @@
|
||||||
@click="exportConsumer"
|
@click="exportConsumer"
|
||||||
v-if="checkPermission(['consumer__export'])"
|
v-if="checkPermission(['consumer__export'])"
|
||||||
>导出Excel</el-button>
|
>导出Excel</el-button>
|
||||||
|
<el-button-group>
|
||||||
<el-button
|
<el-button
|
||||||
type="danger"
|
type="danger"
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
|
round
|
||||||
@click="handleDeletes"
|
@click="handleDeletes"
|
||||||
v-if="checkPermission(['consumer__deletes'])"
|
v-if="checkPermission(['consumer__deletes'])"
|
||||||
>批量删除</el-button>
|
>批量删除</el-button>
|
||||||
|
<!-- <el-button
|
||||||
|
type="primary"
|
||||||
|
icon="el-icon-search"
|
||||||
|
round
|
||||||
|
@click="handleCands"
|
||||||
|
v-if="checkPermission(['consumer__candidates'])"
|
||||||
|
>批量查证</el-button> -->
|
||||||
|
</el-button-group>
|
||||||
<el-checkbox
|
<el-checkbox
|
||||||
v-model="showCreate"
|
v-model="showCreate"
|
||||||
class="filter-item"
|
class="filter-item"
|
||||||
|
@ -170,16 +181,16 @@
|
||||||
v-if="scope.row.company_name != null"
|
v-if="scope.row.company_name != null"
|
||||||
>{{ scope.row.company_name }}</template>
|
>{{ scope.row.company_name }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="缴费学科">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-tag v-for="item in scope.row.subjects_name" :key="item">{{ item }}</el-tag>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="工作类别" sortable="custom" prop="workscope">
|
<el-table-column label="工作类别" sortable="custom" prop="workscope">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-tag v-if="scope.row.workscope_name">{{ scope.row.workscope_name }}</el-tag>
|
<el-tag v-if="scope.row.workscope_name">{{ scope.row.workscope_name }}</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column label="证书信息">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<!-- <el-tag v-if="scope.row.workscope_name">{{ scope.row.workscope_name }}</el-tag> -->
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="创建信息" sortable="custom" prop="create_time" v-if="showCreate">
|
<el-table-column label="创建信息" sortable="custom" prop="create_time" v-if="showCreate">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span v-if="scope.row.create_admin_">{{ scope.row.create_admin_.username }}/</span>
|
<span v-if="scope.row.create_admin_">{{ scope.row.create_admin_.username }}/</span>
|
||||||
|
@ -301,6 +312,9 @@
|
||||||
value-format="yyyy-MM-dd">
|
value-format="yyyy-MM-dd">
|
||||||
</el-date-picker>
|
</el-date-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="身份证号" prop="ID_number1">
|
||||||
|
<el-input v-model="consumer.ID_number1" placeholder="身份证号" />
|
||||||
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div style="text-align:right;">
|
<div style="text-align:right;">
|
||||||
<el-button type="danger" @click="dialogVisible=false">取消</el-button>
|
<el-button type="danger" @click="dialogVisible=false">取消</el-button>
|
||||||
|
@ -675,7 +689,7 @@ export default {
|
||||||
exportConsumer(this.listQuery).then((response) => {
|
exportConsumer(this.listQuery).then((response) => {
|
||||||
loading.close();
|
loading.close();
|
||||||
window.open(response.data.path, "_blank");
|
window.open(response.data.path, "_blank");
|
||||||
});
|
}).catch(()=>{loading.close()});
|
||||||
},
|
},
|
||||||
changeSort(val) {
|
changeSort(val) {
|
||||||
if (val.order == "ascending") {
|
if (val.order == "ascending") {
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
# Generated by Django 3.0.4 on 2020-09-01 03:05
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
import django.utils.timezone
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('crm', '0023_auto_20200826_1444'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='consumer',
|
||||||
|
name='ID_number1',
|
||||||
|
field=models.CharField(blank=True, max_length=100, null=True, verbose_name='身份证号'),
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Candidate',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('create_time', models.DateTimeField(default=django.utils.timezone.now, help_text='创建时间', verbose_name='创建时间')),
|
||||||
|
('update_time', models.DateTimeField(auto_now=True, help_text='修改时间', verbose_name='修改时间')),
|
||||||
|
('is_delete', models.BooleanField(default=False, help_text='删除标记', verbose_name='删除标记')),
|
||||||
|
('report_number', models.TextField(verbose_name='报告单号')),
|
||||||
|
('issue_date', models.DateField(verbose_name='发证日期')),
|
||||||
|
('consumer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='candidate_consumer', to='crm.Consumer')),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'abstract': False,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
]
|
|
@ -72,6 +72,7 @@ class Consumer(CommonModel):
|
||||||
ID_number = models.CharField('身份证号', max_length=100, null=True, blank=True)
|
ID_number = models.CharField('身份证号', max_length=100, null=True, blank=True)
|
||||||
realname = models.CharField('真实姓名', max_length=100, null=True, blank=True)
|
realname = models.CharField('真实姓名', max_length=100, null=True, blank=True)
|
||||||
|
|
||||||
|
ID_number1 = models.CharField('身份证号', max_length=100, null=True, blank=True)
|
||||||
create_admin = models.ForeignKey(UserProfile, on_delete=models.SET_NULL, null=True, blank=True)
|
create_admin = models.ForeignKey(UserProfile, on_delete=models.SET_NULL, null=True, blank=True)
|
||||||
exceed_date = models.DateField('账号过期', null=True, blank=True)
|
exceed_date = models.DateField('账号过期', null=True, blank=True)
|
||||||
|
|
||||||
|
@ -101,3 +102,8 @@ class SendCode(CommonModel):
|
||||||
'''
|
'''
|
||||||
phone = models.CharField(max_length=11, verbose_name='发送号码')
|
phone = models.CharField(max_length=11, verbose_name='发送号码')
|
||||||
code = models.CharField(max_length=4, verbose_name= '验证码')
|
code = models.CharField(max_length=4, verbose_name= '验证码')
|
||||||
|
|
||||||
|
class Candidate(CommonModel):
|
||||||
|
consumer = models.ForeignKey(Consumer, on_delete=models.CASCADE, related_name='candidate_consumer')
|
||||||
|
report_number = models.TextField('报告单号')
|
||||||
|
issue_date = models.DateField('发证日期')
|
|
@ -337,6 +337,8 @@ class ConsumerViewSet(ModelViewSet):
|
||||||
return Response({"error":"工作类别列错误!"})
|
return Response({"error":"工作类别列错误!"})
|
||||||
if sheet['e2'].value != '角色':
|
if sheet['e2'].value != '角色':
|
||||||
return Response({"error":"角色列错误!"})
|
return Response({"error":"角色列错误!"})
|
||||||
|
if sheet['f2'].value != '身份证号':
|
||||||
|
return Response({"error":"身份证号列错误!"})
|
||||||
m = 3
|
m = 3
|
||||||
while sheet['B'+str(m)].value:
|
while sheet['B'+str(m)].value:
|
||||||
name = sheet['A'+str(m)].value
|
name = sheet['A'+str(m)].value
|
||||||
|
@ -345,6 +347,9 @@ class ConsumerViewSet(ModelViewSet):
|
||||||
username = sheet['B'+str(m)].value
|
username = sheet['B'+str(m)].value
|
||||||
if username:
|
if username:
|
||||||
username = str(username).replace(' ', '').replace("\n", "")
|
username = str(username).replace(' ', '').replace("\n", "")
|
||||||
|
ID_number1 = sheet['F'+str(m)].value
|
||||||
|
if ID_number1:
|
||||||
|
ID_number1 = str(ID_number1).replace(' ', '').replace("\n", "")
|
||||||
companyname = sheet['C'+str(m)].value
|
companyname = sheet['C'+str(m)].value
|
||||||
if companyname:
|
if companyname:
|
||||||
companyname = companyname.replace(' ', '')
|
companyname = companyname.replace(' ', '')
|
||||||
|
@ -362,6 +367,7 @@ class ConsumerViewSet(ModelViewSet):
|
||||||
obj.create_admin = request.user
|
obj.create_admin = request.user
|
||||||
obj.name = name
|
obj.name = name
|
||||||
obj.company = companyobj
|
obj.company = companyobj
|
||||||
|
obj.ID_number1 = ID_number1
|
||||||
obj.save()
|
obj.save()
|
||||||
if workscope:
|
if workscope:
|
||||||
workscope = workscope.replace(' ', '')
|
workscope = workscope.replace(' ', '')
|
||||||
|
@ -389,6 +395,8 @@ class ConsumerViewSet(ModelViewSet):
|
||||||
def export(self, request):
|
def export(self, request):
|
||||||
queryset = self.filter_queryset(self.queryset)
|
queryset = self.filter_queryset(self.queryset)
|
||||||
queryset = ConsumerSerializer.setup_eager_loading(queryset) # 性能优化
|
queryset = ConsumerSerializer.setup_eager_loading(queryset) # 性能优化
|
||||||
|
if queryset.count()>1000:
|
||||||
|
return Response({'error':'数据量超过1000,请筛选后导出'})
|
||||||
serializer = ConsumerSerializer(instance=queryset, many=True)
|
serializer = ConsumerSerializer(instance=queryset, many=True)
|
||||||
path = export_consumer(serializer.data)
|
path = export_consumer(serializer.data)
|
||||||
return Response({'path': path})
|
return Response({'path': path})
|
||||||
|
@ -418,7 +426,6 @@ class ConsumerViewSet(ModelViewSet):
|
||||||
elif i.username and i.openid:
|
elif i.username and i.openid:
|
||||||
i.role = role2
|
i.role = role2
|
||||||
i.save()
|
i.save()
|
||||||
print(i.id)
|
|
||||||
return Response(status=status.HTTP_200_OK)
|
return Response(status=status.HTTP_200_OK)
|
||||||
|
|
||||||
@action(methods=['get'], detail=False,
|
@action(methods=['get'], detail=False,
|
||||||
|
|
Loading…
Reference in New Issue