Merge branch 'dev-3.10' of git.mesalab.cn:nezha/nezha-fronted into dev-3.10

This commit is contained in:
zyh
2023-12-15 14:40:20 +08:00
13 changed files with 174 additions and 70 deletions

View File

@@ -75,6 +75,9 @@ export default {
if (typeof (itemValue) === 'string') { if (typeof (itemValue) === 'string') {
itemValue = Number(itemValue) itemValue = Number(itemValue)
} }
// if (typeof (itemValue) !== 'undefined' && isNaN(itemValue)) {
// itemValue = null
// }
if (itemValue === null && nullValueMode !== 'null') { if (itemValue === null && nullValueMode !== 'null') {
if (nullValueMode === 'zero') { if (nullValueMode === 'zero') {
itemValue = 0 itemValue = 0
@@ -389,7 +392,10 @@ export default {
paramsDot = 6 paramsDot = 6
} }
const val = typeof (item.value[1]) == 'undefined' ? 0 : formatScientificNotation(item.value[1], paramsDot) const val = typeof (item.value[1]) == 'undefined' ? 0 : formatScientificNotation(item.value[1], paramsDot)
const showVal = typeof (item.value[1]) == 'undefined' ? '' : chartDataFormat.getUnit(unit).compute(val, null, -1, decimals) let showVal = typeof (item.value[1]) == 'undefined' ? '' : chartDataFormat.getUnit(unit).compute(val, null, -1, decimals)
if ((item.value[1] + '') === 'NaN') {
showVal = 'NaN'
}
sum += isNaN(self.numberWithEConvent(val)) ? 0 : parseFloat(self.numberWithEConvent(val)) sum += isNaN(self.numberWithEConvent(val)) ? 0 : parseFloat(self.numberWithEConvent(val))
let previousDom = '' let previousDom = ''
if (previousItem) { if (previousItem) {

View File

@@ -12,6 +12,9 @@ function stack (data, omit) {
if (typeof (v) === 'undefined') { if (typeof (v) === 'undefined') {
return accum[i] return accum[i]
} }
if (isNaN(v)) {
return accum[i]
}
return (accum[i] += +v) return (accum[i] += +v)
})) }))
} }

View File

@@ -373,25 +373,37 @@ export default {
return row.name.substring(0, 12) + '...' return row.name.substring(0, 12) + '...'
} }
return row.name return row.name
},
tip: function (row) {
return row.name
} }
}, },
{ title: this.$t('asset.manageIp'), data: 'manageIp' }, { title: this.$t('asset.manageIp'), data: 'manageIp', tip: 'manageIp' },
{ {
title: this.$t('overall.type'), title: this.$t('overall.type'),
data: (row) => { data: (row) => {
return row.type ? row.type.name : '' return row.type ? row.type.name : ''
},
tip: (row) => {
return row.type ? row.type.name : ''
} }
}, },
{ {
title: this.$t('asset.model'), title: this.$t('asset.model'),
data: (row) => { data: (row) => {
return row.model ? row.model.name : '' return row.model ? row.model.name : ''
},
tip: (row) => {
return row.model ? row.model.name : ''
} }
}, },
{ {
title: this.$t('overall.dc'), title: this.$t('overall.dc'),
data: (row) => { data: (row) => {
return row.dc ? row.dc.name : '' return row.dc ? row.dc.name : ''
},
tip: (row) => {
return row.dc ? row.dc.name : ''
} }
} }
], ],

View File

@@ -62,22 +62,6 @@
<el-form-item :label='$t("config.assetType.sshCollectScript")' prop="sshCollectScript"> <el-form-item :label='$t("config.assetType.sshCollectScript")' prop="sshCollectScript">
<el-input v-model="editAssetType.sshCollectScript" size="small" type="text"></el-input> <el-input v-model="editAssetType.sshCollectScript" size="small" type="text"></el-input>
</el-form-item> </el-form-item>
<!-- ChartTemplate -->
<!-- <el-form-item :label="$t('config.type.ChartTemplate')" prop="ChartTemplate">
<v-selectpage
:data="chartlList"
:tb-columns="ChartSearchShowFields"
:max-select-limit="3"
:multiple="true"
title="ChartSearch"
placeholder="Please select item"
key-field="id"
v-model="editAssetType.chartIds"
show-field="name"
class="form-control"
@values="(data) => {editAssetType.chartIds = data.map(d => d.id).join(',')}"
></v-selectpage>
</el-form-item> -->
</el-form> </el-form>
</div> </div>
</div> </div>

View File

@@ -25,27 +25,6 @@
<el-option v-for="(item, index) in typeDataList" :key="index" :label="item.name" :value="item.id"></el-option> <el-option v-for="(item, index) in typeDataList" :key="index" :label="item.name" :value="item.id"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<!-- ChartTemplate -->
<!-- <el-form-item :label="$t('overall.chartTemp')" prop="ChartTemplate">
<v-selectpage
:data="chartlList"
:tb-columns="ChartSearchShowFields"
:params="{
varType: 1, dashboardId: 0,
returnChildren:0,groupId:0,
}"
:multiple="true"
:language="language"
title="ChartSearch"
key-field="id"
:width="640"
v-model="editModel.chartIds"
show-field="name"
class="form-control"
@values="(data) => {editModel.chartIds = data.map(d => d.id).join(',')}"
:result-format="resultFormat"
></v-selectpage>
</el-form-item> -->
<!-- DashboardTemplate --> <!-- DashboardTemplate -->
<el-form-item :label="$t('model.dashboardtemplate')" prop="dashboardId" ref="dashboardTemplate"> <el-form-item :label="$t('model.dashboardtemplate')" prop="dashboardId" ref="dashboardTemplate">
<v-selectpage <v-selectpage
@@ -121,16 +100,10 @@ export default {
typeDataList: [], typeDataList: [],
// chartlList: [], // chart 列表数据 // chartlList: [], // chart 列表数据
dashboardList: [], // dashboard 列表数据 dashboardList: [], // dashboard 列表数据
// ChartSearchShowFields: [ // ChartSearch 下拉搜索表头
// { title: 'ID', data: 'id' },
// { title: this.$t('overall.name'), data: 'name', key: 'name' },
// { title: this.$t('overall.type'), data: 'type', key: 'type' },
// { title: this.$t('overall.remark'), data: 'remark', key: 'remark' }
// ],
DashboardSearchShowFields: [ // DashboardSearch 下拉搜索表头 DashboardSearchShowFields: [ // DashboardSearch 下拉搜索表头
{ title: 'ID', data: 'id' }, { title: 'ID', data: 'id' },
{ title: this.$t('overall.name'), data: 'name', key: 'name' }, { title: this.$t('overall.name'), data: 'name', tip: 'name' },
{ title: this.$t('overall.remark'), data: 'remark', key: 'remark' } { title: this.$t('overall.remark'), data: 'remark', tip: 'remark' }
], ],
url: 'asset/model', url: 'asset/model',
brandUrl: 'asset/brand', brandUrl: 'asset/brand',

View File

@@ -192,7 +192,9 @@ export default {
} }
return row.name return row.name
}, },
key: 'name' tip: function (row) {
return row.name
}
}, },
{ {
title: this.$t('project.project.projectName'), title: this.$t('project.project.projectName'),
@@ -203,8 +205,9 @@ export default {
return row.project.name return row.project.name
} }
}, },
deep: true, tip: function (row) {
orjinNME: 'project' return row.project.name
}
}, },
{ {
title: this.$t('overall.remark'), title: this.$t('overall.remark'),
@@ -212,9 +215,11 @@ export default {
if (row.remark && row.remark.length > 15) { if (row.remark && row.remark.length > 15) {
return row.remark.substring(0, 12) + '...' return row.remark.substring(0, 12) + '...'
} }
return row.remark = row.remark ? row.remark : '' return row.remark ? row.remark : ''
}, },
key: 'remark' tip: function (row) {
return row.remark ? row.remark : ''
}
} }
], ],
columns: [ columns: [
@@ -227,32 +232,37 @@ export default {
} }
return row.name return row.name
}, },
key: 'name' tip: function (row) {
return row.name
}
}, },
{ title: this.$t('asset.manageIp'), data: 'manageIp', key: 'manageIp' }, { title: this.$t('asset.manageIp'), data: 'manageIp', tip: 'manageIp' },
{ {
title: this.$t('overall.type'), title: this.$t('overall.type'),
data: (row) => { data: (row) => {
return row.type ? row.type.name : '' return row.type ? row.type.name : ''
}, },
deep: true, tip: (row) => {
orjinNME: 'type' return row.type ? row.type.name : ''
}
}, },
{ {
title: this.$t('asset.model'), title: this.$t('asset.model'),
data: (row) => { data: (row) => {
return row.model ? row.model.name : '' return row.model ? row.model.name : ''
}, },
deep: true, tip: (row) => {
orjinNME: 'model' return row.model ? row.model.name : ''
}
}, },
{ {
title: this.$t('overall.dc'), title: this.$t('overall.dc'),
data: (row) => { data: (row) => {
return row.dc ? row.dc.name : '' return row.dc ? row.dc.name : ''
}, },
deep: true, tip: (row) => {
orjinNME: 'dc' return row.dc ? row.dc.name : ''
}
} }
], ],
object: {}, object: {},

View File

@@ -102,6 +102,9 @@ export default {
return row.name.substring(0, 12) + '...' return row.name.substring(0, 12) + '...'
} }
return row.name return row.name
},
tip: function (row) {
return row.name
} }
}, },
{ {
@@ -114,6 +117,15 @@ export default {
case 2 : str = 'Endpoint'; break case 2 : str = 'Endpoint'; break
} }
return str return str
},
tip: function (row) {
let str
switch (row.varType) {
case 0 : str = 'None'; break
case 1 : str = 'Asset'; break
case 2 : str = 'Endpoint'; break
}
return str
} }
}, },
{ {
@@ -123,6 +135,9 @@ export default {
return row.remark.substring(0, 12) + '...' return row.remark.substring(0, 12) + '...'
} }
return row.remark return row.remark
},
tip: function (row) {
return row.remark
} }
} }
], ],
@@ -136,25 +151,37 @@ export default {
return row.name.substring(0, 12) + '...' return row.name.substring(0, 12) + '...'
} }
return row.name return row.name
},
tip: function (row) {
return row.name
} }
}, },
{ title: this.$t('asset.manageIp'), data: 'manageIp' }, { title: this.$t('asset.manageIp'), data: 'manageIp', tip: 'manageIp' },
{ {
title: this.$t('overall.type'), title: this.$t('overall.type'),
data: (row) => { data: (row) => {
return row.type ? row.type.name : '' return row.type ? row.type.name : ''
},
tip: function (row) {
return row.type ? row.type.name : ''
} }
}, },
{ {
title: this.$t('asset.model'), title: this.$t('asset.model'),
data: (row) => { data: (row) => {
return row.model ? row.model.name : '' return row.model ? row.model.name : ''
},
tip: (row) => {
return row.model ? row.model.name : ''
} }
}, },
{ {
title: this.$t('overall.dc'), title: this.$t('overall.dc'),
data: (row) => { data: (row) => {
return row.dc ? row.dc.name : '' return row.dc ? row.dc.name : ''
},
tip: (row) => {
return row.dc ? row.dc.name : ''
} }
} }
], ],
@@ -168,24 +195,36 @@ export default {
return row.name.substring(0, 12) + '...' return row.name.substring(0, 12) + '...'
} }
return row.name return row.name
},
tip: function (row) {
return row.name
} }
}, },
{ {
title: this.$t('overall.project'), title: this.$t('overall.project'),
data: (row) => { data: (row) => {
return row.project ? row.project.name : '' return row.project ? row.project.name : ''
},
tip: function (row) {
return row.project ? row.project.name : ''
} }
}, },
{ {
title: this.$t('asset.asset'), title: this.$t('asset.asset'),
data: (row) => { data: (row) => {
return row.asset ? row.asset.name : '' return row.asset ? row.asset.name : ''
},
tip: (row) => {
return row.asset ? row.asset.name : ''
} }
}, },
{ {
title: this.$t('overall.module'), title: this.$t('overall.module'),
data: (row) => { data: (row) => {
return row.module ? row.module.name : '' return row.module ? row.module.name : ''
},
tip: (row) => {
return row.module ? row.module.name : ''
} }
} }
], ],

View File

