ken_nogi/pleasanter/develop/★MSS/★マスターシート/sites/scripts/13.確認申請関連資料格納状況確認処理.js
Kenichiro NOGI 7176dc33ec pleasanter
2025-07-10 10:15:35 +09:00

149 lines
5.4 KiB
JavaScript

/*
@config : next999.json
@filename : ${psFileBasename}
@title : 13.確認申請関連資料格納状況確認処理
@name :
@siteIds : 189112
@siteTitles : ★マスターシート
@disabled: false
*/
/*
営業作成敷地調査報告書 Results_Attachments081
営業取得資料⼀式 Results_Attachments084
道路関係 Results_Attachments086
上下⽔道関係 Results_Attachments087
災害マップ Results_Attachments096
申請地資料 Results_Attachments094
住宅地図 Results_Attachments098
現況写真 Results_Attachments099
*/
/*
お客様データファイルの該当項目のファイルの格納状況調査する
格納されているファイルの一覧をテーブル化してMSS編集画面に表示する
すべての項目に1つ以上のファイルが格納されていない場合、申請失敗させる
SectionFields85Container
*/
function getNo9_Files() {
let dataFileId = $("#Results_Class194").val();
let attachFiles;
let attachList = [
"Attachments081",
"Attachments084",
"Attachments086",
"Attachments087",
"Attachments096",
"Attachments094",
"Attachments098",
"Attachments099"
];
let attachListName = {
"Attachments081": { Name: "営業作成敷地調査報告書", Files: [], Guid: [] },
"Attachments084": { Name: "営業取得資料⼀式", Files: [], Guid: [] },
"Attachments086": { Name: "道路関係", Files: [], Guid: [] },
"Attachments087": { Name: "上下⽔道関係", Files: [], Guid: [] },
"Attachments096": { Name: "災害マップ", Files: [], Guid: [] },
"Attachments094": { Name: "申請地資料", Files: [], Guid: [] },
"Attachments098": { Name: "住宅地図", Files: [], Guid: [] },
"Attachments099": { Name: "現況写真", Files: [], Guid: [] }
};
//お客様データファイルの取得
if (dataFileId != "" && dataFileId != "212512") {
$p.apiGet({
'id': dataFileId,
'data': {
'ApiVersion': 1.1,
'ApiKey': apiKey,
},
//'async': false,
'done': function (data) {
attachFiles = data.Response.Data[0];
//console.log(attachFiles);
if (data.Response.TotalCount >= 1) {
attachList.forEach(function (attachName) {
//console.log(attachFiles.AttachmentsHash[attachName]);
attachFiles.AttachmentsHash[attachName].forEach((file) => {
attachListName[attachName].Files.push(file.Name);
attachListName[attachName].Guid.push(file.Guid);
});
});
}
//お客様データファイルが該当データのファイル名一式取得
//console.log(attachListName);
$("#fileListTable").remove();
//保管数チェック
let checkFlag = 1;
//格納HTML作成
let table = document.createElement("table");
table.classList.add("fileListTable");
table.id = "fileListTable";
attachList.forEach(function (attachName) {
let tr = document.createElement("tr");
let td1 = document.createElement("td");
td1.classList.add("fileListTable_td1")
td1.innerHTML = attachListName[attachName].Name;
let td2 = document.createElement("td");
//let files = attachListName[attachName].Files.join("<br>");
if (attachListName[attachName].Files.length > 0) {
for (i = 0; i < attachListName[attachName].Files.length; i++) {
let fileName = attachListName[attachName].Files[i];
let guid = attachListName[attachName].Guid[i];
let show = document.createElement("a");
let span = document.createElement("span");
show.href = "/pleasanter/binaries/" + guid + "/show";
show.target = "_blank"
span.classList = "ui-icon ui-icon-circle-zoomin";
show.append(span);
td2.append(show);
let link = document.createElement("a");
link.innerHTML = fileName;
link.href = "/pleasanter/binaries/" + guid + "/download";
td2.append(link);
let br = document.createElement("br");
td2.append(br);
}
} else {
//1つでもファイル無しのフォルダがあったら0設定
checkFlag = 0;
}
td2.classList.add("fileListTable_td2")
//td2.innerHTML = files;
tr.append(td1);
tr.append(td2);
table.append(tr);
$p.set($("#Results_Class119"), checkFlag);
});
//console.log(table);
$("#SectionFields85").append(table);
},
'fail': function (data) {
console.log(data);
}
});
}
}