隐患类别树型字典完成

This commit is contained in:
caoqianming 2021-01-17 18:39:10 +08:00
parent f4c66fdff1
commit 96e2da6246
9 changed files with 49 additions and 24 deletions

View File

@ -199,7 +199,7 @@ class Trouble(models.Model): # 隐患排查
yhdj = models.ForeignKey(Dickey, related_name='yhdj', yhdj = models.ForeignKey(Dickey, related_name='yhdj',
on_delete=models.CASCADE, null=True, blank=True) on_delete=models.CASCADE, null=True, blank=True)
yhlxo = models.ForeignKey(Dickey, related_name='yhlxo', yhlxo = models.ForeignKey(Dickey, related_name='yhlxo',
on_delete=models.CASCADE, null=True, blank=True) on_delete=models.CASCADE, null=True, blank=True) #危险有害因素
yhlx = models.ForeignKey( yhlx = models.ForeignKey(
Dicclass, related_name='yhlx', on_delete=models.CASCADE, null=True, blank=True) Dicclass, related_name='yhlx', on_delete=models.CASCADE, null=True, blank=True)
yhlb = models.ForeignKey(Dickey, related_name='yhlb', yhlb = models.ForeignKey(Dickey, related_name='yhlb',

View File

@ -98,10 +98,19 @@
textField:'text', textField:'text',
" required=true /> " required=true />
</div> </div>
<div style="margin-bottom:5px">
<input class="easyui-combotree" editable="false" name="yhlxo" id="yhlxo" style="width:480px;" data-options="
url:'',
label:'隐患因素',
method: 'get',
valueField:'value',
textField:'text',
" />
</div>
<div style="margin-bottom:5px"> <div style="margin-bottom:5px">
<input class="easyui-combobox" name="yhlx" id="yhlx" style="width:480px;" editable="false" <input class="easyui-combobox" name="yhlx" id="yhlx" style="width:480px;" editable="false"
data-options=" data-options="
label:'隐患类型', label:'隐患类',
method: 'get', method: 'get',
valueField:'value', valueField:'value',
textField:'text', textField:'text',
@ -234,6 +243,7 @@
// }); // });
// $("#yhlx").combobox('setValue', data.yhlx__dicid); // $("#yhlx").combobox('setValue', data.yhlx__dicid);
$("#yhpg").textbox('setValue', data.yhpg__dickeyname).textbox('disable'); $("#yhpg").textbox('setValue', data.yhpg__dickeyname).textbox('disable');
$("#yhlxo").textbox('setValue', data.yhlxo__dickeyname).textbox('disable');
$("#yhlx").textbox('setValue', data.yhlx__dicname).textbox('disable'); $("#yhlx").textbox('setValue', data.yhlx__dicname).textbox('disable');
$("#yhlb").textbox('setValue', data.yhlb__dickeyname).textbox('disable'); $("#yhlb").textbox('setValue', data.yhlb__dickeyname).textbox('disable');
$("#yhms,#zgms,#yyfx,#zgcs").textbox('disable'); $("#yhms,#zgms,#yyfx,#zgcs").textbox('disable');
@ -244,6 +254,7 @@
$('#file2').hide(); $('#file2').hide();
$("#yhms").textbox('disable'); $("#yhms").textbox('disable');
$("#yhpg").textbox('setValue', data.yhpg__dickeyname).textbox('disable'); $("#yhpg").textbox('setValue', data.yhpg__dickeyname).textbox('disable');
$("#yhlxo").textbox('setValue', data.yhlxo__dickeyname).textbox('disable');
$("#yhlx").textbox('setValue', data.yhlx__dicname).textbox('disable'); $("#yhlx").textbox('setValue', data.yhlx__dicname).textbox('disable');
$("#yhlb").textbox('setValue', data.yhlb__dickeyname).textbox('disable'); $("#yhlb").textbox('setValue', data.yhlb__dickeyname).textbox('disable');
$("#zgbm").textbox('setValue', data.zgbm__partname).textbox('disable'); $("#zgbm").textbox('setValue', data.zgbm__partname).textbox('disable');
@ -262,6 +273,7 @@
$("#fcyjdiv,#shyjdiv,#reject,#jxpg").hide(); $("#pass").linkbutton({ text: '提交整改结果' }); $("#fcyjdiv,#shyjdiv,#reject,#jxpg").hide(); $("#pass").linkbutton({ text: '提交整改结果' });
$("#yhms").textbox('disable'); $("#yhms").textbox('disable');
$("#yhpg").textbox('setValue', data.yhpg__dickeyname).textbox('disable'); $("#yhpg").textbox('setValue', data.yhpg__dickeyname).textbox('disable');
$("#yhlxo").textbox('setValue', data.yhlxo__dickeyname).textbox('disable');
$("#yhlx").textbox('setValue', data.yhlx__dicname).textbox('disable'); $("#yhlx").textbox('setValue', data.yhlx__dicname).textbox('disable');
$("#yhlb").textbox('setValue', data.yhlb__dickeyname).textbox('disable'); $("#yhlb").textbox('setValue', data.yhlb__dickeyname).textbox('disable');
$("#zgbm").textbox('setValue', data.zgbm__partname).textbox('disable'); $("#zgbm").textbox('setValue', data.zgbm__partname).textbox('disable');
@ -292,6 +304,7 @@
$('#fcyjdiv,#file2').hide(); $('#fcyjdiv,#file2').hide();
$("#yhms").textbox('disable'); $("#yhms").textbox('disable');
$("#yhpg").textbox('setValue', data.yhpg__dickeyname); $("#yhpg").textbox('disable'); $("#yhpg").textbox('setValue', data.yhpg__dickeyname); $("#yhpg").textbox('disable');
$("#yhlxo").textbox('setValue', data.yhlxo__dickeyname).textbox('disable');
$("#yhlx").textbox('setValue', data.yhlx__dicname); $("#yhlx").textbox('disable'); $("#yhlx").textbox('setValue', data.yhlx__dicname); $("#yhlx").textbox('disable');
$("#yhlb").textbox('setValue', data.yhlb__dickeyname); $("#yhlb").textbox('disable'); $("#yhlb").textbox('setValue', data.yhlb__dickeyname); $("#yhlb").textbox('disable');
$("#zgbm").textbox('setValue', data.zgbm__partname); $("#zgbm").textbox('disable'); $("#zgbm").textbox('setValue', data.zgbm__partname); $("#zgbm").textbox('disable');
@ -333,9 +346,10 @@
// $("#pgh").after('<div style="margin-bottom:5px"><span style="color:blue;font-weight:bold">' + data.pgr__ubelongpart__partname + ' ' + data.pgr__name + ' ' + '</span><span style="font-weight:bold">完成评估</span></div>'); // $("#pgh").after('<div style="margin-bottom:5px"><span style="color:blue;font-weight:bold">' + data.pgr__ubelongpart__partname + ' ' + data.pgr__name + ' ' + '</span><span style="font-weight:bold">完成评估</span></div>');
// } // }
// else { // else {
$("#yhlxo").combotree({url:'getdickey?dicclass=56&a=combobox'});
$("#yhlx").combobox({ $("#yhlx").combobox({
url: 'getdicclass?dicid=15', onSelect: function (node) { url: 'getdicclass?dicid=15', onSelect: function (node) {
$('#yhlb').combobox({ url: 'getdickey?dicclass=' + node.value + '&a=combobox', }); $('#yhlb').combotree({ url: 'getdickey?dicclass=' + node.value + '&a=combobox', });
} }
}); });
$("#yhxqh").after('<div style="margin-bottom:5px"><span style="color:blue;font-weight:bold">' + data.fxbm__partname + ' ' + data.fxr__name + ' ' + '</span><span style="font-weight:bold">提报</span></div>'); $("#yhxqh").after('<div style="margin-bottom:5px"><span style="color:blue;font-weight:bold">' + data.fxbm__partname + ' ' + data.fxr__name + ' ' + '</span><span style="font-weight:bold">提报</span></div>');
@ -346,6 +360,7 @@
$('#fcyjdiv,#file2,#zgxq,#shyjdiv,#jxpg,#csyj,#reject').hide(); $('#fcyjdiv,#file2,#zgxq,#shyjdiv,#jxpg,#csyj,#reject').hide();
$("#yhms").textbox('disable'); $("#yhms").textbox('disable');
$("#yhpg").textbox('setValue', data.yhpg__dickeyname); $("#yhpg").textbox('disable'); $("#yhpg").textbox('setValue', data.yhpg__dickeyname); $("#yhpg").textbox('disable');
$("#yhlxo").textbox('setValue', data.yhlxo__dickeyname).textbox('disable');
$("#yhlx").textbox('setValue', data.yhlx__dicname); $("#yhlx").textbox('disable'); $("#yhlx").textbox('setValue', data.yhlx__dicname); $("#yhlx").textbox('disable');
$("#yhlb").textbox('setValue', data.yhlb__dickeyname); $("#yhlb").textbox('disable'); $("#yhlb").textbox('setValue', data.yhlb__dickeyname); $("#yhlb").textbox('disable');
$("#zgbm").textbox('setValue', data.zgbm__partname); $("#zgbm").textbox('disable'); $("#zgbm").textbox('setValue', data.zgbm__partname); $("#zgbm").textbox('disable');
@ -359,6 +374,7 @@
$('#fcyjdiv,#file2,#zgxq,#shyjdiv,#jxpg,#reject').hide(); $('#fcyjdiv,#file2,#zgxq,#shyjdiv,#jxpg,#reject').hide();
$("#yhms").textbox('disable'); $("#yhms").textbox('disable');
$("#yhpg").textbox('setValue', data.yhpg__dickeyname); $("#yhpg").textbox('disable'); $("#yhpg").textbox('setValue', data.yhpg__dickeyname); $("#yhpg").textbox('disable');
$("#yhlxo").textbox('setValue', data.yhlxo__dickeyname).textbox('disable');
$("#yhlx").textbox('setValue', data.yhlx__dicname); $("#yhlx").textbox('disable'); $("#yhlx").textbox('setValue', data.yhlx__dicname); $("#yhlx").textbox('disable');
$("#yhlb").textbox('setValue', data.yhlb__dickeyname); $("#yhlb").textbox('disable'); $("#yhlb").textbox('setValue', data.yhlb__dickeyname); $("#yhlb").textbox('disable');
$("#zgbm").textbox('setValue', data.zgbm__partname); $("#zgbm").textbox('disable'); $("#zgbm").textbox('setValue', data.zgbm__partname); $("#zgbm").textbox('disable');

View File

@ -13,15 +13,7 @@
textField:'text', textField:'text',
" /> " />
</div> </div>
<div style="margin-bottom:5px">
<input class="easyui-combotree" editable="false" required=true name="yhlxo" id="yhlxo" style="width:480px;" data-options="
url:'getdickey?dicclass=56&a=combobox',
label:'隐患类型',
method: 'get',
valueField:'value',
textField:'text',
" />
</div>
<div style="margin-bottom:5px"> <div style="margin-bottom:5px">
<input editable="false" required=true name="jclx" id="jclx" style="width:480px" data-options=" <input editable="false" required=true name="jclx" id="jclx" style="width:480px" data-options="
label:'检查类型', label:'检查类型',
@ -88,6 +80,15 @@
" "
required=true /> required=true />
</div> </div>
<div style="margin-bottom:5px">
<input class="easyui-combotree" editable="false" required=true name="yhlxo" id="yhlxo" style="width:480px;" data-options="
url:'getdickey?dicclass=56&a=combobox',
label:'隐患因素',
method: 'get',
valueField:'value',
textField:'text',
" />
</div>
<div style="margin-bottom:5px"> <div style="margin-bottom:5px">
<input name="yhlx" id="yhlx" style="width:480px" editable="false" data-options=" <input name="yhlx" id="yhlx" style="width:480px" editable="false" data-options="
label:'隐患大类', label:'隐患大类',

View File

@ -42,7 +42,7 @@
</div> </div>
<div class="online"> <div class="online">
<div class="title"><img src="/static/safesite/mystatic/images/bigdata/icon01.png" /> 隐患类分布</div> <div class="title"><img src="/static/safesite/mystatic/images/bigdata/icon01.png" /> 隐患类分布</div>
<div id="yhlbt" style="height:80%;"></div> <div id="yhlbt" style="height:80%;"></div>
</div> </div>
<!-- <!--

View File

@ -22,7 +22,7 @@
</div> </div>
<div style="margin-bottom:20px"> <div style="margin-bottom:20px">
<input class="easyui-textbox" name="yhlx" style="width:100%" data-options="label:'隐患:',required:true"> <input class="easyui-textbox" name="yhlx" style="width:100%" data-options="label:'隐患类:',required:true">
</div> </div>
<div style="margin-bottom:20px"> <div style="margin-bottom:20px">
<input class="easyui-textbox" name="yhlb" style="width:100%" data-options="label:'隐患类别:',required:true"> <input class="easyui-textbox" name="yhlb" style="width:100%" data-options="label:'隐患类别:',required:true">

View File

@ -53,7 +53,7 @@
<option value="6">已归档</option> <option value="6">已归档</option>
</select> </select>
</div> </div>
<div style="margin-top:4px"><label>隐患类</label><input name='yhlx' id="syhlx" style="width:300px;" /></div> <div style="margin-top:4px"><label>隐患</label><input name='yhlx' id="syhlx" style="width:300px;" /></div>
<div style="margin-top:4px"><label>隐患类别</label><input name='yhlb' id="syhlb" style="width:300px;" /></div> <div style="margin-top:4px"><label>隐患类别</label><input name='yhlb' id="syhlb" style="width:300px;" /></div>
<div style="margin-top:4px"><label>检查类型</label><input name='jclx' id="sjclx" style="width:300px;" /></div> <div style="margin-top:4px"><label>检查类型</label><input name='jclx' id="sjclx" style="width:300px;" /></div>
<div style="margin-top:4px"><label>隐患评估</label><input name='yhpg' id="syhpg" style="width:300px;" /></div> <div style="margin-top:4px"><label>隐患评估</label><input name='yhpg' id="syhpg" style="width:300px;" /></div>

View File

@ -12,15 +12,18 @@
<table class='detailtable'> <table class='detailtable'>
<tr> <tr>
<td style="width:50%">隐患等级:{{yhdj__dickeyname}}</td> <td style="width:50%">隐患等级:{{yhdj__dickeyname}}</td>
<td style="width:50%">隐患类型:{{yhlx__dicname}}</td> <td style="width:50%">检查类型:{{jclx__dickeyname}}</td>
</tr> </tr>
<tr> <tr>
<td>隐患因素:{{yhlxo__dickeyname}}</td>
<td >发现时间:{{fxsj| dateFormat 'yyyy-MM-dd hh:mm:ss'}}</td>
</tr>
<tr>
<td >隐患大类:{{yhlx__dicname}}</td>
<td>隐患类别:{{yhlb__dickeyname}}</td> <td>隐患类别:{{yhlb__dickeyname}}</td>
<td>检查类型:{{jclx__dickeyname}}</td>
</tr>
<tr>
<td colspan="2">发现时间:{{fxsj| dateFormat 'yyyy-MM-dd hh:mm:ss'}}</td>
</tr> </tr>
<tr> <tr>
<td>发现区域:{{yhqy__name}}</td> <td>发现区域:{{yhqy__name}}</td>
<td>隐患地点:{{yhdd}}</td> <td>隐患地点:{{yhdd}}</td>

View File

@ -53,7 +53,7 @@
<table class='detailtable'> <table class='detailtable'>
<tr> <tr>
<td style="width:50%">隐患等级:{{yhdj__dickeyname}}</td> <td style="width:50%">隐患等级:{{yhdj__dickeyname}}</td>
<td style="width:50%">隐患类{{yhlx__dicname}}</td> <td style="width:50%">隐患类:{{yhlx__dicname}}</td>
</tr> </tr>
<tr> <tr>
<td>隐患类别:{{yhlb__dickeyname}}</td> <td>隐患类别:{{yhlb__dickeyname}}</td>

View File

@ -1239,7 +1239,7 @@ def getyh(req):
userid = req.session['userid'] userid = req.session['userid']
troubleid = req.GET.get('troubleid') troubleid = req.GET.get('troubleid')
a = Trouble.objects.filter(troubleid=troubleid).values('sybzt', 'troubleid', 'fxr__userid', 'fxr__name', 'yhms', 'yhzt', 'fxsj', 'tbsj', 'yhlb__dickeyname', 'yhlb__dickeyid', 'todouser__name', 'yhpg__dickeyname', 'yhnum', 'yhdd', 'fxbm__partname', 'yhdj__dickeyname', 'yhdj__dickeyid', 'yhpg__dickeyname', 'yhpg__dickeyid', 'jclx__dickeyname', 'jclx__dickeyid', 'yhlx__dicname', a = Trouble.objects.filter(troubleid=troubleid).values('sybzt', 'troubleid', 'fxr__userid', 'fxr__name', 'yhms', 'yhzt', 'fxsj', 'tbsj', 'yhlb__dickeyname', 'yhlb__dickeyid', 'todouser__name', 'yhpg__dickeyname', 'yhnum', 'yhdd', 'fxbm__partname', 'yhdj__dickeyname', 'yhdj__dickeyid', 'yhpg__dickeyname', 'yhpg__dickeyid', 'jclx__dickeyname', 'jclx__dickeyid', 'yhlx__dicname',
'yhlx__dicid', 'yyfx', 'zgcs', 'yhtp', 'zghtp', 'zgms', 'zgbm__partname', 'zgbm__partid', 'zgr__name', 'zgqx', 'fcr__ubelongpart__partname', 'fcr__name', 'shr__ubelongpart__partname', 'shr__name', 'pgr__ubelongpart__partname', 'pgr__name', 'zpr__ubelongpart__partname', 'zpr__name', 'csqrr__ubelongpart__partname', 'csqrr__name', 'shyj', 'fcyj', 'shresult', 'zgbm', 'zgr', 'pgyj', 'yhqy__name', 'yhqy__id')[0] 'yhlx__dicid', 'yyfx', 'zgcs', 'yhtp', 'zghtp', 'zgms', 'zgbm__partname', 'zgbm__partid', 'zgr__name', 'zgqx', 'fcr__ubelongpart__partname', 'fcr__name', 'shr__ubelongpart__partname', 'shr__name', 'pgr__ubelongpart__partname', 'pgr__name', 'zpr__ubelongpart__partname', 'zpr__name', 'csqrr__ubelongpart__partname', 'csqrr__name', 'shyj', 'fcyj', 'shresult', 'zgbm', 'zgr', 'pgyj', 'yhqy__name', 'yhqy__id', 'yhlxo', 'yhlxo__dickeyname')[0]
# print(a['yhtp']) # print(a['yhtp'])
if a['yhtp'] != '': if a['yhtp'] != '':
a['yhtp'] = a['yhtp'].split('?') a['yhtp'] = a['yhtp'].split('?')
@ -1476,6 +1476,8 @@ def accessyh(req):
a.zgcs = yhdata['zgcs'] a.zgcs = yhdata['zgcs']
a.yhpg = Dickey.objects.get(dickeyid=yhdata['yhpg']) a.yhpg = Dickey.objects.get(dickeyid=yhdata['yhpg'])
a.yhlx = Dicclass.objects.get(dicid=yhdata['yhlx']) a.yhlx = Dicclass.objects.get(dicid=yhdata['yhlx'])
if 'yhlxo' in yhdata and yhdata['yhlxo']:
a.yhlxo = Dickey.objects.get(dickeyid=yhdata['yhlxo'])
a.yhlb = Dickey.objects.get(dickeyid=yhdata['yhlb']) a.yhlb = Dickey.objects.get(dickeyid=yhdata['yhlb'])
a.zgbm = Partment.objects.get(partid=yhdata['zgbm']) a.zgbm = Partment.objects.get(partid=yhdata['zgbm'])
a.zgr = User.objects.get(userid=yhdata['zgr']) a.zgr = User.objects.get(userid=yhdata['zgr'])
@ -1516,6 +1518,8 @@ def accessyh(req):
# print(req.POST.get('yhms')) # print(req.POST.get('yhms'))
a.yhpg = Dickey.objects.get(dickeyid=yhdata['yhpg']) a.yhpg = Dickey.objects.get(dickeyid=yhdata['yhpg'])
a.yhlx = Dicclass.objects.get(dicid=yhdata['yhlx']) a.yhlx = Dicclass.objects.get(dicid=yhdata['yhlx'])
if 'yhlxo' in yhdata and yhdata['yhlxo']:
a.yhlxo = Dickey.objects.get(dickeyid=yhdata['yhlxo'])
a.yhlb = Dickey.objects.get(dickeyid=yhdata['yhlb']) a.yhlb = Dickey.objects.get(dickeyid=yhdata['yhlb'])
a.zgbm = Partment.objects.get(partid=yhdata['zgbm']) a.zgbm = Partment.objects.get(partid=yhdata['zgbm'])
a.zgr = User.objects.get(userid=yhdata['zgr']) a.zgr = User.objects.get(userid=yhdata['zgr'])
@ -1664,6 +1668,7 @@ def getdickey(req):
for i in r_list: for i in r_list:
i['value'] = i['dickeyid'] i['value'] = i['dickeyid']
i['text'] = i['dickeyname'] i['text'] = i['dickeyname']
i['name'] = i['dickeyname']
i['id'] = i['dickeyid'] i['id'] = i['dickeyid']
r_dict[i["dickeyid"]]=i r_dict[i["dickeyid"]]=i
ret=[] ret=[]
@ -1951,7 +1956,7 @@ def troublehandle(req):
troubleid = req.GET.get('troubleid') troubleid = req.GET.get('troubleid')
a = Trouble.objects.filter(troubleid=troubleid) a = Trouble.objects.filter(troubleid=troubleid)
x = a.values('yhnum', 'fxr__name', 'yhms', 'yhzt', 'fxsj', 'tbsj', 'yhlb__dickeyname', 'yhpg__dickeyname', 'yhdd', 'fxbm__partname', 'yhdj__dickeyname', 'yhpg__dickeyname', x = a.values('yhnum', 'fxr__name', 'yhms', 'yhzt', 'fxsj', 'tbsj', 'yhlb__dickeyname', 'yhpg__dickeyname', 'yhdd', 'fxbm__partname', 'yhdj__dickeyname', 'yhpg__dickeyname',
'jclx__dickeyname', 'yhlx__dicname', 'yyfx', 'zgcs', 'yhtp', 'zghtp', 'zgms', 'zgbm__partname', 'zgr__name', 'zgqx', 'yhqy__name', 'yhqy__id')[0] 'jclx__dickeyname', 'yhlx__dicname', 'yyfx', 'zgcs', 'yhtp', 'zghtp', 'zgms', 'zgbm__partname', 'zgr__name', 'zgqx', 'yhqy__name', 'yhqy__id', 'yhlxo', 'yhlxo__dickeyname')[0]
b = TroubleAccess.objects.filter(troubleid=a[0]).order_by( b = TroubleAccess.objects.filter(troubleid=a[0]).order_by(
'accesssj').values('clr__name', 'opinion', 'action', 'accesssj') 'accesssj').values('clr__name', 'opinion', 'action', 'accesssj')
x['lcxq'] = list(b) x['lcxq'] = list(b)