Merge branch 'develop' into devTee

This commit is contained in:
setthawutttty 2024-01-31 17:54:53 +07:00
commit f78b2dc4db
2 changed files with 55 additions and 23 deletions

View file

@ -27,6 +27,7 @@ const props = defineProps({
close: Function, close: Function,
orgLevel: Number, orgLevel: Number,
treeId: String, treeId: String,
actionType: String,
}); });
const isReadonly = ref<boolean>(false); // const isReadonly = ref<boolean>(false); //
@ -210,6 +211,21 @@ const visibleColumns = ref<string[]>([
"positionArea", "positionArea",
]); ]);
async function fetchPosition(id: string) {
showLoader();
await http
.get(config.API.orgPosPositionById(id))
.then((res) => {
console.log(res);
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
/** function เรียกรายการประเภทตำแหน่ง */ /** function เรียกรายการประเภทตำแหน่ง */
async function fetchType() { async function fetchType() {
showLoader(); showLoader();
@ -329,22 +345,21 @@ function onSubmit() {
orgChild2Id: props.orgLevel === 2 ? props.treeId : null, orgChild2Id: props.orgLevel === 2 ? props.treeId : null,
orgChild3Id: props.orgLevel === 3 ? props.treeId : null, orgChild3Id: props.orgLevel === 3 ? props.treeId : null,
orgChild4Id: props.orgLevel === 4 ? props.treeId : null, orgChild4Id: props.orgLevel === 4 ? props.treeId : null,
positions: [positionsData], positions: positionsData,
}; };
console.log(body); showLoader();
// showLoader(); await http
// await http .post(config.API.orgPosMaster, body)
// .post(config.API.orgPosMaster, body) .then((res) => {
// .then((res) => { success($q, "เพิ่มข้อมูลสำเร็จ");
// success($q, ""); })
// }) .catch((err) => {
// .catch((err) => { messageError($q, err);
// messageError($q, err); })
// }) .finally(() => {
// .finally(() => { props.close?.();
// props.close?.(); hideLoader();
// hideLoader(); });
// });
}); });
} }
/** ฟังชั่น บันทึก */ /** ฟังชั่น บันทึก */
@ -443,10 +458,14 @@ watch(
fetchType(); fetchType();
fetchLevel(); fetchLevel();
fetchExecutive(); fetchExecutive();
rowsPositionSelect.value = []; if (props.actionType === "ADD") {
search.value = ""; rowsPositionSelect.value = [];
rows.value = []; search.value = "";
clearFormPositionSelect(); rows.value = [];
clearFormPositionSelect();
} else {
// props.treeId && fetchPosition(props.treeId);
}
} }
} }
); );
@ -502,7 +521,7 @@ async function clearFormPositionSelect() {
<template> <template>
<q-dialog v-model="props.modal" persistent> <q-dialog v-model="props.modal" persistent>
<q-card style="min-width: 96vw"> <q-card style="min-width: 96vw">
<DialogHeader tittle="เพิ่มอัตรากำลัง" :close="props.close" /> <DialogHeader :tittle="props.actionType === 'ADD' ? 'เพิ่มอัตรากำลัง':'แก้ไขอัตรากำลัง'" :close="props.close" />
<q-separator /> <q-separator />
<q-card-section class="q-pa-sm"> <q-card-section class="q-pa-sm">

View file

@ -17,6 +17,7 @@ const orgLevel = defineModel<number>("orgLevel", { require: true });
const treeId = defineModel<string>("treeId", { require: true }); const treeId = defineModel<string>("treeId", { require: true });
const stroe = useOrganizational(); const stroe = useOrganizational();
const filter = ref<string>(""); const filter = ref<string>("");
const actionType = ref<string>("");
const listMenu = ref<ListMenu[]>([ const listMenu = ref<ListMenu[]>([
{ {
label: "ดูรายละเอียด", label: "ดูรายละเอียด",
@ -24,6 +25,12 @@ const listMenu = ref<ListMenu[]>([
type: "VIEWDETIAL", type: "VIEWDETIAL",
color: "primary", color: "primary",
}, },
{
label: "แก้ไข",
icon: "edit",
type: "EDIT",
color: "primary",
},
]); ]);
const document = ref<any>([ const document = ref<any>([
{ {
@ -113,7 +120,8 @@ const rows = ref<any>([
]); ]);
const dialogPosition = ref<boolean>(false); const dialogPosition = ref<boolean>(false);
function onClickPosition() { function onClickPosition(type: string) {
actionType.value = type;
dialogPosition.value = !dialogPosition.value; dialogPosition.value = !dialogPosition.value;
} }
@ -133,7 +141,7 @@ function onClickViewDetail() {
dense dense
color="primary" color="primary"
icon="add" icon="add"
@click="onClickPosition" @click="onClickPosition('ADD')"
> >
<q-tooltip>เพมตำแหน</q-tooltip></q-btn <q-tooltip>เพมตำแหน</q-tooltip></q-btn
> >
@ -240,7 +248,11 @@ function onClickViewDetail() {
clickable clickable
v-close-popup v-close-popup
@click=" @click="
item.type === 'VIEWDETIAL' ? onClickViewDetail() : null item.type === 'VIEWDETIAL'
? onClickViewDetail()
: item.type === 'EDIT'
? onClickPosition('EDIT')
: null
" "
> >
<q-item-section avatar> <q-item-section avatar>
@ -363,6 +375,7 @@ function onClickViewDetail() {
:close="onClickPosition" :close="onClickPosition"
:orgLevel="orgLevel" :orgLevel="orgLevel"
:treeId="treeId" :treeId="treeId"
:actionType="actionType"
/> />
<!-- รายละเอยดตำแหน --> <!-- รายละเอยดตำแหน -->