fix ViewCommand

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2025-02-05 15:23:40 +07:00
parent c33ece8586
commit 26a1270dd2
5 changed files with 113 additions and 41 deletions

View file

@ -14,6 +14,7 @@ import type { ResActingPosData } from "@/modules/04_registryPerson/interface/res
import DialogHeader from "@/components/DialogHeader.vue";
import DialogHistory from "@/modules/04_registryPerson/components/detail/GovernmentInformation/05_ActingPosHistory.vue";
import DialogPreviewCommand from "@/modules/18_command/components/DialogPreviewCommand.vue";
const route = useRoute();
const $q = useQuasar();
@ -83,6 +84,15 @@ const columns = ref<QTableProps["columns"]>([
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "refCommandNo",
align: "left",
label: "เลขที่คำสั่ง",
sortable: true,
field: "refCommandNo",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "status",
align: "left",
@ -92,7 +102,7 @@ const columns = ref<QTableProps["columns"]>([
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format(val, row) {
return row.status ? "Active" : "NoActive";
return row.status ? "Active" : "-";
},
},
]);
@ -101,6 +111,7 @@ const visibleColumns = ref<String[]>([
"dateEnd",
"posNo",
"position",
"refCommandNo",
"status",
]);
@ -109,6 +120,11 @@ const isStatusEdit = ref<boolean>(false);
const modal = ref<boolean>(false);
const modalHistory = ref<boolean>(false);
const rowId = ref<string>("");
const modalCommand = ref<boolean>(false);
const command = ref<string>("");
const commandId = ref<string>("");
const formData = reactive<DataActing>({
dateStart: null,
dateEnd: null,
@ -127,6 +143,7 @@ function serchDataTable() {
}
async function fetchData() {
showLoader();
await http
.get(config.API.profileActposition(empType.value, profileId.value))
.then((res) => {
@ -187,6 +204,12 @@ function showHistoryDialog(id: string) {
rowId.value = id;
}
function openViewCommand(data: ResActingPosData) {
command.value = data.refCommandNo;
commandId.value = data.commandId;
modalCommand.value = true;
}
function closeDialogForm() {
modal.value = false;
isStatusEdit.value = false;
@ -318,7 +341,8 @@ onMounted(() => {
flat
dense
round
color="edit"
:color="props.row.commandId ? 'grey-5' : 'edit'"
:disable="props.row.commandId !== null"
icon="edit"
@click.stop.prevent="openEditDialog(props.row)"
>
@ -326,7 +350,19 @@ onMounted(() => {
</q-btn>
</q-td>
<q-td v-for="col in props.cols" :key="col.id">
<div>
<div
v-if="col.name == 'refCommandNo' && props.row.commandId"
@click="col.value ? openViewCommand(props.row) : null"
:class="
col.value
? 'table_ellipsis text-blue cursor-pointer'
: 'table_ellipsis'
"
>
{{ col.value ? col.value : "-" }}
<q-tooltip v-if="col.value">ดูคำสั่ง</q-tooltip>
</div>
<div v-else>
{{ col.value ? col.value : "-" }}
</div>
</q-td>
@ -352,7 +388,8 @@ onMounted(() => {
v-if="
isLeave === false && checkPermission($route)?.attrIsUpdate
"
color="edit"
:color="props.row.commandId ? 'grey-5' : 'edit'"
:disable="props.row.commandId !== null"
icon="edit"
flat
round
@ -393,9 +430,21 @@ onMounted(() => {
</div>
<q-separator />
<div class="row q-pa-sm">
<div class="col-3 text-grey-6 text-weight-medium">
เลขทคำส
</div>
<div
v-if="props.row.commandId"
@click="openViewCommand(props.row)"
class="col-3 text-blue"
>
{{ props.row.refCommandNo }}
<q-tooltip v-if="props.row.commandId">ดูคำสั่ง</q-tooltip>
</div>
<div class="col-3" v-else>-</div>
<div class="col-3 text-grey-6 text-weight-medium">สถานะ</div>
<div class="col-3">
{{ props.row.status ? "Active" : "NoActive" }}
{{ props.row.status ? "Active" : "-" }}
</div>
</div>
<q-separator />
@ -521,6 +570,7 @@ onMounted(() => {
</div>
<div class="col-xs-12 col-sm-6 col-md-6">
<q-checkbox
disable
v-model="formData.status"
label="Active"
keep-color="primary"
@ -539,6 +589,12 @@ onMounted(() => {
</q-dialog>
<DialogHistory v-model:modal="modalHistory" v-model:id="rowId" />
<DialogPreviewCommand
v-model:modal="modalCommand"
v-model:command="command"
v-model:command-id="commandId"
/>
</template>
<style scoped></style>

View file

@ -76,7 +76,7 @@ const columns = ref<QTableProps["columns"]>([
sortable: true,
field: "status",
format(val, row) {
return row.status ? "Active" : "NoActive";
return row.status ? "Active" : "-";
},
headerStyle: "font-size: 14px",
style: "font-size: 14px",

View file

@ -18,6 +18,7 @@ import type {
import DialogHeader from "@/components/DialogHeader.vue";
import DialogHistory from "@/modules/04_registryPerson/components/detail/GovernmentInformation/06_HelpGovernmentHistory.vue";
import DialogPreviewCommand from "@/modules/18_command/components/DialogPreviewCommand.vue";
const route = useRoute();
const $q = useQuasar();
@ -113,6 +114,10 @@ const rowId = ref<string>("");
const modal = ref<boolean>(false);
const modalHistory = ref<boolean>(false);
const modalCommand = ref<boolean>(false);
const command = ref<string>("");
const commandId = ref<string>("");
const formData = reactive<DatAssistance>({
agency: "",
dateStart: null,
@ -134,6 +139,7 @@ function serchDataTable() {
}
async function fetchData() {
showLoader();
await http
.get(config.API.profileAssistance(empType.value, profileId.value))
.then((res) => {
@ -156,15 +162,6 @@ function onSubmit() {
...formData,
profileId: isStatusEdit.value ? undefined : profileId.value,
isUpload: !isStatusEdit.value ? undefined : isUpload.value,
// isUpload: isStatusEdit.value
// ? formData.isUpload
// ? formData.isUpload
// : fileUpload.value
// ? true
// : false
// : fileUpload.value
// ? true
// : false,
};
const method = isStatusEdit.value ? "patch" : "post";
await http[method](
@ -300,6 +297,12 @@ function showHistoryDialog(id: string) {
rowId.value = id;
}
function openViewCommand(data: ResAssistanceData) {
command.value = data.commandNo;
commandId.value = data.commandId;
modalCommand.value = true;
}
function closeDialogForm() {
modal.value = false;
isStatusEdit.value = false;
@ -434,7 +437,8 @@ onMounted(() => {
flat
dense
round
color="edit"
:color="props.row.commandId ? 'grey-5' : 'edit'"
:disable="props.row.commandId !== null"
icon="edit"
@click.stop.prevent="openEditDialog(props.row)"
>
@ -442,7 +446,19 @@ onMounted(() => {
</q-btn>
</q-td>
<q-td v-for="col in props.cols" :key="col.id">
<div>
<div
v-if="col.name == 'commandNo' && props.row.commandId"
@click="col.value ? openViewCommand(props.row) : null"
:class="
col.value
? 'table_ellipsis text-blue cursor-pointer'
: 'table_ellipsis'
"
>
{{ col.value ? col.value : "-" }}
<q-tooltip v-if="col.value">ดูคำสั่ง</q-tooltip>
</div>
<div v-else>
{{ col.value ? col.value : "-" }}
</div>
</q-td>
@ -478,7 +494,8 @@ onMounted(() => {
</q-btn>
<q-btn
v-if="!isLeave && checkPermission($route)?.attrIsUpdate"
color="edit"
:color="props.row.commandId ? 'grey-5' : 'edit'"
:disable="props.row.commandId !== null"
icon="edit"
flat
round
@ -517,7 +534,16 @@ onMounted(() => {
<div class="col-3 text-grey-6 text-weight-medium">
เลขทคำส
</div>
<div class="col-9">
<div
v-if="props.row.commandId"
@click="openViewCommand(props.row)"
class="col-9 text-blue"
>
{{ props.row.commandNo }}
<q-tooltip v-if="props.row.commandId">ดูคำสั่ง</q-tooltip>
</div>
<div class="col-9" v-else>
{{ props.row.commandNo ? props.row.commandNo : "-" }}
</div>
</div>
@ -774,6 +800,12 @@ onMounted(() => {
</q-dialog>
<DialogHistory v-model:modal="modalHistory" v-model:id="rowId" />
<DialogPreviewCommand
v-model:modal="modalCommand"
v-model:command="command"
v-model:command-id="commandId"
/>
</template>
<style scoped></style>