eoss-mobiles 0.2.2 → 0.2.3

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.
Files changed (54) hide show
  1. package/CHANGELOG.md +4 -1
  2. package/lib/action-sheet.js +2 -2
  3. package/lib/button-group.js +2 -2
  4. package/lib/button.js +2 -2
  5. package/lib/calendar.js +2 -2
  6. package/lib/cascader.js +2 -2
  7. package/lib/cell.js +2 -2
  8. package/lib/checkbox.js +108 -108
  9. package/lib/circle.js +2 -2
  10. package/lib/count-down.js +2 -2
  11. package/lib/date.js +2 -2
  12. package/lib/empty.js +2 -2
  13. package/lib/eoss-mobile.common.js +507 -151
  14. package/lib/esign.js +522 -0
  15. package/lib/field.js +2 -2
  16. package/lib/flow.js +108 -108
  17. package/lib/form.js +2 -2
  18. package/lib/grid-item.js +2 -2
  19. package/lib/grid.js +2 -2
  20. package/lib/image-preview.js +2 -2
  21. package/lib/image.js +2 -2
  22. package/lib/index.js +1 -1
  23. package/lib/list.js +2 -2
  24. package/lib/loading.js +2 -2
  25. package/lib/nav-bar.js +2 -2
  26. package/lib/pagination.js +4 -4
  27. package/lib/picker.js +107 -107
  28. package/lib/popover.js +2 -2
  29. package/lib/popup.js +2 -2
  30. package/lib/radio.js +107 -107
  31. package/lib/rate.js +2 -2
  32. package/lib/search.js +2 -2
  33. package/lib/selector.js +297 -257
  34. package/lib/skeleton.js +2 -2
  35. package/lib/stepper.js +2 -2
  36. package/lib/switch.js +2 -2
  37. package/lib/tab.js +2 -2
  38. package/lib/table-column.js +106 -106
  39. package/lib/table.js +110 -110
  40. package/lib/tabs.js +2 -2
  41. package/lib/tag.js +2 -2
  42. package/lib/theme-chalk/esign.css +1 -0
  43. package/lib/theme-chalk/index.css +1 -1
  44. package/lib/uploader.js +2 -2
  45. package/package.json +3 -2
  46. package/packages/esign/index.js +5 -0
  47. package/packages/esign/src/main.vue +144 -0
  48. package/packages/selector/src/selector-tree.vue +91 -75
  49. package/packages/selector/src/tree.vue +9 -4
  50. package/packages/theme-chalk/lib/esign.css +1 -0
  51. package/packages/theme-chalk/lib/index.css +1 -1
  52. package/packages/theme-chalk/src/esign.scss +52 -0
  53. package/packages/theme-chalk/src/index.scss +1 -0
  54. package/src/index.js +4 -1
@@ -0,0 +1,144 @@
1
+ <template>
2
+ <div class="em-esign">
3
+ <div v-if="!$scopedSlots.default && !$slots.default">
4
+ <div
5
+ class="signature-box box-flex box-justify-center"
6
+ :style="{
7
+ height:
8
+ typeof height === 'number'
9
+ ? height
10
+ : height.replace('px', '') + 'px'
11
+ }"
12
+ v-tap="{ methods: esignShow }"
13
+ >
14
+ <img :src="files" />
15
+ </div>
16
+ <div class="opinion-box">
17
+ <span v-tap="{ methods: esignShow }">打开手写签字</span>
18
+ </div>
19
+ </div>
20
+ <slot v-else name="default" :click="esignShow" />
21
+ <van-popup
22
+ v-model="showEsign"
23
+ closeable
24
+ class="esign-skin"
25
+ :style="{
26
+ width:
27
+ typeof esignWidth === 'number'
28
+ ? esignWidth
29
+ : esignWidth.replace('px', '') +
30
+ (esignWidth.indexOf('%') == -1 && 'px')
31
+ }"
32
+ >
33
+ <div class="esign-box">
34
+ <vue-esign
35
+ ref="esign"
36
+ :isCrop="false"
37
+ :height="esignHeight"
38
+ :lineWidth="lineWidth"
39
+ :lineColor="lineColor"
40
+ />
41
+ <div class="esign-btn-box">
42
+ <em-button
43
+ type="warning"
44
+ size="small"
45
+ v-tap="{ methods: handleReset }"
46
+ >清除</em-button
47
+ >
48
+ <em-button
49
+ type="primary"
50
+ size="small"
51
+ v-tap="{ methods: handleGenerate }"
52
+ >保存</em-button
53
+ >
54
+ </div>
55
+ </div>
56
+ </van-popup>
57
+ </div>
58
+ </template>
59
+
60
+ <script>
61
+ export default {
62
+ name: 'EmEsign',
63
+ data() {
64
+ return {
65
+ showEsign: false,
66
+ resultImg: '',
67
+ files: '',
68
+ file: ''
69
+ };
70
+ },
71
+ props: {
72
+ filePath: {
73
+ type: String,
74
+ default: ''
75
+ },
76
+ height: {
77
+ type: [String, Number],
78
+ default: 80
79
+ },
80
+ esignWidth: {
81
+ type: Number,
82
+ default: 1
83
+ },
84
+ esignColor: {
85
+ type: String,
86
+ default: '#000'
87
+ },
88
+ esignHeight: {
89
+ type: [String, Number],
90
+ default: 550
91
+ },
92
+ esignWidth: {
93
+ type: [String, Number],
94
+ default: '330'
95
+ }
96
+ },
97
+ watch: {
98
+ filePath: {
99
+ handler(val) {
100
+ this.files = val;
101
+ },
102
+ immediate: true,
103
+ deep: true
104
+ }
105
+ },
106
+ methods: {
107
+ esignShow() {
108
+ this.showEsign = !this.showEsign;
109
+ },
110
+ handleReset() {
111
+ this.$refs.esign.reset();
112
+ this.$emit('reset');
113
+ },
114
+ handleGenerate() {
115
+ this.$refs.esign
116
+ .generate()
117
+ .then(res => {
118
+ this.resultImg = res;
119
+ this.files = res;
120
+ this.file = this.base64ImgtoFile(res);
121
+ this.showEsign = false;
122
+ this.$emit('save', { file: this.file, data: res });
123
+ })
124
+ .catch(err => {
125
+ this.$toast('请输入');
126
+ });
127
+ },
128
+ base64ImgtoFile(base64data, filename = 'file') {
129
+ let arr = base64data.split(',');
130
+ let mime = arr[0].match(/:(.*?);/)[1];
131
+ let suffix = mime.split('/')[1];
132
+ let bstr = atob(arr[1]);
133
+ let n = bstr.length;
134
+ let u8arr = new Uint8Array(n);
135
+ while (n--) {
136
+ u8arr[n] = bstr.charCodeAt(n);
137
+ }
138
+ return new File([u8arr], `${filename}.${suffix}`, {
139
+ type: mime
140
+ });
141
+ }
142
+ }
143
+ };
144
+ </script>
@@ -42,6 +42,7 @@
42
42
  :departmentLabelKey="departmentLabelKey"
43
43
  :departmentValueKey="departmentValueKey"
44
44
  :nodeKey="nodeKey"
45
+ v-on="$listeners"
45
46
  @popen="open"
46
47
  :isTreeIcon="isTreeIcon"
47
48
  @checke="checked"
@@ -51,7 +52,11 @@
51
52
  :isOtherUnit="isOtherUnit"
52
53
  :filid="filid"
53
54
  >
54
- <template slot="tree-icon" v-if="$scopedSlots['tree-icon']" slot-scope="{ value }">
55
+ <template
56
+ slot="tree-icon"
57
+ v-if="$scopedSlots['tree-icon']"
58
+ slot-scope="{ value }"
59
+ >
55
60
  <slot name="tree-icon" :value="value"></slot>
56
61
  </template>
57
62
  </em-tree>
@@ -107,9 +112,9 @@ export default {
107
112
  // type: String, // 父id或者是空
108
113
  // default: 'root'
109
114
  // },
110
- url:{
115
+ url: {
111
116
  type: String,
112
- default:''
117
+ default: ''
113
118
  },
114
119
  param: {
115
120
  type: Object,
@@ -629,7 +634,11 @@ export default {
629
634
  this.selectIndex
630
635
  ].param.selecttype;
631
636
  request({
632
- url:this.url? this.url : this.baseUrl ? this.baseUrl + selectObject : selectObject,
637
+ url: this.url
638
+ ? this.url
639
+ : this.baseUrl
640
+ ? this.baseUrl + selectObject
641
+ : selectObject,
633
642
  params: {
634
643
  objType: this.objType,
635
644
  namelike: this.namelike,
@@ -654,7 +663,6 @@ export default {
654
663
  } else {
655
664
  this.$toast(msg);
656
665
  }
657
-
658
666
  });
659
667
  },
660
668
  getData(obj) {
@@ -689,87 +697,95 @@ export default {
689
697
  this.$toast.clear();
690
698
  });
691
699
  },
692
- open(res, isStart) {
700
+ getChiled(res, isStart, key) {
693
701
  const _that = this;
694
- _that.oldIsSearch = _that.isSearch;
695
- if (this.$listeners['node-click']) {
696
- let data = _that.$listeners['node-click'](res.obj,!!res.obj.children);
697
- if (!isStart) {
698
- if (res.obj.open) {
699
- this.$set(res.obj, 'open', false);
700
- } else {
701
- this.$set(res.obj, 'open', true);
702
- }
702
+ console.log(key,'key')
703
+ let data = (_that.$listeners[key])(res.obj, !!res.obj.children);
704
+ if (!isStart) {
705
+ if (res.obj.open) {
706
+ this.$set(res.obj, 'open', false);
707
+ } else {
708
+ this.$set(res.obj, 'open', true);
703
709
  }
704
- let newData = res.obj;
705
- if (!newData.children && !isStart) {
706
- if (this.nodeList && this.nodeList.length > 0) {
707
- this.$toast.loading({
708
- message: '加载中...',
709
- forbidClick: true,
710
- loadingType: 'spinner',
711
- overlay: true,
712
- duration: 0
713
- });
714
- // let data = _that.$listeners['node-click'](res.obj);
715
- // if (!isStart) {
716
- // if (res.obj.open) {
717
- // this.$set(res.obj, 'open', false);
718
- // } else {
719
- // this.$set(res.obj, 'open', true);
720
- // }
721
- // }
722
- if (!Array.isArray(data)) {
723
- data
724
- .then(res => {
725
- res.map(x => {
726
- !x[_that.nodeKey] && _that.$set(x, 'nocheck', false);
727
- });
728
- _that.$set(newData, 'children', res);
729
- if (_that.selectList && _that.selectList.length > 0) {
730
- _that.selectList.filter(r => {
731
- newData.children.find(i => {
732
- if (i[_that.valueKey] === r[_that.valueKey]) {
733
- _that.$set(i, 'checked', true);
734
- }
735
- });
736
- });
737
- } else {
710
+ }
711
+ let newData = res.obj;
712
+ if (!newData.children && !isStart) {
713
+ if (this.nodeList && this.nodeList.length > 0) {
714
+ this.$toast.loading({
715
+ message: '加载中...',
716
+ forbidClick: true,
717
+ loadingType: 'spinner',
718
+ overlay: true,
719
+ duration: 0
720
+ });
721
+ if (!Array.isArray(data)) {
722
+ data
723
+ .then(res => {
724
+ res.map(x => {
725
+ !x[_that.nodeKey] && _that.$set(x, 'nocheck', false);
726
+ });
727
+ _that.$set(newData, 'children', res);
728
+ if (_that.selectList && _that.selectList.length > 0) {
729
+ _that.selectList.filter(r => {
738
730
  newData.children.find(i => {
739
- _that.$set(i, 'checked', false);
731
+ if (i[_that.valueKey] === r[_that.valueKey]) {
732
+ _that.$set(i, 'checked', true);
733
+ }
740
734
  });
741
- }
742
- this.$toast.clear();
743
- })
744
- .catch(err => {
745
- this.$toast('数据返回错误');
746
- });
747
- } else {
748
- data.map(x => {
749
- !x[_that.nodeKey] && _that.$set(x, 'nocheck', false);
750
- });
751
- _that.$set(newData, 'children', data);
752
- if (_that.selectList && _that.selectList.length > 0) {
753
- _that.selectList.filter(r => {
735
+ });
736
+ } else {
754
737
  newData.children.find(i => {
755
- if (i[_that.valueKey] === r[_that.valueKey]) {
756
- _that.$set(i, 'checked', true);
757
- }
738
+ _that.$set(i, 'checked', false);
758
739
  });
759
- });
760
- } else {
740
+ }
741
+ this.$toast.clear();
742
+ })
743
+ .catch(err => {
744
+ this.$toast('数据返回错误');
745
+ });
746
+ } else {
747
+ data.map(x => {
748
+ !x[_that.nodeKey] && _that.$set(x, 'nocheck', false);
749
+ });
750
+ _that.$set(newData, 'children', data);
751
+ if (_that.selectList && _that.selectList.length > 0) {
752
+ _that.selectList.filter(r => {
761
753
  newData.children.find(i => {
762
- _that.$set(i, 'checked', false);
754
+ if (i[_that.valueKey] === r[_that.valueKey]) {
755
+ _that.$set(i, 'checked', true);
756
+ }
763
757
  });
764
- }
765
- this.$toast.clear();
766
- }
767
- } else {
768
- if (!res.obj.children) {
769
- this.getData(res.obj);
758
+ });
759
+ } else {
760
+ newData.children.find(i => {
761
+ _that.$set(i, 'checked', false);
762
+ });
770
763
  }
764
+ this.$toast.clear();
771
765
  }
766
+ } else {
767
+ if (!res.obj.children) {
768
+ this.getData(res.obj);
769
+ }
770
+ }
771
+ }
772
+ },
773
+ open(res, isStart, isNode) {
774
+ const _that = this;
775
+ _that.oldIsSearch = _that.isSearch;
776
+ // debugger
777
+ if (this.$listeners['node-click'] && this.$listeners['left-icon']) {
778
+ if (this.$listeners['left-icon'] && !isNode) {
779
+ this.getChiled(res, isStart, 'left-icon');
772
780
  }
781
+ isNode && _that.$listeners['node-click'](res.obj, !!res.obj.children);
782
+ } else if (
783
+ this.$listeners['node-click'] ||
784
+ this.$listeners['left-icon']
785
+ ) {
786
+ isNode &&this.$listeners['node-click'] && this.getChiled(res, isStart, 'node-click');
787
+ this.$listeners['left-icon']&& !isNode &&
788
+ this.getChiled(res, isStart, 'left-icon');
773
789
  } else {
774
790
  if (!isStart) {
775
791
  if (res.obj.open) {
@@ -20,7 +20,9 @@
20
20
  ? item[labelKey].slice(0, 12) + '...'
21
21
  : item[labelKey] -->
22
22
  </div>
23
- <slot name="tree-icon" :value="item"></slot>
23
+ <div v-if="isTreeIcon" v-tap="{ methods: handleClickIcon, obj: item }" >
24
+ <slot name="tree-icon" :value="item"></slot>
25
+ </div>
24
26
  {{ item[labelKey] }}
25
27
  </div>
26
28
  <van-icon name="arrow" class="right" v-if="!isTreeIcon" />
@@ -50,8 +52,7 @@
50
52
  <template v-if="item.children && item.children.length > 0">
51
53
  <em-tree
52
54
  :model="item.children"
53
- @popen="opened"
54
- @checke="checke"
55
+ v-on="$listeners"
55
56
  :isOtherUnit="isOtherUnit"
56
57
  :filid="filid"
57
58
  :nodeKey="nodeKey"
@@ -230,8 +231,12 @@ export default {
230
231
  });
231
232
  },
232
233
  methods: {
234
+ handleClickIcon(res, isStart){
235
+ if(!this.$listeners['left-icon']) return
236
+ this.$emit('popen', res, res.isStart || isStart);
237
+ },
233
238
  opened(res, isStart) {
234
- this.$emit('popen', res, res.isStart || isStart);
239
+ this.$emit('popen', res, res.isStart || isStart,true);
235
240
  },
236
241
  checke(res) {
237
242
  this.$emit('checke', res);
@@ -0,0 +1 @@
1
+ @charset "UTF-8";.em-esign .signature-box{margin-top:7px;height:80px;background-color:#f7f5f5;padding:5px;text-align:center}.em-esign .signature-box img{height:100%;background-color:#fff}.em-esign .opinion-box{height:32px;padding-top:10px;padding-bottom:5px;padding-right:10px;font-size:13px;color:#12278B;text-align:right}.em-esign .esign-skin{width:100%;border-radius:5px}.em-esign .esign-skin .van-popup__close-icon{top:8px;right:8px}.em-esign .esign-box .esign-title{height:40px;line-height:40px;border-bottom:1px solid #12278B;font-size:15px;padding:0 10px}.em-esign .esign-box .esign-btn-box{padding:10px;text-align:right}.em-esign .esign-box .esign-btn-box .van-button{padding:0 7px;border-radius:4px}