diff --git a/enp/migrations/0031_auto_20231226_0855.py b/enp/migrations/0031_auto_20231226_0855.py new file mode 100644 index 00000000..c6e3c80a --- /dev/null +++ b/enp/migrations/0031_auto_20231226_0855.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.8 on 2023-12-26 08:55 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('enp', '0030_gastestequipment'), + ] + + operations = [ + migrations.AlterField( + model_name='prevention', + name='preventiontype', + field=models.IntegerField(blank=True, choices=[(1, '废水'), (2, '废气'), (3, '噪声'), (4, '废水治理')], default=1, null=True, verbose_name='防治类型'), + ), + ] diff --git a/enp/models.py b/enp/models.py index c03e4a30..614ea822 100644 --- a/enp/models.py +++ b/enp/models.py @@ -167,7 +167,8 @@ class Prevention(CommonModel): type_choices = ( (1, '废水'), (2, '废气'), - (3, '噪声') + (3, '噪声'), + (4, '废水治理'), ) clfs_choices = ( ('1', '自行利用'), @@ -292,3 +293,4 @@ class Archives(CommonModel): note = models.CharField('备注', max_length=500, null=True, blank=True) usecomp = models.ForeignKey(Partment, on_delete=models.CASCADE, null=True, blank=True,verbose_name='所属公司') + \ No newline at end of file diff --git a/enp/templates/archives.html b/enp/templates/archives.html index 1ead04d0..5a52e171 100644 --- a/enp/templates/archives.html +++ b/enp/templates/archives.html @@ -331,6 +331,8 @@ function saveArchives(){ var data = $('#arechivesForm').serializeJSON(); data['filepath'] = document.getElementById('url').innerHTML; + + $.ajax({ type: "POST", url: waste_action_url, diff --git a/enp/templates/gastequipment.html b/enp/templates/gastequipment.html new file mode 100644 index 00000000..2f80aa1d --- /dev/null +++ b/enp/templates/gastequipment.html @@ -0,0 +1,202 @@ +
+ + +
+
+ 新增 + 编辑 + 删除 +
+
+
+
+ +
+
+ +
+ + + +
+
+ + + +
+
+ + + +
+ +
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+ +
+ + + + +
+ +
+ + + + +
+
+ + + +
+
+ 保存 +
+
+
+ \ No newline at end of file diff --git a/enp/urls.py b/enp/urls.py index 865c8cf6..e8c5d816 100644 --- a/enp/urls.py +++ b/enp/urls.py @@ -16,6 +16,8 @@ urlpatterns = [ path('gastestequipment/', views.HtmlGasTestEquipment), path('archives/', views.HtmlArchives), path('zprevention/', views.HtmlZprevention), + path('gastequipment/', views.Htmlgastequipment), + ] \ No newline at end of file diff --git a/enp/urls_api.py b/enp/urls_api.py index d1f30fdc..5883d372 100644 --- a/enp/urls_api.py +++ b/enp/urls_api.py @@ -17,6 +17,7 @@ urlpatterns = [ path('facilities//', views.ApiFacilities),#环境设施,生产设施 path('wprevention//', views.ApiWprevention),#废水防治设施 path('gprevention//', views.ApiGprevention),#废水防治设施 + path('wtequipment//', views.ApiWpreventionequipment),#废气治理设备 path('abnormal//', views.ApiAbnormal),#防治设施异常 path('detection//', views.ApiDetection),#废水污染物检测 path('fuel//', views.ApiFuel),#燃料信息表 @@ -24,4 +25,5 @@ urlpatterns = [ path('gastestequipment//', views.ApiGasTestEquipment),#废气监测仪器信息表 path('archives//', views.ApiArchives),#档案管理表 path('zprevention//', views.ApiZprevention),#噪声防治设施 + ] \ No newline at end of file diff --git a/enp/views.py b/enp/views.py index 982a3b0a..4f010ff2 100644 --- a/enp/views.py +++ b/enp/views.py @@ -52,6 +52,10 @@ def HtmlArchives(request): return render(request, 'archives.html') def HtmlZprevention(request): return render(request, 'zprevention.html') + +def Htmlgastequipment(request): + return render(request, 'gastequipment.html') + # 转换为combobox所用string @@ -298,6 +302,9 @@ def ApiGprevention(request, action): obj = Prevention.objects.get(id=data['id']) obj.delete() return JsonResponse({"code":1}) + + + #废水防治设施 def ApiWprevention(request, action): user = User.objects.get(userid=request.session['userid']) @@ -372,6 +379,80 @@ def ApiWprevention(request, action): obj = Prevention.objects.get(id=data['id']) obj.delete() return JsonResponse({"code":1}) + +def ApiWpreventionequipment(request, action): + user = User.objects.get(userid=request.session['userid']) + if action == 'list': + objs = Prevention.objects.filter(usecomp=user.usecomp, is_deleted=False,preventiontype=4) + total = objs.count() + startnum, endnum = fenye(request) + objs = objs.order_by('-create_time')[startnum:endnum].values('id', 'name', 'number', 'type', 'preventiontype', 'cs_name', + 'desig_nnumber', 'em_unit', 'start_time', 'end_time', 'state', 'ckll', 'wryz', 'zlxl', + 'sjly', 'pqfx', 'wncsl', 'clfs','hdl','yjname', 'tjtime', 'tjl') + return HttpResponse(transjson(total, objs), content_type="application/json") + elif action == 'create': + data = json.loads(request.body.decode('utf-8')) + obj = Prevention() + obj.create_by = user + obj.update_by = user + obj.usecomp = user.usecomp + obj.name = data['name'] + obj.number = data['number'] + obj.preventiontype=4 + obj.type = data['type'] + obj.cs_name = data['cs_name'] + obj.desig_nnumber = data['desig_nnumber'] + obj.em_unit = data['em_unit'] + obj.start_time = data['start_time'] + obj.end_time = data['end_time'] + obj.state = data['state'] + obj.ckll = data['ckll'] + obj.wryz = data['wryz'] + obj.zlxl = data['zlxl'] + obj.sjly = data['sjly'] + obj.pqfx = data['pqfx'] + obj.wncsl = data['wncsl'] + obj.clfs = data['clfs'] + obj.hdl = data['hdl'] + obj.yjname = data['yjname'] + obj.tjtime = data['tjtime'] + obj.tjl = data['tjl'] + obj.save() + return JsonResponse({"code":1}) + elif action == 'update': + data = json.loads(request.body.decode('utf-8')) + obj = Prevention.objects.get(id=data['id']) + obj.create_by = user + obj.update_by = user + obj.usecomp = user.usecomp + obj.name = data['name'] + obj.number = data['number'] + obj.preventiontype=4 + obj.type = data['type'] + obj.cs_name = data['cs_name'] + obj.desig_nnumber = data['desig_nnumber'] + obj.em_unit = data['em_unit'] + obj.start_time = data['start_time'] + obj.end_time = data['end_time'] + obj.state = data['state'] + obj.ckll = data['ckll'] + obj.wryz = data['wryz'] + obj.zlxl = data['zlxl'] + obj.sjly = data['sjly'] + obj.pqfx = data['pqfx'] + obj.wncsl = data['wncsl'] + obj.clfs = data['clfs'] + obj.hdl = data['hdl'] + obj.yjname = data['yjname'] + obj.tjtime = data['tjtime'] + obj.tjl = data['tjl'] + obj.save() + return JsonResponse({"code":1}) + elif action == 'delete': + data = json.loads(request.body.decode('utf-8')) + obj = Prevention.objects.get(id=data['id']) + obj.delete() + return JsonResponse({"code":1}) #防治设施异常 def ApiAbnormal(request, action): user = User.objects.get(userid=request.session['userid']) @@ -1014,4 +1095,5 @@ def ApiGasTestEquipment(request, action): obj.remark = data['remark'] obj.update_by=user obj.save() - return JsonResponse({"code":1}) \ No newline at end of file + return JsonResponse({"code":1}) + \ No newline at end of file