Merge branch 'develop' into dev
All checks were successful
Build & Deploy on Dev / build (push) Successful in 3m5s

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2026-02-11 16:52:12 +07:00
commit ae016af9cc
6 changed files with 55 additions and 13 deletions

View file

@ -2881,6 +2881,7 @@ onMounted(async () => {
? probationStore.dataPermissions?.tab1.isEdit
: false
"
:is-delete-file="true"
/>
</div>
</div>

View file

@ -1094,6 +1094,7 @@ onMounted(async () => {
? probationStore.dataPermissions?.tab4.isEdit
: false
"
:is-delete-file="true"
/>
<!-- <Footer /> -->

View file

@ -1410,6 +1410,7 @@ onMounted(async () => {
: false
"
v-model:is-check-file="isCheckFile"
:is-delete-file="true"
/>
<q-toolbar

View file

@ -1270,6 +1270,7 @@ onMounted(async () => {
? probationStore.dataPermissions?.tab2.isEdit
: false
"
:is-delete-file="true"
/>
<q-toolbar

View file

@ -524,7 +524,10 @@ onMounted(async () => {
</q-btn-group>
</q-item-section>
</q-item>
<q-separator class="q-my-xs" v-if="i + 1 < list1_1.length" />
<q-separator
class="q-my-xs"
v-if="Number(i) + 1 < list1_1.length"
/>
</q-list>
</q-card>
</div>
@ -1281,6 +1284,7 @@ onMounted(async () => {
? probationStore.dataPermissions?.tab3.isEdit
: false
"
:is-delete-file="true"
/>
<q-toolbar

View file

@ -1,30 +1,27 @@
<script setup lang="ts">
import { onMounted, ref } from "vue";
import { onMounted, ref, computed } from "vue";
import { useQuasar } from "quasar";
import axios from "axios";
import { useRoute } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
import { checkPermission } from "@/utils/permissions";
import http from "@/plugins/http";
import config from "@/app.config";
const $q = useQuasar();
const route = useRoute();
const mixin = useCounterMixin();
const {
messageError,
date2Thai,
showLoader,
hideLoader,
success,
dialogConfirm,
dialogRemove,
} = mixin;
const { messageError, showLoader, hideLoader, success, dialogRemove } = mixin;
const group = defineModel<string>("group", { required: true });
const isCheckFile = defineModel<boolean>("isCheckFile", { required: true });
const round = defineModel<string>("round", { default: "" });
const passResult = defineModel<number>("passResult", { default: 0 });
const isDeleteFile = defineModel<boolean>("isDeleteFile", {
required: false,
default: false,
});
const checkRoutePermisson = defineModel<boolean>("checkRoutePermisson", {
required: true,
@ -37,6 +34,15 @@ const assignId = ref<string>(route.params.form as string);
const file = ref<any>();
const dataDownload = ref<any>();
const isCanDeleteFile = computed(() => {
return (
isDeleteFile.value &&
checkPermission(route)?.attrIsDelete &&
dataPermissions.value &&
checkRoutePermisson.value
);
});
function onUploadFiles() {
showLoader();
http
@ -95,7 +101,7 @@ async function uploadFileURL(uploadUrl: string) {
/** function เช็คไฟล์*/
async function fetchCheckfile() {
isCheckFile.value = false;
http
await http
.get(config.API.file("ทดลองงาน", group.value, assignId.value))
.then(async (res) => {
if (res.data.length >= 1) {
@ -135,6 +141,25 @@ async function onUpdateStatusAssign() {
});
}
function onDeleteFile() {
dialogRemove($q, async () => {
const fileName = dataDownload.value.fileName; //
try {
showLoader();
await http.delete(
config.API.fileByFile("ทดลองงาน", group.value, assignId.value, fileName)
);
await fetchCheckfile();
success($q, `ลบไฟล์สำเร็จ`);
} catch (e) {
messageError($q, e);
} finally {
hideLoader();
}
});
}
onMounted(() => {
fetchCheckfile();
});
@ -179,13 +204,22 @@ onMounted(() => {
</div>
</div>
<div class="col-12" v-if="isCheckFile">
<div class="col-12 q-gutter-sm" v-if="isCheckFile">
<q-btn
color="primary"
icon="mdi-download"
label="ดาวน์โหลดไฟล์"
@click="onDownloadFile"
/>
<q-btn
v-if="isCanDeleteFile"
color="red"
icon="mdi-delete"
@click="onDeleteFile"
>
<q-tooltip>ลบไฟล</q-tooltip>
</q-btn>
</div>
</template>