ปรับ Code เคื่องราช
This commit is contained in:
parent
51d072ccc0
commit
240862be2c
13 changed files with 548 additions and 885 deletions
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -6,11 +6,7 @@ import { useRouter } from "vue-router";
|
|||
import DialogInformation from "@/components/Dialogs/Information.vue";
|
||||
|
||||
const router = useRouter();
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
const DataStore = useInsigniaDataStore();
|
||||
|
||||
const props = defineProps({
|
||||
tab: {
|
||||
type: String,
|
||||
|
|
@ -38,7 +34,6 @@ const visibleColumns = ref<string[]>([
|
|||
"position",
|
||||
"level",
|
||||
"salary",
|
||||
|
||||
"insigniaType",
|
||||
"insigniaSend",
|
||||
"insigniaLevel",
|
||||
|
|
@ -143,12 +138,9 @@ onMounted(async () => {
|
|||
organization.value = await (DataStore.agency != null
|
||||
? DataStore.agency
|
||||
: DataStore.typeOc);
|
||||
// if (props.fecthInsigniaAll) {
|
||||
// await props.fecthInsigniaAll(props.roundId, props.tab);
|
||||
// }
|
||||
if (organization.value !== "" || organization.value !== undefined) {
|
||||
if (props.fecthInsigniaByOc) {
|
||||
props.fecthInsigniaByOc(
|
||||
await props.fecthInsigniaByOc(
|
||||
props.roundId,
|
||||
organization.value,
|
||||
"officer",
|
||||
|
|
@ -207,7 +199,6 @@ const closeReson = () => {
|
|||
<template>
|
||||
<div class="col-12 row q-pa-md">
|
||||
<div class="row col-12">
|
||||
<!-- {{ DataStore.typeinsigniaOptions }} -->
|
||||
<div class="row col-12 q-col-gutter-sm">
|
||||
<q-select
|
||||
v-if="props.roleUser == 'admin'"
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import DialogInformation from "@/components/Dialogs/Information.vue";
|
|||
|
||||
const router = useRouter();
|
||||
const DataStore = useInsigniaDataStore();
|
||||
|
||||
const props = defineProps({
|
||||
tab: {
|
||||
type: String,
|
||||
|
|
@ -138,12 +137,10 @@ onMounted(async () => {
|
|||
organization.value = await (DataStore.agency != null
|
||||
? DataStore.agency
|
||||
: DataStore.typeOc);
|
||||
// if (props.fecthInsigniaAll) {
|
||||
// await props.fecthInsigniaAll(props.roundId, props.tab);
|
||||
// }
|
||||
|
||||
if (organization.value !== "" || organization.value !== undefined) {
|
||||
if (props.fecthInsigniaByOc) {
|
||||
props.fecthInsigniaByOc(
|
||||
await props.fecthInsigniaByOc(
|
||||
props.roundId,
|
||||
organization.value,
|
||||
"officer",
|
||||
|
|
@ -152,9 +149,9 @@ onMounted(async () => {
|
|||
}
|
||||
}
|
||||
});
|
||||
const changtypeOc = () => {
|
||||
const changtypeOc = async () => {
|
||||
if (props.fecthInsigniaByOc) {
|
||||
props.fecthInsigniaByOc(
|
||||
await props.fecthInsigniaByOc(
|
||||
props.roundId,
|
||||
organization.value,
|
||||
"officer",
|
||||
|
|
@ -342,8 +339,7 @@ const closeReson = () => {
|
|||
flat
|
||||
round
|
||||
color="blue"
|
||||
@click.stop
|
||||
@click="showNote(props.row)"
|
||||
@click.stop="showNote(props.row)"
|
||||
icon="mdi-information-outline"
|
||||
>
|
||||
<q-tooltip>เหตุผลการลบ</q-tooltip>
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import config from "@/app.config";
|
|||
const $q = useQuasar();
|
||||
const mixin = useCounterMixin();
|
||||
const { showLoader, hideLoader, messageError } = mixin;
|
||||
|
||||
const props = defineProps({
|
||||
roundId: {
|
||||
type: String,
|
||||
|
|
@ -73,12 +72,6 @@ const fecthOrg = async () => {
|
|||
});
|
||||
};
|
||||
|
||||
const filterKeyword = ref<string>("");
|
||||
const filterRef = ref<any>(null);
|
||||
const resetFilter = () => {
|
||||
filterKeyword.value = "";
|
||||
filterRef.value.focus();
|
||||
};
|
||||
const pagination = ref({
|
||||
sortBy: "desc",
|
||||
descending: false,
|
||||
|
|
@ -94,77 +87,11 @@ const paginationLabel = (start: number, end: number, total: number) => {
|
|||
<template>
|
||||
<div class="col-12 row q-pa-md">
|
||||
<div class="row col-12">
|
||||
<!-- <div class="row col-12 q-col-gutter-sm">
|
||||
<q-select
|
||||
v-model="organization"
|
||||
label="หน่วยงาน"
|
||||
dense
|
||||
emit-value
|
||||
map-options
|
||||
:options="organizationOptions"
|
||||
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>
|
||||
<q-btn size="md" icon="mdi-download" flat round color="primary">
|
||||
<q-tooltip>ดาวน์โหลด</q-tooltip>
|
||||
</q-btn>
|
||||
<q-btn size="12px" flat round color="add" icon="mdi-plus">
|
||||
<q-tooltip>เพิ่ม</q-tooltip>
|
||||
</q-btn>
|
||||
</div>
|
||||
<q-space />
|
||||
|
||||
<q-input
|
||||
class="col-xs-12 col-sm-3 col-md-2"
|
||||
standout
|
||||
dense
|
||||
v-model="filterKeyword"
|
||||
ref="filterRef"
|
||||
outlined
|
||||
debounce="300"
|
||||
placeholder="ค้นหา"
|
||||
>
|
||||
<template v-slot:append>
|
||||
<q-icon v-if="filterKeyword == ''" name="search" />
|
||||
<q-icon
|
||||
v-if="filterKeyword !== ''"
|
||||
name="clear"
|
||||
class="cursor-pointer"
|
||||
@click="resetFilter"
|
||||
/>
|
||||
</template>
|
||||
</q-input>
|
||||
|
||||
<q-select
|
||||
v-model="visibleColumns"
|
||||
multiple
|
||||
outlined
|
||||
dense
|
||||
options-dense
|
||||
:display-value="$q.lang.table.columns"
|
||||
emit-value
|
||||
map-options
|
||||
:options="columns"
|
||||
option-value="name"
|
||||
options-cover
|
||||
style="min-width: 150px"
|
||||
class="col-xs-12 col-sm-3 col-md-2"
|
||||
/>
|
||||
</div> -->
|
||||
<div class="col-12">
|
||||
<q-table
|
||||
ref="table"
|
||||
:columns="columns"
|
||||
:rows="rows"
|
||||
:filter="filterKeyword"
|
||||
row-key="name"
|
||||
dense
|
||||
flat
|
||||
|
|
@ -180,8 +107,6 @@ const paginationLabel = (start: number, end: number, total: number) => {
|
|||
<q-th v-for="col in props.cols" :key="col.name" :props="props">
|
||||
<span class="text-weight-medium">{{ col.label }}</span>
|
||||
</q-th>
|
||||
<!-- <q-th auto-width />
|
||||
<q-th auto-width /> -->
|
||||
</q-tr>
|
||||
</template>
|
||||
<template v-slot:body="props">
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<script setup lang="ts">
|
||||
import { onMounted, ref, watch } from "vue";
|
||||
import { onMounted, ref } from "vue";
|
||||
import { useQuasar } from "quasar";
|
||||
import { useRouter } from "vue-router";
|
||||
import http from "@/plugins/http";
|
||||
|
|
@ -21,17 +21,13 @@ const roleUser = ref<string>("admin");
|
|||
const DataStore = useInsigniaDataStore();
|
||||
const mixin = useCounterMixin();
|
||||
const { messageError, dialogConfirm, showLoader, hideLoader, success } = mixin;
|
||||
const router = useRouter();
|
||||
const $q = useQuasar(); //ใช้ noti quasar
|
||||
|
||||
const loading = ref<boolean>(false);
|
||||
const round = ref<string>("");
|
||||
const roundName = ref<string>("");
|
||||
|
||||
const optionRound = ref<any>([]);
|
||||
// const typeOc = ref<string>("kljkljk");
|
||||
const optiontypeOc = ref<any>([]);
|
||||
|
||||
const tab = ref<any>("pending");
|
||||
const stat = ref<any>({
|
||||
allUserUser: 0,
|
||||
|
|
@ -57,7 +53,6 @@ const checkRole = async () => {
|
|||
} else {
|
||||
roleUser.value = "admin";
|
||||
}
|
||||
// console.log("roleUser ===> ", roleUser.value);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -70,8 +65,6 @@ const fecthlistRound = async () => {
|
|||
year: e.period_year,
|
||||
name: e.period_name,
|
||||
}));
|
||||
// console.log(optionRound.value);
|
||||
// const lastIndex = optionRound.value.length;
|
||||
const lastValue = optionRound.value[0];
|
||||
round.value = lastValue.id.toString();
|
||||
roundName.value = lastValue.name;
|
||||
|
|
@ -126,10 +119,8 @@ const fecthType = async () => {
|
|||
name: e.organizationName,
|
||||
}));
|
||||
DataStore.fetchOption(optiontypeOc.value);
|
||||
// DataStore.optionsTypeOc = ;
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
|
|
@ -151,21 +142,6 @@ const changround = async () => {
|
|||
roundFilter.year + 543
|
||||
}`;
|
||||
};
|
||||
// const fecthInsigniaAll = async (periodId: string, tab: string) => {
|
||||
// // let data: any = [];
|
||||
// // for (const item of DataStore.optionsTypeOc) {
|
||||
// // await http
|
||||
// // .get(config.API.insigniaList(periodId, item["id"], "officer", tab))
|
||||
// // .then((res) => {
|
||||
// // // console.log(res);
|
||||
// // data.push(res.data.result);
|
||||
// // })
|
||||
// // .catch((err) => {
|
||||
// // console.log(err);
|
||||
// // });
|
||||
// // }
|
||||
// // console.log(data);
|
||||
// };
|
||||
const requestNote = ref<string>("");
|
||||
const requestStatus = ref<string>("");
|
||||
const fecthInsigniaByOc = async (
|
||||
|
|
@ -175,19 +151,16 @@ const fecthInsigniaByOc = async (
|
|||
status: string
|
||||
) => {
|
||||
showLoader();
|
||||
// console.log("ocId===>", ocId);
|
||||
await http
|
||||
.get(config.API.insigniaList(roundId, ocId, role, status))
|
||||
.then(async (res) => {
|
||||
// console.log(res);
|
||||
requestNote.value = res.data.result.requestNote;
|
||||
requestStatus.value = res.data.result.requestStatus;
|
||||
|
||||
await DataStore.fetchData(res.data.result.items);
|
||||
})
|
||||
.catch((err) => {
|
||||
// console.log(err);
|
||||
messageError($q);
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = true;
|
||||
|
|
@ -210,7 +183,6 @@ const sendToDirector = async () => {
|
|||
);
|
||||
})
|
||||
.catch((err) => {
|
||||
// console.log(err);
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
|
|
@ -249,7 +221,6 @@ const backToEdit = async (reason: string) => {
|
|||
);
|
||||
})
|
||||
.catch((err) => {
|
||||
// console.log(err);
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
|
|
@ -279,7 +250,6 @@ const directorApproved = async () => {
|
|||
);
|
||||
})
|
||||
.catch((err) => {
|
||||
// console.log(err);
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
|
|
@ -308,7 +278,6 @@ const requestSendNote = async () => {
|
|||
);
|
||||
})
|
||||
.catch((err) => {
|
||||
// console.log(err);
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
|
|
@ -479,7 +448,9 @@ const requestSendNote = async () => {
|
|||
color="public"
|
||||
class="q-px-md q-ml-md"
|
||||
@click="requestSendNote"
|
||||
/>
|
||||
>
|
||||
<q-tooltip>บันทึกข้อมูล</q-tooltip>
|
||||
</q-btn>
|
||||
</q-toolbar>
|
||||
|
||||
<DialogPopupReason
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue