fix CurrentPage ==> รายการตัวชี้วัดตามแผนฯ
This commit is contained in:
parent
5d97f44ee3
commit
6db8040e90
3 changed files with 60 additions and 38 deletions
|
|
@ -216,7 +216,7 @@ function onSubmit() {
|
|||
const res = await http[method](url, body);
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
editStatus.value
|
||||
? fetchDataById(id.value)
|
||||
? await fetchDataById(id.value)
|
||||
: router.push(`/masterdata/indicator-plan/${res.data.result}`);
|
||||
} catch (e) {
|
||||
messageError($q, e);
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ interface IndicatorType {
|
|||
}
|
||||
|
||||
interface OrgTreeNode {
|
||||
orgTreeDnaId: string;
|
||||
orgTreeId: string;
|
||||
orgRootId: string;
|
||||
orgLevel: number;
|
||||
|
|
@ -107,7 +108,7 @@ interface CompetencySumary {
|
|||
value: string;
|
||||
label: string;
|
||||
color: string;
|
||||
total?:string
|
||||
total?: string;
|
||||
}
|
||||
|
||||
interface Position {
|
||||
|
|
@ -130,10 +131,18 @@ interface ListLinkGroup {
|
|||
capacitys: Capacity[];
|
||||
}
|
||||
|
||||
interface SizeType{
|
||||
width:number
|
||||
height:number
|
||||
interface SizeType {
|
||||
width: number;
|
||||
height: number;
|
||||
}
|
||||
|
||||
interface FormDataNodeData {
|
||||
round: string;
|
||||
nodeId: string | null;
|
||||
node: number | null;
|
||||
keyword: string;
|
||||
}
|
||||
|
||||
export type {
|
||||
Pagination,
|
||||
DataOption,
|
||||
|
|
@ -149,5 +158,6 @@ export type {
|
|||
ListLinkGroup,
|
||||
Position,
|
||||
CompetencySumary,
|
||||
SizeType
|
||||
SizeType,
|
||||
FormDataNodeData
|
||||
};
|
||||
|
|
|
|||
|
|
@ -8,12 +8,15 @@ import config from "@/app.config";
|
|||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { checkPermission } from "@/utils/permissions";
|
||||
import { useStructureTree } from "@/stores/structureTree";
|
||||
import { updateCurrentPage } from "@/utils/function";
|
||||
|
||||
import type {
|
||||
DataOption,
|
||||
IndicatorType,
|
||||
OrgTreeNode,
|
||||
DataHistory,
|
||||
FormDataNodeData,
|
||||
NewPagination,
|
||||
} from "@/modules/01_masterdata/interface/index/Main";
|
||||
|
||||
import DialogHistory from "@/modules/01_masterdata/components/Indicators/DialogHistory.vue";
|
||||
|
|
@ -32,12 +35,6 @@ const isAll = ref<boolean>(false);
|
|||
|
||||
const total = ref<number>(0);
|
||||
const totalList = ref<number>(1);
|
||||
const pagination = ref({
|
||||
sortBy: "createdAt",
|
||||
descending: true,
|
||||
page: 1,
|
||||
rowsPerPage: 10,
|
||||
});
|
||||
|
||||
/** หัวตาราง */
|
||||
const rows = ref<IndicatorType[]>([]);
|
||||
|
|
@ -61,10 +58,17 @@ const columns = ref<QTableProps["columns"]>([
|
|||
style: "font-size: 14px",
|
||||
},
|
||||
]);
|
||||
const node = ref<OrgTreeNode[]>([]);
|
||||
const expanded = ref<any>([]);
|
||||
const filterMain = ref<string>("");
|
||||
const visibleColumns = ref<string[]>(["including", "includingName"]);
|
||||
const pagination = ref({
|
||||
sortBy: "createdAt",
|
||||
descending: true,
|
||||
page: 1,
|
||||
rowsPerPage: 10,
|
||||
});
|
||||
|
||||
const node = ref<OrgTreeNode[]>([]);
|
||||
const expanded = ref<string[]>([]);
|
||||
const filterMain = ref<string>("");
|
||||
|
||||
const roundOp = ref<DataOption[]>([
|
||||
{ id: "", name: "ทั้งหมด" },
|
||||
|
|
@ -73,18 +77,18 @@ const roundOp = ref<DataOption[]>([
|
|||
]);
|
||||
|
||||
const year = ref<number | null>(new Date().getFullYear());
|
||||
const nodeData = reactive<any>({
|
||||
const nodeData = reactive<FormDataNodeData>({
|
||||
round: "",
|
||||
nodeId: null,
|
||||
node: null,
|
||||
keyword: "",
|
||||
});
|
||||
|
||||
/** ดึงข้อมูล */
|
||||
function fetchList() {
|
||||
/** ฟังชั่นดึงข้อมูลรายการตัวชี้วัดตามแผน */
|
||||
async function fetchList() {
|
||||
if (nodeData.nodeId) {
|
||||
showLoader();
|
||||
http
|
||||
await http
|
||||
.post(config.API.kpiPlan + `/search-edit`, {
|
||||
isAll: isAll.value,
|
||||
keyword: nodeData.keyword.trim(),
|
||||
|
|
@ -123,6 +127,10 @@ function onClickAddOrView(status: boolean = false, id: string = "") {
|
|||
: router.push("/masterdata/indicator-plan/add");
|
||||
}
|
||||
|
||||
/**
|
||||
* ฟังชั่นดูรายละเอียดรายการตัวชี้วัด
|
||||
* @param id id รายการตัวชี้วัดที่ต้องการดู
|
||||
*/
|
||||
function onClickView(id: string = "") {
|
||||
router.push(`/masterdata/indicator-plan/view/${id}`);
|
||||
}
|
||||
|
|
@ -133,24 +141,33 @@ async function fetchTree() {
|
|||
}
|
||||
|
||||
/** เรียกข้อมูลตาม row โครงสร้าง*/
|
||||
function updateSelectedTreeMain(data: any) {
|
||||
function updateSelectedTreeMain(data: OrgTreeNode) {
|
||||
if (nodeData.node === data.orgLevel && nodeData.nodeId === data.orgTreeId) {
|
||||
nodeData.node = null;
|
||||
nodeData.nodeId = null;
|
||||
} else {
|
||||
nodeData.node = data.orgLevel;
|
||||
nodeData.nodeId = data.orgTreeDnaId;
|
||||
nodeData.node = data.orgLevel ?? null;
|
||||
nodeData.nodeId = data.orgTreeDnaId ?? null;
|
||||
}
|
||||
getSearch();
|
||||
}
|
||||
|
||||
/** delete */
|
||||
/**
|
||||
* ฟังชั่นลบข้อมูล
|
||||
* @param idData id ของข้อมูลที่ต้องการลบ
|
||||
*/
|
||||
async function deleteData(idData: string) {
|
||||
dialogRemove($q, () =>
|
||||
http
|
||||
dialogRemove($q, async () => {
|
||||
showLoader();
|
||||
await http
|
||||
.delete(config.API.kpiPlanById(idData))
|
||||
.then(() => {
|
||||
fetchList();
|
||||
.then(async () => {
|
||||
pagination.value.page = await updateCurrentPage(
|
||||
pagination.value.page,
|
||||
totalList.value,
|
||||
rows.value.length
|
||||
);
|
||||
await fetchList();
|
||||
success($q, "ลบข้อมูลสำเร็จ");
|
||||
})
|
||||
.catch((err) => {
|
||||
|
|
@ -158,19 +175,13 @@ async function deleteData(idData: string) {
|
|||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
/** clear input filter */
|
||||
function clearFilter() {
|
||||
nodeData.keyword = "";
|
||||
getSearch();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* เปิด dialog history
|
||||
* @param id
|
||||
* ฟังชั่นเปิด dialog history
|
||||
* @param id id รายการตัวชี้วัดที่ต้องการดูประวัติ
|
||||
*/
|
||||
function onClickHistory(id: string) {
|
||||
showLoader();
|
||||
|
|
@ -189,7 +200,7 @@ function onClickHistory(id: string) {
|
|||
});
|
||||
}
|
||||
|
||||
function updatePagination(newPagination: any) {
|
||||
function updatePagination(newPagination: NewPagination) {
|
||||
pagination.value.page = 1;
|
||||
pagination.value.rowsPerPage = newPagination.rowsPerPage;
|
||||
}
|
||||
|
|
@ -230,6 +241,7 @@ onMounted(() => {
|
|||
<q-icon name="search" color="grey-5" />
|
||||
</template>
|
||||
</q-input>
|
||||
|
||||
<q-tree
|
||||
class="tree-container"
|
||||
dense
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue