Explorar o código

屏蔽图片文件夹

Your Name %!s(int64=5) %!d(string=hai) anos
pai
achega
bae8a7c382
Modificáronse 45 ficheiros con 1781 adicións e 360 borrados
  1. 5 2
      .gitignore
  2. 31 2
      apps/AppInfo/admin.py
  3. 176 2
      apps/AppInfo/models.py
  4. 10 6
      apps/Equipment/all_dict.py
  5. 13 0
      apps/Equipment/urls.py
  6. 630 8
      apps/Equipment/views.py
  7. 10 9
      apps/Home/views.py
  8. BIN=BIN
      sightsee_photos/20200831110011.png
  9. BIN=BIN
      sightsee_photos/20200831110447.jpg
  10. BIN=BIN
      sightsee_photos/20200831110854.jpg
  11. BIN=BIN
      sightsee_photos/20200831111046.jpg
  12. BIN=BIN
      sightsee_photos/20200831111252.jpg
  13. BIN=BIN
      sightsee_photos/20200831111342.jpg
  14. 6 6
      templates/backstageNet/annunciate/policyListView.html
  15. 2 1
      templates/backstageNet/info/dormPub.html
  16. 1 1
      templates/backstageNet/info/gardenPub.html
  17. 1 1
      templates/backstageNet/info/newsPub.html
  18. 1 1
      templates/backstageNet/info/productPub.html
  19. 1 1
      templates/backstageNet/info/sightseePub.html
  20. 1 1
      templates/backstageNet/info/videoPub.html
  21. 1 1
      templates/backstageNet/infoManage/pickManageList.html
  22. 0 6
      templates/backstageNet/infoManage/sightseeManageList.html
  23. 181 4
      templates/backstageNet/jk/equipmanage_jk.html
  24. 2 2
      templates/backstageNet/limit/expertList.html
  25. 69 23
      templates/backstageNet/map/map.html
  26. 389 170
      templates/backstageNet/production/cropcount.html
  27. 3 1
      templates/backstageNet/production/gardenManage.html
  28. 1 1
      templates/backstageNet/production/gardenNew.html
  29. 4 2
      templates/backstageNet/production/pick.html
  30. 22 13
      templates/backstageNet/production/repertoryManage.html
  31. 1 0
      templates/backstageNet/production/sellManage.html
  32. 157 2
      templates/backstageNet/qxzctrl/qxzctrl.html
  33. 2 2
      templates/backstageNet/systemSet/mapManage.html
  34. 2 0
      templates/backstageNet/systemSet/user_list.html
  35. 2 2
      templates/backstageNet/warn/productionset.html
  36. 4 4
      templates/backstageNet/warn/warnRecord.html
  37. 8 16
      templates/backstageNet/warn/warnSet.html
  38. 4 0
      templates/outerNet/farmList.html
  39. 23 67
      templates/outerNet/index2.html
  40. 2 2
      templates/outerNet/tourist.html
  41. 6 0
      templates/outerNet/touristList.html
  42. 4 0
      templates/static/css/index2.css
  43. 3 0
      templates/static/css/videoList.css
  44. BIN=BIN
      templates/static/imgs/jkedit.png
  45. 3 1
      templates/static/js/index2.js

+ 5 - 2
.gitignore

@@ -68,5 +68,8 @@ docs/_build/
 /map_photo/
 /.vscode/
 # PyBuilder
-target/
-
+/target/
+/sell_photo/
+/crop_photo/
+/sightsee_photos/
+/user_photo/

+ 31 - 2
apps/AppInfo/admin.py

@@ -6,7 +6,7 @@ from django.contrib.auth.forms import UserCreationForm, UserChangeForm
 # Register your models here.
 from apps.AppInfo.models import MyUser, QXZdata, QXZstatus, Equip, Equip_type, QXZdata_New, JKdata, Article, Video_data,Product,Blog,QXZstatus_New,QXZswitchstatus,QXZswitchdata,\
 CKArticle,GardenManage,GardenArea,Areacrop,Store_Manage,Hotel_Info,Hotel_Photo,FarmUser,FarmList,Pick_Pub,Sell_Manage,Person_Pick,QXZAutoswitch, Pic_Info,Sightsee_Info,QXZ_Alarm_Log,\
-Experts, Relations
+Experts, Relations, QXZ_Alarm
 
 
 
@@ -842,4 +842,33 @@ class RelationsAdmin(admin.ModelAdmin):
     # 搜索项:
     search_fields = ['name']
     # 设置每页显示记录数:
-    list_per_page = 10    
+    list_per_page = 10
+
+
+
+
+# 合作伙伴表
+@admin.register(QXZ_Alarm)
+class QXZ_AlarmAdmin(admin.ModelAdmin):
+    actions_on_bottom = False
+    actions_on_top = True
+    # 详情显示项:
+    fields = [
+        'equip_id',
+        'conf',
+        'tel',
+        'upl_time',
+    ]
+    # 列表显示项:
+    list_display = [
+        'equip_id',
+        'conf',
+        'tel',
+        'upl_time',
+    ]
+    # 筛选过滤项:
+    list_filter = ('upl_time',)
+    # 搜索项:
+    search_fields = ['name']
+    # 设置每页显示记录数:
+    list_per_page = 10

+ 176 - 2
apps/AppInfo/models.py

@@ -92,6 +92,19 @@ class QXZstatus(models.Model):
         verbose_name_plural = verbose_name
         ordering = ['-equip_id__equip_add_time']
         get_latest_by = 'equip_id__equip_add_time'
+        
+# 气象站短信预警
+class QXZ_Alarm(models.Model):
+    equip_id = models.ForeignKey(Equip)
+    conf = models.TextField(u'短信配置', blank=True, null=True)
+    tel = models.CharField(u'手机号',max_length=20, blank=True)
+    upl_time = models.DateTimeField(u'上报时间', auto_now=True)
+
+    class Meta:
+        verbose_name = u"气象站短信预警"
+        verbose_name_plural = verbose_name
+        ordering = ['-upl_time']
+        get_latest_by = 'upl_time'
 
 
 
@@ -113,6 +126,8 @@ class QXZdata(models.Model):
 # 新气象站状态记录:
 class QXZstatus_New(models.Model):
     equip_id = models.ForeignKey(Equip)
+    is_online = models.CharField(u'在线状态', max_length=5, blank=True,null=True)
+    off_time = models.DateTimeField(u'离线时间', blank=True,null=True)
     upl_time = models.DateTimeField(u'数据上传时间', default=timezone.now)
     e1 = models.CharField(u'通道1', max_length=30, blank=True, null=True)
     e2 = models.CharField(u'通道2', max_length=30, blank=True, null=True)
@@ -128,6 +143,25 @@ class QXZstatus_New(models.Model):
     e12 = models.CharField(u'通道12', max_length=30, blank=True, null=True)
     e13 = models.CharField(u'通道13', max_length=30, blank=True, null=True)
     e14 = models.CharField(u'通道14', max_length=30, blank=True, null=True)
+    e15 = models.CharField(u'通道15', max_length=30, blank=True, null=True)
+    e16 = models.CharField(u'通道16', max_length=30, blank=True, null=True)
+    e17 = models.CharField(u'通道17', max_length=30, blank=True, null=True)
+    e18 = models.CharField(u'通道18', max_length=30, blank=True, null=True)
+    e19 = models.CharField(u'通道19', max_length=30, blank=True, null=True)
+    e20 = models.CharField(u'通道20', max_length=30, blank=True, null=True)
+    e21 = models.CharField(u'通道21', max_length=30, blank=True, null=True)
+    e22 = models.CharField(u'通道22', max_length=30, blank=True, null=True)
+    e23 = models.CharField(u'通道23', max_length=30, blank=True, null=True)
+    e24 = models.CharField(u'通道24', max_length=30, blank=True, null=True)
+    e25 = models.CharField(u'通道25', max_length=30, blank=True, null=True)
+    e26 = models.CharField(u'通道26', max_length=30, blank=True, null=True)
+    e27 = models.CharField(u'通道27', max_length=30, blank=True, null=True)
+    e28 = models.CharField(u'通道28', max_length=30, blank=True, null=True)
+    e29 = models.CharField(u'通道29', max_length=30, blank=True, null=True)
+    e30 = models.CharField(u'通道30', max_length=30, blank=True, null=True)
+    lng = models.CharField(u'经度', max_length=50, blank=True)
+    lat = models.CharField(u'维度', max_length=50, blank=True)
+    qxz_picture = models.ImageField(u'气象站图片', upload_to="qxz_photo/", default="qxz_photo/default.png")
     interval = models.CharField(u'设备数据上传时间间隔', max_length=30, blank=True, null=True)
 
     class Meta:
@@ -157,6 +191,22 @@ class QXZdata_New(models.Model):
     e12 = models.CharField(u'通道12', max_length=30, blank=True, null=True)
     e13 = models.CharField(u'通道13', max_length=30, blank=True, null=True)
     e14 = models.CharField(u'通道14', max_length=30, blank=True, null=True)
+    e15 = models.CharField(u'通道15', max_length=30, blank=True, null=True)
+    e16 = models.CharField(u'通道16', max_length=30, blank=True, null=True)
+    e17 = models.CharField(u'通道17', max_length=30, blank=True, null=True)
+    e18 = models.CharField(u'通道18', max_length=30, blank=True, null=True)
+    e19 = models.CharField(u'通道19', max_length=30, blank=True, null=True)
+    e20 = models.CharField(u'通道20', max_length=30, blank=True, null=True)
+    e21 = models.CharField(u'通道21', max_length=30, blank=True, null=True)
+    e22 = models.CharField(u'通道22', max_length=30, blank=True, null=True)
+    e23 = models.CharField(u'通道23', max_length=30, blank=True, null=True)
+    e24 = models.CharField(u'通道24', max_length=30, blank=True, null=True)
+    e25 = models.CharField(u'通道25', max_length=30, blank=True, null=True)
+    e26 = models.CharField(u'通道26', max_length=30, blank=True, null=True)
+    e27 = models.CharField(u'通道27', max_length=30, blank=True, null=True)
+    e28 = models.CharField(u'通道28', max_length=30, blank=True, null=True)
+    e29 = models.CharField(u'通道29', max_length=30, blank=True, null=True)
+    e30 = models.CharField(u'通道30', max_length=30, blank=True, null=True)
 
     class Meta:
         verbose_name = u'气象站-数据表-新'
@@ -217,7 +267,131 @@ class QXZAutoswitch(models.Model):
         ordering = ['-upl_time']
         get_latest_by = 'upl_time'
 
-        
+
+# 气象站基础信息表
+class QXZ_Base_Info(models.Model):
+    equip_id = models.ForeignKey(Equip)
+    volt = models.CharField(u'电压', max_length=20, blank=True, null=True)
+    rssi = models.CharField(u'信号强度', max_length=20, blank=True, null=True)
+    iccid = models.CharField(u'设备卡号', max_length=50, blank=True, null=True)
+    lng = models.CharField(u'经度', max_length=50, blank=True, null=True)
+    lat = models.CharField(u'纬度', max_length=50, blank=True, null=True)
+    led = models.CharField(u'led点阵屏', max_length=10, blank=True, null=True)
+    ledinfo = models.CharField(u'led屏幕内容', max_length=100, blank=True, null=True)
+    dver = models.CharField(u'设备版本号', max_length=100, blank=True, null=True)
+    auto_locat = models.CharField(u'经纬度判断', max_length=50, default="1")
+    # is_online = models.CharField(u'在线状态', max_length=5, blank=True,null=True)
+    upl_time = models.DateTimeField(u'上报时间', auto_now=True)
+
+    class Meta:
+        verbose_name = u"气象站基础信息表"
+        verbose_name_plural = verbose_name
+        ordering = ['-upl_time']
+        get_latest_by = 'upl_time'
+
+
+# 气象站基础信息表
+class QXZ_Info_Record(models.Model):
+    equip_id = models.ForeignKey(Equip)
+    volt = models.CharField(u'电压', max_length=20, blank=True, null=True)
+    rssi = models.CharField(u'信号强度', max_length=20, blank=True, null=True)
+    # is_online = models.CharField(u'在线状态', max_length=5, blank=True,null=True)
+    upl_time = models.DateTimeField(u'上报时间', auto_now=True)
+
+    class Meta:
+        verbose_name = u"气象站信息历史"
+        verbose_name_plural = verbose_name
+        ordering = ['-upl_time']
+        get_latest_by = 'upl_time'
+
+
+
+# 值#enum#通道
+# 新气象站配置表
+class QXZ_Conf(models.Model):
+    equip_id = models.ForeignKey(Equip)
+    e1 = models.CharField(u'通道1', max_length=30, blank=True, null=True)
+    e2 = models.CharField(u'通道2', max_length=30, blank=True, null=True)
+    e3 = models.CharField(u'通道3', max_length=30, blank=True, null=True)
+    e4 = models.CharField(u'通道4', max_length=30, blank=True, null=True)
+    e5 = models.CharField(u'通道5', max_length=30, blank=True, null=True)
+    e6 = models.CharField(u'通道6', max_length=30, blank=True, null=True)
+    e7 = models.CharField(u'通道7', max_length=30, blank=True, null=True)
+    e8 = models.CharField(u'通道8', max_length=30, blank=True, null=True)
+    e9 = models.CharField(u'通道9', max_length=30, blank=True, null=True)
+    e10 = models.CharField(u'通道10', max_length=30, blank=True, null=True)
+    e11 = models.CharField(u'通道11', max_length=30, blank=True, null=True)
+    e12 = models.CharField(u'通道12', max_length=30, blank=True, null=True)
+    e13 = models.CharField(u'通道13', max_length=30, blank=True, null=True)
+    e14 = models.CharField(u'通道14', max_length=30, blank=True, null=True)
+    e15 = models.CharField(u'通道15', max_length=30, blank=True, null=True)
+    e16 = models.CharField(u'通道16', max_length=30, blank=True, null=True)
+    e17 = models.CharField(u'通道17', max_length=30, blank=True, null=True)
+    e18 = models.CharField(u'通道18', max_length=30, blank=True, null=True)
+    e19 = models.CharField(u'通道19', max_length=30, blank=True, null=True)
+    e20 = models.CharField(u'通道20', max_length=30, blank=True, null=True)
+    e21 = models.CharField(u'通道21', max_length=30, blank=True, null=True)
+    e22 = models.CharField(u'通道22', max_length=30, blank=True, null=True)
+    e23 = models.CharField(u'通道23', max_length=30, blank=True, null=True)
+    e24 = models.CharField(u'通道24', max_length=30, blank=True, null=True)
+    e25 = models.CharField(u'通道25', max_length=30, blank=True, null=True)
+    e26 = models.CharField(u'通道26', max_length=30, blank=True, null=True)
+    e27 = models.CharField(u'通道27', max_length=30, blank=True, null=True)
+    e28 = models.CharField(u'通道28', max_length=30, blank=True, null=True)
+    e29 = models.CharField(u'通道29', max_length=30, blank=True, null=True)
+    e30 = models.CharField(u'通道30', max_length=30, blank=True, null=True)
+    upl_time = models.DateTimeField(u'数据上传时间', default=timezone.now)
+
+    class Meta:
+        verbose_name = u'气象站标题配置'
+        verbose_name_plural = verbose_name
+        ordering = ['-upl_time']
+        get_latest_by = 'upl_time'
+
+
+
+# 值#enum#通道
+# 新气象站配置表
+class QXZ_Default_Conf(models.Model):
+    equip_id = models.ForeignKey(Equip)
+    e1 = models.CharField(u'通道1', max_length=30, blank=True, null=True)
+    e2 = models.CharField(u'通道2', max_length=30, blank=True, null=True)
+    e3 = models.CharField(u'通道3', max_length=30, blank=True, null=True)
+    e4 = models.CharField(u'通道4', max_length=30, blank=True, null=True)
+    e5 = models.CharField(u'通道5', max_length=30, blank=True, null=True)
+    e6 = models.CharField(u'通道6', max_length=30, blank=True, null=True)
+    e7 = models.CharField(u'通道7', max_length=30, blank=True, null=True)
+    e8 = models.CharField(u'通道8', max_length=30, blank=True, null=True)
+    e9 = models.CharField(u'通道9', max_length=30, blank=True, null=True)
+    e10 = models.CharField(u'通道10', max_length=30, blank=True, null=True)
+    e11 = models.CharField(u'通道11', max_length=30, blank=True, null=True)
+    e12 = models.CharField(u'通道12', max_length=30, blank=True, null=True)
+    e13 = models.CharField(u'通道13', max_length=30, blank=True, null=True)
+    e14 = models.CharField(u'通道14', max_length=30, blank=True, null=True)
+    e15 = models.CharField(u'通道15', max_length=30, blank=True, null=True)
+    e16 = models.CharField(u'通道16', max_length=30, blank=True, null=True)
+    e17 = models.CharField(u'通道17', max_length=30, blank=True, null=True)
+    e18 = models.CharField(u'通道18', max_length=30, blank=True, null=True)
+    e19 = models.CharField(u'通道19', max_length=30, blank=True, null=True)
+    e20 = models.CharField(u'通道20', max_length=30, blank=True, null=True)
+    e21 = models.CharField(u'通道21', max_length=30, blank=True, null=True)
+    e22 = models.CharField(u'通道22', max_length=30, blank=True, null=True)
+    e23 = models.CharField(u'通道23', max_length=30, blank=True, null=True)
+    e24 = models.CharField(u'通道24', max_length=30, blank=True, null=True)
+    e25 = models.CharField(u'通道25', max_length=30, blank=True, null=True)
+    e26 = models.CharField(u'通道26', max_length=30, blank=True, null=True)
+    e27 = models.CharField(u'通道27', max_length=30, blank=True, null=True)
+    e28 = models.CharField(u'通道28', max_length=30, blank=True, null=True)
+    e29 = models.CharField(u'通道29', max_length=30, blank=True, null=True)
+    e30 = models.CharField(u'通道30', max_length=30, blank=True, null=True)
+    upl_time = models.DateTimeField(u'数据上传时间', default=timezone.now)
+
+    class Meta:
+        verbose_name = u'气象站标题默认配置'
+        verbose_name_plural = verbose_name
+        ordering = ['-upl_time']
+        get_latest_by = 'upl_time'
+
 
 
 # 监控设备token表
@@ -572,7 +746,7 @@ class Warning_His(models.Model):
 
 # 民宿表
 class Hotel_Info(models.Model):
-    name = models.CharField(u'民宿名字', max_length=20, blank=True, null=True)
+    name = models.CharField(u'民宿名字', max_length=200, blank=True, null=True)
     price = models.CharField(u'民宿价格', max_length=20, blank=True, null=True)
     intro = models.CharField(u'民宿简介',max_length=255, null=True, blank=True)
     addr = models.CharField(u'民宿地址',max_length=255, null=True, blank=True)

+ 10 - 6
apps/Equipment/all_dict.py

@@ -55,10 +55,14 @@ qxz_dict = {'100':['未定义',],
 '155':['155','氮','mg/kg'],
 '156':['156','磷','mg/kg'],
 '157':['157','钾','mg/kg'],
-'158':['158','NO2','ug/m3'],
-'159':['159','O3','ug/m3'],
-'160':['160','管道流量','m3/s'],
-'161':['161','流速','L/min'],
-'162':['162','管道压力','KPa'],
-'208':['208','照度','Lux']
+'158':['158','热通量','W/m2'],
+'159':['159','叶面温度','℃'],
+'160':['160','叶面湿度','%RH'],
+'161':['161','茎秆','mm'],
+'162':['162','负氧离子','个/cm3'],
+'201':['201','土壤水势','KPA'],
+'202':['202','露点温度','℃'],
+'203':['203','PM100','ug/m3'],
+'208':['208','照度','Lux'],
+'211':['211','电导率','uS/cm']
 }

+ 13 - 0
apps/Equipment/urls.py

@@ -245,6 +245,19 @@ urlpatterns = [
     
     url(r'^add_relation_list$', Add_Relation_List.as_view(), name='add_relation_list'),
     
+    url(r'^equip_addr$', Equip_Addr.as_view(), name='equip_addr'),
+    
+    url(r'^equip_location$', Equip_Location.as_view(), name='equip_location'),
+    
+    url(r'^add_qxz_test$', Add_Qxz_Test.as_view(), name='add_qxz_test'),
+    
+    url(r'^qxz_data_export$', QXZ_Data_Export.as_view(), name='qxz_data_export'),
+    
+    
+    
+    
+    
+    
     
 
     # 配置文件夹路由:

+ 630 - 8
apps/Equipment/views.py

@@ -24,8 +24,10 @@ from apps.AppInfo.models import (
     Hotel_Info, Hotel_Photo, JKdata, MyUser, Pick_Pub, Product, QXZdata,
     QXZdata_New, QXZstatus, QXZstatus_New, QXZswitchdata, QXZswitchstatus,
     Video_data,GardenArea,Store_Manage,Areacrop,Sell_Manage,Person_Pick,QXZAutoswitch,Sightsee_Info,Pic_Info,
-    QXZ_Alarm_Log,Experts,Relations)
+    QXZ_Alarm_Log,Experts,Relations,QXZ_Alarm,QXZ_Conf,QXZ_Base_Info,QXZ_Default_Conf,QXZ_Info_Record)
 from apps.Equipment.all_dict import qxz_dict
+import xlwt
+from io import BytesIO
 
 
 # 地图
@@ -63,7 +65,8 @@ class Equip_Test(View):
 class JKview(ListView):
     def get(self,request):
         equip_id = request.GET.get('equip_id')
-        return render(request, 'backstageNet/jk/equipmanage_jk.html', context={"equip_id":equip_id})
+        token = "at.0izp4b188fna8vvk8j28o2l4a980qqex-1otrmuqf8l-1k26cbi-cletdiwkp"
+        return render(request, 'backstageNet/jk/equipmanage_jk.html', context={"equip_id":equip_id,"token":token})
     def post(self,request):
         pass
 
@@ -267,6 +270,9 @@ class Equip_Show_Detail(ListView):
     def get(self,request):
         e_id = request.GET.get("id")
         product = Product.objects.get(id=e_id)
+        e_name = request.GET.get("name")
+        if e_name:
+            product = Product.objects.get(title=e_name)
         return render(request, 'outerNet/exhibitionDetail.html', context={"product":product})
     def post(self,request):
         pass
@@ -301,6 +307,9 @@ class Garden_Intro(ListView):
     def get(self,request):
         pid = request.GET.get("id")
         pick = Pick_Pub.objects.get(id=pid)
+        pname = request.GET.get("name")
+        if pname:
+            pick = Pick_Pub.objects.get(name=pname)
         return render(request, 'outerNet/pickIntro.html', context={"pick":pick})
     def post(self,request):
         pass
@@ -329,6 +338,9 @@ class Tourist(ListView):
     def get(self,request):
         sid = request.GET.get("id")
         sightsee = Sightsee_Info.objects.get(id=sid)
+        sname = request.GET.get("name")
+        if sname:
+            sightsee = Sightsee_Info.objects.get(name=sname)
         return render(request, 'outerNet/tourist.html', context={"sightsee":sightsee})
     def post(self,request):
         pass
@@ -370,6 +382,9 @@ class Dorm_Detail(ListView):
         hotel_id = request.GET.get("id")
         hotel = Hotel_Info.objects.get(id=hotel_id)
         photos = Hotel_Photo.objects.filter(hotel=hotel)
+        hotel_name = request.GET.get("name")
+        if hotel_name:
+            hotel = Hotel_Info.objects.get(name=hotel_name)
         return render(request, 'outerNet/hotelDetail.html', context={"hotel":hotel,"photos":photos})
     def post(self,request):
         pass
@@ -410,6 +425,9 @@ class Video_Detail(ListView):
     def get(self,request):
         v_id = request.GET.get("id")
         video = Video_data.objects.get(id=v_id)
+        v_name = request.GET.get("name")
+        if v_name:
+            video = Video_data.objects.get(title=v_name)
         return render(request, 'outerNet/videoDetail.html', context={"video":video})
     def post(self,request):
         pass
@@ -701,12 +719,27 @@ class QXZ_Report_Detail2(ListView):
         pass
     def post(self,request):
         e_id = request.POST.get("e_id")
+        page = int(request.POST.get("page"))
         qxz_list = QXZdata_New.objects.filter(equip_id=e_id)
+        f_tbegin = request.POST.get('begin')
+        f_tend = request.POST.get('end')
+        if f_tbegin:
+            print("f_tbegin:", f_tbegin)
+            print("f_tend:", f_tend)
+            begindate = re.findall(r"\d+\.?\d*", f_tbegin)
+            enddate = re.findall(r"\d+\.?\d*", f_tend)
+            start_date = datetime.date(int(begindate[0]), int(begindate[1]), int(begindate[2]))
+            end_date = datetime.date(int(enddate[0]), int(enddate[1]), int(enddate[2]))
+            print("start_date:", start_date)
+            print("end_date:", end_date)
+            qxz_list = QXZdata_New.objects.filter(equip_id=e_id, upl_time__range=(start_date, end_date))
+            
         data = []
         for i in qxz_list:
             dat = {"e1":i.e1,"e2":i.e2,"e3":i.e3,"e4":i.e4,"e5":i.e5,"e6":i.e6,"e7":i.e7,"e8":i.e8,"e9":i.e9,"e10":i.e10,"e11":i.e11,"e12":i.e12,"e13":i.e13,"e14":i.e14}
             data.append({"upl_time":i.upl_time.strftime('%Y-%m-%d %H:%M:%S'),"dat":dat})
         nums = len(data)
+        data = data[(10*(page-1)):(page*10)]
         datas = {"data":data,"nums":nums}
         datas = json.dumps(datas)
         return HttpResponse(datas)
@@ -968,8 +1001,8 @@ class Video_Pub(ListView):
                 print("-------错误信息为----------")
                 print(e)
                 data = "0"
-            else:
-                data = "0"
+            # else:
+            #     data = "0"
 
         return HttpResponse(data)
 
@@ -1553,6 +1586,9 @@ class Video_Check_List(ListView):
         #保存
         elif req == "check":
             art_obj = Video_data.objects.get(id=art_id)
+            ckobj = CKArticle.objects.get(title=art_obj.title)
+            ckobj.hidden = True
+            ckobj.save()
             art_obj.hidden = True
             art_obj.save()
             data = "1"
@@ -1630,6 +1666,9 @@ class Equip_Check_List(ListView):
         #审核通过
         elif req == "check":
             art_obj = Product.objects.get(id=art_id)
+            ckobj = CKArticle.objects.get(title=art_obj.title)
+            ckobj.hidden = True
+            ckobj.save()
             art_obj.hidden = True
             art_obj.save()
             data = "1"
@@ -1708,6 +1747,9 @@ class Garden_Check_List(ListView):
         elif req == "check":
             art_obj = Pick_Pub.objects.get(id=art_id)
             art_obj.hidden = True
+            ckobj = CKArticle.objects.get(title=art_obj.title)
+            ckobj.hidden = True
+            ckobj.save()
             art_obj.save()
             data = "1"
         data = json.dumps(data,ensure_ascii=False)
@@ -3035,9 +3077,26 @@ class QXZ_Warning_View(ListView):
         print('user_name=', user_name)
         current_user = MyUser.objects.get(username=user_name)
         equip_list = Equip.objects.filter(equip_user=current_user,equip_type=5)
+        if current_user.is_staff:
+            equip_list = Equip.objects.filter(equip_type=5)
         return render(request, 'backstageNet/warn/warnSet.html', context={"equip_list":equip_list})
     def post(self,request):
-        pass
+        equip_id = request.POST.get('equip_id')
+        try:
+            alarm = QXZ_Alarm.objects.get(equip_id=equip_id).conf
+        except:
+            alarm = ""
+        x = QXZ_Conf.objects.get(equip_id=equip_id)
+        conf = {"e1":x.e1,"e2":x.e2,"e3":x.e3,"e4":x.e4,"e5":x.e5,
+                    "e6":x.e6,"e7":x.e7,"e8":x.e8,"e9":x.e9,"e10":x.e10,
+                    "e11":x.e11,"e12":x.e12,"e13":x.e13,"e14":x.e14,
+                    "e15":x.e15,"e16":x.e16,"e17":x.e17,"e18":x.e18,
+                    "e19":x.e19,"e20":x.e20,"e21":x.e21,"e22":x.e22,
+                    "e23":x.e23,"e24":x.e24,"e25":x.e25,"e26":x.e26,
+                    "e27":x.e27,"e28":x.e28,"e29":x.e29,"e30":x.e30}
+        data = {"alarm":alarm,"conf":conf}
+        data = json.dumps(data)
+        return HttpResponse(data)
 
 
 
@@ -3046,7 +3105,22 @@ class QXZ_Warning_List(ListView):
     def get(self,request):
         return render(request, 'backstageNet/warn/warnRecord.html', context={})
     def post(self,request):
-        pass
+        alarm = request.POST.get('alarm')
+        print(alarm)
+        print(eval(alarm)["equip_id"])
+        e_id = eval(alarm)["equip_id"]
+        tel = eval(alarm)["tel"]
+        equip_obj = Equip.objects.get(equip_id=e_id)
+        if QXZ_Alarm.objects.filter(equip_id=e_id).exists():
+            alarm_obj = QXZ_Alarm.objects.get(equip_id=equip_obj)
+            alarm_obj.conf = alarm
+            alarm_obj.tel = tel
+            alarm_obj.save()
+            print("修改成功")
+        else:
+            QXZ_Alarm.objects.create(equip_id=equip_obj,conf=alarm,tel=tel)
+        return HttpResponse("0")
+
 
 
 
@@ -3058,6 +3132,8 @@ class Production_Set(ListView):
         print('user_name=', user_name)
         current_user = MyUser.objects.get(username=user_name)
         equip_list = Equip.objects.filter(equip_user=current_user,equip_type=5)
+        if current_user.is_staff:
+            equip_list = Equip.objects.filter(equip_type=5)
         return render(request, 'backstageNet/warn/productionset.html', context={"equip_list":equip_list})
     def post(self,request):
         pass
@@ -3924,5 +4000,551 @@ class Equip_Addr(ListView):
             equip_list = Equip.objects.filter(equip_user=user)
         data = []
         for i in equip_list:
-            pass
-        
+            data.append({"equip_id":i.equip_id,"lng":i.lng,"lat":i.lat,"equip_type":i.equip_type.type_id})
+        data = json.dumps(data)
+        return HttpResponse(data)
+        
+        
+
+
+class Equip_Location(ListView):
+    def get(self,request):
+        pass
+    def post(self, request):
+        eid = request.POST.get("e_id")
+        ename = request.POST.get("ename")
+        lng = request.POST.get("lng")
+        lat = request.POST.get("lat")
+        if ename:
+            if Equip.objects.filter(equip_name=ename).exists():
+                return HttpResponse("0")
+            equip_obj = Equip.objects.get(equip_id=eid)
+            equip_obj.equip_name = ename
+            equip_obj.save()
+        if lat:
+            equip_obj = Equip.objects.get(equip_id=eid)
+            equip_obj.lng = lng
+            equip_obj.lat = lat
+            equip_obj.save()
+        return HttpResponse("1")
+    
+    
+import json
+class Add_Qxz_Test(ListView):
+    def get(self,request):
+        pass
+    def post(self, request):
+        payload = request.body
+        payload = json.loads(payload.decode())
+        print("payload",payload)
+        print("type",type(payload))
+        if payload.get("cmd") == "terminalData":
+            print("<-----uploading data!----->")
+            extdata = payload.get("ext")
+            print(type(extdata))
+            qxzdata = extdata['data']
+            print(qxzdata)
+            device_id = extdata['StationID']
+            print(device_id)
+            e1 = ''
+            e2 = ''
+            e3 = ''
+            e4 = ''
+            e5 = ''
+            e6 = ''
+            e7 = ''
+            e8 = ''
+            e9 = ''
+            e10 = ''
+            e11 = ''
+            e12 = ''
+            e13 = ''
+            e14 = ''
+            e15 = ''
+            e16 = ''
+            e17 = ''
+            e18 = ''
+            e19 = ''
+            e20 = ''
+            e21 = ''
+            e22 = ''
+            e23 = ''
+            e24 = ''
+            e25 = ''
+            e26 = ''
+            e27 = ''
+            e28 = ''
+            e29 = ''
+            e30 = ''
+            
+            
+            conf1 = ''
+            conf2 = ''
+            conf3 = ''
+            conf4 = ''
+            conf5 = ''
+            conf6 = ''
+            conf7 = ''
+            conf8 = ''
+            conf9 = ''
+            conf10 = ''
+            conf11 = ''
+            conf12 = ''
+            conf13 = ''
+            conf14 = ''
+            conf15 = ''
+            conf16 = ''
+            conf17 = ''
+            conf18 = ''
+            conf19 = ''
+            conf20 = ''
+            conf21 = ''
+            conf22 = ''
+            conf23 = ''
+            conf24 = ''
+            conf25 = ''
+            conf26 = ''
+            conf27 = ''
+            conf28 = ''
+            conf29 = ''
+            conf30 = ''
+            for i in qxzdata:
+                if i['eKey'] == 'e1':
+                    e1 = str(i['eValue']) + '#' + str(i['eNum']) + '#' + str(i['eKey'])
+                    conf1 = qxz_dict[i['eNum']][1] + '#' + qxz_dict[i['eNum']][2]
+                    if e1[0] == "#":
+                        continue
+                elif i['eKey'] == 'e2':
+                    e2 = str(i['eValue']) + '#' + str(i['eNum']) + '#' + str(i['eKey'])
+                    conf2 = qxz_dict[i['eNum']][1] + '#' + qxz_dict[i['eNum']][2]
+                    if e2[0] == "#":
+                        continue
+                elif i['eKey'] == 'e3':
+                    e3 = str(i['eValue']) + '#' + str(i['eNum']) + '#' + str(i['eKey'])
+                    conf3 = qxz_dict[i['eNum']][1] + '#' + qxz_dict[i['eNum']][2]
+                    if e3[0] == "#":
+                        continue
+                elif i['eKey'] == 'e4':
+                    e4 = str(i['eValue']) + '#' + str(i['eNum']) + '#' + str(i['eKey'])
+                    conf4 = qxz_dict[i['eNum']][1] + '#' + qxz_dict[i['eNum']][2]
+                    if e4[0] == "#":
+                        continue
+                elif i['eKey'] == 'e5':
+                    e5 = str(i['eValue']) + '#' + str(i['eNum']) + '#' + str(i['eKey'])
+                    conf5 = qxz_dict[i['eNum']][1] + '#' + qxz_dict[i['eNum']][2]
+                    if e5[0] == "#":
+                        continue
+                elif i['eKey'] == 'e6':
+                    e6 = str(i['eValue']) + '#' + str(i['eNum']) + '#' + str(i['eKey'])
+                    conf6 = qxz_dict[i['eNum']][1] + '#' + qxz_dict[i['eNum']][2]
+                    if e6[0] == "#":
+                        continue
+                elif i['eKey'] == 'e7':
+                    e7 = str(i['eValue']) + '#' + str(i['eNum']) + '#' + str(i['eKey'])
+                    conf7 = qxz_dict[i['eNum']][1] + '#' + qxz_dict[i['eNum']][2]
+                    if e7[0] == "#":
+                        continue
+                elif i['eKey'] == 'e8':
+                    e8 = str(i['eValue']) + '#' + str(i['eNum']) + '#' + str(i['eKey'])
+                    conf8 = qxz_dict[i['eNum']][1] + '#' + qxz_dict[i['eNum']][2]
+                    if e8[0] == "#":
+                        continue
+                elif i['eKey'] == 'e9':
+                    e9 = str(i['eValue']) + '#' + str(i['eNum']) + '#' + str(i['eKey'])
+                    conf9 = qxz_dict[i['eNum']][1] + '#' + qxz_dict[i['eNum']][2]
+                    if e9[0] == "#":
+                        continue
+                elif i['eKey'] == 'e10':
+                    e10 = str(i['eValue']) + '#' + str(i['eNum']) + '#' + str(i['eKey'])
+                    conf10 = qxz_dict[i['eNum']][1] + '#' + qxz_dict[i['eNum']][2]
+                    if e10[0] == "#":
+                        continue
+                elif i['eKey'] == 'e11':
+                    e11 = str(i['eValue']) + '#' + str(i['eNum']) + '#' + str(i['eKey'])
+                    conf11 = qxz_dict[i['eNum']][1] + '#' + qxz_dict[i['eNum']][2]
+                    if e11[0] == "#":
+                        continue
+                elif i['eKey'] == 'e12':
+                    e12 = str(i['eValue']) + '#' + str(i['eNum']) + '#' + str(i['eKey'])
+                    conf12 = qxz_dict[i['eNum']][1] + '#' + qxz_dict[i['eNum']][2]
+                    if e12[0] == "#":
+                        continue
+                elif i['eKey'] == 'e13':
+                    e13 = str(i['eValue']) + '#' + str(i['eNum']) + '#' + str(i['eKey'])
+                    conf13 = qxz_dict[i['eNum']][1] + '#' + qxz_dict[i['eNum']][2]
+                    if e13[0] == "#":
+                        continue
+                elif i['eKey'] == 'e14':
+                    e14 = str(i['eValue']) + '#' + str(i['eNum']) + '#' + str(i['eKey'])
+                    conf14 = qxz_dict[i['eNum']][1] + '#' + qxz_dict[i['eNum']][2]
+                    if e14[0] == "#":
+                        continue
+                elif i['eKey'] == 'e15':
+                    e15 = str(i['eValue']) + '#' + str(i['eNum']) + '#' + str(i['eKey'])
+                    conf15 = qxz_dict[i['eNum']][1] + '#' + qxz_dict[i['eNum']][2]
+                    if e15[0] == "#":
+                        continue
+                elif i['eKey'] == 'e16':
+                    e16 = str(i['eValue']) + '#' + str(i['eNum']) + '#' + str(i['eKey'])
+                    conf16 = qxz_dict[i['eNum']][1] + '#' + qxz_dict[i['eNum']][2]
+                    if e16[0] == "#":
+                        continue
+                elif i['eKey'] == 'e17':
+                    e17 = str(i['eValue']) + '#' + str(i['eNum']) + '#' + str(i['eKey'])
+                    conf17 = qxz_dict[i['eNum']][1] + '#' + qxz_dict[i['eNum']][2]
+                    if e17[0] == "#":
+                        continue
+                elif i['eKey'] == 'e18':
+                    e18 = str(i['eValue']) + '#' + str(i['eNum']) + '#' + str(i['eKey'])
+                    conf18 = qxz_dict[i['eNum']][1] + '#' + qxz_dict[i['eNum']][2]
+                    if e18[0] == "#":
+                        continue
+                elif i['eKey'] == 'e19':
+                    e19 = str(i['eValue']) + '#' + str(i['eNum']) + '#' + str(i['eKey'])
+                    conf19 = qxz_dict[i['eNum']][1] + '#' + qxz_dict[i['eNum']][2]
+                    if e19[0] == "#":
+                        continue
+                elif i['eKey'] == 'e20':
+                    e20 = str(i['eValue']) + '#' + str(i['eNum']) + '#' + str(i['eKey'])
+                    conf20 = qxz_dict[i['eNum']][1] + '#' + qxz_dict[i['eNum']][2]
+                    if e20[0] == "#":
+                        continue
+                elif i['eKey'] == 'e21':
+                    e21 = str(i['eValue']) + '#' + str(i['eNum']) + '#' + str(i['eKey'])
+                    conf21 = qxz_dict[i['eNum']][1] + '#' + qxz_dict[i['eNum']][2]
+                    if e21[0] == "#":
+                        continue
+                elif i['eKey'] == 'e22':
+                    e22 = str(i['eValue']) + '#' + str(i['eNum']) + '#' + str(i['eKey'])
+                    conf22 = qxz_dict[i['eNum']][1] + '#' + qxz_dict[i['eNum']][2]
+                    if e22[0] == "#":
+                        continue
+                elif i['eKey'] == 'e23':
+                    e23 = str(i['eValue']) + '#' + str(i['eNum']) + '#' + str(i['eKey'])
+                    conf23 = qxz_dict[i['eNum']][1] + '#' + qxz_dict[i['eNum']][2]
+                    if e23[0] == "#":
+                        continue
+                elif i['eKey'] == 'e24':
+                    e24 = str(i['eValue']) + '#' + str(i['eNum']) + '#' + str(i['eKey'])
+                    conf24 = qxz_dict[i['eNum']][1] + '#' + qxz_dict[i['eNum']][2]
+                    if e24[0] == "#":
+                        continue
+                elif i['eKey'] == 'e25':
+                    e25 = str(i['eValue']) + '#' + str(i['eNum']) + '#' + str(i['eKey'])
+                    conf25 = qxz_dict[i['eNum']][1] + '#' + qxz_dict[i['eNum']][2]
+                    if e25[0] == "#":
+                        continue
+                elif i['eKey'] == 'e26':
+                    e26 = str(i['eValue']) + '#' + str(i['eNum']) + '#' + str(i['eKey'])
+                    conf26 = qxz_dict[i['eNum']][1] + '#' + qxz_dict[i['eNum']][2]
+                    if e26[0] == "#":
+                        continue
+                elif i['eKey'] == 'e27':
+                    e27 = str(i['eValue']) + '#' + str(i['eNum']) + '#' + str(i['eKey'])
+                    conf27 = qxz_dict[i['eNum']][1] + '#' + qxz_dict[i['eNum']][2]
+                    if e27[0] == "#":
+                        continue
+                elif i['eKey'] == 'e28':
+                    e28 = str(i['eValue']) + '#' + str(i['eNum']) + '#' + str(i['eKey'])
+                    conf28 = qxz_dict[i['eNum']][1] + '#' + qxz_dict[i['eNum']][2]
+                    if e28[0] == "#":
+                        continue
+                elif i['eKey'] == 'e29':
+                    e29 = str(i['eValue']) + '#' + str(i['eNum']) + '#' + str(i['eKey'])
+                    conf29 = qxz_dict[i['eNum']][1] + '#' + qxz_dict[i['eNum']][2]
+                    if e29[0] == "#":
+                        continue
+                elif i['eKey'] == 'e30':
+                    e30 = str(i['eValue']) + '#' + str(i['eNum']) + '#' + str(i['eKey'])
+                    conf30 = qxz_dict[i['eNum']][1] + '#' + qxz_dict[i['eNum']][2]
+                    if e30[0] == "#":
+                        continue
+            qxz_exist = Equip.objects.filter(equip_id=device_id)
+            # print("extdata:", extdata)
+            # 设备存在,进一步判断状态表是否存在:
+            times = datetime.datetime.now()
+            if qxz_exist.exists():
+                print("<-----this equip is existed!----->")
+                try:
+                    e_id = Equip.objects.get(equip_id=device_id)
+                except:
+                    print("<-----this equip didn't exist!----->")      
+                try:
+                    # 设备数据表直接储存数据
+                    # QXZdata.objects.create(equip_id=e_id, qxz_data=extdata)
+                    QXZdata_New.objects.create(equip_id=e_id,
+                        e1=e1,e2=e2,e3=e3,e4=e4,e5=e5,e6=e6,e7=e7,e8=e8,e9=e9,e10=e10,
+                        e11=e11,e12=e12,e13=e13,e14=e14,e15=e15,e16=e16,e17=e17,e18=e18,e19=e19,e20=e20,
+                        e21=e21,e22=e22,e23=e23,e24=e24,e25=e25,e26=e26,e27=e27,e28=e28,e29=e29,e30=e30)
+                            
+                    print("<-----data update success!----->")
+                except:
+                    print("<-----data update failed!----->")
+            
+                if QXZstatus_New.objects.filter(equip_id=e_id).exists():
+                    print("<-----this equip's status is existed!----->")
+                    try:
+                        sta = QXZstatus_New.objects.get(equip_id=e_id)
+                        
+                        sta.e1 = e1
+                        sta.e2 = e2
+                        sta.e3 = e3
+                        sta.e4 = e4
+                        sta.e5 = e5
+                        sta.e6 = e6
+                        sta.e7 = e7
+                        sta.e8 = e8
+                        sta.e9 = e9
+                        sta.e10 = e10
+                        sta.e11 = e11
+                        sta.e12 = e12
+                        sta.e13 = e13
+                        sta.e14 = e14
+                        sta.e15 = e15
+                        sta.e16 = e16
+                        sta.e17 = e17
+                        sta.e18 = e18
+                        sta.e19 = e19
+                        sta.e20 = e20
+                        sta.e21 = e21
+                        sta.e22 = e22
+                        sta.e23 = e23
+                        sta.e24 = e24
+                        sta.e25 = e25
+                        sta.e26 = e26
+                        sta.e27 = e27
+                        sta.e28 = e28
+                        sta.e29 = e29
+                        sta.e30 = e30
+                        sta.is_online = "1"
+                        sta.save()
+                        print("<-----status update success!----->")
+                    except:
+                        print("<-----status update failed!----->")
+                else:
+                    # 设备状态表不存在、创建状态表:
+                    print("<-----this equip's status is not existed!----->")
+                    try:
+                        QXZstatus_New.objects.create(equip_id=e_id,
+                            e1=e1,e2=e2,e3=e3,e4=e4,e5=e5,e6=e6,e7=e7,e8=e8,e9=e9,e10=e10,
+                            e11=e11,e12=e12,e13=e13,e14=e14,e15=e15,e16=e16,e17=e17,e18=e18,e19=e19,e20=e20,
+                            e21=e21,e22=e22,e23=e23,e24=e24,e25=e25,e26=e26,e27=e27,e28=e28,e29=e29,e30=e30,is_online="1")
+                        
+                        # QXZstatus.objects.create(equip_id=e_id, qxz_status=extdata)
+                        print("<-----this equip's status table re-create successed!----->")
+                    except:
+                        print("<-----this equip's status table re-create failed!----->")
+                # 判断标题配置表
+                if QXZ_Conf.objects.filter(equip_id=e_id).exists():
+                    print("------conf create default-------")
+                else:
+                    QXZ_Conf.objects.create(equip_id=e_id,
+                        e1=conf1,e2=conf2,e3=conf3,e4=conf4,e5=conf5,e6=conf6,e7=conf7,e8=conf8,e9=conf9,e10=conf10,
+                        e11=conf11,e12=conf12,e13=conf13,e14=conf14,e15=conf15,e16=conf16,e17=conf17,e18=conf18,e19=conf19,e20=conf20,
+                        e21=conf21,e22=conf22,e23=conf23,e24=conf24,e25=conf25,e26=conf26,e27=conf27,e28=conf28,e29=conf29,e30=conf30)
+                    QXZ_Default_Conf.objects.create(equip_id=e_id,
+                        e1=conf1,e2=conf2,e3=conf3,e4=conf4,e5=conf5,e6=conf6,e7=conf7,e8=conf8,e9=conf9,e10=conf10,
+                        e11=conf11,e12=conf12,e13=conf13,e14=conf14,e15=conf15,e16=conf16,e17=conf17,e18=conf18,e19=conf19,e20=conf20,
+                        e21=conf21,e22=conf22,e23=conf23,e24=conf24,e25=conf25,e26=conf26,e27=conf27,e28=conf28,e29=conf29,e30=conf30)
+                    print("------conf create success-------")
+                # 设备状态表存在、刷新状态表:
+                print("2222222")
+
+            
+            else:
+                print("<-----this equip not existed!----->")
+                # 设备不存在,在设备列表中创建:
+                try:
+                    e_type = Equip_type.objects.get(type_id="5")
+                    e_id = Equip.objects.create(equip_id=device_id, equip_type=e_type)
+                    print("<-----this imei add successed!----->")
+                    try:
+                        # 设备数据表直接储存数据
+                        QXZdata_New.objects.create(equip_id=e_id,
+                            e1=e1,e2=e2,e3=e3,e4=e4,e5=e5,e6=e6,e7=e7,e8=e8,e9=e9,e10=e10,
+                            e11=e11,e12=e12,e13=e13,e14=e14,e15=e15,e16=e16,e17=e17,e18=e18,e19=e19,e20=e20,
+                            e21=e21,e22=e22,e23=e23,e24=e24,e25=e25,e26=e26,e27=e27,e28=e28,e29=e29,e30=e30)
+                        # QXZdata.objects.create(equip_id=e_id, qxz_data=extdata)
+                        print("<-----data update success!----->")
+                    except:
+                        print("<-----data update failed!----->")
+                    try:
+                        QXZstatus_New.objects.create(equip_id=e_id,
+                            e1=e1,e2=e2,e3=e3,e4=e4,e5=e5,e6=e6,e7=e7,e8=e8,e9=e9,e10=e10,
+                            e11=e11,e12=e12,e13=e13,e14=e14,e15=e15,e16=e16,e17=e17,e18=e18,e19=e19,e20=e20,
+                            e21=e21,e22=e22,e23=e23,e24=e24,e25=e25,e26=e26,e27=e27,e28=e28,e29=e29,e30=e30,is_online="1")
+                        # QXZstatus.objects.create(equip_id=e_id, qxz_status=extdata)
+                        print("<-----this imei register successed!----->")
+                    except:
+                        print("<-----this imei register failed!----->")
+                    
+                    # 判断标题配置表
+                    if QXZ_Conf.objects.filter(equip_id=e_id).exists():
+                        print("------conf create default-------")
+                    else:
+                        QXZ_Conf.objects.create(equip_id=e_id,
+                            e1=conf1,e2=conf2,e3=conf3,e4=conf4,e5=conf5,e6=conf6,e7=conf7,e8=conf8,e9=conf9,e10=conf10,
+                            e11=conf11,e12=conf12,e13=conf13,e14=conf14,e15=conf15,e16=conf16,e17=conf17,e18=conf18,e19=conf19,e20=conf20,
+                            e21=conf21,e22=conf22,e23=conf23,e24=conf24,e25=conf25,e26=conf26,e27=conf27,e28=conf28,e29=conf29,e30=conf30)
+                        QXZ_Default_Conf.objects.create(equip_id=e_id,
+                            e1=conf1,e2=conf2,e3=conf3,e4=conf4,e5=conf5,e6=conf6,e7=conf7,e8=conf8,e9=conf9,e10=conf10,
+                            e11=conf11,e12=conf12,e13=conf13,e14=conf14,e15=conf15,e16=conf16,e17=conf17,e18=conf18,e19=conf19,e20=conf20,
+                            e21=conf21,e22=conf22,e23=conf23,e24=conf24,e25=conf25,e26=conf26,e27=conf27,e28=conf28,e29=conf29,e30=conf30)
+                        print("------conf create success-------")
+                            
+                except Exception as e:
+                    print(e)
+                    print("<-----this imei add failed!----->")  
+
+            if payload.get("cmd") == "Status":
+                extdata = payload.get("ext")['terminalStatus']
+                print(extdata)
+                try:
+                    volt = extdata["VOLT"]
+                    rssi = extdata["RSSI"]
+                    iccid = extdata["ICCID"]
+                    lng = extdata["longitude"]
+                    lat = extdata["latitude"]
+                    led = extdata["Dotled"]
+                    
+                except:
+                    pass
+                try:
+                    dver = extdata["Version"]
+                except:
+                    dver = ""
+                if qxz_exist.exists():
+                    print("<-----this equip is existed!----->")
+                    try:
+                        e_id = Equip.objects.get(equip_id=device_id)
+                    except:
+                        print("<-----this equip didn't exist!----->")
+                    QXZ_Info_Record.objects.create(equip_id=e_id, volt=volt,rssi=rssi)
+                    if QXZ_Base_Info.objects.filter(equip_id=e_id).exists():
+                        print("<-----this qxz_base_info is existed!----->")
+                        try:
+                            sta = QXZ_Base_Info.objects.get(equip_id=device_id)
+                            sta.volt = volt
+                            sta.rssi = rssi
+                            sta.iccid = iccid
+                            sta.lng = lng
+                            sta.lat = lat
+                            sta.led = led
+                            sta.dver = dver
+                            sta.save()
+                            sta1 = Equip.objects.get(equip_id=device_id)
+                            sta1.lng = lng
+                            sta1.lat = lat
+                            sta1.save()
+                            print("<-----qxz_base_info update success!----->")
+                        except:
+                            print("<-----qxz_base_info update failed!----->")
+                        try:
+                            sta = QXZ_Base_Info.objects.get(equip_id=device_id)
+                            sta.volt = volt
+                            sta.rssi = rssi
+                            sta.save()
+                            print("<-----qxz_base_info update success!!!----->")
+                        except:
+                            pass
+                    else:
+                        # 设备阈值表不存在、创建阈值表:
+                        print("<-----this qxz_base_info is not existed!----->")
+                        try:
+                            QXZ_Base_Info.objects.create(equip_id=device_id, volt=volt,rssi=rssi,iccid=iccid,lng=lng,lat=lat,led=led)
+                            print("<-----this qxz_base_info table re-create successed!----->")
+                        except:
+                            print("<-----this qxz_base_info table re-create failed!----->")
+        
+        
+        return HttpResponse("1")
+    
+    
+
+# 气象站数据导出接口
+class QXZ_Data_Export(ListView):
+    def get(self,request):
+        equip_id = request.GET.get('id')
+        print("请求数据的设备id:",equip_id)       
+        f_tbegin = request.GET.get('begin')
+        f_tend = request.GET.get('end')
+        filename = request.GET.get('filename')
+        print("f_tbegin:", f_tbegin)
+        print("f_tend:", f_tend)
+        print("f_tbegin:", type(f_tbegin))
+        print("f_tend:", type(f_tend))
+        # 查询时间段
+        if f_tbegin:
+            begindate = re.findall(r"\d+\.?\d*", f_tbegin)
+            enddate = re.findall(r"\d+\.?\d*", f_tend)
+            start_date = datetime.date(int(begindate[0]), int(begindate[1]), int(begindate[2]))
+            end_date = datetime.date(int(enddate[0]), int(enddate[1]), int(enddate[2]))
+            print("start_date:", start_date)
+            print("end_date:", end_date)
+            sta1 = QXZdata.objects.filter(equip_id=equip_id, upl_time__range=(start_date, end_date))
+            print("sta1:", sta1)
+            sta2 = [{"equip_name": x.equip_id.equip_name,
+                    "qxz_data": eval(x.qxz_data)["data"],
+                    "upl_time": x.upl_time.strftime("%Y-%m-%d %H:%M:%S")} for x in sta1]      
+        # 查询全部
+        else:
+            sta1 = QXZdata.objects.filter(equip_id=equip_id)
+            print("sta1:",sta1)
+            sta2 = [{"equip_name": x.equip_id.equip_name,
+                    "qxz_data": eval(x.qxz_data)["data"],
+                    "upl_time": x.upl_time.strftime("%Y-%m-%d %H:%M:%S")} for x in sta1]
+        # print(sta2)
+        try:
+        # 遍历标题
+            title = []
+            for aaa in sta2[0]['qxz_data']:
+                # print(qxz_dict[aaa['eNum']][1])
+                title.append(qxz_dict[aaa['eNum']][1]+aaa['eKey'])
+            title.append("上报时间")
+            print(title)
+        # print(sta2[0]['qxz_data'])
+        except:
+            book = xlwt.Workbook() # 创建一个excel对象
+            sheet = book.add_sheet('Sheet1',cell_overwrite_ok=True) # 添加一个sheet页
+            sheet.write(0,0,"错误的时间段") # 将title数组中的字段写入到0行i列中
+            # 写出到IO
+            output = BytesIO()
+            book.save(output)
+            # 重新定位到开始
+            output.seek(0)
+            response = HttpResponse(content_type='application/vnd.ms-excel')
+            response['Content-Disposition'] = 'attachment;filename=%s.xls'%filename
+            response.write(output.getvalue())
+            return response
+
+
+        book = xlwt.Workbook() # 创建一个excel对象
+        sheet = book.add_sheet('Sheet1',cell_overwrite_ok=True) # 添加一个sheet页
+        for i in range(len(title)): # 遍历列
+            sheet.write(0,i,title[i]) # 将title数组中的字段写入到0行i列中
+
+        for x in range(len(sta2)): # 遍历列表
+            # print("行",x)
+            for xx in range(len(title)):
+                print("行",x+1,"列",xx)
+                # print(sta2[x]["qxz_data"][xx-1])
+                if xx+1 == len(title):
+                    # print(x+1,xx,sta2[x]["upl_time"])
+                    sheet.write(x+1,xx,sta2[x]["upl_time"])
+                    break
+                # print(x+1,xx,sta2[x]["qxz_data"][xx]["eValue"]+" "+qxz_dict[sta2[x]["qxz_data"][xx]["eNum"]][2])
+                sheet.write(x+1,xx,sta2[x]["qxz_data"][xx]["eValue"]+" "+qxz_dict[sta2[x]["qxz_data"][xx]["eNum"]][2])
+
+        # 写出到IO
+        output = BytesIO()
+        book.save(output)
+        # 重新定位到开始
+        output.seek(0)
+        response = HttpResponse(content_type='application/vnd.ms-excel')
+        response['Content-Disposition'] = 'attachment;filename=%s.xls'%filename
+        response.write(output.getvalue())
+        return response
+        
+    
+    def post(self,request):
+        pass

+ 10 - 9
apps/Home/views.py

@@ -27,7 +27,7 @@ import os
 # from configure import verification_code
 import re
 from apps.AppInfo.models import Equip, Equip_type, MyUser, QXZdata, QXZstatus, QXZdata_New, JKdata, Article, QXZstatus_New, QXZswitchdata, QXZswitchstatus, CKArticle, GardenManage, Video_data,\
-    Product, Pick_Pub, FarmList, Hotel_Info, GardenArea, Sightsee_Info,Hotel_Info
+Product, Pick_Pub, FarmList, Hotel_Info, GardenArea, Sightsee_Info,Hotel_Info, Relations
 from qcloudsms_py import SmsSingleSender
 from qcloudsms_py.httpclient import HTTPError
 
@@ -148,13 +148,14 @@ class Home(View):
         two_news = CKArticle.objects.filter(art_type=2)[0:10]
         video_news = Video_data.objects.all()[0:4]
         product = Product.objects.all()[0:8]
-        pick = Pick_Pub.objects.all()[0:6]
-        farm = FarmList.objects.all()
-        garden = GardenArea.objects.all()[0:6]
-        hotel = Hotel_Info.objects.all()[0:6]
-        article = CKArticle.objects.all()[0:12]
-        sightsee = Sightsee_Info.objects.all()[0:6]
-        hotel2 = Hotel_Info.objects.all().order_by('-upl_time')[0:6]
+        pick = Pick_Pub.objects.filter(hidden=True)[0:8]
+        farm = FarmList.objects.all()[0:8]
+        garden = GardenArea.objects.filter(hidden=True)[0:6]
+        hotel = Hotel_Info.objects.filter(hidden=True)[0:6]
+        article = CKArticle.objects.filter(hidden=True)[0:12]
+        sightsee = Sightsee_Info.objects.filter(hidden=True)[0:6]
+        hotel2 = Hotel_Info.objects.filter(hidden=True).order_by('-upl_time')[0:6]
+        relation = Relations.objects.all()
         if request.user.is_authenticated():
             user_name = request.user.username
             curr_user = MyUser.objects.get(username=user_name)
@@ -162,7 +163,7 @@ class Home(View):
             print('user=', curr_user.username)
         else:
             curr_user = ""
-        return render(request, 'outerNet/index2.html', context={"user_news": user_news,"zero_news": zero_news, "one_news": one_news,"article":article,
+        return render(request, 'outerNet/index2.html', context={"user_news": user_news,"zero_news": zero_news, "one_news": one_news,"article":article,"relation":relation,
                                                                "two_news": two_news, "video_news": video_news,"hotel":hotel,"garden":garden,"hotel2":hotel2,
                                                                "product": product, "pick": pick, "farm": farm, "curr_user": curr_user,"sightsee":sightsee})
 

BIN=BIN
sightsee_photos/20200831110011.png


BIN=BIN
sightsee_photos/20200831110447.jpg


BIN=BIN
sightsee_photos/20200831110854.jpg


BIN=BIN
sightsee_photos/20200831111046.jpg


BIN=BIN
sightsee_photos/20200831111252.jpg


BIN=BIN
sightsee_photos/20200831111342.jpg


+ 6 - 6
templates/backstageNet/annunciate/policyListView.html

@@ -119,7 +119,7 @@
                                 <label class="layui-form-label" style="color:#029eef">类型选择:</label>
                                 <div class="layui-input-inline">
                                     <select name="type" lay-verify="required" lay-filter="type">
-                                        <option value=""></option>
+                                        <!-- <option value=""></option> -->
                                         <option value="0">新闻</option>
                                         <option value="1">政策</option>
                                         <option value="2">技术</option>
@@ -206,15 +206,15 @@
                 })
             });
 
-            getData('policy_list', { page: 1, type: '' });
+            getData('policy_list', 1, 0 );
         });
 
 
-        function getData(page, data) {
+        function getData(page, page,req) {
             $.ajax({
                 url: 'policy_list',
-                type: 'get',
-                data: data,
+                type: 'post',
+                data: { page: page, req: req },
                 dataType: 'html',
                 success: function (data) {
                     $('#dataTable').children('tbody').html(data);
@@ -229,7 +229,7 @@
                                 $.ajax({
                                     url: 'policy_list',
                                     type: 'get',
-                                    data: { page: obj.curr },
+                                    data: { page: obj.curr, req: req },
                                     dataType: 'html',
                                     success: function (data) {
                                         $('#dataTable').children('tbody').html(data);

+ 2 - 1
templates/backstageNet/info/dormPub.html

@@ -247,7 +247,7 @@
                         <div class="layui-form-item">
                             <label class="layui-form-label">民宿名称:</label>
                             <div class="layui-input-inline">
-                                <input type="text" name="name" required lay-verify="required" placeholder="请输入名称"
+                                <input type="text" name="name" maxlength="20" required lay-verify="required" placeholder="请输入名称"
                                     autocomplete="off" class="layui-input">
                             </div>
                         </div>
@@ -563,6 +563,7 @@
             map.clearOverlays();
             $('.uploadImg').addClass('uploadImgIcon');
             $('#demo1').removeAttr('src'); //图片链接(base64)
+            $('#uploader-list').html('')
             fuzhi()
             if (window.id !== '') {
                 parent.getData('', parent.$('.layui-laypage-curr em').eq(1).html(), parent.$('.permission .active').data('type'))

+ 1 - 1
templates/backstageNet/info/gardenPub.html

@@ -179,7 +179,7 @@
                         <div class="layui-form-item">
                             <label class="layui-form-label">采摘名称:</label>
                             <div class="layui-input-inline">
-                                <input type="text" name="name" required lay-verify="required" placeholder="请输入采摘名称"
+                                <input type="text" name="name" maxlength="20" required lay-verify="required" placeholder="请输入采摘名称"
                                     autocomplete="off" class="layui-input">
                             </div>
                         </div>

+ 1 - 1
templates/backstageNet/info/newsPub.html

@@ -176,7 +176,7 @@
                         <div class="layui-form-item">
                             <label class="layui-form-label">文章标题:</label>
                             <div class="layui-input-inline">
-                                <input type="text" name="title" required lay-verify="required" placeholder="请输入标题"
+                                <input type="text" name="title" maxlength="20" required lay-verify="required" placeholder="请输入标题"
                                     autocomplete="off" class="layui-input">
                             </div>
                         </div>

+ 1 - 1
templates/backstageNet/info/productPub.html

@@ -173,7 +173,7 @@
                         <div class="layui-form-item">
                             <label class="layui-form-label">产品名称:</label>
                             <div class="layui-input-inline">
-                                <input type="text" name="title" required lay-verify="required" placeholder="请输入产品名称" autocomplete="off" class="layui-input">
+                                <input type="text" name="title" maxlength="20" required lay-verify="required" placeholder="请输入产品名称" autocomplete="off" class="layui-input">
                             </div>
                         </div>
                         <div class="layui-form-item layui-form-text">

+ 1 - 1
templates/backstageNet/info/sightseePub.html

@@ -247,7 +247,7 @@
                         <div class="layui-form-item">
                             <label class="layui-form-label">景点名称:</label>
                             <div class="layui-input-inline">
-                                <input type="text" name="name" required lay-verify="required" placeholder="请输入名称"
+                                <input type="text" name="name" maxlength="20" required lay-verify="required" placeholder="请输入名称"
                                     autocomplete="off" class="layui-input">
                             </div>
                         </div>

+ 1 - 1
templates/backstageNet/info/videoPub.html

@@ -176,7 +176,7 @@
                         <div class="layui-form-item">
                             <label class="layui-form-label">视频标题:</label>
                             <div class="layui-input-inline">
-                                <input type="text" name="title" required lay-verify="required" placeholder="请输入视频标题" autocomplete="off" class="layui-input">
+                                <input type="text" name="title" maxlength="20" required lay-verify="required" placeholder="请输入视频标题" autocomplete="off" class="layui-input">
                             </div>
                         </div>
                         <div class="layui-form-item layui-form-text">

+ 1 - 1
templates/backstageNet/infoManage/pickManageList.html

@@ -32,7 +32,7 @@
 </tr>
 {% endfor %} {% else %}
 <tr>
-    <td colspan="6" style="text-align:center;">暂无数据</td>
+    <td colspan="7" style="text-align:center;">暂无数据</td>
 </tr>
 {% endif %}
 <input type="hidden" value="{{nums}}" id="totalPage">

+ 0 - 6
templates/backstageNet/infoManage/sightseeManageList.html

@@ -15,12 +15,6 @@
         <a href="JavaScript:;" class="passBtn"  onclick="passFun('{{msg.id}}')">通过</a>
         |
         {% else %}
-            {% if msg.hatType == 1 %}
-            <button type="button" onclick="hatPush('{{msg.id}}',1)" class="layui-btn layui-btn-xs layui-btn-danger hatPush"><i class="layui-icon layui-icon-fire"></i></button>
-            {% else %}
-            <button type="button" onclick="hatPush('{{msg.id}}',0)" class="layui-btn layui-btn-xs layui-btn-primary rejectBtn"><i class="layui-icon layui-icon-fire"></i></button>
-            {% endif %}
-            <span>|</span>
         {% endif %}
         <a href="JavaScript:;" class="delBtn" onclick="delFun('{{msg.id}}')">删除</a>
         |

+ 181 - 4
templates/backstageNet/jk/equipmanage_jk.html

@@ -159,7 +159,10 @@
             margin-top: 10px;
         }
 
-
+        #divMain{
+            box-sizing: border-box;
+            width: 100%;
+        }
         #divMain .a4 {
             width: 50%;
             height: 50%;
@@ -342,6 +345,25 @@
             margin-left: 5px;
             cursor: pointer;
         }
+        .jkedit {
+            background-image: url(../static/imgs/jkedit.png);
+            background-repeat: no-repeat;
+            background-size: 100% 100%;
+            width: 120px;
+            height: 30px;
+            margin: auto;
+            margin-top: 15px;
+            /* margin-bottom: 15px; */
+        }
+
+        .jkedit span {
+            width: 54px;
+            height: 32px;
+            display: inline-block;
+            float: left;
+            margin-left: 5px;
+            cursor: pointer;
+        }
         /* 监控列表 */
         .gardenListBtn{
             margin-top: 10px;
@@ -361,6 +383,19 @@
         .gardenListBtn button.layui-btn-primary:hover{
             box-shadow: 0 0 2px 0px #039c6b;
         }
+        /* 气象站定位弹框 */
+		#addLocation{
+			display: none;
+			padding: 20px;
+			height: 450px;
+		}
+		.mapbox{
+			height: 100%;
+		}
+		#allmap{
+			width: 100%;
+			height: 100%;
+		}
     </style>
 </head>
 <script>
@@ -467,6 +502,10 @@
                                             <span onmousedown="configCamera(this,'move',8)" onmouseup="configCamera(this,'stop')"></span>
                                             <span onmousedown="configCamera(this,'move',9)" onmouseup="configCamera(this,'stop')"></span>
                                         </div>
+                                        <div class="jkedit">
+                                            <span onclick="addMapPosition()" ></span>
+                                            <span onclick="ChangeName()" ></span>
+                                        </div>
                                     </div>
                                 </td>
                             </tr>
@@ -480,12 +519,22 @@
             </div>
         </div>
     </div>
-    <input type="text" name="" id="currid" value="{{equip_id|default:''}}">
-
+    <input type="hidden" name="" id="currid" value="{{equip_id|default:''}}">
+    <div id="addLocation">
+        <div class="">
+            经度:<input type="text" name="title" lay-verify="title" id="lng" placeholder="" class="layui-input" style="width: 200px;display: inline-block;">
+            纬度:<input type="text" name="title" lay-verify="title" id="lat"  placeholder="" class="layui-input" style="width: 200px;display: inline-block;">
+            <button type="button" id="shaixuan" onclick="sub_getMarker()" class="layui-btn layui-btn-normal">定位</button>			
+        </div>
+        <div class="mapbox">
+            <div id="allmap"></div>
+        </div>
+    </div>
 
     <script src="{% static '/lib/js/jquery-2.1.4.min.js'%}"></script>
     <script src="{% static '/lib/layui/layui.js'%}"></script>
     <script src="{% static '/js/backstageNet/common.js'%}"></script>
+	<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=TcRPmrsiZUqdUBWoELrUArRkCRC36KMx"></script>
 
     <script>
         $.ajaxSetup({
@@ -538,7 +587,134 @@
 
             $("#span_V" + n).addClass("active");
         }
+        // 百度地图API功能
+        var map = new BMap.Map("allmap");
+        map.centerAndZoom(new BMap.Point(113.64964385, 34.75661006), 13);// 创建点坐标
+        map.enableScrollWheelZoom();   //启用滚轮放大缩小,默认禁用
+        map.enableContinuousZoom();    //启用地图惯性拖拽,默认禁用
+        map.addControl(new BMap.NavigationControl());               // 添加平移缩放控件
+        map.addControl(new BMap.ScaleControl());                    // 添加比例尺控件
+        map.addControl(new BMap.OverviewMapControl());              //添加缩略地图控件
+        map.enableScrollWheelZoom();                            //启用滚轮放大缩小
+        map.addControl(new BMap.MapTypeControl());
+        //单击获取点击的经纬度
+        map.addEventListener("click", function (e) {
+            map.clearOverlays();
+            $('#lng').val(e.point.lng);
+            $('#lat').val(e.point.lat);
+            var point = new BMap.Point(e.point.lng, e.point.lat);
+            var marker = new BMap.Marker(point);
+            map.addOverlay(marker);
+            // alert(e.point.lng + "," + e.point.lat);
+        });
 
+        function sub_getMarker() {
+            map.clearOverlays();
+            var points = []
+            var point = new BMap.Point($('#lng').val(), $('#lat').val());
+            var marker = new BMap.Marker(point);
+            map.addOverlay(marker);
+            points.push(point)
+            console.log(points)
+            map.setViewport(points);
+        }
+        // 添加地图定位
+        function addMapPosition(obj) {
+            id = $('#divMain a.aSelected').find('.equipname').html().trim();
+            layui.use('layer', function () { //独立版的layer无需执行这一句
+                var $ = layui.jquery, layer = layui.layer; //独立版的layer无需执行这一句
+                layer.open({
+                    title: '手动添加位置',
+                    type: 1,
+                    area: ['900px', '600px'],
+                    btn: ['确定', '取消'],
+                    yes: function (index, layero) {
+                        //按钮【按钮一】的回调
+                        if($('#lng').val() && $('#lat').val()){
+                            $.ajax({
+                                url:'equip_location',
+                                type:'post',
+                                data:{
+                                    e_id:id,
+                                    lng:$('#lng').val(),
+                                    lat:$('#lat').val(),
+                                },
+                                success:function(data){
+                                    console.log(data)
+                                    if(data == 0){
+                                        layer.closeAll();
+                                    }else{
+                                        layer.msg('添加失败', {icon: 2}); 
+                                    }
+                                },
+                                error:function(type){
+                                    console.log(type)
+                                }
+                            })
+                        }else{
+                            layer.msg('请先定位', {icon: 2}); 
+                        }
+                    
+                        return false;  
+                    }
+                    , btn2: function (index, layero) {
+                        //按钮【按钮二】的回调
+                        //return false 开启该代码可禁止点击该按钮关闭
+                    },
+                    content: $('#addLocation')
+                });
+            });
+        }
+
+        //点击修改名称,跳出弹框并显示所选设备的设备名称;
+        function ChangeName() {
+            id = $('#divMain a.aSelected').find('.equipname').html().trim();
+            layui.use('layer', function () { //独立版的layer无需执行这一句
+                var $ = layui.jquery, layer = layui.layer; //独立版的layer无需执行这一句
+                layer.prompt({ title: '修改名称', value: '', area: 400 }, function (val, index) {
+                    layer.close(index);
+                    ChangeNameSub(id, val);
+                });
+            });
+        }
+        function ChangeNameSub(deviceId, name, address) {
+                data = {
+                    ename: name,
+                    eid: deviceId
+                }
+            //校验重复校验重复
+            $.ajax({
+                type: "post",
+                url: "equip_location",
+                data: data,
+                dataType: "json",
+                success: function (data) {
+                    if (data == 1) {
+                        // layer.tips("设备名已存在!", '#ename');
+                        layui.use('layer', function () {
+                            var layer = layui.layer;
+                            layer.msg('设备名已存在!');
+                        })
+                        return false;
+                    }
+                    else if (data == 2) {
+                        layui.use('layer', function () {
+                            var layer = layui.layer;
+                            layer.msg('设备位置添加成功!');
+                            // window.location.href = window.location.href;
+                        })
+                    }
+
+                    else if (data == 0) {
+                        layui.use('layer', function () {
+                            var layer = layui.layer;
+                            layer.msg('设备名称修改成功!');
+                            // window.location.href = window.location.href;
+                        })
+                    } 
+                }
+            });
+        }
         function setMouseOut(idx) {
             if (curIndex != idx && $("#a_" + idx).length > 0)
                 $("#a_" + idx).removeClass("aSelected");
@@ -639,6 +815,7 @@
 
             var playHtml;
             var script;
+            var token = 'at.0izp4b188fna8vvk8j28o2l4a980qqex-1otrmuqf8l-1k26cbi-cletdiwkp'
              
 
             if (isIE) {
@@ -654,7 +831,7 @@
             }
             else {
 
-                playHtml = "<iframe   id='playFrame" + curIndex + "'  src='https://open.ys7.com/ezopen/h5/iframe_se?url=ezopen://open.ys7.com/" + deviceSerial + "/" + cameraNo + ".hd.live&autoplay=1&accessToken=at.d2trwvdod5bxxlr4dug8le6wb0ugbi2h-173pi8ymy3-1882umg-zrib7cj3f&templete=2'  width='100%' height='100%' allowfullscreen frameborder='0' allowtransparency=true></iframe>"
+                playHtml = "<iframe   id='playFrame" + curIndex + "'  src='https://open.ys7.com/ezopen/h5/iframe_se?url=ezopen://open.ys7.com/" + deviceSerial + "/" + cameraNo + ".hd.live&autoplay=1&accessToken="+token+"'  width='100%' height='100%' allowfullscreen frameborder='0' allowtransparency=true></iframe>"
 
                 script = document.createElement("script");
                 script.type = "text/javascript";

+ 2 - 2
templates/backstageNet/limit/expertList.html

@@ -5,7 +5,7 @@
         <img src="{% static '/imgs/cornerIcon.png' %}" alt="">
         <div class="expertInner">
             <div class="expertImg">
-                <img src="http://192.168.1.9:8000{{msg.pic}}" alt="">
+                <img src="http://127.0.0.1:8000{{msg.pic}}" alt="">
             </div>
             <div class="expertTxt">
                 <h1>{{msg.name}}</h1>
@@ -23,6 +23,6 @@
     </div>
     {% endfor %}
 {% else %}
-    <div style="text-align:center;line-height: 200px;">暂无数据</div>
+    <div style="text-align:center;line-height: 200px;flex: 1;">暂无数据</div>
 {% endif %}
 <input type="hidden" value="{{nums}}" id="totalPage">

+ 69 - 23
templates/backstageNet/map/map.html

@@ -21,6 +21,10 @@
             width: 100%;
             height: 100vh;
         }
+        .BMapLib_SearchInfoWindow .BMapLib_bubble_content p{
+            line-height: 24px;
+            font-size: 14px;
+        }
     </style>
 </head>
 
@@ -125,6 +129,7 @@
     $("#mapControl_type").html("卫星");
     map.centerAndZoom(new BMap.Point(map_center[0], map_center[1]), 15);
     map.enableScrollWheelZoom(true);
+    geoc = new BMap.Geocoder();
 
     //气象站标识
     var qxzIcon = new BMap.Icon("{% static 'imgs/qxz.png'%}", new BMap.Size(30, 40), { imageSize: new BMap.Size(30, 40),anchor: new BMap.Size(0, 0) });
@@ -137,12 +142,17 @@
     //摄像头标识——加密
     var sxtEncryptIcon = new BMap.Icon("{% static 'imgs/sxt-Encrypt.png'%}", new BMap.Size(30, 40), { imageSize: new BMap.Size(30, 40) });
     
-    function openInfo(title, content, e) {
+    function openInfo(title, id, e) {
         var p = e.target;
-        var point = new BMap.Point(p.getPosition().lng, p.getPosition().lat);
+        var point = new BMap.Point(p.getPosition().lng-.0004, p.getPosition().lat-.001);
+        geoc.getLocation(point, function (rs) {
+            var addComp = rs.addressComponents;
+            $('.area').html('位置:' + addComp.province + ", " + addComp.city + ", " + addComp.district)
+        });
         //var infoWindow = new BMap.InfoWindow(content);  // 创建信息窗口对象
         //map.openInfoWindow(infoWindow, point); //开启信息窗口
 
+        var content = '<p>IMEI:' + id + '</p><p class="area">位置:' + e.point.equip_location + '</p></br>';
         var searchInfoWindow = new BMapLib.SearchInfoWindow(map, content, {
             title: title, //标题 
             panel: "panel", //检索结果面板  
@@ -180,22 +190,27 @@
     var WeatherstationMarker = [];//气象站
     var CameraMarker = [];//摄像头
 
-    GetMonitorMark(1);
+    // GetMonitorMark(1);
+    getData()
     function getData(){
         $.ajax({
-            url:'',
+            url:'equip_addr',
             type:'post',
             data:'',
             dataType:'json',
             success:function(data){
-                
+                var dat = {
+                    "Status": true,
+                    "list":data
+                }
+                GetMonitorMark(dat)
             }
         })
     }
 
     //监测数据
-    function GetMonitorMark(ShowStatus) {
-        var data = {
+    function GetMonitorMark(data) {
+        var data1 = {
             "Status": true,
             "list": [{
                 "id": "D08652664",
@@ -239,8 +254,8 @@
                 for (var i = 0; i < jsonObj.list.length; i++) {
                     var markObj = jsonObj.list[i];
 
-                    var id = markObj.id;
-                    var markType = markObj.markType;
+                    var id = markObj.equip_id;
+                    var markType = markObj.equip_type;
                     var title = markObj.title;
                     var theName = markObj.EquipmentName;
                     var lng = markObj.lng;
@@ -256,9 +271,9 @@
                         var CameraNo = markObj.CameraNo;
                         marker = createCameraMarker(lng, lat, icon, title, id, CameraNo);
                     }
-                    else //气象站
-                        marker = createMarker(lng, lat, icon, title, content);
-
+                    else if (markType == "5") { //气象站
+                        marker = createMarker(lng, lat, icon, '气象站', id);
+                    }
                     map.addOverlay(marker);
 
                     switch (markType) {
@@ -287,31 +302,25 @@
             $("#" + objId).html("");
     }
     function GetMarkerIcon(markType, isRun) {
-        var icon = qxzIcon;
+        var icon = '';
 
         switch (markType) {
             case 5:
-                if (isRun)
-                    icon = qxzIcon;
-                else
-                    icon = qxzOffIcon;
+                icon = qxzIcon;
                 break;
             case 6:
-                if (isRun)
-                    icon = sxtIcon;
-                else
-                    icon = sxtOffIcon;
+                icon = sxtIcon;
                 break;
         }
 
         return icon;
     }
     //将创建marker的方法抽出来,否则的话总是打开最后一个InfoWindow
-    function createMarker(lng, lat, icon, title, content) {
+    function createMarker(lng, lat, icon, title, id) {
 
         var markerx = new BMap.Marker(new BMap.Point(lng, lat), { icon: icon });
         markerx.addEventListener("click", function (e) {
-            openInfo(title, content, e);
+            openInfo(title, id, e);
         });
         return markerx;
     }
@@ -358,6 +367,43 @@
         $("#mapControl_typeChange").hide();
 
     }
+    function toggleIcon(obj, markType) {
+        var IconShow = false;
+
+        if ($(obj).hasClass("IconHide")) {
+            IconShow = true;
+            $(obj).removeClass("IconHide");
+        }
+        else {
+            IconShow = false;
+            $(obj).addClass("IconHide");
+        }
+
+        var pointArray;
+
+        switch (markType) {
+            case 5:
+                pointArray = WeatherstationMarker;
+                break;
+            case 6:
+                pointArray = CameraMarker;
+                break;
+        }
+
+        for (var i = 0; i < pointArray.length; i++) {
+            var marker = pointArray[i];
+            if (IconShow) {
+                var marker = pointArray[i];
+                //map.addOverlay(marker); 
+                marker.show();
+            }
+            else {
+                var marker = pointArray[i];
+                // map.removeOverlay(marker); 
+                marker.hide();
+            }
+        }
+    }
     // 图例悬浮
     function SetAnimation(opFlag, markType) {
 

+ 389 - 170
templates/backstageNet/production/cropcount.html

@@ -160,16 +160,35 @@
                 <button type="button" class="layui-btn  layui-btn-normal layui-btn-sm fr"
                     onclick="selectModelFun()">新增</button>
                 <h2>
+                    <!-- 种植统计{% if garden|length %} -->
                     种植统计
                     <form class="layui-form" action="" style="display:inline-block;vertical-align: middle;">
                         <div class="layui-form-item" style="margin-bottom: 0;">
                             <label class="layui-form-label" style="color:#029eef">选择园区:</label>
                             <div class="layui-input-inline">
-                                <select name="city" id="farmSelect">
+                                <!-- <select name="city" id="farmSelect"> -->
+                                <select name="areaSelct" id="areaSelct" lay-verify="required" lay-filter="areaSelct">
+                                    {% for area in garden %}
+                                    <option value="{{area.id}}">{{area.name}}</option>
+                                    {% endfor %}
                                 </select>
                             </div>
                         </div>
                     </form>
+                    <!-- {% else %} {% endif %} {% if farm|length %} -->
+                    <form class="layui-form" action="" style="display:inline-block;vertical-align: middle;">
+                        <div class="layui-form-item" style="margin-bottom: 0;">
+                            <label class="layui-form-label" style="color:#029eef">农场选择:</label>
+                            <div class="layui-input-inline">
+                                <select name="farmSelct" id="farmSelct" lay-verify="required" lay-filter="farmSelct">
+                                    {% for farm in farm %}
+                                    <option value="{{farm.id}}">{{farm.name}}</option>
+                                    {% endfor %}
+                                </select>
+                            </div>
+                        </div>
+                    </form>
+                    <!-- {% else %} {% endif %} -->
                 </h2>
 
             </div>
@@ -207,7 +226,7 @@
                 </div>
 
                 <div class="layui-form-item">
-                    <label class="layui-form-label">所属园区</label>
+                    <label class="layui-form-label">所属农场</label>
                     <div class="layui-input-block">
                         <input type="text" name="area" required lay-verify="required" readonly="readonly"
                             autocomplete="off" class="layui-input">
@@ -262,6 +281,33 @@
                 }
             });
 
+            // 获取农场选择
+            form.on('select(areaSelct)', function (data) {
+                $.ajax({
+                    url: 'contrast',
+                    type: 'post',
+                    dataType: 'json',
+                    data: {
+                        id: data.value
+                    },
+                    success: function (data) {
+                        console.log(data)
+                        if (data.length) {
+                            renderSelect(data);
+                        } else {
+                            $('#farmSelct').html('');
+                            layui.use(['form'], function () {
+                                form.render('select'); //刷新select选择框渲染
+                            })
+                        }
+                        // gedata('garden_user_new', 2)
+                    },
+                    error: function (type) {
+                        console.log(type)
+                    }
+                })
+            });
+
             //园区下拉列表数据渲染
             gedataA('park_land')
             function gedataA(url) {
@@ -282,163 +328,163 @@
                             form.render('select'); //刷新select选择框渲染
 
                             //页面数据渲染
-                            gedata('cropcount_view', 1)
-                            function gedata(url, page) {
-                                $.ajax({
-                                    url: 'cropcount_view',
-                                    type: 'get',
-                                    data: {
-                                        page: page,
-                                        ids: $('#farmSelect option:eq(0)').val(),
-                                    },
-                                    dataType: 'json',
-                                    success: function (data) {
-                                        if (data.nums !== 0) {
-                                            //获取需要的数据
-                                            var group = data.dat;
-                                            //拼接字符串
-                                            var str = '';
-                                            //对数据做遍历,拼接到页面显示
-                                            // console.log(group)
-                                            for (var i = 0; i < group.length; i++) {
-                                                var strSeparator = "-"; //日期分隔符
-                                                var oDate1
-                                                var oDate2
-                                                var strDateStart = new Date()
-                                                var Str = strDateStart.getFullYear() + '-' +
-                                                    (strDateStart.getMonth() + 1) + '-' +
-                                                    strDateStart.getDate() + ' '
-                                                var strDateEnd = group[i].data.upl_time
-                                                var iDays;
-                                                oDate1 = Str.split(strSeparator);
-                                                oDate2 = strDateEnd.split(strSeparator);
-                                                var strDateS = new Date(oDate1[0], oDate1[1] - 1, oDate1[2]);
-                                                var strDateE = new Date(oDate2[0], oDate2[1] - 1, oDate2[2]);
-                                                iDays = parseInt(Math.ceil(strDateS - strDateE) / 1000 / 60 / 60 / 24)//把相差的毫秒数转换为天数
-                                                // console.log(group[i].data.upl_time)
-                                                if (iDays > 0) {
-                                                    //正数
-                                                    var dateNum = iDays
-                                                } else if (iDays < 0) {
-                                                    //负数
-                                                    var dateNum = 0
-                                                }
-                                                str += '<div class="layui-col-xs6 layui-col-sm6 layui-col-md4">' +
-                                                    '<div class="userItem">' +
-                                                    '<div class="userMsg">' +
-                                                    '<div class="fl imgDiv">' +
-                                                    '<img src="" alt="">' +
-                                                    '<p>' + group[i].data.cropname + '</p>' +
-                                                    '</div>' +
-                                                    '<div class="userInfo">' +
-                                                    // '<p>当前阶段:' + group[i].curro + '</p>' +
-                                                    '<p>所属农场:' + group[i].data.area + '</p>' +
-                                                    '<p>规  模:' + group[i].data.crop_count + '</p>' +
-                                                    '<p>种植日期:' + group[i].data.upl_time + '</p>' +
-                                                    '<p>已生长/天:' + dateNum + '</p>' +
-                                                    '</div>' +
-                                                    '</div>' +
-                                                    '<div class="operateDiv">' +
-                                                    '<button type="button" class="layui-btn layui-btn-sm layui-btn-normal" onclick="amend( ' + group[i].data.id + ' )">修改</button>' +
-                                                    '<button type="button" class="layui-btn layui-btn-sm layui-btn-danger" onclick="del(' + group[i].data.id + ')">删除</button>' +
-                                                    // '<button type="button" class="layui-btn layui-btn-sm layui-btn-danger" onclick="over(' + group[i].id + ')">结束</button>' +
-                                                    // '<button type="button" class="layui-btn layui-btn-sm layui-btn-danger" onclick="over(\'' + group[i].data.id + '\',\'' + group[i].curro + '\')">结束</button>' +
-                                                    '</div>' +
-                                                    '</div>' +
-                                                    '</div>';
-                                            }
-                                            //放入页面的容器显示
-                                            $('#box').html(str)
-
-                                            laypage.render({
-                                                elem: 'page' //注意,这里的 test1 是 ID,不用加 # 号
-                                                , count: data.nums
-                                                , theme: '#2ca9f9'
-                                                , limit: '9'
-                                                , layout: ['prev', 'page', 'next', 'skip']
-                                                , jump: function (obj, first) {
-                                                    if (!first) {
-                                                        $.ajax({
-                                                            url: 'cropcount_view',
-                                                            type: 'get',
-                                                            data: { page: obj.curr, ids: $('#farmSelect option:eq(0)').val() },
-                                                            dataType: 'html',
-                                                            success: function (data) {
-                                                                //转换格式
-                                                                var res = JSON.parse(data)
-                                                                //获取需要的数据
-                                                                var group = res.dat;
-                                                                //拼接字符串
-                                                                var str = '';
-                                                                //对数据做遍历,拼接到页面显示
-                                                                for (var i = 0; i < group.length; i++) {
-                                                                    var strSeparator = "-"; //日期分隔符
-                                                                    var oDate1
-                                                                    var oDate2
-                                                                    var strDateStart = new Date()
-                                                                    var Str = strDateStart.getFullYear() + '-' +
-                                                                        (strDateStart.getMonth() + 1) + '-' +
-                                                                        strDateStart.getDate() + ' '
-                                                                    var strDateEnd = group[i].data.upl_time
-                                                                    var iDays;
-                                                                    oDate1 = Str.split(strSeparator);
-                                                                    oDate2 = strDateEnd.split(strSeparator);
-                                                                    var strDateS = new Date(oDate1[0], oDate1[1] - 1, oDate1[2]);
-                                                                    var strDateE = new Date(oDate2[0], oDate2[1] - 1, oDate2[2]);
-                                                                    iDays = parseInt(Math.ceil(strDateS - strDateE) / 1000 / 60 / 60 / 24)//把相差的毫秒数转换为天数
-
-                                                                    if (iDays > 0) {
-                                                                        //正数
-                                                                        var dateNum = iDays
-                                                                    } else if (iDays < 0) {
-                                                                        //负数
-                                                                        var dateNum = 0
-                                                                    }
-                                                                    str += '<div class="layui-col-xs6 layui-col-sm6 layui-col-md4">' +
-                                                                        '<div class="userItem">' +
-                                                                        '<div class="userMsg">' +
-                                                                        '<div class="fl imgDiv">' +
-                                                                        '<img src="" alt="">' +
-                                                                        '<p>' + group[i].data.cropname + '</p>' +
-                                                                        '</div>' +
-                                                                        '<div class="userInfo">' +
-                                                                        // '<p>当前阶段:' + group[i].curro + '</p>' +
-                                                                        '<p>所属农场:' + group[i].data.area + '</p>' +
-                                                                        '<p>规  模:' + group[i].data.crop_count + '</p>' +
-                                                                        '<p>种植日期:' + group[i].data.upl_time + '</p>' +
-                                                                        '<p>已生长/天:' + dateNum + '</p>' +
-                                                                        '</div>' +
-                                                                        '</div>' +
-                                                                        '<div class="operateDiv">' +
-                                                                        '<button type="button" class="layui-btn layui-btn-sm layui-btn-normal" onclick="amend( ' + group[i].data.id + ' )">修改</button>' +
-                                                                        '<button type="button" class="layui-btn layui-btn-sm layui-btn-danger" onclick="del(' + group[i].data.id + ')">删除</button>' +
-                                                                        // '<button type="button" class="layui-btn layui-btn-sm layui-btn-danger" onclick="over(' + group[i].id + ')">结束</button>' +
-                                                                        // '<button type="button" class="layui-btn layui-btn-sm layui-btn-danger" onclick="over(\'' + group[i].data.id + '\',\'' + group[i].curro + '\')">结束</button>' +
-                                                                        '</div>' +
-                                                                        '</div>' +
-                                                                        '</div>';
-                                                                }
-                                                                //放入页面的容器显示
-                                                                $('#box').html(str)
-                                                            },
-                                                            error: function (type) {
-                                                                console.log(type)
-                                                            }
-                                                        })
-                                                    }
-                                                }
-                                            });
-                                        } else {
-                                            var html = '<div class="layui-col-xs12 " style="line-height:100px;text-align:center">暂无数据</div>'
-                                            $('#box').html(html);
-                                        }
-                                    },
-                                    error: function (type) {
-                                        console.log(type)
-                                        alert('失败')
-                                    }
-                                })
-                            }
+                            // gedata('cropcount_view', 1)
+                            // function gedata(url, page) {
+                            //     $.ajax({
+                            //         url: 'cropcount_view',
+                            //         type: 'get',
+                            //         data: {
+                            //             page: page,
+                            //             ids: $('#farmSelect option:eq(0)').val(),
+                            //         },
+                            //         dataType: 'json',
+                            //         success: function (data) {
+                            //             if (data.nums !== 0) {
+                            //                 //获取需要的数据
+                            //                 var group = data.dat;
+                            //                 //拼接字符串
+                            //                 var str = '';
+                            //                 //对数据做遍历,拼接到页面显示
+                            //                 // console.log(group)
+                            //                 for (var i = 0; i < group.length; i++) {
+                            //                     var strSeparator = "-"; //日期分隔符
+                            //                     var oDate1
+                            //                     var oDate2
+                            //                     var strDateStart = new Date()
+                            //                     var Str = strDateStart.getFullYear() + '-' +
+                            //                         (strDateStart.getMonth() + 1) + '-' +
+                            //                         strDateStart.getDate() + ' '
+                            //                     var strDateEnd = group[i].data.upl_time
+                            //                     var iDays;
+                            //                     oDate1 = Str.split(strSeparator);
+                            //                     oDate2 = strDateEnd.split(strSeparator);
+                            //                     var strDateS = new Date(oDate1[0], oDate1[1] - 1, oDate1[2]);
+                            //                     var strDateE = new Date(oDate2[0], oDate2[1] - 1, oDate2[2]);
+                            //                     iDays = parseInt(Math.ceil(strDateS - strDateE) / 1000 / 60 / 60 / 24)//把相差的毫秒数转换为天数
+                            //                     // console.log(group[i].data.upl_time)
+                            //                     if (iDays > 0) {
+                            //                         //正数
+                            //                         var dateNum = iDays
+                            //                     } else if (iDays < 0) {
+                            //                         //负数
+                            //                         var dateNum = 0
+                            //                     }
+                            //                     str += '<div class="layui-col-xs6 layui-col-sm6 layui-col-md4">' +
+                            //                         '<div class="userItem">' +
+                            //                         '<div class="userMsg">' +
+                            //                         '<div class="fl imgDiv">' +
+                            //                         '<img src="" alt="">' +
+                            //                         '<p>' + group[i].data.cropname + '</p>' +
+                            //                         '</div>' +
+                            //                         '<div class="userInfo">' +
+                            //                         // '<p>当前阶段:' + group[i].curro + '</p>' +
+                            //                         '<p>所属农场:' + group[i].data.area + '</p>' +
+                            //                         '<p>规  模:' + group[i].data.crop_count + '</p>' +
+                            //                         '<p>种植日期:' + group[i].data.upl_time + '</p>' +
+                            //                         '<p>已生长/天:' + dateNum + '</p>' +
+                            //                         '</div>' +
+                            //                         '</div>' +
+                            //                         '<div class="operateDiv">' +
+                            //                         '<button type="button" class="layui-btn layui-btn-sm layui-btn-normal" onclick="amend( ' + group[i].data.id + ' )">修改</button>' +
+                            //                         '<button type="button" class="layui-btn layui-btn-sm layui-btn-danger" onclick="del(' + group[i].data.id + ')">删除</button>' +
+                            //                         // '<button type="button" class="layui-btn layui-btn-sm layui-btn-danger" onclick="over(' + group[i].id + ')">结束</button>' +
+                            //                         // '<button type="button" class="layui-btn layui-btn-sm layui-btn-danger" onclick="over(\'' + group[i].data.id + '\',\'' + group[i].curro + '\')">结束</button>' +
+                            //                         '</div>' +
+                            //                         '</div>' +
+                            //                         '</div>';
+                            //                 }
+                            //                 //放入页面的容器显示
+                            //                 $('#box').html(str)
+
+                            //                 laypage.render({
+                            //                     elem: 'page' //注意,这里的 test1 是 ID,不用加 # 号
+                            //                     , count: data.nums
+                            //                     , theme: '#2ca9f9'
+                            //                     , limit: '9'
+                            //                     , layout: ['prev', 'page', 'next', 'skip']
+                            //                     , jump: function (obj, first) {
+                            //                         if (!first) {
+                            //                             $.ajax({
+                            //                                 url: 'cropcount_view',
+                            //                                 type: 'get',
+                            //                                 data: { page: obj.curr, ids: $('#farmSelect option:eq(0)').val() },
+                            //                                 dataType: 'html',
+                            //                                 success: function (data) {
+                            //                                     //转换格式
+                            //                                     var res = JSON.parse(data)
+                            //                                     //获取需要的数据
+                            //                                     var group = res.dat;
+                            //                                     //拼接字符串
+                            //                                     var str = '';
+                            //                                     //对数据做遍历,拼接到页面显示
+                            //                                     for (var i = 0; i < group.length; i++) {
+                            //                                         var strSeparator = "-"; //日期分隔符
+                            //                                         var oDate1
+                            //                                         var oDate2
+                            //                                         var strDateStart = new Date()
+                            //                                         var Str = strDateStart.getFullYear() + '-' +
+                            //                                             (strDateStart.getMonth() + 1) + '-' +
+                            //                                             strDateStart.getDate() + ' '
+                            //                                         var strDateEnd = group[i].data.upl_time
+                            //                                         var iDays;
+                            //                                         oDate1 = Str.split(strSeparator);
+                            //                                         oDate2 = strDateEnd.split(strSeparator);
+                            //                                         var strDateS = new Date(oDate1[0], oDate1[1] - 1, oDate1[2]);
+                            //                                         var strDateE = new Date(oDate2[0], oDate2[1] - 1, oDate2[2]);
+                            //                                         iDays = parseInt(Math.ceil(strDateS - strDateE) / 1000 / 60 / 60 / 24)//把相差的毫秒数转换为天数
+
+                            //                                         if (iDays > 0) {
+                            //                                             //正数
+                            //                                             var dateNum = iDays
+                            //                                         } else if (iDays < 0) {
+                            //                                             //负数
+                            //                                             var dateNum = 0
+                            //                                         }
+                            //                                         str += '<div class="layui-col-xs6 layui-col-sm6 layui-col-md4">' +
+                            //                                             '<div class="userItem">' +
+                            //                                             '<div class="userMsg">' +
+                            //                                             '<div class="fl imgDiv">' +
+                            //                                             '<img src="" alt="">' +
+                            //                                             '<p>' + group[i].data.cropname + '</p>' +
+                            //                                             '</div>' +
+                            //                                             '<div class="userInfo">' +
+                            //                                             // '<p>当前阶段:' + group[i].curro + '</p>' +
+                            //                                             '<p>所属农场:' + group[i].data.area + '</p>' +
+                            //                                             '<p>规  模:' + group[i].data.crop_count + '</p>' +
+                            //                                             '<p>种植日期:' + group[i].data.upl_time + '</p>' +
+                            //                                             '<p>已生长/天:' + dateNum + '</p>' +
+                            //                                             '</div>' +
+                            //                                             '</div>' +
+                            //                                             '<div class="operateDiv">' +
+                            //                                             '<button type="button" class="layui-btn layui-btn-sm layui-btn-normal" onclick="amend( ' + group[i].data.id + ' )">修改</button>' +
+                            //                                             '<button type="button" class="layui-btn layui-btn-sm layui-btn-danger" onclick="del(' + group[i].data.id + ')">删除</button>' +
+                            //                                             // '<button type="button" class="layui-btn layui-btn-sm layui-btn-danger" onclick="over(' + group[i].id + ')">结束</button>' +
+                            //                                             // '<button type="button" class="layui-btn layui-btn-sm layui-btn-danger" onclick="over(\'' + group[i].data.id + '\',\'' + group[i].curro + '\')">结束</button>' +
+                            //                                             '</div>' +
+                            //                                             '</div>' +
+                            //                                             '</div>';
+                            //                                     }
+                            //                                     //放入页面的容器显示
+                            //                                     $('#box').html(str)
+                            //                                 },
+                            //                                 error: function (type) {
+                            //                                     console.log(type)
+                            //                                 }
+                            //                             })
+                            //                         }
+                            //                     }
+                            //                 });
+                            //             } else {
+                            //                 var html = '<div class="layui-col-xs12 " style="line-height:100px;text-align:center">暂无数据</div>'
+                            //                 $('#box').html(html);
+                            //             }
+                            //         },
+                            //         error: function (type) {
+                            //             console.log(type)
+                            //             alert('失败')
+                            //         }
+                            //     })
+                            // }
                         }
                     },
                     error: function (type) {
@@ -448,10 +494,8 @@
             }
 
 
-            //选择园区的下拉框监听回调
-            form.on('select()', function (data) {
-                // sessionStorage.setItem('seelectID', data.value)
-                // sessionStorage.setItem('seelectName', $('#farmSelect option:selected').text())
+            // 选择农场的下拉框监听回调
+            form.on('select(farmSelct)', function (data) {
                 //页面数据渲染
                 gedata('cropcount_view', 1)
                 function gedata(url, page) {
@@ -464,7 +508,7 @@
                         },
                         dataType: 'json',
                         success: function (data) {
-                            if (data) {
+                            if (data.nums !== 0) {
                                 //获取需要的数据
                                 var group = data.dat;
                                 //拼接字符串
@@ -489,7 +533,7 @@
                                     if (iDays > 0) {
                                         //正数
                                         var dateNum = iDays
-                                    } else if (iDays < 0) {
+                                    } else if (iDays <= 0) {
                                         //负数
                                         var dateNum = 0
                                     }
@@ -640,10 +684,185 @@
 
         })
 
+        // 渲染农场下拉框数据
+        function renderSelect(data) {   
+            $('#farmSelct').html('');
+            var html = '';
+            for (var i = 0; i < data.length; i++) {
+                html += '<option value="' + data[i].id + '">' + data[i].name + '</option>';
+                if (i == data.length - 1) {
+                    $('#farmSelct').html(html);
+                    layui.use(['form'], function () {
+                        form.render('select'); //刷新select选择框渲染
+                    })
+                    gedata('cropcount_view', 1, data[0].id)
+                }
+            }
+        }
+
+
+        // 选中农场进行渲染列表
+        gedata('cropcount_view', 1, $('#farmSelct').val())
+        function gedata(url, page, id) {
+            $.ajax({
+                url: 'cropcount_view',
+                type: 'get',
+                data: {
+                    page: page,
+                    ids: id,
+                },
+                dataType: 'json',
+                success: function (data) {
+                    if (data.nums !== 0) {
+                        //获取需要的数据
+                        var group = data.dat;
+                        //拼接字符串
+                        var str = '';
+                        //对数据做遍历,拼接到页面显示
+                        for (var i = 0; i < group.length; i++) {
+                            var strSeparator = "-"; //日期分隔符
+                            var oDate1
+                            var oDate2
+                            var strDateStart = new Date()
+                            var Str = strDateStart.getFullYear() + '-' +
+                                (strDateStart.getMonth() + 1) + '-' +
+                                strDateStart.getDate() + ' '
+                            var strDateEnd = group[i].data.upl_time
+                            var iDays;
+                            oDate1 = Str.split(strSeparator);
+                            oDate2 = strDateEnd.split(strSeparator);
+                            var strDateS = new Date(oDate1[0], oDate1[1] - 1, oDate1[2]);
+                            var strDateE = new Date(oDate2[0], oDate2[1] - 1, oDate2[2]);
+                            iDays = parseInt(Math.ceil(strDateS - strDateE) / 1000 / 60 / 60 / 24)//把相差的毫秒数转换为天数
+                            if (iDays > 0) {
+                                //正数
+                                var dateNum = iDays
+                            } else if (iDays <= 0) {
+                                //负数
+                                var dateNum = 0
+                            }
+                            str += '<div class="layui-col-xs6 layui-col-sm6 layui-col-md4">' +
+                                '<div class="userItem">' +
+                                '<div class="userMsg">' +
+                                '<div class="fl imgDiv">' +
+                                '<img src="" alt="">' +
+                                '<p>' + group[i].data.cropname + '</p>' +
+                                '</div>' +
+                                '<div class="userInfo">' +
+                                // '<p>当前阶段:' + group[i].curro + '</p>' +
+                                '<p>所属农场:' + group[i].data.area + '</p>' +
+                                '<p>规  模:' + group[i].data.crop_count + '</p>' +
+                                '<p>种植日期:' + group[i].data.upl_time + '</p>' +
+                                '<p>已生长/天:' + dateNum + '</p>' +
+                                '</div>' +
+                                '</div>' +
+                                '<div class="operateDiv">' +
+                                '<button type="button" class="layui-btn layui-btn-sm layui-btn-normal" onclick="amend( ' + group[i].data.id + ' )">修改</button>' +
+                                '<button type="button" class="layui-btn layui-btn-sm layui-btn-danger" onclick="del(' + group[i].data.id + ')">删除</button>' +
+                                // '<button type="button" class="layui-btn layui-btn-sm layui-btn-danger" onclick="over(\'' + group[i].data.id + '\',\'' + group[i].curro + '\')">结束</button>' +
+                                '</div>' +
+                                '</div>' +
+                                '</div>';
+                        }
+                        //放入页面的容器显示
+                        $('#box').html(str)
+
+                        laypage.render({
+                            elem: 'page' //注意,这里的 test1 是 ID,不用加 # 号
+                            , count: data.nums
+                            , limit: '9'
+                            , theme: '#2ca9f9'
+                            , layout: ['prev', 'page', 'next', 'skip']
+                            , jump: function (obj, first) {
+                                if (!first) {
+                                    $.ajax({
+                                        url: 'cropcount_view',
+                                        type: 'get',
+                                        // data: { page: obj.curr, ids: sessionStorage.getItem('seelectID') },
+                                        data: { page: obj.curr, ids: $('#farmSelect').val() },
+                                        dataType: 'html',
+                                        success: function (data) {
+                                            //转换格式
+                                            var res = JSON.parse(data)
+                                            //获取需要的数据
+                                            var group = res.dat;
+                                            //拼接字符串
+                                            var str = '';
+                                            //对数据做遍历,拼接到页面显示
+                                            for (var i = 0; i < group.length; i++) {
+                                                var strSeparator = "-"; //日期分隔符
+                                                var oDate1
+                                                var oDate2
+                                                var strDateStart = new Date()
+                                                var Str = strDateStart.getFullYear() + '-' +
+                                                    (strDateStart.getMonth() + 1) + '-' +
+                                                    strDateStart.getDate() + ' '
+                                                var strDateEnd = group[i].data.upl_time
+                                                var iDays;
+                                                oDate1 = Str.split(strSeparator);
+                                                oDate2 = strDateEnd.split(strSeparator);
+                                                var strDateS = new Date(oDate1[0], oDate1[1] - 1, oDate1[2]);
+                                                var strDateE = new Date(oDate2[0], oDate2[1] - 1, oDate2[2]);
+                                                iDays = parseInt(Math.ceil(strDateS - strDateE) / 1000 / 60 / 60 / 24)//把相差的毫秒数转换为天数
+
+                                                if (iDays > 0) {
+                                                    //正数
+                                                    var dateNum = iDays
+                                                } else if (iDays <= 0) {
+                                                    //负数
+                                                    var dateNum = 0
+                                                }
+                                                str += '<div class="layui-col-xs6 layui-col-sm6 layui-col-md4">' +
+                                                    '<div class="userItem">' +
+                                                    '<div class="userMsg">' +
+                                                    '<div class="fl imgDiv">' +
+                                                    '<img src="" alt="">' +
+                                                    '<p>' + group[i].data.cropname + '</p>' +
+                                                    '</div>' +
+                                                    '<div class="userInfo">' +
+                                                    // '<p>当前阶段:' + group[i].curro + '</p>' +
+                                                    '<p>所属农场:' + group[i].data.area + '</p>' +
+                                                    '<p>规  模:' + group[i].data.crop_count + '</p>' +
+                                                    '<p>种植日期:' + group[i].data.upl_time + '</p>' +
+                                                    '<p>已生长/天:' + dateNum + '</p>' +
+                                                    '</div>' +
+                                                    '</div>' +
+                                                    '<div class="operateDiv">' +
+                                                    '<button type="button" class="layui-btn layui-btn-sm layui-btn-normal" onclick="amend( ' + group[i].data.id + ' )">修改</button>' +
+                                                    '<button type="button" class="layui-btn layui-btn-sm layui-btn-danger" onclick="del(' + group[i].data.id + ')">删除</button>' +
+                                                    // '<button type="button" class="layui-btn layui-btn-sm layui-btn-danger" onclick="over(' + group[i].id + ')">结束</button>' +
+                                                    // '<button type="button" class="layui-btn layui-btn-sm layui-btn-danger" onclick="over(\'' + group[i].data.id + '\',\'' + group[i].curro + '\')">结束</button>' +
+                                                    '</div>' +
+                                                    '</div>' +
+                                                    '</div>';
+                                            }
+                                            //放入页面的容器显示
+                                            $('#box').html(str)
+                                        },
+                                        error: function (type) {
+                                            console.log(type)
+                                        }
+                                    })
+                                }
+                            }
+                        });
+                    } else {
+                        var html = '<div class="layui-col-xs12 " style="line-height:100px;text-align:center">暂无数据</div>'
+                        $('#box').html(html);
+                    }  
+                },
+                error: function (type) {
+                    console.log(type)
+                    alert('失败')
+                }
+            })
+        }
+
+
         //修改
         function amend(id) {
-            var idData = $('#farmSelect').val()
-            var nameData = $('#farmSelect option:selected').text()
+            var idData = $('#farmSelct').val()
+            var nameData = $('#farmSelct option:selected').text()
             if (idData !== '' && nameData !== '') {
                 $.ajax({
                     url: 'cropcount_view',
@@ -737,8 +956,8 @@
 
         // 新增
         function selectModelFun() {
-            var idData = $('#farmSelect').val()
-            var nameData = $('#farmSelect option:selected').text()
+            var idData = $('#farmSelct').val()
+            var nameData = $('#farmSelct option:selected').text()
             if (idData !== '' && nameData !== '') {
                 layui.use(['layer'], function () {
                     layer = layui.layer;
@@ -757,7 +976,7 @@
                 // $('input[name="area"]').val(sessionStorage.getItem('seelectName'))
                 $('input[name="area"]').val(nameData)
             } else {
-                layer.msg("请先选择园区!", { time: 1000, icon: 5 })
+                layer.msg("请先选择园区下的农场!", { time: 1000, icon: 5 })
             }
         }
     </script>

+ 3 - 1
templates/backstageNet/production/gardenManage.html

@@ -514,6 +514,8 @@
                         $('input[name="curr_var"]').val(data[0].curr_var) //品种
                         $('textarea[name="content"]').val(data[0].farm_desc) //介绍
                         $('input[name="id"]').val(data[0].id) //id
+                        $('#img_url').val(data[0].farm_img)
+                        $('#demo1').attr('src',data[0].farm_img)
 
                     },
                     error: function (type) {
@@ -542,7 +544,7 @@
                             if (data) {
                                 layer.close(index);
                                 location.reload();
-                                parent.layer.msg("操作成功!", { time: 1000, icon: 1 })
+                                layer.msg("操作成功!", { time: 1000, icon: 1 })
                             }
                         }
                     })

+ 1 - 1
templates/backstageNet/production/gardenNew.html

@@ -4,7 +4,7 @@
         <!-- <p class="username">{{ msg.art }}</p> -->
         <p class="username">{{ msg.name }}</p>
         <div class="userMsg">
-            <img :src='http://127.0.0.1:8000/{{ msg.farm_img }}' class="fl" alt="">
+            <img src='http://127.0.0.1:8000/{{ msg.farm_img }}' class="fl" alt="">
             <div class="userInfo">
                 <p>基地面积(亩): {{ msg.area }}</p>
                 <p>管理者: {{ msg.manage_user.name }}</p>

+ 4 - 2
templates/backstageNet/production/pick.html

@@ -205,7 +205,8 @@
         <div>
             <form class="layui-form" action="" lay-filter="sellForm">
                 <div class="layui-form-item">
-                    <label class="layui-form-label">所属园区</label>
+                    <!-- <label class="layui-form-label">所属园区</label> -->
+                    <label class="layui-form-label">所属农场</label>
                     <div class="layui-input-block">
                         <select name="farm" lay-verify="required" lay-search>
                             {% for farm in farm_list %}
@@ -313,7 +314,8 @@
                             html += ' <div class="layui-col-xs6 layui-col-sm6 layui-col-md4">' +
                                 '<div class="userItem"><div class="userMsg"><div class="fl imgDiv">' +
                                 '<img src="../static/imgs/Pick_icon.png" alt=""></div><div class="userInfo">' +
-                                '<p>采摘人员: ' + dat[i].name + '</p><p>所属园区:' + dat[i].farm + '</p><p>品种: ' + dat[i].var + '</p><p>采摘数量: ' + dat[i].num + '</p>' +
+                                // '<p>采摘人员: ' + dat[i].name + '</p><p>所属园区:' + dat[i].farm + '</p><p>品种: ' + dat[i].var + '</p><p>采摘数量: ' + dat[i].num + '</p>' +
+                                '<p>采摘人员: ' + dat[i].name + '</p><p>所属农场:' + dat[i].farm + '</p><p>品种: ' + dat[i].var + '</p><p>采摘数量: ' + dat[i].num + '</p>' +
                                 '<p>采摘时间: ' + time[0] + '</p></div></div><div class="operateDiv">' +
                                 '<button type="button" class="layui-btn layui-btn-sm layui-btn-normal" onclick=\'edit(' + datMsg + ')\'>修改</button>' +
                                 '<button type="button" class="layui-btn layui-btn-sm layui-btn-danger" onclick="del(' + dat[i].id + ')">删除</button>' +

+ 22 - 13
templates/backstageNet/production/repertoryManage.html

@@ -144,7 +144,7 @@
                 </a>
             </span>
         </div>
-        <!-- 内容 -->
+        <!-- 内容 --> 
         <div class="mainContent">
             <div class="widget-title">
                 <button type="button" class="layui-btn  layui-btn-normal layui-btn-sm fr"
@@ -153,9 +153,13 @@
                     库存管理
                     <form class="layui-form" action="" style="display:inline-block;vertical-align: middle;">
                         <div class="layui-form-item" style="margin-bottom: 0;">
-                            <label class="layui-form-label" style="color:#029eef">选择园区:</label>
+                            <!-- <label class="layui-form-label" style="color:#029eef">选择园区:</label> -->
+                            <label class="layui-form-label" style="color:#029eef">选择农场:</label>
                             <div class="layui-input-inline">
                                 <select name="city" id="farmSelect">
+                                    {% for art in art_list  %}
+                                    <option value="{{art.id}}">{{art.name}}</option>
+                                    {% endfor %}
                                 </select>
                             </div>
                         </div>
@@ -250,24 +254,26 @@
             });
 
             //园区下拉列表数据渲染
-            gedataA('park_land')
+            // gedataA('park_land')
+            gedataA('repertory_view')
             function gedataA(url) {
+                console.log(url)
                 $.ajax({
-                    url: 'park_land',
+                    // url: 'park_land',
+                    url: 'repertory_view',
                     type: 'get',
                     data: {
 
                     },
-                    dataType: 'json',
                     success: function (data) {
-                        var d = data
-                        for (var i = 0; i < d.length; i++) {
-                            var name = data[i].name
-                            var id = data[i].id
-                            var opt = "<option value='" + id + "'>" + name + "</option>"
-                            $('#farmSelect').append(opt);
-                            form.render('select'); //刷新select选择框渲染
-                        }
+                        // var d = data
+                        // for (var i = 0; i < d.length; i++) {
+                        //     var name = data[i].name
+                        //     var id = data[i].id
+                        //     var opt = "<option value='" + id + "'>" + name + "</option>"
+                        //     $('#farmSelect').append(opt);
+                        //     form.render('select'); //刷新select选择框渲染
+                        // }
 
                         //页面数据渲染
                         gedata('repertory_new', 1)
@@ -281,6 +287,8 @@
                                 },
                                 dataType: 'html',
                                 success: function (data) {
+                                    console.log(data)
+                                    console.log(111)
                                     $('#box').children('#chunk').html(data);
                                     laypage.render({
                                         elem: 'page' //注意,这里的 test1 是 ID,不用加 # 号
@@ -314,6 +322,7 @@
                     },
                     error: function (type) {
                         console.log(type)
+                        console.log('失败')
                     }
                 })
             }

+ 1 - 0
templates/backstageNet/production/sellManage.html

@@ -384,6 +384,7 @@
         }
 
         function edit(dat) {
+            console.log(dat.time)
             form.val("sellForm", {
                 "farm": dat.farm
                 , "name": dat.name

+ 157 - 2
templates/backstageNet/qxzctrl/qxzctrl.html

@@ -292,6 +292,19 @@
         .fr {
             float: right;
         }
+        /* 气象站定位弹框 */
+		#addLocation{
+			display: none;
+			padding: 20px;
+			height: 450px;
+		}
+		.mapbox{
+			height: 100%;
+		}
+		#allmap{
+			width: 100%;
+			height: 100%;
+		}
     </style>
 </head>
 
@@ -336,7 +349,11 @@
                 <div class="ctrlDiv">
                     <div class="title">
                         <div class="widget-title">
-                            <button type="button" class="layui-btn  layui-btn-normal layui-btn-sm fr" onclick="qxzDownCtrlFun()">刷新</button>
+                            <div class="fr">
+                                <button type="button" class="layui-btn  layui-btn-normal layui-btn-sm" onclick="addMapPosition()">定位</button>
+                                <button type="button" class="layui-btn  layui-btn-normal layui-btn-sm" onclick="ChangeName()">重命名</button>
+                                <button type="button" class="layui-btn  layui-btn-normal layui-btn-sm" onclick="qxzDownCtrlFun()">刷新</button>
+                            </div>
                             <h2>控制开关
                                 <span id="Uptime"></span>
                             </h2>
@@ -352,10 +369,20 @@
         </div>
     </div>
     <input type="hidden" id="qxzPhotoId">
-
+    <div id="addLocation">
+        <div class="">
+            经度:<input type="text" name="title" lay-verify="title" id="lng" placeholder="" class="layui-input" style="width: 200px;display: inline-block;">
+            纬度:<input type="text" name="title" lay-verify="title" id="lat"  placeholder="" class="layui-input" style="width: 200px;display: inline-block;">
+            <button type="button" id="shaixuan" onclick="sub_getMarker()" class="layui-btn layui-btn-normal">定位</button>			
+        </div>
+        <div class="mapbox">
+            <div id="allmap"></div>
+        </div>
+    </div>
     <script src="{% static '/lib/js/jquery-2.1.4.min.js'%}"></script>
     <script src="{% static '/lib/layui/layui.js'%}"></script>
     <script src="{% static '/js/backstageNet/common.js'%}"></script>
+	<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=TcRPmrsiZUqdUBWoELrUArRkCRC36KMx"></script>
     <script>
         var currpage = 1;
         var layer, element, form;
@@ -376,6 +403,134 @@
             })
 
         })
+         // 百度地图API功能
+         var map = new BMap.Map("allmap");
+        map.centerAndZoom(new BMap.Point(113.64964385, 34.75661006), 13);// 创建点坐标
+        map.enableScrollWheelZoom();   //启用滚轮放大缩小,默认禁用
+        map.enableContinuousZoom();    //启用地图惯性拖拽,默认禁用
+        map.addControl(new BMap.NavigationControl());               // 添加平移缩放控件
+        map.addControl(new BMap.ScaleControl());                    // 添加比例尺控件
+        map.addControl(new BMap.OverviewMapControl());              //添加缩略地图控件
+        map.enableScrollWheelZoom();                            //启用滚轮放大缩小
+        map.addControl(new BMap.MapTypeControl());
+        //单击获取点击的经纬度
+        map.addEventListener("click", function (e) {
+            map.clearOverlays();
+            $('#lng').val(e.point.lng);
+            $('#lat').val(e.point.lat);
+            var point = new BMap.Point(e.point.lng, e.point.lat);
+            var marker = new BMap.Marker(point);
+            map.addOverlay(marker);
+            // alert(e.point.lng + "," + e.point.lat);
+        });
+
+        function sub_getMarker() {
+            map.clearOverlays();
+            var points = []
+            var point = new BMap.Point($('#lng').val(), $('#lat').val());
+            var marker = new BMap.Marker(point);
+            map.addOverlay(marker);
+            points.push(point)
+            console.log(points)
+            map.setViewport(points);
+        }
+        // 添加地图定位
+        function addMapPosition(obj) {
+            id = $('.equipListUl li.active').attr('id');
+            layui.use('layer', function () { //独立版的layer无需执行这一句
+                var $ = layui.jquery, layer = layui.layer; //独立版的layer无需执行这一句
+                layer.open({
+                    title: '手动添加位置',
+                    type: 1,
+                    area: ['900px', '600px'],
+                    btn: ['确定', '取消'],
+                    yes: function (index, layero) {
+                        //按钮【按钮一】的回调
+                        if($('#lng').val() && $('#lat').val()){
+                            $.ajax({
+                                url:'equip_location',
+                                type:'post',
+                                data:{
+                                    e_id:id,
+                                    lng:$('#lng').val(),
+                                    lat:$('#lat').val(),
+                                },
+                                success:function(data){
+                                    console.log(data)
+                                    if(data == 0){
+                                        layer.closeAll();
+                                    }else{
+                                        layer.msg('添加失败', {icon: 2}); 
+                                    }
+                                },
+                                error:function(type){
+                                    console.log(type)
+                                }
+                            })
+                        }else{
+                            layer.msg('请先定位', {icon: 2}); 
+                        }
+                    
+                        return false;  
+                    }
+                    , btn2: function (index, layero) {
+                        //按钮【按钮二】的回调
+                        //return false 开启该代码可禁止点击该按钮关闭
+                    },
+                    content: $('#addLocation')
+                });
+            });
+        }
+
+        //点击修改名称,跳出弹框并显示所选设备的设备名称;
+        function ChangeName() {
+            id = $('.equipListUl li.active').attr('id');
+            layui.use('layer', function () { //独立版的layer无需执行这一句
+                var $ = layui.jquery, layer = layui.layer; //独立版的layer无需执行这一句
+                layer.prompt({ title: '修改名称', value: '', area: 400 }, function (val, index) {
+                    layer.close(index);
+                    ChangeNameSub(id, val);
+                });
+            });
+        }
+        function ChangeNameSub(deviceId, name, address) {
+                data = {
+                    ename: name,
+                    eid: deviceId
+                }
+            //校验重复校验重复
+            $.ajax({
+                type: "post",
+                url: "equip_location",
+                data: data,
+                dataType: "json",
+                success: function (data) {
+                    if (data == 1) {
+                        // layer.tips("设备名已存在!", '#ename');
+                        layui.use('layer', function () {
+                            var layer = layui.layer;
+                            layer.msg('设备名已存在!');
+                        })
+                        return false;
+                    }
+                    else if (data == 2) {
+                        layui.use('layer', function () {
+                            var layer = layui.layer;
+                            layer.msg('设备位置添加成功!');
+                            // window.location.href = window.location.href;
+                        })
+                    }
+
+                    else if (data == 0) {
+                        layui.use('layer', function () {
+                            var layer = layui.layer;
+                            layer.msg('设备名称修改成功!');
+                            // window.location.href = window.location.href;
+                        })
+                    } 
+                }
+            });
+        }
         // 首页
         function gotofirstpage() {
             currpage = 1;

+ 2 - 2
templates/backstageNet/systemSet/mapManage.html

@@ -374,8 +374,8 @@
                 swneLatLng = [];
                 overlays.push(e.overlay);
 
-                swneLatLng.push(e.overlay.zo[1])
-                swneLatLng.push(e.overlay.zo[3])
+                swneLatLng.push(e.overlay.Ao[1])
+                swneLatLng.push(e.overlay.Ao[3])
 
                 e.overlay.enableEditing();
             };

+ 2 - 0
templates/backstageNet/systemSet/user_list.html

@@ -15,7 +15,9 @@
 	<td>{{ user.date_joined }}</td>
 	<td>
 		<button class="layui-btn layui-btn-sm  btn-shaixuan" onclick="allotEquipPage('{{ user.username }}')">在线分地</button>
+		{% if user.username == 'admin' %}  {% else %}
 		<button class="layui-btn layui-btn-sm  layui-btn-warm" onclick="addUser('{{ user.id }}')">编辑</button>
+		{% endif %}
 		<button class="layui-btn layui-btn-sm layui-btn-normal btn-shaixuan" onclick="resetPwd('{{ user.username }}')">重置密码</button>
 		{% if user.username == 'admin' %}  {% else %}
 		<button class="layui-btn layui-btn-sm layui-btn-danger btn-shaixuan" onclick="deluser('{{ user.username }}')">删除</button>

+ 2 - 2
templates/backstageNet/warn/productionset.html

@@ -250,7 +250,7 @@
                             {% else %} 当前暂无设备 {% endif %}
                         </div>
                         <div class="layui-row controlInfo" id="getthresholdDiv">
-                            <div class="layui-col-xs6 layui-col-md3">
+                            <!-- <div class="layui-col-xs6 layui-col-md3">
                                 <div class="grid-demo ctrlItem">
                                     <div class="ctrlUp">
                                         <input type="hidden" value="" class="currStutas">
@@ -279,7 +279,7 @@
                                         </form>
                                     </div>
                                 </div>
-                            </div>
+                            </div> -->
 
                         </div>
                     </div>

+ 4 - 4
templates/backstageNet/warn/warnRecord.html

@@ -163,7 +163,7 @@
                 dataType:'json',
                 success:function(data){
                     console.log(data)
-                    if(data.dat){
+                    if(data.dat.length){
                         Fill_Table('datatable', data.dat, '');
                         $('.fenpei-bottom').show();
                         Fill_page(data.nums,curr);
@@ -190,9 +190,9 @@
         }
         function Fill_null_Table(table_id) {
             var html = "";
-            html += "<thead><tr><th>采集时间</th><th>风速</th><th>温度</th></tr></thead>";
-            html += "<tr><td colspan=3 style='line-height:100px'>暂无数据</td></tr>";
-            $(document.getElementById(table_id)).html(html);
+            // html += "<thead><tr><th>采集时间</th><th>风速</th><th>温度</th></tr></thead>";
+            html += "<tr><td colspan=4 style='line-height:100px'>暂无数据</td></tr>";
+            $(document.getElementById(table_id).children[1]).html(html);
             scrollBar()
         }
 

+ 8 - 16
templates/backstageNet/warn/warnSet.html

@@ -257,17 +257,9 @@
                     type: 'post',
                     success: function (data) {
                         if (data) {
-                            if (window.id !== '') {
-                                layer.msg("发布成功,等待审核", { icon: 1 });
-                            } else {
-                                layer.msg("发布成功,等待审核", { icon: 1 });
-                            }
+                            layer.msg("成功", { icon: 1 });
                         } else {
-                            if (window.id !== '') {
-                                parent.layer.msg("发布失败", { icon: 2 });
-                            } else {
-                                layer.msg("发布失败", { icon: 2 });
-                            }
+                            layer.msg("失败", { icon: 2 });
                         }
                     },
                     error: function (type) {
@@ -291,11 +283,11 @@
                     renderHtml(data);
                 },
                 error: function (type) {
-                    var data = {
-                        alarm:'{"dat":{"e8":"1#5","e2":"0#7","e3":"0#3","e4":"0#2","e5":"1#56"},"tel":"","equip_id":"16057231"}',
-                        conf: {e8: "盐分", e2: "温度#°", e3: "雨量",e4: "气压#hpa",e5: ""}
-                    }
-                    renderHtml(data);
+                    // var data = {
+                    //     alarm:'{"dat":{"e8":"1#5","e2":"0#7","e3":"0#3","e4":"0#2","e5":"1#56"},"tel":"","equip_id":"16057231"}',
+                    //     conf: {e8: "盐分", e2: "温度#°", e3: "雨量",e4: "气压#hpa",e5: ""}
+                    // }
+                    // renderHtml(data);
                 }
             })
         }
@@ -303,7 +295,7 @@
             alarm:'{"dat":{"e6":"0#","e2":"0#","e3":"0#3","e4":"0#2","e5":"1#56"},"tel":"","equip_id":"16057231"}',
             conf: {e6: "ces", e2: "", e3: "",e4: "风向#°",e5: "数字气压#hpa"}
         }
-        renderHtml(data);
+        // renderHtml(data);
         function renderHtml(data){
             var dat = eval('('+data.alarm+')').dat;
             var conf = data.conf;

+ 4 - 0
templates/outerNet/farmList.html

@@ -15,6 +15,10 @@
     <link rel="stylesheet" href="{% static '/css/module.css' %}">
     <!-- <link rel="stylesheet" href="{% static '/css/hotelList.css' %}"> -->
     <style>
+        .advImg{
+            background: url(../static/imgs/farmAdv.jpg) no-repeat center;
+            background-size: cover;
+        }
         /* 内容模块 */
         .hacienda .haciendaList{
             display: flex;

+ 23 - 67
templates/outerNet/index2.html

@@ -150,7 +150,7 @@
             <div class="yet_loginCover">
                 <div class="person">
                     <div class="userHeadImg">
-                        <img src="http://192.168.1.9:8000/{{curr_user.user_picture}}" alt="">
+                        <img src="http://127.0.0.1:8000/{{curr_user.user_picture}}" alt="">
                     </div>
                     <div class="userCtrl">
                         <div class="userCtrlTop">
@@ -220,7 +220,7 @@
                                             {% for farmItem in garden %}
                                             <li class="farm-item">
                                                 <a target="_blank" href="person_farm?name={{farmItem.user}}">
-                                                  <img src="http://192.168.1.9:8000/{{farmItem.farm_img}}" alt="">
+                                                  <img src="http://127.0.0.1:8000/{{farmItem.farm_img}}" alt="">
                                                     <div class="news-item-txt">
                                                         <div class="title">
                                                             <h1>
@@ -251,7 +251,20 @@
                             <ul class="news-txt-list">
                                 {% for news in article %}
                                 <li class="news-txt-item">
+                                    {% if news.art_type == '5' %}
                                     <a href="news_view?id={{news.id}}" target="_blank">{{news.title}}</a>
+                                    {% elif news.art_type == '6' %}
+                                    <a href="video_detail?name={{news.title}}" target="_blank">{{news.title}}</a>
+                                    {% elif news.art_type == '7' %}
+                                    <a href="equip_show_detail?name={{news.title}}" target="_blank">{{news.title}}</a>
+                                    {% elif news.art_type == '8' %}
+                                    <a href="garden_intro?name={{news.title}}" target="_blank">{{news.title}}</a>
+                                    {% elif news.art_type == '9' %}
+                                    <a href="dorm_detail?name={{news.title}}" target="_blank">{{news.title}}</a>
+                                    {% elif news.art_type == '10' %}
+                                    <a href="tourist?name={{news.title}}" target="_blank">{{news.title}}</a>
+                                    {% else %}
+                                    {% endif %} 
                                 </li>
                                 {% endfor %}
                             </ul>
@@ -392,7 +405,7 @@
                                     <li class="travelItem">
                                         <a href="tourist?id={{sightseeItem.id}}" target="_blank">
                                             <div class="travelImg">
-                                                <img class="haciendaImg1" src="http://192.168.1.9:8000/{{sightseeItem.sightisee_img}}" alt="">
+                                                <img class="haciendaImg1" src="http://127.0.0.1:8000/{{sightseeItem.sightisee_img}}" alt="">
                                                 <img class="haciendaImg2" src="{% static 'imgs/22.png'%}" alt="">
                                             </div>
                                             <div class="travelTitle">
@@ -467,7 +480,7 @@
                                 {% for hotelItem in hotel2 %}
                                 <li class="hotHotelItem">
                                     <a href="dorm_detail?id={{hotelItem.id}}" target="_blank">
-                                        <img src="http://192.168.1.9:8000/{{hotelItem.hotel_img}}" width="96px" height="80px" alt="">
+                                        <img src="http://127.0.0.1:8000/{{hotelItem.hotel_img}}" width="96px" height="80px" alt="">
                                         <div class="desc">
                                             <h3>{{hotelItem.name}}</h3>
                                             <div>{{hotelItem.intro}}</div>
@@ -490,7 +503,7 @@
                                     <a href="dorm_detail?id={{hotelItem.id}}" target="_blank">
                                         <div style="height: 300px;">
                                             <div class="recommendHotelImg">
-                                                <img src="http://192.168.1.9:8000/{{hotelItem.hotel_img}}" alt="">
+                                                <img src="http://127.0.0.1:8000/{{hotelItem.hotel_img}}" alt="">
                                             </div>
                                             <h1>{{hotelItem.name}}</h1>
                                             <div class="area">{{hotelItem.intro}}</div>
@@ -522,71 +535,14 @@
                 </div>
                 <div class="partnerInner">
                     <ul class="partnerInnerList">
+                        {% for relationItem in relation %}
                         <li class="partnerInnerItem">
-                            <a href="">
-                                <img src="http://www.xbxxnyggw.cn/file/upload/201901/22/230441831.jpg" alt="">        
-                            </a>
-                        </li>
-                        <li class="partnerInnerItem">
-                            <a href="">
-                                <img src="http://www.xbxxnyggw.cn/file/upload/201901/22/230441831.jpg" alt="">        
-                            </a>
-                        </li>
-                        <li class="partnerInnerItem">
-                            <a href="">
-                                <img src="http://www.xbxxnyggw.cn/file/upload/201901/22/230441831.jpg" alt="">        
-                            </a>
-                        </li>
-                        <li class="partnerInnerItem">
-                            <a href="">
-                                <img src="http://www.xbxxnyggw.cn/file/upload/201901/22/230441831.jpg" alt="">        
-                            </a>
-                        </li>
-                        <li class="partnerInnerItem">
-                            <a href="">
-                                <img src="http://www.xbxxnyggw.cn/file/upload/201901/22/230441831.jpg" alt="">        
-                            </a>
-                        </li>
-                        <li class="partnerInnerItem">
-                            <a href="">
-                                <img src="http://www.xbxxnyggw.cn/file/upload/201901/22/230441831.jpg" alt="">        
-                            </a>
-                        </li>
-                        <li class="partnerInnerItem">
-                            <a href="">
-                                <img src="http://www.xbxxnyggw.cn/file/upload/201901/22/230441831.jpg" alt="">        
-                            </a>
-                        </li>
-                        <li class="partnerInnerItem">
-                            <a href="">
-                                <img src="http://www.xbxxnyggw.cn/file/upload/201901/22/230441831.jpg" alt="">        
-                            </a>
-                        </li>
-                        <li class="partnerInnerItem">
-                            <a href="">
-                                <img src="http://www.xbxxnyggw.cn/file/upload/201901/22/230441831.jpg" alt="">        
-                            </a>
-                        </li>
-                        <li class="partnerInnerItem">
-                            <a href="">
-                                <img src="http://www.xbxxnyggw.cn/file/upload/201901/22/230441831.jpg" alt="">        
-                            </a>
-                        </li>
-                        <li class="partnerInnerItem">
-                            <a href="">
-                                <img src="http://www.xbxxnyggw.cn/file/upload/201901/22/230441831.jpg" alt="">        
-                            </a>
-                        </li>
-                        <li class="partnerInnerItem">
-                            <a href="">
-                                <img src="http://www.xbxxnyggw.cn/file/upload/201901/22/230441831.jpg" alt="">        
-                            </a>
-                        </li>
-                        <li class="partnerInnerItem">
-                            <a href="">
-                                <img src="http://www.xbxxnyggw.cn/file/upload/201901/22/230441831.jpg" alt="">        
+                            <a target="_blank" href="{{relationItem.relation}}">
+                                <img src="http://127.0.0.1:8000{{relationItem.pic}}" alt="">        
                             </a>
                         </li>
+                        {% endfor %}
+                        
                         <li style="clear: both;"></li>
                     </ul>
                 </div>

+ 2 - 2
templates/outerNet/tourist.html

@@ -68,7 +68,7 @@
                         <div class="sendTime title">{{sightsee.upl_time}}</div>
                         <div class="prodectIntro">
                             <div class="prodectImg">
-                                <img src="http://192.168.1.9:8000/{{sightsee.sightisee_img }}" alt="">
+                                <img src="http://127.0.0.1:8000/{{sightsee.sightisee_img }}" alt="">
                             </div>
                             <div class="descTxt">
                                 <div><span>景点名称:</span>{{sightsee.name}}</div>
@@ -84,7 +84,7 @@
                             <div>{{sightsee.content|safe}}</div>
                             <div class="descTitle">景区导览图</div>
                             <div>
-                                <img src="http://192.168.1.9:8000/{{sightsee.sightisee_img }}" width="100%" alt="">
+                                <img src="http://127.0.0.1:8000/{{sightsee.sightisee_img }}" width="100%" alt="">
                             </div>
                         </div>
                     </div>

+ 6 - 0
templates/outerNet/touristList.html

@@ -13,6 +13,12 @@
     <link rel="stylesheet" href="{% static '/css/common.css' %}">
     <link rel="stylesheet" href="{% static '/css/module.css' %}">
     <link rel="stylesheet" href="{% static '/css/hotelList.css' %}">
+    <style>
+        .advImg{
+            background: url(../static/imgs/scenicAdv.jpg) no-repeat center;
+            background-size: cover;
+        }
+    </style>
 </head>
 
 <body>

+ 4 - 0
templates/static/css/index2.css

@@ -450,6 +450,7 @@ span.swiper-pagination-bullet-active{
 .travelList .travelItem .travelTitle div{
     height: 40px;
     overflow: hidden;
+    font-size: 14px;
 }
 .travelCover .travelRight{
     width: 280px;
@@ -609,6 +610,9 @@ span.swiper-pagination-bullet-active{
     padding: 0 20px;
     font-size: 14px;
     font-weight: 700;
+    white-space: nowrap;
+    overflow: hidden;
+    text-overflow: ellipsis;
 }
 .recommendHotelItem .area{
     line-height: 14px;

+ 3 - 0
templates/static/css/videoList.css

@@ -26,6 +26,9 @@
     font-size: 16px;
     line-height: 34px;
     font-weight: 700;
+    white-space: nowrap;
+    overflow: hidden;
+    text-overflow: ellipsis;
 }
 .videoMsg >div{
     width: 80%;

BIN=BIN
templates/static/imgs/jkedit.png


+ 3 - 1
templates/static/js/index2.js

@@ -9,6 +9,9 @@ $(function () {
         },
     })
 
+    $('.searchBoxBj button').on('click',function(){
+        window.open('farm_list?page=1&condition='+$('.searchBoxBj input').val())
+    })
  
 
      // 轮播
@@ -155,7 +158,6 @@ $(function () {
 // 定位
 function city_change(obj){
     var txt = $(obj).html();
-    alert(txt)
     $('.currCity span').html(txt);
 }