作业证书新增编辑

This commit is contained in:
caoqianming 2020-11-17 13:13:17 +08:00
parent 24bc4dfc6b
commit 7c8a03c5a9
9 changed files with 330 additions and 40 deletions

View File

@ -1,10 +1,21 @@
<table id="aqzstable" style="width:auto;height:100%;"></table>
<a id="downa" href="" target="_blank" style="display:none"></a>
<div id="aqzstablebar" style="padding: 4px;height: 40px;">
<div style="width: 300px;float: right;padding: 5px;">
<div id="aqzstablebar">
<div style="width: 400px;">
<label>快捷查询</label>
<select id='kjcxaqzs' style='width:150px'>
<option value="">请选择</option>
<option value="listself">我的证书</option>
<option value="listall">全部证书</option>
</select>
</div>
<div style="padding: 5px;">
{% load myfilter %}
{% if request|has_permission:'b_safecert_add' %}
<!-- <a id="addaqzs" class="easyui-linkbutton" onclick="addaqzs()" data-options="iconCls: 'fa-plus',plain:true">新增</a> -->
<a id="addaqzs" class="easyui-linkbutton" onclick="addaqzs()" data-options="iconCls: 'fa-plus',plain:true">新增</a>
{% endif %}
{% if request|has_permission:'b_safecert_add' %}
<a id="editaqzs" class="easyui-linkbutton" onclick="editaqzs()" data-options="iconCls: 'fa-pencil',plain:true">编辑</a>
{% endif %}
{% if request|has_permission:'b_safecert_del' %}
<a id="delaqzs" class="easyui-linkbutton" onclick="delaqzs()" data-options="iconCls: 'fa-trash',plain:true">删除</a>
@ -13,14 +24,7 @@
<a id="exportaqzsexcel" onclick="javascript:$('#aqzstable').datagrid('toExcel','证书.xls')" class="easyui-linkbutton" data-options="iconCls: 'fa-download',plain:true">导出Excel</a>
{% endif %}
</div>
<div style="padding: 5px;float: left;width: 400px;">
<label>快捷查询</label>
<select id='kjcxaqzs' style='width:150px'>
<option value="">请选择</option>
<option value="listself">我的证书</option>
<option value="listall">全部证书</option>
</select>
</div>
</div>
<script>
$(function(){
@ -101,4 +105,13 @@
$.messager.alert('提示', '未选择数据!');
}
}
function editaqzs(){
var row = $('#aqzstable').datagrid('getSelected');
if (row) {
opendg('编辑','html/safecert/edit/' + row.id)
}
else {
$.messager.alert('提示', '请先选择一条记录!');
}
}
</script>

View File

@ -1,12 +1,11 @@
<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="aqzssubmitForm()"
id="submitb">提交查询</a>
id="submitb">提交</a>
<a href="javascript:void(0)" iconCls="fa-close" class="easyui-linkbutton" onclick="closeForm()">取消</a>
</div>
<div data-options="region:'center'" style="height:100%;padding:15px 15px;">
<form id="aqzsff" method="post" name="aqzsff" enctype="multipart/form-data">
<p style="color:red;">请输入相关信息后提交进行联网查询证书</p>
<div style="margin-bottom:5px">
<input id="aqzsry" class="easyui-textbox" style="width:480px" data-options="label:'员工',prompt:'请选择'" required=true
editable=false>
@ -14,12 +13,29 @@
<a id="chooseaqzsry" class='easyui-linkbutton' onclick="chooseaqzsry()" style="width:auto">选择</a>
</div>
<div style="margin-bottom:5px">
<input id="realname" class="easyui-textbox" name="realname" style="width:480px" data-options="
label:'真实姓名'," required=true>
<input id="zglx" class="easyui-textbox" name="zglx" style="width:480px" data-options="
label:'资格类型'," required=true>
</div>
<div style="margin-bottom:5px">
<input id="cardnum" class="easyui-textbox" name="cardnum" style="width:480px" data-options="
label:'身份证号'," required=true>
<input id="fzjg" class="easyui-textbox" name="fzjg" style="width:480px" data-options="
label:'发证机关'," required=true>
</div>
<div style="margin-bottom:5px">
<input id="dwlx" class="easyui-textbox" name="dwlx" style="width:480px" data-options="
label:'单位类型'," required=true>
</div>
<div style="margin-bottom:5px">
<input id="yfsrq" class="easyui-datebox" name="yfsrq" style="width:480px" data-options="
label:'应复审'," required=true editable=false>
</div>
<div style="margin-bottom:5px">
<input id="yxqkssj" class="easyui-datebox" name="yxqkssj" style="width:480px" data-options="
label:'有效期开始'," required=true editable=false>
</div>
<div style="margin-bottom:5px">
<input id="yxqjssj" class="easyui-datebox" name="yxqjssj" style="width:480px" data-options="
label:'有效期结束'," required=true editable=false>
</div>
</div>
</form>
</div>
@ -29,7 +45,7 @@
var aqzsdata = $('#aqzsff').serializeJSON();
$.ajax({
type: "POST",
url: 'api/safecert?a=addspider',
url: 'api/safecert?a=add',
data: JSON.stringify(aqzsdata),
datatype: "json",
processData: false,

View File

@ -0,0 +1,96 @@
<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="aqzssubmitForm()"
id="submitb">提交查询</a>
<a href="javascript:void(0)" iconCls="fa-close" class="easyui-linkbutton" onclick="closeForm()">取消</a>
</div>
<div data-options="region:'center'" style="height:100%;padding:15px 15px;">
<form id="aqzsff" method="post" name="aqzsff" enctype="multipart/form-data">
<p style="color:red;">请输入相关信息后提交进行联网查询证书</p>
<div style="margin-bottom:5px">
<input id="aqzsry" class="easyui-textbox" style="width:480px" data-options="label:'员工',prompt:'请选择'" required=true
editable=false>
<input type="hidden" id="userid" name="userid" />
<a id="chooseaqzsry" class='easyui-linkbutton' onclick="chooseaqzsry()" style="width:auto">选择</a>
</div>
<div style="margin-bottom:5px">
<input id="realname" class="easyui-textbox" name="realname" style="width:480px" data-options="
label:'真实姓名'," required=true>
</div>
<div style="margin-bottom:5px">
<input id="cardnum" class="easyui-textbox" name="cardnum" style="width:480px" data-options="
label:'身份证号'," required=true>
</div>
</form>
</div>
</div>
<script>
function aqzssubmitForm() {
var aqzsdata = $('#aqzsff').serializeJSON();
$.ajax({
type: "POST",
url: 'api/safecert?a=addspider',
data: JSON.stringify(aqzsdata),
datatype: "json",
processData: false,
contentType: "application/json;charset=utf-8",//这是原因
beforeSend: function () {
var bo = $('#aqzsff').form('validate')
if (bo == false) {
return bo
} else {
$('#submitb').linkbutton('disable');
}
loading('联网查询中,请稍等。。')
},
success: function (data) {
if (data.code == 1) {
$('#aqzstable').datagrid('reload');
$("#dd").dialog("close");
} else { $.messager.alert('提示', '相关信息错误或查询无证!'); }
$('#submitb').linkbutton('enable');
removeLoading()
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
// $("#p_test").innerHTML = "there is something wrong!";
// alert(XMLHttpRequest.status);
// alert(XMLHttpRequest.readyState);
// alert(textStatus);
removeLoading()
$('#submitb').linkbutton('enable');
}
});
}
function chooseaqzsry() {
var myh = screen.availHeight * 0.5;
$('#userdd').dialog({
maximizable: true,
title: '选择人员',
width: 700,
height: myh,
closed: false,
cache: false,
href: 'getuserf?a=aqzsry',
modal: true,
border: false,
});
$('#userdd').window('center');
}
function aaa(x) {
if (x == "aqzsry") {
userid = top.$('#in').val()
$('#userid').val(userid)
$.get("api/user?a=detail&userid=" + userid, function (result) {
if (result.userprofile__realname != null) {
$('#realname').setValue(result.userprofile__realname)
}
if (result.userprofile__cardnum != null) {
$('#cardnum').setValue(result.userprofile__cardnum)
}
});
$('#user').attr('value', top.$('#in').val());
$('#aqzsry').textbox('setValue', top.$('#in').attr('show'));
}
}
</script>

View File

@ -0,0 +1,117 @@
<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="aqzssubmitForm()"
id="submitb">提交</a>
<a href="javascript:void(0)" iconCls="fa-close" class="easyui-linkbutton" onclick="closeForm()">取消</a>
</div>
<div data-options="region:'center'" style="height:100%;padding:15px 15px;">
<form id="aqzsff" method="post" name="aqzsff" enctype="multipart/form-data">
<div style="margin-bottom:5px">
<input id="aqzsry" class="easyui-textbox" style="width:480px" data-options="label:'员工',prompt:'请选择'" required=true
editable=false>
</div>
<div style="margin-bottom:5px">
<input id="zglx" class="easyui-textbox" name="zglx" style="width:480px" data-options="
label:'资格类型'," required=true>
</div>
<div style="margin-bottom:5px">
<input id="fzjg" class="easyui-textbox" name="fzjg" style="width:480px" data-options="
label:'发证机关'," required=true>
</div>
<div style="margin-bottom:5px">
<input id="dwlx" class="easyui-textbox" name="dwlx" style="width:480px" data-options="
label:'单位类型'," required=true>
</div>
<div style="margin-bottom:5px">
<input id="yfsrq" class="easyui-datebox" name="yfsrq" style="width:480px" data-options="
label:'应复审'," required=true editable=false>
</div>
<div style="margin-bottom:5px">
<input id="yxqkssj" class="easyui-datebox" name="yxqkssj" style="width:480px" data-options="
label:'有效期开始'," required=true editable=false>
</div>
<div style="margin-bottom:5px">
<input id="yxqjssj" class="easyui-datebox" name="yxqjssj" style="width:480px" data-options="
label:'有效期结束'," required=true editable=false>
</div>
</div>
</form>
</div>
</div>
<script>
var id={{id}}
$.get('api/safecert?a=detail&id='+id,function(res){
$('#aqzsry').textbox('setValue',res.user__name)
$('#aqzsff').form('load', res)
})
function aqzssubmitForm() {
var aqzsdata = $('#aqzsff').serializeJSON();
$.ajax({
type: "POST",
url: 'api/safecert?a=add',
data: JSON.stringify(aqzsdata),
datatype: "json",
processData: false,
contentType: "application/json;charset=utf-8",//这是原因
beforeSend: function () {
var bo = $('#aqzsff').form('validate')
if (bo == false) {
return bo
} else {
$('#submitb').linkbutton('disable');
}
loading('联网查询中,请稍等。。')
},
success: function (data) {
if (data.code == 1) {
$('#aqzstable').datagrid('reload');
$("#dd").dialog("close");
} else { $.messager.alert('提示', '相关信息错误或查询无证!'); }
$('#submitb').linkbutton('enable');
removeLoading()
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
// $("#p_test").innerHTML = "there is something wrong!";
// alert(XMLHttpRequest.status);
// alert(XMLHttpRequest.readyState);
// alert(textStatus);
removeLoading()
$('#submitb').linkbutton('enable');
}
});
}
function chooseaqzsry() {
var myh = screen.availHeight * 0.5;
$('#userdd').dialog({
maximizable: true,
title: '选择人员',
width: 700,
height: myh,
closed: false,
cache: false,
href: 'getuserf?a=aqzsry',
modal: true,
border: false,
});
$('#userdd').window('center');
}
function aaa(x) {
if (x == "aqzsry") {
userid = top.$('#in').val()
$('#userid').val(userid)
$.get("api/user?a=detail&userid=" + userid, function (result) {
if (result.userprofile__realname != null) {
$('#realname').setValue(result.userprofile__realname)
}
if (result.userprofile__cardnum != null) {
$('#cardnum').setValue(result.userprofile__cardnum)
}
});
$('#user').attr('value', top.$('#in').val());
$('#aqzsry').textbox('setValue', top.$('#in').attr('show'));
}
}
</script>

View File

@ -92,9 +92,9 @@
{ field: 'ccfzrq', title: '初次发证日期', width: 80 },
{ field: 'yfsrq', title: '应复审日期', width: 80 ,sortable:true,styler: function (value, row, index) {
switch (row.zszt) {
case 1: return 'background-color:green;'; break;
case 1: return 'background-color:green;color:white'; break;
case 2: return 'background-color:yellow;'; break;
case 3: return 'background-color:red;'; break;
case 3: return 'background-color:red;color:white'; break;
}
}},
{ field: 'yxqkssj', title: '有效期开始时间', width: 80 },
@ -136,12 +136,13 @@
$.messager.alert('提示', '未选择数据!');
}
}
function wsdetail(){
var row = $('#wstable').datagrid('getSelected');
function edittzzs(){
var row = $('#tzzstable').datagrid('getSelected');
if (row) {
var url = 'misshtml/detail/' + row.missid
opendg('查看详情',url)
opendg('编辑','html/socert/edit/' + row.id)
}
else { $.messager.alert('提示', '未选择数据!'); }
else {
$.messager.alert('提示', '请先选择一条记录!');
}
}
</script>

View File

@ -69,7 +69,7 @@
} else {
$('#submitb').linkbutton('disable');
}
loading('联网查询中,请稍等。。')
// loading('联网查询中,请稍等。。')
},
success: function (data) {
if (data.code == 1) {
@ -78,14 +78,14 @@
}
// else { $.messager.alert('提示', '相关信息错误或查询无证!'); }
$('#submitb').linkbutton('enable');
removeLoading()
// removeLoading()
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
// $("#p_test").innerHTML = "there is something wrong!";
// alert(XMLHttpRequest.status);
// alert(XMLHttpRequest.readyState);
// alert(textStatus);
removeLoading()
// removeLoading()
$('#submitb').linkbutton('enable');
}
});

