This commit is contained in:
dev01 2023-01-06 10:16:45 +08:00
commit 01caf2df06
8 changed files with 295 additions and 104 deletions

View File

@ -6,15 +6,18 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.IO;
namespace Backend.Controllers namespace Backend.Controllers
{ {
public class VariableController : MybaseController<VariableController> public class VariableController : MybaseController<VariableController>
{ {
private readonly IBackendRepository backendRepository; private readonly IBackendRepository backendRepository;
private string variableFilePath = "";
public VariableController(IBackendRepository backendRepository) public VariableController(IBackendRepository backendRepository)
{ {
this.backendRepository = backendRepository; this.backendRepository = backendRepository;
variableFilePath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "img");
} }
@ -119,7 +122,7 @@ namespace Backend.Controllers
/// <param name="post"></param> /// <param name="post"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public async Task<ApiResult<string>> SaveVariable(VariableInfo post) public async Task<ApiResult<string>> SaveVariable([FromForm] VariableInfo post)
{ {
ApiResult<string> apiResult = new ApiResult<string>(); ApiResult<string> apiResult = new ApiResult<string>();
@ -130,6 +133,22 @@ namespace Backend.Controllers
object param = new { Id = post.id }; object param = new { Id = post.id };
var variableInfo = await backendRepository.GetOneAsync<VariableInfo>("variable", sWhere, param); var variableInfo = await backendRepository.GetOneAsync<VariableInfo>("variable", sWhere, param);
Guid file_guid = Guid.Empty;
if (post.file != null)
{
file_guid = Guid.NewGuid();
var fileName = file_guid + "." + post.extName;
var fullPath = Path.Combine(variableFilePath, fileName);
if (!System.IO.Directory.Exists(variableFilePath))
System.IO.Directory.CreateDirectory(variableFilePath);
using (var stream = new FileStream(fullPath, FileMode.Create))
{
post.file.CopyTo(stream);
}
}
if (variableInfo == null) if (variableInfo == null)
{ {
@ -139,7 +158,7 @@ namespace Backend.Controllers
{ {
{ "@system_type", post.System_type}, { "@system_type", post.System_type},
{ "@system_key", post.System_key}, { "@system_key", post.System_key},
{ "@system_value", post.system_value}, { "@system_value", file_guid != Guid.Empty ? file_guid.ToString() + "." + post.extName : post.system_value},
{ "@system_remark", post.system_remark}, { "@system_remark", post.system_remark},
{ "@system_priority", post.system_priority}, { "@system_priority", post.system_priority},
{ "@system_parent_id", post.system_parent_id}, { "@system_parent_id", post.system_parent_id},
@ -156,7 +175,7 @@ namespace Backend.Controllers
{ {
{ "@system_type", post.System_type}, { "@system_type", post.System_type},
{ "@system_key", post.System_key}, { "@system_key", post.System_key},
{ "@system_value", post.system_value}, { "@system_value", file_guid != Guid.Empty ? file_guid.ToString() + "." + post.extName : post.system_value},
{ "@system_remark", post.system_remark}, { "@system_remark", post.system_remark},
{ "@system_priority", post.system_priority}, { "@system_priority", post.system_priority},
{ "@system_parent_id", post.system_parent_id}, { "@system_parent_id", post.system_parent_id},

View File

@ -1,4 +1,5 @@
using System; using Microsoft.AspNetCore.Http;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -67,6 +68,8 @@ namespace Backend.Models
public string system_remark { get; set; } public string system_remark { get; set; }
public int system_priority { get; set; } public int system_priority { get; set; }
public int system_parent_id { get; set; } public int system_parent_id { get; set; }
public IFormFile file { get; set; }
public string extName { get; set; }
} }
public class PostVariableInfoFilter public class PostVariableInfoFilter

View File

@ -510,7 +510,9 @@
}, },
{ {
"data": null, "data": null,
"defaultContent": '<button class="btn btn-primary edit-btn">修改</button> <button class="btn btn-danger del-btn">刪除</button>' "render": function (data, type, row, meta){
return '<button bg-guid="'+row.building_tag+'" ms-guid="'+row.main_system_tag+'" ss-guid="'+row.sub_system_tag+'" class="btn btn-primary edit-btn">修改</button> <button class="btn btn-danger del-btn">刪除</button>';
}
} }
], ],
'createdRow': function (row, data, dataIndex) { 'createdRow': function (row, data, dataIndex) {
@ -886,9 +888,9 @@
$('#buildMenu_table').on("click", "button.edit-btn", function () { $('#buildMenu_table').on("click", "button.edit-btn", function () {
var url = "/BuildMenu/GetBuildMenu"; var url = "/BuildMenu/GetBuildMenu";
var send_data = { var send_data = {
building_tag: $(this).parents('tr').attr('bg-guid'), building_tag: $(this).attr('bg-guid'),
main_system_tag: $(this).parents('tr').attr('ms-guid'), main_system_tag: $(this).attr('ms-guid'),
sub_system_tag: $(this).parents('tr').attr('ss-guid') sub_system_tag: $(this).attr('ss-guid')
}; };
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
@ -1007,10 +1009,11 @@
} }
$('#buildMenu_table').on("click", "button.del-btn", function () { $('#buildMenu_table').on("click", "button.del-btn", function () {
var send_data = { var send_data = {
building_tag: $(this).parents('tr').attr('bg-guid'), building_tag: $(this).attr('bg-guid'),
main_system_tag: $(this).parents('tr').attr('ms-guid'), main_system_tag: $(this).attr('ms-guid'),
sub_system_tag: $(this).parents('tr').attr('ss-guid') sub_system_tag: $(this).attr('ss-guid')
}; };
Swal.fire( Swal.fire(
{ {
@ -1048,18 +1051,21 @@
}); });
}); });
$('#buildMenu_table').on("click", "tbody>tr", function () { $('#buildMenu_table').on("click", "tbody>tr", function () {
$(this).parents().find('tr').css('background-color', '#fff'); if ($(this).attr('role'))
$(this).css('background-color', '#67B4AC'); {
SelectBuild = $(this).attr('bg-guid'); $(this).parents().find('tr').css('background-color', '#fff');
SelectMainSys = $(this).attr('ms-guid'); $(this).css('background-color', '#67B4AC');
SelectSubSys = $(this).attr('ss-guid'); SelectBuild = $(this).attr('bg-guid');
@*$('#menu_floor_main_modal').append($("<option />").val($(this).attr('ms-guid')).text($(this).attr('ms-name'))); SelectMainSys = $(this).attr('ms-guid');
$('#menu_floor_sub_modal').append($("<option />").val($(this).attr('ss-guid')).text($(this).attr('ss-name')));*@ SelectSubSys = $(this).attr('ss-guid');
@*$('#menu_floor_main_modal').append($("<option />").val($(this).attr('ms-guid')).text($(this).attr('ms-name')));
$('#menu_floor_sub_modal').append($("<option />").val($(this).attr('ss-guid')).text($(this).attr('ss-name')));*@
$('#menu_floor_main_modal').html($(this).attr('ms-name')) $('#menu_floor_main_modal').html($(this).attr('ms-name'))
$('#menu_floor_sub_modal').html($(this).attr('ss-name')) $('#menu_floor_sub_modal').html($(this).attr('ss-name'))
$('#floorcard').show(); $('#floorcard').show();
$('#floorcard').find('.card-title').html($(this).attr('ms-name') + "-" + $(this).attr('ss-name') + "-樓層設定"); $('#floorcard').find('.card-title').html($(this).attr('ms-name') + "-" + $(this).attr('ss-name') + "-樓層設定");
buildMenuFloorTable.ajax.reload(null, false); buildMenuFloorTable.ajax.reload(null, false);
}
}); });
function AddFloor() { function AddFloor() {
var send_data = { var send_data = {

View File

@ -77,6 +77,10 @@
<label class="form-label" for="variable_system_value_modal"><span class="text-danger">*</span>system_value</label> <label class="form-label" for="variable_system_value_modal"><span class="text-danger">*</span>system_value</label>
<input type="text" id="variable_system_value_modal" class="form-control" name="variable_system_value_modal"> <input type="text" id="variable_system_value_modal" class="form-control" name="variable_system_value_modal">
</div> </div>
<div class="form-group col-12" hidden>
<label class="form-label" for="variable_picture_path">圖檔</label>
<input type="file" id="variable_picture_path" class="form-control" name="variable_picture_path" onchange="changeImage(this)">
</div>
<div class="form-group col-12"> <div class="form-group col-12">
<label class="form-label" for="variable_system_remark_modal">備註</label> <label class="form-label" for="variable_system_remark_modal">備註</label>
<textarea id="variable_system_remark_modal" class="form-control" name="variable_system_remark_modal"></textarea> <textarea id="variable_system_remark_modal" class="form-control" name="variable_system_remark_modal"></textarea>
@ -104,6 +108,7 @@
@section Scripts { @section Scripts {
<script> <script>
var variableTable; var variableTable;
var variableFile = null;
$(function () { $(function () {
GetSystemTypeList() GetSystemTypeList()
@ -134,7 +139,10 @@
}, },
{ {
"data": null, "data": null,
"defaultContent": '<button class="btn btn-primary edit-btn">修改</button> <button class="btn btn-danger del-btn">刪除</button>' "render": function (data, type, row, meta) {
var name = row.system_type == "logo" ? "pic_edit_btn" : "edit_btn ";
return `<button name="`+ name +`" class="btn btn-primary edit-btn">修改</button> <button class="btn btn-danger del-btn">刪除</button>`;
}
} }
], ],
//"order": [[2, "desc"]], //"order": [[2, "desc"]],
@ -178,7 +186,7 @@
$("#variable-modal .modal-title").html("系統變數 - 編輯"); $("#variable-modal .modal-title").html("系統變數 - 編輯");
selected_id = $(this).parents('tr').attr('data-id'); selected_id = $(this).parents('tr').attr('data-id');
name = $(this).prop('name');
//取得單一系統變數 //取得單一系統變數
var url = "/Variable/GetOneVariable/"; var url = "/Variable/GetOneVariable/";
@ -186,6 +194,19 @@
id: selected_id id: selected_id
} }
if (name == 'pic_edit_btn') {
$('#variable_picture_path').parent().attr('hidden', false);
$('#variable_system_type_modal').attr('disabled', true);
$('#variable_system_key_modal').attr('disabled', true);
$('#variable_system_value_modal').attr('disabled', true);
}
else {
$('#variable_picture_path').parent().attr('hidden', true);
$('#variable_system_type_modal').attr('disabled', false);
$('#variable_system_key_modal').attr('disabled', false);
$('#variable_system_value_modal').attr('disabled', false);
}
$.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);
@ -293,36 +314,61 @@
$("#save-variable-btn").html('<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>').attr("disabled", true); $("#save-variable-btn").html('<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>').attr("disabled", true);
var url = "/Variable/SaveVariable"; var url = "/Variable/SaveVariable";
var send_data = { var formData = new FormData();
Id: selected_id, formData.append("Id", selected_id);
System_type: $("#variable_system_type_modal").val(), formData.append("System_type", $("#variable_system_type_modal").val());
System_key: $("#variable_system_key_modal").val(), formData.append("System_key", $("#variable_system_key_modal").val());
system_value: $("#variable_system_value_modal").val(), formData.append("system_value", $("#variable_system_value_modal").val());
system_remark: $("#variable_system_remark_modal").val(), formData.append("system_remark", $("#variable_system_remark_modal").val());
system_priority: $("#variable_system_priority_modal").val(), formData.append("system_priority", $("#variable_system_priority_modal").val());
system_parent_id: $("#variable_system_parent_id_modal").val() formData.append("system_parent_id", $("#variable_system_parent_id_modal").val());
if (variableFile != null)
{
formData.append("file", variableFile);
formData.append("extName", variableFile.name.split('.')[1]);
} }
$.post(url, send_data, function (rel) {
$("#save-variable-btn").html('確定').attr("disabled", false); $.ajax({
if (rel.code != "0000") { type: "POST",
if (rel.code == "9998") { url: url,
toast_warning(rel.msg); data: formData,
cache: false,
contentType: false,
processData: false,
success: function (rel) {
$("#save-variable-btn").html('確定').attr("disabled", false);
if (rel.code != "0000") {
if (rel.code == "9998") {
toast_warning(rel.msg);
return;
}
toast_error(rel.msg);
return; return;
} }
toast_error(rel.msg); toast_ok(rel.msg);
return; $('#variable-modal').modal('hide');
} variableTable.ajax.reload();
toast_ok(rel.msg);
$('#variable-modal').modal('hide');
variableTable.ajax.reload();
GetSystemTypeList() variableFile = null;
}, 'json') GetSystemTypeList()
.fail(function (xhr, status, error) { },
fail: function (xhr, status, error) {
$("#save-variable-btn").html('確定').attr("disabled", false); $("#save-variable-btn").html('確定').attr("disabled", false);
}); }
});
} }
} }
//#endregion //#endregion
//#region weblogo
function changeImage(input) {
$(`#variable_picture_path`).attr("data-src", window.URL.createObjectURL(input.files[0]));
variableFile = input.files[0];
console.log(variableFile);
$('#variable_system_key_modal').val(variableFile.name.split('.')[0]);
$('#variable_system_value_modal').val(variableFile.name);
}
//#endregion
</script> </script>
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

@ -31,10 +31,26 @@
<hr> <hr>
</div> </div>
<div class="row bg-dark p-2 align-items-center" id="alr_mainList">
<div class="row bg-dark p-2 align-items-center">
<div class="col-auto">
<a href="#" id="selAllSys" onclick="selAllSysVal(this)" class="btn btn-info">全選類別</a>
</div>
<div class="col-auto">
<div id="alr_mainList" class="frame-wrap">
</div>
</div>
</div>
<div class="row bg-dark p-2 mb-5 align-items-center">
<div class="col-auto" style="padding-left: 133px">
<div id="alr_subList" class="frame-wrap">
</div>
</div>
</div>
<!--<div class="row bg-dark p-2 align-items-center" id="alr_mainList">
</div> </div>
<div class="row bg-dark p-2 mb-5 align-items-center" id="alr_subList"> <div class="row bg-dark p-2 mb-5 align-items-center" id="alr_subList">
</div> </div>-->
<div> <div>
<div class="frame-wrap"> <div class="frame-wrap">
@ -182,6 +198,9 @@
pageAct.alr_startdate = null; pageAct.alr_startdate = null;
pageAct.alr_enddate = null; pageAct.alr_enddate = null;
pageAct.imageFile = []; pageAct.imageFile = [];
pageAct.alrSelSysMain = []
pageAct.alrSelSysSub = [];
pageAct.selAllSysSub = false;
first = true; first = true;
$(function () { $(function () {
@ -192,39 +211,78 @@
sysList(); sysList();
$('#nearthirty').click(); $('#nearthirty').click();
$('#alr_mainList').on('click', 'a[data-type=alr_main]', function () { $('input[type=checkbox][data-type=main]').parent().on('change', function () {
$(this).parent().parent().find('a').removeClass('btn-info'); pageAct.main_system_tag = $('input[type=checkbox]').map(function (i, v) {
$(this).parent().parent().find('a').addClass('btn-secondary'); if ($(v).data('type') == 'main') {
$(this).addClass('btn-info'); if ($(v).is(':checked')) {
$(`[data-main=` + $(v).prop('id') + `]`).attr('hidden', false);
$('a[data-type=alr_sub]').parent().parent().find('a').removeClass('btn-info'); return $(v).prop('id')
$('a[data-type=alr_sub]').parent().parent().find('a').addClass('btn-secondary'); }
else
$(`[data-main=` + $(v).prop('id') + `]`).attr('hidden', true);
}
}).toArray();
pageAct.SysType = null; pageAct.SysType = null;
}); });
$('#alr_subList, #alr_mainList').on('click', 'a[data-type=alr_sub][id!=selAllSys]', function () { $('input[type=checkbox][data-type=sub]').on('click', function () {
pageAct.selSysMain = $(this).parent().data('main'); if (!pageAct.selAllSysSub) {
pageAct.selSysSub = $(this).prop('id'); console.log(this);
pageAct.selAllSysSub = true;
if ($('#selAllSys').hasClass('btn-info')) { $.each($('input[type=checkbox][data-type=sub]:checked'), function (i, v) {
$('#selAllSys').removeClass('btn-info'); $(v).click();
$('#selAllSys').addClass('btn-secondary'); });
$('#alr_mainList a[data-type=alr_main]').removeClass('btn-info');
$('#alr_mainList a[data-type=alr_main]').addClass('btn-secondary'); if (pageAct.SysType == "all") {
$(`#alr_mainList a[data-type=alr_main][id=` + pageAct.selSysMain + `]`).addClass('btn-info'); if (!$(this).is(':checked')) {
$('#alr_subList a[data-type=alr_sub]').parent().attr('hidden', true); $(this).prop('checked', true);
$('#alr_subList a[data-type=alr_sub]').parent('[data-main=' + pageAct.selSysMain + ']').attr('hidden', false); $(this).click();
}
}
pageAct.selAllSysSub = false;
$('#selAllSys').html('全選類別');
pageAct.SysType = null;
getData();
} }
$(this).parent().parent().find('a').removeClass('btn-info');
$(this).parent().parent().find('a').addClass('btn-secondary');
$(this).addClass('btn-info');
pageAct.SysType = null;
getData();
}); });
//$('#alr_mainList').on('click', 'a[data-type=alr_main]', function () {
// $(this).parent().parent().find('a').removeClass('btn-info');
// $(this).parent().parent().find('a').addClass('btn-secondary');
// $(this).addClass('btn-info');
// $('a[data-type=alr_sub]').parent().parent().find('a').removeClass('btn-info');
// $('a[data-type=alr_sub]').parent().parent().find('a').addClass('btn-secondary');
// pageAct.SysType = null;
//});
//$('#alr_subList, #alr_mainList').on('click', 'a[data-type=alr_sub][id!=selAllSys]', function () {
// pageAct.selSysMain = $(this).parent().data('main');
// pageAct.selSysSub = $(this).prop('id');
// if ($('#selAllSys').hasClass('btn-info')) {
// $('#selAllSys').removeClass('btn-info');
// $('#selAllSys').addClass('btn-secondary');
// $('#alr_mainList a[data-type=alr_main]').removeClass('btn-info');
// $('#alr_mainList a[data-type=alr_main]').addClass('btn-secondary');
// $(`#alr_mainList a[data-type=alr_main][id=` + pageAct.selSysMain + `]`).addClass('btn-info');
// $('#alr_subList a[data-type=alr_sub]').parent().attr('hidden', true);
// $('#alr_subList a[data-type=alr_sub]').parent('[data-main=' + pageAct.selSysMain + ']').attr('hidden', false);
// }
// $(this).parent().parent().find('a').removeClass('btn-info');
// $(this).parent().parent().find('a').addClass('btn-secondary');
// $(this).addClass('btn-info');
// pageAct.SysType = null;
// getData();
//});
first = false; first = false;
}); });
@ -438,34 +496,62 @@
let mainStrHtml = ``; let mainStrHtml = ``;
let subStrHtml = ``; let subStrHtml = ``;
let display = pageAct.mainStatus ? "hidden" : ""; let display = pageAct.mainStatus ? "hidden" : "";
let firstSub = '';
let firstMain = '';
if (pageAct.mainStatus) { //if (pageAct.mainStatus) {
mainStrHtml += `<div class="col-auto"> // mainStrHtml += `<div class="col-auto">
<a href="#" id="selAllSys" onclick="selAllSysVal(this)" class="btn btn-secondary">全部類別</a> // <a href="#" id="selAllSys" onclick="selAllSysVal(this)" class="btn btn-secondary">全部類別</a>
</div>`; // </div>`;
} //}
else { //else {
subStrHtml += `<div class="col-auto"> // subStrHtml += `<div class="col-auto">
<a href="#" id="selAllSys" onclick="selAllSysVal(this)" class="btn btn-secondary">全部類別</a> // <a href="#" id="selAllSys" onclick="selAllSysVal(this)" class="btn btn-secondary">全部類別</a>
</div>`; // </div>`;
} //}
//$.each(res.data.history_Main_Systems, function (i, v) {
// if (pageAct.mainStatus) {
// mainStrHtml += `<div class="col-auto">
// <a href="#" class="btn btn-secondary" id=${v.main_system_tag} data-type="alr_main">${v.full_name}</a>
// </div>`;
// }
// $.each(v.history_Sub_systems, function (i2, v2) {
// let selected = (i2 == 0 && i == 0) ? "info" : "secondary";
// subStrHtml += `<div class="col-auto" data-main="${v.main_system_tag}" ${display}>
// <a href="#" class="btn btn-${selected}" id="${v2.sub_system_tag}" data-type="alr_sub">${v2.full_name}</a>
// </div>`;
// if (i2 == 0 && i == 0) {
// pageAct.selSysSub = v2.sub_system_tag;
// pageAct.selSysMain = v.main_system_tag;
// }
// });
//});
$.each(res.data.history_Main_Systems, function (i, v) { $.each(res.data.history_Main_Systems, function (i, v) {
if (pageAct.mainStatus) { if (pageAct.mainStatus) {
mainStrHtml += `<div class="col-auto"> mainStrHtml += `<div class="custom-control custom-checkbox custom-control-inline">
<a href="#" class="btn btn-secondary" id=${v.main_system_tag} data-type="alr_main">${v.full_name}</a> <input type="checkbox" class="custom-control-input" data-type="main" id="${v.main_system_tag}">
<label class="custom-control-label" for="${v.main_system_tag}">${v.full_name}</label>
</div>`; </div>`;
pageAct.alrSelSysMain.push(v);
} }
$.each(v.history_Sub_systems, function (i2, v2) { $.each(v.history_Sub_systems, function (i2, v2) {
let selected = (i2 == 0 && i == 0) ? "info" : "secondary"; var firDis = (i == 0) ? "" : display;
subStrHtml += `<div class="col-auto" data-main="${v.main_system_tag}" ${display}> subStrHtml += `<div class="custom-control custom-checkbox custom-control-inline" data-main="${v.main_system_tag}" ${firDis}>
<a href="#" class="btn btn-${selected}" id="${v2.sub_system_tag}" data-type="alr_sub">${v2.full_name}</a> <input type="checkbox" class="custom-control-input" data-type="sub" id="${v2.sub_system_tag}">
<label class="custom-control-label" for="${v2.sub_system_tag}">${v2.full_name}</label>
</div>`; </div>`;
pageAct.alrSelSysSub.push(v2);
if (i2 == 0 && i == 0) { if (i2 == 0 && i == 0) {
pageAct.selSysSub = v2.sub_system_tag; firstMain = v.main_system_tag;
pageAct.selSysMain = v.main_system_tag; firstSub = v2.sub_system_tag;
} }
}); });
}); });
@ -473,37 +559,61 @@
if (pageAct.mainStatus) { if (pageAct.mainStatus) {
$('#alr_mainList').html(mainStrHtml); $('#alr_mainList').html(mainStrHtml);
$('#alr_subList').html(subStrHtml); $('#alr_subList').html(subStrHtml);
$('input[data-type=main][id=' + firstMain + ']').click();
} }
else { else {
$('#alr_mainList').html(subStrHtml); $('#alr_mainList').html(subStrHtml);
} }
$('input[data-type=sub][id=' + firstSub + ']').click();
} }
ytAjax = new YourTeam.Ajax(url, objSendData, success, null, "POST").send(); ytAjax = new YourTeam.Ajax(url, objSendData, success, null, "POST").send();
} }
function selAllSysVal(elem) { function selAllSysVal(elem) {
$(elem).parent().parent().find('a').removeClass('btn-secondary'); $(loadEle).Loading("start");
$(elem).parent().parent().find('a').addClass('btn-info'); pageAct.selAllSysSub = true;
if ($(elem).html() == '全選類別') {
if ($('a[data-type=alr_sub]').length > 0) { $('#alr_mainList input').map(function (i, v) {
$('a[data-type=alr_sub]').parent().attr('hidden', false); if (!$(v).is(':checked')) {
$('a[data-type=alr_sub]').parent().parent().find('a').removeClass('btn-secondary'); $(v).click();
$('a[data-type=alr_sub]').parent().parent().find('a').addClass('btn-info'); }
});
$('#alr_subList input').map(function (i, v) {
if (!$(v).is(':checked')) {
$(v).click();
}
});
$(elem).html('取消全選');
pageAct.SysType = 'all';
}
else {
$('#alr_mainList input').map(function (i, v) {
if ($(v).is(':checked'))
$(v).click();
});
$('#alr_subList input').map(function (i, v) {
if ($(v).is(':checked'))
$(v).click();
});
$(elem).html('全選類別');
pageAct.SysType = null;
} }
pageAct.SysType = 'all';
getData(); getData();
pageAct.selAllSysSub = false;
} }
function getData(type = null) { function getData(type = null) {
$(loadEle).Loading("start");
let enddate = new Date(new Date().setDate(new Date(pageAct.alr_enddate).getDate() + 1)).getTime(); let enddate = new Date(new Date().setDate(new Date(pageAct.alr_enddate).getDate() + 1)).getTime();
if (pageAct.SysType == "all") { if (pageAct.SysType == "all") {
getAllDeviceAlarmByBaja(new Date(pageAct.alr_startdate).getTime(), enddate, pageAct.return, pageAct.confirm, callBackFromAllDeviceAlert); getAllDeviceAlarmByBaja(new Date(pageAct.alr_startdate).getTime(), enddate, pageAct.return, pageAct.confirm, callBackFromAllDeviceAlert);
} }
else { else {
let elem = $('input[type=checkbox][data-type=sub]:checked');
pageAct.selSysMain = $(elem).parent().data('main');
pageAct.selSysSub = $(elem).prop('id');
getAlarmByBaja(new Date(pageAct.alr_startdate).getTime(), enddate, pageAct.return, pageAct.confirm, pageAct.selSysMain + "_" + pageAct.selSysSub + "_AlarmClass", callBackFromOneDeviceAlert); getAlarmByBaja(new Date(pageAct.alr_startdate).getTime(), enddate, pageAct.return, pageAct.confirm, pageAct.selSysMain + "_" + pageAct.selSysSub + "_AlarmClass", callBackFromOneDeviceAlert);
} }
} }

View File

@ -1484,6 +1484,13 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
}, null, "POST").send(); }, null, "POST").send();
} }
function getLogo() {
url = baseApiUrl + '/api/GetLogo';
ytAjax = new YourTeam.Ajax(url, null, function (res) {
$('[name=webLogo]').attr('src', baseImgUrl + '/img/' + res.data);
}, null, "POST").send();
}
function getUserInfo() { function getUserInfo() {
let url = baseApiUrl + varApiUrl + "getUserFull"; let url = baseApiUrl + varApiUrl + "getUserFull";

View File

@ -251,7 +251,7 @@
url: baseApiUrl + '/api/GetLogo', url: baseApiUrl + '/api/GetLogo',
async: false, async: false,
success: function (rel) { success: function (rel) {
$('[name=webLogo]').attr('src', 'img/' + rel); $('[name=webLogo]').attr('src', baseImgUrl + '/img/' + rel.data);
} }
}) })
} }