ทดลองงาน

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-11-29 18:16:49 +07:00
parent 346397d589
commit e6cff6dece
6 changed files with 260 additions and 270 deletions

View file

@ -166,7 +166,6 @@ const columns = ref<QTableProps["columns"]>([
*/
function filterSelector(val: string, update: Function) {
update(() => {
commandType.value = val ? "" : commandType.value;
commandOp.value = listCommand.value.filter(
(v: any) => v.name.indexOf(val) > -1
);
@ -200,7 +199,7 @@ async function getList() {
config.API.probationPersonalList() +
`?status=${commandType.value == "C-PM-11" ? 2 : 3}&page=${
pagination.value.page
}&pageSize=${pagination.value.rowsPerPage}`
}&pageSize=${pagination.value.rowsPerPage}&keyword=${filter.value}`
)
.then(async (res) => {
const data = await res.data.result.data;
@ -260,144 +259,150 @@ watch(
<DialogHeader :tittle="'ส่งไปออกคำสั่ง'" :close="closeModal" />
<q-separator />
<q-card-section>
<div class="row q-mb-sm" style="padding: 0">
<q-select
v-model="commandType"
dense
outlined
label="ประเภทคำสั่ง"
:options="commandOp"
option-label="name"
option-value="code"
emit-value
class="inputgreen"
map-options
use-input
style="width: 350px; max-width: auto"
@update:model-value="getList()"
@filter="(inputValue:any,
doneFn:Function) => filterSelector(inputValue, doneFn
) "
>
<template v-slot:no-option>
<q-item>
<q-item-section class="text-grey"> ไมอม </q-item-section>
</q-item>
</template></q-select
>
<q-space />
<q-input
borderless
outlined
dense
debounce="300"
v-model="filter"
placeholder="ค้นหา"
style="width: 200px; max-width: auto"
>
<template v-slot:append>
<q-icon v-if="filter == ''" name="search" />
<q-icon
v-if="filter !== ''"
name="clear"
class="cursor-pointer"
@click="filter = ''"
/>
</template>
</q-input>
<q-select
v-model="visibleColumns"
multiple
outlined
dense
options-dense
:display-value="$q.lang.table.columns"
emit-value
map-options
:options="columns"
option-value="name"
style="min-width: 140px"
class="gt-xs q-ml-sm"
/>
</div>
<d-table
:columns="columns"
:rows="rows"
:filter="filter"
row-key="personal_id"
:visible-columns="visibleColumns"
selection="single"
v-model:selected="selected"
:rows-per-page-options="[10, 25, 50, 100]"
@update:pagination="updatePagination"
>
<template v-slot:header-selection="scope">
<q-checkbox
keep-color
color="primary"
<div class="row col-12 q-col-gutter-sm">
<div class="row col-12 q-col-gutter-sm">
<q-select
v-model="commandType"
dense
:disable="commandType"
v-model="scope.selected"
outlined
label="ประเภทคำสั่ง"
:options="commandOp"
option-label="name"
option-value="code"
emit-value
map-options
use-input
hide-selected
fill-input
style="width: 620px; max-width: auto"
@update:model-value="(pagination.page = 1), getList()"
@filter="(inputValue:any,
doneFn:Function) => filterSelector(inputValue, doneFn
) "
>
<template v-slot:no-option>
<q-item>
<q-item-section class="text-grey">
ไมอม
</q-item-section>
</q-item>
</template></q-select
>
<q-space />
<q-input
borderless
outlined
dense
debounce="300"
v-model="filter"
placeholder="ค้นหา"
style="width: 200px; max-width: auto"
@keydown.enter="(pagination.page = 1), getList()"
>
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
<q-select
v-model="visibleColumns"
multiple
outlined
dense
options-dense
:display-value="$q.lang.table.columns"
emit-value
map-options
:options="columns"
option-value="name"
style="min-width: 140px"
/>
</template>
<template v-slot:body="props">
<q-tr :props="props">
<q-td>
</div>
<div class="col-12">
<d-table
:columns="columns"
:rows="rows"
row-key="personal_id"
:visible-columns="visibleColumns"
selection="single"
v-model:selected="selected"
:rows-per-page-options="[10, 25, 50, 100]"
@update:pagination="updatePagination"
>
<template v-slot:header-selection="scope">
<q-checkbox
keep-color
color="primary"
dense
:disable="commandType"
v-model="props.selected"
v-model="scope.selected"
/>
</q-td>
<q-td v-for="col in props.cols" :key="col.name" :props="props">
<div v-if="col.name == 'no'">
{{
(pagination.page - 1) * pagination.rowsPerPage +
props.rowIndex +
1
}}
</div>
<div v-else-if="col.name == 'order_number'">
{{
props.row.order_number
? props.row.order_number != "xx/2566"
? props.row.order_number
: "-"
: "-"
}}
</div>
<div v-else-if="col.name == 'probation_status'">
{{
props.row.probation_status
? store.statusProbationMain(props.row.probation_status)
: "-"
}}
</div>
</template>
<template v-slot:body="props">
<q-tr :props="props">
<q-td>
<q-checkbox
keep-color
color="primary"
dense
:disable="commandType"
v-model="props.selected"
/>
</q-td>
<q-td
v-for="col in props.cols"
:key="col.name"
:props="props"
>
<div v-if="col.name == 'no'">
{{
(pagination.page - 1) * pagination.rowsPerPage +
props.rowIndex +
1
}}
</div>
<div v-else-if="col.name == 'order_number'">
{{
props.row.order_number
? props.row.order_number != "xx/2566"
? props.row.order_number
: "-"
: "-"
}}
</div>
<div v-else-if="col.name == 'probation_status'">
{{
props.row.probation_status
? store.statusProbationMain(
props.row.probation_status
)
: "-"
}}
</div>
<div v-else>
{{ col.value ? col.value : "-" }}
</div>
</q-td>
</q-tr>
</template>
<template v-slot:pagination="scope">
งหมด {{ total }} รายการ
<q-pagination
v-model="pagination.page"
active-color="primary"
color="dark"
:max="Number(totalList)"
size="sm"
boundary-links
direction-links
:max-pages="5"
@update:model-value="getList"
></q-pagination>
</template>
</d-table>
<div v-else>
{{ col.value ? col.value : "-" }}
</div>
</q-td>
</q-tr>
</template>
<template v-slot:pagination="scope">
งหมด {{ total }} รายการ
<q-pagination
v-model="pagination.page"
active-color="primary"
color="dark"
:max="Number(totalList)"
size="sm"
boundary-links
direction-links
:max-pages="5"
@update:model-value="getList"
></q-pagination>
</template>
</d-table>
</div>
</div>
</q-card-section>
<q-separator />
<q-card-actions align="right">