clear code + comment
This commit is contained in:
parent
a9609d2d7f
commit
ac70090e22
19 changed files with 231 additions and 166 deletions
|
|
@ -22,6 +22,7 @@ const pagination = ref({
|
|||
page: 1,
|
||||
rowsPerPage: 10,
|
||||
});
|
||||
|
||||
const maxPage = ref<number>(1);
|
||||
const totalList = ref<number>(0); //จำนวนข้อมูลรายการ
|
||||
|
||||
|
|
@ -104,6 +105,7 @@ const columns = ref<QTableProps["columns"]>([
|
|||
},
|
||||
]);
|
||||
|
||||
/** ดึงข้อมูลหน่วยงาน เเละ เรียกใช้ฟังชั่น ดึงข้อมูล */
|
||||
function fetchListOrg() {
|
||||
showLoader();
|
||||
http
|
||||
|
|
@ -122,6 +124,7 @@ function fetchListOrg() {
|
|||
});
|
||||
}
|
||||
|
||||
/** download file */
|
||||
function onDownload() {
|
||||
showLoader();
|
||||
http
|
||||
|
|
@ -141,11 +144,13 @@ function onDownload() {
|
|||
});
|
||||
}
|
||||
|
||||
/** edit page */
|
||||
function onEdit(id: string) {
|
||||
store.statusEdit = true;
|
||||
router.push(`/development/employee-history/${id}`);
|
||||
}
|
||||
|
||||
/** ดึงข้อมูล */
|
||||
function getData() {
|
||||
showLoader();
|
||||
http
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ const formFilter = reactive({
|
|||
keyword: "",
|
||||
year: new Date().getFullYear(),
|
||||
});
|
||||
|
||||
const maxPage = ref<number>(1);
|
||||
const totalList = ref<number>(0); //จำนวนข้อมูลรายการ
|
||||
|
||||
|
|
@ -33,9 +34,8 @@ const router = useRouter();
|
|||
const store = useDevelopmentDataStore();
|
||||
const $q = useQuasar();
|
||||
const { showLoader, hideLoader, messageError } = useCounterMixin();
|
||||
|
||||
const rows = ref<any>([]);
|
||||
|
||||
const agencyOp = ref<[]>([]);
|
||||
const visibleColumns = ref<string[]>([
|
||||
"citizenId",
|
||||
"name",
|
||||
|
|
@ -113,8 +113,7 @@ const columns = ref<QTableProps["columns"]>([
|
|||
},
|
||||
]);
|
||||
|
||||
const agencyOp = ref<[]>([]);
|
||||
|
||||
/** ดึงข้อมูลหน่วยงาน */
|
||||
function fetchListOrg() {
|
||||
showLoader();
|
||||
http
|
||||
|
|
@ -134,6 +133,7 @@ function fetchListOrg() {
|
|||
});
|
||||
}
|
||||
|
||||
/** ดึงข้อมูลรายการ */
|
||||
function getData() {
|
||||
showLoader();
|
||||
http
|
||||
|
|
@ -162,6 +162,7 @@ function getData() {
|
|||
});
|
||||
}
|
||||
|
||||
/** download file */
|
||||
function onDownload() {
|
||||
showLoader();
|
||||
http
|
||||
|
|
@ -184,6 +185,7 @@ function onDownload() {
|
|||
});
|
||||
}
|
||||
|
||||
/** edit page */
|
||||
function onEdit(id: string) {
|
||||
store.statusEdit = true;
|
||||
router.push(`/development/history/${id}`);
|
||||
|
|
@ -206,6 +208,7 @@ watch(
|
|||
}
|
||||
);
|
||||
|
||||
/** ดึงข้อมูลเมื่ออยู่ในหน้า */
|
||||
onMounted(() => {
|
||||
fetchListOrg();
|
||||
});
|
||||
|
|
@ -276,10 +279,6 @@ onMounted(() => {
|
|||
@update:model-value="(formFilter.page = 1), getData()"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- <q-btn flat round dense icon="add" color="primary" @click="onAdd()">
|
||||
<q-tooltip>เพิ่ม</q-tooltip>
|
||||
</q-btn> -->
|
||||
</q-toolbar>
|
||||
<q-toolbar class="col-4 text-white q-pa-none q-gutter-x-sm">
|
||||
<q-space />
|
||||
|
|
|
|||
|
|
@ -87,6 +87,7 @@ const formProject = reactive<FormProject>({
|
|||
nodeId: null,
|
||||
orgRevisionId: null,
|
||||
});
|
||||
|
||||
/** formQuery*/
|
||||
const formQuery = reactive<FormQueryListProject>({
|
||||
year: new Date().getFullYear(),
|
||||
|
|
@ -98,6 +99,7 @@ const formQuery = reactive<FormQueryListProject>({
|
|||
node: null,
|
||||
nodeId: null,
|
||||
});
|
||||
|
||||
const totalList = ref<number>(0); //จำนวนข้อมูลรายการ
|
||||
const totalPage = ref<number>(1);
|
||||
|
||||
|
|
|
|||
|
|
@ -119,6 +119,7 @@ const formQuery = reactive({
|
|||
const totalList = ref<number>(1); //จำนวนข้อมูลรายการ
|
||||
const maxPage = ref<number>(1);
|
||||
|
||||
/** ดึงข้อมูล */
|
||||
function fetchList() {
|
||||
showLoader();
|
||||
http
|
||||
|
|
@ -141,11 +142,13 @@ function fetchList() {
|
|||
});
|
||||
}
|
||||
|
||||
/** ฟังชั่นดึงข้อมูล รายการ ใหม่ */
|
||||
function fetchNewList() {
|
||||
formQuery.page = 1;
|
||||
fetchList();
|
||||
}
|
||||
|
||||
/** ย้ายไป หน้า เพิ่ม หรือ แก้ไข */
|
||||
function onClickAddOrView(status: boolean = false, id: string = "") {
|
||||
status
|
||||
? router.push(`/development/scholarship/${id}`)
|
||||
|
|
@ -161,13 +164,7 @@ function updatePagination(newPagination: NewPagination) {
|
|||
formQuery.pageSize = newPagination.rowsPerPage;
|
||||
}
|
||||
|
||||
watch(
|
||||
() => formQuery.pageSize,
|
||||
() => {
|
||||
fetchNewList();
|
||||
}
|
||||
);
|
||||
|
||||
/** download file */
|
||||
function onDownload() {
|
||||
showLoader();
|
||||
http
|
||||
|
|
@ -184,6 +181,15 @@ function onDownload() {
|
|||
});
|
||||
}
|
||||
|
||||
/** เช็ค เมื่อมีการเปลี่ยนค่าของ ข้อมูลในเเถว */
|
||||
watch(
|
||||
() => formQuery.pageSize,
|
||||
() => {
|
||||
fetchNewList();
|
||||
}
|
||||
);
|
||||
|
||||
/** ดึงข้อมูลเมื่ออยู่ในหน้า */
|
||||
onMounted(() => {
|
||||
fetchList();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -46,7 +46,13 @@ const nodes = ref<any[]>([]);
|
|||
const filter = ref<string>("");
|
||||
const expanded = ref<Array<string>>([]);
|
||||
const nodeId = ref<string>("");
|
||||
const modalDialog = ref<boolean>(false);
|
||||
const isStatusEdit = ref<boolean>(false);
|
||||
const strategicName = ref<string>("");
|
||||
const levelnode = ref<number>(0);
|
||||
const titleDialog = ref<string>("");
|
||||
|
||||
/** ดึงข้อมูล ในรูปแบบ tree */
|
||||
function fetchDataTree() {
|
||||
showLoader();
|
||||
http
|
||||
|
|
@ -63,6 +69,11 @@ function fetchDataTree() {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* เพิ่ม ลบ แก้ไข
|
||||
* @param type ประเภท node
|
||||
* @param data ข้อมูล
|
||||
*/
|
||||
function onClickAction(type: string, data: DataStrategic | null = null) {
|
||||
switch (type) {
|
||||
case "ADD":
|
||||
|
|
@ -79,11 +90,11 @@ function onClickAction(type: string, data: DataStrategic | null = null) {
|
|||
}
|
||||
}
|
||||
|
||||
const modalDialog = ref<boolean>(false);
|
||||
const isStatusEdit = ref<boolean>(false);
|
||||
const strategicName = ref<string>("");
|
||||
const levelnode = ref<number>(0);
|
||||
const titleDialog = ref<string>("");
|
||||
/**
|
||||
* เปิด dialog
|
||||
* @param status true/false
|
||||
* @param data ข้อมูลยุทธศาสตร์
|
||||
*/
|
||||
function onClickOpenDialog(
|
||||
status: boolean = false,
|
||||
data: DataStrategic | null = null
|
||||
|
|
@ -125,11 +136,13 @@ function onClickOpenDialog(
|
|||
modalDialog.value = true;
|
||||
}
|
||||
|
||||
/** ปิด dialog */
|
||||
function closeDialog() {
|
||||
modalDialog.value = false;
|
||||
strategicName.value = "";
|
||||
}
|
||||
|
||||
/** บันทึกข้อมูล */
|
||||
function onSubmit() {
|
||||
dialogConfirm($q, async () => {
|
||||
const formData = {
|
||||
|
|
@ -138,9 +151,6 @@ function onSubmit() {
|
|||
name: strategicName.value,
|
||||
};
|
||||
try {
|
||||
// const url = isStatusEdit.value
|
||||
// ? config.API.devStrategy;
|
||||
// : config.API.devStrategy;
|
||||
const method = isStatusEdit.value ? "patch" : "post";
|
||||
await http[method](config.API.devStrategy, formData);
|
||||
fetchDataTree();
|
||||
|
|
@ -154,6 +164,7 @@ function onSubmit() {
|
|||
});
|
||||
}
|
||||
|
||||
/** ลบข้อมูลตาม id */
|
||||
function onDelete(data: DataStrategic) {
|
||||
dialogRemove($q, () => {
|
||||
showLoader();
|
||||
|
|
@ -176,6 +187,7 @@ function onDelete(data: DataStrategic) {
|
|||
});
|
||||
}
|
||||
|
||||
/** ดึงข้อมูลเมื่ออยู่ในหน้า */
|
||||
onMounted(() => {
|
||||
fetchDataTree();
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue