sh-tools 2.1.3 → 2.1.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sh-tools",
3
- "version": "2.1.3",
3
+ "version": "2.1.5",
4
4
  "description": "基于xe-ajax和xe-utils二次封装",
5
5
  "main": "packages/index.js",
6
6
  "scripts": {
@@ -198,7 +198,8 @@ export default {
198
198
  break
199
199
  case '$vTime':
200
200
  format = format ? format.replace('YYYY', 'yyyy').replace('DD', 'dd').replace('hh', 'HH') : defaultDateFormat[type]
201
- if (!$vUtils.isNone(value) && format) rvalue = $vUtils.toDateString(value, format)
201
+ if ($vUtils.isNumber(value)) value = String(value)
202
+ if (!$vUtils.isNone(value) && format) $vUtils.toDateString(value, format)
202
203
  break
203
204
  case '$vSelect':
204
205
  case '$vCheckgroup':
@@ -206,11 +207,11 @@ export default {
206
207
  case '$vUpload':
207
208
  case '$vTree':
208
209
  let prefixKey = key.endsWith('Id') ? String(key).replace('Id', '') : key
209
- let isMutiple = multiple || ['$vCheckgroup', '$vUpload'].includes(type)
210
+ let isMutiple = multiple || ['$vCheckgroup', '$vUpload'].includes(rname)
210
211
  let optionValue = 'value'
211
212
  let optionLabel = 'label'
212
- if (type === '$vTree') {
213
- optionValue = nodeKey
213
+ if (rname === '$vTree') {
214
+ optionValue = nodeKey || 'id'
214
215
  if (labelField) optionLabel = labelField
215
216
  }
216
217
  if (isMutiple) {
@@ -230,9 +231,11 @@ export default {
230
231
  }
231
232
  rvalue = oriArray
232
233
  } else {
233
- let valueOption = options.find(option => $vUtils.isEqual(option[optionValue], value))
234
- rtext = valueOption ? valueOption[optionLabel] : ''
235
- rvalue = type === '$vTree' ? (value ? [value] : []) : value
234
+ if (options && options.length) {
235
+ let valueOption = options.find(option => $vUtils.isEqual(option[optionValue], value))
236
+ rtext = valueOption ? valueOption[optionLabel] : ''
237
+ }
238
+ rvalue = rname === '$vTree' ? (value ? [value] : []) : value
236
239
  }
237
240
  if (format) {
238
241
  let dataformat = format.replace(/@/gi, prefixKey)