From fae6fbde88b6ff35cfff4f5324c41bfa9b8d5a6c Mon Sep 17 00:00:00 2001 From: caoqianming Date: Fri, 7 Apr 2023 10:40:36 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=AF=BC=E5=85=A5=E6=97=B6=E4=BD=BF?= =?UTF-8?q?=E7=94=A8get('')=E7=BB=93=E6=9E=84=EF=BC=8C=E5=B9=B6=E5=85=88?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=E5=A4=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/.env.development | 4 ++-- server/apps/ability/views.py | 16 ++++++++++++++-- .../570eef2524c1a8e683521a9e16a59039.djcache | Bin 48 -> 48 bytes 3 files changed, 16 insertions(+), 4 deletions(-) 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/server/apps/ability/views.py b/server/apps/ability/views.py index 2c2eb60..8930ce1 100644 --- a/server/apps/ability/views.py +++ b/server/apps/ability/views.py @@ -219,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() @@ -255,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() @@ -416,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() @@ -481,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() @@ -651,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'] @@ -661,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/temp/570eef2524c1a8e683521a9e16a59039.djcache b/server/temp/570eef2524c1a8e683521a9e16a59039.djcache index f2514f02da48222f899c89b56ace77fb96726813..2edda4ff532f0a4ccbd50ee9b8928cbf88d149be 100644 GIT binary patch literal 48 zcmZo*oyx@k0q%}B8P^>P{;^!IVor9#+*5}c7&iu2MF