This commit is contained in:
Kenichiro NOGI 2025-07-18 17:20:15 +09:00
parent 4ff6e12165
commit 5ecf58a26e
34 changed files with 185 additions and 25 deletions

View File

@ -120,3 +120,39 @@ $p.ex.processButtonControl = function () {
}); });
} }
//指定したサイトIDの子テーブルのステータスとコメントを変更する
$p.ex.changeChildTable = async function (siteId, statusId, comment) {
//プリザンターへゲット処理
const url = 'https://' + location.hostname + '/pleasanter/api/items/' + siteId + '/bulkupsert'
const thisId = $p.id();
const json = {
'ApiVersion': 1.1,
'ApiKey': apiKey,
'Keys': [
'ClassX'
],
'KeyNotFoundCreate': false,
'Data': [
{
'ClassHash': {
'Status': statusId,
'ClassX': thisId,
}
}
]
}
const res = await fetch(url, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(json)
});
const resData = await res.json();
//console.log(resData);
return resData.Response.Data[0];
}

View File

@ -33,7 +33,7 @@ function getMessageData() {
} }
let results = items.Get(326371, JSON.stringify(data)); let results = items.Get(326371, JSON.stringify(data));
if (results.length === 0) { if (results.Length === 0) {
context.Log('メッセージデータが見つかりませんでした。'); context.Log('メッセージデータが見つかりませんでした。');
return; return;
} }
@ -51,7 +51,7 @@ function getMessageData() {
} }
//取得したメッセージデータをhiddenに格納 //取得したメッセージデータをhiddenに格納
if (messageData.length > 0) { if (messageData.Length > 0) {
hidden.Add('messageData', JSON.stringify(messageData)); hidden.Add('messageData', JSON.stringify(messageData));
} else { } else {
context.Log('メッセージデータが見つかりませんでした。'); context.Log('メッセージデータが見つかりませんでした。');

View File

@ -215,8 +215,14 @@ $p.ex.createReportButton = function () {
}); });
} }
//tbody行数をカウント
let count = 0;
//tbody行処理 //tbody行処理
$table.find('tbody tr').each(function () { $table.find('tbody tr').each(function () {
count++;
//行が空でない場合のみ処理
const $row = $(this); const $row = $(this);
const $firstTd = $row.find('td').first(); const $firstTd = $row.find('td').first();
const value = $firstTd.text().trim(); const value = $firstTd.text().trim();
@ -254,23 +260,26 @@ $p.ex.createReportButton = function () {
$headerCb.prop('checked', !$headerCb.prop('checked')).trigger('change'); $headerCb.prop('checked', !$headerCb.prop('checked')).trigger('change');
}); });
//帳票出力ボタンを追加 //メッセージ表示
const $reportBtn = $('<button id="no3-report-btn" style="padding:5px !important; font-size:1.5em;">帳票出力</button>'); if (count > 0) {
$reportBtn.button(); //帳票出力ボタンを追加
$table.after($('<div style="margin-top:5px; text-align:right;"></div>').append($reportBtn)); const $reportBtn = $('<button id="no3-report-btn" style="padding:5px !important; font-size:1.5em;">帳票出力</button>');
$reportBtn.button();
$table.after($('<div style="margin-top:5px; text-align:right;"></div>').append($reportBtn));
//帳票出力ボタンのクリックイベントに関数を紐付け //帳票出力ボタンのクリックイベントに関数を紐付け
$('#no3-report-btn').on('click', function () { $('#no3-report-btn').on('click', function () {
//ここで取得した値を利用してレポート出力処理を実行 //ここで取得した値を利用してレポート出力処理を実行
if (confirm('依頼項目の帳票を出力しますか?')) { if (confirm('依頼項目の帳票を出力しますか?')) {
$p.ex.getCheckedReportValues(); $p.ex.getCheckedReportValues();
} }
}); });
const $reportMesssage = $('<div id="no3-report-message" style="color: red; font-weight: bold;"> ▲チェックした依頼項目をまとめて帳票に出力できます1回上限10個まで▼</div>');
$table.after($reportMesssage);
const $reportMesssage = $('<div id="no3-report-message" style="color: red; font-weight: bold;"> ▲チェックした依頼項目がまとめて帳票に出力されます▼</div>'); }
$table.after($reportMesssage);
} }
$p.ex.getCheckedReportValues = async function () { $p.ex.getCheckedReportValues = async function () {

View File

@ -30,6 +30,7 @@ async function createReport(templateId, recordData = [], templateType = 'xlsx')
//XlsPopulate Workbookを作成 //XlsPopulate Workbookを作成
let workbook = await XlsxPopulate.fromDataAsync(templateBinary); let workbook = await XlsxPopulate.fromDataAsync(templateBinary);
//paramシート取得 //paramシート取得
let param = workbook.sheet('param'); let param = workbook.sheet('param');
if (!param) { if (!param) {
@ -39,13 +40,30 @@ async function createReport(templateId, recordData = [], templateType = 'xlsx')
//レコードデータを取得 //レコードデータを取得
let col = 2; let col = 2;
let ResultIdList = [];
let uniqueIdList = [];
for (let record of recordData) { for (let record of recordData) {
Object.keys(record).forEach(function (key) { Object.keys(record).forEach(function (key) {
param = setValueToSheet(param, col, key, record[key]); param = setValueToSheet(param, col, key, record[key]);
if (key === 'ResultId') {
ResultIdList.push(record[key]);
}
if (key === 'ClassC') {
uniqueIdList.push(record[key]);
}
}); });
col++; col++;
} }
console.log('ResultIdList:', ResultIdList);
console.log('uniqueIdList:', uniqueIdList);
for(let i = 0; i < ResultIdList.length; i++) {
}
const blob = await workbook.outputAsync(); const blob = await workbook.outputAsync();
//return blob; //return blob;

View File

@ -133,7 +133,7 @@ function getMessageData() {
} }
let results = items.Get(326371, JSON.stringify(data)); let results = items.Get(326371, JSON.stringify(data));
if (results.length === 0) { if (results.Length === 0) {
context.Log('メッセージデータが見つかりませんでした。'); context.Log('メッセージデータが見つかりませんでした。');
return; return;
} }
@ -151,7 +151,7 @@ function getMessageData() {
} }
//取得したメッセージデータをhiddenに格納 //取得したメッセージデータをhiddenに格納
if (messageData.length > 0) { if (messageData.Length > 0) {
hidden.Add('messageData', JSON.stringify(messageData)); hidden.Add('messageData', JSON.stringify(messageData));
} else { } else {
context.Log('メッセージデータが見つかりませんでした。'); context.Log('メッセージデータが見つかりませんでした。');

View File

@ -192,7 +192,7 @@ function getMessageData() {
} }
let results = items.Get(326371, JSON.stringify(data)); let results = items.Get(326371, JSON.stringify(data));
if (results.length === 0) { if (results.Length === 0) {
//context.Log('メッセージデータが見つかりませんでした。'); //context.Log('メッセージデータが見つかりませんでした。');
return; return;
} }
@ -210,7 +210,7 @@ function getMessageData() {
} }
//取得したメッセージデータをhiddenに格納 //取得したメッセージデータをhiddenに格納
if (messageData.length > 0) { if (messageData.Length > 0) {
hidden.Add('messageData', JSON.stringify(messageData)); hidden.Add('messageData', JSON.stringify(messageData));
} else { } else {
//context.Log('メッセージデータが見つかりませんでした。'); //context.Log('メッセージデータが見つかりませんでした。');

View File

@ -48,8 +48,8 @@ let templateFiles = {
}; };
//let userList = {}; let userList = {};
let userList = $('#userList').length > 0 ? JSON.parse($('#userList').val()) : {}; //let userList = $('#userList').length > 0 ? JSON.parse($('#userList').val()) : {};
let syukyaku = {}; let syukyaku = {};
let tenpoList = {}; let tenpoList = {};
@ -142,8 +142,8 @@ function onLoad() {
houjinCheck2(); houjinCheck2();
getUserList(0);
//getUserList(0);
flag = 0; flag = 0;
createShiharaiGrid(); createShiharaiGrid();
createMitsumoriGrid(); createMitsumoriGrid();
@ -248,6 +248,7 @@ function getKeiyakuCodeData() {
} }
function getTenpoTable() { function getTenpoTable() {
/*
$p.apiGet({ $p.apiGet({
'id': '96243', 'id': '96243',
'data': { 'data': {
@ -266,6 +267,53 @@ function getTenpoTable() {
}, },
}); });
*/
let tenpoListStr = $('#tenpoList').length > 0 ? JSON.parse($('#tenpoList').val()) : [];
for (tenpo of tenpoListStr) {
tenpoList[tenpo.ResultId] = {
'ResultId': tenpo.ResultId,
'ShopName': tenpo.ShopName,
'ShopName0': tenpo.ShopName0,
'QRFile': tenpo.QRFile,
'QRGuid': tenpo.QRGuid,
}
}
if ($('#Results_ClassF').val()) {
let tenpoId = $('#Results_ClassF').val();
if (tenpoList[tenpoId]) {
console.log(tenpoList[tenpoId]);
let guid = tenpoList[tenpoId].QRGuid;
if (guid) {
let downloadUrl = '/pleasanter/binaries/' + guid + '/download';
let button = document.createElement('button');
button.type = 'button';
button.id = 'openQRCodeFile';
button.innerHTML = 'Google口コミQRコードDL';
button.setAttribute('onclick', 'window.open("' + downloadUrl + '", "_blank")');
button.style.margin = '5px';
$('#reportButtons').append(button);
$('#openQRCodeFile').button({
icon: 'ui-icon-image'
});
} else {
console.log('QRコードファイルがありません。');
}
} else {
console.log('該当する店舗IDがありません。');
}
} else {
console.log('店舗IDが設定されていません。');
}
//console.log(tenpoList);
} }
//添付ファイル入力欄にコメントを追加する汎用関数 //添付ファイル入力欄にコメントを追加する汎用関数

View File

@ -7,7 +7,6 @@
@siteTitles : マスターシート @siteTitles : マスターシート
@disabled: false @disabled: false
*/ */
let myData; let myData;
let arariData; let arariData;
@ -373,6 +372,8 @@ function customizeReport(guid, templateName) {
workbook.sheet('param').cell('C18').value(data003.ClassHash.ClassF); workbook.sheet('param').cell('C18').value(data003.ClassHash.ClassF);
workbook.sheet('param').cell('C19').value(eigyo1); workbook.sheet('param').cell('C19').value(eigyo1);
workbook.sheet('param').cell('C20').value(keiyakuDateStr);
break; break;
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
//4.御提案書 //4.御提案書

View File

@ -10,11 +10,14 @@
try { try {
//context.Log('汎用ユーザーリスト取得スクリプトを実行します。'); //context.Log('汎用ユーザーリスト取得スクリプトを実行します。');
getUserList(); //getUserList();
//自分のデータの取得取得 //自分のデータの取得取得
//getMyData(); //getMyData();
//店舗リストの取得
getTenpoList()
} catch (error) { } catch (error) {
context.Log(error); context.Log(error);
} }
@ -58,3 +61,48 @@ function getMyData() {
//context.Log($ps.JSON.stringify(model)); //context.Log($ps.JSON.stringify(model));
} }
function getTenpoList() {
let data = {
"View": {
"ColumnSorterHash": {
"ClassI": "asc",
"Title": "asc",
}
}
}
let results = items.Get(96243, JSON.stringify(data));
context.Log(`取得した店舗の件数: ${results.Length}`);
if (results.Length === 0) {
context.Log('店舗データが見つかりませんでした。1');
return;
}
let tenpoList = []
for (let item of results) {
let QRFile = '';
let QRGuid = '';
for (let file of item.AttachmentsA) {
//context.Log(`添付ファイル名: ${file.Name}`);
QRFile = file.Name;
QRGuid = file.Guid;
}
tenpoList.push({
'ResultId': item.ResultId,
'ShopName0': item.Title,
'ShopName': item.ClassT,
'QRFile': QRFile,
'QRGuid': QRGuid,
});
}
//取得したメッセージデータをhiddenに格納
if (tenpoList.length > 0) {
hidden.Add('tenpoList', JSON.stringify(tenpoList));
} else {
context.Log('店舗データが見つかりませんでした。2');
}
}