多单位版国产化地质资料管理系统
zhai
2025-12-18 3c6f6c1e3016e38146a4c46be6e7b625c35591f2
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
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
 
<!DOCTYPE html>
<html>
<head>
    <base href="<%=basePath%>">
    <title>借阅申请单</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link href="static/plugins/font-awesome/css/font-awesome.css" rel="stylesheet" type="text/css">
    <link href="static/plugins/jquery-easyui/themes/bootstrap/easyui.css" rel="stylesheet" type="text/css">
    <link rel="stylesheet" href="static/styles/material-teal.css" type="text/css">
    <link rel="stylesheet" type="text/css" href="static/plugins/webuploader/webuploader.css">
    <link rel="stylesheet" href="static/styles/initialize.css" type="text/css">
    <link rel="stylesheet" href="static/styles/archives.css" type="text/css">
    <link rel="stylesheet" href="static/styles/common.css" type="text/css">
    <link rel="stylesheet" href="static/plugins/icheck/skins/all.css" type="text/css">
 
 
    <script type="text/javascript" src="static/plugins/jquery/jquery.min.js"></script>
    <script type="text/javascript" src="static/plugins/jquery-easyui/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="static/plugins/jquery-easyui/locale/easyui-lang-zh_CN.js"></script>
    <script type="text/javascript" src="static/plugins/jquery-easyui/plugins/datagrid-detailview.js"></script>
    <script type="text/javascript" src="static/scripts/easyuiExtend.js"></script>
    <script type="text/javascript" src="static/scripts/jquery-extend.js"></script>
    <script type="text/javascript" src="static/plugins/layer/layer.js"></script>
    <script type="text/javascript" src="static/plugins/slimScroll/jquery.slimscroll.min.js"></script>
    <script type="text/javascript" src="static/plugins/jquery-easyui-edatagrid/jquery.edatagrid.js"></script>
    <script type="text/javascript" src="static/plugins/icheck/icheck.min.js"></script>
    <!-- 弹窗加载组件 -->
    <script type="text/javascript" src="static/plugins/layer/layer.js"></script>
    <script type="text/javascript" src="static/plugins/spinjs/spin.js"></script>
    <script type="text/javascript" src="static/plugins/spinjs/jquery.spin.js"></script>
    <script type="text/javascript" src="static/plugins/jquery.blockUI.js"></script>
    <script type="text/javascript" src="static/plugins/ace/src-noconflict/ace.js"></script>
    <!-- wcp组件 -->
    <script type="text/javascript" src="static/wcp/scripts/wcp.js"></script>
    <script type="text/javascript" src="static/wcp/scripts/libs/wcp.layer.js"></script>
    <script type="text/javascript" src="static/wcp/scripts/libs/wcp.blockUI.js"></script>
    <script type="text/javascript" src="static/wcp/scripts/libs/wcp.spin.js"></script>
    <script type="text/javascript" src="static/wcp/scripts/libs/wcp.jquery.js"></script>
 
    <!--[if lt IE 9]>
    <script type="text/javascript" src="static/plugins/json2.js"></script>
    <![endif]-->
    <script type="text/javascript" src="static/plugins/webuploader/webuploader.js"></script>
    <script src="static/plugins/webuploader/webuploader.min.js"></script>
    <script src="static/plugins/ptfileupload/pt.fileupload.js"></script>
    <style>
        body {
            background: #f3f5fa;
            width: 1150px;
            margin: 0 auto;
        }
 
        .pt-form table {
            margin: 20px auto 0px auto;
        }
 
        .webuploader-pick {
            background-color: #d81b60;
            border: 1px solid #c40a4e;
            border-radius: 4px;
            color: #fff;
            padding: 5px 10px;
            float: right;
            margin: -10px 32px 0 0;
        }
 
        .webuploader-pick i.fa-upload {
            padding-right: 0.3em;
            color: #fff;
        }
    </style>
 
