fix ข้อมูล
This commit is contained in:
parent
70bebf6e7e
commit
9ff4389045
4 changed files with 39 additions and 16 deletions
|
|
@ -48,7 +48,7 @@ const columns = ref<QTableProps["columns"]>([
|
|||
{
|
||||
name: "posLevelName",
|
||||
align: "left",
|
||||
label: "กลุ่มงาน",
|
||||
label: "ระดับชั้นงาน",
|
||||
sortable: true,
|
||||
field: "posLevelName",
|
||||
headerStyle: "font-size: 14px",
|
||||
|
|
@ -57,7 +57,7 @@ const columns = ref<QTableProps["columns"]>([
|
|||
{
|
||||
name: "posTypeName",
|
||||
align: "left",
|
||||
label: "ระดับชั้นงาน",
|
||||
label: "กลุ่มงาน",
|
||||
sortable: true,
|
||||
field: "posTypeName",
|
||||
headerStyle: "font-size: 14px",
|
||||
|
|
@ -72,6 +72,9 @@ const columns = ref<QTableProps["columns"]>([
|
|||
field: "posLevelAuthority",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
format(val, row) {
|
||||
return convertPosLevelAuthority(val);
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "createdAt",
|
||||
|
|
@ -343,9 +346,6 @@ onMounted(() => {
|
|||
<div v-if="col.name == 'no'">
|
||||
{{ props.rowIndex + 1 }}
|
||||
</div>
|
||||
<div v-else-if="col.name === 'posLevelAuthority'">
|
||||
{{ col.value ? convertPosLevelAuthority(col.value) : "-" }}
|
||||
</div>
|
||||
<div v-else>
|
||||
{{ col.value ?? "-" }}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -18,10 +18,13 @@ export const usePersonalDataStore = defineStore("PersonalData", () => {
|
|||
* @param data ข้อมูลรายการจาก API
|
||||
*/
|
||||
async function save(data: DataResponse[]) {
|
||||
row.value = [];
|
||||
const list = data.map((e) => ({
|
||||
...e,
|
||||
createdAt: e.createdAt ? date2Thai(e.createdAt) : "",
|
||||
lastUpdatedAt: e.lastUpdatedAt ? date2Thai(e.lastUpdatedAt) : "",
|
||||
createdAt: e.createdAt ? date2Thai(e.createdAt, false, true) : "-",
|
||||
lastUpdatedAt: e.lastUpdatedAt
|
||||
? date2Thai(e.lastUpdatedAt, false, true)
|
||||
: "-",
|
||||
}));
|
||||
row.value = list;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,17 +95,19 @@ function onSubmit() {
|
|||
});
|
||||
}
|
||||
|
||||
function onSelectAll(type: string) {
|
||||
const isPromiss = ref<boolean | null>(null);
|
||||
|
||||
function onSelectAll(val: boolean) {
|
||||
isChangData.value = true;
|
||||
switch (type) {
|
||||
case "in":
|
||||
switch (val) {
|
||||
case true:
|
||||
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":
|
||||
case false:
|
||||
sysType.value = [];
|
||||
break;
|
||||
}
|
||||
|
|
@ -129,7 +131,16 @@ watch(
|
|||
);
|
||||
|
||||
sysType.value = assignId;
|
||||
console.log(sysTypeOptions.value.length);
|
||||
console.log(sysType.value.length);
|
||||
|
||||
isChangData.value = false;
|
||||
isPromiss.value =
|
||||
sysType.value.length === 0
|
||||
? false
|
||||
: sysTypeOptions.value.length === sysType.value.length
|
||||
? true
|
||||
: null;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
@ -144,7 +155,14 @@ watch(
|
|||
|
||||
<q-card-section style="max-height: 80vh" class="scroll">
|
||||
<div class="row q-gutter-sm">
|
||||
<q-btn
|
||||
<q-checkbox
|
||||
color="primary"
|
||||
keep-color
|
||||
v-model="isPromiss"
|
||||
label="เลือกสิทธิ์ทั้งหมด"
|
||||
@update:model-value="onSelectAll"
|
||||
/>
|
||||
<!-- <q-btn
|
||||
color="primary"
|
||||
label="เลือกสิทธิ์ทั้งหมด"
|
||||
@click="onSelectAll('in')"
|
||||
|
|
@ -153,7 +171,7 @@ watch(
|
|||
color="secondary"
|
||||
label="สิทธิ์ออกทั้งหมด"
|
||||
@click="onSelectAll('out')"
|
||||
/>
|
||||
/> -->
|
||||
</div>
|
||||
<div
|
||||
v-for="(item, index) in sysTypeOptions"
|
||||
|
|
@ -185,7 +203,9 @@ watch(
|
|||
dense
|
||||
v-model="sysType"
|
||||
:val="op.id"
|
||||
@update:model-value="isChangData = true"
|
||||
@update:model-value="
|
||||
(isChangData = true), (isPromiss = null)
|
||||
"
|
||||
/>
|
||||
</q-item-section>
|
||||
|
||||
|
|
|
|||
|
|
@ -684,7 +684,7 @@ onMounted(() => {
|
|||
size="12px"
|
||||
>
|
||||
<q-menu>
|
||||
<q-list dense style="min-width: 250px">
|
||||
<q-list dense style="min-width: 280px">
|
||||
<q-item
|
||||
clickable
|
||||
v-close-popup
|
||||
|
|
@ -709,7 +709,7 @@ onMounted(() => {
|
|||
<q-item-section avatar>
|
||||
<q-icon color="red" name="delete" />
|
||||
</q-item-section>
|
||||
<q-item-section> ลบ</q-item-section>
|
||||
<q-item-section> ลบหน้าที่ความรับผิดชอบทั้งหมด</q-item-section>
|
||||
</q-item>
|
||||
</q-list>
|
||||
</q-menu>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue