修复:原来的统一去了404, 现在加了403, 和部分bug
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 6m54s
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 6m54s
This commit is contained in:
@@ -95,18 +95,6 @@
|
||||
<span class="dialog-title">分配角色</span>
|
||||
<div class="account-info">
|
||||
<span class="account-name">{{ currentAccountName }}</span>
|
||||
<ElTag v-if="currentAccountType === 1" type="danger" size="small" style="margin-left: 8px">
|
||||
超级管理员不能分配角色
|
||||
</ElTag>
|
||||
<ElTag v-if="currentAccountType === 2" type="info" size="small" style="margin-left: 8px">
|
||||
平台用户只能分配一个平台角色
|
||||
</ElTag>
|
||||
<ElTag v-if="currentAccountType === 3" type="warning" size="small" style="margin-left: 8px">
|
||||
代理账号只能分配一个客户角色
|
||||
</ElTag>
|
||||
<ElTag v-if="currentAccountType === 4" type="warning" size="small" style="margin-left: 8px">
|
||||
企业账号只能分配一个客户角色
|
||||
</ElTag>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -67,6 +67,7 @@
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
@selection-change="handleSelectionChange"
|
||||
@row-contextmenu="handleRowContextMenu"
|
||||
>
|
||||
<template #default>
|
||||
<ElTableColumn type="selection" width="55" />
|
||||
@@ -106,7 +107,7 @@
|
||||
@selection-change="handleAvailableCardsSelectionChange"
|
||||
>
|
||||
<template #default>
|
||||
<ElTableColumn type="selection" width="55" />
|
||||
<ElTableColumn type="selection" width="55" :selectable="checkCardSelectable" />
|
||||
<ElTableColumn
|
||||
v-for="col in availableCardColumns"
|
||||
:key="col.prop || col.type"
|
||||
@@ -209,6 +210,14 @@
|
||||
</div>
|
||||
</template>
|
||||
</ElDialog>
|
||||
|
||||
<!-- 表格行操作右键菜单 -->
|
||||
<ArtMenuRight
|
||||
ref="cardOperationMenuRef"
|
||||
:menu-items="cardOperationMenuItems"
|
||||
:menu-width="140"
|
||||
@select="handleCardOperationMenuSelect"
|
||||
/>
|
||||
</ElCard>
|
||||
</div>
|
||||
</ArtTableFullScreen>
|
||||
@@ -224,6 +233,8 @@
|
||||
import { useCheckedColumns } from '@/composables/useCheckedColumns'
|
||||
import { useAuth } from '@/composables/useAuth'
|
||||
import { formatDateTime } from '@/utils/business/format'
|
||||
import ArtMenuRight from '@/components/core/others/ArtMenuRight.vue'
|
||||
import type { MenuItemType } from '@/components/core/others/ArtMenuRight.vue'
|
||||
import ArtButtonTable from '@/components/core/forms/ArtButtonTable.vue'
|
||||
import { BgColorEnum } from '@/enums/appEnum'
|
||||
import type {
|
||||
@@ -264,6 +275,11 @@
|
||||
const availableCardsLoading = ref(false)
|
||||
const availableCardsList = ref<StandaloneIotCard[]>([])
|
||||
const selectedAvailableCards = ref<StandaloneIotCard[]>([])
|
||||
const allocatedCardIccids = ref<Set<string>>(new Set())
|
||||
|
||||
// 右键菜单相关
|
||||
const cardOperationMenuRef = ref<InstanceType<typeof ArtMenuRight>>()
|
||||
const currentOperatingCard = ref<EnterpriseCardItem | null>(null)
|
||||
|
||||
// 卡搜索表单初始值
|
||||
const initialCardSearchState = {
|
||||
@@ -433,8 +449,7 @@
|
||||
{ label: '状态', prop: 'status' },
|
||||
{ label: '状态名称', prop: 'status_name' },
|
||||
{ label: '网络状态', prop: 'network_status' },
|
||||
{ label: '网络状态名称', prop: 'network_status_name' },
|
||||
{ label: '操作', prop: 'operation' }
|
||||
{ label: '网络状态名称', prop: 'network_status_name' }
|
||||
]
|
||||
|
||||
const cardList = ref<EnterpriseCardItem[]>([])
|
||||
@@ -540,41 +555,6 @@
|
||||
prop: 'network_status_name',
|
||||
label: '网络状态名称',
|
||||
width: 130
|
||||
},
|
||||
{
|
||||
prop: 'operation',
|
||||
label: '操作',
|
||||
width: 100,
|
||||
fixed: 'right',
|
||||
formatter: (row: EnterpriseCardItem) => {
|
||||
const buttons = []
|
||||
|
||||
if (row.network_status === 0) {
|
||||
// 停机状态,显示复机按钮
|
||||
if (hasAuth('enterprise_cards:resume')) {
|
||||
buttons.push(
|
||||
h(ArtButtonTable, {
|
||||
text: '复机',
|
||||
iconClass: BgColorEnum.SUCCESS,
|
||||
onClick: () => handleResume(row)
|
||||
})
|
||||
)
|
||||
}
|
||||
} else {
|
||||
// 开机状态,显示停机按钮
|
||||
if (hasAuth('enterprise_cards:suspend')) {
|
||||
buttons.push(
|
||||
h(ArtButtonTable, {
|
||||
text: '停机',
|
||||
iconClass: BgColorEnum.ERROR,
|
||||
onClick: () => handleSuspend(row)
|
||||
})
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
return h('div', { style: 'display: flex; gap: 8px;' }, buttons)
|
||||
}
|
||||
}
|
||||
])
|
||||
|
||||
@@ -849,10 +829,17 @@
|
||||
getAvailableCardsList()
|
||||
}
|
||||
|
||||
// 检查卡是否可选(已授权的卡不可选)
|
||||
const checkCardSelectable = (row: StandaloneIotCard) => {
|
||||
return !allocatedCardIccids.value.has(row.iccid)
|
||||
}
|
||||
|
||||
// 显示授权对话框
|
||||
const showAllocateDialog = () => {
|
||||
allocateDialogVisible.value = true
|
||||
selectedAvailableCards.value = []
|
||||
// 收集已授权的卡的ICCID
|
||||
allocatedCardIccids.value = new Set(cardList.value.map((card) => card.iccid))
|
||||
// 重置搜索条件
|
||||
Object.assign(cardSearchForm, { ...initialCardSearchState })
|
||||
cardPagination.page = 1
|
||||
@@ -954,6 +941,56 @@
|
||||
getTableData()
|
||||
}
|
||||
|
||||
// 右键菜单项配置
|
||||
const cardOperationMenuItems = computed((): MenuItemType[] => {
|
||||
const items: MenuItemType[] = []
|
||||
|
||||
if (!currentOperatingCard.value) return items
|
||||
|
||||
if (currentOperatingCard.value.network_status === 0) {
|
||||
// 停机状态 - 显示复机
|
||||
if (hasAuth('enterprise_cards:resume')) {
|
||||
items.push({
|
||||
key: 'resume',
|
||||
label: '复机'
|
||||
})
|
||||
}
|
||||
} else {
|
||||
// 开机状态 - 显示停机
|
||||
if (hasAuth('enterprise_cards:suspend')) {
|
||||
items.push({
|
||||
key: 'suspend',
|
||||
label: '停机'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return items
|
||||
})
|
||||
|
||||
// 处理右键菜单
|
||||
const handleRowContextMenu = (row: EnterpriseCardItem, column: any, event: MouseEvent) => {
|
||||
event.preventDefault()
|
||||
currentOperatingCard.value = row
|
||||
nextTick(() => {
|
||||
cardOperationMenuRef.value?.show(event)
|
||||
})
|
||||
}
|
||||
|
||||
// 处理菜单选择
|
||||
const handleCardOperationMenuSelect = (item: MenuItemType) => {
|
||||
if (!currentOperatingCard.value) return
|
||||
|
||||
switch (item.key) {
|
||||
case 'suspend':
|
||||
handleSuspend(currentOperatingCard.value)
|
||||
break
|
||||
case 'resume':
|
||||
handleResume(currentOperatingCard.value)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// 停机卡
|
||||
const handleSuspend = (row: EnterpriseCardItem) => {
|
||||
ElMessageBox.confirm('确定要停机该卡吗?', '停机卡', {
|
||||
|
||||
@@ -747,8 +747,7 @@
|
||||
// 查看客户账号
|
||||
const viewCustomerAccounts = (row: EnterpriseItem) => {
|
||||
router.push({
|
||||
name: 'EnterpriseCustomerAccounts',
|
||||
params: { id: row.id },
|
||||
path: `/account-management/enterprise-customer/customer-accounts/${row.id}`,
|
||||
query: { type: 'enterprise' }
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user