API แก้ไขอัตรากำลัง
This commit is contained in:
parent
98bef466d6
commit
e69db49a3f
5 changed files with 118 additions and 36 deletions
|
|
@ -22,6 +22,7 @@ export default {
|
|||
orgPosType: `${orgPos}/type`,
|
||||
orgPosLevel: `${orgPos}/level`,
|
||||
orgPosMaster: `${orgPos}/master`,
|
||||
orgPosMasterById: (id: string) => `${orgPos}/master/${id}`,
|
||||
orgPosMasterList: `${orgPos}/master/list`,
|
||||
orgPosSort: `${orgPos}/sort`,
|
||||
organizationShortName: `${organization}/sort`,
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import type {
|
|||
OptionExecutive,
|
||||
DataPosition,
|
||||
} from "@/modules/02_organizationalNew/interface/response/organizational";
|
||||
import type { FilterMaster } from "@/modules/02_organizationalNew/interface/request/organizational";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
|
|
@ -28,8 +29,11 @@ const props = defineProps({
|
|||
orgLevel: Number,
|
||||
treeId: String,
|
||||
actionType: String,
|
||||
rowId: String,
|
||||
fetchDataTable: Function,
|
||||
});
|
||||
|
||||
const reqMaster = defineModel<FilterMaster>("reqMaster", { required: true });
|
||||
const isReadonly = ref<boolean>(false); // อ่านได้อย่างเดียว
|
||||
const isDisValidate = ref<boolean>(false);
|
||||
|
||||
|
|
@ -216,7 +220,11 @@ async function fetchPosition(id: string) {
|
|||
await http
|
||||
.get(config.API.orgPosPositionById(id))
|
||||
.then((res) => {
|
||||
console.log(res);
|
||||
const data = res.data.result;
|
||||
formData.prefixNo = data.posMasterNoPrefix;
|
||||
formData.positionNo = data.posMasterNo;
|
||||
formData.suffixNo = data.posMasterNoSuffix;
|
||||
rows.value = data.positions;
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
|
|
@ -346,18 +354,42 @@ function onSubmit() {
|
|||
positions: positionsData,
|
||||
};
|
||||
showLoader();
|
||||
await http
|
||||
.post(config.API.orgPosMaster, body)
|
||||
.then((res) => {
|
||||
success($q, "เพิ่มข้อมูลสำเร็จ");
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
props.close?.();
|
||||
hideLoader();
|
||||
});
|
||||
props.actionType === "ADD"
|
||||
? await http
|
||||
.post(config.API.orgPosMaster, body)
|
||||
.then(() => {
|
||||
success($q, "เพิ่มข้อมูลสำเร็จ");
|
||||
props.fetchDataTable?.(
|
||||
reqMaster.value.id,
|
||||
reqMaster.value.type,
|
||||
false
|
||||
);
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
props.close?.();
|
||||
hideLoader();
|
||||
})
|
||||
: props.rowId &&
|
||||
(await http
|
||||
.put(config.API.orgPosMasterById(props.rowId), body)
|
||||
.then(() => {
|
||||
success($q, "แก้ไขข้อมูลสำเร็จ");
|
||||
props.fetchDataTable?.(
|
||||
reqMaster.value.id,
|
||||
reqMaster.value.type,
|
||||
false
|
||||
);
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
props.close?.();
|
||||
hideLoader();
|
||||
}));
|
||||
});
|
||||
}
|
||||
/** ฟังชั่น บันทึก */
|
||||
|
|
@ -411,7 +443,6 @@ async function searchInput() {
|
|||
`?keyword=${search.value}&type=${type.value}`
|
||||
)
|
||||
.then((res) => {
|
||||
console.log(res);
|
||||
rowsPositionSelect.value = res.data.result;
|
||||
})
|
||||
.catch((err) => {
|
||||
|
|
@ -462,7 +493,7 @@ watch(
|
|||
rows.value = [];
|
||||
clearFormPositionSelect();
|
||||
} else {
|
||||
// props.treeId && fetchPosition(props.treeId);
|
||||
props.rowId && fetchPosition(props.rowId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -487,7 +518,7 @@ function deletePos(id: string) {
|
|||
showLoader();
|
||||
http
|
||||
.delete(config.API.orgPosPositionById(id))
|
||||
.then((res) => {
|
||||
.then(() => {
|
||||
success($q, "ลบข้อมูลสำเร็จ");
|
||||
})
|
||||
.catch((err) => {
|
||||
|
|
|
|||
|
|
@ -203,6 +203,7 @@ watch(
|
|||
v-model:reqMaster="reqMaster"
|
||||
v-model:totalPage="totalPage"
|
||||
v-model:posMaster="posMaster"
|
||||
:fetchDataTable="fetchDataTable"
|
||||
:filterKeyword="filterKeyword"
|
||||
/>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, watch } from "vue";
|
||||
import { ref } from "vue";
|
||||
import { useQuasar } from "quasar";
|
||||
import config from "@/app.config";
|
||||
import http from "@/plugins/http";
|
||||
|
||||
/** importType*/
|
||||
import type { QTableProps } from "quasar";
|
||||
|
|
@ -14,11 +17,22 @@ import type { PosMaster2 } from "@/modules/02_organizationalNew/interface/respon
|
|||
import DialogFormPosotion from "@/modules/02_organizationalNew/components/DialogFormPosition.vue";
|
||||
import DialogPositionDetail from "@/modules/02_organizationalNew/components/PositionDetail.vue";
|
||||
import DialogSort from "@/modules/02_organizationalNew/components/DialogSortPosition.vue";
|
||||
|
||||
/** importStore*/
|
||||
import { useOrganizational } from "@/modules/02_organizationalNew/store/organizational";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
||||
const { showLoader, hideLoader, messageError, success, dialogRemove } =
|
||||
useCounterMixin();
|
||||
const $q = useQuasar();
|
||||
|
||||
const props = defineProps({
|
||||
filterKeyword: { type: Function, require: true, default: () => {} },
|
||||
fetchDataTable: {
|
||||
type: Function,
|
||||
require: true,
|
||||
default: () => {},
|
||||
},
|
||||
});
|
||||
|
||||
const dataSort = ref<Array<any>>([]);
|
||||
|
|
@ -35,18 +49,24 @@ const stroe = useOrganizational();
|
|||
const filter = ref<string>("");
|
||||
const actionType = ref<string>("");
|
||||
const listMenu = ref<ListMenu[]>([
|
||||
{
|
||||
label: "ดูรายละเอียด",
|
||||
icon: "mdi-eye",
|
||||
type: "VIEWDETIAL",
|
||||
color: "primary",
|
||||
},
|
||||
{
|
||||
label: "แก้ไข",
|
||||
icon: "edit",
|
||||
type: "EDIT",
|
||||
color: "primary",
|
||||
},
|
||||
{
|
||||
label: "ลบ",
|
||||
icon: "delete",
|
||||
type: "DEL",
|
||||
color: "red",
|
||||
},
|
||||
{
|
||||
label: "ดูรายละเอียด",
|
||||
icon: "mdi-eye",
|
||||
type: "VIEWDETIAL",
|
||||
color: "blue",
|
||||
},
|
||||
]);
|
||||
const document = ref<any>([
|
||||
{
|
||||
|
|
@ -194,7 +214,9 @@ const columnsExpand = ref<QTableProps["columns"]>([
|
|||
]);
|
||||
|
||||
const dialogPosition = ref<boolean>(false);
|
||||
function onClickPosition(type: string) {
|
||||
const rowId = ref<string>("");
|
||||
function onClickPosition(type: string, id: string) {
|
||||
rowId.value = id;
|
||||
actionType.value = type;
|
||||
dialogPosition.value = !dialogPosition.value;
|
||||
}
|
||||
|
|
@ -204,6 +226,24 @@ function onClickViewDetail() {
|
|||
dialogDetail.value = !dialogDetail.value;
|
||||
}
|
||||
|
||||
function onClickDelete(id: string) {
|
||||
dialogRemove($q, async () => {
|
||||
showLoader();
|
||||
await http
|
||||
.delete(config.API.orgPosMasterById(id))
|
||||
.then(() => {
|
||||
success($q, "ลบข้อมูลสำเร็จ");
|
||||
props.fetchDataTable?.(reqMaster.value.id, reqMaster.value.type, false);
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function onClickSort() {
|
||||
modalSort.value = true;
|
||||
}
|
||||
|
|
@ -223,7 +263,7 @@ function updatePagination(newPagination: NewPagination) {
|
|||
dense
|
||||
color="primary"
|
||||
icon="add"
|
||||
@click="onClickPosition('ADD')"
|
||||
@click="onClickPosition('ADD', '')"
|
||||
>
|
||||
<q-tooltip>เพิ่มตำแหน่ง</q-tooltip>
|
||||
</q-btn>
|
||||
|
|
@ -352,7 +392,9 @@ function updatePagination(newPagination: NewPagination) {
|
|||
item.type === 'VIEWDETIAL'
|
||||
? onClickViewDetail()
|
||||
: item.type === 'EDIT'
|
||||
? onClickPosition('EDIT')
|
||||
? onClickPosition('EDIT', props.row.id)
|
||||
: item.type === 'DEL'
|
||||
? onClickDelete(props.row.id)
|
||||
: null
|
||||
"
|
||||
>
|
||||
|
|
@ -466,11 +508,14 @@ function updatePagination(newPagination: NewPagination) {
|
|||
:orgLevel="orgLevel"
|
||||
:treeId="treeId"
|
||||
:actionType="actionType"
|
||||
:rowId="rowId"
|
||||
v-model:reqMaster="reqMaster"
|
||||
:fetchDataTable="props.fetchDataTable"
|
||||
/>
|
||||
|
||||
<!-- รายละเอียดตำแหน่ง -->
|
||||
<DialogPositionDetail v-model:position-detail="dialogDetail" />
|
||||
<DialogSort v-model:sort-position="modalSort"/>
|
||||
<DialogSort v-model:sort-position="modalSort" />
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
|
|||
|
|
@ -246,9 +246,11 @@ onMounted(async () => {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<div class="row q-col-gutter-sm q-pa-sm">
|
||||
<div class="row q-col-gutter-sm q-pa-sm">
|
||||
<div class="col-12">
|
||||
<q-banner class="text-weight-bold text-red-14 bg-red-1 text-center rounded-borders">
|
||||
<q-banner
|
||||
class="text-weight-bold text-red-14 bg-red-1 text-center rounded-borders"
|
||||
>
|
||||
<div class="text-weight-bold">
|
||||
<q-icon name="info_outline" color="red-14" size="24px" />
|
||||
ประกาศเมื่อวันที่ {{ AnnouncementStartDate }} ถึงวันที่
|
||||
|
|
@ -272,7 +274,9 @@ onMounted(async () => {
|
|||
separator
|
||||
>
|
||||
<q-item clickable v-ripple>
|
||||
<q-item-section class="text-grey-9">{{ file.fileName }}</q-item-section>
|
||||
<q-item-section class="text-grey-9">{{
|
||||
file.fileName
|
||||
}}</q-item-section>
|
||||
<q-item-section avatar>
|
||||
<div class="row">
|
||||
<div>
|
||||
|
|
@ -294,7 +298,7 @@ onMounted(async () => {
|
|||
icon="mdi-clipboard-outline"
|
||||
@click="copyLink(file.pathName)"
|
||||
>
|
||||
<q-tooltip>คัดลอกลิ้งค์</q-tooltip>
|
||||
<q-tooltip>คัดลอกลิ้งก์</q-tooltip>
|
||||
</q-btn>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -305,7 +309,9 @@ onMounted(async () => {
|
|||
</div>
|
||||
<div class="col-12">
|
||||
<q-card bordered style="border: 1px solid #d6dee1">
|
||||
<div class="text-weight-medium row col-12 bg-grey-1 q-py-sm q-px-md items-center">
|
||||
<div
|
||||
class="text-weight-medium row col-12 bg-grey-1 q-py-sm q-px-md items-center"
|
||||
>
|
||||
<div>บันทึกแจ้งผลการประกาศคัดเลือก</div>
|
||||
<q-space />
|
||||
<div>
|
||||
|
|
@ -337,9 +343,7 @@ onMounted(async () => {
|
|||
lazy-rules
|
||||
accept=".pdf"
|
||||
:rules="
|
||||
download10Url === ''
|
||||
? [(val) => !!val || 'กรุณาเลือกไฟล์']
|
||||
: []
|
||||
download10Url === '' ? [(val) => !!val || 'กรุณาเลือกไฟล์'] : []
|
||||
"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
|
|
@ -361,7 +365,7 @@ onMounted(async () => {
|
|||
</q-card>
|
||||
</div>
|
||||
|
||||
<div class="col-12" v-if="store.currentStep == 5" >
|
||||
<div class="col-12" v-if="store.currentStep == 5">
|
||||
<div class="q-mr-sm" align="right">
|
||||
<q-btn
|
||||
unelevated
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue