[後台] 修改樓層顯示圖檔問題, 修改切換棟別問題, 關閉點位新增,
This commit is contained in:
		
							parent
							
								
									a620eae1a8
								
							
						
					
					
						commit
						17b9f2485b
					
				@ -468,7 +468,7 @@ namespace Backend.Controllers
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                if (!string.IsNullOrEmpty(buildFloor.InitMapName))
 | 
					                if (!string.IsNullOrEmpty(buildFloor.InitMapName))
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    buildFloor.MapUrl = "/upload/floor_map/" + buildFloor.Floor_guid + ".svg";
 | 
					                    buildFloor.MapUrl = baseURL + "upload/floor_map/" + buildFloor.Floor_map_name + ".svg";
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                apiResult.Code = "0000";
 | 
					                apiResult.Code = "0000";
 | 
				
			||||||
 | 
				
			|||||||
@ -531,8 +531,12 @@ namespace Backend.Controllers
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                if (device_Item.id == 0)
 | 
					                if (device_Item.id == 0)
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    
 | 
					                    var building = await backendRepository.GetAllAsync<string>("select building_tag from building where deleted = 0;");
 | 
				
			||||||
 | 
					                    var parentPath = await backendRepository.GetOneAsync<string>("select system_value from variable where deleted = 0 and system_type = 'obixStatus'");
 | 
				
			||||||
 | 
					                    List<Dictionary<string, object>> device_iteDic = new List<Dictionary<string, object>>();
 | 
				
			||||||
                    //新增
 | 
					                    //新增
 | 
				
			||||||
 | 
					                    foreach (var b in building)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
                        Dictionary<string, object> Device_itemDic = new Dictionary<string, object>()
 | 
					                        Dictionary<string, object> Device_itemDic = new Dictionary<string, object>()
 | 
				
			||||||
                        {
 | 
					                        {
 | 
				
			||||||
                            { "@device_system_tag", main_tag},
 | 
					                            { "@device_system_tag", main_tag},
 | 
				
			||||||
@ -540,6 +544,9 @@ namespace Backend.Controllers
 | 
				
			|||||||
                            { "@full_name", device_Item.full_name},
 | 
					                            { "@full_name", device_Item.full_name},
 | 
				
			||||||
                            { "@points", device_Item.points},
 | 
					                            { "@points", device_Item.points},
 | 
				
			||||||
                            { "@unit", device_Item.unit},
 | 
					                            { "@unit", device_Item.unit},
 | 
				
			||||||
 | 
					                            { "@device_building_tag", b},
 | 
				
			||||||
 | 
					                            { "@parent_path", parentPath},
 | 
				
			||||||
 | 
					                            { "@is_link", 1},
 | 
				
			||||||
                            { "@is_show", device_Item.is_show},
 | 
					                            { "@is_show", device_Item.is_show},
 | 
				
			||||||
                            { "@is_show_riserDiagram", device_Item.is_show_riserDiagram},
 | 
					                            { "@is_show_riserDiagram", device_Item.is_show_riserDiagram},
 | 
				
			||||||
                            { "@is_controll", device_Item.is_controll},
 | 
					                            { "@is_controll", device_Item.is_controll},
 | 
				
			||||||
@ -547,8 +554,10 @@ namespace Backend.Controllers
 | 
				
			|||||||
                            { "@is_show_history", device_Item.is_show_history},
 | 
					                            { "@is_show_history", device_Item.is_show_history},
 | 
				
			||||||
                            { "@created_by", myUserInfo.Userinfo_guid},
 | 
					                            { "@created_by", myUserInfo.Userinfo_guid},
 | 
				
			||||||
                        };
 | 
					                        };
 | 
				
			||||||
                    await backendRepository.AddOneByCustomTable(Device_itemDic, "device_item");
 | 
					                        device_iteDic.Add(Device_itemDic);
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    await backendRepository.AddMutiByCustomTable(device_iteDic, "device_item");
 | 
				
			||||||
                    apiResult.Code = "0000";
 | 
					                    apiResult.Code = "0000";
 | 
				
			||||||
                    apiResult.Msg = "新增成功";
 | 
					                    apiResult.Msg = "新增成功";
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
				
			|||||||
@ -108,6 +108,9 @@
 | 
				
			|||||||
                        //樓層設定上方選單
 | 
					                        //樓層設定上方選單
 | 
				
			||||||
                        $("#BuildList").empty();
 | 
					                        $("#BuildList").empty();
 | 
				
			||||||
                        $.each(data, function (key, value) {
 | 
					                        $.each(data, function (key, value) {
 | 
				
			||||||
 | 
					                            if (value.building_tag.includes("$3"))
 | 
				
			||||||
 | 
					                                value.building_tag = value.building_tag.replace("$3", "");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                            $("#BuildList").append(`<button type="button" class="btn btn-outline-success waves-effect waves-themed ml-2 mb-2 btn-station" id="${value.building_tag}" onclick="clickBuilding('${value.building_tag}')">${value.full_name}</button>`);
 | 
					                            $("#BuildList").append(`<button type="button" class="btn btn-outline-success waves-effect waves-themed ml-2 mb-2 btn-station" id="${value.building_tag}" onclick="clickBuilding('${value.building_tag}')">${value.full_name}</button>`);
 | 
				
			||||||
                            @*if (key == 0) {
 | 
					                            @*if (key == 0) {
 | 
				
			||||||
                                selected_build_guid_top_name = value.full_name;
 | 
					                                selected_build_guid_top_name = value.full_name;
 | 
				
			||||||
@ -530,6 +533,9 @@
 | 
				
			|||||||
                    var url = "/BuildInfo/EditBuildInfo";
 | 
					                    var url = "/BuildInfo/EditBuildInfo";
 | 
				
			||||||
                    var formData = new FormData();
 | 
					                    var formData = new FormData();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    if ($.isNumeric(selected_build_guid[0]))
 | 
				
			||||||
 | 
					                        formData.append("building_tag", "$3" + selected_build_guid);
 | 
				
			||||||
 | 
					                    else
 | 
				
			||||||
                        formData.append("building_tag", selected_build_guid);
 | 
					                        formData.append("building_tag", selected_build_guid);
 | 
				
			||||||
                    formData.append("Full_name", $('#build_name_modal').val());
 | 
					                    formData.append("Full_name", $('#build_name_modal').val());
 | 
				
			||||||
                    formData.append("Ip_address", $('#ip_address_modal').val());
 | 
					                    formData.append("Ip_address", $('#ip_address_modal').val());
 | 
				
			||||||
@ -682,6 +688,9 @@
 | 
				
			|||||||
                    "url": "/BuildInfo/BuildFloorList",
 | 
					                    "url": "/BuildInfo/BuildFloorList",
 | 
				
			||||||
                    "type": "POST",
 | 
					                    "type": "POST",
 | 
				
			||||||
                    "data": function (d) {
 | 
					                    "data": function (d) {
 | 
				
			||||||
 | 
					                        if ($.isNumeric(selected_build_guid_top[0]))
 | 
				
			||||||
 | 
					                            d.build_tag = selected_build_guid_top = "$3" + selected_build_guid_top;
 | 
				
			||||||
 | 
					                        else
 | 
				
			||||||
                            d.build_tag = selected_build_guid_top;
 | 
					                            d.build_tag = selected_build_guid_top;
 | 
				
			||||||
                    },
 | 
					                    },
 | 
				
			||||||
                    "dataSrc": function (rel) {
 | 
					                    "dataSrc": function (rel) {
 | 
				
			||||||
@ -762,11 +771,14 @@
 | 
				
			|||||||
                        return;
 | 
					                        return;
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    else {
 | 
					                    else {
 | 
				
			||||||
 | 
					                        $('#floor-modal').modal();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        $("#BuildName").html(selected_build_guid_top_name);
 | 
					                        $("#BuildName").html(selected_build_guid_top_name);
 | 
				
			||||||
                        $("#floor_name_modal").val(rel.data.full_name);
 | 
					                        $("#floor_name_modal").val(rel.data.full_name);
 | 
				
			||||||
                        @*$("#map_file_preview_modal").attr("data-original", rel.data.mapUrl);*@
 | 
					                        if (rel.data.mapUrl)
 | 
				
			||||||
 | 
					                            loadURLToInputFiled(rel.data.mapUrl, rel.data.initMapName + ".svg");
 | 
				
			||||||
                        $('#floor-modal').modal();
 | 
					                        else
 | 
				
			||||||
 | 
					                            $('#floor_map_file_modal')[0].value = "";
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }, 'json');
 | 
					                }, 'json');
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
@ -977,6 +989,26 @@
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
        //#endregion
 | 
					        //#endregion
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        function loadURLToInputFiled(url, filesName){
 | 
				
			||||||
 | 
					            getImgURL(url, (imgBlob)=>{
 | 
				
			||||||
 | 
					                // Load img blob to input
 | 
				
			||||||
 | 
					                // WIP: UTF8 character error
 | 
				
			||||||
 | 
					                let fileName = filesName
 | 
				
			||||||
 | 
					                let file = new File([imgBlob], fileName,{type:"image/svg+xml", lastModified:new Date().getTime()}, 'utf-8');
 | 
				
			||||||
 | 
					                let container = new DataTransfer(); 
 | 
				
			||||||
 | 
					                container.items.add(file);
 | 
				
			||||||
 | 
					                $('#floor_map_file_modal')[0].files = container.files;
 | 
				
			||||||
 | 
					            })
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        // xmlHTTP return blob respond
 | 
				
			||||||
 | 
					        function getImgURL(url, callback){
 | 
				
			||||||
 | 
					            var xhr = new XMLHttpRequest();
 | 
				
			||||||
 | 
					            xhr.onload = function() {
 | 
				
			||||||
 | 
					                callback(xhr.response);
 | 
				
			||||||
 | 
					            };
 | 
				
			||||||
 | 
					            xhr.open('GET', url);
 | 
				
			||||||
 | 
					            xhr.responseType = 'blob';
 | 
				
			||||||
 | 
					            xhr.send();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    </script>
 | 
					    </script>
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -594,13 +594,13 @@
 | 
				
			|||||||
        //#endregion
 | 
					        //#endregion
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        //#region 新增設備項目
 | 
					        //#region 新增設備項目
 | 
				
			||||||
        function Adddevice_item() {
 | 
					        //function Adddevice_item() {
 | 
				
			||||||
            //SubDeviceItemValidate.resetForm();
 | 
					        //    //SubDeviceItemValidate.resetForm();
 | 
				
			||||||
            selected_system_device_item_guid = "";
 | 
					        //    selected_system_device_item_guid = "";
 | 
				
			||||||
            $("#device-sub-modal .modal-title").html("設備項目 - 新增");
 | 
					        //    $("#device-sub-modal .modal-title").html("設備項目 - 新增");
 | 
				
			||||||
            $("#device-item-sub-form").trigger("reset");
 | 
					        //    $("#device-item-sub-form").trigger("reset");
 | 
				
			||||||
            $("#device-sub-modal").modal();
 | 
					        //    $("#device-sub-modal").modal();
 | 
				
			||||||
        }
 | 
					        //}
 | 
				
			||||||
        //#endregion
 | 
					        //#endregion
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $('#system_sub_table').on("click", "tbody>tr", function () {
 | 
					        $('#system_sub_table').on("click", "tbody>tr", function () {
 | 
				
			||||||
 | 
				
			|||||||
@ -32,11 +32,11 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<div class="card border mb-g w-100 mb-5" id="submenucard">
 | 
					<div class="card border mb-g w-100 mb-5" id="submenucard">
 | 
				
			||||||
    <div class="card-header bg-fusion-25 py-2 pr-3 d-flex align-items-center flex-wrap justify-content-end">
 | 
					    @*<div class="card-header bg-fusion-25 py-2 pr-3 d-flex align-items-center flex-wrap justify-content-end">
 | 
				
			||||||
        <div class="text-right ">
 | 
					        <div class="text-right ">
 | 
				
			||||||
            <a href="javascript:;" class="btn btn-success waves-effect waves-themed" id="adddevice_item-btn" onclick="Adddevice_item()"><span class="fal fa-plus mr-1"></span>新增</a>
 | 
					            <a href="javascript:;" class="btn btn-success waves-effect waves-themed" id="adddevice_item-btn" onclick="Adddevice_item()"><span class="fal fa-plus mr-1"></span>新增</a>
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
    </div>
 | 
					    </div>*@
 | 
				
			||||||
    <div class="card-body">
 | 
					    <div class="card-body">
 | 
				
			||||||
        <div class="w-100">
 | 
					        <div class="w-100">
 | 
				
			||||||
            <div class="col-12">
 | 
					            <div class="col-12">
 | 
				
			||||||
 | 
				
			|||||||
@ -142,12 +142,12 @@ namespace BackendWorkerService
 | 
				
			|||||||
                    );
 | 
					                    );
 | 
				
			||||||
                    #endregion
 | 
					                    #endregion
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    #region 定時取得氣象API
 | 
					                    //#region 定時取得氣象API
 | 
				
			||||||
                    services.AddSingleton<Quartz.Jobs.WeatherAPIJob>();
 | 
					                    //services.AddSingleton<Quartz.Jobs.WeatherAPIJob>();
 | 
				
			||||||
                    services.AddSingleton(
 | 
					                    //services.AddSingleton(
 | 
				
			||||||
                    new JobSchedule(jobType: typeof(Quartz.Jobs.WeatherAPIJob), cronExpression: configuration.GetValue<string>("BackgroundServiceCron:WeatherAPIJob"))
 | 
					                    //new JobSchedule(jobType: typeof(Quartz.Jobs.WeatherAPIJob), cronExpression: configuration.GetValue<string>("BackgroundServiceCron:WeatherAPIJob"))
 | 
				
			||||||
                    );
 | 
					                    //);
 | 
				
			||||||
                    #endregion
 | 
					                    //#endregion
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                }).ConfigureLogging((hostContext, logFactory) => {
 | 
					                }).ConfigureLogging((hostContext, logFactory) => {
 | 
				
			||||||
                    IConfiguration configuration = hostContext.Configuration;
 | 
					                    IConfiguration configuration = hostContext.Configuration;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user