ai.touchui-vue 1.38.0 → 1.39.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/ai.touchui-vue.common.js +337 -193
- package/lib/date-picker.js +22 -15
- package/lib/float.js +39 -9
- package/lib/import.js +19 -11
- package/lib/index.js +1 -1
- package/lib/input.js +4 -7
- package/lib/progress.js +8 -2
- package/lib/select.js +210 -96
- package/lib/theme/css/theme/B-Design.css +1 -1
- package/lib/theme/css/theme/aiplan.css +1 -1
- package/lib/theme/css/theme/aiplangd.css +1 -1
- package/lib/theme/css/theme/chbn.css +1 -1
- package/lib/theme/css/theme/default.css +1 -1
- package/lib/theme/css/theme/dt.css +1 -1
- package/lib/theme/css/theme/ecloud.css +1 -1
- package/lib/theme/css/theme/hongkong.css +1 -1
- package/lib/theme/css/theme/logistics.css +1 -1
- package/lib/theme/css/theme/narrow.css +1 -1
- package/lib/theme/css/theme/sdpf.css +1 -1
- package/lib/theme/css/theme/upc.css +1 -1
- package/lib/theme/css/theme/website.css +1 -1
- package/lib/theme/css/theme/workbench-gz.css +1 -1
- package/lib/theme/css/theme/zj.css +1 -1
- package/lib/utils/validate.js +4 -22
- package/package.json +1 -1
- package/packages/date-picker/src/.DS_Store +0 -0
- package/packages/date-picker/src/date-picker.vue +15 -9
- package/packages/float/src/main.vue +37 -7
- package/packages/import/src/import.vue +1 -1
- package/packages/input/src/input.vue +2 -5
- package/packages/progress/src/progress.vue +5 -0
- package/packages/select/src/select.vue +95 -19
- package/packages/theme/lib/css/theme/B-Design.css +1 -1
- package/packages/theme/lib/css/theme/aiplan.css +1 -1
- package/packages/theme/lib/css/theme/aiplangd.css +1 -1
- package/packages/theme/lib/css/theme/chbn.css +1 -1
- package/packages/theme/lib/css/theme/default.css +1 -1
- package/packages/theme/lib/css/theme/dt.css +1 -1
- package/packages/theme/lib/css/theme/ecloud.css +1 -1
- package/packages/theme/lib/css/theme/hongkong.css +1 -1
- package/packages/theme/lib/css/theme/logistics.css +1 -1
- package/packages/theme/lib/css/theme/narrow.css +1 -1
- package/packages/theme/lib/css/theme/sdpf.css +1 -1
- package/packages/theme/lib/css/theme/upc.css +1 -1
- package/packages/theme/lib/css/theme/website.css +1 -1
- package/packages/theme/lib/css/theme/workbench-gz.css +1 -1
- package/packages/theme/lib/css/theme/zj.css +1 -1
- package/packages/theme/src/less/element/pic.less +1 -0
- package/packages/theme/src/less/element/progress.less +1 -1
- package/packages/theme/src/less/element/select.less +8 -0
- package/src/index.js +1 -1
- package/src/utils/validate.js +4 -22
package/lib/select.js
CHANGED
|
@@ -252,7 +252,7 @@ module.exports = require("ai.touchui-vue/lib/locale");
|
|
|
252
252
|
// ESM COMPAT FLAG
|
|
253
253
|
__webpack_require__.r(__webpack_exports__);
|
|
254
254
|
|
|
255
|
-
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/select/src/select.vue?vue&type=template&id=
|
|
255
|
+
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/select/src/select.vue?vue&type=template&id=b54eb61c
|
|
256
256
|
var render = function () {
|
|
257
257
|
var _vm = this
|
|
258
258
|
var _h = _vm.$createElement
|
|
@@ -335,6 +335,7 @@ var render = function () {
|
|
|
335
335
|
_c(
|
|
336
336
|
"span",
|
|
337
337
|
{
|
|
338
|
+
ref: "selectContentRef",
|
|
338
339
|
staticClass: "to-selectContent",
|
|
339
340
|
class: _vm.setContentClass,
|
|
340
341
|
on: { click: _vm.click },
|
|
@@ -519,7 +520,7 @@ var render = function () {
|
|
|
519
520
|
),
|
|
520
521
|
]
|
|
521
522
|
: [
|
|
522
|
-
_vm.
|
|
523
|
+
_vm.conTags.filter(function (item) {
|
|
523
524
|
return !item.hide
|
|
524
525
|
}).length === 0 &&
|
|
525
526
|
!_vm.inputable &&
|
|
@@ -550,16 +551,20 @@ var render = function () {
|
|
|
550
551
|
"span",
|
|
551
552
|
{ staticClass: "to-selectTag" },
|
|
552
553
|
[
|
|
553
|
-
_vm.
|
|
554
|
-
|
|
554
|
+
(_vm.conTags.length > 0 &&
|
|
555
|
+
!(_vm.isAll && _vm.useAllText)) ||
|
|
556
|
+
(_vm.showCount && _vm.count > 0)
|
|
555
557
|
? [
|
|
556
|
-
_vm._l(_vm.
|
|
558
|
+
_vm._l(_vm.conTags, function (item, index) {
|
|
557
559
|
return [
|
|
558
560
|
!item.hide
|
|
559
561
|
? _c(
|
|
560
562
|
"to-tag",
|
|
561
563
|
{
|
|
562
564
|
key: index,
|
|
565
|
+
class: {
|
|
566
|
+
"show-count": _vm.isNeedMin,
|
|
567
|
+
},
|
|
563
568
|
attrs: {
|
|
564
569
|
color: "fg",
|
|
565
570
|
mode: "plain",
|
|
@@ -576,10 +581,20 @@ var render = function () {
|
|
|
576
581
|
: _vm._e(),
|
|
577
582
|
]
|
|
578
583
|
}),
|
|
584
|
+
_vm.showCount && _vm.count > 0
|
|
585
|
+
? _c(
|
|
586
|
+
"to-tag",
|
|
587
|
+
{
|
|
588
|
+
staticClass: "tag-count",
|
|
589
|
+
attrs: { color: "fg", mode: "plain" },
|
|
590
|
+
},
|
|
591
|
+
[_vm._v("+" + _vm._s(_vm.count))]
|
|
592
|
+
)
|
|
593
|
+
: _vm._e(),
|
|
579
594
|
]
|
|
580
595
|
: _vm._e(),
|
|
581
596
|
!_vm.$phone ||
|
|
582
|
-
(_vm.$phone && _vm.
|
|
597
|
+
(_vm.$phone && _vm.conTags.length === 0)
|
|
583
598
|
? [
|
|
584
599
|
_vm.inputable && !_vm.filterable
|
|
585
600
|
? _c("to-input", {
|
|
@@ -590,7 +605,7 @@ var render = function () {
|
|
|
590
605
|
"prevent-focus": "",
|
|
591
606
|
mode: "none",
|
|
592
607
|
placeholder:
|
|
593
|
-
_vm.
|
|
608
|
+
_vm.conTags.filter(function (item) {
|
|
594
609
|
return !item.hide
|
|
595
610
|
}).length > 0
|
|
596
611
|
? ""
|
|
@@ -620,7 +635,7 @@ var render = function () {
|
|
|
620
635
|
"prevent-focus": "",
|
|
621
636
|
mode: "none",
|
|
622
637
|
placeholder:
|
|
623
|
-
_vm.
|
|
638
|
+
_vm.conTags.filter(function (item) {
|
|
624
639
|
return !item.hide
|
|
625
640
|
}).length > 0
|
|
626
641
|
? ""
|
|
@@ -649,7 +664,7 @@ var render = function () {
|
|
|
649
664
|
"prevent-focus": "",
|
|
650
665
|
mode: "none",
|
|
651
666
|
placeholder:
|
|
652
|
-
_vm.
|
|
667
|
+
_vm.conTags.filter(function (item) {
|
|
653
668
|
return !item.hide
|
|
654
669
|
}).length > 0
|
|
655
670
|
? ""
|
|
@@ -760,6 +775,7 @@ var render = function () {
|
|
|
760
775
|
slide: _vm.layerSlide,
|
|
761
776
|
width: _vm.iOptionWidth,
|
|
762
777
|
position: _vm.layerPosition,
|
|
778
|
+
"max-height": _vm.maxHeight,
|
|
763
779
|
},
|
|
764
780
|
on: { closed: _vm.layerClose, mousedown: _vm.layerMousedown },
|
|
765
781
|
},
|
|
@@ -1906,7 +1922,7 @@ var staticRenderFns = []
|
|
|
1906
1922
|
render._withStripped = true
|
|
1907
1923
|
|
|
1908
1924
|
|
|
1909
|
-
// CONCATENATED MODULE: ./packages/select/src/select.vue?vue&type=template&id=
|
|
1925
|
+
// CONCATENATED MODULE: ./packages/select/src/select.vue?vue&type=template&id=b54eb61c
|
|
1910
1926
|
|
|
1911
1927
|
// EXTERNAL MODULE: external "ai.touchui-vue/lib/utils/ajax"
|
|
1912
1928
|
var ajax_ = __webpack_require__(15);
|
|
@@ -2159,6 +2175,7 @@ var lib_locale_ = __webpack_require__(3);
|
|
|
2159
2175
|
//
|
|
2160
2176
|
//
|
|
2161
2177
|
//
|
|
2178
|
+
//
|
|
2162
2179
|
|
|
2163
2180
|
|
|
2164
2181
|
|
|
@@ -2424,6 +2441,14 @@ var lib_locale_ = __webpack_require__(3);
|
|
|
2424
2441
|
valueType: {
|
|
2425
2442
|
type: String,
|
|
2426
2443
|
default: ''
|
|
2444
|
+
},
|
|
2445
|
+
showCount: {
|
|
2446
|
+
type: Boolean,
|
|
2447
|
+
default: false
|
|
2448
|
+
},
|
|
2449
|
+
maxHeight: {
|
|
2450
|
+
type: [Number, String],
|
|
2451
|
+
default: ''
|
|
2427
2452
|
}
|
|
2428
2453
|
},
|
|
2429
2454
|
data: function data() {
|
|
@@ -2450,7 +2475,10 @@ var lib_locale_ = __webpack_require__(3);
|
|
|
2450
2475
|
layerPosition: 'auto',
|
|
2451
2476
|
disabled: this.readonly,
|
|
2452
2477
|
iApiHeaders: {},
|
|
2453
|
-
inputing: false
|
|
2478
|
+
inputing: false,
|
|
2479
|
+
count: 0,
|
|
2480
|
+
conTags: [],
|
|
2481
|
+
isNeedMin: false
|
|
2454
2482
|
};
|
|
2455
2483
|
},
|
|
2456
2484
|
|
|
@@ -2603,6 +2631,9 @@ var lib_locale_ = __webpack_require__(3);
|
|
|
2603
2631
|
} else {
|
|
2604
2632
|
arr.push('to-box-mode-toast');
|
|
2605
2633
|
}
|
|
2634
|
+
// if (this.showCount) {
|
|
2635
|
+
// arr.push('to-select-showCount')
|
|
2636
|
+
// }
|
|
2606
2637
|
return arr;
|
|
2607
2638
|
},
|
|
2608
2639
|
validateRequired: function validateRequired() {
|
|
@@ -2618,11 +2649,7 @@ var lib_locale_ = __webpack_require__(3);
|
|
|
2618
2649
|
if (this.desc) {
|
|
2619
2650
|
return this.desc;
|
|
2620
2651
|
} else if (this.ToFormItem && this.ToFormItem.label) {
|
|
2621
|
-
|
|
2622
|
-
return this.ToFormItem.label + '-label';
|
|
2623
|
-
} else {
|
|
2624
|
-
return this.ToFormItem.label;
|
|
2625
|
-
}
|
|
2652
|
+
return this.ToFormItem.label;
|
|
2626
2653
|
} else {
|
|
2627
2654
|
return '';
|
|
2628
2655
|
}
|
|
@@ -2664,8 +2691,10 @@ var lib_locale_ = __webpack_require__(3);
|
|
|
2664
2691
|
handler: function handler(val) {
|
|
2665
2692
|
if (val) {
|
|
2666
2693
|
this.selected = [];
|
|
2694
|
+
this.conTags = [];
|
|
2667
2695
|
} else {
|
|
2668
2696
|
this.selected = {};
|
|
2697
|
+
this.conTags = {};
|
|
2669
2698
|
}
|
|
2670
2699
|
},
|
|
2671
2700
|
|
|
@@ -2723,7 +2752,9 @@ var lib_locale_ = __webpack_require__(3);
|
|
|
2723
2752
|
} else {
|
|
2724
2753
|
this.$emit('change', val, this.selected);
|
|
2725
2754
|
}
|
|
2726
|
-
|
|
2755
|
+
if (this.showCount && this.multiple) {
|
|
2756
|
+
this.getAllTag();
|
|
2757
|
+
}
|
|
2727
2758
|
var detail = {
|
|
2728
2759
|
name: 'ToSelect',
|
|
2729
2760
|
value: val,
|
|
@@ -2778,6 +2809,13 @@ var lib_locale_ = __webpack_require__(3);
|
|
|
2778
2809
|
}
|
|
2779
2810
|
},
|
|
2780
2811
|
created: function created() {
|
|
2812
|
+
var _this7 = this;
|
|
2813
|
+
|
|
2814
|
+
this.$nextTick(function () {
|
|
2815
|
+
if (_this7.showCount && _this7.multiple) {
|
|
2816
|
+
_this7.getAllTag();
|
|
2817
|
+
}
|
|
2818
|
+
});
|
|
2781
2819
|
this.iLabelText = this.labelText;
|
|
2782
2820
|
this.iValueText = this.valueText;
|
|
2783
2821
|
this.iResPath = this.resPath;
|
|
@@ -2803,6 +2841,79 @@ var lib_locale_ = __webpack_require__(3);
|
|
|
2803
2841
|
},
|
|
2804
2842
|
|
|
2805
2843
|
methods: {
|
|
2844
|
+
calculateTagLayout: function calculateTagLayout() {
|
|
2845
|
+
var _this8 = this;
|
|
2846
|
+
|
|
2847
|
+
var isRecalculate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
2848
|
+
|
|
2849
|
+
this.$nextTick(function () {
|
|
2850
|
+
var tags = _this8.$el.querySelectorAll('.to-selectTag .to-tag');
|
|
2851
|
+
var selectContent = _this8.$refs.selectContentRef;
|
|
2852
|
+
var gap = selectContent.scrollWidth - selectContent.clientWidth;
|
|
2853
|
+
if (gap > 0) {
|
|
2854
|
+
_this8.isNeedMin = true;
|
|
2855
|
+
return false;
|
|
2856
|
+
}
|
|
2857
|
+
_this8.isNeedMin = false;
|
|
2858
|
+
var firstTagTop = 0;
|
|
2859
|
+
if (tags.length > 1) {
|
|
2860
|
+
for (var i = 0; i < tags.length; i++) {
|
|
2861
|
+
if (i === 0) {
|
|
2862
|
+
firstTagTop = tags[i].offsetTop;
|
|
2863
|
+
} else {
|
|
2864
|
+
if (tags[i].offsetTop !== firstTagTop) {
|
|
2865
|
+
if (!tags[i].className.includes('tag-count')) {
|
|
2866
|
+
var _ret = function () {
|
|
2867
|
+
var index = isRecalculate && _this8.count > 0 ? i - 1 : i;
|
|
2868
|
+
_this8.conTags = _this8.selected.filter(function (item, idx) {
|
|
2869
|
+
return idx < index;
|
|
2870
|
+
});
|
|
2871
|
+
var arrs = _this8.selected.filter(function (item, idx) {
|
|
2872
|
+
return idx >= index;
|
|
2873
|
+
});
|
|
2874
|
+
_this8.count = arrs.length;
|
|
2875
|
+
if (!isRecalculate) {
|
|
2876
|
+
_this8.layoutCount();
|
|
2877
|
+
}
|
|
2878
|
+
return 'break';
|
|
2879
|
+
}();
|
|
2880
|
+
|
|
2881
|
+
if (_ret === 'break') break;
|
|
2882
|
+
} else {
|
|
2883
|
+
if (i >= 2) {
|
|
2884
|
+
var _ret2 = function () {
|
|
2885
|
+
var index = isRecalculate && _this8.count > 0 ? i - 1 : i;
|
|
2886
|
+
_this8.conTags = _this8.selected.filter(function (item, idx) {
|
|
2887
|
+
return idx < index;
|
|
2888
|
+
});
|
|
2889
|
+
var arrs = _this8.selected.filter(function (item, idx) {
|
|
2890
|
+
return idx >= index;
|
|
2891
|
+
});
|
|
2892
|
+
_this8.count = arrs.length;
|
|
2893
|
+
if (!isRecalculate) {
|
|
2894
|
+
_this8.layoutCount();
|
|
2895
|
+
}
|
|
2896
|
+
return 'break';
|
|
2897
|
+
}();
|
|
2898
|
+
|
|
2899
|
+
if (_ret2 === 'break') break;
|
|
2900
|
+
} else {
|
|
2901
|
+
_this8.isNeedMin = true;
|
|
2902
|
+
}
|
|
2903
|
+
}
|
|
2904
|
+
}
|
|
2905
|
+
}
|
|
2906
|
+
}
|
|
2907
|
+
}
|
|
2908
|
+
});
|
|
2909
|
+
},
|
|
2910
|
+
getAllTag: function getAllTag() {
|
|
2911
|
+
this.count = 0;
|
|
2912
|
+
this.calculateTagLayout(false);
|
|
2913
|
+
},
|
|
2914
|
+
layoutCount: function layoutCount() {
|
|
2915
|
+
this.calculateTagLayout(true);
|
|
2916
|
+
},
|
|
2806
2917
|
valueChange: function valueChange(val) {
|
|
2807
2918
|
if (!this.multiple) {
|
|
2808
2919
|
if (this.inputable) {
|
|
@@ -2823,19 +2934,19 @@ var lib_locale_ = __webpack_require__(3);
|
|
|
2823
2934
|
}
|
|
2824
2935
|
},
|
|
2825
2936
|
setSeleted: function setSeleted(val) {
|
|
2826
|
-
var
|
|
2937
|
+
var _this9 = this;
|
|
2827
2938
|
|
|
2828
2939
|
var selected = JSON.parse(JSON.stringify(this.selected));
|
|
2829
2940
|
if (!this.multiple) {
|
|
2830
2941
|
if (this.options.findIndex(function (option) {
|
|
2831
|
-
return option[
|
|
2942
|
+
return option[_this9.iValueText] === val;
|
|
2832
2943
|
}) === -1) {
|
|
2833
2944
|
var _selected;
|
|
2834
2945
|
|
|
2835
2946
|
selected = (_selected = {}, _selected[this.iLabelText] = val, _selected[this.iValueText] = val, _selected);
|
|
2836
2947
|
} else {
|
|
2837
2948
|
selected = this.options.find(function (option) {
|
|
2838
|
-
return option[
|
|
2949
|
+
return option[_this9.iValueText] === val;
|
|
2839
2950
|
});
|
|
2840
2951
|
}
|
|
2841
2952
|
} else {
|
|
@@ -2846,15 +2957,15 @@ var lib_locale_ = __webpack_require__(3);
|
|
|
2846
2957
|
var selectedArr = [];
|
|
2847
2958
|
arr.map(function (item) {
|
|
2848
2959
|
if (item && item.trim()) {
|
|
2849
|
-
if (
|
|
2850
|
-
return String(option[
|
|
2960
|
+
if (_this9.options.findIndex(function (option) {
|
|
2961
|
+
return String(option[_this9.iValueText]) === String(item);
|
|
2851
2962
|
}) === -1) {
|
|
2852
2963
|
var _selectedArr$push;
|
|
2853
2964
|
|
|
2854
|
-
selectedArr.push((_selectedArr$push = {}, _selectedArr$push[
|
|
2965
|
+
selectedArr.push((_selectedArr$push = {}, _selectedArr$push[_this9.iLabelText] = item, _selectedArr$push[_this9.iValueText] = item, _selectedArr$push.hide = !_this9.inputable, _selectedArr$push));
|
|
2855
2966
|
} else {
|
|
2856
|
-
|
|
2857
|
-
if (String(option[
|
|
2967
|
+
_this9.options.map(function (option) {
|
|
2968
|
+
if (String(option[_this9.iValueText]) === String(item)) {
|
|
2858
2969
|
selectedArr.push(option);
|
|
2859
2970
|
}
|
|
2860
2971
|
});
|
|
@@ -2868,19 +2979,22 @@ var lib_locale_ = __webpack_require__(3);
|
|
|
2868
2979
|
var fn = this.beforeChange(selected);
|
|
2869
2980
|
if (fn && fn.then) {
|
|
2870
2981
|
fn.then(function (flag) {
|
|
2871
|
-
|
|
2982
|
+
_this9.selected = selected;
|
|
2983
|
+
_this9.conTags = selected;
|
|
2872
2984
|
}).catch(function (e) {});
|
|
2873
2985
|
} else {
|
|
2874
2986
|
if (fn) {
|
|
2875
2987
|
this.selected = selected;
|
|
2988
|
+
this.conTags = selected;
|
|
2876
2989
|
}
|
|
2877
2990
|
}
|
|
2878
2991
|
} else {
|
|
2879
2992
|
this.selected = selected;
|
|
2993
|
+
this.conTags = selected;
|
|
2880
2994
|
}
|
|
2881
2995
|
},
|
|
2882
2996
|
enter: function enter() {
|
|
2883
|
-
var
|
|
2997
|
+
var _this10 = this;
|
|
2884
2998
|
|
|
2885
2999
|
if (!(this.multiple && this.inputable)) {
|
|
2886
3000
|
this.toggleLayer();
|
|
@@ -2890,9 +3004,9 @@ var lib_locale_ = __webpack_require__(3);
|
|
|
2890
3004
|
// 判断重复项
|
|
2891
3005
|
var value = this.filterable ? this.multipleFilterValue : this.multipleInputValue;
|
|
2892
3006
|
if (this.selected.find(function (item) {
|
|
2893
|
-
return item[
|
|
3007
|
+
return item[_this10.iLabelText] === value;
|
|
2894
3008
|
}) || this.selected.find(function (item) {
|
|
2895
|
-
return item[
|
|
3009
|
+
return item[_this10.iValueText] === value;
|
|
2896
3010
|
})) {
|
|
2897
3011
|
this.$tip.error(this.t('to.select.tip.error.repetition'));
|
|
2898
3012
|
return;
|
|
@@ -2906,7 +3020,7 @@ var lib_locale_ = __webpack_require__(3);
|
|
|
2906
3020
|
var fn = this.beforeChange(newOption);
|
|
2907
3021
|
if (fn && fn.then) {
|
|
2908
3022
|
fn.then(function (flag) {
|
|
2909
|
-
|
|
3023
|
+
_this10.selected.push(newOption);
|
|
2910
3024
|
}).catch(function (e) {});
|
|
2911
3025
|
} else {
|
|
2912
3026
|
if (fn) {
|
|
@@ -2924,11 +3038,11 @@ var lib_locale_ = __webpack_require__(3);
|
|
|
2924
3038
|
if (this.$phone) {
|
|
2925
3039
|
if (this.filterable) {
|
|
2926
3040
|
setTimeout(function () {
|
|
2927
|
-
|
|
3041
|
+
_this10.$refs.popupFilter.focus();
|
|
2928
3042
|
}, 500);
|
|
2929
3043
|
} else {
|
|
2930
3044
|
setTimeout(function () {
|
|
2931
|
-
|
|
3045
|
+
_this10.$refs.popupInput.focus();
|
|
2932
3046
|
}, 500);
|
|
2933
3047
|
}
|
|
2934
3048
|
}
|
|
@@ -2954,17 +3068,17 @@ var lib_locale_ = __webpack_require__(3);
|
|
|
2954
3068
|
}
|
|
2955
3069
|
},
|
|
2956
3070
|
getLabel: function getLabel(val) {
|
|
2957
|
-
var
|
|
3071
|
+
var _this11 = this;
|
|
2958
3072
|
|
|
2959
3073
|
var obj = this.options.find(function (item) {
|
|
2960
|
-
return item[
|
|
3074
|
+
return item[_this11.iValueText] === val;
|
|
2961
3075
|
});
|
|
2962
3076
|
if (obj && obj[this.iLabelText]) {
|
|
2963
3077
|
return obj[this.iLabelText];
|
|
2964
3078
|
}
|
|
2965
3079
|
},
|
|
2966
3080
|
setOptions: function setOptions() {
|
|
2967
|
-
var
|
|
3081
|
+
var _this12 = this;
|
|
2968
3082
|
|
|
2969
3083
|
// 同步选项
|
|
2970
3084
|
if (this.data) {
|
|
@@ -2997,7 +3111,7 @@ var lib_locale_ = __webpack_require__(3);
|
|
|
2997
3111
|
// 如果设置了方法,则替换为方法
|
|
2998
3112
|
if (typeof this.setLabelFn === 'function') {
|
|
2999
3113
|
this.options.forEach(function (item) {
|
|
3000
|
-
item.label =
|
|
3114
|
+
item.label = _this12.setLabelFn(item);
|
|
3001
3115
|
});
|
|
3002
3116
|
}
|
|
3003
3117
|
}
|
|
@@ -3072,37 +3186,37 @@ var lib_locale_ = __webpack_require__(3);
|
|
|
3072
3186
|
// 直接返回一个 select 所需要的 data 对象时,不需要任何解析
|
|
3073
3187
|
// 如:[{name:'张三', id:0},{name:'李四', id:1}]
|
|
3074
3188
|
if (Array.isArray(res)) {
|
|
3075
|
-
|
|
3076
|
-
sessionStorage.setItem('static.' +
|
|
3189
|
+
_this12.options = res;
|
|
3190
|
+
sessionStorage.setItem('static.' + _this12.api, JSON.stringify(res));
|
|
3077
3191
|
|
|
3078
3192
|
// 设置 selected
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
} else if (res.code ===
|
|
3193
|
+
_this12.setSeleted(_this12.value);
|
|
3194
|
+
_this12.setPlaceholder();
|
|
3195
|
+
_this12.$emit('option-loaded', _this12.options);
|
|
3196
|
+
} else if (res.code === _this12.iSuccessCode) {
|
|
3083
3197
|
// 按照 json 格式返回,需要根据配置路径进行解析
|
|
3084
3198
|
// 如:{ code:'0', data:[{name:'张三', id:0},{name:'李四', id:1}]}
|
|
3085
3199
|
var data = [];
|
|
3086
|
-
if (
|
|
3087
|
-
var resPath =
|
|
3200
|
+
if (_this12.iResPath) {
|
|
3201
|
+
var resPath = _this12.iResPath.split('/');
|
|
3088
3202
|
resPath.forEach(function (el) {
|
|
3089
3203
|
data = res[el];
|
|
3090
3204
|
});
|
|
3091
3205
|
}
|
|
3092
|
-
|
|
3093
|
-
sessionStorage.setItem('static.' +
|
|
3206
|
+
_this12.options = data;
|
|
3207
|
+
sessionStorage.setItem('static.' + _this12.api, JSON.stringify(data));
|
|
3094
3208
|
|
|
3095
3209
|
// 设置 selected
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3210
|
+
_this12.setSeleted(_this12.value);
|
|
3211
|
+
_this12.setPlaceholder();
|
|
3212
|
+
_this12.$emit('option-loaded', _this12.options);
|
|
3099
3213
|
} else {
|
|
3100
|
-
|
|
3101
|
-
|
|
3214
|
+
_this12.options = [];
|
|
3215
|
+
_this12.t('to.select.tip.error.res', 'select api(' + _this12.api + ')');
|
|
3102
3216
|
}
|
|
3103
3217
|
},
|
|
3104
3218
|
onError: function onError(res) {
|
|
3105
|
-
|
|
3219
|
+
_this12.$tip.danger(_this12.t('to.select.tip.error.api', 'select api(' + _this12.api + ') '));
|
|
3106
3220
|
}
|
|
3107
3221
|
};
|
|
3108
3222
|
var req = this.httpRequest(options);
|
|
@@ -3131,23 +3245,23 @@ var lib_locale_ = __webpack_require__(3);
|
|
|
3131
3245
|
}
|
|
3132
3246
|
},
|
|
3133
3247
|
selectAll: function selectAll() {
|
|
3134
|
-
var
|
|
3248
|
+
var _this13 = this;
|
|
3135
3249
|
|
|
3136
3250
|
var arr = [];
|
|
3137
3251
|
this.options.map(function (item) {
|
|
3138
3252
|
if (!item.disabled) {
|
|
3139
|
-
arr.push(item[
|
|
3253
|
+
arr.push(item[_this13.iValueText]);
|
|
3140
3254
|
}
|
|
3141
3255
|
});
|
|
3142
3256
|
this.iValue = arr.toString();
|
|
3143
3257
|
},
|
|
3144
3258
|
Deselect: function Deselect() {
|
|
3145
|
-
var
|
|
3259
|
+
var _this14 = this;
|
|
3146
3260
|
|
|
3147
3261
|
var arr = [];
|
|
3148
3262
|
this.options.map(function (item) {
|
|
3149
|
-
if (!item.disabled && !
|
|
3150
|
-
arr.push(item[
|
|
3263
|
+
if (!item.disabled && !_this14.iValue.split(',').includes(item[_this14.iValueText])) {
|
|
3264
|
+
arr.push(item[_this14.iValueText]);
|
|
3151
3265
|
}
|
|
3152
3266
|
});
|
|
3153
3267
|
this.iValue = arr.toString();
|
|
@@ -3156,7 +3270,7 @@ var lib_locale_ = __webpack_require__(3);
|
|
|
3156
3270
|
this.setValue('');
|
|
3157
3271
|
},
|
|
3158
3272
|
itemChange: function itemChange(item) {
|
|
3159
|
-
var
|
|
3273
|
+
var _this15 = this;
|
|
3160
3274
|
|
|
3161
3275
|
if (item.disabled) {
|
|
3162
3276
|
return;
|
|
@@ -3164,38 +3278,38 @@ var lib_locale_ = __webpack_require__(3);
|
|
|
3164
3278
|
this.setSeleted(item[this.iValueText]);
|
|
3165
3279
|
// this.selected = item
|
|
3166
3280
|
this.$nextTick(function () {
|
|
3167
|
-
|
|
3168
|
-
|
|
3281
|
+
_this15.$emit('selected', item);
|
|
3282
|
+
_this15.closeLayer();
|
|
3169
3283
|
});
|
|
3170
3284
|
},
|
|
3171
3285
|
adjustLayer: function adjustLayer() {
|
|
3172
|
-
var
|
|
3286
|
+
var _this16 = this;
|
|
3173
3287
|
|
|
3174
3288
|
if (this.optionDisplay !== 'none' && this.$refs.layer.show) {
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
});
|
|
3289
|
+
setTimeout(function () {
|
|
3290
|
+
_this16.$refs.layer.set(_this16.$refs.link);
|
|
3291
|
+
}, 10);
|
|
3178
3292
|
}
|
|
3179
3293
|
},
|
|
3180
3294
|
openLayer: function openLayer() {
|
|
3181
|
-
var
|
|
3295
|
+
var _this17 = this;
|
|
3182
3296
|
|
|
3183
3297
|
if (!this.disabled && this.optionDisplay !== 'none') {
|
|
3184
3298
|
this.$refs.layer.open('link');
|
|
3185
3299
|
if (this.filterable && this.$phone) {
|
|
3186
3300
|
setTimeout(function () {
|
|
3187
|
-
if (
|
|
3188
|
-
|
|
3301
|
+
if (_this17.$refs.popupFilter) {
|
|
3302
|
+
_this17.$refs.popupFilter.focus();
|
|
3189
3303
|
}
|
|
3190
|
-
|
|
3191
|
-
|
|
3304
|
+
_this17.$nextTick(function () {
|
|
3305
|
+
_this17.options = _this17.s_options.concat(_this17.anotherOptions);
|
|
3192
3306
|
});
|
|
3193
3307
|
}, 500);
|
|
3194
3308
|
}
|
|
3195
3309
|
if (this.inputable && this.$phone) {
|
|
3196
3310
|
setTimeout(function () {
|
|
3197
|
-
if (
|
|
3198
|
-
|
|
3311
|
+
if (_this17.$refs.popupInput) {
|
|
3312
|
+
_this17.$refs.popupInput.focus();
|
|
3199
3313
|
}
|
|
3200
3314
|
}, 500);
|
|
3201
3315
|
}
|
|
@@ -3252,12 +3366,12 @@ var lib_locale_ = __webpack_require__(3);
|
|
|
3252
3366
|
}
|
|
3253
3367
|
},
|
|
3254
3368
|
layerMousedown: function layerMousedown() {
|
|
3255
|
-
var
|
|
3369
|
+
var _this18 = this;
|
|
3256
3370
|
|
|
3257
3371
|
this.blurByLayer = true;
|
|
3258
3372
|
var timer = null;
|
|
3259
3373
|
timer = setTimeout(function () {
|
|
3260
|
-
|
|
3374
|
+
_this18.blurByLayer = false;
|
|
3261
3375
|
clearTimeout(timer);
|
|
3262
3376
|
timer = null;
|
|
3263
3377
|
}, 200);
|
|
@@ -3285,16 +3399,16 @@ var lib_locale_ = __webpack_require__(3);
|
|
|
3285
3399
|
}
|
|
3286
3400
|
},
|
|
3287
3401
|
inputInput: function inputInput(e) {
|
|
3288
|
-
var
|
|
3402
|
+
var _this19 = this;
|
|
3289
3403
|
|
|
3290
3404
|
if (e && e.keyCode === 13) {
|
|
3291
3405
|
this.$emit('inputEnter');
|
|
3292
3406
|
}
|
|
3293
3407
|
this.$nextTick(function () {
|
|
3294
|
-
if (
|
|
3295
|
-
|
|
3408
|
+
if (_this19.value === '') {
|
|
3409
|
+
_this19.openLayer();
|
|
3296
3410
|
} else {
|
|
3297
|
-
|
|
3411
|
+
_this19.closeLayer();
|
|
3298
3412
|
}
|
|
3299
3413
|
});
|
|
3300
3414
|
},
|
|
@@ -3309,15 +3423,15 @@ var lib_locale_ = __webpack_require__(3);
|
|
|
3309
3423
|
this.openLayer();
|
|
3310
3424
|
},
|
|
3311
3425
|
filterInput: function filterInput(e) {
|
|
3312
|
-
var
|
|
3426
|
+
var _this20 = this;
|
|
3313
3427
|
|
|
3314
3428
|
if (e && e.keyCode === 13) {
|
|
3315
3429
|
this.$emit('inputEnter');
|
|
3316
3430
|
}
|
|
3317
3431
|
this.$nextTick(function () {
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3432
|
+
_this20.inputing = true;
|
|
3433
|
+
_this20.adjustLayer();
|
|
3434
|
+
_this20.openLayer();
|
|
3321
3435
|
});
|
|
3322
3436
|
},
|
|
3323
3437
|
filterClear: function filterClear() {
|
|
@@ -3336,10 +3450,10 @@ var lib_locale_ = __webpack_require__(3);
|
|
|
3336
3450
|
}
|
|
3337
3451
|
},
|
|
3338
3452
|
multipleItemChange: function multipleItemChange(value, item) {
|
|
3339
|
-
var
|
|
3453
|
+
var _this21 = this;
|
|
3340
3454
|
|
|
3341
3455
|
var val = this.selected.map(function (option) {
|
|
3342
|
-
return option[
|
|
3456
|
+
return option[_this21.iValueText];
|
|
3343
3457
|
});
|
|
3344
3458
|
if (value) {
|
|
3345
3459
|
val.push(item[this.iValueText]);
|
|
@@ -3351,11 +3465,11 @@ var lib_locale_ = __webpack_require__(3);
|
|
|
3351
3465
|
if (this.inputable && !this.filterable) {
|
|
3352
3466
|
if (this.$phone) {
|
|
3353
3467
|
setTimeout(function () {
|
|
3354
|
-
|
|
3468
|
+
_this21.$refs.popupInput.focus();
|
|
3355
3469
|
}, 500);
|
|
3356
3470
|
} else {
|
|
3357
3471
|
setTimeout(function () {
|
|
3358
|
-
|
|
3472
|
+
_this21.$refs.input.focus();
|
|
3359
3473
|
}, 500);
|
|
3360
3474
|
}
|
|
3361
3475
|
this.multipleInputValue = '';
|
|
@@ -3363,27 +3477,27 @@ var lib_locale_ = __webpack_require__(3);
|
|
|
3363
3477
|
if (this.filterable) {
|
|
3364
3478
|
if (this.$phone) {
|
|
3365
3479
|
setTimeout(function () {
|
|
3366
|
-
|
|
3480
|
+
_this21.$refs.popupFilter.focus();
|
|
3367
3481
|
}, 500);
|
|
3368
3482
|
} else {
|
|
3369
3483
|
setTimeout(function () {
|
|
3370
|
-
|
|
3484
|
+
_this21.$refs.filter.focus();
|
|
3371
3485
|
}, 500);
|
|
3372
3486
|
}
|
|
3373
3487
|
this.multipleFilterValue = '';
|
|
3374
3488
|
}
|
|
3375
3489
|
if (this.setDataFn) {
|
|
3376
3490
|
setTimeout(function () {
|
|
3377
|
-
|
|
3491
|
+
_this21.$refs.filter.focus();
|
|
3378
3492
|
}, 500);
|
|
3379
3493
|
this.setDataInputValue = '';
|
|
3380
3494
|
}
|
|
3381
3495
|
},
|
|
3382
3496
|
removeTag: function removeTag(item) {
|
|
3383
|
-
var
|
|
3497
|
+
var _this22 = this;
|
|
3384
3498
|
|
|
3385
3499
|
var val = this.selected.map(function (option) {
|
|
3386
|
-
return option[
|
|
3500
|
+
return option[_this22.iValueText];
|
|
3387
3501
|
});
|
|
3388
3502
|
this.removeItem(val, item[this.iValueText]);
|
|
3389
3503
|
this.setSeleted(val.join(','));
|
|
@@ -3392,24 +3506,24 @@ var lib_locale_ = __webpack_require__(3);
|
|
|
3392
3506
|
if (this.filterable) {
|
|
3393
3507
|
if (this.$refs.popupFilter) {
|
|
3394
3508
|
setTimeout(function () {
|
|
3395
|
-
|
|
3509
|
+
_this22.$refs.popupFilter.focus();
|
|
3396
3510
|
}, 500);
|
|
3397
3511
|
}
|
|
3398
3512
|
} else {
|
|
3399
3513
|
if (this.$refs.popupInput) {
|
|
3400
3514
|
setTimeout(function () {
|
|
3401
|
-
|
|
3515
|
+
_this22.$refs.popupInput.focus();
|
|
3402
3516
|
}, 500);
|
|
3403
3517
|
}
|
|
3404
3518
|
}
|
|
3405
3519
|
} else {
|
|
3406
3520
|
if (this.filterable) {
|
|
3407
3521
|
setTimeout(function () {
|
|
3408
|
-
|
|
3522
|
+
_this22.$refs.filter.focus();
|
|
3409
3523
|
}, 500);
|
|
3410
3524
|
} else {
|
|
3411
3525
|
setTimeout(function () {
|
|
3412
|
-
|
|
3526
|
+
_this22.$refs.input.focus();
|
|
3413
3527
|
}, 500);
|
|
3414
3528
|
}
|
|
3415
3529
|
}
|
|
@@ -3428,7 +3542,7 @@ var lib_locale_ = __webpack_require__(3);
|
|
|
3428
3542
|
}
|
|
3429
3543
|
},
|
|
3430
3544
|
removeItem: function removeItem(obj, val) {
|
|
3431
|
-
var
|
|
3545
|
+
var _this23 = this;
|
|
3432
3546
|
|
|
3433
3547
|
var index = void 0;
|
|
3434
3548
|
|
|
@@ -3452,7 +3566,7 @@ var lib_locale_ = __webpack_require__(3);
|
|
|
3452
3566
|
// 对象数组
|
|
3453
3567
|
else {
|
|
3454
3568
|
index = obj.findIndex(function (item) {
|
|
3455
|
-
return item[
|
|
3569
|
+
return item[_this23.iValueText] === val;
|
|
3456
3570
|
});
|
|
3457
3571
|
obj.splice(index, 1);
|
|
3458
3572
|
}
|