แก้ dialog สร้างโครงสร้างใหม่

This commit is contained in:
Warunee Tamkoo 2024-02-06 17:21:46 +07:00
parent c0cf58c95b
commit 25a8fb9aa2

View file

@ -130,16 +130,20 @@ async function fetchOrgRevision() {
showLoader(); showLoader();
await http await http
.get(config.API.organizationHistoryNew) .get(config.API.organizationHistoryNew)
.then((res) => { .then(async (res) => {
const data = res.data.result.filter( const data = res.data.result.filter(
(e: HistoryType) => e.orgRevisionIsDraft === false (e: HistoryType) => e.orgRevisionIsDraft === false
); );
if (data) { if (data) {
const listOption = data.map((e: HistoryType) => ({ // const listOption = data.map((e: HistoryType) => ({
id: e.orgRevisionId, // id: e.orgRevisionId,
name: e.orgRevisionName, // name: e.orgRevisionName,
})); // }));
orgRevisionOpMain.value = listOption; // orgRevisionOpMain.value = listOption;
const currentStr = await data.find(
(x: any) => x.orgRevisionIsCurrent === true
);
formData.orgRevisionId = currentStr ? currentStr.orgRevisionId : null;
} }
}) })
.catch((err) => { .catch((err) => {
@ -150,19 +154,19 @@ async function fetchOrgRevision() {
}); });
} }
function filterSelector(val: any, update: Function, refData: string) { // function filterSelector(val: any, update: Function, refData: string) {
switch (refData) { // switch (refData) {
case "orgRevisionId": // case "orgRevisionId":
update(() => { // update(() => {
orgRevisionOp.value = orgRevisionOpMain.value.filter( // orgRevisionOp.value = orgRevisionOpMain.value.filter(
(v: DataOption) => v.name.indexOf(val) > -1 // (v: DataOption) => v.name.indexOf(val) > -1
); // );
}); // });
break; // break;
default: // default:
break; // break;
} // }
} // }
watch( watch(
() => modal.value, () => modal.value,
@ -213,7 +217,7 @@ watch(
lazy-rules lazy-rules
/> />
</div> </div>
<div class="col-6" v-if="type !== 'NEW'"> <!-- <div class="col-6" v-if="type !== 'NEW'">
<q-select <q-select
for="#orgRevisionId" for="#orgRevisionId"
ref="orgRevisionIdRef" ref="orgRevisionIdRef"
@ -242,7 +246,7 @@ watch(
</q-item> </q-item>
</template> </template>
</q-select> </q-select>
</div> </div> -->
</div> </div>
</q-card-section> </q-card-section>
<q-separator /> <q-separator />