combobox update

This commit is contained in:
caoqianming 2020-08-30 23:16:36 +08:00
parent e65e5f2fe6
commit a5e9857c65
7 changed files with 70 additions and 6 deletions

View File

@ -0,0 +1,23 @@
# Generated by Django 2.2.8 on 2020-08-30 20:53
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('safesite', '0343_auto_20200812_2104'),
]
operations = [
# migrations.RemoveField(
# model_name='companyinfo',
# name='liaison_fax',
# ),
migrations.AddField(
model_name='eformitems',
name='type',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='safesite.Dickey'),
),
]

View File

@ -0,0 +1,27 @@
# Generated by Django 2.2.8 on 2020-08-30 22:43
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('safesite', '0344_auto_20200830_2053'),
]
operations = [
# migrations.RemoveField(
# model_name='companyinfo',
# name='liaison_fax',
# ),
migrations.RemoveField(
model_name='eformitems',
name='type',
),
migrations.AddField(
model_name='equipmentcheckitem',
name='type',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='safesite.Dickey'),
),
]

View File

@ -884,6 +884,7 @@ class RiskAct(models.Model): # 风险点表
class EquipmentCheckItem(models.Model):# 检查项目 class EquipmentCheckItem(models.Model):# 检查项目
name = models.CharField(max_length=200,verbose_name='检查项目') name = models.CharField(max_length=200,verbose_name='检查项目')
content = models.CharField(max_length=400,verbose_name='检查内容') content = models.CharField(max_length=400,verbose_name='检查内容')
type = models.ForeignKey(Dickey, on_delete=models.CASCADE, null=True, blank=True)
class EquipmentCheckForm(models.Model):# 检查表 class EquipmentCheckForm(models.Model):# 检查表
name = models.CharField(max_length=200,verbose_name='名称') name = models.CharField(max_length=200,verbose_name='名称')
@ -899,6 +900,7 @@ class EquipmentCheckForm(models.Model):# 检查表
class EFormItems(models.Model): class EFormItems(models.Model):
equipment_check_form = models.ForeignKey(EquipmentCheckForm,on_delete=models.CASCADE) equipment_check_form = models.ForeignKey(EquipmentCheckForm,on_delete=models.CASCADE)
equipment_check_item = models.ForeignKey(EquipmentCheckItem,on_delete=models.CASCADE) equipment_check_item = models.ForeignKey(EquipmentCheckItem,on_delete=models.CASCADE)
submittime = models.DateField(default=timezone.now) submittime = models.DateField(default=timezone.now)
class Equipment(models.Model): # 设备表 class Equipment(models.Model): # 设备表

View File

@ -95,12 +95,14 @@
})} })}
}); });
function addjcb(){ function addjcb(){
opendg('新建检查表','html/equipmentcheckform/add') var myw = screen.availWidth * 0.6;
opendg('新建检查表','html/equipmentcheckform/add', myw)
} }
function editjcb(){ function editjcb(){
var row = $('#jcbtable').datagrid('getSelected'); var row = $('#jcbtable').datagrid('getSelected');
if (row) { if (row) {
opendg('编辑检查表','html/equipmentcheckform/update/'+row.id) var myw = screen.availWidth * 0.6;
opendg('编辑检查表','html/equipmentcheckform/update/'+row.id, myw)
} }
else { else {
$.messager.alert('提示', '请选择一行数据!'); $.messager.alert('提示', '请选择一行数据!');

View File

@ -16,12 +16,16 @@
<th > <th >
</th> </th>
<th width="40%"> <th width="35%">
检查项目 检查项目
</th> </th>
<th width="15%">
检查类型
</th>
<th width="60%"> <th width="60%">
检查具体内容 检查具体内容
</th> </th>
</tr> </tr>
</thead> </thead>
<tbody id="itemsbody"> <tbody id="itemsbody">
@ -42,7 +46,13 @@
$(o).parent().parent().remove() $(o).parent().parent().remove()
} }
function additems(){ 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>') var index =$("#itemsbody>tr").length;
var tr=$('<tr class="items" id="item'+index+'"></tr>');
tr.append($('<th><button onclick="delitem(this)"></button></th><th><input class="easyui-textbox name" style="width:100%;height:40px" data-options="multiline:true"/></th><th><input class="easyui-combobox type" ></input></th><th><input class="easyui-textbox content" style="width:100%;height:40px" data-options="multiline:true"/></th>'))
$("#itemsbody").append(tr);
$.parser.parse(tr);
//$("#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-combobox type" ></input></th><th><input class="easyui-textbox content" style="width:100%;height:40px" data-options="multiline:true"/></th><tr>')
//$("#xxi").combobox()
} }
function jcbsubmitForm(){ function jcbsubmitForm(){

View File

@ -51,7 +51,7 @@
$(o).parent().parent().remove() $(o).parent().parent().remove()
} }
function additems(){ 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>') $("#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><th></th><tr>')
} }
function jcbsubmitForm(){ function jcbsubmitForm(){

View File

@ -22,7 +22,7 @@ class EquipmentCheckFormAPIView(APIView):
id = request.data.get('id',0) id = request.data.get('id',0)
instance = EquipmentCheckForm.objects.filter(id=id) instance = EquipmentCheckForm.objects.filter(id=id)
reqdata = request.data reqdata = request.data
serializer = EquipmentCheckItemSerializer(data=reqdata) serializer = EquipmentCheckFormSerializers(data=reqdata)
if serializer.is_valid(): if serializer.is_valid():
if instance: if instance:
serializer.update(instance,reqdata) serializer.update(instance,reqdata)