fix(command): validate if isIdofficer isBangkok fields to show warnings

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2026-04-17 14:59:22 +07:00
parent 9d9cd92d6b
commit 8a0a6ea873
4 changed files with 29 additions and 23 deletions

View file

@ -61,7 +61,6 @@ let formData = reactive<FormDataDetail>({
});
const commandVolume = ref<string>(""); //
const commandChapter = ref<string>(""); //
const isIdofficer = ref<boolean>(false); // .
const rows = ref<Array<DataOperators>>([]);
const columns = ref<QTableProps["columns"]>([
@ -114,17 +113,7 @@ const visibleColumns = ref<Array<string>>([
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() {
// .
if (
isIdofficer.value &&
store.isIdofficer &&
formData.isBangkok !== "BANGKOK" &&
formData.isBangkok !== "OFFICE"
) {
@ -225,7 +214,6 @@ function onDeleteData(id: string) {
onMounted(async () => {
try {
showLoader();
await fetchCheckIdofficer();
await fetchDataOperatorList();
formData.commandNo = props.formCommandList.commandNo;
formData.commandYear = props.formCommandList.commandYear;
@ -235,7 +223,7 @@ onMounted(async () => {
formData.issue = props.formCommandList.issue;
formData.commandAffectDate = props.formCommandList.commandAffectDate;
formData.commandExcecuteDate = props.formCommandList.commandExcecuteDate;
formData.isBangkok = !isIdofficer.value
formData.isBangkok = !store.isIdofficer
? null
: props.formCommandList.isBangkok;
commandCode.value = props.formCommandList.commandCode;
@ -500,7 +488,7 @@ onMounted(async () => {
<div
class="col-12 q-gutter-sm"
v-if="isIdofficer && commandCode !== 'C-PM-47'"
v-if="store.isIdofficer && commandCode !== 'C-PM-47'"
>
<q-radio
:disable="store.readonly"