no message
This commit is contained in:
parent
8c989e84b2
commit
aa65b8165d
5 changed files with 58 additions and 24 deletions
|
|
@ -112,7 +112,9 @@ export default {
|
||||||
* รายการคำร้องขอแก้ไขข้อมูลทะเบียนประวัติ
|
* รายการคำร้องขอแก้ไขข้อมูลทะเบียนประวัติ
|
||||||
*/
|
*/
|
||||||
requestEdit: `${profileOrg}/edit/`,
|
requestEdit: `${profileOrg}/edit/`,
|
||||||
|
requestEditByType:(type:string)=> `${org}/profile${type}/edit/`,
|
||||||
requestsEdit: `${profileOrg}/edit`,
|
requestsEdit: `${profileOrg}/edit`,
|
||||||
|
requestsEditByType:(type:string)=> `${org}/profile${type}/edit`,
|
||||||
developmentUser: `${profileOrg}/development/user`,
|
developmentUser: `${profileOrg}/development/user`,
|
||||||
developmentUserByType: (type: string) => `${org}/profile${type}/development/user`,
|
developmentUserByType: (type: string) => `${org}/profile${type}/development/user`,
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import axios from "axios";
|
||||||
|
|
||||||
import http from "@/plugins/http";
|
import http from "@/plugins/http";
|
||||||
import config from "@/app.config";
|
import config from "@/app.config";
|
||||||
|
import { useDataStore } from "@/stores/data";
|
||||||
|
|
||||||
import DialogHeader from "@/components/DialogHeader.vue";
|
import DialogHeader from "@/components/DialogHeader.vue";
|
||||||
|
|
||||||
|
|
@ -16,6 +17,7 @@ import { useCounterMixin } from "@/stores/mixin";
|
||||||
*/
|
*/
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const store = useRequestEditStore();
|
const store = useRequestEditStore();
|
||||||
|
const dataStore = useDataStore();
|
||||||
const { dialogConfirm, showLoader, hideLoader, messageError, success } =
|
const { dialogConfirm, showLoader, hideLoader, messageError, success } =
|
||||||
useCounterMixin();
|
useCounterMixin();
|
||||||
|
|
||||||
|
|
@ -53,10 +55,12 @@ function onSubmit() {
|
||||||
async () => {
|
async () => {
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
await http
|
||||||
.post(config.API.requestsEdit, {
|
.post(config.API.requestsEditByType(dataStore.officerLink), {
|
||||||
topic: formData.topic,
|
topic: formData.topic,
|
||||||
detail: formData.detail,
|
detail: formData.detail,
|
||||||
profileId: profileId.value,
|
[dataStore.officerType === "OFFICER"
|
||||||
|
? "profileId"
|
||||||
|
: "profileEmployeeId"]: profileId.value,
|
||||||
})
|
})
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
if (formData.document) {
|
if (formData.document) {
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import { useQuasar } from "quasar";
|
||||||
import { useRouter, useRoute } from "vue-router";
|
import { useRouter, useRoute } from "vue-router";
|
||||||
import { useRequestEditStore } from "@/modules/10_registry/store/RequestEdit";
|
import { useRequestEditStore } from "@/modules/10_registry/store/RequestEdit";
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
|
import { useDataStore } from "@/stores/data";
|
||||||
import config from "@/app.config";
|
import config from "@/app.config";
|
||||||
import http from "@/plugins/http";
|
import http from "@/plugins/http";
|
||||||
|
|
||||||
|
|
@ -14,6 +15,7 @@ import Workflow from "@/components/Workflow/Main.vue";
|
||||||
|
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const store = useRequestEditStore();
|
const store = useRequestEditStore();
|
||||||
|
const dataStore = useDataStore();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { showLoader, hideLoader, messageError, date2Thai } = useCounterMixin();
|
const { showLoader, hideLoader, messageError, date2Thai } = useCounterMixin();
|
||||||
|
|
@ -37,9 +39,9 @@ const statusOption = ref<DataOption[]>(statusOptionMain.value); //ตัวเ
|
||||||
async function fetchData() {
|
async function fetchData() {
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
await http
|
||||||
.get(config.API.requestEdit + `${requestId.value}`)
|
.get(config.API.requestEditByType(dataStore.officerLink) + `${requestId.value}`)
|
||||||
.then((res) => {
|
.then(async (res) => {
|
||||||
const data = res.data.result;
|
const data = await res.data.result;
|
||||||
dataRequest.value = {
|
dataRequest.value = {
|
||||||
fullname: data.fullname,
|
fullname: data.fullname,
|
||||||
createdAt: data.createdAt,
|
createdAt: data.createdAt,
|
||||||
|
|
@ -48,14 +50,14 @@ async function fetchData() {
|
||||||
status: data.status,
|
status: data.status,
|
||||||
remark: data.remark,
|
remark: data.remark,
|
||||||
};
|
};
|
||||||
onDownloadFile(requestId.value); // เช็คว่ามีไฟล์อัปโหลดหรือไม่
|
|
||||||
|
await onDownloadFile(requestId.value); // เช็คว่ามีไฟล์อัปโหลดหรือไม่
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
messageError($q, err);
|
messageError($q, err);
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
hideLoader();
|
hideLoader();
|
||||||
});
|
})
|
||||||
|
.finally(() => {});
|
||||||
}
|
}
|
||||||
|
|
||||||
const checkFile = ref<null | false | "img" | "doc">(null); // เช็คไฟล์อัปโหลด null ค่าเริ่มต้น, false ไม่มีไฟล์, "img" รูปภาพ, "doc" เอกสาร
|
const checkFile = ref<null | false | "img" | "doc">(null); // เช็คไฟล์อัปโหลด null ค่าเริ่มต้น, false ไม่มีไฟล์, "img" รูปภาพ, "doc" เอกสาร
|
||||||
|
|
@ -65,8 +67,8 @@ const urlDownload = ref<string>(""); // url ไฟล์อัปโหลด
|
||||||
* function หาชื่อไฟล์
|
* function หาชื่อไฟล์
|
||||||
* @param id รายการยื่นคำร้องขอแก้ไขข้อมูล
|
* @param id รายการยื่นคำร้องขอแก้ไขข้อมูล
|
||||||
*/
|
*/
|
||||||
function onDownloadFile(id: string) {
|
async function onDownloadFile(id: string) {
|
||||||
http
|
await http
|
||||||
.get(
|
.get(
|
||||||
config.API.file(
|
config.API.file(
|
||||||
"ระบบทะเบียนประวัติ",
|
"ระบบทะเบียนประวัติ",
|
||||||
|
|
@ -79,10 +81,12 @@ function onDownloadFile(id: string) {
|
||||||
await downloadUrl(id, res.data[0].fileName);
|
await downloadUrl(id, res.data[0].fileName);
|
||||||
} else {
|
} else {
|
||||||
checkFile.value = false;
|
checkFile.value = false;
|
||||||
|
hideLoader();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
messageError($q, e);
|
messageError($q, e);
|
||||||
|
hideLoader();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -91,8 +95,8 @@ function onDownloadFile(id: string) {
|
||||||
* @param id รายการยื่นคำร้องขอแก้ไขข้อมูล
|
* @param id รายการยื่นคำร้องขอแก้ไขข้อมูล
|
||||||
* @param fileName ชื่อไฟล์
|
* @param fileName ชื่อไฟล์
|
||||||
*/
|
*/
|
||||||
function downloadUrl(id: string, fileName: string) {
|
async function downloadUrl(id: string, fileName: string) {
|
||||||
http
|
await http
|
||||||
.get(
|
.get(
|
||||||
config.API.fileByFile(
|
config.API.fileByFile(
|
||||||
"ระบบทะเบียนประวัติ",
|
"ระบบทะเบียนประวัติ",
|
||||||
|
|
@ -108,13 +112,13 @@ function downloadUrl(id: string, fileName: string) {
|
||||||
} else {
|
} else {
|
||||||
checkFile.value = "doc";
|
checkFile.value = "doc";
|
||||||
}
|
}
|
||||||
|
hideLoader();
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
messageError($q, e);
|
messageError($q, e);
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
hideLoader();
|
hideLoader();
|
||||||
});
|
})
|
||||||
|
.finally(() => {});
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,11 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted, watch } from "vue";
|
import { ref, onMounted, watch } from "vue";
|
||||||
import { useQuasar } from "quasar";
|
|
||||||
import { useRouter } from "vue-router";
|
|
||||||
import config from "@/app.config";
|
import config from "@/app.config";
|
||||||
import http from "@/plugins/http";
|
import http from "@/plugins/http";
|
||||||
|
import { useDataStore } from "@/stores/data";
|
||||||
|
import { useQuasar } from "quasar";
|
||||||
|
import { useRouter } from "vue-router";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* importType
|
* importType
|
||||||
|
|
@ -32,6 +34,7 @@ import { useCounterMixin } from "@/stores/mixin";
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const store = useRequestEditStore();
|
const store = useRequestEditStore();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const dataStore = useDataStore()
|
||||||
const { showLoader, hideLoader, messageError, dialogRemove, success } =
|
const { showLoader, hideLoader, messageError, dialogRemove, success } =
|
||||||
useCounterMixin();
|
useCounterMixin();
|
||||||
|
|
||||||
|
|
@ -146,7 +149,7 @@ function fetchListRequset() {
|
||||||
};
|
};
|
||||||
showLoader();
|
showLoader();
|
||||||
http
|
http
|
||||||
.get(config.API.requestEdit + `user`, { params: queryParams })
|
.get(config.API.requestEditByType(dataStore.officerLink) + `user`, { params: queryParams })
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
const data = res.data.result;
|
const data = res.data.result;
|
||||||
maxPage.value = Math.ceil(data.total / pageSize.value);
|
maxPage.value = Math.ceil(data.total / pageSize.value);
|
||||||
|
|
@ -369,7 +372,6 @@ onMounted(() => {
|
||||||
map-options
|
map-options
|
||||||
:options="columns"
|
:options="columns"
|
||||||
option-value="name"
|
option-value="name"
|
||||||
|
|
||||||
class="col-xs-12 col-sm-3 col-md-2"
|
class="col-xs-12 col-sm-3 col-md-2"
|
||||||
style="min-width: 140px"
|
style="min-width: 140px"
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,17 @@
|
||||||
import { ref, computed, reactive } from "vue";
|
import { ref, computed, reactive } from "vue";
|
||||||
import { defineStore } from "pinia";
|
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 { useRegistryInFormationStore } from "@/modules/10_registry/store/registry";
|
||||||
|
import { useCounterMixin } from "./mixin";
|
||||||
|
|
||||||
export const useDataStore = defineStore("data", () => {
|
export const useDataStore = defineStore("data", () => {
|
||||||
const storeRegistry = useRegistryInFormationStore();
|
const storeRegistry = useRegistryInFormationStore();
|
||||||
|
const $q = useQuasar();
|
||||||
|
const mixin = useCounterMixin();
|
||||||
|
const { messageError, showLoader, hideLoader } = mixin;
|
||||||
// ref() คือการประกาศ state เหมือน vuex
|
// ref() คือการประกาศ state เหมือน vuex
|
||||||
const formData = reactive<any>({
|
const formData = reactive<any>({
|
||||||
prefix: "",
|
prefix: "",
|
||||||
|
|
@ -85,12 +92,11 @@ export const useDataStore = defineStore("data", () => {
|
||||||
const data = await dataPerson;
|
const data = await dataPerson;
|
||||||
isProbation.value = data.isProbation;
|
isProbation.value = data.isProbation;
|
||||||
officerType.value = data.type;
|
officerType.value = data.type;
|
||||||
officerLink.value = await convertEmType(data.type)
|
officerLink.value = await convertEmType(data.type);
|
||||||
formData.prefix = data.prefix;
|
formData.prefix = data.prefix;
|
||||||
formData.firstName = data.firstName;
|
formData.firstName = data.firstName;
|
||||||
formData.lastName = data.lastName;
|
formData.lastName = data.lastName;
|
||||||
formData.position = data.position;
|
formData.position = data.position;
|
||||||
|
|
||||||
formData.posTypeName = data.posTypeName;
|
formData.posTypeName = data.posTypeName;
|
||||||
formData.posExecutiveName = data.posExecutiveName;
|
formData.posExecutiveName = data.posExecutiveName;
|
||||||
formData.posLevelName = data.posLevelName;
|
formData.posLevelName = data.posLevelName;
|
||||||
|
|
@ -99,6 +105,21 @@ export const useDataStore = defineStore("data", () => {
|
||||||
: "";
|
: "";
|
||||||
storeRegistry.profileId = data.profileId;
|
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 {
|
return {
|
||||||
count,
|
count,
|
||||||
doubleCount,
|
doubleCount,
|
||||||
|
|
@ -119,7 +140,8 @@ export const useDataStore = defineStore("data", () => {
|
||||||
getData,
|
getData,
|
||||||
profileImg,
|
profileImg,
|
||||||
formData,
|
formData,
|
||||||
officerLink
|
officerLink,
|
||||||
|
getProFileType,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue