crm 报价 商机 合同 三块整改
parent
bbd67d77a8
commit
112b15ed81
|
|
@ -5,9 +5,9 @@
|
|||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "msedge",
|
||||
"type": "chrome",
|
||||
"request": "launch",
|
||||
"name": "Launch Edge against localhost",
|
||||
"name": "Launch chrome against localhost",
|
||||
"url": "http://localhost",
|
||||
"webRoot": "${workspaceFolder}/src",
|
||||
"sourceMaps": true
|
||||
|
|
|
|||
|
|
@ -0,0 +1,69 @@
|
|||
import request from '@/config/axios'
|
||||
|
||||
// CRM 方案报价 VO
|
||||
export interface QuotationVO {
|
||||
no: string // 报价单编号
|
||||
customerId: number // 客户id
|
||||
businessId: number // 商机编号
|
||||
invoiceTemplateId: number // 票据模板Id
|
||||
processInstanceId: string // 工作流编号
|
||||
auditStatus: number // 审批状态
|
||||
ownerUserId: number // 商机负责人
|
||||
expanderUserId: number // 拓展人
|
||||
pricingUserId: number // 方案报价人
|
||||
signUserId: number // 报价签约人
|
||||
signPhoneNumber: number // 签约人联系电话
|
||||
signEmail: string // 签约人Email
|
||||
signWechat: string // 签约人微信
|
||||
startTime: Date // 开始时间
|
||||
totalPrice: number // 合同总金额
|
||||
paymentTerm: string // 账期
|
||||
creditMethod: number // 授信方式
|
||||
creditCalcCycle: number // 授信计算周期
|
||||
creditLimit: number // 授信额度
|
||||
partnerCompanyId: number // 合作主体 关联部门id
|
||||
deptId: number // 归属部门Id
|
||||
creator: string // 创建者
|
||||
createTime: Date // 创建时间
|
||||
updater: string // 更新者
|
||||
}
|
||||
|
||||
// CRM 方案报价 API
|
||||
export const QuotationApi = {
|
||||
// 查询CRM 方案报价分页
|
||||
getQuotationPage: async (params: any) => {
|
||||
return await request.get({ url: `/crm/quotation/page`, params })
|
||||
},
|
||||
|
||||
// 查询CRM 方案报价详情
|
||||
getQuotation: async (id: number) => {
|
||||
return await request.get({ url: `/crm/quotation/get?id=` + id })
|
||||
},
|
||||
|
||||
// 新增CRM 方案报价
|
||||
createQuotation: async (data: QuotationVO) => {
|
||||
return await request.post({ url: `/crm/quotation/create`, data })
|
||||
},
|
||||
|
||||
// 修改CRM 方案报价
|
||||
updateQuotation: async (data: QuotationVO) => {
|
||||
return await request.put({ url: `/crm/quotation/update`, data })
|
||||
},
|
||||
|
||||
// 删除CRM 方案报价
|
||||
deleteQuotation: async (id: number) => {
|
||||
return await request.delete({ url: `/crm/quotation/delete?id=` + id })
|
||||
},
|
||||
|
||||
// 导出CRM 方案报价 Excel
|
||||
exportQuotation: async (params) => {
|
||||
return await request.download({ url: `/crm/quotation/export-excel`, params })
|
||||
},
|
||||
|
||||
// ==================== 子表(CRM 报价产品关联) ====================
|
||||
|
||||
// 获得CRM 报价产品关联列表
|
||||
getQuotationProductListByQuotationId: async (quotationId) => {
|
||||
return await request.get({ url: `/crm/quotation/quotation-product/list-by-quotation-id?quotationId=` + quotationId })
|
||||
}
|
||||
}
|
||||
|
|
@ -18,6 +18,24 @@
|
|||
<el-select
|
||||
v-model="formData.ownerUserId"
|
||||
:disabled="formType !== 'create'"
|
||||
placeholder="请选择负责人"
|
||||
class="w-1/1"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in userOptions"
|
||||
:key="item.id"
|
||||
:label="item.nickname"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="需求提交人" prop="requestorUserId">
|
||||
<el-select
|
||||
v-model="formData.requestorUserId"
|
||||
:disabled="formType !== 'create'"
|
||||
placeholder="请选择需求提交人"
|
||||
class="w-1/1"
|
||||
>
|
||||
<el-option
|
||||
|
|
@ -77,6 +95,76 @@
|
|||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="销售阶段" prop="saleStage">
|
||||
<el-select v-model="formData.saleStage" placeholder="请选择销售阶段">
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions('sale_stage')"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="账期" prop="paymentTerm">
|
||||
<el-select v-model="formData.paymentTerm" placeholder="请选择账期">
|
||||
<el-option
|
||||
v-for="dict in getStrDictOptions('payment_term')"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="授信方式" prop="creditMethod">
|
||||
<el-select v-model="formData.creditMethod" placeholder="请选择授信方式">
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions('credit_method')"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="授信计算周期" prop="creditCalcCycle">
|
||||
<el-select v-model="formData.creditCalcCycle" placeholder="请选择授信计算周期">
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions('credit_calc_cycle')"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="授信额度" prop="creditLimit">
|
||||
<el-input v-model="formData.creditLimit" placeholder="请输入授信额度" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="是否技术需求支持" prop="techSupport">
|
||||
<el-radio-group v-model="formData.techSupport">
|
||||
<el-radio
|
||||
v-for="dict in getBoolDictOptions('tech_support')"
|
||||
:key="dict.value"
|
||||
:label="dict.value"
|
||||
>
|
||||
{{ dict.label }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input type="textarea" v-model="formData.remark" placeholder="请输入备注" />
|
||||
|
|
@ -97,15 +185,24 @@
|
|||
</ContentWrap>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="产品总金额" prop="totalProductPrice">
|
||||
<el-form-item label="线上总金额" prop="onlinePrice">
|
||||
<el-input
|
||||
disabled
|
||||
v-model="formData.totalProductPrice"
|
||||
v-model="formData.onlinePrice"
|
||||
:formatter="erpPriceInputFormatter"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="线下总金额" prop="offlinePrice">
|
||||
<el-input
|
||||
disabled
|
||||
v-model="formData.offlinePrice"
|
||||
:formatter="erpPriceInputFormatter"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- <el-col :span="8">
|
||||
<el-form-item label="整单折扣(%)" prop="discountPercent">
|
||||
<el-input-number
|
||||
v-model="formData.discountPercent"
|
||||
|
|
@ -116,7 +213,7 @@
|
|||
class="!w-1/1"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-col> -->
|
||||
<el-col :span="8">
|
||||
<el-form-item label="折扣后金额" prop="price">
|
||||
<el-input
|
||||
|
|
@ -136,6 +233,7 @@
|
|||
</Dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { getIntDictOptions, getStrDictOptions, DICT_TYPE, getBoolDictOptions } from '@/utils/dict'
|
||||
import * as BusinessApi from '@/api/crm/business'
|
||||
import * as BusinessStatusApi from '@/api/crm/business/status'
|
||||
import * as CustomerApi from '@/api/crm/customer'
|
||||
|
|
@ -155,16 +253,28 @@ const formData = ref({
|
|||
id: undefined,
|
||||
name: undefined,
|
||||
customerId: undefined,
|
||||
followUpStatus: undefined,
|
||||
contactLastTime: undefined,
|
||||
contactNextTime: undefined,
|
||||
ownerUserId: undefined,
|
||||
requestorUserId: undefined,
|
||||
statusTypeId: undefined,
|
||||
statusId: undefined,
|
||||
endStatus: undefined,
|
||||
dealTime: undefined,
|
||||
discountPercent: 0,
|
||||
onlinePrice: undefined,
|
||||
offlinePrice: undefined,
|
||||
totalProductPrice: undefined,
|
||||
discountPercent: undefined,
|
||||
totalPrice: undefined,
|
||||
saleStage: undefined,
|
||||
paymentTerm: undefined,
|
||||
creditMethod: undefined,
|
||||
creditCalcCycle: undefined,
|
||||
creditLimit: undefined,
|
||||
techSupport: undefined,
|
||||
remark: undefined,
|
||||
products: [],
|
||||
contactId: undefined,
|
||||
customerDefault: false
|
||||
endRemark: undefined
|
||||
})
|
||||
const formRules = reactive({
|
||||
name: [{ required: true, message: '商机名称不能为空', trigger: 'blur' }],
|
||||
|
|
@ -188,15 +298,12 @@ watch(
|
|||
if (!val) {
|
||||
return
|
||||
}
|
||||
const totalProductPrice = val.products.reduce((prev, curr) => prev + curr.totalPrice, 0)
|
||||
const discountPrice =
|
||||
val.discountPercent != null
|
||||
? erpPriceMultiply(totalProductPrice, val.discountPercent / 100.0)
|
||||
: 0
|
||||
const totalPrice = totalProductPrice - discountPrice
|
||||
const totalOnlinePrice = val.products.reduce((prev, curr) => prev + curr.onlinePrice, 0)
|
||||
const totalOfflinePrice = val.products.reduce((prev, curr) => prev + curr.offlinePrice, 0)
|
||||
// 赋值
|
||||
formData.value.totalProductPrice = totalProductPrice
|
||||
formData.value.totalPrice = totalPrice
|
||||
formData.value.onlinePrice = totalOnlinePrice
|
||||
formData.value.offlinePrice = totalOfflinePrice
|
||||
formData.value.totalPrice = totalOnlinePrice + totalOfflinePrice
|
||||
},
|
||||
{ deep: true }
|
||||
)
|
||||
|
|
|
|||
|
|
@ -30,6 +30,13 @@
|
|||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="产品分类" min-width="150">
|
||||
<template #default="{ row }">
|
||||
<el-form-item class="mb-0px!">
|
||||
<el-input disabled v-model="row.productCategoryId" />
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="条码" min-width="150">
|
||||
<template #default="{ row }">
|
||||
<el-form-item class="mb-0px!">
|
||||
|
|
@ -42,18 +49,11 @@
|
|||
<dict-tag :type="DICT_TYPE.CRM_PRODUCT_UNIT" :value="row.productUnit" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="价格(元)" min-width="120">
|
||||
<template #default="{ row }">
|
||||
<el-form-item class="mb-0px!">
|
||||
<el-input disabled v-model="row.productPrice" :formatter="erpPriceInputFormatter" />
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="售价(元)" fixed="right" min-width="140">
|
||||
<el-table-column label="线上价格(元)" fixed="right" min-width="140">
|
||||
<template #default="{ row, $index }">
|
||||
<el-form-item :prop="`${$index}.businessPrice`" class="mb-0px!">
|
||||
<el-form-item :prop="`${$index}.onlinePrice`" class="mb-0px!">
|
||||
<el-input-number
|
||||
v-model="row.businessPrice"
|
||||
v-model="row.onlinePrice"
|
||||
controls-position="right"
|
||||
:min="0.001"
|
||||
:precision="2"
|
||||
|
|
@ -62,14 +62,14 @@
|
|||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="数量" prop="count" fixed="right" min-width="120">
|
||||
<el-table-column label="线下价格(元)" fixed="right" min-width="140">
|
||||
<template #default="{ row, $index }">
|
||||
<el-form-item :prop="`${$index}.count`" :rules="formRules.count" class="mb-0px!">
|
||||
<el-form-item :prop="`${$index}.offlinePrice`" class="mb-0px!">
|
||||
<el-input-number
|
||||
v-model="row.count"
|
||||
v-model="row.offlinePrice"
|
||||
controls-position="right"
|
||||
:min="0.001"
|
||||
:precision="3"
|
||||
:precision="2"
|
||||
class="!w-100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
|
@ -131,7 +131,7 @@ watch(
|
|||
// 循环处理
|
||||
val.forEach((item) => {
|
||||
if (item.businessPrice != null && item.count != null) {
|
||||
item.totalPrice = erpPriceMultiply(item.businessPrice, item.count)
|
||||
item.totalPrice = item.offlinePrice + item.onlinePrice
|
||||
} else {
|
||||
item.totalPrice = undefined
|
||||
}
|
||||
|
|
@ -145,9 +145,14 @@ const handleAdd = () => {
|
|||
const row = {
|
||||
id: undefined,
|
||||
productId: undefined,
|
||||
productName: undefined,
|
||||
productCategoryId: undefined, //产品分类编号
|
||||
productUnit: undefined, // 产品单位
|
||||
productNo: undefined, // 产品条码
|
||||
productPrice: undefined, // 产品价格
|
||||
onlinePrice: undefined, // 产品价格
|
||||
offlinePrice: undefined, // 产品价格
|
||||
totalPrice: undefined,
|
||||
businessPrice: undefined,
|
||||
count: 1
|
||||
}
|
||||
|
|
@ -163,7 +168,13 @@ const handleDelete = (index: number) => {
|
|||
const onChangeProduct = (productId, row) => {
|
||||
const product = productList.value.find((item) => item.id === productId)
|
||||
if (product) {
|
||||
row.productId = product.id
|
||||
row.productName = product.name
|
||||
row.productCategoryId = 1
|
||||
row.productUnit = product.unit
|
||||
row.onlinePrice = product.onlinePrice
|
||||
row.offlinePrice = product.offlinePrice
|
||||
row.totalPrice = product.totalPrice
|
||||
row.productNo = product.no
|
||||
row.productPrice = product.price
|
||||
row.businessPrice = product.price
|
||||
|
|
|
|||
|
|
@ -1,7 +1,4 @@
|
|||
<template>
|
||||
<doc-alert title="【商机】商机管理、商机状态" url="https://doc.iocoder.cn/crm/business/" />
|
||||
<doc-alert title="【通用】数据权限" url="https://doc.iocoder.cn/crm/permission/" />
|
||||
|
||||
<ContentWrap>
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form
|
||||
|
|
|
|||
|
|
@ -1,7 +1,4 @@
|
|||
<template>
|
||||
<doc-alert title="【合同】合同管理、合同提醒" url="https://doc.iocoder.cn/crm/contract/" />
|
||||
<doc-alert title="【通用】数据权限" url="https://doc.iocoder.cn/crm/permission/" />
|
||||
|
||||
<ContentWrap>
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form
|
||||
|
|
|
|||
|
|
@ -0,0 +1,325 @@
|
|||
<template>
|
||||
<Dialog :title="dialogTitle" v-model="dialogVisible">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
label-width="100px"
|
||||
v-loading="formLoading"
|
||||
>
|
||||
<el-form-item label="报价单编号" prop="no">
|
||||
<el-input v-model="formData.no" placeholder="请输入报价单编号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="客户" prop="customerId">
|
||||
<el-select v-model="formData.customerId" placeholder="请选择客户">
|
||||
<el-option
|
||||
v-for="item in customerList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="选择商机" prop="businessId">
|
||||
<el-select v-model="formData.businessId" placeholder="请选择商机" @change="onBusinessChange">
|
||||
<el-option
|
||||
v-for="dict in businessList"
|
||||
:key="dict.id"
|
||||
:label="dict.name"
|
||||
:value="dict.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="票据模板" prop="invoiceTemplateId">
|
||||
<el-select v-model="formData.invoiceTemplateId" placeholder="请选择票据模板">
|
||||
<el-option
|
||||
v-for="dict in userOptions"
|
||||
:key="dict.id"
|
||||
:label="dict.nickname"
|
||||
:value="dict.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="商机负责人" prop="ownerUserId">
|
||||
<el-select v-model="formData.ownerUserId" placeholder="请选择商机负责人">
|
||||
<el-option
|
||||
v-for="dict in userOptions"
|
||||
:key="dict.id"
|
||||
:label="dict.nickname"
|
||||
:value="dict.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="拓展人" prop="expanderUserId">
|
||||
<el-select v-model="formData.expanderUserId" placeholder="请选择拓展人">
|
||||
<el-option
|
||||
v-for="dict in userOptions"
|
||||
:key="dict.id"
|
||||
:label="dict.nickname"
|
||||
:value="dict.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="方案报价人" prop="pricingUserId">
|
||||
<el-select v-model="formData.pricingUserId" placeholder="请选择方案报价人">
|
||||
<el-option
|
||||
v-for="dict in userOptions"
|
||||
:key="dict.id"
|
||||
:label="dict.nickname"
|
||||
:value="dict.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="报价签约人" prop="signUserId">
|
||||
<el-select v-model="formData.signUserId" placeholder="请选择报价签约人">
|
||||
<el-option
|
||||
v-for="dict in userOptions"
|
||||
:key="dict.id"
|
||||
:label="dict.nickname"
|
||||
:value="dict.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="签约人联系电话" prop="signPhoneNumber">
|
||||
<el-input v-model="formData.signPhoneNumber" placeholder="请输入签约人联系电话" />
|
||||
</el-form-item>
|
||||
<el-form-item label="签约人Email" prop="signEmail">
|
||||
<el-input v-model="formData.signEmail" placeholder="请输入签约人Email" />
|
||||
</el-form-item>
|
||||
<el-form-item label="签约人微信" prop="signWechat">
|
||||
<el-input v-model="formData.signWechat" placeholder="请输入签约人微信" />
|
||||
</el-form-item>
|
||||
<el-form-item label="合同总金额" prop="totalPrice">
|
||||
<el-input v-model="formData.totalPrice" placeholder="" disabled="false" />
|
||||
</el-form-item>
|
||||
<el-form-item label="账期" prop="paymentTerm">
|
||||
<el-select v-model="formData.paymentTerm" placeholder="请选择账期">
|
||||
<el-option
|
||||
v-for="dict in getStrDictOptions('payment_term')"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="授信方式" prop="creditMethod">
|
||||
<el-select v-model="formData.creditMethod" placeholder="请选择授信方式">
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions('credit_method')"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="授信计算周期" prop="creditCalcCycle">
|
||||
<el-select v-model="formData.creditCalcCycle" placeholder="请选择授信计算周期">
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions('credit_calc_cycle')"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="授信额度" prop="creditLimit">
|
||||
<el-input v-model="formData.creditLimit" placeholder="请输入授信额度" />
|
||||
</el-form-item>
|
||||
<el-form-item label="合作主体" prop="partnerCompanyId">
|
||||
<el-select v-model="formData.partnerCompanyId" placeholder="请选择合作主体">
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.SYSTEM_USER_SEX)"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="归属部门" prop="deptId">
|
||||
<el-tree-select
|
||||
v-model="formData.deptId"
|
||||
:data="deptTree"
|
||||
:props="defaultProps"
|
||||
filterable
|
||||
check-strictly
|
||||
node-key="id"
|
||||
placeholder="请选择归属部门"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- 子表的表单 -->
|
||||
<el-tabs v-model="subTabsName">
|
||||
<el-tab-pane label="报价产品关联" name="quotationProduct">
|
||||
<QuotationProductForm ref="quotationProductFormRef" :quotation-id="formData.id" :business-id="formData.businessId" />
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
<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 { getIntDictOptions, getStrDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||
import { QuotationApi, QuotationVO } from '@/api/crm/quotation'
|
||||
import { defaultProps, handleTree } from '@/utils/tree'
|
||||
import QuotationProductForm from './components/QuotationProductForm.vue'
|
||||
import * as CustomerApi from '@/api/crm/customer'
|
||||
import * as UserApi from '@/api/system/user'
|
||||
import * as DeptApi from '@/api/system/dept'
|
||||
import * as BusinessApi from '@/api/crm/business'
|
||||
|
||||
/** CRM 方案报价 表单 */
|
||||
defineOptions({ name: 'QuotationForm' })
|
||||
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
const customerList = ref([]) // 客户列表的数据
|
||||
const userOptions = ref<UserApi.UserVO[]>([]) // 用户列表
|
||||
const businessList = ref([])
|
||||
const deptTree = ref() // 部门树形结构
|
||||
const invoiceTemplateList = ref([])
|
||||
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||
const dialogTitle = ref('') // 弹窗的标题
|
||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||
const formData = ref({
|
||||
no: undefined,
|
||||
customerId: undefined,
|
||||
businessId: undefined,
|
||||
invoiceTemplateId: undefined,
|
||||
processInstanceId: undefined,
|
||||
auditStatus: undefined,
|
||||
ownerUserId: undefined,
|
||||
expanderUserId: undefined,
|
||||
pricingUserId: undefined,
|
||||
signUserId: undefined,
|
||||
signPhoneNumber: undefined,
|
||||
signEmail: undefined,
|
||||
signWechat: undefined,
|
||||
paymentTerm: undefined,
|
||||
creditMethod: undefined,
|
||||
creditCalcCycle: undefined,
|
||||
creditLimit: undefined,
|
||||
partnerCompanyId: undefined,
|
||||
deptId: undefined,
|
||||
creator: undefined,
|
||||
createTime: undefined,
|
||||
updater: undefined
|
||||
})
|
||||
const formRules = reactive({
|
||||
no: [{ required: true, message: '报价单编号不能为空', trigger: 'blur' }],
|
||||
customerId: [{ required: true, message: '客户id不能为空', trigger: 'change' }],
|
||||
businessId: [{ required: true, message: '商机编号不能为空', trigger: 'change' }],
|
||||
invoiceTemplateId: [{ required: true, message: '票据模板Id不能为空', trigger: 'change' }]
|
||||
})
|
||||
const formRef = ref() // 表单 Ref
|
||||
|
||||
/** 子表的表单 */
|
||||
const subTabsName = ref('quotationProduct')
|
||||
const quotationProductFormRef = ref()
|
||||
|
||||
const onBusinessChange = async (businessId: string) => {
|
||||
if (!businessId) return
|
||||
try {
|
||||
const res = await BusinessApi.getBusiness(businessId);
|
||||
formData.creditLimit = res.creditLimit; // 保存详情信息
|
||||
formData.ownerUserId = res.ownerUserId; // 保存详情信息
|
||||
formData.paymentTerm = res.paymentTerm;
|
||||
formData.creditMethod = res.creditMethod;
|
||||
formData.creditCalcCycle = res.creditCalcCycle;
|
||||
} catch (err) {
|
||||
}
|
||||
}
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (type: string, id?: number) => {
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = t('action.' + type)
|
||||
formType.value = type
|
||||
resetForm()
|
||||
// 修改时,设置数据
|
||||
if (id) {
|
||||
formLoading.value = true
|
||||
try {
|
||||
formData.value = await QuotationApi.getQuotation(id)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
// 获得客户列表
|
||||
customerList.value = await CustomerApi.getCustomerSimpleList()
|
||||
// 获得用户列表
|
||||
userOptions.value = await UserApi.getSimpleUserList()
|
||||
|
||||
businessList.value = await BusinessApi.getSimpleBusinessList()
|
||||
// 获得部门树
|
||||
deptTree.value = handleTree(await DeptApi.getSimpleDeptList())
|
||||
}
|
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||
|
||||
/** 提交表单 */
|
||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||
const submitForm = async () => {
|
||||
// 校验表单
|
||||
await formRef.value.validate()
|
||||
// 校验子表单
|
||||
try {
|
||||
await quotationProductFormRef.value.validate()
|
||||
} catch (e) {
|
||||
subTabsName.value = 'quotationProduct'
|
||||
return
|
||||
}
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = formData.value as unknown as QuotationVO
|
||||
// 拼接子表的数据
|
||||
data.quotationProducts = quotationProductFormRef.value.getData()
|
||||
if (formType.value === 'create') {
|
||||
await QuotationApi.createQuotation(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
await QuotationApi.updateQuotation(data)
|
||||
message.success(t('common.updateSuccess'))
|
||||
}
|
||||
dialogVisible.value = false
|
||||
// 发送操作成功的事件
|
||||
emit('success')
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
no: undefined,
|
||||
customerId: undefined,
|
||||
businessId: undefined,
|
||||
invoiceTemplateId: undefined,
|
||||
processInstanceId: undefined,
|
||||
auditStatus: undefined,
|
||||
ownerUserId: undefined,
|
||||
expanderUserId: undefined,
|
||||
pricingUserId: undefined,
|
||||
signUserId: undefined,
|
||||
signPhoneNumber: undefined,
|
||||
signEmail: undefined,
|
||||
signWechat: undefined,
|
||||
startTime: undefined,
|
||||
totalPrice: undefined,
|
||||
paymentTerm: undefined,
|
||||
creditMethod: undefined,
|
||||
creditCalcCycle: undefined,
|
||||
creditLimit: undefined,
|
||||
partnerCompanyId: undefined,
|
||||
deptId: undefined,
|
||||
creator: undefined,
|
||||
createTime: undefined,
|
||||
updater: undefined
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
</script>
|
||||
|
|
@ -0,0 +1,183 @@
|
|||
<template>
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
v-loading="formLoading"
|
||||
label-width="0px"
|
||||
:inline-message="true"
|
||||
>
|
||||
<el-table :data="formData" class="-mt-10px">
|
||||
<el-table-column label="序号" type="index" width="100" />
|
||||
<el-table-column label="产品编号" min-width="150">
|
||||
<template #default="{ row, $index }">
|
||||
<el-form-item :prop="`${$index}.productId`" :rules="formRules.productId" class="mb-0px!">
|
||||
<el-input v-model="row.productId" placeholder="请输入产品编号" />
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="产品名称" min-width="150">
|
||||
<template #default="{ row, $index }">
|
||||
<el-form-item :prop="`${$index}.productName`" :rules="formRules.productName" class="mb-0px!">
|
||||
<el-input v-model="row.productName" placeholder="请输入产品名称" />
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="产品分类编号" min-width="150">
|
||||
<template #default="{ row, $index }">
|
||||
<el-form-item :prop="`${$index}.productCategoryId`" :rules="formRules.productCategoryId" class="mb-0px!">
|
||||
<el-input v-model="row.productCategoryId" placeholder="请输入产品分类编号" />
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="产品单位" min-width="150">
|
||||
<template #default="{ row, $index }">
|
||||
<el-form-item :prop="`${$index}.productUnit`" :rules="formRules.productUnit" class="mb-0px!">
|
||||
<el-input v-model="row.productUnit" placeholder="请输入产品单位" />
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="线上价格" min-width="150">
|
||||
<template #default="{ row, $index }">
|
||||
<el-form-item :prop="`${$index}.onlinePrice`" :rules="formRules.onlinePrice" class="mb-0px!">
|
||||
<el-input v-model="row.onlinePrice" placeholder="请输入线上价格" />
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="线下价格" min-width="150">
|
||||
<template #default="{ row, $index }">
|
||||
<el-form-item :prop="`${$index}.offlinePrice`" :rules="formRules.offlinePrice" class="mb-0px!">
|
||||
<el-input v-model="row.offlinePrice" placeholder="请输入线下价格" />
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="总计价格" min-width="150">
|
||||
<template #default="{ row, $index }">
|
||||
<el-form-item :prop="`${$index}.totalPrice`" :rules="formRules.totalPrice" class="mb-0px!">
|
||||
<el-input v-model="row.totalPrice" placeholder="请输入总计价格" />
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="产品票据" min-width="150">
|
||||
<template #default="{ row, $index }">
|
||||
<el-form-item :prop="`${$index}.productInvoice`" :rules="formRules.productInvoice" class="mb-0px!">
|
||||
<el-input v-model="row.productInvoice" placeholder="请输入产品票据" />
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="产品开具项目" min-width="150">
|
||||
<template #default="{ row, $index }">
|
||||
<el-form-item :prop="`${$index}.productInvoiceItem`" :rules="formRules.productInvoiceItem" class="mb-0px!">
|
||||
<el-input v-model="row.productInvoiceItem" placeholder="请输入产品开具项目" />
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="服务费票据" min-width="150">
|
||||
<template #default="{ row, $index }">
|
||||
<el-form-item :prop="`${$index}.serviceInvoice`" :rules="formRules.serviceInvoice" class="mb-0px!">
|
||||
<el-input v-model="row.serviceInvoice" placeholder="请输入服务费票据" />
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="服务开具项目" min-width="150">
|
||||
<template #default="{ row, $index }">
|
||||
<el-form-item :prop="`${$index}.serviceInvoiceItem`" :rules="formRules.serviceInvoiceItem" class="mb-0px!">
|
||||
<el-input v-model="row.serviceInvoiceItem" placeholder="请输入服务开具项目" />
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" fixed="right" label="操作" width="60">
|
||||
<template #default="{ $index }">
|
||||
<el-button @click="handleDelete($index)" link>—</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-form>
|
||||
<el-row justify="center" class="mt-3">
|
||||
<!-- <el-button @click="handleAdd" round>+ 添加CRM 报价产品关联</el-button> -->
|
||||
</el-row>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { QuotationApi } from '@/api/crm/quotation'
|
||||
import * as BusinessApi from '@/api/crm/business'
|
||||
|
||||
const props = defineProps<{
|
||||
quotationId: undefined, // 报价编号(主表的关联字段)
|
||||
businessId: undefined
|
||||
}>()
|
||||
const formLoading = ref(false) // 表单的加载中
|
||||
const formData = ref([])
|
||||
const formRules = reactive({
|
||||
quotationId: [{ required: true, message: '报价编号不能为空', trigger: 'blur' }],
|
||||
productId: [{ required: true, message: '产品编号不能为空', trigger: 'blur' }],
|
||||
productName: [{ required: true, message: '产品名称不能为空', trigger: 'blur' }],
|
||||
productCategoryId: [{ required: true, message: '产品分类编号不能为空', trigger: 'blur' }],
|
||||
productUnit: [{ required: true, message: '产品单位不能为空', trigger: 'blur' }],
|
||||
onlinePrice: [{ required: true, message: '线上价格不能为空', trigger: 'blur' }],
|
||||
offlinePrice: [{ required: true, message: '线下价格不能为空', trigger: 'blur' }],
|
||||
totalPrice: [{ required: true, message: '总计价格不能为空', trigger: 'blur' }]
|
||||
})
|
||||
const formRef = ref() // 表单 Ref
|
||||
|
||||
/** 监听主表的关联字段的变化,加载对应的子表数据 */
|
||||
watch(
|
||||
() => props.businessId,
|
||||
async (val) => {
|
||||
// 1. 重置表单
|
||||
formData.value = []
|
||||
// 2. val 非空,则加载数据
|
||||
if (!val) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
formLoading.value = true
|
||||
// if(val.quotationId) {
|
||||
// formData.value = await QuotationApi.getQuotationProductListByQuotationId(val.quotationId)
|
||||
// } else if(val.businessId) {
|
||||
const business = await BusinessApi.getBusiness(val);
|
||||
formData.value = business.products
|
||||
// }
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
|
||||
/** 新增按钮操作 */
|
||||
const handleAdd = () => {
|
||||
const row = {
|
||||
quotationId: undefined,
|
||||
productId: undefined,
|
||||
productName: undefined,
|
||||
productCategoryId: undefined,
|
||||
productUnit: undefined,
|
||||
onlinePrice: undefined,
|
||||
offlinePrice: undefined,
|
||||
totalPrice: undefined,
|
||||
productInvoice: undefined,
|
||||
productInvoiceItem: undefined,
|
||||
serviceInvoice: undefined,
|
||||
serviceInvoiceItem: undefined
|
||||
}
|
||||
row.quotationId = props.quotationId
|
||||
formData.value.push(row)
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = (index) => {
|
||||
formData.value.splice(index, 1)
|
||||
}
|
||||
|
||||
/** 表单校验 */
|
||||
const validate = () => {
|
||||
return formRef.value.validate()
|
||||
}
|
||||
|
||||
/** 表单值 */
|
||||
const getData = () => {
|
||||
return formData.value
|
||||
}
|
||||
|
||||
defineExpose({ validate, getData })
|
||||
</script>
|
||||
|
|
@ -0,0 +1,285 @@
|
|||
<template>
|
||||
<ContentWrap>
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form
|
||||
class="-mb-15px"
|
||||
:model="queryParams"
|
||||
ref="queryFormRef"
|
||||
:inline="true"
|
||||
label-width="68px"
|
||||
>
|
||||
<el-form-item label="报价单编号" prop="no">
|
||||
<el-input
|
||||
v-model="queryParams.no"
|
||||
placeholder="请输入报价单编号"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="客户" prop="customerId">
|
||||
<el-select
|
||||
v-model="queryParams.customerId"
|
||||
placeholder="请选择客户"
|
||||
clearable
|
||||
class="!w-240px"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in customerList"
|
||||
:key="dict.id"
|
||||
:label="dict.name"
|
||||
:value="dict.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="商机负责人" prop="ownerUserId">
|
||||
<el-select
|
||||
v-model="queryParams.ownerUserId"
|
||||
placeholder="请选择商机负责人"
|
||||
clearable
|
||||
class="!w-240px"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in userOptions"
|
||||
:key="dict.id"
|
||||
:label="dict.nickName"
|
||||
:value="dict.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-date-picker
|
||||
v-model="queryParams.createTime"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
type="daterange"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
|
||||
class="!w-220px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
||||
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
@click="openForm('create')"
|
||||
v-hasPermi="['crm:quotation:create']"
|
||||
>
|
||||
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
||||
</el-button>
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
@click="handleExport"
|
||||
:loading="exportLoading"
|
||||
v-hasPermi="['crm:quotation:export']"
|
||||
>
|
||||
<Icon icon="ep:download" class="mr-5px" /> 导出
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</ContentWrap>
|
||||
|
||||
<!-- 列表 -->
|
||||
<ContentWrap>
|
||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
||||
<el-table-column label="报价单编号" align="center" prop="no" />
|
||||
<el-table-column label="客户名称" align="center" prop="customerId">
|
||||
<template #default="scope">
|
||||
<el-link
|
||||
:underline="false"
|
||||
type="primary"
|
||||
@click="openCustomerDetail(scope.row.customerId)"
|
||||
>
|
||||
{{ scope.row.customerName }}
|
||||
</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商机负责人" align="center" prop="ownerUserId">
|
||||
<template #default="scope">
|
||||
<el-link
|
||||
:underline="false"
|
||||
type="primary"
|
||||
@click="openContactDetail(scope.row.ownerUserId)"
|
||||
>
|
||||
{{ scope.row.ownerUserName }}
|
||||
</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="账期" align="center" prop="paymentTerm">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="'payment_term'" :value="scope.row.paymentTerm" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="授信方式" align="center" prop="creditMethod">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="'credit_method'" :value="scope.row.creditMethod" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="授信计算周期" align="center" prop="creditCalcCycle">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="'credit_calc_cycle'" :value="scope.row.creditCalcCycle" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="授信额度" align="center" prop="creditLimit" />
|
||||
<el-table-column label="合作主体" align="center" prop="partnerCompanyName" />
|
||||
<el-table-column label="审批状态" align="center" prop="auditStatus">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.SYSTEM_USER_SEX" :value="scope.row.auditStatus" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="创建时间"
|
||||
align="center"
|
||||
prop="createTime"
|
||||
:formatter="dateFormatter"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column label="操作" align="center" min-width="120px">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
@click="openForm('update', scope.row.id)"
|
||||
v-hasPermi="['crm:quotation:update']"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="danger"
|
||||
@click="handleDelete(scope.row.id)"
|
||||
v-hasPermi="['crm:quotation:delete']"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
<Pagination
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNo"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</ContentWrap>
|
||||
|
||||
<!-- 表单弹窗:添加/修改 -->
|
||||
<QuotationForm ref="formRef" @success="getList" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
import download from '@/utils/download'
|
||||
import { QuotationApi, QuotationVO } from '@/api/crm/quotation'
|
||||
import QuotationForm from './QuotationForm.vue'
|
||||
import * as CustomerApi from '@/api/crm/customer'
|
||||
import * as UserApi from '@/api/system/user'
|
||||
import * as DeptApi from '@/api/system/dept'
|
||||
|
||||
/** CRM 方案报价 列表 */
|
||||
defineOptions({ name: 'Quotation' })
|
||||
|
||||
const message = useMessage() // 消息弹窗
|
||||
const { t } = useI18n() // 国际化
|
||||
const userOptions = ref<UserApi.UserVO[]>([]) // 用户列表
|
||||
const customerList = ref([]) // 客户列表的数据
|
||||
|
||||
const { push } = useRouter()
|
||||
|
||||
const loading = ref(true) // 列表的加载中
|
||||
const list = ref<QuotationVO[]>([]) // 列表的数据
|
||||
const total = ref(0) // 列表的总页数
|
||||
const queryParams = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
no: undefined,
|
||||
customerId: undefined,
|
||||
ownerUserId: undefined,
|
||||
partnerCompanyId: undefined,
|
||||
createTime: []
|
||||
})
|
||||
const queryFormRef = ref() // 搜索的表单
|
||||
const exportLoading = ref(false) // 导出的加载中
|
||||
|
||||
/** 查询列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await QuotationApi.getQuotationPage(queryParams)
|
||||
list.value = data.list
|
||||
total.value = data.total
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.pageNo = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value.resetFields()
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
/** 添加/修改操作 */
|
||||
const formRef = ref()
|
||||
const openForm = (type: string, id?: number) => {
|
||||
formRef.value.open(type, id)
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (id: number) => {
|
||||
try {
|
||||
// 删除的二次确认
|
||||
await message.delConfirm()
|
||||
// 发起删除
|
||||
await QuotationApi.deleteQuotation(id)
|
||||
message.success(t('common.delSuccess'))
|
||||
// 刷新列表
|
||||
await getList()
|
||||
} catch {}
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = async () => {
|
||||
try {
|
||||
// 导出的二次确认
|
||||
await message.exportConfirm()
|
||||
// 发起导出
|
||||
exportLoading.value = true
|
||||
const data = await QuotationApi.exportQuotation(queryParams)
|
||||
download.excel(data, 'CRM 方案报价.xls')
|
||||
} catch {
|
||||
} finally {
|
||||
exportLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 打开联系人详情 */
|
||||
const openContactDetail = (id: number) => {
|
||||
push({ name: 'CrmContactDetail', params: { id } })
|
||||
}
|
||||
|
||||
/** 打开客户详情 */
|
||||
const openCustomerDetail = (id: number) => {
|
||||
push({ name: 'CrmCustomerDetail', params: { id } })
|
||||
}
|
||||
|
||||
/** 初始化 **/
|
||||
onMounted(async () => {
|
||||
getList()
|
||||
// 获得客户列表
|
||||
customerList.value = await CustomerApi.getCustomerSimpleList()
|
||||
// 获得用户列表
|
||||
userOptions.value = await UserApi.getSimpleUserList()
|
||||
})
|
||||
</script>
|
||||
Loading…
Reference in New Issue