eoss-mobiles 0.2.24 → 0.2.26

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.
@@ -1,38 +1,43 @@
1
1
  <template>
2
- <div class="em-grid">
3
- <van-grid v-bind="$attrs" v-on="$listeners" :column-num="columnNum">
4
- <van-grid-item
5
- v-bind="item"
6
- :class="{'em-grid-ellipsis':textEllipsis}"
7
- :style="`width:${100 / columnNum}%;`"
8
- @click="goView($event,item)"
9
- v-show="$attrs.data && $attrs.data.length > 0"
10
- v-for="(item, index) of $attrs.data"
11
- :key="index"
12
- />
13
- <slot v-show="$attrs.data && $attrs.data.length == 0" />
14
- </van-grid>
2
+ <div class="em-grid">
3
+ <van-grid v-bind="$attrs" v-on="$listeners" :column-num="columnNum">
4
+ <van-grid-item
5
+ v-bind="item"
6
+ :class="{ 'em-grid-ellipsis': textEllipsis }"
7
+ :style="`width:${100 / columnNum}%;`"
8
+ @click="goView($event, item)"
9
+ v-show="$attrs.data && $attrs.data.length > 0"
10
+ v-for="(item, index) of $attrs.data"
11
+ :key="index"
12
+ />
13
+ <slot v-show="$attrs.data && $attrs.data.length == 0" />
14
+ </van-grid>
15
15
  </div>
16
16
  </template>
17
17
 
18
18
  <script>
