データ取得処理条件式対応
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
import type { SavedData } from "@/types/model";
|
||||
import type { Field, FieldLayout, SavedData } from "@/types/model";
|
||||
import { KintoneIndexEventHandler } from "./KintoneIndexEventHandler";
|
||||
|
||||
(function (PLUGIN_ID) {
|
||||
kintone.events.on('app.record.index.show', (event) => {
|
||||
const setting = kintone.plugin.app.getConfig(PLUGIN_ID);
|
||||
const config:SavedData = getConfig(setting);
|
||||
const handler = new KintoneIndexEventHandler(config);
|
||||
const config:SavedData<FieldLayout> = getConfig(setting);
|
||||
const currentApp = kintone.app.getId()?.toString();
|
||||
if(!currentApp) return;
|
||||
const handler = new KintoneIndexEventHandler(config,currentApp);
|
||||
handler.init();
|
||||
return event;
|
||||
});
|
||||
@@ -14,106 +16,252 @@ import { KintoneIndexEventHandler } from "./KintoneIndexEventHandler";
|
||||
* @param setting
|
||||
* @returns
|
||||
*/
|
||||
function getConfig(setting:any):SavedData{
|
||||
const config:SavedData={
|
||||
function getConfig(setting:any):SavedData<FieldLayout>{
|
||||
const config:SavedData<FieldLayout>={
|
||||
buttonName:setting.buttonName,
|
||||
joinTables:JSON.parse(setting.joinTables)
|
||||
}
|
||||
return config;
|
||||
}
|
||||
|
||||
function getTestSetting(config:SavedData):SavedData{
|
||||
const mainTable = {
|
||||
id:12345,
|
||||
app:"140",
|
||||
onConditions:[
|
||||
{
|
||||
leftField:"文字列__1行_",
|
||||
rightField:"文字列__1行_"
|
||||
}
|
||||
],
|
||||
fieldsMapping:[{
|
||||
leftField:"",
|
||||
rightField:""
|
||||
},
|
||||
{
|
||||
leftField:"",
|
||||
rightField:""
|
||||
}
|
||||
],
|
||||
table:"",
|
||||
whereConditions:[
|
||||
{
|
||||
field:"",
|
||||
condition:"",
|
||||
data:""
|
||||
}
|
||||
]
|
||||
};
|
||||
const leftJoinTable1 = {
|
||||
id:12345,
|
||||
app:"140",
|
||||
onConditions:[
|
||||
{
|
||||
leftField:"文字列__1行_",
|
||||
rightField:"文字列__1行_"
|
||||
}
|
||||
],
|
||||
fieldsMapping:[{
|
||||
leftField:"",
|
||||
rightField:""
|
||||
},
|
||||
{
|
||||
leftField:"",
|
||||
rightField:""
|
||||
}
|
||||
],
|
||||
table:"",
|
||||
whereConditions:[
|
||||
{
|
||||
field:"",
|
||||
condition:"",
|
||||
data:""
|
||||
}
|
||||
]
|
||||
};
|
||||
const leftJoinTable2 = {
|
||||
id:12345,
|
||||
app:"140",
|
||||
onConditions:[
|
||||
{
|
||||
leftField:"文字列__1行_",
|
||||
rightField:"文字列__1行_"
|
||||
}
|
||||
],
|
||||
fieldsMapping:[{
|
||||
leftField:"",
|
||||
rightField:""
|
||||
},
|
||||
{
|
||||
leftField:"",
|
||||
rightField:""
|
||||
}
|
||||
],
|
||||
table:"",
|
||||
whereConditions:[
|
||||
{
|
||||
field:"",
|
||||
condition:"",
|
||||
data:""
|
||||
}
|
||||
]
|
||||
};
|
||||
const retConfig :SavedData ={
|
||||
buttonName : config.buttonName,
|
||||
joinTables:[
|
||||
mainTable,
|
||||
leftJoinTable1,
|
||||
leftJoinTable2
|
||||
]
|
||||
};
|
||||
return retConfig;
|
||||
}
|
||||
// function getTestSetting(config:SavedData):SavedData{
|
||||
// const retConfig :SavedData<FieldLayout> ={
|
||||
// "buttonName": "集約する",
|
||||
// "joinTables": [
|
||||
// {
|
||||
// "id": "m6c69ojr-bx9l8n9fm",
|
||||
// "app": "140",
|
||||
// "table": "",
|
||||
// "onConditions": [
|
||||
// {
|
||||
// "leftField": "",
|
||||
// "rightField": "",
|
||||
// "id": "m6c69ojr-7pho6voer"
|
||||
// }
|
||||
// ],
|
||||
// "fieldsMapping": [
|
||||
// {
|
||||
// "leftField": {
|
||||
// "type": "SINGLE_LINE_TEXT",
|
||||
// "code": "文字列__1行_",
|
||||
// "label": "社員番号",
|
||||
// "noLabel": false,
|
||||
// "required": false,
|
||||
// "minLength": "",
|
||||
// "maxLength": "",
|
||||
// "expression": "",
|
||||
// "hideExpression": false,
|
||||
// "unique": false,
|
||||
// "defaultValue": ""
|
||||
// },
|
||||
// "rightField": {
|
||||
// "type": "SINGLE_LINE_TEXT",
|
||||
// "code": "文字列__1行_",
|
||||
// "label": "社員番号",
|
||||
// "noLabel": false,
|
||||
// "required": false,
|
||||
// "minLength": "",
|
||||
// "maxLength": "",
|
||||
// "expression": "",
|
||||
// "hideExpression": false,
|
||||
// "unique": false,
|
||||
// "defaultValue": ""
|
||||
// },
|
||||
// "id": "m6c69ojr-i75a82qvb"
|
||||
// },
|
||||
// {
|
||||
// "leftField": {
|
||||
// "type": "SINGLE_LINE_TEXT",
|
||||
// "code": "文字列__1行__0",
|
||||
// "label": "氏名",
|
||||
// "noLabel": false,
|
||||
// "required": false,
|
||||
// "minLength": "",
|
||||
// "maxLength": "",
|
||||
// "expression": "",
|
||||
// "hideExpression": false,
|
||||
// "unique": false,
|
||||
// "defaultValue": ""
|
||||
// },
|
||||
// "rightField": {
|
||||
// "type": "SINGLE_LINE_TEXT",
|
||||
// "code": "文字列__1行__0",
|
||||
// "label": "氏名",
|
||||
// "noLabel": false,
|
||||
// "required": false,
|
||||
// "minLength": "",
|
||||
// "maxLength": "",
|
||||
// "expression": "",
|
||||
// "hideExpression": false,
|
||||
// "unique": false,
|
||||
// "defaultValue": ""
|
||||
// },
|
||||
// "id": "m6c6v8sp-7yw58m6e9"
|
||||
// }
|
||||
// ],
|
||||
// "whereConditions": [
|
||||
// {
|
||||
// "field": "",
|
||||
// "condition": "",
|
||||
// "data": "",
|
||||
// "id": "m6c69ojr-az5k7bvp6"
|
||||
// }
|
||||
// ]
|
||||
// },
|
||||
// {
|
||||
// "id": "m6c6u15u-yq4kzp31c",
|
||||
// "app": "141",
|
||||
// "table": "使用者テーブル",
|
||||
// "onConditions": [
|
||||
// {
|
||||
// "leftField": {
|
||||
// "type": "SINGLE_LINE_TEXT",
|
||||
// "code": "社員番号",
|
||||
// "label": "社員番号",
|
||||
// "noLabel": false,
|
||||
// "required": false,
|
||||
// "minLength": "",
|
||||
// "maxLength": "",
|
||||
// "expression": "",
|
||||
// "hideExpression": false,
|
||||
// "unique": false,
|
||||
// "defaultValue": ""
|
||||
// },
|
||||
// "rightField": {
|
||||
// "type": "SINGLE_LINE_TEXT",
|
||||
// "code": "文字列__1行_",
|
||||
// "label": "社員番号",
|
||||
// "noLabel": false,
|
||||
// "required": false,
|
||||
// "minLength": "",
|
||||
// "maxLength": "",
|
||||
// "expression": "",
|
||||
// "hideExpression": false,
|
||||
// "unique": false,
|
||||
// "defaultValue": ""
|
||||
// },
|
||||
// "id": "m6c6ue5e-k7yibisue"
|
||||
// }
|
||||
// ],
|
||||
// "fieldsMapping": [
|
||||
// {
|
||||
// "leftField": {
|
||||
// "type": "SINGLE_LINE_TEXT",
|
||||
// "code": "氏名",
|
||||
// "label": "氏名",
|
||||
// "noLabel": false,
|
||||
// "required": false,
|
||||
// "minLength": "",
|
||||
// "maxLength": "",
|
||||
// "expression": "",
|
||||
// "hideExpression": false,
|
||||
// "unique": false,
|
||||
// "defaultValue": ""
|
||||
// },
|
||||
// "rightField": {
|
||||
// "type": "SINGLE_LINE_TEXT",
|
||||
// "code": "文字列__1行__0",
|
||||
// "label": "氏名",
|
||||
// "noLabel": false,
|
||||
// "required": false,
|
||||
// "minLength": "",
|
||||
// "maxLength": "",
|
||||
// "expression": "",
|
||||
// "hideExpression": false,
|
||||
// "unique": false,
|
||||
// "defaultValue": ""
|
||||
// },
|
||||
// "id": "m6c6ue5e-bjdpae18q"
|
||||
// }
|
||||
// ],
|
||||
// "whereConditions": [
|
||||
// {
|
||||
// "field": "",
|
||||
// "condition": "",
|
||||
// "data": "",
|
||||
// "id": "m6c6ue5e-1rf2v4l9m"
|
||||
// }
|
||||
// ]
|
||||
// },
|
||||
// {
|
||||
// "id": "m6c6vrso-vr7a7v5h1",
|
||||
// "app": "143",
|
||||
// "table": "テーブル",
|
||||
// "onConditions": [
|
||||
// {
|
||||
// "leftField": {
|
||||
// "type": "SINGLE_LINE_TEXT",
|
||||
// "code": "文字列__1行__1",
|
||||
// "label": "資産管理番号",
|
||||
// "noLabel": false,
|
||||
// "required": false,
|
||||
// "minLength": "",
|
||||
// "maxLength": "",
|
||||
// "expression": "",
|
||||
// "hideExpression": false,
|
||||
// "unique": false,
|
||||
// "defaultValue": ""
|
||||
// },
|
||||
// "rightField": {
|
||||
// "type": "SINGLE_LINE_TEXT",
|
||||
// "code": "文字列__1行__1",
|
||||
// "label": "資産管理番号",
|
||||
// "noLabel": false,
|
||||
// "required": false,
|
||||
// "minLength": "",
|
||||
// "maxLength": "",
|
||||
// "expression": "",
|
||||
// "hideExpression": false,
|
||||
// "unique": false,
|
||||
// "defaultValue": ""
|
||||
// },
|
||||
// "id": "m6c6vx94-02xbd48xt"
|
||||
// }
|
||||
// ],
|
||||
// "fieldsMapping": [
|
||||
// {
|
||||
// "leftField": {
|
||||
// "type": "SINGLE_LINE_TEXT",
|
||||
// "code": "文字列__1行__2",
|
||||
// "label": "資産名",
|
||||
// "noLabel": false,
|
||||
// "required": false,
|
||||
// "minLength": "",
|
||||
// "maxLength": "",
|
||||
// "expression": "",
|
||||
// "hideExpression": false,
|
||||
// "unique": false,
|
||||
// "defaultValue": ""
|
||||
// },
|
||||
// "rightField": {
|
||||
// "type": "SINGLE_LINE_TEXT",
|
||||
// "code": "文字列__1行__2",
|
||||
// "label": "資産名",
|
||||
// "noLabel": false,
|
||||
// "required": false,
|
||||
// "minLength": "",
|
||||
// "maxLength": "",
|
||||
// "expression": "",
|
||||
// "hideExpression": false,
|
||||
// "unique": false,
|
||||
// "defaultValue": ""
|
||||
// },
|
||||
// "id": "m6c6vx94-t7d8juf6x"
|
||||
// }
|
||||
// ],
|
||||
// "whereConditions": [
|
||||
// {
|
||||
// "field": "",
|
||||
// "condition": "",
|
||||
// "data": "",
|
||||
// "id": "m6c6vx94-gbxhjgf8m"
|
||||
// }
|
||||
// ]
|
||||
// }
|
||||
// ]
|
||||
// };
|
||||
// return retConfig;
|
||||
// }
|
||||
|
||||
})(kintone.$PLUGIN_ID);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user