裝置 與 基本資料 合併
This commit is contained in:
commit
b88e3a6f34
@ -72,6 +72,26 @@ namespace SolarPower.Controllers
|
||||
apiResult.Msg = errorCode.GetString(apiResult.Code);
|
||||
return apiResult;
|
||||
}
|
||||
/// <summary>
|
||||
/// 取裝置類型下拉選單
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<ApiResult<List<UserSelectItemList>>> GetDeviceTypeSelectOptionList()
|
||||
{
|
||||
ApiResult<List<UserSelectItemList>> apiResult = new ApiResult<List<UserSelectItemList>>();
|
||||
try
|
||||
{
|
||||
var userSelectItemLists = await powerStationRepository.DeviceType();
|
||||
apiResult.Code = "0000";
|
||||
apiResult.Data = userSelectItemLists;
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
apiResult.Code = "9999";
|
||||
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
|
||||
}
|
||||
return apiResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 取得縣市選單
|
||||
@ -615,6 +635,309 @@ namespace SolarPower.Controllers
|
||||
|
||||
return apiResult;
|
||||
}
|
||||
/// <summary>
|
||||
/// 新增/修改 運維資料
|
||||
/// </summary>
|
||||
/// <param name="post"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<ApiResult<string>> SaveOperation(OperationInfo post)
|
||||
{
|
||||
ApiResult<string> apiResult = new ApiResult<string>();
|
||||
try
|
||||
{
|
||||
if (post.Id == 0)
|
||||
{
|
||||
OperationInfo operation = new OperationInfo()
|
||||
{
|
||||
Id = post.Id,
|
||||
Email = post.Email,
|
||||
Name = post.Name,
|
||||
Phone = post.Phone,
|
||||
CreatedBy = myUser.Id,
|
||||
ContactPerson = post.ContactPerson,
|
||||
PowerStationId = post.PowerStationId,
|
||||
Type = post.Type
|
||||
};
|
||||
List<string> properties = new List<string>()
|
||||
{
|
||||
"Id",
|
||||
"Email",
|
||||
"Name",
|
||||
"Phone",
|
||||
"CreatedBy",
|
||||
"ContactPerson",
|
||||
"PowerStationId",
|
||||
"Type"
|
||||
};
|
||||
await powerStationRepository.AddOperation(operation, properties);
|
||||
|
||||
apiResult.Code = "0000";
|
||||
apiResult.Msg = "新增成功";
|
||||
}
|
||||
else
|
||||
{
|
||||
OperationInfo operation = new OperationInfo()
|
||||
{
|
||||
Id = post.Id,
|
||||
Email = post.Email,
|
||||
Name = post.Name,
|
||||
Phone = post.Phone,
|
||||
CreatedBy = myUser.Id,
|
||||
ContactPerson = post.ContactPerson,
|
||||
PowerStationId = post.PowerStationId,
|
||||
Type = post.Type
|
||||
};
|
||||
List<string> properties = new List<string>()
|
||||
{
|
||||
"Id",
|
||||
"Email",
|
||||
"Name",
|
||||
"Phone",
|
||||
"CreatedBy",
|
||||
"ContactPerson",
|
||||
"PowerStationId",
|
||||
"Type"
|
||||
};
|
||||
await powerStationRepository.UpdateOperation(operation, properties);
|
||||
apiResult.Code = "0000";
|
||||
apiResult.Msg = "儲存成功";
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
apiResult.Code = "9999";
|
||||
apiResult.Msg = exception.ToString();
|
||||
}
|
||||
|
||||
return apiResult;
|
||||
}
|
||||
/// <summary>
|
||||
/// 運維資料DataTable
|
||||
/// </summary>
|
||||
/// <param name="stationId"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<ActionResult> OperationTable(int stationId)
|
||||
{
|
||||
|
||||
List<OperationTable> operationTable = new List<OperationTable>();
|
||||
ApiResult<List<OperationTable>> apiResult = new ApiResult<List<OperationTable>>();
|
||||
try
|
||||
{
|
||||
apiResult.Code = "0000";
|
||||
operationTable = await powerStationRepository.OperationTable(stationId);
|
||||
foreach(OperationTable a in operationTable)
|
||||
{
|
||||
a.Function = @"
|
||||
<button type='button' class='btn btn-primary btn-pills waves-effect waves-themed edit-btn'>修改</button>
|
||||
<button type='button' class='btn btn-danger btn-pills waves-effect waves-themed del-btn'>刪除</button>";
|
||||
if (a.Type == 0)
|
||||
{
|
||||
a.TypeName = "施工";
|
||||
}
|
||||
else if(a.Type == 1)
|
||||
{
|
||||
a.TypeName = "清洗";
|
||||
}
|
||||
else if (a.Type == 2)
|
||||
{
|
||||
a.TypeName = "運維";
|
||||
}
|
||||
}
|
||||
|
||||
apiResult.Data = operationTable;
|
||||
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
apiResult.Code = "9999";
|
||||
apiResult.Msg = exception.ToString();
|
||||
}
|
||||
var result = Json(new
|
||||
{
|
||||
data = apiResult
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
/// <summary>
|
||||
/// 取得一筆 運維 資料
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<ApiResult<OperationInfo>> GetOneOperation(int id)
|
||||
{
|
||||
OperationInfo operation = new OperationInfo();
|
||||
ApiResult<OperationInfo> apiResult = new ApiResult<OperationInfo>();
|
||||
try
|
||||
{
|
||||
apiResult.Code = "0000";
|
||||
operation = await powerStationRepository.OneOperationInfo(id);
|
||||
apiResult.Data = operation;
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
apiResult.Code = "9999";
|
||||
apiResult.Msg = exception.ToString();
|
||||
}
|
||||
|
||||
return apiResult;
|
||||
}
|
||||
/// <summary>
|
||||
/// 刪除 運維 資料
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<ApiResult<string>> DeleteOneOperation(int id)
|
||||
{
|
||||
ApiResult<string> apiResult = new ApiResult<string>();
|
||||
OperationInfo operation = new OperationInfo();
|
||||
try
|
||||
{
|
||||
operation = await powerStationRepository.OneOperationInfo(id);
|
||||
|
||||
if (operation == null)
|
||||
{
|
||||
apiResult.Code = "9996";
|
||||
apiResult.Msg = errorCode.GetString(apiResult.Code);
|
||||
return apiResult;
|
||||
}
|
||||
|
||||
await powerStationRepository.DeleteOneOtherTable(operation.Id, "operation_firm");
|
||||
|
||||
apiResult.Code = "0000";
|
||||
apiResult.Msg = "刪除成功";
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
apiResult.Code = "9999";
|
||||
apiResult.Msg = errorCode.GetString(apiResult.Code);
|
||||
Logger.LogError("【" + controllerName + "/" + actionName + "】" + "Id=" + id);
|
||||
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
|
||||
}
|
||||
|
||||
return apiResult;
|
||||
}
|
||||
/// <summary>
|
||||
/// 新增 / 修改 裝置資料
|
||||
/// </summary>
|
||||
/// <param name="Device"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<ApiResult<string>> SaveDevice(DeviceInfo Device)
|
||||
{
|
||||
ApiResult<string> apiResult = new ApiResult<string>();
|
||||
try
|
||||
{
|
||||
if (Device.Id == 0)
|
||||
{
|
||||
Device DeviceInfo = new Device()
|
||||
{
|
||||
Brand = Device.Brand,
|
||||
ColName = Device.ColName,
|
||||
PowerStationId = Device.PowerStationId,
|
||||
DBName = Device.DBName,
|
||||
Id = Device.Id,
|
||||
Name = Device.Name,
|
||||
ProductModel = Device.ProductModel,
|
||||
Remark = Device.Remark,
|
||||
TableName = Device.TableName,
|
||||
Type = Device.Type,
|
||||
UID = Device.PowerStationId + "-" + Device.Type,
|
||||
CreatedBy = myUser.Id
|
||||
};
|
||||
List<string> properties = new List<string>()
|
||||
{
|
||||
"Brand",
|
||||
"ColName",
|
||||
"PowerStationId",
|
||||
"DBName",
|
||||
"Id",
|
||||
"Name",
|
||||
"ProductModel",
|
||||
"Remark",
|
||||
"TableName",
|
||||
"Type",
|
||||
"UID",
|
||||
"CreatedBy"
|
||||
};
|
||||
await powerStationRepository.AddDevice(DeviceInfo,properties);
|
||||
|
||||
apiResult.Code = "0000";
|
||||
apiResult.Msg = "新增成功";
|
||||
}
|
||||
else
|
||||
{
|
||||
Device DeviceInfo = new Device()
|
||||
{
|
||||
Brand = Device.Brand,
|
||||
ColName = Device.ColName,
|
||||
PowerStationId = Device.PowerStationId,
|
||||
DBName = Device.DBName,
|
||||
Id = Device.Id,
|
||||
Name = Device.Name,
|
||||
ProductModel = Device.ProductModel,
|
||||
Remark = Device.Remark,
|
||||
TableName = Device.TableName,
|
||||
Type = Device.Type,
|
||||
UID = Device.PowerStationId + "-" + Device.Type,
|
||||
CreatedBy = myUser.Id
|
||||
};
|
||||
List<string> properties = new List<string>()
|
||||
{
|
||||
"Brand",
|
||||
"ColName",
|
||||
"PowerStationId",
|
||||
"DBName",
|
||||
"Id",
|
||||
"Name",
|
||||
"ProductModel",
|
||||
"Remark",
|
||||
"TableName",
|
||||
"Type",
|
||||
"UID",
|
||||
"CreatedBy"
|
||||
};
|
||||
await powerStationRepository.UpdateDevice(DeviceInfo, properties);
|
||||
apiResult.Code = "0000";
|
||||
apiResult.Msg = "儲存成功";
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
apiResult.Code = "9999";
|
||||
apiResult.Msg = exception.ToString();
|
||||
}
|
||||
return apiResult;
|
||||
}
|
||||
|
||||
public async Task<ActionResult> DeviceTable(int stationId)
|
||||
{
|
||||
List<DeviceTable> deviceTables = new List<DeviceTable>();
|
||||
ApiResult<List<DeviceTable>> apiResult = new ApiResult<List<DeviceTable>>();
|
||||
try
|
||||
{
|
||||
apiResult.Code = "0000";
|
||||
deviceTables = await powerStationRepository.DeviceTable(stationId);
|
||||
foreach (DeviceTable a in deviceTables)
|
||||
{
|
||||
a.Function = @"
|
||||
<button type='button' class='btn btn-primary btn-pills waves-effect waves-themed edit-btn'>修改</button>
|
||||
<button type='button' class='btn btn-danger btn-pills waves-effect waves-themed del-btn'>刪除</button>";
|
||||
}
|
||||
apiResult.Data = deviceTables;
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
apiResult.Code = "9999";
|
||||
apiResult.Msg = exception.ToString();
|
||||
}
|
||||
var result = Json(new
|
||||
{
|
||||
data = apiResult
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 軟刪除單一土地房屋資訊
|
||||
|
||||
@ -37,7 +37,7 @@ namespace SolarPower.Helper
|
||||
var passwordStr = ed.DESDecrypt(dbConfig.Password);
|
||||
|
||||
//var connStr = $"server={serverStr};database={databaseStr};user={rootStr};password={passwordStr};charset=utf8;";
|
||||
var connStr = @"server=127.0.0.1;database=solar_power;user=root;password=000000;charset=utf8;";
|
||||
var connStr = @"server=127.0.0.1;port=3308;database=solar_power;user=root;password=00000000;charset=utf8;";
|
||||
|
||||
this._connectionString = connStr;
|
||||
}
|
||||
|
||||
@ -268,4 +268,68 @@ namespace SolarPower.Models.PowerStation
|
||||
public string ZipCode { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class OperationInfo : Created
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int PowerStationId { get; set; }//電廠id
|
||||
public int Type { get; set; }//廠商類別
|
||||
public string Name { get; set; }//名稱
|
||||
public string ContactPerson { get; set; }//聯絡人
|
||||
public string Phone { get; set; }//電話
|
||||
public string Email { get; set; }//Email
|
||||
}
|
||||
public class OperationStationId
|
||||
{
|
||||
public int stationId { get; set; }
|
||||
}
|
||||
public class OperationTable : OperationInfo
|
||||
{
|
||||
public string CreatedName { get; set; }//建立者名稱
|
||||
public string Function { get; set; }//功能
|
||||
public string TypeName { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 設備裝置下拉選單
|
||||
/// </summary>
|
||||
public class Type
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string EName { get; set; }
|
||||
}
|
||||
public class Root
|
||||
{
|
||||
public List<Type> Type { get; set; }
|
||||
}
|
||||
public class Variable
|
||||
{
|
||||
public string name { get; set; }
|
||||
public string value { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 設備
|
||||
/// </summary>
|
||||
public class DeviceInfo
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int PowerStationId { get; set; }//所屬電站編號
|
||||
public string Name { get; set; }//名稱
|
||||
public string Type { get; set; }//類型
|
||||
public string Brand { get; set; }//廠牌
|
||||
public string ProductModel { get; set; }//型號
|
||||
public string DBName { get; set; }
|
||||
public string TableName { get; set; }
|
||||
public string ColName { get; set; }
|
||||
public string Remark { get; set; }
|
||||
}
|
||||
public class Device : DeviceInfo
|
||||
{
|
||||
public string UID { get; set; }//設備編號
|
||||
public int CreatedBy { get; set; }//建立者
|
||||
}
|
||||
public class DeviceTable : DeviceInfo
|
||||
{
|
||||
public string UID { get; set; }//設備編號
|
||||
public string Function { get; set; }//功能
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,12 +1,15 @@
|
||||
using Dapper;
|
||||
using SolarPower.Helper;
|
||||
using SolarPower.Models.PowerStation;
|
||||
using SolarPower.Models.User;
|
||||
using SolarPower.Repository.Interface;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace SolarPower.Repository.Implement
|
||||
{
|
||||
@ -403,5 +406,241 @@ namespace SolarPower.Repository.Implement
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<int> AddOperation(OperationInfo operation, List<string> properties)
|
||||
{
|
||||
using (IDbConnection conn = _databaseHelper.GetConnection())
|
||||
{
|
||||
int count;
|
||||
conn.Open();
|
||||
try
|
||||
{
|
||||
string sql = GenerateInsertQueryWithCustomTable(properties, "operation_firm");
|
||||
|
||||
count = await conn.ExecuteAsync(sql, operation);
|
||||
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
throw exception;
|
||||
}
|
||||
finally
|
||||
{
|
||||
conn.Close();
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 運維DataTable
|
||||
/// </summary>
|
||||
/// <param name="stationId"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<OperationTable>> OperationTable (int stationId)
|
||||
{
|
||||
|
||||
using (IDbConnection conn = _databaseHelper.GetConnection())
|
||||
{
|
||||
List<OperationTable> operation = new List<OperationTable>();
|
||||
conn.Open();
|
||||
try
|
||||
{
|
||||
string sql = @$"SELECT operation_firm.Name,
|
||||
operation_firm.PowerStationId,
|
||||
operation_firm.Id,operation_firm.ContactPerson,operation_firm.Phone,operation_firm.Email,user.Name AS CreatedName,operation_firm.CreatedAt,operation_firm.Type
|
||||
FROM operation_firm LEFT JOIN user ON operation_firm.CreatedBy = user.id WHERE operation_firm.Deleted = 0 AND operation_firm.PowerStationId = @StationId";
|
||||
operation = (await conn.QueryAsync<OperationTable>(sql, new { StationId = stationId })).ToList();
|
||||
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
throw exception;
|
||||
}
|
||||
finally
|
||||
{
|
||||
conn.Close();
|
||||
}
|
||||
return operation;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 選取單一運維
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<OperationInfo> OneOperationInfo (int id)
|
||||
{
|
||||
using (IDbConnection conn = _databaseHelper.GetConnection())
|
||||
{
|
||||
OperationInfo operation;
|
||||
conn.Open();
|
||||
try
|
||||
{
|
||||
string sql = @$"SELECT * FROM operation_firm WHERE Id = @Id";
|
||||
operation = await conn.QueryFirstOrDefaultAsync<OperationInfo>(sql, new { Id = id });
|
||||
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
throw exception;
|
||||
}
|
||||
finally
|
||||
{
|
||||
conn.Close();
|
||||
}
|
||||
return operation;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task UpdateOperation(OperationInfo operation , List<string> properties)
|
||||
{
|
||||
using IDbConnection conn = _databaseHelper.GetConnection();
|
||||
conn.Open();
|
||||
var trans = conn.BeginTransaction();
|
||||
try
|
||||
{
|
||||
var updateQuery = new StringBuilder($"UPDATE operation_firm SET ");
|
||||
properties.ForEach(property =>
|
||||
{
|
||||
if (!property.Equals("Id"))
|
||||
{
|
||||
updateQuery.Append($"{property}=@{property},");
|
||||
}
|
||||
});
|
||||
updateQuery.Remove(updateQuery.Length - 1, 1); //remove last comma
|
||||
updateQuery.Append(" WHERE id = @Id");
|
||||
await conn.ExecuteAsync(updateQuery.ToString(), operation, trans);
|
||||
trans.Commit();
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
trans.Rollback();
|
||||
throw exception;
|
||||
}
|
||||
finally
|
||||
{
|
||||
conn.Close();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 裝置類型下拉選單
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<List<UserSelectItemList>> DeviceType()
|
||||
{
|
||||
List<UserSelectItemList> result = new List<UserSelectItemList>();
|
||||
using IDbConnection conn = _databaseHelper.GetConnection();
|
||||
conn.Open();
|
||||
var trans = conn.BeginTransaction();
|
||||
try
|
||||
{
|
||||
string sql = @$"SELECT * FROM variable WHERE name = @name";
|
||||
var json = await conn.QueryFirstOrDefaultAsync<Variable>(sql, new { name = "Type" });
|
||||
Root jsonfor = JsonSerializer.Deserialize<Root>(json.value);
|
||||
foreach(Models.PowerStation.Type a in jsonfor.Type)
|
||||
{
|
||||
UserSelectItemList KeyValue = new UserSelectItemList
|
||||
{
|
||||
Value = a.EName,
|
||||
Text = a.Name
|
||||
};
|
||||
result.Add(KeyValue);
|
||||
}
|
||||
trans.Commit();
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
trans.Rollback();
|
||||
throw exception;
|
||||
}
|
||||
finally
|
||||
{
|
||||
conn.Close();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/// <summary>
|
||||
/// 新增裝置資料
|
||||
/// </summary>
|
||||
/// <param name="DeviceInfo"></param>
|
||||
/// <param name="properties"></param>
|
||||
/// <returns></returns>
|
||||
public async Task AddDevice(Device DeviceInfo, List<string> properties)
|
||||
{
|
||||
using IDbConnection conn = _databaseHelper.GetConnection();
|
||||
conn.Open();
|
||||
try
|
||||
{
|
||||
string sql = GenerateInsertQueryWithCustomTable(properties, "device");
|
||||
|
||||
await conn.ExecuteAsync(sql, DeviceInfo);
|
||||
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
throw exception;
|
||||
}
|
||||
finally
|
||||
{
|
||||
conn.Close();
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 修改裝置資料
|
||||
/// </summary>
|
||||
/// <param name="DeviceInfo"></param>
|
||||
/// <param name="properties"></param>
|
||||
/// <returns></returns>
|
||||
public async Task UpdateDevice(Device DeviceInfo, List<string> properties)
|
||||
{
|
||||
using IDbConnection conn = _databaseHelper.GetConnection();
|
||||
conn.Open();
|
||||
var trans = conn.BeginTransaction();
|
||||
try
|
||||
{
|
||||
var updateQuery = GenerateUpdateQueryOtherTable(properties, "device");
|
||||
await conn.ExecuteAsync(updateQuery.ToString(), DeviceInfo, trans);
|
||||
trans.Commit();
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
trans.Rollback();
|
||||
throw exception;
|
||||
}
|
||||
finally
|
||||
{
|
||||
conn.Close();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 裝置dataTable
|
||||
/// </summary>
|
||||
/// <param name="stationId"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<DeviceTable>> DeviceTable(int stationId)
|
||||
{
|
||||
using IDbConnection conn = _databaseHelper.GetConnection();
|
||||
conn.Open();
|
||||
List<DeviceTable> Device = new List<DeviceTable>();
|
||||
try
|
||||
{
|
||||
string sql = @$"SELECT * FROM device WHERE Deleted = 0 AND PowerStationId = @StationId";
|
||||
Device = (await conn.QueryAsync<DeviceTable>(sql, new { StationId = stationId })).ToList();
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
throw exception;
|
||||
}
|
||||
finally
|
||||
{
|
||||
conn.Close();
|
||||
}
|
||||
return Device;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,6 +88,7 @@ namespace SolarPower.Repository.Implement
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 透過Id,軟刪除單一筆資料
|
||||
/// </summary>
|
||||
@ -121,6 +122,40 @@ namespace SolarPower.Repository.Implement
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 透過Id,軟刪除單一筆資料(不同資料表)
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="tablename"></param>
|
||||
/// <returns></returns>
|
||||
public virtual async Task DeleteOneOtherTable(int id,string table_name)
|
||||
{
|
||||
using (IDbConnection conn = this._databaseHelper.GetConnection())
|
||||
{
|
||||
conn.Open();
|
||||
using (var trans = conn.BeginTransaction())
|
||||
{
|
||||
try
|
||||
{
|
||||
var sql = $"UPDATE {table_name} 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();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 取得所有資料
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using SolarPower.Models.PowerStation;
|
||||
using SolarPower.Models.User;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -97,5 +98,38 @@ namespace SolarPower.Repository.Interface
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task DeleteOneLandBuildingInfo(int id);
|
||||
Task<int> AddOperation(OperationInfo operation, List<string> properties);
|
||||
/// <summary>
|
||||
/// 運維dataTable
|
||||
/// </summary>
|
||||
/// <param name="stationId"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<OperationTable>> OperationTable (int stationId);
|
||||
Task<OperationInfo> OneOperationInfo (int stationId);
|
||||
Task UpdateOperation(OperationInfo operation, List<string> properties);
|
||||
/// <summary>
|
||||
/// 裝置類型下拉式選單
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<List<UserSelectItemList>> DeviceType();
|
||||
/// <summary>
|
||||
/// 新增 裝置
|
||||
/// </summary>
|
||||
/// <param name=""></param>
|
||||
/// <returns></returns>
|
||||
Task AddDevice(Device DeviceInfo, List<string> properties);
|
||||
/// <summary>
|
||||
/// 修改 裝置
|
||||
/// </summary>
|
||||
/// <param name="DeviceInfo"></param>
|
||||
/// <param name="properties"></param>
|
||||
/// <returns></returns>
|
||||
Task UpdateDevice(Device DeviceInfo, List<string> properties);
|
||||
/// <summary>
|
||||
/// 設備datatable
|
||||
/// </summary>
|
||||
/// <param name="stationId"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<DeviceTable>> DeviceTable(int stationId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -58,5 +58,13 @@ namespace SolarPower.Repository.Interface
|
||||
/// <param name="Id"></param>
|
||||
/// <returns></returns>
|
||||
Task PurgeOneAsync(int id);
|
||||
/// <summary>
|
||||
/// 透過Id,軟刪除單一筆資料(不同資料表)
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="tablename"></param>
|
||||
/// <returns></returns>
|
||||
Task DeleteOneOtherTable(int id, string tablename);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -92,11 +92,177 @@
|
||||
var powerStationData;
|
||||
var selectedLandBuildingId;
|
||||
var isLandBuildingLock = false;
|
||||
var selected_id = 0;
|
||||
$(function () {
|
||||
|
||||
var url = new URL(location.href);
|
||||
stationId = url.searchParams.get('stationId');
|
||||
//#region 運維列表 DataTable
|
||||
OperationTable = $("#Operation_table").DataTable({
|
||||
"paging": true,
|
||||
"lengthChange": false,
|
||||
"searching": false,
|
||||
"ordering": true,
|
||||
"info": true,
|
||||
"autoWidth": false,
|
||||
"responsive": true,
|
||||
"order": [[7, "desc"]],
|
||||
"columns": [{
|
||||
"data": "typeName"
|
||||
}, {
|
||||
"data": "name"
|
||||
}, {
|
||||
"data": "contactPerson"
|
||||
}, {
|
||||
"data": "phone"
|
||||
}, {
|
||||
"data": "email"
|
||||
}, {
|
||||
"data": "createdAt"
|
||||
}, {
|
||||
"data": "createdName"
|
||||
}, {
|
||||
"data": "function"
|
||||
}],
|
||||
"columnDefs": [{
|
||||
'targets': 1,
|
||||
'searchable': false,
|
||||
'orderable': false,
|
||||
'className': 'dt-body-center'
|
||||
}],
|
||||
"language": {
|
||||
"emptyTable": "無資料...",
|
||||
"processing": "處理中...",
|
||||
"loadingRecords": "載入中...",
|
||||
"lengthMenu": "顯示 _MENU_ 項結果",
|
||||
"zeroRecords": "沒有符合的結果",
|
||||
"info": "顯示第 _START_ 至 _END_ 項結果,共 _TOTAL_ 項",
|
||||
"infoEmpty": "顯示第 0 至 0 項結果,共 0 項",
|
||||
"infoFiltered": "(從 _MAX_ 項結果中過濾)",
|
||||
"infoPostFix": "",
|
||||
"search": "搜尋:",
|
||||
"paginate": {
|
||||
"first": "第一頁",
|
||||
"previous": "上一頁",
|
||||
"next": "下一頁",
|
||||
"last": "最後一頁"
|
||||
},
|
||||
"aria": {
|
||||
"sortAscending": ": 升冪排列",
|
||||
"sortDescending": ": 降冪排列"
|
||||
}
|
||||
},
|
||||
'createdRow': function (row, data, dataIndex) {
|
||||
$(row).attr('data-id', data.id);
|
||||
},
|
||||
"ajax": {
|
||||
"url": "/PowerStation/OperationTable",
|
||||
"type": "POST",
|
||||
"data": function (d) {
|
||||
d.stationId = stationId;
|
||||
},
|
||||
"dataSrc": function (rel) {
|
||||
if (rel.data.code == "9999") {
|
||||
toast_error(rel.data.msg);
|
||||
return;
|
||||
}
|
||||
|
||||
data = rel.data.data;
|
||||
|
||||
if (data == null || data.length == 0) {
|
||||
this.data = [];
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
||||
});
|
||||
//#endregion
|
||||
//#region 運維列表 DataTable
|
||||
DeviceTable = $("#Device_table").DataTable({
|
||||
"paging": true,
|
||||
"lengthChange": false,
|
||||
"searching": false,
|
||||
"ordering": true,
|
||||
"info": true,
|
||||
"autoWidth": false,
|
||||
"responsive": true,
|
||||
"order": [[9, "desc"]],
|
||||
"columns": [{
|
||||
"data": "uID"
|
||||
}, {
|
||||
"data": "name"
|
||||
}, {
|
||||
"data": "type"
|
||||
}, {
|
||||
"data": "brand"
|
||||
}, {
|
||||
"data": "productModel"
|
||||
}, {
|
||||
"data": "dBName"
|
||||
}, {
|
||||
"data": "tableName"
|
||||
}, {
|
||||
"data": "colName"
|
||||
}, {
|
||||
"data": "remark"
|
||||
},{
|
||||
"data": "function"
|
||||
}],
|
||||
"columnDefs": [{
|
||||
'targets': 1,
|
||||
'searchable': false,
|
||||
'orderable': false,
|
||||
'className': 'dt-body-center'
|
||||
}],
|
||||
"language": {
|
||||
"emptyTable": "無資料...",
|
||||
"processing": "處理中...",
|
||||
"loadingRecords": "載入中...",
|
||||
"lengthMenu": "顯示 _MENU_ 項結果",
|
||||
"zeroRecords": "沒有符合的結果",
|
||||
"info": "顯示第 _START_ 至 _END_ 項結果,共 _TOTAL_ 項",
|
||||
"infoEmpty": "顯示第 0 至 0 項結果,共 0 項",
|
||||
"infoFiltered": "(從 _MAX_ 項結果中過濾)",
|
||||
"infoPostFix": "",
|
||||
"search": "搜尋:",
|
||||
"paginate": {
|
||||
"first": "第一頁",
|
||||
"previous": "上一頁",
|
||||
"next": "下一頁",
|
||||
"last": "最後一頁"
|
||||
},
|
||||
"aria": {
|
||||
"sortAscending": ": 升冪排列",
|
||||
"sortDescending": ": 降冪排列"
|
||||
}
|
||||
},
|
||||
'createdRow': function (row, data, dataIndex) {
|
||||
$(row).attr('data-id', data.id);
|
||||
},
|
||||
"ajax": {
|
||||
"url": "/PowerStation/DeviceTable",
|
||||
"type": "POST",
|
||||
"data": function (d) {
|
||||
d.stationId = stationId;
|
||||
},
|
||||
"dataSrc": function (rel) {
|
||||
if (rel.data.code == "9999") {
|
||||
toast_error(rel.data.msg);
|
||||
return;
|
||||
}
|
||||
|
||||
data = rel.data.data;
|
||||
|
||||
if (data == null || data.length == 0) {
|
||||
this.data = [];
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
||||
});
|
||||
//#endregion
|
||||
//#region 電站資料 view 控制
|
||||
if (stationId == 'new') {
|
||||
//#region 電站基本資料
|
||||
@ -241,7 +407,22 @@
|
||||
});
|
||||
});
|
||||
//#endregion
|
||||
var url_DeviceType = "/PowerStation/GetDeviceTypeSelectOptionList";
|
||||
$.get(url_DeviceType, function (rel) {
|
||||
if (rel.code != "0000") {
|
||||
toast_error(rel.msg);
|
||||
return;
|
||||
}
|
||||
$("Device_Type_modal").empty();
|
||||
|
||||
$.each(rel.data, function (index, val) {
|
||||
$("#Device_Type_modal").append($("<option />").val(val.value).text(val.text));
|
||||
});
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
//#region 代管切換
|
||||
$("#check_escrow").click(function () {
|
||||
@ -959,9 +1140,148 @@
|
||||
'</div>';
|
||||
|
||||
dom.append(appendStr);
|
||||
|
||||
|
||||
}
|
||||
|
||||
//#region 新增維運資料
|
||||
function AddOperation()
|
||||
{
|
||||
$("#Operation-modal .modal-title").html("運維廠商資料 - 新增");
|
||||
$("#Operation-form").trigger("reset");
|
||||
$("#Operation-modal").modal();
|
||||
}
|
||||
//#endregion
|
||||
//#region 儲存運維資料
|
||||
function SaveOperation() {
|
||||
|
||||
if ($("#Operation-form").valid()) {
|
||||
var url = "/PowerStation/SaveOperation";
|
||||
var send_data = {
|
||||
Id: selected_id,
|
||||
PowerStationId: stationId,
|
||||
Type: $("#Operation_role_modal").val(),
|
||||
Name: $("#Operation_factory_modal").val(),
|
||||
ContactPerson: $("#Operation_name_modal").val(),
|
||||
Phone: $("#Operation_phone_modal").val(),
|
||||
Email: $("#Operation_email_modal").val(),
|
||||
}
|
||||
|
||||
$.post(url, send_data, function (rel) {
|
||||
if (rel.code != "0000") {
|
||||
toast_error(rel.msg);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
toast_ok(rel.msg);
|
||||
$('#Operation-modal').modal('hide');
|
||||
OperationTable.ajax.reload();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
}, 'json');
|
||||
}
|
||||
}
|
||||
//#endregion
|
||||
//#region 取一筆運維
|
||||
$('#Operation_table').on("click", "button.edit-btn", function () {
|
||||
$("#Operation-modal .modal-title").html("運維廠商資料 - 編輯");
|
||||
|
||||
selected_id = $(this).parents('tr').attr('data-id');
|
||||
|
||||
//取得單一運維基本資料
|
||||
var url = "/PowerStation/GetOneOperation/";
|
||||
|
||||
var send_data = {
|
||||
id: selected_id
|
||||
}
|
||||
|
||||
|
||||
$.post(url, send_data, function (rel) {
|
||||
if (rel.code != "0000") {
|
||||
toast_error(rel.msg);
|
||||
return;
|
||||
}
|
||||
|
||||
$("#Operation_role_modal").val(rel.data.type);
|
||||
$("#Operation_factory_modal").val(rel.data.name);
|
||||
$("#Operation_name_modal").val(rel.data.contactPerson);
|
||||
$("#Operation_phone_modal").val(rel.data.phone);
|
||||
$("#Operation_email_modal").val(rel.data.email);
|
||||
|
||||
$("#Operation-modal").modal();
|
||||
}, 'json');
|
||||
|
||||
});
|
||||
//#endregion
|
||||
//#region 刪除運維
|
||||
$('#Operation_table').on("click", "button.del-btn", function () {
|
||||
|
||||
selected_id = $(this).parents('tr').attr('data-id');
|
||||
|
||||
var url = "/PowerStation/DeleteOneOperation/";
|
||||
|
||||
var send_data = {
|
||||
Id: selected_id
|
||||
}
|
||||
|
||||
$.post(url, send_data, function (rel) {
|
||||
if (rel.code == "9999") {
|
||||
toast_error(rel.msg);
|
||||
return;
|
||||
}
|
||||
|
||||
toast_ok(rel.msg);
|
||||
OperationTable.ajax.reload();
|
||||
}, 'json');
|
||||
|
||||
});
|
||||
//#endregion
|
||||
//#region 新增裝置資料
|
||||
function AddDevice() {
|
||||
$("#Device-modal .modal-title").html("裝置資料 - 新增");
|
||||
$("#Device-form").trigger("reset");
|
||||
$("#Device-modal").modal();
|
||||
}
|
||||
//#endregion
|
||||
|
||||
//#region 儲存裝置資料
|
||||
function SaveDevice() {
|
||||
|
||||
if ($("#Device-form").valid()) {
|
||||
var url = "/PowerStation/SaveDevice";
|
||||
var send_data = {
|
||||
Id: selected_id,
|
||||
PowerStationId: stationId,
|
||||
Name: $("#Device_Name_modal").val(),
|
||||
Type: $("#Device_Type_modal").val(),
|
||||
Brand: $("#Device_Brand_modal").val(),
|
||||
ProductModel: $("#Device_ProductModel_modal").val(),
|
||||
DBName: $("#Device_DBName_modal").val(),
|
||||
TableName: $("#Device_TableName_modal").val(),
|
||||
ColName: $("#Device_ColName_modal").val(),
|
||||
Remark: $("#Device_Remark_modal").val(),
|
||||
}
|
||||
$.post(url, send_data, function (rel) {
|
||||
if (rel.code != "0000") {
|
||||
toast_error(rel.msg);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
toast_ok(rel.msg);
|
||||
$('#Device-modal').modal('hide');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
}, 'json');
|
||||
}
|
||||
}
|
||||
//#endregion
|
||||
|
||||
|
||||
|
||||
//#region 土地與房屋按鈕控制
|
||||
//儲存
|
||||
|
||||
@ -1,13 +1,12 @@
|
||||
<div class="row mb-5">
|
||||
<div class="col-6"><h3>裝置設定</h3></div>
|
||||
<div class="col-6 text-right">
|
||||
<button type="button" class="btn btn-success waves-effect waves-themed mb-3">
|
||||
<span class="fal fa-plus mr-1"></span>
|
||||
新增
|
||||
</button>
|
||||
<a href="javascript:;" class="btn btn-success waves-effect waves-themed mb-3" id="addDevice-btn" onclick="AddDevice()">
|
||||
<span class="fal fa-plus mr-1"></span>新增
|
||||
</a>
|
||||
</div>
|
||||
<div class="w-100">
|
||||
<table class="table table-bordered table-hover m-0 text-center">
|
||||
<table id="Device_table" class="table table-bordered table-hover m-0 text-center">
|
||||
<thead class="thead-themed">
|
||||
<tr>
|
||||
<th>設備ID</th>
|
||||
@ -70,3 +69,70 @@
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="Device-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-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title">
|
||||
裝置資料 - 新增
|
||||
</h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true"><i class="fal fa-times"></i></span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form class="Device-form" id="Device-form">
|
||||
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-6">
|
||||
<label class="form-label" for="Device_Name_modal"><span class="text-danger">*</span>裝置名稱</label>
|
||||
<input type="text" id="Device_Name_modal" name="Device_Name_modal" class="form-control">
|
||||
</div>
|
||||
<div class="form-group col-lg-6">
|
||||
<label class="form-label" for="Device_Type_modal"><span class="text-danger">*</span>裝置類型</label>
|
||||
<select class="form-control" id="Device_Type_modal">
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-lg-6">
|
||||
<label class="form-label" for="Device_Brand_modal"><span class="text-danger">*</span>廠牌</label>
|
||||
<input type="text" id="Device_Brand_modal" name="Device_Brand_modal" class="form-control">
|
||||
</div>
|
||||
<div class="form-group col-lg-6">
|
||||
<label class="form-label" for="Device_ProductModel_modal"><span class="text-danger">*</span>型號</label>
|
||||
<input type="text" id="Device_ProductModel_modal" name="Device_ProductModel_modal" class="form-control">
|
||||
</div>
|
||||
<div class="form-group col-lg-6">
|
||||
<div style="margin-bottom: 0.3rem">
|
||||
<label class="form-label" for="Device_DBName_modal"><span class="text-danger">*</span>DBName</label>
|
||||
<input type="text" id="Device_DBName_modal" name="Device_DBName_modal" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-lg-6">
|
||||
<div style="margin-bottom: 0.3rem">
|
||||
<label class="form-label" for="Device_TableName_modal"><span class="text-danger">*</span>tableName</label>
|
||||
<input type="text" id="Device_TableName_modal" name="Device_TableName_modal" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-lg-6">
|
||||
<div style="margin-bottom: 0.3rem">
|
||||
<label class="form-label" for="Device_ColName_modal"><span class="text-danger">*</span>columnName</label>
|
||||
<input type="text" id="Device_ColName_modal" name="Device_ColName_modal" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-lg-6">
|
||||
<div style="margin-bottom: 0.3rem">
|
||||
<label class="form-label" for="Device_Remark_modal"><span class="text-danger">*</span>備註</label>
|
||||
<input type="text" id="Device_Remark_modal" name="Device_Remark_modal" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
|
||||
<button type="button" class="btn btn-primary" onclick="SaveDevice()">確定</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -1,64 +1,78 @@
|
||||
<div class="row mb-5">
|
||||
<div class="col-6"><h3>運維資料</h3></div>
|
||||
<div class="col-6 text-right">
|
||||
<button type="button" class="btn btn-success waves-effect waves-themed mb-3">
|
||||
<span class="fal fa-plus mr-1"></span>
|
||||
新增
|
||||
</button>
|
||||
<a href="javascript:;" class="btn btn-success waves-effect waves-themed mb-3" id="addOperation-btn" onclick="AddOperation()">
|
||||
<span class="fal fa-plus mr-1"></span>新增
|
||||
</a>
|
||||
</div>
|
||||
<div class="w-100">
|
||||
<table class="table table-bordered table-hover m-0 text-center">
|
||||
<table id="Operation_table" class="table table-bordered table-hover m-0 text-center">
|
||||
<thead class="thead-themed">
|
||||
<tr>
|
||||
<th>廠商類別</th>
|
||||
<th>廠商</th>
|
||||
<th>聯絡人</th>
|
||||
<th>電話</th>
|
||||
<th>email</th>
|
||||
<th>Email</th>
|
||||
<th>建立日期</th>
|
||||
<th>建立人</th>
|
||||
<th>功能</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row">施工</th>
|
||||
<td>台達電</td>
|
||||
<td>林先生</td>
|
||||
<td>0928-123456</td>
|
||||
<td>lin@tdd.com.tw</td>
|
||||
<td>2021/06/02</td>
|
||||
<td>周杰倫</td>
|
||||
<td>
|
||||
<button type="button" class="btn btn-primary btn-pills waves-effect waves-themed">修改</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">清洗</th>
|
||||
<td>潔寶</td>
|
||||
<td>暴風女</td>
|
||||
<td>0928-654321</td>
|
||||
<td>storm@mavel.com</td>
|
||||
<td>2021/06/03</td>
|
||||
<td>周杰倫</td>
|
||||
<td>
|
||||
<button type="button" class="btn btn-primary btn-pills waves-effect waves-themed">修改</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">維運</th>
|
||||
<td>華碩</td>
|
||||
<td>雷神索爾</td>
|
||||
<td>0937-123123</td>
|
||||
<td>thor@asus.com</td>
|
||||
<td>2021/06/04</td>
|
||||
<td>周杰倫</td>
|
||||
<td>
|
||||
<button type="button" class="btn btn-primary btn-pills waves-effect waves-themed">修改</button>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</table >
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal fade" id="Operation-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-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title">
|
||||
運維廠商資料 - 新增
|
||||
</h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true"><i class="fal fa-times"></i></span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form class="Operation-form" id="Operation-form">
|
||||
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-6">
|
||||
<label class="form-label" for="Operation_role_modal"><span class="text-danger">*</span>廠商類別</label>
|
||||
<select class="form-control" id="Operation_role_modal">
|
||||
<option value="0">施工</option>
|
||||
<option value="1">清洗</option>
|
||||
<option value="2">維運</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-lg-6">
|
||||
<label class="form-label" for="Operation_factory_modal"><span class="text-danger">*</span>廠商</label>
|
||||
<input type="text" id="Operation_factory_modal" name="Operation_factory_modal" class="form-control">
|
||||
</div>
|
||||
<div class="form-group col-lg-6">
|
||||
<label class="form-label" for="Operation_name_modal"><span class="text-danger">*</span>聯絡人</label>
|
||||
<input type="text" id="Operation_name_modal" name="Operation_name_modal" class="form-control">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-lg-6">
|
||||
<label class="form-label" for="Operation_phone_modal"><span class="text-danger">*</span>電話</label>
|
||||
<input type="text" id="Operation_phone_modal" name="Operation_phone_modal" class="form-control">
|
||||
</div>
|
||||
<div class="form-group col-lg-6">
|
||||
<div style="margin-bottom: 0.3rem">
|
||||
<label class="form-label" for="Operation_email_modal"><span class="text-danger">*</span>Email</label>
|
||||
<input type="text" id="Operation_email_modal" name="Operation_email_modal" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
|
||||
<button type="button" class="btn btn-primary" onclick="SaveOperation()">確定</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -612,14 +612,14 @@
|
||||
});
|
||||
//#endregion
|
||||
|
||||
//#region 編輯系統管理員
|
||||
//#region 編輯使用者管理員
|
||||
$('#user_table').on("click", "button.edit-btn", function () {
|
||||
|
||||
$("#user-modal .modal-title").html("人員基本資料 - 編輯");
|
||||
|
||||
selected_id = $(this).parents('tr').attr('data-id');
|
||||
|
||||
//取得單一系統管理員
|
||||
//取得單一使用者管理員
|
||||
var url = "/User/GetOneUser/";
|
||||
|
||||
var send_data = {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user