Merge branch 'develop' into devTee
# Conflicts: # src/api/14_KPI/api.KPI.ts
This commit is contained in:
commit
7f0411e710
19 changed files with 1338 additions and 1192 deletions
|
|
@ -5,11 +5,13 @@ import { useRouter } from "vue-router";
|
|||
|
||||
/** importStore*/
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
/** use*/
|
||||
const $q = useQuasar();
|
||||
const router = useRouter();
|
||||
const { showLoader, hideLoader, dialogRemove, success } = useCounterMixin();
|
||||
const { showLoader, hideLoader, dialogRemove, success, messageError } =
|
||||
useCounterMixin();
|
||||
|
||||
/** หัวตาราง */
|
||||
const rows = ref<any>([]);
|
||||
|
|
@ -42,6 +44,10 @@ const columns = ref<QTableProps["columns"]>([
|
|||
style: "font-size: 14px",
|
||||
},
|
||||
]);
|
||||
const node = ref<any>([]);
|
||||
const expanded = ref<any>([]);
|
||||
const filter = ref<string>("");
|
||||
const filterMain = ref<string>("");
|
||||
const visibleColumns = ref<string[]>([
|
||||
"indicatorNo",
|
||||
"indicatorPass",
|
||||
|
|
@ -66,6 +72,11 @@ const formFilter = reactive({
|
|||
keyword: "",
|
||||
});
|
||||
|
||||
const nodeData = reactive<any>({
|
||||
node: null,
|
||||
nodeId: null,
|
||||
});
|
||||
|
||||
function fetchList() {
|
||||
showLoader();
|
||||
const data = [
|
||||
|
|
@ -101,8 +112,49 @@ function onClickDelete(id: number) {
|
|||
});
|
||||
}
|
||||
|
||||
function fetchActive() {
|
||||
showLoader();
|
||||
http
|
||||
.get(config.API.activeOrganization)
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
fetchTree(data.activeId);
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
async function fetchTree(id: string) {
|
||||
showLoader();
|
||||
http
|
||||
.get(config.API.orgByid(id.toString()))
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
node.value = data;
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
function updateSelectedTreeMain(data: any) {
|
||||
if (nodeData.node === data.orgLevel && nodeData.nodeId === data.orgTreeId) {
|
||||
nodeData.node = null;
|
||||
nodeData.nodeId = null;
|
||||
} else {
|
||||
nodeData.node = data.orgLevel;
|
||||
nodeData.nodeId = data.orgTreeId;
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
fetchList();
|
||||
fetchActive();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
@ -111,139 +163,207 @@ onMounted(() => {
|
|||
รายการตัวชี้วัดตามแผนฯ
|
||||
</div>
|
||||
<q-card flat bordered class="q-pa-md">
|
||||
<q-toolbar class="q-pa-none">
|
||||
<div class="row q-gutter-x-sm">
|
||||
<div>
|
||||
<q-select
|
||||
dense
|
||||
outlined
|
||||
v-model="formFilter.org"
|
||||
:options="orgOp"
|
||||
label="หน่วยงาน/ส่วนราชการ"
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
emit-value
|
||||
map-options
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<q-select
|
||||
dense
|
||||
outlined
|
||||
v-model="formFilter.round"
|
||||
:options="roundOp"
|
||||
label="รอบการประเมิน"
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
emit-value
|
||||
map-options
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<q-toolbar-title>
|
||||
<q-btn
|
||||
flat
|
||||
round
|
||||
dense
|
||||
icon="add"
|
||||
color="primary"
|
||||
@click="onClickAddOrView()"
|
||||
>
|
||||
<q-tooltip>เพิ่ม</q-tooltip>
|
||||
</q-btn>
|
||||
</q-toolbar-title>
|
||||
|
||||
<q-space />
|
||||
<div class="row q-gutter-sm">
|
||||
<div>
|
||||
<q-input
|
||||
standout
|
||||
dense
|
||||
v-model="formFilter.keyword"
|
||||
ref="filterRef"
|
||||
outlined
|
||||
debounce="300"
|
||||
placeholder="ค้นหา"
|
||||
>
|
||||
<template v-slot:append>
|
||||
<q-icon v-if="formFilter.keyword == ''" name="search" />
|
||||
<q-icon
|
||||
v-if="formFilter.keyword !== ''"
|
||||
name="clear"
|
||||
class="cursor-pointer"
|
||||
@click="formFilter.keyword = ''"
|
||||
/>
|
||||
</template>
|
||||
</q-input>
|
||||
</div>
|
||||
<div>
|
||||
<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"
|
||||
options-cover
|
||||
style="min-width: 150px"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</q-toolbar>
|
||||
|
||||
<div class="col-12">
|
||||
<d-table
|
||||
for="table"
|
||||
ref="table"
|
||||
:columns="columns"
|
||||
:rows="rows"
|
||||
row-key="subject"
|
||||
flat
|
||||
bordered
|
||||
dense
|
||||
class="custom-header-table"
|
||||
:visible-columns="visibleColumns"
|
||||
>
|
||||
<template v-slot:header="props">
|
||||
<q-tr :props="props">
|
||||
<q-th v-for="col in props.cols" :key="col.name" :props="props">
|
||||
<span class="text-weight-medium">{{ col.label }}</span>
|
||||
</q-th>
|
||||
<q-th auto-width />
|
||||
</q-tr>
|
||||
</template>
|
||||
<template v-slot:body="props">
|
||||
<q-tr :props="props" class="cursor-pointer">
|
||||
<q-td
|
||||
v-for="col in props.cols"
|
||||
:key="col.name"
|
||||
:props="props"
|
||||
@click="onClickAddOrView(true, props.row.id)"
|
||||
>
|
||||
<div class="table_ellipsis">
|
||||
{{ col.value ? col.value : "-" }}
|
||||
<div class="row q-col-gutter-sm">
|
||||
<q-card bordered class="col-4">
|
||||
<q-card-section class="q-py-sm">
|
||||
<div class="text-subtitle2 text-bold">หน่วยงาน/ส่วนราชการ</div>
|
||||
</q-card-section>
|
||||
<div class="col-xs-12 col-sm-3 row">
|
||||
<div class="col-12 row no-wrap">
|
||||
<div class="col-12 q-py-sm q-px-sm">
|
||||
<div class="q-gutter-sm">
|
||||
<q-input dense outlined v-model="filterMain" label="ค้นหา">
|
||||
<template v-slot:append>
|
||||
<q-icon
|
||||
v-if="filterMain !== ''"
|
||||
name="clear"
|
||||
class="cursor-pointer"
|
||||
@click="filterMain = ''"
|
||||
/>
|
||||
<q-icon v-else name="search" color="grey-5" />
|
||||
</template>
|
||||
</q-input>
|
||||
<div>
|
||||
<q-tree
|
||||
class="tree-container"
|
||||
dense
|
||||
:nodes="node"
|
||||
node-key="orgTreeName"
|
||||
label-key="labelName"
|
||||
v-model:expanded="expanded"
|
||||
:filter="filterMain"
|
||||
no-results-label="ไม่พบข้อมูลที่ค้นหา"
|
||||
no-nodes-label="ไม่มีข้อมูล"
|
||||
v-model:selected="nodeData.nodeId"
|
||||
>
|
||||
<template v-slot:default-header="prop">
|
||||
<q-item
|
||||
clickable
|
||||
@click.stop="updateSelectedTreeMain(prop.node)"
|
||||
:active="nodeData.nodeId === prop.node.orgTreeId"
|
||||
active-class="my-list-link text-primary text-weight-medium"
|
||||
class="row col-12 items-center text-dark q-py-xs q-pl-sm rounded-borders my-list"
|
||||
>
|
||||
<div>
|
||||
<div class="text-weight-medium">
|
||||
{{ prop.node.orgTreeName }}
|
||||
</div>
|
||||
<div class="text-weight-light text-grey-8">
|
||||
{{
|
||||
prop.node.orgCode == null
|
||||
? null
|
||||
: prop.node.orgCode
|
||||
}}
|
||||
{{
|
||||
prop.node.orgTreeShortName == null
|
||||
? null
|
||||
: prop.node.orgTreeShortName
|
||||
}}
|
||||
</div>
|
||||
</div>
|
||||
</q-item>
|
||||
</template>
|
||||
</q-tree>
|
||||
</div>
|
||||
</div>
|
||||
</q-td>
|
||||
<q-td>
|
||||
<q-btn
|
||||
flat
|
||||
round
|
||||
icon="delete"
|
||||
color="red"
|
||||
@click.stop.pervent="onClickDelete(props.rowIndex)"
|
||||
>
|
||||
<q-tooltip>ลบข้อมูล </q-tooltip>
|
||||
</q-btn>
|
||||
</q-td>
|
||||
</q-tr>
|
||||
</template>
|
||||
</d-table>
|
||||
</div>
|
||||
<div class="col-12 row">
|
||||
<q-separator :vertical="!$q.screen.lt.md" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</q-card>
|
||||
<div class="col-8">
|
||||
<div class="row q-col-gutter-sm q-mb-sm">
|
||||
<div class="col-3">
|
||||
<q-select
|
||||
dense
|
||||
outlined
|
||||
v-model="formFilter.round"
|
||||
:options="roundOp"
|
||||
label="รอบการประเมิน"
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
emit-value
|
||||
map-options
|
||||
/>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<q-btn
|
||||
flat
|
||||
round
|
||||
dense
|
||||
icon="add"
|
||||
color="primary"
|
||||
@click="onClickAddOrView()"
|
||||
>
|
||||
<q-tooltip>เพิ่ม</q-tooltip>
|
||||
</q-btn>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<q-input
|
||||
standout
|
||||
dense
|
||||
v-model="formFilter.keyword"
|
||||
ref="filterRef"
|
||||
outlined
|
||||
debounce="300"
|
||||
placeholder="ค้นหา"
|
||||
>
|
||||
<template v-slot:append>
|
||||
<q-icon v-if="formFilter.keyword == ''" name="search" />
|
||||
<q-icon
|
||||
v-if="formFilter.keyword !== ''"
|
||||
name="clear"
|
||||
class="cursor-pointer"
|
||||
@click="formFilter.keyword = ''"
|
||||
/>
|
||||
</template>
|
||||
</q-input>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<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"
|
||||
options-cover
|
||||
style="min-width: 150px"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<d-table
|
||||
for="table"
|
||||
ref="table"
|
||||
:columns="columns"
|
||||
:rows="rows"
|
||||
row-key="subject"
|
||||
flat
|
||||
bordered
|
||||
dense
|
||||
class="custom-header-table"
|
||||
:visible-columns="visibleColumns"
|
||||
>
|
||||
<template v-slot:header="props">
|
||||
<q-tr :props="props">
|
||||
<q-th v-for="col in props.cols" :key="col.name" :props="props">
|
||||
<span class="text-weight-medium">{{ col.label }}</span>
|
||||
</q-th>
|
||||
<q-th auto-width />
|
||||
</q-tr>
|
||||
</template>
|
||||
<template v-slot:body="props">
|
||||
<q-tr :props="props" class="cursor-pointer">
|
||||
<q-td
|
||||
v-for="col in props.cols"
|
||||
:key="col.name"
|
||||
:props="props"
|
||||
@click="onClickAddOrView(true, props.row.id)"
|
||||
>
|
||||
<div class="table_ellipsis">
|
||||
{{ col.value ? col.value : "-" }}
|
||||
</div>
|
||||
</q-td>
|
||||
<q-td>
|
||||
<q-btn
|
||||
flat
|
||||
round
|
||||
icon="delete"
|
||||
color="red"
|
||||
@click.stop.pervent="onClickDelete(props.rowIndex)"
|
||||
>
|
||||
<q-tooltip>ลบข้อมูล </q-tooltip>
|
||||
</q-btn>
|
||||
</q-td>
|
||||
</q-tr>
|
||||
</template>
|
||||
</d-table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</q-card>
|
||||
</template>
|
||||
|
||||
<style scoped></style>
|
||||
<style lang="scss" scoped>
|
||||
.tree-container {
|
||||
overflow: auto;
|
||||
height: 65vh;
|
||||
border: 1px solid #e6e6e7;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.my-list-link {
|
||||
color: rgb(118, 168, 222);
|
||||
border-radius: 5px;
|
||||
background: #a3d3fb48 !important;
|
||||
font-weight: 600;
|
||||
border: 1px solid rgba(175, 185, 196, 0.217);
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -70,17 +70,32 @@ const columns = ref<QTableProps["columns"]>([
|
|||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
},
|
||||
{
|
||||
name: "isActive",
|
||||
align: "left",
|
||||
label: "สถานะ",
|
||||
sortable: true,
|
||||
field: "isActive",
|
||||
format: (val) => (val ? "เปิด" : "ปิดแล้ว"),
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
},
|
||||
]);
|
||||
const visibleColumns = ref<string[]>([
|
||||
"durationKPI",
|
||||
"startDate",
|
||||
"endDate",
|
||||
"isActive",
|
||||
]);
|
||||
const visibleColumns = ref<string[]>(["durationKPI", "startDate", "endDate"]);
|
||||
|
||||
/** itemMenu*/
|
||||
const itemMenu = ref<ItemsMenu[]>([
|
||||
{
|
||||
label: "เปิดรอบ",
|
||||
value: "open",
|
||||
icon: "mdi-check",
|
||||
color: "primary",
|
||||
},
|
||||
// {
|
||||
// label: "เปิดรอบ",
|
||||
// value: "open",
|
||||
// icon: "mdi-check",
|
||||
// color: "primary",
|
||||
// },
|
||||
{
|
||||
label: "ปิดรอบ",
|
||||
value: "close",
|
||||
|
|
@ -113,6 +128,7 @@ const formQuery = reactive<FormQueryRound>({
|
|||
const totalList = ref<number>(1);
|
||||
const formData = reactive<FormRound>({
|
||||
durationKPI: "",
|
||||
year: null,
|
||||
startDate: null,
|
||||
endDate: null,
|
||||
});
|
||||
|
|
@ -172,6 +188,7 @@ function clearFormData() {
|
|||
formData.durationKPI = "";
|
||||
formData.startDate = null;
|
||||
formData.endDate = null;
|
||||
formData.year = null;
|
||||
}
|
||||
|
||||
/** function บันทึกข้อมูลเพิ่มรอบการประเมิน*/
|
||||
|
|
@ -244,6 +261,7 @@ function onCloseRounde(id: string) {
|
|||
dialogConfirm(
|
||||
$q,
|
||||
() => {
|
||||
showLoader();
|
||||
http
|
||||
.get(config.API.kpiPeriod + `/close/${id}`)
|
||||
.then(() => {
|
||||
|
|
@ -336,7 +354,9 @@ onMounted(() => {
|
|||
dense
|
||||
lazy-rules
|
||||
outlined
|
||||
:model-value="Number(formQuery.year) + 543"
|
||||
:model-value="
|
||||
formQuery.year === 0 ? 'ทั้งหมด' : Number(formQuery.year) + 543
|
||||
"
|
||||
:label="`${'ปีงบประมาณ'}`"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
|
|
@ -347,6 +367,15 @@ onMounted(() => {
|
|||
>
|
||||
</q-icon>
|
||||
</template>
|
||||
<template v-if="formQuery.year" v-slot:append>
|
||||
<q-icon
|
||||
name="cancel"
|
||||
@click.stop.prevent="
|
||||
(formQuery.year = 0), (formQuery.page = 1), fetchList()
|
||||
"
|
||||
class="cursor-pointer"
|
||||
/>
|
||||
</template>
|
||||
</q-input>
|
||||
</template>
|
||||
</datepicker>
|
||||
|
|
@ -462,7 +491,9 @@ onMounted(() => {
|
|||
<q-item
|
||||
clickable
|
||||
v-close-popup
|
||||
v-for="items in itemMenu"
|
||||
v-for="items in props.row.isActive
|
||||
? itemMenu
|
||||
: itemMenu.slice(1, 2)"
|
||||
@click="onClickAction(items.value, props.row.id)"
|
||||
>
|
||||
<q-item-section avatar>
|
||||
|
|
@ -526,6 +557,49 @@ onMounted(() => {
|
|||
]"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<datepicker
|
||||
menu-class-name="modalfix"
|
||||
v-model="formData.year"
|
||||
:locale="'th'"
|
||||
autoApply
|
||||
year-picker
|
||||
:enableTimePicker="false"
|
||||
>
|
||||
<template #year="{ year }">{{ year + 543 }}</template>
|
||||
<template #year-overlay-value="{ value }">{{
|
||||
parseInt(value + 543)
|
||||
}}</template>
|
||||
<template #trigger>
|
||||
<q-input
|
||||
dense
|
||||
outlined
|
||||
hide-bottom-space
|
||||
class="inputgreen"
|
||||
:model-value="
|
||||
formData.year === null
|
||||
? null
|
||||
: Number(formData.year) + 543
|
||||
"
|
||||
:label="`${'ปีงบประมาณ'}`"
|
||||
:rules="[
|
||||
(val:string) =>
|
||||
!!val || `${'กรุณาเลือกปีงบประมาณ'}`,
|
||||
]"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<q-icon
|
||||
name="event"
|
||||
class="cursor-pointer"
|
||||
style="color: var(--q-primary)"
|
||||
>
|
||||
</q-icon>
|
||||
</template>
|
||||
</q-input>
|
||||
</template>
|
||||
</datepicker>
|
||||
</div>
|
||||
|
||||
<div class="col-12">
|
||||
<datepicker
|
||||
menu-class-name="modalfix"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue