UI สมรรถนะ
This commit is contained in:
parent
d35ab5c48b
commit
28409b1b5e
4 changed files with 880 additions and 8 deletions
|
|
@ -1,3 +1,295 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, onMounted } from "vue";
|
||||
import type { QTableProps } from "quasar";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useQuasar } from "quasar";
|
||||
import { useRouter } from "vue-router";
|
||||
|
||||
import Header from "@/components/DialogHeader.vue";
|
||||
import type { DataOption } from "@/modules/14_KPI/interface/index/Main";
|
||||
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
const modal = ref<boolean>(false);
|
||||
const router = useRouter();
|
||||
const rows = ref<any>();
|
||||
const groupName = ref<string>("");
|
||||
|
||||
const editStatus = ref<boolean>(false);
|
||||
|
||||
const competencyTypeOp = ref<DataOption[]>([
|
||||
{
|
||||
id: "ID1",
|
||||
name: "สมรรถนะหลัก",
|
||||
},
|
||||
{
|
||||
id: "ID2",
|
||||
name: "สมรรถนะประจำกลุ่มงาน",
|
||||
},
|
||||
{
|
||||
id: "ID3",
|
||||
name: "สมรรถนะประจำผู้บริหารกรุงเทพมหานคร",
|
||||
},
|
||||
{
|
||||
id: "ID4",
|
||||
name: "สมรรถนะเฉพาะสำหรับตำแหน่ง ผอ.เขต ผช.ผอ.เขต และหัวหน้าฝ่ายในสังกัด สนง.เขต",
|
||||
},
|
||||
{
|
||||
id: "ID5",
|
||||
name: "สมรรถนะเฉพาะสำหรับตำแหน่งผู้ตรวจราชการ กทม. และผู้ตรวจราชการ",
|
||||
},
|
||||
]);
|
||||
const columns = ref<QTableProps["columns"]>([
|
||||
{
|
||||
name: "groupName",
|
||||
align: "left",
|
||||
label: "รายการกลุ่มงาน",
|
||||
sortable: true,
|
||||
field: "groupName",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
]);
|
||||
|
||||
const $q = useQuasar();
|
||||
const mixin = useCounterMixin();
|
||||
const { dialogRemove, messageError, showLoader, hideLoader, success } = mixin;
|
||||
|
||||
const competencyType = ref<string>("ID1");
|
||||
const filterKeyword = ref<string>("");
|
||||
|
||||
const visibleColumns = ref<string[]>(["groupName"]);
|
||||
|
||||
/** ดึงข้อมูล */
|
||||
async function getData() {
|
||||
const data = [
|
||||
{
|
||||
id: "ID1",
|
||||
groupName: "กลุ่มงาน 1",
|
||||
},
|
||||
{
|
||||
id: "ID2",
|
||||
groupName: "กลุ่มงาน 2",
|
||||
},
|
||||
];
|
||||
rows.value = data;
|
||||
// showLoader();
|
||||
// await http
|
||||
// .get(config.API.orgPrefix)
|
||||
// .then(async (res) => {
|
||||
// })
|
||||
// .catch((err) => {
|
||||
// messageError($q, err);
|
||||
// })
|
||||
// .finally(() => {
|
||||
// hideLoader();
|
||||
// });
|
||||
}
|
||||
|
||||
async function editData(id: string) {
|
||||
console.log(id);
|
||||
// await http
|
||||
// .put(config.API.orgPrefixId(id), {
|
||||
// name: prefix.value,
|
||||
// })
|
||||
// .then(() => {
|
||||
// getData();
|
||||
// success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
// })
|
||||
// .catch((err) => {
|
||||
// messageError($q, err);
|
||||
// })
|
||||
// .finally(() => {
|
||||
// hideLoader();
|
||||
// });
|
||||
}
|
||||
|
||||
async function deleteData(id: string) {
|
||||
console.log(id);
|
||||
// await http
|
||||
// .delete(config.API.orgPrefixId(id))
|
||||
// .then(() => {
|
||||
// getData();
|
||||
// success($q, "ลบข้อมูลสำเร็จ");
|
||||
// })
|
||||
// .catch((err) => {
|
||||
// messageError($q, err);
|
||||
// })
|
||||
// .finally(() => {
|
||||
// hideLoader();w
|
||||
// });
|
||||
}
|
||||
|
||||
/** เปลี่ยนเป็นหน้าเพิ่มข้อมูล */
|
||||
function onAdd() {
|
||||
modal.value = true;
|
||||
}
|
||||
|
||||
function close() {
|
||||
modal.value = false;
|
||||
editStatus.value = false;
|
||||
groupName.value = ''
|
||||
}
|
||||
|
||||
function onEdit(data: any) {
|
||||
modal.value = true;
|
||||
editStatus.value = true;
|
||||
groupName.value = data.groupName
|
||||
}
|
||||
|
||||
function onSubmit() {
|
||||
console.log("save");
|
||||
close()
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
getData();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>เชื่อมโยงกับตําแหน่ง</div>
|
||||
<q-toolbar style="padding: 0">
|
||||
<!-- <q-select
|
||||
v-model="competencyType"
|
||||
outlined
|
||||
label="ประเภทสมรรถนะ"
|
||||
dense
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
:options="competencyTypeOp"
|
||||
style="min-width: 200px"
|
||||
emit-value
|
||||
map-options
|
||||
/> -->
|
||||
<q-btn flat round color="primary" icon="add" @click="onAdd()">
|
||||
<q-tooltip> เพิ่มข้อมูล </q-tooltip>
|
||||
</q-btn>
|
||||
<q-space />
|
||||
<div class="row q-gutter-sm">
|
||||
<q-input outlined dense v-model="filterKeyword" label="ค้นหา"></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"
|
||||
options-cover
|
||||
style="min-width: 150px"
|
||||
/>
|
||||
</div>
|
||||
</q-toolbar>
|
||||
|
||||
<d-table
|
||||
ref="table"
|
||||
:columns="columns"
|
||||
:rows="rows"
|
||||
:filter="filterKeyword"
|
||||
row-key="id"
|
||||
flat
|
||||
bordered
|
||||
:paging="true"
|
||||
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.id"
|
||||
@click="onEdit(props.row)"
|
||||
>
|
||||
{{ col.value }}
|
||||
</q-td>
|
||||
<q-td auto-width>
|
||||
<!-- <q-btn
|
||||
color="edit"
|
||||
flat
|
||||
dense
|
||||
round
|
||||
class="q-mr-xs"
|
||||
size="12px"
|
||||
icon="edit"
|
||||
clickable
|
||||
@click.stop="
|
||||
() => {
|
||||
dialogStatus = 'edit';
|
||||
dialog = true;
|
||||
prefix = props.row.name;
|
||||
editId = props.row.id;
|
||||
}
|
||||
"
|
||||
>
|
||||
<q-tooltip>แก้ไขข้อมูล</q-tooltip>
|
||||
</q-btn> -->
|
||||
<q-btn
|
||||
color="red"
|
||||
flat
|
||||
dense
|
||||
round
|
||||
size="12px"
|
||||
icon="mdi-delete"
|
||||
clickable
|
||||
@click.stop="
|
||||
dialogRemove($q, async () => await deleteData(props.row.id))
|
||||
"
|
||||
v-close-popup
|
||||
>
|
||||
<q-tooltip>ลบข้อมูล</q-tooltip>
|
||||
</q-btn>
|
||||
</q-td>
|
||||
</q-tr>
|
||||
</template>
|
||||
</d-table>
|
||||
|
||||
<q-dialog v-model="modal" persistent>
|
||||
<q-card flat bordered style="min-width: 50vh">
|
||||
<q-form greedy @submit.prevent @validation-success="onSubmit">
|
||||
<Header
|
||||
:tittle="editStatus ? 'แก้ไขกลุ่มงาน' : 'เพิ่มกลุ่มงาน'"
|
||||
:close="close"
|
||||
/>
|
||||
<q-separator />
|
||||
<q-card-section>
|
||||
<q-input
|
||||
label="กลุ่มงาน"
|
||||
v-model="groupName"
|
||||
outlined
|
||||
dense
|
||||
class="inputgreen"
|
||||
:rules="[(val:string) => !!val || `${'กรุณากรอกกลุ่มงาน'}`,]"
|
||||
hide-bottom-space
|
||||
/>
|
||||
</q-card-section>
|
||||
<q-separator />
|
||||
<q-card-actions align="right" class="bg-white text-teal">
|
||||
<q-btn
|
||||
type="submit"
|
||||
for="#submitForm"
|
||||
unelevated
|
||||
dense
|
||||
class="q-px-md items-center"
|
||||
color="public"
|
||||
label="บันทึก"
|
||||
/>
|
||||
</q-card-actions>
|
||||
</q-form>
|
||||
</q-card>
|
||||
</q-dialog>
|
||||
</template>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue