Merge branch 'develop' of github.com:Frappet/bma-ehr-frontend into develop
* 'develop' of github.com:Frappet/bma-ehr-frontend: รายการประเภทตำแหน่ง: ปรับแก้ไขส่งค่าผิด,แก้Get ปรับการแสดงผลฟอร์มเพิ่ม/แก้ไขตำแหน่งของข้าราชการ โครงสร้างอัตรากำลัง => คัดลอกตำแหน่ง
This commit is contained in:
commit
c1b837e47e
7 changed files with 136 additions and 69 deletions
|
|
@ -20,8 +20,10 @@ export default {
|
|||
/** position*/
|
||||
orgPosPosition: `${orgPos}/position`,
|
||||
orgPosPositionById: (id: string) => `${orgPos}/position/${id}`,
|
||||
orgPosPositionExecutive : () => `${orgPos}/position/executive`,
|
||||
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
|
||||
|
|
|
|||
|
|
@ -288,19 +288,6 @@ function close() {
|
|||
:rules="[(val) => !!val || `${'กรุณากรอกตำแหน่งในสายงาน'}`]"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<q-input
|
||||
ref="positionExecutiveFieldRef"
|
||||
v-model="formPositionSelect.positionExecutiveField"
|
||||
:class="inputEdit(isReadonly)"
|
||||
dense
|
||||
outlined
|
||||
for="#positionExecutiveField"
|
||||
label="ด้านทางการบริหาร"
|
||||
lazy-rules
|
||||
hide-bottom-space
|
||||
/>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<q-input
|
||||
ref="positionAreaRef"
|
||||
|
|
@ -314,7 +301,6 @@ function close() {
|
|||
hide-bottom-space
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="col-6">
|
||||
<q-input
|
||||
ref="positionFieldRef"
|
||||
|
|
@ -329,7 +315,6 @@ function close() {
|
|||
:rules="[(val) => !!val || `${'กรุณากรอกสายงาน'}`]"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="col-6">
|
||||
<q-select
|
||||
ref="positionTypeRef"
|
||||
|
|
@ -386,9 +371,22 @@ function close() {
|
|||
clearable
|
||||
/>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<q-input
|
||||
ref="positionExecutiveFieldRef"
|
||||
v-model="formPositionSelect.positionExecutiveField"
|
||||
:class="inputEdit(isReadonly)"
|
||||
dense
|
||||
outlined
|
||||
for="#positionExecutiveField"
|
||||
label="ด้านทางการบริหาร"
|
||||
lazy-rules
|
||||
hide-bottom-space
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="col-6 self-center">
|
||||
<q-checkbox size="md" v-model="isSpecial" label="ฉ" />
|
||||
<q-checkbox size="md" v-model="isSpecial" label="เฉพาะสายงานที่กำหนด" />
|
||||
</div>
|
||||
</div>
|
||||
</q-card-section>
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -23,7 +23,9 @@ import type {
|
|||
DataPosition,
|
||||
} from "@/modules/02_organizationalNew/interface/response/organizational";
|
||||
|
||||
const posExecutive = ref<string>("");
|
||||
const isSpecial = ref<boolean>(false);
|
||||
const shape = ref<string>("false");
|
||||
const props = defineProps({
|
||||
emitSearch: Function,
|
||||
getData: Function,
|
||||
|
|
@ -109,19 +111,33 @@ function saveSelectEdit() {
|
|||
dialogConfirm(
|
||||
$q,
|
||||
async () => {
|
||||
const dataExecutive = shape.value == "false" ? formPositionSelect.positionExecutive:posExecutive.value
|
||||
const url =
|
||||
shape.value == "false"
|
||||
? config.API.orgPosPositionById(formPositionSelect.positionId)
|
||||
: config.API.orgPosPositionExecutive()+`/${formPositionSelect.positionId}`;
|
||||
showLoader();
|
||||
const body = {
|
||||
const body = shape.value == "false" ?{
|
||||
posDictName: formPositionSelect.positionName,
|
||||
posDictField: formPositionSelect.positionField, //สายงาน
|
||||
posTypeId: formPositionSelect.positionType, //*ประเภทตำแหน่ง
|
||||
posLevelId: formPositionSelect.positionLevel, //*ระดับตำแหน่ง
|
||||
posExecutiveId: formPositionSelect.positionExecutive, //ตำแหน่งทางการบริหาร
|
||||
posExecutiveId: dataExecutive, //ตำแหน่งทางการบริหาร
|
||||
posDictExecutiveField: formPositionSelect.positionExecutiveField, //ด้านทางการบริหาร
|
||||
posDictArea: formPositionSelect.positionArea, //ด้าน/สาขา
|
||||
isSpecial: isSpecial.value,
|
||||
};
|
||||
}:{
|
||||
posDictName: formPositionSelect.positionName,
|
||||
posDictField: formPositionSelect.positionField, //สายงาน
|
||||
posTypeId: formPositionSelect.positionType, //*ประเภทตำแหน่ง
|
||||
posLevelId: formPositionSelect.positionLevel, //*ระดับตำแหน่ง
|
||||
posExecutive: dataExecutive, //ตำแหน่งทางการบริหาร
|
||||
posDictExecutiveField: formPositionSelect.positionExecutiveField, //ด้านทางการบริหาร
|
||||
posDictArea: formPositionSelect.positionArea, //ด้าน/สาขา
|
||||
isSpecial: isSpecial.value,
|
||||
}
|
||||
await http
|
||||
.put(config.API.orgPosPositionById(formPositionSelect.positionId), body)
|
||||
.put(url, body)
|
||||
.then(() => {
|
||||
success($q, "เพิ่มข้อมูลสำเร็จ");
|
||||
|
||||
|
|
@ -145,19 +161,33 @@ function onSubmitSelectEdit() {
|
|||
dialogConfirm(
|
||||
$q,
|
||||
async () => {
|
||||
const dataExecutive = shape.value == "false" ? formPositionSelect.positionExecutive:posExecutive.value
|
||||
const url =
|
||||
shape.value == "false"
|
||||
? config.API.orgPosPosition
|
||||
: config.API.orgPosPositionExecutive();
|
||||
showLoader();
|
||||
const body = {
|
||||
const body = shape.value == "false" ?{
|
||||
posDictName: formPositionSelect.positionName,
|
||||
posDictField: formPositionSelect.positionField, //สายงาน
|
||||
posTypeId: formPositionSelect.positionType, //*ประเภทตำแหน่ง
|
||||
posLevelId: formPositionSelect.positionLevel, //*ระดับตำแหน่ง
|
||||
posExecutiveId: formPositionSelect.positionExecutive, //ตำแหน่งทางการบริหาร
|
||||
posExecutiveId: dataExecutive, //ตำแหน่งทางการบริหาร
|
||||
posDictExecutiveField: formPositionSelect.positionExecutiveField, //ด้านทางการบริหาร
|
||||
posDictArea: formPositionSelect.positionArea, //ด้าน/สาขา
|
||||
isSpecial: isSpecial.value,
|
||||
};
|
||||
}:{
|
||||
posDictName: formPositionSelect.positionName,
|
||||
posDictField: formPositionSelect.positionField, //สายงาน
|
||||
posTypeId: formPositionSelect.positionType, //*ประเภทตำแหน่ง
|
||||
posLevelId: formPositionSelect.positionLevel, //*ระดับตำแหน่ง
|
||||
posExecutive: dataExecutive, //ตำแหน่งทางการบริหาร
|
||||
posDictExecutiveField: formPositionSelect.positionExecutiveField, //ด้านทางการบริหาร
|
||||
posDictArea: formPositionSelect.positionArea, //ด้าน/สาขา
|
||||
isSpecial: isSpecial.value,
|
||||
}
|
||||
await http
|
||||
.post(config.API.orgPosPosition, body)
|
||||
.post(url, body)
|
||||
.then(() => {
|
||||
success($q, "เพิ่มข้อมูลสำเร็จ");
|
||||
|
||||
|
|
@ -314,20 +344,6 @@ watch(
|
|||
"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<q-input
|
||||
ref="positionExecutiveFieldRef"
|
||||
v-model="formPositionSelect.positionExecutiveField"
|
||||
:class="inputEdit(isReadonly)"
|
||||
dense
|
||||
outlined
|
||||
for="#positionExecutiveField"
|
||||
label="ด้านทางการบริหาร"
|
||||
lazy-rules
|
||||
hide-bottom-space
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="col-6">
|
||||
<q-input
|
||||
ref="positionAreaRef"
|
||||
|
|
@ -359,7 +375,6 @@ watch(
|
|||
"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="col-6">
|
||||
<q-select
|
||||
ref="positionTypeRef"
|
||||
|
|
@ -406,8 +421,26 @@ watch(
|
|||
"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-12 self-center">
|
||||
<q-radio
|
||||
v-model="shape"
|
||||
checked-icon="task_alt"
|
||||
unchecked-icon="panorama_fish_eye"
|
||||
val="false"
|
||||
label="เลือกจากรายการ"
|
||||
/>
|
||||
<q-radio
|
||||
v-model="shape"
|
||||
checked-icon="task_alt"
|
||||
w
|
||||
unchecked-icon="panorama_fish_eye"
|
||||
val="true"
|
||||
label="เพิ่มใหม่"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<q-select
|
||||
v-if="shape == 'false'"
|
||||
ref="positionExecutiveRef"
|
||||
:class="inputEdit(isReadonly)"
|
||||
label="ตำแหน่งทางการบริหาร"
|
||||
|
|
@ -423,10 +456,39 @@ watch(
|
|||
hide-bottom-space
|
||||
clearable
|
||||
/>
|
||||
<q-input
|
||||
v-else
|
||||
ref="positionExecutiveFieldRef"
|
||||
v-model="posExecutive"
|
||||
:class="inputEdit(isReadonly)"
|
||||
dense
|
||||
outlined
|
||||
for="#positionExecutiveField"
|
||||
label="เพิ่มตำแหน่งทางการบริหาร"
|
||||
lazy-rules
|
||||
hide-bottom-space
|
||||
/>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<q-input
|
||||
ref="positionExecutiveFieldRef"
|
||||
v-model="formPositionSelect.positionExecutiveField"
|
||||
:class="inputEdit(isReadonly)"
|
||||
dense
|
||||
outlined
|
||||
for="#positionExecutiveField"
|
||||
label="ด้านทางการบริหาร"
|
||||
lazy-rules
|
||||
hide-bottom-space
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="col-6 self-center">
|
||||
<q-checkbox size="md" v-model="isSpecial" label="ฉ" />
|
||||
<q-checkbox
|
||||
size="md"
|
||||
v-model="isSpecial"
|
||||
label="เฉพาะสายงานที่กำหนด"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<q-separator />
|
||||
|
|
|
|||
|
|
@ -377,7 +377,7 @@ function onSubmit() {
|
|||
};
|
||||
|
||||
showLoader();
|
||||
props.actionType === "ADD"
|
||||
props.actionType === "ADD" || props.actionType === "COPY"
|
||||
? await http
|
||||
.post(config.API.orgPosMaster, body)
|
||||
.then(() => {
|
||||
|
|
|
|||
|
|
@ -74,6 +74,12 @@ const listMenu = ref<ListMenu[]>([
|
|||
type: "EDIT",
|
||||
color: "edit",
|
||||
},
|
||||
{
|
||||
label: "คัดลอก",
|
||||
icon: "content_copy",
|
||||
type: "COPY",
|
||||
color: "blue-6",
|
||||
},
|
||||
{
|
||||
label: "ลบ",
|
||||
icon: "delete",
|
||||
|
|
@ -259,6 +265,12 @@ function onClickPosition(type: string, id: string) {
|
|||
dialogPosition.value = !dialogPosition.value;
|
||||
}
|
||||
|
||||
function onClickCopyPosition(type: string, id: string) {
|
||||
rowId.value = id ? id : "";
|
||||
actionType.value = type;
|
||||
dialogPosition.value = !dialogPosition.value;
|
||||
}
|
||||
|
||||
const dialogDetail = ref<boolean>(false);
|
||||
const dataDetailPos = ref<DataPosition[]>([]);
|
||||
/**
|
||||
|
|
@ -650,6 +662,8 @@ async function onClickDownloadReport(val: string, name: string) {
|
|||
? onClickHistoryPos(props.row.id)
|
||||
: item.type === 'INHERIT'
|
||||
? onClickInherit(props.row.id)
|
||||
: item.type === 'COPY'
|
||||
? onClickCopyPosition('COPY', props.row.id)
|
||||
: null
|
||||
"
|
||||
>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue