diff --git a/client/.env.development b/client/.env.development index 487e749..f6c64bf 100644 --- a/client/.env.development +++ b/client/.env.development @@ -3,8 +3,8 @@ ENV = 'development' # base api #VUE_APP_BASE_API = 'http://10.0.11.127:8000/api' -#VUE_APP_BASE_API = 'http://127.0.0.1:2222/api' -VUE_APP_BASE_API = 'https://testsearch.ctc.ac.cn/api' +VUE_APP_BASE_API = 'http://127.0.0.1:2222/api' +# VUE_APP_BASE_API = 'https://testsearch.ctc.ac.cn/api' #VUE_APP_BASE_API = 'http://47.95.0.242:9101/api' diff --git a/client/package.json b/client/package.json index 086cf64..5617562 100644 --- a/client/package.json +++ b/client/package.json @@ -5,8 +5,8 @@ "author": "Pan ", "license": "MIT", "scripts": { - "dev": "vue-cli-service serve", - "build:prod": "vue-cli-service build", + "dev": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve", + "build:prod": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build", "build:stage": "vue-cli-service build --mode staging", "preview": "node build/index.js --preview", "lint": "eslint --ext .js,.vue src", @@ -19,7 +19,7 @@ "axios": "0.18.1", "echarts": "^5.4.0", "element-china-area-data": "^5.0.2", - "element-ui": "2.13.0", + "element-ui": "^2.15.13", "file-saver": "^2.0.2", "js-cookie": "2.2.0", "normalize.css": "7.0.0", @@ -49,9 +49,9 @@ "eslint-plugin-vue": "5.2.2", "html-webpack-plugin": "3.2.0", "mockjs": "1.0.1-beta3", - "node-sass": "^6.0.1", "runjs": "^4.3.2", - "sass-loader": "^10.0.1", + "sass": "^1.26.5", + "sass-loader": "^8.0", "script-ext-html-webpack-plugin": "2.1.3", "script-loader": "0.7.2", "serve-static": "^1.13.2", diff --git a/client/src/api/ability.js b/client/src/api/ability.js index d7b9218..00e3f12 100644 --- a/client/src/api/ability.js +++ b/client/src/api/ability.js @@ -270,10 +270,11 @@ export function qactionDelete(id) { -export function provinceLists() { +export function provinceLists(data) { return request({ url:`/system/province/`, method:'get', + params:data }) } export function cityLists(query) { diff --git a/client/src/views/ability/cma2.vue b/client/src/views/ability/cma2.vue index 4ef2396..9175972 100644 --- a/client/src/views/ability/cma2.vue +++ b/client/src/views/ability/cma2.vue @@ -72,7 +72,8 @@ 导入分子公司能力 - 批量删除 + 批量删除 + 批量删除所属公司 @@ -388,7 +389,35 @@ export default { .catch((err) => { }); }, - + delAll2() { + let sszx = this.listQuery.sszx + if(sszx==null || sszx==='' || sszx == undefined){ + this.$message({ + message: "请选中所属公司", + type: "warning", + }); + return + } + this.$confirm("确认删除?", "警告", { + confirmButtonText: "确认", + cancelButtonText: "取消", + type: "error", + }) + .then(async () => { + + let data = { sszx: sszx }; + deletes(data) + .then((res) => { + this.$message({ + message: "删除成功", + type: "success", + }); + this.getList(); + }) + }) + .catch((err) => { + }); + }, handleSelectionChange(val) { this.multipleSelection = val; }, diff --git a/server/apps/ability/views.py b/server/apps/ability/views.py index 16a02ee..80615ec 100644 --- a/server/apps/ability/views.py +++ b/server/apps/ability/views.py @@ -186,10 +186,15 @@ class CMAViewSet(RecordMixin, ModelViewSet): @action(methods=['post'], detail=False, url_path='deletes', url_name='cma_deletes', perms_map = {'post':'cma_deletes'}) def deletes(self, request): - array = request.data['ids'] - CMA.objects.filter(pk__in=array).delete() - + array = request.data.get('ids', []) + sszx = request.data.get('sszx', None) + if array: + CMA.objects.filter(pk__in=array).delete() + + elif sszx: + CMA.objects.filter(sszx=sszx).delete() return Response(status = status.HTTP_200_OK) + @action(methods=['post'], detail=False, url_path='import', url_name='cma_import', perms_map = {'post':'cma_import'}) def cma_import(self, request, pk=None): """ @@ -214,6 +219,9 @@ class CMAViewSet(RecordMixin, ModelViewSet): return Response('不支持非xlsx格式', status = status.HTTP_400_BAD_REQUEST) elif fullpath.endswith('.zip'): fulldir = fullpath.replace('.zip','') + if os.path.exists(fulldir): + import shutil + shutil.rmtree(fulldir) # 先删除该文件夹 os.mkdir(fulldir) os.chdir(fulldir) CMA.objects.filter(type='center').delete() @@ -250,6 +258,9 @@ class CMAViewSet(RecordMixin, ModelViewSet): return Response('不支持非xlsx格式', status = status.HTTP_400_BAD_REQUEST) elif fullpath.endswith('.zip'): fulldir = fullpath.replace('.zip','') + if os.path.exists(fulldir): + import shutil + shutil.rmtree(fulldir) # 先删除该文件夹 os.mkdir(fulldir) os.chdir(fulldir) # CMA.objects.filter(type='sub').delete() @@ -411,6 +422,9 @@ class InspectionViewSet(RecordMixin, ModelViewSet): return Response('不支持非xlsx格式', status = status.HTTP_400_BAD_REQUEST) elif fullpath.endswith('.zip'): fulldir = fullpath.replace('.zip','') + if os.path.exists(fulldir): + import shutil + shutil.rmtree(fulldir) # 先删除该文件夹 os.mkdir(fulldir) os.chdir(fulldir) # CMA.objects.filter(type='sub').delete() @@ -476,6 +490,9 @@ class CNASViewSet(RecordMixin, ModelViewSet): import_cnas(f, os.path.join(root,f)) elif fullpath.endswith('.zip'): fulldir = fullpath.replace('.zip','') + if os.path.exists(fulldir): + import shutil + shutil.rmtree(fulldir) # 先删除该文件夹 os.mkdir(fulldir) os.chdir(fulldir) CNAS.objects.all().delete() @@ -625,8 +642,8 @@ def import_cma2(filename, path): sheet = wb.worksheets[0] datalist = [] sszx = filename.split('-')[0] - if CMA.objects.filter(sszx=sszx, type='sub').exists(): - CMA.objects.filter(sszx=sszx, type='sub').delete() + # if CMA.objects.filter(sszx=sszx, type='sub').exists(): + # CMA.objects.filter(sszx=sszx, type='sub').delete() i = 3 max_row = sheet.max_row defaultv = {} @@ -646,7 +663,7 @@ def import_cma2(filename, path): data['lbxh'] = sheet['c'+str(i)].value defaultv['lbxh'] = data['lbxh'] else: - data['lbxh'] = defaultv['lbxh'] + data['lbxh'] = defaultv.get('lbxh', '') if sheet['d'+str(i)].value: data['lbmc'] = sheet['d'+str(i)].value defaultv['lbmc'] = data['lbmc'] @@ -656,7 +673,7 @@ def import_cma2(filename, path): data['xmxh'] = sheet['e'+str(i)].value defaultv['xmxh'] = data['xmxh'] else: - data['xmxh'] = defaultv.get('xmxh', None) + data['xmxh'] = defaultv.get('xmxh', '') if sheet['f'+str(i)].value: data['xmmc'] = sheet['f'+str(i)].value defaultv['xmmc'] = data['xmmc'] diff --git a/server/apps/supervision/migrations/0031_taction_testreport.py b/server/apps/supervision/migrations/0031_taction_testreport.py new file mode 100644 index 0000000..310655a --- /dev/null +++ b/server/apps/supervision/migrations/0031_taction_testreport.py @@ -0,0 +1,55 @@ +# Generated by Django 3.0.5 on 2023-03-03 02:59 + +from django.conf import settings +import django.contrib.postgres.fields.jsonb +from django.db import migrations, models +import django.db.models.deletion +import django.utils.timezone + + +class Migration(migrations.Migration): + + dependencies = [ + ('system', '0022_delete_historicaldict'), + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('supervision', '0030_auto_20220302_1103'), + ] + + operations = [ + migrations.CreateModel( + name='TestReport', + 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='删除标记')), + ('accept_number', models.CharField(max_length=20, verbose_name='受理编号')), + ('report_number', models.CharField(blank=True, max_length=20, null=True, verbose_name='报告编号')), + ('description', models.TextField(blank=True, null=True, verbose_name='业务描述')), + ('expect_date', models.DateField(verbose_name='预计发放时间')), + ('issue_date', models.DateField(blank=True, null=True, verbose_name='实际发放时间')), + ('belong_dept', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='testreport_belong_dept', to='system.Organization', verbose_name='所属部门')), + ('create_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='testreport_create_by', to=settings.AUTH_USER_MODEL, verbose_name='创建人')), + ('update_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='testreport_update_by', to=settings.AUTH_USER_MODEL, verbose_name='最后编辑人')), + ], + options={ + 'abstract': False, + }, + ), + migrations.CreateModel( + name='TAction', + 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='删除标记')), + ('value_old', django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=dict, null=True, verbose_name='原值')), + ('value_new', django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=dict, null=True, verbose_name='新值')), + ('reason_1', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='taction_r1', to='system.Dict', verbose_name='变更主要原因')), + ('reason_2', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='taction_r2', to='system.Dict', verbose_name='变更次要原因')), + ], + options={ + 'abstract': False, + }, + ), + ] diff --git a/server/apps/supervision/migrations/0032_taction_type.py b/server/apps/supervision/migrations/0032_taction_type.py new file mode 100644 index 0000000..b706c2d --- /dev/null +++ b/server/apps/supervision/migrations/0032_taction_type.py @@ -0,0 +1,18 @@ +# Generated by Django 3.0.5 on 2023-03-07 05:55 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('supervision', '0031_taction_testreport'), + ] + + operations = [ + migrations.AddField( + model_name='taction', + name='type', + field=models.PositiveSmallIntegerField(default=10, verbose_name='变更类型'), + ), + ] diff --git a/server/apps/supervision/migrations/0033_taction_testreport.py b/server/apps/supervision/migrations/0033_taction_testreport.py new file mode 100644 index 0000000..381c0bd --- /dev/null +++ b/server/apps/supervision/migrations/0033_taction_testreport.py @@ -0,0 +1,19 @@ +# Generated by Django 3.0.5 on 2023-03-07 06:19 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('supervision', '0032_taction_type'), + ] + + operations = [ + migrations.AddField( + model_name='taction', + name='testreport', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='supervision.TestReport', verbose_name='关联检测报告'), + ), + ] diff --git a/server/apps/supervision/migrations/0034_auto_20230308_1204.py b/server/apps/supervision/migrations/0034_auto_20230308_1204.py new file mode 100644 index 0000000..fac7ae9 --- /dev/null +++ b/server/apps/supervision/migrations/0034_auto_20230308_1204.py @@ -0,0 +1,26 @@ +# Generated by Django 3.0.5 on 2023-03-08 04:04 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('supervision', '0033_taction_testreport'), + ] + + operations = [ + migrations.AddField( + model_name='taction', + name='create_by', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='taction_create_by', to=settings.AUTH_USER_MODEL, verbose_name='创建人'), + ), + migrations.AddField( + model_name='taction', + name='update_by', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='taction_update_by', to=settings.AUTH_USER_MODEL, verbose_name='最后编辑人'), + ), + ] diff --git a/server/apps/supervision/models.py b/server/apps/supervision/models.py index cc9f007..f7e023e 100644 --- a/server/apps/supervision/models.py +++ b/server/apps/supervision/models.py @@ -1,6 +1,7 @@ from django.db import models from utils.model import BaseModel from apps.system.models import CommonAModel, CommonBModel, Organization, User, Dict, File +from django.contrib.postgres.fields import JSONField # Create your models here. class Content(CommonAModel): @@ -86,4 +87,29 @@ class Record(CommonBModel): class Meta: verbose_name = '报送记录' verbose_name_plural = verbose_name - \ No newline at end of file + + +class TestReport(CommonBModel): + """检测报告 + """ + accept_number = models.CharField('受理编号', max_length=20) + report_number = models.CharField('报告编号', max_length=20, null=True, blank=True) + description = models.TextField('业务描述', null=True, blank=True) + expect_date = models.DateField('预计发放时间') + issue_date = models.DateField('实际发放时间', null=True, blank=True) + + +class TAction(CommonAModel): + """检测报告变更记录 + """ + TACTION_TYPE = ( + (10, '正常发放'), + (20, '报告出错'), + (30, '报告迟单') + ) + testreport = models.ForeignKey(TestReport, on_delete=models.CASCADE, verbose_name='关联检测报告', null=True, blank=True) + type = models.PositiveSmallIntegerField('变更类型', default=10) + reason_1 = models.ForeignKey(Dict, verbose_name='变更主要原因', related_name='taction_r1', on_delete= models.SET_NULL, null=True, blank=True) + reason_2 = models.ForeignKey(Dict, verbose_name='变更次要原因', related_name='taction_r2', on_delete= models.SET_NULL, null=True, blank=True) + value_old = JSONField('原值', null=True, blank=True, default=dict) + value_new = JSONField('新值', null=True, blank=True, default=dict) \ No newline at end of file diff --git a/server/temp/570eef2524c1a8e683521a9e16a59039.djcache b/server/temp/570eef2524c1a8e683521a9e16a59039.djcache deleted file mode 100644 index f2514f0..0000000 Binary files a/server/temp/570eef2524c1a8e683521a9e16a59039.djcache and /dev/null differ