Merge branch 'master' of https://gitea.mjm-staging.developers-homelab.net/BIMS/BIMS
This commit is contained in:
commit
e69dd715d7
@ -79,7 +79,7 @@
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="inpWorTyp">項目</label>
|
||||
<select class="form-control custom-select-ri" id="inpWorTyp" name="inpWorTyp" disabled>
|
||||
<option value=2 selected>維修</option>
|
||||
<option value='2' selected>維修</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@ -277,6 +277,10 @@
|
||||
});
|
||||
|
||||
onEvent('click', '#alertTable a[id=alr_recModal]', function () {
|
||||
$('#alr_forImage').html('');
|
||||
$('#alr_forFile').html('');
|
||||
$('#inpNotice').val('');
|
||||
$('#inpDescription').val('');
|
||||
let alr_table = $('#alertTable').DataTable();
|
||||
let alr_elem = $(this).parent().parent();
|
||||
let alr_tableData = alr_table.row(alr_elem).data();
|
||||
@ -298,6 +302,80 @@
|
||||
let alr_fixDoCode = $($('#inpFixDoCode option[data-sub=' + alr_tableData.alarmClass.toString().split('_')[1] + '][data-main=' + alr_tableData.alarmClass.toString().split('_')[0] + ']')[0]).val();
|
||||
$('#inpFixDoCode').val(alr_fixDoCode);
|
||||
});
|
||||
|
||||
onEvent('click', '#OpeRecSendBtn', function () {
|
||||
let form = $("#opeRecForm");
|
||||
$(form).validate({
|
||||
rules: {
|
||||
inpWorTyp: { 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("error_code", $('#inpErrCode').val());
|
||||
fd.append("location", "台北" + $('#buiActDrop').text() + pageAct.floor);
|
||||
fd.append("location_code", pageAct.AreaTag + pageAct.buiTag + pageAct.floor);
|
||||
fd.append("device_system_category_layer2", pageAct.selSysMain);
|
||||
fd.append("device_system_category_layer3", pageAct.selSysSub);
|
||||
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("notice", $('#inpNotice').val() || null);
|
||||
fd.append("description", $('#inpDescription').val() || null);
|
||||
|
||||
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();
|
||||
getData();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//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();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function setReturn(bool) {
|
||||
|
@ -301,7 +301,6 @@
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
$(loadEle).Loading("close");
|
||||
initDropzone();
|
||||
pageAct.sub_system_tag = null;
|
||||
pageAct.main_system_tag = null;
|
||||
@ -514,20 +513,38 @@
|
||||
"title": "檔案上傳",
|
||||
"data": "lorf",
|
||||
"render": function (data) {
|
||||
strHtml = ``;
|
||||
ope_imgHtml = null;
|
||||
$.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>`
|
||||
if (i == 0)
|
||||
ope_imgHtml = creDiv(["file-item"], null, null, null, { id: v.id });
|
||||
if (i < 3) {
|
||||
if (/\.(jpe?g|png|gif)$/i.test(v.ori_file_name)) {
|
||||
ope_colA = creEle("a", null, null, null, null, null, { href: baseApiUrl + "/upload/operation/" + v.save_file_name + "." + extName, download: v.ori_file_name, target: "_blank" });
|
||||
ope_colImg = creImg("img", null, null, null, null, { filename: v.ori_file_name, savename: v.save_file_name }, { style: "margin-left: 30px", height: "70px", width: "50px", src: baseApiUrl + "/upload/operation/" + v.save_file_name + "." + extName });
|
||||
ope_colA.append(ope_colImg);
|
||||
ope_imgHtml.append(ope_colA);
|
||||
}
|
||||
else if (/\.(xls?x|doc?x|ptt?x|pdf|zip|rar|7zip|txt|odt|xml|rtf|ods|odp|pps?x)$/i.test(v.ori_file_name)) {
|
||||
icons = null
|
||||
if (extName == "xlsx" || extName == xls)
|
||||
icons = "fas fa-file-excel";
|
||||
else if (extName == "pdf" || extName == "ods")
|
||||
icons = "fas fa-file-pdf";
|
||||
else if (extName == "doc" || extName == "docx")
|
||||
icons = "fas fa-file-word";
|
||||
else
|
||||
icons = "fas fa-file-alt";
|
||||
|
||||
ope_colI = creEle("i", null, null, null, [icons + " fa-3x m-1"]);
|
||||
ope_colA = creEle("a", null, null, null, null, { filename: v.ori_file_name, savename: v.save_file_name }, { href: baseApiUrl + "/upload/operation/" + v.save_file_name + "." + extName, download: v.ori_file_name, style: "margin-left: 30px" });
|
||||
ope_colA.append(ope_colI);
|
||||
ope_imgHtml.append(ope_colA);
|
||||
}
|
||||
}
|
||||
});
|
||||
strHtml += `</div>`;
|
||||
|
||||
return strHtml;
|
||||
return ope_imgHtml ? ope_imgHtml.outerHtml() : null;
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -839,11 +856,14 @@
|
||||
$('#opeRecModal input').map(function (i, v) { $(v).val('') });
|
||||
let today = displayDate(new Date(Date.now()), 'date').replaceAll('/', '-');
|
||||
$('#opeRecModal input[id*=Time]').map(function (i, v) { $(v).val(today) });
|
||||
$('#ope_forImage').html('');
|
||||
$('#ope_forFile').html('');
|
||||
$('#inpDescription').val('');
|
||||
$('#inpNotice').val('');
|
||||
selUser();
|
||||
selDevice();
|
||||
selOpeFir();
|
||||
errCodeList();
|
||||
$('#forImage').html('');
|
||||
}
|
||||
|
||||
selSysMain();
|
||||
@ -940,7 +960,6 @@
|
||||
|
||||
onEvent('click', '#OpeRecSendBtn', function () {
|
||||
let form = $("#opeRecForm");
|
||||
let gmtTime = 28800000;
|
||||
$(form).validate({
|
||||
rules: {
|
||||
inpWorTyp: { required: true },
|
||||
@ -963,10 +982,11 @@
|
||||
fd.append("lorf[" + i + "].ori_file_name", v.ori_file_name);
|
||||
});
|
||||
|
||||
fd.append("error_code", $('#inpErrCode').val());
|
||||
fd.append("location", "台北" + $('#buiActDrop').text() + pageAct.floor);
|
||||
fd.append("location_code", pageAct.AreaTag + pageAct.buiTag + pageAct.floor);
|
||||
fd.append("device_system_category_layer2", pageAct.sysMain);
|
||||
fd.append("device_system_category_layer3", pageAct.sysMain);
|
||||
fd.append("device_system_category_layer3", pageAct.sysSub);
|
||||
fd.append("work_type", parseInt($('#inpWorTyp').val()));
|
||||
fd.append("fix_do", $('#inpFixDo').val());
|
||||
fd.append("fix_do_code", $('#inpFixDoCode').val());
|
||||
@ -1040,6 +1060,11 @@
|
||||
onEvent('click', '#opeRecEdiBtn', function () {
|
||||
clearOpeRecPageAct();
|
||||
selUser();
|
||||
selDevice();
|
||||
|
||||
$('#ope_forImage').html('');
|
||||
$('#ope_forFile').html('');
|
||||
|
||||
pageAct.imageFile = [];
|
||||
$('#opeRecTitle').html(pageAct.work_type == 1 ? "編輯保養" : "編輯維修");
|
||||
let url = baseApiUrl + "/operation/OpeRecRead";
|
||||
@ -1049,27 +1074,65 @@
|
||||
if (!res || res.code != "0000" || !res.data) {
|
||||
|
||||
} else {
|
||||
pageAct.sysSub = res.data.device_system_category_layer3;
|
||||
pageAct.number = res.data.fix_do_code;
|
||||
|
||||
selOpeFir();
|
||||
errCodeList();
|
||||
$('#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('/', '-'));
|
||||
$('#inpStaTime').val(displayDate(res.data.start_time, 'date').replaceAll('/', '-'));
|
||||
$('#inpNotice').text(res.data.notice);
|
||||
$('#inpDescription').text(res.data.description);
|
||||
let strHtml = ``;
|
||||
|
||||
ope_imgHtml = null;
|
||||
$.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-info" name="btnDelImg"><i class="fa fa-times"></i></button>
|
||||
</a>
|
||||
</div>`;
|
||||
|
||||
if (/\.(jpe?g|png|gif)$/i.test(v.ori_file_name)) {
|
||||
|
||||
ope_colI = creEle("i", null, null, null, ["fa fa-times"]);
|
||||
ope_colBtn = creBtn(null, null, "btnDelImg", ["btn-dark m-1"]);
|
||||
ope_colImg = creImg("img", null, null, null, null, { filename: v.ori_file_name, savename: v.save_file_name }, { style: "margin-left: 30px; margin-top: 10px", height: "70px", width: "70px", src: baseApiUrl + "/upload/operation/" + v.save_file_name + "." + extName });
|
||||
ope_colA = creEle("a", null, null, null, null, null, { href: baseApiUrl + "/upload/operation/" + v.save_file_name + "." + extName, download: v.ori_file_name, target: "_blank" });
|
||||
ope_imgHtml = creEle("span", null, null, null, ["file-item m-1"], { id: v.id }, null);
|
||||
|
||||
ope_colA.append(ope_colImg);
|
||||
ope_imgHtml.append(ope_colA);
|
||||
ope_colBtn.append(ope_colI);
|
||||
ope_imgHtml.append(ope_colBtn);
|
||||
$('#ope_forImage').append(ope_imgHtml ? ope_imgHtml.outerHtml() : null);
|
||||
}
|
||||
else if (/\.(xls?x|doc?x|ptt?x|pdf|zip|rar|7zip|txt|odt|xml|rtf|ods|odp|pps?x)$/i.test(v.ori_file_name)) {
|
||||
icons = null
|
||||
if (extName == "xlsx" || extName == xls)
|
||||
icons = "fas fa-file-excel";
|
||||
else if (extName == "pdf" || extName == "ods")
|
||||
icons = "fas fa-file-pdf";
|
||||
else if (extName == "doc" || extName == "docx")
|
||||
icons = "fas fa-file-word";
|
||||
else
|
||||
icons = "fas fa-file-alt";
|
||||
|
||||
ope_colI = creEle("i", null, null, null, ["fa fa-times"]);
|
||||
ope_colBtn = creBtn(null, null, "btnDelImg", ["btn-dark m-1"]);
|
||||
ope_colBtn.append(ope_colI);
|
||||
|
||||
ope_colI = creEle("i", null, null, null, [icons + " fa-3x m-1"]);
|
||||
ope_colA = creEle("a", v.ori_file_name, null, null, null, null, { href: baseApiUrl + "/upload/operation/" + v.save_file_name + "." + extName, download: v.ori_file_name, target: "_blank" });
|
||||
ope_imgHtml = creEle("div", null, null, null, ["file-item"], { id: v.id }, null);
|
||||
|
||||
ope_imgHtml.append(ope_colI);
|
||||
ope_imgHtml.append(ope_colA);
|
||||
ope_imgHtml.append(ope_colBtn);
|
||||
$('#ope_forFile').append(ope_imgHtml ? ope_imgHtml.outerHtml() : null);
|
||||
}
|
||||
});
|
||||
$('#forImage').html(strHtml);
|
||||
}
|
||||
}, null, "POST").send()
|
||||
});
|
||||
@ -1113,7 +1176,7 @@
|
||||
}
|
||||
|
||||
function errCodeList() {
|
||||
//$(loadEle).Loading("start");
|
||||
$(loadEle).Loading("start");
|
||||
let _pathArr = pageAct.number.split("_"); //TPE_B1_ELEV_EL_R2F_NA_ELEV1_N1
|
||||
let _devicePath = _pathArr[0] + "_" + _pathArr[1] + "_" + _pathArr[2] + "_" + _pathArr[3] + "_" + _pathArr[4] + "_" + _pathArr[5];
|
||||
getOneDeviceAlarmTop10ByBaja(_devicePath, callbackForErr);
|
||||
@ -1156,7 +1219,7 @@
|
||||
if (/\.(jpe?g|png|gif)$/i.test(file.name)) {
|
||||
fileHelper.readAndPreviewImages(file, 'ope_forImage', 70, 70, '<span class="file-item m-1">', '<button class="btn-dark m-1" name="btnDelImg"><i class="fa fa-times"></i></button></span>');
|
||||
|
||||
pageAct.imageFile.map(function (v, i) { tmpGuidArr.push(v.file.guid) });
|
||||
pageAct.imageFile.map(function (v, i) { if (v['file']) tmpGuidArr.push(v.file.guid); });
|
||||
if (jQuery.inArray(file.guid, tmpGuidArr) == -1) { //not in array
|
||||
let fd = new FormData();
|
||||
let f = file;
|
||||
@ -1167,7 +1230,7 @@
|
||||
else if (/\.(xls?x|doc?x|ptt?x|pdf|zip|rar|7zip|txt|odt|xml|rtf|ods|odp|pps?x)$/i.test(file.name)) {
|
||||
fileHelper.readAndPreviewFiles(file, 'ope_forFile', 70, 70, "<div class='file-item'><i class='fas fa-file-alt fa-2x m-1'></i>", "<button class='btn-dark m-1' name='btnDelImg'><i class='fa fa-times'></i></button></div>");
|
||||
|
||||
pageAct.imageFile.map(function (v, i) { tmpGuidArr.push(v.file.guid) });
|
||||
pageAct.imageFile.map(function (v, i) { if (v['file']) tmpGuidArr.push(v.file.guid); });
|
||||
if (jQuery.inArray(file.guid, tmpGuidArr) == -1) { //not in array
|
||||
let fd = new FormData();
|
||||
let f = file;
|
||||
|
@ -514,7 +514,7 @@ class File {
|
||||
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="' + guid + '" data-extname="' + strExtName
|
||||
+ '" data-size="' + file.size + '" width="' + width + '" height="' + height + '" src="' + src + '">'
|
||||
+ '" data-size="' + file.size + '" width="' + width + '" height="' + height + '" src="' + src + '" style="margin-left: 30px; margin-top: 10px">'
|
||||
+ backHtml;
|
||||
|
||||
container.insertAdjacentHTML("afterBegin", htmlImg);
|
||||
@ -560,7 +560,7 @@ class File {
|
||||
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="' + guid + '" data-extname="' + strExtName
|
||||
+ '" data-size="' + file.size + '" width="' + width + '" height="' + height + '" src="' + src + '">'
|
||||
+ '" data-size="' + file.size + '" width="' + width + '" height="' + height + '" src="' + src + '" style="margin-left: 30px; margin-top: 10px">'
|
||||
+ backHtml;
|
||||
|
||||
container.insertAdjacentHTML("afterBegin", htmlImg);
|
||||
|
@ -174,7 +174,7 @@ namespace FrontendWebApi.ApiControllers
|
||||
ApiResult<string> apiResult = new ApiResult<string>();
|
||||
try
|
||||
{
|
||||
var sqlString = $@"select formId from operation_record where error_code = @error_code limit 1";
|
||||
var sqlString = $@"select formId from operation_record where error_code = @error_code and deleted = 0 limit 1";
|
||||
var formId = await backendRepository.GetOneAsync<string>(sqlString, new { @error_code = alerts.uuid });
|
||||
|
||||
apiResult.Code = "0000";
|
||||
|
@ -1067,10 +1067,11 @@ namespace FrontendWebApi.ApiControllers
|
||||
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
|
||||
var sqlString = $@"select opr.* , concat(d.device_floor_tag, ' ', d.full_name) as device_name, ui.full_name as user_full_name
|
||||
from operation_record opr
|
||||
left join device d on opr.fix_do_code = d.device_number and d.deleted = 0 and d.device_area_tag = SUBSTRING_INDEX(opr.fix_do_code, '_', 1)
|
||||
and d.device_building_tag = SUBSTRING_INDEX(opr.fix_do_code, '_', 2) and d.device_floor_tag = SUBSTRING_INDEX(opr.fix_do_code, '_', 5)
|
||||
and d.device_building_tag = SUBSTRING_INDEX(SUBSTRING_INDEX(fix_do_code, '_', 2), '_', -1)
|
||||
and d.device_floor_tag = SUBSTRING_INDEX(SUBSTRING_INDEX(fix_do_code, '_', 5), '_', -1)
|
||||
and d.device_system_tag = opr.device_system_category_layer2 and d.device_name_tag = opr.device_system_category_layer3
|
||||
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;
|
||||
@ -1181,7 +1182,7 @@ namespace FrontendWebApi.ApiControllers
|
||||
{ "@device_system_category_layer2", or.device_system_category_layer2},
|
||||
{ "@device_system_category_layer3", or.device_system_category_layer3},
|
||||
{ "@work_type", or.work_type},
|
||||
{ "@error_code", or.work_type == 2 ? new_guid.ToString() : null},
|
||||
{ "@error_code", or.error_code},
|
||||
{ "@fix_do", or.fix_do},
|
||||
{ "@fix_do_code", or.fix_do_code },
|
||||
{ "@fix_firm", or.fix_firm},
|
||||
@ -1246,6 +1247,7 @@ namespace FrontendWebApi.ApiControllers
|
||||
{ "@location_code", or.location_code},
|
||||
{ "@device_system_category_layer2", or.device_system_category_layer2},
|
||||
{ "@device_system_category_layer3", or.device_system_category_layer3},
|
||||
{ "@error_code", or.error_code},
|
||||
{ "@fix_do", or.fix_do},
|
||||
{ "@fix_do_code", or.fix_do_code },
|
||||
{ "@fix_firm", or.fix_firm},
|
||||
|
Loading…
Reference in New Issue
Block a user