cdk
2025-03-24 06e6cf5719a7de9d7919cee2f6fcc3cfc6f9eb9d
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
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
<template>
    <view class="m-input-row" :class="{'after':after,'before':before}" :style="rowStyle">
        <text v-if="title" class="m-title" :class="{'separate':separate}" :style="labelStyle">{{title}}</text>
        <view class="m-input-view" :style="inputStyle">
            <!-- hint 只读标签 -->
            <template v-if="type==='hint'">
                <scroll-view :style="{'width':showButton?'90%':'100%'}" class="scroll-view_H" scroll-x="true">
                    <view style="display: flex;">
                        <uni-icons v-if="hintIcons" :color="iconColor" :type="inputIcon" />
                        <text class="m-input"
                            :style="{'justify-content': tempalignment}">{{value.length<=0?placeholder:value}}</text>
                    </view>
                </scroll-view>
            </template>
            <!-- numberbox 数字box -->
            <template v-else-if="type==='numberbox'">
                <view class="uni-numbox">
                    <view @click="calcValue('minus')" class="uni-numbox__minus">
                        <text class="uni-numbox--text"
                            :class="{ 'uni-numbox--disabled': value <= min || disabled }">-</text>
                    </view>
                    <input class="uni-numbox__value" :disabled="disabled" :focus="focus||thisFocus" type="number"
                        :value="value" :placeholder="placeholder" @input="onInput" @confirm="onConfirm"
                        @blur="onBlurNumberbox" :isFocusSelectAll="isFocusSelectAll"  :selection-start="0" :selection-end="selectionEnd"></input>
                    <view @click="calcValue('plus')" class="uni-numbox__plus">
                        <text class="uni-numbox--text"
                            :class="{ 'uni-numbox--disabled': value >= max || disabled }">+</text>
                    </view>
                </view>
                <!-- 清空内容图标 -->
                <uni-icons v-if="clearable&&value.length>0" type="clear" :color="iconColor" @click="clear" size="22">
                </uni-icons>
            </template>
            <!-- checkbox 复选框 -->
            <template v-else-if="type==='checkbox'">
                <checkbox-group @change="checkboxChange">
                    <view class="radio-checkbox-content" v-for="(item, index) in temprange" :key="item[rangeKey]"
                        :style="radioOrCheckboxStyle">
                        <checkbox :value="item[rangeKey]" :checked="item.checked" />
                        <uni-notice-bar class="radio-checkbox-content-notice" :speed="30"
                            :scrollable="item[rangeVal].length>(8/columns)" :single="true" :text="item[rangeVal]"
                            @click="onNoticeClick('checkbox',index)" />
                    </view>
                </checkbox-group>
            </template>
            <!-- radio 单选框 -->
            <template v-else-if="type==='radio'">
                <radio-group @change="radioChange">
                    <view class="radio-checkbox-content" style="display: flex;" v-for="(item, index) in temprange"
                        :key="item[rangeKey]" :style="radioOrCheckboxStyle">
                        <radio :value="item[rangeKey]" :checked="item.checked" />
                        <uni-notice-bar class="radio-checkbox-content-notice" :speed="30"
                            :scrollable="item[rangeVal].length>(8/columns)" :single="true" :text="item[rangeVal]"
                            @click="onNoticeClick('radio',index)" />
                    </view>
                </radio-group>
            </template>
            <!-- switch 开关 -->
            <template v-else-if="type==='switch'">
                <switch :checked="switchResult" type="switch" @change="switchChange" />
                <text style="font-size: 16px;" :style="{'color':switchResult?'#007aff':'#636363' }">
                    {{setSwitchResult}}
                </text>
            </template>
            <!-- combox 下拉框 -->
            <template v-else-if="type==='combox'">
                <view class="uni-combox__input-box">
                    <uni-icons
                        v-if="verify && comboxValue['index']<0 && comboxValue['val'] && comboxValue['val'].length>0"
                        color="#ff0000" type="clear" size="5"></uni-icons>
                    <uni-icons v-if="verify && comboxValue['index']>=0" color="#00ff00" type="checkbox" size="5">
                    </uni-icons>
                    <text v-if="showValueKey">{{comboxValue['key']+(comboxValue['key']?':':'')}}</text>
                    <input class="uni-combox__input" :focus="focus||thisFocus" type="text"
                        :value="comboxValue['val']||''" :placeholder="placeholder" @input="onInputCombox"
                        @focus="onFocusCombox" @blur="onBlurCombox" @confirm="onConfirmCombox" />
                    <uni-icons v-if="clearable && (comboxValue['val'] && comboxValue['val'].length>0)"
                        :color="iconColor" type="clear" @click="clearCombox" size="22"></uni-icons>
                    <uni-icons v-if="!clearable || !comboxValue['val'] || comboxValue['val'].length <= 0"
                        :color="iconColor" class="uni-combox__input-arrow" type="arrowdown" size="22"
                        @click="toggleSelector"></uni-icons>
                    <view v-if="showSelector" class="uni-combox__selector" :style="{'background-color':selectorColor}">
                        <scroll-view scroll-y="true" scroll-x="true" class="uni-combox__selector-scroll">
                            <view class="uni-combox__selector-empty" v-if="filterCandidatesLength === 0">
                                <text>{{ emptyTips }}</text>
                            </view>
                            <view class="uni-combox__selector-item" :style="{'text-align':showSelectorAlign}"
                                v-for="(item, index) in filterCandidates" :key="index"
                                v-if="item[rangeKey] && item[rangeVal]" @click="onSelectorClick(index)">
                                <text>{{
                                    (showSelectorKey?(item[rangeKey]) :"")+
                                    (showSelectorVal?(showSelectorKey?":":"")+item[rangeVal]:"")
                                     }}</text>
                            </view>
                        </scroll-view>
                    </view>
                </view>
            </template>
            <!-- slot 自定义卡槽容器 -->
            <template v-else-if="type==='slot'">
                <scroll-view :style="{'width':showButton?'90%':'100%'}" class="scroll-view_H" scroll-x="true">
                    <view style="display: flex;">
                        <slot name="slot"></slot>
                    </view>
                </scroll-view>
            </template>
            <!-- date 时间 -->
            <template v-else-if="type==='date'">
                <!-- 日期 -->
                <picker v-if="isDate" :style="{'width':isTime?'50%':'100%'}" mode="date" :value="defaultDate"
                    fields="day" :start="startDate" :end="endDate" @change="bindDateChange">
                    <view class="m-input" style="padding-right:10px;">{{defaultDate}}</view>
                </picker>
                <!-- 时间 -->
                <picker v-if="isTime" :style="{'width':isDate?'50%':'100%'}" mode="time" :value="defaultTime"
                    :start="start" :end="end" @change="bindTimeChange">
                    <view class="m-input">{{defaultTime}}</view>
                </picker>
                <!-- 清空内容图标 -->
                <uni-icons v-if="clearable&&(value.length>0||defaultDateTime)" type="clear" :color="iconColor"
                    @click="clear" size="22"></uni-icons>
            </template>
            <!-- text password number 默认为input输入框 -->
            <template v-else>
                <input v-if="type!=='textarea'" class="m-input" :maxlength=-1 :focus="focus||thisFocus"
                    :type="inputType" :value="value" @input="onInput" @confirm="onConfirm" @focus="onFocusInput($event)" :isFocusSelectAll="isFocusSelectAll"
                    @blur="onBlurInput" :placeholder="placeholder" :password="type==='password'&&!showPassword"
                    :selection-start="0" :selection-end="selectionEnd"></input>
 
                <textarea v-else :style="{'height':rowHeight}" class="m-input" :maxlength=-1 :focus="focus||thisFocus"
                    :value="value" @input="onInput" @confirm="onConfirm" @focus="onFocusInput($event)" @blur="onBlurInput"
                    :placeholder="placeholder"
                    :isFocusSelectAll="isFocusSelectAll"  :selection-start="0" :selection-end="selectionEnd"></textarea>
 
                <!-- 清空内容图标 -->
                <uni-icons v-if="clearable&&!displayable&&value.length>0" type="clear" :color="iconColor" @click="clear"
                    size="22"></uni-icons>
                <!-- 密码小眼睛图标 -->
                <uni-icons v-if="displayable" :style="{color:showPassword?'#666666':'#cccccc'}" type="eye"
                    @click="display" size="22"></uni-icons>
                <!-- 扫描图标 -->
                <uni-icons v-if="canScan&&(!clearable|| value.length<=0)" type="scan" :color="iconColor" size="22"
                    @click="scan" />
            </template>
            <!-- 输入框按钮 -->
            <uni-icons v-if="showButton && buttonVal.length<=0" :color="iconColor" :type="buttonIcon" size="22"
                @click="buttonClick"></uni-icons>
            <button v-if="showButton && buttonVal.length>0" class="rightButton" :type="buttonType" size="mini"
                :style="buttonStyle" @click="buttonClick">
                {{buttonVal}}
            </button>
 
        </view>
    </view>
</template>
 
<script>
    import permision from "@/common/permission.js"
    export default {
        props: {
            // 标签
            title: String,
            // row高度
            rowHeight: {
                type: String,
                default: '30px'
            },
            // 标签内容宽度
            labelWidth: {
                type: String,
                default: 'auto'
            },
            // 输入框类型
            type: {
                type: String,
                default: 'text'
            },
            // 输入框值
            value: {
                type: [Date, Object, Number, String, Boolean, Array],
                default () {
                    return '';
                }
            },
            // 是否必填
            mandatory: {
                type: Boolean,
                default: false
            },
            // 默认必填背景颜色
            mandatoryColor: {
                type: String,
                default: '#FFFFCC'
            },
            // 默认正常背景颜色
            defaultColor: {
                type: String,
                default: '#ffffff' //#fffae8
            },
            // 默认只读背景颜色
            readonlyColor: {
                type: String,
                default: '#f1f1f1'
            },
            // 默认图标颜色
            iconColor: {
                type: String,
                default: '#666666'
            },
            // 输入框占位符提示信息
            placeholder: String,
            // 输入框占位符提示信息、只读字体颜色
            placeholderColor: {
                type: String,
                default: '#8383a2'
            },
            // 容器顶部边框
            before: {
                type: Boolean,
                default: false
            },
            // 容器底部边框
            after: {
                type: Boolean,
                default: true
            },
            //标题和内容之间的分割线
            separate: {
                type: Boolean,
                default: false
            },
            //输入内容框边框
            inputBorder: {
                type: Boolean,
                default: true
            },
            //输入内容框边框颜色
            inputBorderColor: {
                type: String,
                default: "#c5c5e1"
            },
            // 自动获取焦点
            focus: {
                type: Boolean,
                default: false
            },
            // 自动选中内容
            isFocusSelectAll: {
                type: Boolean,
                default: false
            },
            // 输入框是否显示清除按钮
            clearable: {
                type: [Boolean, String],
                default: true
            },
            // 是否显示密码可见按钮
            displayable: {
                type: [Boolean, String],
                default: false
            },
            // 是否显示扫描按钮
            canScan: {
                type: [Boolean, String],
                default: false
            },
            // 是否显示只读标签图标
            hintIcons: {
                type: Boolean,
                default: false
            },
            // 是否显示按钮
            showButton: {
                type: Boolean,
                default: false
            },
            // 输入框提示图标类型
            inputIcon: {
                type: String,
                default: 'info'
            },
            // 按钮图标类型
            buttonIcon: {
                type: String,
                default: 'checkmarkempty'
            },
            //按钮类型
            buttonType: {
                type: String,
                default: 'primary' //primary、warn、default
            },
            //按钮宽度
            buttonWidth: {
                type: String,
                default: ''
            },
            //按钮背景颜色
            buttonColor: {
                type: String,
                default: '#f8f8f8'
            },
            //按钮字体颜色
            buttonlabColor: {
                type: String,
                default: '#000000'
            },
            // 右侧按钮响应事件,false-执行自定义按钮点击事件 true-执行输入框提交事件
            btConfirm: {
                type: Boolean,
                default: false
            },
            // 按钮内容
            buttonVal: {
                type: String,
                default: ''
            },
            // 数字输入框最小值
            min: {
                type: Number,
                default: 0
            },
            // 数字输入框最大值
            max: {
                type: Number,
                default: 100
            },
            // 数字输入框步长间隔大小
            step: {
                type: Number,
                default: 1
            },
            //数字输入框按钮是否为禁用状态
            disabled: {
                type: Boolean,
                default: false
            },
            //开关、复选框、单选框、下拉框数据源(父控件的值)
            range: {
                type: [Array, Boolean, Object],
                default () {
                    return [];
                }
            },
            //开关、复选框、单选框、下拉框数据源对应的key字段名称
            rangeKey: {
                type: String,
                default: 'value'
            },
            //开关、复选框、单选框、下拉框数据源对应的value字段名称
            rangeVal: {
                type: String,
                default: 'name'
            },
            //开关、复选框、单选框、下拉框数据源对应默认选择项index
            rangeSelect: {
                type: Number,
                default: -1
            },
            //复选框和单选框展示的列数
            columns: {
                type: Number,
                default: 2
            },
            //switch开关是否选中
            checked: {
                type: Boolean,
                default: false
            },
            //下拉框筛选结果为空时显示的文字
            emptyTips: {
                type: String,
                default: '无匹配项'
            },
            // 是否验证下拉框输入内容是否存在
            verify: {
                type: Boolean,
                default: true
            },
            //下拉框输入内容是否自动补全(过滤的时候默认选择第一个选项)
            automatic: {
                type: Boolean,
                default: true
            },
            //下拉框选择器是否显示key内容
            showSelectorKey: {
                type: Boolean,
                default: false
            },
            //下拉框选择器是否显示valur内容
            showSelectorVal: {
                type: Boolean,
                default: true
            },
            //下拉框输入值是否显示key内容
            showValueKey: {
                type: Boolean,
                default: false
            },
            //下拉框选择器字体对齐方式
            showSelectorAlign: {
                type: String,
                default: "left"
            },
            //标签颜色
            labelColor: {
                type: String,
                default: "#000000"
            },
            //文本内容颜色
            textColor: {
                type: String,
                default: "#0000ff"
            },
            //选择器背景颜色
            selectorColor: {
                type: String,
                default: "#ffffff"
            },
            //是否显示日期
            isDate: {
                type: Boolean,
                default: true
            },
            //是否显示时间
            isTime: {
                type: Boolean,
                default: true
            },
            //是否默认日期和时间
            defaultDateTime: {
                type: Boolean,
                default: false
            },
            //默认时间的时间间隔(比如昨天、明天:-1、1),默认0,天为单位
            dayInterval: {
                type: Number,
                default: 0
            },
 
            //最小日期
            startDate: {
                type: String,
                default: '' //getDate('start');
            },
            //最大日期
            endDate: {
                type: String,
                default: '' //getDate('end');
            },
            //最小时间
            start: {
                type: String,
                default: '00:00'
            },
            //最大时间
            end: {
                type: String,
                default: '23:59'
            },
            //日期结果
            date: {
                type: String,
                default: ''
            },
            //时间结果
            time: {
                type: String,
                default: ''
            },
            //内容对齐方式 默认左对齐 ;left:flex-start; center:center; right:flex-end;
            alignment: {
                type: String,
                default: 'left'
            },
        },
        model: {
            prop: 'value',
            event: 'input'
        },
        data() {
            return {
                //服务器日期
                SYSDate: "",
                //服务器时间
                SYSTime: "",
                //默认日期
                defaultDate: '选择日期',
                //默认时间
                defaultTime: '选择时间',
                //显示密码明文
                showPassword: false,
                //switch是否选中结果(switchResult)
                switchResult: false,
                //显示/隐藏 下拉框选择器内容信息
                showSelector: false,
                //下拉框值内容显示
                comboxValue: {
                    index: -1,
                    key: '',
                    val: ''
                },
                //初始化数据开关。针对需要数据源,并且需要构建返回值结构的时候
                initState: false,
                //内容对齐方式 默认左对齐 
                tempalignment: 'flex-start',
                //开关、复选框、单选框、下拉框数据源(子控件的值)
                temprange: {
                    type: [Array, Boolean, Object],
                    default () {
                        return [];
                    }
                },
                thisFocus: false, //输入框焦点
                selectionEnd:0//选择结束点
            }
        },
        computed: {
            // 针对密码输入框类型处理,为了显示和隐藏密码
            inputType() {
                const type = this.type;
                return type === 'password' ? 'text' : type;
            },
            // 处理主容器样式css
            rowStyle() {
                const type = this.type;
                if (this.rowHeight === '40px' && (type === 'checkbox' || type === 'radio')) {
                    //复选框和单选框自动设置高度
                    if (this.temprange.length > 1) {
                        const cbLen = Math.ceil(this.temprange.length / this.columns);
                        return {
                            height: ((cbLen > 3 ? 3 : cbLen) * 40) + 'px'
                        }
                    }
                }
                return {
                    height: this.rowHeight
                }
            },
            // 处理标签样式css
            labelStyle() {
                let css = {}
                if (this.labelWidth !== 'auto') {
                    css['width'] = this.labelWidth;
                }
                css['color'] = this.labelColor;
                return css;
            },
            // 处理输入部分样式css
            inputStyle() {
                let css = {};
                const type = this.type;
                //设置备件颜色
                if (type === 'hint') {
                    css['background-color'] = this.readonlyColor;
                    css['width'] = '90px';
                    css['color'] = this.placeholderColor;
                } else if (this.mandatory) {
                    css['background-color'] = this.mandatoryColor;
                    css['width'] = '90px';
                    css['color'] = this.textColor;
                } else {
                    css['background-color'] = this.defaultColor;
                    css['width'] = '90px';
                    css['color'] = this.textColor;
                }
                //数字box不用设置边距
                if (type === 'numberbox') {
                    css['padding'] = '0';
                }
 
                //增加边框
                if (this.inputBorder && this.type !== 'switch' && this.type !== 'slot') {
                    css['border-style'] = 'solid';
                    css['border-width'] = '1px';
                    css['border-color'] = this.inputBorderColor; //'#c5c5e1';
                }
                //存在按钮的时候,并且为文字按钮的时候,容器右侧增加圆角
                if (this.showButton && this.buttonVal !== '') {
                    css['border-radius'] = '0 5px 5px 0';
                }
 
                //设置内容对齐方式
                css['text-align'] = this.alignment;
                return css;
            },
            //按钮样式调整
            buttonStyle() {
                let css = {};
                if (this.buttonWidth !== '') {
                    css['width'] = this.buttonWidth;
                }
                if (this.buttonType === 'default') {
                    css['background-color'] = this.buttonColor;
                    css['color'] = this.buttonlabColor;
                }
                return css;
            },
            // 复选框和单选框样式调整
            radioOrCheckboxStyle() {
                //复选框和单选框设置宽度
                const ratio = Math.floor(100 / this.columns);
                return {
                    width: ratio + '%'
                }
            },
            // 开关结果处理
            setSwitchResult() {
                if (this.temprange.length < 2)
                    return '';
                if (this.switchResult) {
                    return this.temprange[0][this.rangeVal];
                } else {
                    return this.temprange[1][this.rangeVal];
                }
            },
            // 得到过滤后的下拉框数据源(根据key进行过滤)
            filterCandidatesKey() {
                if (this.temprange.length <= 0) {
                    return [];
                }
                return this.temprange.filter((item, index, arr) => {
                    this.$set(item, 'index', index);
                    return item[this.rangeKey].indexOf(this.value['key']) > -1;
                });
            },
            // 得到过滤后的下拉框数据源(根据key或者val进行过滤)
            filterCandidates() {
                if (this.temprange.length <= 0) {
                    return [];
                }
                return this.temprange.filter((item, index, arr) => {
                    this.$set(item, 'index', index);
                    let t = false;
                    //一:key、val都为空的时候;二:key、val都不为空,并且索引不小于0(有选中结果的情况)
                    if ((!this.value['key'] && !this.value['val']) ||
                        (this.value['key'] && this.value['val'] && (this.value['index'] || this.value['index'] ==
                            0) && this.value['index'] >= 0)) {
                        t = true;
                    } else {
                        //通过val进行过滤
                        if (this.value['val']) {
                            t = item[this.rangeVal].indexOf(this.value['val']) > -1 ||
                                item[this.rangeKey].indexOf(this.value['val']) > -1;
                        }
                        //通过key进行过滤
                        if (this.value['key']) {
                            t = t || item[this.rangeKey].indexOf(this.value['key']) > -1;
                        }
                    }
                    return t;
                });
            },
            // 得到下拉框选择器数据源的数据长度,用于提示是否有匹配选择项
            filterCandidatesLength() {
                return this.filterCandidates.length;
            }
        },
        watch: {
            //内容对齐方式监听
            alignment(newVal, oldVal) {
                if (JSON.stringify(newVal) != JSON.stringify(oldVal)) {
                    this.setAlignment();
                }
            },
 
            //内容值改变
            value(newVal, oldVal) {
                //用户自定义修改、返回值改变的时候,针对一些需要重新整理的结果集进行处理。
                //(现在操作可能不是最优的,因为控件这个操作主要是针对开发的时候通过代码去改,如果通过控件去操作会导致进行两次整理数据,效率会减慢,先用着)
                let BeforeNewVal = newVal;
                if (JSON.stringify(newVal) != JSON.stringify(oldVal)) {
                    switch (this.type) {
                        case 'switch': //开关
                            if ((newVal === true || newVal === false) && this.temprange.length >=
                                2) { //只设置直接赋值true、false,暂时不提供其他赋值方式
                                let switchV = {
                                    "result": false,
                                    key: '',
                                    val: ''
                                };
                                let i = 0;
                                if (newVal === true) {
                                    this.switchResult = true;
                                    switchV.result = true;
                                } else {
                                    this.switchResult = false;
                                    switchV.result = true;
                                    i = 1;
                                }
                                switchV.key = this.temprange[i][this.rangeKey];
                                switchV.val = this.temprange[i][this.rangeVal];
                                newVal = switchV;
                            }
                            break;
                        case 'date': //日期时间
                            if (newVal == '') {
                                this.defaultDate = '选择日期';
                                this.defaultTime = '选择时间';
                            }
                            newVal = this.operationDateValue();
                            break;
                        case 'combox': //下拉框
                            // console.log("##############"+JSON.stringify(this.temprange))
                            // console.log('@@@@@@@@@@@@@@'+JSON.stringify(newVal))
                            if (this.temprange.length <= 0)
                                break;
 
                            // console.log('$$$$$$$$$$$$$')
                            let comboxV = {
                                index: newVal.index || -1,
                                key: newVal.key || '',
                                val: newVal.val || '',
                            };
                            if ((newVal.index || newVal.index == 0) && newVal.index >= 0) { //优先通过索引过滤整理数据
                                comboxV = {
                                    index: newVal.index,
                                    key: this.temprange[newVal.index][this.rangeKey],
                                    val: this.temprange[newVal.index][this.rangeVal]
                                };
                            } else if (newVal.key) { //通过key过滤整理数据
                                let filterItem = this.filterCandidatesKey;
                                if (filterItem.length > 0) {
                                    comboxV = {
                                        index: filterItem[0].index,
                                        key: filterItem[0][this.rangeKey],
                                        val: filterItem[0][this.rangeVal]
                                    };
                                }
                            } else if ((typeof newVal == 'string') && newVal.constructor == String) { //直接赋key值
                                if (newVal) {
                                    let filterItem = this.temprange.filter((item, index, arr) => {
                                        this.$set(item, 'index', index);
                                        return item[this.rangeKey].indexOf(newVal) > -1;
                                    });
                                    if (filterItem.length > 0) {
                                        comboxV = {
                                            index: filterItem[0].index,
                                            key: filterItem[0][this.rangeKey],
                                            val: filterItem[0][this.rangeVal]
                                        };
                                    }
                                }
                            } else if ((typeof newVal == 'number') && newVal.constructor == Number) { //直接赋索引值
                                if (newVal >= 0) {
                                    comboxV = {
                                        index: newVal,
                                        key: this.temprange[newVal][this.rangeKey],
                                        val: this.temprange[newVal][this.rangeVal]
                                    };
                                }
                            }
                            newVal = comboxV;
                            this.comboxValue = comboxV;
                            // console.log('@@@@@@@@@@@@@@'+JSON.stringify(this.comboxValue))
                            break;
                        case 'checkbox': //复选框
                            if (this.temprange.length <= 0)
                                break;
                            let checkboxV = {
                                indexs: newVal.indexs || [],
                                keys: newVal.keys || [],
                                vals: newVal.vals || [],
                            };
                            let selectK = [];
                            let selectV = [];
                            let selectI = [];
                            if (newVal.indexs) { //优先通过索引过滤整理数据
                                this.temprange.forEach((item, index) => {
                                    if (newVal.indexs.includes(index)) {
                                        this.$set(item, 'checked', true)
                                    } else {
                                        this.$set(item, 'checked', false)
                                    }
                                    if (item.checked) {
                                        selectK.push(item[this.rangeKey]);
                                        selectV.push(item[this.rangeVal]);
                                        selectI.push(index);
                                    }
                                })
                            } else if (newVal.keys) { //通过key过滤整理数据
                                this.temprange.forEach((item, index) => {
                                    if (newVal.keys.includes(item[this.rangeKey])) {
                                        this.$set(item, 'checked', true)
                                    } else {
                                        this.$set(item, 'checked', false)
                                    }
                                    if (item.checked) {
                                        selectK.push(item[this.rangeKey]);
                                        selectV.push(item[this.rangeVal]);
                                        selectI.push(index);
                                    }
                                })
                            }
                            checkboxV.indexs = selectI;
                            checkboxV.keys = selectK;
                            checkboxV.vals = selectV;
                            newVal = checkboxV;
                            break;
                        case 'radio': //单选框
                            if (this.temprange.length <= 0)
                                break;
                            let radioV = {
                                index: newVal.index || -1,
                                key: newVal.key || '',
                                val: newVal.val || '',
                            };
                            if ((newVal.index || newVal.index == 0) && newVal.index >= 0) { //优先通过索引过滤整理数据
                                this.temprange[newVal.index].checked = true;
                                radioV = {
                                    index: newVal.index,
                                    key: this.temprange[newVal.index][this.rangeKey],
                                    val: this.temprange[newVal.index][this.rangeVal]
                                };
                            } else if (newVal.key) { //通过key过滤整理数据
                                let filterItem = this.filterCandidatesKey;
                                if (filterItem.length > 0) {
                                    this.temprange[filterItem[0].index].checked = true;
                                    radioV = {
                                        index: filterItem[0].index,
                                        key: filterItem[0][this.rangeKey],
                                        val: filterItem[0][this.rangeVal]
                                    };
                                }
                            } else if ((typeof newVal == 'string') && newVal.constructor == String) { //直接赋key值
                                if (newVal) {
                                    let filterItem = this.temprange.filter((item, index, arr) => {
                                        this.$set(item, 'index', index);
                                        return item[this.rangeKey].indexOf(newVal) > -1;
                                    });
                                    if (filterItem.length > 0) {
                                        this.temprange[filterItem[0].index].checked = true;
                                        radioV = {
                                            index: filterItem[0].index,
                                            key: filterItem[0][this.rangeKey],
                                            val: filterItem[0][this.rangeVal]
                                        };
                                    }
                                }
                            } else if ((typeof newVal == 'number') && newVal.constructor == Number) { //直接赋索引值
                                if (newVal >= 0) {
                                    this.temprange[newVal].checked = true;
                                    radioV = {
                                        index: newVal,
                                        key: this.temprange[newVal][this.rangeKey],
                                        val: this.temprange[newVal][this.rangeVal]
                                    };
                                }
                            }
                            newVal = radioV;
                            // 把旧的结果改回去
                            if (oldVal.index && oldVal.index >= 0) {
                                this.temprange[oldVal.index].checked = false;
                            }
                            break;
                    }
                }
 
                let setOnChange = true; //判断是否需要设置 change 事件
                //整理之后的结果集合判断是否一致,不一致就反馈到夫控件
                if (JSON.stringify(BeforeNewVal) != JSON.stringify(newVal)) {
                    this.$emit('input', newVal);
                    setOnChange = false; //因为还会返回一次值到父控件,所以不需要触发change事件
                }
                //用来初始化的时候不进行触发change事件
                if (!this.initState) {
                    if (JSON.stringify(newVal) != JSON.stringify(oldVal) && setOnChange) {
                        this.$emit('change', newVal);
                    }
                } else {
                    this.initState = false;
                }
            },
            //数据源变化,更新界面数据绑定信息
            range(newVal, oldVal) {
                //数据源是在页面data中定义,然后通过方法进行赋值的,重新调用初始化数据操作
                if (newVal !== oldVal) {
                    //注:这里两个对象判断相等应该是没用的,需要转换成字符串或者其他操作去进行比对,因为表格数据量大,就不比对了,先这样放着
                    this.temprange = JSON.parse(JSON.stringify(this.range));
                    this.init();
                }
            }
        },
        created() {
            this.temprange = JSON.parse(JSON.stringify(this.range));
            //初始化内容对齐方式
            this.setAlignment();
            //在模板渲染成html前调用,初始化属性值。
            switch (this.type) {
                case 'switch':
                    this.switchResult = this.checked;
                    break;
                case 'date':
                    let resultDate = this.operationDateValue();
                    this.$emit('input', resultDate);
                    break;
            }
        },
        mounted() {
            //在模板渲染成html后调用,初始化页面完成后,对html的dom节点进行一些需要的操作。    
            // if(this.temprange.length>0){
            //数据源是在页面data中进行了初始化的,就调用初始化数据操作
            this.init();
            // }
        },
        methods: {
            //设置内容对齐方式
            setAlignment() {
                switch (this.alignment) {
                    case 'center':
                        this.tempalignment = 'center';
                        break;
                    case 'right':
                        this.tempalignment = 'flex-end';
                        break;
                    default:
                        this.tempalignment = 'flex-start';
                        break;
                }
            },
            //整合时间类型返回值整理
            operationDateValue() {
                // this.SYSDate = await this.$GetSysDateTime('yyyy-MM-dd'); //获取日期
                // this.SYSTime = await this.$GetSysDateTime('hh:mm'); //获取时间
                let d = '';
                let t = '';
                let result = '';
                if (this.value.length > 0) {
                    if (this.value.length > 15) {
                        d = this.isDate ? this.value.substring(0, 10) : '';
                        t = this.isTime ? ' ' + this.value.substring(11, this.value.length) : '';
                        this.defaultDate = this.value.substring(0, 10);
                        this.defaultTime = this.value.substring(11, this.value.length);
                    } else {
                        //已经填写日期
                        if (this.value.length >= 10 && this.value.length < 15) {
                            d = this.isDate ? this.value.substring(0, 10) : '';
                            this.defaultDate = this.value.substring(0, 10);
                        }
                        //已经填写时间
                        if (this.value.length >= 5 && this.value.length < 10) {
                            t = this.isTime ? ' ' + this.value.substring(this.value.length - 5, this.value.length) : '';
                            this.defaultTime = this.value.substring(this.value.length - 5, this.value.length);
                        }
                    }
                    if (d != '' || t != '') {
                        result = (this.isDate ? d : '') + (this.isTime ? t : '');
                    }
                } else {
                    this.defaultDate = this.date.length > 0 ?
                        this.date :
                        this.defaultDateTime ? getDate(this.type, this.dayInterval, this.SYSDate) : this.defaultDate;
                    this.defaultTime = this.time.length > 0 ?
                        this.time :
                        this.defaultDateTime ? getTime(this.type, this.SYSTime) : this.defaultTime;
                    d = this.defaultDate === '选择日期' ? '' : this.defaultDate;
                    t = this.defaultTime === '选择时间' ? '' : ' ' + this.defaultTime;
                    result = (this.isDate ? d : '') + (this.isTime ? t : '');
                }
                return result;
            },
            //初始化数据(针对有数据源的,range)
            init() {
                this.initState = true;
                const items = this.temprange;
                var result = {};
                switch (this.type) {
                    case 'checkbox':
                        result = {
                            indexs: [],
                            keys: [],
                            vals: []
                        };
                        var selectK = [];
                        var selectV = [];
                        var selectI = [];
                        for (var i = 0, lenI = items.length; i < lenI; ++i) {
                            const item = items[i]
                            if (item.checked) {
                                selectK.push(item[this.rangeKey]);
                                selectV.push(item[this.rangeVal]);
                                selectI.push(i);
                            }
                        }
                        result.indexs = selectI;
                        result.keys = selectK;
                        result.vals = selectV;
                        this.$emit('input', result);
                        break;
                    case 'radio':
                        var select = false;
                        result = {
                            index: -1,
                            key: '',
                            val: ''
                        };
                        for (var i = 0, lenI = items.length; i < lenI; ++i) {
                            const item = items[i];
                            if (item['checked'] && !select) {
                                result = {
                                    index: i,
                                    key: item[this.rangeKey],
                                    val: item[this.rangeVal]
                                };
                                select = true;
                                continue;
                            }
                            this.$set(item, 'checked', false);
                        }
                        this.$emit('input', result);
                        break;
                    case 'switch':
                        result = {
                            result: this.switchResult,
                            key: '',
                            val: '',
                        };
                        if (items.length < 2) {
                            this.$emit('input', result);
                            break;
                        }
                        var i = this.switchResult ? 0 : 1;
                        result.key = this.temprange[i][this.rangeKey];
                        result.val = this.temprange[i][this.rangeVal];
                        this.$emit('input', result);
                        break;
                    case 'combox':
                        //result={index:-1,key:'',val:''};
                        // if(this.value!=={} 
                        // && this.value.index>=0 
                        // && (this.temprange.length-1)>=this.value.index){
                        //  result={
                        //   index:this.value.index,
                        //   key:this.temprange[this.value.index][this.rangeKey],
                        //   val:this.temprange[this.value.index][this.rangeVal]
                        //  };
                        // }
                        let newVal = this.value;
                        if (this.temprange.length <= 0)
                            break;
                        //console.log(JSON.stringify(this.temprange))
                        let comboxV = {
                            index: -1,
                            key: '',
                            val: ''
                        };
                        if ((newVal.index || newVal.index == 0) && newVal.index >= 0) { //优先通过索引过滤整理数据
 
                            comboxV = {
                                index: newVal.index,
                                key: this.temprange[newVal.index][this.rangeKey],
                                val: this.temprange[newVal.index][this.rangeVal]
                            };
                        } else if (newVal.key) { //通过key过滤整理数据
                            let filterItem = this.filterCandidatesKey;
                            if (filterItem.length > 0) {
                                comboxV = {
                                    index: filterItem[0].index,
                                    key: filterItem[0][this.rangeKey],
                                    val: filterItem[0][this.rangeVal]
                                };
                            }
                        } else if ((typeof newVal == 'string') && newVal.constructor == String) { //直接赋key值
 
                            if (newVal) {
                                let filterItem = this.temprange.filter((item, index, arr) => {
                                    this.$set(item, 'index', index);
                                    return item[this.rangeKey].indexOf(newVal) > -1;
                                });
                                if (filterItem.length > 0) {
                                    comboxV = {
                                        index: filterItem[0].index,
                                        key: filterItem[0][this.rangeKey],
                                        val: filterItem[0][this.rangeVal]
                                    };
                                }
                            }
                        } else if ((typeof newVal == 'number') && newVal.constructor == Number) { //直接赋索引值
 
                            if (newVal >= 0) {
                                comboxV = {
                                    index: newVal,
                                    key: this.temprange[newVal][this.rangeKey],
                                    val: this.temprange[newVal][this.rangeVal]
                                };
                            }
                        }
                        result = comboxV;
 
                        // console.log(JSON.stringify(result))
                        //this.comboxValue=comboxV;
                        this.$emit('input', result)
                        break;
                }
            },
            //密码框眼睛图标点击切换显示隐藏密码
            display() {
                this.showPassword = !this.showPassword
            },
            //普通输入框清空图标事件
            clear() {
                this.$emit('input', '');
                this.$emit('clear', '');
                this.thisFocus = true;
                //时间控件清空操作
                if (this.type === 'date') {
                    this.defaultDate = '选择日期';
                    this.defaultTime = '选择时间';
                }
            },
            //按钮点击事件
            buttonClick() {
                if (this.btConfirm) {
                    this.$emit('confirm', this.value);
                } else {
                    this.$emit('buttonClick', this.value);
                }
            },
            //普通输入框输入事件
            onInput(e) {
                this.$emit('input', e.detail.value);
            },
            //普通输入框提交事件
            onConfirm(e) {
                this.$emit('confirm', e.detail.value);
            },
            //数字box输入框【+】【-】按钮点击事件
            calcValue(type) {
                if (this.disabled) {
                    return;
                }
                const scale = this.getDecimalScale();
                let value = this.value * scale;
                let step = this.step * scale;
                if (type === "minus") {
                    value -= step;
                    if (value < (this.min * scale)) {
                        return;
                    }
                    if (value > (this.max * scale)) {
                        value = this.max * scale
                    }
                } else if (type === "plus") {
                    value += step;
                    if (value > (this.max * scale)) {
                        return;
                    }
                    if (value < (this.min * scale)) {
                        value = this.min * scale
                    }
                }
                this.$emit('input', String(value / scale));
            },
            //数字box输入框值转换
            getDecimalScale() {
                let scale = 1;
                // 浮点型
                if (~~this.step !== this.step) {
                    scale = Math.pow(10, (this.step + "").split(".")[1].length);
                }
                return scale;
            },
            // 数字box输入框失去焦点事件
            onBlurNumberbox(e) {
                let value = e.detail.value;
                if (!value) {
                    this.$emit('input', '');
                    return;
                }
                value = +value;
                if (value > this.max) {
                    value = this.max;
                } else if (value < this.min) {
                    value = this.min;
                }
                this.$emit('input', value);
            },
            //复选框选择项改变事件
            checkboxChange(e) {
                var items = this.temprange;
                var checkboxV = {
                    indexs: [],
                    keys: [],
                    vals: []
                };
                var selectK = [];
                var selectV = [];
                var selectI = [];
                for (var i = 0, lenI = items.length; i < lenI; ++i) {
                    const item = items[i]
                    if (e.detail.value.includes(item[this.rangeKey])) {
                        this.$set(item, 'checked', true)
                    } else {
                        this.$set(item, 'checked', false)
                    }
                    if (item.checked) {
                        selectK.push(item[this.rangeKey]);
                        selectV.push(item[this.rangeVal]);
                        selectI.push(i);
                    }
                }
                checkboxV.indexs = selectI;
                checkboxV.keys = selectK;
                checkboxV.vals = selectV;
                this.$emit('input', checkboxV);
            },
            //单选框选择项改变事件
            radioChange(e) {
                var items = this.temprange;
                var radioV = {};
                for (var i = 0, lenI = items.length; i < lenI; ++i) {
                    const item = items[i]
                    if (e.target.value === item[this.rangeKey]) {
                        this.$set(item, 'checked', true);
                        radioV = {
                            index: i,
                            key: e.target.value,
                            val: item[this.rangeVal]
                        };
                    } else {
                        this.$set(item, 'checked', false);
                    }
                }
                this.$emit('input', radioV);
            },
            //复选框、单选框字体点击事件
            onNoticeClick(type, index) {
                let item = this.temprange[index];
                let results = {};
                if (type === 'checkbox') {
                    results = {
                        indexs: this.value.indexs,
                        keys: this.value.keys,
                        vals: this.value.vals
                    };
                    if (item['checked']) { //取消选择
                        let oldIndex = results.indexs.indexOf(index);
                        if (index > -1) {
                            results.indexs.splice(oldIndex, 1);
                            results.keys.splice(oldIndex, 1);
                            results.vals.splice(oldIndex, 1);
                        }
                        this.$set(item, 'checked', false);
                    } else { //选择
                        results.indexs.push(index);
                        results.keys.push(item[this.rangeKey]);
                        results.vals.push(item[this.rangeVal]);
                        this.$set(item, 'checked', true);
                    }
                    this.$emit('input', results);
                } else if (type === 'radio') {
                    this.$set(this.temprange[this.value.index], 'checked', false);
                    results = {
                        index: index,
                        key: item[this.rangeKey],
                        val: item[this.rangeVal]
                    };
                    this.$set(item, 'checked', !item['checked']);
                    this.$emit('input', results);
                }
            },
            //开关选择项改变事件
            switchChange(e) {
                this.switchResult = e.target.value;
                var result = {
                    result: this.switchResult,
                    key: '',
                    val: ''
                };
                var i = this.switchResult ? 0 : 1;
                if (this.temprange.length < 2) {
                    this.$emit('input', result);
                    return;
                }
                result.key = this.temprange[i][this.rangeKey];
                result.val = this.temprange[i][this.rangeVal];
                this.$emit('input', result);
            },
            //下拉框展开图标点击事件
            toggleSelector() {
                this.showSelector = !this.showSelector;
            },
            //下拉框清空图标点击事件
            clearCombox() {
                this.$emit('input', {
                    index: -1,
                    key: '',
                    val: ''
                });
            },
            //下拉框输入内容事件
            onInputCombox(e) {
                this.$emit('input', {
                    index: -1,
                    key: '',
                    val: e.detail.value
                });
                setTimeout(() => {
                    let filter = this.filterCandidates;
                    if (filter.length === 1 && filter[0][this.rangeVal] === e.detail.value) {
                        let result = {
                            index: filter[0]["index"],
                            key: filter[0][this.rangeKey],
                            val: filter[0][this.rangeVal]
                        };
                        this.$emit('input', result);
                    }
                }, 100);
            },
            //下拉框提交内容事件
            onConfirmCombox() {
                this.$emit('confirm', this.value);
            },
            //输入框类得到焦点
            onFocusInput(e) {
                this.thisFocus = true;
                if(this.isFocusSelectAll) {
                    this.selectionEnd=this.value?this.value.length:0;//text类型可以 number不行
                    event.currentTarget.select();//number 类型可以 text类型不行
                }
                this.$emit('resetFocus', true);
                this.$emit('focus', this.value);
            },
            //输入框类失去焦点
            onBlurInput() {
                this.thisFocus = false;
                this.$emit('resetFocus', false);
                this.$emit('blur', this.value);
            },
            //下拉框得到焦点事件
            onFocusCombox() {
                this.showSelector = true;
                this.$emit('focus', this.value);
            },
            //下拉框失去焦点事件
            onBlurCombox() {
                //需要延迟执行,防止输入框失去焦点后,马上隐藏选项内容信息,导致无法选择
                setTimeout(() => {
                    const filter = this.filterCandidates;
                    var result = this.value;
                    if (filter.length <= 0) {
                        result = this.verify ?
                            {
                                index: -1,
                                key: '',
                                val: ''
                            } :
                            result;
                    } else if (this.value['index'] < 0 && this.value['val'].length > 0) {
                        if (this.automatic) {
                            result = {
                                index: filter[0]['index'],
                                key: filter[0][this.rangeKey],
                                val: filter[0][this.rangeVal]
                            }
                        } else if (this.verify && result['index'] <= 0) {
                            result = {
                                index: -1,
                                key: '',
                                val: ''
                            };
                        }
                    }
                    this.$emit('input', result);
                    this.$emit('blur', result);
                    this.showSelector = false;
                }, 100);
            },
            //下拉框选择器内容选项点击事件
            onSelectorClick(index) {
                this.showSelector = false;
                const item = this.filterCandidates[index];
                const result = {
                    index: item["index"],
                    key: item[this.rangeKey],
                    val: item[this.rangeVal]
                };
                this.$emit('input', result);
            },
            //时间输入框-日期点击选择事件
            bindDateChange(e) {
                this.defaultDate = e.detail.value
                let result = (this.isDate ? this.defaultDate : '') + (this.isTime && this.defaultTime !== '选择时间' ? (' ' +
                    this.defaultTime) : '');
                this.$emit('input', result);
                this.$emit('confirm', {
                    date: e.detail.value,
                    time: this.defaultTime === '选择时间' ? '' : this.defaultTime
                });
            },
            //时间输入框-时间点击选择事件
            bindTimeChange(e) {
                this.defaultTime = e.detail.value
                let result = (this.isDate && this.defaultDate !== '选择日期' ? this.defaultDate : '') + (this.isTime ? (' ' +
                    this.defaultTime) : '');
                this.$emit('input', result);
                this.$emit('confirm', {
                    date: this.defaultTime === '选择日期' ? '' : this.defaultTime,
                    time: e.detail.value
                });
            },
 
            //跳转到微信扫一扫,用于在微信推广吧。
            // scan(){
            //    if (plus.os.name == "iOS") {  
            //         plus.runtime.openURL("weixin://scanqrcode")
            //     } else if (plus.os.name == "andriod") {  
            //         var Intent = plus.android.importClass("android.content.Intent");  
            //         var ComponentName = plus.android.importClass('android.content.ComponentName')  
            //         var intent = new Intent();  
            //         intent.setComponent(new ComponentName("com.tencent.mm", "com.tencent.mm.ui.LauncherUI"));  
            //         intent.putExtra("LauncherUI.From.Scaner.Shortcut", true);  
            //         intent.setFlags(335544320);  
            //         intent.setAction("android.intent.action.VIEW");  
            //         var main = plus.android.runtimeMainActivity();  
            //         main.startActivity(intent);
            //     }
            // }
 
            //扫一扫事件
            async scan() {
                let status = await this.checkPermission();
                if (status !== 1) {
                    return;
                }
                uni.scanCode({
                    success: (res) => {
                        this.$emit('input', res.result);
                        this.$emit('confirm', res.result);
                    },
                    fail: (err) => {
                        uni.getSetting({
                            success: (res) => {
                                let authStatus = res.authSetting['scope.camera'];
                                if (!authStatus) {
                                    uni.showModal({
                                        title: '授权失败',
                                        content: 'Hello uni-app需要使用您的相机,请在设置界面打开相关权限',
                                        success: (res) => {
                                            if (res.confirm) {
                                                uni.openSetting()
                                            }
                                        }
                                    })
                                }
                            }
                        })
                    }
                });
            },
 
            //扫一扫功能必须的手机权限验证
            async checkPermission(code) {
                let status = permision.isIOS ? await permision.requestIOS('camera') :
                    await permision.requestAndroid('android.permission.CAMERA');
                if (status === null || status === 1) {
                    status = 1;
                } else {
                    uni.showModal({
                        content: "需要相机权限",
                        confirmText: "设置",
                        success: function(res) {
                            if (res.confirm) {
                                permision.gotoAppSetting();
                            }
                        }
                    })
                }
                return status;
            }
 
        }
    }
    //获取日期,只在时间类型控件才使用
    function getDate(type, dayInterval, SYSDate) {
        if (type !== 'date')
            return '';
        // if(dayInterval==0){
        //     return SYSDate;
        // }
        let dateTime = new Date();
        dateTime = dateTime.setDate(dateTime.getDate() + dayInterval);
        const date = new Date(dateTime)
        let year = date.getFullYear();
        let month = date.getMonth() + 1;
        let day = date.getDate();
        if (type === 'start') {
            year = year - 60;
        } else if (type === 'end') {
            year = year + 2;
        }
        month = month > 9 ? month : '0' + month;;
        day = day > 9 ? day : '0' + day;
        return `${year}-${month}-${day}`;
    }
 
    //获取时间,只在时间类型控件才使用
    function getTime(type, SYSTime) {
        if (type !== 'date')
            return '';
        // return SYSTime;
        const date = new Date();
        let h = date.getHours();
        let m = date.getMinutes();
        return (h < 10 ? '0' + h : h) + ':' + (m < 10 ? '0' + m : m);
    }
