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
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
<!doctype html>
<html class="no-js">
<head>
<meta charset="utf-8">
[#include "/business/pages/include/static.html" /]
<title>日常巡检填报</title>
<script type="text/javascript">
    $(document).ready(function() {
        $.formValidator.initConfig({formID:"myform",onError:function(msg){popupTips(msg)},onSuccess:function(){
            if(!(window.top.openConfirm("确定要提交吗?"))) {
                    return false;
                }
        
             document.getElementById("myform").target = window.top.openDialog("1","操作",
                         {},
                         {"width":40,"height":40},[{btnId:"tipBtnSure", btnName:"确定", btnStyle:"bluebtn"}]);
                         return true; 
        }});
        $("#cus_id").formValidator({empty: false, onShow:"请选择${Constants.CUSTOMER_CONSTANTS}",onFocus: "请选择${Constants.CUSTOMER_CONSTANTS}"}).inputValidator({min: 1,onError: "${Constants.CUSTOMER_CONSTANTS}不能为空"});    
        $("#sub_cus_id").formValidator({empty: false, onShow:"请选择所属${Constants.CUSTOMER_CONSTANTS}",onFocus: "请选择所属${Constants.CUSTOMER_CONSTANTS}"}).inputValidator({min: 1,onError: "所属${Constants.CUSTOMER_CONSTANTS}不能为空"});    
        $("#patrol_date").formValidator({empty: false, onShow:"请填写填报日期",onFocus: "请填写填报日期"}).inputValidator({min: 1,onError: "填报日期不能为空"});    
        $("#summary").formValidator({empty: false, onShow:"请填写巡检总结",onFocus: "请填写巡检总结"}).inputValidator({min: 1,onError: "巡检总结不能为空"});    
        $("#user_phone").formValidator({empty:true}).functionValidator({fun:checkPhone});
    });
    function checkPhone(value) {
        if(!$.util.isMobile(value) && !$.util.isTelphone(value)) {
            return "联系方式格式不正确";
        }
        return true;
    }
</script>
<script type="text/javascript">
 
    $(function(){
        var cusId = $("#cus_id").val();
        if(!$.util.isEmpty(cusId)){
            showCommonItem(cusId);
        }
            
        //表单提交事件
        $("#submit").click(function(){
            window.top.confirmInfo('提示', '确定要提交吗?', function(){
                $('#state').val(2);
                setCommonListJson();
                setCiListJson();
                $("#myform").submit();
            })
        });
        
        //表单提交事件
        $("#save").click(function(){
                var begin_time = $("#begin_time").val();
                var end_time = $("#end_time").val();
                if(begin_time!=''&&end_time!=''){
                    if(begin_time>end_time){
                        popupTips("巡检开始时间不能大于结束时间");
                        return;
                    }
                }
                
                $('#state').val(1);
                setCommonListJson();
                setCiListJson();
                $("#myform").submit();
        });
        
        //删除按钮点击事件
        $("a.delete").live("click",function() {
            var $table = $(this).parents("table");
            if($table.find("tr").length==2) {
                var $str = $(this).parents("tr");
                var length = $str.find("td").length;
                $str.find("td:gt(0)").remove();
                $str.find("td:first").attr({"colspan":length,"align":"center"}).html("暂无关联信息");
            } else {
                $(this).parents("tr").remove();
            }
        })
    });
    
    //获取选择的通用巡检项信息
    function setCommonListJson(){
        var commonJsonList = [];
        if($("#ciList").find("tr:eq(1)").find("input").length>0){ 
            $("#commonList").find("tr").each(function(index){
                if(index>0){
                    if($(this).find("input[type=radio]:checked").length>0){
                        var categoryId = $(this).find("input[name=categoryId]").val();
                        var categoryName = $(this).find("input[name=categoryName]").val();
                        var itemId = $(this).find("input[name=itemId]").val();
                        var itemName = $(this).find("input[name=itemName]").val();
                        var result = $(this).find("input[type=radio]:checked").val();
                        var note = $(this).find("input[name=note]").val();
                        var obj = {};
                        obj["categoryId"] = categoryId;
                        obj["categoryName"] = categoryName;
                        obj["itemId"] = itemId;
                        obj["itemName"] = itemName;
                        obj["result"] = result;
                        obj["note"] = note;
                        commonJsonList.push(obj);
                    }
                }
            });
        }
        $("#commonJsonList").val(JSON.stringify(commonJsonList));
    }
    //获取选择的异常配置信息
    function setCiListJson(){
        var ciJsonList = [];
        if($("#ciList").find("tr:eq(1)").find("input").length>0){ 
            $("#ciList").find("tr").each(function(index){
                if(index>0){
                    var obj = {};
                    var itemId = $(this).find("input[name=itemIdresult]").val();
                    var result = $(this).find("input[type=radio]:checked").val();
                    var note = $(this).find("input[name=noteresult]").val();
                    obj["itemId"] = itemId;
                    obj["note"] = note;
                    obj["result"] = result;
                    ciJsonList.push(obj);
                }
            });
        }
        $("#ciJsonList").val(JSON.stringify(ciJsonList));
    }
    
    //异常配置添加
    function addWarnCi(cusId,cusNames){
        var cusId = $("#cus_id").val();    
        var subCusId = $("#sub_cus_id").val();    
        var orderId = $("#orderId").val();
        $("#ciDiv").load("${base}/business/pages/rcxj/itemresult.html",{"cusId":cusId,"orderId":orderId,"subCusId":subCusId});
    }
    
    //显示通用巡检项
    function showCommonItem(cusId,cusNames){
     if($.util.isEmpty($("#sub_cus_id").val())){
        $("#sub_cus_id").val(cusId);
        $("#sub_cus_name").val(cusNames);
     }
        var orderId = $("#orderId").val();
        $("#commonDiv").load("${base}/business/pages/rcxj/commonPatrolItem.html",{"cusId":cusId,"orderId":orderId});
        addWarnCi();
    }
    
    //关联工单列表
    function linkOrder() {
        var customerid = $("#cus_id").val();
        if($.util.isEmpty(customerid)) {
            popupTips("请先选择${Constants.CUSTOMER_CONSTANTS}");
            return;
        }
        var orderIds = new Array();
        var $orderId = $(":hidden[name='orderId']");
        if($orderId.length>0) {
            $orderId.each(function() {
                orderIds.push($(this).val());
            })
        }
        
        var orderids = orderIds.join("-");
        window.top.openDialog("0","添加关联工单",
                             {},
                             {"width":80,"height":80},
                             [{btnId:"btnSure", btnName:"选择", btnStyle:"bluebtn"}],
                             "${base}/business/pages/incident/linkOrder.html?customerid="+customerid+"&orderids="+orderids);
    }
    
    //添加关联工单
    function showLinkOrder(devices) {
        var strHtml = "";
        $.each(devices,function(i,item) {
            var orderId = item.get("orderId");
            var businesstype = item.get("businesstype");
            var orderCode = item.get("orderCode");
            var wfname = item.get("wfname");
            var createTime = item.get("createTime");
            var customerName = item.get("customerName");
            var wfstateText = item.get("wfstateText");
            strHtml += "<tr><td><input type='hidden' name='linkOrderId' value='"+orderId+"'>"+orderCode+"</td><td>"+wfname+"</td><td>"+businesstype+"</td><td>"+wfstateText+"</td><td><a class='delete'>删除</a></td></tr>";
        })
        
        
        var firstTd = $("#linkOrderTable tr:eq(1)");
        if(!$.util.isEmpty(firstTd.find("td:eq(0)").attr("colspan"))){
           if(firstTd.find("td:eq(0)").attr("colspan")!=1) {
                firstTd.remove();
           }
        }
        $("#linkOrderTable").append(strHtml).show();
    } 
</script>
</head>
 
<body class="fullscreen">
[#include "/business/pages/include/header.html" /]
[#include "/component/subCusSelector.html" /]
[#include "/component/DatePicker.html" /]
[#include "/component/newsel.html" /]
[#include "/component/webuploadTwo.html" /]
<nav class="fs_nav">
    <div class="fsnav_con">
        <h3>日常巡检</h3>
        <a class="focus" href="${base}/business/pages/rcxj/myRcxjList.html"><span>日常巡检填报<div></div></span></a>
    </div>
</nav>
<div class="fs_navpath">
    <h3>当前位置</h3><span></span><a>预防性维护</a><span></span>
    <a>日常巡检</a><span></span><em>日常巡检填报</em>
</div>
<div class="fs_navtitle" id="fsNavtitle">
    <div class="fs_navtitle_con">
        <h2>日常巡检</h2>
        <div class="fsnt_btn">
            <!-- <a id="submit" class="fb_submit"><span>提交</span></a> -->
            <a id="save" class="fb_submit"><span>保存</span></a>
        </div>
    </div>
</div>
 
<div class="fs_main fs_edit">
<form id="myform" method="post" action="editRcxj.html">
    <div class="edit_title"><h3>基本信息</h3></div>
    <input type="hidden" id="state" name="state"/>
    <input type="hidden" id="orderId" name="orderId" value="${RequestParameters.id}"/>
    <input type="hidden" id="commonJsonList" name="commonJsonList"/>
    <input type="hidden" id="ciJsonList" name="ciJsonList"/>
    <table class="edit_layout">
            <tr>
               <th><label class="required">${Constants.CUSTOMER_CONSTANTS}名称:</label></th>
                <td>
                    [@sel id="cus_id" labelName="cus_name" value="${info.cus_id}" text="${info.cus_name}" textField="id" valueField="name" source=cusList blankFlag="n" callback="showCommonItem"/]
                    <a class="csm_info"> </a>
                    <div id="cus_idTip" style="display:inline-block;"></div>
                </td>
                <th><label class="required">${Constants.UNIT_CONSTANTS}:</label></th>
                <td>
                    [@cub_cus id="sub_cus_id" name="sub_cus_name" cusConId="cus_id" value="${info.sub_cus_id}" text="${info.sub_cus_name}" back="addWarnCi" /]
                    <div id="sub_cus_idTip" style="display:inline-block;"></div>
                </td>
            </tr>
            <tr>
               <th><label class="required">报告日期:</label></th>
               <td>
                       [#if info.patrol_date??]
                           [@datepicker id="patrol_date" value="${info.patrol_date}" class="general" length=8/]
                       [#else]
                           [@datepicker id="patrol_date" class="general" length=8/]
                       [/#if]
               <div id="patrol_dateTip" style="display:inline-block;"></div></td>
               <th><label>填报人:</label></th>
               <td><input name="user_name" value="${info.user_name}" class="general" type="text" readonly/></td>
            </tr>
            <tr>
                <th><label>巡检开始时间:</label></th>
                <td>
                    [#if info.begin_time??]
                        [@datepicker id="begin_time" value="${info.begin_time}" class="general" length=14/]
                    [#else]
                        [@datepicker id="begin_time" class="general" length=14/]
                    [/#if]
                </td>
                <th><label>巡检结束时间:</label></th>
                <td>
                    [#if info.end_time??]
                        [@datepicker id="end_time" value="${info.end_time}" class="general" length=14/]
                    [#else]
                        [@datepicker id="end_time" class="general" length=14/]
                    [/#if]
                </td>
            </tr>
            <tr>
                <th><label>联系方式:</label></th>
                <td colspan="3"><input name="user_phone" id="user_phone" value="${info.user_phone}" class="general" type="text" /></td>
            </tr>
 
            <tr>
                <th class="postop"><label class="required">巡检总结:</label></th>
                <td colspan="3">
                    <textarea id="summary" style="width:590px;" name="summary" value="${info.summary}" class="general">${info.summary}</textarea>
                    <div id="summaryTip" style="display:inline-block;"></div>
                </td>
            </tr>
            [#if info.state=4]
            <tr>
                <th class="postop"><label class="required">审批意见:</label></th>
                <td colspan="3">
                    <textarea class="general" readonly="readonly">${info.spyj}</textarea>
                </td>
            </tr>
            [/#if]
            <tr>
                <th class="postop"><label>附件:</label></th>
                <td>
                    <div class="upload_file">
                        [@webuploadTwo fileList=info.fileList id="files" multiple="true" /]
                    </div>
                </td>
            </tr>
       </table>
    
    <div class="edit_title"><h3>类型巡检</h3></div>
    <div id="commonDiv">
         <div class="table_basic">
         <table class="display_form" id="commonList" style="width:95%">
         <tr class="title">
            <td style="width:30%">巡检类型</td>
            <td style="width:10%">巡检项</td>
            <td style="width:30%">巡检结果</td>
            <td style="width:30%">备注</td>
         </tr>
         <tr>
            <td colspan="4" align="center">无巡检项信息</td>
         </tr>
        </table>
        </div>
    </div>
    <div class="edit_title"><h3>配置巡检</h3></div>
    <div id="ciDiv">
        <div class="table_basic">
        <table class="display_form" id="ciList" style="width:95%">
        <tr class="title">
            <td style="width:15%">配置名称(搜索码)</td>
            <td style="width:25%">巡检项</td>
            <td style="width:20%">巡检结果</td>
            <td width="20%">备注</td>
        </tr>
        <tr>
            <td colspan="5" align="center">无巡检项信息</td>
         </tr>
        </table>
    </div>
   </div>  
   <div class="edit_title"><h3>关联工单信息</h3><a class="add_associated" href="javascript:linkOrder();">添加关联工单</a></div>
       <div class="table_basic">
    <table class="display_form" id="linkOrderTable" style="width:95%">
        <tr class="title">
            <td>工单编号</td>
            <td>工单名称</td>
            <td>工单类型</td>
            <td>当前状态</td>
            <td>操作</td>
        </tr>
        [#if linkOrderList??&&linkOrderList?size>0]
            [#list linkOrderList as linkOrder]
            <tr>
                <td><input type="hidden" name="linkOrderId" value="${linkOrder.FLOWID}"/>${linkOrder.ORDER_CODE}</td>
                <td>${linkOrder.WFNAME}</td>
                <td>${Constants.mapWORKFLOW_BUSINESS_TYPE_Label(linkOrder.BUSINESSTYPE+"")}</td>
                <td>
                [#if linkOrder.WFSTATE ==1]
                    进行中
                [#elseif linkOrder.WFSTATE ==2]
                    已完成
                [#elseif linkOrder.WFSTATE ==3]
                    已关闭
                [/#if]
                </td>
                <td><a class='delete'>删除</a></td>
            </tr>
            [/#list]
        [#else]
            <tr align="center">
                <td colspan="5">暂无关联信息</td>
            </tr>
        [/#if]
    </table>
    </div>
</form>
</div>
[#include "/business/pages/include/footer.html" /]
</body>
</html>