From 3cb4638bcb93a8fdf4cfea140025bbc299d35d47 Mon Sep 17 00:00:00 2001
From: chenluhua1980 <Chenluhua@qq.com>
Date: 星期二, 18 十一月 2025 17:02:07 +0800
Subject: [PATCH] 1.权限完善。操作日志等

---
 SourceCode/Bond/Servo/ServoDlg.cpp |   32 ++++++++++++++++++++------------
 1 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/SourceCode/Bond/Servo/ServoDlg.cpp b/SourceCode/Bond/Servo/ServoDlg.cpp
index 5705532..f563fbc 100644
--- a/SourceCode/Bond/Servo/ServoDlg.cpp
+++ b/SourceCode/Bond/Servo/ServoDlg.cpp
@@ -33,6 +33,7 @@
 #include "CControlJobManagerDlg.h"
 #include "CUserManager2.h"
 #include "CUserManager2Dlg.h"
+#include "CUserXLogDlg.h"
 
 
 #ifdef _DEBUG
@@ -1017,15 +1018,14 @@
 LRESULT CServoDlg::OnToolbarBtnClicked(WPARAM wParam, LPARAM lParam)
 {
 	int id = (int)lParam;
-	if (id == IDC_BUTTON_RUN || id == IDC_BUTTON_STOP) {
-		UserRole emRole = UserManager::getInstance().getCurrentUserRole();
-		if (emRole != UserRole::SuperAdmin) {
-			AfxMessageBox(_T("褰撳墠鐢ㄦ埛骞堕潪绠$悊鍛橈紒锛侊紒")); 
-			return 1;
-		}
-	}
-
 	if (id == IDC_BUTTON_RUN) {
+		int rc = UX_CanExecute(L"start");
+		if (rc != 1) {
+			AfxMessageBox("鎿嶄綔鏉冮檺涓嶈冻锛岃鑱旂郴绠$悊浜哄憳锛�");
+			return 0;
+		}
+		UX_RecordAction(L"start");
+
 		if (theApp.m_model.getMaster().getState() == SERVO::MASTERSTATE::MSERROR) {
 			AfxMessageBox("褰撳墠鏈夋満鍙板彂鐢熼敊璇紝涓嶈兘鍚姩锛岃纭瑙e喅闂鍚庡啀灏濊瘯閲嶆柊鍚姩锛�");
 		}
@@ -1062,6 +1062,13 @@
 		}
 	}
 	else if (id == IDC_BUTTON_STOP) {
+		int rc = UX_CanExecute(L"stop");
+		if (rc != 1) {
+			AfxMessageBox("鎿嶄綔鏉冮檺涓嶈冻锛岃鑱旂郴绠$悊浜哄憳锛�");
+			return 0;
+		}
+		UX_RecordAction(L"stop");
+
 		if (theApp.m_model.getMaster().stop() == 0) {
 			m_pTopToolbar->GetBtn(IDC_BUTTON_STOP)->EnableWindow(FALSE);
 		}
@@ -1101,12 +1108,13 @@
 			CUserManager2Dlg dlg;
 			dlg.DoModal();
 		}
+		else if (menuId == 1) {
+			CUserXLogDlg dlg;
+			dlg.DoModal();
+		}
 		else if (menuId == 2) {
 			CLoginDlg2 dlg;
-			if (dlg.DoModal() != IDOK) {
-				PostMessage(WM_CLOSE);
-			}
-			else {
+			if (dlg.DoModal() == IDOK) {
 				bool bRet = CUserManager2::getInstance().login((LPTSTR)(LPCTSTR)dlg.m_strUsername,
 					(LPTSTR)(LPCTSTR)dlg.m_strPassword);
 				if (!bRet) {

--
Gitblit v1.9.3