</script>
 
<style>
    .rightButton {
        padding: 0 20rpx;
        height: 30px;
        margin-left: 10rpx;
    }
 
    .scroll-view_H {
        white-space: nowrap;
        /* width: 100%; */
    }
 
    .uni-combox {
        display: flex;
        height: 40px;
        line-height: 40px;
        flex-direction: row;
        align-items: center;
        position: relative;
    }
 
    .uni-combox.before::before {
        position: absolute;
        right: 0;
        top: 0;
        left: 0;
        height: 1px;
        content: '';
        -webkit-transform: scaleY(0.5);
        transform: scaleY(0.5);
        background-color: #c8c7cc;
        z-index: 99;
        /* 这里会被input覆盖1px给了一个置顶 */
    }
 
    .uni-combox.after::after {
        position: absolute;
        right: 0;
        bottom: 0;
        left: 0;
        height: 1px;
        content: '';
        -webkit-transform: scaleY(0.5);
        transform: scaleY(0.5);
        background-color: #c8c7cc;
    }
 
    .uni-combox__input-box {
        position: relative;
        display: flex;
        flex: 1;
        flex-direction: row;
        align-items: center;
        /* color: #0000ff; */
        height: 100%;
    }
 
    .uni-combox__input {
        flex: 1;
        font-size: 16px;
        height: 22px;
        line-height: 22px;
    }
 
    .uni-combox__input-arrow {
        /* padding: 10px; */
    }
 
    .uni-combox__selector {
        box-sizing: border-box;
        position: absolute;
        top: 42px;
        left: 0;
        width: 100%;
        background-color: #ffffff;
        border-radius: 6px;
        box-shadow: #dddddd 4px 4px 8px, #dddddd -4px -4px 8px;
        z-index: 99;
    }
 
    .uni-combox__selector-scroll {
        max-height: 200px;
        box-sizing: border-box;
        white-space: nowrap;
    }
 
    .uni-combox__selector::before {
        content: '';
        position: absolute;
        width: 0;
        height: 0;
        border-bottom: solid 6px #ffffff;
        border-right: solid 6px transparent;
        border-left: solid 6px transparent;
        left: 50%;
        top: -6px;
        margin-left: -6px;
    }
 
    .uni-combox__selector-empty,
    .uni-combox__selector-item {
        /* #ifdef APP-NVUE */
        display: flex;
        /* #endif */
        line-height: 36px;
        font-size: 14px;
        text-align: left;
        border-bottom: solid 1px #dddddd;
        margin: 0px 10px;
    }
 
    .uni-combox__selector-empty:last-child,
    .uni-combox__selector-item:last-child {
        border-bottom: none;
    }
 
    uni-radio-group,
    uni-checkbox-group {
        width: 100%;
        height: 100%;
        /* max-height: 120px; */
        overflow-y: scroll;
    }
 
    .radio-checkbox-content {
        display: flex;
        float: left;
        margin: 2px 0;
    }
 
    .radio-checkbox-content-notice {
        padding: 0;
        margin-bottom: 0;
    }
 
    .uni-numbox {
        display: flex;
        flex-direction: row;
        height: 28px;
        line-height: 28px;
        width: 100%;
    }
 
    .uni-numbox__value {
        height: 28px;
        width: 100%;
        text-align: center;
        font-size: 16px;
        border-style: solid;
        border-color: #e5e5e5;
        border-width: 0 1px 0 1px;
    }
 
    .uni-numbox__minus {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        width: 30px;
        height: 28px;
        font-size: 20px;
        color: #333;
        background-color: #f8f8f8;
        border-style: solid;
        border-color: #e5e5e5;
        border-top-left-radius: 3px;
        border-bottom-left-radius: 3px;
        border-width: 0 0 0 1px;
    }
 
    .uni-numbox__plus {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        width: 30px;
        height: 28px;
        border-width: 0 1px 1px 0;
        border-style: solid;
        border-color: #e5e5e5;
        border-top-right-radius: 3px;
        border-bottom-right-radius: 3px;
        background-color: #f8f8f8;
    }
 
    .uni-numbox--text {
        font-size: 40rpx;
        color: #333;
    }
 
    .uni-numbox--disabled {
        color: #c0c0c0;
    }
 
    .m-input-view {
        display: inline-flex;
        flex-direction: row;
        align-items: center;
        width: 100%;
        flex: 1;
        padding: 0 0 0 5px;
    }
 
    .m-input-row {
        display: flex;
        flex-direction: row;
        position: relative;
        font-size: 16px;
        line-height: 30px;
        height: 30px;
        padding: 5px 1px;
    }
 
    .m-input-row.before::before {
        position: absolute;
        right: 0;
        top: 0;
        left: 0;
        height: 1px;
        content: '';
        -webkit-transform: scaleY(.5);
        transform: scaleY(.5);
        background-color: #b0b0d9;
    }
 
    .m-input-row.after::after {
        position: absolute;
        right: 0;
        bottom: 0;
        left: 0;
        height: 1px;
        content: '';
        -webkit-transform: scaleY(.5);
        transform: scaleY(.5);
        background-color: #b0b0d9;
    }
 
    .m-title {
        /* width: 25%; */
        width: 80px;
        padding-left: 5px;
    }
 
    /* 标签右侧边框 */
    .m-title.separate::after {
        position: absolute;
        bottom: 0;
        top: 0;
        width: 1px;
        content: '';
        background-color: #b0b0d9;
    }
 
    .m-input {
        width: 100%;
        display: flex;
        flex: 1;
        font-size: 16px;
    }
    
</style>