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,
orgLevel: Number,
treeId: String,
actionType: String,
});
const isReadonly = ref<boolean>(false); //
@ -210,6 +211,21 @@ const visibleColumns = ref<string[]>([
"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 เรียกรายการประเภทตำแหน่ง */
async function fetchType() {
showLoader();
@ -329,22 +345,21 @@ function onSubmit() {
orgChild2Id: props.orgLevel === 2 ? props.treeId : null,
orgChild3Id: props.orgLevel === 3 ? props.treeId : null,
orgChild4Id: props.orgLevel === 4 ? props.treeId : null,
positions: [positionsData],
positions: positionsData,
};
console.log(body);
// showLoader();
// await http
// .post(config.API.orgPosMaster, body)
// .then((res) => {
// success($q, "");
// })
// .catch((err) => {
// messageError($q, err);
// })
// .finally(() => {
// props.close?.();
// hideLoader();
// });
showLoader();
await http
.post(config.API.orgPosMaster, body)
.then((res) => {
success($q, "เพิ่มข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
props.close?.();
hideLoader();
});
});
}
/** ฟังชั่น บันทึก */
@ -443,10 +458,14 @@ watch(
fetchType();
fetchLevel();
fetchExecutive();
rowsPositionSelect.value = [];
search.value = "";
rows.value = [];
clearFormPositionSelect();
if (props.actionType === "ADD") {
rowsPositionSelect.value = [];
search.value = "";
rows.value = [];
clearFormPositionSelect();
} else {
// props.treeId && fetchPosition(props.treeId);
}
}
}
);
@ -502,7 +521,7 @@ async function clearFormPositionSelect() {
<template>
<q-dialog v-model="props.modal" persistent>
<q-card style="min-width: 96vw">
<DialogHeader tittle="เพิ่มอัตรากำลัง" :close="props.close" />
<DialogHeader :tittle="props.actionType === 'ADD' ? 'เพิ่มอัตรากำลัง':'แก้ไขอัตรากำลัง'" :close="props.close" />
<q-separator />
<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 stroe = useOrganizational();
const filter = ref<string>("");
const actionType = ref<string>("");
const listMenu = ref<ListMenu[]>([
{
label: "ดูรายละเอียด",
@ -24,6 +25,12 @@ const listMenu = ref<ListMenu[]>([
type: "VIEWDETIAL",
color: "primary",
},
{
label: "แก้ไข",
icon: "edit",
type: "EDIT",
color: "primary",
},
]);
const document = ref<any>([
{
@ -113,7 +120,8 @@ const rows = ref<any>([
]);
const dialogPosition = ref<boolean>(false);
function onClickPosition() {
function onClickPosition(type: string) {
actionType.value = type;
dialogPosition.value = !dialogPosition.value;
}
@ -133,7 +141,7 @@ function onClickViewDetail() {
dense
color="primary"
icon="add"
@click="onClickPosition"
@click="onClickPosition('ADD')"
>
<q-tooltip>เพมตำแหน</q-tooltip></q-btn
>
@ -240,7 +248,11 @@ function onClickViewDetail() {
clickable
v-close-popup
@click="
item.type === 'VIEWDETIAL' ? onClickViewDetail() : null
item.type === 'VIEWDETIAL'
? onClickViewDetail()
: item.type === 'EDIT'
? onClickPosition('EDIT')
: null
"
>
<q-item-section avatar>
@ -363,6 +375,7 @@ function onClickViewDetail() {
:close="onClickPosition"
:orgLevel="orgLevel"
:treeId="treeId"
:actionType="actionType"
/>
<!-- รายละเอยดตำแหน -->