โครงการ => API ลักษณะโครงการ
This commit is contained in:
parent
c5b68d0691
commit
b76f5854cf
5 changed files with 107 additions and 74 deletions
|
|
@ -5,6 +5,8 @@ import http from "@/plugins/http";
|
|||
import config from "@/app.config";
|
||||
|
||||
import type { ItemsMenu } from "@/modules/15_development/interface/index/Main";
|
||||
import type { DataStrategic } from "@/modules/15_development/interface/response/Strategic";
|
||||
|
||||
import DialogHeader from "@/components/DialogHeader.vue";
|
||||
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
|
@ -40,11 +42,9 @@ const ListMenu = ref<ItemsMenu[]>([
|
|||
},
|
||||
]);
|
||||
|
||||
const nodes = ref<any>([]);
|
||||
const nodes = ref<any[]>([]);
|
||||
const filter = ref<string>("");
|
||||
const notFound = ref<string>("ไม่พบข้อมูลที่ค้นหา");
|
||||
const noData = ref<string>("ไม่มีข้อมูล");
|
||||
const expanded = ref<Array<any>>([]);
|
||||
const expanded = ref<Array<string>>([]);
|
||||
const nodeId = ref<string>("");
|
||||
|
||||
function fetchDataTree() {
|
||||
|
|
@ -52,7 +52,7 @@ function fetchDataTree() {
|
|||
http
|
||||
.get(config.API.devStrategy)
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
const data: DataStrategic[] = res.data.result;
|
||||
nodes.value = data;
|
||||
})
|
||||
.catch((err) => {
|
||||
|
|
@ -63,11 +63,7 @@ function fetchDataTree() {
|
|||
});
|
||||
}
|
||||
|
||||
function updateSelected(data: any) {
|
||||
nodeId.value = data.orgTreeName;
|
||||
}
|
||||
|
||||
function onClickAction(type: string, data: any = null) {
|
||||
function onClickAction(type: string, data: DataStrategic | null = null) {
|
||||
switch (type) {
|
||||
case "ADD":
|
||||
onClickOpenDialog(false, data);
|
||||
|
|
@ -76,7 +72,7 @@ function onClickAction(type: string, data: any = null) {
|
|||
onClickOpenDialog(true, data);
|
||||
break;
|
||||
case "DEL":
|
||||
onDelete(data);
|
||||
data && onDelete(data);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
@ -88,24 +84,27 @@ const isStatusEdit = ref<boolean>(false);
|
|||
const strategicName = ref<string>("");
|
||||
const levelnode = ref<number>(0);
|
||||
const titleDialog = ref<string>("");
|
||||
function onClickOpenDialog(status: boolean = false, data: any = null) {
|
||||
function onClickOpenDialog(
|
||||
status: boolean = false,
|
||||
data: DataStrategic | null = null
|
||||
) {
|
||||
isStatusEdit.value = status;
|
||||
if (status) {
|
||||
console.log(data);
|
||||
|
||||
nodeId.value = data.id;
|
||||
strategicName.value = data.name;
|
||||
levelnode.value = data.level;
|
||||
titleDialog.value =
|
||||
data.level === 1
|
||||
? "ยุทธศาสตร์"
|
||||
: data.level === 2
|
||||
? "ยุทธศาสตร์ที่ 1"
|
||||
: data.level === 3
|
||||
? "ยุทธศาสตร์ย่อย"
|
||||
: data.level === 4
|
||||
? "กลยุทธ์ที่/เป้าประสงค์ที่"
|
||||
: "";
|
||||
if (data) {
|
||||
nodeId.value = data.id;
|
||||
strategicName.value = data.name;
|
||||
levelnode.value = data.level;
|
||||
titleDialog.value =
|
||||
data.level === 1
|
||||
? "ยุทธศาสตร์"
|
||||
: data.level === 2
|
||||
? "ยุทธศาสตร์ที่ 1"
|
||||
: data.level === 3
|
||||
? "ยุทธศาสตร์ย่อย"
|
||||
: data.level === 4
|
||||
? "กลยุทธ์ที่/เป้าประสงค์ที่"
|
||||
: "";
|
||||
}
|
||||
} else {
|
||||
if (data) {
|
||||
titleDialog.value =
|
||||
|
|
@ -155,8 +154,7 @@ function onSubmit() {
|
|||
});
|
||||
}
|
||||
|
||||
function onDelete(data: any) {
|
||||
console.log(data);
|
||||
function onDelete(data: DataStrategic) {
|
||||
dialogRemove($q, () => {
|
||||
showLoader();
|
||||
const formData = {
|
||||
|
|
@ -218,8 +216,8 @@ onMounted(() => {
|
|||
node-key="id"
|
||||
label-key="id"
|
||||
:filter="filter"
|
||||
:no-results-label="notFound"
|
||||
:no-nodes-label="noData"
|
||||
no-results-label="ไม่พบข้อมูลที่ค้นหา"
|
||||
no-nodes-label="ไม่มีข้อมูล"
|
||||
v-model:expanded="expanded"
|
||||
>
|
||||
<template v-slot:default-header="prop">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue