Merge branch 'nice_dev' into develop

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-04-18 16:56:30 +07:00
commit 94ec57c791
5 changed files with 69 additions and 71 deletions

View file

@ -43,9 +43,9 @@ const node = ref<any>([]);
const filter = ref<string>("");
const expanded = ref<any>([]);
async function fetchData(id: string) {
function fetchData(id: string) {
showLoader();
await http
http
.get(config.API.developmentMainTab("tab1", id))
.then(async (res) => {
const data = res.data.result;
@ -60,8 +60,8 @@ async function fetchData(id: string) {
if (nodeTree) {
expanded.value = [];
const parts = nodeTree?.orgName.split("/");
for (let i = 0; i < parts.length; i++) {
const arrangedParts = parts[i - 1];
for (let i = 1; i < parts.length; i++) {
const arrangedParts = parts[i];
expanded.value.push(arrangedParts);
}
updateSelected(nodeTree);
@ -137,17 +137,19 @@ function updateSelected(data: any) {
formData.orgRevisionId = data.orgRevisionId;
}
function searchAndReplace(orgTreeData: any, treeId: string | null) {
for (let orgTree of orgTreeData) {
if (orgTree.orgTreeId === treeId) {
return orgTree;
}
let foundOrg: any = searchAndReplace(orgTree.children, treeId);
if (foundOrg) {
return foundOrg;
async function searchAndReplace(orgTreeData: any, treeId: string | null) {
if (orgTreeData) {
for (let orgTree of orgTreeData) {
if (orgTree.orgTreeId === treeId) {
return orgTree;
}
let foundOrg: any = await searchAndReplace(orgTree.children, treeId);
if (foundOrg) {
return foundOrg;
}
}
return false;
}
return null;
}
onMounted(async () => {

View file

@ -95,7 +95,7 @@ function getClass() {
/** save */
function onSubmit() {
const url = id.value
? config.API.developmentHistoryList("officer") + `${id.value}`
? config.API.developmentHistoryListByid("officer", id.value)
: config.API.developmentHistoryAdd("officer");
const body = {
@ -162,7 +162,7 @@ function upDateProject(data: any) {
function getDataEdit() {
showLoader();
http
.get(config.API.developmentHistoryList("officer") + `${id.value}`)
.get(config.API.developmentHistoryListByid("officer", id.value))
.then((res) => {
const data = res.data.result;
formMain.id = id.value;

View file

@ -94,7 +94,7 @@ function getClass() {
/** save */
function onSubmit() {
const url = id.value
? config.API.developmentHistoryList("employee") + `${id.value}`
? config.API.developmentHistoryListByid("employee", id.value)
: config.API.developmentHistoryAdd("employee");
const body = {
@ -115,7 +115,7 @@ function onSubmit() {
dialogConfirm($q, () => {
showLoader();
http[id.value ? "put" : "post"](url, body)
.then((res) => {
.then(() => {
router.push(`/development/employee-history`);
})
.catch((e) => {
@ -150,7 +150,7 @@ function upDateProject(data: any) {
function getDataEdit() {
showLoader();
http
.get(config.API.developmentHistoryList("employee") + `${id.value}`)
.get(config.API.developmentHistoryListByid("employee", id.value))
.then((res) => {
const data = res.data.result;
formMain.id = id.value;