ออกคำสั่ง ==> fix Columns

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2025-02-25 18:01:14 +07:00
parent 972d66effa
commit 3d527561c5
2 changed files with 26 additions and 8 deletions

View file

@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref, onMounted, reactive } from "vue";
import { ref, onMounted, reactive, computed } from "vue";
import { useQuasar, type QTableProps } from "quasar";
import http from "@/plugins/http";
@ -36,6 +36,7 @@ const props = defineProps({
onCheckChangeData: { type: Function, required: true },
fetchDataCommandList: { type: Function, required: true },
commandSysId: { type: String, required: true },
commandCode: { type: String, required: true },
formCommandList: { type: Object, required: true },
});
@ -64,7 +65,7 @@ const filter = ref<string>("");
const rows = ref<PersonInfo[]>([]);
const rowsMain = ref<PersonInfo[]>([]);
const columns = ref<QTableProps["columns"]>([
const baseColumns = ref<QTableProps["columns"]>([
{
name: "no",
align: "left",
@ -130,8 +131,22 @@ const columns = ref<QTableProps["columns"]>([
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
]);
const columns = computed<QTableProps["columns"]>(() => {
if (
props.commandCode === "C-PM-01" ||
props.commandCode === "C-PM-02" ||
props.commandCode === "C-PM-03" ||
props.commandCode === "C-PM-04"
) {
return baseColumns.value;
} else {
return baseColumns.value?.filter(
(e) => e.name !== "position" && e.name !== "positionType"
);
}
});
const visibleColumns = ref<String[]>([
"no",
"citizenId",
@ -287,6 +302,7 @@ function onSearchData() {
onMounted(async () => {
const promises = [getPersonList()];
console.log(props.commandCode);
if (props.commandSysId) {
promises.push(getCommandSalaryList(props.commandSysId));