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