修改維修/保養照片上傳和現實, 修改表單查詢
This commit is contained in:
parent
22aeb02835
commit
be55c25959
@ -198,6 +198,7 @@
|
||||
if (index == 0) {
|
||||
strHtml += `<button onClick="setValue(null, null, '${val.points}', this)" type="button" class="btn btn-dark waves-effect waves-themed">${val.full_name} ${val.points}</button>`;
|
||||
pageAct.deviceItem = val.points;
|
||||
pageAct.devicePoiName = val.full_name + ' ' + val.points;
|
||||
getData();
|
||||
} else {
|
||||
strHtml += `<button onClick="setValue(null, null, '${val.points}', this)" type="button" class="btn btn-secondary waves-effect waves-themed">${val.full_name} ${val.points}</button>`;
|
||||
@ -242,7 +243,8 @@
|
||||
pageAct.deviceName = deviceName;
|
||||
devPointsList();
|
||||
}
|
||||
else if (deviceItem != null && deviceItem != undefined) {
|
||||
else if (deviceItem != null && deviceItem != undefined) {
|
||||
pageAct.devicePoiName = $(elem).text();
|
||||
pageAct.deviceItem = deviceItem;
|
||||
getData();
|
||||
}
|
||||
@ -330,7 +332,7 @@
|
||||
function loadTable(data) {
|
||||
if (data) {
|
||||
$.each(data, function (i, v) {
|
||||
v.type = deviceName;
|
||||
v.type = pageAct.devicePoiName;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -6,8 +6,8 @@
|
||||
<div class="row bg-dark p-2">
|
||||
<div class="col-auto">
|
||||
<div class="btn-group">
|
||||
<button type="button" onclick="setType(1)" 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(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(null)" class="btn btn-secondary waves-effect waves-themed">廠商資料</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -40,7 +40,7 @@
|
||||
</div>
|
||||
<div class="row bg-dark p-2 align-items-center">
|
||||
<div class="col-auto">
|
||||
<a href="#" onclick="selAllSysVal" class="btn btn-info">全部類別</a>
|
||||
<a href="#" onclick="selAllSysVal(this)" class="btn btn-info">全選類別</a>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<div id="mainList" class="frame-wrap">
|
||||
@ -78,8 +78,8 @@
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title">
|
||||
新增廠商資料
|
||||
<h4 id="opeFirmTitle" class="modal-title">
|
||||
|
||||
</h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true"><i class="fal fa-times"></i></span>
|
||||
@ -90,15 +90,15 @@
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="selSysMain">系統大類</label>
|
||||
<select class="form-control" id="selSysMain" name="selSysMain">
|
||||
<label class="form-label" for="inpFirmSelSysMain">系統大類</label>
|
||||
<select class="form-control" id="inpFirmSelSysMain" name="inpFirmSelSysMain">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="selSysSub">系統小類</label>
|
||||
<select class="form-control" id="selSysSub" name="selSysSub">
|
||||
<label class="form-label" for="inpFirmSelSysSub">系統小類</label>
|
||||
<select class="form-control" id="inpFirmSelSysSub" name="inpFirmSelSysSub">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@ -149,74 +149,161 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal center 設備權限 -->
|
||||
<!-- Modal center 保養/維修 -->
|
||||
<div class="modal fade" id="opeRecModal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title">
|
||||
選擇功能
|
||||
<h4 id="opeRecTitle" class="modal-title">
|
||||
|
||||
</h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true"><i class="fal fa-times"></i></span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<table class="table table-bordered table-striped text-center m-0">
|
||||
<thead class="thead-themed">
|
||||
<tr>
|
||||
<th>選擇</th>
|
||||
<th>編號</th>
|
||||
<th>功能名稱</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><input type="checkbox"></td>
|
||||
<td>1</td>
|
||||
<td>系統監控</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type="checkbox"></td>
|
||||
<td>2</td>
|
||||
<td>歷史資料</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type="checkbox"></td>
|
||||
<td>3</td>
|
||||
<td>異常記錄</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type="checkbox"></td>
|
||||
<td>4</td>
|
||||
<td>即時告警</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type="checkbox"></td>
|
||||
<td>5</td>
|
||||
<td>運維管理</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type="checkbox"></td>
|
||||
<td>6</td>
|
||||
<td>圖資管理</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type="checkbox"></td>
|
||||
<td>7</td>
|
||||
<td>帳號管理</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">關閉</button>
|
||||
<button type="button" class="btn btn-primary">儲存</button>
|
||||
</div>
|
||||
<form id="opeRecForm">
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="inpWorTyp">項目</label>
|
||||
<select class="form-control" id="inpWorTyp" name="inpWorTyp">
|
||||
<option value=1 selected>保養</option>
|
||||
<option value=2>維修</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="inpArea">區域</label>
|
||||
<select class="form-control" id="inpArea" name="inpArea">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="inpBuilding">東別</label>
|
||||
<select class="form-control" id="inpBuilding" name="inpBuilding">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="inpFloor">樓層</label>
|
||||
<select class="form-control" id="inpFloor" name="inpFloor">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="inpRecSelSysMain">系統大類</label>
|
||||
<select class="form-control" id="inpRecSelSysMain" name="inpRecSelSysMain">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="inpRecSelSysSub">系統小類</label>
|
||||
<select class="form-control" id="inpRecSelSysSub" name="inpRecSelSysSub">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="inpFixDo">維修項目</label>
|
||||
<input type="text" id="inpFixDo" name="inpFixDo" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="inpFixDoCode">維修項目代碼(設備編號)</label>
|
||||
<select class="form-control" id="inpFixDoCode" name="inpFixDoCode">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="inpFixFirm">負責廠商</label>
|
||||
<select class="form-control" id="inpFixFirm" name="inpFixFirm">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="inpStatus">狀態</label>
|
||||
<select class="form-control" id="inpStatus" name="inpStatus">
|
||||
<option value=0 selected>未完成</option>
|
||||
<option value=1>完成</option>
|
||||
<option value=2>未完成-過期</option>
|
||||
<option value=3>完成-過期</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="inpWorPerId">工作人員編號</label>
|
||||
<select class="form-control" id="inpWorPerId" name="inpWorPerId">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="inpStaTime">預計開始時間</label>
|
||||
<input class="form-control" type="datetime-local" id="inpStaTime" name="inpStaTime">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="inpEndTime">預計結束時間</label>
|
||||
<input class="form-control" type="datetime-local" id="inpEndTime" name="inpEndTime">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="inpWorTime">實際開始時間</label>
|
||||
<input class="form-control" type="datetime-local" id="inpWorTime" name="inpWorTime">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="inpFinTime">實際完成時間</label>
|
||||
<input class="form-control" type="datetime-local" id="inpFinTime" name="inpFinTime">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="inpNotice">注意事項</label>
|
||||
<input class="form-control" type="text" id="inpNotice" name="inpNotice">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="inpDescription">結果描述</label>
|
||||
<input class="form-control" type="text" id="inpDescription" name="inpDescription">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label">上傳圖片</label>
|
||||
<label for="myImage" class="file-upload form-control" style="cursor : pointer ">點擊上傳圖片</label>
|
||||
<input id="myImage" class="form-control" type="file" multiple hidden />
|
||||
</div>
|
||||
<div id='forImage' class="col-sm-12 forimage mt-2 p-0">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" id="OpeRecCanBtn" data-dismiss="modal">關閉</button>
|
||||
<button type="button" class="btn btn-primary" id="OpeRecSendBtn" e-prevent>儲存</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal center 刪除 -->
|
||||
<div class="modal fade" id="delModal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
@ -282,13 +369,14 @@
|
||||
$('#startdate, #enddate').on('change', function () {
|
||||
let startdate = new Date($('#startdate').val());
|
||||
let enddate = new Date($('#enddate').val());
|
||||
setDate(null, startdate, enddate)
|
||||
setDate(null, startdate, enddate);
|
||||
});
|
||||
|
||||
$(`[onclick="setType(null)"]`).click();
|
||||
|
||||
initDate();
|
||||
event();
|
||||
$('div.image-full-show').css("display", "none");
|
||||
});
|
||||
|
||||
function loadOpeFirmTable() {
|
||||
@ -344,8 +432,8 @@
|
||||
"title": "功能",
|
||||
"data": "id",
|
||||
"render": function (data) {
|
||||
let btnDiv = creDiv(["row", "m-0", "justify-content-center"], { "style": "gap:10px" }, null, null, {id: data});
|
||||
btnDiv.append(creBtnHtml("修改", "opeFirmEdiBtn", null, ["btn", "btn-info"], { "toggle": "modal", "target": "#opeFirmModal"}));
|
||||
let btnDiv = creDiv(["row", "m-0", "justify-content-center"], { "style": "gap:10px" }, null, null, { id: data });
|
||||
btnDiv.append(creBtnHtml("修改", "opeFirmEdiBtn", null, ["btn", "btn-info"], { "toggle": "modal", "target": "#opeFirmModal" }));
|
||||
btnDiv.append(creBtnHtml("刪除", "opeFirmDelBtn", null, ["btn", "btn-danger"], { "toggle": "modal", "target": "#delModal" }));
|
||||
return btnDiv.outerHtml();
|
||||
}
|
||||
@ -370,16 +458,16 @@
|
||||
let tag = "#opeRecTable";
|
||||
|
||||
let column_defs = [
|
||||
{ "targets": [0], "width": "8%", "sortable": true },
|
||||
{ "targets": [1], "width": "8%", "sortable": true },
|
||||
{ "targets": [2], "width": "8%", "sortable": true },
|
||||
{ "targets": [3], "width": "8%", "sortable": true },
|
||||
{ "targets": [4], "width": "8%", "sortable": true },
|
||||
{ "targets": [5], "width": "8%", "sortable": true },
|
||||
{ "targets": [6], "width": "8%", "sortable": true },
|
||||
{ "targets": [7], "width": "8%", "sortable": true },
|
||||
{ "targets": [8], "width": "8%", "sortable": false },
|
||||
{ "targets": [9], "width": "8%", "sortable": false },
|
||||
{ "targets": [0], "width": "2%", "sortable": true },
|
||||
{ "targets": [1], "width": "6%", "sortable": true },
|
||||
{ "targets": [2], "width": "7%", "sortable": true },
|
||||
{ "targets": [3], "width": "6%", "sortable": true },
|
||||
{ "targets": [4], "width": "5%", "sortable": true },
|
||||
{ "targets": [5], "width": "3%", "sortable": true },
|
||||
{ "targets": [6], "width": "5%", "sortable": true },
|
||||
{ "targets": [7], "width": "6%", "sortable": true },
|
||||
{ "targets": [8], "width": "15%", "sortable": false },
|
||||
{ "targets": [9], "width": "6%", "sortable": false },
|
||||
{ "targets": [10], "width": "8%", "sortable": false },
|
||||
{ "targets": [11], "width": "8%", "sortable": false },
|
||||
];
|
||||
@ -422,7 +510,23 @@
|
||||
},
|
||||
{
|
||||
"title": "檔案上傳",
|
||||
"data": "start_time",
|
||||
"data": "lorf",
|
||||
"render": function (data) {
|
||||
strHtml = ``;
|
||||
$.each(data, function (i, v) {
|
||||
if (i == 0)
|
||||
strHtml += `<div class="file-item" data-id=${v.id}>`
|
||||
if (i < 3) {
|
||||
let extName = v.ori_file_name.split('.')[1];
|
||||
strHtml += `<a href="${baseApiUrl}/upload/operation/${v.save_file_name}.${extName}" download="${v.ori_file_name}" target="_blank">
|
||||
<img style="margin-left: 30px" data-filename="${v.ori_file_name}" data-savename="${v.save_file_name}" height="70px" width="70px" src="${baseApiUrl}/upload/operation/${v.save_file_name}.${extName}">
|
||||
</a>`
|
||||
}
|
||||
});
|
||||
strHtml += `</div>`;
|
||||
|
||||
return strHtml;
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "完成時間",
|
||||
@ -431,7 +535,6 @@
|
||||
return displayDate(data, "datetime");
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"title": "建立時間",
|
||||
"data": "created_at",
|
||||
@ -440,8 +543,9 @@
|
||||
"title": "功能",
|
||||
"data": "id",
|
||||
"render": function (data) {
|
||||
let btnDiv = creDiv(["row", "m-0", "justify-content-center"], { "style": "gap:10px" });
|
||||
btnDiv.append(creBtnHtml("刪除", "opeRecDelBtn", null, ["btn", "btn-danger"], { "id": data }));
|
||||
let btnDiv = creDiv(["row", "m-0", "justify-content-center"], { "style": "gap:10px" }, null, null, { id: data });
|
||||
btnDiv.append(creBtnHtml("修改", "opeRecEdiBtn", null, ["btn", "btn-info"], { "toggle": "modal", "target": "#opeRecModal" }));
|
||||
btnDiv.append(creBtnHtml("刪除", "opeRecDelBtn", null, ["btn", "btn-danger"], { "toggle": "modal", "target": "#delModal" }));
|
||||
return btnDiv.outerHtml();
|
||||
}
|
||||
},
|
||||
@ -452,13 +556,13 @@
|
||||
|
||||
function setType(wt) {
|
||||
pageAct.work_type = wt;
|
||||
|
||||
|
||||
if (wt == null) {
|
||||
$('#newForm').data('target', '#opeFirmModal')
|
||||
$('#newForm').attr('data-target', '#opeFirmModal');
|
||||
loadOpeFirmTable();
|
||||
}
|
||||
else {
|
||||
$('#newForm').data('target', '#opeRecModal')
|
||||
$('#newForm').attr('data-target', '#opeRecModal');
|
||||
loadOpeRecTable();
|
||||
}
|
||||
}
|
||||
@ -493,9 +597,16 @@
|
||||
pageAct.serial_number = null;
|
||||
}
|
||||
|
||||
function clearOpeRecPageAct() {
|
||||
pageAct.selAreaTag = null;
|
||||
pageAct.selBuiTag = null;
|
||||
pageAct.selFloTag = null;
|
||||
}
|
||||
|
||||
function snSearch() {
|
||||
clearPageAct();
|
||||
pageAct.serial_number = $('#serial_number').val() || null;
|
||||
refTable();
|
||||
}
|
||||
|
||||
function initMaiList() {
|
||||
@ -556,7 +667,7 @@
|
||||
startdate: pageAct.startdate == undefined ? null : pageAct.startdate,
|
||||
enddate: pageAct.enddate == undefined ? null : pageAct.enddate,
|
||||
};
|
||||
|
||||
|
||||
ytAjax = new YourTeam.Ajax(url, objSendData, function (rel) {
|
||||
if (rel.code == "0000")
|
||||
location.href = baseApiUrl + "/api/df?path=" + rel.data.split('/')[0] + "&fileName=" + rel.data.split('/')[1] + "&token=" + localStorage.getItem("JWT-Authorization");
|
||||
@ -570,8 +681,10 @@
|
||||
if (!res || res.code != "0000" || !res.data) {
|
||||
|
||||
} else {
|
||||
$("#selSysMain").html();
|
||||
$("#selSysSub").html();
|
||||
$("#inpFirmSelSysMain").html();
|
||||
$("#inpFirmSelSysSub").html();
|
||||
$("#inpRecSelSysMain").html();
|
||||
$("#inpRecSelSysSub").html();
|
||||
strHtml = ``;
|
||||
$.each(res.data, (index, roleObj) => {
|
||||
strHtml += `<option value='${roleObj.system_value}'>${roleObj.system_key}</option>`;
|
||||
@ -579,7 +692,8 @@
|
||||
if (index == 0)
|
||||
pageAct.selSysMain = tag ?? roleObj.system_value
|
||||
})
|
||||
$("#selSysMain").html(strHtml);
|
||||
$("#inpFirmSelSysMain").html(strHtml);
|
||||
$("#inpRecSelSysMain").html(strHtml);
|
||||
selSysSub();
|
||||
}
|
||||
}, null, "POST").send();
|
||||
@ -595,24 +709,187 @@
|
||||
ytAjax = new YourTeam.Ajax(url, objSendData, function (res) {
|
||||
$.each(res.data, (index, roleObj) => {
|
||||
strHtml += `<option value='${roleObj.system_value}'>${roleObj.system_key}</option>`;
|
||||
if (index == 0)
|
||||
pageAct.selSysSub = pageAct.selSysSub ?? roleObj.system_value;
|
||||
})
|
||||
$("#selSysSub").html(strHtml);
|
||||
$("#inpFirmSelSysSub").html(strHtml);
|
||||
$("#inpRecSelSysSub").html(strHtml);
|
||||
|
||||
if (pageAct.work_type != null)
|
||||
selArea(pageAct.selAreaTag);
|
||||
}, null, "POST").send();
|
||||
}
|
||||
|
||||
|
||||
function selArea(area_tag = null) {
|
||||
let url = baseApiUrl + "/operation/AreaList";
|
||||
|
||||
ytAjax = new YourTeam.Ajax(url, null, function (res) {
|
||||
if (!res || res.code != "0000" || !res.data) {
|
||||
|
||||
} else {
|
||||
$("#inpArea").html();
|
||||
strHtml = ``;
|
||||
$.each(res.data, (index, roleObj) => {
|
||||
let selected = (area_tag == roleObj.device_area_tag ? 'selected' : '');
|
||||
strHtml += `<option value='${roleObj.device_area_tag}' ${selected}>${roleObj.area_name}</option>`;
|
||||
|
||||
if (index == 0)
|
||||
pageAct.selAreaTag = area_tag ?? roleObj.device_area_tag
|
||||
})
|
||||
$("#inpArea").html(strHtml);
|
||||
selBuilding(pageAct.selBuiTag);
|
||||
}
|
||||
}, null, "POST").send();
|
||||
}
|
||||
|
||||
function selBuilding(building_tag = null) {
|
||||
let url = baseApiUrl + "/operation/BuiList";
|
||||
|
||||
sendData = {
|
||||
device_area_tag: pageAct.selAreaTag,
|
||||
};
|
||||
objSendData.Data = sendData;
|
||||
ytAjax = new YourTeam.Ajax(url, objSendData, function (res) {
|
||||
if (!res || res.code != "0000" || !res.data) {
|
||||
|
||||
} else {
|
||||
$("#inpBuilding").html();
|
||||
strHtml = ``;
|
||||
$.each(res.data, (index, roleObj) => {
|
||||
let selected = (building_tag == roleObj.device_building_tag ? 'selected' : '');
|
||||
strHtml += `<option value='${roleObj.device_building_tag}' ${selected}>${roleObj.building_name}</option>`;
|
||||
|
||||
if (index == 0)
|
||||
pageAct.selBuiTag = building_tag ?? roleObj.device_building_tag
|
||||
})
|
||||
$("#inpBuilding").html(strHtml);
|
||||
selFloor(pageAct.selFloTag);
|
||||
}
|
||||
}, null, "POST").send();
|
||||
}
|
||||
|
||||
function selFloor(floor_tag = null) {
|
||||
|
||||
let url = baseApiUrl + "/operation/FloList";
|
||||
|
||||
sendData = {
|
||||
device_building_tag: pageAct.selBuiTag,
|
||||
};
|
||||
objSendData.Data = sendData;
|
||||
ytAjax = new YourTeam.Ajax(url, objSendData, function (res) {
|
||||
if (!res || res.code != "0000" || !res.data) {
|
||||
|
||||
} else {
|
||||
$("#inpFloor").html();
|
||||
strHtml = ``;
|
||||
$.each(res.data, (index, roleObj) => {
|
||||
let selected = (floor_tag == roleObj.device_floor_tag ? 'selected' : '');
|
||||
strHtml += `<option value='${roleObj.device_floor_tag}' ${selected}>${roleObj.device_floor_tag}</option>`;
|
||||
|
||||
if (index == 0)
|
||||
pageAct.selFloTag = floor_tag ?? roleObj.device_floor_tag
|
||||
})
|
||||
$("#inpFloor").html(strHtml);
|
||||
selDevice();
|
||||
}
|
||||
}, null, "POST").send();
|
||||
}
|
||||
|
||||
function selDevice() {
|
||||
let url = baseApiUrl + "/operation/DevList";
|
||||
|
||||
sendData = {
|
||||
device_area_tag: pageAct.selAreaTag,
|
||||
device_building_tag: pageAct.selBuiTag,
|
||||
device_floor_tag: pageAct.selFloTag,
|
||||
main_system_tag: pageAct.selSysMain,
|
||||
sub_system_tag: pageAct.selSysSub,
|
||||
};
|
||||
objSendData.Data = sendData;
|
||||
ytAjax = new YourTeam.Ajax(url, objSendData, function (res) {
|
||||
if (!res || res.code != "0000" || !res.data) {
|
||||
|
||||
} else {
|
||||
$("#inpFixDoCode").html();
|
||||
strHtml = ``;
|
||||
$.each(res.data, (index, roleObj) => {
|
||||
strHtml += `<option value='${roleObj.device_number}'>${roleObj.full_name}</option>`;
|
||||
|
||||
if (index == 0)
|
||||
pageAct.selDevice = roleObj.device_number
|
||||
})
|
||||
$("#inpFixDoCode").html(strHtml);
|
||||
}
|
||||
}, null, "POST").send();
|
||||
}
|
||||
|
||||
function selFixFirm() {
|
||||
let url = baseApiUrl + "/operation/OpeFirList";
|
||||
ytAjax = new YourTeam.Ajax(url, null, function (res) {
|
||||
if (!res || res.code != "0000" || !res.data) {
|
||||
|
||||
} else {
|
||||
$("#inpFixFirm").html();
|
||||
strHtml = ``;
|
||||
$.each(res.data, (index, roleObj) => {
|
||||
strHtml += `<option value='${roleObj.id}'>${roleObj.name}</option>`;
|
||||
})
|
||||
$("#inpFixFirm").html(strHtml);
|
||||
}
|
||||
}, null, "POST").send();
|
||||
}
|
||||
|
||||
function selUser() {
|
||||
let url = baseApiUrl + "/User/UserManagerList";
|
||||
ytAjax = new YourTeam.Ajax(url, objSendData, function (res) {
|
||||
if (!res || res.code != "0000" || !res.data) {
|
||||
|
||||
} else {
|
||||
$("#inpWorPerId").html();
|
||||
strHtml = ``;
|
||||
$.each(res.data, (index, roleObj) => {
|
||||
strHtml += `<option value='${roleObj.userinfo_guid}'>${roleObj.full_name}</option>`;
|
||||
})
|
||||
$("#inpWorPerId").html(strHtml);
|
||||
}
|
||||
}, null, "POST").send();
|
||||
}
|
||||
|
||||
function selAllSysVal(elem) {
|
||||
//loading process
|
||||
$('#mainList input').map(function (i, v) { $(v).click() });
|
||||
$('#subList input').map(function (i, v) { $(v).click() });
|
||||
//end loading
|
||||
|
||||
$(elem).html($(elem).html() == '全選類別' ? '取消全選' : '全選類別');
|
||||
}
|
||||
|
||||
function event() {
|
||||
onEvent('click', '#newForm', function () {
|
||||
pageAct.opeFirmAct = 'add';
|
||||
$('#opeFirmModal input').map(function (i, v) { $(v).val('') });
|
||||
|
||||
if (pageAct.work_type == null) {
|
||||
pageAct.opeFirmAct = 'add';
|
||||
$('#opeFirmTitle').html('新增廠商資料');
|
||||
$('#opeFirmModal input').map(function (i, v) { $(v).val('') });
|
||||
}
|
||||
else {
|
||||
clearOpeRecPageAct();
|
||||
pageAct.opeRecId = null;
|
||||
pageAct.imageFile = [];
|
||||
$('#opeRecTitle').html(pageAct.work_type == 1 ? "新增保養" : "新增維修");
|
||||
$('#opeRecModal input').map(function (i, v) { $(v).val('') });
|
||||
let today = displayDate(new Date(Date.now()), 'datetime').replaceAll('/', '-');
|
||||
$('#opeRecModal input[id*=Time]').map(function (i, v) { $(v).val(today) });
|
||||
selFixFirm();
|
||||
selUser();
|
||||
$('#forImage').html('');
|
||||
}
|
||||
|
||||
selSysMain();
|
||||
});
|
||||
|
||||
onEvent('change', '#selSysMain', function () {
|
||||
pageAct.selSysMain = $(this).val();
|
||||
selSysSub();
|
||||
});
|
||||
|
||||
onEvent('click', '#opeFirmEdiBtn', function () {
|
||||
$('#opeFirmTitle').html('編輯廠商資料');
|
||||
let url = baseApiUrl + "/operation/OpeFirRead";
|
||||
pageAct.opeFirmId = $(this).parent().data('id')
|
||||
objSendData.Data = { id: pageAct.opeFirmId };
|
||||
@ -622,8 +899,8 @@
|
||||
} else {
|
||||
pageAct.opeFirmAct = 'edit';
|
||||
selSysMain(res.data.device_system_category_layer2);
|
||||
$('#opeFirmForm select[id=selSysMain]').val(res.data.device_system_category_layer2).change();
|
||||
$('#opeFirmForm select[id=selSysSub]').val(res.data.device_system_category_layer3).change();
|
||||
$('#opeFirmForm select[id=inpFirmSelSysMain]').val(res.data.device_system_category_layer2).change();
|
||||
$('#opeFirmForm select[id=inpFirmSelSysSub]').val(res.data.device_system_category_layer3).change();
|
||||
$('#opeFirmForm input[id=inpName]').val(res.data.name);
|
||||
$('#opeFirmForm input[id=inpConPer]').val(res.data.contact_person);
|
||||
$('#opeFirmForm input[id=inpPhone]').val(res.data.phone);
|
||||
@ -634,21 +911,21 @@
|
||||
}, null, "POST").send()
|
||||
});
|
||||
|
||||
onEvent("click", "#OpeFirmSendBtn", function () {
|
||||
onEvent('click', '#OpeFirmSendBtn', function () {
|
||||
let form = $("#opeFirmForm");
|
||||
|
||||
|
||||
$(form).validate({
|
||||
rules: {
|
||||
selSysMain: { required: true },
|
||||
selSysSub: { required: true },
|
||||
inpFirmSelSysMain: { required: true },
|
||||
inpFirmSelSysSub: { required: true },
|
||||
inpName: { required: true, maxlength: 50 }
|
||||
}
|
||||
});
|
||||
if ($(form).valid()) {
|
||||
let url = baseApiUrl + "/operation/" + (pageAct.opeFirmAct == "add" ? 'SaveOpeFirm' : 'EdtOneOpeFirm');
|
||||
let sendData = {
|
||||
device_system_category_layer2: $('#selSysMain').val(),
|
||||
device_system_category_layer3: $('#selSysSub').val(),
|
||||
device_system_category_layer2: $('#inpFirmSelSysMain').val(),
|
||||
device_system_category_layer3: $('#inpFirmSelSysSub').val(),
|
||||
name: $("#inpName").val() || null,
|
||||
contact_person: $("#inpConPer").val() || null,
|
||||
phone: $("#inpPhone").val() || null,
|
||||
@ -661,7 +938,7 @@
|
||||
sendData.id = pageAct.opeFirmId;
|
||||
|
||||
objSendData.Data = sendData;
|
||||
|
||||
|
||||
ytAjax = new YourTeam.Ajax(url, objSendData, function (res) {
|
||||
if (!res || res.code != "0000" || !res.data) {
|
||||
|
||||
@ -675,12 +952,13 @@
|
||||
}
|
||||
});
|
||||
|
||||
onEvent("click", "#opeFirmDelBtn", function () {
|
||||
onEvent('click', '#opeFirmDelBtn', function () {
|
||||
pageAct.opeRecId = null;
|
||||
pageAct.opeFirmId = $(this).parent().data('id');
|
||||
});
|
||||
|
||||
onEvent("click", "#confirmDelBtn", function () {
|
||||
objSendData.Data = { id: pageAct.opeFirmId };
|
||||
onEvent('click', '#confirmDelBtn', function () {
|
||||
objSendData.Data = { id: pageAct.opeFirmId ?? pageAct.opeRecId };
|
||||
let url = baseApiUrl + "/operation/" + (pageAct.work_type == null ? "DelOpeFirm" : "DelOpeRecord");
|
||||
|
||||
ytAjax = new YourTeam.Ajax(url, objSendData, function (res) {
|
||||
@ -694,5 +972,229 @@
|
||||
}
|
||||
}, null, "DELETE").send();
|
||||
});
|
||||
|
||||
onEvent('click', '#opeRecDelBtn', function () {
|
||||
pageAct.opeRecId = $(this).parent().data('id');
|
||||
pageAct.opeFirmId = null;
|
||||
});
|
||||
|
||||
onEvent('click', '#OpeRecSendBtn', function () {
|
||||
let form = $("#opeRecForm");
|
||||
let gmtTime = 28800000;
|
||||
$(form).validate({
|
||||
rules: {
|
||||
inpWorTyp: { required: true},
|
||||
inpArea: { required: true },
|
||||
inpBuilding: { required: true },
|
||||
inpFloor: { required: true },
|
||||
inpRecSelSysMain: { required: true },
|
||||
inpRecSelSysSub: { required: true },
|
||||
inpFixDo: { required: true },
|
||||
inpFixDoCode: { required: true },
|
||||
inpFixFirm: { required: true },
|
||||
inpStatus: { required: true },
|
||||
inpWorPerId: { required: true },
|
||||
}
|
||||
});
|
||||
|
||||
if ($(form).valid()) {
|
||||
let url = baseApiUrl + "/operation/SavOpeRecord";
|
||||
|
||||
let fd = new FormData();
|
||||
$.each(pageAct.imageFile, function (i, v) {
|
||||
fd.append("lorf[" + i + "].id", v.id);
|
||||
fd.append("lorf[" + i + "].file", v.file);
|
||||
fd.append("lorf[" + i + "].save_file_name", v.save_file_name);
|
||||
fd.append("lorf[" + i + "].ori_file_name", v.ori_file_name);
|
||||
});
|
||||
fd.append("location", $('#inpArea option:selected').text() + $('#inpBuilding option:selected').text() + $('#inpFloor option:selected').text());
|
||||
fd.append("location_code", $('#inpArea').val().toString() + $('#inpBuilding').val().toString() + $('#inpFloor').val().toString());
|
||||
fd.append("device_system_category_layer2", $('#inpRecSelSysMain').val());
|
||||
fd.append("device_system_category_layer3", $('#inpRecSelSysSub').val());
|
||||
fd.append("work_type", parseInt($('#inpWorTyp').val()));
|
||||
fd.append("fix_do", $('#inpFixDo').val());
|
||||
fd.append("fix_do_code", $('#inpFixDoCode').val());
|
||||
fd.append("fix_firm", parseInt($('#inpFixFirm').val()));
|
||||
fd.append("status", parseInt($('#inpStatus').val()));
|
||||
fd.append("work_person_id", $('#inpWorPerId').val());
|
||||
fd.append("start_time", ($('#inpStaTime').val() || null) == null ? null : new Date($('#inpStaTime').val()).toISOString());
|
||||
fd.append("end_time", ($('#inpEndTime').val() || null) == null ? $('#inpEndTime').val() : new Date($('#inpEndTime').val()).toISOString());
|
||||
fd.append("work_time", ($('#inpWorTime').val() || null) == null ? $('#inpWorTime').val() : new Date($('#inpWorTime').val()).toISOString());
|
||||
fd.append("finish_time", ($('#inpFinTime').val() || null) == null ? null : new Date($('#inpFinTime').val()).toISOString());
|
||||
fd.append("notice", $('#inpNotice').val() || null);
|
||||
fd.append("description", $('#inpDescription').val() || null);
|
||||
|
||||
//let sendData = {
|
||||
// location: $('#inpArea option:selected').text() + $('#inpBuilding option:selected').text() + $('#inpFloor option:selected').text(),
|
||||
// location_code: $('#inpArea').val().toString() + $('#inpBuilding').val().toString() + $('#inpFloor').val().toString(),
|
||||
// device_system_category_layer2: $('#inpRecSelSysMain').val(),
|
||||
// device_system_category_layer3: $('#inpRecSelSysSub').val(),
|
||||
// work_type: parseInt($('#inpWorTyp').val()),
|
||||
// fix_do: $('#inpFixDo').val(),
|
||||
// fix_do_code: $('#inpFixDoCode').val(),
|
||||
// fix_firm: parseInt($('#inpFixFirm').val()),
|
||||
// status: parseInt($('#inpStatus').val()),
|
||||
// work_person_id: $('#inpWorPerId').val(),
|
||||
// start_time: $('#inpStaTime').val() == null ? null : new Date(new Date($('#inpStaTime').val()).getTime() + gmtTime),
|
||||
// end_time: $('#inpEndTime').val() == null ? $('#inpEndTime').val() : new Date(new Date($('#inpEndTime').val()).getTime() + gmtTime),
|
||||
// work_time: $('#inpWorTime').val() == null ? $('#inpWorTime').val() : new Date(new Date($('#inpWorTime').val()).getTime() + gmtTime),
|
||||
// finish_time: $('#inpFinTime').val() == null ? null : new Date(new Date($('#inpFinTime').val()).getTime() + gmtTime),
|
||||
// notice: $('#inpNotice').val() || null,
|
||||
// description: $('#inpDescription').val() || null,
|
||||
// lorf: pageAct.imageFile,
|
||||
//};
|
||||
if (pageAct.opeRecId != null)
|
||||
fd.append("id", pageAct.opeRecId);
|
||||
|
||||
objSendData.Data = sendData;
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: "POST",
|
||||
data: fd,
|
||||
async: false,
|
||||
cache: false,
|
||||
contentType: false,
|
||||
processData: false,
|
||||
beforeSend: function (xhr) { xhr.setRequestHeader('Authorization', "Bearer " + localStorage.getItem("JWT-Authorization")) },
|
||||
success: function (res) {
|
||||
if (!res || res.code != "0000" || !res.data) {
|
||||
|
||||
} else {
|
||||
//toast_ok(common.AddSuc);
|
||||
//$("#opeFirmModal").modal("hide");
|
||||
$("#OpeRecCanBtn").click();
|
||||
refTable();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//ytAjax = new YourTeam.Ajax(url, objSendData, function (res) {
|
||||
// if (!res || res.code != "0000" || !res.data) {
|
||||
|
||||
// } else {
|
||||
// //toast_ok(common.AddSuc);
|
||||
// //$("#opeFirmModal").modal("hide");
|
||||
// $("#OpeRecCanBtn").click();
|
||||
// refTable();
|
||||
// }
|
||||
//}, null, "POST").send();
|
||||
}
|
||||
});
|
||||
|
||||
onEvent('click', '#opeRecEdiBtn', function () {
|
||||
clearOpeRecPageAct();
|
||||
selFixFirm();
|
||||
selUser();
|
||||
pageAct.imageFile = [];
|
||||
$('#opeRecTitle').html(pageAct.work_type == 1 ? "編輯保養" : "編輯維修");
|
||||
let url = baseApiUrl + "/operation/OpeRecRead";
|
||||
pageAct.opeRecId = $(this).parent().data('id');
|
||||
objSendData.Data = { id: pageAct.opeRecId };
|
||||
ytAjax = new YourTeam.Ajax(url, objSendData, function (res) {
|
||||
if (!res || res.code != "0000" || !res.data) {
|
||||
|
||||
} else {
|
||||
pageAct.selBuiTag = res.data.device_building_tag;
|
||||
pageAct.selFloTag = res.data.device_floor_tag;
|
||||
pageAct.selSysSub = res.data.device_system_category_layer3;
|
||||
selSysMain(res.data.device_system_category_layer2);
|
||||
$('#inpArea').val(res.data.device_area_tag);
|
||||
$('#inpBuilding').val(res.data.device_building_tag);
|
||||
$('#inpFloor').val(res.data.device_floor_tag);
|
||||
$('#inpRecSelSysMain').val(res.data.device_system_category_layer2);
|
||||
$('#inpRecSelSysSub').val(res.data.device_system_category_layer3);
|
||||
$('#inpWorTyp').val(res.data.work_type);
|
||||
$('#inpFixDo').val(res.data.fix_do);
|
||||
$('#inpFixDoCode').val(res.data.fix_do_code);
|
||||
$('#inpFixFirm').val(res.data.fix_firm);
|
||||
$('#inpStatus').val(res.data.status);
|
||||
$('#inpWorPerId').val(res.data.work_person_id);
|
||||
$('#inpStaTime').val(displayDate(res.data.start_time, 'datetime').replace(' ', 'T').replaceAll('/', '-'));
|
||||
$('#inpEndTime').val(displayDate(res.data.end_time, 'datetime').replace(' ', 'T').replaceAll('/', '-'));
|
||||
$('#inpWorTime').val(displayDate(res.data.work_time, 'datetime').replace(' ', 'T').replaceAll('/', '-'));
|
||||
$('#inpFinTime').val(displayDate(res.data.finish_time, 'datetime').replace(' ', 'T').replaceAll('/', '-'));
|
||||
$('#inpNotice').val(res.data.notice);
|
||||
$('#inpDescription').val(res.data.description);
|
||||
let strHtml = ``;
|
||||
$.each(res.data.lorf, function (i, v) {
|
||||
let extName = v.ori_file_name.split('.')[1];
|
||||
let divMargin = (i == 0) ? `style='margin-top: 2px'` : ``;
|
||||
strHtml += `<div class="file-item" data-id=${v.id} ${divMargin}>
|
||||
<a href="${baseApiUrl}/upload/operation/${v.save_file_name}.${extName}" download="${v.ori_file_name}" target="_blank">
|
||||
<img data-filename=${v.ori_file_name} data-savename=${v.save_file_name} height="70px" width="150px" src="${baseApiUrl}/upload/operation/${v.save_file_name}.${extName}">
|
||||
<button class="btn-dark" name="btnDelImg"><i class="fa fa-times"></i></button>
|
||||
</a>
|
||||
</div>`;
|
||||
});
|
||||
$('#forImage').html(strHtml);
|
||||
}
|
||||
}, null, "POST").send()
|
||||
});
|
||||
|
||||
onEvent('change', '#inpFirmSelSysMain, #inpRecSelSysMain', function () {
|
||||
pageAct.selSysMain = $(this).val();
|
||||
selSysSub();
|
||||
});
|
||||
|
||||
onEvent("change", "#inpRecSelSysSub", function () {
|
||||
pageAct.selSysSub = $(this).val();
|
||||
selDevice();
|
||||
});
|
||||
|
||||
onEvent("change", "#inpArea", function () {
|
||||
pageAct.selAreaTag = $(this).val();
|
||||
selBuilding();
|
||||
});
|
||||
|
||||
onEvent("change", "#inpBuilding", function () {
|
||||
pageAct.selBuiTag = $(this).val();
|
||||
selFloor();
|
||||
});
|
||||
|
||||
onEvent("change", "#inpFloor", function () {
|
||||
pageAct.selFloTag = $(this).val();
|
||||
selDevice();
|
||||
});
|
||||
|
||||
onEvent("change", "#myImage", function (e) {
|
||||
var imageuploadFormOS = 0;
|
||||
let fileHelper = new YourTeam.Utility.File();
|
||||
//若有文字顯示,清除文字顯示
|
||||
if ($('#forImage p').length > 0) {
|
||||
$("#forImage").html(""); // 清除預覽
|
||||
}
|
||||
//console.log(this.files)
|
||||
imageuploadFormOS = this.files.length;
|
||||
//最多只能上傳幾張
|
||||
let maxlength = $("#forImage").data("maxlength");
|
||||
if (maxlength) {
|
||||
if (imageuploadFormOS + $('#forImage img').length > maxlength) {
|
||||
ShowModal("error", "uplImgOverLen", "無法上傳", "最多只能上傳" + maxlength + "張,您已經超出上傳數量。");
|
||||
$("#myImage").val("");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
fileHelper.readAndPreviewImages(this.files, 'forImage', 150, 70, '<div class="file-item">', '<button class="btn-dark" name="btnDelImg" ><i class="fa fa-times"></i></button></div>');
|
||||
$.each(this.files, function (i, v) {
|
||||
let fd = new FormData();
|
||||
let file = v;
|
||||
fd.append('file', v);
|
||||
pageAct.imageFile.push({ "ori_file_name": v.name, "save_file_name": file.guid, "file": fd.get("file") });
|
||||
});
|
||||
}); //變更圖片
|
||||
|
||||
onEvent("click", "[name=btnDelImg]", function () {
|
||||
elem = $(this).parent();
|
||||
if (elem.attr('data-id'))
|
||||
pageAct.imageFile.push({ "id": elem.data('id'), "ori_file_name": elem.find('img').data('filename'), "save_file_name": elem.find('img').data('savename') });
|
||||
else {
|
||||
pageAct.imageFile =
|
||||
$.grep(pageAct.imageFile, function (image) {
|
||||
return image.save_file_name != elem.find('img').data('savename');
|
||||
});
|
||||
}
|
||||
|
||||
elem.remove();
|
||||
});
|
||||
}
|
||||
</script>
|
@ -490,7 +490,8 @@ class File {
|
||||
let height = imgHeight ? imgHeight + "px" : "auto";
|
||||
let myMath = new YourTeam.Utility.Math();
|
||||
let myFile = new YourTeam.Utility.File();
|
||||
let strExtName = "",strOrgName="";
|
||||
let strExtName = "", strOrgName = "";
|
||||
|
||||
for (let i = 0; i < files.length; i++) {
|
||||
let file = files[i];
|
||||
if (limitMaxSize != null) {
|
||||
@ -500,6 +501,8 @@ class File {
|
||||
}
|
||||
}
|
||||
htmlImg = "";
|
||||
let guid = myMath.guid().replace(' ', '');
|
||||
file.guid = guid;
|
||||
if (/\.(jpe?g|png|gif)$/i.test(file.name)) {
|
||||
|
||||
let reader = new FileReader();
|
||||
@ -507,13 +510,13 @@ class File {
|
||||
let image = new Image();
|
||||
let src = this.result;
|
||||
image.src = this.result;
|
||||
|
||||
image.onload = function () {
|
||||
strExtName = myFile.getFileExtension(file.name);
|
||||
strOrgName = (strExtName === null || strExtName === "") ? file.name : file.name.replace('.' + strExtName, '');
|
||||
htmlImg = frontHtml + '<img data-filename="' + file.name + '" data-orgname="' + strOrgName + '" data-savename="' + myMath.guid().replace(' ', '') + '" data-extname="' + strExtName
|
||||
htmlImg = frontHtml + '<img data-filename="' + file.name + '" data-orgname="' + strOrgName + '" data-savename="' + guid + '" data-extname="' + strExtName
|
||||
+ '" data-size="' + file.size + '" width="' + width + '" height="' + height + '" src="' + src + '">'
|
||||
+ backHtml;
|
||||
|
||||
container.insertAdjacentHTML("afterBegin", htmlImg);
|
||||
//$("[name=" + removeClickTagName + "]").on("click", function (e) {
|
||||
// e.preventDefault();
|
||||
|
@ -485,7 +485,7 @@ namespace FrontendWebApi.ApiControllers
|
||||
}
|
||||
if (i == 6)
|
||||
{
|
||||
cell.SetCellValue(or.start_time);
|
||||
cell.SetCellValue(or.start_time != null ? ((DateTime)or.start_time).ToString("yyyy/MM/dd HH:mm:dd") : null);
|
||||
}
|
||||
if (i == 7)
|
||||
{
|
||||
@ -539,7 +539,7 @@ namespace FrontendWebApi.ApiControllers
|
||||
}
|
||||
if (i == 8)
|
||||
{
|
||||
cell.SetCellValue(or.finish_time);
|
||||
cell.SetCellValue(or.finish_time != null ? ((DateTime)or.finish_time).ToString("yyyy/MM/dd HH:mm:dd") : null);
|
||||
}
|
||||
if (i == 9)
|
||||
{
|
||||
@ -661,7 +661,7 @@ namespace FrontendWebApi.ApiControllers
|
||||
}
|
||||
if (i == 7)
|
||||
{
|
||||
cell.SetCellValue(or.start_time.ToString("yyyy/MM/dd HH:mm:ss"));
|
||||
cell.SetCellValue(or.start_time != null ? ((DateTime)or.start_time).ToString("yyyy/MM/dd HH:mm:ss") : null);
|
||||
}
|
||||
if (i == 8)//image
|
||||
{
|
||||
@ -715,7 +715,7 @@ namespace FrontendWebApi.ApiControllers
|
||||
}
|
||||
if (i == 9)
|
||||
{
|
||||
cell.SetCellValue(or.finish_time.ToString("yyyy/MM/dd HH:mm:ss"));
|
||||
cell.SetCellValue(or.finish_time != null ? ((DateTime)or.finish_time).ToString("yyyy/MM/dd HH:mm:ss") : null);
|
||||
}
|
||||
if (i == 10)
|
||||
{
|
||||
@ -795,7 +795,7 @@ namespace FrontendWebApi.ApiControllers
|
||||
}
|
||||
else
|
||||
{
|
||||
var sqlString = $@"select ofi.id, ofi.name from operation_firm where deleted = 0";
|
||||
var sqlString = $@"select id, name from operation_firm where deleted = 0";
|
||||
opList = await backendRepository.GetAllAsync<Operation_Firm>(sqlString);
|
||||
}
|
||||
|
||||
@ -1037,7 +1037,7 @@ namespace FrontendWebApi.ApiControllers
|
||||
}
|
||||
if (ofl.serial_number != null)
|
||||
{
|
||||
sWhere += $@" and opr.formId like '%@formId%'";
|
||||
sWhere += $@" and opr.formId like '%{ofl.serial_number}%'";
|
||||
}
|
||||
|
||||
var sqlString = $@"select opr.* , concat(d.device_floor_tag, ' ', d.device_last_name, ' ', d.device_serial_tag) as device_name, ui.full_name as user_full_name
|
||||
@ -1048,7 +1048,7 @@ namespace FrontendWebApi.ApiControllers
|
||||
left join userinfo ui on opr.work_person_id = ui.userinfo_guid and ui.deleted = 0
|
||||
where opr.deleted = 0 and opr.work_type = @work_type" + sWhere;
|
||||
|
||||
var param = new { @work_type = ofl.work_type, @start_created_at = ofl.start_created_at, @end_created_at = ofl.end_created_at, @sub_system_tag = ofl.sub_system_tag, @main_system_tag = ofl.main_system_tag, @formId = ofl.serial_number };
|
||||
var param = new { @work_type = ofl.work_type, @start_created_at = ofl.start_created_at, @end_created_at = ofl.end_created_at, @sub_system_tag = ofl.sub_system_tag, @main_system_tag = ofl.main_system_tag };
|
||||
|
||||
orl = await backendRepository.GetAllAsync<Operation_Record>(sqlString, param);
|
||||
|
||||
@ -1128,7 +1128,7 @@ namespace FrontendWebApi.ApiControllers
|
||||
/// </summary>
|
||||
/// <param name="or"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<ApiResult<string>> SavOpeRecord([FromBody] Operation_Record or)
|
||||
public async Task<ApiResult<string>> SavOpeRecord([FromForm] Operation_Record or)
|
||||
{
|
||||
ApiResult<string> apiResult = new ApiResult<string>();
|
||||
|
||||
@ -1144,7 +1144,7 @@ namespace FrontendWebApi.ApiControllers
|
||||
|
||||
if (ori == null) //create
|
||||
{
|
||||
var new_guid = new Guid();
|
||||
var new_guid = Guid.NewGuid();
|
||||
Dictionary<string, object> operation_record = new Dictionary<string, object>()
|
||||
{
|
||||
{ "@deleted", 0},
|
||||
@ -1171,19 +1171,22 @@ namespace FrontendWebApi.ApiControllers
|
||||
};
|
||||
await backendRepository.AddOneByCustomTable(operation_record, "operation_record");
|
||||
|
||||
if (or.lorf.Count > 0)
|
||||
if (or.lorf != null)
|
||||
{
|
||||
if (or.lorf.Count > 0)
|
||||
{
|
||||
foreach(var orf in or.lorf)
|
||||
{
|
||||
sqlString = $@"select id from operation_record where formId = @formId";
|
||||
var fParam = new { @formId = formId };
|
||||
var record_id = await backendRepository.GetOneAsync<int>(sqlString, fParam);
|
||||
new_guid = Guid.NewGuid();
|
||||
Dictionary<string, object> operation_record_file = new Dictionary<string, object>()
|
||||
{
|
||||
{ "@deleted", 0},
|
||||
{ "@record_id", record_id},
|
||||
{ "@ori_file_name", orf.ori_file_name},
|
||||
{ "@save_file_name", orf.save_file_name},
|
||||
{ "@save_file_name", new_guid},
|
||||
{ "@created_by", myUser.userinfo_guid},
|
||||
{ "@created_at", DateTime.Now}
|
||||
};
|
||||
@ -1191,7 +1194,6 @@ namespace FrontendWebApi.ApiControllers
|
||||
if (!System.IO.Directory.Exists(operationFileSaveAsPath))
|
||||
System.IO.Directory.CreateDirectory(operationFileSaveAsPath);
|
||||
|
||||
new_guid = new Guid();
|
||||
|
||||
var fileName = new_guid + "." + orf.ori_file_name.Split('.')[1];
|
||||
|
||||
@ -1205,6 +1207,7 @@ namespace FrontendWebApi.ApiControllers
|
||||
await backendRepository.AddOneByCustomTable(operation_record_file, "operation_record_file");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
apiResult.Data = "新增成功";
|
||||
}
|
||||
@ -1232,15 +1235,17 @@ namespace FrontendWebApi.ApiControllers
|
||||
};
|
||||
await backendRepository.UpdateOneByCustomTable(operation_record , "operation_record", "id = " + or.id + "");
|
||||
|
||||
if (or.lorf.Count > 0)
|
||||
if (or.lorf != null)
|
||||
{
|
||||
if (or.lorf.Count > 0)
|
||||
{
|
||||
foreach(var orf in or.lorf)
|
||||
{
|
||||
//刪除原本檔案
|
||||
if (orf.id != 0 && orf.save_file_name == null && orf.ori_file_name != null)
|
||||
if (orf.id != 0 && orf.save_file_name != null && orf.ori_file_name != null)
|
||||
{
|
||||
//FolderFunction folderFunction = new FolderFunction();
|
||||
//folderFunction.DeleteFile(Path.Combine(operationFileSaveAsPath, orf.ori_file_name));
|
||||
//folderFunction.DeleteFile(Path.Combine(operationFileSaveAsPath, orf.save_file_name));
|
||||
Dictionary<string, object> operation_record_file = new Dictionary<string, object>()
|
||||
{
|
||||
{ "@deleted", 1},
|
||||
@ -1249,12 +1254,13 @@ namespace FrontendWebApi.ApiControllers
|
||||
}
|
||||
|
||||
if (orf.ori_file_name != null && orf.file != null) {
|
||||
var new_guid = Guid.NewGuid();
|
||||
Dictionary<string, object> operation_record_file = new Dictionary<string, object>()
|
||||
{
|
||||
{ "@deleted", 0},
|
||||
{ "@formId", or.formId},
|
||||
{ "@record_id", or.id},
|
||||
{ "@ori_file_name", orf.ori_file_name},
|
||||
{ "@save_file_name", orf.save_file_name},
|
||||
{ "@save_file_name", new_guid},
|
||||
{ "@created_by", myUser.userinfo_guid},
|
||||
{ "@created_at", DateTime.Now}
|
||||
};
|
||||
@ -1262,8 +1268,6 @@ namespace FrontendWebApi.ApiControllers
|
||||
if (!System.IO.Directory.Exists(operationFileSaveAsPath))
|
||||
System.IO.Directory.CreateDirectory(operationFileSaveAsPath);
|
||||
|
||||
var new_guid = new Guid();
|
||||
|
||||
var fileName = new_guid + "." + orf.ori_file_name.Split('.')[1];
|
||||
|
||||
var fullPath = Path.Combine(operationFileSaveAsPath, fileName);
|
||||
@ -1291,7 +1295,7 @@ namespace FrontendWebApi.ApiControllers
|
||||
// if (!System.IO.Directory.Exists(operationFileSaveAsPath))
|
||||
// System.IO.Directory.CreateDirectory(operationFileSaveAsPath);
|
||||
|
||||
// var new_guid = new Guid();
|
||||
// var new_guid = Guid.NewGuid();
|
||||
|
||||
// var fileName = new_guid + "." + orf.ori_file_name.Split('.')[1];
|
||||
|
||||
@ -1314,6 +1318,7 @@ namespace FrontendWebApi.ApiControllers
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
apiResult.Data = "修改成功";
|
||||
}
|
||||
@ -1347,8 +1352,8 @@ namespace FrontendWebApi.ApiControllers
|
||||
var param = new { @id = or.id };
|
||||
var formId = await backendRepository.GetOneAsync<string>(sqlString, param);
|
||||
|
||||
sqlString = @$"UPDATE operation_record_file SET deleted = 1 WHERE formId = @formId";
|
||||
var dParam = new { @formId = formId };
|
||||
sqlString = @$"UPDATE operation_record_file SET deleted = 1 WHERE record_id = @record_id";
|
||||
var dParam = new { @record_id = or.id };
|
||||
await backendRepository.ExecuteSql(sqlString, dParam);
|
||||
|
||||
sqlString = @$"UPDATE operation_record SET deleted = 1 WHERE id = @id";
|
||||
|
@ -76,10 +76,10 @@ namespace FrontendWebApi.Models
|
||||
public int fix_firm { get; set; }
|
||||
public byte status { get; set; }
|
||||
public string work_person_id { get; set; }
|
||||
public DateTime start_time { get; set; }
|
||||
public DateTime end_time { get; set; }
|
||||
public DateTime work_time { get; set; }
|
||||
public DateTime finish_time { get; set; }
|
||||
public DateTime? start_time { get; set; }
|
||||
public DateTime? end_time { get; set; }
|
||||
public DateTime? work_time { get; set; }
|
||||
public DateTime? finish_time { get; set; }
|
||||
public string notice { get; set; }
|
||||
public string description { get; set; }
|
||||
public string work_type_name
|
||||
|
BIN
FrontendWebApi/wwwroot/excel/operation/維修.xlsx
Normal file
BIN
FrontendWebApi/wwwroot/excel/operation/維修.xlsx
Normal file
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 72 KiB |
Binary file not shown.
After Width: | Height: | Size: 72 KiB |
Binary file not shown.
After Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 7.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 7.3 KiB |
Loading…
Reference in New Issue
Block a user