fix: 选择子阵地时不可以操作

develop
时启龙 2024-08-28 19:08:06 +08:00
parent 3b1a339ab1
commit b54b169dad
18 changed files with 61 additions and 65 deletions

View File

@ -60,7 +60,7 @@ export default {
addStorageEvent('selectPostion', '')
}
}
// init()
init()
onUnmounted(() => {
// addStorageEvent('isLeaderPosition', '')
// addStorageEvent('selectPostion', '')

View File

@ -2,7 +2,7 @@
<div>
<data-dialog v-if="detailDialog.visible" :dialog="detailDialog" :isBackup="isBackup" :table-name="detailDialog.record.tableName"></data-dialog>
<cb-advance-table :card-border="false" :search-configs="searchConfigs" :data="list" :params="params" :columns="exampleColumns" :get-list="getList" :total="total" :loading="loading" ref="tableRef" @select="handleSelectItem" @select-all="handleSelectAll">
<template #action v-if="isLeaderPosition">
<template #action v-if="!selectPostion">
<el-button @click="handleUpdate('update')" icon="el-icon-edit" :disabled="!selectIds.length || !reconcile || isShow">批量更新</el-button>
<el-button @click="handleUpdate('cancel')" icon="el-icon-edit" :disabled="!selectIds.length || !reconcile || isShow">批量取消</el-button>
</template>
@ -59,7 +59,7 @@ export default defineComponent({
},
},
setup(props, context) {
const { isLeaderPosition } = usePosition()
const { selectPostion } = usePosition()
const searchConfigs = ref([{ value: 'type', type: 'Const', initValue: props.type }, { value: 'taskInstanceId', type: 'Const', initValue: props.id }, ...exampleSearchConfigs, { value: 'tableName', type: 'Const', initValue: props.tableName }])
const statusOptions = { RECONCILED: '未调和', SUCCESS: '执行成功', FAILED: '执行失败' }
const statusColor = { RECONCILED: 'primary', SUCCESS: 'success', FAILED: 'danger' }
@ -151,7 +151,7 @@ export default defineComponent({
getDetail,
getList,
handleUpdate,
isLeaderPosition,
selectPostion,
}
},
})

View File

@ -1,13 +1,13 @@
<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 v-if="isLeaderPosition">
<template #action v-if="!selectPostion">
<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">
<template v-if="!selectPostion">
<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>
@ -31,7 +31,7 @@ export default defineComponent({
},
},
setup(props, { emit }) {
const { isLeaderPosition } = usePostion()
const { selectPostion } = usePostion()
function listFormat(data) {
const res = data.map((item) => {
item.graph = JSON.parse(item.graph)
@ -90,7 +90,7 @@ export default defineComponent({
handleCreate,
refresh,
getDetail,
isLeaderPosition,
selectPostion,
}
},
})

View File

@ -1,14 +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 v-if="isLeaderPosition">
<template #action v-if="!selectPostion">
<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">
<template v-if="!selectPostion">
<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>
@ -59,7 +59,7 @@ export default defineComponent({
},
},
setup(props, context) {
const { isLeaderPosition } = usePostion()
const { selectPostion } = usePostion()
function listFormat(data) {
return data.map((item) => {
item.graph = JSON.parse(item.graph)
@ -151,7 +151,7 @@ export default defineComponent({
handleRun,
jumpRouter,
...toRefs(state),
isLeaderPosition,
selectPostion,
}
},
})

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 v-if="isLeaderPosition">
<template #action v-if="!selectPostion">
<el-button type="primary" @click="handleCreate({ title: '新增定时任务' })" icon="el-icon-plus">新增</el-button>
</template>
<template #name="name, record">
@ -13,7 +13,7 @@
</cb-status-icon>
</template>
<template #operate="val, record">
<template v-if="isLeaderPosition">
<template v-if="!selectPostion">
<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>
@ -69,7 +69,7 @@ export default defineComponent({
},
},
setup(props) {
const { isLeaderPosition } = usePostion()
const { selectPostion } = usePostion()
function listFormat(data) {
return data.map((item) => {
item.graph = JSON.parse(item.graph)
@ -148,7 +148,7 @@ export default defineComponent({
jumpRouter,
...toRefs(state),
statusFilter,
isLeaderPosition,
selectPostion,
}
},
})

View File

@ -2,7 +2,7 @@
<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 v-if="isLeaderPosition">
<template #action v-if="!selectPostion">
<el-button type="primary" :disabled="!selectionIds.length" @click="handleCancel()" icon="el-icon-edit">批量取消</el-button>
</template>
<template #status="status">
@ -58,7 +58,7 @@ import AmsPosition from '@/views/AmsPosition.vue'
export default defineComponent({
components: { AmsPosition },
setup(props, context) {
const { isLeaderPosition } = usePostion(() => {
const { selectPostion } = usePostion(() => {
getList()
})
const { list, total, params, loading, getList } = useTable({
@ -186,7 +186,7 @@ export default defineComponent({
recordList,
updateId,
handleUpdate,
isLeaderPosition,
selectPostion,
}
},
})

View File

@ -2,7 +2,7 @@
<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 v-if="isLeaderPosition">
<template #action v-if="!selectPostion">
<el-button type="primary" @click="handleCreate()" icon="el-icon-plus">新增</el-button>
</template>
<template #name="val, record">
@ -14,7 +14,7 @@
</cb-status-icon>
</template>
<template #operate="val, record">
<template v-if="isLeaderPosition">
<template v-if="!selectPostion">
<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>
@ -67,7 +67,7 @@ import AmsPosition from '@/views/AmsPosition.vue'
export default defineComponent({
components: { AddDialog, AmsPosition },
setup(props, context) {
const { isLeaderPosition } = usePostion(() => {
const { selectPostion } = usePostion(() => {
getList()
})
const { list, total, params, handleDelete, loading, getList } = useTable({
@ -112,7 +112,7 @@ export default defineComponent({
detailVisible,
getDetail,
goBack,
isLeaderPosition,
selectPostion,
}
},
})

View File

@ -2,11 +2,11 @@
<div>
<AmsPosition></AmsPosition>
<cb-advance-table ref="tableRef" title="属性列表" :search-configs="searchConfigs" :data="list" :params="params" :columns="columns" :get-list="getList" :total="total" :loading="loading">
<template #action v-if="isLeaderPosition">
<template #action v-if="!selectPostion">
<el-button type="primary" @click="handleCreate()" icon="el-icon-plus">新增</el-button>
</template>
<template #operate="val, record">
<template v-if="isLeaderPosition">
<template v-if="!selectPostion">
<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>
@ -28,7 +28,7 @@ import AmsPosition from '@/views/AmsPosition.vue'
export default defineComponent({
components: { AddDialog, AmsPosition },
setup() {
const { isLeaderPosition } = usePostion(() => getList())
const { selectPostion } = usePostion(() => getList())
const { list, total, params, handleDelete, loading, getList } = useTable({
getService: getPool,
removeService: removePool,
@ -60,7 +60,7 @@ export default defineComponent({
getList,
addDialog,
handleCreate,
isLeaderPosition,
selectPostion,
}
},
})

View File

@ -12,7 +12,7 @@
<div class="m-b-sm m-l-xs">配置模型</div>
<!-- 搜索区域 -->
<cb-table-search :configs="searchConfigs" :onSearch="handleSearch" class="service-search m-b-sm">
<template #operate v-if="isLeaderPosition">
<template #operate v-if="!selectPostion">
<el-button type="primary" icon="el-icon-plus" @click="handlCreate()"> </el-button>
</template>
</cb-table-search>
@ -28,7 +28,7 @@
</div>
</div>
<div class="card-remark">{{ row.remark || '暂无描述' }}</div>
<div class="card-footer" v-if="isLeaderPosition">
<div class="card-footer" v-if="!selectPostion">
<el-button type="text" class="operate" @click.stop="handlCreate(row)"> 编辑 </el-button>
<el-button type="text" class="operate" @click.stop="handleRemove(row)"> 删除 </el-button>
</div>
@ -92,12 +92,12 @@ export default {
},
setup() {
const instance = getCurrentInstance()
const { isLeaderPosition } = usePostion(() => {
const { selectPostion } = usePostion(() => {
instance.proxy.getList()
instance.proxy.$refs.treeRef.$refs.tree.loadGroups()
})
return {
isLeaderPosition,
selectPostion,
}
},
methods: {

View File

@ -1,6 +1,6 @@
<template>
<div>
<div class="operate-btn-group" v-if="isLeaderPosition">
<div class="operate-btn-group" v-if="!selectPostion">
<el-button class="w-ss" type="primary" @click="getProperties" v-if="!isEdit"> </el-button>
<el-button class="w-ss" type="primary" @click="saveModule" v-if="isEdit"> </el-button>
<el-button class="w-ss" type="ghost" @click="cancelModule" v-if="isEdit"> </el-button>
@ -102,7 +102,7 @@ export default {
attrHeight: [Number, String],
},
setup(props) {
const { isLeaderPosition } = usePosition()
const { selectPostion } = usePosition()
const state = reactive({
addData: {
dialog: false,
@ -391,7 +391,7 @@ export default {
getProperties,
cancelModule,
saveModule,
isLeaderPosition,
selectPostion,
}
},
}

View File

@ -5,7 +5,7 @@
<el-card class="group">
<div slot="header">
关系分组
<el-button v-if="isLeaderPosition" class="pull-right button-plus" type="text" @click="handleCreateGroup()" icon="el-icon-plus"></el-button>
<el-button v-if="!selectPostion" class="pull-right button-plus" type="text" @click="handleCreateGroup()" icon="el-icon-plus"></el-button>
</div>
<el-row>
<el-col :span="24">
@ -15,7 +15,7 @@
<span class="custom-tree-node-label">
{{ data.name }}
</span>
<span class="operate-btns" v-if="isLeaderPosition">
<span class="operate-btns" v-if="!selectPostion">
<dot-dropdown :data="data" @editNode="handleCreateGroup" @deleteNode="handleDelete" />
</span>
</div>
@ -57,7 +57,7 @@ import AmsPosition from '@/views/AmsPosition.vue'
export default defineComponent({
components: { DotDropdown, RelationList, AmsPosition },
setup() {
const { isLeaderPosition } = usePostion(() => {
const { selectPostion } = usePostion(() => {
getCategoryList()
})
const loading = ref(false)
@ -112,7 +112,7 @@ export default defineComponent({
handleDelete,
saveGroup,
listRef,
isLeaderPosition,
selectPostion,
}
},
})

View File

@ -1,11 +1,11 @@
<template>
<div>
<cb-advance-table ref="tableRef" title="关联类型" :search-configs="searchConfigs" :data="list" :params="params" :columns="columns" :get-list="getList" :total="total" :loading="loading">
<template #action v-if="isLeaderPosition">
<template #action v-if="!selectPostion">
<el-button type="primary" @click="handleCreate()" icon="el-icon-plus" :disabled="!categoryList.length">新增</el-button>
</template>
<template #operate="val, record">
<template v-if="isLeaderPosition">
<template v-if="!selectPostion">
<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>
@ -86,7 +86,7 @@ export default defineComponent({
},
},
setup() {
const { isLeaderPosition } = usePosition()
const { selectPostion } = usePosition()
const searchConfigs = ref(cloneDeep(searchConfig))
const { list, total, params, handleDelete, loading, getList } = useTable({
getService: getRelation,
@ -143,7 +143,7 @@ export default defineComponent({
handleSearch,
formRef,
save,
isLeaderPosition,
selectPostion,
}
},
})

View File

@ -2,7 +2,7 @@
<el-card class="leftC" shadow="never">
<div slot="header" class="side-header">
<el-input placeholder="输入关键字进行过滤" v-model="filterText" clearable> </el-input>
<el-tooltip content="添加模型分组" v-if="isLeaderPosition">
<el-tooltip content="添加模型分组" v-if="!selectPostion">
<i class="el-icon-plus cur-point m-l-xs" @click="handleCreateNode({ title: '新增根分组', operateType: 'create', isRoot: true, type: 'group' })"></i>
</el-tooltip>
</div>
@ -30,7 +30,7 @@ export default {
},
},
setup(props, { emit }) {
const { isLeaderPosition } = usePosition()
const { selectPostion } = usePosition()
const state = reactive({
addData: {
data: {},
@ -81,7 +81,7 @@ export default {
remove,
updateSuccess,
tree,
isLeaderPosition,
selectPostion,
}
},
}

View File

@ -1,7 +1,7 @@
<template>
<div>
<cb-advance-table :key="currentModule.id" v-if="!detailVisible" title="资源列表" :search-configs="searchConfigs" :data="list" :params="params" :columns="columns" :get-list="getList" :total="total" :loading="loading" @selection-change="handleSelectionChange">
<template #action v-if="isLeaderPosition">
<template #action v-if="!selectPostion">
<el-button type="primary" @click="handleCreate()" icon="el-icon-plus" :disabled="!currentModule.id">新增</el-button>
<ImportData url="/api/ams/v1/instances/upload" @getData="getList" template-url="/ams/v1/instances/download" :disabled="!currentModule.id" :params="{ moduleId: currentModule.id, moduleCode: currentModule.code, type: '2007' }"></ImportData>
<el-button @click="exportData" icon="el-icon-download" :disabled="!currentModule.id">导出</el-button>
@ -34,7 +34,7 @@
<span>{{ getMultileName(val, column.prop, propertyList) }}</span>
</template>
<template #operate="val, record" v-if="list.length">
<template v-if="isLeaderPosition">
<template v-if="!selectPostion">
<el-button type="text" @click="handleCreate(record)" :disabled="!record.authEdit"><i class="el-icon-edit"></i> 编辑</el-button>
<div class="action-divider"></div>
<el-button type="text" @click="handleDelete(record, { moduleCode: currentModule.code })" :disabled="!record.authDelete"><i class="el-icon-delete"></i> 删除</el-button>
@ -69,7 +69,7 @@ import usePosition from '@/views/usePosition'
export default defineComponent({
components: { AddDialog, DetailItem, ImportData, BatchEditDialog, TipDialog, AuthDialog },
setup(props, context) {
const { isLeaderPosition } = usePosition()
const { selectPostion } = usePosition()
const { list, total, params, handleDelete, loading, getList } = useTable({
getService: getInstance,
removeService: removeInstance,
@ -238,7 +238,7 @@ export default defineComponent({
tipDialog,
batchOperate,
authDialog,
isLeaderPosition,
selectPostion,
}
},
})

View File

@ -1,7 +1,7 @@
<template>
<div>
<cb-advance-table ref="tableRef" :card-border="false" :search-configs="searchConfigs" :data="list" :params="params" :columns="columns" :get-list="getList" :total="total" :loading="loading">
<template #action v-if="isLeaderPosition">
<template #action v-if="!selectPostion">
<el-button type="primary" @click="handleCreate()" icon="el-icon-plus">新增</el-button>
</template>
<template #operate="val, record">
@ -66,7 +66,7 @@ export default defineComponent({
},
},
setup(props) {
const { isLeaderPosition } = usePosition()
const { selectPostion } = usePosition()
const searchConfigs = reactive(cloneDeep(searchConfig))
searchConfigs[0].initValue = props.detailData.moduleId
searchConfigs[1].initValue = props.detailData.id
@ -111,7 +111,7 @@ export default defineComponent({
addDialog,
handleCreate,
handleDelete,
isLeaderPosition,
selectPostion,
}
},
})

View File

@ -2,14 +2,14 @@
<div>
<AmsPosition></AmsPosition>
<cb-advance-table title="拓扑列表" :search-configs="searchConfigs" :data="list" :params="params" :columns="columns" :get-list="getList" :total="total" :loading="loading">
<template #action v-if="isLeaderPosition">
<template #action v-if="!selectPostion">
<el-button type="primary" @click="handleCreate()" 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">
<template v-if="!selectPostion">
<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>
@ -36,7 +36,7 @@ export default defineComponent({
AmsPosition,
},
setup() {
const { isLeaderPosition } = usePostion(() => getList())
const { selectPostion } = usePostion(() => getList())
const { list, total, loading, getList, params, handleDelete } = useTable({
getService: getInstanceTopo,
removeService: removeInstanceTopo,
@ -88,7 +88,7 @@ export default defineComponent({
handleDelete,
getDetail,
...toRefs(state),
isLeaderPosition,
selectPostion,
}
},
})

View File

@ -2,14 +2,14 @@
<div>
<AmsPosition></AmsPosition>
<cb-advance-table title="拓扑列表" :search-configs="searchConfigs" :data="list" :params="params" :columns="columns" :get-list="getList" :total="total" :loading="loading">
<template #action v-if="isLeaderPosition">
<template #action v-if="!selectPostion">
<el-button type="primary" @click="handleCreate()" 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">
<template v-if="!selectPostion">
<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>
@ -36,7 +36,7 @@ export default defineComponent({
AmsPosition,
},
setup() {
const { isLeaderPosition } = usePostion(() => getList())
const { selectPostion } = usePostion(() => getList())
const { list, total, loading, getList, params, handleDelete } = useTable({
getService: getInstanceTopo,
removeService: removeInstanceTopo,
@ -88,7 +88,7 @@ export default defineComponent({
handleDelete,
getDetail,
...toRefs(state),
isLeaderPosition,
selectPostion,
}
},
})

View File

@ -1,13 +1,9 @@
import { onMounted, onUnmounted, ref, watch } from 'vue'
const usePostion = (cb?: Function) => {
const isLeaderPosition = ref(window.sessionStorage.getItem('isLeaderPosition') === 'true')
const selectPostion = ref(window.sessionStorage.getItem('selectPostion') || '')
const handleStorageEvent = (event) => {
if (event.key === 'isLeaderPosition') {
isLeaderPosition.value = event.newValue === 'true'
}
if (event.key === 'selectPostion') {
selectPostion.value = event.newValue
}
@ -21,7 +17,7 @@ const usePostion = (cb?: Function) => {
onUnmounted(() => window.removeEventListener('setItem', handleStorageEvent))
return {
isLeaderPosition,
selectPostion,
}
}
export const getSelectPosition = () => {