//deom1
//date-name="Property_QtyFail"
//自定义选择器(名称随便)="选择器值"
<input name="QtyFail" date-name="Property_QtyFail" onchange="changeBadNumber(this)" class="inputbox" style="width:50px;" value="@(inspectionDetail.BadQty)" disabled />
//JS
var inupt_QtyFail = $("input[date-name='Property_QtyFail']");//不良数
inupt_QtyFail[0].value;
function changeBadNumber(that) {
var value = $(that).val();
if (value == "") {
return false;
}
//刷新合格数 SamplingSize QualifiedNumber
var badAcceptanceQty = parseInt($(that).parent().parent().find("td[name='BadAcceptance']").text());
var badRejectionQty = parseInt($(that).parent().parent().find("td[name='BadRejection']").text());
var inspectionQty = $(that).parent().parent().find("td[name='SamplingSize']").text();
var qualifiedQty = parseInt(inspectionQty) - parseInt(value);
if (qualifiedQty < 0) {
$(that).parent().parent().find("td[name='QualifiedQty']").find('input').val('0');
}
else {
$(that).parent().parent().find("td[name='QualifiedQty']").find('input').val(qualifiedQty);
}
if (value <= badAcceptanceQty) {
$(that).parent().parent().find("td[name='InspectionSectionConclusion']").find('input').val('@Html.Raw(Label.Pass)');
$(that).parent().parent().find("td[name='InspectionSectionConclusion']").find('input').change();
}
else {
$(that).parent().parent().find("td[name='InspectionSectionConclusion']").find('input').val('@Html.Raw(Label.Failure)');
$(that).parent().parent().find("td[name='InspectionSectionConclusion']").find('input').change();
}
}
//deom2
//data-type定义选择器 ;data存值
//data-type="GroupAttr" data="@(inspectionDetail.GroupAttr)"
<input id="txt" data-type="GroupAttr" data="@(inspectionDetail.GroupAttr)" name="@inspectionDetail.GroupName" CodeName="@detail.InspectionItems.CodeName" iscollect="N" value="@(inspectionCollectionDetail.Count == 0 ? " " : inspectionCollectionDetail.First().InspectionValue)" UpperLimit="@detail.InspectionItems.UpperLimit" LowerLimit="@detail.InspectionItems.LowerLimit" class="inputbox" inspectionOrder="@inspectionDetail.SortOrder" itemOrder="@detail.SortOrder" eachCollection="@detail.InspectionItems.EachCollection" onblur="calAnalysis(this)" />
//JS
function calAnalysis(that) {
//性能测试项
var GroupAttrType = $(that).parent().find("input[data-type='GroupAttr']").attr('data');
if ($(that).val() == "" || GroupAttrType=="@(Const.PERFORMANCEL_INSPECTION)")
{
return;
}
var inspectionName = $(that).attr("CodeName");
var enterValue = parseFloat($(that).val());
var upperValue = parseFloat($(that).parent().find("i[name='upperLimit']").text());
var lowerValue = parseFloat($(that).parent().find("i[name='lowerLimit']").text());
//检测输入的值
if (enterValue != NaN && enterValue != undefined&&(enterValue > upperValue || enterValue < lowerValue)){
$(that).css('color', 'red');
}
else if (enterValue != NaN && enterValue != undefined && (lowerValue<= enterValue <= upperValue)) {
$(that).css('color', '');
}
}
网友评论