|
|
@@ -437,6 +437,7 @@ if (0 < $_FILES['excel']['error']) {
|
|
|
</li>
|
|
|
</ul>
|
|
|
</header>
|
|
|
+
|
|
|
<div class="row">
|
|
|
<div class="col-md-4 col-md-offset-8">
|
|
|
圖示顏色含意: <i class="fa fa-info-circle info">匯入確認頁面</i> <i class="fa fa-check-circle success">此頁面資料正確</i> <i class="fa fa-exclamation-circle warning">此頁面資料有空</i> <i class="fa fa-times-circle error">此頁面檔案路徑有誤</i>
|
|
|
@@ -463,9 +464,12 @@ if (0 < $_FILES['excel']['error']) {
|
|
|
|
|
|
</section>
|
|
|
<script type="text/javascript">
|
|
|
+ var val = [];
|
|
|
var error;
|
|
|
var tables;
|
|
|
var test;
|
|
|
+ var searchTables = [];
|
|
|
+ var tableIndex;
|
|
|
var confirmMsg = "確定要匯入嗎?";
|
|
|
var statusList = {
|
|
|
"error": false,
|
|
|
@@ -481,6 +485,18 @@ if (0 < $_FILES['excel']['error']) {
|
|
|
'error': 'fa fa-times-circle',
|
|
|
'warning': 'fa fa-exclamation-circle',
|
|
|
};
|
|
|
+ var ErrorClass = function(settings, searchData, index, rowData) {
|
|
|
+ var $td = searchTables[tableIndex].row(index).nodes().to$().find('td.ErrorClass');
|
|
|
+ return $td.length;
|
|
|
+ }
|
|
|
+ var NullClass = function(settings, searchData, index, rowData) {
|
|
|
+ var $td = searchTables[tableIndex].row(index).nodes().to$().find('td.NullClass');
|
|
|
+ return $td.length;
|
|
|
+ }
|
|
|
+ var BothClasses = function(settings, searchData, index, rowData) {
|
|
|
+ var $td = searchTables[tableIndex].row(index).nodes().to$().find('td.NullClass,td.ErrorClass');
|
|
|
+ return $td.length;
|
|
|
+ }
|
|
|
|
|
|
$(document).ready(function() {
|
|
|
const queryString = window.location.search;
|
|
|
@@ -526,10 +542,9 @@ if (0 < $_FILES['excel']['error']) {
|
|
|
if (tab == "匯入資訊") {
|
|
|
active = 'class="active"';
|
|
|
}
|
|
|
- //(statusList[status] != undefined) && (statusList[status] = true);
|
|
|
if (statusList[status] != undefined & !statusList[status]) {
|
|
|
statusList[status] = true;
|
|
|
- confirmMsg += "\n"+statusDetail[status];
|
|
|
+ confirmMsg += "\n" + statusDetail[status];
|
|
|
}
|
|
|
|
|
|
console.log(status);
|
|
|
@@ -565,16 +580,8 @@ if (0 < $_FILES['excel']['error']) {
|
|
|
errorList.shift();
|
|
|
}
|
|
|
|
|
|
- /*$('#tablepage'+i).dataTable({
|
|
|
- "createdRow": function(row, data, dataIndex) {
|
|
|
- for (j = 0; j < data.length; j++) {
|
|
|
- if (data[j] == `null`) {
|
|
|
- $(row).addClass('NullClass');
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- });*/
|
|
|
- $('#tablepage' + tab).dataTable({
|
|
|
+ searchTables[tab] = $('#tablepage' + tab).DataTable({
|
|
|
+ dom: '<"#toolbar' + tab + '">lfrtip',
|
|
|
"language": {
|
|
|
"processing": "處理中...",
|
|
|
"loadingRecords": "載入中...",
|
|
|
@@ -618,10 +625,55 @@ if (0 < $_FILES['excel']['error']) {
|
|
|
}],
|
|
|
});
|
|
|
i++;
|
|
|
+ $('#toolbar' + tab).html(`<input name="check${tab}" id="errCheck${tab}" value="error" type="radio" >顯示錯誤檔案路徑</input>
|
|
|
+ <input name="check${tab}" id="nullCheck${tab}" value="null" type="radio" >顯示未填入的資料</input>
|
|
|
+ <input name="check${tab}" id="nullCheck${tab}" value="both" type="radio" >顯示所有異常資料</input>
|
|
|
+ <input name="check${tab}" id="nullCheck${tab}" value="all" type="radio" >顯示所有資料</input>`);
|
|
|
+ /*$(`input[name='check${tab}']`).on("click", function() {
|
|
|
+ $.fn.dataTable.ext.search.pop();
|
|
|
+ if ($(this).val() == "error") {
|
|
|
+ $.fn.dataTable.ext.search.push(ErrorClass);
|
|
|
+ } else if ($(this).val() == "null") {
|
|
|
+ $.fn.dataTable.ext.search.push(NullClass);
|
|
|
+ } else if ($(this).val() == "both") {
|
|
|
+ $.fn.dataTable.ext.search.push(BothClasses);
|
|
|
+ } else {
|
|
|
+ $.fn.dataTable.ext.search.pop();
|
|
|
+ }
|
|
|
+ console.log(tab);
|
|
|
+ searchTables["3_設計圖"].draw();
|
|
|
+
|
|
|
+
|
|
|
+ });*/
|
|
|
+
|
|
|
+ if (document.querySelector(`input[name="check${tab}"]`)) {
|
|
|
+ document.querySelectorAll(`input[name="check${tab}"]`).forEach((elem) => {
|
|
|
+ elem.addEventListener("change", function(event) {
|
|
|
+ var item = event.target.value;
|
|
|
+
|
|
|
+ tableIndex = event.target.parentElement.id.split('bar')[1];
|
|
|
+ $.fn.dataTable.ext.search.pop();
|
|
|
+ if (item == "error") {
|
|
|
+ $.fn.dataTable.ext.search.push(ErrorClass);
|
|
|
+ } else if (item == "null") {
|
|
|
+ $.fn.dataTable.ext.search.push(NullClass);
|
|
|
+ } else if (item == "both") {
|
|
|
+ $.fn.dataTable.ext.search.push(BothClasses);
|
|
|
+ } else {
|
|
|
+ $.fn.dataTable.ext.search.pop();
|
|
|
+ }
|
|
|
+ console.log(tableIndex);
|
|
|
+
|
|
|
+ searchTables[tableIndex].draw();
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
});
|
|
|
}
|
|
|
|