Commit a6c634b7 by 李宁

自己测试完成

1 parent 723d1ec0
......@@ -4,7 +4,7 @@
<meta charset="UTF-8">
<link rel="icon" href="/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Vite App</title>
<title>商机办结登记</title>
</head>
<body>
<div id="app"></div>
......
......@@ -207,7 +207,7 @@
</div>
<template #footer>
<el-button type="primary" @click="submitExcelData">{{uploadResult.failed>0?'确定':'提交'}}</el-button>
<el-button type="primary" @click="submitExcelData">{{(uploadResult?.failed || 0)>0?'确定':'提交'}}</el-button>
</template>
</el-dialog>
</div>
......@@ -445,7 +445,7 @@ const handleFileChange = async (e: Event) => {
}
const submitExcelData = async ()=>{
if(uploadResult.value.failed > 0){
if((uploadResult.value?.failed || 0) > 0){
showUploadResult.value = false
return
}
......@@ -466,7 +466,7 @@ const submitExcelData = async ()=>{
}
}
const excelShowdData = ref([])
const excelShowdData = ref<any[]>([])
const processUploadData = (data: any[]) => {
const errors: string[] = []
let successCount = 0
......@@ -474,7 +474,7 @@ const processUploadData = (data: any[]) => {
excelShowdData.value = data
// 获取现有的业务代码集合
const existingCodes = new Set(props.rules.map(r => r.businessCode.toLowerCase()))
const existingCodes = new Set(props.rules.map((r: any) => r.businessCode?.toLowerCase?.() || ''))
data.forEach((row, index) => {
const rowNum = index + 3 // Excel行号(从1开始,跳过表头)
......
......@@ -192,9 +192,9 @@
>
<div class="text-left">
<p class="text-sm text-neutral-900 text-[14px] font-bold">{{ currentUser?.username || '管理员' }}</p>
<p class="text-xs text-neutral-500">
<!-- <p class="text-xs text-neutral-500">
{{ currentUser?.role === 'admin' ? '系统管理员' : '普通用户' }}
</p>
</p> -->
</div>
<ChevronDown :size="16" class="text-neutral-400" />
</el-button>
......@@ -235,9 +235,9 @@
<!-- 业务酬金管理页面 -->
<BusinessRulesManagement
v-else-if="activeView === 'business'"
:rules="businessRules"
@add="handleAddBusinessRule"
@update="handleUpdateBusinessRule"
:rules="businessRules as any"
@add="handleAddBusinessRule as any"
@update="handleUpdateBusinessRule as any"
@toggle-status="handleToggleBusinessRuleStatus"
@delete="handleDeleteBusinessRule"
/>
......@@ -245,7 +245,7 @@
<!-- 角色管理页面 -->
<RoleManagement
v-else-if="activeView === 'roles'"
:roles="roles"
:roles="roles as any"
:permissions="permissions"
@add-role="handleAddRole"
@update-role="handleUpdateRole"
......@@ -297,12 +297,14 @@ const platformLogo = ref(platformLogoImg)
const { $api } = getCurrentInstance()!.appContext.config.globalProperties
// 本地Role类型定义,确保permissions字段是必需的
interface Role {
id: number
id: string
roleName: string
status: 1 | 0
name: string
level: '地市级' | '区县级' | '一线人员'
status: '启用' | '禁用'
remark?: string
permissionIds?: string[]
permissions?: string[]
permissions: string[]
createTime?: string
}
interface DesktopMainProps {
......@@ -315,7 +317,7 @@ const isSidebarCollapsed = ref(false)
const activeMenu = ref<string>('orders') // 当前激活的菜单
const activeView = ref<string>('orders') // 当前显示的视图
const selectedOrderId = ref<string | null>(null) // 当前查看的订单ID
const selectedOrder = ref<{}>(null) // 当前查看的订单ID
const selectedOrder = ref<any>(null) // 当前查看的订单
const userInfo = ref(localStorage.getItem('pcUserInfo') ? JSON.parse(localStorage.getItem('pcUserInfo') as string) : {})
// 菜单配置
// const businessMenuItems = [
......@@ -386,6 +388,10 @@ const businessRules = ref<BusinessRule[]>([
businessName: '5G套餐办理',
estimatedReward: 50,
status: '生效中',
jobName: '5G套餐办理',
jobId: 'JOB001',
preMoney: 50,
totalPrice: 50,
createTime: '2025-10-20 10:00'
},
{
......@@ -394,6 +400,10 @@ const businessRules = ref<BusinessRule[]>([
businessName: '宽带新装',
estimatedReward: 80,
status: '生效中',
jobName: '宽带新装',
jobId: 'JOB002',
preMoney: 80,
totalPrice: 80,
createTime: '2025-10-20 10:05'
},
{
......@@ -402,6 +412,10 @@ const businessRules = ref<BusinessRule[]>([
businessName: '话费充值',
estimatedReward: 30,
status: '生效中',
jobName: '话费充值',
jobId: 'JOB003',
preMoney: 30,
totalPrice: 30,
createTime: '2025-10-20 10:10'
},
{
......@@ -410,6 +424,10 @@ const businessRules = ref<BusinessRule[]>([
businessName: '流量包办理',
estimatedReward: 40,
status: '已停用',
jobName: '流量包办理',
jobId: 'JOB004',
preMoney: 40,
totalPrice: 40,
createTime: '2025-10-20 10:15'
}
])
......@@ -426,6 +444,10 @@ interface BusinessRule {
estimatedReward: number
status: "生效中" | "已停用"
createTime: string
jobName: string
preMoney: number
jobId: string
totalPrice: number
}
interface Organization {
id: string
......@@ -537,7 +559,10 @@ const handleToggleBusinessRuleStatus = (ruleId: string) => {
if (rule) {
const currentStatus = rule.status
const newStatus = currentStatus === '生效中' ? '已停用' : '生效中'
rule.status = newStatus
businessRules.value[ruleIndex] = {
...rule,
status: newStatus
}
ElMessage.success(`业务规则已${newStatus === '生效中' ? '启用' : '停用'}`)
console.log('切换业务规则状态:', ruleId, newStatus)
}
......@@ -554,12 +579,12 @@ const handleDeleteBusinessRule = (ruleId: string) => {
// 角色管理方法
const handleAddRole = (roleData: any) => {
const newRole: Role = {
id: Date.now(),
id: String(Date.now()),
roleName: roleData.roleName || roleData.name || '',
name: roleData.name || roleData.roleName,
level: roleData.level,
description: roleData.description,
permissions: roleData.permissions || roleData.permissionIds || [],
status: 1,
status: '启用',
createTime: new Date().toLocaleString('zh-CN', {
year: 'numeric',
month: '2-digit',
......@@ -572,8 +597,8 @@ const handleAddRole = (roleData: any) => {
roles.value.push(newRole)
console.log('新增角色:', newRole)
}
const handleUpdateRole = (roleId: number, updates: any) => {
const roleIndex = roles.value.findIndex(role => role.id === roleId)
const handleUpdateRole = (roleId: string, updates: any) => {
const roleIndex = roles.value.findIndex((role: any) => String(role.id) === roleId)
if (roleIndex !== -1) {
const existingRole = roles.value[roleIndex]
if (existingRole) {
......
......@@ -347,6 +347,8 @@ interface Order {
chinaPersonName: string
customerPhone: string
job: string
jobName?: string
memo?: string
createTime: string
status: status
auditStatus?: auditStatus
......@@ -398,7 +400,7 @@ onMounted(()=>{
queryLog()
})
const logData = ref([])
const logData = ref<any[]>([])
const queryLog = async ()=>{
try {
const response = await $api.queryOrderLog({
......@@ -406,7 +408,7 @@ const queryLog = async ()=>{
})
if (response.c === 0) {
response.d.forEach(item=>{
response.d.forEach((item: any)=>{
item.detail = JSON.parse(item.parameter)
})
......
......@@ -116,6 +116,8 @@
</div>
<el-switch
v-model="roleStatusEnabled"
active-text="开启"
inactive-text="关闭"
/>
</div>
</div>
......@@ -126,13 +128,13 @@
<label class="block text-sm font-medium text-neutral-900">
权限选择 <span class="text-red-500">*</span>
</label>
<el-tag
<!-- <el-tag
type="primary"
effect="plain"
class="bg-brand-primary/10 text-brand-primary border-brand-primary"
>
已选择 {{ selectedPermissions.length }} 个权限
</el-tag>
</el-tag> -->
</div>
<div class="border border-neutral-300 rounded p-4 bg-neutral-50 max-h-96 overflow-y-auto">
......@@ -214,6 +216,7 @@ export interface Permission {
export interface Role {
id: Number
name: string
roleName?: string
level: '地市级' | '区县级' | '一线人员'
status: RoleStatus
remark?: string
......@@ -313,7 +316,7 @@ const handleOpenAddDialog = () => {
// 打开编辑对话框
const handleOpenEditDialog = async (role: Role) => {
editingRole.value = role
roleName.value = role.roleName
roleName.value = role.roleName || ''
roleDescription.value = role.remark || ''
roleStatusEnabled.value = role.status === 1
......
<script setup lang="ts">
import WelcomeItem from './WelcomeItem.vue'
// import WelcomeItem from './WelcomeItem.vue' // 文件不存在,暂时注释
import DocumentationIcon from './icons/IconDocumentation.vue'
import ToolingIcon from './icons/IconTooling.vue'
import EcosystemIcon from './icons/IconEcosystem.vue'
......
......@@ -248,6 +248,8 @@
</div>
<el-switch
v-model="formData.isActive"
active-text=""
inactive-text="按年付费"
/>
</div>
</div>
......@@ -271,7 +273,7 @@
:role-id="formData.roleId"
:roles="roles"
:expanded-ids="organizationExpandedIds"
:account-type="formData.accountType"
:account-type="formData.accountType as any "
@select="handleOrganizationSelect"
@toggle-expand="handleToggleExpand"
/>
......@@ -304,10 +306,12 @@
</div>
</div>
</div>
<template #footer>
<el-button @click="isDialogOpen = false">取消</el-button>
<el-button type="primary" @click="handleSave">确定</el-button>
</template>
</el-dialog>
</div>
</template>
......@@ -324,7 +328,7 @@ export interface User {
realName: string
organizationId: string
roleId: string
accountType?: '1' | '2' | '3'
accountType?: string
phone?: string
email?: string
status: '1' | '0',
......@@ -368,7 +372,7 @@ const userNameSearch = ref('')
const phoneSearch = ref('')
const codeSearch = ref('')
const roleFilter = ref<string>('all')
const accountTypeFilter = ref<'' | '1' | '2' | '3'>('')
const accountTypeFilter = ref<string>('')
const statusFilter = ref<'' | '1' | '0'>('')
const organizationFilter = ref<string>('')
const organizationExpandedIds = ref(new Set<string>())
......@@ -377,7 +381,7 @@ const formData = ref({
username: '',
realName: '',
phone: '',
accountType: '',
accountType: '1',
organizationId: '',
roleId: '',
isActive: true
......@@ -524,16 +528,6 @@ const handleOpenEditDialog = (row: any) => {
const handleAccountTypeChange = () => {
// 当账号类型变更时,清空组织选择
formData.value.organizationId = ''
// 根据账号类型设置组织选择的层级限制
const accountType = formData.value.accountType
if (accountType === '地市级') {
ElMessage.info('账号类型为地市级,所属组织只能选择地市级')
} else if (accountType === '区县级') {
ElMessage.info('账号类型为区县级,所属组织只能选择区县级')
} else if (accountType === '一线人员') {
ElMessage.info('账号类型为一线人员,所属组织只能选择客户经理团队')
}
}
const handleRoleChange = () => {
// 角色变更时不进行层级检查
......@@ -580,25 +574,6 @@ const expandToOrganization = (targetOrgId: string) => {
console.warn('未找到目标组织:', targetOrgId)
}
}
const isOrganizationSelectable = (orgType: string, roleId: string): boolean => {
// 只根据账号类型进行组织层级限制,不根据角色层级限制
const accountType = formData.value.accountType
switch (accountType) {
case '地市级':
// 地市级只能选择地市级组织
return orgType === '地市'
case '区县级':
// 区县级只能选择区县级组织
return orgType === '区县'
case '一线人员':
// 一线人员只能选择客户经理团队
return orgType === '客户经理团队'
default:
// 如果没有选择账号类型,可以选择所有组织
return true
}
}
const handleSave = async () => {
// 表单验证
if (!formData.value.username.trim()) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!