You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

469 lines
12 KiB

<?php
include "header.php";
$depart_id = accountidToDepartId($user_id);
$dt_setup = array(
"columns" => array(
array(
"key" => "SEQ",
"field" => "id",
"label" => "項次",
"style" => "",
"width" => "60",
),
array(
"key" => "create_at",
"field" => "create_at",
"label" => "反饋日期",
"style" => "",
"width" => "120",
),
array(
"key" => "facilityno",
"field" => "facilityno",
"label" => "電梯編號",
"style" => "",
"width" => "120",
),
array(
"key" => "onsite_name",
"field" => "sitename",
"label" => "現場名稱",
"style" => "",
"width" => "120",
),
array(
"key" => "onsite_address",
"field" => "siteaddress",
"label" => "現場地址",
"style" => "",
"width" => "180",
),
array(
"key" => "creater",
"field" => "creater",
"label" => "不良單填單人員",
"style" => "",
"width" => "120",
),
array(
"key" => "describe",
"field" => "ngdescribe",
"label" => "簡述不良內容",
"style" => "",
"width" => "180",
),
array(
"key" => "ngimage",
"field" => "ngimage",
"label" => "照片上傳",
"style" => "",
"width" => "180",
),
array(
"key" => "verify",
"field" => "verify",
"label" => "品證人員",
"style" => "",
"width" => "120",
),
array(
"key" => "investigation_reason",
"field" => "investigationreason",
"label" => "現場調查原因",
"style" => "",
"width" => "180",
),
array(
"key" => "countermeasure",
"field" => "countermeasure",
"label" => "對策方式及再發防止",
"style" => "",
"width" => "180",
),
array(
"key" => "responsible_depart",
"field" => "responsibledepartment",
"label" => "判定責任單位",
"style" => "",
"width" => "120",
),
array(
"key" => "responsible_depart_leader",
"field" => "responsibledepartmentleader",
"label" => "責任單位主管",
"style" => "",
"width" => "120",
),
array(
"key" => "responsible_depart_responder",
"field" => "responder",
"label" => "責任單位回覆人",
"style" => "",
"width" => "120",
),
array(
"key" => "progress",
"field" => "progress",
"label" => "處理進度",
"style" => "",
"width" => "120",
),
array(
"key" => "reply_time",
"field" => "reply_at",
"label" => "回覆時間",
"style" => "",
"width" => "120",
),
array(
"key" => "reply_history",
"field" => "replyhistory",
"label" => "責任單位回覆",
"style" => "",
"width" => "360",
),
array(
"key" => "update_time",
"field" => "update_at",
"label" => "更新時間",
"style" => "",
"width" => "120",
),
array(
"key" => "reviewresult",
"field" => "reviewresult",
"label" => "判定結果",
"style" => "",
"width" => "120",
),
array(
"key" => "ngfeedback_type",
"field" => "ngfeedback_type",
"label" => "判定種類",
"style" => "",
"width" => "80",
),
array(
"key" => "responsiblesupplier",
"field" => "responsiblesupplier",
"label" => "責任供應商",
"style" => "",
"width" => "120",
),
array(
"key" => "closer",
"field" => "closer",
"label" => "結案人員",
"style" => "",
"width" => "120",
),
array(
"key" => "close_time",
"field" => "close_at",
"label" => "結案時間",
"style" => "",
"width" => "120",
),
),
"datas" => array()
);
$progress = array(
"0" => "待判定",
"1" => "待處理",
"2" => "處理中",
"9" => "已完成"
);
$result = array(
"N" => "判定不良品",
"G" => "判定良品"
);
$sql = "
select *,
f_return_account_name(verify) as verify_name,
f_return_account_name(creater) as creater_name,
f_return_account_name(responsibledepartmentleader) as responsibledepartmentleader_name,
f_return_account_name(responder) as responder_name,
f_return_account_name(closer) as closer_name,
f_return_department_name(responsibledepartment) as responsibledepartment_name
from ngfeedback
";
if(accountidToDepartId($user_id !== '912')){
$sql .= sql_myself($user_id);
}
$rtn = mysqli_query($link, $sql);
$dt_setup["datas"] = mysqli_fetch_all($rtn, MYSQLI_ASSOC);
// 結束連線
mysqli_close($link);
if ($user_auth&2) {
?>
<p><a href="ngfeedback-create.php?function_name=ngfeedback&<?php echo $token_link; ?>" class="btn btn-info btn-sm" style="margin-left: 12px"> <span class="glyphicon glyphicon-plus"></span></a></p>
<?php
}
?>
<style>
table {
table-layout:fixed;
width: 100%;
}
td {
word-wrap:break-word;
}
img {
width:125px;
}
.width_style_1 {
width:125px;
}
table{
width:100%;
}
#table_index_filter{
float:right;
}
#table_index_paginate{
float:right;
}
label {
display: inline-flex;
margin-bottom: .5rem;
margin-top: .5rem;
}
.dataTables_scrollHead .dataTable {
margin-bottom: -2px;
}
.dataTables_scrollBody .dataTable {
margin-bottom: 0;
}
td[key=ngimage] > img {
width: 163px;
}
.middle-center {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
transform-origin:50% 50%;
text-align: center;
}
#dialog_pic {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background: rgba(0, 0, 0, 0.65);
z-index: 99;
display: none;
}
#dialog_pic > .dialog-body {
width: auto;
max-width: 96%;
max-height: 96%;
padding: 12px;
background: var(--bs-white, #fff);
border-radius: 6px;
overflow: auto;
}
#dialog_pic > .dialog-body > img {
width: 100%;
height: 100%;
object-fit: contain;
}
td[key=reply_history] > div {
white-space: pre-line;
}
@media screen and (max-width: 600px) {
table {
border: 0;
}
table thead {
display: none;
}
table tr {
margin-bottom: 10px;
display: block;
border-bottom: 2px solid #ddd;
}
table td {
display: block;
text-align: right;
font-size: 14px;
border-bottom: 1px dotted #ccc;
width: 100%;
min-height: 36px;
}
table td:last-child {
border-bottom: 0;
}
table td:before {
content: attr(data-label);
float: left;
text-transform: uppercase;
font-weight: bold;
}
#dialog_pic > .dialog-body {
width: 100%;
}
}
</style>
<div style="overflow-x:auto;">
<table id="table_index" class="table table-striped table-bordered" style="width:100%">
<thead>
<tr>
<?php
foreach ($dt_setup["columns"] as $col) {
echo "<th key='".$col["key"]."' width='".$col["width"]."' style='".$col["style"]."'>".$col["label"]."</th>";
}
?>
</tr>
</thead>
<tbody>
<?php
foreach($dt_setup["datas"] as $row) {
echo "<tr>";
foreach ($dt_setup["columns"] as $col) {
echo "<td key='".$col["key"]."' width='".$col["width"]."' data-label='".$col["label"]."' style='".$col["style"]."'>";
switch ($col["field"]) {
case "ngimage":
echo "<img class='image-fluid result_pics zoom' src='..".$row[$col["field"]]."'/>";
break;
case "reviewresult":
if (!$row["reviewresult"] && $row["progress"] == "9" && in_array($depart_id, array("220", "912"))) {
echo "<a href=\"ngfeedback-update.php?function_name=ngfeedback&no=".$row["id"]."&$token_link\" class='btn btn-info btn-sm'><span style='font-size: 1.125em; font-weight: 600;'>品證人員填寫</span></a>";
break;
}
case "verify":
if ($col["field"] == "verify" && !$row["verify"] && in_array($depart_id, array("220", "912"))) {
echo "<a href=\"ngfeedback-update.php?function_name=ngfeedback&no=".$row["id"]."&$token_link\" class='btn btn-info btn-sm'><span style='font-size: 1.125em; font-weight: 600;'>品證人員填寫</span></a>";
break;
}
case "responder":
if (!in_array($row["progress"], array("0", "9")) && $col["field"] == "responder" && $row["responder"] && ($depart_id == "220" || $row["responder"] == $user_id)) {
echo "<a href=\"ngfeedback-update-reply.php?function_name=ngfeedback&no=".$row["id"]."&$token_link\" class='btn btn-info btn-sm'><span style='font-size: 1.125em; font-weight: 600;'>".$row["responder"]." 填寫</span></a>";
break;
}
default:
if (in_array($col["field"], array("creater", "verify", "responsibledepartmentleader", "responsibledepartment", "responder", "closer"))) {
echo "<div>".implode(" ", array($row[$col["field"]], $row[$col["field"]."_name"]))."</div>";
} else if ($col["field"] == "progress" && isset($progress[$row[$col["field"]]])) {
echo "<div data-progress='".$row[$col["field"]]."'>".$progress[$row[$col["field"]]]."</div>";
} else if ($col["field"] == "reviewresult" && isset($result[$row[$col["field"]]])) {
echo "<div data-result='".$row[$col["field"]]."'>".$result[$row[$col["field"]]]."</div>";
} else {
echo "<div>".$row[$col["field"]]."</div>";
}
}
echo "</td>";
}
echo "</tr>";
}
?>
</tbody>
</table>
</div>
<div id="dialog_pic">
<div class="dialog-body middle-center">
<img src="#" style="width: 100%; height: auto;"/>
</div>
</div>
<script>
var searchContent = "";
var showNum = 10;
var nowPage = 1;
var table = $('#table_index').DataTable({
"scrollX": true,
/*
"language": {
"emptyTable": "無資料...",
"processing": "處理中...",
"loadingRecords": "載入中...",
"lengthMenu": "顯示_MENU_ 筆",
"zeroRecords": "沒有符合的結果",
"info": "第 _START_ 至 _END_ 項,共 _TOTAL_ 項",
"infoEmpty": "第 0 至 0 項,共 0 項",
"infoFiltered": "(從 _MAX_ 項結果中過濾)",
"infoPostFix": "",
"search": "",
"paginate": {
"first": "第一頁",
"previous": "上一頁",
"next": "下一頁",
"last": "最後一頁"
},
"aria": {
"sortAscending": ": 升冪排列",
"sortDescending": ": 降冪排列"
}
}
*/
}, {
"order": [
[4, "desc"],
[8, "asc"]
]
});
// var table = $('#table_index').DataTable();
table.search(searchContent).draw();
table.page.len(showNum).draw();
table.page((nowPage) - 1).draw('page');
// 監聽頁碼
table.on('page.dt', function() {
searchDatatable(table);
});
// 監聽資料筆數
table.on('length.dt', function(e, settings, len) {
searchDatatable(table);
});
// 監聽搜尋事件
$("#table_index_filter > label > input").change(function() {
searchDatatable(table);
});
function searchDatatable(table) {
showNum = table.page.len();
nowPage = table.page.info().page + 1;
searchContent = table.search();
/*
window.location.href = "<?php echo "wipwhole-index.php?function_name=wipinstall&$token_link"; ?>" +
"&showNum=" + showNum + "&nowPage=" + nowPage + "&searchContent=" + searchContent + "&sheetNum=" + sheetNum +
"&contractno=" + contractno + "&facilityno=" + facilityno + "&custom=" + custom +
"&site_survey_contact_verify=" + site_survey_contact_verify + "&real_contract_arrival_date_start=" + real_contract_arrival_date_start +
"&real_contract_arrival_date_end=" + real_contract_arrival_date_end + "&area_no=" + area_no;
*/
}
$(function() {
$('img.zoom').on('click', function() {
$('#dialog_pic img').attr("src", $(this).attr("src"));
$('#dialog_pic').show();
});
// 点击显示的大图,触发事件,当触发当前页面内里任何处位置,就会隐藏显示的大图
$('#dialog_pic').on('click', function() {
$(this).hide();
});
});
</script>