Merge branch 'master' of https://gitea.mjm-staging.developers-homelab.net/BIMS/BIMS
This commit is contained in:
		
						commit
						3712bbbc18
					
				@ -61,10 +61,10 @@ namespace Backend.ApiControllers
 | 
				
			|||||||
                        {
 | 
					                        {
 | 
				
			||||||
                            { "@user_guid", myUser.userinfo_guid },
 | 
					                            { "@user_guid", myUser.userinfo_guid },
 | 
				
			||||||
                            { "@operation_type", 1 }, //1:名稱修改
 | 
					                            { "@operation_type", 1 }, //1:名稱修改
 | 
				
			||||||
                            { "@building_guid", GetOne.Building_guid },
 | 
					                            { "@building_guid", GetOne.building_tag },
 | 
				
			||||||
                            { "@main_system_guid", GetOne.Main_system_guid },
 | 
					                            { "@main_system_guid", GetOne.device_system_tag },
 | 
				
			||||||
                            { "@sub_system_guid", GetOne.Sub_system_guid },
 | 
					                            { "@sub_system_guid", GetOne.device_name_tag },
 | 
				
			||||||
                            { "@floor_guid", GetOne.Floor_guid },
 | 
					                            { "@floor_guid", GetOne.floor_tag },
 | 
				
			||||||
                            { "@device_guid", GetOne.Device_guid },
 | 
					                            { "@device_guid", GetOne.Device_guid },
 | 
				
			||||||
                            { "@action_name", "修改名稱" },
 | 
					                            { "@action_name", "修改名稱" },
 | 
				
			||||||
                            { "@parameter", JsonConvert.SerializeObject(change) },
 | 
					                            { "@parameter", JsonConvert.SerializeObject(change) },
 | 
				
			||||||
 | 
				
			|||||||
@ -54,13 +54,13 @@ namespace Backend.Models
 | 
				
			|||||||
        public string Device_guid { get; set; }
 | 
					        public string Device_guid { get; set; }
 | 
				
			||||||
        public byte Deleted { get; set; }
 | 
					        public byte Deleted { get; set; }
 | 
				
			||||||
        public byte Status { get; set; }
 | 
					        public byte Status { get; set; }
 | 
				
			||||||
        public string Building_guid { get; set; }
 | 
					        public string building_tag { get; set; }
 | 
				
			||||||
        public string Building_full_name { get; set; }
 | 
					        public string Building_full_name { get; set; }
 | 
				
			||||||
        public string Main_system_guid { get; set; }
 | 
					        public string Main_system_guid { get; set; }
 | 
				
			||||||
        public string Main_system_full_name { get; set; }
 | 
					        public string Main_system_full_name { get; set; }
 | 
				
			||||||
        public string Sub_system_guid { get; set; }
 | 
					        public string Sub_system_guid { get; set; }
 | 
				
			||||||
        public string Sub_system_full_name { get; set; }
 | 
					        public string Sub_system_full_name { get; set; }
 | 
				
			||||||
        public string Floor_guid { get; set; }
 | 
					        public string floor_tag { get; set; }
 | 
				
			||||||
        public string Floor_full_name { get; set; }
 | 
					        public string Floor_full_name { get; set; }
 | 
				
			||||||
        public string Device_coordinate { get; set; }
 | 
					        public string Device_coordinate { get; set; }
 | 
				
			||||||
        public string Device_full_name { get; set; }
 | 
					        public string Device_full_name { get; set; }
 | 
				
			||||||
@ -76,7 +76,8 @@ namespace Backend.Models
 | 
				
			|||||||
        public string Device_flashing { get; set; }
 | 
					        public string Device_flashing { get; set; }
 | 
				
			||||||
        public string Device_ip { get; set; }
 | 
					        public string Device_ip { get; set; }
 | 
				
			||||||
        public string Device_port { get; set; }
 | 
					        public string Device_port { get; set; }
 | 
				
			||||||
        public string Device_name_tag { get; set; }
 | 
					        public string device_name_tag { get; set; }
 | 
				
			||||||
 | 
					        public string device_system_tag { get; set; }
 | 
				
			||||||
        public List<DeviceDisaster> Device_disasters { get; set; } //防災類型
 | 
					        public List<DeviceDisaster> Device_disasters { get; set; } //防災類型
 | 
				
			||||||
        public List<DeviceNode> Device_nodes { get; set; } //設備子節點
 | 
					        public List<DeviceNode> Device_nodes { get; set; } //設備子節點
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -814,7 +814,7 @@
 | 
				
			|||||||
                        if (rel.data.length > 0) {
 | 
					                        if (rel.data.length > 0) {
 | 
				
			||||||
                            $('#select_building').empty();
 | 
					                            $('#select_building').empty();
 | 
				
			||||||
                            $.each(rel.data, function (index, val) {
 | 
					                            $.each(rel.data, function (index, val) {
 | 
				
			||||||
                                $("#select_building").append($("<option />").val(val.building_guid).text(val.full_name));
 | 
					                                $("#select_building").append($("<option />").val(val.building_tag).text(val.full_name));
 | 
				
			||||||
                            });
 | 
					                            });
 | 
				
			||||||
                            //預設查詢第一個
 | 
					                            //預設查詢第一個
 | 
				
			||||||
                            $("#select_building").val($("#select_building option:first").val());
 | 
					                            $("#select_building").val($("#select_building option:first").val());
 | 
				
			||||||
 | 
				
			|||||||
@ -218,6 +218,7 @@
 | 
				
			|||||||
	pageAct.alrSelSysSub = [];
 | 
						pageAct.alrSelSysSub = [];
 | 
				
			||||||
	pageAct.selAllSysSub = false;
 | 
						pageAct.selAllSysSub = false;
 | 
				
			||||||
	first = true;
 | 
						first = true;
 | 
				
			||||||
 | 
						let dataAlarm = [];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	$(function () {
 | 
						$(function () {
 | 
				
			||||||
		initDropzone();
 | 
							initDropzone();
 | 
				
			||||||
@ -247,10 +248,9 @@
 | 
				
			|||||||
				// console.log(this);
 | 
									// console.log(this);
 | 
				
			||||||
				pageAct.selAllSysSub = true;
 | 
									pageAct.selAllSysSub = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									//$.each($('input[type=checkbox][data-type=sub]:checked'), function (i, v) {
 | 
				
			||||||
				$.each($('input[type=checkbox][data-type=sub]:checked'), function (i, v) {
 | 
									//	$(v).click();
 | 
				
			||||||
					$(v).click();
 | 
									//});
 | 
				
			||||||
				});
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
				if (pageAct.SysType == "all") {
 | 
									if (pageAct.SysType == "all") {
 | 
				
			||||||
					if (!$(this).is(':checked')) {
 | 
										if (!$(this).is(':checked')) {
 | 
				
			||||||
@ -595,7 +595,6 @@
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	function selAllSysVal(elem) {
 | 
						function selAllSysVal(elem) {
 | 
				
			||||||
		$(loadEle).Loading("start");
 | 
					 | 
				
			||||||
		pageAct.selAllSysSub = true;
 | 
							pageAct.selAllSysSub = true;
 | 
				
			||||||
		if ($(elem).html() == '全選類別') {
 | 
							if ($(elem).html() == '全選類別') {
 | 
				
			||||||
			$('#alr_mainList input').map(function (i, v) {
 | 
								$('#alr_mainList input').map(function (i, v) {
 | 
				
			||||||
@ -630,6 +629,8 @@
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	function getData(type = null) {
 | 
						function getData(type = null) {
 | 
				
			||||||
 | 
							dataAlarm = [];
 | 
				
			||||||
 | 
							$(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") {
 | 
				
			||||||
@ -637,15 +638,28 @@
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
		else {
 | 
							else {
 | 
				
			||||||
			let elem = $('input[type=checkbox][data-type=sub]:checked');
 | 
								let elem = $('input[type=checkbox][data-type=sub]:checked');
 | 
				
			||||||
			if (elem[0]?.id === "other") {
 | 
								if (elem && elem.length > 0) {
 | 
				
			||||||
				console.log(elem[0]?.id)
 | 
									elem.each(function (i, v) {
 | 
				
			||||||
				getOtherAlarmByBaja(new Date(pageAct.alr_startdate).getTime(), enddate, pageAct.return, pageAct.confirm, callBackFromAllDeviceAlert);
 | 
										if (v?.id === "other") {
 | 
				
			||||||
				return
 | 
											console.log(v?.id)
 | 
				
			||||||
 | 
											getOtherAlarmByBaja(new Date(pageAct.alr_startdate).getTime(), enddate, pageAct.return, pageAct.confirm, stackData);
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
										else {
 | 
				
			||||||
 | 
											pageAct.selSysMain = $(v).parent().data('main');
 | 
				
			||||||
 | 
											pageAct.selSysSub = $(v).prop('id');
 | 
				
			||||||
 | 
											getAlarmByBaja(new Date(pageAct.alr_startdate).getTime(), enddate, pageAct.return, pageAct.confirm, pageAct.selSysMain + "_" + pageAct.selSysSub + "_AlarmClass", stackData);
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
									});
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			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);
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							$(loadEle).Loading("close");
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						function stackData(res) {
 | 
				
			||||||
 | 
							res.data.forEach(v => {
 | 
				
			||||||
 | 
								dataAlarm.push(v);
 | 
				
			||||||
 | 
							});
 | 
				
			||||||
 | 
							callBackFromOneDeviceAlert(dataAlarm);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	function callBackFromAllDeviceAlert(res) {
 | 
						function callBackFromAllDeviceAlert(res) {
 | 
				
			||||||
@ -657,20 +671,18 @@
 | 
				
			|||||||
			if (res.data.length > 0)
 | 
								if (res.data.length > 0)
 | 
				
			||||||
				t.fnAddData(res.data);
 | 
									t.fnAddData(res.data);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		$(loadEle).Loading("close");
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	function callBackFromOneDeviceAlert(res) {
 | 
						function callBackFromOneDeviceAlert(res) {
 | 
				
			||||||
		//res = JSON.parse(res);
 | 
							refTable(res);
 | 
				
			||||||
		refTable(res.data);
 | 
					
 | 
				
			||||||
		if (historyTable != null) {
 | 
							if (historyTable != null) {
 | 
				
			||||||
			let t = $('#alertTable').dataTable();
 | 
								let t = $('#alertTable').dataTable();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			t.fnClearTable();
 | 
								t.fnClearTable();
 | 
				
			||||||
			if (res.data.length > 0)
 | 
								if (res.length > 0)
 | 
				
			||||||
				t.fnAddData(res.data);
 | 
									t.fnAddData(res);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		$(loadEle).Loading("close");
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	function refTable(data) {
 | 
						function refTable(data) {
 | 
				
			||||||
 | 
				
			|||||||
@ -337,7 +337,7 @@
 | 
				
			|||||||
    })
 | 
					    })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    function getGraCatList(callback) {
 | 
					    function getGraCatList(callback) {
 | 
				
			||||||
        let url = baseApiUrl + "/GraphManage/VarList";
 | 
							let url = baseApiUrl + "/GraphManage/GraphManageTreeList";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        ytAjax = new YourTeam.Ajax(url, null, function (res) {
 | 
					        ytAjax = new YourTeam.Ajax(url, null, function (res) {
 | 
				
			||||||
            if (!res || res.code != "0000" || !res.data) {
 | 
					            if (!res || res.code != "0000" || !res.data) {
 | 
				
			||||||
 | 
				
			|||||||
@ -264,9 +264,9 @@
 | 
				
			|||||||
    function getData(start = null, end = null) {
 | 
					    function getData(start = null, end = null) {
 | 
				
			||||||
        var sdt = new Date();
 | 
					        var sdt = new Date();
 | 
				
			||||||
        var edt = new Date(new Date().setDate(sdt.getDate() + 1));
 | 
					        var edt = new Date(new Date().setDate(sdt.getDate() + 1));
 | 
				
			||||||
 | 
					        $(loadEle).Loading("start");
 | 
				
			||||||
        start = start ?? sdt.toLocaleDateString();
 | 
					        start = start ?? sdt.toLocaleDateString();
 | 
				
			||||||
        end = end ?? edt.toLocaleDateString();
 | 
					        end = end ?? edt.toLocaleDateString();
 | 
				
			||||||
        $(loadEle).Loading("start");
 | 
					 | 
				
			||||||
        callBackFromHistory()
 | 
					        callBackFromHistory()
 | 
				
			||||||
        getHistoryDataByBaja(pageAct.deviceNumber + "_" + pageAct.deviceItem,
 | 
					        getHistoryDataByBaja(pageAct.deviceNumber + "_" + pageAct.deviceItem,
 | 
				
			||||||
            new Date(start).getTime(),
 | 
					            new Date(start).getTime(),
 | 
				
			||||||
@ -363,7 +363,7 @@
 | 
				
			|||||||
        let start = new Date($('#his_startdate').val());
 | 
					        let start = new Date($('#his_startdate').val());
 | 
				
			||||||
        let end = new Date(new Date().setDate(new Date($('#his_enddate input').val()).getDate() + 1));
 | 
					        let end = new Date(new Date().setDate(new Date($('#his_enddate input').val()).getDate() + 1));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (pageAct.dateType == "day")
 | 
					        if (pageAct.dateType == "today")
 | 
				
			||||||
            end = new Date(new Date().setDate(start.getDate() + 1));
 | 
					            end = new Date(new Date().setDate(start.getDate() + 1));
 | 
				
			||||||
        else if (pageAct.dateType == "month") {
 | 
					        else if (pageAct.dateType == "month") {
 | 
				
			||||||
            start = new Date($('#getmonth').val());
 | 
					            start = new Date($('#getmonth').val());
 | 
				
			||||||
@ -394,48 +394,49 @@
 | 
				
			|||||||
                v.type = pageAct.devicePoiName.split(" ")[0];
 | 
					                v.type = pageAct.devicePoiName.split(" ")[0];
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			let tag = "#historyTable";
 | 
					            let tag = "#historyTable";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			let column_defs = [
 | 
					            let column_defs = [
 | 
				
			||||||
				{ "targets": [0], "width": "20%", "sortable": true },
 | 
					                { "targets": [0], "width": "20%", "sortable": true },
 | 
				
			||||||
				{ "targets": [1], "width": "20%", "sortable": true },
 | 
					                { "targets": [1], "width": "20%", "sortable": true },
 | 
				
			||||||
				{ "targets": [2], "width": "20%", "sortable": true }
 | 
					                { "targets": [2], "width": "20%", "sortable": true }
 | 
				
			||||||
			];
 | 
					            ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			let columns = [
 | 
					            let columns = [
 | 
				
			||||||
				{
 | 
					                {
 | 
				
			||||||
					"title": "類別",
 | 
					                    "title": "類別",
 | 
				
			||||||
					"data": "type"
 | 
					                    "data": "type"
 | 
				
			||||||
				},
 | 
					                },
 | 
				
			||||||
				{
 | 
					                {
 | 
				
			||||||
					"title": "設備名稱",
 | 
					                    "title": "設備名稱",
 | 
				
			||||||
					"data": "deviceName",
 | 
					                    "data": "deviceName",
 | 
				
			||||||
				},
 | 
					                },
 | 
				
			||||||
				{
 | 
					                {
 | 
				
			||||||
					"title": "數值",
 | 
					                    "title": "數值",
 | 
				
			||||||
					"data": "value",
 | 
					                    "data": "value",
 | 
				
			||||||
					"render": function (data) {
 | 
					                    "render": function (data) {
 | 
				
			||||||
						if (isNaN(data.toString())) {
 | 
					                        if (isNaN(data.toString())) {
 | 
				
			||||||
							return data
 | 
					                            return data
 | 
				
			||||||
						}
 | 
					                        }
 | 
				
			||||||
						return data.roundDecimal(2);
 | 
					                        return data.roundDecimal(2);
 | 
				
			||||||
					}
 | 
					                    }
 | 
				
			||||||
				},
 | 
					                },
 | 
				
			||||||
				{
 | 
					                {
 | 
				
			||||||
					"title": "紀錄時間",
 | 
					                    "title": "紀錄時間",
 | 
				
			||||||
					"data": "timestamp",
 | 
					                    "data": "timestamp",
 | 
				
			||||||
					"render": function (data) {
 | 
					                    "render": function (data) {
 | 
				
			||||||
						// console.log(data)
 | 
					                        // console.log(data)
 | 
				
			||||||
						return displayDate(data, "datetime");
 | 
					                        return displayDate(data, "datetime");
 | 
				
			||||||
					}
 | 
					                    }
 | 
				
			||||||
				}
 | 
					                }
 | 
				
			||||||
			];
 | 
					            ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			historyTable = new YourTeam.JqDataTables.getTableByStatic(tag, data, columns, column_defs, null, null, null, null, "tpi");
 | 
					            historyTable = new YourTeam.JqDataTables.getTableByStatic(tag, data, columns, column_defs, null, null, null, null, "tpi");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    function exportExcel() {
 | 
					    function exportExcel() {
 | 
				
			||||||
 | 
					        $(loadEle).Loading("start");
 | 
				
			||||||
        let url = baseApiUrl + "/History/OpeExportExcel";
 | 
					        let url = baseApiUrl + "/History/OpeExportExcel";
 | 
				
			||||||
        objSendData.Data = $('#historyTable').dataTable().fnGetData();
 | 
					        objSendData.Data = $('#historyTable').dataTable().fnGetData();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -444,10 +445,11 @@
 | 
				
			|||||||
            v.endtime = $('#his_enddate input').val() === "" ? null : new Date($('#his_enddate input').val());
 | 
					            v.endtime = $('#his_enddate input').val() === "" ? null : new Date($('#his_enddate input').val());
 | 
				
			||||||
            v.dateType = pageAct.dateType;
 | 
					            v.dateType = pageAct.dateType;
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					 | 
				
			||||||
        ytAjax = new YourTeam.Ajax(url, objSendData, function (rel) {
 | 
					        ytAjax = new YourTeam.Ajax(url, objSendData, function (rel) {
 | 
				
			||||||
            if (rel.code == "0000")
 | 
					            if (rel.code == "0000") {
 | 
				
			||||||
                location.href = baseApiUrl + "/api/df?path=" + rel.data.split('/')[0] + "&fileName=" + rel.data.split('/')[1] + "&token=" + cookies.get("JWT-Authorization");
 | 
					                location.href = baseApiUrl + "/api/df?path=" + rel.data.split('/')[0] + "&fileName=" + rel.data.split('/')[1] + "&token=" + cookies.get("JWT-Authorization");
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
        }, null, "POST").send();
 | 
					        }, null, "POST").send();
 | 
				
			||||||
 | 
					        $(loadEle).Loading("close");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
@ -8,22 +8,13 @@
 | 
				
			|||||||
					<div class="btn-group">
 | 
										<div class="btn-group">
 | 
				
			||||||
						<button type="button" onclick="setType(2)" class="btn btn-secondary waves-effect waves-themed">維修</button>
 | 
											<button type="button" onclick="setType(2)" class="btn btn-secondary waves-effect waves-themed">維修</button>
 | 
				
			||||||
						<button type="button" onclick="setType(1)" class="btn btn-secondary waves-effect waves-themed">保養記錄</button>
 | 
											<button type="button" onclick="setType(1)" class="btn btn-secondary waves-effect waves-themed">保養記錄</button>
 | 
				
			||||||
						<button type="button" onclick="setType(null)"
 | 
											<button type="button" onclick="setType(null)" class="btn btn-secondary waves-effect waves-themed">廠商資料</button>
 | 
				
			||||||
								class="btn btn-secondary waves-effect waves-themed">
 | 
					 | 
				
			||||||
							廠商資料
 | 
					 | 
				
			||||||
						</button>
 | 
					 | 
				
			||||||
					</div>
 | 
										</div>
 | 
				
			||||||
				</div>
 | 
									</div>
 | 
				
			||||||
				<div id="setDate" class="col-auto">
 | 
									<div id="setDate" class="col-auto">
 | 
				
			||||||
					<div class="btn-group">
 | 
										<div class="btn-group">
 | 
				
			||||||
						<button onclick="setDate('tdy')" type="button"
 | 
											<button onclick="setDate('tdy')" type="button" class="btn btn-secondary waves-effect waves-themed">今天</button>
 | 
				
			||||||
								class="btn btn-secondary waves-effect waves-themed">
 | 
											<button onclick="setDate('ytd')" type="button" class="btn btn-secondary waves-effect waves-themed">昨天</button>
 | 
				
			||||||
							今天
 | 
					 | 
				
			||||||
						</button>
 | 
					 | 
				
			||||||
						<button onclick="setDate('ytd')" type="button"
 | 
					 | 
				
			||||||
								class="btn btn-secondary waves-effect waves-themed">
 | 
					 | 
				
			||||||
							昨天
 | 
					 | 
				
			||||||
						</button>
 | 
					 | 
				
			||||||
					</div>
 | 
										</div>
 | 
				
			||||||
				</div>
 | 
									</div>
 | 
				
			||||||
				<div class="col-auto">
 | 
									<div class="col-auto">
 | 
				
			||||||
@ -69,7 +60,7 @@
 | 
				
			|||||||
						<a href="#" id="newForm" class="btn btn-success" data-toggle="modal" data-target="#opeFirmModal">新增</a>
 | 
											<a href="#" id="newForm" class="btn btn-success" data-toggle="modal" data-target="#opeFirmModal">新增</a>
 | 
				
			||||||
						<a href="#" onclick="exportExcel()" class="btn btn-info waves-effect waves-themed">
 | 
											<a href="#" onclick="exportExcel()" class="btn btn-info waves-effect waves-themed">
 | 
				
			||||||
							<span class="fal fa-file-excel mr-1"></span>
 | 
												<span class="fal fa-file-excel mr-1"></span>
 | 
				
			||||||
							<span>匯出</span>
 | 
												匯出
 | 
				
			||||||
						</a>
 | 
											</a>
 | 
				
			||||||
					</div>
 | 
										</div>
 | 
				
			||||||
					<table id="opeFirmTable" class="table table-bordered table-striped text-center m-0 w-100">
 | 
										<table id="opeFirmTable" class="table table-bordered table-striped text-center m-0 w-100">
 | 
				
			||||||
@ -85,8 +76,7 @@
 | 
				
			|||||||
</main>
 | 
					</main>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<!-- Modal center 廠商資料 -->
 | 
					<!-- Modal center 廠商資料 -->
 | 
				
			||||||
<div class="modal fade" id="opeFirmModal" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static"
 | 
					<div class="modal fade" id="opeFirmModal" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static" data-keyboard="false">
 | 
				
			||||||
	 data-keyboard="false">
 | 
					 | 
				
			||||||
	<div class="modal-dialog modal-dialog-centered" role="document">
 | 
						<div class="modal-dialog modal-dialog-centered" role="document">
 | 
				
			||||||
		<div class="modal-content">
 | 
							<div class="modal-content">
 | 
				
			||||||
			<div class="modal-header">
 | 
								<div class="modal-header">
 | 
				
			||||||
@ -162,8 +152,7 @@
 | 
				
			|||||||
</div>
 | 
					</div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<!-- Modal center 維修-->
 | 
					<!-- Modal center 維修-->
 | 
				
			||||||
<div class="modal fade" id="opeRecModal_2" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static"
 | 
					<div class="modal fade" id="opeRecModal_2" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static" data-keyboard="false">
 | 
				
			||||||
	 data-keyboard="false">
 | 
					 | 
				
			||||||
	<div class="modal-dialog modal-dialog-centered" role="document">
 | 
						<div class="modal-dialog modal-dialog-centered" role="document">
 | 
				
			||||||
		<div class="modal-content">
 | 
							<div class="modal-content">
 | 
				
			||||||
			<div class="modal-header">
 | 
								<div class="modal-header">
 | 
				
			||||||
@ -233,14 +222,12 @@
 | 
				
			|||||||
								<div class="form-control" id="inpStatus_2">
 | 
													<div class="form-control" id="inpStatus_2">
 | 
				
			||||||
									<div class="row container">
 | 
														<div class="row container">
 | 
				
			||||||
										<div class="">
 | 
															<div class="">
 | 
				
			||||||
											<input class="custom-radio-input" type="radio" name="inpSta_2" id="inpSta_2_0" value="0"
 | 
																<input class="custom-radio-input" type="radio" name="inpSta_2" id="inpSta_2_0" value="0" data-value="0" checked>
 | 
				
			||||||
												   data-value="0" checked>
 | 
					 | 
				
			||||||
											<label class="form-label" for="inpSta_0">未完成</label>
 | 
																<label class="form-label" for="inpSta_0">未完成</label>
 | 
				
			||||||
										</div>
 | 
															</div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
										<div class="px-4">
 | 
															<div class="px-4">
 | 
				
			||||||
											<input class="custom-radio-input" type="radio" name="inpSta_2" id="inpSta_2_1" value="1"
 | 
																<input class="custom-radio-input" type="radio" name="inpSta_2" id="inpSta_2_1" value="1" data-value="1">
 | 
				
			||||||
												   data-value="1">
 | 
					 | 
				
			||||||
											<label class="form-label" for="inpSta_1">完成</label>
 | 
																<label class="form-label" for="inpSta_1">完成</label>
 | 
				
			||||||
										</div>
 | 
															</div>
 | 
				
			||||||
									</div>
 | 
														</div>
 | 
				
			||||||
@ -264,8 +251,7 @@
 | 
				
			|||||||
						<div class="col-md-12">
 | 
											<div class="col-md-12">
 | 
				
			||||||
							<div class="form-group">
 | 
												<div class="form-group">
 | 
				
			||||||
								<label class="form-label" for="inpDescription_2">結果描述</label>
 | 
													<label class="form-label" for="inpDescription_2">結果描述</label>
 | 
				
			||||||
								<textarea class="form-control" type="text" id="inpDescription_2" name="inpDescription_2"
 | 
													<textarea class="form-control" type="text" id="inpDescription_2" name="inpDescription_2" rows="7"></textarea>
 | 
				
			||||||
										  rows="7"></textarea>
 | 
					 | 
				
			||||||
							</div>
 | 
												</div>
 | 
				
			||||||
						</div>
 | 
											</div>
 | 
				
			||||||
						<div class="col-md-12">
 | 
											<div class="col-md-12">
 | 
				
			||||||
@ -302,8 +288,7 @@
 | 
				
			|||||||
</div>
 | 
					</div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<!-- Modal center 保養 -->
 | 
					<!-- Modal center 保養 -->
 | 
				
			||||||
<div class="modal fade" id="opeRecModal" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static"
 | 
					<div class="modal fade" id="opeRecModal" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static" data-keyboard="false">
 | 
				
			||||||
	 data-keyboard="false">
 | 
					 | 
				
			||||||
	<div class="modal-dialog modal-dialog-centered" role="document">
 | 
						<div class="modal-dialog modal-dialog-centered" role="document">
 | 
				
			||||||
		<div class="modal-content">
 | 
							<div class="modal-content">
 | 
				
			||||||
			<div class="modal-header">
 | 
								<div class="modal-header">
 | 
				
			||||||
@ -365,14 +350,12 @@
 | 
				
			|||||||
								<div class="form-control" id="inpStatus">
 | 
													<div class="form-control" id="inpStatus">
 | 
				
			||||||
									<div class="row container">
 | 
														<div class="row container">
 | 
				
			||||||
										<div class="">
 | 
															<div class="">
 | 
				
			||||||
											<input class="custom-radio-input" type="radio" name="inpSta" id="inpSta_0" data-value="0"
 | 
																<input class="custom-radio-input" type="radio" name="inpSta" id="inpSta_0" data-value="0" value="0" checked>
 | 
				
			||||||
												   value="0" checked>
 | 
					 | 
				
			||||||
											<label class="form-label" for="inpSta_0">未完成</label>
 | 
																<label class="form-label" for="inpSta_0">未完成</label>
 | 
				
			||||||
										</div>
 | 
															</div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
										<div class="px-4">
 | 
															<div class="px-4">
 | 
				
			||||||
											<input class="custom-radio-input" type="radio" name="inpSta" id="inpSta_1" data-value="1"
 | 
																<input class="custom-radio-input" type="radio" name="inpSta" id="inpSta_1" data-value="1" value="1">
 | 
				
			||||||
												   value="1">
 | 
					 | 
				
			||||||
											<label class="form-label" for="inpSta_1">完成</label>
 | 
																<label class="form-label" for="inpSta_1">完成</label>
 | 
				
			||||||
										</div>
 | 
															</div>
 | 
				
			||||||
									</div>
 | 
														</div>
 | 
				
			||||||
@ -396,8 +379,7 @@
 | 
				
			|||||||
						<div class="col-md-12">
 | 
											<div class="col-md-12">
 | 
				
			||||||
							<div class="form-group">
 | 
												<div class="form-group">
 | 
				
			||||||
								<label class="form-label" for="inpDescription">結果描述</label>
 | 
													<label class="form-label" for="inpDescription">結果描述</label>
 | 
				
			||||||
								<textarea class="form-control" type="text" id="inpDescription" name="inpDescription"
 | 
													<textarea class="form-control" type="text" id="inpDescription" name="inpDescription" rows="7"></textarea>
 | 
				
			||||||
										  rows="7"></textarea>
 | 
					 | 
				
			||||||
							</div>
 | 
												</div>
 | 
				
			||||||
						</div>
 | 
											</div>
 | 
				
			||||||
						<div class="col-md-12">
 | 
											<div class="col-md-12">
 | 
				
			||||||
@ -434,8 +416,7 @@
 | 
				
			|||||||
</div>
 | 
					</div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<!-- Modal center 刪除 -->
 | 
					<!-- Modal center 刪除 -->
 | 
				
			||||||
<div class="modal fade" id="delModal" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static"
 | 
					<div class="modal fade" id="delModal" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static" data-keyboard="false">
 | 
				
			||||||
	 data-keyboard="false">
 | 
					 | 
				
			||||||
	<div class="modal-dialog modal-dialog-centered" role="document">
 | 
						<div class="modal-dialog modal-dialog-centered" role="document">
 | 
				
			||||||
		<div class="modal-content">
 | 
							<div class="modal-content">
 | 
				
			||||||
			<div class="modal-header">
 | 
								<div class="modal-header">
 | 
				
			||||||
@ -536,6 +517,7 @@
 | 
				
			|||||||
	});
 | 
						});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	function loadOpeFirmTable() {
 | 
						function loadOpeFirmTable() {
 | 
				
			||||||
 | 
							$(loadEle).Loading("start");
 | 
				
			||||||
		$('#opeFirmTable_wrapper').css('display', 'block');
 | 
							$('#opeFirmTable_wrapper').css('display', 'block');
 | 
				
			||||||
		$('#opeRecTable_wrapper').css('display', 'none');
 | 
							$('#opeRecTable_wrapper').css('display', 'none');
 | 
				
			||||||
		$('#opeRecTable_2_wrapper').css('display', 'none');
 | 
							$('#opeRecTable_2_wrapper').css('display', 'none');
 | 
				
			||||||
@ -601,9 +583,11 @@
 | 
				
			|||||||
		];
 | 
							];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		opeFirmTable = new YourTeam.JqDataTables.getTableByAjax(ajaxObj, tag, null, columns, column_defs);
 | 
							opeFirmTable = new YourTeam.JqDataTables.getTableByAjax(ajaxObj, tag, null, columns, column_defs);
 | 
				
			||||||
 | 
							$(loadEle).Loading("close");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	function loadOpeRecTable() {
 | 
						function loadOpeRecTable() {
 | 
				
			||||||
 | 
							$(loadEle).Loading("start");
 | 
				
			||||||
		$('#opeFirmTable_wrapper').css('display', 'none');
 | 
							$('#opeFirmTable_wrapper').css('display', 'none');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		$('#serial_number').parent().parent().css('display', 'block');
 | 
							$('#serial_number').parent().parent().css('display', 'block');
 | 
				
			||||||
@ -860,6 +844,7 @@
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		opeRecTable = new YourTeam.JqDataTables.getTableByAjax(ajaxObj, tag, null, columns, column_defs);
 | 
							opeRecTable = new YourTeam.JqDataTables.getTableByAjax(ajaxObj, tag, null, columns, column_defs);
 | 
				
			||||||
 | 
							$(loadEle).Loading("close");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	function setType(wt) {
 | 
						function setType(wt) {
 | 
				
			||||||
@ -998,8 +983,8 @@
 | 
				
			|||||||
			loadOpeRecTable();
 | 
								loadOpeRecTable();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	function exportExcel(e) {
 | 
						function exportExcel() {
 | 
				
			||||||
		console.log("export", e)
 | 
							$(loadEle).Loading("start");
 | 
				
			||||||
		let url = baseApiUrl + "/operation/OpeExportExcel";
 | 
							let url = baseApiUrl + "/operation/OpeExportExcel";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		objSendData.Data = {
 | 
							objSendData.Data = {
 | 
				
			||||||
@ -1007,11 +992,12 @@
 | 
				
			|||||||
			startdate: pageAct.startdate == undefined ? null : pageAct.startdate,
 | 
								startdate: pageAct.startdate == undefined ? null : pageAct.startdate,
 | 
				
			||||||
			enddate: pageAct.enddate == undefined ? null : pageAct.enddate,
 | 
								enddate: pageAct.enddate == undefined ? null : pageAct.enddate,
 | 
				
			||||||
		};
 | 
							};
 | 
				
			||||||
		console.log("data", objSendData.Data)
 | 
					
 | 
				
			||||||
		ytAjax = new YourTeam.Ajax(url, objSendData, function (rel) {
 | 
							ytAjax = new YourTeam.Ajax(url, objSendData, function (rel) {
 | 
				
			||||||
			if (rel.code == "0000")
 | 
								if (rel.code == "0000")
 | 
				
			||||||
				location.href = baseApiUrl + "/api/df?path=" + rel.data.split('/')[0] + "&fileName=" + rel.data.split('/')[1] + "&token=" + cookies.get("JWT-Authorization");
 | 
									location.href = baseApiUrl + "/api/df?path=" + rel.data.split('/')[0] + "&fileName=" + rel.data.split('/')[1] + "&token=" + cookies.get("JWT-Authorization");
 | 
				
			||||||
		}, null, "POST").send();
 | 
							}, null, "POST").send();
 | 
				
			||||||
 | 
							$(loadEle).Loading("close");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	function selSysMain() {
 | 
						function selSysMain() {
 | 
				
			||||||
@ -1100,7 +1086,6 @@
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	function selAllSysVal(elem) {
 | 
						function selAllSysVal(elem) {
 | 
				
			||||||
		$(loadEle).Loading("start");
 | 
					 | 
				
			||||||
		if ($(elem).html() == '全選類別') {
 | 
							if ($(elem).html() == '全選類別') {
 | 
				
			||||||
			$('#mainList input').map(function (i, v) {
 | 
								$('#mainList input').map(function (i, v) {
 | 
				
			||||||
				if (!$(v).is(':checked')) {
 | 
									if (!$(v).is(':checked')) {
 | 
				
			||||||
@ -1127,7 +1112,6 @@
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		refTable();
 | 
							refTable();
 | 
				
			||||||
		$(loadEle).Loading("close");
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	function event() {
 | 
						function event() {
 | 
				
			||||||
@ -1375,18 +1359,12 @@
 | 
				
			|||||||
				if (!res || res.code != "0000" || !res.data) {
 | 
									if (!res || res.code != "0000" || !res.data) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				} else {
 | 
									} else {
 | 
				
			||||||
					pageAct.sysMain = res.data.device_system_category_layer2;
 | 
					 | 
				
			||||||
					pageAct.sysSub = res.data.device_system_category_layer3;
 | 
										pageAct.sysSub = res.data.device_system_category_layer3;
 | 
				
			||||||
					pageAct.number = res.data.fix_do_code;
 | 
										pageAct.number = res.data.fix_do_code;
 | 
				
			||||||
 | 
										selOpeFir();
 | 
				
			||||||
 | 
										errCodeList();
 | 
				
			||||||
					callbackForErr(JSON.stringify({
 | 
					 | 
				
			||||||
						count: [res.data].length,
 | 
					 | 
				
			||||||
						data: [{ uuid: res.data.error_code }]
 | 
					 | 
				
			||||||
					}));
 | 
					 | 
				
			||||||
					$(pageAct.work_type == "1" ? '#inpNumber' : '#inpNumber_2').val(res.data.formId);
 | 
										$(pageAct.work_type == "1" ? '#inpNumber' : '#inpNumber_2').val(res.data.formId);
 | 
				
			||||||
					$(pageAct.work_type == "1" ? '#inpWorTyp' : '#inpWorTyp_2').val(res.data.work_type);
 | 
										$(pageAct.work_type == "1" ? '#inpWorTyp' : '#inpWorTyp_2').val(res.data.work_type);
 | 
				
			||||||
					$(pageAct.work_type == "1" ? '#inpErrCode' : '#inpErrCode_2').val(res.data.error_code);
 | 
					 | 
				
			||||||
					$(pageAct.work_type == "1" ? '#inpFixDo' : '#inpFixDo_2').val(res.data.fix_do);
 | 
										$(pageAct.work_type == "1" ? '#inpFixDo' : '#inpFixDo_2').val(res.data.fix_do);
 | 
				
			||||||
					$(pageAct.work_type == "1" ? '#inpFixDoCode' : '#inpFixDoCode_2').val(res.data.fix_do_code);
 | 
										$(pageAct.work_type == "1" ? '#inpFixDoCode' : '#inpFixDoCode_2').val(res.data.fix_do_code);
 | 
				
			||||||
					$(pageAct.work_type == "1" ? '#inpFixFirm' : '#inpFixFirm_2').val(res.data.fix_firm);
 | 
										$(pageAct.work_type == "1" ? '#inpFixFirm' : '#inpFixFirm_2').val(res.data.fix_firm);
 | 
				
			||||||
@ -1395,9 +1373,6 @@
 | 
				
			|||||||
					$(pageAct.work_type == "1" ? '#inpStaTime' : '#inpStaTime_2').val(displayDate(res.data.start_time, 'date').replaceAll('/', '-'));
 | 
										$(pageAct.work_type == "1" ? '#inpStaTime' : '#inpStaTime_2').val(displayDate(res.data.start_time, 'date').replaceAll('/', '-'));
 | 
				
			||||||
					$(pageAct.work_type == "1" ? '#inpNotice' : '#inpNotice_2').val(res.data.notice);
 | 
										$(pageAct.work_type == "1" ? '#inpNotice' : '#inpNotice_2').val(res.data.notice);
 | 
				
			||||||
					$(pageAct.work_type == "1" ? '#inpDescription' : '#inpDescription_2').val(res.data.description);
 | 
										$(pageAct.work_type == "1" ? '#inpDescription' : '#inpDescription_2').val(res.data.description);
 | 
				
			||||||
					let elemSel = $(pageAct.work_type == "1" ? '#inpFixDoCode' : '#inpFixDoCode_2').find('option:selected');;
 | 
					 | 
				
			||||||
					pageAct.number = elemSel.val();
 | 
					 | 
				
			||||||
					selOpeFir();
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
					ope_imgHtml = null;
 | 
										ope_imgHtml = null;
 | 
				
			||||||
					$.each(res.data.lorf, function (i, v) {
 | 
										$.each(res.data.lorf, function (i, v) {
 | 
				
			||||||
@ -1493,18 +1468,17 @@
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	function callbackForErr(res) {
 | 
						function callbackForErr(res) {
 | 
				
			||||||
		res = JSON.parse(res) || res;
 | 
							res = JSON.parse(res);
 | 
				
			||||||
		console.log(res)
 | 
					 | 
				
			||||||
		strHtml = ``;
 | 
							strHtml = ``;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		$.each(res.data, function (i, v) {
 | 
							$.each(res.data, function (i, v) {
 | 
				
			||||||
			msg = v.msgText != null ? ($.trim(v.msgText.toString()).length > 0 ? v.msgText.split(':')[0] : '') : '';
 | 
								msg = v.msgText != null ? ($.trim(v.msgText.toString()).length > 0 ? v.msgText.split(':')[0] : '') : '';
 | 
				
			||||||
            strHtml += `<option value=${v.uuid}>${v.uuid.split("-")[0]}</option>`;
 | 
								strHtml += `<option value=${v.uuid}>${v.uuid}</option>`;
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (res.count > 0)
 | 
							if (res.count > 0)
 | 
				
			||||||
			$(pageAct.work_type == '1' ? '#inpErrCode' : '#inpErrCode_2').html(strHtml);
 | 
								$(pageAct.work_type == '1' ? '#inpErrCode' : '#inpErrCode_2').html(strHtml);
 | 
				
			||||||
		else
 | 
					
 | 
				
			||||||
			$(pageAct.work_type == '1' ? '#inpErrCode' : '#inpErrCode_2').html("");
 | 
					 | 
				
			||||||
		$(loadEle).Loading("close");
 | 
							$(loadEle).Loading("close");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -716,7 +716,7 @@ namespace FrontendWebApi.ApiControllers
 | 
				
			|||||||
                            join auth_page p on p.AuthCode = a.AuthCode
 | 
					                            join auth_page p on p.AuthCode = a.AuthCode
 | 
				
			||||||
                            where u.account = N'{role.Account}'
 | 
					                            where u.account = N'{role.Account}'
 | 
				
			||||||
                            and p.SubName = N'編輯設備名稱'
 | 
					                            and p.SubName = N'編輯設備名稱'
 | 
				
			||||||
                            and p.building_guid = N'{role.Building_guid}'";
 | 
					                            and p.building_tag = N'{role.Building_tag}'";
 | 
				
			||||||
                var have = await backendRepository.GetOneAsync<string>(sql);
 | 
					                var have = await backendRepository.GetOneAsync<string>(sql);
 | 
				
			||||||
                if (have == null)
 | 
					                if (have == null)
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
 | 
				
			|||||||
@ -70,20 +70,6 @@ namespace FrontendWebApi.ApiControllers
 | 
				
			|||||||
                return null;
 | 
					                return null;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        [HttpGet]
 | 
					 | 
				
			||||||
        [Route("api/df")]
 | 
					 | 
				
			||||||
        public ActionResult DownloadFile(string path, string fileName, string token)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            var jwt = new JwtSecurityTokenHandler().ReadJwtToken(token);
 | 
					 | 
				
			||||||
            if (jwt == null)
 | 
					 | 
				
			||||||
                return Unauthorized(HttpStatusCode.Unauthorized);
 | 
					 | 
				
			||||||
            else if (fileName == null)
 | 
					 | 
				
			||||||
                return NotFound("找不到文件");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            var filePath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "excel", path);
 | 
					 | 
				
			||||||
            return File(System.IO.File.ReadAllBytes(Path.Combine(filePath, fileName)), "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", fileName);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        [HttpPost]
 | 
					        [HttpPost]
 | 
				
			||||||
        [Route("api/Upload")]
 | 
					        [Route("api/Upload")]
 | 
				
			||||||
        public ActionResult DroZonUplFile()
 | 
					        public ActionResult DroZonUplFile()
 | 
				
			||||||
 | 
				
			|||||||
@ -46,7 +46,8 @@ namespace FrontendWebApi.ApiControllers
 | 
				
			|||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
        /// <param name="lhe"></param>
 | 
					        /// <param name="lhe"></param>
 | 
				
			||||||
        /// <returns></returns>
 | 
					        /// <returns></returns>
 | 
				
			||||||
        public ActionResult<ApiResult<string>> OpeExportExcel([FromBody] List<HistoryExport> lhe)
 | 
					        [HttpPost]
 | 
				
			||||||
 | 
					        public async Task<ActionResult<ApiResult<string>>> OpeExportExcel([FromBody] List<HistoryExport> lhe)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            ApiResult<string> apiResult = new ApiResult<string>();
 | 
					            ApiResult<string> apiResult = new ApiResult<string>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -118,13 +119,16 @@ namespace FrontendWebApi.ApiControllers
 | 
				
			|||||||
                    sheet.SetColumnWidth(0, 4 * 160 * 12);
 | 
					                    sheet.SetColumnWidth(0, 4 * 160 * 12);
 | 
				
			||||||
                    sheet.SetColumnWidth(1, 4 * 160 * 12);
 | 
					                    sheet.SetColumnWidth(1, 4 * 160 * 12);
 | 
				
			||||||
                    sheet.SetColumnWidth(2, 4 * 160 * 12);
 | 
					                    sheet.SetColumnWidth(2, 4 * 160 * 12);
 | 
				
			||||||
 | 
					                    sheet.SetColumnWidth(3, 4 * 160 * 12);
 | 
				
			||||||
                    ICell cell = row.CreateCell(0);
 | 
					                    ICell cell = row.CreateCell(0);
 | 
				
			||||||
                    cell.SetCellValue("設備名稱");
 | 
					                    cell.SetCellValue("類型");
 | 
				
			||||||
                    cell.CellStyle = styleLine12;
 | 
					                    cell.CellStyle = styleLine12;
 | 
				
			||||||
                    cell = row.CreateCell(1);
 | 
					                    cell = row.CreateCell(1);
 | 
				
			||||||
                    cell.SetCellValue("數值");
 | 
					                    cell.SetCellValue("設備名稱");
 | 
				
			||||||
                    cell.CellStyle = styleLine12;
 | 
					                    cell.CellStyle = styleLine12;
 | 
				
			||||||
                    cell = row.CreateCell(2);
 | 
					                    cell = row.CreateCell(2);
 | 
				
			||||||
 | 
					                    cell.SetCellValue("數值");
 | 
				
			||||||
 | 
					                    cell = row.CreateCell(3);
 | 
				
			||||||
                    cell.SetCellValue("記錄時間");
 | 
					                    cell.SetCellValue("記錄時間");
 | 
				
			||||||
                    cell.CellStyle = styleLine12;
 | 
					                    cell.CellStyle = styleLine12;
 | 
				
			||||||
                    #endregion
 | 
					                    #endregion
 | 
				
			||||||
@ -135,7 +139,7 @@ namespace FrontendWebApi.ApiControllers
 | 
				
			|||||||
                        {
 | 
					                        {
 | 
				
			||||||
                            RowPosition += 1;
 | 
					                            RowPosition += 1;
 | 
				
			||||||
                            row = sheet.CreateRow(RowPosition);
 | 
					                            row = sheet.CreateRow(RowPosition);
 | 
				
			||||||
                            for (var i = 0; i < 3; i++)
 | 
					                            for (var i = 0; i < 4; i++)
 | 
				
			||||||
                            {
 | 
					                            {
 | 
				
			||||||
                                cell = row.CreateCell(i);
 | 
					                                cell = row.CreateCell(i);
 | 
				
			||||||
                                if (i == 0)
 | 
					                                if (i == 0)
 | 
				
			||||||
@ -169,7 +173,7 @@ namespace FrontendWebApi.ApiControllers
 | 
				
			|||||||
            catch (Exception exception)
 | 
					            catch (Exception exception)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                apiResult.Code = "9999";
 | 
					                apiResult.Code = "9999";
 | 
				
			||||||
                apiResult.Msg = "系統內部錯誤,請聯絡管理者。";
 | 
					                apiResult.Msg = "系統內部錯誤,請聯絡管理者。 Msg: " + exception.Message;
 | 
				
			||||||
                Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
 | 
					                Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
 | 
				
			||||||
                return Ok(apiResult);
 | 
					                return Ok(apiResult);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
@ -1156,7 +1160,7 @@ namespace FrontendWebApi.ApiControllers
 | 
				
			|||||||
                        var device_item_info = device_item_infos.Where(x => x.Device_number == device_number && x.Points == point).FirstOrDefault();
 | 
					                        var device_item_info = device_item_infos.Where(x => x.Device_number == device_number && x.Points == point).FirstOrDefault();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        var sql = $@"select '{device_item_info.Building_name}' as Building_name, '{device_item_info.Main_system_name}' as Main_system_name,
 | 
					                        var sql = $@"select '{device_item_info.Building_name}' as Building_name, '{device_item_info.Main_system_name}' as Main_system_name,
 | 
				
			||||||
                                            '{device_item_info.Sub_system_name}' as Sub_system_name', {device_item_info.Device_number}' as Device_number, 
 | 
					                                            '{device_item_info.Sub_system_name}' as Sub_system_name, '{device_item_info.Device_number}' as Device_number, 
 | 
				
			||||||
                                            '{device_item_info.Device_name}' as Device_name, '{device_item_info.Item_name}' as Item_name, '{device_item_info.Points}' as Points,
 | 
					                                            '{device_item_info.Device_name}' as Device_name, '{device_item_info.Item_name}' as Item_name, '{device_item_info.Points}' as Points,
 | 
				
			||||||
                                            '{device_item_info.Unit}' as Unit, timestamp as Timestamp, round(value, 2) as Value
 | 
					                                            '{device_item_info.Unit}' as Unit, timestamp as Timestamp, round(value, 2) as Value
 | 
				
			||||||
                                    from FIC_CENTER_{device_number}_{point}
 | 
					                                    from FIC_CENTER_{device_number}_{point}
 | 
				
			||||||
 | 
				
			|||||||
@ -120,9 +120,9 @@ namespace FrontendWebApi.ApiControllers
 | 
				
			|||||||
                    //取得當前登入使用者資訊
 | 
					                    //取得當前登入使用者資訊
 | 
				
			||||||
                    EDFunction edFunction = new EDFunction();
 | 
					                    EDFunction edFunction = new EDFunction();
 | 
				
			||||||
                    HttpContext.Session.SetString("MyApiAccount", edFunction.AESEncrypt(myUser.account)); //將帳號透過AES加密
 | 
					                    HttpContext.Session.SetString("MyApiAccount", edFunction.AESEncrypt(myUser.account)); //將帳號透過AES加密
 | 
				
			||||||
                    //}
 | 
					                    //
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					                apiResult.Data = myUser?.exp.ToString() + "_"+ HttpContext.Session.GetString("MyApiAccount") ?? null;
 | 
				
			||||||
                apiResult.Code = "0000";
 | 
					                apiResult.Code = "0000";
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            catch (Exception exception)
 | 
					            catch (Exception exception)
 | 
				
			||||||
@ -160,5 +160,18 @@ namespace FrontendWebApi.ApiControllers
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            return apiResult;
 | 
					            return apiResult;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        [HttpGet]
 | 
				
			||||||
 | 
					        [Route("api/df")]
 | 
				
			||||||
 | 
					        public ActionResult DownloadFile(string path, string fileName, string token)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            if (fileName == null)
 | 
				
			||||||
 | 
					                return NotFound("找不到文件");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            var filePath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "excel", path);
 | 
				
			||||||
 | 
					            return File(System.IO.File.ReadAllBytes(Path.Combine(filePath, fileName)), "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", fileName);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -212,7 +212,7 @@ namespace FrontendWebApi.Models
 | 
				
			|||||||
    public class ChangeNameRole
 | 
					    public class ChangeNameRole
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        public string Account { get; set; }
 | 
					        public string Account { get; set; }
 | 
				
			||||||
        public string Building_guid { get; set; }
 | 
					        public string Building_tag { get; set; }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    public class SaveGrouping
 | 
					    public class SaveGrouping
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
				
			|||||||
@ -289,7 +289,7 @@ namespace FrontendWebApi.Models
 | 
				
			|||||||
    public class HistoryExport
 | 
					    public class HistoryExport
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        public string deviceName { get; set; }
 | 
					        public string deviceName { get; set; }
 | 
				
			||||||
        public int value { get; set; }
 | 
					        public double value { get; set; }
 | 
				
			||||||
        public DateTime timestamp { get; set; }
 | 
					        public DateTime timestamp { get; set; }
 | 
				
			||||||
        public DateTime starttime { get; set; }
 | 
					        public DateTime starttime { get; set; }
 | 
				
			||||||
        public DateTime? endtime { get; set; }
 | 
					        public DateTime? endtime { get; set; }
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										
											BIN
										
									
								
								FrontendWebApi/wwwroot/excel/history/歷史資料_2023-05-23.xlsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								FrontendWebApi/wwwroot/excel/history/歷史資料_2023-05-23.xlsx
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
		Loading…
	
		Reference in New Issue
	
	Block a user