|
|
@@ -1,13 +1,26 @@
|
|
|
-var test;
|
|
|
+/*
|
|
|
+ 0:自動編號 SN項次
|
|
|
+ 1:類別 圖名
|
|
|
+ 2:X 關鍵字
|
|
|
+ 3:X 版次
|
|
|
+ 4:檔案數 X
|
|
|
+ 5:計畫編號-計畫名稱 計畫編號
|
|
|
+ 6:類別ID 計畫名稱
|
|
|
+ 7:X 類別ID
|
|
|
+ 8:X 工程類別
|
|
|
+ 9:X 上一層資料夾
|
|
|
+ 10:X 檔案路徑
|
|
|
+*/
|
|
|
$(document).ready(function () {
|
|
|
- const types = ["工程概要", "工程計算書", "設計圖", "數量計算書", "工程預算書", "施工規範&特定條款", "設計報告書"];
|
|
|
+ //const types = ["工程概要", "工程計算書", "設計圖", "數量計算書", "工程預算書", "施工規範&特定條款", "設計報告書"];
|
|
|
+ var types = [];
|
|
|
var path = '';
|
|
|
var category = '';
|
|
|
var project_id = '';
|
|
|
var project_name = '';
|
|
|
var project = '';
|
|
|
var blueprint_SN = '';
|
|
|
- var blueprint_path = '';
|
|
|
+ var blueprint_path = '';
|
|
|
var notes = [];
|
|
|
var tempTable = [];
|
|
|
var tempTable2 = [];
|
|
|
@@ -162,9 +175,11 @@ $(document).ready(function () {
|
|
|
$("#project-id").val(project_id)
|
|
|
$("#header").empty();
|
|
|
category = $('#treeAjaxHTML').jstree(true).get_node(data.node.parents[0]).text;
|
|
|
+ countFiles(project_id, "false");
|
|
|
|
|
|
var span = $('<span>' + project + ' > </span>');
|
|
|
span.on("click", function (e) {
|
|
|
+ countFiles(project_id, "false");
|
|
|
displayDetail(false, true);
|
|
|
is_blueprint2 = false;
|
|
|
for (var k = folderPath.length - 1; k > 0; k--) {
|
|
|
@@ -174,23 +189,22 @@ $(document).ready(function () {
|
|
|
let i = 1;
|
|
|
table.clear().draw();
|
|
|
tempTable = [];
|
|
|
-
|
|
|
-
|
|
|
- types.forEach(function (data) {
|
|
|
- console.log(data)
|
|
|
- if(fileNums[i-1] == null){
|
|
|
+
|
|
|
+
|
|
|
+ types.forEach(function (element) {
|
|
|
+ if (fileNums[i - 1] == null) {
|
|
|
total = 0;
|
|
|
- }else{
|
|
|
- total = fileNums[i-1].total;
|
|
|
+ } else {
|
|
|
+ total = fileNums[i - 1].total;
|
|
|
}
|
|
|
let temp = [
|
|
|
i,
|
|
|
- data,
|
|
|
+ element.type_name,
|
|
|
category,
|
|
|
'',
|
|
|
total,
|
|
|
project,
|
|
|
-
|
|
|
+ element.type_id
|
|
|
];
|
|
|
table.row.add(temp).draw();
|
|
|
|
|
|
@@ -205,20 +219,21 @@ $(document).ready(function () {
|
|
|
let i = 1;
|
|
|
table.clear().draw();
|
|
|
tempTable = [];
|
|
|
- countFiles(project_id, "false");
|
|
|
- types.forEach(function (data) {
|
|
|
- if(fileNums[i-1] == null){
|
|
|
+
|
|
|
+ types.forEach(function (element) {
|
|
|
+ if (fileNums[i - 1] == null) {
|
|
|
total = 0;
|
|
|
- }else{
|
|
|
- total = fileNums[i-1].total;
|
|
|
+ } else {
|
|
|
+ total = fileNums[i - 1].total;
|
|
|
}
|
|
|
let temp = [
|
|
|
i,
|
|
|
- data,
|
|
|
+ element.type_name,
|
|
|
category,
|
|
|
'',
|
|
|
total,
|
|
|
project,
|
|
|
+ element.type_id
|
|
|
];
|
|
|
table.row.add(temp).draw();
|
|
|
tempTable.push(temp);
|
|
|
@@ -315,7 +330,7 @@ $(document).ready(function () {
|
|
|
data = ["", "", "null", "", "", "", "", "", "", ""];
|
|
|
}
|
|
|
let project_id = data[5].split("-")[0];
|
|
|
- let SN = data[0];
|
|
|
+ let SN = data[6] != null ? data[6] : 0;
|
|
|
let is_blueprint = data[1] == "設計圖" || data[1] == "成果圖" ? true : false;
|
|
|
let note = notes.includes(data[1]) ? data[1] : '';
|
|
|
|
|
|
@@ -366,34 +381,30 @@ $(document).ready(function () {
|
|
|
let type = types[parseInt(data[7]) - 1];
|
|
|
let path = '';
|
|
|
//let category = data[8];
|
|
|
- if (data[7] == 3) {
|
|
|
- path = data[8] + "/" + data[5] + "-" + data[6] + data[10];
|
|
|
- } else {
|
|
|
- path = data[8] + "/" + data[5] + "-" + data[6] + data[10];
|
|
|
- }
|
|
|
|
|
|
+ path = data[8] + "/" + data[5] + "-" + data[6] + data[10];
|
|
|
$("#plan_code").text(data[5]);
|
|
|
$("#plan_name").text(data[6]);
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
$("#version").text(data[3]);
|
|
|
$("#fileName").text(data[1]);
|
|
|
- if(path.toLowerCase().includes("pdf")){
|
|
|
+ if (path.toLowerCase().includes("pdf")) {
|
|
|
PDFObject.embed("./assets/建置資料/" + path, "#pdfFile");
|
|
|
$("#download").append('<img src="./assets/images/' + 'pdf-icon.png" style="height: 30px; display: inline-block;"> ');
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
PDFObject.embed("./assets/notPDF.pdf", "#pdfFile");
|
|
|
-
|
|
|
- if(path.toLowerCase().includes("doc")){
|
|
|
+
|
|
|
+ if (path.toLowerCase().includes("doc")) {
|
|
|
$("#download").append('<img src="./assets/images/' + 'word-icon.png" style="height: 30px; display: inline-block;"> ');
|
|
|
- }else if(path.toLowerCase().includes("xls")){
|
|
|
+ } else if (path.toLowerCase().includes("xls")) {
|
|
|
$("#download").append('<img src="./assets/images/' + 'excel-icon.png" style="height: 30px; display: inline-block;"> ');
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
- console.log( data[10]);
|
|
|
+ console.log(data[10]);
|
|
|
let fileNames = data[10].split('/');
|
|
|
- let fileName = fileNames[fileNames.length-1];
|
|
|
+ let fileName = fileNames[fileNames.length - 1];
|
|
|
$("#download").append('<a target="_blank" href="./assets/建置資料/' + path + '">' + fileName + '</a>');
|
|
|
|
|
|
}
|
|
|
@@ -401,6 +412,7 @@ $(document).ready(function () {
|
|
|
});
|
|
|
|
|
|
function displayDetail(isFile, isBlueprint) {
|
|
|
+
|
|
|
table.column(0).visible(isBlueprint);
|
|
|
table.column(2).visible(isFile);
|
|
|
table.column(3).visible(isFile);
|
|
|
@@ -410,7 +422,7 @@ $(document).ready(function () {
|
|
|
$("#SN").text("圖號");
|
|
|
$("#name").text("圖名");
|
|
|
$('.nav-tabs a[href="#pdfTab"]').tab('show');
|
|
|
- //test = table;
|
|
|
+ test = table;
|
|
|
if (table.rows().count() > 10) {
|
|
|
table.page.len(10).draw();
|
|
|
} else {
|
|
|
@@ -445,6 +457,13 @@ $(document).ready(function () {
|
|
|
.success(function (response) {
|
|
|
console.log(response);
|
|
|
fileNums = response;
|
|
|
+ types = [];
|
|
|
+ response.forEach(function (element) {
|
|
|
+ types.push({
|
|
|
+ type_id: element.type_id,
|
|
|
+ type_name: element.type_name
|
|
|
+ })
|
|
|
+ });
|
|
|
})
|
|
|
.error(function (error) {
|
|
|
console.log(error);
|
|
|
@@ -489,9 +508,9 @@ $(document).ready(function () {
|
|
|
countFiles(project_id, "true");
|
|
|
for (i = 0; i < response.length; i++) {
|
|
|
notes[i] = response[i]['notes'];
|
|
|
- if(fileNums[i] == null){
|
|
|
+ if (fileNums[i] == null) {
|
|
|
total = 0;
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
total = fileNums[i].total;
|
|
|
}
|
|
|
let temp = [
|