View File

@ -10,8 +10,6 @@
<div style="margin-bottom:5px">
<input id="tzzyry" class="easyui-textbox" style="width:480px" data-options="label:'员工',prompt:'请选择'" required=true
editable=false>
<input type="hidden" id="userid" name="userid" />
<a id="choosetzzyry" class='easyui-linkbutton' onclick="choosetzzyry()" style="width:auto">选择</a>
</div>
<div style="margin-bottom:5px">
<input id="zylb" class="easyui-textbox" name="zylb" style="width:480px" data-options="
@ -53,11 +51,19 @@
</div>
</div>
<script>
var id={{id}}
$.get('api/socert?a=detail&id='+id,function(res){
$('#tzzyry').textbox('setValue',res.user__name)
$('#tzzsff').form('load', res)
})
function tzzssubmitForm() {
var tzzsdata = $('#tzzsff').serializeJSON();
tzzsdata.id = id
$.ajax({
type: "POST",
url: 'api/socert?a=add',
url: 'api/socert?a=edit',
data: JSON.stringify(tzzsdata),
datatype: "json",
processData: false,
@ -69,7 +75,6 @@
} else {
$('#submitb').linkbutton('disable');
}
loading('联网查询中,请稍等。。')
},
success: function (data) {
if (data.code == 1) {
@ -78,14 +83,12 @@
}
// else { $.messager.alert('提示', '相关信息错误或查询无证!'); }
$('#submitb').linkbutton('enable');
removeLoading()
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
// $("#p_test").innerHTML = "there is something wrong!";
// alert(XMLHttpRequest.status);
// alert(XMLHttpRequest.readyState);
// alert(textStatus);
removeLoading()
$('#submitb').linkbutton('enable');
}
});

View File

@ -35,6 +35,7 @@ urlpatterns = [
path('rightshtml', views.rightshtml),
path('socerthtml', views.socerthtml),
path('socerthtml/add', views.socertadd),
path('html/socert/edit/<int:id>/',views.socertedit),
path('html/medetail', views.medetail),
path('html/suggest', views.suggest),
path('html/suggest/add', views.suggestadd),
@ -71,6 +72,7 @@ urlpatterns = [
path('html/examtest/detail/<int:id>/', views.examtestdetail),
path('html/safecert', views.safecert),
path('html/safecert/add', views.safecertadd),
path('html/safecert/edit/<int:id>/',views.safecertedit),
path('html/area', views.area),
path('html/areadetail', views.areadetail),
path('html/mapshow', views.mapshow),

View File

@ -284,6 +284,8 @@ def safecert(req):
def safecertadd(req):
return render(req, 'safecertadd.html')
def safecertedit(req, id):
return render(req, 'safecertedit.html', {'id': id})
def examtestdetail(req, id):
return render(req, 'examtestdetail.html', {'id': id})
@ -420,6 +422,8 @@ def socerthtml(req):
def socertadd(req):
return render(req, 'socertadd.html')
def socertedit(req, id):
return render(req, 'socertedit.html', {'id':id})
def rightshtml(req):
groupid = req.GET.get('groupid')
@ -4040,8 +4044,7 @@ def apisocert(req):
userid = req.session['userid']
companyid = getcompany(userid)
startnum, endnum = fenye(req)
a = Socertificate.objects.filter(usecomp=Partment.objects.get(
partid=companyid)).order_by('id') # 无deletemark
a = Socertificate.objects.filter(user__usecomp__partid=companyid).order_by('id') # 无deletemark
total = a.count()
startnum, endnum = fenye(req)
if req.GET.get('sort'):
@ -4076,6 +4079,19 @@ def apisocert(req):
obj.usecomp = user.usecomp
obj.save()
return JsonResponse({'code':1})
elif a == 'edit':
postdata = json.loads(req.body.decode('utf-8'))
obj = Socertificate.objects.get(id=postdata['id'])
obj.zylb = postdata['zylb']
obj.fzjg = postdata['fzjg']
obj.czxm = postdata['czxm']
obj.ccfzrq = postdata['ccfzrq']
obj.yfsrq = postdata['yfsrq']
obj.yxqkssj = postdata['yxqkssj']
obj.yxqjssj = postdata['yxqjssj']
obj.zszt = guoqi(postdata['yfsrq'])
obj.save()
return JsonResponse({'code':1})
# elif a == 'addspider':
# postdata = json.loads(req.body.decode('utf-8'))
# userid = postdata['userid']
@ -4200,7 +4216,7 @@ def apisocert(req):
elif a == 'detail':
id = req.GET.get('id')
a = Socertificate.objects.filter(id=id).values(
'id', 'realname', 'gender', 'zylb', 'czxm', 'fzjg', 'ccfzrq', 'yfsrq', 'yxqkssj', 'yxqjssj', 'sjfssj', 'user__userprofile__realname', 'user__userprofile__gender', 'user__userprofile__cardnum')
'id', 'realname', 'gender', 'zylb', 'czxm', 'fzjg', 'ccfzrq', 'yfsrq', 'yxqkssj', 'yxqjssj', 'sjfssj', 'user__userprofile__realname', 'user__userprofile__gender', 'user__userprofile__cardnum', 'user__name')
return JsonResponse(a[0])
elif a == 'getjson':
cardnum = req.GET.get('cardnum')
@ -4233,8 +4249,7 @@ def apisafecert(req):
userid = req.session['userid']
companyid = getcompany(userid)
startnum, endnum = fenye(req)
a = Safecert.objects.filter(usecomp=Partment.objects.get(
partid=companyid)).order_by('id') # 无deletemark
a = Safecert.objects.filter(user__usecomp__partid=companyid).order_by('id') # 无deletemark
total = a.count()
startnum, endnum = fenye(req)
if req.GET.get('sort'):
@ -4253,6 +4268,33 @@ def apisafecert(req):
a = a.values('id', 'realname', 'gender', 'zglx', 'dwlx',
'fzjg', 'yfsrq', 'yxqkssj', 'yxqjssj', 'zszt', 'url', 'cardnum', 'user__userprofile__realname', 'user__userprofile__gender', 'user__userprofile__cardnum')
return HttpResponse(transjson(total, a), content_type="application/json")
elif a == 'add':
postdata = json.loads(req.body.decode('utf-8'))
obj = Safecert()
user = User.objects.get(userid = postdata['userid'])
obj.user = User.objects.get(userid = postdata['userid'])
obj.zglx = postdata['zglx']
obj.fzjg = postdata['fzjg']
obj.dwlx = postdata['dwlx']
obj.yfsrq = postdata['yfsrq']
obj.yxqkssj = postdata['yxqkssj']
obj.yxqjssj = postdata['yxqjssj']
obj.zszt = guoqi(postdata['yfsrq'])
obj.usecomp = user.usecomp
obj.save()
return JsonResponse({'code':1})
elif a == 'edit':
postdata = json.loads(req.body.decode('utf-8'))
obj = Safecert.objects.get(id=postdata['id'])
obj.zylb = postdata['zglx']
obj.fzjg = postdata['fzjg']
obj.czxm = postdata['dwlx']
obj.yfsrq = postdata['yfsrq']
obj.yxqkssj = postdata['yxqkssj']
obj.yxqjssj = postdata['yxqjssj']
obj.zszt = guoqi(postdata['yfsrq'])
obj.save()
return JsonResponse({'code':1})
# elif a == 'addspider':
# postdata = json.loads(req.body.decode('utf-8'))
# userid = postdata['userid']
@ -4370,7 +4412,7 @@ def apisafecert(req):
elif a == 'detail':
id = req.GET.get('id')
a = Safecert.objects.filter(id=id).values(
'id', 'realname', 'gender', 'zglx', 'dwlx', 'fzjg', 'yfsrq', 'yxqkssj', 'yxqjssj', 'zszt', 'url', 'user__userprofile__realname', 'user__userprofile__gender', 'user__userprofile__cardnum')
'id', 'realname', 'gender', 'zglx', 'dwlx', 'fzjg', 'yfsrq', 'yxqkssj', 'yxqjssj', 'zszt', 'url', 'user__userprofile__realname', 'user__userprofile__gender', 'user__userprofile__cardnum', 'user__name')
return JsonResponse(a[0])
elif a == 'getjson':
cardnum = req.GET.get('cardnum')