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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
<!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个汉字!"});
              $("#note").formValidator({empty: true}).inputValidator({ max: 200, onError: "工单备注不能超过200个字符"});
            
           
        })
</script>
 
<div class="edit_txt">
    <form action="${base}/business/pages/overageLoss/overageLossEditSubmit.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="state" name="state" value="${msgMap.STATE}" />
         <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>
                    [#if status ==1 ]
                            <input class="general" type="hidden" value="${status}" name="bus_type" id="bus_type" />报损
                    [#else]
                            <input class="general" type="hidden" value="${status}" name="bus_type" id="bus_type" />报溢
                    [/#if]
                </td>
            </tr> 
            <tr>
                <th>
                    [#if status ==1]
                        <label>报损备件数:</label>
                    [#else]
                        <label>报溢备件数:</label>
                        <span id="bjCount"></span>
                    [/#if]
                </th>
                <td>
                    <p></p>
                </td>
             </tr>
            <tr>
                <th><label>备注:</label></th>
                <td colspan="3"><textarea class="general" style="width:360px;" id="note" name="note"/>${msgMap.NOTE}</textarea>
                <div id="noteTip" style="display:inline-block;"></div>
                </td>
            </tr>
        </table>
 
 
        <div class="edit_title">
            <!--  库存报损 0 -->
            [#if status==1]     
                <h3>报损备件明细</h3>
            [#else]
                <h3>报溢备件明细</h3>
            [/#if]
            
            [#if status==1]
                <a class="add_associated" href="javascript:addBs('${id}');">新增</a>
                <a class="add_associated" href="javascript:addPlBs();">批量设置报损原因</a>
            [#else]
                <a class="add_associated" href="javascript:addBy('${id}');">新增</a>
                <a class="add_associated" href="javascript:addPlBy();">批量设置报溢原因</a>
            [/#if]
            
        </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">
    var nowPage = 1;
    function query(){
        var partId=$("#id").val();
        var params = {"partId":partId};
         pagination("${base}/business/pages/bpbj/stockApply/stockOverageListData.html","${base}/business/pages/bpbj/stockApply/stockOverageListCount.html","main","pagination",{cpage:nowPage,psize:1000},params,function(data,page) {
            nowPage = page;
            countBj(partId)
        });
    }
    
    $(function(){
            query();
    });
   function countBj(partId){
            $.post("${base}/business/pages/overageLoss/loseListCount.html", {"orderId":partId},function(data){
                      $("#bjCount").text(data);
            },"json");
    }
    //库存报溢 增加页面
    function addBy(id){
               var url = "${base}/business/pages/bpbj/stockApply/editBj.html?id="+id;
               window.top.openDialog("2","新增/编辑",
                 {},
                 {"width":60,"height":70},
                 [{btnId:"btnSure", btnName:"提交", btnStyle:"bluebtn"}],
                 url);
     }
        //库存报损 增加页面
    function addBs(id){
            var deviceIds = new Array();
            var $deviceId = $(":hidden[name='spart_id']");
            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 () {
            detailIds += (detailIds ? "," : "") + $(this).val();
         })
        
            var checkedBox = $("#main :checkbox:checked");
            if(checkedBox.length==0) {
                popupTips("请选择备件");
                return;
            }
            var url = "${base}/business/pages/overageLoss/overageByPlEdit.html?detailIds="+detailIds;
            window.top.openDialog("plBy", "批量设置报溢原因",
             {},
                {"width": 60, "height": 80},
                 [{btnId: "btnSure", btnName: "确定", btnStyle: "bluebtn"}], url);
    }
   
    function del(id){
        var tip = "确定要删除吗?";
         window.top.confirmInfo('提示', tip, function(){
             $.post("${base}/business/pages/bpbj/stockApply/deleteSpareOverage_part.html", {"id":id},function(data){
                   if(data == "1"){
                       window.top.popupTips("操作成功");
                       query();
                   }
             },"json");
         })
         
     }
    
  //备件详细信息
    function sparePartDetail(id,detail_id,orderId){
           var url = "${base}/business/pages/bpbj/stockApply/sparePartDetail.html?id="+id+"&detail_id="+detail_id+"&orderId="+orderId+"&type=byxg";
           window.top.openDialog("xgbj","修改报溢备件",
             {},
             {"width":60,"height":70},
             [{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  initbj(){
    var orderId=$("#id").val();
    $.post("${base}/business/pages/overageLoss/loseListCount.html", {"orderId":orderId},function(data){
                      if(data=="0"){
                          window.top.popupTips("请添加报溢备件!");
                        return;
                      }else{
                      selSpareNextNode();
                      }
            },"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();  
    }
    
 
</script>
 
 
</body>
</html>