Merge branch 'develop' into devTee
This commit is contained in:
commit
37901242c7
6 changed files with 135 additions and 84 deletions
|
|
@ -12,6 +12,7 @@ import config from "@/app.config";
|
|||
import CardTop from "@/modules/05_placement/components/PersonalList/StatCard.vue";
|
||||
import AddTablePosition from "@/modules/05_placement/components/PersonalList/Table.vue";
|
||||
|
||||
import type { StatResponse } from "@/modules/05_placement/interface/response/Main";
|
||||
const $q = useQuasar();
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
|
|
@ -25,12 +26,13 @@ const round = ref<string>("");
|
|||
const title = ref<string>("");
|
||||
const examData = ref<any>();
|
||||
const roleAdmin = ref<boolean>(false);
|
||||
const stat = ref<any>({
|
||||
const stat = ref<StatResponse>({
|
||||
total: 0,
|
||||
unContain: 0,
|
||||
prepareContain: 0,
|
||||
contain: 0,
|
||||
disclaim: 0,
|
||||
report: 0,
|
||||
});
|
||||
|
||||
/**
|
||||
|
|
@ -49,6 +51,7 @@ async function getStat() {
|
|||
prepareContain: statCard.prepareContain,
|
||||
contain: statCard.contain,
|
||||
disclaim: statCard.disclaim,
|
||||
report: statCard.report,
|
||||
};
|
||||
DataStore.checkLoad(1);
|
||||
})
|
||||
|
|
@ -131,6 +134,11 @@ onMounted(async () => {
|
|||
label="จำนวนที่เตรียมบรรจุ"
|
||||
color="#2EA0FF"
|
||||
/>
|
||||
<CardTop
|
||||
:amount="stat.report"
|
||||
label="ส่งไปออกคำสั่ง"
|
||||
color="orange"
|
||||
/>
|
||||
<CardTop
|
||||
:amount="stat.contain"
|
||||
label="จำนวนที่บรรจุแล้ว"
|
||||
|
|
|
|||
|
|
@ -245,10 +245,12 @@ function convertContainStatus(val: string, type: string = "") {
|
|||
return "ยังไม่บรรจุ";
|
||||
case "PREPARE-CONTAIN":
|
||||
return "เตรียม" + (!type ? type : "บรรจุ");
|
||||
case "CONTAIN":
|
||||
case "DONE":
|
||||
return (!type ? type : "บรรจุ") + "แล้ว";
|
||||
case "DISCLAIM":
|
||||
return "สละสิทธิ์";
|
||||
case "REPORT":
|
||||
return "ส่งไปออกคำสั่ง";
|
||||
default:
|
||||
return "-";
|
||||
}
|
||||
|
|
@ -356,7 +358,7 @@ async function getTable() {
|
|||
data.statusId == "PREPARE-CONTAIN" &&
|
||||
data.node == null
|
||||
? "ขอผ่อนผัน"
|
||||
: data.statusId == "CONTAIN"
|
||||
: data.statusId == "DONE"
|
||||
? convertTypeCommand(data.typeCommand) + "แล้ว"
|
||||
: convertContainStatus(data.statusId) +
|
||||
(data.typeCommand != ""
|
||||
|
|
@ -384,7 +386,7 @@ async function getTable() {
|
|||
// รายชื่อทั้งหมด
|
||||
rows.value = await (roleAdmin.value
|
||||
? rowsAll.value
|
||||
: rowsAll.value.filter((x: any) => x.statusId !== "CONTAIN"));
|
||||
: rowsAll.value.filter((x: any) => x.statusId !== "DONE"));
|
||||
// รายชื่อไปยังหน่วยงาน
|
||||
rowsFilter.value = await rows.value.filter(
|
||||
(e: any) =>
|
||||
|
|
@ -748,9 +750,9 @@ function openModalOrder(val: boolean) {
|
|||
|
||||
watch(containStatus, () => {
|
||||
if (containStatus.value) {
|
||||
rows.value = rowsAll.value.filter((x: any) => x.statusId == "CONTAIN");
|
||||
rows.value = rowsAll.value.filter((x: any) => x.statusId == "DONE");
|
||||
} else {
|
||||
rows.value = rowsAll.value.filter((x: any) => x.statusId != "CONTAIN");
|
||||
rows.value = rowsAll.value.filter((x: any) => x.statusId != "DONE");
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -804,7 +806,7 @@ onMounted(async () => {
|
|||
<q-td auto-width>
|
||||
<q-btn
|
||||
v-if="
|
||||
props.row.statusId !== 'CONTAIN' &&
|
||||
props.row.statusId !== 'DONE' &&
|
||||
(checkPermission($route)?.attrIsGet ||
|
||||
checkPermission($route)?.attrIsUpdate)
|
||||
"
|
||||
|
|
@ -834,7 +836,7 @@ onMounted(async () => {
|
|||
<q-item
|
||||
v-if="
|
||||
props.row.nodeName !== null &&
|
||||
props.row.statusId !== 'CONTAIN' &&
|
||||
props.row.statusId !== 'DONE' &&
|
||||
props.row.statusId !== 'DISCLAIM' &&
|
||||
checkPermission($route)?.attrIsUpdate
|
||||
"
|
||||
|
|
|
|||
|
|
@ -101,4 +101,13 @@ interface Education {
|
|||
startDate: string;
|
||||
}
|
||||
|
||||
export type { OpType, DataPerson, Education };
|
||||
interface StatResponse {
|
||||
total: number;
|
||||
unContain: number;
|
||||
prepareContain: number;
|
||||
contain: number;
|
||||
disclaim: number;
|
||||
report: number;
|
||||
}
|
||||
|
||||
export type { OpType, DataPerson, Education, StatResponse };
|
||||
|
|
|
|||
|
|
@ -9,8 +9,12 @@ import { useCounterMixin } from "@/stores/mixin";
|
|||
import { useCommandMainStore } from "@/modules/18_command/store/Main";
|
||||
|
||||
import type { QTableProps } from "quasar";
|
||||
import type {
|
||||
ListCommand,
|
||||
DataOrder,
|
||||
Pagination,
|
||||
} from "@/modules/18_command/interface/index/Main";
|
||||
import type { DataListCommand } from "@/modules/18_command/interface/response/Main";
|
||||
import type { ListCommand } from "@/modules/18_command/interface/index/Main";
|
||||
|
||||
import DialogHeader from "@/components/DialogHeader.vue";
|
||||
|
||||
|
|
@ -18,17 +22,11 @@ const storeCommand = useCommandMainStore();
|
|||
const router = useRouter();
|
||||
const $q = useQuasar();
|
||||
const mixin = useCounterMixin();
|
||||
const {
|
||||
showLoader,
|
||||
success,
|
||||
messageError,
|
||||
dialogConfirm,
|
||||
hideLoader,
|
||||
date2Thai,
|
||||
} = mixin;
|
||||
const { showLoader, messageError, dialogConfirm, hideLoader, date2Thai } =
|
||||
mixin;
|
||||
|
||||
/** props*/
|
||||
const modal = defineModel<boolean>("modal", { required: true });
|
||||
|
||||
const props = defineProps({
|
||||
commandTypeCode: String, // ไอดีประเภทคำสั่ง
|
||||
persons: Array, // ไอดีคนที่เลือกออกคำสั่งส่งมาเป็น array
|
||||
|
|
@ -36,22 +34,14 @@ const props = defineProps({
|
|||
|
||||
const commandOp = ref<ListCommand[]>([]); // ประเภทคำสั่ง
|
||||
const commandType = ref<string>(""); //ประเภทคำสั่ง
|
||||
const commandNo = ref<string>("");
|
||||
const commandYear = ref<number>(new Date().getFullYear());
|
||||
const commandNo = ref<string>(""); //คำสั่งเลขที่
|
||||
const commandYear = ref<number>(new Date().getFullYear()); //ปี
|
||||
|
||||
const rows = ref<DataListCommand[]>([]); // รายการคำสั่ง
|
||||
const selected = ref<any[]>([]); // id คำสั่งที่เลือก
|
||||
const selected = ref<DataOrder[]>([]); // id คำสั่งที่เลือก
|
||||
const filter = ref<string>(""); // คำค้นหา
|
||||
|
||||
const total = ref<number>(0);
|
||||
const totalList = ref<number>(1);
|
||||
const pagination = ref({
|
||||
sortBy: "createdAt",
|
||||
descending: true,
|
||||
page: 1,
|
||||
rowsPerPage: 10,
|
||||
});
|
||||
|
||||
const total = ref<number>(0); //จำนวนรายการ
|
||||
const totalList = ref<number>(1); //จำนวนหน้า
|
||||
const visibleColumns = ref<string[]>([
|
||||
"commandNo",
|
||||
"issue",
|
||||
|
|
@ -125,9 +115,41 @@ const columns = ref<QTableProps["columns"]>([
|
|||
style: "font-size: 14px",
|
||||
},
|
||||
]);
|
||||
const pagination = ref({
|
||||
sortBy: "createdAt",
|
||||
descending: true,
|
||||
page: 1,
|
||||
rowsPerPage: 10,
|
||||
});
|
||||
|
||||
const selectCreate = ref<string | null>("NEW"); //ประเภทการออกคำสั่ง สร้างใหม่/คำสั่งแบบร่าง
|
||||
|
||||
/** ฟังก์ชันเรียกข้อมูลรายการคำสั่ง*/
|
||||
async function getListCommandDraf() {
|
||||
showLoader();
|
||||
await http
|
||||
.get(
|
||||
config.API.commandList +
|
||||
`?page=${pagination.value.page}&pageSize=${pagination.value.rowsPerPage}&year=${commandYear.value}&keyword=${filter.value}&status=DRAFT&commandTypeId=${commandType.value}`
|
||||
)
|
||||
.then(async (res) => {
|
||||
totalList.value = Math.ceil(
|
||||
res.data.result.total / pagination.value.rowsPerPage
|
||||
);
|
||||
total.value = res.data.result.total;
|
||||
rows.value = res.data.result.data;
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* ฟังก์ชันสร้างคำสั่งใหม่
|
||||
* @param isRedirect บันทึกและไปยังหน้าคำสั่ง เป็น true บันทึกและเลือกรายชื่อต่อ เป็น false
|
||||
*/
|
||||
function createCommand(isRedirect: boolean) {
|
||||
dialogConfirm($q, async () => {
|
||||
|
|
@ -153,7 +175,6 @@ function createCommand(isRedirect: boolean) {
|
|||
if (isRedirect) {
|
||||
router.push(`/command/edit/${id}`);
|
||||
} else {
|
||||
// modal.value = false;
|
||||
clearValue();
|
||||
}
|
||||
})
|
||||
|
|
@ -168,6 +189,7 @@ function createCommand(isRedirect: boolean) {
|
|||
|
||||
/**
|
||||
* ฟังก์ชันเพิ่มคนเข้าไปในคำสั่งที่เป็นแบบร่าง
|
||||
* @param isRedirect บันทึกและไปยังหน้าคำสั่ง เป็น true บันทึกและเลือกรายชื่อต่อ เป็น false
|
||||
*/
|
||||
function addPersonalToCommand(isRedirect: boolean) {
|
||||
dialogConfirm($q, async () => {
|
||||
|
|
@ -204,6 +226,10 @@ function addPersonalToCommand(isRedirect: boolean) {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* ฟังก์ชันบันทึกข้อมูล
|
||||
* @param isRedirect บันทึกและไปยังหน้าคำสั่ง เป็น true บันทึกและเลือกรายชื่อต่อ เป็น false
|
||||
*/
|
||||
function onSubmit(isRedirect: boolean) {
|
||||
if (selectCreate.value === "NEW") {
|
||||
createCommand(isRedirect);
|
||||
|
|
@ -212,61 +238,41 @@ function onSubmit(isRedirect: boolean) {
|
|||
}
|
||||
}
|
||||
|
||||
/** ปิด popup */
|
||||
/** ฟังก์ชันปิด popup */
|
||||
function closeModal() {
|
||||
modal.value = false;
|
||||
clearValue();
|
||||
}
|
||||
|
||||
/** ฟังก์ชันกำหน้ค่าเป็น Defult*/
|
||||
function clearValue() {
|
||||
commandNo.value = "";
|
||||
commandYear.value = new Date().getFullYear();
|
||||
|
||||
selectCreate.value = "NEW";
|
||||
selected.value = [];
|
||||
filter.value = "";
|
||||
}
|
||||
|
||||
const selectCreate = ref<string | null>("NEW");
|
||||
|
||||
async function getListCommandDraf() {
|
||||
showLoader();
|
||||
await http
|
||||
.get(
|
||||
config.API.commandList +
|
||||
`?page=${pagination.value.page}&pageSize=${pagination.value.rowsPerPage}&year=${commandYear.value}&keyword=${filter.value}&status=DRAFT&commandTypeId=${commandType.value}`
|
||||
)
|
||||
.then(async (res) => {
|
||||
totalList.value = Math.ceil(
|
||||
res.data.result.total / pagination.value.rowsPerPage
|
||||
);
|
||||
total.value = res.data.result.total;
|
||||
rows.value = res.data.result.data;
|
||||
console.log("🚀 ~ .then ~ rows.value:", rows.value);
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
/** ดึงข้อมูลคำสั่ง */
|
||||
/** ฟังก์ชันดึงข้อมูลคำสั่ง */
|
||||
async function fetchCommandType() {
|
||||
const data = await storeCommand.getCommandTypes(); // ยิงไป get ที่ store
|
||||
// filter เฉพาะ code ของคำสั่งที่เลือก
|
||||
commandOp.value = await data.filter(
|
||||
(v: any) => v.code == props.commandTypeCode
|
||||
(v: ListCommand) => v.code == props.commandTypeCode
|
||||
);
|
||||
commandType.value = commandOp.value[0].id;
|
||||
}
|
||||
|
||||
function updatePagination(newPagination: any) {
|
||||
/**
|
||||
* ฟังก์ชันอัปเดทจำนวนแถวต่อหน้า
|
||||
* @param newPagination จำนวนแถวที่ต้องการ
|
||||
*/
|
||||
function updatePagination(newPagination: Pagination) {
|
||||
pagination.value.page = 1;
|
||||
pagination.value.rowsPerPage = newPagination.rowsPerPage;
|
||||
}
|
||||
|
||||
/** ดูการเปลี่ยนแปลงของจำนวนแถวต่อหน้า*/
|
||||
watch(
|
||||
() => pagination.value.rowsPerPage,
|
||||
async () => {
|
||||
|
|
@ -274,12 +280,14 @@ watch(
|
|||
}
|
||||
);
|
||||
|
||||
/** ดูการเปลี่ยนแปลงของ modal*/
|
||||
watch(modal, () => {
|
||||
if (modal.value && props.persons?.length !== 0) {
|
||||
fetchCommandType();
|
||||
}
|
||||
});
|
||||
|
||||
/** ดูการเปลี่ยนแปลงของประเภทการออกคำสั่ง*/
|
||||
watch(
|
||||
() => selectCreate.value,
|
||||
async () => {
|
||||
|
|
|
|||
|
|
@ -37,32 +37,53 @@ const commandYear = ref<number>(new Date().getFullYear());
|
|||
const commandAffectDate = ref<Date | null>(null); //วันที่ลงนาม
|
||||
const commandExcecuteDate = ref<Date | null>(null); //วันที่คำสั่งมีผล
|
||||
|
||||
/**
|
||||
* ฟังก์ชันสร้างคำสั่งใหม่
|
||||
*/
|
||||
/** ฟังก์ชันบันทึกและไปยังหน้าคำสั่ง*/
|
||||
function onSubmit() {
|
||||
dialogConfirm($q, () => {});
|
||||
dialogConfirm($q, async () => {
|
||||
showLoader();
|
||||
const body = {
|
||||
commandYear: commandYear.value,
|
||||
commandNo: commandNo.value,
|
||||
commandTypeId: commandType.value,
|
||||
commandAffectDate: commandAffectDate.value,
|
||||
commandExcecuteDate: commandExcecuteDate.value,
|
||||
persons: [],
|
||||
};
|
||||
|
||||
await http
|
||||
.post(config.API.command + `/person`, body)
|
||||
.then(async (res) => {
|
||||
const id = await res.data.result;
|
||||
router.push(`/command/edit/${id}`);
|
||||
modal.value = false;
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/** ปิด popup */
|
||||
/**
|
||||
* ฟังก์ชันปิด popup สร้างคำสั่ง
|
||||
* และกำหนดตัวแปรให้เป็นค่า Defult
|
||||
*/
|
||||
function closeModal() {
|
||||
modal.value = false;
|
||||
clearValue();
|
||||
}
|
||||
|
||||
function clearValue() {
|
||||
commandNo.value = "";
|
||||
commandYear.value = new Date().getFullYear();
|
||||
commandAffectDate.value = null;
|
||||
commandExcecuteDate.value = null;
|
||||
}
|
||||
|
||||
/** ดึงข้อมูลคำสั่ง */
|
||||
/** ฟังก์ชันดึงข้อมูลคำสั่ง */
|
||||
async function fetchCommandType() {
|
||||
const data = await storeCommand.getCommandTypes(); // ยิงไป get ที่ store
|
||||
// filter เฉพาะ code ของคำสั่งที่เลือก
|
||||
commandOp.value = await data.filter(
|
||||
(v: any) => v.code == props.commandTypeCode
|
||||
(v: ListCommand) => v.code == props.commandTypeCode
|
||||
);
|
||||
commandType.value = commandOp.value[0].id;
|
||||
}
|
||||
|
|
@ -250,16 +271,6 @@ watch(modal, () => {
|
|||
<q-separator />
|
||||
|
||||
<q-card-actions align="right">
|
||||
<!-- <q-btn
|
||||
label="บันทึกและเลือกรายชื่อต่อ"
|
||||
@click="() => onSubmit(false)"
|
||||
:disable="
|
||||
selectCreate === 'NEW' ? commandType == '' : selected.length == 0
|
||||
"
|
||||
color="blue"
|
||||
>
|
||||
<q-tooltip>บันทึกและเลือกรายชื่อต่อ</q-tooltip>
|
||||
</q-btn> -->
|
||||
<q-btn
|
||||
label="บันทึกและไปยังหน้าคำสั่ง"
|
||||
:disable="commandType == ''"
|
||||
|
|
|
|||
|
|
@ -57,6 +57,18 @@ interface ListCommand {
|
|||
commandSysId: string;
|
||||
}
|
||||
|
||||
interface DataOrder {
|
||||
assignFullName: string;
|
||||
commandAffectDate: string | Date;
|
||||
commandExcecuteDate: string | Date;
|
||||
commandNo: string;
|
||||
commandYear: number;
|
||||
createdFullName: string;
|
||||
id: string;
|
||||
issue: string;
|
||||
status: string;
|
||||
}
|
||||
|
||||
export type {
|
||||
Pagination,
|
||||
DataOption,
|
||||
|
|
@ -64,4 +76,5 @@ export type {
|
|||
DataPerson,
|
||||
DateSelectPerson,
|
||||
ListCommand,
|
||||
DataOrder,
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue