Skip to content

Commit c1f507b

Browse files
committed
✨ CRM:完善合同的审批逻辑
1 parent 9acd01e commit c1f507b

File tree

4 files changed

+34
-6
lines changed

4 files changed

+34
-6
lines changed

src/router/modules/remaining.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,18 @@ const remainingRouter: AppRouteRecordRaw[] = [
539539
},
540540
component: () => import('@/views/crm/contract/detail/index.vue')
541541
},
542+
{
543+
path: 'contract/detail',
544+
name: 'CrmContractDetail2', // 特殊:用于适配 BPM 打开详情
545+
meta: {
546+
title: '合同详情XXX',
547+
noCache: true,
548+
hidden: true,
549+
canTo: true,
550+
activeMenu: '/crm/contract'
551+
},
552+
component: () => import('@/views/crm/contract/detail/index.vue')
553+
},
542554
{
543555
path: 'contact/detail/:id',
544556
name: 'CrmContactDetail',

src/views/crm/contract/detail/ContractDetailsHeader.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
{{ erpPriceInputFormatter(contract.totalPrice) }}
2525
</el-descriptions-item>
2626
<el-descriptions-item label="下单时间">
27-
{{ contract.orderDate ? formatDate(contract.orderDate) : '空' }}
27+
{{ formatDate(contract.orderDate) }}
2828
</el-descriptions-item>
2929
<!-- TODO 芋艿:回款金额 -->
3030
<el-descriptions-item label="回款金额(元)"> 待实现 </el-descriptions-item>
@@ -37,7 +37,7 @@
3737
<script lang="ts" setup>
3838
import * as ContractApi from '@/api/crm/contract'
3939
import { formatDate } from '@/utils/formatTime'
40-
import { erpPriceInputFormatter, floatToFixed2 } from '@/utils'
40+
import { erpPriceInputFormatter } from '@/utils'
4141
4242
defineOptions({ name: 'ContractDetailsHeader' })
4343
defineProps<{ contract: ContractApi.ContractVO }>()

src/views/crm/contract/detail/index.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@
4343
import { useTagsViewStore } from '@/store/modules/tagsView'
4444
import { OperateLogV2VO } from '@/api/system/operatelog'
4545
import * as ContractApi from '@/api/crm/contract'
46-
import ContractDetailsHeader from './ContractDetailsHeader.vue'
4746
import ContractDetailsInfo from './ContractDetailsInfo.vue'
47+
import ContractDetailsHeader from './ContractDetailsHeader.vue'
4848
import ContractProductList from './ContractProductList.vue'
4949
import { BizTypeEnum } from '@/api/crm/permission'
5050
import { getOperateLogPage } from '@/api/crm/operateLog'
@@ -54,6 +54,7 @@ import PermissionList from '@/views/crm/permission/components/PermissionList.vue
5454
import FollowUpList from '@/views/crm/followup/index.vue'
5555
5656
defineOptions({ name: 'CrmContractDetail' })
57+
const props = defineProps<{ id?: number }>()
5758
5859
const route = useRoute()
5960
const message = useMessage()
@@ -72,8 +73,8 @@ const openForm = (type: string, id?: number) => {
7273
const getContractData = async () => {
7374
loading.value = true
7475
try {
75-
await getOperateLog(contractId.value)
7676
contract.value = await ContractApi.getContract(contractId.value)
77+
await getOperateLog(contractId.value)
7778
} finally {
7879
loading.value = false
7980
}
@@ -108,7 +109,7 @@ const close = () => {
108109
109110
/** 初始化 */
110111
onMounted(async () => {
111-
const id = route.params.id
112+
const id = props.id || route.params.id
112113
if (!id) {
113114
message.warning('参数错误,合同不能为空!')
114115
close()

src/views/crm/contract/index.vue

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,22 +183,32 @@
183183
<el-table-column fixed="right" label="操作" width="250">
184184
<template #default="scope">
185185
<el-button
186+
v-if="scope.row.auditStatus === 0"
186187
v-hasPermi="['crm:contract:update']"
187188
link
188189
type="primary"
189190
@click="openForm('update', scope.row.id)"
190191
>
191192
编辑
192193
</el-button>
193-
<!-- TODO @puhui999:可以加下判断,什么情况下,可以审批;然后加个【查看审批】按钮 -->
194194
<el-button
195+
v-if="scope.row.auditStatus === 0"
195196
v-hasPermi="['crm:contract:update']"
196197
link
197198
type="primary"
198199
@click="handleSubmit(scope.row)"
199200
>
200201
提交审核
201202
</el-button>
203+
<el-button
204+
v-else
205+
link
206+
v-hasPermi="['crm:contract:update']"
207+
type="primary"
208+
@click="handleProcessDetail(scope.row)"
209+
>
210+
查看审批
211+
</el-button>
202212
<el-button
203213
v-hasPermi="['crm:contract:query']"
204214
link
@@ -328,6 +338,11 @@ const handleSubmit = async (row: ContractApi.ContractVO) => {
328338
await getList()
329339
}
330340
341+
/** 查看审批 */
342+
const handleProcessDetail = (row: ContractApi.ContractVO) => {
343+
push({ name: 'BpmProcessInstanceDetail', query: { id: row.processInstanceId } })
344+
}
345+
331346
/** 打开合同详情 */
332347
const { push } = useRouter()
333348
const openDetail = (id: number) => {

0 commit comments

Comments
 (0)