+
+
{{ role.role_name }}
import { h } from 'vue'
+ import { useRoute } from 'vue-router'
import { FormInstance, ElSwitch, ElCheckbox, ElCheckboxGroup, ElTag } from 'element-plus'
import { ElMessageBox, ElMessage } from 'element-plus'
import type { FormRules } from 'element-plus'
@@ -130,6 +131,7 @@
defineOptions({ name: 'Account' }) // 定义组件名称,用于 KeepAlive 缓存控制
const { hasAuth } = useAuth()
+ const route = useRoute()
const dialogType = ref('add')
const dialogVisible = ref(false)
@@ -272,7 +274,7 @@
}
if (type === 'edit' && row) {
- formData.id = row.ID
+ formData.id = row.id
formData.username = row.username
formData.phone = row.phone
formData.user_type = row.user_type
@@ -295,7 +297,7 @@
})
.then(async () => {
try {
- await AccountService.deleteAccount(row.ID)
+ await AccountService.deleteAccount(row.id)
ElMessage.success('删除成功')
getAccountList()
} catch (error) {
@@ -425,6 +427,12 @@
})
onMounted(() => {
+ // 从 URL 查询参数中读取 shop_id
+ const shopIdParam = route.query.shop_id
+ if (shopIdParam) {
+ formFilters.shop_id = Number(shopIdParam)
+ }
+
getAccountList()
loadAllRoles()
loadShopList()
@@ -444,7 +452,7 @@
// 显示分配角色对话框
const showRoleDialog = async (row: any) => {
- currentAccountId.value = row.ID
+ currentAccountId.value = row.id
selectedRoles.value = []
try {
@@ -452,11 +460,11 @@
await loadAllRoles()
// 先加载当前账号的角色,再打开对话框
- const res = await AccountService.getAccountRoles(row.ID)
+ const res = await AccountService.getAccountRoles(row.id)
if (res.code === 0) {
// 提取角色ID数组
const roles = res.data || []
- selectedRoles.value = roles.map((role: any) => role.ID)
+ selectedRoles.value = roles.map((role: any) => role.id)
// 数据加载完成后再打开对话框
roleDialogVisible.value = true
}
@@ -582,7 +590,7 @@
// 先更新UI
row.status = newStatus
try {
- await AccountService.updateAccountStatus(row.ID, newStatus as 0 | 1)
+ await AccountService.updateAccountStatus(row.id, newStatus as 0 | 1)
ElMessage.success('状态切换成功')
} catch (error) {
// 切换失败,恢复原状态
diff --git a/src/views/account-management/enterprise-customer/index.vue b/src/views/account-management/enterprise-customer/index.vue
index 5abeb8e..beeaef1 100644
--- a/src/views/account-management/enterprise-customer/index.vue
+++ b/src/views/account-management/enterprise-customer/index.vue
@@ -168,12 +168,6 @@
-
-
-
@@ -199,6 +193,14 @@
+
+
+