248 lines
6.4 KiB
TypeScript
248 lines
6.4 KiB
TypeScript
import http from "@/plugins/http";
|
|
import config from "@/app.config";
|
|
import { useQuasar } from "quasar";
|
|
|
|
import { useCounterMixin } from "@/stores/mixin";
|
|
import { useEvaluateStore } from "@/modules/06_evaluate/store";
|
|
|
|
const store = useEvaluateStore();
|
|
const mixin = useCounterMixin();
|
|
const $q = useQuasar();
|
|
|
|
const { showLoader, hideLoader, messageError } = mixin;
|
|
|
|
/** function เช็คการยื่นข้อประเมิน*/
|
|
async function fetchCheckStatus() {
|
|
store.showLoadStatus = false;
|
|
store.currentStep = 1;
|
|
showLoader();
|
|
await http
|
|
.get(config.API.evaluationCheckStatus())
|
|
.then((res) => {
|
|
const data = res.data.result;
|
|
store.tabMenu === "1"
|
|
? (store.evaluateId = data.expertId)
|
|
: (store.evaluateId = data.specialExpertId);
|
|
store.evaluateId && fetchCheckStep();
|
|
|
|
store.showLoadStatus = true;
|
|
})
|
|
.catch((err) => {
|
|
messageError($q, err);
|
|
})
|
|
.finally(() => {
|
|
hideLoader();
|
|
});
|
|
}
|
|
|
|
async function fetchCheckStep() {
|
|
await http
|
|
.get(config.API.evaluationCheckStep(store.evaluateId))
|
|
.then((res) => {
|
|
const data = res.data.result;
|
|
let step =
|
|
data.Step === "CHECK_SPEC"
|
|
? 1
|
|
: data.Step === "PREPARE_DOC_V1"
|
|
? 2
|
|
: data.Step === "CHECK_DOC_V1"
|
|
? 3
|
|
: data.Step === "WAIT_CHECK_DOC_V1"
|
|
? 4
|
|
: data.Step === "ANNOUNCE_WEB"
|
|
? 5
|
|
: data.Step === "PREPARE_DOC_V2"
|
|
? 6
|
|
: data.Step === "CHECK_DOC_V2"
|
|
? 7
|
|
: data.Step === "WAIT_CHECK_DOC_V2"
|
|
? 8
|
|
: data.Step === "DONE"
|
|
? 9
|
|
: 0;
|
|
|
|
store.currentStep = step;
|
|
store.step = step;
|
|
})
|
|
.catch((err) => {
|
|
messageError($q, err);
|
|
});
|
|
}
|
|
|
|
async function saveEvaluation(body: any) {
|
|
console.log(body);
|
|
// const form = {
|
|
// UserId: "08dbca3a-8b6a-4a4e-8b23-1f62e4f30ef6",
|
|
// CitizenId: "1540200054020",
|
|
// Prefix: "นางสาว",
|
|
// FullName: "สาวิตรี ศรีสมัย",
|
|
// Position: "นักทรัพยากรบุคคล",
|
|
// Oc: "สำนักปลัดกรุงเทพมหานคร/สำนักงานการเจ้าหน้าที่",
|
|
// Salary: "10000",
|
|
// PositionLevel: "นักทรัพยากรบุคคล",
|
|
// PosNo: "10",
|
|
// BirthDate: "string",
|
|
// GovAge: "string",
|
|
// Type: "string",
|
|
// Step: "string",
|
|
// IsEducationalQft: true,
|
|
// IsGovermantServiceHtr: true,
|
|
// IsOperatingExp: true,
|
|
// IsMinPeriodOfTenure: true,
|
|
// IsHaveSpecificQft: true,
|
|
// IsHaveProLicense: true,
|
|
// IsHaveMinPeriodOrHoldPos: true,
|
|
// Reason: "string",
|
|
// Educations: [
|
|
// {
|
|
// EducationLevel: "string",
|
|
// Institute: "string",
|
|
// IsDate: true,
|
|
// StartDate: "2023-12-19T03:20:04.460Z",
|
|
// EndDate: "2023-12-19T03:20:04.460Z",
|
|
// FinishDate: "2023-12-19T03:20:04.460Z",
|
|
// IsEducation: true,
|
|
// Degree: "string",
|
|
// Field: "string",
|
|
// FundName: "string",
|
|
// Gpa: "string",
|
|
// Country: "string",
|
|
// Other: "string",
|
|
// Duration: "string",
|
|
// DurationYear: "string",
|
|
// },
|
|
// ],
|
|
// Certificates: [
|
|
// {
|
|
// Step: "string",
|
|
// CertificateType: "string",
|
|
// Issuer: "string",
|
|
// CertificateNo: "string",
|
|
// IssueDate: "2023-12-19T03:20:04.460Z",
|
|
// ExpireDate: "2023-12-19T03:20:04.460Z",
|
|
// },
|
|
// ],
|
|
// Salaries: [
|
|
// {
|
|
// Step: "string",
|
|
// Date: "2023-12-19T03:20:04.460Z",
|
|
// Amount: 0,
|
|
// PositionSalaryAmount: 0,
|
|
// MouthSalaryAmount: 0,
|
|
// Position: "string",
|
|
// PosNo: "string",
|
|
// SalaryClass: "string",
|
|
// SalaryRef: "string",
|
|
// RefCommandNo: "string",
|
|
// RefCommandDate: "2023-12-19T03:20:04.460Z",
|
|
// SalaryStatus: "string",
|
|
// },
|
|
// ],
|
|
// Trainings: [
|
|
// {
|
|
// Name: "string",
|
|
// Topic: "string",
|
|
// StartDate: "2023-12-19T03:20:04.460Z",
|
|
// EndDate: "2023-12-19T03:20:04.460Z",
|
|
// Yearly: 0,
|
|
// Place: "string",
|
|
// Duration: "string",
|
|
// Department: "string",
|
|
// NumberOrder: "string",
|
|
// DateOrder: "2023-12-19T03:20:04.460Z",
|
|
// },
|
|
// ],
|
|
// Assessments: [
|
|
// {
|
|
// Date: "2023-12-19T03:20:04.460Z",
|
|
// Point1Total: 0,
|
|
// Point1: 0,
|
|
// Point2Total: 0,
|
|
// Point2: 0,
|
|
// PointSumTotal: 0,
|
|
// PointSum: 0,
|
|
// },
|
|
// ],
|
|
// };
|
|
|
|
showLoader();
|
|
await http
|
|
.post(config.API.evaluationCheckspec(), body)
|
|
.then((res) => {
|
|
console.log(res);
|
|
})
|
|
.catch((err) => {
|
|
messageError($q, err);
|
|
})
|
|
.finally(() => {
|
|
hideLoader();
|
|
fetchCheckStep();
|
|
});
|
|
}
|
|
|
|
async function nextPrapare(type: string, body: any) {
|
|
showLoader();
|
|
await http
|
|
.put(config.API.evaluationPreparedoc(store.evaluateId, type), body)
|
|
.then((res) => {
|
|
console.log(res);
|
|
})
|
|
.catch((err) => {
|
|
messageError($q, err);
|
|
})
|
|
.finally(() => {
|
|
hideLoader();
|
|
fetchCheckStep();
|
|
});
|
|
}
|
|
|
|
async function peviousPrapare(type: string) {
|
|
showLoader();
|
|
await http
|
|
.put(config.API.evaluationPreparedoc(store.evaluateId, type))
|
|
.then((res) => {
|
|
console.log(res);
|
|
})
|
|
.catch((err) => {
|
|
messageError($q, err);
|
|
})
|
|
.finally(() => {
|
|
hideLoader();
|
|
});
|
|
}
|
|
|
|
async function nextCheckDoc(type: string) {
|
|
showLoader();
|
|
await http
|
|
.put(config.API.evaluationCheckdoc(store.evaluateId, type))
|
|
.then((res) => {
|
|
console.log(res);
|
|
})
|
|
.catch((err) => {
|
|
messageError($q, err);
|
|
})
|
|
.finally(() => {
|
|
hideLoader();
|
|
fetchCheckStep();
|
|
});
|
|
}
|
|
|
|
async function nextCheckDoc2() {
|
|
showLoader();
|
|
await http
|
|
.put(config.API.evaluationCheckdocV1(store.evaluateId))
|
|
.then((res) => {})
|
|
.catch((err) => {})
|
|
.finally(() => {
|
|
hideLoader();
|
|
});
|
|
}
|
|
|
|
export default {
|
|
fetchCheckStatus,
|
|
saveEvaluation,
|
|
nextPrapare,
|
|
peviousPrapare,
|
|
nextCheckDoc,
|
|
nextCheckDoc2,
|
|
};
|