1. 修改權限(未完成)

This commit is contained in:
Kai 2021-07-12 18:55:50 +08:00
parent 0e15d5cfe4
commit a79a8c829e
2 changed files with 78 additions and 11 deletions

View File

@ -73,20 +73,19 @@ namespace SolarPower.Controllers
myUser.Role = roleRepository.GetMyRoleInfoById(myUser.RoleId); myUser.Role = roleRepository.GetMyRoleInfoById(myUser.RoleId);
List<string> auth_arr = new List<string>(); List<string> auth_arr = new List<string>();
if (myUser.Role.Layer != 0) //判斷是否平台管理員
{
foreach (var auth in myUser.Role.Auths)
{
var per_auch_arr = auth.Split(',');
foreach (var x in per_auch_arr)
{
auth_arr.Add(x);
}
}
ViewBag.auths = auth_arr; foreach (var auth in myUser.Role.Auths)
{
var per_auch_arr = auth.Split(',');
foreach (var x in per_auch_arr)
{
auth_arr.Add(x);
}
} }
ViewBag.auths = auth_arr;
ViewBag.myUser = myUser; ViewBag.myUser = myUser;
#region #region

View File

@ -1038,6 +1038,7 @@ ALTER TABLE `inverter`
-- 子DB裝置列表新增欄位 20210708 -- 子DB裝置列表新增欄位 20210708
ALTER TABLE `device` ALTER TABLE `device`
ADD COLUMN `Enabled` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否啟用, 0:否 1:是' AFTER `PowerStationId`, ADD COLUMN `Enabled` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否啟用, 0:否 1:是' AFTER `PowerStationId`,
ADD COLUMN `Status` tinyint(4) DEFAULT '0' COMMENT '狀態0:未啟用 1:正常 2:異常' AFTER `Enabled`,
ADD COLUMN `InstallDate` timestamp NULL DEFAULT NULL COMMENT '安裝日期' AFTER `ColName`, ADD COLUMN `InstallDate` timestamp NULL DEFAULT NULL COMMENT '安裝日期' AFTER `ColName`,
DROP COLUMN `Remark`; DROP COLUMN `Remark`;
@ -1106,6 +1107,73 @@ ALTER TABLE `sensor_history_month`
ADD COLUMN `Temperature` DECIMAL(5,2) NULL DEFAULT NULL COMMENT '每月平均模組溫度計溫度' AFTER `Irradiance`; ADD COLUMN `Temperature` DECIMAL(5,2) NULL DEFAULT NULL COMMENT '每月平均模組溫度計溫度' AFTER `Irradiance`;
-- 傾印 alarmorion_orionalarmclass 結構
CREATE TABLE IF NOT EXISTS `alarmorion_orionalarmclass` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`alarmClass` varchar(64) NOT NULL,
`unackedAlarmCount` int(11) DEFAULT NULL,
`openAlarmCount` int(11) DEFAULT NULL,
`inAlarmCount` int(11) DEFAULT NULL,
`totalAlarmCount` int(11) DEFAULT NULL,
`timeOfLastAlarm` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `alarmOrion_OrionAlarmClassalarmClassUQ` (`alarmClass`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- 正在傾印表格 alarmorion_orionalarmclass 的資料
DELETE FROM `alarmorion_orionalarmclass`;
/*!40000 ALTER TABLE `alarmorion_orionalarmclass` DISABLE KEYS */;
INSERT INTO `alarmorion_orionalarmclass` (`id`, `alarmClass`, `unackedAlarmCount`, `openAlarmCount`, `inAlarmCount`, `totalAlarmCount`, `timeOfLastAlarm`) VALUES
(1, 'defaultAlarmClass', 0, 0, 0, 1, 1625569030632),
(2, 'Network', 7, 7, 0, 9, 1625728376568),
(3, 'Inverter', 78, 78, 0, 79, 1625722999680),
(4, 'PR', 2, 2, 0, 6, 1625653811674);
/*!40000 ALTER TABLE `alarmorion_orionalarmclass` ENABLE KEYS */;
-- 傾印 ref_err_device 結構
CREATE TABLE IF NOT EXISTS `ref_err_device` (
`id` smallint(2) NOT NULL,
`deviceType` varchar(20) DEFAULT NULL COMMENT '設備類別',
`errCode` smallint(1) DEFAULT NULL COMMENT '錯誤代碼',
`errMsg` varchar(40) DEFAULT NULL,
`errMsg_tw` varchar(40) DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
-- 正在傾印表格 ref_err_device 的資料
DELETE FROM `ref_err_device`;
/*!40000 ALTER TABLE `ref_err_device` DISABLE KEYS */;
INSERT INTO `ref_err_device` (`id`, `deviceType`, `errCode`, `errMsg`, `errMsg_tw`) VALUES
(1, 'DeviceNetwork', 1, 'b:true', '設備斷線'),
(2, 'Network', 2, 'b:true', '網路斷線'),
(3, 'PR', 6, 'd', 'PR異常');
/*!40000 ALTER TABLE `ref_err_device` ENABLE KEYS */;
-- 傾印 資料表 solar_power_test.ref_err_inv 結構
CREATE TABLE IF NOT EXISTS `ref_err_inv` (
`id` smallint(2) NOT NULL,
`brend` varchar(30) DEFAULT NULL COMMENT '廠牌',
`deviceType` varchar(20) DEFAULT NULL COMMENT '設備類別',
`errCode` smallint(1) DEFAULT NULL COMMENT '錯誤代碼',
`errMsg` varchar(40) DEFAULT NULL,
`errMsg_tw` varchar(40) DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
-- 正在傾印表格 solar_power_test.ref_err_inv 的資料:~8 rows (近似值)
DELETE FROM `ref_err_inv`;
/*!40000 ALTER TABLE `ref_err_inv` DISABLE KEYS */;
INSERT INTO `ref_err_inv` (`id`, `brend`, `deviceType`, `errCode`, `errMsg`, `errMsg_tw`) VALUES
(1, 'solaredge', 'inverter', 1, 'Off', '關機'),
(2, 'solaredge', 'inverter', 2, 'Night mode', '夜間模式'),
(3, 'solaredge', 'inverter', 3, 'Grid Monitoring/wake-up', '監控中/開機'),
(4, 'solaredge', 'inverter', 4, 'Inverter is ON and producing power', '正常'),
(5, 'solaredge', 'inverter', 5, 'Production (curtailed)', '電力縮減'),
(6, 'solaredge', 'inverter', 6, 'Shutting down', '關機中'),
(7, 'solaredge', 'inverter', 7, 'Fault', '設備異常'),
(8, 'solaredge', 'inverter', 8, 'Maintenance/setup', '維修中/設定中');
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */; /*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
/*!40014 SET FOREIGN_KEY_CHECKS=IFNULL(@OLD_FOREIGN_KEY_CHECKS, 1) */; /*!40014 SET FOREIGN_KEY_CHECKS=IFNULL(@OLD_FOREIGN_KEY_CHECKS, 1) */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;