ทะเบียนประวัติ: ประวัติเปลี่ยนชื่อ ดึงข้อมูลมาใส่input+readonly
This commit is contained in:
parent
3b02120606
commit
0a4bc767ab
1 changed files with 76 additions and 32 deletions
|
|
@ -24,20 +24,19 @@ const {
|
||||||
success,
|
success,
|
||||||
dialogConfirm,
|
dialogConfirm,
|
||||||
messageError,
|
messageError,
|
||||||
typeChangeName,
|
|
||||||
showLoader,
|
showLoader,
|
||||||
hideLoader,
|
hideLoader,
|
||||||
dialogRemove,
|
dialogRemove,
|
||||||
} = mixin;
|
} = mixin;
|
||||||
|
|
||||||
const { calculateAge, fetchPerson } = store;
|
const { fetchPerson } = store;
|
||||||
const profileId = ref<string>(route.params.id.toString());
|
const profileId = ref<string>(route.params.id.toString());
|
||||||
const editId = ref<string>("");
|
const editId = ref<string>("");
|
||||||
const dialog = ref<boolean>(false);
|
const dialog = ref<boolean>(false);
|
||||||
const dialogStatus = ref<string>("create");
|
const dialogStatus = ref<string>("create");
|
||||||
const filterSearch = ref("");
|
const filterSearch = ref("");
|
||||||
const filterHistory = ref<string>("");
|
const filterHistory = ref<string>("");
|
||||||
const fileName = ref<string>("");
|
|
||||||
const modalHistory = ref<boolean>(false);
|
const modalHistory = ref<boolean>(false);
|
||||||
const rowsHistory = ref<RequestItemsObject[]>([]);
|
const rowsHistory = ref<RequestItemsObject[]>([]);
|
||||||
const changeNameData = reactive<any>({
|
const changeNameData = reactive<any>({
|
||||||
|
|
@ -50,20 +49,23 @@ const changeNameData = reactive<any>({
|
||||||
documentId: "",
|
documentId: "",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const profileInfo = ref<any>([]);
|
||||||
|
|
||||||
const statusOption = ref([
|
const statusOption = ref([
|
||||||
"เปลี่ยนคำนำหน้าชื่อ",
|
"เปลี่ยนคำนำหน้าชื่อ",
|
||||||
"เปลี่ยนชื่อ",
|
"เปลี่ยนชื่อ",
|
||||||
"เปลี่ยนนามสกุล",
|
"เปลี่ยนนามสกุล",
|
||||||
"เปลี่ยนชื่อ-นามสกุล",
|
"เปลี่ยนชื่อ-นามสกุล",
|
||||||
|
"เปลี่ยนคำนำหน้าชื่อ และชื่อ",
|
||||||
"เปลี่ยนคำนำหน้าชื่อ และนามสกุล",
|
"เปลี่ยนคำนำหน้าชื่อ และนามสกุล",
|
||||||
"เปลี่ยนคำนำหน้าชื่อ และชื่อ-นามสกุล",
|
"เปลี่ยนคำนำหน้าชื่อ และชื่อ-นามสกุล",
|
||||||
]);
|
]);
|
||||||
const prefixFilter = ref([]);
|
|
||||||
const statusOptionFilter = ref([
|
const statusOptionFilter = ref([
|
||||||
"เปลี่ยนคำนำหน้าชื่อ",
|
"เปลี่ยนคำนำหน้าชื่อ",
|
||||||
"เปลี่ยนชื่อ",
|
"เปลี่ยนชื่อ",
|
||||||
"เปลี่ยนนามสกุล",
|
"เปลี่ยนนามสกุล",
|
||||||
"เปลี่ยนชื่อ-นามสกุล",
|
"เปลี่ยนชื่อ-นามสกุล",
|
||||||
|
"เปลี่ยนคำนำหน้าชื่อ และชื่อ",
|
||||||
"เปลี่ยนคำนำหน้าชื่อ และนามสกุล",
|
"เปลี่ยนคำนำหน้าชื่อ และนามสกุล",
|
||||||
"เปลี่ยนคำนำหน้าชื่อ และชื่อ-นามสกุล",
|
"เปลี่ยนคำนำหน้าชื่อ และชื่อ-นามสกุล",
|
||||||
]);
|
]);
|
||||||
|
|
@ -258,13 +260,13 @@ function closeDialog() {
|
||||||
dialog.value = false;
|
dialog.value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearForm() {
|
// function clearForm() {
|
||||||
changeNameData.status = "";
|
// changeNameData.status = "";
|
||||||
changeNameData.prefix = "";
|
// changeNameData.prefix = "";
|
||||||
changeNameData.firstName = "";
|
// changeNameData.firstName = "";
|
||||||
changeNameData.lastName = "";
|
// changeNameData.lastName = "";
|
||||||
alertUpload.value = false;
|
// alertUpload.value = false;
|
||||||
}
|
// }
|
||||||
|
|
||||||
async function onSubmit() {
|
async function onSubmit() {
|
||||||
if (!!fileUpload.value) {
|
if (!!fileUpload.value) {
|
||||||
|
|
@ -334,6 +336,21 @@ async function uploadFileURL(uploadUrl: string, file: any) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function fetchDataPersonal() {
|
||||||
|
showLoader();
|
||||||
|
await http
|
||||||
|
.get(config.API.registryNewByProfileId(profileId.value))
|
||||||
|
.then((res) => {
|
||||||
|
profileInfo.value = res.data.result;
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
messageError($q, err);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
hideLoader();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
async function fetchProfile(id: string) {
|
async function fetchProfile(id: string) {
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
await http
|
||||||
|
|
@ -396,24 +413,23 @@ function editData(idData: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteData(idData: string) {
|
function deleteData(idData: string) {
|
||||||
// dialogRemove($q, () =>
|
dialogRemove($q, () =>
|
||||||
http
|
http
|
||||||
.delete(config.API.profileNewChangeNameByChangeNameId(idData))
|
.delete(config.API.profileNewChangeNameByChangeNameId(idData))
|
||||||
.then(() => {
|
.then(() => {
|
||||||
fetchData(profileId.value);
|
fetchData(profileId.value);
|
||||||
success($q, "ลบข้อมูลสำเร็จ");
|
success($q, "ลบข้อมูลสำเร็จ");
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
messageError($q, err);
|
messageError($q, err);
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
hideLoader();
|
hideLoader();
|
||||||
});
|
})
|
||||||
// );
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteFileData(idData: string) {
|
function deleteFileData(idData: string) {
|
||||||
// dialogRemove($q, () =>
|
|
||||||
http
|
http
|
||||||
.delete(
|
.delete(
|
||||||
config.API.subFile(
|
config.API.subFile(
|
||||||
|
|
@ -432,7 +448,6 @@ function deleteFileData(idData: string) {
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
hideLoader();
|
hideLoader();
|
||||||
});
|
});
|
||||||
// );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchHistoryData(id: string) {
|
async function fetchHistoryData(id: string) {
|
||||||
|
|
@ -487,9 +502,9 @@ onMounted(async () => {
|
||||||
) {
|
) {
|
||||||
await fetchPerson();
|
await fetchPerson();
|
||||||
}
|
}
|
||||||
prefixFilter.value = store.Ops.prefixOps;
|
|
||||||
|
|
||||||
fetchData(profileId.value);
|
fetchData(profileId.value);
|
||||||
|
fetchDataPersonal();
|
||||||
});
|
});
|
||||||
function filterSelector(val: string, update: Function, refData: string) {
|
function filterSelector(val: string, update: Function, refData: string) {
|
||||||
switch (refData) {
|
switch (refData) {
|
||||||
|
|
@ -502,7 +517,7 @@ function filterSelector(val: string, update: Function, refData: string) {
|
||||||
break;
|
break;
|
||||||
case "prefixOps":
|
case "prefixOps":
|
||||||
update(() => {
|
update(() => {
|
||||||
store.Ops.prefixOps = prefixFilter.value.filter(
|
store.Ops.prefixOps = store.OpsFilter.prefixOps.filter(
|
||||||
(v: any) => v.name.indexOf(val) > -1
|
(v: any) => v.name.indexOf(val) > -1
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
@ -523,9 +538,12 @@ function filterSelector(val: string, update: Function, refData: string) {
|
||||||
size="16px"
|
size="16px"
|
||||||
@click="
|
@click="
|
||||||
() => {
|
() => {
|
||||||
|
changeNameData.prefix = profileInfo.prefix;
|
||||||
|
changeNameData.firstName = profileInfo.firstName;
|
||||||
|
changeNameData.lastName = profileInfo.lastName;
|
||||||
|
changeNameData.status = '';
|
||||||
dialogStatus = 'create';
|
dialogStatus = 'create';
|
||||||
dialog = true;
|
dialog = true;
|
||||||
clearForm();
|
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
|
|
@ -669,7 +687,7 @@ function filterSelector(val: string, update: Function, refData: string) {
|
||||||
</q-td>
|
</q-td>
|
||||||
<q-td auto-width>
|
<q-td auto-width>
|
||||||
<q-btn
|
<q-btn
|
||||||
v-if="props.row.file != null"
|
v-if="props.row.file !== null"
|
||||||
color="green"
|
color="green"
|
||||||
flat
|
flat
|
||||||
dense
|
dense
|
||||||
|
|
@ -688,7 +706,7 @@ function filterSelector(val: string, update: Function, refData: string) {
|
||||||
<q-form @submit.prevent greedy @validation-success="onSubmit()">
|
<q-form @submit.prevent greedy @validation-success="onSubmit()">
|
||||||
<q-card-section class="flex justify-between" style="padding: 0">
|
<q-card-section class="flex justify-between" style="padding: 0">
|
||||||
<dialog-header
|
<dialog-header
|
||||||
:tittle="dialogStatus == 'edit' ? 'แก้ไขข้อมูล' : 'เพิ่มข้อมูล'"
|
:tittle="dialogStatus === 'edit' ? 'แก้ไขข้อมูล' : 'เพิ่มข้อมูล'"
|
||||||
:close="closeDialog"
|
:close="closeDialog"
|
||||||
/>
|
/>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
|
|
@ -717,6 +735,15 @@ function filterSelector(val: string, update: Function, refData: string) {
|
||||||
<div class="row q-gutter-md q-mb-md">
|
<div class="row q-gutter-md q-mb-md">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<q-select
|
<q-select
|
||||||
|
:readonly="
|
||||||
|
!changeNameData.status ||
|
||||||
|
(changeNameData.status !== 'เปลี่ยนคำนำหน้าชื่อ' &&
|
||||||
|
changeNameData.status !== 'เปลี่ยนคำนำหน้าชื่อ และชื่อ' &&
|
||||||
|
changeNameData.status !==
|
||||||
|
'เปลี่ยนคำนำหน้าชื่อ และนามสกุล' &&
|
||||||
|
changeNameData.status !==
|
||||||
|
'เปลี่ยนคำนำหน้าชื่อ และชื่อ-นามสกุล')
|
||||||
|
"
|
||||||
v-model="changeNameData.prefix"
|
v-model="changeNameData.prefix"
|
||||||
:options="store.Ops.prefixOps"
|
:options="store.Ops.prefixOps"
|
||||||
label="คำนำหน้าชื่อ"
|
label="คำนำหน้าชื่อ"
|
||||||
|
|
@ -739,6 +766,14 @@ function filterSelector(val: string, update: Function, refData: string) {
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<q-input
|
<q-input
|
||||||
|
:readonly="
|
||||||
|
!changeNameData.status ||
|
||||||
|
(changeNameData.status !== 'เปลี่ยนชื่อ' &&
|
||||||
|
changeNameData.status !== 'เปลี่ยนคำนำหน้าชื่อ และชื่อ' &&
|
||||||
|
changeNameData.status !== 'เปลี่ยนชื่อ-นามสกุล' &&
|
||||||
|
changeNameData.status !==
|
||||||
|
'เปลี่ยนคำนำหน้าชื่อ และชื่อ-นามสกุล')
|
||||||
|
"
|
||||||
outlined
|
outlined
|
||||||
v-model="changeNameData.firstName"
|
v-model="changeNameData.firstName"
|
||||||
label="ชื่อ"
|
label="ชื่อ"
|
||||||
|
|
@ -750,6 +785,15 @@ function filterSelector(val: string, update: Function, refData: string) {
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<q-input
|
<q-input
|
||||||
|
:readonly="
|
||||||
|
!changeNameData.status ||
|
||||||
|
(changeNameData.status !== 'เปลี่ยนนามสกุล' &&
|
||||||
|
changeNameData.status !== 'เปลี่ยนชื่อ-นามสกุล' &&
|
||||||
|
changeNameData.status !==
|
||||||
|
'เปลี่ยนคำนำหน้าชื่อ และนามสกุล' &&
|
||||||
|
changeNameData.status !==
|
||||||
|
'เปลี่ยนคำนำหน้าชื่อ และชื่อ-นามสกุล')
|
||||||
|
"
|
||||||
outlined
|
outlined
|
||||||
v-model="changeNameData.lastName"
|
v-model="changeNameData.lastName"
|
||||||
label="นามสกุล"
|
label="นามสกุล"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue