fetch(modify):修改bug
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 5m45s

This commit is contained in:
sexygoat
2026-02-05 17:22:41 +08:00
parent d97dc5f007
commit b94c043a56
24 changed files with 2734 additions and 446 deletions

View File

@@ -168,12 +168,6 @@
</template>
</ElDialog>
<!-- 客户账号列表弹窗 -->
<CustomerAccountDialog
v-model="customerAccountDialogVisible"
:enterprise-id="currentEnterpriseId"
/>
<!-- 修改密码对话框 -->
<ElDialog v-model="passwordDialogVisible" title="修改密码" width="400px">
<ElForm ref="passwordFormRef" :model="passwordForm" :rules="passwordRules">
@@ -199,6 +193,14 @@
</div>
</template>
</ElDialog>
<!-- 企业客户操作右键菜单 -->
<ArtMenuRight
ref="enterpriseOperationMenuRef"
:menu-items="enterpriseOperationMenuItems"
:menu-width="140"
@select="handleEnterpriseOperationMenuSelect"
/>
</ElCard>
</div>
</ArtTableFullScreen>
@@ -215,9 +217,11 @@
import { useCheckedColumns } from '@/composables/useCheckedColumns'
import { useAuth } from '@/composables/useAuth'
import ArtButtonTable from '@/components/core/forms/ArtButtonTable.vue'
import CustomerAccountDialog from '@/components/business/CustomerAccountDialog.vue'
import ArtMenuRight from '@/components/core/others/ArtMenuRight.vue'
import type { MenuItemType } from '@/components/core/others/ArtMenuRight.vue'
import { formatDateTime } from '@/utils/business/format'
import { BgColorEnum } from '@/enums/appEnum'
import { RoutesAlias } from '@/router/routesAlias'
defineOptions({ name: 'EnterpriseCustomer' })
@@ -227,7 +231,6 @@
const dialogVisible = ref(false)
const passwordDialogVisible = ref(false)
const customerAccountDialogVisible = ref(false)
const loading = ref(false)
const submitLoading = ref(false)
const passwordSubmitLoading = ref(false)
@@ -236,6 +239,10 @@
const currentEnterpriseId = ref<number>(0)
const shopList = ref<ShopResponse[]>([])
// 右键菜单
const enterpriseOperationMenuRef = ref<InstanceType<typeof ArtMenuRight>>()
const currentOperatingEnterprise = ref<EnterpriseItem | null>(null)
// 搜索表单初始值
const initialSearchState = {
enterprise_name: '',
@@ -450,47 +457,30 @@
{
prop: 'operation',
label: '操作',
width: 340,
width: 200,
fixed: 'right',
formatter: (row: EnterpriseItem) => {
const buttons = []
if (hasAuth('enterprise_customer:edit')) {
buttons.push(
h(ArtButtonTable, {
text: '编辑',
iconClass: BgColorEnum.SECONDARY,
onClick: () => showDialog('edit', row)
})
)
}
if (hasAuth('enterprise_customer:look_customer')) {
buttons.push(
h(ArtButtonTable, {
text: '查看客户',
iconClass: BgColorEnum.PRIMARY,
onClick: () => viewCustomerAccounts(row)
})
)
}
if (hasAuth('enterprise_customer:card_authorization')) {
buttons.push(
h(ArtButtonTable, {
text: '卡授权',
iconClass: BgColorEnum.PRIMARY,
onClick: () => manageCards(row)
})
)
}
if (hasAuth('enterprise_customer:update_pwd')) {
// 只要有编辑、账号列表、修改密码权限之一,就显示更多操作按钮
if (
hasAuth('enterprise_customer:edit') ||
hasAuth('enterprise_customer:look_customer') ||
hasAuth('enterprise_customer:update_pwd')
) {
buttons.push(
h(ArtButtonTable, {
text: '修改密码',
iconClass: BgColorEnum.WARNING,
onClick: () => showPasswordDialog(row)
text: '更多操作',
onContextmenu: (e: MouseEvent) => showEnterpriseOperationMenu(e, row)
})
)
}
@@ -749,8 +739,11 @@
// 查看客户账号
const viewCustomerAccounts = (row: EnterpriseItem) => {
currentEnterpriseId.value = row.id
customerAccountDialogVisible.value = true
router.push({
name: 'EnterpriseCustomerAccounts',
params: { id: row.id },
query: { type: 'enterprise' }
})
}
// 卡管理
@@ -760,6 +753,59 @@
query: { id: row.id }
})
}
// 企业客户操作菜单项配置
const enterpriseOperationMenuItems = computed((): MenuItemType[] => {
const items: MenuItemType[] = []
if (hasAuth('enterprise_customer:look_customer')) {
items.push({
key: 'accountList',
label: '账号列表'
})
}
if (hasAuth('enterprise_customer:edit')) {
items.push({
key: 'edit',
label: '编辑'
})
}
if (hasAuth('enterprise_customer:update_pwd')) {
items.push({
key: 'updatePassword',
label: '修改密码'
})
}
return items
})
// 显示企业客户操作右键菜单
const showEnterpriseOperationMenu = (e: MouseEvent, row: EnterpriseItem) => {
e.preventDefault()
e.stopPropagation()
currentOperatingEnterprise.value = row
enterpriseOperationMenuRef.value?.show(e)
}
// 处理企业客户操作菜单选择
const handleEnterpriseOperationMenuSelect = (item: MenuItemType) => {
if (!currentOperatingEnterprise.value) return
switch (item.key) {
case 'accountList':
viewCustomerAccounts(currentOperatingEnterprise.value)
break
case 'edit':
showDialog('edit', currentOperatingEnterprise.value)
break
case 'updatePassword':
showPasswordDialog(currentOperatingEnterprise.value)
break
}
}
</script>
<style lang="scss" scoped>