fix(command): validate if isIdofficer isBangkok fields to show warnings
This commit is contained in:
parent
9d9cd92d6b
commit
8a0a6ea873
4 changed files with 29 additions and 23 deletions
|
|
@ -61,7 +61,6 @@ let formData = reactive<FormDataDetail>({
|
||||||
});
|
});
|
||||||
const commandVolume = ref<string>(""); //เล่มที่
|
const commandVolume = ref<string>(""); //เล่มที่
|
||||||
const commandChapter = ref<string>(""); //ตอนที่
|
const commandChapter = ref<string>(""); //ตอนที่
|
||||||
const isIdofficer = ref<boolean>(false); //เช็ค สกจ.
|
|
||||||
|
|
||||||
const rows = ref<Array<DataOperators>>([]);
|
const rows = ref<Array<DataOperators>>([]);
|
||||||
const columns = ref<QTableProps["columns"]>([
|
const columns = ref<QTableProps["columns"]>([
|
||||||
|
|
@ -114,17 +113,7 @@ const visibleColumns = ref<Array<string>>([
|
||||||
|
|
||||||
const modalAddOperator = ref<boolean>(false); // แสดงเพิ่มรายชื่อลงนามในแนบท้ายคำสั่ง
|
const modalAddOperator = ref<boolean>(false); // แสดงเพิ่มรายชื่อลงนามในแนบท้ายคำสั่ง
|
||||||
|
|
||||||
/** ฟังก์ชันเช็ค สกจ.*/
|
|
||||||
async function fetchCheckIdofficer() {
|
|
||||||
await http
|
|
||||||
.get(config.API.checkIdofficer)
|
|
||||||
.then((res) => {
|
|
||||||
isIdofficer.value = res.data.result;
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
messageError($q, err);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ฟังก์ชันบันทึกข้อมูลรายละเอียดคำสั่ง
|
* ฟังก์ชันบันทึกข้อมูลรายละเอียดคำสั่ง
|
||||||
|
|
@ -133,7 +122,7 @@ async function fetchCheckIdofficer() {
|
||||||
async function onSubmit() {
|
async function onSubmit() {
|
||||||
//ถ้าเป็น สกจ. ต้องเลือกประเภทคำสั่งด้วย
|
//ถ้าเป็น สกจ. ต้องเลือกประเภทคำสั่งด้วย
|
||||||
if (
|
if (
|
||||||
isIdofficer.value &&
|
store.isIdofficer &&
|
||||||
formData.isBangkok !== "BANGKOK" &&
|
formData.isBangkok !== "BANGKOK" &&
|
||||||
formData.isBangkok !== "OFFICE"
|
formData.isBangkok !== "OFFICE"
|
||||||
) {
|
) {
|
||||||
|
|
@ -225,7 +214,6 @@ function onDeleteData(id: string) {
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
try {
|
try {
|
||||||
showLoader();
|
showLoader();
|
||||||
await fetchCheckIdofficer();
|
|
||||||
await fetchDataOperatorList();
|
await fetchDataOperatorList();
|
||||||
formData.commandNo = props.formCommandList.commandNo;
|
formData.commandNo = props.formCommandList.commandNo;
|
||||||
formData.commandYear = props.formCommandList.commandYear;
|
formData.commandYear = props.formCommandList.commandYear;
|
||||||
|
|
@ -235,7 +223,7 @@ onMounted(async () => {
|
||||||
formData.issue = props.formCommandList.issue;
|
formData.issue = props.formCommandList.issue;
|
||||||
formData.commandAffectDate = props.formCommandList.commandAffectDate;
|
formData.commandAffectDate = props.formCommandList.commandAffectDate;
|
||||||
formData.commandExcecuteDate = props.formCommandList.commandExcecuteDate;
|
formData.commandExcecuteDate = props.formCommandList.commandExcecuteDate;
|
||||||
formData.isBangkok = !isIdofficer.value
|
formData.isBangkok = !store.isIdofficer
|
||||||
? null
|
? null
|
||||||
: props.formCommandList.isBangkok;
|
: props.formCommandList.isBangkok;
|
||||||
commandCode.value = props.formCommandList.commandCode;
|
commandCode.value = props.formCommandList.commandCode;
|
||||||
|
|
@ -500,7 +488,7 @@ onMounted(async () => {
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="col-12 q-gutter-sm"
|
class="col-12 q-gutter-sm"
|
||||||
v-if="isIdofficer && commandCode !== 'C-PM-47'"
|
v-if="store.isIdofficer && commandCode !== 'C-PM-47'"
|
||||||
>
|
>
|
||||||
<q-radio
|
<q-radio
|
||||||
:disable="store.readonly"
|
:disable="store.readonly"
|
||||||
|
|
|
||||||
|
|
@ -292,7 +292,10 @@ function onConfirmOrder() {
|
||||||
if (
|
if (
|
||||||
store?.dataCommand?.commandNo !== "" &&
|
store?.dataCommand?.commandNo !== "" &&
|
||||||
store?.dataCommand?.commandAffectDate !== null &&
|
store?.dataCommand?.commandAffectDate !== null &&
|
||||||
store?.dataCommand?.commandExcecuteDate !== null
|
store?.dataCommand?.commandExcecuteDate !== null &&
|
||||||
|
(!store.isIdofficer ||
|
||||||
|
store?.dataCommand?.isBangkok === "BANGKOK" ||
|
||||||
|
store?.dataCommand?.isBangkok === "OFFICE")
|
||||||
) {
|
) {
|
||||||
dialogConfirm(
|
dialogConfirm(
|
||||||
$q,
|
$q,
|
||||||
|
|
@ -316,10 +319,10 @@ function onConfirmOrder() {
|
||||||
"คุณต้องการยืนยันการส่งออกคำสั่งใช่หรือไม่?"
|
"คุณต้องการยืนยันการส่งออกคำสั่งใช่หรือไม่?"
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
dialogMessageNotify(
|
const messageWarning = !store.isIdofficer
|
||||||
$q,
|
? "ไม่สามารถดำเนินการต่อได้ กรุณากรอกเลขที่คำสั่ง วันที่ลงนาม และวันที่คำสั่งมีผลให้ครบ"
|
||||||
"ไม่สามารถดำเนินการต่อได้ กรุณากรอกเลขที่คำสั่ง วันที่ลงนาม และวันที่คำสั่งมีผลให้ครบ"
|
: "ไม่สามารถดำเนินการต่อได้ กรุณากรอกเลขที่คำสั่ง วันที่ลงนาม วันที่คำสั่งมีผล และเลือกประเภทคำสั่งให้ครบ";
|
||||||
);
|
dialogMessageNotify($q, messageWarning);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,8 @@ export const useCommandDetail = defineStore("commandDetailStore", () => {
|
||||||
const readonly = ref<boolean>(false);
|
const readonly = ref<boolean>(false);
|
||||||
const dataCommand = ref<FormDataDetail>();
|
const dataCommand = ref<FormDataDetail>();
|
||||||
const status = ref<string>("");
|
const status = ref<string>("");
|
||||||
const isSalary = ref<boolean>(false)
|
const isSalary = ref<boolean>(false);
|
||||||
|
const isIdofficer = ref<boolean>(false);
|
||||||
function checkStep(val: string) {
|
function checkStep(val: string) {
|
||||||
status.value = val;
|
status.value = val;
|
||||||
switch (val) {
|
switch (val) {
|
||||||
|
|
@ -39,6 +40,7 @@ export const useCommandDetail = defineStore("commandDetailStore", () => {
|
||||||
readonly,
|
readonly,
|
||||||
status,
|
status,
|
||||||
dataCommand,
|
dataCommand,
|
||||||
isSalary
|
isSalary,
|
||||||
|
isIdofficer,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -92,12 +92,25 @@ async function fetchDataCommandList() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** ฟังก์ชันเช็ค สกจ.*/
|
||||||
|
async function fetchCheckIdofficer() {
|
||||||
|
await http
|
||||||
|
.get(config.API.checkIdofficer)
|
||||||
|
.then((res) => {
|
||||||
|
store.isIdofficer = res.data.result;
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
messageError($q, err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ทำงานเมื่อ Components ถูกเรียกใช้งาน
|
* ทำงานเมื่อ Components ถูกเรียกใช้งาน
|
||||||
* กำหนดค่า `store.readonly` เมื่อ route.name เป็น "commandViewDetailPage" จะอ่านข้อมูลได้อย่างเดียว
|
* กำหนดค่า `store.readonly` เมื่อ route.name เป็น "commandViewDetailPage" จะอ่านข้อมูลได้อย่างเดียว
|
||||||
*/
|
*/
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await fetchDataCommandList();
|
await fetchDataCommandList();
|
||||||
|
await fetchCheckIdofficer();
|
||||||
store.readonly =
|
store.readonly =
|
||||||
route.name === "commandViewDetailPage" ||
|
route.name === "commandViewDetailPage" ||
|
||||||
formCommandList.status === "REPORTED" ||
|
formCommandList.status === "REPORTED" ||
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue