ปรับ Code เคื่องราช

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-08-29 10:59:58 +07:00
parent 51d072ccc0
commit 240862be2c
13 changed files with 548 additions and 885 deletions

View file

@ -12,14 +12,7 @@ import DialogPopupReason from "@/components/Dialogs/PopupReason.vue";
const router = useRouter();
const mixin = useCounterMixin();
const {
dialogRemove,
dialogConfirm,
showLoader,
hideLoader,
messageError,
success,
} = mixin;
const { dialogConfirm, showLoader, hideLoader, messageError, success } = mixin;
const $q = useQuasar();
const DataStore = useInsigniaDataStore();
@ -30,7 +23,6 @@ const modalAdd = ref<boolean>(false);
const modalEdit = ref<boolean>(false);
const rowid = ref<string>("");
const organization = ref<string>("");
const fileId = ref<string>("");
const organizationOptions = ref<any>([{ id: "1", name: "ทั้งหมด" }]);
const visibleColumns = ref<string[]>([
@ -178,7 +170,6 @@ const columns2 = ref<QTableProps["columns"]>([
]);
const rows2 = ref<any[]>([]);
const person = ref<any>([]);
const props = defineProps({
tab: {
@ -205,10 +196,6 @@ const props = defineProps({
});
onMounted(async () => {
// if (DataStore.typeOc == "") {
// // organization.value = DataStore.optionsTypeOc[2].id;
// DataStore.typeOc = organization.value;
// } else organization.value = DataStore.typeOc;
organization.value = await (DataStore.agency != null
? DataStore.agency
: DataStore.typeOc);
@ -250,7 +237,6 @@ const fecthlistRetire = async () => {
}
})
.catch((e) => {
// console.log(e);
messageError($q, e);
});
};
@ -271,8 +257,6 @@ const fecthlistperson = async (id: string) => {
criterias: data,
})
.then((res) => {
// console.log(res);
rows2.value = res.data.result.map((e: any) => ({
id: e.id,
fullname: e.fullname == null ? "-" : e.fullname,
@ -283,14 +267,12 @@ const fecthlistperson = async (id: string) => {
modalAdd.value = true;
})
.catch((e) => {
// console.log(e);
messageError($q, e);
})
.finally(() => {
hideLoader();
});
};
const clickAdd = async (id: string) => {
dialogConfirm(
$q,
@ -306,17 +288,14 @@ const addlistperson = async (id: string) => {
showLoader();
let data = {
profileId: id,
// insigniaId: organization.value,
insigniaPeriodId: props.roundId,
};
// console.log(data);
await http
.post(config.API.insigniaCreate(), data)
.then(() => {
success($q, "เพิ่มรายชื่อสำเร็จ");
})
.catch((err) => {
// console.log(err);
messageError($q, err);
})
.finally(() => {
@ -333,20 +312,11 @@ const addlistperson = async (id: string) => {
});
};
// const clickAction = (props: any, action: string) => {
// Note.value = "";
// person.value = props;
// titleModal.value = props.name;
// actionModal.value = action;
// modalNote.value = true;
// };
const clickmodalEdit = (props: any) => {
insignia.value = props.insigniaSend;
// insigniaType.value = props.insigniaLevel;
person.value = props;
modalEdit.value = true;
fecthInsignia();
// fecthInsigniaType();
};
const downloadFile = (response: any, filename: string) => {
@ -393,7 +363,6 @@ const clickSave = () => {
const listEdit = async (profileId: string) => {
let data: any = {
insigniaId: insignia.value,
// insigniaTypeId: insigniaType.value,
};
await http
.put(config.API.insigniaEdit(profileId), data)
@ -499,7 +468,6 @@ const listdelete = async (id: string, reason: string) => {
const insignia = ref<string>("");
const insigniaOptions = ref<any>([]);
const insigniaType = ref<string>("");
// const insigniaTypeOptions = ref<any>([]);
const fecthInsignia = async () => {
await http
@ -507,17 +475,10 @@ const fecthInsignia = async () => {
.then((res) => {
insigniaOptions.value = res.data.result;
})
.catch(() => {
// console.log(err);
.catch((e) => {
messageError($q, e);
});
};
// const fecthInsigniaType = async () => {
// await http(config.API.insigniaType)
// .then((res) => {
// insigniaTypeOptions.value = res.data.result;
// })
// .catch((err) => {});
// };
const nextPage = (id: string) => {
router.push(`/registry/${id}`);
@ -559,7 +520,6 @@ const paginationLabel2 = (start: number, end: number, total: number) => {
<div class="col-12 row q-pa-md">
<div class="row col-12">
<div class="row col-12 q-col-gutter-sm">
<!-- {{ DataStore.typeinsigniaOptions }} -->
<q-select
v-if="props.roleUser == 'admin'"
v-model="organization"
@ -958,31 +918,14 @@ const paginationLabel2 = (start: number, end: number, total: number) => {
style="min-width: 150px"
/>
</div>
<!-- <div class="col">
<q-select
v-model="insigniaType"
label="ชั้นเครื่องราชฯ"
dense
emit-value
map-options
:options="insigniaTypeOptions"
option-value="id"
option-label="name"
lazy-rules
hide-bottom-space
:readonly="false"
:borderless="false"
:outlined="true"
:hide-dropdown-icon="false"
style="min-width: 150px"
/>
</div> -->
</div>
</div>
<q-separator />
<div class="q-pa-md">
<div class="row justify-end">
<q-btn label="บันทึก" @click="clickSave" color="public" />
<q-btn label="บันทึก" @click="clickSave" color="public"
><q-tooltip>นท</q-tooltip></q-btn
>
</div>
</div>
</q-card>
@ -1002,54 +945,4 @@ const paginationLabel2 = (start: number, end: number, total: number) => {
:click-close="closemodelPopupDelete"
:savaForm="savaReasonDelete"
/>
<!-- note -->
<!-- <q-dialog v-model="modalNote" persistent>
<q-card style="min-width: 350px">
<q-toolbar>
<q-toolbar-title class="text-subtitle2 text-bold">
<div v-if="actionModal == 'note'">
เปนเหตผลทไมนขอ {{ titleModal }}
</div>
<div v-if="actionModal == 'delete'">ลบออก {{ titleModal }}</div>
</q-toolbar-title>
<q-btn
icon="close"
unelevated
round
dense
@click="modalNote = false"
style="color: #ff8080; background-color: #ffdede"
/> </q-toolbar
><q-separator />
<q-card-section class="q-pt-none"></q-card-section>
<q-card-section class="q-pt-none">
<q-input
dense
outlined
type="textarea"
label="เหตุผลที่ไม่ยื่นขอ"
v-model="Note"
@keyup.enter="modalNote = false"
:rules="[(val) => !!val || 'เหตุผลที่ไม่ยื่นขอ']"
/>
</q-card-section>
<q-card-actions align="right" class="bg-white text-teal">
<q-btn
v-if="actionModal == 'note'"
label="บันทึก"
@click="clickSavenote"
color="public"
:disable="Note === ''"
/>
<q-btn
v-if="actionModal == 'delete'"
label="บันทึก"
@click="clickDelete"
color="public"
:disable="Note === ''"
/>
</q-card-actions>
</q-card>
</q-dialog> -->
</template>