ปรับ ออกคำสั่ง

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-09-01 11:15:18 +07:00
parent cf8bdb7ce0
commit 46f4173524
3 changed files with 111 additions and 34 deletions

View file

@ -247,10 +247,10 @@ const fecthTypeOption = async (actions: string) => {
messageError($q, e);
})
.finally(async () => {
await fecthCommand();
if (actions == "hasData") {
await fetchdetailOrder();
}
await fecthCommand();
hideLoader();
});
};
@ -260,6 +260,8 @@ const fetchdetailOrder = async () => {
await http
.get(config.API.detailOrder(orderIdString))
.then((res: any) => {
console.log(res);
const data = res.data.result;
console.log(data);
typeOrder.value = typeOrderOption.value.find(
@ -336,7 +338,7 @@ const fetchdetailOrder = async () => {
messageError($q, e);
})
.finally(async () => {
await fecthCommand();
// await fecthCommand();
hideLoader();
});
};
@ -344,6 +346,8 @@ const fecthCommand = async () => {
await http
.get(config.API.organizationsOrder())
.then((res: any) => {
console.log(res);
byOrderOption.value = res.data.result;
})
.catch((e: any) => {
@ -412,12 +416,15 @@ const fecthExamRoundOption = async (commandCode: string) => {
};
const submit = async () => {
console.log(nameCommand.value);
console.log(CommandOption.value);
let signBy = null;
if (!nameCommand.value.length) {
signBy = await nameCommand.value.name;
} else {
const name2 = await CommandOption.value.find(
(x: any) => x.id == nameCommand.value.id
(x: any) => x.name == nameCommand.value
);
signBy = await name2?.name;
console.log("signBy", signBy);
@ -437,7 +444,7 @@ const submit = async () => {
orderBy: byOrder.value,
orderByOrganizationName: orderByOrganizationName,
registerPosition: "",
signatoryBy: signBy,
signatoryBy: signBy === "" ? nameCommand.value : signBy,
signatoryPosition: positionCommand.value,
};
if (
@ -525,7 +532,7 @@ const submit = async () => {
});
}
console.log(formdata);
// console.log(formdata);
await myForm.value!.validate().then((result: boolean) => {
if (result) {
@ -564,6 +571,7 @@ const updateOrder = async (formData: Object, orderId: string, type: string) => {
.put(config.API.orderCPMUpdate(type, orderId), formData)
.then((res) => {
console.log(res);
next();
success($q, "บันทึกข้อมูลสำเร็จ");
})

View file

@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref, onMounted } from "vue";
import { ref, onMounted, computed } from "vue";
import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import { useRoute } from "vue-router";
@ -94,6 +94,7 @@ const columns = ref<QTableProps["columns"]>([
const rows = ref<ResponseData[]>([]);
const rows2 = ref<ResponseData[]>([]);
const selected = ref<ResponseData[]>([]);
const orderTypeCode = ref<string>("");
onMounted(async () => {
await conditionData();
@ -107,6 +108,7 @@ const conditionData = async () => {
: null;
if (id !== null) {
await getData(id);
await fetchOrder(id);
}
};
@ -145,7 +147,35 @@ const getData = async (id: string) => {
hideLoader();
});
};
const fetchOrder = async (id: string) => {
await http
.get(config.API.detailOrder(id))
.then((res) => {
let data = res.data.result;
orderTypeCode.value = data.orderTypeCode;
})
.catch((err) => {
messageError($q, err);
});
};
const statuscode = computed(() => {
if (
orderTypeCode.value === "c-pm-01" ||
orderTypeCode.value === "c-pm-02" ||
orderTypeCode.value === "c-pm-03" ||
orderTypeCode.value === "c-pm-04" ||
orderTypeCode.value === "c-pm-05" ||
orderTypeCode.value === "c-pm-06" ||
orderTypeCode.value === "c-pm-07" ||
orderTypeCode.value === "c-pm-08" ||
orderTypeCode.value === "c-pm-09" ||
orderTypeCode.value === "c-pm-14" ||
orderTypeCode.value === "c-pm-21"
) {
return true;
}
return false;
});
const dialogDeleteData = async (id: string) => {
dialogRemove($q, () => deleteData(id));
};
@ -374,14 +404,18 @@ const addlist = async (data: Object) => {
};
const save = async () => {
// console.log("save===>", rows.value)
// console.log("save===>", rows.value);
// console.log(statuscode.value);
const check = rows.value.find((x: any) => x.salaryAmount == null);
if (selected.value.length > 0 && !check) {
if (
(selected.value.length > 0 && !check) ||
(statuscode.value === true && selected.value.length > 0)
) {
dialogConfirm($q, () => {
success($q, "บันทึกข้อมูลสำเร็จ");
next();
});
} else if (check) {
} else if (check && statuscode.value === false) {
dialogMessageNotify($q, "ระบุรายละเอียดการเงินไม่ครบ");
} else {
dialogMessageNotify($q, "กรุณาเลือกรายชื่อ");
@ -472,7 +506,7 @@ const getClass = (val: boolean) => {
<q-th auto-width />
<q-th auto-width />
<q-th auto-width />
<q-th auto-width />
<q-th auto-width v-if="statuscode !== true" />
</q-tr>
</template>
<template v-slot:body="props">
@ -508,7 +542,7 @@ const getClass = (val: boolean) => {
<!-- <q-tooltip>เลอนลำดบลง</q-tooltip> -->
</q-btn>
</q-td>
<q-td auto-width>
<q-td auto-width v-if="statuscode !== true">
<q-btn
v-if="props.row.salaryAmount === null"
dense