Explorar el Código

選考アプリ修正

develop
sosuke.iwabuchi hace 2 años
padre
commit
aec9655fdc
Se han modificado 5 ficheros con 78 adiciones y 8 borrados
  1. +54
    -2
      src/apps/定期予約選考/index.ts
  2. +2
    -0
      src/mypage/index.ts
  3. +10
    -3
      src/mypage/lib.ts
  4. +6
    -0
      src/mypage/定期予約選考.ts
  5. +6
    -3
      src/types/定期予約選考.ts

+ 54
- 2
src/apps/定期予約選考/index.ts Ver fichero

@@ -1,7 +1,7 @@
import { AppID } from "@/common/appids";
import { setHeaderButton } from "@/common/header-button";
import { makeRecordData } from "@/common/rest-api-client";
import { noticeToCandidates } from "@/mypage/定期予約選考";
import { fillCandidates, noticeToCandidates } from "@/mypage/定期予約選考";
import {
定期予約選考,
定期予約選考フィールド名,
@@ -10,6 +10,46 @@ import {
import { 定期申込予約フィールド名, 状態Dropdown } from "@/types/定期申込予約";
import { KintoneRestAPIClient } from "@kintone/rest-api-client";

// 検索用文字列をセットする
const setSearchCondition = (currentRecord: 定期予約選考) => {
const candidates = currentRecord.申込者一覧.value
.filter((row) => !!row.value.申込者一覧_申込レコード番号.value)
.map((row) => {
return "c" + row.value.申込者一覧_申込レコード番号.value + "c";
});
const entries = currentRecord.契約希望者一覧.value
.filter((row) => !!row.value.契約希望者一覧_申込レコード番号.value)
.map((row) => {
return "e" + row.value.契約希望者一覧_申込レコード番号.value + "e";
});
const results = currentRecord.選考結果一覧.value
.filter((row) => !!row.value.選考結果一覧_申込番号.value)
.map((row) => {
return "r" + row.value.選考結果一覧_申込レコード番号.value + "r";
});

currentRecord.検索用_申込一覧_レコード番号.value = candidates.join(",");
currentRecord.検索用_契約希望者_レコード番号.value = entries.join(",");
currentRecord.検索用_選考結果_レコード番号.value = results.join(",");
};

const getCallBackHandleFillcandidates = (currentRecord: 定期予約選考) => {
return async () => {
const confirm = window.confirm("候補者を設定しますか?");
if (!confirm || !currentRecord) return;

const result = await fillCandidates(
Number(currentRecord.レコード番号.value)
);
if (result) {
window.alert("設定しました");
location.reload();
} else {
window.alert("失敗しました");
}
};
};

const getCallBackHandleNoticeTocandidates = (currentRecord: 定期予約選考) => {
return async () => {
const confirm = window.confirm("対象者へメール送信しますか?");
@@ -33,7 +73,6 @@ const getCallBackHandleFinish = (currentRecord: 定期予約選考) => {
if (!confirm || !currentRecord) return;

const client = new KintoneRestAPIClient();

// 選考のステータスを終了にする
const param = {
app: AppID.定期予約選考,
@@ -80,6 +119,12 @@ const getCallBackHandleFinish = (currentRecord: 定期予約選考) => {
const currentRecord: 定期予約選考 = event.record;

// 各種ボタンの設置
if (currentRecord.選考ステータス.value === 選考ステータスDropdown.起票) {
setHeaderButton(
"候補者設定",
getCallBackHandleFillcandidates(currentRecord)
);
}
if (
currentRecord.選考ステータス.value === 選考ステータスDropdown.通知者選択中
) {
@@ -94,4 +139,11 @@ const getCallBackHandleFinish = (currentRecord: 定期予約選考) => {
setHeaderButton("当選者確定", getCallBackHandleFinish(currentRecord));
}
});

kintone.events.on("app.record.edit.submit", (event) => {
const currentRecord: 定期予約選考 = event.record;
setSearchCondition(currentRecord);

return event;
});
})();

+ 2
- 0
src/mypage/index.ts Ver fichero

@@ -1,5 +1,7 @@
export const MyPageApiID = {
メール送信依頼: "email/send",
定期選考候補者設定: "season-ticket-contract-selection/fill-candidates",
定期選考一斉通知: "season-ticket-contract-selection/notice-to-candidates",
領収証発行: "receipt/create",
} as const;
export type MyPageApiID = (typeof MyPageApiID)[keyof typeof MyPageApiID];

+ 10
- 3
src/mypage/lib.ts Ver fichero

@@ -18,17 +18,24 @@ export const send = async (apiId: MyPageApiID, data: object) => {
};
console.info("MyPageAPICall", url, data);

const res: MyPageApiResponse = await kintone.proxy(
const res: any = await kintone.proxy(
url,
"POST",
{ "Content-Type": "application/json" },
sendData
);

if (res?.result === "SUCCESS") {
const status = res[1];
if (status !== 200) {
console.error("http status not 200", res);
return false;
}
const obj = JSON.parse(res[0]);

if (obj.result === "SUCCESS") {
return true;
} else {
console.error(res);
console.error("処理失敗", res);
return false;
}
};

+ 6
- 0
src/mypage/定期予約選考.ts Ver fichero

@@ -1,6 +1,12 @@
import { MyPageApiID } from ".";
import { send } from "./lib";

export const fillCandidates = (recordNo: number) => {
const sendData = {
record_no: recordNo,
};
return send(MyPageApiID.定期選考候補者設定, sendData);
};
export const noticeToCandidates = (recordNo: number) => {
const sendData = {
record_no: recordNo,


+ 6
- 3
src/types/定期予約選考.ts Ver fichero

@@ -3,6 +3,9 @@ import { AppRecord } from ".";

const F = {
選考ステータス: "選考ステータス",
検索用_申込一覧_レコード番号: "検索用_申込一覧_レコード番号",
検索用_契約希望者_レコード番号: "検索用_契約希望者_レコード番号",
検索用_選考結果_レコード番号: "検索用_選考結果_レコード番号",
} as const;

export const 選考ステータスDropdown = {
@@ -19,13 +22,13 @@ export type 選考ステータスDropdown =
export const 定期予約選考フィールド名 = F;
export type 定期予約選考 = AppRecord & {
利用開始日: KintoneRecordField.Date;
検索用_契約希望者_レコード番号: KintoneRecordField.SingleLineText;
[F.検索用_契約希望者_レコード番号]: KintoneRecordField.SingleLineText;
自動選考メッセージ: KintoneRecordField.MultiLineText;
[F.選考ステータス]: KintoneRecordField.Dropdown;
選考締切日: KintoneRecordField.Date;
検索用_申込一覧_レコード番号: KintoneRecordField.SingleLineText;
[F.検索用_申込一覧_レコード番号]: KintoneRecordField.SingleLineText;
駐車場名: KintoneRecordField.SingleLineText;
検索用_選考結果_レコード番号: KintoneRecordField.SingleLineText;
[F.検索用_選考結果_レコード番号]: KintoneRecordField.SingleLineText;
申込者一覧: KintoneRecordField.Subtable<{
申込者一覧_申込レコード番号: KintoneRecordField.Number;
申込者一覧_メールアドレス: KintoneRecordField.SingleLineText;


Cargando…
Cancelar
Guardar