mirror of
https://github.com/veops/cmdb.git
synced 2025-08-07 23:19:09 +08:00
support JSON type
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
NODE_ENV=production
|
||||
VUE_APP_PREVIEW=false
|
||||
VUE_APP_API_BASE_URL=http://127.0.0.1:5000/api
|
||||
VUE_APP_API_BASE_URL=http://127.0.0.1:5001/api
|
||||
|
@@ -94,7 +94,8 @@ var valueTypeMap = {
|
||||
'2': 'text',
|
||||
'3': 'datetime',
|
||||
'4': 'date',
|
||||
'5': 'time'
|
||||
'5': 'time',
|
||||
'6': 'json'
|
||||
}
|
||||
|
||||
export default {
|
||||
@@ -270,6 +271,7 @@ export default {
|
||||
const col = {}
|
||||
col.title = item.alias
|
||||
col.dataIndex = item.name
|
||||
col.value_type = item.value_type
|
||||
if (index !== prefAttrList.length - 1) {
|
||||
col.width = 100
|
||||
}
|
||||
|
@@ -61,7 +61,8 @@ var valueTypeMap = {
|
||||
'2': 'text',
|
||||
'3': 'datetime',
|
||||
'4': 'date',
|
||||
'5': 'time'
|
||||
'5': 'time',
|
||||
'6': 'json'
|
||||
}
|
||||
|
||||
export default {
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="editable-cell">
|
||||
<div v-if="editable.x" class="editable-cell-input-wrapper">
|
||||
<a-input :value="value" @change="handleChange" @pressEnter="check" />
|
||||
<a-input :value="value | joinList" @change="handleChange" @pressEnter="check" />
|
||||
<a-icon type="check" class="editable-cell-icon-check" @click="check" />
|
||||
</div>
|
||||
<div v-else class="editable-cell-text-wrapper">
|
||||
@@ -37,10 +37,25 @@ export default {
|
||||
}
|
||||
},
|
||||
filters: {
|
||||
jsonDump: function (v) {
|
||||
if (typeof v === 'object') {
|
||||
return JSON.stringify(v)
|
||||
} else {
|
||||
return v
|
||||
}
|
||||
},
|
||||
joinList: function (itemValue) {
|
||||
if (typeof itemValue === 'object' && itemValue) {
|
||||
return itemValue.join(',')
|
||||
} else if (itemValue !== null && itemValue !== 'undefined') {
|
||||
try {
|
||||
if (typeof itemValue[0] !== 'object') {
|
||||
return itemValue.join(',')
|
||||
} else {
|
||||
return JSON.stringify(itemValue)
|
||||
}
|
||||
} catch (e) {
|
||||
return JSON.stringify(itemValue)
|
||||
}
|
||||
} else if (itemValue !== null && itemValue !== 'undefined' && itemValue !== undefined && itemValue !== 'null') {
|
||||
return itemValue + ''
|
||||
} else {
|
||||
return ''
|
||||
|
@@ -97,7 +97,8 @@ var valueTypeMap = {
|
||||
'2': 'text',
|
||||
'3': 'datetime',
|
||||
'4': 'date',
|
||||
'5': 'time'
|
||||
'5': 'time',
|
||||
'6': 'json'
|
||||
}
|
||||
|
||||
export default {
|
||||
|
@@ -4,5 +4,6 @@ export const valueTypeMap = {
|
||||
'2': '文本',
|
||||
'3': 'datetime',
|
||||
'4': 'date',
|
||||
'5': 'time'
|
||||
'5': 'time',
|
||||
'6': 'json'
|
||||
}
|
||||
|
Reference in New Issue
Block a user