ปรับ ออกคำสั่ง
This commit is contained in:
parent
cf8bdb7ce0
commit
46f4173524
3 changed files with 111 additions and 34 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue