109 lines
2.5 KiB
JavaScript
109 lines
2.5 KiB
JavaScript
try {
|
|
//パターンデータ取得
|
|
getPatternTable();
|
|
|
|
//カテゴリデータ取得
|
|
getCategoryTable();
|
|
|
|
|
|
} catch (error) {
|
|
context.Log(error);
|
|
}
|
|
|
|
//パターンデータ取得
|
|
function getPatternTable() {
|
|
//パターンデータを取得
|
|
let data = {
|
|
"View": {
|
|
"ColumnSorterHash": {
|
|
"ClassA": "asc"
|
|
}
|
|
}
|
|
}
|
|
|
|
let results = items.Get(380479, JSON.stringify(data));
|
|
if (results.Length === 0) {
|
|
context.Log('パターンデータが見つかりませんでした 1');
|
|
return;
|
|
}
|
|
|
|
let patternData = {};
|
|
let count = 0;
|
|
for (let item of results) {
|
|
const code = item.ClassA;
|
|
const name = item.ClassB;
|
|
const color = item.ClassC;
|
|
let bgColor;
|
|
let fontColor;
|
|
if (color) {
|
|
bgColor = color.split('-')[0];
|
|
fontColor = color.split('-')[1];
|
|
}
|
|
|
|
patternData[code] = {
|
|
"code": code,
|
|
"name": name,
|
|
"bgColor": bgColor,
|
|
"fontColor": fontColor
|
|
}
|
|
|
|
count++;
|
|
}
|
|
|
|
//取得したパターンデータをhiddenに格納
|
|
if (count > 0) {
|
|
hidden.Add('patternData', JSON.stringify(patternData));
|
|
} else {
|
|
context.Log('パターンデータが見つかりませんでした 2');
|
|
}
|
|
|
|
}
|
|
|
|
//カテゴリデータ取得
|
|
function getCategoryTable() {
|
|
//カテゴリデータを取得
|
|
let data = {
|
|
"View": {
|
|
"ColumnSorterHash": {
|
|
"ClassA": "asc"
|
|
}
|
|
}
|
|
}
|
|
|
|
let results = items.Get(380497, JSON.stringify(data));
|
|
if (results.Length === 0) {
|
|
context.Log('カテゴリデータが見つかりませんでした 1');
|
|
return;
|
|
}
|
|
|
|
let categoryData = {};
|
|
let count = 0;
|
|
for (let item of results) {
|
|
const code = item.ClassA;
|
|
const name = item.ClassB;
|
|
const color = item.ClassC;
|
|
let bgColor;
|
|
let fontColor;
|
|
if (color) {
|
|
bgColor = color.split('-')[0];
|
|
fontColor = color.split('-')[1];
|
|
}
|
|
|
|
categoryData[code] = {
|
|
"code": code,
|
|
"name": name,
|
|
"bgColor": bgColor,
|
|
"fontColor": fontColor
|
|
}
|
|
|
|
count++;
|
|
}
|
|
|
|
//取得したカテゴリデータをhiddenに格納
|
|
if (count > 0) {
|
|
hidden.Add('categoryData', JSON.stringify(categoryData));
|
|
} else {
|
|
context.Log('カテゴリデータが見つかりませんでした 2');
|
|
}
|
|
|
|
} |