diff --git a/cmdb-ui/src/modules/cmdb/api/history.js b/cmdb-ui/src/modules/cmdb/api/history.js
index 7de88a7..aeff68a 100644
--- a/cmdb-ui/src/modules/cmdb/api/history.js
+++ b/cmdb-ui/src/modules/cmdb/api/history.js
@@ -1,89 +1,92 @@
-import { axios } from '@/utils/request'
-
-export function getCIHistory(ciId) {
- return axios({
- url: `/v0.1/history/ci/${ciId}`,
- method: 'GET'
- })
-}
-
-export function getCIHistoryTable(params) {
- return axios({
- url: `/v0.1/history/records/attribute`,
- method: 'GET',
- params: params
- })
-}
-
-export function getRelationTable(params) {
- return axios({
- url: `/v0.1/history/records/relation`,
- method: 'GET',
- params: params
- })
-}
-
-export function getCITypesTable(params) {
- return axios({
- url: `/v0.1/history/ci_types`,
- method: 'GET',
- params: params
- })
-}
-
-export function getUsers(params) {
- return axios({
- url: `/v1/acl/users/employee`,
- method: 'GET',
- params: params
- })
-}
-
-export function getCiTriggers(params) {
- return axios({
- url: `/v0.1/history/ci_triggers`,
- method: 'GET',
- params: params
- })
-}
-
-export function getCiTriggersByCiId(ci_id, params) {
- return axios({
- url: `/v0.1/history/ci_triggers/${ci_id}`,
- method: 'GET',
- params
- })
-}
-
-export function getCiRelatedTickets(params) {
- return axios({
- url: `/itsm/v1/process_ticket/get_tickets_by`,
- method: 'POST',
- data: params,
- isShowMessage: false
- })
-}
-
-export function judgeItsmInstalled() {
- return axios({
- url: `/itsm/v1/process_ticket/itsm_existed`,
- method: 'GET',
- isShowMessage: false
- })
-}
-
-export function getCIsBaseline(params) {
- return axios({
- url: `/v0.1/ci/baseline`,
- method: 'GET',
- params
- })
-}
-
-export function CIBaselineRollback(ciId, params) {
- return axios({
- url: `/v0.1/ci/${ciId}/baseline/rollback`,
- method: 'POST',
- data: params
- })
-}
+import { axios } from '@/utils/request'
+
+export function getCIHistory(ciId) {
+ return axios({
+ url: `/v0.1/history/ci/${ciId}`,
+ method: 'GET'
+ })
+}
+
+export function getCIHistoryTable(params) {
+ return axios({
+ url: `/v0.1/history/records/attribute`,
+ method: 'GET',
+ params: params,
+ timeout: 30 * 1000
+ })
+}
+
+export function getRelationTable(params) {
+ return axios({
+ url: `/v0.1/history/records/relation`,
+ method: 'GET',
+ params: params,
+ timeout: 30 * 1000
+ })
+}
+
+export function getCITypesTable(params) {
+ return axios({
+ url: `/v0.1/history/ci_types`,
+ method: 'GET',
+ params: params,
+ timeout: 30 * 1000
+ })
+}
+
+export function getUsers(params) {
+ return axios({
+ url: `/v1/acl/users/employee`,
+ method: 'GET',
+ params: params
+ })
+}
+
+export function getCiTriggers(params) {
+ return axios({
+ url: `/v0.1/history/ci_triggers`,
+ method: 'GET',
+ params: params
+ })
+}
+
+export function getCiTriggersByCiId(ci_id, params) {
+ return axios({
+ url: `/v0.1/history/ci_triggers/${ci_id}`,
+ method: 'GET',
+ params
+ })
+}
+
+export function getCiRelatedTickets(params) {
+ return axios({
+ url: `/itsm/v1/process_ticket/get_tickets_by`,
+ method: 'POST',
+ data: params,
+ isShowMessage: false
+ })
+}
+
+export function judgeItsmInstalled() {
+ return axios({
+ url: `/itsm/v1/process_ticket/itsm_existed`,
+ method: 'GET',
+ isShowMessage: false
+ })
+}
+
+export function getCIsBaseline(params) {
+ return axios({
+ url: `/v0.1/ci/baseline`,
+ method: 'GET',
+ params
+ })
+}
+
+export function CIBaselineRollback(ciId, params) {
+ return axios({
+ url: `/v0.1/ci/${ciId}/baseline/rollback`,
+ method: 'POST',
+ data: params
+ })
+}
diff --git a/cmdb-ui/src/modules/cmdb/views/ci/modules/ciDetailTab.vue b/cmdb-ui/src/modules/cmdb/views/ci/modules/ciDetailTab.vue
index ffc3362..7511f1b 100644
--- a/cmdb-ui/src/modules/cmdb/views/ci/modules/ciDetailTab.vue
+++ b/cmdb-ui/src/modules/cmdb/views/ci/modules/ciDetailTab.vue
@@ -1,449 +1,463 @@
-
-
-
-
-
- {{ $t('cmdb.ci.share') }}
-
-
- {{ $t('cmdb.attribute') }}
-
-
-
-
-
-
-
-
-
- {{ $t('cmdb.relation') }}
-
-
-
-
-
- {{ $t('cmdb.ci.history') }}
-
-
-
- {{ $t('cmdb.ci.rollback') }}
-
-
-
-
-
-
-
- {{ $t('noData') }}
-
-
-
-
-
-
- {{ operateTypeMap[row.operate_type] }}
-
-
-
-
-
- {{ JSON.parse(row.old) }}
- {{ row.old }}
-
-
-
-
- {{ JSON.parse(row.new) }}
- {{ row.new }}
-
-
-
-
-
-
- {{ $t('cmdb.history.triggerHistory') }}
-
-
-
-
-
- {{ $t('cmdb.ci.relITSM') }}
-
-
-
-
-
-
-
- {{ $t('cmdb.ci.noPermission') }}
-
-
-
-
-
-
-
+
+
+
+
+
+ {{ $t('cmdb.ci.share') }}
+
+
+ {{ $t('cmdb.attribute') }}
+
+
+
+
+
+
+
+
+
+ {{ $t('cmdb.relation') }}
+
+
+
+
+
+ {{ $t('cmdb.ci.history') }}
+
+
+
+ {{ $t('cmdb.ci.rollback') }}
+
+
+ {{ $t('export') }}
+
+
+
+
+
+
+
+ {{ $t('noData') }}
+
+
+
+
+
+
+ {{ operateTypeMap[row.operate_type] }}
+
+
+
+
+
+ {{ JSON.parse(row.old) }}
+ {{ row.old }}
+
+
+
+
+ {{ JSON.parse(row.new) }}
+ {{ row.new }}
+
+
+
+
+
+
+ {{ $t('cmdb.history.triggerHistory') }}
+
+
+
+
+
+ {{ $t('cmdb.ci.relITSM') }}
+
+
+
+
+
+
+
+ {{ $t('cmdb.ci.noPermission') }}
+
+
+
+
+
+
+
diff --git a/cmdb-ui/src/modules/cmdb/views/operation_history/modules/ciTable.vue b/cmdb-ui/src/modules/cmdb/views/operation_history/modules/ciTable.vue
index 8178e27..fc73711 100644
--- a/cmdb-ui/src/modules/cmdb/views/operation_history/modules/ciTable.vue
+++ b/cmdb-ui/src/modules/cmdb/views/operation_history/modules/ciTable.vue
@@ -7,6 +7,7 @@
@search="handleSearch"
@searchFormReset="searchFormReset"
@searchFormChange="searchFormChange"
+ @export="handleExport"
>
-
-
+
+
= 0
},
+
+ async handleExport(params) {
+ const hide = this.$message.loading(this.$t('loading'), 0)
+ const res = await getCIHistoryTable({
+ ...params,
+ page: this.queryParams.page,
+ page_size: this.queryParams.page_size,
+ })
+ hide()
+ const data = []
+ res.records.forEach((item) => {
+ item[0].type_id = this.handleTypeId(item[0].type_id)
+ item[1].forEach((subItem) => {
+ subItem.operate_type = this.handleOperateType(subItem.operate_type)
+ subItem.new = subItem.new || ''
+ subItem.old = subItem.old || ''
+ const tempObj = Object.assign(subItem, item[0])
+ data.push(tempObj)
+ })
+ })
+
+ this.$refs.xTable.exportData({
+ filename: this.$t('cmdb.history.ciChange'),
+ sheetName: 'Sheet1',
+ type: 'xlsx',
+ types: ['xlsx', 'csv', 'html', 'xml', 'txt'],
+ isMerge: true,
+ isColgroup: true,
+ data,
+ })
+ }
},
}
diff --git a/cmdb-ui/src/modules/cmdb/views/operation_history/modules/relation.vue b/cmdb-ui/src/modules/cmdb/views/operation_history/modules/relation.vue
index 540b074..d7fb859 100644
--- a/cmdb-ui/src/modules/cmdb/views/operation_history/modules/relation.vue
+++ b/cmdb-ui/src/modules/cmdb/views/operation_history/modules/relation.vue
@@ -5,6 +5,7 @@
@expandChange="handleExpandChange"
@search="handleSearch"
@searchFormReset="searchFormReset"
+ @export="handleExport"
>
= 0
},
+
+ async handleExport(params) {
+ const hide = this.$message.loading(this.$t('loading'), 0)
+ const res = await getRelationTable({
+ ...params,
+ page: this.queryParams.page,
+ page_size: this.queryParams.page_size,
+ })
+ hide()
+ const data = []
+ res.records.forEach((item) => {
+ item[1].forEach((subItem) => {
+ subItem.operate_type = this.handleOperateType(subItem.operate_type)
+ subItem.relation_type_id = this.handleRelationType(subItem.relation_type_id)
+ subItem.first = res.cis[String(subItem.first_ci_id)]
+ subItem.second = res.cis[String(subItem.second_ci_id)]
+
+ const tempObj = Object.assign(subItem, item[0])
+
+ tempObj.changeDescription = this.getExportChangeDescription(tempObj)
+
+ data.push(tempObj)
+ })
+ })
+
+ this.$refs.xTable.exportData({
+ filename: this.$t('cmdb.history.relationChange'),
+ sheetName: 'Sheet1',
+ type: 'xlsx',
+ types: ['xlsx', 'csv', 'html', 'xml', 'txt'],
+ isMerge: true,
+ isColgroup: true,
+ data,
+ })
+ },
+
+ getExportChangeDescription(item) {
+ const first = item.first ? `${item.first.ci_type_alias}${item.first.unique_alias && item.first[item.first.unique] ? `(${item.first.unique_alias}:${item.first[item.first.unique]})` : ''}` : ''
+ const second = item.second ? `${item.second.ci_type_alias}${item.second.unique_alias && item.second[item.second.unique] ? `(${item.second.unique_alias}:${item.second[item.second.unique]})` : ''}` : ''
+ let center = ''
+ if (item.changeDescription === this.$t('cmdb.history.noUpdate')) {
+ center = item.relation_type_id
+ } else if (item.operate_type.includes(this.$t('update'))) {
+ center = item.changeArr.join(';')
+ } else if (item.operate_type.includes(this.$t('new'))) {
+ center = item.relation_type_id
+ } else if (item.operate_type.includes(this.$t('delete'))) {
+ center = item.relation_type_id
+ }
+
+ return `${first || ''} => ${center || ''} => ${second || ''}`
+ }
},
}
diff --git a/cmdb-ui/src/modules/cmdb/views/operation_history/modules/searchForm.vue b/cmdb-ui/src/modules/cmdb/views/operation_history/modules/searchForm.vue
index 66d80c5..4afd340 100644
--- a/cmdb-ui/src/modules/cmdb/views/operation_history/modules/searchForm.vue
+++ b/cmdb-ui/src/modules/cmdb/views/operation_history/modules/searchForm.vue
@@ -27,7 +27,7 @@
{{ Object.keys(choice)[0] }}
@@ -42,7 +42,7 @@
hideDisabledOptions: true,
defaultValue: [moment('00:00:00', 'HH:mm:ss'), moment('23:59:59', 'HH:mm:ss')],
}"
- v-else-if="valueTypeMap[attr.value_type] == 'date' || valueTypeMap[attr.value_type] == 'datetime'"
+ v-else-if="attr.value_type === '3'"
/>
@@ -85,7 +85,7 @@
@change="onChange"
format="YYYY-MM-DD HH:mm"
:placeholder="[$t('cmdb.history.startTime'), $t('cmdb.history.endTime')]"
- v-else-if="valueTypeMap[item.value_type] == 'date' || valueTypeMap[item.value_type] == 'datetime'"
+ v-else-if="attr.value_type === '3'"
:show-time="{
hideDisabledOptions: true,
defaultValue: [moment('00:00:00', 'HH:mm:ss'), moment('23:59:59', 'HH:mm:ss')],
@@ -101,6 +101,9 @@
{{ $t('query') }}
+
+ {{ $t('export') }}
+
{{ $t('reset') }}
@@ -155,6 +158,13 @@ export default {
this.$emit('search', this.queryParams)
},
+ handleExport() {
+ const queryParams = {
+ ...this.queryParams
+ }
+ this.$emit('export', queryParams)
+ },
+
handleReset() {
this.queryParams = {
page: 1,
diff --git a/cmdb-ui/src/modules/cmdb/views/operation_history/modules/typeTable.vue b/cmdb-ui/src/modules/cmdb/views/operation_history/modules/typeTable.vue
index 09f01f0..486b0a0 100644
--- a/cmdb-ui/src/modules/cmdb/views/operation_history/modules/typeTable.vue
+++ b/cmdb-ui/src/modules/cmdb/views/operation_history/modules/typeTable.vue
@@ -5,6 +5,7 @@
@expandChange="handleExpandChange"
@search="handleSearch"
@searchFormReset="searchFormReset"
+ @export="handleExport"
>
= 0
},
+
+ async handleExport(params) {
+ const hide = this.$message.loading(this.$t('loading'), 0)
+ const res = await getCITypesTable({
+ ...params,
+ page: this.queryParams.page,
+ page_size: this.queryParams.page_size,
+ })
+ hide()
+
+ res.result.forEach((item) => {
+ this.handleChangeDescription(item, item.operate_type)
+ item.operate_type = this.handleOperateType(item.operate_type)
+ item.type_id = this.handleTypeId(item.type_id)
+ item.uid = this.handleUID(item.uid)
+ if (item.operate_type.includes(this.$t('update'))) {
+ item.changeDescription = item.changeArr.join(';')
+ }
+ })
+
+ this.$refs.xTable.exportData({
+ filename: this.$t('cmdb.history.ciTypeChange'),
+ sheetName: 'Sheet1',
+ type: 'xlsx',
+ types: ['xlsx', 'csv', 'html', 'xml', 'txt'],
+ isMerge: true,
+ isColgroup: true,
+ data: res.result,
+ })
+ },
},
}