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