19
19
  export default {
20
20
  name: 'EmGrid',
21
- inheritAttrs:false,
22
- props:{
23
- columnNum:{
24
- type:[Number,String],
25
- default:4
26
- },
27
- textEllipsis:{
28
- type:Boolean,
29
- default:false
30
- }
21
+ inheritAttrs: false,
22
+ props: {
23
+ columnNum: {
24
+ type: [Number, String],
25
+ default: 4
31
26
  },
32
- methods:{
33
- goView(event,val){
34
- this.$emit('click',{event,info:val})
27
+ textEllipsis: {
28
+ type: Boolean,
29
+ default: false
35
30
  },
31
+ targetStop: {
32
+ type: Boolean,
33
+ default: true
34
+ }
35
+ },
36
+ methods: {
37
+ goView(event, val) {
38
+ this.$emit('click', val);
39
+ this.targetStop && event.stopPropagation();
40
+ }
36
41
  }
37
42
  };
38
43
  </script>
@@ -13,6 +13,7 @@
13
13
  v-bind="$attrs"
14
14
  v-on="$listeners"
15
15
  :showTree="showTree"
16
+ :showMore="$listeners['left-icon'] == undefined"
16
17
  :isTreeIcon="$scopedSlots['tree-icon'] != undefined"
17
18
  :selectList="selectList"
18
19
  @dispose="handleDispose"
@@ -28,7 +29,8 @@
28
29
  v-bind="$attrs"
29
30
  v-on="$listeners"
30
31
  :showTree="showTree"
31
- :isTreeIcon="$scopedSlots['tree-icon'] != undefined"
32
+ :showMore="$listeners['left-icon'] == undefined"
33
+ :isTreeIcon=" $scopedSlots['tree-icon'] != undefined"
32
34
  :selectList.sync="selectList"
33
35
  @dispose="handleDispose"
34
36
  @close="handleDispose()"
@@ -82,6 +84,7 @@ export default {
82
84
  },
83
85
  mounted() {
84
86
  // this.selectList = this.value
87
+ // console.log(this)
85
88
  },
86
89
  methods: {
87
90
  handleSelector() {
@@ -35,6 +35,7 @@
35
35
  <div class="em-tree-box">
36
36
  <em-tree
37
37
  v-if="personnel && personnel.length > 0"
38
+ ref="emTree"
38
39
  :model="personnel"
39
40
  :value-key="valueKey"
40
41
  :label-key="labelKey"
@@ -45,7 +46,9 @@
45
46
  :nodeKey="nodeKey"
46
47
  v-on="$listeners"
47
48
  @popen="open"
49
+ :isAllCheck="isAllCheck"
48
50
  :isTreeIcon="isTreeIcon"
51
+ :showMore="showMore"
49
52
  @checke="checked"
50
53
  :showTree="showTree"
51
54
  :oldIsSearch="oldIsSearch"
@@ -68,7 +71,7 @@
68
71
  <!-- r[labelKey].length > 6
69
72
  ? r[labelKey].slice(0, 6) + '...'
70
73
  : r[labelKey] -->
71
- <div class="name" v-if="r[labelKey] || r['showname']">
74
+ <div class="name" v-if="r[labelKey] || r['showname']">
72
75
  {{ r[labelKey] || r['showname'] }}
73
76
  </div>
74
77
  <div class="delte" @click="delteList(i)">
@@ -109,6 +112,10 @@ export default {
109
112
  type: [Array, String], //传入选中数组
110
113
  default: () => []
111
114
  },
115
+ isAllCheck: {
116
+ type: Boolean,
117
+ default: false
118
+ },
112
119
  // pid: {
113
120
  // type: String, // 父id或者是空
114
121
  // default: 'root'
@@ -180,6 +187,10 @@ export default {
180
187
  type: Boolean,
181
188
  default: true
182
189
  },
190
+ showMore: {
191
+ type: Boolean,
192
+ default: true
193
+ },
183
194
  isTreeIcon: {
184
195
  type: Boolean,
185
196
  default: false
@@ -208,6 +219,10 @@ export default {
208
219
  type: [String, Number],
209
220
  default: 0
210
221
  },
222
+ isDefaultNode: {
223
+ type: Boolean,
224
+ default: true
225
+ },
211
226
  nodeList: Array,
212
227
  baseUrl: String
213
228
  },
@@ -224,6 +239,7 @@ export default {
224
239
  newParam: {},
225
240
  oldIsSearch: false,
226
241
  selectIndex: 0,
242
+ checkObj: {},
227
243
  first: true
228
244
  };
229
245
  },
@@ -529,13 +545,13 @@ export default {
529
545
  typeof this.selectList != 'string' &&
530
546
  (this.list = $.deepClone(this.selectList));
531
547
 
532
- this.$nextTick(() => {
533
- if (this.nodeList) {
534
- this.getNodeList();
535
- } else {
536
- this.getContent();
537
- }
538
- });
548
+ // this.$nextTick(() => {
549
+ // if (this.nodeList) {
550
+ // this.getNodeList();
551
+ // } else {
552
+ // this.getContent();
553
+ // }
554
+ // });
539
555
  },
540
556
  methods: {
541
557
  handleClick(index) {
@@ -660,8 +676,8 @@ export default {
660
676
  ].param.selecttype;
661
677
  if (this.newParam.selecttype === 'persongroup') {
662
678
  this.newParam.pid = 'root';
663
- }else{
664
- this.newParam.pid = this.param.pid || 'root'
679
+ } else {
680
+ this.newParam.pid = this.param.pid || 'root';
665
681
  }
666
682
  request({
667
683
  url: this.url
@@ -733,6 +749,19 @@ export default {
733
749
  params: params
734
750
  }).then(res => {
735
751
  if (res.rCode == 0) {
752
+ if (
753
+ res.results.length > 0 &&
754
+ res.results[0].nocheck == false &&
755
+ this.isAllCheck
756
+ ) {
757
+ res.results.unshift({
758
+ showshortname: '全选',
759
+ checked: false,
760
+ isAllCheck: true,
761
+ id: $.generateUUID(),
762
+ parentshowid: res.results[0].parentshowid
763
+ });
764
+ }
736
765
  this.$set(obj, 'children', res.results);
737
766
  let _this = this;
738
767
  this.selectList.filter(r => {
@@ -742,13 +771,26 @@ export default {
742
771
  }
743
772
  });
744
773
  });
774
+ if (this.isAllCheck) {
775
+ let checkList = obj.children
776
+ .slice(1, obj.children.length)
777
+ .filter(x => x.checked);
778
+ if (
779
+ checkList.length ===
780
+ obj.children.slice(1, obj.children.length).length
781
+ ) {
782
+ _this.$set(obj.children[0], 'checked', true);
783
+ }
784
+ }
745
785
  }
746
786
  this.$toast.clear();
747
787
  });
748
788
  },
749
789
  getChiled(res, isStart, key) {
750
790
  const _that = this;
751
- let data = _that.$listeners[key](res.obj, !!res.obj.children);
791
+ let data = _that.$listeners[key]
792
+ ? _that.$listeners[key](res.obj, !!res.obj.children)
793
+ : undefined;
752
794
  if (!isStart) {
753
795
  if (res.obj.open) {
754
796
  this.$set(res.obj, 'open', false);
@@ -822,14 +864,20 @@ export default {
822
864
  const _that = this;
823
865
  _that.oldIsSearch = _that.isSearch;
824
866
  // debugger
825
- if (this.$listeners['node-click'] && this.$listeners['left-icon']) {
867
+ if (
868
+ this.$listeners['node-click'] &&
869
+ (this.$listeners['left-icon'] || (this.showMore && !this.isDefaultNode))
870
+ ) {
826
871
  if (this.$listeners['left-icon'] && !isNode) {
827
872
  this.getChiled(res, isStart, 'left-icon');
873
+ } else if (this.showMore && !isNode) {
874
+ this.getChiled(res, isStart, 'right-icon');
828
875
  }
829
876
  isNode && _that.$listeners['node-click'](res.obj, !!res.obj.children);
830
877
  } else if (
831
878
  this.$listeners['node-click'] ||
832
- this.$listeners['left-icon']
879
+ this.$listeners['left-icon'] ||
880
+ (this.showMore && !this.isDefaultNode)
833
881
  ) {
834
882
  isNode &&
835
883
  this.$listeners['node-click'] &&
@@ -837,6 +885,10 @@ export default {
837
885
  this.$listeners['left-icon'] &&
838
886
  !isNode &&
839
887
  this.getChiled(res, isStart, 'left-icon');
888
+ this.showMore &&
889
+ !this.isDefaultNode &&
890
+ !isNode &&
891
+ this.getChiled(res, isStart, 'right-icon');
840
892
  } else {
841
893
  if (!isStart) {
842
894
  if (res.obj.open) {
@@ -850,23 +902,53 @@ export default {
850
902
  }
851
903
  }
852
904
  },
853
- checked(res) {
905
+ checked(res, model) {
854
906
  this.oldIsSearch = this.isSearch;
855
907
  if (res.obj.checked) {
856
- for (let i in this.list) {
857
- if (this.list[i][this.valueKey] == res.obj[this.valueKey]) {
858
- this.list.splice(i, 1);
908
+ if (res.obj.isAllCheck) {
909
+ model.map(x => {
910
+ for (let i in this.list) {
911
+ if (this.list[i][this.valueKey] == x[this.valueKey]) {
912
+ this.list.splice(i, 1);
913
+ }
914
+ }
915
+ this.$set(x, 'checked', false);
916
+ });
917
+ } else {
918
+ for (let i in this.list) {
919
+ if (this.list[i][this.valueKey] == res.obj[this.valueKey]) {
920
+ this.list.splice(i, 1);
921
+ }
859
922
  }
923
+ this.$set(res.obj, 'checked', false);
860
924
  }
861
-
862
- this.$set(res.obj, 'checked', false);
863
925
  } else {
864
926
  if (!this.multiple && this.list.length >= 1) {
865
927
  this.$toast(this.promptText);
866
928
  return;
867
929
  }
868
- this.$set(res.obj, 'checked', true);
869
- this.list.unshift(res.obj);
930
+ if (res.obj.isAllCheck) {
931
+ model.map(x => {
932
+ this.$set(x, 'checked', true);
933
+ });
934
+ this.list.unshift(...model.slice(1, model.length));
935
+ } else {
936
+ this.$set(res.obj, 'checked', true);
937
+ this.list.unshift(res.obj);
938
+ }
939
+ }
940
+ if (this.isAllCheck) {
941
+ let checkList = model.slice(1, model.length).filter(x => x.checked);
942
+ var obj = {};
943
+ this.list = this.list.reduce((item, next) => {
944
+ obj[next.showid] ? '' : (obj[next.showid] = true && item.push(next));
945
+ return item;
946
+ }, []);
947
+ if (this.isAllCheck && model.length - 1 === checkList.length) {
948
+ this.$set(model[0], 'checked', true);
949
+ } else if (this.isAllCheck) {
950
+ this.$set(model[0], 'checked', false);
951
+ }
870
952
  }
871
953
  },
872
954
  dispose() {
@@ -20,12 +20,15 @@
20
20
  ? item[labelKey].slice(0, 12) + '...'
21
21
  : item[labelKey] -->
22
22
  </div>
23
- <div v-if="isTreeIcon" v-tap="{ methods: handleClickIcon, obj: item }" >
24
- <slot name="tree-icon" :value="item"></slot>
23
+ <div
24
+ v-if="isTreeIcon"
25
+ v-tap="{ methods: handleClickIcon, obj: item }"
26
+ >
27
+ <slot name="tree-icon" :value="item"></slot>
25
28
  </div>
26
29
  {{ item[labelKey] }}
27
30
  </div>
28
- <van-icon name="arrow" class="right" v-if="!isTreeIcon" />
31
+ <van-icon name="arrow" v-tap="{ methods: handleClickIcon, obj: item }" class="right" v-if="showMore" />
29
32
  <i
30
33
  class="iconfont icon-gou select-icon"
31
34
  v-show="
@@ -58,9 +61,11 @@
58
61
  :nodeKey="nodeKey"
59
62
  :oldIsSearch="oldIsSearch"
60
63
  :isSearch="isSearch"
64
+ :isAllCheck="isAllCheck"
61
65
  :label-key="labelKey"
62
66
  :value-key="valueKey"
63
67
  :showTree="showTree"
68
+ :showMore="showMore"
64
69
  :enterprise="enterprise"
65
70
  :isTreeIcon="isTreeIcon"
66
71
  :department="department"
@@ -202,6 +207,14 @@ export default {
202
207
  type: String,
203
208
  default: 'showshortname'
204
209
  },
210
+ isAllCheck:{
211
+ type:Boolean,
212
+ default:false
213
+ },
214
+ showMore:{
215
+ type:Boolean,
216
+ default:true
217
+ },
205
218
  oldIsSearch: Boolean,
206
219
  isSearch: Boolean
207
220
  },
@@ -232,14 +245,16 @@ export default {
232
245
  },
233
246
  methods: {
234
247
  handleClickIcon(res, isStart){
235
- if(!this.$listeners['left-icon']) return
248
+ if(!this.$listeners['left-icon'] && !this.showMore) return
236
249
  this.$emit('popen', res, res.isStart || isStart);
237
250
  },
238
251
  opened(res, isStart) {
239
252
  this.$emit('popen', res, res.isStart || isStart,true);
240
253
  },
241
254
  checke(res) {
242
- this.$emit('checke', res);
255
+ let model = undefined
256
+ if(this.isAllCheck) model = this.model
257
+ this.$emit('checke', res,model);
243
258
  },
244
259
  isShowNode(id) {
245
260
  let isShow = true;
package/src/index.js CHANGED
@@ -101,7 +101,7 @@ if (typeof window !== 'undefined' && window.Vue) {
101
101
  }
102
102
 
103
103
  export default {
104
- version: '0.2.24',
104
+ version: '0.2.26',
105
105
  install,
106
106
  Button,
107
107
  ButtonGroup,
package/src/utils/http.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import base from './axios';
2
2
  const request = options => {
3
- console.log(options, 'options');
4
3
  let fn;
5
4
  switch (options.type) {
6
5
  case 'post':