Files
ipms-sjy-ui/src/views/crm/product/detail/index.vue

67 lines
1.9 KiB
Vue
Raw Normal View History

2024-01-11 17:51:45 +08:00
<template>
2024-01-27 15:15:07 +08:00
<ProductDetailsHeader :loading="loading" :product="product" @refresh="getProductData(id)" />
2024-01-11 17:51:45 +08:00
<el-col>
<el-tabs>
<el-tab-pane label="详细资料">
2024-01-13 02:04:20 +00:00
<ProductDetailsInfo :product="product" />
2024-01-11 17:51:45 +08:00
</el-tab-pane>
<el-tab-pane label="操作日志">
2024-01-13 02:04:20 +00:00
<OperateLogV2 :log-list="logList" />
2024-01-11 17:51:45 +08:00
</el-tab-pane>
</el-tabs>
</el-col>
</template>
2024-01-27 15:15:07 +08:00
<script lang="ts" setup>
2024-01-13 02:04:20 +00:00
import { useTagsViewStore } from '@/store/modules/tagsView'
import { OperateLogV2VO } from '@/api/system/operatelog'
2024-01-11 17:51:45 +08:00
import * as ProductApi from '@/api/crm/product'
import ProductDetailsHeader from '@/views/crm/product/detail/ProductDetailsHeader.vue'
import ProductDetailsInfo from '@/views/crm/product/detail/ProductDetailsInfo.vue'
2024-01-27 15:15:07 +08:00
import { BizTypeEnum } from '@/api/crm/permission'
import { getOperateLogPage } from '@/api/crm/operateLog'
2024-01-11 17:51:45 +08:00
2024-01-13 02:04:20 +00:00
defineOptions({ name: 'CrmProductDetail' })
2024-01-11 17:51:45 +08:00
const route = useRoute()
2024-01-27 15:15:07 +08:00
const message = useMessage()
2024-01-11 17:51:45 +08:00
const id = Number(route.params.id) // 编号
const loading = ref(true) // 加载中
const product = ref<ProductApi.ProductVO>({} as ProductApi.ProductVO) // 详情
/** 获取详情 */
const getProductData = async (id: number) => {
loading.value = true
try {
product.value = await ProductApi.getProduct(id)
await getOperateLog(id)
} finally {
loading.value = false
}
}
2024-01-13 02:04:20 +00:00
/** 获取操作日志 */
2024-01-11 17:51:45 +08:00
const logList = ref<OperateLogV2VO[]>([]) // 操作日志列表
const getOperateLog = async (productId: number) => {
if (!productId) {
return
}
2024-01-27 15:15:07 +08:00
const data = await getOperateLogPage({
bizType: BizTypeEnum.CRM_PRODUCT,
2024-01-11 17:51:45 +08:00
bizId: productId
})
logList.value = data.list
}
/** 初始化 */
2024-01-13 02:04:20 +00:00
const { delView } = useTagsViewStore() // 视图操作
const { currentRoute } = useRouter() // 路由
2024-01-11 17:51:45 +08:00
onMounted(async () => {
if (!id) {
2024-01-27 15:15:07 +08:00
message.warning('参数错误,产品不能为空!')
2024-01-11 17:51:45 +08:00
delView(unref(currentRoute))
return
}
await getProductData(id)
})
</script>