fix(command): edit-salary
This commit is contained in:
parent
0372eb9726
commit
d215283163
6 changed files with 534 additions and 13 deletions
|
|
@ -1,5 +1,5 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, watch } from "vue";
|
||||
import { ref, watch, computed, type PropType } from "vue";
|
||||
import { useQuasar } from "quasar";
|
||||
|
||||
import http from "@/plugins/http";
|
||||
|
|
@ -19,6 +19,7 @@ import type {
|
|||
import type { DataListCommand } from "@/modules/18_command/interface/response/Main";
|
||||
|
||||
import DialogHeader from "@/components/DialogHeader.vue";
|
||||
import DialogEditSalary from "@/modules/18_command/components/DialogEditSalary.vue";
|
||||
|
||||
const storeCommand = useCommandMainStore();
|
||||
const router = useRouter();
|
||||
|
|
@ -43,6 +44,10 @@ const props = defineProps({
|
|||
},
|
||||
});
|
||||
|
||||
const isSalary = computed(() => {
|
||||
return !!commandOp.value.find((v) => v.id == commandType.value)?.isSalary;
|
||||
});
|
||||
|
||||
const commandOp = ref<ListCommand[]>([]); // ประเภทคำสั่ง
|
||||
const commandType = ref<string>(""); //ประเภทคำสั่ง
|
||||
const commandNo = ref<string>(""); //คำสั่งเลขที่
|
||||
|
|
@ -130,6 +135,9 @@ const columns = ref<QTableProps["columns"]>([
|
|||
|
||||
const selectCreate = ref<string | null>("NEW"); //ประเภทการออกคำสั่ง สร้างใหม่/คำสั่งแบบร่าง
|
||||
|
||||
const modalSalary = ref<boolean>(false); //
|
||||
const commandOrderId = ref<string>(""); // ไอดีคำสั่งที่สร้างหรือเพิ่มคนเข้าไป
|
||||
|
||||
/** ฟังก์ชันเรียกข้อมูลรายการคำสั่ง*/
|
||||
async function getListCommandDraf() {
|
||||
showLoader();
|
||||
|
|
@ -191,12 +199,18 @@ function createCommand(isRedirect: boolean) {
|
|||
.post(config.API.command + `/person`, body)
|
||||
.then(async (res) => {
|
||||
const id = await res.data.result;
|
||||
commandOrderId.value = id;
|
||||
modal.value = false;
|
||||
if (isRedirect) {
|
||||
router.push(`/command/edit/${id}`);
|
||||
if (!isSalary.value) {
|
||||
if (isRedirect) {
|
||||
router.push(`/command/edit/${id}`);
|
||||
} else {
|
||||
clearValue();
|
||||
props.fetchData(); // เรียกฟังก์ชัน fetchData ที่ส่งมาจาก props เพื่อรีเฟรชข้อมูล
|
||||
}
|
||||
} else {
|
||||
clearValue();
|
||||
await props.fetchData(); // เรียกฟังก์ชัน fetchData ที่ส่งมาจาก props เพื่อรีเฟรชข้อมูล
|
||||
modal.value = false;
|
||||
modalSalary.value = true;
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
|
|
@ -237,12 +251,18 @@ function addPersonalToCommand(isRedirect: boolean) {
|
|||
.post(config.API.command + `/person`, body)
|
||||
.then(async (res) => {
|
||||
const id = await res.data.result;
|
||||
commandOrderId.value = id;
|
||||
modal.value = false;
|
||||
if (isRedirect) {
|
||||
router.push(`/command/edit/${id}`);
|
||||
if (!isSalary.value) {
|
||||
if (isRedirect) {
|
||||
router.push(`/command/edit/${id}`);
|
||||
} else {
|
||||
modal.value = false;
|
||||
props.fetchData(); // เรียกฟังก์ชัน fetchData ที่ส่งมาจาก props เพื่อรีเฟรชข้อมูล
|
||||
}
|
||||
} else {
|
||||
modal.value = false;
|
||||
await props.fetchData(); // เรียกฟังก์ชัน fetchData ที่ส่งมาจาก props เพื่อรีเฟรชข้อมูล
|
||||
modalSalary.value = true;
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
|
|
@ -569,7 +589,7 @@ watch(
|
|||
|
||||
<q-card-actions align="right">
|
||||
<q-btn
|
||||
v-if="isHold"
|
||||
v-if="isHold && !isSalary"
|
||||
label="บันทึกและเลือกรายชื่อต่อ"
|
||||
@click="() => onSubmit(false)"
|
||||
:disable="
|
||||
|
|
@ -580,7 +600,9 @@ watch(
|
|||
<q-tooltip>บันทึกและเลือกรายชื่อต่อ</q-tooltip>
|
||||
</q-btn>
|
||||
<q-btn
|
||||
label="บันทึกและไปยังหน้าคำสั่ง"
|
||||
:label="
|
||||
!isSalary ? 'บันทึกและไปยังหน้าคำสั่ง' : 'บันทึกและไปยังหน้าแก้ไขเงินเดือน'
|
||||
"
|
||||
@click="() => onSubmit(true)"
|
||||
:disable="
|
||||
selectCreate == 'NEW' ? commandType == '' : selected.length == 0
|
||||
|
|
@ -592,6 +614,19 @@ watch(
|
|||
</q-card-actions>
|
||||
</q-card>
|
||||
</q-dialog>
|
||||
|
||||
<DialogEditSalary
|
||||
v-model:modal="modalSalary"
|
||||
:command-code="commandTypeCode || ''"
|
||||
:command-id="
|
||||
selectCreate === 'NEW'
|
||||
? commandOrderId
|
||||
: selected.length > 0
|
||||
? selected[0].id
|
||||
: ''
|
||||
"
|
||||
:fetch-data="fetchData"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<style scoped></style>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue