รายการประเภทตำแหน่ง: ปรับแก้ไขส่งค่าผิด,แก้Get
This commit is contained in:
parent
91504f66ec
commit
ce8fa1afb2
3 changed files with 20 additions and 28 deletions
|
|
@ -22,6 +22,7 @@ export default {
|
|||
orgPosPositionById: (id: string) => `${orgPos}/position/${id}`,
|
||||
orgPosExecutive: `${orgPos}/executive`,
|
||||
orgPosType: `${orgPos}/type`,
|
||||
orgPosTypeId: (id: string) => `${orgPos}/type/${id}`,
|
||||
orgPosLevel: `${orgPos}/level`,
|
||||
orgPosMaster: `${orgPos}/master`,
|
||||
orgPosMasterById: (id: string) => `${orgPos}/master/${id}`,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
import { ref, onMounted } from "vue";
|
||||
import type { QInput, QTableProps } from "quasar";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useRouter, useRoute } from "vue-router";
|
||||
import { 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";
|
||||
|
|
@ -133,6 +133,7 @@ const posLevelAuthority = ref<string>("");
|
|||
const posLevelNameRef = ref<QInput | null>(null);
|
||||
const posLevelRankRef = ref<QInput | null>(null);
|
||||
const posTypeIdRef = ref<QInput | null>(null);
|
||||
const posLevelAuthorityRef = ref<QInput | null>(null);
|
||||
const visibleColumns = ref<string[]>([
|
||||
"no",
|
||||
"posTypeName",
|
||||
|
|
@ -144,9 +145,10 @@ const visibleColumns = ref<string[]>([
|
|||
async function fetchData() {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.orgPosLevel)
|
||||
.get(config.API.orgPosTypeId(id.value))
|
||||
.then(async (res) => {
|
||||
store.save(res.data.result, id.value);
|
||||
posName.value = res.data.result.posTypeName;
|
||||
store.save(res.data.result.posLevels);
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
|
|
@ -221,6 +223,7 @@ function validateForm() {
|
|||
posLevelNameRef.value?.validate();
|
||||
posLevelRankRef.value?.validate();
|
||||
posTypeIdRef.value?.validate();
|
||||
posLevelAuthorityRef.value?.validate();
|
||||
onSubmit();
|
||||
}
|
||||
|
||||
|
|
@ -238,28 +241,7 @@ async function onSubmit() {
|
|||
}
|
||||
}
|
||||
|
||||
async function fetchName() {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.orgPosType)
|
||||
.then(async (res) => {
|
||||
storeName.save(res.data.result);
|
||||
storeName.row.forEach((e) => {
|
||||
if (e.id === id.value) {
|
||||
posName.value = e.posTypeName ? e.posTypeName : "";
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
fetchName();
|
||||
fetchData();
|
||||
});
|
||||
</script>
|
||||
|
|
@ -348,11 +330,18 @@ onMounted(async () => {
|
|||
@click.stop="
|
||||
() => {
|
||||
dialogStatus = 'edit';
|
||||
dialog = true;
|
||||
editId = props.row.id;
|
||||
posLevelName = props.row.posLevelName;
|
||||
posLevelRank = props.row.posLevelRank;
|
||||
posLevelAuthority = props.row.posLevelAuthority;
|
||||
if (props.row.posLevelAuthority === 'หัวหน้าหน่วยงาน') {
|
||||
posLevelAuthority = 'HEAD';
|
||||
} else if (props.row.posLevelAuthority === 'ปลัด') {
|
||||
posLevelAuthority = 'DEPUTY';
|
||||
} else {
|
||||
posLevelAuthority = 'GOVERNOR';
|
||||
}
|
||||
|
||||
dialog = true;
|
||||
}
|
||||
"
|
||||
>
|
||||
|
|
@ -424,6 +413,7 @@ onMounted(async () => {
|
|||
|
||||
<div class="col-12">
|
||||
<q-select
|
||||
ref="posLevelAuthorityRef"
|
||||
outlined
|
||||
v-model="posLevelAuthority"
|
||||
emit-value
|
||||
|
|
@ -433,6 +423,7 @@ onMounted(async () => {
|
|||
label="ผู้มีอำนาจสั่งบรรจุ"
|
||||
dense
|
||||
lazy-rules
|
||||
:rules="[(val) => !!val || 'กรุณาเลือกผู้มีอำนาจสั่งบรรจุ']"
|
||||
borderless
|
||||
bg-color="white"
|
||||
hide-bottom-space
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ const { date2Thai } = useCounterMixin();
|
|||
export const usePositionDataStore = defineStore("PositionData", () => {
|
||||
const pathLocation = ref<string>("list_position");
|
||||
const row = ref<DataRow[]>([]);
|
||||
function save(data: DataResponse[], id: string) {
|
||||
function save(data: DataResponse[]) {
|
||||
const list = data.map((e) => ({
|
||||
...e,
|
||||
posTypes: undefined,
|
||||
|
|
@ -26,7 +26,7 @@ export const usePositionDataStore = defineStore("PositionData", () => {
|
|||
? storeOption.posLevelAuthorityConvert(e.posLevelAuthority)
|
||||
: "-",
|
||||
})) satisfies DataRow[];
|
||||
row.value = list.filter((e) => e.posTypeId === id);
|
||||
row.value = list;
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue