ขอโอน api ต่อแล้ว,ดาต้ายังไม่ครบ

This commit is contained in:
Thanit Konmek 2023-08-10 17:02:08 +07:00
parent 1cbf5e3f06
commit 6fbc73300c
5 changed files with 307 additions and 277 deletions

View file

@ -35,19 +35,25 @@
<div class="col-xs-6 col-sm-3 row items-center">
<div class="col-12 q-pl-md">
<div class="col-12 text-top">ตำแหนงในสายงาน</div>
<div class="col-12 text-detail">{{ position }}</div>
<div class="col-12 text-detail">
{{ responseData.positionTypeOld }}
</div>
</div>
</div>
<div class="col-xs-6 col-sm-3 row items-center">
<div class="col-12">
<div class="col-12 text-top">ระด</div>
<div class="col-12 text-detail">{{ level }}</div>
<div class="col-12 text-detail">
{{ responseData.positionLevelOld }}
</div>
</div>
</div>
<div class="col-xs-6 col-sm-3 row items-center">
<div class="col-12">
<div class="col-12 text-top">งก</div>
<div class="col-12 text-detail">{{ institution }}</div>
<div class="col-12 text-detail">
{{ responseData.organizationPositionOld }}
</div>
</div>
</div>
</div>
@ -59,16 +65,17 @@
<div class="q-pl-sm text-weight-bold text-dark">อมลการขอโอน</div>
<q-space />
<q-btn
v-if="!roleAdmin"
v-if="!roleAdmin"
outline
color="primary"
dense
icon-right="arrow_forward"
class="q-px-sm"
label="ส่งคำร้องไปยัง สกจ."
@click="confirmMessage"
/>
<q-btn
v-else
v-else
outline
color="primary"
dense
@ -83,13 +90,17 @@
<div class="col-xs-6 col-sm-3 row items-center">
<div class="col-12">
<div class="col-12 text-top">หนวยงานทขอโอนไป</div>
<div class="col-12 text-detail">{{ organization }}</div>
<div class="col-12 text-detail">
{{ responseData.organization }}
</div>
</div>
</div>
<div class="col-xs-6 col-sm-3 row items-center">
<div class="col-12">
<div class="col-12 text-top">เหตผลทขอโอน</div>
<div class="col-12 text-detail">{{ reason }}</div>
<div class="col-12 text-detail">
{{ responseData.reason }}
</div>
</div>
</div>
</div>
@ -102,12 +113,10 @@
</div>
<div class="col-12"><q-separator /></div>
<div class="col-12">
<q-table
flat
bordered
<d-table
:rows="rows"
:columns="columns"
row-key="name"
row-key="fileName"
hide-header
hide-bottom
>
@ -116,40 +125,56 @@
<q-td key="no" :props="props">
{{ props.rowIndex + 1 }}
</q-td>
<q-td key="noteTitle" :props="props">
{{ props.row.noteTitle }}
<q-td key="fileName" :props="props">
{{ props.row.fileName }}
</q-td>
<q-td key="btnMicrosoft" :props="props">
<q-btn flat
dense
round
color="red"
icon="picture_as_pdf">
<q-btn flat dense round color="red" icon="picture_as_pdf">
<q-tooltip>ไฟล PDF</q-tooltip>
</q-btn>
<q-btn flat
dense
round
color="blue"
icon="mdi-file-word">
<q-btn flat dense round color="blue" icon="mdi-file-word">
<q-tooltip>ไฟล WORD</q-tooltip>
</q-btn>
</q-td>
</q-tr>
</template>
</q-table>
</d-table>
</div>
</q-card>
</template>
<script setup lang="ts">
import { useRouter } from "vue-router";
import { onMounted, ref } from "vue";
import { useRoute } from "vue-router";
import { useQuasar } from "quasar";
import { useRoute, useRouter } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
import config from "@/app.config";
import keycloak from "@/plugins/keycloak";
let roleAdmin = ref<boolean>(false);
import type { QTableProps } from "quasar";
import type {
TypeFile,
ResponseDataDetail,
} from "@/modules/05_placement/interface/response/Transfer";
const $q = useQuasar();
const route = useRoute();
const router = useRouter();
const mixin = useCounterMixin();
const personId = route.params.id;
const {
date2Thai,
dialogMessage,
messageError,
showLoader,
hideLoader,
success,
} = mixin;
const roleAdmin = ref<boolean>(false);
const name = ref<string>("นายสมคิด ยอดใจ");
const position = ref<string>("นักจัดการงานทั่วไป");
const level = ref<string>("ชำนาญการพิเศษ");
@ -157,17 +182,23 @@ const institution = ref<string>("ฝ่ายบริหารงานทั
const status = ref<string>("อยู่ระหว่างการทดลองงาน");
const organization = ref<string>("ก.ก.");
const reason = ref<string>("เพราะxxx");
const route = useRoute();
const personId = route.params.id;
const rows = [
{
noteTitle: "ชื่อเอกสาร",
},
{
noteTitle: "ชื่อเอกสาร",
},
];
const columns = [
const responseData = ref<ResponseDataDetail>({
createdAt: new Date(),
date: new Date(),
id: "",
organization: "",
organizationPositionOld: "",
positionLevelOld: "",
positionNumberOld: "",
positionTypeOld: "",
reason: "",
salary: 0,
status: "",
});
const rows = ref<TypeFile[]>([]);
const columns = ref<QTableProps["columns"]>([
{
name: "no",
align: "left",
@ -178,11 +209,11 @@ const columns = [
style: "font-size: 14px",
},
{
name: "noteTitle",
name: "fileName",
align: "left",
label: "ชื่อ-นามสกุล",
label: "ชื่อไฟล์",
sortable: true,
field: "noteTitle",
field: "fileName",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
@ -195,14 +226,84 @@ const columns = [
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
];
]);
onMounted(async () => {
if (keycloak.tokenParsed != null) {
roleAdmin.value = await keycloak.tokenParsed.role.includes("placement1");
console.log("roleAdmin===>", roleAdmin.value);
}
});
roleAdmin.value = await keycloak.tokenParsed.role.includes("placement1");
console.log("roleAdmin===>", roleAdmin.value);
}
await getData();
});
const getData = async () => {
showLoader();
await http
.get(config.API.transferUserId(personId.toString()))
.then((res: any) => {
const data = res.data.result;
// console.log(data);
let list: TypeFile[] = [];
if (data.docs.length > 0) {
data.docs.map((doc: TypeFile) => {
list.push({
pathName: doc.pathName ?? "",
fileName: doc.fileName ?? "",
});
});
rows.value = list;
responseData.value.createdAt = data.createdAt;
responseData.value.date = new Date();
responseData.value.id = data.id ?? "";
responseData.value.organization = data.organization ?? "";
responseData.value.organizationPositionOld =
data.organizationPositionOld ?? "";
responseData.value.positionLevelOld = data.positionLevelOld ?? "";
responseData.value.positionNumberOld = data.positionNumberOld ?? "";
responseData.value.positionTypeOld = data.positionTypeOld ?? "";
responseData.value.reason = data.reason ?? "";
responseData.value.salary = data.salary !== null ? data.salary : 0;
responseData.value.status = data.status ?? "";
}
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
};
const confirmMessage = async () => {
dialogMessage(
$q,
"ต้องการยืนยันส่งคำร้องไปยัง สกจ หรือไม่?",
"ข้อมูลจะถูกนำส่งคำร้องไปยัง สกจ ทันที",
"mdi-help-circle-outline",
"ยืนยัน",
"primary",
() => sendConfirm(),
undefined
);
};
const sendConfirm = async () => {
showLoader();
await http
.get(config.API.transferConfirmId(personId.toString()))
.then((res: any) => {
// const data = res.data.result;
// console.log(data);
success($q, "ส่งคำร้องข้อมูลสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await getData();
hideLoader();
});
};
</script>
<style lang="scss" scope>
.q-img {
@ -217,34 +318,4 @@ onMounted(async () => {
.text-detail {
font-weight: 500;
}
.custom-header-table {
max-height: 64vh;
.q-table tr:nth-child(odd) td {
background: white;
}
.q-table tr:nth-child(even) td {
background: #f8f8f8;
}
.q-table thead tr {
background: #ecebeb;
}
.q-table thead tr th {
position: sticky;
z-index: 1;
}
/* this will be the loading indicator */
.q-table thead tr:last-child th {
/* height of all previous header rows */
top: 48px;
}
.q-table thead tr:first-child th {
top: 0;
}
}
</style>