equipmentcheck form add
This commit is contained in:
parent
b2748fd560
commit
ec4bac283b
|
@ -14,6 +14,7 @@ class GroupAdmin(admin.ModelAdmin):
|
|||
|
||||
@admin.register(models.Groupmember)
|
||||
class GroupmemberAdmin(admin.ModelAdmin):
|
||||
list_display=['group','member']
|
||||
def formfield_for_foreignkey(self, db_field, request, **kwargs):
|
||||
if db_field.name == "member":
|
||||
kwargs["queryset"] = s_models.Partment.objects.filter(iscompany=1,deletemark=1)
|
||||
|
|
|
@ -90,14 +90,14 @@ desired effect
|
|||
<!-- Menu Toggle Button -->
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
|
||||
<!-- The user image in the navbar-->
|
||||
<img src="{% static 'groups/dist/img/user2-160x160.jpg' %}" class="user-image" alt="User Image">
|
||||
<img src="{% static 'groups/dist/img/avatar5.png' %}" class="user-image" alt="User Image">
|
||||
<!-- hidden-xs hides the username on small devices so only the image appears. -->
|
||||
<span class="hidden-xs">{{ request.session.user_name }}</span>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<!-- The user image in the menu -->
|
||||
<li class="user-header">
|
||||
<img src="{% static 'groups/dist/img/user2-160x160.jpg' %}" class="img-circle" alt="User Image">
|
||||
<img src="{% static 'groups/dist/img/avatar5.png' %}" class="img-circle" alt="User Image">
|
||||
|
||||
<p>
|
||||
{{ request.session.user_name }} - 集团管理员
|
||||
|
@ -129,7 +129,7 @@ desired effect
|
|||
<!-- Sidebar user panel (optional) -->
|
||||
<div class="user-panel">
|
||||
<div class="pull-left image">
|
||||
<img src="{% static 'groups/dist/img/user2-160x160.jpg' %}" class="img-circle" alt="User Image">
|
||||
<img src="{% static 'groups/dist/img/avatar5.png' %}" class="img-circle" alt="User Image">
|
||||
</div>
|
||||
<div class="pull-left info">
|
||||
<p>{{ request.session.user_name }}</p>
|
||||
|
|
|
@ -316,7 +316,7 @@ def updateposition(req):
|
|||
i.position = data['geocodes'][0]
|
||||
i.save()
|
||||
else:
|
||||
address = i.partname.replace('公司', '').replace('责任', '').replace('有限', '')
|
||||
address = i.partname.replace('公司', '').replace('责任', '').replace('有限', '').replace('水泥','')
|
||||
data = getPosition(address)
|
||||
if data['status'] == '1' and int(data['count']) > 0:
|
||||
i.position = data['geocodes'][0]
|
||||
|
@ -334,7 +334,11 @@ def getPosition(address):
|
|||
|
||||
|
||||
def apipositions(req):
|
||||
companys = GroupUser.objects.get(id = req.session['user_id']).group.members.all()
|
||||
user = GroupUser.objects.get(id = req.session['user_id'])
|
||||
if user.issuper==1:
|
||||
companys = s_models.Partment.objects.filter(iscompany=1).order_by('-creattime')
|
||||
else:
|
||||
companys = user.group.members.all().order_by('-creattime')
|
||||
positions = companys.values('position','partname')
|
||||
return JsonResponse({"code":1,"data":list(positions)})
|
||||
def trouble(request):#隐患排查
|
||||
|
|
|
@ -37,12 +37,14 @@ INSTALLED_APPS = [
|
|||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'rest_framework',
|
||||
'safesite',
|
||||
'safesite.templatetags',
|
||||
'groups',
|
||||
'captcha',
|
||||
|
||||
]
|
||||
|
||||
CAPTCHA_CHALLENGE_FUNCT = 'captcha.helpers.math_challenge'
|
||||
MIDDLEWARE = [
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
# Generated by Django 2.2.8 on 2020-01-13 12:09
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('safesite', '0311_auto_20200110_1604'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
# migrations.RemoveField(
|
||||
# model_name='companyinfo',
|
||||
# name='liaison_fax',
|
||||
# ),
|
||||
migrations.AddField(
|
||||
model_name='equipmentcheckform',
|
||||
name='deletemark',
|
||||
field=models.IntegerField(default=1, verbose_name='删除标记'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='equipmentcheckform',
|
||||
name='usecomp',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='safesite.Partment', verbose_name='所属公司'),
|
||||
),
|
||||
]
|
|
@ -0,0 +1,28 @@
|
|||
# Generated by Django 2.2.8 on 2020-01-14 12:01
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('safesite', '0312_auto_20200113_1209'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
# migrations.RemoveField(
|
||||
# model_name='companyinfo',
|
||||
# name='liaison_fax',
|
||||
# ),
|
||||
migrations.AddField(
|
||||
model_name='equipmentcheckform',
|
||||
name='createby',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='safesite.User', verbose_name='创建人'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='equipmentcheckform',
|
||||
name='usecomp',
|
||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='safesite.Partment', verbose_name='所属公司'),
|
||||
),
|
||||
]
|
|
@ -0,0 +1,22 @@
|
|||
# Generated by Django 2.2.8 on 2020-01-14 18:15
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('safesite', '0313_auto_20200114_1201'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RenameField(
|
||||
model_name='equipmentcheckitem',
|
||||
old_name='item',
|
||||
new_name='name',
|
||||
),
|
||||
# migrations.RemoveField(
|
||||
# model_name='companyinfo',
|
||||
# name='liaison_fax',
|
||||
# ),
|
||||
]
|
|
@ -0,0 +1,23 @@
|
|||
# Generated by Django 2.2.8 on 2020-01-15 09:41
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('safesite', '0314_auto_20200114_1815'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
# migrations.RemoveField(
|
||||
# model_name='companyinfo',
|
||||
# name='liaison_fax',
|
||||
# ),
|
||||
migrations.AddField(
|
||||
model_name='equipment',
|
||||
name='checkform',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='safesite.EquipmentCheckForm'),
|
||||
),
|
||||
]
|
|
@ -0,0 +1,27 @@
|
|||
# Generated by Django 2.2.8 on 2020-01-15 16:53
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('safesite', '0315_auto_20200115_0941'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
# migrations.RemoveField(
|
||||
# model_name='companyinfo',
|
||||
# name='liaison_fax',
|
||||
# ),
|
||||
migrations.AddField(
|
||||
model_name='train',
|
||||
name='jsqd',
|
||||
field=models.IntegerField(default=0, verbose_name='结束签到'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='trainuser',
|
||||
name='jsqd',
|
||||
field=models.DateTimeField(blank=True, null=True, verbose_name='结束签到时间'),
|
||||
),
|
||||
]
|
|
@ -803,7 +803,8 @@ class Train(models.Model): # 培训表
|
|||
User, on_delete=models.CASCADE, null=True, blank=True)
|
||||
otherparticipant = models.CharField(max_length=1000, null=True, blank=True)
|
||||
deletemark = models.IntegerField(default='1')
|
||||
state = models.IntegerField(default='0')
|
||||
state = models.IntegerField(default='0') #是否关闭
|
||||
jsqd = models.IntegerField(verbose_name='结束签到',default=0)#默认关闭
|
||||
participantnum = models.IntegerField(default='1', null=True, blank=True)
|
||||
knownum = models.IntegerField(default='1', null=True, blank=True)
|
||||
pxxg = models.CharField(max_length=1000, null=True, blank=True)
|
||||
|
@ -820,6 +821,7 @@ class Trainuser(models.Model): # 培训人员记录
|
|||
ExamTestDetail, on_delete=models.CASCADE, null=True, blank=True)
|
||||
checked = models.IntegerField(default=0)
|
||||
qdsj = models.DateTimeField(null=True, blank=True)
|
||||
jsqd = models.DateTimeField(verbose_name='结束签到时间',null=True,blank=True)
|
||||
isnew = models.IntegerField(default=0)
|
||||
opinion = models.CharField(max_length=1000, null=True, blank=True)
|
||||
|
||||
|
@ -863,17 +865,22 @@ class RiskAct(models.Model): # 风险点表
|
|||
tasktype = models.IntegerField(default=0)
|
||||
tasktime = models.DateTimeField(null=True, blank=True) # 最后任务开始时间
|
||||
|
||||
class EquipmentCheckItem(models.Model):# 设备检查项目
|
||||
item = models.CharField(max_length=200,verbose_name='检查项目')
|
||||
class EquipmentCheckItem(models.Model):# 检查项目
|
||||
name = models.CharField(max_length=200,verbose_name='检查项目')
|
||||
content = models.CharField(max_length=400,verbose_name='检查内容')
|
||||
usecomps = ArrayField(models.IntegerField(), blank=True, null=True)
|
||||
nousecomps = ArrayField(models.IntegerField(), blank=True, null=True)
|
||||
|
||||
class EquipmentCheckForm(models.Model):# 设备检查表
|
||||
class EquipmentCheckForm(models.Model):# 检查表
|
||||
name = models.CharField(max_length=200,verbose_name='名称')
|
||||
desc = models.CharField(max_length=400,verbose_name='描述')
|
||||
items = models.ManyToManyField(EquipmentCheckItem,related_name='checkitems', through='EFormItems')
|
||||
usecomp = models.ForeignKey(Partment,on_delete=models.CASCADE, null=True, blank=True)
|
||||
deletemark = models.IntegerField(default=1,verbose_name="删除标记")
|
||||
createby = models.ForeignKey(User,on_delete=models.CASCADE, verbose_name="创建人",null=True,blank=True)
|
||||
usecomp = models.ForeignKey(Partment,on_delete=models.CASCADE, verbose_name='所属公司')
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
class EFormItems(models.Model):
|
||||
equipment_check_form = models.ForeignKey(EquipmentCheckForm,on_delete=models.CASCADE)
|
||||
|
@ -913,6 +920,7 @@ class Equipment(models.Model): # 设备表
|
|||
qrcode = models.CharField(max_length=200, blank=True, null=True)
|
||||
riskact = models.ForeignKey(
|
||||
RiskAct, null=True, blank=True, on_delete=models.CASCADE)
|
||||
checkform = models.ForeignKey(EquipmentCheckForm,on_delete=models.CASCADE,null=True,blank=True)
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
from .models import *
|
||||
from rest_framework import serializers
|
||||
|
||||
class UserSerializers(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
model = User
|
||||
fields = ('userid','name','username')
|
||||
read_only_fields = ('userid',)
|
||||
|
||||
class EquipmentCheckItemSerializers(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
model = EquipmentCheckItem
|
||||
fields = ('id','name','content')
|
||||
read_only_fields = ('id',)
|
||||
|
||||
class EquipmentCheckFormSerializers(serializers.Serializer):
|
||||
id = serializers.IntegerField(read_only=True)
|
||||
name = serializers.CharField()
|
||||
desc = serializers.CharField()
|
||||
createby = serializers.PrimaryKeyRelatedField(read_only=True)
|
||||
usecomp = serializers.PrimaryKeyRelatedField(read_only=True)
|
||||
createby = UserSerializers(read_only=True)
|
||||
items = serializers.SerializerMethodField(read_only=True)
|
||||
def create(self, validated_data):
|
||||
items = validated_data.pop('items')
|
||||
instance = EquipmentCheckForm.objects.create(**validated_data)
|
||||
validated_data['items'] = items
|
||||
return instance
|
||||
|
||||
def update(self,instance,validated_data):
|
||||
items = validated_data.pop('items')
|
||||
instance = instance.update(**validated_data)
|
||||
validated_data['items'] = items
|
||||
return instance
|
||||
|
||||
def get_items(self,obj):
|
||||
queryset = EFormItems.objects.filter(equipment_check_form=obj).all()
|
||||
return [{'id':row.equipment_check_item.id,'name':row.equipment_check_item.name,'content':row.equipment_check_item.content} for row in queryset]
|
||||
|
||||
|
|
@ -60,6 +60,9 @@
|
|||
<input id="duration" class="easyui-numberbox" name="duration" style="width:480px" data-options="min:0,precision:1,label:'培训时长',prompt:'小时'"
|
||||
required=true>
|
||||
</div>
|
||||
<div style="margin-bottom:5px">
|
||||
<input id="jsqd" class="easyui-checkbox" name="jsqd" value=1 label="结束签到:"><span style="color:blue"> 开启后可精确员工培训时间,开始签到默认开启</span>
|
||||
</div>
|
||||
<div id='knownumdiv' style="margin-bottom:5px;display:none">
|
||||
<input id="knownum" class="easyui-numberbox" name="knownum" style="width:480px" data-options="label:'掌握人数',required:true">
|
||||
</div>
|
||||
|
|
|
@ -1,108 +1,117 @@
|
|||
<div class="easyui-layout" style="width:100%;height:100%;">
|
||||
<div data-options="region:'west',split:true,border:false" style="width:240px;height:60%;" title="区域">
|
||||
<div data-options="region:'west',split:true,border:false" style="width:240px;" title="区域">
|
||||
<ul id="qytree" data-options="animate:true"></ul>
|
||||
</div>
|
||||
<div data-options="region:'center',title:'设备',split:true,border:false" style="height:60%;">
|
||||
<div data-options="region:'center',title:'设备',split:true,border:false" >
|
||||
|
||||
<div id="sbbar" style="padding:5px;height:auto">
|
||||
<div>
|
||||
{% load myfilter %}
|
||||
{% if request|has_permission:'b_equipment_add' %}
|
||||
<a onclick="addsb()" class="easyui-linkbutton"
|
||||
data-options="iconCls:'fa-plus',plain:true">新增设备</a>
|
||||
<a id="b_equipment_add"></a>
|
||||
{% endif %}
|
||||
{% if request|has_permission:'b_equipment_import' %}
|
||||
<a onclick="javascript:$('#drsbdg').dialog('open').window('center');" class="easyui-linkbutton"
|
||||
data-options="iconCls:'fa-upload',plain:true">导入设备</a>
|
||||
<a onclick="addsb()" class="easyui-linkbutton" data-options="iconCls:'fa-plus',plain:true">新增设备</a>
|
||||
<a id="b_equipment_add"></a>
|
||||
{% endif %}
|
||||
<!-- <a onclick="exportsbexcel" class="easyui-linkbutton"
|
||||
{% if request|has_permission:'b_equipment_import' %}
|
||||
<a onclick="javascript:$('#drsbdg').dialog('open').window('center');" class="easyui-linkbutton"
|
||||
data-options="iconCls:'fa-upload',plain:true">导入设备</a>
|
||||
{% endif %}
|
||||
<!-- <a onclick="exportsbexcel" class="easyui-linkbutton"
|
||||
data-options="iconCls:'fa-download',plain:true">导出</a> -->
|
||||
{% if request|has_permission:'b_equipment_del' %}
|
||||
<a id="delsb" onclick="delsb()" class="easyui-linkbutton"
|
||||
data-options="iconCls:'fa-trash',plain:true">删除</a>
|
||||
<a id="delsb" onclick="delsb()" class="easyui-linkbutton"
|
||||
data-options="iconCls:'fa-trash',plain:true">删除</a>
|
||||
{% endif %}
|
||||
<a id="bindjcb" onclick="javascript:$('#bindjcbdg').dialog('open')" class="easyui-linkbutton"
|
||||
data-options="iconCls:'fa-plug',plain:true">批量绑定检查表</a>
|
||||
<!-- <a id="bindfxd" onclick="bindfxd()" class="easyui-linkbutton"
|
||||
data-options="iconCls:'fa-plug',plain:true">批量绑定风险点</a> -->
|
||||
</div>
|
||||
<div>
|
||||
<form id='searchsbff'>
|
||||
<label>类别</label>
|
||||
<input id="scate" name="cate" editable=false class="easyui-combobox"
|
||||
data-options="url:'getdickey?dicclass=47&a=combobox'" />
|
||||
<label>运行状态</label><select name='state' id='sstate' class="easyui-combobox" editable=false>
|
||||
<option value="">请选择</option>
|
||||
<option value="1">正常</option>
|
||||
<option value="0">异常</option>
|
||||
</select>
|
||||
<label>设备名称</label><input name='name' id='sname' class="easyui-textbox">
|
||||
<a id="sbsearch" onclick="sbsearch()" class="easyui-linkbutton"
|
||||
data-options="iconCls: 'fa-search',plain:true">查询</a>
|
||||
{% if request|has_permission:'b_equipment_exportxls' %}
|
||||
<a id="exportsbexcel" onclick="exportsbexcel()" class="easyui-linkbutton"
|
||||
data-options="iconCls: 'fa-download',plain:true">导出Excel</a>
|
||||
{% endif %}
|
||||
{% if request|has_permission:'b_equipment_change' %}
|
||||
<a id="b_equipment_change"></a>
|
||||
{% endif %}
|
||||
</form>
|
||||
|
||||
</div>
|
||||
<div>
|
||||
<form id='searchsbff'>
|
||||
<label>类别</label>
|
||||
<input id="scate" name="cate"
|
||||
editable=false class="easyui-combobox" data-options="url:'getdickey?dicclass=47&a=combobox'"/>
|
||||
<label>运行状态</label><select name='state' id='sstate'
|
||||
class="easyui-combobox" editable=false>
|
||||
<option value="">请选择</option>
|
||||
<option value="1">正常</option>
|
||||
<option value="0">异常</option>
|
||||
</select>
|
||||
<label>设备名称</label><input name='name' id='sname'
|
||||
class="easyui-textbox" >
|
||||
<a id="sbsearch" onclick="sbsearch()" class="easyui-linkbutton" data-options="iconCls: 'fa-search',plain:true">查询</a>
|
||||
{% if request|has_permission:'b_equipment_exportxls' %}
|
||||
<a id="exportsbexcel" onclick="exportsbexcel()" class="easyui-linkbutton" data-options="iconCls: 'fa-download',plain:true">导出Excel</a>
|
||||
{% endif %}
|
||||
{% if request|has_permission:'b_equipment_change' %}
|
||||
<a id="b_equipment_change"></a>
|
||||
{% endif %}
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<table id="sbtable" style="height:100%;"></table>
|
||||
<table id="sbtable" style="height:100%;width:100%"></table>
|
||||
|
||||
</div>
|
||||
<div data-options="region:'south',split:true,border:false" style="height:40%;">
|
||||
<div style="float: left;">
|
||||
<form id='sbff'>
|
||||
<input hidden=true name="id" id="sbid"></input>
|
||||
<table style="margin:10px;">
|
||||
<tr>
|
||||
<td><label>设备编号:</label><input id="num" class="easyui-textbox" name="num" required=true /></td>
|
||||
<td><label>特种设备:</label><input id="istz" type="checkbox" name="istz" value="1"/></td>
|
||||
<td><label>主设备:</label><input id="iskey" type="checkbox" name="iskey" value="1"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label>设备名称:</label><input id="name" class="easyui-textbox" name="name" required=true /></td>
|
||||
<td><label>设备类别:</label><input id="cate" class="easyui-combobox" name="cate" required=true
|
||||
data-options="url:'getdickey?dicclass=47&a=combobox'" editable=false/></td>
|
||||
<td><label>所属区域:</label><input id="area" class="easyui-combotree" name="area" required=true editable=false/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label>规格型号:</label><input id="type" class="easyui-textbox" name="type" /></td>
|
||||
<td><label>生产厂家:</label><input id="oem" class="easyui-textbox" name="oem" required=true /></td>
|
||||
<td><label>出厂编号:</label><input id="fnum" class="easyui-textbox" name="fnum" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label>出厂日期:</label><input id="fdate" class="easyui-datebox" name="fdate" editable=false/></td>
|
||||
<td><label>投用日期:</label><input id="udate" class="easyui-datebox" name="udate" editable=false/></td>
|
||||
<td><label>具体位置:</label><input id="place" class="easyui-textbox" name="place" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label>责任部门:</label><input id="zrbm" name="zrbm" /></td>
|
||||
<td><label>责任人员:</label><input id="zrr" class="easyui-combobox" name="zrr" editable=false/></td>
|
||||
<td><label>关联风险点</label><a onclick="choosefxd()" class="easyui-linkbutton">选择</a>
|
||||
<span style="color: blue;" id="fxdspan"></span>
|
||||
<input type=hidden id="fxdinput" name="riskact">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3"><label>技术参数:</label><input id="parameter" class="easyui-textbox" name="parameter"
|
||||
style="height:100px;width:90%" data-options="multiline:true" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<a id="savesb" onclick="savesb()" class="easyui-linkbutton" data-options="iconCls: 'fa-save'">保存</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<table style="margin:10px;">
|
||||
<tr>
|
||||
<td><label>设备编号:</label><input id="num" class="easyui-textbox" name="num" required=true /></td>
|
||||
<td><label>特种设备:</label><input id="istz" type="checkbox" name="istz" value="1" /></td>
|
||||
<td><label>主设备:</label><input id="iskey" type="checkbox" name="iskey" value="1" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label>设备名称:</label><input id="name" class="easyui-textbox" name="name" required=true />
|
||||
</td>
|
||||
<td><label>设备类别:</label><input id="cate" class="easyui-combobox" name="cate" required=true
|
||||
data-options="url:'getdickey?dicclass=47&a=combobox'" editable=false /></td>
|
||||
<td><label>所属区域:</label><input id="area" class="easyui-combotree" name="area" required=true
|
||||
editable=false /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label>规格型号:</label><input id="type" class="easyui-textbox" name="type" /></td>
|
||||
<td><label>生产厂家:</label><input id="oem" class="easyui-textbox" name="oem" required=true /></td>
|
||||
<td><label>出厂编号:</label><input id="fnum" class="easyui-textbox" name="fnum" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label>出厂日期:</label><input id="fdate" class="easyui-datebox" name="fdate" editable=false />
|
||||
</td>
|
||||
<td><label>投用日期:</label><input id="udate" class="easyui-datebox" name="udate" editable=false />
|
||||
</td>
|
||||
<td><label>具体位置:</label><input id="place" class="easyui-textbox" name="place" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label>责任部门:</label><input id="zrbm" name="zrbm" /></td>
|
||||
<td><label>责任人员:</label><input id="zrr" class="easyui-combobox" name="zrr" editable=false />
|
||||
</td>
|
||||
<td><label>关联风险点</label><a onclick="choosefxd()" class="easyui-linkbutton">选择</a>
|
||||
<span style="color: blue;" id="fxdspan"></span>
|
||||
<input type=hidden id="fxdinput" name="riskact">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3"><label>技术参数:</label><input id="parameter" class="easyui-textbox"
|
||||
name="parameter" style="height:80px;width:90%" data-options="multiline:true" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<a id="savesb" onclick="savesb()" class="easyui-linkbutton"
|
||||
data-options="iconCls: 'fa-save'">保存</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div style="float: left;width:200px;text-align: center;margin-top:10px;">
|
||||
<div>设备图片</div>
|
||||
<div>设备图片</div>
|
||||
</div>
|
||||
<div style="float: left;width:200px;text-align: center;margin-top:10px;margin-left:10px">
|
||||
<div>二维码</div>
|
||||
<img id="qrimg" width=200 height=200></img>
|
||||
<div>二维码</div>
|
||||
<img id="qrimg" width=200 height=200></img>
|
||||
</div>
|
||||
</div>
|
||||
<div id="drsbdg" class="easyui-dialog" title="导入设备" style="width:400px;height:200px;"
|
||||
|
@ -112,13 +121,30 @@
|
|||
<p style="margin-left: 10px">录入完成后点击下方按钮上传文件</p>
|
||||
<input type="file" id="drfile" name="" accept=".xls,.xlsx" style="margin-left: 10px" />
|
||||
</div>
|
||||
<div id="bindjcbdg" class="easyui-dialog" title="绑定检查表" style="width:400px;height:200px;padding: 10px;"
|
||||
data-options="resizable:true,modal:true,closed:true,border:false,buttons:'#dlg-buttons'">
|
||||
<input id="checkform" class="easyui-combobox" data-options="label:'检查表'" required=true style="width:100%"
|
||||
editable=false></input>
|
||||
</div>
|
||||
<div id="dlg-buttons">
|
||||
<a class="easyui-linkbutton" onclick="savejcb()">保存</a>
|
||||
<a class="easyui-linkbutton" onclick="javascript:$('#bindjcbdg').dialog('close')">取消</a>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
if($('#b_equipment_add').length){
|
||||
$('#savesb').show()
|
||||
}else{
|
||||
$('#savesb').hide()
|
||||
}
|
||||
$.get('api/equipmentcheckform', function (res) {
|
||||
let data = res.rows;
|
||||
$('#checkform').combobox({
|
||||
data: data,
|
||||
valueField: 'id',
|
||||
textField: 'name',
|
||||
})
|
||||
})
|
||||
if ($('#b_equipment_add').length) {
|
||||
$('#savesb').show()
|
||||
} else {
|
||||
$('#savesb').hide()
|
||||
}
|
||||
$('#zrbm').combotree({
|
||||
url: 'parthandle?a=tree', loadFilter: function (rows) { return convert(rows); }, onSelect: function (node) {
|
||||
$('#zrr').combobox({ url: 'getuser?partid=' + node.id + '&a=combobox', })
|
||||
|
@ -150,7 +176,6 @@
|
|||
$('#sbtable').datagrid({
|
||||
url: 'api/equipment?a=listall',
|
||||
rownumbers: true,
|
||||
singleSelect: true,
|
||||
fitColumns: true,
|
||||
striped: true,
|
||||
method: 'get',
|
||||
|
@ -158,6 +183,7 @@
|
|||
pagination: 'true',
|
||||
pageSize: 20,
|
||||
columns: [[
|
||||
{ field: 'ck', checkbox: true, },
|
||||
{ field: 'id', title: 'ID', hidden: true },
|
||||
{ field: 'num', title: '编号', width: 100 },
|
||||
{ field: 'cate__dickeyname', title: '类别', width: 80 },
|
||||
|
@ -189,22 +215,24 @@
|
|||
{ field: 'udate', title: '投用日期', width: 80 },
|
||||
{ field: 'place', title: '所属地点', width: 80 },
|
||||
{ field: 'area__name', title: '区域', width: 80 },
|
||||
{ field: 'state', title: '运行状态', width: 50, styler: function (value, row, index) {
|
||||
{
|
||||
field: 'state', title: '运行状态', width: 50, styler: function (value, row, index) {
|
||||
if (value == 1) {
|
||||
return 'background-color:green;color:white';
|
||||
}else{ return 'background-color:red;'; }
|
||||
} else { return 'background-color:red;'; }
|
||||
}, formatter: function (value, row, index) {
|
||||
if (value == 1) {
|
||||
return '正常';
|
||||
}else{return '异常'}
|
||||
} },
|
||||
|
||||
} else { return '异常' }
|
||||
}
|
||||
},
|
||||
{ field: 'checkform__name', title: '检查表', width: 80 },
|
||||
|
||||
]],
|
||||
onSelect: function (index, data) {
|
||||
if($('#b_equipment_change').length){
|
||||
if ($('#b_equipment_change').length) {
|
||||
$('#savesb').show()
|
||||
}else{
|
||||
} else {
|
||||
$('#savesb').hide()
|
||||
}
|
||||
$('#qrimg').empty()
|
||||
|
@ -223,40 +251,46 @@
|
|||
$('#area').combotree('setValue', res.area__id)
|
||||
$('#zrbm').combotree('setValue', res.zrbm__partid)
|
||||
$('#fxdinput').val(res.riskact__id)
|
||||
$('#fxdspan').css('color','blue')
|
||||
$('#fxdspan').html(' '+res.riskact__name)
|
||||
if(res.riskact__name==undefined){
|
||||
$('#fxdspan').css('color','red')
|
||||
$('#fxdspan').css('color', 'blue')
|
||||
$('#fxdspan').html(' ' + res.riskact__name)
|
||||
if (res.riskact__name == undefined) {
|
||||
$('#fxdspan').css('color', 'red')
|
||||
$('#fxdspan').html(' 未绑定')
|
||||
}
|
||||
$('#zrr').combobox({ url: 'getuser?partid=' + res.zrbm__partid + '&a=combobox', }).combobox('setValue', res.zrr__userid)
|
||||
if (res.iskey == 1) {
|
||||
$('#iskey').prop("checked", true);
|
||||
}else{$('#iskey').prop("checked", false);}
|
||||
} else { $('#iskey').prop("checked", false); }
|
||||
if (res.istz == 1) {
|
||||
$('#istz').prop("checked", true);
|
||||
}else{$('#istz').prop("checked", false);}
|
||||
} else { $('#istz').prop("checked", false); }
|
||||
// $('#qrimg').qrcode({
|
||||
// "render": "canvas",
|
||||
// "size": 200,
|
||||
// "text": 'https://safeyun.ctcshe.com/miniprogram/equipmentdetail?id='+res.id.toString()
|
||||
// });
|
||||
$('#qrimg').attr('src',res.qrcode)
|
||||
$('#qrimg').attr('src', res.qrcode)
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
//ajax接收的才是js对象
|
||||
function delsb() {
|
||||
var row = $('#sbtable').datagrid('getSelected');
|
||||
if (row) {
|
||||
var row = $('#sbtable').datagrid('getSelections');
|
||||
let ids = []
|
||||
for (i = 0; i < row.length; i++) {
|
||||
ids.push(row[i].id)
|
||||
}
|
||||
if (ids.length) {
|
||||
$.messager.confirm('提示', '确定删除吗?', function (r) {
|
||||
if (r) {
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: 'api/equipment?a=del&id=' + row.id,
|
||||
type: "POST",
|
||||
url: 'api/equipment?a=del',
|
||||
data: JSON.stringify({ ids: ids }),
|
||||
datatype: "json",
|
||||
beforeSend: function () { },
|
||||
contentType: "application/json;charset=utf-8",
|
||||
success: function (data) {
|
||||
if (data.code == 1) {
|
||||
$("#sbtable").datagrid('reload');
|
||||
|
@ -281,24 +315,24 @@
|
|||
$.messager.alert('提示', '未选择数据!');
|
||||
}
|
||||
}
|
||||
function sbsearch(){
|
||||
function sbsearch() {
|
||||
var querydata = $('#searchsbff').serializeJSON();
|
||||
//let url = 'api/miss?a=exportexcel&'+parseParams(querydata)
|
||||
$('#sbtable').datagrid('load',querydata);
|
||||
$('#sbtable').datagrid('load', querydata);
|
||||
//$('<form method="post" action="' + url + '"></form>').appendTo('body').submit().remove();
|
||||
}
|
||||
function exportsbexcel() {
|
||||
var querydata = $('#searchsbff').serializeJSON();
|
||||
let url = 'api/equipment?a=listall&b=exportexcel&'+parseParams(querydata)
|
||||
let url = 'api/equipment?a=listall&b=exportexcel&' + parseParams(querydata)
|
||||
$('<form method="post" action="' + url + '"></form>').appendTo('body').submit().remove();
|
||||
}
|
||||
function addsb(){
|
||||
function addsb() {
|
||||
$('#sbff').form('clear')
|
||||
$('#sbtable').datagrid('clearSelections');
|
||||
$('#qrimg').attr('src','')
|
||||
|
||||
$('#qrimg').attr('src', '')
|
||||
|
||||
}
|
||||
function savesb(){
|
||||
function savesb() {
|
||||
var data = $('#sbff').serializeJSON();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
|
@ -342,7 +376,7 @@
|
|||
});
|
||||
}
|
||||
else if (data.code == 2) {
|
||||
$.messager.alert('提示', data.msg+data.info, 'info', function () {
|
||||
$.messager.alert('提示', data.msg + data.info, 'info', function () {
|
||||
$("#main").panel({ href: 'html/equipment', title: '用户' });
|
||||
});
|
||||
}
|
||||
|
@ -354,9 +388,37 @@
|
|||
}; //请求完成
|
||||
xhr.onerror = function (evt) { $.messager.alert('提示', '失败!文件内容有误'); document.getElementById('drfile').value = ''; }; //请求失败
|
||||
}
|
||||
function choosefxd(){
|
||||
function choosefxd() {
|
||||
var myh = screen.availHeight * 0.8;
|
||||
var area = $('#area').combotree('getValue')
|
||||
opendg('选择风险点','html/riskact/chose?area='+area,myh)
|
||||
opendg('选择风险点', 'html/riskact/chose?area=' + area, myh)
|
||||
}
|
||||
function savejcb() {
|
||||
var row = $('#sbtable').datagrid('getSelections');
|
||||
let ids = []
|
||||
for (i = 0; i < row.length; i++) {
|
||||
ids.push(row[i].id)
|
||||
}
|
||||
if (ids.length) {
|
||||
let form = $('#checkform').combobox('getValue')
|
||||
let data = { 'ids': ids, 'form': form }
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: 'api/equipment?a=bindjcb',
|
||||
data: JSON.stringify(data),
|
||||
datatype: "json",
|
||||
processData: false,
|
||||
contentType: "application/json;charset=utf-8",
|
||||
beforeSend: function () {
|
||||
},
|
||||
success: function (data) {
|
||||
$("#sbtable").datagrid('reload');
|
||||
$('#bindjcbdg').dialog('close')
|
||||
},
|
||||
});
|
||||
} else {
|
||||
$.messager.alert('提示', '未选择数据');
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,159 @@
|
|||
<div class="easyui-layout" style="width:100%;height:100%;">
|
||||
<div data-options="region:'center',split:true,border:false" style="width:50%;height:100%;">
|
||||
<table id="jcbtable" style="width:auto;height:100%;"></table>
|
||||
</div>
|
||||
<div data-options="region:'east',split:true,border:false" style="width:50%;height:100%;">
|
||||
<form style="margin: 10px;" id="checkform">
|
||||
<div style="margin-bottom:5px">
|
||||
<input id="name" class="easyui-textbox" name="name" style="width:100%;" data-options="label:'名称'"
|
||||
readonly />
|
||||
</div>
|
||||
<div style="margin-bottom:5px">
|
||||
<input id="desc" class="easyui-textbox" name="desc" style="width:100%;height:100px" data-options="label:'功能描述',multiline:true"
|
||||
readonly />
|
||||
</div>
|
||||
<div class="labeldiv">检查条目</div>
|
||||
<table width=100% class='detailtable'>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
检查项目
|
||||
</th>
|
||||
<th>
|
||||
检查内容
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="itemsbodydetail">
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div id="jcbtablebar" style="padding:6px;height:auto">
|
||||
<div style="margin-bottom:2px;margin-top:2px">
|
||||
|
||||
|
||||
{% load myfilter %}
|
||||
{% if request|has_permission:'b_exampaper_zujuan' %}
|
||||
<a id="addjcb" class="easyui-linkbutton" onclick="addjcb()" data-options="iconCls: 'fa-plus',plain:true">新建检查表</a>
|
||||
{% endif %}
|
||||
{% if request|has_permission:'b_exampaper_upd' %}
|
||||
<a id="editjcb" class="easyui-linkbutton" onclick="editjcb()" data-options="iconCls: 'fa-pencil',plain:true">编辑检查表</a>
|
||||
{% endif %}
|
||||
{% if request|has_permission:'b_exampaper_del' %}
|
||||
<a id="deljcb" class="easyui-linkbutton" onclick="deljcb()" data-options="iconCls: 'fa-trash',plain:true">删除</a>
|
||||
{% endif %}
|
||||
{% if request|has_permission:'b_exampaper_daochu' %}
|
||||
<a id="exportjcb" onclick="exportjcb()" class="easyui-linkbutton" data-options="iconCls: 'fa-download',plain:true">导出Word</a>
|
||||
{% endif %}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$('#jcbtable').datagrid({
|
||||
url: 'api/equipmentcheckform',
|
||||
rownumbers: true,
|
||||
singleSelect: true,
|
||||
striped: true,
|
||||
fitColumns: true,
|
||||
method: 'get',
|
||||
//pagination: 'true',
|
||||
// pageSize: 20,
|
||||
toolbar: '#jcbtablebar',
|
||||
border:false,
|
||||
columns: [[
|
||||
{ field: 'id', title: 'ID', hidden: true },
|
||||
{ field: 'name', title: '检查表名称', width: 200 },
|
||||
{ field: 'desc', title: '检查表描述', width: 400 },
|
||||
{ field: 'createby', title: '创建人', width: 100,formatter: function (value, row, index) {
|
||||
if(value){
|
||||
return value.name
|
||||
}
|
||||
} },
|
||||
]],
|
||||
onSelect: function (index,data) {
|
||||
$.get('api/equipmentcheckform/'+data.id,function(res){
|
||||
$('#checkform').form('load',res)
|
||||
let html = ''
|
||||
for(var i=0;i<res.items.length;i++){
|
||||
html = html + '<tr ><th>'+res.items[i].name+'</th><th>'+res.items[i].content+'</th><tr>'
|
||||
}
|
||||
$('#itemsbodydetail').html(html)
|
||||
})}
|
||||
});
|
||||
function addjcb(){
|
||||
opendg('新建检查表','html/equipmentcheckform/add')
|
||||
}
|
||||
function editjcb(){
|
||||
var row = $('#jcbtable').datagrid('getSelected');
|
||||
if (row) {
|
||||
opendg('编辑检查表','html/equipmentcheckform/update/'+row.id)
|
||||
}
|
||||
else {
|
||||
$.messager.alert('提示', '请选择一行数据!');
|
||||
}
|
||||
|
||||
}
|
||||
function deljcb(){
|
||||
var row = $('#jcbtable').datagrid('getSelected');
|
||||
if (row) {
|
||||
$.messager.confirm('提示', '确定删除吗?', function (r) {
|
||||
if (r) {
|
||||
$.ajax({
|
||||
type: "DELETE",
|
||||
url: 'api/equipmentcheckform/'+row.id,
|
||||
datatype: "json",
|
||||
beforeSend: function () { },
|
||||
success: function (data,status,xhr) {
|
||||
if (xhr.status == 204) {
|
||||
$("#jcbtable").datagrid('reload');
|
||||
}
|
||||
else {
|
||||
$.messager.alert('提示', '你无权删除该条记录!');
|
||||
}
|
||||
},
|
||||
complete: function (XMLHttpRequest, textStatus) {
|
||||
},
|
||||
error: function () {
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
else {
|
||||
$.messager.alert('提示', '请选择一行数据!');
|
||||
}
|
||||
}
|
||||
|
||||
function editsj(){
|
||||
var row = $('#sjtable').datagrid('getSelected');
|
||||
if (row) {
|
||||
var url = 'html/exampaper/edit/' + row.id
|
||||
var myw = screen.availWidth * 0.7;
|
||||
opendg('编辑试卷',url,myw)
|
||||
}
|
||||
else { $.messager.alert('提示', '请选择一行数据!'); }
|
||||
}
|
||||
function exportsjword() {
|
||||
var row = $('#sjtable').datagrid('getSelected');
|
||||
if (row) {
|
||||
var url = 'api/exampaper?a=exportword&id=' + row.id
|
||||
$('<form method="post" action="' + url + '"></form>').appendTo('body').submit().remove();
|
||||
}
|
||||
else { $.messager.alert('提示', '请选择一张考卷!'); }
|
||||
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,81 @@
|
|||
<div class="easyui-layout" style="width:100%;height:100%;">
|
||||
<div data-options="region:'center'" style="height:100%;padding:15px 15px;">
|
||||
<form id="jcbff" method="post" name="jcbff" enctype="multipart/form-data">
|
||||
<div style="margin-bottom:5px">
|
||||
<input id="name" class="easyui-textbox validatebox" name="name" style="width:100%;" data-options="label:'名称'"
|
||||
required=true />
|
||||
</div>
|
||||
<div style="margin-bottom:5px">
|
||||
<input id="desc" class="easyui-textbox validatebox" name="desc" style="width:100%;height:80px" data-options="label:'功能描述',multiline:true"
|
||||
required=true />
|
||||
</div>
|
||||
<div class="labeldiv">配置检查条目</div>
|
||||
<table width=100% rules=all>
|
||||
<thead>
|
||||
<tr>
|
||||
<th >
|
||||
|
||||
</th>
|
||||
<th width="40%">
|
||||
检查项目
|
||||
</th>
|
||||
<th width="60%">
|
||||
检查具体内容
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="itemsbody">
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<a class="easyui-linkbutton" iconCls="fa-plus" onclick="additems()">添加检查项目</a>
|
||||
</form>
|
||||
</div>
|
||||
<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="jcbsubmitForm()"
|
||||
id="submitb">保存</a>
|
||||
<a href="javascript:void(0)" iconCls="fa-close" class="easyui-linkbutton" onclick="closeForm()">取消</a>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
function delitem(o){
|
||||
$(o).parent().parent().remove()
|
||||
}
|
||||
function additems(){
|
||||
$("#itemsbody").append('<tr class="items"><th><button onclick="delitem(this)">删</button></th><th><input class="easyui-textbox name" style="width:90%;height:40px" data-options="multiline:true"/></th><th><input class="easyui-textbox content" style="width:100%;height:40px" data-options="multiline:true"/></th><tr>')
|
||||
|
||||
}
|
||||
function jcbsubmitForm(){
|
||||
var items = new Array();
|
||||
$(".items").each(function () {
|
||||
let name = $(this).find("input.name").val()
|
||||
let content = $(this).find("input.content").val()
|
||||
items.push({'name':name,'content':content})
|
||||
});
|
||||
var data = $('#jcbff').serializeJSON();
|
||||
data['items']=items
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: 'api/equipmentcheckform',
|
||||
data: JSON.stringify(data),
|
||||
datatype: "json",
|
||||
processData: false,
|
||||
contentType: "application/json;charset=utf-8",
|
||||
beforeSend: function () {
|
||||
var bo = $('#jcbff').form('validate')
|
||||
if (bo == false) {
|
||||
return bo
|
||||
} else {
|
||||
// $('#submitb').linkbutton('disable');
|
||||
}
|
||||
},
|
||||
success: function (data) {
|
||||
if (data.code == 200) {
|
||||
$('#jcbtable').datagrid('reload');
|
||||
$("#dd").dialog("close");
|
||||
} else { $.messager.alert('提示', '失败!'+data.msg); }
|
||||
// $('#submitb').linkbutton('enable');
|
||||
},
|
||||
});
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,92 @@
|
|||
<div class="easyui-layout" style="width:100%;height:100%;">
|
||||
<div data-options="region:'center'" style="height:100%;padding:15px 15px;">
|
||||
<form id="jcbff" method="post" name="jcbff" enctype="multipart/form-data">
|
||||
<input type=hidden name="id" value={{pk}}>
|
||||
<div style="margin-bottom:5px">
|
||||
<input id="name" class="easyui-textbox validatebox" name="name" style="width:100%;" data-options="label:'名称'"
|
||||
required=true />
|
||||
</div>
|
||||
<div style="margin-bottom:5px">
|
||||
<input id="desc" class="easyui-textbox validatebox" name="desc" style="width:100%;height:80px" data-options="label:'功能描述',multiline:true"
|
||||
required=true />
|
||||
</div>
|
||||
<div class="labeldiv">配置检查条目</div>
|
||||
<table width=100% rules=all>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
|
||||
</th>
|
||||
<th width=40%>
|
||||
检查项目
|
||||
</th>
|
||||
<th width=60%>
|
||||
检查具体内容
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="itemsbody">
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<a class="easyui-linkbutton" iconCls="fa-plus" onclick="additems()">添加检查项目</a>
|
||||
</form>
|
||||
</div>
|
||||
<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="jcbsubmitForm()"
|
||||
id="submitb">保存</a>
|
||||
<a href="javascript:void(0)" iconCls="fa-close" class="easyui-linkbutton" onclick="closeForm()">取消</a>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$.get('api/equipmentcheckform/'+{{pk}},function(res){
|
||||
$('#jcbff').form('load',res)
|
||||
let html = ''
|
||||
for(var i=0;i<res.items.length;i++){
|
||||
html = html + '<tr class="items" pk='+res.items[i].id+'><th><button onclick="delitem(this)">删</button></th><th><input class="easyui-textbox name" style="width:90%;height:40px" data-options="multiline:true" value="'+res.items[i].name+'"/></th><th><input class="easyui-textbox content" style="width:100%;height:40px" data-options="multiline:true" value="'+res.items[i].content+'"/></th><tr>'
|
||||
}
|
||||
$('#itemsbody').html(html)
|
||||
})
|
||||
function delitem(o){
|
||||
$(o).parent().parent().remove()
|
||||
}
|
||||
function additems(){
|
||||
$("#itemsbody").append('<tr class="items" pk=0><th><button onclick="delitem(this)">删</button></th><th><input class="easyui-textbox name" style="width:90%;height:40px" data-options="multiline:true"/></th><th><input class="easyui-textbox content" style="width:100%;height:40px" data-options="multiline:true"/></th><tr>')
|
||||
|
||||
}
|
||||
function jcbsubmitForm(){
|
||||
var items = new Array();
|
||||
$(".items").each(function () {
|
||||
let id = $(this).attr('pk')
|
||||
let name = $(this).find(".name").val()
|
||||
let content = $(this).find(".content").val()
|
||||
items.push({'id':id,'name':name,'content':content})
|
||||
});
|
||||
//console.log(items)
|
||||
var data = $('#jcbff').serializeJSON();
|
||||
data['items']=items
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: 'api/equipmentcheckform',
|
||||
data: JSON.stringify(data),
|
||||
datatype: "json",
|
||||
processData: false,
|
||||
contentType: "application/json;charset=utf-8",
|
||||
beforeSend: function () {
|
||||
var bo = $('#jcbff').form('validate')
|
||||
if (bo == false) {
|
||||
return bo
|
||||
} else {
|
||||
// $('#submitb').linkbutton('disable');
|
||||
}
|
||||
},
|
||||
success: function (data) {
|
||||
if (data.code == 200) {
|
||||
$('#jcbtable').datagrid('reload');
|
||||
$("#dd").dialog("close");
|
||||
} else { $.messager.alert('提示', '失败!'+data.msg); }
|
||||
// $('#submitb').linkbutton('enable');
|
||||
},
|
||||
});
|
||||
}
|
||||
</script>
|
|
@ -376,16 +376,19 @@ float: left;">
|
|||
});
|
||||
</script>
|
||||
|
||||
{% load myfilter %}
|
||||
{% if request|has_permission:'m_area' %}
|
||||
<script>
|
||||
var data=JSON.parse(localStorage.getItem("data"));
|
||||
bindmap9('gzbqst')
|
||||
if(data.rights.indexOf(30)!=-1){ //有无地图功能
|
||||
$('#panelxdiv').show()
|
||||
$('#panelxdiv').show()
|
||||
$('#panelx').panel({
|
||||
href:'html/mapshow',
|
||||
title:'地图展示'
|
||||
})
|
||||
}
|
||||
</script>
|
||||
{% endif %}
|
||||
<script>
|
||||
bindmap9('gzbqst')
|
||||
|
||||
$("#sfxbm").combotree({
|
||||
url: 'parthandle?a=tree',
|
||||
editable: false,
|
||||
|
|
|
@ -30,20 +30,14 @@
|
|||
loadFilter: function (rows) {
|
||||
return convert(rows);
|
||||
},
|
||||
formatter: function (node) {
|
||||
var s = node.text;
|
||||
if (node.children) {
|
||||
s += ' <span style=\'color:blue\'>(' + node.children.length + ')</span>';
|
||||
}
|
||||
return s;
|
||||
},"/>
|
||||
" />
|
||||
<label>风险点类型</label>
|
||||
<input class="easyui-combobox" name="type" data-options="url: 'getdickey?dicclass=53&a=combobox'," editable=false/>
|
||||
<a onclick="searchriskact()" class="easyui-linkbutton" data-options="iconCls: 'fa-search',plain:true">查询</a>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<table id="riskacttable" style="height:100%;"></table>
|
||||
<table id="riskacttable" style="height:100%;width:100%"></table>
|
||||
</div>
|
||||
<div data-options="region:'center',title:'风险',split:true,border:false" style="width:50%;height:100%;">
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from django.urls import path,include
|
||||
from . import views
|
||||
from . import views,viewsdrf
|
||||
from . import datashowview
|
||||
from django.conf import settings
|
||||
from django.conf.urls.static import static
|
||||
|
@ -100,6 +100,9 @@ urlpatterns = [
|
|||
path('html/addoperproce',views.addoperproce),
|
||||
path('html/operproce/detail/<int:id>/',views.operprocedetail),#责任制度观看详情
|
||||
path('html/datashow2/',views.datashow2),
|
||||
path('html/equipmentcheckform/',views.EquipmentCheckFormView.as_view()),
|
||||
path('html/equipmentcheckform/add',views.EquipmentCheckFormAddView.as_view()),
|
||||
path('html/equipmentcheckform/update/<int:pk>',views.EquipmentCheckFormUpdateView.as_view()),
|
||||
#html页面
|
||||
|
||||
|
||||
|
@ -169,6 +172,18 @@ urlpatterns = [
|
|||
# path('api/examtj',views.examtj),
|
||||
path('api/check_session',views.check_session),
|
||||
path('api/equipmentfig',views.equipmentfig),#设备统计图
|
||||
|
||||
path('api/equipmentcheckform',viewsdrf.EquipmentCheckFormAPIView.as_view()),
|
||||
path('api/equipmentcheckform/<int:pk>',viewsdrf.EquipmentCheckFormDetailView.as_view()),
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#path('api/rights/group/<int:groupid>',views.rightsgroup),
|
||||
path('api/main',views.mainapi),
|
||||
path('bindwechat', views.bwlogin,name='bwlogin'), #微信登陆绑定相关
|
||||
|
|
|
@ -3,11 +3,12 @@ from captcha.helpers import captcha_image_url
|
|||
from captcha.models import CaptchaStore
|
||||
from django.shortcuts import render, redirect, render_to_response
|
||||
from django.http import HttpResponse, HttpResponseRedirect, JsonResponse
|
||||
from .models import User, Trouble, Dickey, Partment, Dicclass, Train, Drill, TroubleAccess, Group, Yjyc, Trainuser, Drilluser, Yjsetup, Menu, Observe, Observeto, Unsafes, Miss, Socertificate, Userprofile, Suggest, Notice, Noticeto, Operation, Operzyry, Fxcs, Operationspjd, Operspxq, Question, ExamPaper, ExamTest, ExamPaperDetail, ExamTestDetail, Questioncat, Safecert, Map, Area, Missto, Suggestflow, Equipment, Inspect, Risk, RiskAct, Risktask, Riskcheck, Report, RiskActTask, Riskcheck2,Resbility,Operproce,Readerblility,ReaderOperproce,Role
|
||||
from .models import User, Trouble, Dickey, Partment, Dicclass, Train, Drill, TroubleAccess, Group, Yjyc, Trainuser, Drilluser, Yjsetup, Menu, Observe, Observeto, Unsafes, Miss, Socertificate, Userprofile, Suggest, Notice, Noticeto, Operation, Operzyry, Fxcs, Operationspjd, Operspxq, Question, ExamPaper, ExamTest, ExamPaperDetail, ExamTestDetail, Questioncat, Safecert, Map, Area, Missto, Suggestflow, Equipment, Inspect, Risk, RiskAct, Risktask, Riskcheck, Report, RiskActTask, Riskcheck2,Resbility,Operproce,Readerblility,ReaderOperproce,Role,EquipmentCheckForm,EquipmentCheckItem
|
||||
from django.template import RequestContext
|
||||
from django.views.decorators.csrf import csrf_exempt
|
||||
from django.core import serializers
|
||||
from django.conf import settings
|
||||
from django.views.generic import TemplateView
|
||||
from .forms import UserForm
|
||||
import json
|
||||
from uuid import UUID
|
||||
|
@ -149,7 +150,14 @@ def upfile(req):
|
|||
return JsonResponse({"code": 1, "filename": file_name, "filepath": filepath})
|
||||
|
||||
# html页面
|
||||
class EquipmentCheckFormUpdateView(TemplateView):
|
||||
template_name='equipmentcheckformupdate.html'
|
||||
|
||||
class EquipmentCheckFormAddView(TemplateView):
|
||||
template_name='equipmentcheckformadd.html'
|
||||
|
||||
class EquipmentCheckFormView(TemplateView):
|
||||
template_name='equipmentcheckform.html'
|
||||
|
||||
def riskas(req):
|
||||
return render(req, 'riskas.html')
|
||||
|
@ -527,16 +535,16 @@ def init_permission(user,req):
|
|||
permission_dict = {}
|
||||
x = []
|
||||
if user.issuper==1:
|
||||
x = Group.objects.filter(grouptype=0,usecomp=user.usecomp)[0].menulist
|
||||
menus = user.usecomp.role.permissions.all()
|
||||
else:
|
||||
bgroups = user.userg.filter(usecomp=user.usecomp) #所属公司的用户组
|
||||
for i in bgroups:
|
||||
x.extend(i.menulist)
|
||||
menus = Menu.objects.exclude(menuid__in=[11, 9]).filter(menuid__in=list(set(x)), deletemark=1)
|
||||
menus = Menu.objects.exclude(menuid__in=[11, 9]).filter(menuid__in=list(set(x)), deletemark=1)
|
||||
for item in menus:
|
||||
permission_dict[item.menucode] = ({
|
||||
'url':item.url,
|
||||
'parentid':item.parentid.menuid,
|
||||
'parentid':item.parentid.menuid if item.parentid else None,
|
||||
'id': item.menuid,
|
||||
'name': item.menuname,
|
||||
})
|
||||
|
@ -859,9 +867,8 @@ def apirights(req):
|
|||
return JsonResponse({"code": 1})
|
||||
elif a == 'have':
|
||||
userid = req.session['userid']
|
||||
companyid = getcompany(userid)
|
||||
allrights = Group.objects.get(
|
||||
usecomp__partid=companyid, grouptype=0).menulist
|
||||
user = User.objects.get(userid=userid)
|
||||
allrights = list(user.usecomp.role.permissions.all().values_list('menuid',flat=True))
|
||||
return JsonResponse({'code': 1, 'rights': allrights})
|
||||
|
||||
|
||||
|
@ -4766,7 +4773,13 @@ def apitool(req):
|
|||
i.role=Role.objects.get(id=1)
|
||||
i.save()
|
||||
return JsonResponse({"code": 1})
|
||||
|
||||
elif a == 'correct_riskgroups':
|
||||
for i in Group.objects.filter(menulist__contains=[38]):
|
||||
menulist = i.menulist
|
||||
menulist.append(181)
|
||||
i.menulist = menulist
|
||||
i.save()
|
||||
return JsonResponse({"code": 1})
|
||||
def apinotice(req):
|
||||
a = req.GET.get('a')
|
||||
if a == 'add':
|
||||
|
@ -6277,7 +6290,7 @@ def apiequipment(req):
|
|||
total = objs.count()
|
||||
startnum, endnum = fenye(req)
|
||||
objs = objs.order_by('num')[startnum:endnum].values(
|
||||
'id', 'num', 'name', 'type', 'oem', 'udate', 'place', 'istz', 'iskey', 'state', 'cate__dickeyname', 'area__name')
|
||||
'id', 'num', 'name', 'type', 'oem', 'udate', 'place', 'istz', 'iskey', 'state', 'cate__dickeyname', 'area__name','checkform__name')
|
||||
return HttpResponse(transjson(total, objs), content_type="application/json")
|
||||
elif a == 'update':
|
||||
data = json.loads(req.body.decode('utf-8'))
|
||||
|
@ -6314,11 +6327,10 @@ def apiequipment(req):
|
|||
obj.save()
|
||||
return JsonResponse({"code": 1})
|
||||
elif a == 'del':
|
||||
id = req.GET.get('id')
|
||||
user = User.objects.get(userid=userid)
|
||||
a = Equipment.objects.get(id=id)
|
||||
if user.issuper == 1:
|
||||
a.delete()
|
||||
ids = json.loads(req.body.decode('utf-8'))['ids']
|
||||
Equipment.objects.filter(id__in=ids).delete()
|
||||
return JsonResponse({"code": 1})
|
||||
else:
|
||||
return JsonResponse({"code": 0})
|
||||
|
@ -6327,6 +6339,12 @@ def apiequipment(req):
|
|||
a = Equipment.objects.filter(id=id).values('id', 'num', 'name', 'type', 'oem', 'udate', 'fdate', 'fnum', 'place', 'istz', 'iskey', 'state', 'cate__dickeyname',
|
||||
'cate__dickeyid', 'parameter', 'img', 'area__name', 'area__id', 'zrbm__partid', 'zrr__userid', 'zrbm__partname', 'zrr__name', 'qrcode', 'riskact__name', 'riskact__id')
|
||||
return JsonResponse(a[0])
|
||||
elif a == 'bindjcb':
|
||||
data = json.loads(req.body.decode('utf-8'))
|
||||
ids = data['ids']
|
||||
form = EquipmentCheckForm.objects.get(id=data['form'])
|
||||
Equipment.objects.filter(id__in=ids).update(checkform=form)
|
||||
return JsonResponse({"code": 1})
|
||||
|
||||
|
||||
def apiinspect(req):
|
||||
|
@ -6438,9 +6456,9 @@ def apiriskact(req):
|
|||
companyid = getcompany(userid)
|
||||
if a == 'listall':
|
||||
a = RiskAct.objects.filter(usecomp__partid=companyid)
|
||||
if int(req.GET.get('area', 0)):
|
||||
if req.GET.get('area'):
|
||||
a = a.filter(area__id=req.GET.get('area'))
|
||||
if int(req.GET.get('type', 0)):
|
||||
if req.GET.get('type'):
|
||||
a = a.filter(type__dickeyid=req.GET.get('type'))
|
||||
total = a.count()
|
||||
startnum, endnum = fenye(req)
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
from .models import *
|
||||
from .serializers import *
|
||||
from rest_framework.views import APIView
|
||||
from rest_framework.response import Response
|
||||
from rest_framework import generics
|
||||
|
||||
class EquipmentCheckFormAPIView(APIView):
|
||||
|
||||
def get(self,request):
|
||||
userid = request.session['userid']
|
||||
usecomp = User.objects.get(userid=userid).usecomp
|
||||
queryset = EquipmentCheckForm.objects.filter(deletemark=1,usecomp=usecomp).order_by('-pk')
|
||||
total = queryset.count()
|
||||
serializer = EquipmentCheckFormSerializers(instance=queryset,many=True)
|
||||
ret = {'total':total,'rows':serializer.data}
|
||||
return Response(ret)
|
||||
|
||||
def post(self,request):
|
||||
userid = request.session['userid']
|
||||
user = User.objects.get(userid=userid)
|
||||
usecomp = user.usecomp
|
||||
id = request.data.get('id',0)
|
||||
instance = EquipmentCheckForm.objects.filter(id=id)
|
||||
reqdata = request.data
|
||||
serializer = EquipmentCheckFormSerializers(data=reqdata)
|
||||
if serializer.is_valid():
|
||||
if instance:
|
||||
serializer.update(instance,reqdata)
|
||||
for i in request.data['items']:
|
||||
serializerx = EquipmentCheckItemSerializers(data=i)
|
||||
if serializerx.is_valid():
|
||||
ins = EquipmentCheckItem.objects.filter(id=i['id'])
|
||||
if ins:
|
||||
serializerx.update(ins.first(),i)
|
||||
else:
|
||||
iteminstance = serializerx.save()
|
||||
EFormItems.objects.create(equipment_check_form=instance.first(),equipment_check_item=iteminstance)
|
||||
res = {'code':200,'msg':'success','data':{}}
|
||||
else:
|
||||
reqdata['usecomp'] = usecomp
|
||||
reqdata['createby'] = user
|
||||
if EquipmentCheckForm.objects.filter(name=reqdata['name'],usecomp=usecomp).exists():
|
||||
res = {'code':400,'msg':'同名表已存在','data':{}}
|
||||
else:
|
||||
forminstance = serializer.create(reqdata)
|
||||
for i in request.data['items']:
|
||||
serializerx = EquipmentCheckItemSerializers(data=i)
|
||||
if 'id' in i and i['id']:
|
||||
ins = EquipmentCheckItem.objects.filter(id=i['id']).first()
|
||||
if serializerx.is_valid():
|
||||
erializerx.update(ins,i)
|
||||
|
||||
else:
|
||||
if serializerx.is_valid():
|
||||
iteminstance = serializerx.save()
|
||||
EFormItems.objects.create(equipment_check_form=forminstance,equipment_check_item=iteminstance)
|
||||
res = {'code':200,'msg':'success','data':{}}
|
||||
return Response(res)
|
||||
return Response({'code':404,'msg':'验证错误','data':serializer.errors}, status=404)
|
||||
|
||||
class EquipmentCheckFormDetailView(generics.RetrieveUpdateDestroyAPIView):
|
||||
queryset = EquipmentCheckForm.objects.all()
|
||||
serializer_class = EquipmentCheckFormSerializers
|
||||
|
Loading…
Reference in New Issue