fix:add function calculateFiscalYear
This commit is contained in:
parent
72aa6f44ac
commit
27280c393f
5 changed files with 18 additions and 4 deletions
|
|
@ -4,6 +4,7 @@ import { useQuasar } from "quasar";
|
||||||
|
|
||||||
import type { PropsTable } from "@/interface/PropsTable";
|
import type { PropsTable } from "@/interface/PropsTable";
|
||||||
import { useLeaveStore } from "@/modules/05_leave/store";
|
import { useLeaveStore } from "@/modules/05_leave/store";
|
||||||
|
import { calculateFiscalYear } from "@/utils/functions";
|
||||||
|
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const attrs = ref<any>(useAttrs());
|
const attrs = ref<any>(useAttrs());
|
||||||
|
|
@ -82,7 +83,7 @@ watch(
|
||||||
);
|
);
|
||||||
|
|
||||||
/** filter */
|
/** filter */
|
||||||
const year = ref<number>(new Date().getFullYear());
|
const year = ref<number>(calculateFiscalYear(new Date()));
|
||||||
const filter = ref<string>("");
|
const filter = ref<string>("");
|
||||||
|
|
||||||
/** updateVisible*/
|
/** updateVisible*/
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import http from "@/plugins/http";
|
||||||
import config from "@/app.config";
|
import config from "@/app.config";
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
import { useAppealComplainStore } from "@/modules/07_appealComplain/store";
|
import { useAppealComplainStore } from "@/modules/07_appealComplain/store";
|
||||||
|
import { calculateFiscalYear } from "@/utils/functions";
|
||||||
|
|
||||||
import type { PropsTable } from "@/interface/PropsTable";
|
import type { PropsTable } from "@/interface/PropsTable";
|
||||||
import type { FormType } from "@/modules/07_appealComplain/interface/response/mainType";
|
import type { FormType } from "@/modules/07_appealComplain/interface/response/mainType";
|
||||||
|
|
@ -37,7 +38,7 @@ const pagination = ref<PropsTable.Pagination>({
|
||||||
const formData = reactive<FormType>({
|
const formData = reactive<FormType>({
|
||||||
type: "ALL",
|
type: "ALL",
|
||||||
status: "ALL",
|
status: "ALL",
|
||||||
year: new Date().getFullYear(),
|
year: calculateFiscalYear(new Date()),
|
||||||
});
|
});
|
||||||
const visibleColumns = ref<string[]>([
|
const visibleColumns = ref<string[]>([
|
||||||
"no",
|
"no",
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,13 @@ import { ref, reactive } from "vue";
|
||||||
import type { DataOptions } from "./interface/index/Main";
|
import type { DataOptions } from "./interface/index/Main";
|
||||||
import type { FormQuery } from "@/modules/08_KPI/interface/request/index";
|
import type { FormQuery } from "@/modules/08_KPI/interface/request/index";
|
||||||
import type { DataProfile } from "@/interface/Main";
|
import type { DataProfile } from "@/interface/Main";
|
||||||
|
import { calculateFiscalYear } from "@/utils/functions";
|
||||||
|
|
||||||
export const useKpiDataStore = defineStore("KPIDate", () => {
|
export const useKpiDataStore = defineStore("KPIDate", () => {
|
||||||
const mainRowData = ref<any>();
|
const mainRowData = ref<any>();
|
||||||
const isUpdate = ref<boolean>(false);
|
const isUpdate = ref<boolean>(false);
|
||||||
const tabMainevaluator = ref<string>("1");
|
const tabMainevaluator = ref<string>("1");
|
||||||
const yearRound = ref<number>(new Date().getFullYear());
|
const yearRound = ref<number>(calculateFiscalYear(new Date()));
|
||||||
const formQuery = reactive<FormQuery>({
|
const formQuery = reactive<FormQuery>({
|
||||||
page: 1,
|
page: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import config from "@/app.config";
|
||||||
import http from "@/plugins/http";
|
import http from "@/plugins/http";
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
import { useKpiDataStore } from "@/modules/08_KPI/store";
|
import { useKpiDataStore } from "@/modules/08_KPI/store";
|
||||||
|
import { calculateFiscalYear } from "@/utils/functions";
|
||||||
|
|
||||||
import type { QTableProps } from "quasar";
|
import type { QTableProps } from "quasar";
|
||||||
import type { DataProfile } from "@/interface/Main";
|
import type { DataProfile } from "@/interface/Main";
|
||||||
|
|
@ -94,7 +95,7 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
]);
|
]);
|
||||||
|
|
||||||
/** List*/
|
/** List*/
|
||||||
const year = ref<number>(new Date().getFullYear());
|
const year = ref<number>(calculateFiscalYear(new Date()));
|
||||||
const round = ref<string>("");
|
const round = ref<string>("");
|
||||||
const roundMainOp = ref<DataOptions[]>([]);
|
const roundMainOp = ref<DataOptions[]>([]);
|
||||||
const roundDialgOp = ref<DataOptions[]>([]);
|
const roundDialgOp = ref<DataOptions[]>([]);
|
||||||
|
|
|
||||||
10
src/utils/functions.ts
Normal file
10
src/utils/functions.ts
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
/**
|
||||||
|
* คำนวณปีงบประมาณ
|
||||||
|
*
|
||||||
|
* @param date วันที่ปัจจุบัน
|
||||||
|
* @returns ปีงบประมาณ
|
||||||
|
*/
|
||||||
|
export function calculateFiscalYear(date: Date) {
|
||||||
|
const month = date.getMonth() + 1;
|
||||||
|
return month >= 10 ? date.getFullYear() + 1 : date.getFullYear();
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue