หมายหน้าที่ความรับผิดชอบ
This commit is contained in:
parent
63a468d732
commit
1cedcf539f
1 changed files with 53 additions and 26 deletions
|
|
@ -69,31 +69,45 @@ function closeDialog() {
|
||||||
|
|
||||||
/** ฟังก์ชันยืนยันการบันทึกข้อมูลกำหนดหน้าที่ความรับผิดชอบ*/
|
/** ฟังก์ชันยืนยันการบันทึกข้อมูลกำหนดหน้าที่ความรับผิดชอบ*/
|
||||||
function onSubmit() {
|
function onSubmit() {
|
||||||
if (sysType.value.length !== 0) {
|
dialogConfirm($q, async () => {
|
||||||
dialogConfirm($q, async () => {
|
const body = {
|
||||||
const body = {
|
posMasterId: posMasterId.value,
|
||||||
posMasterId: posMasterId.value,
|
assignIds: sysType.value,
|
||||||
assignIds: sysType.value,
|
};
|
||||||
};
|
showLoader();
|
||||||
showLoader();
|
await http
|
||||||
await http
|
.post(config.API.posAssign, body)
|
||||||
.post(config.API.posAssign, body)
|
.then(async () => {
|
||||||
.then(async () => {
|
await props.fetchDataTable(
|
||||||
await props.fetchDataTable(
|
props.reqMaster.id,
|
||||||
props.reqMaster.id,
|
props.reqMaster.revisionId,
|
||||||
props.reqMaster.revisionId,
|
props.reqMaster.type
|
||||||
props.reqMaster.type
|
);
|
||||||
);
|
closeDialog();
|
||||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||||
closeDialog();
|
})
|
||||||
})
|
.catch((err) => {
|
||||||
.catch((err) => {
|
messageError($q, err);
|
||||||
messageError($q, err);
|
})
|
||||||
})
|
.finally(() => {
|
||||||
.finally(() => {
|
hideLoader();
|
||||||
hideLoader();
|
});
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
|
|
||||||
|
function onSelectAll(type: string) {
|
||||||
|
isChangData.value = true;
|
||||||
|
switch (type) {
|
||||||
|
case "in":
|
||||||
|
const allAssginsIds = sysTypeOptions.value.reduce((acc, item) => {
|
||||||
|
const ids = item.assgins.map((assign) => assign.id); // ดึง id ใน assgins
|
||||||
|
return acc.concat(ids); // รวม id เข้ากับอาร์เรย์สะสม
|
||||||
|
}, [] as string[]);
|
||||||
|
sysType.value = allAssginsIds;
|
||||||
|
break;
|
||||||
|
case "out":
|
||||||
|
sysType.value = [];
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -113,6 +127,7 @@ watch(
|
||||||
const assignId = props.dataPosMaster.posMasterAssigns.map(
|
const assignId = props.dataPosMaster.posMasterAssigns.map(
|
||||||
(r: PosMaster) => r.assignId
|
(r: PosMaster) => r.assignId
|
||||||
);
|
);
|
||||||
|
|
||||||
sysType.value = assignId;
|
sysType.value = assignId;
|
||||||
isChangData.value = false;
|
isChangData.value = false;
|
||||||
}
|
}
|
||||||
|
|
@ -128,6 +143,18 @@ watch(
|
||||||
<q-separator />
|
<q-separator />
|
||||||
|
|
||||||
<q-card-section style="max-height: 80vh" class="scroll">
|
<q-card-section style="max-height: 80vh" class="scroll">
|
||||||
|
<div class="row q-gutter-sm">
|
||||||
|
<q-btn
|
||||||
|
color="primary"
|
||||||
|
label="เลือกสิทธิ์ทั้งหมด"
|
||||||
|
@click="onSelectAll('in')"
|
||||||
|
/>
|
||||||
|
<q-btn
|
||||||
|
color="secondary"
|
||||||
|
label="สิทธิ์ออกทั้งหมด"
|
||||||
|
@click="onSelectAll('out')"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
<div
|
<div
|
||||||
v-for="(item, index) in sysTypeOptions"
|
v-for="(item, index) in sysTypeOptions"
|
||||||
:key="index"
|
:key="index"
|
||||||
|
|
@ -175,7 +202,7 @@ watch(
|
||||||
<q-separator />
|
<q-separator />
|
||||||
<q-card-actions align="right">
|
<q-card-actions align="right">
|
||||||
<q-btn
|
<q-btn
|
||||||
:disable="sysType.length === 0 || !isChangData"
|
:disable="!isChangData"
|
||||||
label="บันทึก"
|
label="บันทึก"
|
||||||
color="secondary"
|
color="secondary"
|
||||||
type="submit"
|
type="submit"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue