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', '') addStorageEvent('selectPostion', '')
} }
} }
// init() init()
onUnmounted(() => { onUnmounted(() => {
// addStorageEvent('isLeaderPosition', '') // addStorageEvent('isLeaderPosition', '')
// addStorageEvent('selectPostion', '') // addStorageEvent('selectPostion', '')

View File

@ -2,7 +2,7 @@
<div> <div>
<data-dialog v-if="detailDialog.visible" :dialog="detailDialog" :isBackup="isBackup" :table-name="detailDialog.record.tableName"></data-dialog> <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"> <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('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> <el-button @click="handleUpdate('cancel')" icon="el-icon-edit" :disabled="!selectIds.length || !reconcile || isShow">批量取消</el-button>
</template> </template>
@ -59,7 +59,7 @@ export default defineComponent({
}, },
}, },
setup(props, context) { 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 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 statusOptions = { RECONCILED: '未调和', SUCCESS: '执行成功', FAILED: '执行失败' }
const statusColor = { RECONCILED: 'primary', SUCCESS: 'success', FAILED: 'danger' } const statusColor = { RECONCILED: 'primary', SUCCESS: 'success', FAILED: 'danger' }
@ -151,7 +151,7 @@ export default defineComponent({
getDetail, getDetail,
getList, getList,
handleUpdate, handleUpdate,
isLeaderPosition, selectPostion,
} }
}, },
}) })

View File

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

View File

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

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 v-if="isLeaderPosition"> <template #action v-if="!selectPostion">
<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,7 +13,7 @@
</cb-status-icon> </cb-status-icon>
</template> </template>
<template #operate="val, record"> <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> <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>
@ -69,7 +69,7 @@ export default defineComponent({
}, },
}, },
setup(props) { setup(props) {
const { isLeaderPosition } = usePostion() const { selectPostion } = 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)
@ -148,7 +148,7 @@ export default defineComponent({
jumpRouter, jumpRouter,
...toRefs(state), ...toRefs(state),
statusFilter, statusFilter,
isLeaderPosition, selectPostion,
} }
}, },
}) })

View File

@ -2,7 +2,7 @@
<div> <div>
<AmsPosition></AmsPosition> <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 v-if="isLeaderPosition"> <template #action v-if="!selectPostion">
<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">
@ -58,7 +58,7 @@ import AmsPosition from '@/views/AmsPosition.vue'
export default defineComponent({ export default defineComponent({
components: { AmsPosition }, components: { AmsPosition },
setup(props, context) { setup(props, context) {
const { isLeaderPosition } = usePostion(() => { const { selectPostion } = usePostion(() => {
getList() getList()
}) })
const { list, total, params, loading, getList } = useTable({ const { list, total, params, loading, getList } = useTable({
@ -186,7 +186,7 @@ export default defineComponent({
recordList, recordList,
updateId, updateId,
handleUpdate, handleUpdate,
isLeaderPosition, selectPostion,
} }
}, },
}) })

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,7 +1,7 @@
<template> <template>
<div> <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"> <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> <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> <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> <el-button @click="exportData" icon="el-icon-download" :disabled="!currentModule.id">导出</el-button>
@ -34,7 +34,7 @@
<span>{{ getMultileName(val, column.prop, propertyList) }}</span> <span>{{ getMultileName(val, column.prop, propertyList) }}</span>
</template> </template>
<template #operate="val, record" v-if="list.length"> <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> <el-button type="text" @click="handleCreate(record)" :disabled="!record.authEdit"><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, { moduleCode: currentModule.code })" :disabled="!record.authDelete"><i class="el-icon-delete"></i> 删除</el-button> <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({ export default defineComponent({
components: { AddDialog, DetailItem, ImportData, BatchEditDialog, TipDialog, AuthDialog }, components: { AddDialog, DetailItem, ImportData, BatchEditDialog, TipDialog, AuthDialog },
setup(props, context) { setup(props, context) {
const { isLeaderPosition } = usePosition() const { selectPostion } = usePosition()
const { list, total, params, handleDelete, loading, getList } = useTable({ const { list, total, params, handleDelete, loading, getList } = useTable({
getService: getInstance, getService: getInstance,
removeService: removeInstance, removeService: removeInstance,
@ -238,7 +238,7 @@ export default defineComponent({
tipDialog, tipDialog,
batchOperate, batchOperate,
authDialog, authDialog,
isLeaderPosition, selectPostion,
} }
}, },
}) })

View File

@ -1,7 +1,7 @@
<template> <template>
<div> <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"> <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> <el-button type="primary" @click="handleCreate()" icon="el-icon-plus">新增</el-button>
</template> </template>
<template #operate="val, record"> <template #operate="val, record">
@ -66,7 +66,7 @@ export default defineComponent({
}, },
}, },
setup(props) { setup(props) {
const { isLeaderPosition } = usePosition() const { selectPostion } = usePosition()
const searchConfigs = reactive(cloneDeep(searchConfig)) const searchConfigs = reactive(cloneDeep(searchConfig))
searchConfigs[0].initValue = props.detailData.moduleId searchConfigs[0].initValue = props.detailData.moduleId
searchConfigs[1].initValue = props.detailData.id searchConfigs[1].initValue = props.detailData.id
@ -111,7 +111,7 @@ export default defineComponent({
addDialog, addDialog,
handleCreate, handleCreate,
handleDelete, handleDelete,
isLeaderPosition, selectPostion,
} }
}, },
}) })

View File

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

View File

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

View File

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