</head>
<body>
<div class="margin-lr">
    <div class="pt-title-theme3">
        <i class="fa fa-file-text"></i>
        <h4>借阅申请单</h4>
    </div>
    <div class="ptbody">
        <div class="pt-application-row">
            <div class="pt-subtitle">
                <i></i>
                <span>借阅审批</span>
            </div>
            <div class="pt-form">
                <form id="form1">
                    <table style="width: 100%;">
                        <tr>
                            <td class="tbtitle">借阅单编号</td>
                            <td>
                                <input id="formId" name="formId" type="hidden"
                                       value="${borrowForm.formId}"/>
                                <span style="color:#808080;">
                                        <input class="easyui-textbox" id="applyCode" name="applyCode" type="text"
                                               style="width:310px" value="${borrowForm.applyCode}"
                                               readonly/>
                                    </span>
                            </td>
                        </tr>
                        <tr>
                            <td class="tbtitle">姓名
                            </td>
                            <td>
                                <input class="easyui-textbox" id="borrowUserName" name="borrowUserName"
                                       type="text" style="width:310px"
                                       value="${borrowForm.borrowUserName}" readonly/>
                                <input type="hidden" id="borrowUserId" name="borrowUserId" type="text"
                                       style="width:310px" value="${borrowForm.borrowUserId}"
                                       readonly/>
                            </td>
                            <td class="tbtitle">
                                工作单位:
                            </td>
                            <td>
                                <input class="easyui-textbox" name="deptName" type="text" style="width:310px"
                                       value="${borrowForm.deptName}"
                                       data-options="tipPosition:'bottom'" readonly/>
                            </td>
                        </tr>
 
                        <tr>
                            <td class="tbtitle">
                                邮编:
                            </td>
                            <td>
                                <input class="easyui-textbox" id="postCode" name="postCode" type="text"
                                       style="width:310px"
                                       value="${borrowForm.postCode}"
                                       data-options="tipPosition:'bottom'" readonly/>
                            </td>
                            <td class="tbtitle">
                                单位地址:
                            </td>
                            <td>
                                <input class="easyui-textbox" id="deptAddress" name="deptAddress" type="text"
                                       style="width:310px"
                                       value="${borrowForm.deptAddress}"
                                       data-options="tipPosition:'bottom'"/>
                            </td>
                        </tr>
                        <tr>
                            <td class="tbtitle">电话:</td>
                            <td>
                                <input class="easyui-textbox" id="telNumber" name="telNumber" type="text"
                                       style="width:310px"
                                       value="${borrowForm.telNumber}"
                                       data-options="tipPosition:'bottom'" readonly/>
                            </td>
                            <td class="tbtitle">流程状态</td>
                            <td>
                                <c:if test="${borrowForm.applyCode==null}">
                                    <font style="color:red"><b>未发起流程</b></font>
                                </c:if>
                                <c:if test="${borrowForm.flowState==0}">
                                    <font style="color:#00a55a;"><b>流程中[${borrowForm.flowStep}]</b></font>
                                </c:if>
                                <c:if test="${borrowForm.flowState==1}">
                                    <font style="color:#00a55a;"><b>已结束</b></font>
                                </c:if>
                                <c:if test="${borrowForm.flowState==-1}">
                                    <font style="color:#00a55a;"><b>已终止</b></font>
                                </c:if>
                            </td>
                        </tr>
                        <tr>
                            <td class="tbtitle">手机:</td>
                            <td>
                                <input class="easyui-textbox" id="borrowTel" name="telNumber" type="text"
                                       style="width:310px"
                                       value="${borrowForm.borrowTel}"
                                       data-options="tipPosition:'bottom'" readonly/>
                            </td>
<%--                            <td class="tbtitle">涉密证书编号:</td>--%>
<%--                            <td>--%>
<%--                                <input class="easyui-textbox" id="certificateNumber" name="certificateNumber"--%>
<%--                                       type="text"--%>
<%--                                       style="width:310px"--%>
<%--                                       value="${borrowForm.certificateNumber}"--%>
<%--                                       data-options="tipPosition:'bottom'" readonly/>--%>
<%--                            </td>--%>
                            <td class="tbtitle">是否通过流程:</td>
                            <td>
                                <input type="hidden" id="utilizationMethod" name="utilizationMethod" type="text"
                                       style="width:310px" value="${borrowForm.utilizationMethod}"
                                       readonly/>
                            </td>
                        </tr>
                        <tr>
                            <td class="tbtitle"><em class="pt-color-danger">*</em>资料用途</td>
                            <td colspan="3">
                                <input class="easyui-textbox" name="borrowPurpose"
                                       data-options="multiline:true,required:true"
                                       style="height:70px;width:98%"
                                       value="${borrowForm.borrowPurpose}" readonly>
                            </td>
                        </tr>
                        <tr>
                            <td class="tbtitle">用户备注</td>
                            <td colspan="3">
                                <input class="easyui-textbox" name="remark" data-options="multiline:true"
                                       style="height:70px;width:98%" value="${borrowForm.remark}" readonly>
                            </td>
                        </tr>
                    </table>
                </form>
            </div>
        </div>
        <div class="pt-application-row">
            <div class="pt-subtitle">
                <i></i>
                <span>附件</span>
            </div>
            <div class="pt-fj clear">
                <div class="pt-process-formats">
                    <ul class="clear" id="thelist">
                    </ul>
                </div>
                <div id="picker">
                    <i class="fa fa-upload"></i>
                    上传附件
                </div>
            </div>
        </div>
        <div class="pt-application-row">
            <div class="pt-subtitle">
                <i></i>
                <span>借阅明细</span>
            </div>
            <div class="pt-spacing" style="padding:18px 10px">
                <div class="easyui-accordion">
                    <c:forEach items="${borrowInfoList}" var="borrowInfo">
                        <div style="overflow:hidden;"
                             title="档号:${borrowInfo.parentBorrowInfo.archivalCode}   ${borrowInfo.parentBorrowInfo.fileTitle}">
                            <table cellspacing="0" cellpadding="0">
                                <tr>
                                    <th style="width:10%;text-align:center;">档号</th>
                                    <th style="width:30%;text-align:center;">题名</th>
                                    <th style="width:10%;text-align:center;">密级</th>
                                    <th style="width:10%;text-align:center;">涉密页码</th>
                                    <th>
                                        <input type="checkbox" class="flat"
                                               id="electronic_all_${borrowInfo.parentBorrowInfo.fileId}"/>电子
                                        <input type="checkbox" class="flat"
                                               id="paper_all_${borrowInfo.parentBorrowInfo.fileId}"/>纸质
                                        <input type="checkbox" class="flat"
                                               id="original_all_${borrowInfo.parentBorrowInfo.fileId}"/>调阅原件
                                    </th>
                                    <th>
                                        <input type="radio" class="flat"
                                               name="agreeGroupAll_${borrowInfo.parentBorrowInfo.fileId}"
                                               id="agree_all_${borrowInfo.parentBorrowInfo.fileId}"/>
                                        同意
                                        <input type="radio" class="flat"
                                               name="agreeGroupAll_${borrowInfo.parentBorrowInfo.fileId}"
                                               id="notAgree_all_${borrowInfo.parentBorrowInfo.fileId}"/>
                                        不同意
                                    </th>
                                    <th style="text-align:center">浏览</th>
                                </tr>
                                <c:forEach items="${borrowInfo.borrowDetailList}"
                                           var="borrowDetail">
                                    <tr>
                                        <td style="text-align:center;">${borrowDetail.itemCode}</td>
                                        <td style="text-align:center;">${borrowDetail.itemTitle}</td>
                                        <td style="text-align:center;">${borrowDetail.securityClassification}</td>
                                        <td style="text-align:center;">${borrowDetail.securityPageNum}</td>
                                        <td>
                                            <input type="checkbox" class="flat"
                                                   id="electronic_${borrowDetail.detailId}"
                                                   name="electronic_${borrowDetail.fileId}"/>电子
                                            <input type="checkbox" class="flat"
                                                   id="paper_${borrowDetail.detailId}"
                                                   name="paper_${borrowDetail.fileId}"/>纸质
                                            <input type="checkbox" class="flat"
                                                   id="original_${borrowDetail.detailId}"
                                                   name="original_${borrowDetail.fileId}"/>调阅原件
                                        </td>
                                        <td>
                                            <input type="radio" class="flat"
                                                   name="agreeGroup_${borrowDetail.detailId}"
                                                   id="agree_${borrowDetail.detailId}"/>
                                            同意
                                            <input type="radio" class="flat"
                                                   name="agreeGroup_${borrowDetail.detailId}"
                                                   id="notAgree_${borrowDetail.detailId}"/>
                                            不同意
                                        </td>
                                        <td style="text-align:center;padding:0"
                                            id="browse_file_${borrowDetail.detailId}">
                                        </td>
                                    </tr>
                                </c:forEach>
                            </table>
                        </div>
                    </c:forEach>
                </div>
 
            </div>
        </div>
        <div class="pt-application-row">
            <div class="pt-subtitle">
                <i></i>
                <span>流程记录</span>
                <i></i>
                <a href="javascript:showFlowDiagram();">
                    <span style="color: #0a84ff">流程示意图</span>
                </a>
            </div>
            <div class="pt-tablelist">
                <table cellspacing="0" cellpadding="0">
                    <tr>
                        <th>序号</th>
                        <th>办理环节</th>
                        <th>办理人员</th>
                        <th>办理意见</th>
                        <th>处理时间</th>
                    </tr>
                    <c:forEach items="${historyTaskList}" varStatus="status" var="history">
                        <tr>
                            <td>${status.index+1 }</td>
                            <td>${history.taskName }</td>
                            <td>${history.assigneeUserName }</td>
                            <c:if test="${history.deleteReason!=null&&'ROLL_BACK'.equals(history.deleteReason)}">
                                <td>[退回]${history.approvalComment }</td>
                            </c:if>
                            <c:if test="${history.deleteReason!=null&&'PROCESS_INSTANCE_DELETED'.equals(history.deleteReason)}">
                                <td>[终止]${history.approvalComment }</td>
                            </c:if>
                            <c:if test="${history.deleteReason==null||(!'ROLL_BACK'.equals(history.deleteReason)&&!'PROCESS_INSTANCE_DELETED'.equals(history.deleteReason))}">
                                <td>${history.approvalComment }</td>
                            </c:if>
                            <td>
                                <fmt:formatDate value="${history.endTime }" pattern="yyyy-MM-dd HH:mm:ss"/>
                            </td>
                        </tr>
                    </c:forEach>
                </table>
            </div>
        </div>
        <div class="pt-application-btn">
            <%--            <button class="pt-btn pt-btn-primary" onclick="saveBorrowDetail()">保存信息</button>--%>
            <c:if test="${task!=null || approvePermission}">
                <button class="pt-btn pt-btn-primary" onclick="dealFlow()">流程办理</button>
            </c:if>
            <%--            <c:if test="${borrowForm.flowState==1}">--%>
                            <button class="pt-btn pt-btn-warning" onclick="reportPrinting()"><i class="fa fa-map-o"></i>打印借阅单
            <%--                </button>--%>
            <%--            </c:if>--%>
            <button class="pt-btn pt-btn-default" onclick="closeWindow()">关闭</button>
        </div>
    </div>
</div>
</body>
<script type="text/javascript" src="static/scripts/ResizeScroll.js"></script>
<script>
    var selectId = '0';
    var params = {
        callBack: null,
        callBackParams: null
    };
 
    $(function () {
        new ResizeScroll({
            "id": ".ptbody", fun: function () {
                var wh = $(window).height();
                return (wh - 36 - 28 - 10);
            }
        });
 
        //渲染所有checkbox
        $('input[type=radio],input[type="checkbox"].flat').iCheck({
            checkboxClass: 'icheckbox_flat-red',
            radioClass: 'iradio_square-green',
            increaseArea: '50%',
        });
 
 
        <c:forEach items="${borrowInfoList}" var="borrowInfo">
        //全部电子选中与否
        $('#electronic_all_${borrowInfo.parentBorrowInfo.fileId}').on('ifChecked', function (event) {
            $("input[name='electronic_${borrowInfo.parentBorrowInfo.fileId}']").iCheck('check');
        });
        $('#electronic_all_${borrowInfo.parentBorrowInfo.fileId}').on('ifUnchecked', function (event) {
            $("input[name='electronic_${borrowInfo.parentBorrowInfo.fileId}']").iCheck('uncheck');
        });
        //全部纸质选中与否
        $('#paper_all_${borrowInfo.parentBorrowInfo.fileId}').on('ifChecked', function (event) {
            $("input[name='paper_${borrowInfo.parentBorrowInfo.fileId}']").iCheck('check');
        });
        $('#paper_all_${borrowInfo.parentBorrowInfo.fileId}').on('ifUnchecked', function (event) {
            $("input[name='paper_${borrowInfo.parentBorrowInfo.fileId}']").iCheck('uncheck');
        });
        //全部原件借出选中与否
        $('#original_all_${borrowInfo.parentBorrowInfo.fileId}').on('ifChecked', function (event) {
            $("input[name='original_${borrowInfo.parentBorrowInfo.fileId}']").iCheck('check');
        });
        $('#original_all_${borrowInfo.parentBorrowInfo.fileId}').on('ifUnchecked', function (event) {
            $("input[name='original_${borrowInfo.parentBorrowInfo.fileId}']").iCheck('uncheck');
        });
 
        //全部同意与否
        $('#agree_all_${borrowInfo.parentBorrowInfo.fileId}').on('ifChecked', function (event) {
            <c:forEach items="${borrowInfo.borrowDetailList}" var="borrowDetail">
            $("input[id='agree_${borrowDetail.detailId}']").iCheck('check');
            </c:forEach>
        });
        $('#notAgree_all_${borrowInfo.parentBorrowInfo.fileId}').on('ifChecked', function (event) {
            <c:forEach items="${borrowInfo.borrowDetailList}" var="borrowDetail">
            $("input[id='notAgree_${borrowDetail.detailId}']").iCheck('check');
            </c:forEach>
        });
        </c:forEach>
 
 
        <c:forEach items="${allBorrowDetailList}" var="borrowDetail">
        if ('${borrowDetail.electronic}' == '1') {
            $("#electronic_${borrowDetail.detailId}").iCheck('check');
        }
        if ('${borrowDetail.paper}' == '1') {
            $("#paper_${borrowDetail.detailId}").iCheck('check');
        }
        if ('${borrowDetail.original}' == '1') {
            $("#original_${borrowDetail.detailId}").iCheck('check');
        }
        if ('${borrowDetail.agree}' == '1') {
            $("#agree_${borrowDetail.detailId}").iCheck('check');
        }
        if ('${borrowDetail.agree}' == '0') {
            $("#notAgree_${borrowDetail.detailId}").iCheck('check');
        }
 
 
        //审核过的不允许选择同意与否,选中与否
        <c:if test="${borrowForm.flowState!=0}">
        $("#electronic_all_${borrowDetail.fileId}").iCheck('disable');
        $("#paper_all_${borrowDetail.fileId}").iCheck('disable');
        $("#original_all_${borrowDetail.fileId}").iCheck('disable');
 
        $('#agree_all_${borrowDetail.fileId}').iCheck('disable');
        $('#notAgree_all_${borrowDetail.fileId}').iCheck('disable');
 
        $("#electronic_${borrowDetail.detailId}").iCheck('disable');
        if ('${borrowDetail.electronic}' == '1') {
            $("#electronic_${borrowDetail.detailId}").parent().attr('class', 'icheckbox_flat-red checked');
        }
        $("#apeer_${borrowDetail.detailId}").iCheck('disable');
        if ('${borrowDetail.paper}' == '1') {
            $("#paper_${borrowDetail.detailId}").parent().attr('class', 'icheckbox_flat-red checked');
        }
        $("#original_${borrowDetail.detailId}").iCheck('disable');
        if ('${borrowDetail.original}' == '1') {
            $("#original_${borrowDetail.detailId}").parent().attr('class', 'icheckbox_flat-red checked');
        }
 
 
        $("#agree_${borrowDetail.detailId}").iCheck('disable');
        <c:if test="${borrowDetail.agree==1}">
        $("#agree_${borrowDetail.detailId}").parent().attr('class', 'iradio_square-red checked');
        </c:if>
        $("#notAgree_${borrowDetail.detailId}").iCheck('disable');
        <c:if test="${borrowDetail.agree==0}">
        $("#notAgree_${borrowDetail.detailId}").parent().attr('class', 'iradio_square-green checked');
        </c:if>
 
        </c:if>
        $('#browse_file_${borrowDetail.detailId}').html('');
        $.ajax({
            url: "fileView/checkHasAttach?keyId=${borrowDetail.itemId}&type=${borrowDetail.borrowType}",    //请求的url地址
            dataType: "json",   //返回格式为json
            type: "post",
            async: false,
            success: function (data) {
                if (data) {
                    var html = "<a href='fileView/viewFile?keyId=${borrowDetail.itemId}&type=${borrowDetail.borrowType}' target='_blank' class='pt-color-primary'><i class='fa fa-eye' title='浏览'></i></a>";
                    $('#browse_file_${borrowDetail.detailId}').append(html);
                }
            }
        })
        </c:forEach>
        loadAttachList();
    });
 
 
    //选中并且清除灰色样式
    function setCheckedDisableAndClearDisableCss(type, id) {
        $("#" + type + "_" + id).iCheck('check');
        $("#" + type + "_" + id).iCheck('disable');
        $("#" + type + "_" + id).parent().attr('class', 'icheckbox_flat-red checked');
    }
 
    //不选中,允许可选
    function setUnCheckedEnable(type, id) {
        $("#" + type + "_" + id).iCheck('uncheck');
        $("#" + type + "_" + id).iCheck('enable');
    }
 
    //不选中,不可选
    function setUnCheckedDisable(type, id) {
        $("#" + type + "_" + id).iCheck('uncheck');
        $("#" + type + "_" + id).iCheck('disable');
    }
 
 
    //保存所有选中状态
    function saveBorrowDetail() {
        var array = [];
        <c:forEach items="${allBorrowDetailList}" var="borrowDetail">
        var detailId = '${borrowDetail.detailId}';
 
        var electronic = $("#electronic_" + detailId).is(':checked') == true ? 1 : 0;
        var paper = $("#paper_" + detailId).is(':checked') == true ? 1 : 0;
        var original = $("#original_" + detailId).is(':checked') == true ? 1 : 0;
        var agree = $("#agree_" + detailId).is(':checked');
        var notAgree = $("#notAgree_" + detailId).is(':checked');
        var borrowDetailInfo;
        if (agree) {
            agree = 1;
        } else {
            agree = 0;
        }
        ;
        borrowDetailInfo = {
            "detailId": detailId,
            "electronic": electronic,
            "paper": paper,
            "original": original,
            "agree": agree
        };
 
        array.push(borrowDetailInfo);
        </c:forEach>
 
        wcp.ui.setBusy("body", wcp.ajax({
            url: "borrow/saveBorrowDetail",
            data: JSON.stringify(array),
        }).done(function (result) {
            wcp.notify.success('保存成功!');
        }));
    }
 
    function dealFlow() {
        saveBorrowDetail();
        var url = "flow/dealFlow?keyId=${borrowForm.formId}&processInstanceId=${processInstanceId}&taskId=${task.taskId}";
        var title = "流程办理";
        top.layer.open({
            title: title,
            type: 2,
            area: ["680px", "550px"],
            fixed: false,
            content: url,
            success: function (layero, index) {
                var body = window.top.layer.getChildFrame('body', index);
                var iframeWin = window.top[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象
 
                //将表单参数传给流程办理页面
                var formData = $("#form1").serializeObject();
                iframeWin.params.variables = formData;
                iframeWin.params.callBack = dealFlowCallBack;
            }
        });
    }
 
    function dealFlowCallBack() {
        //saveArchivesUtilizationForm();
        //判断是否需要执行回调函数
        if (params.callBack) {
            if (params.callBackParams) {
                params.callBack(params.callBackParams);
            } else {
                params.callBack();
            }
        }
 
        closeWindow();
    }
 
    function closeWindow() {
        var title = top.$('#tt').tabs('getSelected').panel("options").title;
        top.$("#tt").tabs("close", title);
    }
 
 
    //上传附件
    var $list = $('#thelist');
    var addFile = [];//增加的附件
    var deleteFile = [];//删除的附件,只存已在数据库中数据
    //上传附件
    var fileUpload = new FileUpload({
        auto: true,
        serverPath: 'general/uploadFile?moduleId=${borrowFormModule.moduleId}&tableId=${borrowFormModule.mainTableId}&keyId=${borrowForm.formId}&attachType=0',
        fileSingleSizeLimit: 1024 * 1024 * 1024,
        uploadSuccess: function (file, response) {
            response = eval(response);
            addFile.push(response.result);
            var uploadName = response.result.uploadName;
            var attachUrl = response.result.attachUrl.replace(/\\/g, "\\\\");
            var attachViewUrl = response.result.attachViewUrl.replace(/\\/g, "\\\\");
            var physicalName = response.result.physicalName;
            $('#' + file.id).find('.pt-process-bar').fadeOut();
            $('#' + file.id).find('span.state').text('已上传');
            $('#' + file.id).children("div").append('<div class="pt-process-formats-btn" style="float:left">'
                + '<a href="javascript:;" class="pt-color-success" onclick="viewFile(\'0\',\'0\',\'' + attachViewUrl + '\')"><i class="fa fa-eye" title="查看"></i>查看</a>'
                + '<a href="javascript:;" class="pt-color-danger" onclick="removeFile(\'' + file.id + '\',\'' + uploadName + '\')"><i class="fa fa-trash-o" title="删除"></i>删除</a>'
                + '<a href="javascript:;" class="pt-color-primary" onclick="downLoadFile(0,\'' + attachUrl + '\',\'' + physicalName + '\')"><i class="fa fa-download" title="下载"></i>下载</a></div>');
            saveAttachs('${borrowForm.formId}');
        },
        fileQueued: function (file) {
            $list.append('<li id="' + file.id + '"><img src="static/styles/images/' + getImg('.' + file.ext) + '">'
                + '<div class="pt-process-formats-txt"><h5 title="' + file.name + '">' + file.name + '</h5>'
                + '<div class="pt-process-bar"><div class="bar"><div class="subbar"></div></div><span class="state">等待上传...</span></div></div></li>');
        },
        uploadProgress: function (file, percentage) {
            var $li = $('#' + file.id),
                $percent = $li.find('.subbar');
            $li.find('span.state').text('上传中');
            $percent.css('width', percentage * 100 + '%');
        },
        uploadError: function (file, reason) {
            $('#' + file.id).find('span.state').text('上传出错').parent().append("<i class='fa fa-close pt-color-danger'></i>");
        },
        //捕捉加入队列前的错误
        uploadBeforeError: function (type) {
            wcp.notify.error("上传出错!请检查后重新上传!错误代码" + type);
        },
        uploadComplete: function (file) {
 
        }
    });
 
    $list.delegate('i.fa-close', 'click', function (event) {
        $(this).closest("li").remove();
    });
 
    //加载附件列表
    function loadAttachList() {
        $list.html('');
        $.ajax({
            type: 'POST',
            contentType: "application/json; charset=utf-8",
            async: false,//取消异步请求
            url: 'general/getAttachList?moduleId=${borrowFormModule.moduleId}&keyId=${borrowForm.formId}',
            success: function (data) {
                for (var i = 0; i < data.length; i++) {
                    var img = getImg(data[i].extension);
                    var attachUrl = data[i].attachUrl.replace(/\\/g, "\\\\");
                    var attachId = data[i].attachId;
                    var physicalName = data[i].physicalName;
                    var attachType = data[i].attachType;
                    var extension = data[i].extension.toLowerCase();
                    if (attachType == 0) {
                        var htmlStr = '<li id="' + data[i].attachId + '">'
                            + '<img src="static/styles/images/' + img + '" alt="">'
                            + '<div class="pt-process-formats-txt">'
                            + '   <h5 title="${attach.physicalName}">' + physicalName + '</h5> '
                            + '   <div class="pt-process-formats-btn">'
                            + '       <a href="javascript:;" class="pt-color-success" onclick="viewFile(\'' + attachId + '\',0)">'
                            + '           <i class="fa fa-eye" title="查看"></i>查看</a> ';
                        if (extension == ".doc" || extension == ".docx" || extension == ".xls" || extension == ".xlsx") {
                            htmlStr += '<a href="javascript:;" class="pt-color-primary" onclick="viewFile(\'' + attachId + '\',1)">'
                                + '           <i class="fa fa-pencil" title="编辑"></i>编辑</a>';
                        }
                        htmlStr += '<a href="javascript:;" class="pt-color-danger" onclick="removeFile(\'' + attachId + '\',null,\'' + attachUrl + '\')">'
                            + '           <i class="fa fa-trash-o" title="删除"></i>删除</a>'
                            + '       <a href="javascript:;" class="pt-color-primary" onclick="downLoadFile(\'' + attachId + '\',\'' + attachUrl + '\',\'' + physicalName + '\')">'
                            + '           <i class="fa fa-download" title="下载"></i>下载</a>'
                            + '   </div>'
                            + '</div>'
                            + '</li> ';
                        $list.append(htmlStr);
                    } else if (attachType == 1) {
                        var mainBodyAttachHtml = '<div  id="' + attachId + '" class="form-unit-text clear">'
                            + '<img src="static/styles/images/' + img + '">'
                            + '<p>' + physicalName + '</p> '
                            + '<div class="pt-process-formats-btn">'
                            + '    <a href="javascript:;" class="pt-color-success" onclick="viewFile(\'' + attachId + '\',0)">'
                            + '    <i class="fa fa-eye" title="查看"></i>查看</a>'
                            + '    <a href="javascript:;" class="pt-color-danger" onclick="removeFile(\'' + attachId + '\',null,\'' + attachUrl + '\')">'
                            + '    <i class="fa fa-trash-o" title="删除"></i>删除</a>'
                            + '    <a href="javascript:;" class="pt-color-primary" onclick="downLoadFile(\'' + attachId + '\',\'' + attachUrl + '\',\'' + physicalName + '\')">'
                            + '    <i class="fa fa-download" title="下载"></i>下载</a>'
                            + '    <a href="javascript:;" class="pt-color-warning">'
                            + '</div> '
                            + '</div>';
                        $('#divMainBodyAttach').html('');
                        $('#divMainBodyAttach').append(mainBodyAttachHtml);
                    }
                }
            }
        });
    }
 
    function getImg(ext) {
        var ret = "";
 
        switch (ext) {
            case "wps":
            case "docx":
            case "doc":
                ret = "formats-word.png";
                break;
            case "et":
            case "xlsx":
            case "xls":
                ret = "formats-excel.png";
                break;
            case "pptx":
            case "ppt":
                ret = "formats-ppt.png";
                break;
            case "pdf":
                ret = "formats-pdf.png";
                break;
            case "zip":
                ret = "formats-zip.png";
                break;
            case "png":
            case "jpg":
            case "jpeg":
            case "bmp":
            case "gif":
                ret = "formats-img.png";
                break;
            default:
                ret = "formats-lcurrency.png";
                break;
 
        }
 
        return ret;
    }
 
    function downLoadFile(attachId, attachUrl, physicalName) {
        var url = 'general/beforeDownloadAttach?attachId=' + attachId;
        $.ajax({
            type: 'POST',
            url: "general/beforeDownloadAttach?attachId=" + attachId,
            async: false,
            success: function (data) {
                if (data == "noAuthorize") {
                    wcp.message.error('对不起,您无权限下载此附件!');
                } else if (data == "noFile") {
                    wcp.message.error('对不起,不存在此附件!');
                } else {
                    dowloadAttachFunction(attachId, attachUrl, physicalName);
                }
            }
        });
    }
 
 
    //下载附件
    function dowloadAttachFunction(attachId, attachUrl, physicalName) {
        var url = 'general/downLoadAttach?attachId=' + attachId;
        //创建form
        var form = document.getElementById('#downLoadForm');
        if (form == null) {
            form = $("<form>");
            form.attr("id", "downLoadForm");
            form.attr("style", "display:none");
            form.attr("target", "");
            form.attr("method", "post");
            $("body").append(form);
        }
        form.attr("action", url);
        //附件地址
        var inputAttachUrl = document.getElementById('#iptAttachUrl');
        if (inputAttachUrl == null) {
            inputAttachUrl = $("<input>");
            inputAttachUrl.attr("id", "iptAttachUrl");
            form.append(inputAttachUrl);
        }
        inputAttachUrl.attr("type", "hidden");
        inputAttachUrl.attr("name", "attachUrl");
        inputAttachUrl.val(attachUrl);
        //附件物理名称
        var inputPhysicalName = document.getElementById('#iptphysicalName');
        if (inputPhysicalName == null) {
            inputPhysicalName = $("<input>");
            inputPhysicalName.attr("id", "iptphysicalName");
            form.append(inputPhysicalName);
        }
        inputPhysicalName.attr("type", "hidden");
        inputPhysicalName.attr("name", "physicalName");
        inputPhysicalName.val(physicalName);
        form.submit();
    }
 
    //浏览附件
    function viewFile(attachId, isEdit, attachViewUrl) {
        var url = 'general/viewFile?attachId=' + attachId + '&isEdit=' + isEdit + '&attachViewUrl=' + encodeURIComponent(attachViewUrl);
        // top.addPanel(url, '附件浏览' + attachId);
        window.open(url);
    }
 
    //移除附件,临时上传文件暂时未删除
    function removeFile(attachId, uploadName, attachUrl) {
        try {
            $('#' + attachId).closest("li").remove();
        } catch (e) {
        }
        try {
            $('#' + attachId).closest("div").remove();
        } catch (e) {
        }
        if (uploadName == null) {
            deleteFile.push({'attachId': attachId, "attachUrl": attachUrl});
            deleteAttachs();
        } else {
            removeAaary(addFile, uploadName); //移除临时保存的
        }
    }
 
    /*删除数组中的某一个对象
    _arr:数组
    _obj:需删除的对象
    */
    function removeAaary(_arr, _obj) {
        var length = _arr.length;
        for (var i = 0; i < length; i++) {
            if (_arr[i].uploadName == _obj) {
                if (i == 0) {
                    _arr.shift(); //删除并返回数组的第一个元素
                    return _arr;
                } else if (i == length - 1) {
                    _arr.pop();  //删除并返回数组的最后一个元素
                    return _arr;
                } else {
                    _arr.splice(i, 1); //删除下标为i的元素
                    return _arr;
                }
            }
        }
    }
 
    //保存增加的附件数据,数据新增时keyId不为null
    function saveAttachs(keyId) {
 
        var url = "api/general/saveAttachs";
        if (keyId != null) {
            url = url + "?keyId=" + keyId;
        }
        $.ajax({
            type: 'POST',
            contentType: "application/json; charset=utf-8",
            url: url,
            dataType: 'json',
            data: JSON.stringify(addFile),
            async: false,//取消异步请求
            success: function (data) {
                addFile = [];
            }
        });
    }
 
    //删除指定的附件数据
    function deleteAttachs() {
        $.ajax({
            type: 'POST',
            contentType: "application/json; charset=utf-8",
            url: "api/general/deleteAttachs",
            dataType: 'json',
            data: JSON.stringify(deleteFile),
            async: false,//取消异步请求
            success: function (data) {
                deleteFile = [];
            }
        });
    }
 
    function openTab(url, title, partId, type) {
        top.addPanel(url, title);
        var curTabWin = null;
        var curTab = top.$('#tt').tabs('getSelected');
        if (curTab && curTab.find('iframe').length > 0) {
            curTabWin = curTab.find('iframe')[0].contentWindow;
            //将回调函数传给子页面
            $(curTabWin).load(function () {
                if (curTabWin.params) {
                    curTabWin.params.callBackParams = partId;
                    curTabWin.params.callBack = getPartContent;
                    if (type == 1) {
                        curTabWin.params.callBack = refreshData;
                    }
                }
            });
        }
    }
 
    //打印借阅单
    function reportPrinting() {
        var applyCode = $("#applyCode").textbox("getValue");
        var borrowUserName = $("#borrowUserName").textbox("getValue");
        var fileName = applyCode + "_" + borrowUserName;
        // var reportFile = "borrow_approval.ureport.xml";
        var reportFile = "borrow_approval_hn.ureport.xml"
        var path = "<%=path%>";
        var url = path + "/ureport/preview?_u=file:" + reportFile + "&_i=&_n=" + fileName + "&formId=" + '${borrowForm.formId}';
        window.open(url);
    }
 
    /**
     * 流程示意图
     */
    function showFlowDiagram() {
        top.layer.open({
            title: "流程示意图",
            type: 2,
            area: ['1100px', '600px'],
            shadeClose: true, //点击遮罩关闭
            content: 'flow/showFlowDiagram?processInstanceId=${processInstanceId}'
        });
    }
 
 
</script>
</html>