Merge branch 'master' of https://gitea.mjm-staging.developers-homelab.net/BIMS/BIMS
This commit is contained in:
commit
8f54db2c24
@ -19,12 +19,14 @@ namespace Backend.Controllers
|
|||||||
{
|
{
|
||||||
private readonly IBackendRepository backendRepository;
|
private readonly IBackendRepository backendRepository;
|
||||||
private string mapFileSaveAsPath = "";
|
private string mapFileSaveAsPath = "";
|
||||||
|
private string buildMapFileSaveAsPath = "";
|
||||||
|
|
||||||
public BuildInfoController(IBackendRepository backendRepository)
|
public BuildInfoController(IBackendRepository backendRepository)
|
||||||
{
|
{
|
||||||
this.backendRepository = backendRepository;
|
this.backendRepository = backendRepository;
|
||||||
|
|
||||||
mapFileSaveAsPath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "upload", "floor_map");
|
mapFileSaveAsPath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "upload", "floor_map");
|
||||||
|
buildMapFileSaveAsPath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "upload", "build_map");
|
||||||
}
|
}
|
||||||
|
|
||||||
public IActionResult Index()
|
public IActionResult Index()
|
||||||
@ -44,7 +46,8 @@ namespace Backend.Controllers
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var sqlString = @$"SELECT A.priority, A.building_tag, A.full_name, A.ip_address, A.ip_port, (SELECT COUNT(*) FROM floor f WHERE f.deleted = 0 AND f.building_tag = A.building_tag) AS 'floorNum', A.created_at
|
var sqlString = @$"SELECT A.priority, A.building_tag, A.full_name, A.ip_address, A.ip_port, (SELECT COUNT(*) FROM floor f WHERE f.deleted = 0 AND f.building_tag = A.building_tag) AS 'floorNum', A.created_at,
|
||||||
|
A.orgName_3D, A.extName_3D
|
||||||
FROM building A
|
FROM building A
|
||||||
WHERE A.deleted = 0
|
WHERE A.deleted = 0
|
||||||
ORDER BY A.priority ASC, A.created_at DESC";
|
ORDER BY A.priority ASC, A.created_at DESC";
|
||||||
@ -69,7 +72,7 @@ namespace Backend.Controllers
|
|||||||
/// <param name="post"></param>
|
/// <param name="post"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<ApiResult<string>> SaveBuildInfo(BuildInfo post)
|
public async Task<ApiResult<string>> SaveBuildInfo([FromForm] BuildInfo post)
|
||||||
{
|
{
|
||||||
ApiResult<string> apiResult = new ApiResult<string>();
|
ApiResult<string> apiResult = new ApiResult<string>();
|
||||||
|
|
||||||
@ -101,6 +104,7 @@ namespace Backend.Controllers
|
|||||||
//新增
|
//新增
|
||||||
//抓取當前的Priority
|
//抓取當前的Priority
|
||||||
var current_priority = await backendRepository.GetCurrentPriority("building");
|
var current_priority = await backendRepository.GetCurrentPriority("building");
|
||||||
|
var map_3d_guid = new Guid();
|
||||||
|
|
||||||
Dictionary<string, object> building = new Dictionary<string, object>();
|
Dictionary<string, object> building = new Dictionary<string, object>();
|
||||||
building = new Dictionary<string, object>()
|
building = new Dictionary<string, object>()
|
||||||
@ -110,10 +114,28 @@ namespace Backend.Controllers
|
|||||||
{ "@ip_address", post.Ip_address},
|
{ "@ip_address", post.Ip_address},
|
||||||
{ "@ip_port", post.Ip_port},
|
{ "@ip_port", post.Ip_port},
|
||||||
{ "@priority", current_priority + 1},
|
{ "@priority", current_priority + 1},
|
||||||
|
{ "@orgName_3D", post.orgName_3D},
|
||||||
|
{ "@saveName_3D", map_3d_guid},
|
||||||
|
{ "@extName_3D", post.extName_3D},
|
||||||
{ "@created_by", myUserInfo.Userinfo_guid}
|
{ "@created_by", myUserInfo.Userinfo_guid}
|
||||||
};
|
};
|
||||||
await backendRepository.AddOneByCustomTable(building, "building");
|
await backendRepository.AddOneByCustomTable(building, "building");
|
||||||
|
|
||||||
|
if (post.orgName_3D != null && post.extName_3D != null)
|
||||||
|
{
|
||||||
|
var fileName = map_3d_guid + "." + post.extName_3D;
|
||||||
|
|
||||||
|
var fullPath = Path.Combine(buildMapFileSaveAsPath, fileName);
|
||||||
|
|
||||||
|
if (!System.IO.Directory.Exists(buildMapFileSaveAsPath))
|
||||||
|
System.IO.Directory.CreateDirectory(buildMapFileSaveAsPath);
|
||||||
|
|
||||||
|
using (var stream = new FileStream(fullPath, FileMode.Create))
|
||||||
|
{
|
||||||
|
post.Map3dFile.CopyTo(stream);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
apiResult.Code = "0000";
|
apiResult.Code = "0000";
|
||||||
apiResult.Msg = "新增成功";
|
apiResult.Msg = "新增成功";
|
||||||
}
|
}
|
||||||
@ -142,7 +164,7 @@ namespace Backend.Controllers
|
|||||||
/// <param name="post"></param>
|
/// <param name="post"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<ApiResult<string>> EditBuildInfo(BuildInfo post)
|
public async Task<ApiResult<string>> EditBuildInfo([FromForm] BuildInfo post)
|
||||||
{
|
{
|
||||||
ApiResult<string> apiResult = new ApiResult<string>();
|
ApiResult<string> apiResult = new ApiResult<string>();
|
||||||
|
|
||||||
@ -153,6 +175,10 @@ namespace Backend.Controllers
|
|||||||
|
|
||||||
var sWhere = $@"deleted = 0 AND ip_address = @ip_address AND ip_port = @ip_port AND building_tag != @building_tag";
|
var sWhere = $@"deleted = 0 AND ip_address = @ip_address AND ip_port = @ip_port AND building_tag != @building_tag";
|
||||||
var buildInfos = await backendRepository.GetAllAsync<BuildInfo>("building", sWhere, new { ip_address = post.Ip_address, ip_port = post.Ip_port, building_tag = post.building_tag });
|
var buildInfos = await backendRepository.GetAllAsync<BuildInfo>("building", sWhere, new { ip_address = post.Ip_address, ip_port = post.Ip_port, building_tag = post.building_tag });
|
||||||
|
|
||||||
|
sWhere = $@"deleted = 0 AND building_tag = @building_tag";
|
||||||
|
var buildInfo = await backendRepository.GetOneAsync<BuildInfo>("building", sWhere, new { building_tag = post.building_tag });
|
||||||
|
|
||||||
if (buildInfos.Count == 0)
|
if (buildInfos.Count == 0)
|
||||||
{
|
{
|
||||||
judgeIPAddressRepeat = false;
|
judgeIPAddressRepeat = false;
|
||||||
@ -166,11 +192,44 @@ namespace Backend.Controllers
|
|||||||
{ "@full_name", post.Full_name},
|
{ "@full_name", post.Full_name},
|
||||||
{ "@ip_address", post.Ip_address},
|
{ "@ip_address", post.Ip_address},
|
||||||
{ "@ip_port", post.Ip_port},
|
{ "@ip_port", post.Ip_port},
|
||||||
|
{ "@orgName_3D", post.orgName_3D},
|
||||||
|
{ "@extName_3D", post.extName_3D},
|
||||||
{ "@updated_by", myUserInfo.Userinfo_guid},
|
{ "@updated_by", myUserInfo.Userinfo_guid},
|
||||||
{ "@updated_at", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}
|
{ "@updated_at", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}
|
||||||
};
|
};
|
||||||
await backendRepository.UpdateOneByCustomTable(building, "building", "building_tag='" + post.building_tag + "'");
|
await backendRepository.UpdateOneByCustomTable(building, "building", "building_tag='" + post.building_tag + "'");
|
||||||
|
|
||||||
|
if (post.orgName_3D != null && post.extName_3D != null)
|
||||||
|
{
|
||||||
|
var map_3d_guid = Guid.NewGuid();
|
||||||
|
|
||||||
|
//刪除原本檔案
|
||||||
|
if (buildInfo.saveName_3D != null)
|
||||||
|
{
|
||||||
|
FolderFunction folderFunction = new FolderFunction();
|
||||||
|
folderFunction.DeleteFile(Path.Combine(buildMapFileSaveAsPath, buildInfo.saveName_3D + "." + buildInfo.extName_3D));
|
||||||
|
}
|
||||||
|
|
||||||
|
Dictionary<string, object> build_map_3d_dic = new Dictionary<string, object>();
|
||||||
|
build_map_3d_dic = new Dictionary<string, object>()
|
||||||
|
{
|
||||||
|
{ "@saveName_3D", map_3d_guid}
|
||||||
|
};
|
||||||
|
await backendRepository.UpdateOneByCustomTable(build_map_3d_dic, "building", "building_tag='" + post.building_tag + "'");
|
||||||
|
|
||||||
|
var fileName = map_3d_guid + "." + post.extName_3D;
|
||||||
|
|
||||||
|
var fullPath = Path.Combine(buildMapFileSaveAsPath, fileName);
|
||||||
|
|
||||||
|
if (!System.IO.Directory.Exists(buildMapFileSaveAsPath))
|
||||||
|
System.IO.Directory.CreateDirectory(buildMapFileSaveAsPath);
|
||||||
|
|
||||||
|
using (var stream = new FileStream(fullPath, FileMode.Create))
|
||||||
|
{
|
||||||
|
post.Map3dFile.CopyTo(stream);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
apiResult.Code = "0000";
|
apiResult.Code = "0000";
|
||||||
apiResult.Msg = "修改成功";
|
apiResult.Msg = "修改成功";
|
||||||
}
|
}
|
||||||
@ -399,6 +458,9 @@ namespace Backend.Controllers
|
|||||||
{ "@full_name", post.Full_name},
|
{ "@full_name", post.Full_name},
|
||||||
{ "@InitMapName", post.InitMapName},
|
{ "@InitMapName", post.InitMapName},
|
||||||
{ "@floor_map_name", floor_map_guid},
|
{ "@floor_map_name", floor_map_guid},
|
||||||
|
{ "@orgName_3D", post.orgName_3D},
|
||||||
|
{ "@saveName_3D", post.saveName_3D},
|
||||||
|
{ "@extName_3D", post.extName_3D},
|
||||||
{ "@priority", current_priority + 1},
|
{ "@priority", current_priority + 1},
|
||||||
{ "@created_by", myUserInfo.Userinfo_guid}
|
{ "@created_by", myUserInfo.Userinfo_guid}
|
||||||
};
|
};
|
||||||
@ -411,6 +473,9 @@ namespace Backend.Controllers
|
|||||||
|
|
||||||
var fullPath = Path.Combine(mapFileSaveAsPath, fileName);
|
var fullPath = Path.Combine(mapFileSaveAsPath, fileName);
|
||||||
|
|
||||||
|
if (!System.IO.Directory.Exists(buildMapFileSaveAsPath))
|
||||||
|
System.IO.Directory.CreateDirectory(buildMapFileSaveAsPath);
|
||||||
|
|
||||||
using (var stream = new FileStream(fullPath, FileMode.Create))
|
using (var stream = new FileStream(fullPath, FileMode.Create))
|
||||||
{
|
{
|
||||||
post.MapFile.CopyTo(stream);
|
post.MapFile.CopyTo(stream);
|
||||||
@ -451,6 +516,9 @@ namespace Backend.Controllers
|
|||||||
|
|
||||||
var fullPath = Path.Combine(mapFileSaveAsPath, fileName);
|
var fullPath = Path.Combine(mapFileSaveAsPath, fileName);
|
||||||
|
|
||||||
|
if (!System.IO.Directory.Exists(buildMapFileSaveAsPath))
|
||||||
|
System.IO.Directory.CreateDirectory(buildMapFileSaveAsPath);
|
||||||
|
|
||||||
using (var stream = new FileStream(fullPath, FileMode.Create))
|
using (var stream = new FileStream(fullPath, FileMode.Create))
|
||||||
{
|
{
|
||||||
post.MapFile.CopyTo(stream);
|
post.MapFile.CopyTo(stream);
|
||||||
|
@ -364,6 +364,7 @@ namespace Backend.Controllers
|
|||||||
}
|
}
|
||||||
return apiResult;
|
return apiResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<ActionResult> BuildMenuTable(BuildMenuTablePost post)
|
public async Task<ActionResult> BuildMenuTable(BuildMenuTablePost post)
|
||||||
{
|
{
|
||||||
@ -618,10 +619,11 @@ namespace Backend.Controllers
|
|||||||
{
|
{
|
||||||
var sqlString = @$"select f.floor_guid Value, f.full_name Name
|
var sqlString = @$"select f.floor_guid Value, f.full_name Name
|
||||||
from sub_system_floor sf
|
from sub_system_floor sf
|
||||||
left join floor f on sf.floor_tag = f.full_name
|
left join floor f on sf.floor_tag = f.full_name and sf.building_tag = f.building_tag
|
||||||
where sf.deleted = 0 and sf.status = 0 and sf.building_tag = @building_tag and sf.main_system_tag = @main_system_tag and sf.sub_system_tag = @sub_system_tag
|
where sf.deleted = 0 and sf.status = 0 and sf.building_tag = @building_tag and sf.main_system_tag = @main_system_tag and sf.sub_system_tag = @sub_system_tag
|
||||||
|
and (f.InitMapName + f.floor_map_name) is not null
|
||||||
ORDER BY f.priority, f.created_at";
|
ORDER BY f.priority, f.created_at";
|
||||||
KeyValue = await backendRepository.GetAllAsync<KeyValue>(sqlString, new { building_tag = post.building_tag, main_system_tag = post.main_system_tag, sub_system_type = post.sub_system_tag });
|
KeyValue = await backendRepository.GetAllAsync<KeyValue>(sqlString, new { building_tag = post.building_tag, main_system_tag = post.main_system_tag, sub_system_tag = post.sub_system_tag });
|
||||||
|
|
||||||
apiResult.Code = "0000";
|
apiResult.Code = "0000";
|
||||||
apiResult.Data = KeyValue;
|
apiResult.Data = KeyValue;
|
||||||
@ -635,5 +637,29 @@ namespace Backend.Controllers
|
|||||||
return apiResult;
|
return apiResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<ApiResult<int>> GetBuildingHas3D(MenuIn post)
|
||||||
|
{
|
||||||
|
ApiResult<int> apiResult = new ApiResult<int>();
|
||||||
|
List<KeyValue> KeyValue = new List<KeyValue>();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var sqlString = @$"select v.id
|
||||||
|
from building b
|
||||||
|
join variable v on v.system_type = @system_type and system_key = N'是否有3D' and v.deleted = 0
|
||||||
|
where b.building_tag = @building_tag and (b.orgName_3D + b.saveName_3D) is not null;";
|
||||||
|
KeyValue = await backendRepository.GetAllAsync<KeyValue>(sqlString, new { building_tag = post.building_tag, system_type = system_setting_type });
|
||||||
|
|
||||||
|
apiResult.Code = "0000";
|
||||||
|
apiResult.Data = KeyValue.Count;
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
apiResult.Code = "9999";
|
||||||
|
apiResult.Msg = "系統內部錯誤,請聯絡管理者。";
|
||||||
|
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
|
||||||
|
}
|
||||||
|
return apiResult;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,7 @@ namespace Backend.Controllers
|
|||||||
public string actionName;
|
public string actionName;
|
||||||
public string main_system_type = "device_system_category_layer2";
|
public string main_system_type = "device_system_category_layer2";
|
||||||
public string sub_system_type = "device_system_category_layer3";
|
public string sub_system_type = "device_system_category_layer3";
|
||||||
|
public string system_setting_type = "system_setting";
|
||||||
|
|
||||||
public MybaseController() { }
|
public MybaseController() { }
|
||||||
public override void OnActionExecuting(ActionExecutingContext filterContext)
|
public override void OnActionExecuting(ActionExecutingContext filterContext)
|
||||||
|
@ -16,6 +16,10 @@ namespace Backend.Models
|
|||||||
public string Ip_port { get; set; } //監控主機 IP port
|
public string Ip_port { get; set; } //監控主機 IP port
|
||||||
public string Ip_address_port { get { return Ip_address + ":" + Ip_port; } }
|
public string Ip_address_port { get { return Ip_address + ":" + Ip_port; } }
|
||||||
public byte FloorNum { get; set; } //樓層數量
|
public byte FloorNum { get; set; } //樓層數量
|
||||||
|
public IFormFile Map3dFile { get; set; }
|
||||||
|
public string orgName_3D { get; set; }
|
||||||
|
public string saveName_3D { get; set; }
|
||||||
|
public string extName_3D { get; set; }
|
||||||
//public string Created_at { get; set; } //建立時間
|
//public string Created_at { get; set; } //建立時間
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -30,6 +34,9 @@ namespace Backend.Models
|
|||||||
public string Floor_map_name { get; set; } //平面圖檔名
|
public string Floor_map_name { get; set; } //平面圖檔名
|
||||||
public IFormFile MapFile { get; set; } //平面圖檔
|
public IFormFile MapFile { get; set; } //平面圖檔
|
||||||
public int Priority { get; set; }
|
public int Priority { get; set; }
|
||||||
|
public string orgName_3D { get; set; }
|
||||||
|
public string saveName_3D { get; set; }
|
||||||
|
public string extName_3D { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SelectedBuildFloor
|
public class SelectedBuildFloor
|
||||||
|
@ -230,6 +230,19 @@
|
|||||||
}
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
//驗證是否有上傳
|
||||||
|
jQuery.validator.addMethod("fileUpload", function (value, element) {
|
||||||
|
var str = value;
|
||||||
|
var result = false;
|
||||||
|
if ($("#3d_file_modal")[0].files.length > 0) {
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}, "請選擇檔案");
|
||||||
|
|
||||||
//#region 區域表單驗證
|
//#region 區域表單驗證
|
||||||
var BuildInfoValidate = $("#build-form").validate({
|
var BuildInfoValidate = $("#build-form").validate({
|
||||||
rules: {
|
rules: {
|
||||||
@ -247,6 +260,9 @@
|
|||||||
required: true,
|
required: true,
|
||||||
maxlength: 50,
|
maxlength: 50,
|
||||||
filterspace: true
|
filterspace: true
|
||||||
|
},
|
||||||
|
file_3d_modal: {
|
||||||
|
accept: "image/svg+xml"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -257,33 +273,50 @@
|
|||||||
if ($("#build-form").valid()) {
|
if ($("#build-form").valid()) {
|
||||||
$("#save-building-btn").html('<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>').attr("disabled", true);
|
$("#save-building-btn").html('<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>').attr("disabled", true);
|
||||||
var url = "/BuildInfo/SaveBuildInfo";
|
var url = "/BuildInfo/SaveBuildInfo";
|
||||||
var send_data = {
|
|
||||||
building_tag: $('#build_name_tag').val(),
|
var formData = new FormData();
|
||||||
Full_name: $('#build_name_modal').val(),
|
formData.append("building_tag", $('#build_name_tag').val());
|
||||||
Ip_address: $('#ip_address_modal').val(),
|
formData.append("Full_name", $('#build_name_modal').val());
|
||||||
Ip_port: $('#ip_port_modal').val()
|
formData.append("Ip_address", $('#ip_address_modal').val());
|
||||||
|
formData.append("Ip_port", $('#ip_port_modal').val());
|
||||||
|
|
||||||
|
maps = $('#file_3d_modal')[0].files;
|
||||||
|
if (maps.length > 0) {
|
||||||
|
var file_names = maps[0].name.split(".");
|
||||||
|
|
||||||
|
formData.append("Map3dFile", maps[0]);
|
||||||
|
formData.append("orgName_3D", file_names[0]);
|
||||||
|
formData.append("extName_3D", file_names[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$.post(url, send_data, function (rel) {
|
$.ajax({
|
||||||
$("#save-building-btn").html('確定').attr("disabled", false);
|
type: "POST",
|
||||||
if (rel.code != "0000") {
|
url: url,
|
||||||
if (rel.code == "9999") {
|
data: formData,
|
||||||
toast_error(rel.msg);
|
cache: false,
|
||||||
|
contentType: false,
|
||||||
|
processData: false,
|
||||||
|
success: function (rel) {
|
||||||
|
$("#save-building-btn").html('確定').attr("disabled", false);
|
||||||
|
if (rel.code != "0000") {
|
||||||
|
if (rel.code == "9999") {
|
||||||
|
toast_error(rel.msg);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
toast_warning(rel.msg);
|
||||||
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
toast_warning(rel.msg);
|
toast_ok(rel.msg);
|
||||||
|
buildInfoTable.ajax.reload(null, false);
|
||||||
|
$('#build-modal').modal('hide');
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
return;
|
},
|
||||||
|
fail: function (xhr, status, error) {
|
||||||
|
$("#save-building-btn").html('確定').attr("disabled", false);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
toast_ok(rel.msg);
|
|
||||||
buildInfoTable.ajax.reload(null, false);
|
|
||||||
$('#build-modal').modal('hide');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}, 'json')
|
|
||||||
.fail(function (xhr, status, error) {
|
|
||||||
$("#save-building-btn").html('確定').attr("disabled", false);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -292,33 +325,50 @@
|
|||||||
if ($("#build-form").valid()) {
|
if ($("#build-form").valid()) {
|
||||||
$("#save-building-btn").html('<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>').attr("disabled", true);
|
$("#save-building-btn").html('<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>').attr("disabled", true);
|
||||||
var url = "/BuildInfo/EditBuildInfo";
|
var url = "/BuildInfo/EditBuildInfo";
|
||||||
var send_data = {
|
var formData = new FormData();
|
||||||
building_tag: selected_build_guid,
|
|
||||||
Full_name: $('#build_name_modal').val(),
|
formData.append("building_tag", selected_build_guid);
|
||||||
Ip_address: $('#ip_address_modal').val(),
|
formData.append("Full_name", $('#build_name_modal').val());
|
||||||
Ip_port: $('#ip_port_modal').val()
|
formData.append("Ip_address", $('#ip_address_modal').val());
|
||||||
|
formData.append("Ip_port", $('#ip_port_modal').val());
|
||||||
|
|
||||||
|
maps = $('#file_3d_modal')[0].files;
|
||||||
|
if (maps.length > 0) {
|
||||||
|
var file_names = maps[0].name.split(".");
|
||||||
|
|
||||||
|
formData.append("Map3dFile", maps[0]);
|
||||||
|
formData.append("orgName_3D", file_names[0]);
|
||||||
|
formData.append("extName_3D", file_names[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$.post(url, send_data, function (rel) {
|
$.ajax({
|
||||||
$("#save-building-btn").html('確定').attr("disabled", false);
|
type: "POST",
|
||||||
if (rel.code != "0000") {
|
url: url,
|
||||||
if (rel.code == "9999") {
|
data: formData,
|
||||||
toast_error(rel.msg);
|
cache: false,
|
||||||
|
contentType: false,
|
||||||
|
processData: false,
|
||||||
|
success: function (rel) {
|
||||||
|
$("#save-building-btn").html('確定').attr("disabled", false);
|
||||||
|
if (rel.code != "0000") {
|
||||||
|
if (rel.code == "9999") {
|
||||||
|
toast_error(rel.msg);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
toast_warning(rel.msg);
|
||||||
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
toast_warning(rel.msg);
|
toast_ok(rel.msg);
|
||||||
|
buildInfoTable.ajax.reload(null, false);
|
||||||
|
$('#build-modal').modal('hide');
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
return;
|
},
|
||||||
|
fail: function (xhr, status, error) {
|
||||||
|
$("#save-building-btn").html('確定').attr("disabled", false);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
toast_ok(rel.msg);
|
|
||||||
buildInfoTable.ajax.reload(null, false);
|
|
||||||
$('#build-modal').modal('hide');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}, 'json')
|
|
||||||
.fail(function (xhr, status, error) {
|
|
||||||
$("#save-building-btn").html('確定').attr("disabled", false);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -566,7 +616,10 @@
|
|||||||
},
|
},
|
||||||
map_file_modal: {
|
map_file_modal: {
|
||||||
accept: "image/svg+xml"
|
accept: "image/svg+xml"
|
||||||
}
|
},
|
||||||
|
//file_3d_modal: {
|
||||||
|
// accept: "image/svg+xml"
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -595,6 +648,7 @@
|
|||||||
var formData = new FormData();
|
var formData = new FormData();
|
||||||
|
|
||||||
maps = $('#map_file_modal')[0].files
|
maps = $('#map_file_modal')[0].files
|
||||||
|
maps3D = $('#file_3d_modal')[0].files
|
||||||
|
|
||||||
formData.append("Floor_guid", selected_floor_guid);
|
formData.append("Floor_guid", selected_floor_guid);
|
||||||
formData.append("building_tag", selected_build_guid_top);
|
formData.append("building_tag", selected_build_guid_top);
|
||||||
@ -607,6 +661,13 @@
|
|||||||
formData.append("InitMapName", maps[0].name.replace("." + file_names[file_names.length - 1], ""));
|
formData.append("InitMapName", maps[0].name.replace("." + file_names[file_names.length - 1], ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(maps3D.length > 0) {
|
||||||
|
var file_names = maps3D[0].name.split(".")
|
||||||
|
|
||||||
|
formData.append("orgName_3D", maps3D[0].name.replace("." + file_names[file_names.length - 1], ""));
|
||||||
|
formData.append("extName_3D", maps3D[1].name.replace("." + file_names[file_names.length - 1], ""));
|
||||||
|
}
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: url,
|
url: url,
|
||||||
|
@ -56,6 +56,10 @@
|
|||||||
<label class="form-label" for="map_file_modal">平面圖檔(限制SVG格式)</label>
|
<label class="form-label" for="map_file_modal">平面圖檔(限制SVG格式)</label>
|
||||||
<input type="file" id="map_file_modal" class="form-control" name="map_file_modal" onchange="changeImage(this)" accept="image/svg+xml">
|
<input type="file" id="map_file_modal" class="form-control" name="map_file_modal" onchange="changeImage(this)" accept="image/svg+xml">
|
||||||
</div>
|
</div>
|
||||||
|
@*<div class="form-group col-12">
|
||||||
|
<label class="form-label" for="map_file_modal">3D檔(限制SVG格式)</label>
|
||||||
|
<input type="file" id="map_file_modal" class="form-control" name="map_file_modal" onchange="changeImage(this)" accept="image/svg+xml">
|
||||||
|
</div>*@
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
@ -56,6 +56,10 @@
|
|||||||
<label class="form-label" for="ip_port_modal"><span class="text-danger">*</span>監控主機 PORT</label>
|
<label class="form-label" for="ip_port_modal"><span class="text-danger">*</span>監控主機 PORT</label>
|
||||||
<input type="text" id="ip_port_modal" class="form-control" name="ip_port_modal">
|
<input type="text" id="ip_port_modal" class="form-control" name="ip_port_modal">
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group col-12">
|
||||||
|
<label class="form-label" for="file_3d_modal">3D檔(限制SVG格式)</label>
|
||||||
|
<input type="file" id="file_3d_modal" class="form-control" name="file_3d_modal" onchange="changeImage(this)" accept="image/svg+xml">
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
@ -161,7 +161,7 @@
|
|||||||
2D
|
2D
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col" id="drawing_3_div" style="display: none;">
|
||||||
<input type="radio" name="drawing" id="drawing_3" value="3">
|
<input type="radio" name="drawing" id="drawing_3" value="3">
|
||||||
<label for="drawing_3">
|
<label for="drawing_3">
|
||||||
3D
|
3D
|
||||||
@ -280,7 +280,7 @@
|
|||||||
2D
|
2D
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col" id="drawing_3_div_r" style="display: none;">
|
||||||
<input type="radio" name="drawing_r" id="drawing_3_r" value="3">
|
<input type="radio" name="drawing_r" id="drawing_3_r" value="3">
|
||||||
<label for="drawing_3_r">
|
<label for="drawing_3_r">
|
||||||
3D
|
3D
|
||||||
@ -768,6 +768,7 @@
|
|||||||
|
|
||||||
GetSubList($('#build_menu_main_modal').val());
|
GetSubList($('#build_menu_main_modal').val());
|
||||||
GetFloorInSubSystem();
|
GetFloorInSubSystem();
|
||||||
|
GetBuildingHas3D();
|
||||||
$('#planimetric_click').attr("disabled", false);
|
$('#planimetric_click').attr("disabled", false);
|
||||||
$('#build-menu-modal').modal();
|
$('#build-menu-modal').modal();
|
||||||
}
|
}
|
||||||
@ -953,6 +954,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
changebuild_menu_drawing_modal();
|
changebuild_menu_drawing_modal();
|
||||||
|
GetBuildingHas3D();
|
||||||
GetFloorInSubSystem(rel.data.left_planimetric_floor_guid);
|
GetFloorInSubSystem(rel.data.left_planimetric_floor_guid);
|
||||||
GetFloorInSubSystem(rel.data.right_planimetric_floor_guid);
|
GetFloorInSubSystem(rel.data.right_planimetric_floor_guid);
|
||||||
$('.modal-title').html("選單基本資料 - 修改");
|
$('.modal-title').html("選單基本資料 - 修改");
|
||||||
@ -1198,6 +1200,7 @@
|
|||||||
main_system_tag: $('#build_menu_main_modal').val(),
|
main_system_tag: $('#build_menu_main_modal').val(),
|
||||||
sub_system_tag: $('#build_menu_sub_modal').val(),
|
sub_system_tag: $('#build_menu_sub_modal').val(),
|
||||||
};
|
};
|
||||||
|
|
||||||
$.post(url, send_data, function (rel) {
|
$.post(url, send_data, function (rel) {
|
||||||
if (rel.code != "0000") {
|
if (rel.code != "0000") {
|
||||||
toast_error(rel.msg);
|
toast_error(rel.msg);
|
||||||
@ -1215,12 +1218,34 @@
|
|||||||
});
|
});
|
||||||
if (floor != null) {
|
if (floor != null) {
|
||||||
$('#build_menu_planimetric_floor_modal').val(floor);
|
$('#build_menu_planimetric_floor_modal').val(floor);
|
||||||
$('#build_menu_planimetric_floor_modal_r').val(floor);
|
$('#build_menu_planimetric_floor_modal_r').val(floor);
|
||||||
}
|
}
|
||||||
$('[id^=drawing_1_div]').show();
|
$('[id^=drawing_1_div]').show();
|
||||||
|
|
||||||
$('[id^=build_menu_planimetric_floor_modal_div]').show();
|
$('[id^=build_menu_planimetric_floor_modal_div]').show();
|
||||||
changebuild_menu_drawing_modal();
|
changebuild_menu_drawing_modal();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 'json');
|
||||||
|
}
|
||||||
|
|
||||||
|
function GetBuildingHas3D() {
|
||||||
|
var url = "/BuildMenu/GetBuildingHas3D";
|
||||||
|
var send_data = {
|
||||||
|
building_tag: $('#build_menu_building_modal').val(),
|
||||||
|
};
|
||||||
|
|
||||||
|
$.post(url, send_data, function (rel) {
|
||||||
|
if (rel.code != "0000") {
|
||||||
|
toast_error(rel.msg);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (rel.data == 0) {
|
||||||
|
$('[id^=drawing_3_div]').hide();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$('[id^=drawing_3_div]').show();
|
||||||
|
changebuild_menu_drawing_modal();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, 'json');
|
}, 'json');
|
||||||
|
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 130 KiB |
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 130 KiB |
Loading…
Reference in New Issue
Block a user