ปรับแก้ไขข้อมูลหลักตำแหน่งลูกจ้างประจำ
This commit is contained in:
parent
4a554fa225
commit
7703fa374c
7 changed files with 321 additions and 184 deletions
|
|
@ -4,12 +4,14 @@ import type { QInput, QTableProps } from "quasar";
|
|||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useRouter, useRoute } from "vue-router";
|
||||
import { usePositionDataStore } from "@/modules/01_metadataNew/stores/positionListStore";
|
||||
import { useMainOptionDataStore } from "@/modules/01_metadataNew/stores/main";
|
||||
import { usePositionTypeDataStore } from "@/modules/01_metadataNew/stores/positionTypeStore";
|
||||
import dialogHeader from "@/components/DialogHeader.vue";
|
||||
import { useQuasar } from "quasar";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
const store = usePositionDataStore();
|
||||
const storeOption = useMainOptionDataStore();
|
||||
const storeName = usePositionTypeDataStore();
|
||||
const router = useRouter();
|
||||
const mixin = useCounterMixin();
|
||||
|
|
@ -153,30 +155,48 @@ async function fetchData() {
|
|||
}
|
||||
|
||||
async function addData() {
|
||||
await http.post(config.API.orgPosLevel, {
|
||||
posLevelName: posLevelName.value,
|
||||
posLevelRank: posLevelRank.value,
|
||||
posLevelAuthority:
|
||||
posLevelAuthority.value == "" ? "" : posLevelAuthority.value,
|
||||
posTypeId: id.value,
|
||||
});
|
||||
fetchData();
|
||||
await http
|
||||
.post(config.API.orgPosLevel, {
|
||||
posLevelName: posLevelName.value,
|
||||
posLevelRank: posLevelRank.value,
|
||||
posLevelAuthority:
|
||||
posLevelAuthority.value == "" ? "" : posLevelAuthority.value,
|
||||
posTypeId: id.value,
|
||||
})
|
||||
.then(() => {
|
||||
fetchData();
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
});
|
||||
}
|
||||
|
||||
async function editData(editId: string) {
|
||||
await http.put(config.API.orgPosLevelId(editId), {
|
||||
posLevelName: posLevelName.value,
|
||||
posLevelRank: posLevelRank.value,
|
||||
posLevelAuthority:
|
||||
posLevelAuthority.value == "" ? "" : posLevelAuthority.value,
|
||||
posTypeId: id.value,
|
||||
});
|
||||
fetchData();
|
||||
await http
|
||||
.put(config.API.orgPosLevelId(editId), {
|
||||
posLevelName: posLevelName.value,
|
||||
posLevelRank: posLevelRank.value,
|
||||
posLevelAuthority:
|
||||
posLevelAuthority.value == "" ? "" : posLevelAuthority.value,
|
||||
posTypeId: id.value,
|
||||
})
|
||||
.then(() => {
|
||||
fetchData();
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
});
|
||||
}
|
||||
|
||||
async function deleteData(id: string) {
|
||||
await http.delete(config.API.orgPosLevelId(id));
|
||||
fetchData();
|
||||
await http
|
||||
.delete(config.API.orgPosLevelId(id))
|
||||
.then(() => {
|
||||
fetchData();
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
});
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
|
|
@ -345,7 +365,7 @@ async function fetchName() {
|
|||
</d-table>
|
||||
|
||||
<q-dialog v-model="dialog" class="dialog" persistent>
|
||||
<q-card style="min-width: 350px" class="bg-grey-11">
|
||||
<q-card style="width: 350px">
|
||||
<form @submit.prevent="validateForm">
|
||||
<q-card-section class="flex justify-between" style="padding: 0">
|
||||
<dialog-header
|
||||
|
|
@ -355,54 +375,69 @@ async function fetchName() {
|
|||
</q-card-section>
|
||||
|
||||
<q-separator color="grey-4" />
|
||||
<q-card-section class="q-pa-none">
|
||||
<q-input
|
||||
outlined
|
||||
ref="posLevelNameRef"
|
||||
v-model="posLevelName"
|
||||
label="ชื่อระดับตำแหน่ง"
|
||||
dense
|
||||
lazy-rules
|
||||
borderless
|
||||
class="col-12 bg-white q-ma-md"
|
||||
hide-bottom-space
|
||||
:rules="[(val) => val.length > 0 || 'กรุณากรอกระดับตำแหน่ง']"
|
||||
/>
|
||||
<q-input
|
||||
ref="posLevelRankRef"
|
||||
outlined
|
||||
v-model="posLevelRank"
|
||||
label="ระดับ"
|
||||
dense
|
||||
type="number"
|
||||
lazy-rules
|
||||
borderless
|
||||
min="1"
|
||||
class="col-12 bg-white q-ma-md"
|
||||
:rules="[(val) => val != undefined || 'กรุณากรอกระดับ']"
|
||||
hide-bottom-space
|
||||
/>
|
||||
<q-input
|
||||
outlined
|
||||
v-model="posLevelAuthority"
|
||||
label="ผู้มีอำนาจสั่งบรรจุ"
|
||||
dense
|
||||
lazy-rules
|
||||
borderless
|
||||
class="col-12 bg-white q-ma-md"
|
||||
hide-bottom-space
|
||||
/>
|
||||
<q-select
|
||||
ref="posTypeIdRef"
|
||||
v-model="posName"
|
||||
label="ประเภทตำแหน่ง"
|
||||
outlined
|
||||
dense
|
||||
class="col-12 bg-white q-ma-md"
|
||||
options-cover
|
||||
hide-bottom-space
|
||||
readonly
|
||||
/>
|
||||
<q-card-section class="row q-gutter-y-md">
|
||||
<div class="col-12">
|
||||
<q-input
|
||||
outlined
|
||||
ref="posLevelNameRef"
|
||||
v-model="posLevelName"
|
||||
label="ชื่อระดับตำแหน่ง"
|
||||
dense
|
||||
lazy-rules
|
||||
borderless
|
||||
bg-color="white"
|
||||
hide-bottom-space
|
||||
:rules="[(val) => val.length > 0 || 'กรุณากรอกระดับตำแหน่ง']"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="col-12">
|
||||
<q-input
|
||||
ref="posLevelRankRef"
|
||||
outlined
|
||||
v-model="posLevelRank"
|
||||
label="ระดับ"
|
||||
dense
|
||||
type="number"
|
||||
lazy-rules
|
||||
borderless
|
||||
min="1"
|
||||
bg-color="white"
|
||||
:rules="[(val) => val != undefined || 'กรุณากรอกระดับ']"
|
||||
hide-bottom-space
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="col-12">
|
||||
<q-select
|
||||
outlined
|
||||
v-model="posLevelAuthority"
|
||||
emit-value
|
||||
map-options
|
||||
:options="storeOption.posLevelAuthorityOption"
|
||||
option-value="id"
|
||||
label="ผู้มีอำนาจสั่งบรรจุ"
|
||||
dense
|
||||
lazy-rules
|
||||
borderless
|
||||
bg-color="white"
|
||||
hide-bottom-space
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="col-12">
|
||||
<q-select
|
||||
ref="posTypeIdRef"
|
||||
v-model="posName"
|
||||
label="ประเภทตำแหน่ง"
|
||||
outlined
|
||||
dense
|
||||
bg-color="white"
|
||||
options-cover
|
||||
hide-bottom-space
|
||||
readonly
|
||||
/>
|
||||
</div>
|
||||
</q-card-section>
|
||||
|
||||
<q-card-actions align="right">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue