feat: 资产管理 3.0

develop
时启龙 2024-08-28 16:02:19 +08:00
parent 4467ff700c
commit 6350f2d6ef
13 changed files with 141 additions and 99 deletions

View File

@ -1,26 +1,27 @@
import { request } from '@cmp/cmp-element'
import EnhancedRequestGet from '@/services/EnhancedRequestGet'
const baseUrl = '/ams/v1/collection/tasks/instances'
export function getCollectionTasksInstances(params: Base.IListParams) {
return request.get(baseUrl, { params })
return EnhancedRequestGet(baseUrl, { params })
}
export function getCollectionTasksInstancesDetail(id: boolean) {
return request.get(`${baseUrl}/${id}`)
return EnhancedRequestGet(`${baseUrl}/${id}`)
}
export function getNodeLogs(id: number, params: { end: boolean; priority?: number }) {
return request.get(`/cop/v1/tasks/instances/nodes/${id}/logs`, {
return EnhancedRequestGet(`/cop/v1/tasks/instances/nodes/${id}/logs`, {
params,
})
}
export function getHosts(params: any) {
return request.get('/cop/v1/hosts', { params })
return EnhancedRequestGet('/cop/v1/hosts', { params })
}
// simple修改
export function getIdentsBySimple(params: any): any {
return request.get('/cop/v1/identifications/simple', {
return EnhancedRequestGet('/cop/v1/identifications/simple', {
params,
})
}
@ -28,17 +29,17 @@ export function getIdentsBySimple(params: any): any {
const scriptsUrl = '/cop/v1/scripts'
// simple修改
export function getScriptBySimple(params: any) {
return request.get(`${scriptsUrl}/simple`, {
return EnhancedRequestGet(`${scriptsUrl}/simple`, {
params,
})
}
export function getScriptDetail(id) {
return request.get(`${scriptsUrl}/${id}`)
return EnhancedRequestGet(`${scriptsUrl}/${id}`)
}
const groupUrl = '/cop/v1/scripts/groups'
export function getGroup(params: any) {
return request.get(groupUrl, {
return EnhancedRequestGet(groupUrl, {
params,
})
}
@ -46,20 +47,20 @@ export function getGroup(params: any) {
// 采集历史
const historyUrl = '/ams/v1/collection/history'
export function getCollectionhistory(params: any): any {
return request.get(historyUrl, {
return EnhancedRequestGet(historyUrl, {
params,
})
}
// 未采集
export function getCollectionInstances(params: any): any {
return request.get(`${historyUrl}/instances`, {
return EnhancedRequestGet(`${historyUrl}/instances`, {
params,
})
}
// 数据详情列表
export function getCollectionItem(params: any): any {
return request.get(`${historyUrl}/item`, {
return EnhancedRequestGet(`${historyUrl}/item`, {
params,
})
}

View File

@ -1,12 +1,13 @@
import { request } from '@cmp/cmp-element'
import EnhancedRequestGet from '@/services/EnhancedRequestGet'
const baseUrl = '/ams/v1/collection/tasks'
export function getCollectionTasks(params: Base.IListParams) {
return request.get(baseUrl, { params })
return EnhancedRequestGet(baseUrl, { params })
}
export function getCollectionTaskDetail(id: number) {
return request.get(`${baseUrl}/${id}`)
return EnhancedRequestGet(`${baseUrl}/${id}`)
}
export function createCollectionTask(params: any) {

View File

@ -1,11 +1,12 @@
import { request } from '@cmp/cmp-element'
import EnhancedRequestGet from '@/services/EnhancedRequestGet'
const baseUrl = '/ams/v1/rule'
export function getRule(params: Base.IListParams) {
return request.get(baseUrl, { params })
return EnhancedRequestGet(baseUrl, { params })
}
export function getRuleDetail(id: number) {
return request.get(`${baseUrl}/${id}`)
return EnhancedRequestGet(`${baseUrl}/${id}`)
}
export function createRule(params: any) {
return request.post(baseUrl, params)

View File

@ -1,13 +1,6 @@
<!--
* @Author: Haijun Zhang
* @Date: 2022-11-03 17:39:48
* @LastEditTime: 2022-11-07 11:33:41
* @LastEditors: Haijun Zhang
* @Description:
* @FilePath: \cmc-web\webs\ams-web\src\views\data-collection\history\index.vue
-->
<template>
<div class="warpper">
<AmsPosition></AmsPosition>
<history-detail v-if="detailDialog.visible" :dialog="detailDialog"></history-detail>
<cb-advance-table v-show="!detailDialog.visible" title="采集历史" :search-configs="searchConfigs" :data="list" :params="params" :columns="columns" :get-list="getList" :total="total" :loading="loading">
<template #name="name, record">
@ -34,10 +27,12 @@ import { columns, searchConfigs } from './config'
import { taskExeStatusFilter } from '@/filters/index'
import { cloneDeep } from 'lodash-es'
import { useRoute } from '@cmp/cmp-core'
import usePostion from '@/views/usePostion'
import AmsPosition from '@/views/AmsPosition.vue'
export default defineComponent({
components: { HistoryDetail },
components: { HistoryDetail, AmsPosition },
setup(props, context: any) {
usePostion(() => getList())
const typeOptions = {
standard: '标准任务',
scheduled: '定时任务',

View File

@ -1,16 +1,18 @@
<template>
<cb-advance-table title="插件列表" :isInitSearch="false" :search-configs="searchConfigs" :data="list" :params="params" :columns="columns" :get-list="getList" :total="total" :loading="loading">
<template #action>
<template #action v-if="isLeaderPosition">
<el-button type="primary" @click="handleCreate({ title: '新增采集插件' })" icon="el-icon-plus">新增</el-button>
</template>
<template #name="name, record">
<span class="detail-href" @click="getDetail(record.id)">{{ name }}</span>
</template>
<template #operate="val, record">
<template v-if="isLeaderPosition">
<el-button type="text" @click="handleCreate({ ...record, title: '编辑采集插件' })"><i class="el-icon-edit"></i> 编辑</el-button>
<div class="action-divider"></div>
<el-button type="text" @click="handleDelete(record)"><i class="el-icon-delete"></i> 删除</el-button>
</template>
</template>
</cb-advance-table>
</template>
@ -19,6 +21,7 @@ import { defineComponent, reactive, watch, toRefs } from 'vue'
import { useTable } from '@cmp/cmp-element'
import { searchConfigs, columns } from './config'
import { getCollectionPlugins, removeCollectionPlugin, getUser } from 'services/data-collection/plugins'
import usePostion from '@/views/usePostion'
export default defineComponent({
props: {
@ -28,6 +31,7 @@ export default defineComponent({
},
},
setup(props, { emit }) {
const { isLeaderPosition } = usePostion()
function listFormat(data) {
const res = data.map((item) => {
item.graph = JSON.parse(item.graph)
@ -86,6 +90,7 @@ export default defineComponent({
handleCreate,
refresh,
getDetail,
isLeaderPosition,
}
},
})

View File

@ -3,7 +3,7 @@
<AmsPosition></AmsPosition>
<split-pane class="split-pane" :min-percent="10" :default-percent="20" split="vertical">
<template slot="paneL">
<Tree ref="Tree" category="template" @handleNodeClick="handleNodeClick"></Tree>
<Tree ref="TreeRef" category="template" @handleNodeClick="handleNodeClick"></Tree>
</template>
<template slot="paneR">
<List ref="listRef" :currentModuleId="currentModuleId" @handleCreate="handleCreate" @getDetail="getDetail"></List>
@ -15,7 +15,7 @@
</template>
<script lang="ts">
import { defineComponent, reactive, toRefs, ref, getCurrentInstance } from 'vue'
import { defineComponent, reactive, toRefs, ref } from 'vue'
import SplitPane from 'vue-splitpane'
import Tree from '@/views/data-collection/components/Tree.vue'
import List from './List.vue'
@ -35,9 +35,10 @@ export default defineComponent({
AmsPosition,
},
setup() {
const instance = getCurrentInstance()
const TreeRef = ref()
const listRef = ref()
usePostion(() => {
if (instance.proxy?.$refs?.Tree) (instance.proxy.$refs.Tree as any).getData()
TreeRef.value.getData()
listRef.value.refresh()
})
const state = reactive({
@ -71,7 +72,6 @@ export default defineComponent({
state.visible = true
}
const listRef = ref()
function goBack() {
state.visible = false
state.detailVisible = false
@ -93,6 +93,7 @@ export default defineComponent({
handleCreate,
goBack,
listRef,
TreeRef,
getDetail,
}
},

View File

@ -1,10 +1,10 @@
<template>
<el-tabs v-model="activeName" class="content">
<el-tab-pane label="常规任务" name="standard">
<Normal v-if="activeName === 'standard'" :currentModuleId="currentModuleId" type="standard"></Normal>
<Normal ref="ItemRef" v-if="activeName === 'standard'" :currentModuleId="currentModuleId" type="standard"></Normal>
</el-tab-pane>
<el-tab-pane label="定时任务" name="scheduled">
<Settime v-if="activeName === 'scheduled'" :currentModuleId="currentModuleId" type="scheduled"></Settime>
<Settime ref="ItemRef" v-if="activeName === 'scheduled'" :currentModuleId="currentModuleId" type="scheduled"></Settime>
</el-tab-pane>
</el-tabs>
</template>
@ -25,9 +25,11 @@ export default defineComponent({
},
},
setup() {
const ItemRef = ref()
const activeName = ref('standard')
return {
activeName,
ItemRef,
}
},
})

View File

@ -1,13 +1,14 @@
<template>
<div>
<cb-advance-table title="任务列表" :card-border="false" :search-configs="searchConfigs" :data="list" :params="params" :columns="columns" :get-list="getList" :total="total" :loading="loading">
<template #action>
<template #action v-if="isLeaderPosition">
<el-button type="primary" @click="handleCreate({ title: '新增', graph: {} })" icon="el-icon-plus">新增</el-button>
</template>
<template #name="name, record">
<span class="detail-href" @click="handleCreate({ title: '查看', ...record, disabled: true })">{{ name }}</span>
</template>
<template #operate="val, record">
<template v-if="isLeaderPosition">
<el-button type="text" @click="handleCreate({ title: '编辑', ...record })"><i class="el-icon-edit"></i> 编辑</el-button>
<div class="action-divider"></div>
<el-button type="text" @click="handleDelete(record)"><i class="el-icon-delete"></i> 删除</el-button>
@ -26,6 +27,7 @@
</el-dropdown-menu>
</el-dropdown>
</template>
</template>
</cb-advance-table>
<!-- <Detail :detail="detail" v-if="visible" @goBack="visible = false"></Detail> -->
<AddData :add-data="addData" v-if="addData.dialog" @getList="refresh"></AddData>
@ -41,6 +43,7 @@ import { getCollectionTasks, removeCollectionTask, patchCollectionTask } from 's
import { MessageBox, Message } from 'element-ui'
import { jumpRouter } from '../utils'
import { decrypt } from '@cmp/cmp-element'
import usePostion from '@/views/usePostion'
export default defineComponent({
components: {
@ -56,6 +59,7 @@ export default defineComponent({
},
},
setup(props, context) {
const { isLeaderPosition } = usePostion()
function listFormat(data) {
return data.map((item) => {
item.graph = JSON.parse(item.graph)
@ -147,6 +151,7 @@ export default defineComponent({
handleRun,
jumpRouter,
...toRefs(state),
isLeaderPosition,
}
},
})

View File

@ -1,7 +1,7 @@
<template>
<div>
<cb-advance-table title="任务列表" :card-border="false" :search-configs="searchConfigs" :data="list" :params="params" :columns="columns" :get-list="getList" :total="total" :loading="loading">
<template #action>
<template #action v-if="isLeaderPosition">
<el-button type="primary" @click="handleCreate({ title: '新增定时任务' })" icon="el-icon-plus">新增</el-button>
</template>
<template #name="name, record">
@ -13,6 +13,7 @@
</cb-status-icon>
</template>
<template #operate="val, record">
<template v-if="isLeaderPosition">
<el-button type="text" @click="handleCreate({ title: '编辑定时任务', ...record })"><i class="el-icon-edit"></i> 编辑</el-button>
<div class="action-divider"></div>
<el-button type="text" @click="handleDelete(record)"><i class="el-icon-delete"></i> 删除</el-button>
@ -35,6 +36,7 @@
</el-dropdown-menu>
</el-dropdown>
</template>
</template>
</cb-advance-table>
<Detail :detail="detail" v-if="visible" @goBack="visible = false"></Detail>
<AddData :dialog="addData" v-if="addData.show" :getData="refresh"></AddData>
@ -50,6 +52,7 @@ import AddData from './AddData.vue'
import Detail from './Detail.vue'
import { MessageBox, Message } from 'element-ui'
import { jumpRouter } from '../utils'
import usePostion from '@/views/usePostion'
export default defineComponent({
components: {
@ -66,6 +69,7 @@ export default defineComponent({
},
},
setup(props) {
const { isLeaderPosition } = usePostion()
function listFormat(data) {
return data.map((item) => {
item.graph = JSON.parse(item.graph)
@ -144,6 +148,7 @@ export default defineComponent({
jumpRouter,
...toRefs(state),
statusFilter,
isLeaderPosition,
}
},
})

View File

@ -1,11 +1,12 @@
<template>
<div class="warpper">
<AmsPosition></AmsPosition>
<split-pane class="split-pane" :min-percent="10" :default-percent="20" split="vertical">
<template slot="paneL">
<Tree category="task" @handleNodeClick="handleNodeClick"></Tree>
<Tree ref="TreeRef" category="task" @handleNodeClick="handleNodeClick"></Tree>
</template>
<template slot="paneR">
<Content :currentModuleId="currentModuleId"></Content>
<Content ref="ListRef" :currentModuleId="currentModuleId"></Content>
</template>
</split-pane>
</div>
@ -16,14 +17,22 @@ import { defineComponent, reactive, toRefs, ref } from 'vue'
import SplitPane from 'vue-splitpane'
import Tree from '@/views/data-collection/components/Tree.vue'
import Content from './content/index.vue'
import usePostion from '@/views/usePostion'
import AmsPosition from '@/views/AmsPosition.vue'
export default defineComponent({
components: {
SplitPane,
Tree,
Content,
AmsPosition,
},
setup() {
const TreeRef = ref()
const ListRef = ref()
usePostion(() => {
TreeRef.value.getData()
ListRef.value.$refs.ItemRef.refresh()
})
const state = reactive({
currentModuleId: '',
visible: false,
@ -52,6 +61,8 @@ export default defineComponent({
...toRefs(state),
handleNodeClick,
handleCreate,
TreeRef,
ListRef,
}
},
})

View File

@ -1,7 +1,8 @@
<template>
<div>
<AmsPosition></AmsPosition>
<cb-advance-table title="关联历史" :search-configs="searchConfigs" :data="list" :params="params" :columns="columns" :get-list="getList" :total="total" :loading="loading" @selection-change="handleSelectionChange">
<template #action>
<template #action v-if="isLeaderPosition">
<el-button type="primary" :disabled="!selectionIds.length" @click="handleCancel()" icon="el-icon-edit">批量取消</el-button>
</template>
<template #status="status">
@ -10,7 +11,7 @@
</cb-status-icon>
</template>
<template #operate="val, record">
<template v-if="record.status === 'RECONCILED'">
<template v-if="record.status === 'RECONCILED' && isLeaderPosition">
<el-button type="text" @click="handleCheck(record.id)"><i class="el-icon-setting"></i> 更新数据</el-button>
<div class="action-divider"></div>
<el-button type="text" @click="handleCancel(record.id)"><i class="el-icon-setting"></i> 取消更新</el-button>
@ -51,9 +52,15 @@ import { Message, MessageBox } from 'element-ui'
import { useTable, useSelection } from '@cmp/cmp-element'
import { getCategoryByModuleId, getRuleByModuleId } from 'services/index'
import { cloneDeep } from 'lodash-es'
import usePostion from '@/views/usePostion'
import AmsPosition from '@/views/AmsPosition.vue'
export default defineComponent({
components: { AmsPosition },
setup(props, context) {
const { isLeaderPosition } = usePostion(() => {
getList()
})
const { list, total, params, loading, getList } = useTable({
getService: getHistory,
})
@ -179,6 +186,7 @@ export default defineComponent({
recordList,
updateId,
handleUpdate,
isLeaderPosition,
}
},
})

View File

@ -1,7 +1,8 @@
<template>
<div>
<AmsPosition></AmsPosition>
<cb-advance-table v-show="!detailVisible" title="规则列表" :search-configs="searchConfigs" :data="list" :params="params" :columns="columns" :get-list="getList" :total="total" :loading="loading">
<template #action>
<template #action v-if="isLeaderPosition">
<el-button type="primary" @click="handleCreate()" icon="el-icon-plus">新增</el-button>
</template>
<template #name="val, record">
@ -13,10 +14,12 @@
</cb-status-icon>
</template>
<template #operate="val, record">
<template v-if="isLeaderPosition">
<el-button type="text" @click="handleCreate(record)"><i class="el-icon-edit"></i> 编辑</el-button>
<div class="action-divider"></div>
<el-button type="text" @click="handleDelete(record)"><i class="el-icon-delete"></i> 删除</el-button>
</template>
</template>
</cb-advance-table>
<!--新增编辑界面-->
<AddDialog :dialog="addDialog" v-if="addDialog.visible" @getData="getList"></AddDialog>
@ -59,10 +62,14 @@ import { columns, searchConfigs as searchConfig } from './config'
import { defineComponent, ref } from 'vue'
import { Message, MessageBox } from 'element-ui'
import { useTable } from '@cmp/cmp-element'
import usePostion from '@/views/usePostion'
import AmsPosition from '@/views/AmsPosition.vue'
export default defineComponent({
components: { AddDialog },
components: { AddDialog, AmsPosition },
setup(props, context) {
const { isLeaderPosition } = usePostion(() => {
getList()
})
const { list, total, params, handleDelete, loading, getList } = useTable({
getService: getRule,
removeService: removeRule,
@ -105,6 +112,7 @@ export default defineComponent({
detailVisible,
getDetail,
goBack,
isLeaderPosition,
}
},
})

View File

@ -1,19 +1,12 @@
<!--
* @Author: Haijun Zhang
* @Date: 2022-11-03 17:39:49
* @LastEditTime: 2022-11-07 11:30:58
* @LastEditors: Haijun Zhang
* @Description:
* @FilePath: \cmc-web\webs\ams-web\src\views\log\index.vue
-->
<template>
<el-card>
<AmsPosition></AmsPosition>
<el-tabs v-model="activeName">
<el-tab-pane label="操作审计" name="first">
<LogList :isLog="true" />
<LogList ref="ItemRef" v-if="activeName === 'first'" :isLog="true" />
</el-tab-pane>
<el-tab-pane label="备份列表" name="third">
<LogList :isLog="false" />
<LogList ref="ItemRef" v-if="activeName === 'third'" :isLog="false" />
</el-tab-pane>
</el-tabs>
</el-card>
@ -21,12 +14,18 @@
<script lang="ts">
import { defineComponent, reactive, ref } from 'vue'
import LogList from './LogList.vue'
import usePostion from '@/views/usePostion'
import AmsPosition from '@/views/AmsPosition.vue'
export default defineComponent({
components: { LogList },
components: { LogList, AmsPosition },
setup(props, context) {
usePostion(() => {
ItemRef.value.getList()
})
const ItemRef = ref()
const activeName = ref('first')
return {
ItemRef,
activeName,
}
},