Merge branch 'develop' of https://github.com/Frappet/bma-ehr-frontend into develop
This commit is contained in:
commit
e997e096dc
1 changed files with 38 additions and 43 deletions
|
|
@ -234,12 +234,14 @@ async function fetchPosition(id: string) {
|
|||
});
|
||||
}
|
||||
|
||||
const dataLevel = ref<any>();
|
||||
/** function เรียกรายการประเภทตำแหน่ง */
|
||||
async function fetchType() {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.orgPosType)
|
||||
.then((res) => {
|
||||
dataLevel.value = res.data.result;
|
||||
typeOpsMain.value = res.data.result.map((e: OptionType) => ({
|
||||
id: e.id,
|
||||
name: e.posTypeName,
|
||||
|
|
@ -255,24 +257,24 @@ async function fetchType() {
|
|||
}
|
||||
|
||||
/** function เรียกรายการระดับตำแหน่ง */
|
||||
async function fetchLevel() {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.orgPosLevel)
|
||||
.then((res) => {
|
||||
levelOpsMain.value = res.data.result.map((e: OptionLevel) => ({
|
||||
id: e.id,
|
||||
name: e.posLevelName,
|
||||
}));
|
||||
levelOps.value = levelOpsMain.value;
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
// async function fetchLevel() {
|
||||
// showLoader();
|
||||
// await http
|
||||
// .get(config.API.orgPosLevel)
|
||||
// .then((res) => {
|
||||
// levelOpsMain.value = res.data.result.map((e: OptionLevel) => ({
|
||||
// id: e.id,
|
||||
// name: e.posLevelName,
|
||||
// }));
|
||||
// levelOps.value = levelOpsMain.value;
|
||||
// })
|
||||
// .catch((err) => {
|
||||
// messageError($q, err);
|
||||
// })
|
||||
// .finally(() => {
|
||||
// hideLoader();
|
||||
// });
|
||||
// }
|
||||
|
||||
/** function เรียกรายการตำแหน่งทางการบริหาร */
|
||||
async function fetchExecutive() {
|
||||
|
|
@ -454,11 +456,22 @@ async function searchInput() {
|
|||
}
|
||||
}
|
||||
|
||||
function updateSelectType(val: string) {
|
||||
const listLevel = dataLevel.value.find((e: any) => e.id === val);
|
||||
levelOpsMain.value = listLevel.posLevels.map((e: OptionLevel) => ({
|
||||
id: e.id,
|
||||
name: e.posLevelName,
|
||||
}));
|
||||
levelOps.value = levelOpsMain.value;
|
||||
formPositionSelect.positionLevel = "";
|
||||
}
|
||||
|
||||
/**
|
||||
* คัดลอกข้อมูล
|
||||
* @param data ข้อมูลตำแหน่ง
|
||||
*/
|
||||
function copyDetiail(data: RowDetailPositions) {
|
||||
updateSelectType(data.posTypeId);
|
||||
formPositionSelect.positionId = data.positionId;
|
||||
formPositionSelect.positionName = data.positionName;
|
||||
formPositionSelect.positionField = data.positionField;
|
||||
|
|
@ -485,13 +498,17 @@ watch(
|
|||
() => {
|
||||
if (props.modal === true) {
|
||||
fetchType();
|
||||
fetchLevel();
|
||||
// fetchLevel();
|
||||
fetchExecutive();
|
||||
|
||||
if (props.actionType === "ADD") {
|
||||
rowsPositionSelect.value = [];
|
||||
search.value = "";
|
||||
rows.value = [];
|
||||
clearFormPositionSelect();
|
||||
formData.prefixNo = "";
|
||||
formData.positionNo = "";
|
||||
formData.suffixNo = "";
|
||||
} else {
|
||||
props.rowId && fetchPosition(props.rowId);
|
||||
}
|
||||
|
|
@ -896,7 +913,7 @@ async function clearFormPositionSelect() {
|
|||
:options="typeOps"
|
||||
emit-value
|
||||
dense
|
||||
@update:model-value="updateSelect"
|
||||
@update:model-value="updateSelectType"
|
||||
map-options
|
||||
outlined
|
||||
option-label="name"
|
||||
|
|
@ -916,10 +933,10 @@ async function clearFormPositionSelect() {
|
|||
:class="inputEdit(isReadonly)"
|
||||
label="ระดับตำแหน่ง"
|
||||
v-model="formPositionSelect.positionLevel"
|
||||
:disable="formPositionSelect.positionType === ''"
|
||||
:options="levelOps"
|
||||
emit-value
|
||||
dense
|
||||
@update:model-value="updateSelect"
|
||||
map-options
|
||||
outlined
|
||||
option-label="name"
|
||||
|
|
@ -942,21 +959,12 @@ async function clearFormPositionSelect() {
|
|||
:options="executiveOps"
|
||||
emit-value
|
||||
dense
|
||||
@update:model-value="updateSelect"
|
||||
map-options
|
||||
outlined
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
lazy-rules
|
||||
hide-bottom-space
|
||||
:rules="
|
||||
!isDisValidate
|
||||
? [
|
||||
(val) =>
|
||||
!!val || `${'กรุณาเลือกตำแหน่งทางการบริหาร'}`,
|
||||
]
|
||||
: []
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
|
|
@ -970,14 +978,6 @@ async function clearFormPositionSelect() {
|
|||
label="ด้านทางการบริหาร"
|
||||
lazy-rules
|
||||
hide-bottom-space
|
||||
:rules="
|
||||
!isDisValidate
|
||||
? [
|
||||
(val) =>
|
||||
!!val || `${'กรุณากรอกด้านทางการบริหาร'}`,
|
||||
]
|
||||
: []
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
|
|
@ -991,11 +991,6 @@ async function clearFormPositionSelect() {
|
|||
label="ด้าน/สาขา"
|
||||
lazy-rules
|
||||
hide-bottom-space
|
||||
:rules="
|
||||
!isDisValidate
|
||||
? [(val) => !!val || `${'กรุณากรอกด้าน/สาขา'}`]
|
||||
: []
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue