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 +1 -1
- package/packages/utils/other.js +10 -7
package/package.json
CHANGED
package/packages/utils/other.js
CHANGED
|
@@ -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 (
|
|
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(
|
|
210
|
+
let isMutiple = multiple || ['$vCheckgroup', '$vUpload'].includes(rname)
|
|
210
211
|
let optionValue = 'value'
|
|
211
212
|
let optionLabel = 'label'
|
|
212
|
-
if (
|
|
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
|
-
|
|
234
|
-
|
|
235
|
-
|
|
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)
|