lookup.js
47.3 KB
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
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
var bankList = [
{"id": "1", "name": "渤海银行", "type": "BANK",prefix:"b"},
{"id": "2", "name": "广发银行", "type": "BANK",prefix:"g"},
{"id": "3", "name": "国家开发银行", "type": "BANK",prefix:"g"},
{"id": "4", "name": "恒丰银行", "type": "BANK",prefix:"h"},
{"id": "5", "name": "华夏银行", "type": "BANK",prefix:"h"},
{"id": "6", "name": "交通银行", "type": "BANK",prefix:"j"},
{"id": "7", "name": "平安银行", "type": "BANK",prefix:"p"},
{"id": "8", "name": "上海浦东发展银行", "type": "BANK",prefix:"s"},
{"id": "9", "name": "兴业银行", "type": "BANK",prefix:"x"},
{"id": "10", "name": "招商银行", "type": "BANK",prefix:"z"},
{"id": "11", "name": "浙商银行", "type": "BANK",prefix:"z"},
{"id": "12", "name": "中国工商银行", "type": "BANK",prefix:"z"},
{"id": "13", "name": "中国光大银行", "type": "BANK",prefix:"z"},
{"id": "14", "name": "中国建设银行", "type": "BANK",prefix:"z"},
{"id": "15", "name": "中国民生银行", "type": "BANK",prefix:"z"},
{"id": "16", "name": "中国农业银行", "type": "BANK",prefix:"z"},
{"id": "17", "name": "中国银行", "type": "BANK",prefix:"z"},
{"id": "18", "name": "中国邮政储蓄银行", "type": "BANK",prefix:"z"},
{"id": "19", "name": "中信银行", "type": "BANK",prefix:"z"},
{"id": "20", "name": "安阳银行", "type": "BANK",prefix:"a"},
{"id": "21","name": "鞍山银行","type": "BANK",prefix:"a"},
{"id": "22", "name": "包商银行", "type": "BANK",prefix:"b"},
{"id": "23", "name": "保定银行", "type": "BANK",prefix:"b"},
{"id": "24", "name": "北京银行","type": "BANK",prefix:"b"},
{"id": "25", "name": "本溪市商业银行", "type": "BANK",prefix:"b"},
{"id": "26", "name": "沧州银行", "type": "BANK",prefix:"c"},
{"id": "27", "name": "长安银行","type": "BANK",prefix:"c"},
{"id": "28", "name": "长沙银行", "type": "BANK",prefix:"c"},
{"id": "29", "name": "长治市商业银行", "type": "BANK",prefix:"c"},
{"id": "30","name": "朝阳银行","type": "BANK",prefix:"c"},
{"id": "31", "name": "成都银行", "type": "BANK",prefix:"c"},
{"id": "32", "name": "承德银行", "type": "BANK",prefix:"c"},
{"id": "33", "name": "重庆三峡银行", "type": "BANK",prefix:"c"},
{"id": "34", "name": "重庆银行", "type": "BANK",prefix:"c"},
{"id": "35", "name": "达州市商业银行", "type": "BANK",prefix:"d"},
{"id": "36", "name": "大连银行", "type": "BANK",prefix:"d"},
{"id": "37", "name": "大同市商业银行", "type": "BANK",prefix:"d"},
{"id": "38", "name": "丹东银行", "type": "BANK",prefix:"d"},
{"id": "39", "name": "德阳银行", "type": "BANK",prefix:"d"},
{"id": "40", "name": "德州银行", "type": "BANK",prefix:"d"},
{"id": "41", "name": "东莞银行", "type": "BANK",prefix:"d"},
{ "id": "42", "name": "东营银行", "type": "BANK",prefix:"d"},
{"id": "43", "name": "鄂尔多斯银行", "type": "BANK",prefix:"e"},
{"id": "44", "name": "福建海峡银行", "type": "BANK",prefix:"f"},
{ "id": "45", "name": "抚顺银行", "type": "BANK",prefix:"f"},
{"id": "46", "name": "阜新银行", "type": "BANK",prefix:"f"},
{"id": "47", "name": "富滇银行", "type": "BANK",prefix:"f"},
{ "id": "48", "name": "甘肃银行", "type": "BANK",prefix:"g"},
{"id": "49", "name": "赣州银行", "type": "BANK",prefix:"g"},
{"id": "50", "name": "广东华兴银行", "type": "BANK",prefix:"g"},
{ "id": "51", "name": "广东南粤银行", "type": "BANK",prefix:"g"},
{"id": "52", "name": "广西北部湾银行", "type": "BANK",prefix:"g"},
{"id": "53", "name": "广州银行", "type": "BANK",prefix:"g"},
{ "id": "54", "name": "贵阳银行", "type": "BANK",prefix:"g"},
{"id": "55", "name": "贵州银行", "type": "BANK",prefix:"g"},
{"id": "56", "name": "桂林银行", "type": "BANK",prefix:"g"},
{ "id": "57", "name": "哈尔滨银行", "type": "BANK",prefix:"h"},
{"id": "58", "name": "哈密市商业银行", "type": "BANK",prefix:"h"},
{"id": "59", "name": "邯郸银行", "type": "BANK",prefix:"h"},
{ "id": "60", "name": "汉口银行", "type": "BANK",prefix:"h"},
{"id": "61", "name": "杭州银行", "type": "BANK",prefix:"h"},
{"id": "62", "name": "河北银行", "type": "BANK",prefix:"h"},
{ "id": "63", "name": "鹤壁银行", "type": "BANK",prefix:"h"},
{"id": "64", "name": "衡水银行", "type": "BANK",prefix:"h"},
{"id": "65", "name": "葫芦岛银行", "type": "BANK",prefix:"h"},
{ "id": "66", "name": "湖北银行", "type": "BANK",prefix:"h"},
{"id": "67", "name": "湖州银行", "type": "BANK",prefix:"h"},
{"id": "68", "name": "华融湘江银行", "type": "BANK",prefix:""},
{ "id": "69", "name": "徽商银行", "type": "BANK",prefix:"h"},
{"id": "70", "name": "吉林银行", "type": "BANK",prefix:"j"},
{"id": "71", "name": "济宁银行", "type": "BANK",prefix:"j"},
{ "id": "72", "name": "嘉兴银行", "type": "BANK",prefix:"j"},
{"id": "73", "name": "江苏银行", "type": "BANK",prefix:"j"},
{"id": "74", "name": "江苏长江商业银行", "type": "BANK",prefix:"j"},
{ "id": "75", "name": "焦作市商业银行", "type": "BANK",prefix:"j"},
{"id": "76", "name": "金华银行", "type": "BANK",prefix:"j"},
{"id": "77", "name": "锦州银行", "type": "BANK",prefix:"j"},
{ "id": "78", "name": "晋城银行", "type": "BANK",prefix:"j"},
{"id": "79", "name": "晋商银行", "type": "BANK",prefix:"j"},
{"id": "80", "name": "晋中市商业银行", "type": "BANK",prefix:"j"},
{ "id": "81", "name": "景德镇市商业银行", "type": "BANK",prefix:"j"},
{"id": "82", "name": "九江银行", "type": "BANK",prefix:"j"},
{"id": "83", "name": "开封市商业银行", "type": "BANK",prefix:"k"},
{ "id": "84", "name": "库尔勒市商业银行", "type": "BANK",prefix:"k"},
{"id": "85", "name": "昆仑银行", "type": "BANK",prefix:"k"},
{"id": "86", "name": "莱商银行", "type": "BANK",prefix:"l"},
{ "id": "87", "name": "兰州银行", "type": "BANK",prefix:"l"},
{"id": "88", "name": "廊坊银行", "type": "BANK",prefix:"l"},
{"id": "89", "name": "乐山市商业银行", "type": "BANK",prefix:"l"},
{ "id": "90", "name": "凉山州商业银行", "type": "BANK",prefix:"l"},
{"id": "91", "name": "辽阳银行", "type": "BANK",prefix:"l"},
{"id": "92", "name": "临商银行", "type": "BANK",prefix:"l"},
{ "id": "93", "name": "柳州银行", "type": "BANK",prefix:"l"},
{"id": "94", "name": "龙江银行", "type": "BANK",prefix:"l"},
{"id": "95", "name": "泸州市商业银行", "type": "BANK",prefix:"l"},
{ "id": "96", "name": "洛阳银行", "type": "BANK",prefix:"l"},
{"id": "97", "name": "漯河银行", "type": "BANK",prefix:"l"},
{"id": "98", "name": "绵阳市商业银行", "type": "BANK",prefix:"m"},
{ "id": "99", "name": "南昌银行", "type": "BANK",prefix:"n"},
{"id": "100", "name": "南充市商业银行", "type": "BANK",prefix:"n"},
{"id": "101", "name": "南京银行", "type": "BANK",prefix:"n"},
{ "id": "102", "name": "南阳银行", "type": "BANK",prefix:"n"},
{"id": "103", "name": "内蒙古银行", "type": "BANK",prefix:"n"},
{"id": "104", "name": "宁波东海银行", "type": "BANK",prefix:"n"},
{ "id": "105", "name": "宁波通商银行", "type": "BANK",prefix:"n"},
{"id": "106", "name": "宁波银行", "type": "BANK",prefix:"n"},
{"id": "107", "name": "宁夏银行", "type": "BANK",prefix:"n"},
{"id": "108", "name": "攀枝花市商业银行", "type": "BANK",prefix:"p"},
{"id": "109", "name": "盘锦市商业银行", "type": "BANK",prefix:"p"},
{"id": "110", "name": "平顶山银行", "type": "BANK",prefix:"p"},
{ "id": "111", "name": "濮阳银行", "type": "BANK",prefix:"p"},
{"id": "112", "name": "齐鲁银行", "type": "BANK",prefix:"q"},
{"id": "113", "name": "齐商银行", "type": "BANK",prefix:"q"},
{"id": "114", "name": "秦皇岛银行", "type": "BANK",prefix:"q"},
{"id": "115", "name": "青岛银行", "type": "BANK",prefix:"q"},
{"id": "116", "name": "青海银行", "type": "BANK",prefix:"q"},
{ "id": "117", "name": "曲靖市商业银行", "type": "BANK",prefix:"q"},
{"id": "118", "name": "泉州银行", "type": "BANK",prefix:"q"},
{"id": "119", "name": "日照银行", "type": "BANK",prefix:"r"},
{ "id": "120", "name": "三门峡银行", "type": "BANK",prefix:"s"},
{"id": "121", "name": "商丘银行", "type": "BANK",prefix:"s"},
{"id": "122", "name": "上海银行", "type": "BANK",prefix:"s"},
{ "id": "123", "name": "上饶银行", "type": "BANK",prefix:"s"},
{"id": "124", "name": "绍兴银行", "type": "BANK",prefix:"s"},
{"id": "125", "name": "盛京银行", "type": "BANK",prefix:"s"},
{ "id": "126", "name": "石嘴山银行", "type": "BANK",prefix:"s"},
{"id": "127", "name": "苏州银行", "type": "BANK",prefix:"s"},
{"id": "128", "name": "遂宁市商业银行", "type": "BANK",prefix:"s"},
{ "id": "129", "name": "台州银行", "type": "BANK",prefix:"t"},
{"id": "130", "name": "泰安市商业银行", "type": "BANK",prefix:"t"},
{"id": "131", "name": "唐山市商业银行", "type": "BANK",prefix:"t"},
{ "id": "132", "name": "天津银行", "type": "BANK",prefix:"t"},
{"id": "133", "name": "铁岭银行", "type": "BANK",prefix:"t"},
{"id": "134", "name": "威海市商业银行", "type": "BANK",prefix:"w"},
{ "id": "135", "name": "潍坊银行", "type": "BANK",prefix:"w"},
{"id": "136", "name": "温州银行", "type": "BANK",prefix:"w"},
{"id": "137", "name": "乌海银行", "type": "BANK",prefix:"w"},
{ "id": "138", "name": "乌鲁木齐市商业银行", "type": "BANK",prefix:"w"},
{"id": "139", "name": "西安银行", "type": "BANK",prefix:"x"},
{"id": "140", "name": "西藏银行", "type": "BANK",prefix:"x"},
{ "id": "141", "name": "厦门国际银行", "type": "BANK",prefix:"x"},
{"id": "142", "name": "厦门银行", "type": "BANK",prefix:"x"},
{"id": "143", "name": "新疆汇和银行", "type": "BANK",prefix:"x"},
{ "id": "144", "name": "新乡银行", "type": "BANK",prefix:"x"},
{"id": "145", "name": "信阳银行", "type": "BANK",prefix:"x"},
{"id": "146", "name": "邢台银行", "type": "BANK",prefix:"x"},
{ "id": "147", "name": "许昌银行", "type": "BANK",prefix:"x"},
{"id": "148", "name": "雅安市商业银行", "type": "BANK",prefix:"y"},
{"id": "149", "name": "烟台银行", "type": "BANK",prefix:"y"},
{ "id": "150", "name": "阳泉市商业银行", "type": "BANK",prefix:"y"},
{"id": "151", "name": "宜宾市商业银行", "type": "BANK",prefix:"y"},
{"id": "152", "name": "营口沿海银行", "type": "BANK",prefix:"y"},
{ "id": "153", "name": "营口银行", "type": "BANK",prefix:"y"},
{"id": "154", "name": "玉溪市商业银行", "type": "BANK",prefix:"y"},
{"id": "155", "name": "枣庄银行", "type": "BANK",prefix:"z"},
{ "id": "156", "name": "张家口市商业银行", "type": "BANK",prefix:"z"},
{"id": "157", "name": "浙江稠州商业银行", "type": "BANK",prefix:"z"},
{ "id": "158", "name": "浙江民泰商业银行", "type": "BANK",prefix:"z"},
{"id": "159", "name": "浙江泰隆商业银行", "type": "BANK",prefix:"z"},
{"id": "160", "name": "郑州银行", "type": "BANK",prefix:"z"},
{ "id": "161", "name": "中德住房储蓄银行", "type": "BANK",prefix:"z"},
{"id": "162", "name": "周口银行", "type": "BANK",prefix:"z"},
{"id": "163", "name": "珠海华润银行", "type": "BANK",prefix:"z"},
{ "id": "164", "name": "驻马店银行", "type": "BANK",prefix:"z"},
{"id": "165", "name": "自贡市商业银行", "type": "BANK",prefix:"z"},
{"id": "166", "name": "南洋商业银行", "type": "BANK",prefix:"n"},
{"id": "167", "name": "昆山农村商业银行", "type": "BANK",prefix:"k"},
{"id": "168", "name": "江苏省农村信用社联合社", "type": "BANK",prefix:"j"},
{"id": "169", "name": "北京农商银行", "type": "BANK",prefix:"b"},
{"id": "170", "name": "浙江省农村信用社联合社(瑞丰银行)", "type": "BANK",prefix:"z"},
{"id": "171", "name": "中国农商银行", "type": "BANK",prefix:"z"},
{"id": "1000","name": "支付宝", "type": "THIRD_PAY","code": "ALIPAY",prefix:"z"},
{"id": "1001","name": "微信支付","type": "THIRD_PAY","code": "WECHAT",prefix:"w"}
];
angular.module("xn/template/lookup.html",[]).run(["$templateCache", function($templateCache){
"use strict";
$templateCache.put("xn/template/lookup/xnAccount.html",
"<div id='{{id}}' class='xn-account-layout'>" +
" <div class='account-input-box' ng-class='{\"account-input-focus\":vm.showList||vm.match}' >"+
" <input type='text' class='account-input' ng-model='vm.keyword' ng-required='{{vm.required}}' id='tableText' name='{{vm.name}}' autocomplete=\"off\" placeholder=\"{{xnPlaceholder}}\" " +
" ng-focus='doFocus()' ng-blur='doBlur()' ng-keyup=\"keydown($event)\"/>"+
" <span class='expand' ng-class='{\"expand-active\":vm.showList}' ng-click='openList($event)'></span>"+
" <span class=\"delete-icon\" ng-show=\"vm.keyword\" ng-click=\"delete($event)\">X</span>"+
" </div>"+
" <div ng-if='vm.showList' class='account-list-layout'>" +
" <div class='account-list' ng-show='itemList.length>0'>" +
" <div class='account-description'>你可以在输入框内输入或者在下面选择一个会计科目</div>" +
" <ul class='account-type-tabs clearfix'>" +
" <li class='account-type-tab' ng-repeat='type in typeList' ng-class=\"type.state?'account-type-tab-active':''\" ng-click='changeTab(type,$index)'>{{type.value}}" +
" </li>"+
" </ul>"+
" <ul class='account-items-box clearfix' ng-show=\"vm.showType=='ASSET'\">" +
" <li class='account-item' ng-class='{\"account-item-active\":vm.index==$index}' ng-repeat=\"item in assetList track by $index\" ng-click='selectItem(item,$event)' >" +
" <span>{{item.code}}</span>" +
" <span class='account-name'>{{item.accountName}}</span>" +
" </li>"+
" </ul>"+
" <ul class='account-items-box clearfix' ng-show=\"vm.showType=='LIABILITY'\">" +
" <li class='account-item' ng-class='{\"account-item-active\":vm.index==$index}' ng-repeat=\"item in liabilityList track by $index\" ng-click='selectItem(item,$event)' >" +
" <span>{{item.code}}</span>" +
" <span class='account-name'>{{item.accountName}}</span>" +
" </li>"+
" </ul>"+
" <ul class='account-items-box clearfix' ng-show=\"vm.showType=='COMMON'\">" +
" <li class='account-item' ng-class='{\"account-item-active\":vm.index==$index}' ng-repeat=\"item in commonList track by $index\" ng-click='selectItem(item,$event)' >" +
" <span>{{item.code}}</span>" +
" <span class='account-name'>{{item.accountName}}</span>" +
" </li>"+
" </ul>"+
" <ul class='account-items-box clearfix' ng-show=\"vm.showType=='OWNERS_EQUITY'\">" +
" <li class='account-item' ng-class='{\"account-item-active\":vm.index==$index}' ng-repeat=\"item in owerseQuityList track by $index\" ng-click='selectItem(item,$event)' >" +
" <span>{{item.code}}</span>" +
" <span class='account-name'>{{item.accountName}}</span>" +
" </li>"+
" </ul>"+
" <ul class='account-items-box clearfix' ng-show=\"vm.showType=='COST'\">" +
" <li class='account-item' ng-class='{\"account-item-active\":vm.index==$index}' ng-repeat=\"item in costList track by $index\" ng-click='selectItem(item,$event)' >" +
" <span>{{item.code}}</span>" +
" <span class='account-name'>{{item.accountName}}</span>" +
" </li>"+
" </ul>"+
" <ul class='account-items-box clearfix' ng-show=\"vm.showType=='PROFIT_LOSS'\">" +
" <li class='account-item' ng-class='{\"account-item-active\":vm.index==$index}' ng-repeat=\"item in profitLossList track by $index\" ng-click='selectItem(item,$event)' >" +
" <span>{{item.code}}</span>" +
" <span class='account-name'>{{item.accountName}}</span>" +
" </li>"+
" </ul>"+
" </div> "+
" <div class='account-list' ng-show='itemList.length==0'>没有输入的相关内容</div>"+
" </div>"+
" <div class='account-match-layout' ng-show=\"vm.match\" >" +
" <div class='account-match-list' ng-show='itemList.length>0'>" +
" <ul class='account-match-box clearfix'>" +
" <li class='account-match-item clearfix' ng-class='{\"account-match-active\":vm.index==$index}' ng-repeat='item in itemList' ng-click='selectItem(item,$event)' >" +
" <span class=\"xn-col-md-6\">{{item.code}}</span>" +
" <span class='xn-col-md-16 account-match-name'>{{item.accountName}}</span>" +
" </li>"+
" </ul>"+
" </div>"+
" <div class='account-match-list' ng-show='itemList.length==0'>没有相关内容</div>"+
" </div>"+
"</div>"
);
$templateCache.put("xn/template/lookup/xnBank.html",
"<div id='{{id}}' class='xn-bank-layout'>" +
" <div class='bank-input-box' >"+
" <input type='text' class='bank-input' ng-model='vm.keyword' ng-required='{{vm.required}}' id='tableText' name='{{vm.name}}' autocomplete=\"off\" placeholder=\"{{xnPlaceholder}}\" " +
" ng-focus='doFocus()' ng-blur='doBlur()' ng-keyup=\"onKeydown($event)\"/>"+
" <span class='expand' ng-class='{\"expand-active\":vm.showList}' ng-click='openList($event)'></span>"+
" <span class=\"delete-icon\" ng-show=\"vm.keyword\" ng-click=\"delete($event)\">X</span>"+
" </div>"+
" <div class='bank-list-layout' ng-show=\"vm.showList && vm.keyword.length==0\" >" +
" <div class='bank-list' >" +
" <div class='bank-description'>你可以在输入框内输入或者在下面选择一个银行</div>" +
" <div>" +
" <ul class='bank-tabs clearfix'>" +
" <li class='tab-item' ng-class=\"{'tab-active':vm.tabState===1}\" ng-click='changeTab(1)'>常用</li>"+
" <li class='tab-item' ng-class=\"{'tab-active':vm.tabState===2}\" ng-click='changeTab(2)'>A-G</li>"+
" <li class='tab-item' ng-class=\"{'tab-active':vm.tabState===3}\" ng-click='changeTab(3)'>H-K</li>"+
" <li class='tab-item' ng-class=\"{'tab-active':vm.tabState===4}\" ng-click='changeTab(4)'>L-S</li>"+
" <li class='tab-item' ng-class=\"{'tab-active':vm.tabState===5}\" ng-click='changeTab(5)'>T-Z</li>"+
" </ul>"+
" </div> " +
" <ul class='bank-items-box clearfix' ng-show=\"vm.tabState===1\">" +
" <li class='bank-item' ng-repeat=\"item in bankGroups.host track by $index\" ng-click='selectItem(item,$event)' >" +
" <span class='bank-name' ng-class='{\"bank-active\":vm.initIndex==$index}' ><i class='bank-icon bank-icon{{item.id}}''></i>{{item.name}}</span>" +
" </li>"+
" </ul>"+
" <ul class='bank-items-box clearfix' ng-show=\"vm.tabState===2\">" +
" <li class='bank-item' ng-repeat=\"item in bankGroups.AGList track by $index\" ng-click='selectItem(item,$event)' >" +
" <span class='bank-name' ng-class='{\"bank-active\":vm.initIndex==$index}'><i class='bank-icon bank-icon{{item.id}}''></i>{{item.name}}</span>" +
" </li>"+
" </ul>"+
" <ul class='bank-items-box clearfix' ng-show=\"vm.tabState===3\">" +
" <li class='bank-item' ng-repeat=\"item in bankGroups.HKList track by $index\" ng-click='selectItem(item,$event)' >" +
" <span class='bank-name' ng-class='{\"bank-active\":vm.initIndex==$index}'><i class='bank-icon bank-icon{{item.id}}''></i>{{item.name}}</span>" +
" </li>"+
" </ul>"+
" <ul class='bank-items-box clearfix' ng-show=\"vm.tabState===4\">" +
" <li class='bank-item' ng-repeat=\"item in bankGroups.LSList track by $index\" ng-click='selectItem(item,$event)' >" +
" <span class='bank-name' ng-class='{\"bank-active\":vm.initIndex==$index}'><i class='bank-icon bank-icon{{item.id}}''></i>{{item.name}}</span>" +
" </li>"+
" </ul>"+
" <ul class='bank-items-box clearfix' ng-show=\"vm.tabState===5\">" +
" <li class='bank-item' ng-repeat=\"item in bankGroups.TZList track by $index\" ng-click='selectItem(item,$event)' >" +
" <span class='bank-name' ng-class='{\"bank-active\":vm.initIndex==$index}'><i class='bank-icon bank-icon{{item.id}}''></i>{{item.name}}</span>" +
" </li>"+
" </ul>"+
" </div> "+
" </div>"+
" <div class='bank-match-layout' ng-show=\"vm.showList && vm.keyword.length>0\" >" +
" <div class='bank-match-list' ng-show='responseList.length>0'>" +
" <ul class='bank-match-box clearfix'>" +
" <li class='bank-match-item clearfix' ng-repeat='item in responseList' ng-click='selectItem(item,$event)' >" +
" <span class='bank-name' ng-class='{\"bank-active\":vm.searchIndex==$index}'><i class='bank-icon bank-icon{{item.id}}''></i>{{item.name}}</span>" +
" </li>"+
" </ul>"+
" </div>"+
" <div class='bank-match-list' ng-show='responseList.length==0'>没有相关内容</div>"+
" </div>"+
"</div>"
)
}]);
//财务
var xnAccount=function($timeout,$q){
return {
restrict: "EA",
scope: {
data: "=ngModel", /*传出和传进的值*/
searchKey: "@", /*查的key一般是id*/
searchVal: "@", /*查的value一般是name*/
required: "@", /*本输入框是否必填*/
name: "@", /*输入框的名字*/
pageSize: "@", /*查询每页的数量*/
placeholder: "@", /*提示信息*/
callback: "&", /*回调函数*/
method: "&" , /*外部方法*/
showType:"@"
},
templateUrl: "xn/template/lookup/xnAccount.html",
replace: true,
require: "^ngModel",
link: function (scope, elements, attrs) {
scope.typeList=[
{key:'ASSET',value:'资产类',state:false},
{key:'LIABILITY',value:'负债类',state:false},
{key:'COMMON',value:'共同类' ,state:false},
{key:'OWNERS_EQUITY',value:'所有者权益类',state:false},
{key:'COST',value:'成本类',state:false},
{key:'PROFIT_LOSS',value:'损益类',state:true}
];
scope.itemList = [];
scope.assetList=[];
scope.liabilityList=[];
scope.commonList=[];
scope.owerseQuityList=[];
scope.costList=[];
scope.profitLossList=[];
var time = new Date().getTime();
scope.id = "xnLookup" + time;
scope.vm={
showList:false, //显示tab选择框
match:false,//动态查询显示match框
showType:scope.showType,
key:scope.searchKey||"accountId", //关键词
val:scope.searchVal||"accountName", //搜索关键词
name:scope.name||"LookupName"+time, //输入框名称
required:scope.required||false, //输入框是否必填
isPopup:scope.isPopup||false,
keyword:"",
pageSize:Number(scope.pageSize)|| 10,
pageNumber:1
};
scope.xnPlaceholder = scope.placeholder || "";
var interval = 0;
var hasSearch = true;
setInterval(function () {
interval += 10;
if(interval >= 350 && !hasSearch) {
getList();
}
}, 10);
//删除数据
scope.delete=function () {
interval = 0;
hasSearch = false;
scope.data="";
scope.vm.keyword="";
scope.assetList=[];
scope.liabilityList=[];
scope.commonList=[];
scope.owerseQuityList=[];
scope.costList=[];
scope.profitLossList=[];
};
//获取焦距
scope.doFocus = function () {
if (!scope.vm.keyword) {
scope.vm.showList = true;
scope.vm.match = false;
} else {
scope.vm.showList = false;
scope.vm.match = true;
scope.vm.typeEnumList = [];
}
getList();
};
//打开右边按钮
scope.openList=function (e) {
scope.vm.showList=!scope.vm.showList;
if(scope.vm.showList){
$timeout(function() {
$("#"+scope.id+" .account-input").focus();
}, 0);
}else {
//关闭
if(!angular.isObject(scope.data)){
scope.vm.keyword="";
}
}
};
/*切换tab*/
scope.changeTab=function (type,index) {
for(var i=0;i<scope.typeList.length;i++){
if(i==index){
scope.typeList[i].state=true;
}else {
scope.typeList[i].state=false;
}
}
scope.vm.showType=type.key;
;
scope.vm.showList=true;
};
//监控外部ng-model是否有值
scope.$watch(function () {
return scope.data;
},function (newData) {
if(angular.isObject(newData)){
scope.vm.keyword=angular.copy(newData[scope.vm.key]+"-"+newData[scope.vm.val]);
}
});
//获取列表数据
function getList() {
scope.assetList=[];
scope.liabilityList=[];
scope.commonList=[];
scope.owerseQuityList=[];
scope.costList=[];
scope.profitLossList=[];
if (!scope.vm.keyword) {
scope.vm.showList = true;
scope.vm.match = false;
} else {
scope.vm.showList = false;
scope.vm.match = true;
}
hasSearch = true;
var deferred = $q.defer();
var data={
pageSize: scope.vm.pageSize,
pageNumber:scope.vm.pageNumber
};
if(scope.vm.keyword){
data.keyword= scope.vm.keyword.split("-")[0];
}else{
data.keyword= scope.vm.keyword;
}
scope.method({data:{"deferred":deferred,data:data}});
deferred.promise.then(function (data) {
console.log(data);
//列表负值
scope.itemList=[];
scope.itemList=data.itemList|| [];
if(scope.itemList.length>0){
for (var i = 0; i <scope.itemList.length; i++) {
if (scope.itemList[i].accountType == "ASSET") {
scope.assetList.push(scope.itemList[i]);
} else if (scope.itemList[i].accountType == "LIABILITY") {
scope.liabilityList.push(scope.itemList[i]);
} else if (scope.itemList[i].accountType == "COMMON") {
scope.commonList.push(scope.itemList[i]);
}
else if (scope.itemList[i].accountType == "OWNERS_EQUITY") {
scope.owerseQuityList.push(scope.itemList[i]);
} else if (scope.itemList[i].accountType == "COST") {
scope.costList.push(scope.itemList[i]);
} else if (scope.itemList[i].accountType == "PROFIT_LOSS") {
scope.profitLossList.push(scope.itemList[i]);
}
}
}
//判断第几个
if(scope.vm.match){
if(angular.isObject(scope.data)){
var state=true;
angular.forEach(data,function (item,index) {
if(item[scope.vm.key]==scope.data[scope.vm.key]){
scope.vm.index=index;
state=false;
}
});
if(state){
scope.vm.index=0;
}
}else {
scope.vm.index=0;
}
}
});
}
//选择
scope.selectItem=function (data,e) {
e.preventDefault();
e.stopPropagation();
scope.data=angular.copy(data);
scope.vm.keyword=angular.copy(data[scope.vm.key]+"-"+data[scope.vm.val]);
scope.vm.showList=false;
scope.vm.match=false;
callback(data);
};
//初始化pageNumber
function initPage(){
scope.vm.pageNumber=1;
}
// 按键事件
scope.keydown = function(e) {
scope.onKeydown(e);
};
scope.onKeydown=function (e) {
// //定义选中第几个
var e = window.event || arguments.callee.caller.arguments[0];
switch (e.keyCode||e.which||e.charCode){
case 13: //回车
var data=scope.itemList[scope.vm.index];
scope.data=angular.copy(data);
scope.vm.keyword=angular.copy(data[scope.vm.val]);
scope.vm.showList=false;
//调用外部方法
callback(data);
break;
case 40: //向下
e.preventDefault();
e.stopPropagation();
if(scope.itemList.length-1>scope.vm.index){
scope.vm.index++;
}
break;
case 38://向上
e.preventDefault();
e.stopPropagation();
if(scope.vm.index>0){
scope.vm.index--;
}
break;
case 27: //退出 esc
scope.vm.showList=false;
scope.vm.match=false;
if(!angular.isObject(scope.data)){
scope.vm.keyword="";
}
break;
case 8://backspace
interval = 0;
hasSearch = false;
initPage();
scope.data="";
break;
case 46://删除
interval = 0;
hasSearch = false;
scope.data="";
scope.vm.keyword="";
initPage();
scope.data="";
break;
default:
interval = 0;
hasSearch = false;
initPage();
scope.data="";
break;
}
};
//选择时调用外部方法
function callback(data){
if(scope.callback){
scope.callback({data:data});
}
};
//已开鼠标 关闭
var getPar = function(tar) {
if(tar.id==scope.id){
scope.count++;
}
if(tar.parentElement){
getPar(tar.parentElement);
}
};
angular.element(document).bind("click", function(e) {
scope.count = 0;
getPar(e.target);
if(scope.count == 0) {
scope.$apply(function(){
scope.vm.showList=false;
if(!angular.isObject(scope.data)){
scope.vm.keyword="";
}
})
}
});
}
}
};
//银行
var xnBank=function($timeout,$filter,bankList){
return {
restrict: "EA",
scope: {
data:"=ngModel", /*传出和传进的值*/
placeholder : "@", /*提示信息*/
required: "@", /*本输入框是否必填*/
name: "@", /*输入框的名字*/
callback: "&" /*回调函数*/
},
templateUrl: "xn/template/lookup/xnBank.html",
replace: true,
require: "^ngModel",
link: function (scope, elements, attrs) {
scope.bankList=bankList;
//分类
scope.bankGroups={
host:[
{"id": "12", "name": "中国工商银行", "type": "BANK",prefix:"z"},
{"id": "16", "name": "中国农业银行", "type": "BANK",prefix:"z"},
{"id": "14", "name": "中国建设银行", "type": "BANK",prefix:"z"},
{"id": "6", "name": "交通银行", "type": "BANK",prefix:"j"},
{"id": "10", "name": "招商银行", "type": "BANK",prefix:"z"},
{"id": "17", "name": "中国银行", "type": "BANK",prefix:"z"},
{"id": "18", "name": "中国邮政储蓄银行", "type": "BANK",prefix:"z"},
{"id": "5", "name": "华夏银行", "type": "BANK",prefix:"h"},
{"id": "8", "name": "上海浦东发展银行", "type": "BANK",prefix:"s"},
{"id": "2", "name": "广发银行", "type": "BANK",prefix:"g"},
{"id": "15", "name": "中国民生银行", "type": "BANK",prefix:"z"},
{"id": "122", "name": "上海银行", "type": "BANK",prefix:"s"},
{"id": "9", "name": "兴业银行", "type": "BANK",prefix:"x"},
{"id": "11", "name": "浙商银行", "type": "BANK",prefix:"z"},
{"id": "24", "name": "北京银行","type": "BANK",prefix:"b"},
{"id": "1", "name": "渤海银行", "type": "BANK",prefix:"b"},
{"id": "13", "name": "中国光大银行", "type": "BANK",prefix:"z"},
{"id": "19", "name": "中信银行", "type": "BANK",prefix:"z"},
{"id": "4", "name": "恒丰银行", "type": "BANK",prefix:"h"},
{"id": "127", "name": "苏州银行", "type": "BANK",prefix:"s"}
],
AGList:[],
HKList:[],
LSList:[],
TZList:[]
};
//过滤后返回的数据
scope.responseList=[];
//keydwon 切换后保存的数据
var bankTabList=angular.copy(scope.bankGroups.host);
angular.forEach(bankList,function (bank) {
switch (bank.prefix){
case "a":
case "b":
case "c":
case "d":
case "e":
case "f":
case "g":
scope.bankGroups.AGList.push(bank);
break;
case "h":
case "i":
case "j":
case "k":
scope.bankGroups.HKList.push(bank);
break;
case "l":
case "m":
case "n":
case "o":
case "p":
case "q":
case "r":
case "s":
scope.bankGroups.LSList.push(bank);
break;
case "t":
case "u":
case "v":
case "w":
case "x":
case "y":
case "z":
scope.bankGroups.TZList.push(bank);
break;
}
});
console.log(scope.bankGroups);
var time = new Date().getTime();
scope.id = "xnLookup" + time;
scope.vm={
required : "@",
name : "@",
tabState:1,
keyword:"",
showList:false, //数据是否显示
dataState:false, //数据是否正确:
initIndex:0,
searchIndex:0
};
scope.xnPlaceholder=scope.placeholder||"";
//获取焦距
scope.doFocus=function () {
scope.vm.showList=true;
scope.vm.initIndex=0;
getList();
};
//切换
scope.changeTab=function (index) {
scope.vm.tabState=index;
scope.vm.initIndex=0;
$timeout(function() {
$("#"+scope.id+" .bank-input").focus();
}, 0);
bankTabList=[];
switch(index){
case 1:
bankTabList=angular.copy(scope.bankGroups.host);
break;
case 2:
bankTabList=angular.copy(scope.bankGroups.AGList);
break;
case 3:
bankTabList=angular.copy(scope.bankGroups.HKList);
break;
case 4:
bankTabList=angular.copy(scope.bankGroups.LSList);
break;
case 5:
bankTabList=angular.copy(scope.bankGroups.TZList);
break;
}
};
//keyword 赋值
function defineKeyword(data){
scope.vm.keyword=angular.copy(data.name);
scope.vm.dataState=true;
}
//判断数组
scope.$watch(function () {
return scope.data;
},function (newData) {
if(scope.data){
angular.forEach(scope.bankList,function (bank) {
if(bank.id==newData){
defineKeyword(bank);
}
});
}else {
scope.vm.keyword="";
}
});
scope.openList=function (e) {
// e.preventDefault();
// e.stopPropagation();
scope.vm.showList=!scope.vm.showList;
if(scope.vm.showList){
//打开
// getList();
$timeout(function() {
$("#"+scope.id+" .bank-input").focus();
}, 0);
}else {
//关闭
if(!scope.vm.dataState){
scope.vm.keyword="";
}
}
};
//失去焦点
function doBlur() {
$timeout(function() {
$("#"+scope.id+" .bank-input").blur();
}, 0);
}
//删除数据
scope.delete=function () {
scope.vm.keyword="";
scope.vm.dataState=false;
scope.data="";
};
//获取列表数据
function getList() {
scope.responseList=[];
scope.responseList=$filter('filter')(scope.bankList,{name:scope.vm.keyword});
//判断第几个
if(scope.vm.dataState){
var state=true;
angular.forEach(function () {
return scope.responseList;
},function (item,index) {
if(item.id==scope.data){
scope.vm.searchIndex=index;
state=false;
}
});
if(state){
scope.vm.searchIndex=0;
}
}else {
scope.vm.searchIndex=0;
}
}
//选择时调用外部方法
function callback(data){
if(scope.callback){
scope.callback({data:data});
}
}
// 按键事件
scope.onKeydown=function (e) {
scope.vm.showList=true;
scope.vm.dataState=false;
scope.data="";
switch (e.keyCode){
case 13: //回车
var data="";
if(scope.vm.keyword){
//有数据
data=scope.responseList[scope.vm.searchIndex];
}else {
//没有数据
data=bankTabList[scope.vm.initIndex];
}
scope.data=data.id;
defineKeyword(data);
scope.vm.showList=false;
doBlur();
//调用外部方法
callback(data);
break;
case 40: //向下
e.preventDefault();
e.stopPropagation();
if(scope.vm.keyword && scope.responseList.length-1>scope.vm.searchIndex){
//有数据
scope.vm.searchIndex++;
}else {
//没有数据
if(bankTabList.length-1>scope.vm.initIndex){
scope.vm.initIndex++;
}
}
break;
case 38://向上
e.preventDefault();
e.stopPropagation();
if(scope.vm.keyword && scope.vm.searchIndex>0){
//有数据
scope.vm.searchIndex--;
}else {
//没有数据
if(scope.vm.initIndex>0){
scope.vm.initIndex--;
}
}
break;
case 39: //右边
break;
case 37: //向左
break;
case 27: //退出 esc
case 9: //退出 teb
scope.vm.showList=false;
doBlur();
if(!scope.vm.dataState){
scope.vm.keyword="";
}
break;
case 8://backspace
getList();
break;
case 46://删除
scope.vm.keyword="";
break;
default:
getList();
break;
}
console.log( scope.vm.dataState);
};
//选择
scope.selectItem=function (data,e) {
e.preventDefault();
e.stopPropagation();
scope.data=data.id;
defineKeyword(data);
scope.vm.showList=false;
doBlur();
callback(data);
};
//已开鼠标 关闭
var getPar = function(tar) {
if(tar.id==scope.id){
scope.count++;
}
if(tar.parentElement){
getPar(tar.parentElement);
}
};
angular.element(document).bind("click", function(e) {
scope.count = 0;
getPar(e.target);
if(scope.count == 0) {
scope.$apply(function(){
scope.vm.showList=false;
doBlur();
console.log(scope.vm.dataState);
if(!scope.vm.dataState){
scope.vm.keyword="";
}
})
}
});
}
}
};
/*ng-blur=\"isShow=false\"*/
angular.module("xn.directive.lookup",["xn/template/lookup.html"])
.constant('bankList', bankList)
.directive("xnAccount",["$timeout","$q",xnAccount])
.directive("xnBank",["$timeout","$filter","bankList",xnBank]);