From 02987f39aeb612b5e24b34ea7accc3460477298e Mon Sep 17 00:00:00 2001 From: caoqianming Date: Wed, 25 Dec 2019 17:04:44 +0800 Subject: [PATCH 01/12] button control part1 --- safesite/templates/drill.html | 33 +++++++++++++++++--------- safesite/templates/edulessonindex.html | 33 +++++++++++++++++--------- safesite/templates/equipment.html | 28 +++++++++++++++++++++- safesite/templates/examtest.html | 17 ++++++++++--- safesite/templates/inspect.html | 20 ++++++++++------ safesite/templates/miss.html | 26 +++++++++++++------- safesite/templates/notice.html | 26 +++++++++++++------- safesite/templates/observe.html | 33 ++++++++++++++++---------- safesite/templates/operation.html | 11 +++++++++ safesite/templates/risk.html | 15 ++++++++++++ safesite/templates/suggest.html | 29 ++++++++++++++-------- safesite/templates/task.html | 3 +++ safesite/templates/train.html | 32 ++++++++++++++++--------- 13 files changed, 224 insertions(+), 82 deletions(-) diff --git a/safesite/templates/drill.html b/safesite/templates/drill.html index 26aa7356..ce8b9222 100644 --- a/safesite/templates/drill.html +++ b/safesite/templates/drill.html @@ -1,16 +1,7 @@
-
-
+ -
+
详细筛选 +
+
+ {% load myfilter %} + {% if request|has_permission:'b_drill_add' %} + 新增 + {% endif %} + 评估 + + {% if request|has_permission:'b_drill_del' %} + 删除 + {% endif %} + {% if request|has_permission:'b_drill_detail' %} + 查看详情 + {% endif %} + {% if request|has_permission:'b_drill_exportdoc' %} + 导出Word + {% endif %} + {% if request|has_permission:'b_drill_exportxls' %} + 导出Excel + {% endif %}
diff --git a/safesite/templates/edulessonindex.html b/safesite/templates/edulessonindex.html index 27bf0401..0ee05fd9 100644 --- a/safesite/templates/edulessonindex.html +++ b/safesite/templates/edulessonindex.html @@ -1,16 +1,7 @@ -
-
- 上传视频 - 上传文件 - 删除文件 + -
+
+
+
+ {% load myfilter %} + {% if request|has_permission:'b_edu_addvideo' %} + 上传视频 + {% endif %} + {% if request|has_permission:'b_edu_addfile' %} + 上传文件 + {% endif %} + {% if request|has_permission:'b_edu_del' %} + 删除文件 + {% endif %} + {% if request|has_permission:'b_edu_study' %} + 点击学习 + {% endif %} + {% if request|has_permission:'b_edu_detail' %} + 观看历史 + {% endif %} + +
diff --git a/safesite/templates/equipment.html b/safesite/templates/equipment.html index ca770a8f..d784c15f 100644 --- a/safesite/templates/equipment.html +++ b/safesite/templates/equipment.html @@ -6,14 +6,22 @@
+ {% load myfilter %} + {% if request|has_permission:'b_equipment_add' %} 新增设备 + + {% endif %} + {% if request|has_permission:'b_equipment_import' %} 导入设备 + {% endif %} + {% if request|has_permission:'b_equipment_del' %} 删除 + {% endif %}
@@ -29,7 +37,12 @@ 查询 + {% if request|has_permission:'b_equipment_exportxls' %} 导出Excel + {% endif %} + {% if request|has_permission:'b_equipment_change' %} + + {% endif %}
@@ -76,7 +89,9 @@ style="height:100px;width:90%" data-options="multiline:true" /> - 保存 + + 保存 + @@ -99,6 +114,11 @@
查询 diff --git a/safesite/templates/zuoyepeizhi.html b/safesite/templates/zuoyepeizhi.html index 3f1042a4..531ec1bf 100644 --- a/safesite/templates/zuoyepeizhi.html +++ b/safesite/templates/zuoyepeizhi.html @@ -6,15 +6,31 @@
+ + {% load myfilter %} + {% if request|has_permission:'b_zuoyepeizhi_risk_add' %} 新增 - 删除 + {% endif %} + {% if request|has_permission:'b_zuoyepeizhi_risk_del' %} + 删除 + {% endif %} + + + +
+ {% if request|has_permission:'b_zuoyepeizhi_shenpi_add' %} 新增 - 删除 + {% endif %} + {% if request|has_permission:'b_zuoyepeizhi_shenpi_del' %} + 删除 + {% endif %} + +
diff --git a/safesite/urls.py b/safesite/urls.py index 9359a89c..5f678d62 100644 --- a/safesite/urls.py +++ b/safesite/urls.py @@ -184,8 +184,6 @@ urlpatterns = [ path('api/getresbilitydata',views.getresbilitydata),#责任制 path('api/getprodata',views.getprodata),#操作规程 path('boUR15vyNu.txt',views.minip_px), - - #合作模块 path('edu/',include('safesite.edu.urls')), path('datashow/',datashowview.area, name='datashow'), From fd54a366f9e26c157f3f33d3cb581ba6ca221b2f Mon Sep 17 00:00:00 2001 From: caoqianming Date: Wed, 25 Dec 2019 21:43:21 +0800 Subject: [PATCH 04/12] menu button complete admin --- safesite/views.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/safesite/views.py b/safesite/views.py index ec66a61e..7b85c884 100644 --- a/safesite/views.py +++ b/safesite/views.py @@ -519,10 +519,13 @@ def checkpw(data): #密码复杂度校验 def init_permission(user,req): permission_dict = {} - bgroups = user.userg.all() #所属用户组 x = [] - for i in bgroups: - x.extend(i.menulist) + if user.issuper==1: + x = Group.objects.filter(grouptype=0,usecomp=user.usecomp)[0].menulist + else: + bgroups = user.userg.all() #所属用户组 + for i in bgroups: + x.extend(i.menulist) menus = Menu.objects.exclude(menuid__in=[11, 9]).filter(menuid__in=list(set(x)), deletemark=1) for item in menus: permission_dict[item.menucode] = ({ From dabf935a79dcaf6bf0801cb6bb76e64d0c9acd33 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Fri, 27 Dec 2019 01:26:49 +0800 Subject: [PATCH 05/12] datashow operation --- safesite/static/safesite/mystatic/js/util.js | 2 +- safesite/static/safesite/mystatic/js/util2.js | 507 +----------------- safesite/templates/datashow.html | 16 +- safesite/views.py | 7 +- 4 files changed, 18 insertions(+), 514 deletions(-) diff --git a/safesite/static/safesite/mystatic/js/util.js b/safesite/static/safesite/mystatic/js/util.js index 28bcd191..1ddb20c6 100644 --- a/safesite/static/safesite/mystatic/js/util.js +++ b/safesite/static/safesite/mystatic/js/util.js @@ -577,7 +577,6 @@ function update() { } }) $.get('api/mapshow?a=operation', function (res) { - console.log(res) for (let i = 0, len = res.length; i < len; i++) { var data = res[i] data.id = data.zyqy__id @@ -585,6 +584,7 @@ function update() { data.polygon = data.zyqy__polygon data.name = data.zyqy__name data.type = 'zy' + data.list = data.zylist setPoint(data) } }) diff --git a/safesite/static/safesite/mystatic/js/util2.js b/safesite/static/safesite/mystatic/js/util2.js index 748f203f..aaab891d 100644 --- a/safesite/static/safesite/mystatic/js/util2.js +++ b/safesite/static/safesite/mystatic/js/util2.js @@ -1,508 +1,4 @@ -function photoCompress(file, w, objDiv) { - var ready = new FileReader(); - /*开始读取指定的Blob对象或File对象中的内容. 当读取操作完成时,readyState属性的值会成为DONE,如果设置了onloadend事件处理程序,则调用之.同时,result属性中将包含一个data: URL格式的字符串以表示所读取文件的内容.*/ - ready.readAsDataURL(file); - ready.onload = function () { - var re = this.result; - canvasDataURL(re, w, objDiv) - } -} -function canvasDataURL(path, obj, callback) { - var img = new Image(); - img.src = path; - img.onload = function () { - var that = this; - // 默认按比例压缩 - var w = that.width, - h = that.height, - scale = w / h; - w = obj.width || w; - h = obj.height || (w / scale); - var quality = 0.7; // 默认图片质量为0.7 - //生成canvas - var canvas = document.createElement('canvas'); - var ctx = canvas.getContext('2d'); - // 创建属性节点 - var anw = document.createAttribute("width"); - anw.nodeValue = w; - var anh = document.createAttribute("height"); - anh.nodeValue = h; - canvas.setAttributeNode(anw); - canvas.setAttributeNode(anh); - ctx.drawImage(that, 0, 0, w, h); - // 图像质量 - if (obj.quality && obj.quality <= 1 && obj.quality > 0) { - quality = obj.quality; - } - // quality值越小,所绘制出的图像越模糊 - var base64 = canvas.toDataURL('image/jpeg', quality); - // 回调函数返回base64的值 - callback(base64); - } -} -function convertBase64UrlToBlob(urlData) { - var arr = urlData.split(','), mime = arr[0].match(/:(.*?);/)[1], - bstr = atob(arr[1]), n = bstr.length, u8arr = new Uint8Array(n); - while (n--) { - u8arr[n] = bstr.charCodeAt(n); - } - return new Blob([u8arr], { type: mime }); -} - -//取消上传 -function cancleUploadFile() { - - xhr.abort(); -} - -//验证表单不为空 -function myCheck(checkarray) { - for (var i = 0; i < checkarray.length; i++) { - if (checkarray[i] == "") { - return false; - } - } - return true; -} -//获取当前href的参数==当前dialog的地址 -function GetQueryString(name) { - var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); - var href = $('#dd').dialog('options')['href'] - var r = href.split('?')[1].match(reg); - if (r != null) return unescape(r[2]); return null; -} - -function GetQueryString2(name) { - var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); - var href = $('#userdd').dialog('options')['href'] - var r = href.split('?')[1].match(reg); - if (r != null) return unescape(r[2]); return null; -} - -//放大和缩小图片 -function bigger(o) { - var h = $(document).height() - var mh = h * 0.8 - $this = $(o); - var img_content = $this.attr("src"); - top.$("body").append( - "
" - + "
" - + "" - + "
" - ); - top.$(".bg-img").animate({ - width: "100%", - height: "100%", - bottom: "0", - left: "0", - }, "normal") - $('.bg-img').on("click", function () { - $(this).remove(); - }) -} - - - - -//加载menutree列表 -function convertmenu(rows) { - function exists(rows, parentid) { - for (var i = 0; i < rows.length; i++) { - if (rows[i].menuid == parentid) return true; - } - return false; - } - - var nodes = []; - // get the top level nodes - for (var i = 0; i < rows.length; i++) { - var row = rows[i]; - if (!exists(rows, row.parentid)) { - nodes.push({ - id: row.menuid, - text: row.menuname, - checked: row.checked, - iconCls: row.icon, - attributes: row.url - }); - } - } - - var toDo = []; - for (var i = 0; i < nodes.length; i++) { - toDo.push(nodes[i]); - } - while (toDo.length) { - var node = toDo.shift(); // the parent node - // get the children nodes - for (var i = 0; i < rows.length; i++) { - var row = rows[i]; - if (row.parentid == node.id) { - var child = { id: row.menuid, text: row.menuname, attributes: row.url, iconCls: row.icon, checked: row.checked }; - if (node.children) { - node.children.push(child); - } else { - node.children = [child]; - } - toDo.push(child); - } - } - } - return nodes; -} - -//datagrid加载tree列表 -function convert(rows, x) { - var x = x || 'open'; - function exists(rows, parentId) { - for (var i = 0; i < rows.length; i++) { - if (rows[i].id == parentId) return true; - } - return false; - } - - var nodes = []; - // get the top level nodes - for (var i = 0; i < rows.length; i++) { - var row = rows[i]; - if (!exists(rows, row.parentId)) { - nodes.push({ - id: row.id, - text: row.name, - state: x, - pic: row.pic - }); - } - } - - var toDo = []; - for (var i = 0; i < nodes.length; i++) { - toDo.push(nodes[i]); - } - while (toDo.length) { - var node = toDo.shift(); // the parent node - // get the children nodes - for (var i = 0; i < rows.length; i++) { - var row = rows[i]; - if (row.parentId == node.id) { - var child = { id: row.id, text: row.name, pic: row.pic }; - if (node.children) { - node.children.push(child); - } else { - node.children = [child]; - } - toDo.push(child); - } - } - } - return nodes; -} -//关闭dialog-dd -function closeForm() { - $("#dd").dialog("close"); -} -//关闭dialog-userdd -function closed2Form() { - $('#userdd').dialog("close"); -} -//关闭dialog-userdd -function close3Form() { - $('#questiondd').dialog("close"); -} -//新建iframe -function createFrame(url) { - var s = ''; - return s; -} - -//移除上传的文件或图片或列表 -function removep(o) { - $(o).closest('li').remove(); -} - -//判断是否为数字 -function isNumber(val) { - - var regPos = /^\d+(\.\d+)?$/; //非负浮点数 - //var regNeg = /^(-(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*)))$/; //负浮点数 - if (regPos.test(val)) { - return true; - } else { - return false; - } - -} -//判断是否为整数 -function isIntNum(val) { - var regPos = /^\d+$/; // 非负整数 - //var regNeg = /^\-[1-9][0-9]*$/; // 负整数 - if (regPos.test(val)) { - return true; - } else { - return false; - } -} -// function opendialog(o){ -// _clickTab = $(o).attr('url'); -// _value = $(o).text(); -// if (window.screen) { -// var myh = screen.availHeight * 0.7; -// $("#dd").dialog({ -// maximizable: true, -// title: _value, -// width: 600, -// height: myh, -// closed: false, -// cache: false, -// href: _clickTab, -// modal: true, -// border:false, -// }); -// $("#dd").window('center'); -// } -// } -function changehref(o) { - - _clickTab = $(o).attr('url');// 找到链接a中的targer的值 - - _value = $(o).attr('value'); - - $("#main").attr('value', _value); - $("#main").panel({ href: _clickTab, title: $(o).attr('title') }); - // $.ajax({ - // type: "get", - // url: _clickTab, - // async: false, - // success: function (data) { - // $("#main").attr('value',_value); - // $("#main").html(data); - // } - // }); -} -//获取dialog-dd传值 -function getQueryParam(name) { - var obj = $('#dd').dialog('options'); - var queryParams = obj["queryParams"]; - - return queryParams[name]; -} - -//部分页面操作函数 -//新增隐患 -function edityh(troubleid) { - if (window.screen) { - var myh = screen.availHeight * 0.7; - var url = 'addtrouble?a=edityh&troubleid=' + troubleid - $("#dd").dialog({ - maximizable: true, - title: '新增隐患', - width: 600, - height: myh, - closed: false, - cache: false, - href: url, - modal: true, - border: false, - }); - $("#dd").window('center'); - } -} - -function choseusers(x) { - var x = x || 'participant'; - var myh = screen.availHeight * 0.7; - $('#userdd').dialog({ - maximizable: true, - title: '选择人员', - width: 900, - height: myh, - closed: false, - cache: false, - href: 'getusersf?a=' + x, - modal: true, - border: false, - }); - $('#userdd').window('center'); -} -//导出excel -function JSONToCSVConvertor(JSONData, ReportTitle, ShowLabel) { - //If JSONData is not an object then JSON.parse will parse the JSON string in an Object - var arrData = typeof JSONData != 'object' ? JSON.parse(JSONData) - : JSONData; - var CSV = ''; - //Set Report title in first row or line - CSV += ReportTitle + '\r\n\n'; - //This condition will generate the Label/Header - if (ShowLabel) { - var row = ""; - //This loop will extract the label from 1st index of on array - for (var index in arrData[0]) { - //Now convert each value to string and comma-seprated - row += index + ','; - } - row = row.slice(0, -1); - //append Label row with line break - CSV += row + '\r\n'; - } - //1st loop is to extract each row - for (var i = 0; i < arrData.length; i++) { - var row = ""; - //2nd loop will extract each column and convert it in string comma-seprated - for (var index in arrData[i]) { - row += '"' + arrData[i][index] + '",'; - } - row.slice(0, row.length - 1); - //add a line break after each row - CSV += row + '\r\n'; - } - if (CSV == '') { - alert("Invalid data"); - return; - } - //Generate a file name - var fileName = "MyReport_"; - //this will remove the blank-spaces from the title and replace it with an underscore - fileName += ReportTitle.replace(/ /g, "_"); - //Initialize file format you want csv or xls - var uri = 'data:text/csv;charset=utf-8,' + encodeURI(CSV); - // Now the little tricky part. - // you can use either>> window.open(uri); - // but this will not work in some browsers - // or you will not get the correct file extension - //this trick will generate a temp tag - var link = document.createElement("a"); - link.href = uri; - //set the visibility hidden so it will not effect on your web-layout - link.style = "visibility:hidden"; - link.download = fileName + ".csv"; - //this part will append the anchor tag and remove it after automatic click - document.body.appendChild(link); - link.click(); - document.body.removeChild(link); -} -//loading效果 -function loading(msg) { - var msg = msg || '请稍等。。'; - $('body').loading({ - loadingWidth: 220, - title: msg, - titleColor: '#fff', - discColor: '#EDEEE9', - discription: '', - direction: 'column', - type: 'origin', - originBg: '#ECCFBB', - originDivWidth: 40, - originDivHeight: 40, - originWidth: 6, - originHeight: 6, - smallLoading: false, - loadingBg: 'rgba(56,43,14,0.8)', - loadingMaskBg: 'rgba(66,66,66,0.2)' - }); -} -//js判断为空 - - - -function isEmpty(obj) { - // 检验 undefined 和 null - if (!obj && obj !== 0 && obj !== '') { return true; } - if (Array.prototype.isPrototypeOf(obj) && obj.length === 0) { return true; } - if (Object.prototype.isPrototypeOf(obj) && Object.keys(obj).length === 0) { return true; } - return false; -} -function openlayer(title, href, w) { - var w = w || 600; - if (window.screen) { - var myh = screen.availHeight * 0.7; - $.get(href, function (res) { - layer.open({ - type: 1, - content: res, - title: title, - area: [w, myh] - }); - }) - } -} -//打开dd-dialog -function opendg(title, href, w) { - var w = w || 600; - if (window.screen) { - var myh = screen.availHeight * 0.7; - $("#dd").dialog({ - title: title, - width: w, - height: myh, - closed: false, - cache: false, - href: href, - modal: true, - border: false, - }).dialog('center'); - } -} - -function opendg2(title, href) { - if (window.screen) { - var myh = screen.availHeight * 0.8; - var myW = screen.availWidth * 0.7; - $("#questiondd").dialog({ - title: title, - width: myW, - height: myh, - closed: false, - cache: false, - href: href, - modal: true, - border: false, - }).dialog('center'); - } -} -/** - * 使用indexOf判断元素是否存在于数组中 - * @param {Object} arr 数组 - * @param {Object} value 元素值 - */ -function isInArray(arr, value) { - if (arr.indexOf && typeof (arr.indexOf) == 'function') { - var index = arr.indexOf(value); - if (index >= 0) { - return true; - } - } - return false; -} -function parseParams(data) { - try { - var tempArr = []; - for (var i in data) { - var key = encodeURIComponent(i); - var value = encodeURIComponent(data[i]); - tempArr.push(key + '=' + value); - } - var urlParamsStr = tempArr.join('&'); - return urlParamsStr; - } catch (err) { - return ''; - } -} -//排序 -function jsonSort(jsonObj) { - let arr = []; - for (var key in jsonObj) { - arr.push(key) - } - arr.sort(); - let str = ''; - for (var i in arr) { - str += arr[i] + "=" + jsonObj[arr[i]] + "&" - } - return str.substr(0, str.length - 1) -} -//map定时显示,每分钟请求一次 +//map定时显示,每分钟请求一次 function update() { if ($('#mapshowinput').length) { source.clear() @@ -542,6 +38,7 @@ function update() { data.polygon = data.zyqy__polygon data.name = data.zyqy__name data.type = 'zy' + data.list = data.zylist setPoint(data) } }) diff --git a/safesite/templates/datashow.html b/safesite/templates/datashow.html index 29cfc4dc..d1670b48 100644 --- a/safesite/templates/datashow.html +++ b/safesite/templates/datashow.html @@ -2,7 +2,7 @@ - + 数据大屏 @@ -341,7 +341,7 @@ //设置弹出框的容器 element: container, //是否自动平移,即假如标记在屏幕边缘,弹出时自动平移地图使弹出框完全可见 - autoPan: true + autoPan: false }); $.get('../api/map?a=default', function (res) { $('#map').empty() @@ -391,7 +391,7 @@ if (feature) { var data = feature.getProperties() //设置弹出框内容,可以HTML自定义 - var html = "

" + data.name + "

" + var html = "

" + data.name + "

" if (data.type == 'yh') { html = html + "

事故隐患数量:" + data.num.toString() + "

" } @@ -400,6 +400,9 @@ } else if (data.type == 'zy') { html = html + "

危险作业数量:" + data.num.toString() + "

" + for(let i=0;i"+(i+1).toString()+":"+ data.list[i].zylx__dickeyname + "--" +data.list[i].zybm__partname + "--" + data.list[i].zyfzr__name +"--作业人数"+data.list[i].num.toString()+ "

" + } } else if (data.type == 'fx') { html = html + "

风险等级:" + data.risklevel + "

" @@ -471,14 +474,14 @@ var data = feature.getProperties() if (data.type == 'yh') { src = '/static/safesite/mystatic/images/mapyh.png' - anchor = [0.5, 50] + anchor = [0.9, 50] } else if (data.type == 'ws') { src = '/static/safesite/mystatic/images/mapws.png' anchor = [0.1, 50] } else if (data.type == 'zy') { src = '/static/safesite/mystatic/images/mapzy.png' - anchor = [0.9, 50] + anchor = [0.5, 50] } else { src = '/static/safesite/mystatic/images/icon1.png' @@ -518,7 +521,8 @@ id: i.id, name: i.name, type: i.type, - num: i.num + num: i.num, + list:i.list }); pointFeature.setStyle(createPointStyle(pointFeature)); source.addFeature(pointFeature) diff --git a/safesite/views.py b/safesite/views.py index 7b85c884..2f9ec615 100644 --- a/safesite/views.py +++ b/safesite/views.py @@ -6194,9 +6194,12 @@ def apimapshow(req): elif a == 'operation': objs = Operation.objects.filter(usecomp__partid=companyid, deletemark=1).exclude( zyqy=None).exclude(zyzt__zyzt='已关闭') - objs = objs.values('zyqy__id', 'zyqy__name', + objs1 = objs.values('zyqy__id', 'zyqy__name', 'zyqy__polygon').annotate(num=Count('zyqy')) - return HttpResponse(json.dumps(list(objs)), content_type="application/json") + for i in objs1: + i['zylist'] = list(objs.filter(zyqy__id=i['zyqy__id']).values('zyid','zylx__dickeyname','zyfzr__name', + 'zybm__partname').annotate(num=Count('zyry'))) + return HttpResponse(json.dumps(list(objs1)), content_type="application/json") elif a == 'all': date1 = datetime.now() - timedelta(days=30) yh = Trouble.objects.filter(usecomp__partid=companyid, deletemark=1).exclude(yhzt=6).exclude(yhqy=None).exclude( From 67932f2f2ea00f97ebe2a43de3e736a38d57fefc Mon Sep 17 00:00:00 2001 From: caoqianming Date: Fri, 27 Dec 2019 10:17:21 +0800 Subject: [PATCH 06/12] datashow2 operation guangling --- safesite/static/safesite/mystatic/js/util2.js | 10 +- safesite/templates/datashow2.html | 395 ++++++++++++++++++ safesite/templates/index.html | 2 + safesite/urls.py | 1 + safesite/views.py | 14 + 5 files changed, 417 insertions(+), 5 deletions(-) create mode 100644 safesite/templates/datashow2.html diff --git a/safesite/static/safesite/mystatic/js/util2.js b/safesite/static/safesite/mystatic/js/util2.js index aaab891d..886c4956 100644 --- a/safesite/static/safesite/mystatic/js/util2.js +++ b/safesite/static/safesite/mystatic/js/util2.js @@ -2,12 +2,12 @@ function update() { if ($('#mapshowinput').length) { source.clear() - $.get('../api/mapshow?a=risk', function (res) { + $.get('/api/mapshow?a=risk', function (res) { for (let i = 0, len = res.length; i < len; i++) { setPolygon(res[i]) } }) - $.get('../api/mapshow?a=trouble', function (res) { + $.get('/api/mapshow?a=trouble', function (res) { for (let i = 0, len = res.length; i < len; i++) { var data = res[i] data.id = data.yhqy__id @@ -18,7 +18,7 @@ function update() { setPoint(data) } }) - $.get('../api/mapshow?a=miss', function (res) { + $.get('/api/mapshow?a=miss', function (res) { for (let i = 0, len = res.length; i < len; i++) { var data = res[i] data.id = data.missqy__id @@ -29,7 +29,7 @@ function update() { setPoint(data) } }) - $.get('../api/mapshow?a=operation', function (res) { + $.get('/api/mapshow?a=operation', function (res) { console.log(res) for (let i = 0, len = res.length; i < len; i++) { var data = res[i] @@ -44,4 +44,4 @@ function update() { }) } } -var t1 = window.setInterval(update, 1000 * 60) \ No newline at end of file +var t1 = window.setInterval(update, 1000 * 60 * 5) \ No newline at end of file diff --git a/safesite/templates/datashow2.html b/safesite/templates/datashow2.html new file mode 100644 index 00000000..4da6bbdc --- /dev/null +++ b/safesite/templates/datashow2.html @@ -0,0 +1,395 @@ + + + + + + + 数据大屏 + + + + + + + + + + + +
+ 企业安全数据显示大屏 + +
+
+
+ +
+
+ +
+ + + + + + + + + + + + + + + + +
危险作业列表
作业编号作业类型作业区域作业部门作业负责人作业人数开始时间
+
+ +
+ + + + + + + + + + + + + +
排名地市销售收入(万元)同比(%)环比(%)销售计划(万元)计划完成率(%)
+
+
+
+
+ +
+ + + + + + \ No newline at end of file diff --git a/safesite/templates/index.html b/safesite/templates/index.html index a955e065..7ac73928 100644 --- a/safesite/templates/index.html +++ b/safesite/templates/index.html @@ -99,6 +99,8 @@ style="display:none;color: #eee5e7;cursor: pointer;" onclick="setup()">预警设置 数据大屏 + 数据大屏2
diff --git a/safesite/urls.py b/safesite/urls.py index 5f678d62..273aeab4 100644 --- a/safesite/urls.py +++ b/safesite/urls.py @@ -99,6 +99,7 @@ urlpatterns = [ path('html/operproce',views.operproce),#操作规程 path('html/addoperproce',views.addoperproce), path('html/operproce/detail//',views.operprocedetail),#责任制度观看详情 + path('html/datashow2/',views.datashow2), #html页面 diff --git a/safesite/views.py b/safesite/views.py index 2f9ec615..9e53fe8d 100644 --- a/safesite/views.py +++ b/safesite/views.py @@ -490,6 +490,12 @@ def addoperproce(req):#责任制 def operprocedetail(req, id): return render(req, 'operprocedetail.html', {'id': id}) +def datashow2(req): + return render(req,'datashow2.html') + + + + def mainhtml(req): # 计算一些数据 userid = req.session['userid'] @@ -5079,6 +5085,14 @@ def apioperation(req): a = a[startnum:endnum].values('zyid', 'zylx__dickeyname', 'zynum', 'zyfzr__name', 'zynr', 'zyzt', 'submittime', 'todouser__name','zyqy__name') return HttpResponse(transjson(total, a), content_type="application/json") + elif a == 'liston': + userid = req.session['userid'] + usecomp = User.objects.get(userid=userid).usecomp + objs = Operation.objects.filter( + usecomp=usecomp, deletemark=1).exclude(zyzt__zyzt='已关闭') + total = objs.count() + objs = objs.values('zyid', 'zylx__dickeyname', 'zynum','zyfzr__name', 'zynr','zyqy__name','zyqy__id','zybm__partname','kssj').annotate(num=Count('zyry')) + return HttpResponse(transjson(total, objs), content_type="application/json") elif a == 'exportexcel': userid = req.session['userid'] usecomp = User.objects.get(userid=userid).usecomp From 81ac2080039a61cf92bbd0c7c9f74ae498463781 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Fri, 27 Dec 2019 10:35:37 +0800 Subject: [PATCH 07/12] index datashow2 --- safesite/templates/datashow2.html | 2 +- safesite/templates/index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/safesite/templates/datashow2.html b/safesite/templates/datashow2.html index 4da6bbdc..2496d110 100644 --- a/safesite/templates/datashow2.html +++ b/safesite/templates/datashow2.html @@ -364,7 +364,7 @@ $('.tbl-body tbody').html($('.tbl-body tbody').html() + $('.tbl-body tbody').html()); $('.tbl-body').css('top', '0'); var tblTop = 0; - var speedhq = 100; // 数值越大越慢 + var speedhq = 80; // 数值越大越慢 var outerHeight = $('.tbl-body tbody').find("tr").outerHeight(); function Marqueehq() { if (tblTop <= -outerHeight * Items.length) { diff --git a/safesite/templates/index.html b/safesite/templates/index.html index 7ac73928..9c801b41 100644 --- a/safesite/templates/index.html +++ b/safesite/templates/index.html @@ -88,7 +88,7 @@ {{ user.username }} 欢迎您!
-
+
安全退出 Date: Fri, 27 Dec 2019 14:15:43 +0800 Subject: [PATCH 08/12] datashow2 meihua --- safesite/templates/datashow2.html | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/safesite/templates/datashow2.html b/safesite/templates/datashow2.html index 2496d110..9e468d14 100644 --- a/safesite/templates/datashow2.html +++ b/safesite/templates/datashow2.html @@ -17,12 +17,10 @@ +
企业安全数据显示大屏 -
-
-
@@ -73,9 +71,6 @@
-
- -