add ui dialog create or select command

This commit is contained in:
Warunee Tamkoo 2024-09-24 11:19:41 +07:00
parent df4cb61671
commit 874cd33e9d
6 changed files with 388 additions and 22 deletions

View file

@ -4,16 +4,19 @@ import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import { useTransferDataStore } from "@/modules/05_placement/store";
import http from "@/plugins/http";
import config from "@/app.config";
import { useCommandMainStore } from "@/modules/18_command/store/Main";
// import http from "@/plugins/http";
// import config from "@/app.config";
import type { QTableProps } from "quasar";
import type { ResponseData } from "@/modules/05_placement/interface/response/Transfer";
import DialogHeader from "@/components/DialogHeader.vue";
import DialogCreateCommand from "@/modules/18_command/components/DialogCreateCommand.vue";
const $q = useQuasar();
const mixin = useCounterMixin();
const stroeCommand = useCommandMainStore();
const { statusText } = useTransferDataStore();
const {
showLoader,
@ -24,16 +27,17 @@ const {
date2Thai,
} = mixin;
const modal = defineModel<boolean>("modal", { required: true });
/**
* props
*/
const props = defineProps({
modal: Boolean,
closeModal: Function,
fetchData: Function,
rows: Array,
});
const modalCommand = ref<boolean>(false); //- modal
//Table
const selected = ref<ResponseData[]>([]); //
const filter = ref<string>(""); //
@ -133,20 +137,23 @@ function saveOrder() {
const body = {
id,
};
showLoader();
await http
.post(config.API.transferReport, body)
.then(async () => {
await props.fetchData?.();
await success($q, "ส่งไปออกคำสั่งสำเร็จ");
props.closeModal?.();
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
modalCommand.value = true;
modal.value = false;
// showLoader();
// await http
// .post(config.API.transferReport, body)
// .then(async () => {
// await props.fetchData?.();
// await success($q, "");
// props.closeModal?.();
// })
// .catch((e) => {
// messageError($q, e);
// })
// .finally(() => {
// hideLoader();
// });
},
"ยืนยันส่งไปออกคำสั่ง",
"ต้องการยืนยันส่งไปออกคำสั่งใช่หรือไม่?"
@ -159,9 +166,9 @@ function saveOrder() {
* กำหนดให selected เปนคาวาง
*/
watch(
() => props.modal,
() => modal.value,
() => {
if (props.modal === true) {
if (modal.value === true) {
selected.value = [];
}
}
@ -275,6 +282,12 @@ watch(
</q-card-actions>
</q-card>
</q-dialog>
<DialogCreateCommand
v-model:modal="modalCommand"
command-type-code="C-PM-13"
:persons-id="selected"
/>
</template>
<style scoped></style>