Merge branch 'develop' into nice_dev
# Conflicts: # src/api/11_discipline/api.discipline.ts
This commit is contained in:
parent
73a0384fa8
commit
eafbc65bf2
6 changed files with 104 additions and 28 deletions
|
|
@ -244,6 +244,7 @@ watch(
|
|||
:on-submit="onSubmit"
|
||||
:data="data"
|
||||
@submit:disciplinary="onSubmitDisciplinary"
|
||||
:fetchData="fetchDetailDisciplinary"
|
||||
/>
|
||||
</q-tab-panel>
|
||||
</q-tab-panels>
|
||||
|
|
|
|||
|
|
@ -204,6 +204,10 @@ const props = defineProps({
|
|||
type: Function,
|
||||
default: () => "",
|
||||
},
|
||||
fetchData: {
|
||||
type: Function,
|
||||
default: () => "",
|
||||
},
|
||||
});
|
||||
const emit = defineEmits(["submit:disciplinary"]);
|
||||
|
||||
|
|
@ -890,7 +894,10 @@ onMounted(async () => {
|
|||
label="ระดับโทษความผิด"
|
||||
:rules="[(val) => !!val || `${'กรุณาเลือกระดับโทษความผิด'}`]"
|
||||
lazy-rules
|
||||
/>
|
||||
group-label="group"
|
||||
group-values="options"
|
||||
>
|
||||
</q-select>
|
||||
|
||||
<q-input
|
||||
class="col-xs-12 col-sm-3"
|
||||
|
|
@ -983,24 +990,32 @@ onMounted(async () => {
|
|||
label="ไฟล์เอกสารหลักฐานสรุปพยานหลักฐานสนับสนุนข้อกล่าวหา"
|
||||
:files="disciplineDisciplinary_DocSummaryEvidences"
|
||||
:id="id"
|
||||
type="summaryEvidence"
|
||||
:fetchData="props.fetchData"
|
||||
/>
|
||||
<UploadFile
|
||||
title="อัปโหลดบันทึกถ้อยคำของผู้กล่าวหา"
|
||||
label="ไฟล์เอกสารบันทึกถ้อยคำของผู้กล่าวหา"
|
||||
:files="disciplineDisciplinary_DocRecordAccusers"
|
||||
:id="id"
|
||||
type="recordAccuser"
|
||||
:fetchData="props.fetchData"
|
||||
/>
|
||||
<UploadFile
|
||||
title="อัปโหลดพยานและการบันทึกถ้อยคำ"
|
||||
label="ไฟล์เอกสารพยานและการบันทึกถ้อยคำ"
|
||||
:files="disciplineDisciplinary_DocWitnessess"
|
||||
:id="id"
|
||||
type="witnesses"
|
||||
:fetchData="props.fetchData"
|
||||
/>
|
||||
<UploadFile
|
||||
title="อัปโหลดไฟล์เอกสารหลักฐานอื่น ๆ"
|
||||
label="ไฟล์เอกสารหลักฐานอื่น ๆ"
|
||||
:files="disciplineDisciplinary_DocOthers"
|
||||
:id="id"
|
||||
type="other"
|
||||
:fetchData="props.fetchData"
|
||||
/>
|
||||
</div>
|
||||
</form>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,18 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, watch } from "vue";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import { useQuasar } from "quasar";
|
||||
|
||||
import type { FileLists } from "@/modules/11_discipline/interface/index/Main";
|
||||
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
||||
const $q = useQuasar();
|
||||
|
||||
const mixin = useCounterMixin();
|
||||
const { showLoader, hideLoader, success, messageError } = mixin;
|
||||
|
||||
const fileRef = ref<Object | null>(null);
|
||||
const file = ref<any>();
|
||||
|
||||
|
|
@ -28,32 +39,61 @@ const props = defineProps({
|
|||
required: true,
|
||||
default: "support",
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
fetchData: {
|
||||
type: Function,
|
||||
default: () => "",
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
* อัปโหลดหลักฐานสนับสนุนข้อกล่าวหา
|
||||
*/
|
||||
function uploadFile() {
|
||||
async function uploadFile() {
|
||||
console.log("test");
|
||||
|
||||
// const Data = new FormData();
|
||||
// Data.append("file", file.value);
|
||||
// showLoader();
|
||||
// http
|
||||
// .put(config.API.complaintFileUpload(props.id), Data)
|
||||
// .then((res) => {
|
||||
// console.log(res);
|
||||
// success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
// })
|
||||
// .catch((e) => {
|
||||
// messageError($q, e);
|
||||
// })
|
||||
// .finally(async () => {
|
||||
// hideLoader();
|
||||
// });
|
||||
const Data = new FormData();
|
||||
Data.append("file", file.value);
|
||||
showLoader();
|
||||
await http
|
||||
.put(config.API.disciplineDoc(props.type, props.id), Data)
|
||||
.then(() => {
|
||||
file.value = null;
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
props.fetchData();
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
function removeFile(id: string) {
|
||||
console.log(id);
|
||||
async function removeFile(id: string) {
|
||||
showLoader();
|
||||
await http
|
||||
.delete(config.API.disciplineByIdDoc(props.type, props.id, id))
|
||||
.then(() => {
|
||||
success($q, "ลบข้อมูลสำเร็จ");
|
||||
props.fetchData();
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* เปิดลิงค์ไฟล์
|
||||
* @param link รับมาเป็น https ลิงค์
|
||||
*/
|
||||
function downloadFile(link: string) {
|
||||
window.open(link, "_blank");
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
@ -122,7 +162,7 @@ function removeFile(id: string) {
|
|||
size="12px"
|
||||
color="blue"
|
||||
icon="mdi-download-outline"
|
||||
@href="f.pathName"
|
||||
@click="downloadFile(f.pathName)"
|
||||
>
|
||||
<q-tooltip>ดาวน์โหลดเอกสาร</q-tooltip>
|
||||
</q-btn>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue