企业信息ajaxsubmit
This commit is contained in:
parent
c4bbbbfef4
commit
5ce542b6f1
|
|
@ -1,165 +1,50 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<div class="labeldiv" style="margin:10px">公司信息</div>
|
||||
<form method="post" action="/companyinfo/" id="companyform">
|
||||
{% csrf_token %}
|
||||
{{ companyinfo.non_field_errors }}
|
||||
<table class="detailtable" style="margin:10px">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width:50%">
|
||||
属性
|
||||
</th>
|
||||
<th style="width:50%">
|
||||
内容
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for field in companyinfo %}
|
||||
<tr>
|
||||
<td> {{ field.label_tag }}</td>
|
||||
<td>{{ field }}{{ field.errors }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
<tr>
|
||||
<td colspan="2"><button type="button" class="btn btn-primary float-right" onclick="submitForm()">提交</button></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
<script>
|
||||
function submitForm() {
|
||||
// jquery 表单提交
|
||||
$("#companyform").ajaxSubmit(function(result) {
|
||||
// 对于表单提交成功后处理,result为表单正常提交后返回的内容
|
||||
if (result.code === 1) {
|
||||
$.messager.show({
|
||||
msg:'保存成功',
|
||||
timeout:1000,
|
||||
showType:'slide'
|
||||
});
|
||||
}else{
|
||||
$.messager.show({
|
||||
msg:'保存失败',
|
||||
timeout:1000,
|
||||
showType:'slide'
|
||||
});
|
||||
}
|
||||
});
|
||||
return false; // 必须返回false,否则表单会自己再做一次提交操作,并且页面跳转
|
||||
}</script>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<title>ctc安全生产管理系统</title>
|
||||
<link rel="icon" href="/media/favicon.ico" type="image/x-icon" />
|
||||
<link rel="stylesheet" type="text/css" href="/static/safesite/mystatic/css/loading.css">
|
||||
<link rel="stylesheet" type="text/css" href="/static/safesite/easyui/themes/default/easyui.css">
|
||||
<link rel="stylesheet" type="text/css" href="/static/safesite/easyui/themes/icon.css">
|
||||
<link rel="stylesheet" type="text/css" href="/static/safesite/mystatic/css/mystyle.css" />
|
||||
<link rel="stylesheet" type="text/css" href="/static/safesite/mystatic/css/font-awesome.min.css">
|
||||
<link rel="stylesheet" type="text/css" href="/static/safesite/mystatic/openlayer/ol.css">
|
||||
<script type="text/javascript" src="/static/safesite/easyui/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="/static/safesite/easyui/jquery.easyui.min.js"></script>
|
||||
<script type="text/javascript" src="/static/safesite/mystatic/js/jquery.serializejson.min.js"></script>
|
||||
<script type="text/javascript" src="/static/safesite/easyui/locale/easyui-lang-zh_CN.js"></script>
|
||||
<script type="text/javascript" src="/static/safesite/mystatic/js/echarts.min.js"></script>
|
||||
<script type="text/javascript" src="/static/safesite/mystatic/js/chart.js"></script>
|
||||
<script type="text/javascript" src="/static/safesite/mystatic/js/util.js"></script>
|
||||
<script type="text/javascript" src="/static/safesite/mystatic/js/loading.js"></script>
|
||||
<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/openlayer/ol.js"></script>
|
||||
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=requestAnimationFrame,Element.prototype.classList,URL"></script>
|
||||
<style type="text/css">
|
||||
.easyui-linkbutton:hover
|
||||
|
||||
{
|
||||
background: #1148a0;
|
||||
color: #0E2D5F;
|
||||
}
|
||||
.loading {
|
||||
position: absolute;
|
||||
z-index: 1000;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: white;
|
||||
text-align: left;
|
||||
padding: 5px 10px
|
||||
}
|
||||
.northDiv {
|
||||
overflow: hidden;
|
||||
height: 80px;
|
||||
background-color: #013162;
|
||||
background-image: url("/static/safesite/mystatic/images/indexbj1.png");
|
||||
background-repeat: no-repeat;
|
||||
font-family: Verdana, 微软雅黑,黑体
|
||||
}
|
||||
.divMune {
|
||||
height: 35px;
|
||||
background-color: #f9f9f9;
|
||||
text-align: center;
|
||||
color: #0E2D5F;
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
line-height: 35px;
|
||||
cursor: pointer;
|
||||
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
|
||||
<body id="layoutbody" class="easyui-layout">
|
||||
<div data-options="region:'center',border:false" title="主页" >
|
||||
|
||||
|
||||
|
||||
<div class="panel layout-panel layout-panel-center panel-htop" style="width: 100%; height:100%; left: 0px; top: 0px;"><div data-options="region:'center'" style="padding: 15px; height:700px;" title="" class="panel-body panel-body-noheader layout-body" id="">
|
||||
<div class="labeldiv">公司信息</div>
|
||||
<form method="post" action="/companyinfo/">
|
||||
{% csrf_token %}
|
||||
{{ companyinfo.non_field_errors }}
|
||||
<table class="detailtable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width:50%">
|
||||
属性
|
||||
</th>
|
||||
<th style="width:50%">
|
||||
内容
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for field in companyinfo %}
|
||||
<tr>
|
||||
<td> {{ field.label_tag }}</td>
|
||||
<td>{{ field }}{{ field.errors }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
<tr><td colspan="2"><button type="submit" class="btn btn-primary float-right" >提交</button></td></tr>
|
||||
</tbody></table>
|
||||
</form>
|
||||
</div></div>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div region="north" class="northDiv">
|
||||
<div style="float:right;width:7%;margin-left:10px">
|
||||
<img src="/static/safesite/mystatic/images/head.png" style="float: right;width:50px;height:50px;text-align: center;margin-top: 10px;margin-right: 10px;"
|
||||
id="headimg" />
|
||||
</div>
|
||||
<div style="width:30%;float:right">
|
||||
<div style="margin-top: 10px;text-align: center;position: fixed;width: 500px;height: 70px;right: 20px;">
|
||||
<span style=" padding-right:20px;font-size: 18px;color:#F5EBEB" class="head">
|
||||
{{ username }} 欢迎您!
|
||||
</span>
|
||||
</div>
|
||||
<div style="text-align: center;position: fixed;width: 500px;height: 70px;top: 40px;right: 60px;">
|
||||
<a style="color: #eee5e7;cursor: pointer;" class="easyui-linkbutton" iconCls="fa-sign-out" plain=true
|
||||
onclick="loginout()">安全退出</a>
|
||||
<a style="color: #eee5e7;cursor: pointer;" id="bindwx" class="easyui-linkbutton" iconCls="fa-weixin" plain=true
|
||||
onclick="bindwx()">绑定微信</a>
|
||||
<a style="color: #eee5e7;cursor: pointer;" class="easyui-linkbutton" iconCls="fa-key" plain=true
|
||||
onclick="javascript:$('#pwdg').dialog({border:false})">修改密码</a>
|
||||
<a id='setupb' class="easyui-linkbutton" iconCls="fa-cogs" plain=true style="display:none;color: #eee5e7;cursor: pointer;"
|
||||
onclick="setup()">预警设置</a>
|
||||
<a style="color: #eee5e7;cursor: pointer;" href="datashow" target="_blank" class="easyui-linkbutton" iconCls="fa-desktop" plain=true>数据大屏</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="width:50%;height:100%">
|
||||
<input id="userindex" userid="{{userid}}" openid="{{openid}}" nickname="{{nickname}}"
|
||||
headimgurl="{{headimgurl}}" menus="{{menus}}" style="display:none;" />
|
||||
|
||||
<button style="margin: 15px;background-color: transparent;border: 0;font-size: 15px;color: white;cursor: pointer;" onclick="javascript:$('#main').panel({href:'mainhtml',title:'主页'})">{{companyname}}<br/>安全生产管理系统</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id='pwdg' title='修改密码' style="width:500px;height:250px;display:none" data-options="modal:true">
|
||||
<form method="post" style="margin-top:10px">
|
||||
<div style="margin-bottom:5px;">
|
||||
<input id="oldpwd" class="easyui-textbox" name="oldpwd" type="password" style="width:100%;"
|
||||
data-options="label:'旧密码'" /></div>
|
||||
<div style="margin-bottom:5px;">
|
||||
<input id="newpwd" class="easyui-textbox" name="newpwd" type="password" style="width:100%;"
|
||||
data-options="label:'新密码'" /></div>
|
||||
<div style="margin-bottom:5px;">
|
||||
<input id="newpwd2" class="easyui-textbox" name="newpwd2" type="password" style="width:100%;"
|
||||
data-options="label:'确认新密码'" /></div>
|
||||
</form>
|
||||
<div style="text-align: center">
|
||||
<a id="btnpwc" class="easyui-linkbutton" iconCls="icon-ok" onclick="btnpwc()">保存</a>
|
||||
<a class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#pwdg').dialog('close')">取消</a>
|
||||
</div>
|
||||
</div>
|
||||
<div id="dd" style="overflow: hidden;"></div>
|
||||
<div id="userdd" style="overflow: hidden;"></div>
|
||||
<div id="questiondd" style="overflow: hidden;"></div>
|
||||
<input type="hidden" id="in" show="" total="" target="" />
|
||||
<!-- <button type="hidden" id="getb" onclick="test()" /> -->
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -25,6 +25,7 @@
|
|||
<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/openlayer/ol.js"></script>
|
||||
<script src="https://cdn.bootcss.com/jquery.form/4.2.1/jquery.form.min.js"></script>
|
||||
<style type="text/css">
|
||||
.easyui-linkbutton:hover
|
||||
|
||||
|
|
|
|||
|
|
@ -5604,32 +5604,11 @@ def companyinfo(req):
|
|||
#html = 'companyinfo.html'
|
||||
#return redirect('/withmenu/', html="companyinfo.html")
|
||||
#return HttpResponseRedirect("/withmenu/?html=companyinfo.html")
|
||||
return render(req, 'htmlindex.html', {
|
||||
'username': user[0].name,
|
||||
'userid': user[0].userid,
|
||||
'openid': user[0].openid,
|
||||
'headimgurl': user[0].headimgurl,
|
||||
'nickname': user[0].nickname,
|
||||
'companyname': companyname,
|
||||
'issuper': user[0].issuper,
|
||||
'token': user[0].token,
|
||||
'html': 'companyinfo'
|
||||
})
|
||||
|
||||
|
||||
userid = user[0].userid
|
||||
name = user[0].name
|
||||
openid = user[0].openid
|
||||
headimgurl = user[0].headimgurl
|
||||
nickname = user[0].nickname
|
||||
issuper = user[0].issuper
|
||||
|
||||
return JsonResponse({'code':1})
|
||||
from django.forms import model_to_dict
|
||||
companyinfo_form = forms.CompanyInfoForm(model_to_dict(companyinfo))
|
||||
return render(req, 'companyinfo.html',
|
||||
{'companyinfo': companyinfo_form, 'username': name, 'userid': userid, 'openid': openid,
|
||||
'headimgurl': headimgurl, 'message': message,
|
||||
'nickname': nickname, 'companyname': companyname, 'issuper': issuper, 'token': user[0].token})
|
||||
{'companyinfo': companyinfo_form})
|
||||
|
||||
|
||||
def dump(obj):
|
||||
|
|
|
|||
Loading…
Reference in New Issue