forward to detail
This commit is contained in:
@@ -8,13 +8,22 @@
|
||||
@click="toCustomerDetail"
|
||||
/>
|
||||
<t-cell-group v-entrance-transition="70" v-if="record" title="登记信息" theme="card">
|
||||
<t-cell title="登记事件" :note="record.event?.name || '未知事件'" />
|
||||
<t-cell
|
||||
title="登记事件"
|
||||
:note="record.event?.name || '未知事件'"
|
||||
:arrow="canReadEvent && !!(record.event?.id || record.eventId)"
|
||||
:hover="canReadEvent && !!(record.event?.id || record.eventId)"
|
||||
@click="toEventDetail"
|
||||
/>
|
||||
<t-cell v-if="record.numberValue !== undefined && record.numberValue !== null" title="事件数值" :note="getNumberValueText(record)" />
|
||||
<t-cell v-if="record.pointValue !== undefined && record.pointValue !== null" title="提交积分值" :note="getPointValueText(record.pointValue, pointLedgerChangeType)" />
|
||||
<t-cell v-if="record.earnedPointValue !== undefined && record.earnedPointValue !== null" title="本次积分变化" :note="getPointValueText(record.earnedPointValue, pointLedgerChangeType)" />
|
||||
<t-cell title="登记时间" :note="record.registeredAt ? Time.toPassedDateTime(record.registeredAt) : '-'" />
|
||||
<t-cell title="登记时间">
|
||||
<template #note>
|
||||
<pass-time-label :timestamp="record.registeredAt" underline />
|
||||
</template>
|
||||
</t-cell>
|
||||
<t-cell title="登记人" :note="Text.display(record.operator?.nick || record.operator?.name)" />
|
||||
<t-cell title="客户编码" :note="Text.display(record.customer?.code)" />
|
||||
<t-cell title="备注" :note="Text.display(record.remark)" />
|
||||
</t-cell-group>
|
||||
<div v-if="record" class="photo-wrapper" v-entrance-transition="140">
|
||||
@@ -33,7 +42,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Text, Time } from "timi-web";
|
||||
import { PassTimeLabel, Text } from "timi-web";
|
||||
import { useUserStore, type Attachment } from "timi-web-api";
|
||||
import EventRecordAPI from "@/api/EventRecordAPI";
|
||||
import CustomerProfileCard from "@/components/CustomerProfileCard.vue";
|
||||
@@ -61,6 +70,7 @@ const record = ref<EventRecord>();
|
||||
const isLoading = ref(false);
|
||||
|
||||
const canUpdateRecord = computed(() => userStore.hasPermissions(permissionCodes.eventRecord.update));
|
||||
const canReadEvent = computed(() => userStore.hasPermissions(permissionCodes.event.read));
|
||||
const recordPhotoItemList = computed(() => (record.value?.attachmentList || [])
|
||||
.filter(item => !!item.id)
|
||||
.map(item => ({
|
||||
@@ -170,6 +180,29 @@ async function toCustomerDetail(): Promise<void> {
|
||||
await router.push(`/management/customers/${customerId}`);
|
||||
}
|
||||
|
||||
async function toEventDetail(): Promise<void> {
|
||||
const eventId = record.value?.event?.id || record.value?.eventId;
|
||||
if (!canReadEvent.value || !eventId) {
|
||||
return;
|
||||
}
|
||||
await router.push({
|
||||
name: "EventDetail",
|
||||
params: { id: eventId },
|
||||
query: { transitionDepth: String(getCurrentRouteDepth() + 1) }
|
||||
});
|
||||
}
|
||||
|
||||
function getCurrentRouteDepth(): number {
|
||||
const transitionDepth = Array.isArray(route.query.transitionDepth)
|
||||
? route.query.transitionDepth[0]
|
||||
: route.query.transitionDepth;
|
||||
const depth = Number(transitionDepth);
|
||||
if (transitionDepth && Number.isInteger(depth) && 0 <= depth && depth <= 20) {
|
||||
return depth;
|
||||
}
|
||||
return Number(route.meta.depth ?? 0);
|
||||
}
|
||||
|
||||
watch(() => route.params.id, async () => {
|
||||
await loadRecord();
|
||||
}, { immediate: true });
|
||||
|
||||
Reference in New Issue
Block a user