diff --git a/client/.env.development b/client/.env.development
index db28ec5..c5200d4 100644
--- a/client/.env.development
+++ b/client/.env.development
@@ -3,10 +3,10 @@ ENV = 'development'
# base api
#VUE_APP_BASE_API = 'http://10.0.11.127:8000/api'
-#VUE_APP_BASE_API = 'http://127.0.0.1:8000/api'
+VUE_APP_BASE_API = 'http://127.0.0.1:8000/api'
#VUE_APP_BASE_API = 'https://testsearch.ctc.ac.cn/api'
-VUE_APP_BASE_API = 'http://47.95.0.242:9101/api'
+#VUE_APP_BASE_API = 'http://47.95.0.242:9101/api'
# vue-cli uses the VUE_CLI_BABEL_TRANSPILE_MODULES environment variable,
diff --git a/client_mp/components/.DS_Store b/client_mp/components/.DS_Store
new file mode 100644
index 0000000..5f98ef7
Binary files /dev/null and b/client_mp/components/.DS_Store differ
diff --git a/client_mp/components/linzq-imgUpload/.DS_Store b/client_mp/components/linzq-imgUpload/.DS_Store
new file mode 100644
index 0000000..511f62b
Binary files /dev/null and b/client_mp/components/linzq-imgUpload/.DS_Store differ
diff --git a/client_mp/components/linzq-imgUpload/linzq-imgUpload.vue b/client_mp/components/linzq-imgUpload/linzq-imgUpload.vue
new file mode 100644
index 0000000..a8604a8
--- /dev/null
+++ b/client_mp/components/linzq-imgUpload/linzq-imgUpload.vue
@@ -0,0 +1,183 @@
+
+
+
+
+
+
+ 上传图片
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/client_mp/components/linzq-imgUpload/shanchus2.png b/client_mp/components/linzq-imgUpload/shanchus2.png
new file mode 100644
index 0000000..c2cb8e3
Binary files /dev/null and b/client_mp/components/linzq-imgUpload/shanchus2.png differ
diff --git a/client_mp/components/linzq-imgUpload/tupianadd.png b/client_mp/components/linzq-imgUpload/tupianadd.png
new file mode 100644
index 0000000..3d032af
Binary files /dev/null and b/client_mp/components/linzq-imgUpload/tupianadd.png differ
diff --git a/client_mp/pages/inspectrecord/recorddo.vue b/client_mp/pages/inspectrecord/recorddo.vue
index 44ed9e0..fe5f065 100644
--- a/client_mp/pages/inspectrecord/recorddo.vue
+++ b/client_mp/pages/inspectrecord/recorddo.vue
@@ -23,7 +23,7 @@
-
+
diff --git a/client_mp/pages/vod/video.vue b/client_mp/pages/vod/video.vue
index b694ff7..8a5a0d6 100644
--- a/client_mp/pages/vod/video.vue
+++ b/client_mp/pages/vod/video.vue
@@ -151,9 +151,6 @@
// 点击导航切换swiper
taggleNav(val) {
this.swiperIndex = val;
- if (this.list[val].content.length == 0) {
- this.getVideos()
- }
},
// 滚动tabs以及移动下划线
scrollDom() {
diff --git a/client_mp/store/index.js b/client_mp/store/index.js
index 6698ed9..570fc7e 100644
--- a/client_mp/store/index.js
+++ b/client_mp/store/index.js
@@ -35,6 +35,7 @@ const store = new Vuex.Store({
vuex_token: lifeData.vuex_token ? lifeData.vuex_token : '',
// vuex_host: 'http://127.0.0.1:8000',
//vuex_api: 'http://47.95.0.242:9101/api',
+ //vuex_api: 'http://127.0.0.1:8000/api',
// vuex_apifile: 'http://127.0.0.1:8000/api/file/',
vuex_host: 'https://testsearch.ctc.ac.cn',
diff --git a/server/apps/ability/migrations/0020_ability.py b/server/apps/ability/migrations/0020_ability.py
new file mode 100644
index 0000000..019c551
--- /dev/null
+++ b/server/apps/ability/migrations/0020_ability.py
@@ -0,0 +1,39 @@
+# Generated by Django 3.0.5 on 2021-07-19 02:38
+
+from django.db import migrations, models
+import django.utils.timezone
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('ability', '0019_auto_20210129_0957'),
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='Ability',
+ 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_deleted', models.BooleanField(default=False, help_text='删除标记', verbose_name='删除标记')),
+ ('dlxh', models.TextField(blank=True, null=True, verbose_name='大类序号')),
+ ('dlmc', models.TextField(blank=True, null=True, verbose_name='大类')),
+ ('lbxh', models.TextField(blank=True, null=True, verbose_name='类别序号')),
+ ('lbmc', models.TextField(blank=True, null=True, verbose_name='类别名称')),
+ ('xmxh', models.TextField(blank=True, null=True, verbose_name='项目序号')),
+ ('xmmc', models.TextField(blank=True, null=True, verbose_name='项目名称')),
+ ('bzmc', models.TextField(blank=True, null=True, verbose_name='标准名称')),
+ ('bzbh', models.TextField(blank=True, null=True, verbose_name='标准编号')),
+ ('bztk', models.TextField(blank=True, null=True, verbose_name='标准条款')),
+ ('xzfw', models.TextField(blank=True, null=True, verbose_name='限制范围')),
+ ('bz', models.TextField(blank=True, null=True, verbose_name='备注')),
+ ('cma', models.TextField(blank=True, null=True, verbose_name='CMA中心')),
+ ('cna', models.TextField(blank=True, null=True, verbose_name='CNAS中心')),
+ ],
+ options={
+ 'verbose_name': '记录合并',
+ },
+ ),
+ ]
diff --git a/server/apps/ability/migrations/0021_auto_20210719_1237.py b/server/apps/ability/migrations/0021_auto_20210719_1237.py
new file mode 100644
index 0000000..86e7c99
--- /dev/null
+++ b/server/apps/ability/migrations/0021_auto_20210719_1237.py
@@ -0,0 +1,18 @@
+# Generated by Django 3.0.5 on 2021-07-19 04:37
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('ability', '0020_ability'),
+ ]
+
+ operations = [
+ migrations.RenameField(
+ model_name='ability',
+ old_name='cna',
+ new_name='cnas',
+ ),
+ ]
diff --git a/server/apps/ability/migrations/0022_auto_20210719_1411.py b/server/apps/ability/migrations/0022_auto_20210719_1411.py
new file mode 100644
index 0000000..8a51df0
--- /dev/null
+++ b/server/apps/ability/migrations/0022_auto_20210719_1411.py
@@ -0,0 +1,23 @@
+# Generated by Django 3.0.5 on 2021-07-19 06:11
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('ability', '0021_auto_20210719_1237'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='ability',
+ name='cma_o',
+ field=models.TextField(blank=True, null=True, verbose_name='中心'),
+ ),
+ migrations.AddField(
+ model_name='ability',
+ name='cma_oplace',
+ field=models.TextField(blank=True, null=True, verbose_name='地点'),
+ ),
+ ]
diff --git a/server/apps/ability/migrations/0023_auto_20210728_0902.py b/server/apps/ability/migrations/0023_auto_20210728_0902.py
new file mode 100644
index 0000000..ecfe041
--- /dev/null
+++ b/server/apps/ability/migrations/0023_auto_20210728_0902.py
@@ -0,0 +1,46 @@
+# Generated by Django 3.0.5 on 2021-07-28 01:02
+
+from django.db import migrations, models
+import django.db.models.deletion
+import django.utils.timezone
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('system', '0018_auto_20210430_1156'),
+ ('ability', '0022_auto_20210719_1411'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='qualification',
+ name='ssbm',
+ field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='qualification_ssbm', to='system.Organization'),
+ ),
+ migrations.CreateModel(
+ name='Correct',
+ 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_deleted', models.BooleanField(default=False, help_text='删除标记', verbose_name='删除标记')),
+ ('dlxh', models.TextField(blank=True, null=True, verbose_name='大类序号')),
+ ('dlmc', models.TextField(blank=True, null=True, verbose_name='大类')),
+ ('lbxh', models.TextField(blank=True, null=True, verbose_name='类别序号')),
+ ('lbmc', models.TextField(blank=True, null=True, verbose_name='类别名称')),
+ ('bclxh', models.TextField(blank=True, null=True, verbose_name='被测量序号')),
+ ('bclmc', models.TextField(blank=True, null=True, verbose_name='被测量名称')),
+ ('jzgc', models.TextField(blank=True, null=True, verbose_name='校准规程')),
+ ('clfw', models.TextField(blank=True, null=True, verbose_name='测量范围')),
+ ('zqddj', models.TextField(blank=True, null=True, verbose_name='准确度等级')),
+ ('note', models.TextField(blank=True, null=True, verbose_name='说明')),
+ ('ssgs', models.TextField(blank=True, null=True, verbose_name='所属公司')),
+ ('ssbm', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='correct_ssbm', to='system.Organization')),
+ ],
+ options={
+ 'verbose_name': '校验能力',
+ 'verbose_name_plural': '校验能力',
+ },
+ ),
+ ]
diff --git a/server/apps/ability/models.py b/server/apps/ability/models.py
index d6d0058..27c07fb 100644
--- a/server/apps/ability/models.py
+++ b/server/apps/ability/models.py
@@ -6,6 +6,27 @@ from apps.system.models import Organization, User
# Create your models here.
from django.contrib.postgres.fields import JSONField
+class Ability(BaseModel):
+ dlxh = models.TextField('大类序号', null=True, blank=True)
+ dlmc = models.TextField('大类', null=True, blank=True)
+ lbxh = models.TextField('类别序号', null=True,blank=True)
+ lbmc = models.TextField('类别名称', null=True,blank=True)
+ xmxh = models.TextField('项目序号', null=True,blank=True)
+ xmmc = models.TextField('项目名称', null=True,blank=True)
+ bzmc = models.TextField('标准名称', null=True,blank=True)
+ bzbh = models.TextField('标准编号', null=True,blank=True)
+ bztk = models.TextField('标准条款', null=True,blank=True)
+ xzfw = models.TextField('限制范围',null=True,blank=True)
+ bz = models.TextField('备注',null=True,blank=True)
+ cma = models.TextField('CMA中心',null=True,blank=True)
+ cnas = models.TextField('CNAS中心',null=True,blank=True)
+ cma_o = models.TextField('中心',null=True,blank=True)
+ cma_oplace = models.TextField('地点',null=True,blank=True)
+ class Meta:
+ verbose_name='记录合并'
+
+
+
class QueryRecord(BaseModel):
user = models.ForeignKey(User, related_name='record_user', on_delete=models.CASCADE)
path = models.CharField('访问地址', max_length=200)
@@ -18,6 +39,23 @@ class QueryRecord(BaseModel):
verbose_name = '查询记录'
verbose_name_plural = verbose_name
+class Correct(BaseModel):
+ dlxh = models.TextField('大类序号', null=True,blank=True)
+ dlmc = models.TextField('大类', null=True,blank=True)
+ lbxh = models.TextField('类别序号', null=True,blank=True)
+ lbmc = models.TextField('类别名称', null=True,blank=True)
+ bclxh = models.TextField('被测量序号', null=True,blank=True)
+ bclmc = models.TextField('被测量名称', null=True,blank=True)
+ jzgc = models.TextField('校准规程', null=True, blank=True)
+ clfw = models.TextField('测量范围', null=True, blank=True)
+ zqddj = models.TextField('准确度等级', null=True, blank=True)
+ note = models.TextField('说明', null=True, blank=True)
+ ssgs = models.TextField('所属公司', null=True, blank=True)
+ ssbm = models.ForeignKey(Organization, on_delete=models.CASCADE, null=True, blank=True, related_name='correct_ssbm')
+
+ class Meta:
+ verbose_name='校验能力'
+ verbose_name_plural=verbose_name
class CMA(BaseModel):
"""
@@ -71,7 +109,7 @@ class CNAS(BaseModel):
class Qualification(BaseModel):
sszx = models.TextField('所属中心', null=True, blank=True)
- ssbm = models.ForeignKey(Organization, on_delete=models.CASCADE, null=True, blank=True, related_name='system_ssbm')
+ ssbm = models.ForeignKey(Organization, on_delete=models.CASCADE, null=True, blank=True, related_name='qualification_ssbm')
cma = models.TextField('cma资质', null=True, blank=True)
cnas = models.TextField('cnas资质', null=True, blank=True)
other = models.TextField('检验检测相关其它资质', null=True, blank=True)
diff --git a/server/apps/ability/serializers.py b/server/apps/ability/serializers.py
index 53f2e6a..7e7f2b5 100644
--- a/server/apps/ability/serializers.py
+++ b/server/apps/ability/serializers.py
@@ -66,4 +66,18 @@ class QualificationotherSerializer(serializers.ModelSerializer):
def setup_eager_loading(queryset):
""" Perform necessary eager loading of data. """
queryset = queryset.select_related('qualification')
+ return queryset
+
+class CorrectSerializer(serializers.ModelSerializer):
+ """
+ 校验能力序列化
+ """
+ bm_ =OrganizationSerializer(source = 'ssbm', read_only=True)
+ class Meta:
+ model = Correct
+ fields = '__all__'
+ @staticmethod
+ def setup_eager_loading(queryset):
+ """ Perform necessary eager loading of data. """
+ queryset = queryset.select_related('ssbm')
return queryset
\ No newline at end of file
diff --git a/server/apps/ability/urls.py b/server/apps/ability/urls.py
index 41228a7..2cc4ec7 100644
--- a/server/apps/ability/urls.py
+++ b/server/apps/ability/urls.py
@@ -1,6 +1,7 @@
+from django.db.models import base
from django.urls import path, include
from rest_framework import routers
-from .views import CMAViewSet, CNASViewSet, QualificationViewSet,InspectionViewSet,QualificationotherViewSet, QueryRecordListViewSet
+from .views import CMAViewSet, CNASViewSet, CorrectViewSet, QualificationViewSet,InspectionViewSet,QualificationotherViewSet, QueryRecordListViewSet, correct_ability, merge_cma, merge_cnas
router = routers.DefaultRouter()
router.register('cma', CMAViewSet, basename="cma")
@@ -9,6 +10,10 @@ router.register('qualification', QualificationViewSet, basename="qualification")
router.register('qualificationother', QualificationotherViewSet, basename="qualificationother")
router.register('inspection', InspectionViewSet, basename="inspection")
router.register('queryrecord', QueryRecordListViewSet, basename="queryrecord")
+router.register('correct', CorrectViewSet, basename="correct")
urlpatterns = [
+ path('merge/cma/', merge_cma),
+ path('merge/cnas/', merge_cnas),
+ # path('correct/', correct_ability),
path('', include(router.urls))
]
\ No newline at end of file
diff --git a/server/apps/ability/views.py b/server/apps/ability/views.py
index 3af95cb..ff33350 100644
--- a/server/apps/ability/views.py
+++ b/server/apps/ability/views.py
@@ -14,6 +14,7 @@ from apps.system.models import Organization
from openpyxl import Workbook, load_workbook
from django.db.models import Count
from utils.pagination import PageOrNot
+from rest_framework.views import APIView
# Create your views here.
import json
@@ -26,8 +27,7 @@ class RecordMixin():
will instead be performed lazily, the first time either
`request.user` or `request.auth` is accessed.
"""
- user = request.user
- if request.method == 'GET' and user.username != 'admin':
+ if request.user and request.method == 'GET' and request.user.username != 'admin':
QueryRecord.objects.create(user=user,path=request.path,ip=request.META.get('HTTP_X_FORWARDED_FOR'),method=\
request.method,search=request.query_params.get('search',None),query=request.query_params)
@@ -364,6 +364,55 @@ class CNASViewSet(RecordMixin, ModelViewSet):
return Response(status = status.HTTP_200_OK)
+class CorrectViewSet(RecordMixin, ModelViewSet):
+ """
+ 校验能力:增删改查
+ """
+ perms_map = {'get': 'correct_view', 'post': 'correct_create',
+ 'put': 'correct_update', 'delete': 'correct_delete'}
+ queryset = Correct.objects.all()
+ serializer_class = CorrectSerializer
+ search_fields = ['dlmc', 'lbmc', 'bclmc','jzgc']
+ ordering_fields = ['dlmc']
+ ordering = ['create_time', 'dlmc']
+ filterset_fields = ['ssbm']
+
+ @action(methods=['post'], detail=False, perms_map = {'post':'correct_delete'})
+ def deletes(self, request):
+ array = request.data['ids']
+ Correct.objects.filter(pk__in=array).delete()
+ return Response(status = status.HTTP_200_OK)
+
+ @action(methods=['get'], detail=False, perms_map = {'*':'*'})
+ def group(self, request, pk=None):
+ """
+ 聚合查询列
+ """
+ queryset = self.filter_queryset(self.get_queryset())
+ ret = []
+ if request.query_params.get('group_by', None):
+ group_by = request.query_params.get('group_by')
+ group_by_data = list(queryset.values(group_by).annotate(count=Count(group_by)).order_by(group_by))
+ for i in group_by_data:
+ if i[group_by] and i['count']:
+ ret.append({'text':i[group_by]+'('+ str(i['count']) +')','value':i[group_by]})
+ return Response(ret)
+
+ @action(methods=['post'], detail=False, url_path="import")
+ def correct_import(self, request, pk=None):
+ """
+ 导入校验能力
+ """
+ filepath = request.data['path']
+ fullpath = settings.BASE_DIR + filepath
+ if fullpath.endswith('.xlsx'):
+ ret = import_correct(fullpath)
+ if ret[0]:
+ return Response()
+ return Response(ret[1], status=status.HTTP_400_BAD_REQUEST)
+ else:
+ return Response('不支持非xlsx格式', status = status.HTTP_400_BAD_REQUEST)
+
def import_qualification(path):
wb = load_workbook(path)
sheet = wb.worksheets[0]
@@ -593,4 +642,165 @@ def import_inspection(filename, path):
data['sszx'] = sszx
datalist.append(Inspection(**data))
i = i + 1
- Inspection.objects.bulk_create(datalist)
\ No newline at end of file
+ Inspection.objects.bulk_create(datalist)
+
+def import_correct(path):
+ wb = load_workbook(path,data_only=True)
+ sheet = wb.worksheets[0]
+ datalist = []
+ ssgs = sheet['k3'].value
+ try:
+ ssbm = Organization.objects.get(name=ssgs)
+ except:
+ return False , ssgs+'不存在'
+ if Correct.objects.filter(ssbm=ssbm).exists():
+ Correct.objects.filter(ssbm=ssbm).delete()
+ i = 3
+ max_row = sheet.max_row
+ defaultv = {}
+ while i