แก้ list ประเภทสมรรถนะซ้ำ

This commit is contained in:
Warunee Tamkoo 2024-04-09 11:36:19 +07:00
parent 7a0ca5bb65
commit 618037135d
2 changed files with 40 additions and 57 deletions

View file

@ -5,40 +5,35 @@ import { useCounterMixin } from "@/stores/mixin";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
import type{ DataOption } from '@/modules/14_KPI/interface/index/Main' import type { DataOption } from "@/modules/14_KPI/interface/index/Main";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
const router = useRouter();
const router = useRouter() const rows = ref<any>();
const rows = ref<any>()
const competencyTypeOp = ref<DataOption[]>([ const competencyTypeOp = ref<DataOption[]>([
{ {
id:'ID1', id: "ID1",
name:'สมรรถนะหลัก', name: "สมรรถนะหลัก",
}, },
{ {
id:'ID2', id: "ID2",
name:'สมรรถนะประจำกลุ่มงาน', name: "สมรรถนะประจำกลุ่มงาน",
}, },
{ {
id:'ID3', id: "ID3",
name:'สมรรถนะประจำกลุ่มงาน', name: "สมรรถนะประจำผู้บริหารกรุงเทพมหานคร",
}, },
{ {
id:'ID4', id: "ID4",
name:'สมรรถนะประจำผู้บริหารกรุงเทพมหานคร', name: "สมรรถนะเฉพาะสำหรับตำแหน่ง ผอ.เขต ผช.ผอ.เขต และหัวหน้าฝ่ายในสังกัด สนง.เขต",
}, },
{ {
id:'ID5', id: "ID5",
name:'สมรรถนะเฉพาะสำหรับตำแหน่ง ผอ.เขต ผช.ผอ.เขต และหัวหน้าฝ่ายในสังกัด สนง.เขต', name: "สมรรถนะเฉพาะสำหรับตำแหน่งผู้ตรวจราชการ กทม. และผู้ตรวจราชการ",
}, },
{ ]);
id:'ID6',
name:'สมรรถนะเฉพาะสำหรับตำแหน่งผู้ตรวจราชการ กทม. และผู้ตรวจราชการ',
},
])
const columns = ref<QTableProps["columns"]>([ const columns = ref<QTableProps["columns"]>([
{ {
name: "competency", name: "competency",
@ -51,32 +46,30 @@ const columns = ref<QTableProps["columns"]>([
sort: (a: string, b: string) => sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
]) ]);
const $q = useQuasar(); const $q = useQuasar();
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const { dialogRemove, messageError, showLoader, hideLoader, success } = mixin; const { dialogRemove, messageError, showLoader, hideLoader, success } = mixin;
const competencyType = ref<string>('ID1') const competencyType = ref<string>("ID1");
const filterKeyword = ref<string>(""); const filterKeyword = ref<string>("");
const visibleColumns = ref<string[]>([ const visibleColumns = ref<string[]>(["competency"]);
"competency",
]);
/** ดึงข้อมูล */ /** ดึงข้อมูล */
async function getData() { async function getData() {
const data = [ const data = [
{ {
id:'ID1', id: "ID1",
competency:'รายการสมรรถะ 1' competency: "รายการสมรรถะ 1",
}, },
{ {
id:'ID2', id: "ID2",
competency:'รายการสมรรถะ 2' competency: "รายการสมรรถะ 2",
}, },
] ];
rows.value = data rows.value = data;
// showLoader(); // showLoader();
// await http // await http
// .get(config.API.orgPrefix) // .get(config.API.orgPrefix)
@ -91,7 +84,7 @@ async function getData() {
} }
async function editData(id: string) { async function editData(id: string) {
console.log(id) console.log(id);
// await http // await http
// .put(config.API.orgPrefixId(id), { // .put(config.API.orgPrefixId(id), {
// name: prefix.value, // name: prefix.value,
@ -109,7 +102,7 @@ async function editData(id: string) {
} }
async function deleteData(id: string) { async function deleteData(id: string) {
console.log(id) console.log(id);
// await http // await http
// .delete(config.API.orgPrefixId(id)) // .delete(config.API.orgPrefixId(id))
// .then(() => { // .then(() => {
@ -125,8 +118,8 @@ async function deleteData(id: string) {
} }
/** เปลี่ยนเป็นหน้าเพิ่มข้อมูล */ /** เปลี่ยนเป็นหน้าเพิ่มข้อมูล */
function onAdd(){ function onAdd() {
router.push(`/KPI-competency/add`) router.push(`/KPI-competency/add`);
} }
onMounted(async () => { onMounted(async () => {
@ -137,24 +130,18 @@ onMounted(async () => {
<template> <template>
<q-toolbar style="padding: 0"> <q-toolbar style="padding: 0">
<q-select <q-select
v-model="competencyType" v-model="competencyType"
outlined outlined
label="ประเภทสมรรถนะ" label="ประเภทสมรรถนะ"
dense dense
option-label="name" option-label="name"
option-value="id" option-value="id"
:options="competencyTypeOp" :options="competencyTypeOp"
style="min-width: 200px" style="min-width: 200px"
emit-value emit-value
map-options map-options
/> />
<q-btn <q-btn flat round color="primary" icon="add" @click="onAdd()">
flat
round
color="primary"
icon="add"
@click="onAdd()"
>
<q-tooltip> เพมขอม </q-tooltip> <q-tooltip> เพมขอม </q-tooltip>
</q-btn> </q-btn>
<q-space /> <q-space />

View file

@ -30,18 +30,14 @@ const competencyTypeOp = ref<DataOption[]>([
}, },
{ {
id: "ID3", id: "ID3",
name: "สมรรถนะประจำกลุ่มงาน",
},
{
id: "ID4",
name: "สมรรถนะประจำผู้บริหารกรุงเทพมหานคร", name: "สมรรถนะประจำผู้บริหารกรุงเทพมหานคร",
}, },
{ {
id: "ID5", id: "ID4",
name: "สมรรถนะเฉพาะสำหรับตำแหน่ง ผอ.เขต ผช.ผอ.เขต และหัวหน้าฝ่ายในสังกัด สนง.เขต", name: "สมรรถนะเฉพาะสำหรับตำแหน่ง ผอ.เขต ผช.ผอ.เขต และหัวหน้าฝ่ายในสังกัด สนง.เขต",
}, },
{ {
id: "ID6", id: "ID5",
name: "สมรรถนะเฉพาะสำหรับตำแหน่งผู้ตรวจราชการ กทม. และผู้ตรวจราชการ", name: "สมรรถนะเฉพาะสำหรับตำแหน่งผู้ตรวจราชการ กทม. และผู้ตรวจราชการ",
}, },
]); ]);