This commit is contained in:
caoqianming 2023-04-27 10:47:52 +08:00
commit eb704e44a2
11 changed files with 209 additions and 18 deletions

View File

@ -3,8 +3,8 @@ ENV = 'development'
# base api # base api
#VUE_APP_BASE_API = 'http://10.0.11.127:8000/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 = 'http://127.0.0.1:2222/api'
VUE_APP_BASE_API = 'https://testsearch.ctc.ac.cn/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'

View File

@ -5,8 +5,8 @@
"author": "Pan <panfree23@gmail.com>", "author": "Pan <panfree23@gmail.com>",
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"dev": "vue-cli-service serve", "dev": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve",
"build:prod": "vue-cli-service build", "build:prod": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build",
"build:stage": "vue-cli-service build --mode staging", "build:stage": "vue-cli-service build --mode staging",
"preview": "node build/index.js --preview", "preview": "node build/index.js --preview",
"lint": "eslint --ext .js,.vue src", "lint": "eslint --ext .js,.vue src",
@ -19,7 +19,7 @@
"axios": "0.18.1", "axios": "0.18.1",
"echarts": "^5.4.0", "echarts": "^5.4.0",
"element-china-area-data": "^5.0.2", "element-china-area-data": "^5.0.2",
"element-ui": "2.13.0", "element-ui": "^2.15.13",
"file-saver": "^2.0.2", "file-saver": "^2.0.2",
"js-cookie": "2.2.0", "js-cookie": "2.2.0",
"normalize.css": "7.0.0", "normalize.css": "7.0.0",
@ -49,9 +49,9 @@
"eslint-plugin-vue": "5.2.2", "eslint-plugin-vue": "5.2.2",
"html-webpack-plugin": "3.2.0", "html-webpack-plugin": "3.2.0",
"mockjs": "1.0.1-beta3", "mockjs": "1.0.1-beta3",
"node-sass": "^6.0.1",
"runjs": "^4.3.2", "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-ext-html-webpack-plugin": "2.1.3",
"script-loader": "0.7.2", "script-loader": "0.7.2",
"serve-static": "^1.13.2", "serve-static": "^1.13.2",

View File

@ -270,10 +270,11 @@ export function qactionDelete(id) {
export function provinceLists() { export function provinceLists(data) {
return request({ return request({
url:`/system/province/`, url:`/system/province/`,
method:'get', method:'get',
params:data
}) })
} }
export function cityLists(query) { export function cityLists(query) {

View File

@ -72,7 +72,8 @@
</div> </div>
<el-button slot="reference">导入分子公司能力</el-button> <el-button slot="reference">导入分子公司能力</el-button>
</el-popover> </el-popover>
<el-button @click="delAll()" v-if="checkPermission(['cma_deletes'])">批量删除</el-button> <el-button @click="delAll()" v-if="checkPermission(['cma_deletes'])" type="danger" plain>批量删除</el-button>
<el-button @click="delAll2()" v-if="checkPermission(['cma_deletes'])" type="danger" plain>批量删除所属公司</el-button>
</div> </div>
</el-card> </el-card>
<el-card style="margin-top: 10px"> <el-card style="margin-top: 10px">
@ -388,7 +389,35 @@ export default {
.catch((err) => { .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) { handleSelectionChange(val) {
this.multipleSelection = val; this.multipleSelection = val;
}, },

View File

@ -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'}) @action(methods=['post'], detail=False, url_path='deletes', url_name='cma_deletes', perms_map = {'post':'cma_deletes'})
def deletes(self, request): def deletes(self, request):
array = request.data['ids'] array = request.data.get('ids', [])
sszx = request.data.get('sszx', None)
if array:
CMA.objects.filter(pk__in=array).delete() CMA.objects.filter(pk__in=array).delete()
elif sszx:
CMA.objects.filter(sszx=sszx).delete()
return Response(status = status.HTTP_200_OK) return Response(status = status.HTTP_200_OK)
@action(methods=['post'], detail=False, url_path='import', url_name='cma_import', perms_map = {'post':'cma_import'}) @action(methods=['post'], detail=False, url_path='import', url_name='cma_import', perms_map = {'post':'cma_import'})
def cma_import(self, request, pk=None): def cma_import(self, request, pk=None):
""" """
@ -214,6 +219,9 @@ class CMAViewSet(RecordMixin, ModelViewSet):
return Response('不支持非xlsx格式', status = status.HTTP_400_BAD_REQUEST) return Response('不支持非xlsx格式', status = status.HTTP_400_BAD_REQUEST)
elif fullpath.endswith('.zip'): elif fullpath.endswith('.zip'):
fulldir = fullpath.replace('.zip','') fulldir = fullpath.replace('.zip','')
if os.path.exists(fulldir):
import shutil
shutil.rmtree(fulldir) # 先删除该文件夹
os.mkdir(fulldir) os.mkdir(fulldir)
os.chdir(fulldir) os.chdir(fulldir)
CMA.objects.filter(type='center').delete() CMA.objects.filter(type='center').delete()
@ -250,6 +258,9 @@ class CMAViewSet(RecordMixin, ModelViewSet):
return Response('不支持非xlsx格式', status = status.HTTP_400_BAD_REQUEST) return Response('不支持非xlsx格式', status = status.HTTP_400_BAD_REQUEST)
elif fullpath.endswith('.zip'): elif fullpath.endswith('.zip'):
fulldir = fullpath.replace('.zip','') fulldir = fullpath.replace('.zip','')
if os.path.exists(fulldir):
import shutil
shutil.rmtree(fulldir) # 先删除该文件夹
os.mkdir(fulldir) os.mkdir(fulldir)
os.chdir(fulldir) os.chdir(fulldir)
# CMA.objects.filter(type='sub').delete() # CMA.objects.filter(type='sub').delete()
@ -411,6 +422,9 @@ class InspectionViewSet(RecordMixin, ModelViewSet):
return Response('不支持非xlsx格式', status = status.HTTP_400_BAD_REQUEST) return Response('不支持非xlsx格式', status = status.HTTP_400_BAD_REQUEST)
elif fullpath.endswith('.zip'): elif fullpath.endswith('.zip'):
fulldir = fullpath.replace('.zip','') fulldir = fullpath.replace('.zip','')
if os.path.exists(fulldir):
import shutil
shutil.rmtree(fulldir) # 先删除该文件夹
os.mkdir(fulldir) os.mkdir(fulldir)
os.chdir(fulldir) os.chdir(fulldir)
# CMA.objects.filter(type='sub').delete() # CMA.objects.filter(type='sub').delete()
@ -476,6 +490,9 @@ class CNASViewSet(RecordMixin, ModelViewSet):
import_cnas(f, os.path.join(root,f)) import_cnas(f, os.path.join(root,f))
elif fullpath.endswith('.zip'): elif fullpath.endswith('.zip'):
fulldir = fullpath.replace('.zip','') fulldir = fullpath.replace('.zip','')
if os.path.exists(fulldir):
import shutil
shutil.rmtree(fulldir) # 先删除该文件夹
os.mkdir(fulldir) os.mkdir(fulldir)
os.chdir(fulldir) os.chdir(fulldir)
CNAS.objects.all().delete() CNAS.objects.all().delete()
@ -625,8 +642,8 @@ def import_cma2(filename, path):
sheet = wb.worksheets[0] sheet = wb.worksheets[0]
datalist = [] datalist = []
sszx = filename.split('-')[0] sszx = filename.split('-')[0]
if CMA.objects.filter(sszx=sszx, type='sub').exists(): # if CMA.objects.filter(sszx=sszx, type='sub').exists():
CMA.objects.filter(sszx=sszx, type='sub').delete() # CMA.objects.filter(sszx=sszx, type='sub').delete()
i = 3 i = 3
max_row = sheet.max_row max_row = sheet.max_row
defaultv = {} defaultv = {}
@ -646,7 +663,7 @@ def import_cma2(filename, path):
data['lbxh'] = sheet['c'+str(i)].value data['lbxh'] = sheet['c'+str(i)].value
defaultv['lbxh'] = data['lbxh'] defaultv['lbxh'] = data['lbxh']
else: else:
data['lbxh'] = defaultv['lbxh'] data['lbxh'] = defaultv.get('lbxh', '')
if sheet['d'+str(i)].value: if sheet['d'+str(i)].value:
data['lbmc'] = sheet['d'+str(i)].value data['lbmc'] = sheet['d'+str(i)].value
defaultv['lbmc'] = data['lbmc'] defaultv['lbmc'] = data['lbmc']
@ -656,7 +673,7 @@ def import_cma2(filename, path):
data['xmxh'] = sheet['e'+str(i)].value data['xmxh'] = sheet['e'+str(i)].value
defaultv['xmxh'] = data['xmxh'] defaultv['xmxh'] = data['xmxh']
else: else:
data['xmxh'] = defaultv.get('xmxh', None) data['xmxh'] = defaultv.get('xmxh', '')
if sheet['f'+str(i)].value: if sheet['f'+str(i)].value:
data['xmmc'] = sheet['f'+str(i)].value data['xmmc'] = sheet['f'+str(i)].value
defaultv['xmmc'] = data['xmmc'] defaultv['xmmc'] = data['xmmc']

View File

@ -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,
},
),
]

View File

@ -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='变更类型'),
),
]

View File

@ -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='关联检测报告'),
),
]

View File

@ -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='最后编辑人'),
),
]

View File

@ -1,6 +1,7 @@
from django.db import models from django.db import models
from utils.model import BaseModel from utils.model import BaseModel
from apps.system.models import CommonAModel, CommonBModel, Organization, User, Dict, File from apps.system.models import CommonAModel, CommonBModel, Organization, User, Dict, File
from django.contrib.postgres.fields import JSONField
# Create your models here. # Create your models here.
class Content(CommonAModel): class Content(CommonAModel):
@ -87,3 +88,28 @@ class Record(CommonBModel):
verbose_name = '报送记录' verbose_name = '报送记录'
verbose_name_plural = verbose_name verbose_name_plural = verbose_name
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)