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 f2514f0..2edda4f 100644 Binary files a/server/temp/570eef2524c1a8e683521a9e16a59039.djcache and b/server/temp/570eef2524c1a8e683521a9e16a59039.djcache differ