商机新增发邮件发短信

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" /> 新增 <Icon icon="ep:plus" class="mr-5px" /> 新增
</el-button> </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-item>
</el-form> </el-form>
</ContentWrap> </ContentWrap>
<!-- 列表 --> <!-- 列表 -->
<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="id" align="center" prop="id" />
<el-table-column label="商机名称" align="center" prop="name" width="150"> <el-table-column label="商机名称" align="center" prop="name" width="150">
<template #default="scope"> <template #default="scope">
@ -144,6 +163,8 @@
<BusinessForm ref="formRef" @success="getList" /> <BusinessForm ref="formRef" @success="getList" />
<RecordForm ref="recordFormRef" /> <RecordForm ref="recordFormRef" />
<BusRecordForm ref="busRecordFormRef" /> <BusRecordForm ref="busRecordFormRef" />
<SmsTemplateSendForm ref="smsTemplateSendFormRef" />
<MailTemplateSendForm ref="mailTemplateSendFormRef" />
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@ -154,6 +175,8 @@ import BusinessForm from './BusinessForm.vue'
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import RecordForm from '@/views/crm/crmrecord/RecordForm.vue' import RecordForm from '@/views/crm/crmrecord/RecordForm.vue'
import BusRecordForm from '@/views/crm/crmbusinessrecord/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' }) defineOptions({ name: 'CrmBusiness' })
@ -177,6 +200,8 @@ const queryParams = reactive({
const queryFormRef = ref() // const queryFormRef = ref() //
const exportLoading = ref(false) // const exportLoading = ref(false) //
const activeIndex = ref('my') const activeIndex = ref('my')
const selectCustomers = ref([])
const isDisabled = ref(true)
/** 查询列表 */ /** 查询列表 */
const getList = async () => { 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) => { const handleSelect = (key) => {
queryParams.relation = key queryParams.relation = key
getList() getList()
@ -236,19 +275,14 @@ const handleDelete = async (id: number) => {
} catch {} } catch {}
} }
/** 导出按钮操作 */ const smsTemplateSendFormRef = ref()
const handleExport = async () => { const openSms = () => {
try { smsTemplateSendFormRef.value.open(selectCustomers.value,true)
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await BusinessApi.exportBusiness(queryParams)
download.excel(data, '商机.xls')
} catch {
} finally {
exportLoading.value = false
} }
const mailTemplateSendFormRef = ref()
const openMail = () => {
mailTemplateSendFormRef.value.open(selectCustomers.value,true)
} }
/** 初始化 **/ /** 初始化 **/