<!doctype html>
|
<html>
|
|
<head>
|
<meta charset="utf-8">
|
<title></title>
|
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
|
<script src="../../js/mui.min.js"></script>
|
<script src="../../js/api.js"></script>
|
<script src="../../js/common.js"></script>
|
<script src="../../js/jquery.js"></script>
|
<script src="../../js/jquery-1.11.1.js"></script>
|
<script src="../../js/jquery.xml2json.js.js"></script>
|
<script src="../../js/template-web.js"></script>
|
<link href="../../css/mui.min.css" rel="stylesheet" />
|
<link rel="stylesheet" type="text/css" href="../../css/iconfont.css" />
|
<link rel="stylesheet" type="text/css" href="../lyt/css/common_s.css" />
|
<style type="text/css">
|
.mui-input-group .mui-input-row {
|
height: 32px;
|
}
|
|
.mui-input-row label {
|
text-align: right;
|
width: 40%;
|
}
|
|
.mui-input-row label~input,
|
.mui-input-row label~select,
|
.mui-input-row label~textarea {
|
float: right;
|
width: 60%;
|
}
|
|
select {
|
background: url(../img/right-arrow.png) no-repeat right center;
|
/*background-color: #d5d5d5;*/
|
}
|
|
.result-dialog {
|
position: fixed;
|
margin-top: 1.51rem;
|
z-index: 999;
|
margin: 0 auto;
|
margin-top: 3.125rem;
|
border-radius: 0.75rem;
|
background-color: #f0f0f0;
|
}
|
</style>
|
</head>
|
|
<body class="mui-fullscreen" style="text-align:center;">
|
<header class="mui-bar mui-bar-nav">
|
<button type="button" class="mui-left mui-action-back mui-btn mui-btn-link mui-btn-nav mui-pull-left">
|
<span class="mui-icon mui-icon-left-nav"></span>
|
</button>
|
<h1 class="mui-title">不良录入</h1>
|
<button class="mui-btn mui-btn-primary btn-right" id="set_disabled">锁定</button>
|
<span class="title-right mui-icon mui-icon-bars" style="color:#0062CC;" id="recodeList"></span>
|
|
</header>
|
<dialog id="resultDialog" class="result-dialog" style="width: 90%;height: 60%;">
|
<!-- <p style="font-size: 16px;color: #000000;margin:0 auto;margin-top:1rem;width: 8.375rem;"><span>其他不良项目</span></p> -->
|
<div class="mui-input-row mui-search" style="color: #000000;margin:0 auto;margin-top:1rem;width: 20rem;">
|
<input type="search" class="mui-input-clear" id="search_word" placeholder="请输入查询关键字">
|
</div>
|
<div style="display: flex;flex-wrap: wrap;border-top:solid 2px #6081f9;height: 82%;overflow:auto;" id="other_def_list">
|
<script id='other-def-template' type="text/template">
|
<% for(var i in record){ var item=record[i];%>
|
<div class="mui-col-sm-3 def-other-item" id="oth_def<%=(i)%>"
|
onclick="seletDefOtherItemAsBtn('<%=(item.DEFECT_NAME)%>','<%=(item.DEFECT_CODE)%>','<%=(i)%>')">
|
<p class="def-other-p"><%=(item.DEFECT_NAME)%></p>
|
</div>
|
<% } %>
|
</script>
|
</div>
|
<div class="mui-button-row">
|
<button type="reset" class="mui-btn" onclick="document.getElementById('resultDialog').style.display = 'none';">关闭</button>
|
</div>
|
</dialog>
|
<div class="mui-content">
|
<div class="mui-row" style="margin: 0.2875rem;">
|
<div class="mui-col-sm-6 mui-col-xs-12" style="border-bottom:solid 2px #6081f9">
|
<div class="mui-input-row">
|
<label style="width: 30%;">工序线体:</label>
|
<input type="text" class="mui-input" disabled style="width: 55%;float: left;" id="procLine" value="请选择">
|
<a class="mui-navigate-right1">
|
<select class="mui-h5" style="margin:auto; color:#000;width: 10%;" id="proc_line" onchange="changeSelectProcLine()">
|
<option value=""></option>
|
</select>
|
</a>
|
</div>
|
</div>
|
<div class="mui-col-sm-6 mui-col-xs-12" style="border-bottom:solid 2px #6081f9">
|
<div class="mui-input-row">
|
<label style="width: 30%;">工位名称:</label>
|
<input type="text" style="width: 70%;" disabled class="mui-input-clear" id="procName" />
|
</div>
|
</div>
|
</div>
|
<div class="mui-row" style="margin: 0.2875rem;">
|
<div class="mui-col-sm-6 mui-col-xs-12" style="border-bottom:solid 2px #6081f9">
|
<div class="mui-input-row">
|
<label style="width: 30%;">工单号:</label>
|
<input type="text" class="mui-input" style="width: 55%;float: left;" id="taskno" value="请选择">
|
<a class="mui-navigate-right1">
|
<select class="mui-h5" style="margin:auto; color:#000;width: 10%;" id="taskno_list" onchange="changeSelectTask()">
|
<option value=""></option>
|
</select>
|
</a>
|
</div>
|
</div>
|
<div class="mui-col-sm-6 mui-col-xs-12" style="border-bottom:solid 2px #6081f9">
|
<div class="mui-input-row">
|
<label style="width: 30%;">型号:</label>
|
<input type="text" style="width: 70%;" disabled class="mui-input-clear" id="board_item" />
|
</div>
|
</div>
|
</div>
|
<div class="mui-row" style="margin: 0.2875rem;">
|
<div class="mui-col-sm-6 mui-col-xs-12" style="border-bottom:solid 2px #6081f9">
|
<div class="mui-input-row">
|
<label style="width: 30%;">线体:</label>
|
<input type="text" style="width: 70%;" disabled class="mui-input-clear" id="line_no" />
|
</div>
|
</div>
|
<div class="mui-col-sm-6 mui-col-xs-12" style="border-bottom:solid 2px #6081f9">
|
<div class="mui-input-row">
|
<label style="width: 30%;">设备:</label>
|
<input type="text" style="width: 70%;" disabled class="mui-input-clear" id="dev_list" />
|
</div>
|
</div>
|
</div>
|
<div class="mui-row" style="margin: 0.2875rem;">
|
<div class="mui-col-sm-6 mui-col-xs-12" style="border-bottom:solid 2px #6081f9">
|
<div class="mui-input-row">
|
<label style="width: 30%;">计划数量:</label>
|
<input type="text" style="width:70%;" disabled class="mui-input-clear" id="plan_qty" />
|
</div>
|
</div>
|
<div class="mui-col-sm-6 mui-col-xs-12" style="border-bottom:solid 2px #6081f9">
|
<div class="mui-input-row">
|
<label style="width: 30%;">投入数量:</label>
|
<input type="text" style="width:70%;" disabled class="mui-input-clear" id="input_qty" />
|
</div>
|
</div>
|
</div>
|
<div class="mui-row" style="margin: 0.2875rem;">
|
<div class="mui-col-sm-6 mui-col-xs-12" style="border-bottom:solid 2px #6081f9">
|
<div class="mui-input-row">
|
<label style="width: 30%;">产品编码:</label>
|
<input type="text" style="width: 70%;" disabled class="mui-input-clear" id="board_no" />
|
</div>
|
</div>
|
<div class="mui-col-sm-6 mui-col-xs-12">
|
<div class="mui-input-row" style="border-bottom:solid 2px #6081f9">
|
<label style="width: 30%;">产品名称:</label>
|
<input type="text" style="width: 70%;" disabled class="mui-input-clear" id="board_name" />
|
</div>
|
</div>
|
</div>
|
|
<div style="display: flex;flex-wrap: wrap;" id="def_list">
|
<script id='def-template' type="text/template">
|
<% for(var i in record){ var item=record[i];%>
|
<div class="mui-col-sm-3 def-item" id="def<%=(i)%>"
|
onclick="seletDefItem('<%=(item.DEFECT_NAME)%>','<%=(item.DEFECT_CODE)%>','<%=(i)%>')">
|
<p class="def-p"><%=(item.DEFECT_NAME)%></p>
|
</div>
|
<% } %>
|
</script>
|
|
</div>
|
<div style="display: flex;flex-wrap: wrap;">
|
<div class="mui-col-sm-4 seleted-item1">
|
<span id="selected_item" class="seleted-item-p">暂无已选项目</span>
|
</div>
|
<!-- <div class="mui-col-sm-4 seleted-item1" id="temp_div">
|
</div>
|
<script id='temp-btn-template' type="text/template">
|
<% for(var i in record){ var item=record[i];%>
|
<div class="mui-col-sm-2 btn-item1" id="temp_btn" style="background-color: #0033CC;"
|
onclick="seletTempItem('<%=(item.defName)%>','<%=(item.defCode)%>')">
|
<span class="btn-item1-p"><%=(item.defName)%></span>
|
</div>
|
<% } %>
|
</script> -->
|
<div class="mui-col-sm-2 btn-item" style="background-color: #f99924;" onclick="getOtherDefData()">
|
其他不良(选择)
|
</div>
|
<div class="mui-col-sm-2 btn-item" id="sumbit_btn" style="background-color: #63ef74;" onclick="addData()">
|
确认
|
</div>
|
<div class="mui-col-sm-2 btn-item" id="delete_btn" style="background-color: #FF0000;" onclick="delData()">
|
删除
|
</div>
|
</div>
|
|
<div style="width:99%;height:38rem;margin-top: 0.5rem ;border-top:solid 2px #6081f9;overflow: auto;">
|
<ul class="mui-table-view">
|
<li class="mui-table-view-cell mui-collapse mui-active">
|
<a class="mui-navigate-right" href="#" style="text-align: left;">不良录入明细</a>
|
<div class="mui-collapse-content" id="record_list">
|
<script id="re-template" type="text/template">
|
<% for(var i in record){ var item=record[i]; %>
|
<div class="mui-card">
|
<div class="mui-card-header" style="display: flex;flex-wrap: wrap;">
|
<span>不良代码-名称:(<%=(item.不良代码)%>)-<%=(item.不良名称)%></span>
|
<span>数量:<%=(item.不良数量)%></span>
|
</div>
|
</div>
|
<%}%>
|
</script>
|
</div>
|
</li>
|
</ul>
|
</div>
|
</div>
|
<script type="text/javascript" charset="utf-8">
|
mui.init();
|
var clickItemCode = ""; //被选择的
|
mui.plusReady(function() {
|
getLineData("")
|
})
|
|
document.getElementById('recodeList').addEventListener('tap',function(e){
|
mui.openWindow({
|
id: 'search_buliangpin_record',
|
url: 'search_buliangpin_record.html',
|
extras: {
|
|
urlId: "/defect_input/getBadList",
|
},
|
waiting: { // 控制 弹出转圈框的信息
|
autoShow: true, //自动显示等待框,默认为true
|
title: '加载中' //等待对话框上显示的提示内容
|
}
|
});
|
})
|
|
//获取出现频率最高排序不良类型
|
function getDefData() {
|
aj.post('/defect_input/getDefect', {
|
"factory": api_localStorageGet("factory"),
|
"company": api_localStorageGet("company"),
|
"procLine": $("#procLine").val()
|
}, function(data) {
|
if (data.result) {
|
//console.log(JSON.stringify(data))
|
document.getElementById('def_list').innerHTML = template('def-template', {
|
"record": data.data
|
})
|
} else {
|
mui.alert(data.msg)
|
}
|
})
|
}
|
|
function getOtherDefData() {
|
aj.post('/defect_input/getDefectOther', {
|
"factory": api_localStorageGet("factory"),
|
"company": api_localStorageGet("company"),
|
"procLine": $("#procLine").val()
|
}, function(data) {
|
if (data.result) {
|
//console.log(JSON.stringify(data))
|
document.getElementById('other_def_list').innerHTML = template('other-def-template', {
|
"record": data.data
|
})
|
} else {
|
mui.alert(data.msg)
|
}
|
})
|
document.getElementById("resultDialog").style.display = "block"
|
}
|
|
function getTaskData(keyword) {
|
var key = "%" + keyword + "%"
|
//获取工单数据
|
aj.post('/defect_input/getTaskNo', {
|
"factory": api_localStorageGet("factory"),
|
"company": api_localStorageGet("company"),
|
"procLine": $("#procLine").val(),
|
"keyword": key
|
}, function(data) {
|
if (data.result) {
|
//console.log(JSON.stringify(data))
|
$("#taskno_list").empty()
|
var list = data.data;
|
$("#taskno_list").append("<option value=''></option>");
|
for (var i = 0; i < list.length; i++) {
|
$("#taskno_list").append("<option value='" + list[i].工单号 +
|
"' board_item='" + list[i].型号 + "' board_name='" + list[i].产品名称 +
|
"' plan_qty='" + list[i].计划数量 + "' board_no='" + list[i].产品编码 +
|
"' input_qty='" + list[i].投入数量 + "' dev_list='" + list[i].设备 +
|
"' line_no='" + list[i].线体 +
|
"'>" + list[i].下拉显示数据 + "</option>");
|
}
|
} else {
|
mui.alert(data.msg)
|
}
|
})
|
}
|
|
function getLineData(keyword) {
|
//获取工序线体
|
aj.post('/defect_input/getProcLineByUser', {
|
"factory": api_localStorageGet("factory"),
|
"company": api_localStorageGet("company"),
|
"userNo": api_localStorageGet("code")
|
}, function(data) {
|
if (data.result) {
|
//console.log(JSON.stringify(data))
|
$("#proc_line").empty()
|
var list = data.data;
|
$("#proc_line").append("<option value=''></option>");
|
for (var i = 0; i < list.length; i++) {
|
$("#proc_line").append("<option value='" + list[i].工序线体编号 +
|
"'procName='" + list[i].工序线体名称 + "'>" + list[i].工序线体编号 + "|" + list[i].工序线体名称 + "</option>");
|
}
|
} else {
|
mui.alert(data.msg)
|
}
|
})
|
|
// var key ="%"+keyword+"%"
|
// //获取工序线体
|
// aj.post('/defect_input/getProcLine', {
|
// "keyword":key
|
// }, function(data) {
|
// if (data.result) {
|
// //console.log(JSON.stringify(data))
|
// $("#proc_line").empty()
|
// var list = data.data;
|
// $("#proc_line").append("<option value=''></option>");
|
// for (var i = 0; i < list.length; i++) {
|
// $("#proc_line").append("<option value='" + list[i].工序线体编号 +
|
// "'procName='" + list[i].工序线体名称 + "'>" + list[i].工序线体编号 +"|"+list[i].工序线体名称+ "</option>");
|
// }
|
// } else {
|
// mui.alert(data.msg)
|
// }
|
// })
|
}
|
|
$("#taskno").bind('input propertychange', function() {
|
var key = $("#taskno").val()
|
getTaskData(key)
|
})
|
|
//设置表头锁定
|
$("#set_disabled").click(function() {
|
|
if ($("#procLine").val() == "请选择") {
|
mui.toast("请先选好工序线体")
|
return false
|
} else if ($("#taskno").val() == "请选择") {
|
mui.toast("请先选好工单")
|
return false
|
}
|
|
$('#set_disabled').attr("disabled", "disabled");
|
$('#set_disabled').removeClass("mui-btn-primary")
|
$('#set_disabled').addClass("mui-btn-grey")
|
$('#taskno').attr("disabled", "disabled");
|
$("#taskno").css({
|
"background-color": "#dfdfdf"
|
});
|
$('#taskno_list').attr("disabled", "disabled");
|
|
//$('#procLine').attr("disabled","disabled");
|
$("#procLine").css({
|
"background-color": "#dfdfdf"
|
});
|
$('#proc_line').attr("disabled", "disabled");
|
//$("#proc_line").css({"background-color":"#dfdfdf"});
|
|
|
$("#board_no").css({
|
"background-color": "#dfdfdf"
|
});
|
$("#board_name").css({
|
"background-color": "#dfdfdf"
|
});
|
$("#plan_qty").css({
|
"background-color": "#dfdfdf"
|
});
|
$("#board_item").css({
|
"background-color": "#dfdfdf"
|
});
|
$("#procName").css({
|
"background-color": "#dfdfdf"
|
});
|
$("#dev_list").css({
|
"background-color": "#dfdfdf"
|
});
|
$("#line_no").css({
|
"background-color": "#dfdfdf"
|
});
|
$("#input_qty").css({
|
"background-color": "#dfdfdf"
|
});
|
})
|
|
function changeSelectTask() {
|
var board_item = $("#taskno_list").find("option:selected").attr('board_item');
|
var board_name = $("#taskno_list").find("option:selected").attr('board_name');
|
var board_no = $("#taskno_list").find("option:selected").attr('board_no');
|
var plan_qty = $("#taskno_list").find("option:selected").attr('plan_qty');
|
var input_qty = $("#taskno_list").find("option:selected").attr('input_qty');
|
var dev_list = $("#taskno_list").find("option:selected").attr('dev_list');
|
var line_no = $("#taskno_list").find("option:selected").attr('line_no');
|
$("#board_item").val(board_item)
|
$("#board_name").val(board_name)
|
$("#plan_qty").val(plan_qty)
|
$("#board_no").val(board_no)
|
$("#input_qty").val(input_qty)
|
$("#dev_list").val(dev_list)
|
$("#line_no").val(line_no)
|
|
// var txt = $('#taskno_list option:selected').text()
|
// txt = txt.substring(0, txt.indexOf("|"))
|
$('#taskno').val($('#taskno_list').val());
|
$('#taskno_list option:first').prop('selected', 'selected')
|
|
var procLine = $("#procLine").val();
|
//console.log(procLine)
|
if (procLine != ""&&procLine != "请选择") {
|
getRecord()
|
}
|
}
|
|
|
// $("#procLine").bind('input propertychange', function() {
|
// var key =$("#procLine").val()
|
// getLineData(key)
|
// })
|
|
//选择工序线体后
|
function changeSelectProcLine() {
|
var procName = $("#proc_line").find("option:selected").attr('procName');
|
$("#procName").val(procName)
|
|
|
var txt = $('#proc_line option:selected').text()
|
txt = txt.substring(0, txt.indexOf("|"))
|
$('#procLine').val(txt);
|
$('#proc_line option:first').prop('selected', 'selected')
|
var task = $("#taskno").val();
|
if (task != "请选择"&&task != "") {
|
getRecord()
|
}
|
getTaskData("")
|
getDefData()
|
|
}
|
|
$("#search_word").bind('keyup', function(event) { //监听查询关键字
|
if (event.keyCode == "13") { //回车后执行
|
var keyword = $("#search_word").val();
|
//keyword = "%" + keyword + "%"
|
aj.post('/defect_input/searchDefectOther', {
|
"factory": api_localStorageGet("factory"),
|
"company": api_localStorageGet("company"),
|
"procLine": $("#procLine").val(),
|
"keyword": keyword
|
}, function(data) {
|
if (data.result) {
|
//console.log(JSON.stringify(data))
|
document.getElementById('other_def_list').innerHTML = template('other-def-template', {
|
"record": data.data
|
})
|
} else {
|
mui.alert(data.msg)
|
}
|
})
|
}
|
})
|
|
//获取录入明细
|
function getRecord() {
|
aj.post('/defect_input/getRecord', {
|
"factory": api_localStorageGet("factory"),
|
"company": api_localStorageGet("company"),
|
"taskNo": $("#taskno").val(),
|
"procLine": $("#procLine").val(),
|
"devCode": $("#dev_list").val(),
|
}, function(data) {
|
if (data.result) {
|
//console.log(JSON.stringify(data))
|
document.getElementById('record_list').innerHTML = template('re-template', {
|
"record": data.data
|
})
|
} else {
|
mui.alert(data.msg)
|
}
|
})
|
}
|
|
function seletDefItem(name, code, index) {
|
document.getElementById('def' + index).style.background = '#efefef'
|
setTimeout(function() {
|
document.getElementById('def' + index).style.background = '#61b3ff'
|
}, 150);
|
|
$("#selected_item").text("已选【" + name + "】")
|
clickItemCode = code
|
}
|
|
function seletDefOtherItemAsBtn(name, code, index) {
|
// document.getElementById('oth_def'+index).style.background='#efefef'
|
// setTimeout(function (){
|
// document.getElementById('oth_def'+index).style.background='#f99924'
|
// }, 150);
|
// var tempBtn={
|
// "defName":name,
|
// "defCode":code
|
// }
|
// document.getElementById('temp_div').innerHTML = template('temp-btn-template', {
|
// "record": [tempBtn]
|
// })
|
$("#selected_item").text("已选【" + name + "】")
|
clickItemCode = code
|
document.getElementById("resultDialog").style.display = "none"
|
}
|
|
function seletTempItem(name, code) {
|
document.getElementById('temp_btn').style.background = '#efefef'
|
setTimeout(function() {
|
document.getElementById('temp_btn').style.background = '#0033CC'
|
}, 150);
|
$("#selected_item").text("已选【" + name + "】")
|
clickItemCode = code
|
}
|
|
//增加明细
|
function addData() {
|
document.getElementById('sumbit_btn').style.background = '#efefef'
|
setTimeout(function() {
|
document.getElementById('sumbit_btn').style.background = '#63ef74'
|
}, 150);
|
sumbitData(1)
|
}
|
//删除明细
|
function delData() {
|
document.getElementById('delete_btn').style.background = '#efefef'
|
setTimeout(function() {
|
document.getElementById('delete_btn').style.background = '#FF0000'
|
}, 150);
|
sumbitData(2)
|
}
|
|
//提交数据
|
function sumbitData(ftype) {
|
if ($("#procLine").val() == "请选择") {
|
mui.toast("请选择工序线体")
|
return false
|
} else if ($("#taskno").val() == "请选择") {
|
mui.toast("请选择工单")
|
return false
|
} else if (clickItemCode == "") {
|
mui.toast("请选择不良项目")
|
return false
|
}
|
|
mui.prompt('请输入数量:', '请输入', '', ['取消', '确定'], function(e) {
|
if (e.index == 1) { //确定
|
var v = e.value
|
//console.log(v)
|
if (!/^[0-9]*[1-9][0-9]*$/.test(v)) {
|
mui.toast("请输入大于0,不含小数的数值")
|
return false;
|
}
|
aj.post('/defect_input/setDefectData', {
|
"userNo": api_localStorageGet("code"),
|
"procLine": $("#procLine").val(),
|
"taskNo": $("#taskno").val(),
|
"defCode": clickItemCode,
|
"num": v,
|
"type": ftype,
|
"devCode":$("#dev_list").val(),
|
"factory": api_localStorageGet("factory"),
|
"company": api_localStorageGet("company"),
|
}, function(data) {
|
//console.log(JSON.stringify(data))
|
if (data.result) {
|
|
mui.toast(data.msg)
|
getRecord()
|
} else {
|
mui.alert(data.msg)
|
}
|
})
|
} else { //取消
|
mui.toast("操作取消")
|
}
|
}, 'div')
|
}
|
</script>
|
</body>
|
</html>
|