no message

This commit is contained in:
setthawutttty 2024-11-07 12:06:13 +07:00
parent 8c989e84b2
commit aa65b8165d
5 changed files with 58 additions and 24 deletions

View file

@ -112,7 +112,9 @@ export default {
*
*/
requestEdit: `${profileOrg}/edit/`,
requestEditByType:(type:string)=> `${org}/profile${type}/edit/`,
requestsEdit: `${profileOrg}/edit`,
requestsEditByType:(type:string)=> `${org}/profile${type}/edit`,
developmentUser: `${profileOrg}/development/user`,
developmentUserByType: (type: string) => `${org}/profile${type}/development/user`,

View file

@ -5,6 +5,7 @@ import axios from "axios";
import http from "@/plugins/http";
import config from "@/app.config";
import { useDataStore } from "@/stores/data";
import DialogHeader from "@/components/DialogHeader.vue";
@ -16,6 +17,7 @@ import { useCounterMixin } from "@/stores/mixin";
*/
const $q = useQuasar();
const store = useRequestEditStore();
const dataStore = useDataStore();
const { dialogConfirm, showLoader, hideLoader, messageError, success } =
useCounterMixin();
@ -53,10 +55,12 @@ function onSubmit() {
async () => {
showLoader();
await http
.post(config.API.requestsEdit, {
.post(config.API.requestsEditByType(dataStore.officerLink), {
topic: formData.topic,
detail: formData.detail,
profileId: profileId.value,
[dataStore.officerType === "OFFICER"
? "profileId"
: "profileEmployeeId"]: profileId.value,
})
.then(async (res) => {
if (formData.document) {

View file

@ -5,6 +5,7 @@ import { useQuasar } from "quasar";
import { useRouter, useRoute } from "vue-router";
import { useRequestEditStore } from "@/modules/10_registry/store/RequestEdit";
import { useCounterMixin } from "@/stores/mixin";
import { useDataStore } from "@/stores/data";
import config from "@/app.config";
import http from "@/plugins/http";
@ -14,6 +15,7 @@ import Workflow from "@/components/Workflow/Main.vue";
const $q = useQuasar();
const store = useRequestEditStore();
const dataStore = useDataStore();
const router = useRouter();
const route = useRoute();
const { showLoader, hideLoader, messageError, date2Thai } = useCounterMixin();
@ -37,9 +39,9 @@ const statusOption = ref<DataOption[]>(statusOptionMain.value); //ตัวเ
async function fetchData() {
showLoader();
await http
.get(config.API.requestEdit + `${requestId.value}`)
.then((res) => {
const data = res.data.result;
.get(config.API.requestEditByType(dataStore.officerLink) + `${requestId.value}`)
.then(async (res) => {
const data = await res.data.result;
dataRequest.value = {
fullname: data.fullname,
createdAt: data.createdAt,
@ -48,14 +50,14 @@ async function fetchData() {
status: data.status,
remark: data.remark,
};
onDownloadFile(requestId.value); //
await onDownloadFile(requestId.value); //
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
})
.finally(() => {});
}
const checkFile = ref<null | false | "img" | "doc">(null); // null , false , "img" , "doc"
@ -65,8 +67,8 @@ const urlDownload = ref<string>(""); // url ไฟล์อัปโหลด
* function หาชอไฟล
* @param id รายการยนคำรองขอแกไขขอม
*/
function onDownloadFile(id: string) {
http
async function onDownloadFile(id: string) {
await http
.get(
config.API.file(
"ระบบทะเบียนประวัติ",
@ -79,10 +81,12 @@ function onDownloadFile(id: string) {
await downloadUrl(id, res.data[0].fileName);
} else {
checkFile.value = false;
hideLoader();
}
})
.catch((e) => {
messageError($q, e);
hideLoader();
});
}
@ -91,8 +95,8 @@ function onDownloadFile(id: string) {
* @param id รายการยนคำรองขอแกไขขอม
* @param fileName อไฟล
*/
function downloadUrl(id: string, fileName: string) {
http
async function downloadUrl(id: string, fileName: string) {
await http
.get(
config.API.fileByFile(
"ระบบทะเบียนประวัติ",
@ -108,13 +112,13 @@ function downloadUrl(id: string, fileName: string) {
} else {
checkFile.value = "doc";
}
hideLoader();
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
})
.finally(() => {});
}
onMounted(async () => {

View file

@ -1,9 +1,11 @@
<script setup lang="ts">
import { ref, onMounted, watch } from "vue";
import { useQuasar } from "quasar";
import { useRouter } from "vue-router";
import config from "@/app.config";
import http from "@/plugins/http";
import { useDataStore } from "@/stores/data";
import { useQuasar } from "quasar";
import { useRouter } from "vue-router";
/**
* importType
@ -32,6 +34,7 @@ import { useCounterMixin } from "@/stores/mixin";
const $q = useQuasar();
const store = useRequestEditStore();
const router = useRouter();
const dataStore = useDataStore()
const { showLoader, hideLoader, messageError, dialogRemove, success } =
useCounterMixin();
@ -146,7 +149,7 @@ function fetchListRequset() {
};
showLoader();
http
.get(config.API.requestEdit + `user`, { params: queryParams })
.get(config.API.requestEditByType(dataStore.officerLink) + `user`, { params: queryParams })
.then((res) => {
const data = res.data.result;
maxPage.value = Math.ceil(data.total / pageSize.value);
@ -369,7 +372,6 @@ onMounted(() => {
map-options
:options="columns"
option-value="name"
class="col-xs-12 col-sm-3 col-md-2"
style="min-width: 140px"
/>

View file

@ -1,10 +1,17 @@
import { ref, computed, reactive } from "vue";
import { defineStore } from "pinia";
import http from "@/plugins/http";
import config from "@/app.config";
import { useQuasar } from "quasar";
import { useRegistryInFormationStore } from "@/modules/10_registry/store/registry";
import { useCounterMixin } from "./mixin";
export const useDataStore = defineStore("data", () => {
const storeRegistry = useRegistryInFormationStore();
const $q = useQuasar();
const mixin = useCounterMixin();
const { messageError, showLoader, hideLoader } = mixin;
// ref() คือการประกาศ state เหมือน vuex
const formData = reactive<any>({
prefix: "",
@ -85,12 +92,11 @@ export const useDataStore = defineStore("data", () => {
const data = await dataPerson;
isProbation.value = data.isProbation;
officerType.value = data.type;
officerLink.value = await convertEmType(data.type)
officerLink.value = await convertEmType(data.type);
formData.prefix = data.prefix;
formData.firstName = data.firstName;
formData.lastName = data.lastName;
formData.position = data.position;
formData.posTypeName = data.posTypeName;
formData.posExecutiveName = data.posExecutiveName;
formData.posLevelName = data.posLevelName;
@ -99,6 +105,21 @@ export const useDataStore = defineStore("data", () => {
: "";
storeRegistry.profileId = data.profileId;
}
async function getProFileType() {
http
.get(config.API.proFileType)
.then(async (res) => {
const data = res.data.result;
officerType.value = data.type;
officerLink.value = await convertEmType(data.type);
hideLoader();
})
.catch((e) => {
messageError($q, e);
});
}
return {
count,
doubleCount,
@ -119,7 +140,8 @@ export const useDataStore = defineStore("data", () => {
getData,
profileImg,
formData,
officerLink
officerLink,
getProFileType,
};
});