1. 修改 運維作業記錄 刪除
2. 新增帳號 時判斷 該帳號是否已存在
This commit is contained in:
parent
48731a6394
commit
fefa7cfe8c
5
.gitignore
vendored
5
.gitignore
vendored
@ -31,6 +31,8 @@ bld/
|
|||||||
.vs/
|
.vs/
|
||||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||||
#wwwroot/
|
#wwwroot/
|
||||||
|
wwwroot/upload
|
||||||
|
|
||||||
|
|
||||||
# Visual Studio 2017 auto generated files
|
# Visual Studio 2017 auto generated files
|
||||||
Generated\ Files/
|
Generated\ Files/
|
||||||
@ -338,4 +340,5 @@ ASALocalRun/
|
|||||||
|
|
||||||
# BeatPulse healthcheck temp database
|
# BeatPulse healthcheck temp database
|
||||||
healthchecksdb
|
healthchecksdb
|
||||||
/SolarPower/wwwroot/js/bower_components
|
|
||||||
|
|
||||||
|
|||||||
@ -680,6 +680,50 @@ namespace SolarPower.Controllers
|
|||||||
return apiResult;
|
return apiResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<ApiResult<string>> DeleteOperationRecodeFile(PostOperationRecodeIdAndSelectedId post)
|
||||||
|
{
|
||||||
|
ApiResult<string> apiResult = new ApiResult<string>();
|
||||||
|
|
||||||
|
OperationRecode operationRecode = null;
|
||||||
|
OperationRecodeFile operationRecodeFile = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
operationRecode = await operationRepository.GetOneOperationRecodeAsync(post.ReocdeId);
|
||||||
|
|
||||||
|
if (operationRecode == null)
|
||||||
|
{
|
||||||
|
apiResult.Code = "9989";
|
||||||
|
apiResult.Msg = errorCode.GetString(apiResult.Code);
|
||||||
|
return apiResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
operationRecodeFile = await operationRepository.GetOneOperationRecodeFileAsync(post.SelectedId);
|
||||||
|
|
||||||
|
if (operationRecodeFile == null)
|
||||||
|
{
|
||||||
|
apiResult.Code = "9988";
|
||||||
|
apiResult.Msg = errorCode.GetString(apiResult.Code);
|
||||||
|
return apiResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
await operationRepository.DeleteOneOperationRecodeFile(post.SelectedId);
|
||||||
|
|
||||||
|
apiResult.Code = "0000";
|
||||||
|
apiResult.Msg = "刪除成功";
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
apiResult.Code = "9999";
|
||||||
|
apiResult.Msg = errorCode.GetString(apiResult.Code);
|
||||||
|
string json = System.Text.Json.JsonSerializer.Serialize(post);
|
||||||
|
Logger.LogError("【" + controllerName + "/" + actionName + "】" + json);
|
||||||
|
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
return apiResult;
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<ApiResult<List<OperationRecodeDataTable>>> ExportOperationRecodeExcel(PostOperationRecodeFilter post)
|
public async Task<ApiResult<List<OperationRecodeDataTable>>> ExportOperationRecodeExcel(PostOperationRecodeFilter post)
|
||||||
{
|
{
|
||||||
ApiResult<List<OperationRecodeDataTable>> apiResult = new ApiResult<List<OperationRecodeDataTable>>();
|
ApiResult<List<OperationRecodeDataTable>> apiResult = new ApiResult<List<OperationRecodeDataTable>>();
|
||||||
|
|||||||
@ -250,7 +250,7 @@ namespace SolarPower.Controllers
|
|||||||
|
|
||||||
var tempSerialNumber = GetLastSerialNumber(currentSerialNumber);
|
var tempSerialNumber = GetLastSerialNumber(currentSerialNumber);
|
||||||
|
|
||||||
var codeFormat = "{0}-{1}-{2}";
|
var codeFormat = "{0}{1}{2}";
|
||||||
|
|
||||||
powerStation = new PowerStation()
|
powerStation = new PowerStation()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -296,6 +296,15 @@ namespace SolarPower.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
#region 新增使用者
|
#region 新增使用者
|
||||||
|
//判斷帳號 是否已存在
|
||||||
|
var exist = userRepository.GetOneByAccountAsync(post.Account);
|
||||||
|
if(exist != null)
|
||||||
|
{
|
||||||
|
apiResult.Code = "9987";
|
||||||
|
apiResult.Msg = errorCode.GetString(apiResult.Code);
|
||||||
|
return apiResult;
|
||||||
|
}
|
||||||
|
|
||||||
EDFunction edFunction = new EDFunction();
|
EDFunction edFunction = new EDFunction();
|
||||||
|
|
||||||
//隨機產生亂數密碼
|
//隨機產生亂數密碼
|
||||||
|
|||||||
@ -484,14 +484,13 @@ CREATE TABLE IF NOT EXISTS `company` (
|
|||||||
`UpdatedAt` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp() COMMENT '修改時間',
|
`UpdatedAt` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp() COMMENT '修改時間',
|
||||||
PRIMARY KEY (`Id`),
|
PRIMARY KEY (`Id`),
|
||||||
KEY `IDX_01` (`Deleted`,`Status`)
|
KEY `IDX_01` (`Deleted`,`Status`)
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='公司資料';
|
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='公司資料';
|
||||||
|
|
||||||
-- 正在傾印表格 solar_power.company 的資料:~-1 rows (近似值)
|
-- 正在傾印表格 solar_power.company 的資料:~-1 rows (近似值)
|
||||||
DELETE FROM `company`;
|
DELETE FROM `company`;
|
||||||
/*!40000 ALTER TABLE `company` DISABLE KEYS */;
|
/*!40000 ALTER TABLE `company` DISABLE KEYS */;
|
||||||
INSERT INTO `company` (`Id`, `Deleted`, `Status`, `Name`, `Logo`, `TaxIDNumber`, `Phone`, `Address`, `RegisterUpperLimit`, `SPStationAmount`, `RelationalDB`, `CreatedBy`, `CreatedAt`, `UpdatedBy`, `UpdatedAt`) VALUES
|
INSERT INTO `company` (`Id`, `Deleted`, `Status`, `Name`, `Logo`, `TaxIDNumber`, `Phone`, `Address`, `RegisterUpperLimit`, `SPStationAmount`, `RelationalDB`, `CreatedBy`, `CreatedAt`, `UpdatedBy`, `UpdatedAt`) VALUES
|
||||||
(1, 0, 1, '大眾電腦', NULL, '20840777', '02-87518751', '臺北市內湖區陽光街300號1至9樓', 100, 0, NULL, 1, '2021-06-14 14:52:20', NULL, '2021-06-14 14:52:37'),
|
(1, 0, 1, '大眾電腦', NULL, '20840777', '02-87518751', '臺北市內湖區陽光街300號1至9樓', 100, 0, NULL, 1, '2021-06-14 14:52:20', NULL, '2021-06-14 14:52:37');
|
||||||
(2, 0, 1, '台積電', '2.png', '11223345', NULL, NULL, 10, 0, 'solar_com_0002', 1, '2021-06-14 17:38:49', NULL, '2021-06-14 17:39:00');
|
|
||||||
/*!40000 ALTER TABLE `company` ENABLE KEYS */;
|
/*!40000 ALTER TABLE `company` ENABLE KEYS */;
|
||||||
|
|
||||||
-- 傾印 資料表 solar_power.company_auth_page 結構
|
-- 傾印 資料表 solar_power.company_auth_page 結構
|
||||||
@ -822,6 +821,80 @@ INSERT INTO `variable` (`id`, `name`, `value`, `remark`) VALUES
|
|||||||
-- 設備流水號 - 2021/6/18 12:21:00
|
-- 設備流水號 - 2021/6/18 12:21:00
|
||||||
ALTER TABLE `device` ADD COLUMN `SerialNumber` VARCHAR(3) NULL DEFAULT NULL COMMENT '單一設備流水號' COLLATE 'utf8mb4_unicode_ci' AFTER `PowerStationId`;
|
ALTER TABLE `device` ADD COLUMN `SerialNumber` VARCHAR(3) NULL DEFAULT NULL COMMENT '單一設備流水號' COLLATE 'utf8mb4_unicode_ci' AFTER `PowerStationId`;
|
||||||
|
|
||||||
|
-- 修改 公司子資料庫的欄位名稱 20210628
|
||||||
|
ALTER TABLE `company`
|
||||||
|
CHANGE COLUMN `RelationalDB` `SiteDB` VARCHAR(50) NULL DEFAULT NULL COMMENT '公司各自資料庫' COLLATE 'utf8mb4_unicode_ci' AFTER `SPStationAmount`;
|
||||||
|
|
||||||
|
-- 創建 定期計畫建立資料表 20210628
|
||||||
|
CREATE TABLE `operation_plan_create` (
|
||||||
|
`Id` INT(10) NOT NULL AUTO_INCREMENT COMMENT '流水號',
|
||||||
|
`Deleted` TINYINT(4) UNSIGNED NOT NULL DEFAULT '0' COMMENT '是否刪除, 0:否 1:是',
|
||||||
|
`PlanId` VARCHAR(50) NULL DEFAULT NULL COMMENT '計畫單號' COLLATE 'utf8mb4_unicode_ci',
|
||||||
|
`PowerStationId` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '電站編號',
|
||||||
|
`SerialNumber` VARCHAR(4) NULL DEFAULT NULL COMMENT '計畫單號用流水號' COLLATE 'utf8mb4_unicode_ci',
|
||||||
|
`ScheduleNum` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '排程數字',
|
||||||
|
`ScheduleType` TINYINT(4) UNSIGNED NOT NULL DEFAULT '0' COMMENT '排程屬性,0:天 1:周 2:月 3:季 4:年',
|
||||||
|
`WorkDay` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '預期工作天數',
|
||||||
|
`StartTime` TIMESTAMP NULL DEFAULT NULL COMMENT '開始時間',
|
||||||
|
`Type` TINYINT(4) UNSIGNED NOT NULL DEFAULT '0' COMMENT '項目, 0:清洗 1:巡檢',
|
||||||
|
`EmailType` TINYINT(4) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'email提醒種類,0:當天 1:前一天 2:前兩天 3:前三天',
|
||||||
|
`Description` MEDIUMTEXT NULL DEFAULT NULL COMMENT '描述' COLLATE 'utf8mb4_unicode_ci',
|
||||||
|
`CreatedBy` INT(10) NULL DEFAULT '0',
|
||||||
|
`CreatedAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
`UpdatedBy` INT(10) NULL DEFAULT '0',
|
||||||
|
`UpdatedAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
PRIMARY KEY (`Id`) USING BTREE,
|
||||||
|
INDEX `IDX_01` (`Deleted`, `PowerStationId`, `CreatedBy`, `StartTime`, `PlanId`) USING BTREE
|
||||||
|
)
|
||||||
|
COMMENT='運維計劃建立'
|
||||||
|
COLLATE='utf8_general_ci'
|
||||||
|
ENGINE=InnoDB;
|
||||||
|
|
||||||
|
-- 創建 運維作業記錄資料表 20210628
|
||||||
|
CREATE TABLE `operation_record` (
|
||||||
|
`Id` INT(10) NOT NULL AUTO_INCREMENT COMMENT '流水號',
|
||||||
|
`Deleted` TINYINT(4) NOT NULL DEFAULT '0' COMMENT '是否刪除 0:否 1:是',
|
||||||
|
`FormId` VARCHAR(20) NULL DEFAULT NULL COMMENT '表單號' COLLATE 'utf8mb4_unicode_ci',
|
||||||
|
`SerialNumber` VARCHAR(4) NULL DEFAULT NULL COMMENT '表單流水號' COLLATE 'utf8_general_ci',
|
||||||
|
`PowerStationId` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '電站編號',
|
||||||
|
`WorkType` TINYINT(4) NOT NULL DEFAULT '0' COMMENT '工作項目, 0:清洗 1:巡檢 2:維修',
|
||||||
|
`ErrorCode` VARCHAR(50) NULL DEFAULT NULL COMMENT '異常代號' COLLATE 'utf8mb4_unicode_ci',
|
||||||
|
`FixDo` VARCHAR(50) NULL DEFAULT '0' COMMENT '維修項目' COLLATE 'utf8mb4_unicode_ci',
|
||||||
|
`Status` TINYINT(4) NOT NULL DEFAULT '0' COMMENT '狀態 0:未完成 1:完成 2:未完成-過期 3:完成-過期',
|
||||||
|
`WorkPersonId` INT(10) NULL DEFAULT '0' COMMENT '工作人員編號',
|
||||||
|
`StartTime` TIMESTAMP NULL DEFAULT NULL COMMENT '預計開始時間',
|
||||||
|
`EndTime` TIMESTAMP NULL DEFAULT NULL COMMENT '預計結束時間',
|
||||||
|
`FinishTime` TIMESTAMP NULL DEFAULT NULL COMMENT '完成時間',
|
||||||
|
`WorkTime` TIMESTAMP NULL DEFAULT NULL COMMENT '作業時間',
|
||||||
|
`Notice` MEDIUMTEXT NULL DEFAULT NULL COMMENT '注意事項' COLLATE 'utf8mb4_unicode_ci',
|
||||||
|
`Description` MEDIUMTEXT NULL DEFAULT NULL COMMENT '結果描述' COLLATE 'utf8mb4_unicode_ci',
|
||||||
|
`CreatedBy` INT(10) NULL DEFAULT NULL,
|
||||||
|
`CreatedAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
`UpdatedBy` INT(10) NULL DEFAULT NULL,
|
||||||
|
`UpdatedAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
PRIMARY KEY (`Id`) USING BTREE,
|
||||||
|
INDEX `IDX_01` (`Deleted`, `FormId`, `WorkPersonId`) USING BTREE
|
||||||
|
)
|
||||||
|
COMMENT='運維作業紀錄'
|
||||||
|
COLLATE='utf8_general_ci'
|
||||||
|
ENGINE=InnoDB;
|
||||||
|
|
||||||
|
-- 創建 運維作業記錄檔案資料表 20210628
|
||||||
|
CREATE TABLE `operation_record_file` (
|
||||||
|
`Id` INT(10) NOT NULL AUTO_INCREMENT,
|
||||||
|
`Deleted` TINYINT(4) NOT NULL DEFAULT '0' COMMENT '是否刪除, 0:否 1:是',
|
||||||
|
`RecordId` INT(10) NULL DEFAULT NULL COMMENT '主表流水號',
|
||||||
|
`FileName` VARCHAR(100) NULL DEFAULT NULL COMMENT '檔案名稱' COLLATE 'utf8_general_ci',
|
||||||
|
`CreatedBy` INT(10) UNSIGNED NOT NULL COMMENT '建立者',
|
||||||
|
`CreatedAt` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '建立時間',
|
||||||
|
PRIMARY KEY (`Id`) USING BTREE,
|
||||||
|
INDEX `IDX_01` (`RecordId`, `Deleted`) USING BTREE
|
||||||
|
)
|
||||||
|
COMMENT='運維紀錄 檔案 or 圖片'
|
||||||
|
COLLATE='utf8_general_ci'
|
||||||
|
ENGINE=InnoDB;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
|
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
|
||||||
|
|||||||
@ -17,6 +17,8 @@ namespace SolarPower.Models
|
|||||||
{
|
{
|
||||||
{ "0000", "OK" },
|
{ "0000", "OK" },
|
||||||
{ "0001", "傳入參數錯誤。" },
|
{ "0001", "傳入參數錯誤。" },
|
||||||
|
{ "9987", "該帳號已被註冊,請重新輸入"},
|
||||||
|
{ "9988", "查無該運維作業記錄檔案"},
|
||||||
{ "9989", "查無該運維作業記錄"},
|
{ "9989", "查無該運維作業記錄"},
|
||||||
{ "9990", "查無該圖片"},
|
{ "9990", "查無該圖片"},
|
||||||
{ "9991", "查無該土地房屋資訊"},
|
{ "9991", "查無該土地房屋資訊"},
|
||||||
|
|||||||
@ -299,4 +299,13 @@ namespace SolarPower.Models
|
|||||||
public string Notice { get; set; }
|
public string Notice { get; set; }
|
||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 針對運維作業記錄檔案
|
||||||
|
/// </summary>
|
||||||
|
public class PostOperationRecodeIdAndSelectedId
|
||||||
|
{
|
||||||
|
public int ReocdeId { get; set; }
|
||||||
|
public int SelectedId { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -429,5 +429,70 @@ namespace SolarPower.Repository.Implement
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 透過Id,取得單一運維作業記錄檔案
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<OperationRecodeFile> GetOneOperationRecodeFileAsync(int id)
|
||||||
|
{
|
||||||
|
OperationRecodeFile result;
|
||||||
|
|
||||||
|
using (IDbConnection conn = this._databaseHelper.GetConnection())
|
||||||
|
{
|
||||||
|
conn.Open();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var sql = @$"SELECT *
|
||||||
|
FROM operation_record_file
|
||||||
|
WHERE Deleted = 0 AND Id = @Id";
|
||||||
|
|
||||||
|
result = await conn.QueryFirstOrDefaultAsync<OperationRecodeFile>(sql, new { Id = id });
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
throw exception;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
conn.Close();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 透過Id,軟刪除運維作業記錄檔案
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task DeleteOneOperationRecodeFile(int id)
|
||||||
|
{
|
||||||
|
using (IDbConnection conn = this._databaseHelper.GetConnection())
|
||||||
|
{
|
||||||
|
conn.Open();
|
||||||
|
using (var trans = conn.BeginTransaction())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var sql = $"UPDATE operation_record_file SET deleted = 1 WHERE id = @Id";
|
||||||
|
|
||||||
|
await conn.ExecuteAsync(sql, new { Id = id }, trans);
|
||||||
|
|
||||||
|
trans.Commit();
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
trans.Rollback();
|
||||||
|
throw exception;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
conn.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -53,6 +53,20 @@ namespace SolarPower.Repository.Interface
|
|||||||
/// <param name="properties"></param>
|
/// <param name="properties"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<int> AddOperationRecodeFilesAsync(List<OperationRecodeFile> entity, List<string> properties);
|
Task<int> AddOperationRecodeFilesAsync(List<OperationRecodeFile> entity, List<string> properties);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 透過Id,取得單一運維作業記錄檔案
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<OperationRecodeFile> GetOneOperationRecodeFileAsync(int id);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 透過Id,軟刪除運維作業記錄檔案
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task DeleteOneOperationRecodeFile(int id);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -89,7 +89,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!--公司資料-->
|
<!--公司資料-->
|
||||||
<div class="modal fade" id="company-modal" tabindex="-1" role="dialog" aria-hidden="true">
|
<div class="modal fade" id="company-modal" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static" data-keyboard="false">
|
||||||
<div class="modal-dialog modal-dialog-centered modal-lg" role="document">
|
<div class="modal-dialog modal-dialog-centered modal-lg" role="document">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
@ -144,7 +144,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<!--/.公司資料-->
|
<!--/.公司資料-->
|
||||||
<!-- 公司權限池 -->
|
<!-- 公司權限池 -->
|
||||||
<div class="modal fade" id="company-auth-modal" tabindex="-1" role="dialog" aria-hidden="true">
|
<div class="modal fade" id="company-auth-modal" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static" data-keyboard="false">
|
||||||
<div class="modal-dialog modal-dialog-centered modal-lg" role="document">
|
<div class="modal-dialog modal-dialog-centered modal-lg" role="document">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
|
|||||||
@ -110,7 +110,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="modal fade" id="recode-form-modal" tabindex="-1" role="dialog" aria-hidden="true">
|
<div class="modal fade" id="recode-form-modal" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static" data-keyboard="false">
|
||||||
<div class="modal-dialog modal-dialog-centered modal-lg" role="document">
|
<div class="modal-dialog modal-dialog-centered modal-lg" role="document">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
@ -204,7 +204,9 @@
|
|||||||
<p>檔案上傳</p>
|
<p>檔案上傳</p>
|
||||||
</div>
|
</div>
|
||||||
<div id="recode_files_div" class="col-10">
|
<div id="recode_files_div" class="col-10">
|
||||||
<div class="row align-items-center img-zoom-div"></div>
|
<div class="row px-3 mb-3 d-flex justify-content-start align-items-center img-zoom-div">
|
||||||
|
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row px-3">
|
<div class="row px-3">
|
||||||
@ -394,7 +396,7 @@
|
|||||||
|
|
||||||
if (cellData != null) {
|
if (cellData != null) {
|
||||||
cellData.forEach(function (value, index) {
|
cellData.forEach(function (value, index) {
|
||||||
CreateRecodeFileBox($(td).children(".row"), value);
|
CreateRecodeFileBox($(td).children(".row"), value, false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -671,7 +673,7 @@
|
|||||||
RecodeFileBox = $("#recode_files_div > .row");
|
RecodeFileBox = $("#recode_files_div > .row");
|
||||||
RecodeFileBox.empty();
|
RecodeFileBox.empty();
|
||||||
recode.recodeFiles.forEach(function (value, index) {
|
recode.recodeFiles.forEach(function (value, index) {
|
||||||
CreateRecodeFileBox(RecodeFileBox, value);
|
CreateRecodeFileBox(RecodeFileBox, value, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#recode-form-modal").modal();
|
$("#recode-form-modal").modal();
|
||||||
@ -803,26 +805,72 @@
|
|||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
//#region 產生檔案html
|
//#region 產生檔案html
|
||||||
function CreateRecodeFileBox(dom, value) {
|
function CreateRecodeFileBox(dom, value, show_del_btn) {
|
||||||
var str = "";
|
var str = "";
|
||||||
str += '<div class="col-2">';
|
str += '<div class="col-auto px-0 py-2 mx-2">';
|
||||||
var split = value.fileName.split(".");
|
var split = value.fileName.split(".");
|
||||||
var excel_format = ["xls", "xlsx"];
|
var excel_format = ["xls", "xlsx"];
|
||||||
var word_format = ["doc", "docx"];
|
var word_format = ["doc", "docx"];
|
||||||
if (split[split.length - 1].toLowerCase() == "pdf") {
|
if (split[split.length - 1].toLowerCase() == "pdf") {
|
||||||
str += '<a href="' + value.fileName + '" class="btn btn-info waves-effect waves-themed mb-3 mr-2" download><i class="fal fa-file-pdf"></i></a>';
|
str += '<a href="' + value.fileName + '" class="btn btn-info waves-effect waves-themed mb-3 mr-2" download><i class="fal fa-file-pdf" style="font-size: 1.5em; line-height: 2;"></i></a>';
|
||||||
} else if (excel_format.indexOf(split[split.length - 1].toLowerCase()) > -1) {
|
} else if (excel_format.indexOf(split[split.length - 1].toLowerCase()) > -1) {
|
||||||
str += '<a href="' + value.fileName + '" class="btn btn-info waves-effect waves-themed mb-3 mr-2" download><i class="fal fa-file-excel"></i></a>';
|
str += '<a href="' + value.fileName + '" class="btn btn-info waves-effect waves-themed mb-3 mr-2" download><i class="fal fa-file-excel" style="font-size: 1.5em; line-height: 2;"></i></a>';
|
||||||
} else if (word_format.indexOf(split[split.length - 1].toLowerCase()) > -1) {
|
} else if (word_format.indexOf(split[split.length - 1].toLowerCase()) > -1) {
|
||||||
str += '<a href="' + value.fileName + '" class="btn btn-info waves-effect waves-themed mb-3 mr-2" download><i class="fal fa-file-word"></i></a>';
|
str += '<a href="' + value.fileName + '" class="btn btn-info waves-effect waves-themed mb-3 mr-2" download><i class="fal fa-file-word" style="font-size: 1.5em; line-height: 2;"></i></a>';
|
||||||
} else {
|
} else {
|
||||||
str += '<img src="' + value.fileName + '" class="img-zoom" width="100%" />';
|
str += '<img src="' + value.fileName + '" class="img-zoom" width="100%" />';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (show_del_btn) {
|
||||||
|
str += '<a href="javascript:;" class="del-operation-recode-file-btn" data-id="' + value.id + '">';
|
||||||
|
str += '<span class="badge border border-light rounded-pill bg-danger-500 position-absolute pos-top pos-right"><i class="fal fa-times"></i></span>';
|
||||||
|
str += '</a>';
|
||||||
|
}
|
||||||
|
|
||||||
str += '</div>';
|
str += '</div>';
|
||||||
dom.append(str);
|
dom.append(str);
|
||||||
}
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
//#region 刪除檔案
|
||||||
|
$('#recode_files_div').on("click", "a.del-operation-recode-file-btn", function () {
|
||||||
|
|
||||||
|
var selectedFileId = $(this).attr("data-id");
|
||||||
|
|
||||||
|
var div = $(this).parents(".col-auto");
|
||||||
|
|
||||||
|
Swal.fire({
|
||||||
|
title: "刪除",
|
||||||
|
text: "你確定是否刪除此筆資料?",
|
||||||
|
type: "warning",
|
||||||
|
icon: 'warning',
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonText: "是",
|
||||||
|
cancelButtonText: "否"
|
||||||
|
}).then(function (result) {
|
||||||
|
if (result.value) {
|
||||||
|
|
||||||
|
var url = "/Operation/DeleteOperationRecodeFile";
|
||||||
|
|
||||||
|
var send_data = {
|
||||||
|
ReocdeId: selected_id,
|
||||||
|
SelectedId: selectedFileId
|
||||||
|
}
|
||||||
|
|
||||||
|
$.post(url, send_data, function (rel) {
|
||||||
|
if (rel.code != "0000") {
|
||||||
|
toast_error(rel.msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
toast_ok(rel.msg);
|
||||||
|
div.remove();
|
||||||
|
}, 'json');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
//#endregion
|
||||||
|
|
||||||
//#region 匯出excel
|
//#region 匯出excel
|
||||||
function ExportExcel() {
|
function ExportExcel() {
|
||||||
var url = "/Operation/ExportOperationRecodeExcel";
|
var url = "/Operation/ExportOperationRecodeExcel";
|
||||||
|
|||||||
@ -1936,7 +1936,7 @@
|
|||||||
function CreatePowerStationSingleLineBox(dom, value) {
|
function CreatePowerStationSingleLineBox(dom, value) {
|
||||||
var str = '<div class="col-xl">' +
|
var str = '<div class="col-xl">' +
|
||||||
'<div class="card border m-auto m-lg-0" style="padding: 9.5px;">' +
|
'<div class="card border m-auto m-lg-0" style="padding: 9.5px;">' +
|
||||||
'<img src="' + value.image + '" class="card-img-top" alt="...">' +
|
'<img src="' + value.image + '" class="card-img-top img-zoom" alt="...">' +
|
||||||
'<a href="javascript:void(0);" class="btn btn-danger btn-lg btn-icon rounded-circle waves-effect waves-themed position-absolute pos-top pos-right del-power-station-single-line-btn" data-id="' + value.id + '">' +
|
'<a href="javascript:void(0);" class="btn btn-danger btn-lg btn-icon rounded-circle waves-effect waves-themed position-absolute pos-top pos-right del-power-station-single-line-btn" data-id="' + value.id + '">' +
|
||||||
'<i class="fal fa-times"></i>' +
|
'<i class="fal fa-times"></i>' +
|
||||||
'</a>' +
|
'</a>' +
|
||||||
|
|||||||
@ -46,7 +46,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body" id="power-station-single-line-card">
|
<div class="card-body" id="power-station-single-line-card">
|
||||||
<div class="row d-flex justify-content-between">
|
<div class="row d-flex justify-content-between img-zoom-div">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -688,15 +688,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
$.post(url, send_data, function (rel) {
|
$.post(url, send_data, function (rel) {
|
||||||
if (rel.code == "9999") {
|
if (rel.code != "0000") {
|
||||||
toast_error(rel.msg);
|
toast_error(rel.msg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (rel.code == "9998") {
|
|
||||||
toast_error(rel.msg);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
toast_ok(rel.msg);
|
toast_ok(rel.msg);
|
||||||
$('#user-modal').modal('hide');
|
$('#user-modal').modal('hide');
|
||||||
|
|||||||
@ -24,4 +24,9 @@ label.error {
|
|||||||
#recode-file-div .dz-preview .dz-progress
|
#recode-file-div .dz-preview .dz-progress
|
||||||
{
|
{
|
||||||
display: none;
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 修改 Sweet Alert 2*/
|
||||||
|
.swal2-container {
|
||||||
|
z-index:2051;
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user