| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208 |
- <template>
- <div class="app-container">
- <el-dialog :title="sendMsgOpen.title" :visible.sync="sendMsgOpen.open" width="1000px" append-to-body>
- <el-alert
- type="error"
- :closable="false"
- show-icon>
- <template #title>
- <span style="font-size: 25px; line-height: 1.5;">
- 此功能用于给 选中的 SOP营期 内【所有的】客户发送 消息
- </span>
- </template>
- </el-alert>
- <el-form ref="msgForm" :model="msgForm" :rules="msgRules">
- <el-form-item label="策略" prop="draftStrategy">
- <el-radio-group v-model="msgForm.draftStrategy">
- <el-radio :label="1">正常群发</el-radio>
- <el-radio :label="2">清除草稿</el-radio>
- <el-radio :label="3">发送草稿</el-radio>
- <el-radio :label="4">sip外呼</el-radio>
- </el-radio-group>
- </el-form-item>
- <el-form-item label="选择课程" v-if="msgForm.draftStrategy==1 || msgForm.draftStrategy==4" >
- <el-select v-model="msgForm.courseId" placeholder="请选择课程" style=" margin-right: 10px;" size="mini" filterable clearable @change="courseChange()">
- <el-option
- v-for="dict in courseList"
- :key="dict.dictValue"
- :label="dict.dictLabel"
- :value="parseInt(dict.dictValue)"
- />
- </el-select>
- <el-select v-model="msgForm.videoId" placeholder="请选择小节" size="mini" style=" margin-right: 10px;" filterable clearable @change="videoIdChange()" >
- <el-option
- v-for="dict in videoList"
- :key="dict.dictValue"
- :label="dict.dictLabel"
- :value="parseInt(dict.dictValue)"
- />
- </el-select>
- <el-select v-model="msgForm.courseType" placeholder="请选择消息类型" size="mini" style=" margin-right: 10px;" filterable clearable>
- <el-option
- v-for="dict in sysFsSopWatchStatus"
- :key="dict.dictValue"
- :label="dict.dictLabel"
- :value="parseInt(dict.dictValue)"
- />
- </el-select>
- </el-form-item>
- <el-form-item label="选择直播间" v-if="msgForm.draftStrategy!=4">
- <el-select v-model="liveGroupTypeId"
- placeholder="请选择直播间分组" clearable
- @change="liveGroupTypeChange" >
- <el-option
- v-for="dict in liveGroupTypeList"
- :key="dict.id"
- :label="dict.liveGroupType"
- :value="dict.id"
- />
- </el-select>
- <el-select v-model="msgForm.liveId"
- filterable
- placeholder="请选择直播间" size="mini"
- style=" margin-right: 10px;"
- @change="liveChangemsgForm(msgForm.liveId)" clearable >
- <el-option
- v-for="dict in liveList"
- :key="dict.liveId"
- :label="dict.liveName"
- :value="dict.liveId"
- />
- </el-select>
- </el-form-item>
- <el-form-item label="规则" prop="setting" v-if="msgForm.draftStrategy==1" >
- <div v-for="(item, index) in setting" :key="index" style="background-color: #fdfdfd; border: 1px solid #e6e6e6; margin-bottom: 20px;">
- <el-row>
- <el-col :span="22">
- <el-form :model="item" label-width="70px">
- <el-form-item label="内容类别" style="margin: 2%">
- <el-radio-group v-model="item.contentType">
- <el-radio :label="item.dictValue" v-for="item in sysQwSopAiContentType" @change="handleContentTypeChange()">{{item.dictLabel}}</el-radio>
- </el-radio-group>
- </el-form-item>
- <el-form-item label="内容" style="margin-bottom: 2%" >
- <el-input
- v-if="item.contentType == 1 || item.contentType == 15"
- v-model="item.value"
- type="textarea"
- :rows="3"
- placeholder="内容"
- style="width: 90%; margin-top: 10px;"
- @keydown.native="handleKeydown($event, index)"
- :ref="`textarea-${index}`"
- >
- </el-input>
- <el-link
- v-if="item.contentType == 1 || item.contentType == 15"
- type="primary"
- @click="toggleSalesCall(index)"
- style="margin-top: 10px;"
- >
- {{ item.isSalesCallAdded ? '移除#销售称呼#' : '添加#销售称呼#' }}
- </el-link>
- <el-link
- v-if="item.contentType == 1 || item.contentType == 15"
- type="primary"
- @click="toggleSalesCallCustomer(index)"
- style="margin-top: 10px;margin-left: 2%"
- >
- {{ item.isSalesCallCustomerAdded ? '移除#客户称呼#' : '添加#客户称呼#' }}
- </el-link>
- <ImageUpload v-if="item.contentType == 2 " v-model="item.imgUrl" type="image" :num="1" :width="150" :height="150" />
- <div v-if="item.contentType == 3 || item.contentType ==9 ">
- <el-card class="box-card">
- <el-form-item label="链接标题:" label-width="100px">
- <el-input v-model="item.linkTitle" placeholder="请输入链接标题" style="width: 90%;"/>
- </el-form-item>
- <el-form-item label="链接描述:" label-width="100px" >
- <el-input type="textarea" :rows="3" v-model="item.linkDescribe" placeholder="请输入链接描述" style="width: 90%;margin-top: 1%;"/>
- </el-form-item>
- <el-form-item label="链接封面:" label-width="100px">
- <ImageUpload v-model="item.linkImageUrl" type="image" :num="1" :file-size="2" :width="150" :height="150" style="margin-top: 1%;" />
- </el-form-item>
- <el-form-item label="链接地址:" label-width="100px" >
- <el-tag type="warning" v-model="item.isBindUrl=1">选择的课程小节 即为卡片链接地址</el-tag>
- </el-form-item>
- </el-card>
- </div>
- <div v-if="item.contentType == 4 || item.contentType == 10 || item.contentType == 17 || item.contentType == 23">
- <el-card class="box-card">
- <el-form-item label="标题" prop="miniprogramTitle">
- <el-input v-model="item.miniprogramTitle" placeholder="请输入小程序消息标题,最长为64字" />
- </el-form-item>
- <el-form-item label="封面" prop="miniprogramPicUrl">
- <ImageUpload v-model="item.miniprogramPicUrl" type="image" :num="10" :width="150" :height="150" />
- </el-form-item>
- <el-form-item label="appid" prop="miniprogramAppid" v-show="false" >
- <el-input v-model="item.miniprogramAppid='wx73f85f8d62769119' " disabled />
- </el-form-item>
- <el-form-item label="page路径" prop="miniprogramPage" v-show="item.contentType == 10" label-width="100px" style="margin-left: -30px" >
- <el-input v-model="item.miniprogramPage" placeholder="小程序消息打开后的路径" type="textarea" :rows="3" />
- </el-form-item>
- </el-card>
- </div>
- <div v-if="item.contentType == 5 ">
- <el-form-item label="上传文件:" prop="fileUrl" label-width="100px">
- <el-upload
- v-model="item.fileUrl"
- class="avatar-uploader"
- :action="uploadUrl"
- :show-file-list="false"
- :on-success="(res, file) => handleAvatarSuccessFile(res, file, item)"
- :before-upload="beforeAvatarUploadFile">
- <i class="el-icon-plus avatar-uploader-icon"></i>
- </el-upload>
- <el-link v-if="item.fileUrl" type="primary" :href="downloadUrl(item.fileUrl)" download>
- {{item.fileUrl}}
- </el-link>
- </el-form-item>
- </div>
- <div v-if="item.contentType == 6 ">
- <el-form-item label="上传视频:" prop="videoUrl" label-width="100px">
- <el-upload
- v-model="item.videoUrl"
- class="avatar-uploader"
- :action="uploadUrl"
- :show-file-list="false"
- :on-success="(res, file) => handleAvatarSuccessVideo(res, file, item)"
- :before-upload="beforeAvatarUploadVideo">
- <i class="el-icon-plus avatar-uploader-icon"></i>
- </el-upload>
- <video v-if="item.videoUrl"
- :src="item.videoUrl"
- controls style="width: 200px;height: 100px">
- </video>
- </el-form-item>
- </div>
- <div v-if="item.contentType == 7 || item.contentType == 16">
- <el-input
- v-model="item.value"
- type="textarea" :rows="3" maxlength="66" show-word-limit
- placeholder="输入要转为语音的内容" style="width: 90%;margin-top: 10px;"
- @input="handleInputVideoText(item.value,item)"/>
- <el-button type="primary" size="mini" plain style="margin-top: 10px;" @click="openVoiceDialog(item)">快捷语音</el-button>
- </div>
- <div v-if="item.contentType == 8">
- <el-button type="primary"
- style="margin-bottom: 1%"
- @click="hanldeSelectVideoNum(setting,index)">
- 选择视频号
- </el-button>
- <el-card class="box-card" v-if="item.coverUrl">
- <el-form-item label="封面标题:" label-width="100px">
- <el-input v-model="item.nickname"
- style="width: 90%;margin-bottom: 1%" disabled/>
- </el-form-item>
- <el-form-item label="头像:" label-width="100px">
- <el-image
- v-if="item.avatar != null"
- :src="item.avatar"
- :preview-src-list="[item.avatar]"
- :style="{ width: '50px', height: '50px' }"
- ></el-image>
- </el-form-item>
- <el-form-item label="封面:" label-width="100px">
- <el-image
- v-if="item.coverUrl != null"
- :src="item.coverUrl"
- :preview-src-list="[item.coverUrl]"
- :style="{ width: '200px', height: '200px' }"
- ></el-image>
- </el-form-item>
- <el-form-item label="简介:" label-width="100px">
- <el-input type="textarea" :rows="3"
- v-model="item.desc"
- style="width: 90%;margin-top: 1%;" disabled/>
- </el-form-item>
- <el-form-item label="视频地址:" label-width="100px"
- style="margin-top: 1%">
- <el-input v-model="item.url"
- style="width: 90%;" disabled/>
- </el-form-item>
- </el-card>
- </div>
- <div v-if="item.contentType == 12 || item.contentType == 18 || item.contentType == 19 || item.contentType == 24 || item.contentType == 20">
- <el-card class="box-card">
- <el-form-item label="直播间分组" label-width="110px">
- <el-select v-model="liveGroupTypeId"
- filterable
- placeholder="请选择直播间分组" clearable
- @change="liveGroupTypeChange" >
- <el-option
- v-for="dict in liveGroupTypeList"
- :key="dict.id"
- :label="dict.liveGroupType"
- :value="dict.id"
- />
- </el-select>
- </el-form-item>
- <el-form-item label="直播间" >
- <el-select v-model="item.liveId"
- filterable
- placeholder="请选择直播间"
- @change="liveChange(item)" >
- <el-option
- v-for="dict in liveList"
- :key="dict.liveId"
- :label="dict.liveName"
- :value="dict.liveId"
- />
- </el-select>
- </el-form-item>
- <el-form-item label="标题" prop="miniprogramTitle">
- <el-input v-model="item.miniprogramTitle" placeholder="请输入小程序消息标题,最长为64字节" :rows="2" maxlength="64"
- type="textarea" />
- </el-form-item>
- <el-form-item label="封面" prop="miniprogramPicUrl">
- <ImageUpload v-model="item.miniprogramPicUrl" type="image" :num="10" :width="150" :height="150" />
- </el-form-item>
- <el-form-item label="appid" prop="miniprogramAppid" v-show="false">
- <el-input v-model="item.miniprogramAppid='wxcfd4cd6e2375e42f' " disabled />
- </el-form-item>
- <el-form-item label="page路径" prop="miniprogramPage" v-show="false" label-width="100px" style="margin-left: -30px">
- <el-input v-model="item.miniprogramPage" placeholder="小程序消息打开后的路径" disabled />
- </el-form-item>
- </el-card>
- </div>
- <div v-if="item.contentType == 14">
- <el-card class="box-card">
- <el-form-item label="福袋名称" >
- <el-select v-model="item.luckyBagId"
- placeholder="请选择福袋" size="mini"
- @change="getLuckyBagStatus(item)" >
- <el-option
- v-for="dict in luckyBagList"
- :key="dict.id"
- :label="dict.name"
- :value="dict.id"
- />
- </el-select>
- </el-form-item>
- <el-form-item label="福袋状态" >
- <el-tag :type="item.luckyBagDataStatus == 1 ? 'success' : 'danger'">
- {{ item.luckyBagDataStatus == 1 ? '启用' : '禁用' }}
- </el-tag>
- </el-form-item>
- </el-card>
- </div>
- </el-form-item>
- <el-form-item label="添加短链" v-if="item.contentType == 1 || item.contentType == 15" >
- <el-tooltip content="请先根据课程选定课程小节之后再添加" effect="dark" :disabled="!!msgForm.videoId">
- <el-switch
- v-model="item.isBindUrl"
- :disabled="!msgForm.videoId"
- active-color="#13ce66"
- inactive-color="#DCDFE6"
- active-value="1"
- inactive-value="2">
- </el-switch>
- </el-tooltip>
- <span v-if="item.isBindUrl == '1'" style="margin-left: 10px; color: #13ce66">添加URL</span>
- <span v-if="item.isBindUrl == '2'" style="margin-left: 10px; color: #b1b4ba">不加URL</span>
- </el-form-item>
- <el-form-item label="课节过期时间" v-if="item.isBindUrl == '1'
- && item.contentType != 2
- && item.contentType != 5
- && item.contentType != 6
- && item.contentType != 8"
- style="margin-top: 1%" label-width="100px">
- <el-row>
- <el-input-number v-model="item.expiresDays" :min="1" :max="100" ></el-input-number>
- (天)
- </el-row>
- <el-row>
- <span class="tip">填写0或不填时,默认为系统配置的默认时间</span>
- </el-row>
- </el-form-item>
- </el-form>
- </el-col>
- <el-col :span="1" :offset="1">
- <i class="el-icon-delete" @click="delSetList(index)" style="margin-top: 20px;" v-if="setting.length>1"></i>
- </el-col>
- </el-row>
- </div>
- <el-link type="primary" class="el-icon-plus" :underline="false" @click='addSetList()' >添加内容</el-link>
- </el-form-item>
- <el-form-item label="外呼任务" v-if="msgForm.draftStrategy==4" >
- <el-select v-model="msgForm.aiCustomerRoleId"
- placeholder="请选择外呼任务" size="mini"
- @change="getAiSipCallTask()" >
- <el-option
- v-for="template in aiSipCallTaskList"
- :key="template.batchId"
- :label="template.batchName"
- :value="template.batchId"
- />
- </el-select>
- </el-form-item>
- <el-form-item label="发送时间" prop="sendTime" v-if="msgForm.draftStrategy==1 || msgForm.draftStrategy==4" >
- <el-date-picker
- class="custom-input"
- v-model="msgForm.sendTime"
- type="datetime"
- value-format="yyyy-MM-dd HH:mm:ss"
- format="yyyy-MM-dd HH:mm:ss"
- placeholder="选择日期时间"
- :picker-options="pickerOptions"
- style="width: 220px;">
- </el-date-picker>
- <span class="tip" style="margin-left: 2%"> 不填时,默认为系统当前时间(立即发送)</span>
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button type="primary" @click="submitMsgForm">确 定</el-button>
- <el-button @click="cancelMsgForm">取 消</el-button>
- </div>
- </el-dialog>
- <el-dialog :title="videoNumOptions.title" :visible.sync="videoNumOptions.open" width="1500px" append-to-body>
- <userVideo ref="QwUserVideo" @videoResult="qwUserVideoResult"></userVideo>
- </el-dialog>
- <el-dialog :title="voiceOptions.title" :visible.sync="voiceOptions.open" width="800px" append-to-body>
- <div style="margin-bottom: 10px;">
- <el-input v-model="voiceOptions.keyword" placeholder="请输入关键词搜索" style="width: 300px;" clearable @clear="searchVoice" @keyup.enter.native="searchVoice">
- <el-button slot="append" icon="el-icon-search" @click="searchVoice">搜索</el-button>
- </el-input>
- </div>
- <el-table :data="voiceOptions.list" v-loading="voiceOptions.loading" highlight-current-row @current-change="handleVoiceSelect">
- <el-table-column prop="voiceTxt" label="语音内容" min-width="200" show-overflow-tooltip></el-table-column>
- <el-table-column label="操作" width="80" align="center">
- <template slot-scope="scope">
- <el-button type="text" size="mini" @click="selectVoice(scope.row)">选择</el-button>
- </template>
- </el-table-column>
- </el-table>
- <el-pagination
- style="margin-top: 10px; text-align: right;"
- background
- layout="total, prev, pager, next"
- :total="voiceOptions.total"
- :page-size="voiceOptions.pageSize"
- :current-page.sync="voiceOptions.pageNum"
- @current-change="searchVoice">
- </el-pagination>
- </el-dialog>
- </div>
- </template>
- <script>
- import { sendMsg,} from "../../../api/qw/sopUserLogsInfo";
- import ImageUpload from "@/views/qw/sop/ImageUpload.vue";
- import {courseList, videoList} from "@/api/qw/sop";
- import userVideo from "@/views/qw/userVideo/userVideo";
- import {listReward} from "@/api/qw/luckyBag";
- import {listToLiveNoEnd, listLiveGroupType} from "@/api/live/live";
- import { getQwSopTempVoiceCompanyUser } from "@/api/qw/QwSopTempVoice";
- import { listAiSipCallTask } from '@/api/aiSipCall/aiSipCallTask'
- export default {
- name: "sendMsgSopOpenTool",
- components: {ImageUpload,userVideo},
- data() {
- return {
- aiSipCallTaskList: [],
- queryParams1: {
- pageNum: 1,
- pageSize: 10,
- dataStatus: '1',
- name: null,
- type: null
- },
- luckyBagList: [],
- projectFrom:process.env.VUE_APP_PROJECT_FROM,
- videoNumOptions: {
- title: '选择视频号',
- open: false,
- content: null,
- contentIndex: null,
- },
- voiceOptions: {
- title: '快捷语音',
- open: false,
- keyword: '',
- list: [],
- loading: false,
- total: 0,
- pageNum: 1,
- pageSize: 5,
- currentItem: null,
- },
- //上传语音的遮罩层
- voiceLoading :false,
- uploadUrl:process.env.VUE_APP_BASE_API+"/common/uploadOSS",
- uploadUrlByVoice:process.env.VUE_APP_BASE_API+"/common/uploadOSSByHOOKVoice",
- // 遮罩层
- loading: true,
- // 导出遮罩层
- exportLoading: false,
- // 选中数组
- ids: [],
- // 非单个禁用
- single: true,
- // 非多个禁用
- multiple: true,
- // 显示搜索条件
- showSearch: true,
- // 总条数
- total: 0,
- // sopUserLogsInfo表格数据
- sopUserLogsInfoList: [],
- sysFsSopWatchStatus: [],
- isSalesCallAdded:false,
- isSalesCallCustomerAdded:false,
- tagList:[],
- selectTags:[],
- // 弹出层标题
- title: "",
- // 是否显示弹出层
- open: false,
- updateOpen:false,
- // 查询参数
- queryParams: {
- pageNum: 1,
- pageSize: 10,
- tagIds:null,
- remark:null,
- sopId: null,
- userLogsId: null,
- userIdParam:null,
- startTimeParam:null,
- externalContactId: null,
- qwUserId: null,
- corpId: null,
- externalId: null,
- fsUserId: null,
- externalUserName: null,
- createTime: null,
- },
- courseList:[],
- videoList:[],
- //插件版
- sysQwSopAiContentType:[],
- liveList: [],
- liveGroupTypeList: [],
- liveGroupTypeId: null,
- sendMsgOpen:{
- title:'一键批量群发',
- open:false,
- ids:null,
- },
- // 表单参数
- form: {},
- setting:[{contentType:'1', value: '',}],
- msgForm:{
- videoId:null,
- courseId:null,
- courseType:null,
- userIdParam:null,
- setting:null,
- ids:null,
- type:null,
- corpId:null,
- sopId: null,
- sopIds: null,
- startTime: null,
- sendTime: null,
- draftStrategy:1,
- },
- // 表单校验
- rules: {},
- batchRules:{
- paramTime: [
- { required: true, message: '选择的时间不能为空', trigger: 'blur' }
- ],
- },
- msgRules:{},
- pickerOptions: {
- shortcuts: [
- {
- text: '现在',
- onClick(picker) {
- picker.$emit('pick', new Date());
- }
- },
- {
- text: '1小时后',
- onClick(picker) {
- const date = new Date();
- date.setTime(date.getTime() + 3600 * 1000);
- picker.$emit('pick', date);
- }
- },
- {
- text: '明天此时',
- onClick(picker) {
- const date = new Date();
- date.setTime(date.getTime() + 3600 * 1000 * 24);
- picker.$emit('pick', date);
- }
- },
- {
- text: '后天此时',
- onClick(picker) {
- const date = new Date();
- date.setTime(date.getTime() + 3600 * 1000 * 24 * 2);
- picker.$emit('pick', date);
- }
- },
- {
- text: '一周后',
- onClick(picker) {
- const date = new Date();
- date.setTime(date.getTime() + 3600 * 1000 * 24 * 7);
- picker.$emit('pick', date);
- }
- }
- ]
- },
- };
- },
- created() {
- this.getDicts("sys_qwSopAi_contentType").then(response => {
- this.sysQwSopAiContentType = response.data;
- });
- this.getDicts("sys_fs_sop_watch_status").then(response => {
- this.sysFsSopWatchStatus = response.data;
- });
- listToLiveNoEnd().then(response => {
- this.liveList = response.rows;
- });
- listLiveGroupType().then(response => {
- this.liveGroupTypeList = response.rows || response.data || [];
- });
- courseList().then(response => {
- this.courseList = response.list;
- });
- listReward(this.queryParams1).then(response => {
- this.luckyBagList = response.rows;
- });
- this.loadSipTemplates();
- },
- methods: {
- loadSipTemplates() {
- if (this.aiSipCallTaskList.length > 0) {
- return; // 如果已经有数据,不再重复加载
- }
- listAiSipCallTask({taskType: 1,status: 0,pageNum: 1,pageSize: 100}).then(response => {
- this.aiSipCallTaskList = response.rows || response.data || [];
- if (this.aiSipCallTaskList.length === 0) {
- }
- }).catch(error => {
- console.error('加载sip模板失败:', error);
- this.$message.error('加载sip模板失败');
- });
- },
- // 获取sip模板信息
- getAiSipCallTask() {
- if (this.aiSipCallTaskList.length === 0) {
- listAiSipCallTask({taskType: 1,status: 0,pageNum: 1,pageSize: 100}).then(response => {
- this.aiSipCallTaskList = response.rows || response.data || [];
- }).catch(error => {
- console.error('加载sip模板失败:', error);
- this.$message.error('加载sip模板失败');
- });
- }
- },
- getLuckyBagStatus(content) {
- const selectedLuckyBag = this.luckyBagList.find(item => item.id === content.luckyBagId);
- if (selectedLuckyBag) {
- content.luckyBagDataStatus = selectedLuckyBag.dataStatus; // 自动填充标题
- } else {
- // 若未找到对应直播间,清空标题和封面(可选)
- content.luckyBagDataStatus = null;
- }
- },
- liveChange(content) {
- // content.liveId 是选中的直播间 ID(liveId)
- const selectedLive = this.liveList.find(live => live.liveId === content.liveId);
- if (selectedLive) {
- // 从选中的直播间对象中提取标题和封面,赋值给当前内容的对应字段
- // 假设直播间对象中标题字段为 liveTitle,封面字段为 coverImg(根据实际接口字段调整)
- content.miniprogramTitle = selectedLive.liveName || ''; // 自动填充标题
- content.miniprogramPicUrl = selectedLive.liveImgUrl || ''; // 自动填充封面
- } else {
- // 若未找到对应直播间,清空标题和封面(可选)
- content.miniprogramTitle = '';
- content.miniprogramPicUrl = '';
- }
- },
- liveGroupTypeChange(val) {
- if (val) {
- listToLiveNoEnd({ liveGroupType: val }).then(response => {
- this.liveList = response.rows;
- });
- } else {
- listToLiveNoEnd().then(response => {
- this.liveList = response.rows;
- });
- }
- // 切换分组时清空已选的直播间
- if (this.msgForm.liveId) {
- this.msgForm.liveId = null;
- }
- // 清空规则中的直播间
- for (let i = 0; i < this.setting.length; i++) {
- this.$set(this.setting[i], 'liveId', null);
- }
- },
- qwUserVideoResult(val) {
- // 根据选中的内容,将返回的数据更新到相应的表单项
- const content = this.videoNumOptions.content;
- const setList = content[this.videoNumOptions.contentIndex];
- setList.nickname = val.nickname;
- setList.avatar = val.avatar;
- setList.coverUrl = val.coverUrl;
- setList.thumbUrl = val.thumbUrl;
- setList.desc = val.desc;
- setList.url = val.url;
- setList.extras = val.extras;
- setList.videoId = val.id;
- console.info(setList)
- this.videoNumOptions.open = false;
- },
- oneClickGroupSending(val,type,corpId,isMine){
- this.sendMsgOpen.open= true;
- this.msgForm.sopIds = val;
- this.msgForm.type = type;
- this.msgForm.corpId = corpId;
- this.msgForm.isMine = isMine;
- },
- courseChange() {
- if (this.msgForm.courseId != null ) {
- const selectedCourse = this.courseList.find(course => parseInt(course.dictValue) === this.msgForm.courseId);
- for (let i = 0; i < this.setting.length; i++) {
- //响应式直接给链接的标题/封面上值
- if (selectedCourse && this.msgForm.courseId != null) {
- if ( this.setting[i].contentType == 3 || this.setting[i].contentType == 9 ){
- this.$set(this.setting[i], 'linkTitle', selectedCourse.dictLabel);
- this.$set(this.setting[i], 'linkImageUrl', selectedCourse.dictImgUrl);
- }
- if ( this.setting[i].contentType == 4 || this.setting[i].contentType == 10 || this.setting[i].contentType == 17
- || this.setting[i].contentType == 23){//新增APP 看课 跳转短链回填封面
- this.$set(this.setting[i], 'miniprogramPicUrl', selectedCourse.dictImgUrl);
- }
- }
- }
- }
- videoList(this.msgForm.courseId).then(response => {
- this.videoList=response.list;
- });
- this.msgForm.videoId = null
- },
- videoIdChange() {
- if (this.msgForm.videoId != null ) {
- // 查找选中的课节对应的 label
- const selectedVideo = this.videoList.find(course => parseInt(course.dictValue) === this.msgForm.videoId);
- for (let i = 0; i < this.setting.length; i++) {
- //响应式直接给链接的描述上值
- if (selectedVideo && this.msgForm.videoId != null) {
- if (this.setting[i].contentType == 3 || this.setting[i].contentType == 9 ){
- this.$set(this.setting[i], 'linkDescribe', selectedVideo.dictLabel);
- if (this.projectFrom == 'sxjz' && selectedVideo.dictImgUrl) {
- this.$set(this.setting[i], 'linkImageUrl', selectedVideo.dictImgUrl);
- }
- }
- if (this.setting[i].contentType == 4 || this.setting[i].contentType == 10 || this.setting[i].contentType == 17
- || this.setting[i].contentType == 23){//新增APP 看课 跳转短链回填标题
- this.$set(this.setting[i], 'miniprogramTitle', selectedVideo.dictLabel);
- if (this.projectFrom == 'sxjz' && selectedVideo.dictImgUrl) {
- this.$set(this.setting[i], 'miniprogramPicUrl', selectedVideo.dictImgUrl);
- }
- }
- }
- }
- }
- },
- handleAvatarSuccessFile(res, file, item) {
- if (res.code === 200) {
- // 使用 $set 确保响应式更新
- this.$set(item, 'fileUrl', res.url);
- } else {
- this.msgError(res.msg);
- }
- },
- beforeAvatarUploadFile(file){
- const isLt1M = file.size / 1024 / 1024 < 10;
- if (!isLt1M) {
- this.$message.error('上传大小不能超过 10MB!');
- }
- return isLt1M;
- },
- //下载文件
- downloadUrl(materialUrl) {
- // 直接返回文件 URL
- return materialUrl;
- },
- handleAvatarSuccessVideo(res, file, item) {
- if(res.code==200){
- // 使用 $set 确保响应式更新
- this.$set(item, 'videoUrl', res.url);
- }
- else{
- this.msgError(res.msg);
- }
- },
- beforeAvatarUploadVideo(file){
- const isLt30M = file.size / 1024 / 1024 < 10;
- const isMP4 = file.type === 'video/mp4';
- if (!isMP4) {
- this.$message.error('仅支持上传 MP4 格式的视频文件!');
- return false;
- }
- if (!isLt30M) {
- this.$message.error('上传大小不能超过 10MB!');
- return false;
- }
- return true;
- },
- handleInputVideoText(value,content){
- // 允许的字符:中文、英文(大小写)、数字和指定标点符号(,。!?)
- const regex = /^[\u4e00-\u9fa5,。!?,!?]+$/;
- // 删除不符合条件的字符
- const filteredValue = value.split('').filter(char => regex.test(char)).join('');
- this.$set(content, 'value', filteredValue);
- },
- delSetList(index){
- this.setting.splice(index,1)
- },
- addSetList(){
- const newSetting = {
- contentType:'1',
- value: '',
- };
- // 将新设置项添加到 content.setting 数组中
- this.setting.push(newSetting);
- },
- //选择视频号
- hanldeSelectVideoNum(content, index) {
- this.videoNumOptions.content = content;
- this.videoNumOptions.contentIndex = index;
- this.videoNumOptions.open = true;
- },
- handleKeydown(event, index) {
- const item = this.setting[index];
- const textarea = this.$refs[`textarea-${index}`][0].$refs.textarea;
- const cursorPosition = textarea.selectionStart;
- // 检查是否按下了 Backspace 或 Delete 键
- if (event.key === 'Backspace' || event.key === 'Delete') {
- const tags = ['#销售称呼#', '#客户称呼#']; // 需要检查的标签
- const value = item.value;
- // 遍历标签,检查是否需要删除
- for (const tag of tags) {
- let start, end;
- if (event.key === 'Backspace') {
- // 检查光标前是否是当前标签的一部分
- start = cursorPosition - tag.length;
- if (start >= 0 && value.slice(start, cursorPosition) === tag) {
- // 删除整个标签
- item.value = value.slice(0, start) + value.slice(cursorPosition);
- // 更新光标位置
- this.$nextTick(() => {
- textarea.setSelectionRange(start, start);
- });
- // 更新状态
- if (tag === '#销售称呼#') item.isSalesCallAdded = false;
- if (tag === '#客户称呼#') item.isSalesCallCustomerAdded = false;
- event.preventDefault(); // 阻止默认删除行为
- break; // 找到匹配的标签后退出循环
- }
- } else if (event.key === 'Delete') {
- // 检查光标后是否是当前标签的一部分
- end = cursorPosition + tag.length;
- if (end <= value.length && value.slice(cursorPosition, end) === tag) {
- // 删除整个标签
- item.value = value.slice(0, cursorPosition) + value.slice(end);
- // 更新状态
- if (tag === '#销售称呼#') item.isSalesCallAdded = false;
- if (tag === '#客户称呼#') item.isSalesCallCustomerAdded = false;
- event.preventDefault(); // 阻止默认删除行为
- break; // 找到匹配的标签后退出循环
- }
- }
- // 检查光标是否位于标签的中间
- for (let i = 0; i <= tag.length; i++) {
- const tagStart = cursorPosition - i;
- const tagEnd = tagStart + tag.length;
- if (
- tagStart >= 0 &&
- tagEnd <= value.length &&
- value.slice(tagStart, tagEnd) === tag
- ) {
- // 删除整个标签
- item.value = value.slice(0, tagStart) + value.slice(tagEnd);
- // 更新光标位置
- this.$nextTick(() => {
- textarea.setSelectionRange(tagStart, tagStart);
- });
- // 更新状态
- if (tag === '#销售称呼#') item.isSalesCallAdded = false;
- if (tag === '#客户称呼#') item.isSalesCallCustomerAdded = false;
- event.preventDefault(); // 阻止默认删除行为
- break; // 找到匹配的标签后退出循环
- }
- }
- }
- }
- },
- // 切换添加销售称呼按钮点击事件
- toggleSalesCall(index) {
- const item = this.setting[index];
- const salesCall = '#销售称呼#';
- const textarea = this.$refs[`textarea-${index}`][0].$refs.textarea;
- // 获取当前光标位置
- const cursorPosition = textarea.selectionStart;
- if (item.isSalesCallAdded) {
- // 移除所有的 #销售称呼#
- item.value = item.value.replace(new RegExp(salesCall, 'g'), '');
- } else {
- // 添加 #销售称呼#
- item.value = item.value.slice(0, cursorPosition) + salesCall + item.value.slice(cursorPosition);
- }
- // 切换状态
- item.isSalesCallAdded = !item.isSalesCallAdded;
- // 保持光标位置
- this.$nextTick(() => {
- textarea.setSelectionRange(cursorPosition, cursorPosition);
- });
- },
- toggleSalesCallCustomer(index) {
- const item = this.setting[index];
- const salesCall = '#客户称呼#';
- const textarea = this.$refs[`textarea-${index}`][0].$refs.textarea;
- // 获取当前光标位置
- const cursorPosition = textarea.selectionStart;
- if (item.isSalesCallCustomerAdded) {
- // 移除所有的 #销售称呼#
- item.value = item.value.replace(new RegExp(salesCall, 'g'), '');
- } else {
- // 添加 #客户称呼#
- item.value = item.value.slice(0, cursorPosition) + salesCall + item.value.slice(cursorPosition);
- }
- // 切换状态
- item.isSalesCallCustomerAdded = !item.isSalesCallCustomerAdded;
- // 保持光标位置
- this.$nextTick(() => {
- textarea.setSelectionRange(cursorPosition, cursorPosition);
- });
- },
- handleContentTypeChange() {
- //如果是链接的才上
- if (this.msgForm.courseId != null ) {
- const selectedCourse = this.courseList.find(course => parseInt(course.dictValue) === this.msgForm.courseId);
- for (let i = 0; i < this.setting.length; i++) {
- //响应式直接给链接的标题/封面上值
- if (selectedCourse && this.msgForm.courseId != null) {
- if (this.setting[i].contentType == 3 || this.setting[i].contentType == 9){
- this.$set(this.setting[i], 'linkTitle', selectedCourse.dictLabel);
- this.$set(this.setting[i], 'linkImageUrl', selectedCourse.dictImgUrl);
- }
- if (this.setting[i].contentType == 4 || this.setting[i].contentType == 10 || this.setting[i].contentType == 17
- || this.setting[i].contentType == 23){
- this.$set(this.setting[i], 'miniprogramPicUrl', selectedCourse.dictImgUrl);
- }
- }
- }
- }
- if (this.msgForm.videoId != null ) {
- // 查找选中的课节对应的 label
- const selectedVideo = this.videoList.find(course => parseInt(course.dictValue) === this.msgForm.videoId);
- for (let i = 0; i < this.setting.length; i++) {
- //响应式直接给链接的描述上值
- if (selectedVideo && this.msgForm.videoId != null) {
- if (this.setting[i].contentType == 3 || this.setting[i].contentType == 9){
- this.$set(this.setting[i], 'linkDescribe', selectedVideo.dictLabel);
- if (this.projectFrom == 'sxjz' && selectedVideo.dictImgUrl) {
- this.$set(this.setting[i], 'linkImageUrl', selectedVideo.dictImgUrl);
- }
- }
- if (this.setting[i].contentType == 4 || this.setting[i].contentType == 10 || this.setting[i].contentType == 17
- || this.setting[i].contentType == 23){
- this.$set(this.setting[i], 'miniprogramTitle', selectedVideo.dictLabel);
- if (this.projectFrom == 'sxjz' && selectedVideo.dictImgUrl) {
- this.$set(this.setting[i], 'miniprogramPicUrl', selectedVideo.dictImgUrl);
- }
- }
- }
- }
- }
- },
- resetSendMsgSop() {
- this.liveGroupTypeId = null;
- this.msgForm = {
- videoId:null,
- courseId:null,
- courseType:null,
- setting:null,
- sendTime:null,
- draftStrategy:1,
- };
- this.resetForm("msgForm");
- },
- // 多选框选中数据
- handleSelectionChange(selection) {
- this.ids = selection.map(item => item.id)
- this.single = selection.length!==1
- this.multiple = !selection.length
- },
- submitMsgForm(){
- this.$refs["msgForm"].validate(valid => {
- if (valid) {
- if (this.msgForm.draftStrategy==1 || this.msgForm.draftStrategy == 4 ){
- this.msgForm.setting = JSON.stringify(this.setting);
- let jsonSetting = JSON.parse(this.msgForm.setting);
- let hasLiveSetting = false;
- let count = 0;
- for (let index = 0; index < jsonSetting.length; index++) {
- if (jsonSetting[index] && [12, 18, 19, 24].includes(Number(jsonSetting[index].contentType))) {
- hasLiveSetting = true;
- count++;
- }
- }
- if (hasLiveSetting) {
- if (this.msgForm.courseId) {
- return this.$message.error("直播间不能选取课程");
- }
- if (this.msgForm.videoId) {
- return this.$message.error("直播间不能选取课节");
- }
- if (count > 1) {
- return this.$message.error("直播间一次只能发送一条");
- }
- }
- if (this.setting.length <= 0) {
- return this.$message.error("请添加规则")
- }
- if (!hasLiveSetting && !this.msgForm.courseId){
- return this.$message.error("课程不能为空")
- }
- if (!hasLiveSetting && !this.msgForm.videoId){
- return this.$message.error("课节不能为空")
- }
- if (this.msgForm.courseType===null || this.msgForm.courseType===''){
- return this.$message.error("消息类型不能为空")
- }
- if(this.msgForm.draftStrategy == 4){
- if (this.msgForm.aiCustomerRoleId == null || this.msgForm.aiCustomerRoleId == '') {
- return this.$message.error("请选择外呼任务")
- }
- }
- if(this.msgForm.draftStrategy != 4) {
- for (let i = 0; i < this.setting.length; i++) {
- if (this.setting[i].contentType == 1 && (this.setting[i].value == null || this.setting[i].value == "")) {
- return this.$message.error("内容不能为空")
- }
- if (this.setting[i].contentType == 2 && (this.setting[i].imgUrl == null || this.setting[i].imgUrl == "")) {
- return this.$message.error("图片不能为空")
- }
- if ((this.setting[i].contentType == 3 || this.setting[i].contentType == 9) && (this.setting[i].linkTitle == null || this.setting[i].linkTitle == "")) {
- return this.$message.error("链接标题不能为空")
- }
- if ((this.setting[i].contentType == 3 || this.setting[i].contentType == 9) && (this.setting[i].linkDescribe == null || this.setting[i].linkDescribe == "")) {
- return this.$message.error("链接描述不能为空")
- }
- if ((this.setting[i].contentType == 3 || this.setting[i].contentType == 9) && (this.setting[i].linkImageUrl == null || this.setting[i].linkImageUrl == "")) {
- return this.$message.error("链接图片不能为空")
- }
- if ((this.setting[i].contentType == 3 || this.setting[i].contentType == 9) && this.setting[i].type == 1 && (this.setting[i].linkUrl == null || this.setting[i].linkUrl == "")) {
- return this.$message.error("链接地址不能为空")
- }
- if ([4, 10, 17, 23, 24].includes(Number(this.setting[i].contentType)) && (this.setting[i].miniprogramTitle == null || this.setting[i].miniprogramTitle == "")) {
- return this.$message.error("小程序消息标题不能为空")
- }
- if ([4, 10, 17, 23, 24].includes(Number(this.setting[i].contentType)) && (this.setting[i].miniprogramPicUrl == null || this.setting[i].miniprogramPicUrl == "")) {
- return this.$message.error("小程序封面地址不能为空")
- }
- if (this.setting[i].contentType == 10 && (this.setting[i].miniprogramPage == null || this.setting[i].miniprogramPage == "")) {
- return this.$message.error("小程序page地址不能为空")
- }
- if (this.setting[i].contentType == 5 && (this.setting[i].fileUrl == null || this.setting[i].fileUrl == "")) {
- return this.$message.error("文件不能为空")
- }
- if (this.setting[i].contentType == 6 && (this.setting[i].videoUrl == null || this.setting[i].videoUrl == "")) {
- return this.$message.error("视频不能为空")
- }
- if (this.setting[i].contentType == 7 && (this.setting[i].value == null || this.setting[i].value == "")) {
- return this.$message.error("语音不能为空")
- }
- // 添加对福袋的验证
- if (this.setting[i].contentType == 14 && (this.setting[i].luckyBagId == null || this.setting[i].luckyBagId === "")) {
- return this.$message.error("福袋不能为空")
- }
- if ((this.setting[i].contentType == 12 || this.setting[i].contentType == 24) && (this.setting[i].liveId == null || this.setting[i].liveId == "")) {
- return this.$message.error("直播间不能为空");
- }
- }
- }
- }
- this.sendMsgOpen.open = false;
- const loading = this.$loading({
- lock: true,
- text: '正在执行中请稍后~~请不要刷新页面!!',
- spinner: 'el-icon-loading',
- background: 'rgba(0, 0, 0, 0.7)'
- });
- sendMsg(this.msgForm).then(response => {
- this.msgSuccess("一键群发成功");
- loading.close();
- this.setting=[];
- this.resetSendMsgSop();
- }).finally(()=>{
- loading.close();
- });
- }
- });
- },
- cancelMsgForm(){
- this.sendMsgOpen.open = false;
- this.resetSendMsgSop();
- },
- liveChangemsgForm(liveId){
- if(!!liveId){
- for(let i =0;i<this.setting.length;i++){
- this.$set(this.setting[i], 'liveId', liveId);
- this.liveChange(this.setting[i]);
- }
- }
- },
- liveDisabled(){
- return !!this.msgForm && !!this.msgForm.liveId ;
- },
- openVoiceDialog(item) {
- this.voiceOptions.open = true;
- this.voiceOptions.currentItem = item;
- this.voiceOptions.keyword = '';
- this.voiceOptions.pageNum = 1;
- this.searchVoice();
- },
- searchVoice() {
- this.voiceOptions.loading = true;
- getQwSopTempVoiceCompanyUser({
- pageNum: this.voiceOptions.pageNum,
- pageSize: this.voiceOptions.pageSize,
- keyword: this.voiceOptions.keyword || undefined,
- }).then(response => {
- this.voiceOptions.list = response.rows || response.list || [];
- this.voiceOptions.total = response.total || 0;
- }).finally(() => {
- this.voiceOptions.loading = false;
- });
- },
- selectVoice(row) {
- if (this.voiceOptions.currentItem) {
- this.$set(this.voiceOptions.currentItem, 'value', row.voiceTxt || '');
- }
- this.voiceOptions.open = false;
- },
- handleVoiceSelect(row) {
- // 预留行选中事件
- },
- }
- };
- </script>
|