Merge branch 'develop' into warunee-dev
This commit is contained in:
commit
8709f26508
25 changed files with 8170 additions and 6032 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -1,11 +1,18 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, onMounted } from "vue";
|
||||
import type { QTableProps } from "quasar";
|
||||
import { useQuasar } from "quasar";
|
||||
import { useCounterMixin } from '@/stores/mixin'
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
const mixin = useCounterMixin()
|
||||
const { success, messageError,hideLoader,dialogConfirm } = mixin
|
||||
const fileUpload = ref<any>(null);
|
||||
const reason = ref<string>("");
|
||||
const file = ref<string>("");
|
||||
const documentTitle = ref<string>("");
|
||||
|
||||
const $q = useQuasar();
|
||||
const filterKeyword = ref<string>("");
|
||||
const filterDoc = ref<any>(null);
|
||||
|
||||
|
|
@ -45,27 +52,68 @@ const colums2 = ref<QTableProps["columns"]>([
|
|||
sortable: true,
|
||||
},
|
||||
]);
|
||||
const rows2 = ref<any>([
|
||||
{
|
||||
no: "1",
|
||||
fileName: "test1",
|
||||
annotation: "ทดสอบ",
|
||||
file: "",
|
||||
},
|
||||
{
|
||||
no: "2",
|
||||
fileName: "test2",
|
||||
annotation: "ทดสอบ",
|
||||
file: "",
|
||||
},
|
||||
]);
|
||||
const rows2 = ref<any>([]);
|
||||
|
||||
interface TypeData {
|
||||
fileName:string
|
||||
reason:string
|
||||
pathName:string
|
||||
}
|
||||
const props = defineProps({
|
||||
roundId: {
|
||||
type: String,
|
||||
},
|
||||
});
|
||||
onMounted(() => {
|
||||
|
||||
const getRequest = async () => {
|
||||
await http
|
||||
.get(config.API.requestDocNote(props.roundId as string))
|
||||
.then((res:any) =>{
|
||||
console.log(res)
|
||||
const data = res.data.result
|
||||
console.log(data)
|
||||
data.map((item:TypeData) =>{
|
||||
rows2.value.push({
|
||||
fileName:item.fileName,
|
||||
annotation:item.reason,
|
||||
file:item.pathName
|
||||
})
|
||||
|
||||
}
|
||||
)
|
||||
console.log(rows2.value)
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
});
|
||||
}
|
||||
|
||||
const putRequest = () => {
|
||||
const dataAppend = new FormData()
|
||||
dataAppend.append("Name",documentTitle.value)
|
||||
dataAppend.append("Reason",reason.value)
|
||||
dataAppend.append("File",fileUpload.value)
|
||||
http
|
||||
.put(config.API.requestDocNote(props.roundId as string),dataAppend)
|
||||
.then((res) => {
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
documentTitle.value = "";
|
||||
reason.value = "";
|
||||
fileUpload.value = null;
|
||||
getRequest();
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
onMounted(async() => {
|
||||
console.log(props.roundId);
|
||||
await getRequest()
|
||||
});
|
||||
const resetFilterRef = () => {
|
||||
filterKeyword.value = "";
|
||||
|
|
@ -77,6 +125,9 @@ const pagination = ref({
|
|||
page: 1,
|
||||
rowsPerPage: 10,
|
||||
});
|
||||
const save = () => {
|
||||
dialogConfirm($q,()=>putRequest())
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<Transition>
|
||||
|
|
@ -119,6 +170,9 @@ const pagination = ref({
|
|||
hide-bottom-space
|
||||
/>
|
||||
</div>
|
||||
<div class="col-12 flex justify-end">
|
||||
<q-btn label="บันทึก" @click="save" color="public" />
|
||||
</div>
|
||||
<div class="row col-12">
|
||||
<q-space />
|
||||
<q-input
|
||||
|
|
@ -184,10 +238,13 @@ const pagination = ref({
|
|||
{{ props.row.fileName }}
|
||||
</q-td>
|
||||
<q-td key="annotation" :props="props">
|
||||
{{ props.row.annotation }}
|
||||
{{ props.row.annotation !== null ? props.row.annotation:"-"}}
|
||||
</q-td>
|
||||
<q-td auto-width>
|
||||
<q-btn
|
||||
type="a"
|
||||
:href="props.row.file"
|
||||
target="_blank"
|
||||
dense
|
||||
size="14px"
|
||||
flat
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue