chenluhua1980
2025-12-11 33f080ddc32f3545b685b2e0a7a5df3c35894270
SourceCode/Bond/Servo/CPageCollectionEvent.cpp
@@ -149,5 +149,30 @@
void CPageCollectionEvent::OnClickedBtn(const char* btnName)
{
   // 暂留:后续实现增删改逻辑
   ASSERT(btnName);
   if (_strcmpi(btnName, "删除") == 0) {
      POSITION pos = m_listCtrl.GetFirstSelectedItemPosition();
      if (pos == nullptr) return;
      int nItem = m_listCtrl.GetNextSelectedItem(pos);
      auto pEvent = reinterpret_cast<SERVO::CCollectionEvent*>(m_listCtrl.GetItemData(nItem));
      if (pEvent == nullptr) return;
      int rc = UX_CanExecute(L"delEvents");
      if (rc != 1) {
         AfxMessageBox("操作权限不足,请联系管理人员!");
         return;
      }
      int ret = theApp.m_model.m_hsmsPassive.deleteCollectionEvent((unsigned short)pEvent->getEventId());
      if (ret == 0) {
         UX_RecordAction(L"delEvents");
         m_listCtrl.DeleteAllItems();
         loadCollectionEvents();
         if (CButton* pDel = GetBtnByName("删除")) pDel->EnableWindow(FALSE);
         if (CButton* pEdit = GetBtnByName("编辑")) pEdit->EnableWindow(FALSE);
      }
      else {
         AfxMessageBox(_T("删除事件失败"));
      }
   }
}