✨ CRM:完善商机的新增、修改逻辑
parent
6baeadc87a
commit
29605800b5
|
@ -11,6 +11,27 @@ export interface BusinessStatusTypeVO {
|
|||
}
|
||||
}
|
||||
|
||||
export const DEFAULT_STATUSES = [
|
||||
{
|
||||
endStatus: 1,
|
||||
key: '结束',
|
||||
name: '赢单',
|
||||
percent: 100
|
||||
},
|
||||
{
|
||||
endStatus: 2,
|
||||
key: '结束',
|
||||
name: '输单',
|
||||
percent: 0
|
||||
},
|
||||
{
|
||||
endStatus: 3,
|
||||
key: '结束',
|
||||
name: '无效',
|
||||
percent: 0
|
||||
}
|
||||
]
|
||||
|
||||
// 查询商机状态组列表
|
||||
export const getBusinessStatusPage = async (params: any) => {
|
||||
return await request.get({ url: `/crm/business-status/page`, params })
|
||||
|
@ -31,6 +52,11 @@ export const getBusinessStatus = async (id: number) => {
|
|||
return await request.get({ url: `/crm/business-status/get?id=` + id })
|
||||
}
|
||||
|
||||
// 删除商机状态
|
||||
export const deleteBusinessStatus = async (id: number) => {
|
||||
return await request.delete({ url: `/crm/business-status/delete?id=` + id })
|
||||
}
|
||||
|
||||
// 获得商机状态组列表
|
||||
export const getBusinessStatusTypeSimpleList = async () => {
|
||||
return await request.get({ url: `/crm/business-status/type-simple-list` })
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
placeholder="请选择商机状态组"
|
||||
clearable
|
||||
class="w-1/1"
|
||||
:disabled="formType !== 'create'"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in statusTypeList"
|
||||
|
|
|
@ -25,20 +25,27 @@
|
|||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="阶段设置" prop="statuses">
|
||||
<el-table border style="width: 100%" :data="formData.statuses">
|
||||
<el-table
|
||||
border
|
||||
style="width: 100%"
|
||||
:data="formData.statuses.concat(BusinessStatusApi.DEFAULT_STATUSES)"
|
||||
>
|
||||
<el-table-column align="center" label="阶段" width="70">
|
||||
<template #default="scope">
|
||||
<el-text>阶段 {{ scope.$index + 1 }}</el-text>
|
||||
<el-text v-if="!scope.row.defaultStatus">阶段 {{ scope.$index + 1 }}</el-text>
|
||||
<el-text v-else>结束</el-text>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="阶段名称" width="160" prop="name">
|
||||
<template #default="{ row }">
|
||||
<el-input v-model="row.name" placeholder="请输入状态名称" />
|
||||
<el-input v-if="!row.endStatus" v-model="row.name" placeholder="请输入状态名称" />
|
||||
<el-text v-else>{{ row.name }}</el-text>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="140" align="center" label="赢单率" prop="percent">
|
||||
<el-table-column width="140" align="center" label="赢单率(%)" prop="percent">
|
||||
<template #default="{ row }">
|
||||
<el-input-number
|
||||
v-if="!row.endStatus"
|
||||
v-model="row.percent"
|
||||
placeholder="请输入赢单率"
|
||||
controls-position="right"
|
||||
|
@ -47,12 +54,21 @@
|
|||
:precision="2"
|
||||
class="!w-1/1"
|
||||
/>
|
||||
<el-text v-else>{{ row.percent }}</el-text>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="110" align="center">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" @click="addStatusArea(scope.$index)"> 添加 </el-button>
|
||||
<el-button
|
||||
v-if="!scope.row.endStatus"
|
||||
link
|
||||
type="primary"
|
||||
@click="addStatus(scope.$index)"
|
||||
>
|
||||
添加
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="!scope.row.endStatus"
|
||||
link
|
||||
type="danger"
|
||||
@click="deleteStatusArea(scope.$index)"
|
||||
|
@ -110,13 +126,13 @@ const open = async (type: string, id?: number) => {
|
|||
formData.value = await BusinessStatusApi.getBusinessStatus(id)
|
||||
treeRef.value.setCheckedKeys(formData.value.deptIds)
|
||||
if (formData.value.statuses.length == 0) {
|
||||
addStatusArea(0)
|
||||
addStatus()
|
||||
}
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
} else {
|
||||
addStatusArea(0)
|
||||
addStatus()
|
||||
}
|
||||
// 加载部门树
|
||||
deptList.value = handleTree(await DeptApi.getSimpleDeptList())
|
||||
|
@ -162,7 +178,7 @@ const resetForm = () => {
|
|||
}
|
||||
|
||||
/** 添加状态 */
|
||||
const addStatusArea = () => {
|
||||
const addStatus = () => {
|
||||
const data = formData.value
|
||||
data.statuses.push({
|
||||
name: '',
|
||||
|
|
|
@ -80,6 +80,7 @@ import { dateFormatter } from '@/utils/formatTime'
|
|||
import download from '@/utils/download'
|
||||
import * as BusinessStatusApi from '@/api/crm/business/status'
|
||||
import BusinessStatusForm from './BusinessStatusForm.vue'
|
||||
import { deleteBusinessStatus } from '@/api/crm/business/status'
|
||||
|
||||
defineOptions({ name: 'CrmBusinessStatus' })
|
||||
|
||||
|
@ -126,40 +127,19 @@ const openForm = (type: string, id?: number) => {
|
|||
formRef.value.open(type, id)
|
||||
}
|
||||
|
||||
/** 选择客户操作 */
|
||||
const formCustomerRef = ref()
|
||||
const openCustomerForm = (id?: number) => {
|
||||
formCustomerRef.value.open(id)
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (id: number) => {
|
||||
try {
|
||||
// 删除的二次确认
|
||||
await message.delConfirm()
|
||||
// 发起删除
|
||||
await BusinessStatusTypeApi.deleteBusinessStatusType(id)
|
||||
await BusinessStatusApi.deleteBusinessStatus(id)
|
||||
message.success(t('common.delSuccess'))
|
||||
// 刷新列表
|
||||
await getList()
|
||||
} catch {}
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = async () => {
|
||||
try {
|
||||
// 导出的二次确认
|
||||
await message.exportConfirm()
|
||||
// 发起导出
|
||||
exportLoading.value = true
|
||||
const data = await BusinessStatusTypeApi.exportBusinessStatusType(queryParams)
|
||||
download.excel(data, '商机状态组.xls')
|
||||
} catch {
|
||||
} finally {
|
||||
exportLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 初始化 **/
|
||||
onMounted(() => {
|
||||
getList()
|
||||
|
|
Loading…
Reference in New Issue