@@ -820,9 +820,12 @@ export default {
return row.name.substring(0, 12) + '...' return row.name.substring(0, 12) + '...'
} }
return row.name return row.name
},
tip: function (row) {
return row.name
} }
}, },
{ title: this.$t('overall.type'), data: 'type' }, { title: this.$t('overall.type'), data: 'type', tip: 'type' },
{ {
title: this.$t('overall.remark'), title: this.$t('overall.remark'),
data: function (row) { data: function (row) {
@@ -830,6 +833,9 @@ export default {
return row.remark.substring(0, 12) + '...' return row.remark.substring(0, 12) + '...'
} }
return row.remark return row.remark
},
tip: function (row) {
return row.remark
} }
} }
], ],
@@ -958,25 +964,37 @@ export default {
return row.name.substring(0, 12) + '...' return row.name.substring(0, 12) + '...'
} }
return row.name return row.name
},
tip: function (row) {
return row.name
} }
}, },
{ title: this.$t('asset.manageIp'), data: 'manageIp' }, { title: this.$t('asset.manageIp'), data: 'manageIp', tip: 'manageIp' },
{ {
title: this.$t('overall.type'), title: this.$t('overall.type'),
data: (row) => { data: (row) => {
return row.type ? row.type.name : '' return row.type ? row.type.name : ''
},
tip: (row) => {
return row.type ? row.type.name : ''
} }
}, },
{ {
title: this.$t('asset.model'), title: this.$t('asset.model'),
data: (row) => { data: (row) => {
return row.model ? row.model.name : '' return row.model ? row.model.name : ''
},
tip: (row) => {
return row.model ? row.model.name : ''
} }
}, },
{ {
title: this.$t('overall.dc'), title: this.$t('overall.dc'),
data: (row) => { data: (row) => {
return row.dc ? row.dc.name : '' return row.dc ? row.dc.name : ''
},
tip: (row) => {
return row.dc ? row.dc.name : ''
} }
} }
], ],
@@ -989,18 +1007,27 @@ export default {
return row.name.substring(0, 12) + '...' return row.name.substring(0, 12) + '...'
} }
return row.name return row.name
},
tip: function (row) {
return row.name
} }
}, },
{ {
title: this.$t('softwareType.category'), title: this.$t('softwareType.category'),
data: (row) => { data: (row) => {
return row.type ? row.type.category : '' return row.type ? row.type.category : ''
},
tip: (row) => {
return row.type ? row.type.category : ''
} }
}, },
{ {
title: this.$t('overall.type'), title: this.$t('overall.type'),
data: (row) => { data: (row) => {
return row.type ? row.type.name : '' return row.type ? row.type.name : ''
},
tip: (row) => {
return row.type ? row.type.name : ''
} }
}, },
{ {
@@ -1010,6 +1037,9 @@ export default {
return row.remark.substring(0, 12) + '...' return row.remark.substring(0, 12) + '...'
} }
return row.remark return row.remark
},
tip: function (row) {
return row.remark
} }
} }
], ],
@@ -1134,7 +1164,7 @@ export default {
}) })
}, },
getSoftwareAsset () { getSoftwareAsset () {
this.$get('/asset/software', { pageSize: -1, projectIds: this.editEndpoint.projectId, assetIds: this.editEndpoint.assetId }).then(res => { this.$get('/asset/software', { pageSize: -1, projectIds: this.editEndpoint.projectId, assetIds: this.editEndpoint.assetId }).then(res => {
this.softwareAssetList = res.data.list this.softwareAssetList = res.data.list
}) })
}, },

View File

@@ -210,25 +210,37 @@ export default {
return row.name.substring(0, 12) + '...' return row.name.substring(0, 12) + '...'
} }
return row.name return row.name
},
tip: function (row) {
return row.name
} }
}, },
{ title: this.$t('asset.manageIp'), data: 'manageIp' }, { title: this.$t('asset.manageIp'), data: 'manageIp', tip: 'manageIp' },
{ {
title: this.$t('overall.type'), title: this.$t('overall.type'),
data: (row) => { data: (row) => {
return row.type ? row.type.name : '' return row.type ? row.type.name : ''
},
tip: (row) => {
return row.type ? row.type.name : ''
} }
}, },
{ {
title: this.$t('asset.model'), title: this.$t('asset.model'),
data: (row) => { data: (row) => {
return row.model ? row.model.name : '' return row.model ? row.model.name : ''
},
tip: (row) => {
return row.model ? row.model.name : ''
} }
}, },
{ {
title: this.$t('overall.dc'), title: this.$t('overall.dc'),
data: (row) => { data: (row) => {
return row.dc ? row.dc.name : '' return row.dc ? row.dc.name : ''
},
tip: (row) => {
return row.dc ? row.dc.name : ''
} }
} }
], ],

View File

@@ -755,7 +755,9 @@ export default {
} }
return row.name return row.name
}, },
key: 'name' tip: function (row) {
return row.name
}
}, },
{ {
title: this.$t('overall.remark'), title: this.$t('overall.remark'),
@@ -765,7 +767,9 @@ export default {
} }
return row.remark return row.remark
}, },
key: 'remark' tip: function (row) {
return row.remark
}
} }
], ],
showAllBasicOption: false, showAllBasicOption: false,

View File

@@ -214,25 +214,37 @@ export default {
return row.name.substring(0, 12) + '...' return row.name.substring(0, 12) + '...'
} }
return row.name return row.name
},
tip: function (row) {
return row.name
} }
}, },
{ title: this.$t('asset.manageIp'), data: 'manageIp' }, { title: this.$t('asset.manageIp'), data: 'manageIp', tip: 'manageIp' },
{ {
title: this.$t('overall.type'), title: this.$t('overall.type'),
data: (row) => { data: (row) => {
return row.type ? row.type.name : '' return row.type ? row.type.name : ''
},
tip: (row) => {
return row.type ? row.type.name : ''
} }
}, },
{ {
title: this.$t('asset.model'), title: this.$t('asset.model'),
data: (row) => { data: (row) => {
return row.model ? row.model.name : '' return row.model ? row.model.name : ''
},
tip: (row) => {
return row.model ? row.model.name : ''
} }
}, },
{ {
title: this.$t('overall.dc'), title: this.$t('overall.dc'),
data: (row) => { data: (row) => {
return row.dc ? row.dc.name : '' return row.dc ? row.dc.name : ''
},
tip: (row) => {
return row.dc ? row.dc.name : ''
} }
} }
], ],

View File

@@ -33,7 +33,7 @@ export default {
key: idx, key: idx,
domProps: { domProps: {
innerHTML: this.renderColumn(val, col), innerHTML: this.renderColumn(val, col),
title: col.deep ? val[col.orjinNME].name : val[col.key] title: this.renderTip(val, col)
} }
}) })
})) }))
@@ -47,6 +47,13 @@ export default {
case 'string': return row[col.data] case 'string': return row[col.data]
case 'function': return col.data(row) case 'function': return col.data(row)
} }
},
renderTip (row, col) {
if (!row || !Object.keys(row).length || !col || !col.tip) return ''
switch (typeof col.tip) {
case 'string': return row[col.tip]
case 'function': return col.tip(row)
}
} }
} }
} }

View File

@@ -58,25 +58,37 @@ export default {
return row.name.substring(0, 12) + '...' return row.name.substring(0, 12) + '...'
} }
return row.name return row.name
},
tip: function (row) {
return row.name
} }
}, },
{ title: this.$t('asset.manageIp'), data: 'manageIp' }, { title: this.$t('asset.manageIp'), data: 'manageIp', tip: 'manageIp' },
{ {
title: this.$t('overall.type'), title: this.$t('overall.type'),
data: (row) => { data: (row) => {
return row.type ? row.type.name : '' return row.type ? row.type.name : ''
},
tip: (row) => {
return row.type ? row.type.name : ''
} }
}, },
{ {
title: this.$t('asset.model'), title: this.$t('asset.model'),
data: (row) => { data: (row) => {
return row.model ? row.model.name : '' return row.model ? row.model.name : ''
},
tip: (row) => {
return row.model ? row.model.name : ''
} }
}, },
{ {
title: this.$t('overall.dc'), title: this.$t('overall.dc'),
data: (row) => { data: (row) => {
return row.dc ? row.dc.name : '' return row.dc ? row.dc.name : ''
},
tip: (row) => {
return row.dc ? row.dc.name : ''
} }
} }
] ]