| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320 |
- <% layout('/layouts/default.html', {title: '质量检查记录管理', libs: ['validate','fileupload']}){ %>
- <style>
- .custom-table{
- table-layout:fixed;
- white-space: pre-wrap!important;
- }
- </style>
- <div class="main-content">
- <div class="box box-main">
- <div class="box-header with-border">
- <div class="box-title">
- <i class="fa icon-note"></i> ${text('首件检查')} 当前工件码:<span id="sss"></span>
- </div>
- <div class="box-tools pull-right">
- <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
- </div>
- </div>
- <#form:form id="inputForm" model="${mesProductCheck}" action="${ctx}/mes/mesProductCheck/desksave" method="post" class="form-horizontal">
- <div class="box-body">
- <!-- <div class="form-unit">${text('基本信息')}</div>-->
- <#form:hidden path="id"/>
- <div class="row">
- <!-- <div class="col-xs-12">-->
- <!-- <table class="table table-bordered">-->
- <!-- <tr>-->
- <!-- <th class="mpc-header">来源</th>-->
- <!-- <td>首件检查</td>-->
- <!-- </tr>-->
- <!-- <tr>-->
- <!-- <th class="mpc-header">二维码编号</th>-->
- <!-- <td><span id="sss"></span></td>-->
- <!-- </tr>-->
- <!-- <tr>-->
- <!-- <th class="mpc-header">工位号</th>-->
- <!-- <td>OP300</td>-->
- <!-- </tr>-->
- <!-- </table>-->
- <!-- </div>-->
- <#form:hidden path="checkId"/>
- <!-- <div class="col-xs-12">-->
- <!-- <div class="form-group">-->
- <!-- <label class="control-label col-sm-2" title="">-->
- <!-- <span class="required">*</span> ${text('检查类型')}:<i class="fa icon-question hide"></i></label>-->
- <!-- <div class="col-sm-10">-->
- <!-- <#form:select path="checkId" items="${mclist}" itemLabel="title" blankOption="true" itemValue="id" class="form-control required" />-->
- <!-- </div>-->
- <!-- </div>-->
- <!-- </div>-->
- <div class="col-xs-12">
- <div class="form-group">
- <!-- <label class="control-label col-sm-2" title="">-->
- <!-- <span class="required">*</span> ${text('检查清单')}:<i class="fa icon-question hide"></i></label>-->
- <div class="col-sm-12">
- <input type="hidden" id="checkItemsBox" name="items" value="">
- <table class="table table-bordered text-center custom-table">
- <thead>
- <tr>
- <th>检查位置</th>
- <th>检查项目</th>
- <th>标准要求</th>
- <th>检查方式</th>
- <th>结果</th>
- <th>失效类型</th>
- </tr>
- </thead>
- <tbody id="checkitems">
- <!--<tr>
- <td>检查位置</td>
- <td>检查项目</td>
- <td>标准要求</td>
- <td>检查方式</td>
- <td><input type="radio" name="aa[0]"></td>
- <td>
- <label style="font-weight: normal;">失效类型1 <input name="bb[0]" type="checkbox"></label>
- <label>失效类型2 <input name="bb[0]" type="checkbox"></label>
- <label>失效类型3 <input name="bb[0]" type="checkbox"></label>
- <label>失效类型4 <input name="bb[0]" type="checkbox"></label>
- <label>失效类型5 <input name="bb[0]" type="checkbox"></label>
- <label>失效类型6 <input name="bb[0]" type="checkbox"></label>
- <label>失效类型7 <input name="bb[0]" type="checkbox"></label>
- </td>
- </tr>
- <tr>
- <td>检查位置</td>
- <td>检查项目</td>
- <td>标准要求</td>
- <td>检查方式</td>
- <td><input type="radio" name="aa[1]"></td>
- <td>
- <table class="table text-center">
- <tr>
- <td><label>失效类型1 <input name="bb[1]" type="checkbox"></label></td>
- </tr>
- <tr>
- <td><label>失效类型2 <input name="bb[1]" type="checkbox"></label></td>
- </tr>
- <tr>
- <td><label>失效类型3 <input name="bb[1]" type="checkbox"></label></td>
- </tr>
- <tr>
- <td><label>失效类型4 <input name="bb[1]" type="checkbox"></label></td>
- </tr>
- </table>
- </td>-->
- </tbody>
- </tr>
- </table>
- </div>
- </div>
- </div>
- <div class="col-xs-12">
- <div class="form-group">
- <label class="control-label col-sm-2" title="">
- <span class="required">*</span> ${text('操作')}:<i class="fa icon-question hide"></i></label>
- <div class="col-sm-10">
- <#form:radio path="state" dictType="mes_deal_status" class="form-control required" />
- </div>
- </div>
- </div>
- <div class="col-xs-12">
- <div class="form-group">
- <label class="control-label col-sm-2" title="">
- <span class="required hide">*</span> ${text('备注')}:<i class="fa icon-question hide"></i></label>
- <div class="col-sm-10">
- <#form:input path="remark" maxlength="255" class="form-control"/>
- </div>
- </div>
- </div>
- <div class="col-xs-12" id="repairbox" style="display: none;">
- <div class="form-group">
- <label class="control-label col-sm-2" title="">
- <span class="required">*</span> ${text('不合格类型')}:<i class="fa icon-question hide"></i></label>
- <div class="col-sm-10">
- <#form:select path="repairType" dictType="mes_warehouse_type" multiple="true" blankOption="true" class="form-control " />
- </div>
- </div>
- <div class="form-group">
- <label class="control-label col-sm-2" title="">
- <span class="required">*</span> ${text('不合格描述')}:<i class="fa icon-question hide"></i></label>
- <div class="col-sm-10">
- <#form:input path="repairContent" maxlength="255" class="form-control"/>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="box-footer">
- <div class="row">
- <div class="col-sm-offset-2 col-sm-10">
- <button type="submit" class="btn btn-sm btn-primary" id="btnSubmit"><i class="fa fa-check"></i> ${text('保 存')}</button>
- <button type="button" class="btn btn-sm btn-default" id="btnCancel" onclick="js.closeCurrentTabPage()"><i class="fa fa-reply-all"></i> ${text('关 闭')}</button>
- </div>
- </div>
- </div>
- </#form:form>
- </div>
- </div>
- <% } %>
- <script>
- var mclist = ${toJson(mclist)}; // 检查类型
- var items = []; // 检查清单
- $(function () {
- let val = $('#checkId').val(); // 取值
- changeVal(val);
- callJavaFx();
- });
- function callJavaFx(){
- // window.sout.println("test:"+window.apps.callFromJs("jaaaaa"))
- var javaja = window.apps.callFromJs("jadd");
- // console.log("sss:"+javaja)
- // alert(javaja)
- $("#sss").html(javaja);
- }
- $("#inputForm").validate({
- submitHandler: function(form){
- js.ajaxSubmitForm($(form), function(data){
- js.showMessage(data.message);
- if(data.result == Global.TRUE){
- js.closeCurrentTabPage(function(contentWindow){
- contentWindow.page();
- });
- }
- }, "json");
- }
- });
- // 选中事件
- $('#state').on('ifChecked', function(){
- let val = $('#state input:radio:checked').val(); // 取值
- if(val == '2' || val == '4'){
- $('#repairbox').show();
- }else{
- $('#repairbox').hide();
- }
- });
- $('#checkId').on('select2:select', function (event) {
- let val = $('#checkId').val(); // 取值
- changeVal(val);
- });
- function changeVal(val) {
- console.log(val);
- items = [];
- for(let o in mclist){
- if(mclist[o].id == val){
- items = mclist[o].mesCheckFormList;
- }
- }
- for(let o in items){
- items[o].result = "";
- items[o].fails = "";
- }
- formatItems();
- }
- function formatItems() {
- let str = "";
- for (let o in items){
- str += '<tr>';
- str += '<td>'+items[o].position+'</td>';
- str += '<td>'+items[o].title+'</td>';
- str += '<td>'+items[o].standard+'</td>';
- str += '<td>'+items[o].way+'</td>';
- str += '<td><label style="font-weight: normal;"><input type="radio" name="extraitems['+o+']" onclick="selectOk(this)" data-id="'+items[o].id+'" value="1">OK</label> ';
- str += '<label style="font-weight: normal;"><input type="radio" name="extraitems['+o+']" onclick="selectNok(this)" data-id="'+items[o].id+'" value="0">NOK</label></td>';
- str += '<td style="text-align: left">';
- let fails = items[o].mesCheckItemsFail;
- for (let n in fails){
- str += '<label style="font-weight: normal;"> <input onchange="changeFail(this)" data-id="'+items[o].id+'" name="extraitems['+o+'][fails]" type="checkbox" value="'+fails[n].id+'"> '+fails[n].title+' </label><br />';
- }
- str += '</td>';
- str += '</tr>';
- }
- $('#checkitems').html(str);
- formatResult();
- }
- function formatResult() {
- let checkItems = [];
- for(let o in items){
- checkItems.push({
- id: items[o].itemsId,
- result: items[o].result?items[o].result:'',
- fails: items[o].fails?items[o].fails:'',
- oprno: items[o].oprno
- });
- }
- console.log('result',checkItems);
- $('#checkItemsBox').val(JSON.stringify(checkItems));
- }
- function selectOk(_self) {
- let id = $(_self).attr('data-id');
- for(let o in items){
- if(items[o].id == id){
- items[o].result = "1";
- items[o].fails = "";
- }
- }
- console.log(items);
- formatResult();
- }
- function selectNok(_self) {
- let id = $(_self).attr('data-id');
- for(let o in items){
- if(items[o].id == id){
- items[o].result = "0";
- //jquery获取复选框值
- let chk_value =[];//定义一个数组
- //遍历每一个名字为active的复选框,其中选中的执行函数
- $('input[name="extraitems['+o+'][fails]"]:checked').each(function(){
- chk_value.push($(this).val());//将选中的值添加到数组chk_value中
- });
- items[o].fails = chk_value.join(',');
- }
- }
- console.log(items);
- formatResult();
- }
- function changeFail(_self) {
- let id = $(_self).attr('data-id');
- console.log(id);
- for(let o in items){
- if(items[o].id == id){
- if(items[o].result == '0'){
- //jquery获取复选框值
- let chk_value =[];//定义一个数组
- //遍历每一个名字为active的复选框,其中选中的执行函数
- $('input[name="extraitems['+o+'][fails]"]:checked').each(function(){
- chk_value.push($(this).val());//将选中的值添加到数组chk_value中
- });
- items[o].fails = chk_value.join(',');
- }else{
- items[o].fails = '';
- }
- }
- }
- formatResult();
- }
- </script>
|