no message
This commit is contained in:
parent
69771682eb
commit
9355b54882
2 changed files with 92 additions and 33 deletions
|
|
@ -23,29 +23,16 @@ const { dialogConfirm, showLoader, success, hideLoader, messageError } =
|
||||||
useCounterMixin();
|
useCounterMixin();
|
||||||
|
|
||||||
const modal = defineModel<boolean>("sortAgency", { required: true });
|
const modal = defineModel<boolean>("sortAgency", { required: true });
|
||||||
|
const modalSort = defineModel<Array<any>>("data", { required: true });
|
||||||
|
const modalType = defineModel<number>("type", { required: true });
|
||||||
const rows = ref<any>([]);
|
const rows = ref<any>([]);
|
||||||
const columns = ref<QTableProps["columns"]>([
|
const columns = ref<QTableProps["columns"]>([
|
||||||
{
|
{
|
||||||
name: "id",
|
name: "name",
|
||||||
required: true,
|
required: true,
|
||||||
label: "ชื่อเครื่องราชฯ",
|
label: "ชื่อ",
|
||||||
align: "left",
|
align: "left",
|
||||||
field: "id",
|
field: "name",
|
||||||
sortable: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "shortName",
|
|
||||||
align: "center",
|
|
||||||
label: "ชื่อย่อ",
|
|
||||||
field: "shortName",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "insigniaType",
|
|
||||||
align: "left",
|
|
||||||
label: "ลำดับชั้นเครื่องราชฯ",
|
|
||||||
field: "insigniaType",
|
|
||||||
headerStyle: "font-size: 14px",
|
|
||||||
style: "font-size: 14px",
|
|
||||||
sortable: true,
|
sortable: true,
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
@ -61,7 +48,7 @@ function onDropRow(from: any, to: any) {
|
||||||
function save() {
|
function save() {
|
||||||
dialogConfirm($q, () => {
|
dialogConfirm($q, () => {
|
||||||
const data = rows.value;
|
const data = rows.value;
|
||||||
const dataId = data.map((item: any) => item.id);
|
const dataId = data.map((item: any) => item.orgTreeId);
|
||||||
console.log(dataId);
|
console.log(dataId);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -69,20 +56,32 @@ watch(
|
||||||
() => modal.value,
|
() => modal.value,
|
||||||
() => {
|
() => {
|
||||||
if (modal.value == true) {
|
if (modal.value == true) {
|
||||||
const dataList = [
|
const dataStandant = modalSort.value;
|
||||||
{
|
if (modalType.value === 0) {
|
||||||
id: "x1",
|
const mappedData = dataStandant.map((item: any) => ({
|
||||||
shortName: "test1",
|
orgLevel: item.orgLevel,
|
||||||
insigniaType: "test1",
|
name: `${item.orgTreeName} (${item.orgTreeShortName})`,
|
||||||
},
|
orgRevisionId: item.orgRevisionId,
|
||||||
{
|
orgTreeId: item.orgTreeId,
|
||||||
id: "x2",
|
orgTreeName: item.orgTreeName,
|
||||||
shortName: "test2",
|
orgTreeShortName: item.orgTreeShortName,
|
||||||
insigniaType: "test2",
|
}));
|
||||||
},
|
rows.value = mappedData;
|
||||||
];
|
console.log("row", rows.value);
|
||||||
|
} else if (modalType.value === 1) {
|
||||||
|
const mappedData = dataStandant.map((item: any) => ({
|
||||||
|
name: `${item.orgTreeName} (${item.orgTreeShortName})`,
|
||||||
|
orgRootId: item.orgRootId,
|
||||||
|
orgTreeId: item.orgTreeId,
|
||||||
|
orgLevel: item.orgLevel,
|
||||||
|
orgTreeName: item.orgTreeName,
|
||||||
|
orgTreeShortName: item.orgTreeShortName,
|
||||||
|
orgRevisionId: item.orgRevisionId,
|
||||||
|
}));
|
||||||
|
rows.value = mappedData;
|
||||||
|
|
||||||
rows.value = dataList;
|
console.log("row", dataStandant);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
@ -113,7 +112,7 @@ watch(
|
||||||
:rows="rows"
|
:rows="rows"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:rows-per-page-options="[100]"
|
:rows-per-page-options="[100]"
|
||||||
row-key="name"
|
row-key="orgTreeId"
|
||||||
hide-bottom
|
hide-bottom
|
||||||
hide-pagination
|
hide-pagination
|
||||||
hide-header
|
hide-header
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import type { OrgTree } from "@/modules/02_organizationalNew/interface/response/
|
||||||
/** importComponents*/
|
/** importComponents*/
|
||||||
import DialogAgency from "@/modules/02_organizationalNew/components/DialogFormAgency.vue";
|
import DialogAgency from "@/modules/02_organizationalNew/components/DialogFormAgency.vue";
|
||||||
import DialogStructureDetail from "@/modules/02_organizationalNew/components/StructureDetail.vue";
|
import DialogStructureDetail from "@/modules/02_organizationalNew/components/StructureDetail.vue";
|
||||||
|
import DialogSortAgency from "@/modules/02_organizationalNew/components/DialogSortAgency.vue";
|
||||||
|
|
||||||
/** importStore*/
|
/** importStore*/
|
||||||
import { useOrganizational } from "@/modules/02_organizationalNew/store/organizational";
|
import { useOrganizational } from "@/modules/02_organizationalNew/store/organizational";
|
||||||
|
|
@ -80,7 +81,9 @@ const listAdd = ref<ListMenu[]>([
|
||||||
|
|
||||||
const nodeTEST = defineModel<OrgTree[]>("nodeTree", { default: [] });
|
const nodeTEST = defineModel<OrgTree[]>("nodeTree", { default: [] });
|
||||||
const filter = ref<string>("");
|
const filter = ref<string>("");
|
||||||
|
const level = ref<number>(0);
|
||||||
const nodes = ref<Array<OrgTree>>([]);
|
const nodes = ref<Array<OrgTree>>([]);
|
||||||
|
const dataSort = ref<Array<any>>([]);
|
||||||
const lazy = ref(nodes);
|
const lazy = ref(nodes);
|
||||||
const expanded = ref<Array<any>>([]);
|
const expanded = ref<Array<any>>([]);
|
||||||
const notFound = ref<string>("ไม่พบข้อมูลที่ค้นหา");
|
const notFound = ref<string>("ไม่พบข้อมูลที่ค้นหา");
|
||||||
|
|
@ -165,6 +168,7 @@ function deleteNode(treeNode: any, organizationId: any): boolean {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const modalSortAgency = ref<boolean>(false);
|
||||||
const dialogAgency = ref<boolean>(false);
|
const dialogAgency = ref<boolean>(false);
|
||||||
const actionType = ref<string>("");
|
const actionType = ref<string>("");
|
||||||
const dataNode = ref<any>();
|
const dataNode = ref<any>();
|
||||||
|
|
@ -214,6 +218,54 @@ async function onClickDel(type: number, id: string) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onClickSort(type: number, id: string) {
|
||||||
|
modalSortAgency.value = true;
|
||||||
|
level.value = type;
|
||||||
|
if (type === 0) {
|
||||||
|
const dataList = nodes.value;
|
||||||
|
const dataMap = dataList.map((item: any) => ({
|
||||||
|
orgTreeId: item.orgTreeId,
|
||||||
|
orgLevel: item.orgLevel,
|
||||||
|
orgTreeName: item.orgTreeName,
|
||||||
|
orgTreeShortName: item.orgTreeShortName,
|
||||||
|
orgRevisionId: item.orgRevisionId,
|
||||||
|
}));
|
||||||
|
|
||||||
|
dataSort.value = dataMap;
|
||||||
|
} else if (type === 1) {
|
||||||
|
const dataList = nodes.value;
|
||||||
|
const dataMap = dataList.map((item: any) => ({
|
||||||
|
orgTreeId: item.orgTreeId,
|
||||||
|
orgRevisionId: item.orgRevisionId,
|
||||||
|
children: item.children,
|
||||||
|
}));
|
||||||
|
const dataChild = dataMap
|
||||||
|
.filter((item: any) => item.orgTreeId === id)
|
||||||
|
.reduce((acc: any, item: any) => {
|
||||||
|
return acc.concat(
|
||||||
|
item.children.map((child: any) => ({
|
||||||
|
orgRootId: child.orgRootId,
|
||||||
|
orgTreeId: child.orgTreeId,
|
||||||
|
orgLevel: child.orgLevel,
|
||||||
|
orgTreeName: child.orgTreeName,
|
||||||
|
orgTreeShortName: child.orgTreeShortName,
|
||||||
|
orgRevisionId: child.orgRevisionId,
|
||||||
|
}))
|
||||||
|
);
|
||||||
|
}, []);
|
||||||
|
dataSort.value = dataChild;
|
||||||
|
} else if (type === 2) {
|
||||||
|
|
||||||
|
const dataList = nodes.value;
|
||||||
|
const dataMap = dataList.map((item: any) => ({
|
||||||
|
orgTreeId: item.orgTreeId,
|
||||||
|
children: item.children,
|
||||||
|
}))
|
||||||
|
|
||||||
|
console.log(dataMap)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
watch(
|
watch(
|
||||||
() => nodeTEST.value,
|
() => nodeTEST.value,
|
||||||
() => {
|
() => {
|
||||||
|
|
@ -328,6 +380,8 @@ onMounted(async () => {});
|
||||||
? onClickDetail(prop.node.orgTreeId, prop.node.orgLevel)
|
? onClickDetail(prop.node.orgTreeId, prop.node.orgLevel)
|
||||||
: item.type === 'DEL'
|
: item.type === 'DEL'
|
||||||
? onClickDel(prop.node.orgLevel, prop.node.orgTreeId)
|
? onClickDel(prop.node.orgLevel, prop.node.orgTreeId)
|
||||||
|
: item.type === 'SORT'
|
||||||
|
? onClickSort(prop.node.orgLevel, prop.node.orgRootId)
|
||||||
: null
|
: null
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
|
|
@ -451,6 +505,12 @@ onMounted(async () => {});
|
||||||
v-model:treeId="treeId"
|
v-model:treeId="treeId"
|
||||||
v-model:orgLevel="orgLevel"
|
v-model:orgLevel="orgLevel"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<DialogSortAgency
|
||||||
|
v-model:sort-agency="modalSortAgency"
|
||||||
|
v-model:data="dataSort"
|
||||||
|
v-model:type="level"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped></style>
|
<style scoped></style>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue