Commit a6c634b7 by 李宁

自己测试完成

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