63 lines
2.1 KiB
Vue
63 lines
2.1 KiB
Vue
<script setup lang="ts">
|
||
/**
|
||
* 模板名称详情:信息展示 + 底栏编辑/删除(禁止抽屉主路径)
|
||
*/
|
||
import { computed, ref } from 'vue'
|
||
import { onLoad, onShow } from '@dcloudio/uni-app'
|
||
|
||
import { deleteupperCamelCase, getupperCamelCaseInfo } from '../api'
|
||
import AppBottomBar from '@/components/AppBottomBar.vue'
|
||
import AppDetailHero from '@/components/AppDetailHero.vue'
|
||
import AppInfoGroup, { type AppInfoRow } from '@/components/AppInfoGroup.vue'
|
||
import AppPageAtmosphere from '@/components/AppPageAtmosphere.vue'
|
||
|
||
const id = ref(0)
|
||
const info = ref<Record<string, any>>({})
|
||
|
||
onLoad((q) => { id.value = Number(q?.id || 0) })
|
||
onShow(async () => {
|
||
if (id.value) info.value = (await getupperCamelCaseInfo(id.value)) || {}
|
||
})
|
||
|
||
const title = computed(() => String(info.value.UNI_TITLE_FIELD || `模板名称#${id.value}`))
|
||
const rows = computed<AppInfoRow[]>(() => [
|
||
// UNI_DETAIL_ROWS
|
||
{ label: '状态', value: Number(info.value.status) === 0 ? '正常' : '禁用' },
|
||
{ label: '创建时间', value: info.value.created_at },
|
||
])
|
||
|
||
function goEdit() {
|
||
uni.navigateTo({ url: `/pages-sub/my-gen/dashCase/pages/form?id=${id.value}` })
|
||
}
|
||
|
||
function onDelete() {
|
||
uni.showModal({
|
||
title: '删除确认',
|
||
content: '确定删除该记录吗?',
|
||
confirmColor: '#ef4444',
|
||
success: async (res) => {
|
||
if (!res.confirm) return
|
||
await deleteupperCamelCase({ ids: [id.value] })
|
||
uni.showToast({ title: '已删除', icon: 'success' })
|
||
setTimeout(() => uni.navigateBack(), 400)
|
||
},
|
||
})
|
||
}
|
||
</script>
|
||
|
||
<template>
|
||
<!-- 氛围壳提供主题作用域 + 背景色斑,玻璃卡的模糊才有内容可透 -->
|
||
<AppPageAtmosphere>
|
||
<view class="nl-page">
|
||
<AppDetailHero
|
||
:title="title"
|
||
:subtitle="String(info.UNI_SUBTITLE_FIELD || '')"
|
||
:status-text="Number(info.status) === 0 ? '正常' : '禁用'"
|
||
:status-type="Number(info.status) === 0 ? 'success' : 'danger'"
|
||
/>
|
||
<AppInfoGroup title="详细信息" :items="rows" />
|
||
<AppBottomBar primary-text="编辑" danger-text="删除" @primary="goEdit" @danger="onDelete" />
|
||
</view>
|
||
</AppPageAtmosphere>
|
||
</template>
|