This commit is contained in:
@@ -10,6 +10,22 @@
|
||||
返回
|
||||
</ElButton>
|
||||
<h2 class="detail-title">资产分配详情</h2>
|
||||
<ElButton
|
||||
v-if="recordAuditTarget && hasAuth(recordAuditPermission)"
|
||||
type="primary"
|
||||
plain
|
||||
@click="openAuditInvestigation(recordAuditTarget)"
|
||||
>
|
||||
{{ userType === 3 ? '活动记录' : '分配审计' }}
|
||||
</ElButton>
|
||||
<ElButton
|
||||
v-if="assetAuditTarget && hasAuth(AUDIT_PERMISSIONS.resourceTimeline)"
|
||||
type="primary"
|
||||
plain
|
||||
@click="openAuditInvestigation(assetAuditTarget)"
|
||||
>
|
||||
资产审计
|
||||
</ElButton>
|
||||
</div>
|
||||
|
||||
<!-- 详情内容 -->
|
||||
@@ -25,7 +41,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { computed, ref, onMounted } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { ElCard, ElButton, ElIcon, ElMessage } from 'element-plus'
|
||||
import { ArrowLeft, Loading } from '@element-plus/icons-vue'
|
||||
@@ -34,14 +50,42 @@
|
||||
import { CardService } from '@/api/modules'
|
||||
import type { AssetAllocationRecord } from '@/types/api/card'
|
||||
import { formatDateTime } from '@/utils/business/format'
|
||||
import { useAuth } from '@/composables/useAuth'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
import { AUDIT_PERMISSIONS } from '@/config/constants/audit'
|
||||
import { resolveAuditResourceTarget } from '@/utils/business/auditNavigation'
|
||||
import { openAuditInvestigation } from '@/components/business/audit/investigationController'
|
||||
|
||||
defineOptions({ name: 'AssetAssignDetail' })
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const { hasAuth } = useAuth()
|
||||
const userStore = useUserStore()
|
||||
|
||||
const loading = ref(false)
|
||||
const detailData = ref<AssetAllocationRecord | null>(null)
|
||||
const userType = computed(() => Number(userStore.info.user_type))
|
||||
const recordAuditPermission = computed(() =>
|
||||
userType.value === 3 ? AUDIT_PERMISSIONS.agentActivity : AUDIT_PERMISSIONS.resourceTimeline
|
||||
)
|
||||
const recordAuditTarget = computed(() => {
|
||||
if (!detailData.value || userType.value === 4) return null
|
||||
return resolveAuditResourceTarget({
|
||||
userType: userType.value,
|
||||
resourceType: 'asset_allocation_record',
|
||||
internalId: detailData.value.id,
|
||||
businessIdentifier: detailData.value.allocation_no
|
||||
})
|
||||
})
|
||||
const assetAuditTarget = computed(() => {
|
||||
if (!detailData.value || ![1, 2].includes(userType.value)) return null
|
||||
return resolveAuditResourceTarget({
|
||||
userType: userType.value,
|
||||
resourceType: detailData.value.asset_type,
|
||||
internalId: detailData.value.asset_id
|
||||
})
|
||||
})
|
||||
|
||||
// 详情页配置
|
||||
const detailSections: DetailSection[] = [
|
||||
|
||||
@@ -28,6 +28,8 @@
|
||||
:pageSize="pagination.pageSize"
|
||||
:total="pagination.total"
|
||||
:marginTop="10"
|
||||
:actions="getActions"
|
||||
:actionsWidth="180"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
>
|
||||
@@ -51,10 +53,15 @@
|
||||
import { formatDateTime } from '@/utils/business/format'
|
||||
import type { AssetAllocationRecord, AllocationTypeEnum, AssetTypeEnum } from '@/types/api/card'
|
||||
import { RoutesAlias } from '@/router/routesAlias'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
import { AUDIT_PERMISSIONS } from '@/config/constants/audit'
|
||||
import { resolveAuditResourceTarget } from '@/utils/business/auditNavigation'
|
||||
import { openAuditInvestigation } from '@/components/business/audit/investigationController'
|
||||
|
||||
defineOptions({ name: 'AssetAllocationRecords' })
|
||||
|
||||
const { hasAuth } = useAuth()
|
||||
const userStore = useUserStore()
|
||||
const router = useRouter()
|
||||
|
||||
const loading = ref(false)
|
||||
@@ -221,6 +228,40 @@
|
||||
|
||||
const recordList = ref<AssetAllocationRecord[]>([])
|
||||
|
||||
const getActions = (row: AssetAllocationRecord) => {
|
||||
const actions: Array<{ label: string; handler: () => void; type: 'primary' }> = []
|
||||
const userType = Number(userStore.info.user_type)
|
||||
const entryPermission =
|
||||
userType === 3 ? AUDIT_PERMISSIONS.agentActivity : AUDIT_PERMISSIONS.resourceTimeline
|
||||
if (!hasAuth(entryPermission) || userType === 4) return actions
|
||||
const recordTarget = resolveAuditResourceTarget({
|
||||
userType,
|
||||
resourceType: 'asset_allocation_record',
|
||||
internalId: row.id,
|
||||
businessIdentifier: row.allocation_no
|
||||
})
|
||||
if (recordTarget)
|
||||
actions.push({
|
||||
label: userType === 3 ? '活动记录' : '分配审计',
|
||||
handler: () => openAuditInvestigation(recordTarget),
|
||||
type: 'primary'
|
||||
})
|
||||
if ([1, 2].includes(userType)) {
|
||||
const assetTarget = resolveAuditResourceTarget({
|
||||
userType,
|
||||
resourceType: row.asset_type,
|
||||
internalId: row.asset_id
|
||||
})
|
||||
if (assetTarget)
|
||||
actions.push({
|
||||
label: '资产审计',
|
||||
handler: () => openAuditInvestigation(assetTarget),
|
||||
type: 'primary'
|
||||
})
|
||||
}
|
||||
return actions
|
||||
}
|
||||
|
||||
// 获取分配类型标签类型
|
||||
const getAllocationTypeType = (type: AllocationTypeEnum) => {
|
||||
return type === 'allocate' ? 'success' : 'warning'
|
||||
|
||||
Reference in New Issue
Block a user