chore: crm product detail
This commit is contained in:
@@ -1,4 +1,29 @@
|
||||
<script lang="ts" setup></script>
|
||||
<script lang="ts" setup>
|
||||
import type { CrmProductApi } from '#/api/crm/product';
|
||||
|
||||
import { useDescription } from '#/components/description';
|
||||
|
||||
import { useDetailBaseSchema } from '../data';
|
||||
|
||||
defineOptions({ name: 'CrmProductDetailsInfo' });
|
||||
|
||||
defineProps<{
|
||||
product: CrmProductApi.Product; // 产品信息
|
||||
}>();
|
||||
|
||||
const [ProductDescription] = useDescription({
|
||||
componentProps: {
|
||||
title: '基本信息',
|
||||
bordered: false,
|
||||
column: 4,
|
||||
class: 'mx-4',
|
||||
},
|
||||
schema: useDetailBaseSchema(),
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>productInfo</div>
|
||||
<div class="p-4">
|
||||
<ProductDescription :data="product" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
<script lang="ts" setup></script>
|
||||
<template>
|
||||
<div>productList</div>
|
||||
</template>
|
||||
@@ -1,7 +1,94 @@
|
||||
<script lang="ts" setup></script>
|
||||
<script setup lang="ts">
|
||||
import type { CrmProductApi } from '#/api/crm/product';
|
||||
import type { SystemOperateLogApi } from '#/api/system/operate-log';
|
||||
|
||||
import { defineAsyncComponent, onMounted, ref } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
|
||||
import { Page } from '@vben/common-ui';
|
||||
import { useTabs } from '@vben/hooks';
|
||||
|
||||
import { Button, Card, Tabs } from 'ant-design-vue';
|
||||
|
||||
import { getOperateLogPage } from '#/api/crm/operateLog';
|
||||
import { BizTypeEnum } from '#/api/crm/permission';
|
||||
import { getProduct } from '#/api/crm/product';
|
||||
import { useDescription } from '#/components/description';
|
||||
|
||||
import { useDetailSchema } from '../data';
|
||||
|
||||
const ProductDetailsInfo = defineAsyncComponent(
|
||||
() => import('./detail-info.vue'),
|
||||
);
|
||||
|
||||
const OperateLog = defineAsyncComponent(
|
||||
() => import('#/components/operate-log'),
|
||||
);
|
||||
|
||||
const loading = ref(false);
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const tabs = useTabs();
|
||||
|
||||
const productId = ref(0);
|
||||
|
||||
const product = ref<CrmProductApi.Product>({} as CrmProductApi.Product);
|
||||
const productLogList = ref<SystemOperateLogApi.OperateLog[]>([]);
|
||||
|
||||
const [Description] = useDescription({
|
||||
componentProps: {
|
||||
bordered: false,
|
||||
column: 4,
|
||||
class: 'mx-4',
|
||||
},
|
||||
schema: useDetailSchema(),
|
||||
});
|
||||
|
||||
/** 加载详情 */
|
||||
async function loadProductDetail() {
|
||||
loading.value = true;
|
||||
const data = await getProduct(productId.value);
|
||||
const logList = await getOperateLogPage({
|
||||
bizType: BizTypeEnum.CRM_PRODUCT,
|
||||
bizId: productId.value,
|
||||
});
|
||||
productLogList.value = logList.list;
|
||||
product.value = data;
|
||||
loading.value = false;
|
||||
}
|
||||
|
||||
/** 返回列表页 */
|
||||
function handleBack() {
|
||||
tabs.closeCurrentTab();
|
||||
router.push('/crm/product');
|
||||
}
|
||||
// 加载数据
|
||||
onMounted(async () => {
|
||||
productId.value = Number(route.params.id);
|
||||
await loadProductDetail();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<p>待完成</p>
|
||||
</div>
|
||||
<Page auto-content-height :title="product?.name" :loading="loading">
|
||||
<template #extra>
|
||||
<div class="flex items-center gap-2">
|
||||
<Button @click="handleBack"> 返回 </Button>
|
||||
</div>
|
||||
</template>
|
||||
<Card class="min-h-[10%]">
|
||||
<Description :data="product" />
|
||||
</Card>
|
||||
<Card class="mt-4 min-h-[60%]">
|
||||
<Tabs>
|
||||
<Tabs.TabPane tab="详细资料" key="1" :force-render="true">
|
||||
<ProductDetailsInfo :product="product" />
|
||||
</Tabs.TabPane>
|
||||
<Tabs.TabPane tab="操作日志" key="2" :force-render="true">
|
||||
<OperateLog :log-list="productLogList" />
|
||||
</Tabs.TabPane>
|
||||
</Tabs>
|
||||
</Card>
|
||||
</Page>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user