แก้ไข statusText
This commit is contained in:
parent
6ec6e7bd12
commit
2fdd948e8f
2 changed files with 57 additions and 18 deletions
27
src/modules/02_transfer/store.ts
Normal file
27
src/modules/02_transfer/store.ts
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
import { defineStore } from "pinia"
|
||||||
|
|
||||||
|
export const useTransferDataStore = defineStore("transfer", () => {
|
||||||
|
const statusText = (val: string) => {
|
||||||
|
switch (val) {
|
||||||
|
case "WAITTING":
|
||||||
|
return "รอดำเนินการ"
|
||||||
|
case "PENDING":
|
||||||
|
return "เลือกตำแหน่งแล้ว"
|
||||||
|
case "APPROVE":
|
||||||
|
return "อนุมัติ"
|
||||||
|
case "REJECT":
|
||||||
|
return "ไม่อนุมัติ"
|
||||||
|
case "REPORT":
|
||||||
|
return "ส่งรายชื่อไปออกคำสั่ง"
|
||||||
|
case "DONE":
|
||||||
|
return "ออกคำสั่งเสร็จแล้ว"
|
||||||
|
|
||||||
|
default:
|
||||||
|
return "-"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
statusText,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
@ -4,9 +4,12 @@ import { ref, onMounted } from "vue"
|
||||||
import { useQuasar } from "quasar"
|
import { useQuasar } from "quasar"
|
||||||
import { useRouter } from "vue-router"
|
import { useRouter } from "vue-router"
|
||||||
import { useCounterMixin } from "@/stores/mixin"
|
import { useCounterMixin } from "@/stores/mixin"
|
||||||
|
import { useTransferDataStore } from "@/modules/02_transfer/store"
|
||||||
import http from "@/plugins/http"
|
import http from "@/plugins/http"
|
||||||
import config from "@/app.config"
|
import config from "@/app.config"
|
||||||
|
|
||||||
|
const transferData = useTransferDataStore()
|
||||||
|
const { statusText } = transferData
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const $q = useQuasar()
|
const $q = useQuasar()
|
||||||
const mixin = useCounterMixin()
|
const mixin = useCounterMixin()
|
||||||
|
|
@ -22,7 +25,7 @@ const rows = ref<any>([
|
||||||
const initialPagination = ref({
|
const initialPagination = ref({
|
||||||
rowsPerPage: 0,
|
rowsPerPage: 0,
|
||||||
})
|
})
|
||||||
const visibleColumns = ref<String[]>(["no", "date", "position", "noPos", "level", "salary", "transfer", "status"])
|
const visibleColumns = ref<String[]>(["no", "date", "position", "noPos", "level", "salary", "transfer", "statustext"])
|
||||||
|
|
||||||
const columns = ref<QTableProps["columns"]>([
|
const columns = ref<QTableProps["columns"]>([
|
||||||
{
|
{
|
||||||
|
|
@ -89,11 +92,11 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
style: "font-size: 14px",
|
style: "font-size: 14px",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "status",
|
name: "statustext",
|
||||||
align: "left",
|
align: "left",
|
||||||
label: "สถานะ",
|
label: "สถานะ",
|
||||||
sortable: true,
|
sortable: true,
|
||||||
field: "status",
|
field: "statustext",
|
||||||
headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
style: "font-size: 14px; width:10%;",
|
style: "font-size: 14px; width:10%;",
|
||||||
},
|
},
|
||||||
|
|
@ -117,6 +120,7 @@ const fecthListTransfer = async () => {
|
||||||
id: e.id,
|
id: e.id,
|
||||||
date: date2Thai(e.createdAt),
|
date: date2Thai(e.createdAt),
|
||||||
status: e.status,
|
status: e.status,
|
||||||
|
statustext: statusText(e.status),
|
||||||
position: e.organizationPositionOld,
|
position: e.organizationPositionOld,
|
||||||
noPos: e.posNo,
|
noPos: e.posNo,
|
||||||
level: e.positionLevel,
|
level: e.positionLevel,
|
||||||
|
|
@ -165,21 +169,29 @@ const clickBack = () => {
|
||||||
>
|
>
|
||||||
<template #columns="props">
|
<template #columns="props">
|
||||||
<q-tr :props="props" class="cursor-pointer" @click="router.push(`/transfer/` + props.row.id)">
|
<q-tr :props="props" class="cursor-pointer" @click="router.push(`/transfer/` + props.row.id)">
|
||||||
<q-td v-for="col in props.cols" :key="col.name" :props="props">
|
<q-td key="no" :props="props">
|
||||||
<div v-if="col.name == 'no'">
|
{{ props.rowIndex + 1 }}
|
||||||
{{ props.rowIndex + 1 }}
|
</q-td>
|
||||||
</div>
|
<q-td key="date" :props="props">
|
||||||
<div v-else-if="col.name == 'status'">
|
{{ props.row.date }}
|
||||||
<q-icon size="20px" v-if="props.row.status == 'WAITTING'" name="mdi-timer-sand" color="deep-orange">
|
</q-td>
|
||||||
<q-tooltip>รอดำเนินการ</q-tooltip>
|
<q-td key="position" :props="props">
|
||||||
</q-icon>
|
{{ props.row.position }}
|
||||||
<q-icon size="20px" v-else name="mdi-check" color="teal">
|
</q-td>
|
||||||
<q-tooltip>เสร็จสิ้น</q-tooltip>
|
<q-td key="noPos" :props="props">
|
||||||
</q-icon>
|
{{ props.row.noPos }}
|
||||||
</div>
|
</q-td>
|
||||||
<div v-else>
|
<q-td key="level" :props="props">
|
||||||
{{ col.value }}
|
{{ props.row.level }}
|
||||||
</div>
|
</q-td>
|
||||||
|
<q-td key="salary" :props="props">
|
||||||
|
{{ props.row.salary }}
|
||||||
|
</q-td>
|
||||||
|
<q-td key="transfer" :props="props">
|
||||||
|
{{ props.row.transfer }}
|
||||||
|
</q-td>
|
||||||
|
<q-td key="statustext" :props="props">
|
||||||
|
{{ props.row.statustext }}
|
||||||
</q-td>
|
</q-td>
|
||||||
</q-tr>
|
</q-tr>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue