บรรจุ แต่งตั้ง ย้าย โอน => ปรับ code และ load
This commit is contained in:
parent
9f4aeec575
commit
34dc306288
30 changed files with 1154 additions and 1429 deletions
|
|
@ -1,35 +1,30 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, computed, watchEffect } from "vue";
|
||||
import { ref, computed, watchEffect, watch } from "vue";
|
||||
import { useQuasar } from "quasar";
|
||||
import type { QTableProps } from "quasar";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
/**
|
||||
* importComponents
|
||||
*/
|
||||
import DialogHeader from "@/components/DialogHeader.vue";
|
||||
|
||||
/**
|
||||
* importStore
|
||||
*/
|
||||
import { useTransferDataStore } from "@/modules/05_placement/store";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
const storeFn = useTransferDataStore();
|
||||
|
||||
const { statusText } = storeFn;
|
||||
const mixin = useCounterMixin();
|
||||
const {
|
||||
showLoader,
|
||||
success,
|
||||
messageError,
|
||||
dialogConfirm,
|
||||
findOrgName,
|
||||
date2Thai,
|
||||
} = mixin;
|
||||
|
||||
const $q = useQuasar();
|
||||
const selected = ref<any>([]);
|
||||
const checkSelected = computed(() => {
|
||||
if (selected.value.length === 0 || props.type === "") {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
const storeFn = useTransferDataStore();
|
||||
const { statusText } = storeFn;
|
||||
const { showLoader, success, messageError, dialogConfirm, date2Thai } =
|
||||
useCounterMixin();
|
||||
|
||||
/**
|
||||
* props
|
||||
*/
|
||||
const props = defineProps({
|
||||
Modal: Boolean,
|
||||
clickClose: Function,
|
||||
|
|
@ -40,6 +35,22 @@ const props = defineProps({
|
|||
filterKeyword2: String,
|
||||
type: String,
|
||||
});
|
||||
const emit = defineEmits([
|
||||
"update:filterKeyword2",
|
||||
"update:type",
|
||||
"update:selected",
|
||||
]);
|
||||
|
||||
const selected = ref<any>([]);
|
||||
const checkSelected = computed(() => {
|
||||
if (selected.value.length === 0 || props.type === "") {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Table
|
||||
*/
|
||||
const visibleColumns2 = ref<string[]>([
|
||||
"no",
|
||||
"fullname",
|
||||
|
|
@ -120,57 +131,67 @@ const columns2 = ref<QTableProps["columns"]>([
|
|||
format: (val) => statusText(val),
|
||||
},
|
||||
]);
|
||||
const emit = defineEmits([
|
||||
"update:filterKeyword2",
|
||||
"update:type",
|
||||
"update:selected",
|
||||
]);
|
||||
const updateInput = (value: any) => {
|
||||
|
||||
/**
|
||||
* update filter
|
||||
*/
|
||||
function updateInput(value: any) {
|
||||
emit("update:filterKeyword2", value);
|
||||
};
|
||||
}
|
||||
|
||||
const updateInputType = (value: any) => {
|
||||
/**
|
||||
* update ประเภทคำสั่ง
|
||||
*/
|
||||
function updateInputType(value: any) {
|
||||
emit("update:type", value);
|
||||
};
|
||||
//รีเซ็ตค่าในช่องค้นหา
|
||||
const Reset = () => {
|
||||
emit("update:filterKeyword2", "");
|
||||
};
|
||||
//เปิด modal ยืนยัน
|
||||
const clickAddlist = () => {
|
||||
dialogConfirm($q, () => addOther());
|
||||
};
|
||||
}
|
||||
|
||||
//อัพเดต ส่งไปออกคำสั่ง
|
||||
const addOther = async () => {
|
||||
let pId: string[] = [];
|
||||
let Type = props.type as string;
|
||||
selected.value.forEach((e: any) => {
|
||||
pId.push(e.id);
|
||||
});
|
||||
let data = {
|
||||
id: pId,
|
||||
};
|
||||
showLoader();
|
||||
await http
|
||||
.put(config.API.otherReport(Type), data)
|
||||
.then(() => {
|
||||
success($q, "บันทึกสำเร็จ");
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
props.fecthlistOthet?.();
|
||||
selected.value = [];
|
||||
props.clickClose?.();
|
||||
/**
|
||||
* รีเซ็ตค่าในช่องค้นหา
|
||||
*/
|
||||
function Reset() {
|
||||
emit("update:filterKeyword2", "");
|
||||
}
|
||||
|
||||
/**
|
||||
* ยืนยันการส่งไปออกคำสั่ง
|
||||
*/
|
||||
function clickAddlist() {
|
||||
dialogConfirm($q, async () => {
|
||||
let pId: string[] = [];
|
||||
let Type = props.type as string;
|
||||
selected.value.forEach((e: any) => {
|
||||
pId.push(e.id);
|
||||
});
|
||||
};
|
||||
watchEffect(() => {
|
||||
if (props.Modal === true) {
|
||||
selected.value = [];
|
||||
let data = {
|
||||
id: pId,
|
||||
};
|
||||
showLoader();
|
||||
await http
|
||||
.put(config.API.otherReport(Type), data)
|
||||
.then(() => {
|
||||
success($q, "บันทึกสำเร็จ");
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
props.fecthlistOthet?.();
|
||||
selected.value = [];
|
||||
props.clickClose?.();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
watch(
|
||||
() => props.Modal,
|
||||
() => {
|
||||
if (props.Modal === true) {
|
||||
selected.value = [];
|
||||
}
|
||||
}
|
||||
});
|
||||
);
|
||||
|
||||
// filter OptionsType
|
||||
const OptionsTypeFn = ref<any>([]);
|
||||
function filterFnOptionsType(val: string, update: any) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue