Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
bbf6c16b
authored
Feb 22, 2024
by
YunaiV
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
✨
CRM:完成商机状态的变更
parent
cf7036d3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
135 additions
and
0 deletions
+135
-0
src/api/crm/business/index.ts
+5
-0
src/api/crm/business/status/index.ts
+5
-0
src/views/crm/business/BusinessUpdateStatusForm.vue
+108
-0
src/views/crm/business/detail/index.vue
+17
-0
No files found.
src/api/crm/business/index.ts
View file @
bbf6c16b
...
@@ -72,6 +72,11 @@ export const updateBusiness = async (data: BusinessVO) => {
...
@@ -72,6 +72,11 @@ export const updateBusiness = async (data: BusinessVO) => {
return
await
request
.
put
({
url
:
`/crm/business/update`
,
data
})
return
await
request
.
put
({
url
:
`/crm/business/update`
,
data
})
}
}
// 修改 CRM 商机状态
export
const
updateBusinessStatus
=
async
(
data
:
BusinessVO
)
=>
{
return
await
request
.
put
({
url
:
`/crm/business/update-status`
,
data
})
}
// 删除 CRM 商机
// 删除 CRM 商机
export
const
deleteBusiness
=
async
(
id
:
number
)
=>
{
export
const
deleteBusiness
=
async
(
id
:
number
)
=>
{
return
await
request
.
delete
({
url
:
`/crm/business/delete?id=`
+
id
})
return
await
request
.
delete
({
url
:
`/crm/business/delete?id=`
+
id
})
...
...
src/api/crm/business/status/index.ts
View file @
bbf6c16b
...
@@ -61,3 +61,8 @@ export const deleteBusinessStatus = async (id: number) => {
...
@@ -61,3 +61,8 @@ export const deleteBusinessStatus = async (id: number) => {
export
const
getBusinessStatusTypeSimpleList
=
async
()
=>
{
export
const
getBusinessStatusTypeSimpleList
=
async
()
=>
{
return
await
request
.
get
({
url
:
`/crm/business-status/type-simple-list`
})
return
await
request
.
get
({
url
:
`/crm/business-status/type-simple-list`
})
}
}
// 获得商机阶段列表
export
const
getBusinessStatusSimpleList
=
async
(
typeId
:
number
)
=>
{
return
await
request
.
get
({
url
:
`/crm/business-status/status-simple-list`
,
params
:
{
typeId
}
})
}
src/views/crm/business/BusinessUpdateStatusForm.vue
0 → 100644
View file @
bbf6c16b
<
template
>
<Dialog
title=
"变更商机状态"
v-model=
"dialogVisible"
width=
"400"
>
<el-form
ref=
"formRef"
:model=
"formData"
:rules=
"formRules"
label-width=
"80px"
v-loading=
"formLoading"
>
<el-form-item
label=
"商机阶段"
prop=
"status"
>
<el-select
v-model=
"formData.status"
placeholder=
"请选择商机阶段"
class=
"w-1/1"
>
<el-option
v-for=
"item in statusList"
:key=
"item.id"
:label=
"item.name + '(赢单率:' + item.percent + '%)'"
:value=
"item.id"
/>
<el-option
v-for=
"item in BusinessStatusApi.DEFAULT_STATUSES"
:key=
"item.endStatus"
:label=
"item.name + '(赢单率:' + item.percent + '%)'"
:value=
"-item.endStatus"
/>
</el-select>
</el-form-item>
</el-form>
<template
#
footer
>
<el-button
@
click=
"submitForm"
type=
"primary"
:disabled=
"formLoading"
>
确 定
</el-button>
<el-button
@
click=
"dialogVisible = false"
>
取 消
</el-button>
</
template
>
</Dialog>
</template>
<
script
setup
lang=
"ts"
>
import
*
as
BusinessApi
from
'@/api/crm/business'
import
*
as
BusinessStatusApi
from
'@/api/crm/business/status'
const
{
t
}
=
useI18n
()
// 国际化
const
message
=
useMessage
()
// 消息弹窗
const
dialogVisible
=
ref
(
false
)
// 弹窗的是否展示
const
formLoading
=
ref
(
false
)
// 表单的加载中
const
formData
=
ref
({
id
:
undefined
,
statusId
:
undefined
,
endStatus
:
undefined
,
status
:
undefined
})
const
formRules
=
reactive
({
status
:
[{
required
:
true
,
message
:
'商机阶段不能为空'
,
trigger
:
'blur'
}]
})
const
formRef
=
ref
()
// 表单 Ref
const
statusList
=
ref
([])
// 商机状态列表
/** 打开弹窗 */
const
open
=
async
(
business
:
BusinessApi
.
BusinessVO
)
=>
{
dialogVisible
.
value
=
true
resetForm
()
formData
.
value
=
{
id
:
business
.
id
,
statusId
:
business
.
statusId
,
endStatus
:
business
.
endStatus
,
status
:
business
.
endStatus
!=
null
?
-
business
.
endStatus
:
business
.
statusId
}
// 加载状态列表
formLoading
.
value
=
true
try
{
statusList
.
value
=
await
BusinessStatusApi
.
getBusinessStatusSimpleList
(
business
.
statusTypeId
)
}
finally
{
formLoading
.
value
=
false
}
}
defineExpose
({
open
})
// 提供 open 方法,用于打开弹窗
/** 提交表单 */
const
emit
=
defineEmits
([
'success'
])
// 定义 success 事件,用于操作成功后的回调
const
submitForm
=
async
()
=>
{
// 校验表单
if
(
!
formRef
)
return
const
valid
=
await
formRef
.
value
.
validate
()
if
(
!
valid
)
return
// 提交请求
formLoading
.
value
=
true
try
{
await
BusinessApi
.
updateBusinessStatus
({
id
:
formData
.
value
.
id
,
statusId
:
formData
.
value
.
status
>
0
?
formData
.
value
.
status
:
undefined
,
endStatus
:
formData
.
value
.
status
<
0
?
-
formData
.
value
.
status
:
undefined
})
message
.
success
(
'更新商机状态成功'
)
dialogVisible
.
value
=
false
// 发送操作成功的事件
emit
(
'success'
)
}
finally
{
formLoading
.
value
=
false
}
}
/** 重置表单 */
const
resetForm
=
()
=>
{
formData
.
value
=
{
id
:
undefined
,
statusId
:
undefined
,
endStatus
:
undefined
,
status
:
undefined
}
formRef
.
value
?.
resetFields
()
}
</
script
>
src/views/crm/business/detail/index.vue
View file @
bbf6c16b
...
@@ -3,6 +3,14 @@
...
@@ -3,6 +3,14 @@
<el-button
v-if=
"permissionListRef?.validateWrite"
@
click=
"openForm('update', business.id)"
>
<el-button
v-if=
"permissionListRef?.validateWrite"
@
click=
"openForm('update', business.id)"
>
编辑
编辑
</el-button>
</el-button>
<el-button
:disabled=
"business.endStatus"
v-if=
"permissionListRef?.validateWrite"
type=
"success"
@
click=
"openStatusForm()"
>
变更商机状态
</el-button>
<el-button
v-if=
"permissionListRef?.validateOwnerUser"
type=
"primary"
@
click=
"transfer"
>
<el-button
v-if=
"permissionListRef?.validateOwnerUser"
type=
"primary"
@
click=
"transfer"
>
转移
转移
</el-button>
</el-button>
...
@@ -41,8 +49,10 @@
...
@@ -41,8 +49,10 @@
</el-tab-pane>
</el-tab-pane>
</el-tabs>
</el-tabs>
</el-col>
</el-col>
<!-- 表单弹窗:添加/修改 -->
<!-- 表单弹窗:添加/修改 -->
<ContactForm
ref=
"formRef"
@
success=
"getContact(business.id)"
/>
<ContactForm
ref=
"formRef"
@
success=
"getContact(business.id)"
/>
<BusinessUpdateStatusForm
ref=
"statusFormRef"
@
success=
"getContact(business.id)"
/>
<CrmTransferForm
ref=
"transferFormRef"
@
success=
"close"
/>
<CrmTransferForm
ref=
"transferFormRef"
@
success=
"close"
/>
</
template
>
</
template
>
<
script
lang=
"ts"
setup
>
<
script
lang=
"ts"
setup
>
...
@@ -59,6 +69,7 @@ import ContactForm from '@/views/crm/contact/ContactForm.vue'
...
@@ -59,6 +69,7 @@ import ContactForm from '@/views/crm/contact/ContactForm.vue'
import
CrmTransferForm
from
'@/views/crm/permission/components/TransferForm.vue'
import
CrmTransferForm
from
'@/views/crm/permission/components/TransferForm.vue'
import
FollowUpList
from
'@/views/crm/followup/index.vue'
import
FollowUpList
from
'@/views/crm/followup/index.vue'
import
ContactList
from
'@/views/crm/contact/components/ContactList.vue'
import
ContactList
from
'@/views/crm/contact/components/ContactList.vue'
import
BusinessUpdateStatusForm
from
'@/views/crm/business/BusinessUpdateStatusForm.vue'
defineOptions
({
name
:
'CrmBusinessDetail'
})
defineOptions
({
name
:
'CrmBusinessDetail'
})
...
@@ -86,6 +97,12 @@ const openForm = (type: string, id?: number) => {
...
@@ -86,6 +97,12 @@ const openForm = (type: string, id?: number) => {
formRef
.
value
.
open
(
type
,
id
)
formRef
.
value
.
open
(
type
,
id
)
}
}
/** 变更商机状态 */
const
statusFormRef
=
ref
()
const
openStatusForm
=
()
=>
{
statusFormRef
.
value
.
open
(
business
.
value
)
}
/** 联系人转移 */
/** 联系人转移 */
const
transferFormRef
=
ref
<
InstanceType
<
typeof
CrmTransferForm
>>
()
// 联系人转移表单 ref
const
transferFormRef
=
ref
<
InstanceType
<
typeof
CrmTransferForm
>>
()
// 联系人转移表单 ref
const
transfer
=
()
=>
{
const
transfer
=
()
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment