no message

This commit is contained in:
setthawutttty 2024-03-19 18:02:16 +07:00
parent 60b90428a7
commit f683c153a0

View file

@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref,defineProps } from "vue"; import { ref, defineProps } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import http from "@/plugins/http"; import http from "@/plugins/http";
@ -8,25 +8,25 @@ import DialogPopupReason from "@/components/Dialogs/PopupReason.vue"; //หม
import { useSalaryListSDataStore } from "@/modules/13_salary/store/SalaryListsStore"; import { useSalaryListSDataStore } from "@/modules/13_salary/store/SalaryListsStore";
const store = useSalaryListSDataStore(); const store = useSalaryListSDataStore();
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import axios from "axios";
const $q = useQuasar(); // noti quasar const $q = useQuasar(); // noti quasar
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const { messageError, dialogConfirm, showLoader, hideLoader, success } = mixin; const { messageError, dialogConfirm, showLoader, hideLoader, success } = mixin;
const type = ref<string>('') const type = ref<string>("");
const sendStep = ref<number>(1); const sendStep = ref<number>(1);
const fileUpload = ref<any>(null); const fileUpload = ref<any>(null);
const document = ref<string>(""); const document = ref<string>("");
const props = defineProps({ const props = defineProps({
rootId:String, rootId: String,
periodId:String, periodId: String,
getData:Function getData: Function,
}) });
/** /**
* function ปโหลดไฟลเจาหนาท * function ปโหลดไฟลเจาหนาท
* @param event file * @param event file
*/ */
async function uploadFile(event: any) { async function uploadFile(event: any) {
const fileName = event.name const fileName = { fileName: event.name };
dialogConfirm( dialogConfirm(
$q, $q,
@ -47,15 +47,13 @@ async function uploadFile(event: any) {
fileList: fileName, fileList: fileName,
} }
) )
.then(async () => { .then(async (res) => {
// await fecthInsigniaByOc( const foundKey: string | undefined = Object.keys(res.data).find(
// round.value, (key) =>
// DataStore.agency, res.data[key]?.fileName !== undefined &&
// "officer", res.data[key]?.fileName !== ""
// tab.value );
// ); foundKey && uploadfile(res.data[foundKey]?.uploadUrl, fileUpload);
// success($q, "");
// fileUpload.value = null;
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
@ -66,22 +64,74 @@ async function uploadFile(event: any) {
); );
} }
function saveReccommend(reason:string) { /**
* functoin ปโหลดไฟล
* @param uploadUrl link ปโหลด
* @param file ไฟล
*/
async function uploadfile(uploadUrl: string, file: any) {
showLoader();
await axios
.put(uploadUrl, file, {
headers: {
"Content-Type": file.type,
},
})
.then(() => {
getListFile();
success($q, "อัปโหลไฟล์สำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
function getListFile() {
http
.get(
config.API.subFile(
"ระบบเงินเดือน",
"เลื่อนเงินเดือน",
props.periodId ? props.periodId : "",
props.rootId ? props.rootId : ""
)
)
.then((res) => {
console.log(res);
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {});
}
function saveReccommend(reason: string) {
dialogConfirm( dialogConfirm(
$q, $q,
async () => { async () => {
showLoader() showLoader();
http http
.put(config.API.salaryPeriodStatusComment(type.value, props.periodId ? props.periodId:'', props.rootId ? props.rootId:''),{ .put(
titleRecommend:reason config.API.salaryPeriodStatusComment(
}) type.value,
.then((res)=>{ props.periodId ? props.periodId : "",
props.getData?.() props.rootId ? props.rootId : ""
}).catch((e)=>{ ),
messageError($q,e) {
}).finally(()=>{ titleRecommend: reason,
hideLoader() }
}) )
.then((res) => {
props.getData?.();
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
sendStep.value = sendStep.value + 1; sendStep.value = sendStep.value + 1;
modalRecommend.value = false; modalRecommend.value = false;
}, },
@ -90,20 +140,28 @@ function saveReccommend(reason:string) {
); );
} }
function sendToDirector(msg: string,type:string) { function sendToDirector(msg: string, type: string) {
dialogConfirm( dialogConfirm(
$q, $q,
async () => { async () => {
showLoader() showLoader();
http http
.get(config.API.salaryPeriodStatus(type, props.periodId ? props.periodId:'', props.rootId ? props.rootId:'')) .get(
.then((res)=>{ config.API.salaryPeriodStatus(
props.getData?.() type,
}).catch((e)=>{ props.periodId ? props.periodId : "",
messageError($q,e) props.rootId ? props.rootId : ""
}).finally(()=>{ )
hideLoader() )
}) .then((res) => {
props.getData?.();
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}, },
"ยืนยันการ" + msg, "ยืนยันการ" + msg,
"ต้องการยืนยันการ" + msg + "หรือไม่?" "ต้องการยืนยันการ" + msg + "หรือไม่?"
@ -112,10 +170,10 @@ function sendToDirector(msg: string,type:string) {
const modalRecommend = ref<boolean>(false); const modalRecommend = ref<boolean>(false);
const titleRecommend = ref<string>(""); const titleRecommend = ref<string>("");
function sendAndRecommend(title: string,typeOrder:string) { function sendAndRecommend(title: string, typeOrder: string) {
modalRecommend.value = true; modalRecommend.value = true;
titleRecommend.value = title; titleRecommend.value = title;
type.value = typeOrder type.value = typeOrder;
} }
</script> </script>
@ -169,7 +227,7 @@ function sendAndRecommend(title: string,typeOrder:string) {
unelevated unelevated
color="public" color="public"
label="ส่งเอกสารให้ ผอ. ตรวจสอบ" label="ส่งเอกสารให้ ผอ. ตรวจสอบ"
@click="sendToDirector('ส่งเอกสารให้ ผอ. ตรวจสอบ','officer')" @click="sendToDirector('ส่งเอกสารให้ ผอ. ตรวจสอบ', 'officer')"
/> />
<!-- ผอ. หนวยงานทำการยนยนและสงให สกจ. --> <!-- ผอ. หนวยงานทำการยนยนและสงให สกจ. -->
@ -178,16 +236,16 @@ function sendAndRecommend(title: string,typeOrder:string) {
unelevated unelevated
color="public" color="public"
label="ยืนยันและส่งเอกสารให้ สกจ." label="ยืนยันและส่งเอกสารให้ สกจ."
@click="sendToDirector('ยืนยันและส่งเอกสารให้ สกจ.','head')" @click="sendToDirector('ยืนยันและส่งเอกสารให้ สกจ.', 'head')"
/> />
<!-- สกจ. ตรวจสอบเอกสารและขอมลรายการเงนเดอนทแตละหนวยงานสงมา ไมปรบโควต --> <!-- สกจ. ตรวจสอบเอกสารและขอมลรายการเงนเดอนทแตละหนวยงานสงมา ไมปรบโควต -->
<q-btn <q-btn
v-if="store.statusQuota == 'WAITOWNER1'" v-if="store.statusQuota == 'WAITOWNER1'"
unelevated unelevated
color="green" color="green"
label="ยืนยันการตรวจสอบ" label="ยืนยันการตรวจสอบ"
@click="sendToDirector('ยืนยันการตรวจสอบ','owner')" @click="sendToDirector('ยืนยันการตรวจสอบ', 'owner')"
/> />
<!-- สกจ. ตรวจสอบเอกสารและขอมลรายการเงนเดอนทแตละหนวยงานสงมา ปรบโควต --> <!-- สกจ. ตรวจสอบเอกสารและขอมลรายการเงนเดอนทแตละหนวยงานสงมา ปรบโควต -->
@ -197,7 +255,7 @@ function sendAndRecommend(title: string,typeOrder:string) {
unelevated unelevated
color="warning" color="warning"
label="ส่งคำแนะนำให้ ผอ. ตรวจสอบ" label="ส่งคำแนะนำให้ ผอ. ตรวจสอบ"
@click="sendAndRecommend('ส่งคำแนะนำให้ ผอ. ตรวจสอบ','owner')" @click="sendAndRecommend('ส่งคำแนะนำให้ ผอ. ตรวจสอบ', 'owner')"
/> />
<!-- ผอ.หนวยงานสงคำแนะนำใหการเจาหนาทหนวยงาน --> <!-- ผอ.หนวยงานสงคำแนะนำใหการเจาหนาทหนวยงาน -->
@ -206,7 +264,9 @@ function sendAndRecommend(title: string,typeOrder:string) {
unelevated unelevated
color="public" color="public"
label="ส่งคำแนะนำให้การเจ้าหน้าที่หน่วยงาน" label="ส่งคำแนะนำให้การเจ้าหน้าที่หน่วยงาน"
@click="sendAndRecommend('ส่งคำแนะนำให้การเจ้าหน้าที่หน่วยงาน','head')" @click="
sendAndRecommend('ส่งคำแนะนำให้การเจ้าหน้าที่หน่วยงาน', 'head')
"
/> />
<q-btn <q-btn
@ -224,7 +284,15 @@ function sendAndRecommend(title: string,typeOrder:string) {
/> />
</div> </div>
</q-toolbar> </q-toolbar>
<div class="col-12">
asdasd
<q-card bordered class="row" style="border: 1px solid #d6dee1">
<div class="col-12 text-weight-medium bg-grey-1 q-py-sm q-px-md">
รายการเอกสาร
</div>
<div class="col-12"><q-separator /></div>
</q-card>
</div>
<DialogPopupReason <DialogPopupReason
v-model:modal="modalRecommend" v-model:modal="modalRecommend"
:title="titleRecommend" :title="titleRecommend"