cy
2022-06-21 129904537f66509f97b285e7eb4f42b3dc349dd0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
<!doctype html>
<html class="no-js">
<head>
    <meta charset="utf-8">
    <title>增加/修改</title>
[#include "/business/pages/include/static.html" /]
[#include "/component/DatePicker.html" /]
    <script type="text/javascript" src="${common_static}/static/script/jquery.ssq.js"></script>
</head>
<body class="edit_txt_body">
<script type="text/javascript">
    $(function() {
        $.formValidator.initConfig({formID:"myform",onError:function(msg){popupTips(msg)},onSuccess:function(){
                document.getElementById("myform").target = window.top.openDialog("1","操作",
                             {},
                             {"width":40,"height":40,"noclose":true},
                             [{btnId:"tipBtnSure", btnName:"确定", btnStyle:"bluebtn"}]);
                             return true;
        }});
        
        
        $("#order_name").formValidator({empty:false,onFocus:"请输入工单名称"}).inputValidator({min:2,max:32,onError:"工单名称为1-16个汉字!"});
                
    });
 
</script>
 
<div class="edit_txt">
    <form action="${base}/business/pages/overageLoss/lossEditSubmit.html" method="post" id="myform" name="myform">
        <input type="hidden" name="id" id="id" value="${id}"/>
        <input type="hidden" id="order_code" name="order_code" value="${msgMap.order_code}" />
        <input type="hidden" id="type" name="type" value="${type}" />
         <input type="hidden" name="dealId" id="dealId" value="" />
         <input type="hidden" name="dealName" id="dealName" value="" />
         <input type="hidden" name="bz" id="bz" value="" />
        <table class="edit_layout" width="99%">
            <tr>
                <th><label class="required">工单名称:</label></th>
                <td colspan="3"><input class="general" type="text" name="order_name" id="order_name"  value="${msgMap.order_name}"  style="width:360px"/>
                    <div id="order_nameTip" style="display:inline-block;"></div>
                </td>
            </tr>    
            <tr>
              <th><label>业务类型:</label></th>
                <td>
                    <input class="general" type="hidden" value="${msgMap.status}" name="bus_type" id="bus_type" />报损
                </td>
            </tr> 
            <tr>
                <th>
                    <label>报损备件数:</label>
                </th>
                <td>
                    <span id="bjCount"></span>
                </td>
             </tr>
            <tr>
                <th><label>备注:</label></th>
                <td colspan="3"><textarea class="general" style="width:360px;" id="note" name="note"  value="${msgMap.note}" /></textarea>
                </td>
            </tr>
        </table>
 
 
        <div class="edit_title">
            <!--  库存报损 0 -->
                <h3>报损备件明细</h3>
                <a class="add_associated" href="javascript:addBs('${id}');">新增</a>
                <a class="add_associated" href="javascript:addPlBy();">批量设置报损原因</a>
        </div>
            <p style="font-size: 14px;padding-left: 50px">
            </p>
 
    <div class="fs_main clearfix">    
        <div id="main"></div>
        <div id="pagination"></div>
    </div>
 
   </form>
</div>
 
 
<script type="text/javascript">
    function query(){
         var orderId=$("#id").val(); 
         var url="${base}/business/pages/overageLoss/spareLoseListData.html";
            loading($("#main"));
            var params = {"orderId":orderId};
            $.post(url,params,function(data,textStatus) {
                loaded($("#main"));
                $("#main").html(data);
                countBj(orderId);
            })    
            
            
    }
    
    $(function(){
            query();
    });
 
     function countBj(orderId){
            $.post("${base}/business/pages/overageLoss/loseListCount.html", {"orderId":orderId},function(data){
                      $("#bjCount").text(data);
            },"json");
    }
   //库存报损 增加页面
    function addBs(id){
            var deviceIds = new Array();
            var $deviceId = $(":input[name='spareId']");
            if ($deviceId.length > 0) {
                $deviceId.each(function () {
                    deviceIds.push($(this).val());
                })
            }
            var spart_ids = deviceIds.join("-");
               var url = "${base}/business/pages/overageLoss/spareDeviceLose.html?orderId="+id+"&spart_ids="+spart_ids;
               window.top.openDialog("1","添加备件实体",
                 {},
                 {"width":80,"height":80},
                 [{btnId:"btnSure", btnName:"选择", btnStyle:"bluebtn"}],
                 url);
     }
    
    //批量设置报损原因
    function addPlBy() {
        var detailIds = "";
        $("#main :checkbox:checked").each(function () {
            debugger;
            detailIds += (detailIds ? "," : "") + $(this).val();
        })
        
            var checkedBox = $("#main :checkbox:checked");
            if(checkedBox.length==0) {
                popupTips("请选择备件");
                return;
            }
            var url = "${base}/business/pages/overageLoss/loseByPlEdit.html?detailIds="+detailIds;
            window.top.openDialog("plBy", "批量设置报溢报损原因",
                    {},
                    {"width": 60, "height": 80},
                    [{btnId: "btnSure", btnName: "确定", btnStyle: "bluebtn"}], url);
         
    }
    
    
    
    function onDialogBtnClick(btnID, dialogID, config) {
        if (btnID == "btnSave") {
            $("#myform").submit();
        }
        if(btnID == "btnSure"){
         var order_name = $("#order_name").val();
        if ($.util.isEmpty(order_name)) {
            popupTips("请填写工单名称!");
            return;
        }
          initbj();
        }
    }
 function initDelivery(){
     var orderId=$("#id").val();
      var tip = "确定要提交吗?";
        window.top.confirmInfo('提示', tip, function(){
            $.post("${base}/business/pages/overageLoss/initDelivery.html", {"orderId":orderId},function(data){
                  if(data == "0"){
                      selSpareNextNode();
                  }else{
                      window.top.popupTips("存在备件没有设置报损原因!");
                  }
            },"json");
        })
        
    }
   function  initbj(){
    var orderId=$("#id").val();
    $.post("${base}/business/pages/overageLoss/loseListCount.html", {"orderId":orderId},function(data){
                      if(data=="0"){
                          window.top.popupTips("请添加报损备件!");
                        return;
                      }else{
                        initDelivery();
                      }
            },"json");
   
   }
  function selSpareNextNode(){
 
    var orderId="";
    var url = "${base}/business/pages/bpbj/deliveryApply/selSpareNextNode.html?orderId="+orderId+"&type=1";
              window.top.openDialog("insideAllot","提交审核",
     {},
     {"width":60,"height":70},
     [{btnId:"btnSure", btnName:"提交", btnStyle:"bluebtn"}],
     url);
 
}
 
function showDealDeivce(devices) {
     $.each(devices, function (i, item) {
                var dealId = item.get("dealId");
                var dealName = item.get("dealName");
                var bz = item.get("bz");
              $("#dealId").val(dealId);
              $("#dealName").val(dealName);
              $("#bz").val(bz);
            })
          $("#myform").submit();  
    }
         //修改备件详细信息
function sparePartDetail(detail_id,bjId){
    var orderId=$("#orderId").val();
       var url = "${base}/business/pages/bpbj/stockApply/sparePartDetail.html?id="+bjId+"&detail_id="+detail_id+"&type=bsxg";
    window.top.openDialog("xgbj", "修改备件",
                {},
                {"width": 60, "height": 80},
                [{btnId: "btnSure", btnName: "确定", btnStyle: "bluebtn"}], url);
   }
 
 
function delBj(id){
       var tip = "确定要删除吗?";
        window.top.confirmInfo('提示', tip, function(){
            $.post("${base}/business/pages/overageLoss/deleteItem.html", {"id":id},function(data){
                  if(data == "1"){
                      window.top.popupTips("操作成功");
                      query();
                  }
            },"json");
        })
        
    }
 
</script>
 
 
</body>
</html>