优化估值审核页面功能
This commit is contained in:
parent
106472944b
commit
bd76792ec9
@ -34,7 +34,6 @@ const statusOptions = [
|
||||
{ label: '全部', value: '' },
|
||||
{ label: '待审核', value: 'pending' },
|
||||
{ label: '已完成', value: 'approved' },
|
||||
{ label: '已拒绝', value: 'rejected' },
|
||||
]
|
||||
|
||||
const {
|
||||
@ -67,6 +66,13 @@ const approvalForm = ref({
|
||||
})
|
||||
const approvalFormRef = ref(null)
|
||||
|
||||
// 文案设置弹窗
|
||||
const contentModalVisible = ref(false)
|
||||
const contentForm = ref({
|
||||
content: '',
|
||||
})
|
||||
const contentFormRef = ref(null)
|
||||
|
||||
onMounted(() => {
|
||||
$table.value?.handleSearch()
|
||||
})
|
||||
@ -76,7 +82,6 @@ const renderStatus = (status) => {
|
||||
const statusMap = {
|
||||
pending: { type: 'warning', text: '待审核' },
|
||||
approved: { type: 'success', text: '已完成' },
|
||||
rejected: { type: 'error', text: '已拒绝' },
|
||||
}
|
||||
const config = statusMap[status] || { type: 'default', text: '未知' }
|
||||
return h(NTag, { type: config.type }, { default: () => config.text })
|
||||
@ -148,28 +153,25 @@ const columns = [
|
||||
{
|
||||
title: '操作',
|
||||
key: 'actions',
|
||||
width: 150,
|
||||
width: 120,
|
||||
align: 'center',
|
||||
fixed: 'right',
|
||||
render(row) {
|
||||
return [
|
||||
// 审核按钮 - 仅待审核状态显示
|
||||
row.status === 'pending' &&
|
||||
h(
|
||||
NButton,
|
||||
{
|
||||
size: 'small',
|
||||
type: 'primary',
|
||||
style: 'margin-right: 8px;',
|
||||
onClick: () => handleApprove(row),
|
||||
},
|
||||
{
|
||||
default: () => '审核',
|
||||
icon: renderIcon('mdi:check-circle-outline', { size: 16 }),
|
||||
}
|
||||
),
|
||||
// 查看按钮
|
||||
h(
|
||||
if (row.status === 'pending') {
|
||||
return h(
|
||||
NButton,
|
||||
{
|
||||
size: 'small',
|
||||
type: 'primary',
|
||||
onClick: () => handleApprove(row),
|
||||
},
|
||||
{
|
||||
default: () => '审核',
|
||||
icon: renderIcon('mdi:check-circle-outline', { size: 16 }),
|
||||
}
|
||||
)
|
||||
} else if (row.status === 'approved') {
|
||||
return h(
|
||||
NButton,
|
||||
{
|
||||
size: 'small',
|
||||
@ -180,8 +182,9 @@ const columns = [
|
||||
default: () => '查看',
|
||||
icon: renderIcon('mdi:eye-outline', { size: 16 }),
|
||||
}
|
||||
),
|
||||
]
|
||||
)
|
||||
}
|
||||
return null
|
||||
},
|
||||
},
|
||||
]
|
||||
@ -199,12 +202,33 @@ function handleApprove(row) {
|
||||
|
||||
// 查看详情
|
||||
function handleView(row) {
|
||||
handleEdit(row)
|
||||
console.log('查看详情', row)
|
||||
}
|
||||
|
||||
// 提交审核
|
||||
async function submitApproval(action) {
|
||||
// 打开文案设置弹窗
|
||||
function handleAddContent() {
|
||||
contentForm.value = {
|
||||
content: '',
|
||||
}
|
||||
contentModalVisible.value = true
|
||||
}
|
||||
|
||||
// 保存文案设置
|
||||
function handleContentSave() {
|
||||
contentFormRef.value?.validate((errors) => {
|
||||
if (!errors) {
|
||||
console.log('保存文案设置', contentForm.value)
|
||||
// 这里可以调用API保存文案
|
||||
contentModalVisible.value = false
|
||||
$message.success('文案设置保存成功')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 审核处理
|
||||
async function handleApprovalSubmit(action) {
|
||||
try {
|
||||
approvalForm.value.action = action
|
||||
await approvalFormRef.value?.validate()
|
||||
|
||||
const apiCall = action === 'approve' ? api.approveValuation : api.rejectValuation
|
||||
@ -233,6 +257,16 @@ const approvalRules = {
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
const contentRules = {
|
||||
content: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入文案内容',
|
||||
trigger: ['input', 'blur'],
|
||||
},
|
||||
],
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@ -296,6 +330,13 @@ const approvalRules = {
|
||||
/>
|
||||
</QueryBarItem>
|
||||
</template>
|
||||
|
||||
<template #action>
|
||||
<NButton type="primary" @click="handleAddContent">
|
||||
<TheIcon icon="mdi:plus" :size="18" class="mr-5" />
|
||||
新增文案设置
|
||||
</NButton>
|
||||
</template>
|
||||
</CrudTable>
|
||||
|
||||
<!-- 查看详情弹窗 -->
|
||||
@ -375,13 +416,13 @@ const approvalRules = {
|
||||
</NFormItem>
|
||||
<NFormItem>
|
||||
<NSpace>
|
||||
<NButton type="success" @click="submitApproval('approve')">
|
||||
<NButton type="success" @click="handleApprovalSubmit('approve')">
|
||||
<template #icon>
|
||||
<TheIcon icon="mdi:check-circle-outline" :size="16" />
|
||||
</template>
|
||||
通过
|
||||
</NButton>
|
||||
<NButton type="error" @click="submitApproval('reject')">
|
||||
<NButton type="error" @click="handleApprovalSubmit('reject')">
|
||||
<template #icon>
|
||||
<TheIcon icon="mdi:close-circle-outline" :size="16" />
|
||||
</template>
|
||||
@ -392,5 +433,38 @@ const approvalRules = {
|
||||
</NFormItem>
|
||||
</NForm>
|
||||
</CrudModal>
|
||||
|
||||
<!-- 文案设置弹窗 -->
|
||||
<CrudModal
|
||||
v-model:visible="contentModalVisible"
|
||||
title="新增文案设置"
|
||||
:show-footer="false"
|
||||
>
|
||||
<NForm
|
||||
ref="contentFormRef"
|
||||
label-placement="left"
|
||||
label-align="left"
|
||||
:label-width="80"
|
||||
:model="contentForm"
|
||||
:rules="contentRules"
|
||||
>
|
||||
<NFormItem label="文案" path="content">
|
||||
<NInput
|
||||
v-model:value="contentForm.content"
|
||||
type="textarea"
|
||||
:rows="6"
|
||||
placeholder="请输入文案内容"
|
||||
/>
|
||||
</NFormItem>
|
||||
<NFormItem>
|
||||
<NSpace>
|
||||
<NButton type="primary" @click="handleContentSave">
|
||||
保存
|
||||
</NButton>
|
||||
<NButton @click="contentModalVisible = false">取消</NButton>
|
||||
</NSpace>
|
||||
</NFormItem>
|
||||
</NForm>
|
||||
</CrudModal>
|
||||
</CommonPage>
|
||||
</template>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user