fix(discipline-suspend):fetch-listorder
This commit is contained in:
parent
e37c0cf079
commit
60156836a1
4 changed files with 72 additions and 15 deletions
|
|
@ -4,6 +4,9 @@ import { useQuasar } from "quasar";
|
||||||
|
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
import { useCommandMainStore } from "@/modules/18_command/store/Main";
|
import { useCommandMainStore } from "@/modules/18_command/store/Main";
|
||||||
|
import { useDisciplineSuspendStore } from "@/modules/11_discipline/store/SuspendStore";
|
||||||
|
import http from "@/plugins/http";
|
||||||
|
import config from "@/app.config";
|
||||||
|
|
||||||
import type { QTableProps } from "quasar";
|
import type { QTableProps } from "quasar";
|
||||||
import type { dataType } from "@/modules/11_discipline/interface/response/suspend";
|
import type { dataType } from "@/modules/11_discipline/interface/response/suspend";
|
||||||
|
|
@ -15,8 +18,9 @@ import DialogCreateCommand from "@/modules/18_command/components/DialogCreateCom
|
||||||
/** use */
|
/** use */
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const storeCommand = useCommandMainStore();
|
const storeCommand = useCommandMainStore();
|
||||||
const mixin = useCounterMixin();
|
const storeSuspend = useDisciplineSuspendStore();
|
||||||
const { dialogConfirm, onSearchDataTable } = mixin;
|
const { onSearchDataTable, showLoader, hideLoader, messageError, date2Thai } =
|
||||||
|
useCounterMixin();
|
||||||
|
|
||||||
const modal = defineModel<boolean>("modal", { required: true });
|
const modal = defineModel<boolean>("modal", { required: true });
|
||||||
const modalCommand = ref<boolean>(false); // ตัวแปร popup สร้างคำสั่ง
|
const modalCommand = ref<boolean>(false); // ตัวแปร popup สร้างคำสั่ง
|
||||||
|
|
@ -47,6 +51,7 @@ const filterKeyword = ref<string>("");
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
rows: dataType[];
|
rows: dataType[];
|
||||||
fetchData: Function;
|
fetchData: Function;
|
||||||
|
employeeClass: string;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
/** คอลัมน์ */
|
/** คอลัมน์ */
|
||||||
|
|
@ -128,6 +133,62 @@ const visibleColumns = ref<string[]>([
|
||||||
"status",
|
"status",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
async function fetchListData() {
|
||||||
|
showLoader();
|
||||||
|
const paramsNew = {
|
||||||
|
keyword: filterKeyword.value.trim(),
|
||||||
|
profileType: props.employeeClass,
|
||||||
|
status: "PENDING",
|
||||||
|
};
|
||||||
|
|
||||||
|
await http
|
||||||
|
.get(config.API.suspendMain, { params: paramsNew })
|
||||||
|
.then(async (res) => {
|
||||||
|
const result = await res.data.result.data;
|
||||||
|
const mapData = result.map((item: dataType) => {
|
||||||
|
return {
|
||||||
|
id: item.id,
|
||||||
|
profileId: item.profileId,
|
||||||
|
citizenId: item.citizenId,
|
||||||
|
name: `${item.prefix}${item.firstName} ${item.lastName}`,
|
||||||
|
prefix: item.prefix,
|
||||||
|
firstName: item.firstName,
|
||||||
|
profileType: item.profileType,
|
||||||
|
lastName: item.lastName,
|
||||||
|
organization: item.organization,
|
||||||
|
position: item.position,
|
||||||
|
posNo: item.posNo,
|
||||||
|
positionType: item.positionType,
|
||||||
|
positionLevel: item.positionLevel,
|
||||||
|
salary: item.salary,
|
||||||
|
status: storeSuspend.statusTothai(item.status),
|
||||||
|
statusEn: item.status,
|
||||||
|
descriptionSuspend: item.descriptionSuspend,
|
||||||
|
dateTotal:
|
||||||
|
item.startDateSuspend && item.endDateSuspend
|
||||||
|
? `${date2Thai(item.startDateSuspend)} - ${date2Thai(
|
||||||
|
item.endDateSuspend
|
||||||
|
)}`
|
||||||
|
: "-",
|
||||||
|
startDateSuspend: item.startDateSuspend,
|
||||||
|
endDateSuspend: item.endDateSuspend,
|
||||||
|
title: item.title,
|
||||||
|
offenseDetails: item.offenseDetails,
|
||||||
|
disciplinaryFaultLevel: item.disciplinaryFaultLevel,
|
||||||
|
disciplinaryCaseFault: item.disciplinaryCaseFault,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
rows.value = mapData;
|
||||||
|
rowsMain.value = mapData;
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
messageError($q, e);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
hideLoader();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function closeModal() {
|
function closeModal() {
|
||||||
modal.value = false;
|
modal.value = false;
|
||||||
commandType.value = "";
|
commandType.value = "";
|
||||||
|
|
@ -149,15 +210,8 @@ function filterSelector(val: string, update: Function) {
|
||||||
|
|
||||||
/** ฟังก์ชั่นยืนยันและส่งคนไปสร้างคำสั่ง */
|
/** ฟังก์ชั่นยืนยันและส่งคนไปสร้างคำสั่ง */
|
||||||
function saveOrder() {
|
function saveOrder() {
|
||||||
// dialogConfirm(
|
|
||||||
// $q,
|
|
||||||
// async () => {
|
|
||||||
modalCommand.value = true;
|
modalCommand.value = true;
|
||||||
modal.value = false;
|
modal.value = false;
|
||||||
// },
|
|
||||||
// "ยืนยันส่งไปออกคำสั่ง",
|
|
||||||
// "ต้องการยืนยันส่งไปออกคำสั่งใช่หรือไม่?"
|
|
||||||
// );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function serchDataTable() {
|
function serchDataTable() {
|
||||||
|
|
@ -185,8 +239,7 @@ watch(
|
||||||
() => modal.value,
|
() => modal.value,
|
||||||
async () => {
|
async () => {
|
||||||
if (modal.value === true) {
|
if (modal.value === true) {
|
||||||
rows.value = props.rows ? props.rows : [];
|
await fetchListData();
|
||||||
rowsMain.value = props.rows ? props.rows : [];
|
|
||||||
selected.value = [];
|
selected.value = [];
|
||||||
const data = await storeCommand.getCommandTypes();
|
const data = await storeCommand.getCommandTypes();
|
||||||
listCommand.value = data.filter(
|
listCommand.value = data.filter(
|
||||||
|
|
@ -274,7 +327,7 @@ watch(
|
||||||
keep-color
|
keep-color
|
||||||
color="primary"
|
color="primary"
|
||||||
dense
|
dense
|
||||||
:disable="commandType"
|
:disable="commandType ? false : true"
|
||||||
v-model="scope.selected"
|
v-model="scope.selected"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -285,7 +338,7 @@ watch(
|
||||||
keep-color
|
keep-color
|
||||||
color="primary"
|
color="primary"
|
||||||
dense
|
dense
|
||||||
:disable="commandType"
|
:disable="commandType ? false : true"
|
||||||
v-model="props.selected"
|
v-model="props.selected"
|
||||||
/>
|
/>
|
||||||
</q-td>
|
</q-td>
|
||||||
|
|
|
||||||
|
|
@ -31,9 +31,9 @@ const { messageError, showLoader, hideLoader, date2Thai, convertDateToAPI } =
|
||||||
const { pagination, params, onRequest } = usePagination("", getList);
|
const { pagination, params, onRequest } = usePagination("", getList);
|
||||||
|
|
||||||
const date = ref<any>(null);
|
const date = ref<any>(null);
|
||||||
const employeeClass = ref<string>("");
|
const employeeClass = ref<string>("OFFICER");
|
||||||
const employeeClassOption = ref<DataOption[]>([
|
const employeeClassOption = ref<DataOption[]>([
|
||||||
{ id: "", name: "ทั้งหมด" },
|
// { id: "", name: "ทั้งหมด" },
|
||||||
{ id: "OFFICER", name: "ข้าราชการ กทม. สามัญ" },
|
{ id: "OFFICER", name: "ข้าราชการ กทม. สามัญ" },
|
||||||
{ id: "EMPLOYEE", name: "ลูกจ้างประจำ กทม." },
|
{ id: "EMPLOYEE", name: "ลูกจ้างประจำ กทม." },
|
||||||
]);
|
]);
|
||||||
|
|
@ -451,6 +451,7 @@ onMounted(async () => {
|
||||||
v-model:modal="modal"
|
v-model:modal="modal"
|
||||||
:rows="rows2"
|
:rows="rows2"
|
||||||
:fetch-data="getList"
|
:fetch-data="getList"
|
||||||
|
:employeeClass="employeeClass"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<style scoped lang="scss"></style>
|
<style scoped lang="scss"></style>
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,8 @@ interface dataType {
|
||||||
offenseDetails: string;
|
offenseDetails: string;
|
||||||
disciplinaryFaultLevel: string;
|
disciplinaryFaultLevel: string;
|
||||||
disciplinaryCaseFault: string;
|
disciplinaryCaseFault: string;
|
||||||
|
profileId?: string;
|
||||||
|
profileType: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface DataDetail {
|
interface DataDetail {
|
||||||
|
|
|
||||||
|
|
@ -99,6 +99,7 @@ export const useDisciplineSuspendStore = defineStore(
|
||||||
visibleColumns,
|
visibleColumns,
|
||||||
getData,
|
getData,
|
||||||
offenseDetailsOps,
|
offenseDetailsOps,
|
||||||
|
statusTothai,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue