feat: Add unique value column to operation history table

This commit is contained in:
thexqn
2024-08-30 01:00:39 +08:00
parent 12c7b564cd
commit d0779d17fa
4 changed files with 37 additions and 2 deletions

View File

@@ -45,6 +45,7 @@
</template>
</vxe-column>
<vxe-column field="type_id" width="100px" :title="$t('cmdb.ciType.ciType')"></vxe-column>
<vxe-column field="unique_value" width="100px" :title="$t('cmdb.ciType.uniqueKey')"></vxe-column>
<vxe-column field="operate_type" width="89px" :title="$t('operation')">
<template #header="{ column }">
<span>{{ column.title }}</span>
@@ -314,7 +315,7 @@ export default {
}
},
mergeRowMethod({ row, _rowIndex, column, visibleData }) {
const fields = ['created_at', 'user', 'type_id']
const fields = ['created_at', 'user', 'type_id', 'unique_value']
const cellValue = row[column.property]
const created_at = row['created_at']
if (column.property === 'created_at') {
@@ -365,6 +366,22 @@ export default {
}
}
}
} else if (column.property === 'unique_value') {
if (cellValue && fields.includes(column.property)) {
const prevRow = visibleData[_rowIndex - 1]
let nextRow = visibleData[_rowIndex + 1]
if (prevRow && prevRow[column.property] === cellValue && prevRow['created_at'] === created_at) {
return { rowspan: 0, colspan: 0 }
} else {
let countRowspan = 1
while (nextRow && nextRow[column.property] === cellValue && nextRow['created_at'] === created_at) {
nextRow = visibleData[++countRowspan + _rowIndex]
}
if (countRowspan > 1) {
return { rowspan: countRowspan, colspan: 1 }
}
}
}
}
},
filterUser() {

View File

@@ -85,7 +85,7 @@
@change="onChange"
format="YYYY-MM-DD HH:mm"
:placeholder="[$t('cmdb.history.startTime'), $t('cmdb.history.endTime')]"
v-else-if="attr.value_type === '3'"
v-else-if="valueTypeMap[item.value_type] == 'date' || valueTypeMap[item.value_type] == 'datetime'"
:show-time="{
hideDisabledOptions: true,
defaultValue: [moment('00:00:00', 'HH:mm:ss'), moment('23:59:59', 'HH:mm:ss')],