mirror of
https://github.com/jumpserver/lina.git
synced 2026-01-13 19:35:24 +00:00
fix: 修复上传json文件上传问题
This commit is contained in:
@@ -50,7 +50,7 @@ export default {
|
||||
const reader = new FileReader()
|
||||
reader.onload = function() {
|
||||
let result = this.result
|
||||
if (vm.toFormat === 'object') {
|
||||
if (vm.toFormat === 'object' && vm.fileName.endsWith('.json')) {
|
||||
result = JSON.parse(result)
|
||||
}
|
||||
vm.$emit('input', result)
|
||||
|
||||
@@ -91,13 +91,17 @@ export default {
|
||||
const attrs = values.attrs
|
||||
for (const item of encryptedFields) {
|
||||
const value = attrs[item]
|
||||
if (value) {
|
||||
attrs[item] = encryptPassword(value)
|
||||
if (!value) {
|
||||
continue
|
||||
}
|
||||
attrs[item] = encryptPassword(value)
|
||||
}
|
||||
const toListFields = ['ip_group']
|
||||
for (const item of toListFields) {
|
||||
let value = attrs[item]
|
||||
if (!value) {
|
||||
continue
|
||||
}
|
||||
value = value?.split(',') || []
|
||||
value = value.filter((value, index) => { if (value) return true })
|
||||
attrs[item] = value
|
||||
|
||||
Reference in New Issue
Block a user