Bladeren bron

メッセージ対応

develop
sosuke.iwabuchi 2 jaren geleden
bovenliggende
commit
5c485e814e
4 gewijzigde bestanden met toevoegingen van 27 en 10 verwijderingen
  1. +10
    -3
      src/apps/定期申込予約/index.tsx
  2. +7
    -7
      src/apps/定期申込予約/自動承認.ts
  3. +1
    -0
      src/exception/index.ts
  4. +9
    -0
      src/middleware/swal.ts

+ 10
- 3
src/apps/定期申込予約/index.tsx Bestand weergeven

@@ -1,7 +1,8 @@
import { AppID } from "@/common/appids";
import { setHeaderButton } from "@/common/header-button";
import { CancelError } from "@/exception";
import { CancelError, Message } from "@/exception";
import {
ErrorDialog,
ShowConfirmDialog,
SuccessDialog,
WarningDialog,
@@ -52,9 +53,15 @@ import { 申込 } from "./自動承認";
} catch (e) {
if (e instanceof CancelError) {
console.log("canceled");
} else {
throw e;
return;
} else if (e instanceof Message) {
ErrorDialog.fire({
text: e.message,
});
return;
}
ErrorDialog.fire();
throw e;
}
});
}


+ 7
- 7
src/apps/定期申込予約/自動承認.ts Bestand weergeven

@@ -28,7 +28,7 @@ import { 車室契約情報, 車室契約情報フィールド名 } from "@/type
import { 車室情報2 } from "@/types/車室情報2";
import { 顧客マスタフィールド名 } from "@/types/顧客マスタ";
import { sprintf } from "sprintf";
import { CancelError } from "../../exception";
import { CancelError, Message } from "../../exception";
import { 入金予定結果フィールド名 } from "@/types/入金予定結果";
import { dateParse, now } from "@/common/datetime";

@@ -93,7 +93,7 @@ export class 申込 {

private async 契約対象車室取得() {
if (!this.定期申込予約.駐車場.value) {
throw new Error("駐車場名の設定をしてください");
throw new Message("駐車場名の設定をしてください");
}

this.車室一覧 = await get車室情報一覧({
@@ -102,7 +102,7 @@ export class 申込 {
}
private async 契約情報取得() {
if (!this.定期申込予約.駐車場.value) {
throw new Error("駐車場名の設定をしてください");
throw new Message("駐車場名の設定をしてください");
}
this.契約一覧 = await get車室契約情報一覧({
駐車場名: this.定期申込予約.駐車場.value,
@@ -111,7 +111,7 @@ export class 申込 {
}
private async 自動承認グループ取得() {
if (!this.定期申込予約.定期駐車場プラン.value) {
throw new Error("プラン名の設定をしてください");
throw new Message("プラン名の設定をしてください");
}
this.自動承認グループ = await get自動承認グループ(
this.定期申込予約.定期駐車場プラン.value
@@ -143,7 +143,7 @@ export class 申込 {
.find(() => true);

if (!target) {
throw new Error("空き車室がありません");
throw new Message("空き車室がありません");
}

const 車室番号 = Number(target.value.車室番号.value);
@@ -151,7 +151,7 @@ export class 申込 {
return Number(room.車室番号.value) === 車室番号;
});
if (!車室) {
throw new Error("車室がありません");
throw new Message("車室がありません");
}

return 車室;
@@ -240,7 +240,7 @@ export class 申込 {

private get契約開始日() {
const 利用開始希望日 = this.定期申込予約.利用開始希望日.value;
if (!利用開始希望日) throw new Error("利用開始希望日不正");
if (!利用開始希望日) throw new Message("利用開始希望日不正");
return 利用開始希望日;
}



+ 1
- 0
src/exception/index.ts Bestand weergeven

@@ -1 +1,2 @@
export class CancelError extends Error {}
export class Message extends Error {}

+ 9
- 0
src/middleware/swal.ts Bestand weergeven

@@ -6,11 +6,17 @@ export const SuccessDialog = Swal.mixin({
timer: 1000,
title: "成功しました",
showConfirmButton: false,
didOpen: () => {
Swal.hideLoading();
},
});

export const ErrorDialog = Swal.mixin({
icon: "error",
title: "エラーが発生しました",
didOpen: () => {
Swal.hideLoading();
},
});
export const WarningDialog = Swal.mixin({
icon: "warning",
@@ -21,6 +27,9 @@ export const ConfirmDialog = Swal.mixin({
showCancelButton: true,
confirmButtonText: "実行",
cancelButtonText: "キャンセル",
didOpen: () => {
Swal.hideLoading();
},
});

export const ShowConfirmDialog = (param: SweetAlertOptions) => {


Laden…
Annuleren
Opslaan