Merge branch 'nice_dev' into develop

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-08-23 13:55:25 +07:00
commit fde0a3fd0b
5 changed files with 169 additions and 137 deletions

View file

@ -46,4 +46,7 @@ export default {
listOut: () => `${retirement}/out`,
outByid: (id: string) => `${retirement}/out/${id}`,
outReport: `${retirement}/out/report`,
fileRetirement: (id: string) => `${retirement}/upload/${id}`,
checkfileupload: (id: string) => `${retirement}/upload/check/${id}`
};

View file

@ -20,9 +20,10 @@ const retireld_params = route.params.retirementId;
const modalNote = ref<boolean>(false);
const note = ref<string>("");
const retireProfileId = ref<string>("");
const retireld = ref<string>();
const retireld = ref<string>(retireld_params.toString());
const profileId = ref<string>("");
const filter = ref<string>("");
const statusUpload = ref<boolean>();
const columns = ref<any["columns"]>([
{
@ -131,20 +132,7 @@ const columns = ref<any["columns"]>([
style: "font-size: 14px",
},
]);
const rows = ref<any>([
// {
// fixname: "",
// name: " ",
// brand: "",
// positionType: "",
// positionManager: "",
// positionLavel: "",
// positionNumber: ".2",
// govGroup: "",
// govOffice: "",
// bureau: "",
// },
]);
const rows = ref<any>([]);
const visibleColumns = ref<string[]>([
"order",
"fixname",
@ -160,11 +148,14 @@ const visibleColumns = ref<string[]>([
]);
const action = ref<string>("");
const fileUpload = ref<any>(null);
const fileInputRef = ref<any>(null);
onMounted(() => {
retireld.value = retireld_params.toString();
console.log(retireld_params);
fecthlistprofile(retireld.value);
fecthCheck(retireld.value);
});
const round = ref<number>();
const typeReport = ref<string>("");
@ -205,6 +196,17 @@ const fecthlistprofile = async (id: string) => {
hideLoader();
});
};
const fecthCheck = async (id: string) => {
await http
.get(config.API.checkfileupload(id))
.then((res) => {
console.log(res);
statusUpload.value = res.data.result;
})
.catch((err) => {
console.log(err);
});
};
// DelProfile
const clickDelete = () => {
$q.dialog({
@ -297,38 +299,33 @@ const visibleNote = computed(() => {
return true;
}
});
// const saveList = () => {
// $q.dialog({
// title: "",
// message: "?",
// cancel: {
// flat: true,
// color: "negative",
// },
// persistent: true,
// })
// .onOk(async () => {
// const retireld = "1233444";
// await http
// .post(config.API.listRetire("123"), { retireld: retireld })
// .then(() => {
// success($q, "");
// })
// .catch((e) => {
// messageError($q, e);
// })
// .finally(() => {
// fecthlist();
// });
// })
// .onCancel(() => {})
// .onDismiss(() => {});
// };
const classrow = (prop: any) => {
if (profileId.value !== "" && prop.profileId === profileId.value) {
return "color: #26a69a;";
} else return "";
const uploadFile = async (event: any) => {
showLoader();
const selectedFile = event;
console.log(selectedFile);
const formdata = new FormData();
formdata.append("file", selectedFile);
await http
.put(config.API.fileRetirement(retireld.value.toString()), formdata)
.then((res) => {
success($q, "เพิ่มไฟล์สำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
fileUpload.value = null;
fecthlistprofile(retireld.value);
fecthCheck(retireld.value);
hideLoader();
});
};
// const classrow = (prop: any) => {
// if (profileId.value !== "" && prop.profileId === profileId.value) {
// return "color: #26a69a;";
// } else return "";
// };
const paging = ref<boolean>(true);
const pagination = ref({
sortBy: "order",
@ -359,80 +356,103 @@ const paginationLabel = (start: number, end: number, total: number) => {
<div>
<q-card class="col-12 q-pa-md">
<div class="row col-12 q-pb-sm">
<AddList
:dataProfile="dataProfile"
:retireld="retireld"
:profile-id="profileId"
:UpdateListId="UpdateListId"
v-if="
statusReport === false &&
(typeReport == 'ADD' || typeReport == '' || typeReport == null)
"
/>
<div class="row">
<AddList
:dataProfile="dataProfile"
:retireld="retireld"
:profile-id="profileId"
:UpdateListId="UpdateListId"
v-if="
statusReport === false &&
(typeReport == 'ADD' || typeReport == '' || typeReport == null) &&
statusUpload !== true
"
/>
<!-- <q-btn flat round style="color: #016987;" icon="save" @click="saveList">
<!-- <q-btn flat round style="color: #016987;" icon="save" @click="saveList">
<q-tooltip>นทกขอม</q-tooltip>
</q-btn> -->
<q-btn color="primary" flat round icon="download">
<q-menu>
<q-list style="min-width: 100px">
<q-item clickable>
<q-item-section avatar>
<q-icon color="red" name="mdi-file-pdf" />
</q-item-section>
<q-item-section>ไฟล .PDF</q-item-section>
</q-item>
<q-item clickable>
<q-item-section avatar>
<q-icon color="green" name="mdi-file-excel" />
</q-item-section>
<q-item-section>ไฟล .xls</q-item-section>
</q-item>
</q-list>
</q-menu>
<q-tooltip>ดาวนโหลดไฟล</q-tooltip>
</q-btn>
<q-btn flat round color="light-blue" icon="upload">
<q-tooltip>พโหลดไฟล</q-tooltip>
</q-btn>
<q-space />
<q-tabs shrink>
<q-input
borderless
<q-btn color="primary" flat round icon="download">
<q-menu>
<q-list style="min-width: 100px">
<q-item clickable>
<q-item-section avatar>
<q-icon color="red" name="mdi-file-pdf" />
</q-item-section>
<q-item-section>ไฟล .PDF</q-item-section>
</q-item>
<q-item clickable>
<q-item-section avatar>
<q-icon color="green" name="mdi-file-excel" />
</q-item-section>
<q-item-section>ไฟล .xls</q-item-section>
</q-item>
</q-list>
</q-menu>
<q-tooltip>ดาวนโหลดไฟล</q-tooltip>
</q-btn>
<q-file
bg-color="white"
outlined
dense
debounce="300"
v-model="filter"
placeholder="ค้นหา"
style="max-width: 200px"
class="q-ml-sm"
v-model="fileUpload"
accept=".pdf"
:style="fileUpload === null ? 'width: 100px' : 'width: auto'"
v-if="statusUpload !== true"
>
<template v-slot:append>
<q-icon name="search" />
<template v-slot:prepend>
<q-icon color="light-blue" name="attach_file" />
<q-tooltip>พโหลดไฟล</q-tooltip>
</template>
</q-input>
<q-select
v-model="visibleColumns"
multiple
outlined
dense
options-dense
:display-value="$q.lang.table.columns"
emit-value
map-options
:options="columns"
option-value="name"
options-cover
style="min-width: 150px"
class="gt-xs q-ml-sm"
>
<!-- <template v-slot:option="{ opt }">
<div>{{ opt.label }}</div>
<div class="sublabel">{{ opt.sublabel }}</div>
</template> -->
</q-select>
</q-tabs>
</q-file>
<q-btn
flat
round
color="light-blue"
icon="upload"
@click="uploadFile(fileUpload)"
v-if="fileUpload !== null"
/>
</div>
<q-space />
<div class="row">
<q-tabs shrink>
<q-input
borderless
outlined
dense
debounce="300"
v-model="filter"
placeholder="ค้นหา"
style="max-width: 200px"
class="q-ml-sm"
>
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
<q-select
v-model="visibleColumns"
multiple
outlined
dense
options-dense
:display-value="$q.lang.table.columns"
emit-value
map-options
:options="columns"
option-value="name"
options-cover
style="min-width: 150px"
class="gt-xs q-ml-sm"
>
<!-- <template v-slot:option="{ opt }">
<div>{{ opt.label }}</div>
<div class="sublabel">{{ opt.sublabel }}</div>
</template> -->
</q-select>
</q-tabs>
</div>
</div>
<div>
@ -467,7 +487,8 @@ const paginationLabel = (start: number, end: number, total: number) => {
(typeReport === 'EDIT' ||
typeReport === null ||
typeReport === '') &&
statusReport === false
statusReport === false &&
statusUpload !== true
"
/>
<q-th
@ -476,7 +497,8 @@ const paginationLabel = (start: number, end: number, total: number) => {
(typeReport === 'REMOVE' ||
typeReport === null ||
typeReport === '') &&
statusReport === false
statusReport === false &&
statusUpload !== true
"
/>
</q-tr>
@ -553,7 +575,8 @@ const paginationLabel = (start: number, end: number, total: number) => {
(typeReport === 'EDIT' ||
typeReport === null ||
typeReport === '') &&
statusReport === false
statusReport === false &&
statusUpload !== true
"
>
<q-btn
@ -578,7 +601,8 @@ const paginationLabel = (start: number, end: number, total: number) => {
(typeReport === 'REMOVE' ||
typeReport === null ||
typeReport === '') &&
statusReport === false
statusReport === false &&
statusUpload !== true
"
>
<q-btn

View file

@ -50,6 +50,7 @@
round
color="add"
icon="mdi-plus"
:disable="checkjson == true"
>
<q-tooltip>เพ</q-tooltip>
</q-btn>
@ -275,7 +276,7 @@
</template>
<script setup lang="ts">
import { onMounted, ref, useAttrs, reactive, watch } from "vue";
import { onMounted, ref, useAttrs, reactive, watch, computed } from "vue";
import type { QTableProps } from "quasar";
import type {
FormMainProbation,
@ -355,9 +356,9 @@ const tab = ref<any>("officer");
const visibleColumns2 = ref<string[]>(["no", "name", "retireNumber"]);
const yearOptions = reactive<any[]>([]);
const filteryear = () => {
console.log(yearOptions);
// console.log(yearOptions);
yearOptions.push({ id: currentYear, name: currentYear + 543 });
console.log(yearOptions[0].id);
// console.log(yearOptions[0].id);
fiscalyear.value = yearOptions[0].id;
fetchRetirement(type.value, currentYear);
};
@ -367,7 +368,7 @@ const fetchRetirement = async (type: string, year: any) => {
await http
.get(config.API.retirement(type, year))
.then((res) => {
console.log(res);
// console.log(res);
rows.value = [];
let data = res.data.result;
rows.value = data.map((items: any) => ({
@ -378,9 +379,11 @@ const fetchRetirement = async (type: string, year: any) => {
total: items.total,
round: items.round,
typeReport: typeReportChangeName(items.typeReport),
json: items.json,
}));
actionOption.value = rows.value;
rows.value.sort((a, b) => a.round - b.round);
checkststus(rows.value);
})
.catch((e) => {
messageError($q, e);
@ -540,7 +543,7 @@ const cerateRetirement = async (data: object) => {
});
};
const clickSelect = async (action: string) => {
console.log(action);
// console.log(action);
// console.log(radio.value);
$q.dialog({
title: "ยืนยันการแก้ไขข้อมูลประกาศเกษียณ",
@ -558,7 +561,7 @@ const clickSelect = async (action: string) => {
retireHistoryId: action,
option: radio.value,
};
console.log(data);
// console.log(data);
await cerateRetirement(data);
})
@ -569,6 +572,14 @@ const clickSelect = async (action: string) => {
const clickClose = async () => {
modal.value = false;
};
const checkjson = ref<boolean>();
const checkststus = (data: any) => {
let jsonfasle = rows.value.find((e: any) => e.json == false);
if (jsonfasle) {
checkjson.value = true;
} else checkjson.value = false;
};
const fiscalyear = ref<number>();
// const fiscalyearOP = ref<any>([
// { id: 1, name: "" },
@ -608,7 +619,7 @@ watch(type, () => {
fetchRetirement(type.value, currentYear);
});
const typeReportChangeName = (val: string) => {
console.log(val);
// console.log(val);
switch (val) {
case "EDIT":
return "ประกาศแก้ไขเกษียณ";

View file

@ -236,7 +236,7 @@ const fecthlistRetire = async () => {
}
})
.catch((e) => {
console.log(e);
// console.log(e);
messageError($q, e);
});
};
@ -257,7 +257,7 @@ const fecthlistperson = async (id: string) => {
criterias: data,
})
.then((res) => {
console.log(res);
// console.log(res);
rows2.value = res.data.result.map((e: any) => ({
id: e.id,
@ -269,7 +269,7 @@ const fecthlistperson = async (id: string) => {
modalAdd.value = true;
})
.catch((e) => {
console.log(e);
// console.log(e);
messageError($q, e);
})
.finally(() => {
@ -294,14 +294,14 @@ const addlistperson = async (id: string) => {
// insigniaId: organization.value,
insigniaPeriodId: props.roundId,
};
console.log(data);
// console.log(data);
await http
.post(config.API.insigniaCreate(), data)
.then(() => {
success($q, "เพิ่มรายชื่อสำเร็จ");
})
.catch((err) => {
console.log(err);
// console.log(err);
messageError($q, err);
})
.finally(() => {
@ -439,8 +439,8 @@ const fecthInsignia = async () => {
.then((res) => {
insigniaOptions.value = res.data.result;
})
.catch((err) => {
console.log(err);
.catch(() => {
// console.log(err);
});
};
// const fecthInsigniaType = async () => {

View file

@ -39,17 +39,11 @@ export const useInsigniaDataStore = defineStore("insignia", () => {
} else rows.value = []
}
const fetchOption = (op: any) => {
console.log(agency.value);
console.log(op);
if (agency.value !== null) {
typeOc.value = agency.value
optionsTypeOc.value = op.filter((e: any) => e.id == agency.value
)
} else { optionsTypeOc.value = op, typeOc.value = op[2].id }
console.log(optionsTypeOc.value);
}
const filtertypeInsignia = async () => {
typeinsignia.value = "all"