diff --git a/safesite/templates/safecert.html b/safesite/templates/safecert.html
index 1ce72e39..ef9de712 100644
--- a/safesite/templates/safecert.html
+++ b/safesite/templates/safecert.html
@@ -1,10 +1,21 @@
-
+
+
+ 快捷查询
+
+ 请选择
+ 我的证书
+ 全部证书
+
+
+
{% load myfilter %}
{% if request|has_permission:'b_safecert_add' %}
-
+
新增
+ {% endif %}
+ {% if request|has_permission:'b_safecert_add' %}
+
编辑
{% endif %}
{% if request|has_permission:'b_safecert_del' %}
删除
@@ -13,14 +24,7 @@
导出Excel
{% endif %}
-
- 快捷查询
-
- 请选择
- 我的证书
- 全部证书
-
-
+
\ No newline at end of file
diff --git a/safesite/templates/safecertadd.html b/safesite/templates/safecertadd.html
index 0be5e79f..abbe2cbf 100644
--- a/safesite/templates/safecertadd.html
+++ b/safesite/templates/safecertadd.html
@@ -1,12 +1,11 @@
@@ -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,
diff --git a/safesite/templates/safecertadd_.html b/safesite/templates/safecertadd_.html
new file mode 100644
index 00000000..0be5e79f
--- /dev/null
+++ b/safesite/templates/safecertadd_.html
@@ -0,0 +1,96 @@
+
+
\ No newline at end of file
diff --git a/safesite/templates/safecertedit.html b/safesite/templates/safecertedit.html
new file mode 100644
index 00000000..cea1d109
--- /dev/null
+++ b/safesite/templates/safecertedit.html
@@ -0,0 +1,117 @@
+
+
+
\ No newline at end of file
diff --git a/safesite/templates/socert.html b/safesite/templates/socert.html
index 7bfef4b5..6c1c2ce8 100644
--- a/safesite/templates/socert.html
+++ b/safesite/templates/socert.html
@@ -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('提示', '请先选择一条记录!');
+ }
}
\ No newline at end of file
diff --git a/safesite/templates/socertadd.html b/safesite/templates/socertadd.html
index f4752638..7a0ac832 100644
--- a/safesite/templates/socertadd.html
+++ b/safesite/templates/socertadd.html
@@ -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');
}
});
diff --git a/safesite/templates/socertedit.html b/safesite/templates/socertedit.html
index f4752638..6beb4036 100644
--- a/safesite/templates/socertedit.html
+++ b/safesite/templates/socertedit.html
@@ -10,8 +10,6 @@
/',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//', views.examtestdetail),
path('html/safecert', views.safecert),
path('html/safecert/add', views.safecertadd),
+ path('html/safecert/edit//',views.safecertedit),
path('html/area', views.area),
path('html/areadetail', views.areadetail),
path('html/mapshow', views.mapshow),
diff --git a/safesite/views.py b/safesite/views.py
index 5b49acf5..90ef5c8c 100644
--- a/safesite/views.py
+++ b/safesite/views.py
@@ -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')