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

View File

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

View File

@ -1,11 +1,12 @@
import { request } from '@cmp/cmp-element' import { request } from '@cmp/cmp-element'
import EnhancedRequestGet from '@/services/EnhancedRequestGet'
const baseUrl = '/ams/v1/rule' const baseUrl = '/ams/v1/rule'
export function getRule(params: Base.IListParams) { export function getRule(params: Base.IListParams) {
return request.get(baseUrl, { params }) return EnhancedRequestGet(baseUrl, { params })
} }
export function getRuleDetail(id: number) { export function getRuleDetail(id: number) {
return request.get(`${baseUrl}/${id}`) return EnhancedRequestGet(`${baseUrl}/${id}`)
} }
export function createRule(params: any) { export function createRule(params: any) {
return request.post(baseUrl, params) 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> <template>
<div class="warpper"> <div class="warpper">
<AmsPosition></AmsPosition>
<history-detail v-if="detailDialog.visible" :dialog="detailDialog"></history-detail> <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"> <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"> <template #name="name, record">
@ -34,10 +27,12 @@ import { columns, searchConfigs } from './config'
import { taskExeStatusFilter } from '@/filters/index' import { taskExeStatusFilter } from '@/filters/index'
import { cloneDeep } from 'lodash-es' import { cloneDeep } from 'lodash-es'
import { useRoute } from '@cmp/cmp-core' import { useRoute } from '@cmp/cmp-core'
import usePostion from '@/views/usePostion'
import AmsPosition from '@/views/AmsPosition.vue'
export default defineComponent({ export default defineComponent({
components: { HistoryDetail }, components: { HistoryDetail, AmsPosition },
setup(props, context: any) { setup(props, context: any) {
usePostion(() => getList())
const typeOptions = { const typeOptions = {
standard: '标准任务', standard: '标准任务',
scheduled: '定时任务', scheduled: '定时任务',

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,7 +1,8 @@
<template> <template>
<div> <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"> <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> <el-button type="primary" :disabled="!selectionIds.length" @click="handleCancel()" icon="el-icon-edit">批量取消</el-button>
</template> </template>
<template #status="status"> <template #status="status">
@ -10,7 +11,7 @@
</cb-status-icon> </cb-status-icon>
</template> </template>
<template #operate="val, record"> <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> <el-button type="text" @click="handleCheck(record.id)"><i class="el-icon-setting"></i> 更新数据</el-button>
<div class="action-divider"></div> <div class="action-divider"></div>
<el-button type="text" @click="handleCancel(record.id)"><i class="el-icon-setting"></i> 取消更新</el-button> <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 { useTable, useSelection } from '@cmp/cmp-element'
import { getCategoryByModuleId, getRuleByModuleId } from 'services/index' import { getCategoryByModuleId, getRuleByModuleId } from 'services/index'
import { cloneDeep } from 'lodash-es' import { cloneDeep } from 'lodash-es'
import usePostion from '@/views/usePostion'
import AmsPosition from '@/views/AmsPosition.vue'
export default defineComponent({ export default defineComponent({
components: { AmsPosition },
setup(props, context) { setup(props, context) {
const { isLeaderPosition } = usePostion(() => {
getList()
})
const { list, total, params, loading, getList } = useTable({ const { list, total, params, loading, getList } = useTable({
getService: getHistory, getService: getHistory,
}) })
@ -179,6 +186,7 @@ export default defineComponent({
recordList, recordList,
updateId, updateId,
handleUpdate, handleUpdate,
isLeaderPosition,
} }
}, },
}) })

View File

@ -1,7 +1,8 @@
<template> <template>
<div> <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"> <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> <el-button type="primary" @click="handleCreate()" icon="el-icon-plus">新增</el-button>
</template> </template>
<template #name="val, record"> <template #name="val, record">
@ -13,10 +14,12 @@
</cb-status-icon> </cb-status-icon>
</template> </template>
<template #operate="val, record"> <template #operate="val, record">
<template v-if="isLeaderPosition">
<el-button type="text" @click="handleCreate(record)"><i class="el-icon-edit"></i> 编辑</el-button> <el-button type="text" @click="handleCreate(record)"><i class="el-icon-edit"></i> 编辑</el-button>
<div class="action-divider"></div> <div class="action-divider"></div>
<el-button type="text" @click="handleDelete(record)"><i class="el-icon-delete"></i> 删除</el-button> <el-button type="text" @click="handleDelete(record)"><i class="el-icon-delete"></i> 删除</el-button>
</template> </template>
</template>
</cb-advance-table> </cb-advance-table>
<!--新增编辑界面--> <!--新增编辑界面-->
<AddDialog :dialog="addDialog" v-if="addDialog.visible" @getData="getList"></AddDialog> <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 { defineComponent, ref } from 'vue'
import { Message, MessageBox } from 'element-ui' import { Message, MessageBox } from 'element-ui'
import { useTable } from '@cmp/cmp-element' import { useTable } from '@cmp/cmp-element'
import usePostion from '@/views/usePostion'
import AmsPosition from '@/views/AmsPosition.vue'
export default defineComponent({ export default defineComponent({
components: { AddDialog }, components: { AddDialog, AmsPosition },
setup(props, context) { setup(props, context) {
const { isLeaderPosition } = usePostion(() => {
getList()
})
const { list, total, params, handleDelete, loading, getList } = useTable({ const { list, total, params, handleDelete, loading, getList } = useTable({
getService: getRule, getService: getRule,
removeService: removeRule, removeService: removeRule,
@ -105,6 +112,7 @@ export default defineComponent({
detailVisible, detailVisible,
getDetail, getDetail,
goBack, 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> <template>
<el-card> <el-card>
<AmsPosition></AmsPosition>
<el-tabs v-model="activeName"> <el-tabs v-model="activeName">
<el-tab-pane label="操作审计" name="first"> <el-tab-pane label="操作审计" name="first">
<LogList :isLog="true" /> <LogList ref="ItemRef" v-if="activeName === 'first'" :isLog="true" />
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="备份列表" name="third"> <el-tab-pane label="备份列表" name="third">
<LogList :isLog="false" /> <LogList ref="ItemRef" v-if="activeName === 'third'" :isLog="false" />
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
</el-card> </el-card>
@ -21,12 +14,18 @@
<script lang="ts"> <script lang="ts">
import { defineComponent, reactive, ref } from 'vue' import { defineComponent, reactive, ref } from 'vue'
import LogList from './LogList.vue' import LogList from './LogList.vue'
import usePostion from '@/views/usePostion'
import AmsPosition from '@/views/AmsPosition.vue'
export default defineComponent({ export default defineComponent({
components: { LogList }, components: { LogList, AmsPosition },
setup(props, context) { setup(props, context) {
usePostion(() => {
ItemRef.value.getList()
})
const ItemRef = ref()
const activeName = ref('first') const activeName = ref('first')
return { return {
ItemRef,
activeName, activeName,
} }
}, },