综述: 为菜市场新增功能添加权限配置模块
- 在新增菜市场模态框中,在经营者信息下方增加权限配置区域,支持树形结构展示和选择权限 - 新增权限树相关样式,包括节点展开/收起、选中状态、悬停效果、滚动条美化等 - 实现完整的权限管理逻辑: * 支持树形结构动态构建,包含菜市场管理、摊位管理、商品管理、订单管理、财务管理等模块 * 选中子权限时自动选中所有父级权限 * 选中父权限时自动选中所有子权限 * 取消选择时智能处理父子权限联动关系 - 在表单提交时包含权限数据验证和收集,未选择权限时给予友好提示 - 关闭模态框时自动重置权限选择状态 - 修复展开按钮点击导致弹窗关闭的问题,设置按钮类型为button并阻止默认行为
This commit is contained in:
		
							parent
							
								
									671da5d9e7
								
							
						
					
					
						commit
						251be8fd4f
					
				|  | @ -486,6 +486,114 @@ | ||||||
|         .hidden { |         .hidden { | ||||||
|             display: none !important; |             display: none !important; | ||||||
|         } |         } | ||||||
|  | 
 | ||||||
|  |         /* 权限配置样式 */ | ||||||
|  |         .permissions-container { | ||||||
|  |             max-height: 400px; | ||||||
|  |             overflow-y: auto; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         .permission-tree { | ||||||
|  |             list-style: none; | ||||||
|  |             padding: 0; | ||||||
|  |             margin: 0; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         .permission-item { | ||||||
|  |             margin-bottom: 8px; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         .permission-node { | ||||||
|  |             display: flex; | ||||||
|  |             align-items: center; | ||||||
|  |             padding: 10px 12px; | ||||||
|  |             border-radius: 4px; | ||||||
|  |             transition: all 0.3s; | ||||||
|  |             cursor: pointer; | ||||||
|  |             background-color: #fafafa; | ||||||
|  |             border: 1px solid #ebeef5; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         .permission-node:hover { | ||||||
|  |             background-color: #f0f7ff; | ||||||
|  |             border-color: #409eff; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         .permission-node.selected { | ||||||
|  |             background-color: #e6f4ff; | ||||||
|  |             border-color: #409eff; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         .permission-checkbox { | ||||||
|  |             margin-right: 10px; | ||||||
|  |             width: 16px; | ||||||
|  |             height: 16px; | ||||||
|  |             cursor: pointer; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         .expand-btn { | ||||||
|  |             background: none; | ||||||
|  |             border: none; | ||||||
|  |             cursor: pointer; | ||||||
|  |             padding: 2px; | ||||||
|  |             margin-right: 8px; | ||||||
|  |             color: #409eff; | ||||||
|  |             font-size: 12px; | ||||||
|  |             transition: all 0.3s; | ||||||
|  |             min-width: 20px; | ||||||
|  |             border-radius: 3px; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         .expand-btn:hover { | ||||||
|  |             background: #e6f4ff; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         .expand-btn.collapsed { | ||||||
|  |             transform: rotate(-90deg); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         .permission-label { | ||||||
|  |             font-size: 14px; | ||||||
|  |             color: #606266; | ||||||
|  |             user-select: none; | ||||||
|  |             flex: 1; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         .permission-children { | ||||||
|  |             margin-left: 32px; | ||||||
|  |             margin-top: 8px; | ||||||
|  |             border-left: 2px solid #e6f4ff; | ||||||
|  |             padding-left: 12px; | ||||||
|  |             display: none; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         .permission-children.expanded { | ||||||
|  |             display: block; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         .permission-item.parent > .permission-node { | ||||||
|  |             background-color: #f5f7fa; | ||||||
|  |             font-weight: 500; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         /* 权限容器滚动条样式 */ | ||||||
|  |         .permissions-container::-webkit-scrollbar { | ||||||
|  |             width: 6px; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         .permissions-container::-webkit-scrollbar-track { | ||||||
|  |             background: #f5f7fa; | ||||||
|  |             border-radius: 3px; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         .permissions-container::-webkit-scrollbar-thumb { | ||||||
|  |             background: #dcdfe6; | ||||||
|  |             border-radius: 3px; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         .permissions-container::-webkit-scrollbar-thumb:hover { | ||||||
|  |             background: #c0c4cc; | ||||||
|  |         } | ||||||
|     </style> |     </style> | ||||||
| </head> | </head> | ||||||
| <body> | <body> | ||||||
|  | @ -728,6 +836,18 @@ | ||||||
|                         </div> |                         </div> | ||||||
|                     </div> |                     </div> | ||||||
| 
 | 
 | ||||||
|  |                     <!-- 权限配置 --> | ||||||
|  |                     <div class="form-section"> | ||||||
|  |                         <div class="form-section-title">权限配置</div> | ||||||
|  |                         <div class="form-group" style="display: block;"> | ||||||
|  |                             <div class="permissions-container" style="max-height: 400px; overflow-y: auto; border: 1px solid #ebeef5; border-radius: 4px; padding: 15px;"> | ||||||
|  |                                 <ul id="permissionTree" class="permission-tree"> | ||||||
|  |                                     <!-- 权限树将通过JavaScript动态生成 --> | ||||||
|  |                                 </ul> | ||||||
|  |                             </div> | ||||||
|  |                         </div> | ||||||
|  |                     </div> | ||||||
|  | 
 | ||||||
|                     <!-- 基础配置 --> |                     <!-- 基础配置 --> | ||||||
|                     <div class="form-section"> |                     <div class="form-section"> | ||||||
|                         <div class="form-section-title">基础配置</div> |                         <div class="form-section-title">基础配置</div> | ||||||
|  | @ -911,6 +1031,116 @@ | ||||||
|     </div> |     </div> | ||||||
| 
 | 
 | ||||||
|     <script> |     <script> | ||||||
|  |         // 权限数据 | ||||||
|  |         const permissions = [ | ||||||
|  |             { | ||||||
|  |                 id: 1, | ||||||
|  |                 code: 'MARKET_MANAGE', | ||||||
|  |                 name: '菜市场管理', | ||||||
|  |                 description: '菜市场管理模块', | ||||||
|  |                 parentCode: '', | ||||||
|  |                 type: 'menu' | ||||||
|  |             }, | ||||||
|  |             { | ||||||
|  |                 id: 2, | ||||||
|  |                 code: 'MARKET_BOOTH', | ||||||
|  |                 name: '摊位管理', | ||||||
|  |                 description: '摊位管理功能', | ||||||
|  |                 parentCode: 'MARKET_MANAGE', | ||||||
|  |                 type: 'menu' | ||||||
|  |             }, | ||||||
|  |             { | ||||||
|  |                 id: 3, | ||||||
|  |                 code: 'MARKET_BOOTH_ADD', | ||||||
|  |                 name: '添加摊位', | ||||||
|  |                 description: '添加新摊位按钮', | ||||||
|  |                 parentCode: 'MARKET_BOOTH', | ||||||
|  |                 type: 'button' | ||||||
|  |             }, | ||||||
|  |             { | ||||||
|  |                 id: 4, | ||||||
|  |                 code: 'MARKET_BOOTH_EDIT', | ||||||
|  |                 name: '编辑摊位', | ||||||
|  |                 description: '编辑摊位信息按钮', | ||||||
|  |                 parentCode: 'MARKET_BOOTH', | ||||||
|  |                 type: 'button' | ||||||
|  |             }, | ||||||
|  |             { | ||||||
|  |                 id: 5, | ||||||
|  |                 code: 'MARKET_BOOTH_DELETE', | ||||||
|  |                 name: '删除摊位', | ||||||
|  |                 description: '删除摊位按钮', | ||||||
|  |                 parentCode: 'MARKET_BOOTH', | ||||||
|  |                 type: 'button' | ||||||
|  |             }, | ||||||
|  |             { | ||||||
|  |                 id: 6, | ||||||
|  |                 code: 'MARKET_GOODS', | ||||||
|  |                 name: '商品管理', | ||||||
|  |                 description: '商品管理功能', | ||||||
|  |                 parentCode: 'MARKET_MANAGE', | ||||||
|  |                 type: 'menu' | ||||||
|  |             }, | ||||||
|  |             { | ||||||
|  |                 id: 7, | ||||||
|  |                 code: 'MARKET_GOODS_ADD', | ||||||
|  |                 name: '添加商品', | ||||||
|  |                 description: '添加新商品按钮', | ||||||
|  |                 parentCode: 'MARKET_GOODS', | ||||||
|  |                 type: 'button' | ||||||
|  |             }, | ||||||
|  |             { | ||||||
|  |                 id: 8, | ||||||
|  |                 code: 'MARKET_GOODS_EDIT', | ||||||
|  |                 name: '编辑商品', | ||||||
|  |                 description: '编辑商品信息按钮', | ||||||
|  |                 parentCode: 'MARKET_GOODS', | ||||||
|  |                 type: 'button' | ||||||
|  |             }, | ||||||
|  |             { | ||||||
|  |                 id: 9, | ||||||
|  |                 code: 'ORDER_MANAGE', | ||||||
|  |                 name: '订单管理', | ||||||
|  |                 description: '订单管理模块', | ||||||
|  |                 parentCode: '', | ||||||
|  |                 type: 'menu' | ||||||
|  |             }, | ||||||
|  |             { | ||||||
|  |                 id: 10, | ||||||
|  |                 code: 'ORDER_VIEW', | ||||||
|  |                 name: '查看订单', | ||||||
|  |                 description: '查看订单功能', | ||||||
|  |                 parentCode: 'ORDER_MANAGE', | ||||||
|  |                 type: 'menu' | ||||||
|  |             }, | ||||||
|  |             { | ||||||
|  |                 id: 11, | ||||||
|  |                 code: 'ORDER_PROCESS', | ||||||
|  |                 name: '处理订单', | ||||||
|  |                 description: '处理订单按钮', | ||||||
|  |                 parentCode: 'ORDER_MANAGE', | ||||||
|  |                 type: 'button' | ||||||
|  |             }, | ||||||
|  |             { | ||||||
|  |                 id: 12, | ||||||
|  |                 code: 'FINANCE_MANAGE', | ||||||
|  |                 name: '财务管理', | ||||||
|  |                 description: '财务管理模块', | ||||||
|  |                 parentCode: '', | ||||||
|  |                 type: 'menu' | ||||||
|  |             }, | ||||||
|  |             { | ||||||
|  |                 id: 13, | ||||||
|  |                 code: 'FINANCE_VIEW', | ||||||
|  |                 name: '查看财务', | ||||||
|  |                 description: '查看财务数据', | ||||||
|  |                 parentCode: 'FINANCE_MANAGE', | ||||||
|  |                 type: 'menu' | ||||||
|  |             } | ||||||
|  |         ]; | ||||||
|  | 
 | ||||||
|  |         let selectedPermissions = new Set(); | ||||||
|  | 
 | ||||||
|         // 验证码倒计时 |         // 验证码倒计时 | ||||||
|         let countdown = 0; |         let countdown = 0; | ||||||
|         let countdownTimer = null; |         let countdownTimer = null; | ||||||
|  | @ -1005,6 +1235,214 @@ | ||||||
|                 document.getElementById('sendCodeBtn').disabled = false; |                 document.getElementById('sendCodeBtn').disabled = false; | ||||||
|                 document.getElementById('sendCodeBtn').textContent = '发送验证码'; |                 document.getElementById('sendCodeBtn').textContent = '发送验证码'; | ||||||
|             } |             } | ||||||
|  |             // 初始化权限树 | ||||||
|  |             initPermissionTree(); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         // 初始化权限树 | ||||||
|  |         function initPermissionTree() { | ||||||
|  |             const tree = buildPermissionTree(permissions); | ||||||
|  |             const treeContainer = document.getElementById('permissionTree'); | ||||||
|  |             treeContainer.innerHTML = ''; | ||||||
|  | 
 | ||||||
|  |             tree.forEach(item => { | ||||||
|  |                 treeContainer.appendChild(createPermissionNode(item)); | ||||||
|  |             }); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         // 构建权限树 | ||||||
|  |         function buildPermissionTree(data) { | ||||||
|  |             const map = {}; | ||||||
|  |             const roots = []; | ||||||
|  | 
 | ||||||
|  |             // 创建映射 | ||||||
|  |             data.forEach(item => { | ||||||
|  |                 map[item.code] = { ...item, children: [] }; | ||||||
|  |             }); | ||||||
|  | 
 | ||||||
|  |             // 构建树结构 | ||||||
|  |             data.forEach(item => { | ||||||
|  |                 if (item.parentCode && map[item.parentCode]) { | ||||||
|  |                     map[item.parentCode].children.push(map[item.code]); | ||||||
|  |                 } else { | ||||||
|  |                     roots.push(map[item.code]); | ||||||
|  |                 } | ||||||
|  |             }); | ||||||
|  | 
 | ||||||
|  |             return roots; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         // 创建权限节点 | ||||||
|  |         function createPermissionNode(item) { | ||||||
|  |             const li = document.createElement('li'); | ||||||
|  |             li.className = 'permission-item ' + (item.children.length > 0 ? 'parent' : 'child'); | ||||||
|  | 
 | ||||||
|  |             const nodeDiv = document.createElement('div'); | ||||||
|  |             nodeDiv.className = 'permission-node'; | ||||||
|  | 
 | ||||||
|  |             // 展开/收起按钮 | ||||||
|  |             if (item.children.length > 0) { | ||||||
|  |                 const expandBtn = document.createElement('button'); | ||||||
|  |                 expandBtn.className = 'expand-btn'; | ||||||
|  |                 expandBtn.type = 'button'; // 防止触发表单提交 | ||||||
|  |                 expandBtn.textContent = '▼'; | ||||||
|  |                 expandBtn.onclick = (e) => { | ||||||
|  |                     e.preventDefault(); | ||||||
|  |                     e.stopPropagation(); | ||||||
|  |                     togglePermissionChildren(expandBtn, li); | ||||||
|  |                 }; | ||||||
|  |                 nodeDiv.appendChild(expandBtn); | ||||||
|  |             } else { | ||||||
|  |                 // 占位符保持对齐 | ||||||
|  |                 const placeholder = document.createElement('span'); | ||||||
|  |                 placeholder.style.width = '20px'; | ||||||
|  |                 placeholder.style.display = 'inline-block'; | ||||||
|  |                 nodeDiv.appendChild(placeholder); | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |             // 复选框 | ||||||
|  |             const checkbox = document.createElement('input'); | ||||||
|  |             checkbox.type = 'checkbox'; | ||||||
|  |             checkbox.className = 'permission-checkbox'; | ||||||
|  |             checkbox.dataset.permissionCode = item.code; | ||||||
|  |             checkbox.onchange = (e) => handlePermissionChange(e, item); | ||||||
|  |             nodeDiv.appendChild(checkbox); | ||||||
|  | 
 | ||||||
|  |             // 权限标签 | ||||||
|  |             const label = document.createElement('span'); | ||||||
|  |             label.className = 'permission-label'; | ||||||
|  |             label.textContent = `${item.name} (${item.description || item.code})`; | ||||||
|  |             label.onclick = () => checkbox.click(); | ||||||
|  |             nodeDiv.appendChild(label); | ||||||
|  | 
 | ||||||
|  |             li.appendChild(nodeDiv); | ||||||
|  | 
 | ||||||
|  |             // 子权限 | ||||||
|  |             if (item.children.length > 0) { | ||||||
|  |                 const childrenContainer = document.createElement('ul'); | ||||||
|  |                 childrenContainer.className = 'permission-children'; | ||||||
|  | 
 | ||||||
|  |                 item.children.forEach(child => { | ||||||
|  |                     childrenContainer.appendChild(createPermissionNode(child)); | ||||||
|  |                 }); | ||||||
|  | 
 | ||||||
|  |                 li.appendChild(childrenContainer); | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |             return li; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         // 切换权限子节点显示 | ||||||
|  |         function togglePermissionChildren(btn, li) { | ||||||
|  |             const children = li.querySelector('.permission-children'); | ||||||
|  |             if (!children) return; | ||||||
|  | 
 | ||||||
|  |             const isExpanded = children.classList.contains('expanded'); | ||||||
|  |             children.classList.toggle('expanded'); | ||||||
|  |             btn.textContent = isExpanded ? '▶' : '▼'; | ||||||
|  |             btn.classList.toggle('collapsed', isExpanded); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         // 处理权限选择变化 | ||||||
|  |         function handlePermissionChange(event, permission) { | ||||||
|  |             const checkbox = event.target; | ||||||
|  |             const isChecked = checkbox.checked; | ||||||
|  |             const permissionCode = permission.code; | ||||||
|  |             const node = checkbox.closest('.permission-node'); | ||||||
|  | 
 | ||||||
|  |             // 更新节点选中样式 | ||||||
|  |             if (node) { | ||||||
|  |                 node.classList.toggle('selected', isChecked); | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |             if (isChecked) { | ||||||
|  |                 selectedPermissions.add(permissionCode); | ||||||
|  |                 // 选中子级权限时,自动选中所有父级权限 | ||||||
|  |                 selectParentPermissions(permission); | ||||||
|  |                 // 如果是父权限,自动选中所有子权限 | ||||||
|  |                 if (permission.children && permission.children.length > 0) { | ||||||
|  |                     selectChildrenPermissions(permission, true); | ||||||
|  |                 } | ||||||
|  |             } else { | ||||||
|  |                 selectedPermissions.delete(permissionCode); | ||||||
|  |                 // 如果是父权限,自动取消所有子权限 | ||||||
|  |                 if (permission.children && permission.children.length > 0) { | ||||||
|  |                     selectChildrenPermissions(permission, false); | ||||||
|  |                 } | ||||||
|  |                 // 如果是子权限,检查是否需要取消父权限 | ||||||
|  |                 uncheckParentIfNeeded(permission); | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |             console.log('已选择权限:', Array.from(selectedPermissions)); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         // 选择所有父级权限 | ||||||
|  |         function selectParentPermissions(permission) { | ||||||
|  |             if (!permission.parentCode) return; | ||||||
|  | 
 | ||||||
|  |             // 查找父权限 | ||||||
|  |             const parent = permissions.find(p => p.code === permission.parentCode); | ||||||
|  |             if (!parent) return; | ||||||
|  | 
 | ||||||
|  |             // 选中父权限 | ||||||
|  |             const parentCheckbox = document.querySelector(`[data-permission-code="${parent.code}"]`); | ||||||
|  |             if (parentCheckbox && !parentCheckbox.checked) { | ||||||
|  |                 parentCheckbox.checked = true; | ||||||
|  |                 selectedPermissions.add(parent.code); | ||||||
|  |                 const parentNode = parentCheckbox.closest('.permission-node'); | ||||||
|  |                 if (parentNode) parentNode.classList.add('selected'); | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |             // 递归选中上级父权限 | ||||||
|  |             selectParentPermissions(parent); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         // 选择/取消子权限 | ||||||
|  |         function selectChildrenPermissions(parent, select) { | ||||||
|  |             if (!parent.children) return; | ||||||
|  | 
 | ||||||
|  |             parent.children.forEach(child => { | ||||||
|  |                 const childCheckbox = document.querySelector(`[data-permission-code="${child.code}"]`); | ||||||
|  |                 if (childCheckbox) { | ||||||
|  |                     childCheckbox.checked = select; | ||||||
|  |                     const childNode = childCheckbox.closest('.permission-node'); | ||||||
|  |                     if (childNode) childNode.classList.toggle('selected', select); | ||||||
|  | 
 | ||||||
|  |                     if (select) { | ||||||
|  |                         selectedPermissions.add(child.code); | ||||||
|  |                     } else { | ||||||
|  |                         selectedPermissions.delete(child.code); | ||||||
|  |                     } | ||||||
|  | 
 | ||||||
|  |                     // 递归处理子权限 | ||||||
|  |                     selectChildrenPermissions(child, select); | ||||||
|  |                 } | ||||||
|  |             }); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         // 检查是否需要取消父权限选择 | ||||||
|  |         function uncheckParentIfNeeded(permission) { | ||||||
|  |             if (!permission.parentCode) return; | ||||||
|  | 
 | ||||||
|  |             // 查找父权限 | ||||||
|  |             const parent = permissions.find(p => p.code === permission.parentCode); | ||||||
|  |             if (!parent) return; | ||||||
|  | 
 | ||||||
|  |             // 检查父权限的所有子权限是否都未选中 | ||||||
|  |             const siblings = permissions.filter(p => p.parentCode === parent.code); | ||||||
|  |             const hasSelectedSibling = siblings.some(sibling => selectedPermissions.has(sibling.code)); | ||||||
|  | 
 | ||||||
|  |             if (!hasSelectedSibling) { | ||||||
|  |                 const parentCheckbox = document.querySelector(`[data-permission-code="${parent.code}"]`); | ||||||
|  |                 if (parentCheckbox) { | ||||||
|  |                     parentCheckbox.checked = false; | ||||||
|  |                     selectedPermissions.delete(parent.code); | ||||||
|  |                     const parentNode = parentCheckbox.closest('.permission-node'); | ||||||
|  |                     if (parentNode) parentNode.classList.remove('selected'); | ||||||
|  |                     // 递归检查上级父权限 | ||||||
|  |                     uncheckParentIfNeeded(parent); | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         // 关闭模态框 |         // 关闭模态框 | ||||||
|  | @ -1022,6 +1460,14 @@ | ||||||
|             document.getElementById('locationLng').value = ''; |             document.getElementById('locationLng').value = ''; | ||||||
|             document.getElementById('selectedLocationText').textContent = '请选择定位'; |             document.getElementById('selectedLocationText').textContent = '请选择定位'; | ||||||
|             document.getElementById('selectedLocationText').style.color = '#f56c6c'; |             document.getElementById('selectedLocationText').style.color = '#f56c6c'; | ||||||
|  |             // 重置权限选择 | ||||||
|  |             selectedPermissions.clear(); | ||||||
|  |             document.querySelectorAll('.permission-checkbox').forEach(checkbox => { | ||||||
|  |                 checkbox.checked = false; | ||||||
|  |             }); | ||||||
|  |             document.querySelectorAll('.permission-node').forEach(node => { | ||||||
|  |                 node.classList.remove('selected'); | ||||||
|  |             }); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         // 提交表单 |         // 提交表单 | ||||||
|  | @ -1052,8 +1498,26 @@ | ||||||
|                 return; |                 return; | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|  |             // 验证权限选择(可选,根据需求决定是否必选) | ||||||
|  |             if (selectedPermissions.size === 0) { | ||||||
|  |                 if (!confirm('您还未选择任何权限,确定要继续吗?')) { | ||||||
|  |                     return; | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |             // 构建提交数据,包含权限信息 | ||||||
|  |             const formData = { | ||||||
|  |                 operatorAccount: account, | ||||||
|  |                 verifyCode: verifyCode, | ||||||
|  |                 marketName: marketName, | ||||||
|  |                 categoryType: categoryType, | ||||||
|  |                 permissions: Array.from(selectedPermissions) | ||||||
|  |             }; | ||||||
|  | 
 | ||||||
|  |             console.log('提交数据:', formData); | ||||||
|  | 
 | ||||||
|             // 这里应该调用后端API验证验证码并提交表单 |             // 这里应该调用后端API验证验证码并提交表单 | ||||||
|             alert('表单提交功能待实现'); |             alert('表单提交功能待实现\n已选择权限: ' + formData.permissions.join(', ')); | ||||||
|             closeModal(); |             closeModal(); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue