fix load ===> ยุทธศาสตร์
This commit is contained in:
parent
c94fbd22e0
commit
5d97f44ee3
1 changed files with 86 additions and 83 deletions
|
|
@ -36,9 +36,9 @@ const levelnode = ref<number>(0);
|
|||
const titleDialog = ref<string>("");
|
||||
|
||||
/** ดึงข้อมูล ในรูปแบบ tree */
|
||||
function fetchDataTree() {
|
||||
async function fetchDataTree() {
|
||||
showLoader();
|
||||
http
|
||||
await http
|
||||
.get(config.API.devStrategy + `/edit/strategic`)
|
||||
.then((res) => {
|
||||
const data: DataStrategic[] = res.data.result;
|
||||
|
|
@ -129,6 +129,7 @@ function closeDialog() {
|
|||
/** บันทึกข้อมูล */
|
||||
function onSubmit() {
|
||||
dialogConfirm($q, async () => {
|
||||
showLoader();
|
||||
const formData = {
|
||||
idnode: levelnode.value === 0 ? "0" : nodeId.value,
|
||||
levelnode: levelnode.value,
|
||||
|
|
@ -137,18 +138,21 @@ function onSubmit() {
|
|||
try {
|
||||
const method = isStatusEdit.value ? "patch" : "post";
|
||||
await http[method](config.API.devStrategy, formData);
|
||||
fetchDataTree();
|
||||
await fetchDataTree();
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
closeDialog();
|
||||
} catch (err) {
|
||||
messageError($q, err);
|
||||
} finally {
|
||||
hideLoader();
|
||||
closeDialog();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** ลบข้อมูลตาม id */
|
||||
/**
|
||||
* ฟังก์ชันลบข้อมูลยุทธศาสตร์
|
||||
* @param data ข้อมูลยุทธศาสตร์ที่ต้องการลบ
|
||||
*/
|
||||
function onDelete(data: DataStrategic) {
|
||||
dialogRemove($q, () => {
|
||||
showLoader();
|
||||
|
|
@ -158,8 +162,8 @@ function onDelete(data: DataStrategic) {
|
|||
};
|
||||
http
|
||||
.delete(config.API.devStrategy, { data: formData })
|
||||
.then(() => {
|
||||
fetchDataTree();
|
||||
.then(async () => {
|
||||
await fetchDataTree();
|
||||
success($q, "ลบข้อมูลสำเร็จ");
|
||||
})
|
||||
.catch((err) => {
|
||||
|
|
@ -252,84 +256,83 @@ onMounted(() => {
|
|||
icon="mdi-dots-vertical"
|
||||
round
|
||||
>
|
||||
<q-menu
|
||||
>
|
||||
<q-menu>
|
||||
<q-list dense style="min-width: 100px">
|
||||
<q-item
|
||||
v-if="
|
||||
prop.node.level !== 4 &&
|
||||
checkPermission($route)?.attrIsCreate
|
||||
"
|
||||
clickable
|
||||
v-close-popup
|
||||
@click.stop="onClickAction('ADD', prop.node)"
|
||||
>
|
||||
<q-item-section avatar style="min-width: 20px">
|
||||
<q-icon size="17px" :color="'primary'" :name="'add'" />
|
||||
</q-item-section>
|
||||
<q-item
|
||||
v-if="
|
||||
prop.node.level !== 4 &&
|
||||
checkPermission($route)?.attrIsCreate
|
||||
"
|
||||
clickable
|
||||
v-close-popup
|
||||
@click.stop="onClickAction('ADD', prop.node)"
|
||||
>
|
||||
<q-item-section avatar style="min-width: 20px">
|
||||
<q-icon size="17px" :color="'primary'" :name="'add'" />
|
||||
</q-item-section>
|
||||
|
||||
<q-item-section v-if="prop.node.level === 1">
|
||||
{{ `เพิ่มยุทธศาสตร์ 1` }}
|
||||
</q-item-section>
|
||||
<q-item-section v-if="prop.node.level === 2">
|
||||
{{ `เพิ่มยุทธศาสตร์ย่อย` }}
|
||||
</q-item-section>
|
||||
<q-item-section v-if="prop.node.level === 3">
|
||||
{{ `เพิ่มกลยุทธ์ที่/เป้าประสงค์` }}
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
<q-item
|
||||
v-if="
|
||||
checkPermission($route)?.attrIsUpdate &&
|
||||
checkPermission($route)?.attrIsGet
|
||||
"
|
||||
clickable
|
||||
v-close-popup
|
||||
@click.stop="onClickAction('EDIT', prop.node)"
|
||||
>
|
||||
<q-item-section avatar style="min-width: 20px">
|
||||
<q-icon size="17px" :color="'edit'" :name="'edit'" />
|
||||
</q-item-section>
|
||||
<q-item-section v-if="prop.node.level === 1">
|
||||
{{ `แก้ไขยุทธศาสตร์/แผน` }}
|
||||
</q-item-section>
|
||||
<q-item-section v-if="prop.node.level === 2">
|
||||
{{ `แก้ไขยุทธศาสตร์ 1` }}
|
||||
</q-item-section>
|
||||
<q-item-section v-if="prop.node.level === 3">
|
||||
{{ `แก้ไขยุทธศาสตร์ย่อย` }}
|
||||
</q-item-section>
|
||||
<q-item-section v-if="prop.node.level === 4">
|
||||
{{ `แก้ไขกลยุทธ์ที่/เป้าประสงค์` }}
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
<q-item
|
||||
v-if="prop.node.children.length !== 0"
|
||||
clickable
|
||||
v-close-popup
|
||||
@click="
|
||||
(modalSort = true),
|
||||
(idSort = prop.node.id),
|
||||
(dataSort = prop.node.children)
|
||||
"
|
||||
>
|
||||
<q-item-section avatar style="min-width: 20px">
|
||||
<q-icon size="17px" :color="'blue'" :name="'mdi-sort'" />
|
||||
</q-item-section>
|
||||
<q-item-section> จัดลำดับข้อมูล </q-item-section>
|
||||
</q-item>
|
||||
<q-item
|
||||
v-if="checkPermission($route)?.attrIsDelete"
|
||||
clickable
|
||||
v-close-popup
|
||||
@click.stop="onClickAction('DEL', prop.node)"
|
||||
>
|
||||
<q-item-section avatar style="min-width: 20px">
|
||||
<q-icon size="17px" :color="'red'" :name="'delete'" />
|
||||
</q-item-section>
|
||||
<q-item-section> ลบข้อมูล </q-item-section>
|
||||
</q-item>
|
||||
</q-list>
|
||||
<q-item-section v-if="prop.node.level === 1">
|
||||
{{ `เพิ่มยุทธศาสตร์ 1` }}
|
||||
</q-item-section>
|
||||
<q-item-section v-if="prop.node.level === 2">
|
||||
{{ `เพิ่มยุทธศาสตร์ย่อย` }}
|
||||
</q-item-section>
|
||||
<q-item-section v-if="prop.node.level === 3">
|
||||
{{ `เพิ่มกลยุทธ์ที่/เป้าประสงค์` }}
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
<q-item
|
||||
v-if="
|
||||
checkPermission($route)?.attrIsUpdate &&
|
||||
checkPermission($route)?.attrIsGet
|
||||
"
|
||||
clickable
|
||||
v-close-popup
|
||||
@click.stop="onClickAction('EDIT', prop.node)"
|
||||
>
|
||||
<q-item-section avatar style="min-width: 20px">
|
||||
<q-icon size="17px" :color="'edit'" :name="'edit'" />
|
||||
</q-item-section>
|
||||
<q-item-section v-if="prop.node.level === 1">
|
||||
{{ `แก้ไขยุทธศาสตร์/แผน` }}
|
||||
</q-item-section>
|
||||
<q-item-section v-if="prop.node.level === 2">
|
||||
{{ `แก้ไขยุทธศาสตร์ 1` }}
|
||||
</q-item-section>
|
||||
<q-item-section v-if="prop.node.level === 3">
|
||||
{{ `แก้ไขยุทธศาสตร์ย่อย` }}
|
||||
</q-item-section>
|
||||
<q-item-section v-if="prop.node.level === 4">
|
||||
{{ `แก้ไขกลยุทธ์ที่/เป้าประสงค์` }}
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
<q-item
|
||||
v-if="prop.node.children.length !== 0"
|
||||
clickable
|
||||
v-close-popup
|
||||
@click="
|
||||
(modalSort = true),
|
||||
(idSort = prop.node.id),
|
||||
(dataSort = prop.node.children)
|
||||
"
|
||||
>
|
||||
<q-item-section avatar style="min-width: 20px">
|
||||
<q-icon size="17px" :color="'blue'" :name="'mdi-sort'" />
|
||||
</q-item-section>
|
||||
<q-item-section> จัดลำดับข้อมูล </q-item-section>
|
||||
</q-item>
|
||||
<q-item
|
||||
v-if="checkPermission($route)?.attrIsDelete"
|
||||
clickable
|
||||
v-close-popup
|
||||
@click.stop="onClickAction('DEL', prop.node)"
|
||||
>
|
||||
<q-item-section avatar style="min-width: 20px">
|
||||
<q-icon size="17px" :color="'red'" :name="'delete'" />
|
||||
</q-item-section>
|
||||
<q-item-section> ลบข้อมูล </q-item-section>
|
||||
</q-item>
|
||||
</q-list>
|
||||
</q-menu>
|
||||
</q-btn>
|
||||
</q-item>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue