fxcs update

This commit is contained in:
caoqianming 2020-07-11 15:31:43 +08:00
parent 79db239eee
commit 18e64490ac
10 changed files with 1427 additions and 5 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,117 @@
/*!
* jQuery Cookie Plugin v1.4.1
* https://github.com/carhartl/jquery-cookie
*
* Copyright 2013 Klaus Hartl
* Released under the MIT license
*/
(function (factory) {
if (typeof define === 'function' && define.amd) {
// AMD
define(['jquery'], factory);
} else if (typeof exports === 'object') {
// CommonJS
factory(require('jquery'));
} else {
// Browser globals
factory(jQuery);
}
}(function ($) {
var pluses = /\+/g;
function encode(s) {
return config.raw ? s : encodeURIComponent(s);
}
function decode(s) {
return config.raw ? s : decodeURIComponent(s);
}
function stringifyCookieValue(value) {
return encode(config.json ? JSON.stringify(value) : String(value));
}
function parseCookieValue(s) {
if (s.indexOf('"') === 0) {
// This is a quoted cookie as according to RFC2068, unescape...
s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
}
try {
// Replace server-side written pluses with spaces.
// If we can't decode the cookie, ignore it, it's unusable.
// If we can't parse the cookie, ignore it, it's unusable.
s = decodeURIComponent(s.replace(pluses, ' '));
return config.json ? JSON.parse(s) : s;
} catch(e) {}
}
function read(s, converter) {
var value = config.raw ? s : parseCookieValue(s);
return $.isFunction(converter) ? converter(value) : value;
}
var config = $.cookie = function (key, value, options) {
// Write
if (value !== undefined && !$.isFunction(value)) {
options = $.extend({}, config.defaults, options);
if (typeof options.expires === 'number') {
var days = options.expires, t = options.expires = new Date();
t.setTime(+t + days * 864e+5);
}
return (document.cookie = [
encode(key), '=', stringifyCookieValue(value),
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
options.path ? '; path=' + options.path : '',
options.domain ? '; domain=' + options.domain : '',
options.secure ? '; secure' : ''
].join(''));
}
// Read
var result = key ? undefined : {};
// To prevent the for loop in the first place assign an empty array
// in case there are no cookies at all. Also prevents odd result when
// calling $.cookie().
var cookies = document.cookie ? document.cookie.split('; ') : [];
for (var i = 0, l = cookies.length; i < l; i++) {
var parts = cookies[i].split('=');
var name = decode(parts.shift());
var cookie = parts.join('=');
if (key && key === name) {
// If second argument (value) is a function it's a converter...
result = read(cookie, value);
break;
}
// Prevent storing a cookie that we couldn't decode.
if (!key && (cookie = read(cookie)) !== undefined) {
result[name] = cookie;
}
}
return result;
};
config.defaults = {};
$.removeCookie = function (key, options) {
if ($.cookie(key) === undefined) {
return false;
}
// Must not alter options, thus extending a fresh object...
$.cookie(key, '', $.extend({}, options, { expires: -1 }));
return !$.cookie(key);
};
}));

File diff suppressed because one or more lines are too long

View File

@ -1,2 +1 @@
.ol-box{box-sizing:border-box;border-radius:2px;border:2px solid #00f}.ol-mouse-position{top:8px;right:8px;position:absolute}.ol-scale-line{background:rgba(0,60,136,.3);border-radius:4px;bottom:8px;left:8px;padding:2px;position:absolute}.ol-scale-line-inner{border:1px solid #eee;border-top:none;color:#eee;font-size:10px;text-align:center;margin:1px;will-change:contents,width}.ol-overlay-container{will-change:left,right,top,bottom}.ol-unsupported{display:none}.ol-unselectable,.ol-viewport{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent}.ol-selectable{-webkit-touch-callout:default;-webkit-user-select:text;-moz-user-select:text;-ms-user-select:text;user-select:text}.ol-grabbing{cursor:-webkit-grabbing;cursor:-moz-grabbing;cursor:grabbing}.ol-grab{cursor:move;cursor:-webkit-grab;cursor:-moz-grab;cursor:grab}.ol-control{position:absolute;background-color:rgba(255,255,255,.4);border-radius:4px;padding:2px}.ol-control:hover{background-color:rgba(255,255,255,.6)}.ol-zoom{top:.5em;left:.5em}.ol-rotate{top:.5em;right:.5em;transition:opacity .25s linear,visibility 0s linear}.ol-rotate.ol-hidden{opacity:0;visibility:hidden;transition:opacity .25s linear,visibility 0s linear .25s}.ol-zoom-extent{top:4.643em;left:.5em}.ol-full-screen{right:.5em;top:.5em}@media print{.ol-control{display:none}}.ol-control button{display:block;margin:1px;padding:0;color:#fff;font-size:1.14em;font-weight:700;text-decoration:none;text-align:center;height:1.375em;width:1.375em;line-height:.4em;background-color:rgba(0,60,136,.5);border:none;border-radius:2px}.ol-control button::-moz-focus-inner{border:none;padding:0}.ol-zoom-extent button{line-height:1.4em}.ol-compass{display:block;font-weight:400;font-size:1.2em;will-change:transform}.ol-touch .ol-control button{font-size:1.5em}.ol-touch .ol-zoom-extent{top:5.5em}.ol-control button:focus,.ol-control button:hover{text-decoration:none;background-color:rgba(0,60,136,.7)}.ol-zoom .ol-zoom-in{border-radius:2px 2px 0 0}.ol-zoom .ol-zoom-out{border-radius:0 0 2px 2px}.ol-attribution{text-align:right;bottom:.5em;right:.5em;max-width:calc(100% - 1.3em)}.ol-attribution ul{margin:0;padding:0 .5em;font-size:.7rem;line-height:1.375em;color:#000;text-shadow:0 0 2px #fff}.ol-attribution li{display:inline;list-style:none;line-height:inherit}.ol-attribution li:not(:last-child):after{content:" "}.ol-attribution img{max-height:2em;max-width:inherit;vertical-align:middle}.ol-attribution button,.ol-attribution ul{display:inline-block}.ol-attribution.ol-collapsed ul{display:none}.ol-attribution:not(.ol-collapsed){background:rgba(255,255,255,.8)}.ol-attribution.ol-uncollapsible{bottom:0;right:0;border-radius:4px 0 0;height:1.1em;line-height:1em}.ol-attribution.ol-uncollapsible img{margin-top:-.2em;max-height:1.6em}.ol-attribution.ol-uncollapsible button{display:none}.ol-zoomslider{top:4.5em;left:.5em;height:200px}.ol-zoomslider button{position:relative;height:10px}.ol-touch .ol-zoomslider{top:5.5em}.ol-overviewmap{left:.5em;bottom:.5em}.ol-overviewmap.ol-uncollapsible{bottom:0;left:0;border-radius:0 4px 0 0}.ol-overviewmap .ol-overviewmap-map,.ol-overviewmap button{display:inline-block}.ol-overviewmap .ol-overviewmap-map{border:1px solid #7b98bc;height:150px;margin:2px;width:150px}.ol-overviewmap:not(.ol-collapsed) button{bottom:1px;left:2px;position:absolute}.ol-overviewmap.ol-collapsed .ol-overviewmap-map,.ol-overviewmap.ol-uncollapsible button{display:none}.ol-overviewmap:not(.ol-collapsed){background:rgba(255,255,255,.8)}.ol-overviewmap-box{border:2px dotted rgba(0,60,136,.7)}.ol-overviewmap .ol-overviewmap-box:hover{cursor:move}
/*# sourceMappingURL=ol.css.map */

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,61 @@
<div class="easyui-layout" style="width:100%;height:100%;">
<div id='southdiv' data-options="region:'south'" style="height:50px;text-align:center;padding:5px">
<a href="javascript:void(0)" iconCls="fa-check" class="easyui-linkbutton" onclick="fxcssubmitForm()" id="submitb">保存</a>
</div>
<div data-options="region:'center'" style="height:100%;padding:15px 15px;">
<form id="fxcsff" method="post" name="fxcsff" enctype="multipart/form-data">
<div style="margin-top:10px;margin-bottom:5px">
<input id="fxfx" class="easyui-textbox" name="fxfx" style="width:480px;height:100px" data-options="label:'风险分析',multiline:true"
required=true />
</div>
<div style="margin-bottom:5px">
<input id="aqcs" class="easyui-textbox" name="aqcs" style="width:480px;height:100px" data-options="label:'安全措施',multiline:true"
required=true />
</div>
<div style="margin-bottom:5px">
<input id="cslx" class="easyui-textbox" name="cslx" style="width:480px" data-options="label:'措施分类'"
/>
</div>
</form>
</div>
</div>
<script>
var id = {{id}}
$.get('api/fxcs?a=detail&fxid='+id,function(res){
var data = res.data
$('#fxfx').textbox('setValue',data.fxfx)
$('#aqcs').textbox('setValue',data.aqcs)
$('#cslx').textbox('setValue',data.cslx)
})
function fxcssubmitForm() {
var fxcsdata = $('#fxcsff').serializeJSON();
fxcsdata.id=id
// fxcsdata['zylx'] = $('#zylxlist').datalist('getSelected').value
$.ajax({
type: "POST",
url: 'api/fxcs?a=edit',
data: JSON.stringify(fxcsdata),
datatype: "json",
processData: false,
contentType: "application/json;charset=utf-8",
beforeSend: function () {
var bo = $('#fxcsff').form('validate')
if (bo == false) {
return bo
} else {
$('#submitb').linkbutton('disable');
}
},
success: function (data) {
if (data.code == 1) {
$('#fxcstable').datagrid('reload');
$("#dd").dialog("close");
} else { $.messager.alert('提示', '失败!'); }
$('#submitb').linkbutton('enable');
},
});
}
</script>

View File

@ -22,10 +22,10 @@
<script type="text/javascript" src="/static/safesite/mystatic/layer/layer.js"></script>
<script type="text/javascript" src="/static/safesite/mystatic/js/datagrid-export.js"></script>
<script type="text/javascript" src="/static/safesite/mystatic/js/jquery-qrcode-0.17.0.min.js"></script>
<script src="https://cdn.bootcss.com/ckeditor/4.8.0/ckeditor.js"></script>
<script type="text/javascript" src="/static/safesite/mystatic/js/ckeditor.js"></script>
<script type="text/javascript" src="/static/safesite/mystatic/openlayer/ol.js"></script>
<script src="https://cdn.bootcss.com/jquery.form/4.2.1/jquery.form.min.js"></script>
<script src="https://cdn.bootcss.com/jquery-cookie/1.4.1/jquery.cookie.js"></script>
<script type="text/javascript" src="/static/safesite/mystatic/js/jquery.form.min.js"></script>
<script type="text/javascript" src="/static/safesite/mystatic/js/jquery.cookie.js"></script>
<script type="text/javascript" src="/static/safesite/mystatic/js/util.js"></script>
<script type="text/javascript" src="/static/safesite/easyui/datagrid-scrollview.js"></script>
<style type="text/css">

View File

@ -11,6 +11,9 @@
{% if request|has_permission:'b_zuoyepeizhi_risk_add' %}
<a id="addfxcs" class="easyui-linkbutton" onclick="addfxcs()" data-options="iconCls: 'fa-plus',plain:true">新增</a>
{% endif %}
{% if request|has_permission:'b_zuoyepeizhi_risk_edit' %}
<a id="editfxcs" class="easyui-linkbutton" onclick="editfxcs()" data-options="iconCls: 'fa-edit',plain:true">编辑</a>
{% endif %}
{% if request|has_permission:'b_zuoyepeizhi_risk_del' %}
<a id="delfxcs" class="easyui-linkbutton" onclick="delfxcs()" data-options="iconCls: 'fa-trash',plain:true">删除</a>
{% endif %}
@ -92,6 +95,15 @@
$.messager.alert('提示', '未选择作业类型!');
}
}
function editfxcs(){
var row = $('#fxcstable').datagrid('getSelected')
if (row){
opendg('编辑风险分析和控制措施','html/fxcs/edit/'+row.id+'/')
}else{
$.messager.alert('提示', '未选择具体风险!');
}
}
function delfxcs(){
var row = $('#fxcstable').datagrid('getSelected')

View File

@ -50,6 +50,7 @@ urlpatterns = [
path('html/operation/add', views.operationadd),
path('html/operation/detail/<int:zyid>/', views.operationdetail),
path('html/fxcs/add', views.fxcsadd),
path('html/fxcs/edit/<int:id>/', views.fxcsedit),
path('html/operationspjd/add', views.operationspjdadd),
path('html/question',views.question),
path('html/questioncat/add',views.questioncatadd),

View File

@ -328,6 +328,8 @@ def operationspjdadd(req):
def fxcsadd(req):
return render(req, 'fxcsadd.html')
def fxcsedit(req, id):
return render(req, 'fxcsedit.html', {'id': id})
def operationadd(req):
return render(req, 'operationadd.html')
@ -5614,6 +5616,10 @@ def apifxcs(req):
total = a.count()
a = a.values('id', 'fxfx', 'aqcs', 'cslx')
return HttpResponse(transjson(total, a), content_type="application/json")
elif a == 'detail':
fxid = req.GET.get('fxid')
obj = Fxcs.objects.filter(id=fxid).values('id','fxfx', 'aqcs', 'cslx')[0]
return JsonResponse({"code": 1, "data":obj})
elif a == 'add':
data = json.loads(req.body.decode('utf-8'))
userid = req.session['userid']
@ -5626,6 +5632,20 @@ def apifxcs(req):
Fxcs.objects.create(zylx=Dickey.objects.get(
dickeyid=zylx), fxfx=fxfx, aqcs=aqcs, cslx=cslx, usecomps=','+companyid+',')
return JsonResponse({"code": 1})
elif a == 'edit':
data = json.loads(req.body.decode('utf-8'))
fxid = data['id']
userid = req.session['userid']
companyid = getcompany(userid)
if Fxcs.objects.get(id=fxid).usecomps == ','+ companyid +',':
obj = Fxcs.objects.get(id=fxid)
obj.fxfx = data['fxfx']
obj.aqcs = data['aqcs']
obj.cslx = data['cslx']
obj.save()
return JsonResponse({"code": 1})
else:
return JsonResponse({"code": 0})
elif a == 'del':
userid = req.session['userid']
companyid = getcompany(userid)