mali-applet-ui 1.0.145 → 1.0.147

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
 
@@ -236,6 +236,7 @@ export default {
236
236
  }
237
237
  .ml-amount-input-inp {
238
238
  outline: 0;
239
+ border: 0;
239
240
  }
240
241
  .ml-amount-input-inp,
241
242
  .ml-amount-input-simulate {
@@ -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,10 +2,13 @@
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>
8
- <view v-if="clearable" class="ml-list-select-user-del-item" @click="removeItem(item)">
11
+ <view v-if="clearable && !readonly" class="ml-list-select-user-del-item" @click="removeItem(item)">
9
12
  <ml-icon name="close" />
10
13
  </view>
11
14
  </view>
@@ -13,7 +16,7 @@
13
16
  <view v-else class="ml-list-select-user-list">
14
17
  <view class="ml-list-select-user-page-placeholder">{{ placeholder }}</view>
15
18
  </view>
16
- <view class="ml-list-select-user-add-item" @click="openUserEvent">
19
+ <view v-if="!readonly" class="ml-list-select-user-add-item" @click="openUserEvent">
17
20
  <view class="ml-list-select-user-add-btn">
18
21
  <ml-icon name="add-circle" />
19
22
  </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 {
@@ -44,6 +48,7 @@ export default {
44
48
  default: '请选择'
45
49
  },
46
50
  disabled: Boolean,
51
+ readonly: Boolean,
47
52
  border: Boolean,
48
53
  clearable: Boolean,
49
54
  className: String
@@ -57,12 +62,18 @@ export default {
57
62
  optOptions () {
58
63
  return Object.assign({}, this.optionProps)
59
64
  },
65
+ optAvatarUrlField () {
66
+ return this.optOptions.avatar || 'faceImgUrl'
67
+ },
60
68
  optLabelField () {
61
69
  return this.optOptions.label || 'label'
62
70
  },
63
71
  optValueField () {
64
72
  return this.optOptions.value || 'value'
65
73
  },
74
+ defaultAvatarUrl () {
75
+ return globalStore.listSelectUserPage?.defaultAvatarUrl
76
+ },
66
77
  hasEmpty () {
67
78
  if (this.type === 'checkbox') {
68
79
  return !this.value || !this.value.length
@@ -70,10 +81,7 @@ export default {
70
81
  return XEUtils.eqNull(this.value) || this.value === ''
71
82
  },
72
83
  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])
84
+ return this.getSelectRows(this.value)
77
85
  }
78
86
  },
79
87
  watch: {
@@ -92,6 +100,15 @@ export default {
92
100
  this.$emit('tap', {})
93
101
  this.$emit('click', {})
94
102
  },
103
+ getSelectRows (value) {
104
+ if (!this.dataList || !this.dataList.length) {
105
+ return []
106
+ }
107
+ if (this.type === 'checkbox') {
108
+ return this.dataList.filter(item => value.includes(item[this.optValueField]))
109
+ }
110
+ return this.dataList.filter(item => value === item[this.optValueField])
111
+ },
95
112
  openUserEvent () {
96
113
  if (this.disabled) {
97
114
  return
@@ -119,11 +136,24 @@ export default {
119
136
  },
120
137
  removeItem (item) {
121
138
  let value = null
139
+ const checkedKey = null
140
+ let checkedKeys = []
122
141
  if (this.type === 'checkbox') {
123
142
  value = this.value.filter(key => key !== item[this.optValueField])
143
+ checkedKeys = value
144
+ }
145
+ const selectRows = this.getSelectRows(value)
146
+ const label = selectRows.map(item => item[this.optLabelField]).join(',')
147
+ const params = {
148
+ value,
149
+ label,
150
+ selectRows,
151
+ checkedKey,
152
+ checkedKeys,
153
+ type: this.compType
124
154
  }
125
155
  this.$emit('input', value)
126
- this.$emit('change', { value })
156
+ this.$emit('change', params)
127
157
  },
128
158
  clearEvent () {
129
159
  let value = null
@@ -131,7 +161,14 @@ export default {
131
161
  value = []
132
162
  }
133
163
  this.$emit('input', value)
134
- this.$emit('clear', { value })
164
+ this.$emit('clear', {
165
+ value,
166
+ label: '',
167
+ checkedKey: null,
168
+ checkedKeys: [],
169
+ selectRows: [],
170
+ type: this.compType
171
+ })
135
172
  }
136
173
  }
137
174
  }
@@ -171,16 +208,23 @@ export default {
171
208
  color: $uni-text-color-disable;
172
209
  }
173
210
  }
174
- .ml-list-select-user-img {
175
- width: 50rpx;
176
- height: 50rpx;
177
- border-radius: 50%;
178
- overflow: hidden;
211
+ .ml-list-select-user-avatar {
212
+ display: flex;
213
+ flex-direction: row;
214
+ justify-content: center;
215
+ .ml-list-select-user-avatar-img {
216
+ width: 40rpx;
217
+ height: 40rpx;
218
+ border-radius: 50%;
219
+ overflow: hidden;
220
+ }
179
221
  }
180
222
  .ml-list-select-user-name {
223
+ margin-left: 8rpx;
181
224
  .ml-list-select-user-content {
182
225
  font-size: 28rpx;
183
- max-width: 140rpx;
226
+ max-width: 100rpx;
227
+ text-align: center;
184
228
  overflow: hidden;
185
229
  text-overflow: ellipsis;
186
230
  white-space: nowrap;
@@ -188,7 +232,7 @@ export default {
188
232
  }
189
233
  .ml-list-select-user-del-item {
190
234
  flex-shrink: 0;
191
- margin-left: 16rpx;
235
+ margin-left: 8rpx;
192
236
  }
193
237
  .ml-list-select-user-page-placeholder {
194
238
  color: $ml-input-color-placeholder;
@@ -280,6 +280,7 @@ export default {
280
280
  }
281
281
  .ml-number-input-inp {
282
282
  outline: 0;
283
+ border: 0;
283
284
  }
284
285
  .ml-number-input-minus-btn,
285
286
  .ml-number-input-plus-btn {
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.147",
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)