商机新增发邮件发短信

This commit is contained in:
hupeng 2024-12-02 10:30:54 +08:00
parent 968262c5c0
commit 04c3d94bd3

View File

@ -56,13 +56,32 @@
>
<Icon icon="ep:plus" class="mr-5px" /> 新增
</el-button>
<el-button
type="warning"
plain
@click="openSms"
:disabled = "isDisabled"
v-hasPermi="['crm:business:send-sms']"
>
<Icon icon="ep:notification" class="mr-5px" /> 发短信
</el-button>
<el-button
type="danger"
plain
@click="openMail"
:disabled = "isDisabled"
v-hasPermi="['crm:business:send-mail']"
>
<Icon icon="ep:message" 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 v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="40" />
<el-table-column label="id" align="center" prop="id" />
<el-table-column label="商机名称" align="center" prop="name" width="150">
<template #default="scope">
@ -144,6 +163,8 @@
<BusinessForm ref="formRef" @success="getList" />
<RecordForm ref="recordFormRef" />
<BusRecordForm ref="busRecordFormRef" />
<SmsTemplateSendForm ref="smsTemplateSendFormRef" />
<MailTemplateSendForm ref="mailTemplateSendFormRef" />
</template>
<script setup lang="ts">
@ -154,6 +175,8 @@ import BusinessForm from './BusinessForm.vue'
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import RecordForm from '@/views/crm/crmrecord/RecordForm.vue'
import BusRecordForm from '@/views/crm/crmbusinessrecord/RecordForm.vue'
import SmsTemplateSendForm from '@/views/components/sms/SmsTemplateSendForm.vue'
import MailTemplateSendForm from '@/views/components/email/MailTemplateSendForm.vue'
/** 商机 列表 */
defineOptions({ name: 'CrmBusiness' })
@ -177,6 +200,8 @@ const queryParams = reactive({
const queryFormRef = ref() //
const exportLoading = ref(false) //
const activeIndex = ref('my')
const selectCustomers = ref([])
const isDisabled = ref(true)
/** 查询列表 */
const getList = async () => {
@ -190,6 +215,20 @@ const getList = async () => {
}
}
const handleSelectionChange = (val) => {
if(val.length > 0) {
isDisabled.value = false
}
let newArray = []
val.forEach(element => {
let obj = {}
obj.id = element.customerId
obj.name = element.customerName
newArray.push(obj)
})
selectCustomers.value = newArray
}
const handleSelect = (key) => {
queryParams.relation = key
getList()
@ -236,19 +275,14 @@ const handleDelete = async (id: number) => {
} catch {}
}
/** 导出按钮操作 */
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await BusinessApi.exportBusiness(queryParams)
download.excel(data, '商机.xls')
} catch {
} finally {
exportLoading.value = false
}
const smsTemplateSendFormRef = ref()
const openSms = () => {
smsTemplateSendFormRef.value.open(selectCustomers.value,true)
}
const mailTemplateSendFormRef = ref()
const openMail = () => {
mailTemplateSendFormRef.value.open(selectCustomers.value,true)
}
/** 初始化 **/