Merge branch 'master' of https://gitea.mjm-staging.developers-homelab.net/BIMS/BIMS
This commit is contained in:
commit
7802738fa4
@ -12,21 +12,21 @@
|
||||
role="tab"><i class="fal fa-cog mr-1"></i> 群組權限</a> </li>
|
||||
</ul>
|
||||
<div class="tab-content border border-top-0 p-3 w-100">
|
||||
<div class="tab-pane fade show active" id="tab_borders_icons-1" role="tabpanel">
|
||||
<div class="tab-pane fade show active" id="tab_borders_icons-1" role="tabpanel" data-id="accMan">
|
||||
<div class="row mb-5 align-items-end">
|
||||
<div class="col-auto">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="simpleinput">姓名</label>
|
||||
<input type="text" id="simpleinput" class="form-control">
|
||||
<label class="form-label" for="seaAccManName">姓名</label>
|
||||
<input type="text" id="seaAccManName" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="simpleinput">群組</label>
|
||||
<input type="text" id="simpleinput" class="form-control">
|
||||
<label class="form-label" for="seaAccManRolName">角色</label>
|
||||
<input type="text" id="seaAccManRolName" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<!--<div class="col-auto">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="example-select">狀態</label>
|
||||
<select class="form-control" id="example-select select2bs4">
|
||||
@ -34,8 +34,8 @@
|
||||
<option>停用</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto"> <a href="#" class="btn btn-info">搜尋</a> </div>
|
||||
</div>-->
|
||||
<div class="col-auto"> <a href="#" class="btn btn-info" id="acc_searchBtn">搜尋</a> </div>
|
||||
</div>
|
||||
<div class="frame-wrap">
|
||||
<div class="mb-3"> <a href="#" class="btn btn-success" data-toggle="modal"
|
||||
@ -44,11 +44,11 @@
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="tab_borders_icons-2" role="tabpanel">
|
||||
<div class="tab-pane fade" id="tab_borders_icons-2" role="tabpanel" data-id="rolMan">
|
||||
<div class="row mb-5 align-items-end">
|
||||
<div class="col-auto">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="simpleinput">群組</label>
|
||||
<label class="form-label" for="simpleinput">角色</label>
|
||||
<input type="text" id="simpleinput" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
@ -61,7 +61,7 @@
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="tab_borders_icons-3" role="tabpanel">
|
||||
<div class="tab-pane fade" id="tab_borders_icons-3" role="tabpanel" data-id="rolAuth">
|
||||
<div class="row mb-5 align-items-end">
|
||||
<div class="col-auto">
|
||||
<div class="form-group">
|
||||
@ -85,7 +85,7 @@
|
||||
</main>
|
||||
|
||||
<!-- Modal center Add -->
|
||||
<div class="modal fade" id="accManModal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal fade" id="accManModal" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static" data-keyboard="false">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
@ -116,11 +116,6 @@
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="inpAcc">帳號</label>
|
||||
<input type="text" id="inpAcc" name="inpAcc" class="form-control">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" id="inpSameEmail"
|
||||
name="inpSameEmail" />
|
||||
<label class="custom-control-label text-white" for="inpSameEmail">與email相同</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
@ -139,8 +134,8 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">關閉</button>
|
||||
<button type="submit" class="btn btn-primary" id="accManSendBtn" e-prevent>儲存</button>
|
||||
<button type="button" class="btn btn-secondary" id="accManCanBtn" data-dismiss="modal">關閉</button>
|
||||
<button type="button" class="btn btn-primary" id="accManSendBtn" e-prevent>儲存</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@ -148,7 +143,7 @@
|
||||
</div>
|
||||
|
||||
<!-- Modal group Add -->
|
||||
<div class="modal fade" id="groupModal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal fade" id="groupModal" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static" data-keyboard="false">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
@ -171,8 +166,8 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">關閉</button>
|
||||
<button type="submit" class="btn btn-primary" id="accManSendBtn" e-prevent>儲存</button>
|
||||
<button type="button" class="btn btn-secondary" id="" data-dismiss="modal">關閉</button>
|
||||
<button type="button" class="btn btn-primary" id="" e-prevent>儲存</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@ -180,7 +175,7 @@
|
||||
</div>
|
||||
|
||||
<!-- Modal center 設備權限 -->
|
||||
<div class="modal fade" id="modal-center-cog" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal fade" id="modal-center-cog" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static" data-keyboard="false">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
@ -243,7 +238,7 @@
|
||||
</div>
|
||||
|
||||
<!-- Modal center 設備權限 -->
|
||||
<div class="modal fade" id="modal-center-users" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal fade" id="modal-center-users" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static" data-keyboard="false">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
@ -311,7 +306,7 @@
|
||||
</div>
|
||||
|
||||
<!-- delete modal -->
|
||||
<div class="modal fade" id="delModal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal fade" id="delModal" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static" data-keyboard="false">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-footer">
|
||||
@ -319,8 +314,9 @@
|
||||
<button type="button" class="btn btn-primary" id="confirmDelBtn" aria-label="OK" e-prevent>
|
||||
確定
|
||||
</button>
|
||||
<button type="button" class="btn btn-danger" data-dismiss="modal" aria-label="No">
|
||||
<button type="button" class="btn btn-danger" id="closeDelBtn" data-dismiss="modal" aria-label="No">
|
||||
取消
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -329,6 +325,7 @@
|
||||
<script>
|
||||
var rolAuthTable = null;
|
||||
$(function () {
|
||||
clearPagSes();
|
||||
getRoleSel();
|
||||
loadAccManTable();
|
||||
loadRolManTable();
|
||||
@ -343,6 +340,14 @@
|
||||
}
|
||||
let tag = "#accManTable";
|
||||
|
||||
let sendData = {};
|
||||
if (pageAct.accManName != null)
|
||||
sendData.Full_name = pageAct.accManName;
|
||||
|
||||
if (pageAct.accRolName != null)
|
||||
sendData.Role_full_name = pageAct.accRolName;
|
||||
|
||||
ajaxObj.data = sendData;
|
||||
let column_defs = [
|
||||
{ "targets": [0], "width": "6%", "sortable": true },
|
||||
{ "targets": [1], "width": "12%", "sortable": true },
|
||||
@ -540,13 +545,45 @@
|
||||
dtAjaxResetSendData(rolAuthTable, { SelectedRoleId: roleGuid })
|
||||
})
|
||||
|
||||
onEvent("click", "[data-target*=accManModal]", function () {
|
||||
pageAct.accManId = $(this).prop('id').split('Btn')[1]
|
||||
|
||||
$("#inpAcc").val('');
|
||||
$("#inpName").val('');
|
||||
$("#inpEmail").val('');
|
||||
$("#inpPhone").val('');
|
||||
$("#selRolAuth").val($($('#selRolAuth option')[0]).val());
|
||||
|
||||
if ($(this).prop('id') !== undefined) {
|
||||
let url = baseApiUrl + "/User/GetOneUser";
|
||||
let sendData = {
|
||||
Id: $(this).prop('id').split('Btn')[1],
|
||||
};
|
||||
objSendData.Data = sendData;
|
||||
ytAjax = new YourTeam.Ajax(url, objSendData, function (res) {
|
||||
if (!res || res.code != "0000" || !res.data) {
|
||||
|
||||
} else {
|
||||
$("#inpAcc").val(res.data.account);
|
||||
$("#inpName").val(res.data.full_name);
|
||||
$("#inpEmail").val(res.data.email);
|
||||
$("#inpPhone").val(res.data.phone);
|
||||
$("#selRolAuth").val(res.data.role_guid);
|
||||
}
|
||||
}, null, "POST").send();
|
||||
}
|
||||
});
|
||||
onEvent("click", "[data-target*=delModal]", function () {
|
||||
pageAct.accManId = $(this).prop('id').split('Btn')[1]
|
||||
});
|
||||
|
||||
onEvent("click", "#accManSendBtn", function () {
|
||||
let form = $("#accManForm");
|
||||
$(form).validate({
|
||||
rules: {
|
||||
inpEmail: { required: true, email: true },
|
||||
inpName: { required: true, minlength: 2, dbLimit: 50 },
|
||||
inpAcc: { required: true, email: true, dbLimit: 50 },
|
||||
inpAcc: { required: true, dbLimit: 50 },
|
||||
selRolAuth: { required: true },
|
||||
inpPhone: { phone: true },
|
||||
}
|
||||
@ -554,23 +591,76 @@
|
||||
if ($(form).valid()) {
|
||||
let url = baseApiUrl + "/User/SaveUser";
|
||||
let sendData = {
|
||||
Id: 0,
|
||||
Id: pageAct.accManId ?? "0",
|
||||
Account: $("#inpAcc").val(),
|
||||
Name: $("#inpName").val(),
|
||||
Email: $("#inpEmail").val(),
|
||||
Phone: $("#inpPhone").val(),
|
||||
RoleId: $("#selRolAuth").val(),
|
||||
};
|
||||
|
||||
objSendData.Data = sendData;
|
||||
ytAjax = new YourTeam.Ajax(url, objSendData, function (res) {
|
||||
if (!res || res.code != "0000" || !res.data) {
|
||||
if (!res || res.code != "0000" || !res.msg) {
|
||||
|
||||
} else {
|
||||
toast_ok(common.AddSuc);
|
||||
$("#accManModal").modal("hide");
|
||||
toast_ok(pageAct.accManId == null ? common.AddSuc : common.EditSuc);
|
||||
//$("#accManModal").modal("hide");
|
||||
$("#accManCanBtn").click();
|
||||
pageAct.accManId = null;
|
||||
loadAccManTable();
|
||||
}
|
||||
}, null, "POST").send();
|
||||
}
|
||||
})
|
||||
|
||||
onEvent("change", "#seaAccManName", function () {
|
||||
pageAct.accManName = $(this).val() || null;
|
||||
});
|
||||
|
||||
onEvent("change", "#seaAccManRolName", function () {
|
||||
pageAct.accRolName = $(this).val() || null;
|
||||
});
|
||||
|
||||
onEvent("click", "#acc_searchBtn", function () {
|
||||
let acc_table = $('div.tab-pane.fade.show.active').data('id');
|
||||
|
||||
if (acc_table == "accMan")
|
||||
loadAccManTable();
|
||||
else if (acc_table == "rolMan")
|
||||
loadRolManTable();
|
||||
else if (acc_table == "rolAuth")
|
||||
loadRolAuthTable();
|
||||
});
|
||||
|
||||
onEvent("change", ".tab-pane.fade", function () {
|
||||
console.log('aaa');
|
||||
});
|
||||
|
||||
onEvent("click", "#confirmDelBtn", function () {
|
||||
let url = baseApiUrl + "/User/DeleteOneUser";
|
||||
let sendData = {
|
||||
Id: pageAct.accManId,
|
||||
};
|
||||
|
||||
objSendData.Data = sendData;
|
||||
ytAjax = new YourTeam.Ajax(url, objSendData, function (res) {
|
||||
if (!res || res.code != "0000" || !res.msg) {
|
||||
|
||||
} else {
|
||||
toast_ok(common.DelSuc);
|
||||
//$("#accManModal").modal("hide");
|
||||
$("#closeDelBtn").click();
|
||||
pageAct.accManId = null;
|
||||
loadAccManTable();
|
||||
}
|
||||
}, null, "POST").send();
|
||||
})
|
||||
}
|
||||
|
||||
function clearPagSes() {
|
||||
pageAct.accManId = null;
|
||||
pageAct.accManName = null;
|
||||
pageAct.accRolName = null;
|
||||
}
|
||||
</script>
|
@ -434,7 +434,7 @@
|
||||
|
||||
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");
|
||||
location.href = baseApiUrl + "/api/df?path=" + rel.data.split('/')[0] + "&fileName=" + rel.data.split('/')[1] + "&token=" + cookies.get("JWT-Authorization");
|
||||
}, null, "POST").send();
|
||||
}
|
||||
</script>
|
@ -65,6 +65,8 @@
|
||||
</div>
|
||||
<table id="opeFirmTable" class="table table-bordered table-striped text-center m-0 w-100">
|
||||
</table>
|
||||
<table id="opeRecTable_2" class="table table-bordered table-striped text-center m-0 w-100">
|
||||
</table>
|
||||
<table id="opeRecTable" class="table table-bordered table-striped text-center m-0 w-100">
|
||||
</table>
|
||||
</div>
|
||||
@ -149,7 +151,143 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal center 保養/維修 -->
|
||||
<!-- Modal center 維修-->
|
||||
<div class="modal fade" id="opeRecModal_2" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static" data-keyboard="false">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<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>
|
||||
<form id="opeRecForm_2">
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="inpNumber_2">表單編號</label>
|
||||
<input type="text" id="inpNumber_2" name="" class="form-control" disabled>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="inpErrCode_2">異常編號</label>
|
||||
<select class="form-control" id="inpErrCode_2" name="inpErrCode_2">
|
||||
<option value=''>未選擇</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="inpStaTime_2">預計開始時間</label>
|
||||
<input type="date" id="inpStaTime_2" name="inpStaTime_2" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="inpWorTyp_2">項目</label>
|
||||
<select class="form-control custom-select-ri" id="inpWorTyp_2" name="inpWorTyp_2" disabled>
|
||||
<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="inpFixDo_2">維修項目</label>
|
||||
<input type="text" id="inpFixDo_2" name="inpFixDo_2" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="inpFixDoCode_2">維修項目代碼(設備編號)</label>
|
||||
<select class="form-control" id="inpFixDoCode_2" name="inpFixDoCode_2">
|
||||
<option value=''>未選擇</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="inpFixFirm_2">負責廠商</label>
|
||||
<select class="form-control" id="inpFixFirm_2" name="inpFixFirm_2">
|
||||
<option value=''>未選擇</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="inpStatus_2">狀態</label>
|
||||
<div class="form-control" id="inpStatus_2">
|
||||
<div class="row container">
|
||||
<div class="">
|
||||
<input class="custom-radio-input" type="radio" name="inpSta_2" id="inpSta_2_0" value="0" data-value="0" checked>
|
||||
<label class="form-label" for="inpSta_0">未完成</label>
|
||||
</div>
|
||||
|
||||
<div class="px-4">
|
||||
<input class="custom-radio-input" type="radio" name="inpSta_2" id="inpSta_2_1" value="1" data-value="1">
|
||||
<label class="form-label" for="inpSta_1">完成</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="inpWorPerId_2">工作人員編號</label>
|
||||
<select class="form-control" id="inpWorPerId_2" name="inpWorPerId_2">
|
||||
<option value=''>未選擇</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="inpNotice_2">注意事項</label>
|
||||
<textarea class="form-control" type="text" id="inpNotice_2" name="inpNotice_2" rows="7"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="inpDescription_2">結果描述</label>
|
||||
<textarea class="form-control" type="text" id="inpDescription_2" name="inpDescription_2" rows="7"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<label class="form-label">上傳檔案</label>
|
||||
<div id='ope_forImage_2' class="col-sm-12 forimage mt-2 p-0">
|
||||
</div>
|
||||
<div id='ope_forFile_2' class="col-sm-12 forfile mt-2 p-0">
|
||||
</div>
|
||||
|
||||
<div class="form-group dropzone" id="ope_dropZone_2">
|
||||
<div class="dz-message">
|
||||
<div class="drag-icon-cph">
|
||||
<i class="material-icons">backup</i>
|
||||
</div>
|
||||
<h3>選擇一個文件或拖放到這裡</h3>
|
||||
<p class="mb-0 col-grey">
|
||||
PDF檔案不超過 10MB
|
||||
</p>
|
||||
</div>
|
||||
<div class="fallback">
|
||||
<input name="file" type="file" multiple />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" id="OpeRecCanBtn_2" data-dismiss="modal">關閉</button>
|
||||
<button type="button" class="btn btn-primary" id="OpeRecSendBtn_2" e-prevent>儲存</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal center 保養 -->
|
||||
<div class="modal fade" id="opeRecModal" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static" data-keyboard="false">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
@ -165,10 +303,8 @@
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="inpErrCode">異常編號</label>
|
||||
<select class="form-control" id="inpErrCode" name="inpErrCode">
|
||||
<option value=''>未選擇</option>
|
||||
</select>
|
||||
<label class="form-label" for="inpNumber">表單編號</label>
|
||||
<input type="text" id="inpNumber" name="" class="form-control" disabled>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
@ -214,12 +350,12 @@
|
||||
<div class="form-control" id="inpStatus">
|
||||
<div class="row container">
|
||||
<div class="">
|
||||
<input class="custom-radio-input" type="radio" name="inpSta" id="inpSta_0" value="0" checked>
|
||||
<input class="custom-radio-input" type="radio" name="inpSta" id="inpSta_0" data-value="0" value="0" checked>
|
||||
<label class="form-label" for="inpSta_0">未完成</label>
|
||||
</div>
|
||||
|
||||
<div class="px-4">
|
||||
<input class="custom-radio-input" type="radio" name="inpSta" id="inpSta_1" value="1">
|
||||
<input class="custom-radio-input" type="radio" name="inpSta" id="inpSta_1" data-value="1" value="1">
|
||||
<label class="form-label" for="inpSta_1">完成</label>
|
||||
</div>
|
||||
</div>
|
||||
@ -260,7 +396,7 @@
|
||||
</div>
|
||||
<h3>選擇一個文件或拖放到這裡</h3>
|
||||
<p class="mb-0 col-grey">
|
||||
PDF檔案不超過 3MB
|
||||
PDF檔案不超過 10MB
|
||||
</p>
|
||||
</div>
|
||||
<div class="fallback">
|
||||
@ -377,6 +513,7 @@
|
||||
function loadOpeFirmTable() {
|
||||
$('#opeFirmTable_wrapper').css('display', 'block');
|
||||
$('#opeRecTable_wrapper').css('display', 'none');
|
||||
$('#opeRecTable_2_wrapper').css('display', 'none');
|
||||
$('#serial_number').parent().parent().css('display', 'none');
|
||||
$('[for=serial_number]').parent().css('display', 'none');
|
||||
$('#setDate').css('display', 'none');
|
||||
@ -443,7 +580,7 @@
|
||||
|
||||
function loadOpeRecTable() {
|
||||
$('#opeFirmTable_wrapper').css('display', 'none');
|
||||
$('#opeRecTable_wrapper').css('display', 'block');
|
||||
|
||||
$('#serial_number').parent().parent().css('display', 'block');
|
||||
$('[for=serial_number]').parent().css('display', 'block');
|
||||
$('#setDate').css('display', 'block');
|
||||
@ -456,9 +593,14 @@
|
||||
data: { work_type: pageAct.work_type, start_created_at: pageAct.startdate, end_created_at: pageAct.enddate, serial_number: pageAct.serial_number, main_system_tag: pageAct.main_system_tag, sub_system_tag: pageAct.sub_system_tag }
|
||||
}
|
||||
|
||||
let tag = "#opeRecTable";
|
||||
let tag = "#opeRecTable" + (pageAct.work_type == "2" ? "_2" : "");
|
||||
let column_defs = [];
|
||||
let columns = [];
|
||||
if (pageAct.work_type == "2") {
|
||||
$('#opeRecTable_wrapper').css('display', 'none');
|
||||
$('#opeRecTable_2_wrapper').css('display', 'block');
|
||||
|
||||
let column_defs = [
|
||||
column_defs = [
|
||||
{ "targets": [0], "width": "2%", "sortable": true },
|
||||
{ "targets": [1], "width": "6%", "sortable": true },
|
||||
{ "targets": [2], "width": "7%", "sortable": true },
|
||||
@ -473,7 +615,7 @@
|
||||
{ "targets": [11], "width": "8%", "sortable": false },
|
||||
];
|
||||
|
||||
let columns = [
|
||||
columns = [
|
||||
{
|
||||
"title": "項目",
|
||||
"data": "work_type_name",
|
||||
@ -520,7 +662,118 @@
|
||||
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_colA = creEle("a", null, null, null, null, null, { href: baseApiUrl + "/upload/operation/" + v.save_file_name + "." + extName, download: v.ori_file_name, target: "_blank", style: "cursor: pointer" });
|
||||
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);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return ope_imgHtml ? ope_imgHtml.outerHtml() : null;
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "完成時間",
|
||||
"data": "finish_time",
|
||||
"render": function (data) {
|
||||
return displayDate(data, "datetime");
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "建立時間",
|
||||
"data": "created_at",
|
||||
},
|
||||
{
|
||||
"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("修改", "opeRecEdiBtn", null, ["btn", "btn-info"], { "toggle": "modal", "target": "#opeRecModal_2" }));
|
||||
btnDiv.append(creBtnHtml("刪除", "opeRecDelBtn", null, ["btn", "btn-danger"], { "toggle": "modal", "target": "#delModal" }));
|
||||
return btnDiv.outerHtml();
|
||||
}
|
||||
},
|
||||
];
|
||||
}
|
||||
else if (pageAct.work_type == "1") {
|
||||
$('#opeRecTable_wrapper').css('display', 'block');
|
||||
$('#opeRecTable_2_wrapper').css('display', 'none');
|
||||
|
||||
column_defs = [
|
||||
{ "targets": [0], "width": "2%", "sortable": true },
|
||||
{ "targets": [1], "width": "6%", "sortable": true },
|
||||
{ "targets": [2], "width": "6%", "sortable": true },
|
||||
{ "targets": [3], "width": "5%", "sortable": true },
|
||||
{ "targets": [4], "width": "3%", "sortable": true },
|
||||
{ "targets": [5], "width": "5%", "sortable": true },
|
||||
{ "targets": [6], "width": "6%", "sortable": true },
|
||||
{ "targets": [7], "width": "15%", "sortable": false },
|
||||
{ "targets": [8], "width": "6%", "sortable": false },
|
||||
{ "targets": [9], "width": "8%", "sortable": false },
|
||||
{ "targets": [10], "width": "8%", "sortable": false },
|
||||
];
|
||||
|
||||
columns = [
|
||||
{
|
||||
"title": "項目",
|
||||
"data": "work_type_name",
|
||||
},
|
||||
{
|
||||
"title": "位置",
|
||||
"data": "location",
|
||||
},
|
||||
{
|
||||
"title": "表單號",
|
||||
"data": "formId",
|
||||
},
|
||||
{
|
||||
"title": "設備名稱",
|
||||
"data": "device_name",
|
||||
},
|
||||
{
|
||||
"title": "狀態",
|
||||
"data": "status_name",
|
||||
},
|
||||
{
|
||||
"title": "處理人員",
|
||||
"data": "user_full_name",
|
||||
},
|
||||
{
|
||||
"title": "預計施工時間",
|
||||
"data": "start_time",
|
||||
"render": function (data) {
|
||||
return displayDate(data, "datetime");
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "檔案上傳",
|
||||
"data": "lorf",
|
||||
"render": function (data) {
|
||||
ope_imgHtml = null;
|
||||
$.each(data, function (i, v) {
|
||||
let extName = v.ori_file_name.split('.')[1];
|
||||
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", style: "cursor: pointer" });
|
||||
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);
|
||||
@ -569,6 +822,7 @@
|
||||
}
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
opeRecTable = new YourTeam.JqDataTables.getTableByAjax(ajaxObj, tag, null, columns, column_defs);
|
||||
}
|
||||
@ -581,8 +835,8 @@
|
||||
loadOpeFirmTable();
|
||||
}
|
||||
else {
|
||||
$('#inpWorTyp').val(wt);
|
||||
$('#newForm').attr('data-target', '#opeRecModal');
|
||||
$(pageAct.work_type == '1' ? '#inpWorTyp' : '#inpWorTyp_2').val(wt);
|
||||
$('#newForm').attr('data-target', pageAct.work_type == "1" ? '#opeRecModal' : '#opeRecModal_2');
|
||||
loadOpeRecTable();
|
||||
}
|
||||
}
|
||||
@ -720,7 +974,7 @@
|
||||
|
||||
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");
|
||||
location.href = baseApiUrl + "/api/df?path=" + rel.data.split('/')[0] + "&fileName=" + rel.data.split('/')[1] + "&token=" + cookies.get("JWT-Authorization");
|
||||
}, null, "POST").send();
|
||||
}
|
||||
|
||||
@ -758,7 +1012,7 @@
|
||||
|
||||
} else {
|
||||
strHtml = ``;
|
||||
$("#inpFixDoCode").html();
|
||||
$(pageAct.work_type == '1' ? "#inpFixDoCode" : "#inpFixDoCode_2").html();
|
||||
$.each(res.data, (index, roleObj) => {
|
||||
strHtml += `<option value='${roleObj.device_number}' data-floor=${roleObj.device_floor_tag} data-main=${roleObj.device_system_tag} data-sub=${roleObj.device_name_tag}>${roleObj.device_name}</option>`;
|
||||
|
||||
@ -769,7 +1023,7 @@
|
||||
pageAct.number = roleObj.device_number;
|
||||
}
|
||||
})
|
||||
$("#inpFixDoCode").html(strHtml);
|
||||
$(pageAct.work_type == '1' ? "#inpFixDoCode" : "#inpFixDoCode_2").html(strHtml);
|
||||
}
|
||||
}, null, "POST").send();
|
||||
}
|
||||
@ -780,13 +1034,13 @@
|
||||
if (!res || res.code != "0000" || !res.data) {
|
||||
|
||||
} else {
|
||||
$("#inpWorPerId").html();
|
||||
$(pageAct.work_type == '1' ? "#inpWorPerId" : "#inpWorPerId_2").html();
|
||||
strHtml = ``;
|
||||
strHtml += `<option value=''>未選擇</option>`;
|
||||
$.each(res.data, (index, roleObj) => {
|
||||
strHtml += `<option value='${roleObj.userinfo_guid}'>${roleObj.full_name}</option>`;
|
||||
})
|
||||
$("#inpWorPerId").html(strHtml);
|
||||
$(pageAct.work_type == '1' ? "#inpWorPerId" : "#inpWorPerId_2").html(strHtml);
|
||||
}
|
||||
}, null, "POST").send();
|
||||
}
|
||||
@ -798,13 +1052,13 @@
|
||||
if (!res || res.code != "0000" || !res.data) {
|
||||
|
||||
} else {
|
||||
$("#inpFixFirm").html();
|
||||
$(pageAct.work_type == '1' ? "#inpFixFirm" : "#inpFixFirm_2").html();
|
||||
strHtml = ``;
|
||||
strHtml += `<option value=''>未選擇</option>`;
|
||||
$.each(res.data, (index, roleObj) => {
|
||||
strHtml += `<option value='${roleObj.id}'>${roleObj.name}</option>`;
|
||||
})
|
||||
$("#inpFixFirm").html(strHtml);
|
||||
$(pageAct.work_type == '1' ? "#inpFixFirm" : "#inpFixFirm_2").html(strHtml);
|
||||
}
|
||||
}, null, "POST").send();
|
||||
}
|
||||
@ -847,23 +1101,28 @@
|
||||
pageAct.opeFirmAct = 'add';
|
||||
$('#opeFirmTitle').html('新增廠商資料');
|
||||
$('#opeFirmModal input').map(function (i, v) { $(v).val('') });
|
||||
$('#opeFirmModal [id*=-error]').hide();
|
||||
}
|
||||
else {
|
||||
clearOpeRecPageAct();
|
||||
$('#' + (pageAct.work_type == '1' ? 'opeRecForm' : 'opeRecForm_2') + ' [id*=-error]').hide();
|
||||
pageAct.opeRecId = null;
|
||||
pageAct.imageFile = [];
|
||||
$('#opeRecTitle').html(pageAct.work_type == 1 ? "新增保養" : "新增維修");
|
||||
$('#opeRecModal input').map(function (i, v) { $(v).val('') });
|
||||
$(pageAct.work_type == '1' ? '#opeRecTitle' : '#opeRecTitle_2').html(pageAct.work_type == 1 ? "新增保養" : "新增維修");
|
||||
$(pageAct.work_type == '1' ? '#opeRecModal input' : '#opeRecModal_2 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('');
|
||||
$(pageAct.work_type == '1' ? '#opeRecModal input[id*=Time]' : '#opeRecModal_2 input[id*=Time]').map(function (i, v) { $(v).val(today) });
|
||||
$(pageAct.work_type == '1' ? '#ope_forImage' : '#ope_forImage_2').html('');
|
||||
$(pageAct.work_type == '1' ? '#ope_forFile' : '#ope_forFile_2').html('');
|
||||
$(pageAct.work_type == '1' ? '#inpDescription' : '#inpDescription_2').val('');
|
||||
$(pageAct.work_type == '1' ? '#inpNotice' : '#inpNotice_2').val('');
|
||||
$(pageAct.work_type == '1' ? '#inpFixDo' : '#inpFixDo_2').val('');
|
||||
selUser();
|
||||
selDevice();
|
||||
selOpeFir();
|
||||
errCodeList();
|
||||
getFormId();
|
||||
getUser();
|
||||
}
|
||||
|
||||
selSysMain();
|
||||
@ -923,7 +1182,7 @@
|
||||
if (!res || res.code != "0000" || !res.data) {
|
||||
|
||||
} else {
|
||||
//toast_ok(common.AddSuc);
|
||||
toast_ok(common.AddSuc);
|
||||
//$("#opeFirmModal").modal("hide");
|
||||
$("#OpeFirmCanBtn").click();
|
||||
refTable();
|
||||
@ -945,7 +1204,7 @@
|
||||
if (!res || res.code != "0000" || !res.data) {
|
||||
|
||||
} else {
|
||||
//toast_ok(common.AddSuc);
|
||||
toast_ok(common.DelSuc);
|
||||
//$("#delModal").modal("hide");
|
||||
$("#confirmDelCanBtn").click();
|
||||
refTable();
|
||||
@ -958,8 +1217,9 @@
|
||||
pageAct.opeFirmId = null;
|
||||
});
|
||||
|
||||
onEvent('click', '#OpeRecSendBtn', function () {
|
||||
let form = $("#opeRecForm");
|
||||
onEvent('click', '#OpeRecSendBtn, #OpeRecSendBtn_2', function () {
|
||||
let form = $(pageAct.work_type == '1' ? "#opeRecForm" : "#opeRecForm_2");
|
||||
if (pageAct.work_type == '1') {
|
||||
$(form).validate({
|
||||
rules: {
|
||||
inpWorTyp: { required: true },
|
||||
@ -970,6 +1230,19 @@
|
||||
inpWorPerId: { required: true },
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
$(form).validate({
|
||||
rules: {
|
||||
inpWorTyp_2: { required: true },
|
||||
inpFixDo_2: { required: true },
|
||||
inpFixDoCode_2: { required: true },
|
||||
inpFixFirm_2: { required: true },
|
||||
inpStatus_2: { required: true },
|
||||
inpWorPerId_2: { required: true },
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if ($(form).valid()) {
|
||||
let url = baseApiUrl + "/operation/SavOpeRecord";
|
||||
@ -982,23 +1255,23 @@
|
||||
fd.append("lorf[" + i + "].ori_file_name", v.ori_file_name);
|
||||
});
|
||||
|
||||
fd.append("error_code", $('#inpErrCode').val());
|
||||
fd.append("error_code", $(pageAct.work_type == "1" ? '#inpErrCode' : '#inpErrCode_2').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.sysSub);
|
||||
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("work_type", parseInt($(pageAct.work_type == "1" ? '#inpWorTyp' : '#inpWorTyp_2').val()));
|
||||
fd.append("fix_do", $(pageAct.work_type == "1" ? '#inpFixDo' : '#inpFixDo_2').val());
|
||||
fd.append("fix_do_code", $(pageAct.work_type == "1" ? '#inpFixDoCode' : '#inpFixDoCode_2').val());
|
||||
fd.append("fix_firm", parseInt($(pageAct.work_type == "1" ? '#inpFixFirm' : '#inpFixFirm_2').val()));
|
||||
fd.append("status", parseInt($('#' + (pageAct.work_type == '1' ? 'inpStatus' : 'inpStatus_2') + ' [name=' + (pageAct.work_type == '1' ? 'inpSta' : 'inpSta_2') + ']:checked').data('value')));
|
||||
fd.append("work_person_id", $(pageAct.work_type == "1" ? '#inpWorPerId' : '#inpWorPerId_2').val());
|
||||
fd.append("start_time", ($(pageAct.work_type == "1" ? '#inpStaTime' : '#inpStaTime_2').val() || null) == null ? null : new Date($(pageAct.work_type == "1" ? '#inpStaTime' : '#inpStaTime_2').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);
|
||||
fd.append("finish_time", (parseInt($('#' + (pageAct.work_type == '1' ? 'inpStatus' : 'inpStatus_2') + ' [name=' + (pageAct.work_type == '1' ? 'inpSta' : 'inpSta_2') + ']:checked').data('value'))) == 1 ? new Date(Date.now()).toISOString() : null);
|
||||
fd.append("notice", $(pageAct.work_type == "1" ? '#inpNotice' : '#inpNotice_2').val() || null);
|
||||
fd.append("description", $(pageAct.work_type == "1" ? '#inpDescription' : '#inpDescription_2').val() || null);
|
||||
|
||||
//let sendData = {
|
||||
// location: $('#inpArea option:selected').text() + $('#inpBuilding option:selected').text() + $('#inpFloor option:selected').text(),
|
||||
@ -1031,29 +1304,18 @@
|
||||
cache: false,
|
||||
contentType: false,
|
||||
processData: false,
|
||||
beforeSend: function (xhr) { xhr.setRequestHeader('Authorization', "Bearer " + localStorage.getItem("JWT-Authorization")) },
|
||||
beforeSend: function (xhr) { xhr.setRequestHeader('Authorization', "Bearer " + cookies.get("JWT-Authorization")) },
|
||||
success: function (res) {
|
||||
if (!res || res.code != "0000" || !res.data) {
|
||||
|
||||
} else {
|
||||
//toast_ok(common.AddSuc);
|
||||
toast_ok(common.AddSuc);
|
||||
//$("#opeFirmModal").modal("hide");
|
||||
$("#OpeRecCanBtn").click();
|
||||
$(pageAct.work_type == '1' ? "#OpeRecCanBtn" : "#OpeRecCanBtn_2").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();
|
||||
}
|
||||
});
|
||||
|
||||
@ -1064,6 +1326,8 @@
|
||||
|
||||
$('#ope_forImage').html('');
|
||||
$('#ope_forFile').html('');
|
||||
$('#ope_forImage_2').html('');
|
||||
$('#ope_forFile_2').html('');
|
||||
|
||||
pageAct.imageFile = [];
|
||||
$('#opeRecTitle').html(pageAct.work_type == 1 ? "編輯保養" : "編輯維修");
|
||||
@ -1076,18 +1340,18 @@
|
||||
} 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, 'date').replaceAll('/', '-'));
|
||||
$('#inpNotice').text(res.data.notice);
|
||||
$('#inpDescription').text(res.data.description);
|
||||
$(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" ? '#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" ? '#inpFixFirm' : '#inpFixFirm_2').val(res.data.fix_firm);
|
||||
$('#' + (pageAct.work_type == '1' ? 'inpStatus' : 'inpStatus_2') + ' [name=' + (pageAct.work_type == '1' ? 'inpSta' : 'inpSta_2') + '][data-value=' + res.data.status + ']').click();
|
||||
$(pageAct.work_type == "1" ? '#inpWorPerId' : '#inpWorPerId_2').val(res.data.work_person_id);
|
||||
$(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" ? '#inpDescription' : '#inpDescription_2').val(res.data.description);
|
||||
|
||||
ope_imgHtml = null;
|
||||
$.each(res.data.lorf, function (i, v) {
|
||||
@ -1106,7 +1370,7 @@
|
||||
ope_imgHtml.append(ope_colA);
|
||||
ope_colBtn.append(ope_colI);
|
||||
ope_imgHtml.append(ope_colBtn);
|
||||
$('#ope_forImage').append(ope_imgHtml ? ope_imgHtml.outerHtml() : null);
|
||||
$(pageAct.work_type == "1" ? '#ope_forImage' : '#ope_forImage_2').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
|
||||
@ -1130,7 +1394,7 @@
|
||||
ope_imgHtml.append(ope_colI);
|
||||
ope_imgHtml.append(ope_colA);
|
||||
ope_imgHtml.append(ope_colBtn);
|
||||
$('#ope_forFile').append(ope_imgHtml ? ope_imgHtml.outerHtml() : null);
|
||||
$(pageAct.work_type == "1" ? '#ope_forFile' : '#ope_forFile_2').append(ope_imgHtml ? ope_imgHtml.outerHtml() : null);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -1164,7 +1428,7 @@
|
||||
$($(`#inpFirmSelSysSub option[data-main=${mainTag}]`)[0]).attr('selected', 'selected')
|
||||
});
|
||||
|
||||
onEvent("change", "#inpFixDoCode", function () {
|
||||
onEvent("change", "#inpFixDoCode, #inpFixDoCode_2", function () {
|
||||
elemSel = $(this).find('option:selected');
|
||||
pageAct.sysSub = elemSel.data('sub');
|
||||
pageAct.sysMain = elemSel.data('main');
|
||||
@ -1188,18 +1452,18 @@
|
||||
|
||||
$.each(res.data, function (i, v) {
|
||||
msg = v.msgText != null ? ($.trim(v.msgText.toString()).length > 0 ? v.msgText.split(':')[0] : '') : '';
|
||||
strHtml += `<option value=${v.uuid}>${msg}</option>`;
|
||||
strHtml += `<option value=${v.uuid}>${v.uuid}</option>`;
|
||||
});
|
||||
|
||||
if (res.count > 0)
|
||||
$('#inpErrCode').html(strHtml);
|
||||
$(pageAct.work_type == '1' ? '#inpErrCode' : '#inpErrCode_2').html(strHtml);
|
||||
|
||||
$(loadEle).Loading("close");
|
||||
}
|
||||
|
||||
//上傳檔案 dropzone
|
||||
function initDropzone() {
|
||||
uploader = $("#ope_dropZone").dropzone({
|
||||
$("#ope_dropZone").dropzone({
|
||||
url: baseApiUrl + '/api/Upload',
|
||||
previewsContainer: false,
|
||||
addRemoveLinks: false,
|
||||
@ -1207,11 +1471,11 @@
|
||||
dictInvalidFileType: `上傳格式錯誤`,
|
||||
dictCancelUploadConfirmation: `確定要取消上傳此檔案嗎?`,
|
||||
dictCancelUpload: `<span class="material-icons mi-cancel">cancel</span>`,
|
||||
maxFilesize: 3,
|
||||
maxFilesize: 10,
|
||||
filesizeBase: 1024,
|
||||
maxFiles: 50,
|
||||
acceptedFiles: ".pdf, .docx, .doc, .xls, .xlsm, .xlsx, .ppt, .pptx, .gif, .png, .jpg, .jpeg",
|
||||
headers: { "Authorization": 'Bearer ' + localStorage.getItem("JWT-Authorization") },
|
||||
headers: { "Authorization": 'Bearer ' + cookies.get("JWT-Authorization") },
|
||||
accept: function (file, done) {
|
||||
let fileHelper = new YourTeam.Utility.File();
|
||||
tmpGuidArr = [];
|
||||
@ -1240,5 +1504,67 @@
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$("#ope_dropZone_2").dropzone({
|
||||
url: baseApiUrl + '/api/Upload',
|
||||
previewsContainer: false,
|
||||
addRemoveLinks: false,
|
||||
dictRemoveFile: `<span class="material-icons mi-delete">delete</span>`,
|
||||
dictInvalidFileType: `上傳格式錯誤`,
|
||||
dictCancelUploadConfirmation: `確定要取消上傳此檔案嗎?`,
|
||||
dictCancelUpload: `<span class="material-icons mi-cancel">cancel</span>`,
|
||||
maxFilesize: 10,
|
||||
filesizeBase: 1024,
|
||||
maxFiles: 50,
|
||||
acceptedFiles: ".pdf, .docx, .doc, .xls, .xlsm, .xlsx, .ppt, .pptx, .gif, .png, .jpg, .jpeg",
|
||||
headers: { "Authorization": 'Bearer ' + cookies.get("JWT-Authorization") },
|
||||
accept: function (file, done) {
|
||||
let fileHelper = new YourTeam.Utility.File();
|
||||
tmpGuidArr = [];
|
||||
|
||||
if (/\.(jpe?g|png|gif)$/i.test(file.name)) {
|
||||
fileHelper.readAndPreviewImages(file, 'ope_forImage_2', 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) { 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;
|
||||
fd.append('file', f);
|
||||
pageAct.imageFile.push({ "ori_file_name": f.name, "save_file_name": f.guid, "file": fd.get("file") });
|
||||
}
|
||||
}
|
||||
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_2', 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) { 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;
|
||||
fd.append('file', f);
|
||||
pageAct.imageFile.push({ "ori_file_name": f.name, "save_file_name": f.guid, "file": fd.get("file") });
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getFormId() {
|
||||
ytAjax = new YourTeam.Ajax(baseApiUrl + '/operation/GetFormId', objSendData, function (res) {
|
||||
if (!res || res.code != "0000" || !res.data) {
|
||||
|
||||
} else {
|
||||
$(pageAct.work_type == '1' ? '#inpNumber' : '#inpNumber_2').val(res.data);
|
||||
}
|
||||
}, null, "POST").send();
|
||||
}
|
||||
|
||||
function getUser() {
|
||||
ytAjax = new YourTeam.Ajax(baseApiUrl + "/api/getUser", null, function (res) {
|
||||
if (!res || res.code != "0000" || !res.data) {
|
||||
|
||||
} else {
|
||||
$(pageAct.work_type == '1' ? '#inpWorPerId' : '#inpWorPerId_2').val(res.data);
|
||||
}
|
||||
}, null, "POST").send();
|
||||
}
|
||||
</script>
|
@ -167,7 +167,7 @@ function creSelect(id = null, cls = [], name = null, data = {}, attr = {}, text
|
||||
}
|
||||
|
||||
function creOption(text = null, value = null, data = {}, attr = {}, cls = [], name = null, id = null) {
|
||||
attr = value != null ? attr.value = value : attr;
|
||||
value != null ? attr.value = value : attr;
|
||||
return creEle("option", text, id, name, cls, data, attr);
|
||||
}
|
||||
|
||||
|
@ -166,7 +166,7 @@ function jquValAddMethod() {
|
||||
}, "請輸入正確電話號碼格式");
|
||||
|
||||
$.validator.addMethod("dbLimit", function (value, element, param) {
|
||||
return value.length > param;
|
||||
return value.length < param;
|
||||
}, "超出輸入限制");
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,8 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Image = System.Drawing.Image;
|
||||
using System.IdentityModel.Tokens.Jwt;
|
||||
using System.Net;
|
||||
|
||||
namespace FrontendWebApi.ApiControllers
|
||||
{
|
||||
@ -1403,6 +1405,33 @@ namespace FrontendWebApi.ApiControllers
|
||||
|
||||
return apiResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 獲取維修/保養 單號
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<ApiResult<string>> GetFormId()
|
||||
{
|
||||
ApiResult<string> apiResult = new ApiResult<string>();
|
||||
|
||||
try
|
||||
{
|
||||
var sqlString = $@"select formId from operation_record where convert(created_at, DATE) = convert(NOW(), DATE) order by id desc limit 1";
|
||||
var formId = await backendRepository.GetOneAsync<string>(sqlString);
|
||||
formId = formId != null ? "op" + DateTime.Now.ToString("yyyyMMdd") + (Int32.Parse(formId.Substring(10)) + 1).ToString().PadLeft(3, '0') : "op" + DateTime.Now.ToString("yyyyMMdd") + "001";
|
||||
|
||||
apiResult.Code = "0000";
|
||||
apiResult.Data = formId;
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
apiResult.Code = "9999";
|
||||
apiResult.Msg = "系統內部錯誤,請聯絡管理者。";
|
||||
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
|
||||
}
|
||||
|
||||
return apiResult;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,9 @@ using Repository.BaseRepository.Interface;
|
||||
using Repository.FrontendRepository.Interface;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IdentityModel.Tokens.Jwt;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@ -662,5 +664,16 @@ namespace FrontendWebApi.ApiControllers
|
||||
|
||||
return apiResult;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Route("api/getUser")]
|
||||
public ActionResult GetUser()
|
||||
{
|
||||
return Json(new
|
||||
{
|
||||
code = "0000",
|
||||
data = myUser.userinfo_guid
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user