mali-applet-ui 1.0.145 → 1.0.146

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/config/store.js CHANGED
@@ -7,25 +7,25 @@ const globalStore = {
7
7
  // fileName: 'fileName' // 文件名
8
8
  // },
9
9
  // 获取附件缩略图方法
10
- getThumbnailFileUrl: null,
11
- // 获取附件路径方法
12
- getFileUrl: null,
13
- // 上传附件方法
14
- uploadFile: null,
15
- // 下载附件方法
16
- downloadFile: null,
17
- // 删除附件方法
18
- removeFile: null
10
+ // getThumbnailFileUrl: null,
11
+ // // 获取附件路径方法
12
+ // getFileUrl: null,
13
+ // // 上传附件方法
14
+ // uploadFile: null,
15
+ // // 下载附件方法
16
+ // downloadFile: null,
17
+ // // 删除附件方法
18
+ // removeFile: null
19
19
  },
20
20
  // 审批组件
21
21
  approval: {
22
22
  // 审批流程
23
23
  select: {
24
- optionMethod: null
24
+ // optionMethod: null
25
25
  },
26
26
  // 审批记录
27
27
  record: {
28
- optionMethod: null
28
+ // optionMethod: null
29
29
  },
30
30
  types: [
31
31
  { value: 0, label: '起草中', color: '#353535', background: '#eaebed' },
@@ -49,9 +49,9 @@ const globalStore = {
49
49
  total: 'total'
50
50
  },
51
51
  notData: {
52
- emptyUrl: '',
52
+ // emptyUrl: '',
53
53
  emptyText: '暂无记录',
54
- resultUrl: '',
54
+ // resultUrl: '',
55
55
  resultText: '暂无相关结果',
56
56
  resultHint: '请检查输入是否正确'
57
57
  }
@@ -68,7 +68,7 @@ const globalStore = {
68
68
  total: 'total'
69
69
  },
70
70
  notData: {
71
- emptyUrl: '',
71
+ // emptyUrl: '',
72
72
  emptyText: '暂无记录',
73
73
  resultUrl: '',
74
74
  resultText: '暂无相关结果',
@@ -76,8 +76,11 @@ const globalStore = {
76
76
  }
77
77
  },
78
78
  notData: {
79
- emptyUrl: '',
79
+ // emptyUrl: '',
80
80
  emptyText: '暂无记录'
81
+ },
82
+ listSelectUserPage: {
83
+ // defaultAvatarUrl: ''
81
84
  }
82
85
  }
83
86
 
@@ -166,6 +166,7 @@ export default {
166
166
  }
167
167
  .ml-input-inp {
168
168
  outline: 0;
169
+ border: 0;
169
170
  }
170
171
  .ml-input-inp,
171
172
  .ml-input-simulate {
@@ -2,6 +2,9 @@
2
2
  <view class="ml-list-select-user-page" :class="[className || '', {'is-border': border, 'is-disabled': disabled}]" @tap="tapEvent">
3
3
  <view v-if="selectRows.length" class="ml-list-select-user-list">
4
4
  <view v-for="(item, index) in selectRows" :key="index" class="ml-list-select-user-item">
5
+ <view class="ml-list-select-user-avatar">
6
+ <image class="ml-list-select-user-avatar-img" :src="item[optAvatarUrlField] || defaultAvatarUrl" mode="aspectFit"></image>
7
+ </view>
5
8
  <view class="ml-list-select-user-name">
6
9
  <view class="ml-list-select-user-content">{{ item[optLabelField] }}</view>
7
10
  </view>
@@ -22,6 +25,7 @@
22
25
  </template>
23
26
 
24
27
  <script>
28
+ import globalStore from '../../../config/store'
25
29
  import XEUtils from 'xe-utils'
26
30
 
27
31
  export default {
@@ -57,12 +61,18 @@ export default {
57
61
  optOptions () {
58
62
  return Object.assign({}, this.optionProps)
59
63
  },
64
+ optAvatarUrlField () {
65
+ return this.optOptions.avatar || 'faceImgUrl'
66
+ },
60
67
  optLabelField () {
61
68
  return this.optOptions.label || 'label'
62
69
  },
63
70
  optValueField () {
64
71
  return this.optOptions.value || 'value'
65
72
  },
73
+ defaultAvatarUrl () {
74
+ return globalStore.listSelectUserPage?.defaultAvatarUrl
75
+ },
66
76
  hasEmpty () {
67
77
  if (this.type === 'checkbox') {
68
78
  return !this.value || !this.value.length
@@ -70,10 +80,7 @@ export default {
70
80
  return XEUtils.eqNull(this.value) || this.value === ''
71
81
  },
72
82
  selectRows () {
73
- if (this.type === 'checkbox') {
74
- return this.dataList.filter(item => this.value.includes(item[this.optValueField]))
75
- }
76
- return this.dataList.filter(item => this.value === item[this.optValueField])
83
+ return this.getSelectRows(this.value)
77
84
  }
78
85
  },
79
86
  watch: {
@@ -92,6 +99,15 @@ export default {
92
99
  this.$emit('tap', {})
93
100
  this.$emit('click', {})
94
101
  },
102
+ getSelectRows (value) {
103
+ if (!this.dataList || !this.dataList.length) {
104
+ return []
105
+ }
106
+ if (this.type === 'checkbox') {
107
+ return this.dataList.filter(item => value.includes(item[this.optValueField]))
108
+ }
109
+ return this.dataList.filter(item => value === item[this.optValueField])
110
+ },
95
111
  openUserEvent () {
96
112
  if (this.disabled) {
97
113
  return
@@ -119,11 +135,24 @@ export default {
119
135
  },
120
136
  removeItem (item) {
121
137
  let value = null
138
+ const checkedKey = null
139
+ let checkedKeys = []
122
140
  if (this.type === 'checkbox') {
123
141
  value = this.value.filter(key => key !== item[this.optValueField])
142
+ checkedKeys = value
143
+ }
144
+ const selectRows = this.getSelectRows(value)
145
+ const label = selectRows.map(item => item[this.optLabelField]).join(',')
146
+ const params = {
147
+ value,
148
+ label,
149
+ selectRows,
150
+ checkedKey,
151
+ checkedKeys,
152
+ type: this.compType
124
153
  }
125
154
  this.$emit('input', value)
126
- this.$emit('change', { value })
155
+ this.$emit('change', params)
127
156
  },
128
157
  clearEvent () {
129
158
  let value = null
@@ -131,7 +160,14 @@ export default {
131
160
  value = []
132
161
  }
133
162
  this.$emit('input', value)
134
- this.$emit('clear', { value })
163
+ this.$emit('clear', {
164
+ value,
165
+ label: '',
166
+ checkedKey: null,
167
+ checkedKeys: [],
168
+ selectRows: [],
169
+ type: this.compType
170
+ })
135
171
  }
136
172
  }
137
173
  }
@@ -171,16 +207,23 @@ export default {
171
207
  color: $uni-text-color-disable;
172
208
  }
173
209
  }
174
- .ml-list-select-user-img {
175
- width: 50rpx;
176
- height: 50rpx;
177
- border-radius: 50%;
178
- overflow: hidden;
210
+ .ml-list-select-user-avatar {
211
+ display: flex;
212
+ flex-direction: row;
213
+ justify-content: center;
214
+ .ml-list-select-user-avatar-img {
215
+ width: 40rpx;
216
+ height: 40rpx;
217
+ border-radius: 50%;
218
+ overflow: hidden;
219
+ }
179
220
  }
180
221
  .ml-list-select-user-name {
222
+ margin-left: 8rpx;
181
223
  .ml-list-select-user-content {
182
224
  font-size: 28rpx;
183
- max-width: 140rpx;
225
+ max-width: 100rpx;
226
+ text-align: center;
184
227
  overflow: hidden;
185
228
  text-overflow: ellipsis;
186
229
  white-space: nowrap;
@@ -188,7 +231,7 @@ export default {
188
231
  }
189
232
  .ml-list-select-user-del-item {
190
233
  flex-shrink: 0;
191
- margin-left: 16rpx;
234
+ margin-left: 8rpx;
192
235
  }
193
236
  .ml-list-select-user-page-placeholder {
194
237
  color: $ml-input-color-placeholder;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mali-applet-ui",
3
- "version": "1.0.145",
3
+ "version": "1.0.146",
4
4
  "description": "码里云小程序组件库",
5
5
  "files": [
6
6
  "lib",
package/store/base.js CHANGED
@@ -31,7 +31,7 @@ const base = {
31
31
  success ({ eventChannel }) {
32
32
  if (opts && opts.compTitle) {
33
33
  uni.setNavigationBarTitle({
34
- title: opts.compTitle
34
+ title: opts.compTitle || '请选择'
35
35
  })
36
36
  }
37
37
  eventChannel.emit('init', compParams)