sopUserLogsInfoDetails.vue 60 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595
  1. <template>
  2. <div class="app-container">
  3. <el-alert
  4. title="注意事项"
  5. type="warning"
  6. :closable="false"
  7. show-icon>
  8. <template #title>
  9. <span style="font-size: 20px; line-height: 1.5;">
  10. 搜索【客户备注】【标签】【进线时间】【客户等级】 只能搜索/筛选出 【当前页】的数据)【可以用客户id来搜(客户id来源-》企微/我的企微客户-》列表的企微客户ID)】
  11. </span>
  12. </template>
  13. </el-alert>
  14. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px">
  15. <!-- <el-form-item label="企微员工账号" prop="qwUserId">-->
  16. <!-- <el-input-->
  17. <!-- v-model="queryParams.qwUserId"-->
  18. <!-- placeholder="请输入企微员工账号"-->
  19. <!-- clearable-->
  20. <!-- size="small"-->
  21. <!-- @keyup.enter.native="handleQuery"-->
  22. <!-- />-->
  23. <!-- </el-form-item>-->
  24. <el-form-item label="客户名称" prop="externalUserName">
  25. <el-input
  26. v-model="queryParams.externalUserName"
  27. placeholder="请输入客户名称"
  28. clearable
  29. size="small"
  30. @keyup.enter.native="handleQuery"
  31. />
  32. </el-form-item>
  33. <el-form-item label="客户备注" prop="remark">
  34. <el-input
  35. v-model="queryParams.remark"
  36. placeholder="请输入客户备注"
  37. clearable
  38. size="small"
  39. @keyup.enter.native="handleQuery"
  40. />
  41. </el-form-item>
  42. <el-form-item label="客户id" prop="externalId">
  43. <el-input
  44. v-model="queryParams.externalId"
  45. placeholder="请输入企微客户id"
  46. clearable
  47. size="small"
  48. @keyup.enter.native="handleQuery"
  49. />
  50. </el-form-item>
  51. <el-form-item label="客户等级" prop="level">
  52. <el-select v-model="queryParams.level" placeholder="客户等级" clearable size="small">
  53. <el-option
  54. v-for="dict in ratingType"
  55. :key="dict.dictValue"
  56. :label="dict.dictLabel"
  57. :value="dict.dictValue"
  58. />
  59. </el-select>
  60. </el-form-item>
  61. <el-form-item label="进线时间" prop="entryTime" v-if="queryParams.filterMode == 1">
  62. <el-date-picker clearable size="small"
  63. v-model="queryParams.entryTime"
  64. type="date"
  65. value-format="yyyy-MM-dd"
  66. placeholder="选择营期时间">
  67. </el-date-picker>
  68. </el-form-item>
  69. <el-form-item label="官方群发需求" prop="fsUserIdStatus">
  70. <el-select style="width: 200px" v-model="queryParams.fsUserIdStatus" placeholder="请选择" clearable size="small" >
  71. <el-option
  72. v-for="item in statusOptions"
  73. :key="item.dictValue"
  74. :label="item.dictLabel"
  75. :value="item.dictValue"
  76. />
  77. </el-select>
  78. </el-form-item>
  79. <el-form-item label="标签" prop="tagIds">
  80. <!-- <el-select v-model="selectTags" remote multiple placeholder="请选择" filterable style="width: 100%;">-->
  81. <!-- <el-option-->
  82. <!-- v-for="dict in tagList"-->
  83. <!-- :label="dict.name"-->
  84. <!-- :value="dict.tagId">-->
  85. <!-- </el-option>-->
  86. <!-- </el-select>-->
  87. <div @click="hangleChangeTags()" style="cursor: pointer; border: 1px solid #e6e6e6; background-color: white; overflow: hidden; flex-grow: 1;width: 250px">
  88. <div style="min-height: 35px; max-height: 200px; overflow-y: auto;">
  89. <el-tag type="success"
  90. closable
  91. :disable-transitions="false"
  92. v-for="list in this.selectTags"
  93. :key="list.tagId"
  94. @close="handleCloseTags(list)"
  95. style="margin: 3px;"
  96. >{{list.name}}
  97. </el-tag>
  98. </div>
  99. </div>
  100. </el-form-item>
  101. <el-form-item>
  102. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  103. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  104. </el-form-item>
  105. </el-form>
  106. <el-row :gutter="10" class="mb8" v-if="queryParams.filterMode == 1">
  107. <el-col :span="1.5">
  108. <el-button
  109. type="warning"
  110. icon="el-icon-s-promotion"
  111. size="medium"
  112. :disabled="multiple"
  113. @click="handleSendMsg"
  114. v-hasPermi="['qw:sopUserLogsInfo:msg']"
  115. >一键群发</el-button>
  116. </el-col>
  117. <el-col :span="1.5">
  118. <el-button
  119. type="danger"
  120. plain
  121. icon="el-icon-delete"
  122. size="medium"
  123. :disabled="multiple"
  124. @click="handleUpdate"
  125. v-hasPermi="['qw:sopUserLogsInfo:edit']"
  126. >批量修改客户营期</el-button>
  127. </el-col>
  128. </el-row>
  129. <div style="color: #999;font-size: 14px;display: flex;align-items: center;margin-bottom: 5px" v-if="queryParams.filterMode == 1">
  130. <i class="el-icon-info"></i>
  131. 【一键群发】:用于给 选中的 客户 发送插件信息
  132. </div>
  133. <div style="color: #999;font-size: 14px;display: flex;align-items: center;margin-bottom: 5px" v-if="queryParams.filterMode == 1">
  134. <i class="el-icon-info"></i>
  135. 【批量修改客户营期】:选中 相应的客户 修改到 想进的相应的营期
  136. </div>
  137. <div style="color: #999;font-size: 14px;display: flex;align-items: center;margin-bottom: 5px" v-if="queryParams.filterMode == 1">
  138. <i class="el-icon-info"></i>
  139. 【官方群发许可】:只有这里显示为【是】的,才能通过模板中的 官方群发 来发送(允许条件是 客户点击过【非官方群发】发送的课程!)
  140. </div>
  141. <el-table border v-loading="loading" :data="sopUserLogsInfoList" @selection-change="handleSelectionChange" v-if="queryParams.filterMode == 1">
  142. <el-table-column type="selection" width="55" align="center" />
  143. <el-table-column label="编号" align="center" prop="id" width="100"/>
  144. <!-- <el-table-column label="企微员工账号" align="center" prop="qwUserId" width="100"/>-->
  145. <el-table-column label="客户ID" align="center" prop="externalId" width="100"/>
  146. <!-- <el-table-column label="客户小程序id" align="center" prop="fsUserId" width="100">-->
  147. <!-- <template slot-scope="scope">-->
  148. <!-- <el-tag type="success">-->
  149. <!-- {{ scope.row.fsUserId === 0 || scope.row.fsUserId === null ? '无' : scope.row.fsUserId }}-->
  150. <!-- </el-tag>-->
  151. <!-- </template>-->
  152. <!-- </el-table-column>-->
  153. <el-table-column label="客户名称" align="center" prop="externalUserName" />
  154. <el-table-column label="备注" align="center" prop="remark" />
  155. <el-table-column label="客户标签" align="center" prop="tagIdsName" width="250px">
  156. <template slot-scope="scope">
  157. <div v-for="name in scope.row.tagIdsName" style="display: inline;">
  158. <el-tag type="success">{{ name }}</el-tag>
  159. </div>
  160. </template>
  161. </el-table-column>
  162. <el-table-column label="官方群发许可" align="center" prop="fsUserId" width="70">
  163. <!-- 表头提示 -->
  164. <template slot="header">
  165. <el-tooltip effect="dark" content="即点过小程序链接的,通过插件助手发过一次课,且客户观看了的" placement="top">
  166. <span>官方群发许可</span>
  167. </el-tooltip>
  168. </template>
  169. <!-- 单元格提示 -->
  170. <template slot-scope="scope">
  171. <el-tooltip
  172. effect="dark"
  173. :content="`通过插件助手发过一次课,且客户观看了的`"
  174. placement="top"
  175. >
  176. <el-tag v-if="scope.row.fsUserId > 0" type="success">是</el-tag>
  177. <el-tag v-else type="danger">否</el-tag>
  178. </el-tooltip>
  179. </template>
  180. </el-table-column>
  181. <el-table-column label="客户等级" align="center" prop="levelName" width="180"/>
  182. <el-table-column label="进线时间" align="center" prop="inComTime" width="180"/>
  183. <el-table-column label="添加日期" align="center" prop="createTime" width="180"/>
  184. <el-table-column label="添加时间" align="center" prop="crtTime" width="180"/>
  185. <el-table-column label="修改时间" align="center" prop="updateTime" width="180"/>
  186. <!-- <el-table-column label="官方群发许可" align="center" prop="fsUserId" width="70">-->
  187. <!-- <template slot-scope="scope">-->
  188. <!-- <el-tag v-if="scope.row.fsUserId > 0" type="success">是</el-tag>-->
  189. <!-- <el-tag v-else type="danger">否</el-tag>-->
  190. <!-- </template>-->
  191. <!-- </el-table-column>-->
  192. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="120" fixed="right">
  193. <template slot-scope="scope">
  194. <!-- <el-button-->
  195. <!-- size="mini"-->
  196. <!-- type="text"-->
  197. <!-- icon="el-icon-edit"-->
  198. <!-- @click="handleUpdate(scope.row)"-->
  199. <!-- v-hasPermi="['qw:sopUserLogsInfo:edit']"-->
  200. <!-- >修改客户营期</el-button>-->
  201. <el-button
  202. size="mini"
  203. type="text"
  204. icon="el-icon-delete"
  205. @click="handleDelete(scope.row)"
  206. v-hasPermi="['qw:sopUserLogsInfo:remove']"
  207. >删除客户营期</el-button>
  208. </template>
  209. </el-table-column>
  210. </el-table>
  211. <el-table border v-loading="loading" :data="sopUserLogsInfoList" @selection-change="handleSelectionChange" v-if="queryParams.filterMode == 2">
  212. <el-table-column type="selection" width="55" align="center" />
  213. <el-table-column label="编号" align="center" prop="id" width="100"/>
  214. <el-table-column label="客户名称" align="center" prop="name" />
  215. <el-table-column label="备注" align="center" prop="remark" />
  216. <el-table-column label="客户标签" align="center" prop="tagIdsName" width="250px">
  217. <template slot-scope="scope">
  218. <div v-for="name in scope.row.tagIdsName" style="display: inline;">
  219. <el-tag type="success">{{ name }}</el-tag>
  220. </div>
  221. </template>
  222. </el-table-column>
  223. <el-table-column label="加群时间" align="center" prop="joinTime" width="180"/>
  224. <!-- <el-table-column label="进线时间" align="center" prop="inComTime" width="180"/>-->
  225. </el-table>
  226. <pagination-more
  227. v-show="total>0"
  228. :total="total"
  229. :page.sync="queryParams.pageNum"
  230. :limit.sync="queryParams.pageSize"
  231. @pagination="getList"
  232. />
  233. <el-dialog :title="sendMsgOpen.title" :visible.sync="sendMsgOpen.open" width="1000px" append-to-body>
  234. <el-form ref="msgForm" :model="msgForm" :rules="msgRules" label-width="100px">
  235. <el-form-item label="选择课程">
  236. <el-select v-model="msgForm.courseId" placeholder="请选择课程" style=" margin-right: 10px;" size="mini" remote filterable @change="courseChange()">
  237. <el-option
  238. v-for="dict in courseList"
  239. :key="dict.dictValue"
  240. :label="dict.dictLabel"
  241. :value="parseInt(dict.dictValue)"
  242. />
  243. </el-select>
  244. <el-select v-model="msgForm.videoId" placeholder="请选择小节" size="mini" style=" margin-right: 10px;" remote filterable @change="videoIdChange()" >
  245. <el-option
  246. v-for="dict in videoList"
  247. :key="dict.dictValue"
  248. :label="dict.dictLabel"
  249. :value="parseInt(dict.dictValue)"
  250. />
  251. </el-select>
  252. <el-select v-model="msgForm.courseType" placeholder="请选择消息类型" size="mini" style=" margin-right: 10px;">
  253. <el-option
  254. v-for="dict in sysFsSopWatchStatus"
  255. :key="dict.dictValue"
  256. :label="dict.dictLabel"
  257. :value="parseInt(dict.dictValue)"
  258. />
  259. </el-select>
  260. </el-form-item>
  261. <el-form-item label="规则" prop="setting" >
  262. <div v-for="(item, index) in setting" :key="index" style="background-color: #fdfdfd; border: 1px solid #e6e6e6; margin-bottom: 20px;">
  263. <el-row>
  264. <el-col :span="22">
  265. <el-form :model="item" label-width="70px">
  266. <el-form-item label="内容类别" style="margin: 2%">
  267. <el-radio-group v-model="item.contentType">
  268. <el-radio :label="item.dictValue" v-for="item in sysQwSopAiContentType" @change="handleContentTypeChange()">{{item.dictLabel}}</el-radio>
  269. </el-radio-group>
  270. </el-form-item>
  271. <el-form-item label="内容" style="margin-bottom: 2%" >
  272. <el-input
  273. v-if="item.contentType == 1 || item.contentType == 15"
  274. v-model="item.value"
  275. type="textarea"
  276. :rows="3"
  277. placeholder="内容"
  278. style="width: 90%; margin-top: 10px;"
  279. @keydown.native="handleKeydown($event, index)"
  280. :ref="`textarea-${index}`"
  281. >
  282. </el-input>
  283. <el-link
  284. v-if="item.contentType == 1 || item.contentType == 15"
  285. type="primary"
  286. @click="toggleSalesCall(index)"
  287. style="margin-top: 10px;"
  288. >
  289. {{ item.isSalesCallAdded ? '移除#客服称呼#' : '添加#客服称呼#' }}
  290. </el-link>
  291. <el-link
  292. v-if="item.contentType == 1 || item.contentType == 15"
  293. type="primary"
  294. @click="toggleSalesCallCustomer(index)"
  295. style="margin-top: 10px;margin-left: 2%"
  296. >
  297. {{ item.isSalesCallCustomerAdded ? '移除#客户称呼#' : '添加#客户称呼#' }}
  298. </el-link>
  299. <ImageUpload v-if="item.contentType == 2 " v-model="item.imgUrl" type="image" :num="1" :width="150" :height="150" />
  300. <div v-if="item.contentType == 3 || item.contentType ==9 ">
  301. <el-card class="box-card">
  302. <el-form-item label="链接标题:" label-width="100px">
  303. <el-input v-model="item.linkTitle" placeholder="请输入链接标题" style="width: 90%;"/>
  304. </el-form-item>
  305. <el-form-item label="链接描述:" label-width="100px" >
  306. <el-input type="textarea" :rows="3" v-model="item.linkDescribe" placeholder="请输入链接描述" style="width: 90%;margin-top: 1%;"/>
  307. </el-form-item>
  308. <el-form-item label="链接封面:" label-width="100px">
  309. <ImageUpload v-model="item.linkImageUrl" type="image" :num="1" :file-size="2" :width="150" :height="150" style="margin-top: 1%;" />
  310. </el-form-item>
  311. <el-form-item label="链接地址:" label-width="100px" >
  312. <el-tag type="warning" v-model="item.isBindUrl=1">选择的课程小节 即为卡片链接地址</el-tag>
  313. </el-form-item>
  314. </el-card>
  315. </div>
  316. <div v-if="item.contentType == 4">
  317. <el-card class="box-card">
  318. <el-form-item label="标题" prop="miniprogramTitle">
  319. <el-input v-model="item.miniprogramTitle" placeholder="请输入小程序消息标题,最长为64字" />
  320. </el-form-item>
  321. <el-form-item label="封面" prop="miniprogramPicUrl">
  322. <ImageUpload v-model="item.miniprogramPicUrl" type="image" :num="10" :width="150" :height="150" />
  323. </el-form-item>
  324. <el-form-item label="appid" prop="miniprogramAppid" v-show="false" >
  325. <el-input v-model="item.miniprogramAppid='wx73f85f8d62769119' " disabled />
  326. </el-form-item>
  327. <el-form-item label="page路径" prop="miniprogramPage" v-show="false" label-width="100px" style="margin-left: -30px" >
  328. <el-input v-model="item.miniprogramPage" placeholder="小程序消息打开后的路径" disabled />
  329. </el-form-item>
  330. </el-card>
  331. </div>
  332. <div v-if="item.contentType == 5 ">
  333. <el-form-item label="上传文件:" prop="fileUrl" label-width="100px">
  334. <el-upload
  335. v-model="item.fileUrl"
  336. class="avatar-uploader"
  337. :action="uploadUrl"
  338. :show-file-list="false"
  339. :on-success="(res, file) => handleAvatarSuccessFile(res, file, item)"
  340. :before-upload="beforeAvatarUploadFile">
  341. <i class="el-icon-plus avatar-uploader-icon"></i>
  342. </el-upload>
  343. <el-link v-if="item.fileUrl" type="primary" :href="downloadUrl(item.fileUrl)" download>
  344. {{item.fileUrl}}
  345. </el-link>
  346. </el-form-item>
  347. </div>
  348. <div v-if="item.contentType == 6 ">
  349. <el-form-item label="上传视频:" prop="videoUrl" label-width="100px">
  350. <el-upload
  351. v-model="item.videoUrl"
  352. class="avatar-uploader"
  353. :action="uploadUrl"
  354. :show-file-list="false"
  355. :on-success="(res, file) => handleAvatarSuccessVideo(res, file, item)"
  356. :before-upload="beforeAvatarUploadVideo">
  357. <i class="el-icon-plus avatar-uploader-icon"></i>
  358. </el-upload>
  359. <video v-if="item.videoUrl"
  360. :src="item.videoUrl"
  361. controls style="width: 200px;height: 100px">
  362. </video>
  363. </el-form-item>
  364. </div>
  365. <div v-if="item.contentType == 7 || item.contentType == 16">
  366. <el-input
  367. v-model="item.value"
  368. type="textarea" :rows="3" maxlength="66" show-word-limit
  369. placeholder="输入要转为语音的内容" style="width: 90%;margin-top: 10px;"
  370. @input="handleInputVideoText(item.value,item)"/>
  371. </div>
  372. <div v-if="item.contentType == 12">
  373. <!-- <div >-->
  374. <el-card class="box-card">
  375. <el-form-item label="直播间" >
  376. <el-select v-model="item.liveId"
  377. placeholder="请选择直播间" size="mini"
  378. @change="liveChange(item)" >
  379. <el-option
  380. v-for="dict in liveList"
  381. :key="dict.liveId"
  382. :label="dict.liveName"
  383. :value="dict.liveId"
  384. />
  385. </el-select>
  386. </el-form-item>
  387. <el-form-item label="标题" prop="miniprogramTitle">
  388. <el-input v-model="item.miniprogramTitle" placeholder="请输入小程序消息标题,最长为64字节" :rows="2" maxlength="64"
  389. type="textarea" />
  390. </el-form-item>
  391. <el-form-item label="封面" prop="miniprogramPicUrl">
  392. <ImageUpload v-model="item.miniprogramPicUrl" type="image" :num="10" :width="150" :height="150" />
  393. </el-form-item>
  394. <el-form-item label="appid" prop="miniprogramAppid" v-show="false">
  395. <el-input v-model="item.miniprogramAppid='wx503cf8ab31f83dd4' " disabled />
  396. </el-form-item>
  397. <el-form-item label="page路径" prop="miniprogramPage" v-show="false" label-width="100px" style="margin-left: -30px">
  398. <el-input v-model="item.miniprogramPage" placeholder="小程序消息打开后的路径" disabled />
  399. </el-form-item>
  400. </el-card>
  401. </div>
  402. <div v-if="item.contentType == 8">
  403. <el-button type="primary"
  404. style="margin-bottom: 1%"
  405. @click="hanldeSelectVideoNum(setting,index)">
  406. 选择视频号
  407. </el-button>
  408. <el-card class="box-card" v-if="item.coverUrl">
  409. <el-form-item label="封面标题:" label-width="100px">
  410. <el-input v-model="item.nickname"
  411. style="width: 90%;margin-bottom: 1%" disabled/>
  412. </el-form-item>
  413. <el-form-item label="头像:" label-width="100px">
  414. <el-image
  415. v-if="item.avatar != null"
  416. :src="item.avatar"
  417. :preview-src-list="[item.avatar]"
  418. :style="{ width: '50px', height: '50px' }"
  419. ></el-image>
  420. </el-form-item>
  421. <el-form-item label="封面:" label-width="100px">
  422. <el-image
  423. v-if="item.coverUrl != null"
  424. :src="item.coverUrl"
  425. :preview-src-list="[item.coverUrl]"
  426. :style="{ width: '200px', height: '200px' }"
  427. ></el-image>
  428. </el-form-item>
  429. <el-form-item label="简介:" label-width="100px">
  430. <el-input type="textarea" :rows="3"
  431. v-model="item.desc"
  432. style="width: 90%;margin-top: 1%;" disabled/>
  433. </el-form-item>
  434. <el-form-item label="视频地址:" label-width="100px"
  435. style="margin-top: 1%">
  436. <el-input v-model="item.url"
  437. style="width: 90%;" disabled/>
  438. </el-form-item>
  439. </el-card>
  440. </div>
  441. <div v-if="item.contentType == 14">
  442. <el-card class="box-card">
  443. <el-form-item label="福袋名称" >
  444. <el-select v-model="item.luckyBagId"
  445. placeholder="请选择福袋" size="mini"
  446. @change="getLuckyBagStatus(item)" >
  447. <el-option
  448. v-for="dict in luckyBagList"
  449. :key="dict.id"
  450. :label="dict.name"
  451. :value="dict.id"
  452. />
  453. </el-select>
  454. </el-form-item>
  455. <el-form-item label="福袋状态" >
  456. <el-tag :type="item.luckyBagDataStatus == 1 ? 'success' : 'danger'">
  457. {{ item.luckyBagDataStatus == 1 ? '启用' : '禁用' }}
  458. </el-tag>
  459. </el-form-item>
  460. </el-card>
  461. </div>
  462. </el-form-item>
  463. <el-form-item label="添加短链" v-if="item.contentType == 1 || item.contentType == 15" >
  464. <el-tooltip content="请先根据课程选定课程小节之后再添加" effect="dark" :disabled="!!msgForm.videoId">
  465. <el-switch
  466. v-model="item.isBindUrl"
  467. :disabled="!msgForm.videoId"
  468. active-color="#13ce66"
  469. inactive-color="#DCDFE6"
  470. active-value="1"
  471. inactive-value="2">
  472. </el-switch>
  473. </el-tooltip>
  474. <span v-if="item.isBindUrl == '1'" style="margin-left: 10px; color: #13ce66">添加URL</span>
  475. <span v-if="item.isBindUrl == '2'" style="margin-left: 10px; color: #b1b4ba">不加URL</span>
  476. </el-form-item>
  477. <el-form-item label="课节过期时间" v-if="item.isBindUrl == '1'
  478. && item.contentType != 2
  479. && item.contentType != 5
  480. && item.contentType != 6
  481. && item.contentType != 8"
  482. style="margin-top: 1%" label-width="100px">
  483. <el-row>
  484. <el-input-number v-model="item.expiresDays" :min="1" :max="100" ></el-input-number>
  485. (天)
  486. </el-row>
  487. <el-row>
  488. <span class="tip">填写0或不填时,默认为系统配置的默认时间</span>
  489. </el-row>
  490. </el-form-item>
  491. </el-form>
  492. </el-col>
  493. <el-col :span="1" :offset="1">
  494. <i class="el-icon-delete" @click="delSetList(index)" style="margin-top: 20px;" v-if="setting.length>1"></i>
  495. </el-col>
  496. </el-row>
  497. </div>
  498. <el-link type="primary" class="el-icon-plus" :underline="false" @click='addSetList()' >添加内容</el-link>
  499. </el-form-item>
  500. </el-form>
  501. <div slot="footer" class="dialog-footer">
  502. <el-button type="primary" @click="submitMsgForm">确 定</el-button>
  503. <el-button @click="cancelMsgForm">取 消</el-button>
  504. </div>
  505. </el-dialog>
  506. <!-- 添加或修改sopUserLogsInfo对话框 -->
  507. <el-dialog title="批量修改客户营期" :visible.sync="updateOpen" width="500px" append-to-body>
  508. <el-form ref="updateLogsInfoFrom" :model="updateLogsInfoFrom" :rules="batchRules" label-width="120px">
  509. <el-form-item label="选择营期时间" prop="paramTime">
  510. <el-date-picker clearable size="small"
  511. v-model="updateLogsInfoFrom.paramTime"
  512. type="date"
  513. value-format="yyyy-MM-dd"
  514. placeholder="选择营期时间">
  515. </el-date-picker>
  516. </el-form-item>
  517. </el-form>
  518. <div slot="footer" class="dialog-footer">
  519. <el-button type="primary" @click="submitForm">确 定</el-button>
  520. <el-button @click="cancel">取 消</el-button>
  521. </div>
  522. </el-dialog>
  523. <!-- 搜索标签 -->
  524. <el-dialog :title="changeTagDialog.title" :visible.sync="changeTagDialog.open" style="width:100%;height: 100%" append-to-body>
  525. <div>搜索标签:
  526. <el-input v-model="queryTagParams.name" placeholder="请输入标签名称" clearable size="small" style="width: 200px;margin-right: 10px" />
  527. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleSearchTags(queryTagParams.name)">搜索</el-button>
  528. <el-button type="primary" icon="el-icon-plus" size="mini" @click="cancelSearchTags">重置</el-button>
  529. </div>
  530. <div v-for="item in tagGroupList" :key="item.id" >
  531. <div style="font-size: 20px;margin-top: 20px;margin-bottom: 20px;">
  532. <span class="name-background">{{ item.name }}</span>
  533. </div>
  534. <div class="tag-container">
  535. <a
  536. v-for="tagItem in item.tag"
  537. class="tag-box"
  538. @click="tagSelection(tagItem)"
  539. :class="{ 'tag-selected': tagItem.isSelected }"
  540. >
  541. {{ tagItem.name }}
  542. </a>
  543. </div>
  544. </div>
  545. <pagination
  546. v-show="tagTotal>0"
  547. :total="tagTotal"
  548. :page.sync="queryTagParams.pageNum"
  549. :limit.sync="queryTagParams.pageSize"
  550. @pagination="getPageListTagGroup"
  551. />
  552. <div slot="footer" class="dialog-footer">
  553. <el-button type="primary" @click="tagSubmitForm()">确 定</el-button>
  554. <el-button @click="tagCancel()">取消</el-button>
  555. </div>
  556. </el-dialog>
  557. <el-dialog :title="videoNumOptions.title" :visible.sync="videoNumOptions.open" width="1500px" append-to-body>
  558. <userVideo ref="QwUserVideo" @videoResult="qwUserVideoResult"></userVideo>
  559. </el-dialog>
  560. </div>
  561. </template>
  562. <script>
  563. import {
  564. listSopUserLogsInfo,
  565. delSopUserLogsInfo,
  566. addSopUserLogsInfo,
  567. updateSopUserLogsInfo,
  568. exportSopUserLogsInfo,
  569. sendMsgSop, batchUpdateSopUserLogsInfoToTime
  570. } from "@/api/qw/sopUserLogsInfo";
  571. import ImageUpload from "@/views/qw/sop/ImageUpload.vue";
  572. import {courseList, videoList} from "@/api/qw/sop";
  573. import {addCourseFinishTemp, updateCourseFinishTemp} from "@/api/course/courseFinishTemp";
  574. import {allListTagGroup} from "@/api/qw/tagGroup";
  575. import {listTag} from "@/api/qw/tag";
  576. import {searchTags} from "../../../api/qw/tag";
  577. import userVideo from "@/views/qw/userVideo/userVideo.vue";
  578. import PaginationMore from "../../../components/PaginationMore/index.vue";
  579. import {listToLiveNoEnd} from "@/api/live/live";
  580. import {listReward} from "@/api/qw/luckyBag";
  581. export default {
  582. name: "sopUserLogsInfoDetails",
  583. components: {PaginationMore, userVideo, ImageUpload},
  584. data() {
  585. return {
  586. queryParams1: {
  587. pageNum: 1,
  588. pageSize: 10,
  589. dataStatus: '1',
  590. name: null,
  591. type: null
  592. },
  593. luckyBagList: [],
  594. projectFrom:process.env.VUE_APP_PROJECT_FROM,
  595. statusOptions:[],
  596. //上传语音的遮罩层
  597. voiceLoading :false,
  598. uploadUrl:process.env.VUE_APP_BASE_API+"/common/uploadOSS2",
  599. uploadUrlByVoice:process.env.VUE_APP_BASE_API+"/common/uploadOSSByHOOKVoice",
  600. // 遮罩层
  601. loading: true,
  602. // 导出遮罩层
  603. exportLoading: false,
  604. // 选中数组
  605. ids: [],
  606. // 非单个禁用
  607. single: true,
  608. // 非多个禁用
  609. multiple: true,
  610. // 显示搜索条件
  611. showSearch: true,
  612. // 总条数
  613. total: 0,
  614. videoNumOptions: {
  615. title: '选择视频号',
  616. open: false,
  617. content: null,
  618. contentIndex: null,
  619. },
  620. // sopUserLogsInfo表格数据
  621. sopUserLogsInfoList: [],
  622. sysFsSopWatchStatus: [],
  623. isSalesCallAdded:false,
  624. isSalesCallCustomerAdded:false,
  625. selectTags:[],
  626. // 弹出层标题
  627. title: "",
  628. // 是否显示弹出层
  629. open: false,
  630. updateOpen:false,
  631. // 查询参数
  632. queryParams: {
  633. pageNum: 1,
  634. pageSize: 10,
  635. tagIds:null,
  636. remark:null,
  637. sopId: null,
  638. userLogsId: null,
  639. userIdParam:null,
  640. startTimeParam:null,
  641. externalContactId: null,
  642. qwUserId: null,
  643. corpId: null,
  644. externalId: null,
  645. fsUserId: null,
  646. externalUserName: null,
  647. createTime: null,
  648. entryTime: null,
  649. fsUserIdStatus:null,
  650. level:null
  651. },
  652. ratingType: [],
  653. tagGroupList: [],
  654. tagTotal:0,
  655. //标签
  656. changeTagDialog:{
  657. title:"",
  658. open:false,
  659. },
  660. queryTagParams:{
  661. pageNum: 1,
  662. pageSize: 10,
  663. total:0,
  664. name:null,
  665. corpId:null,
  666. },
  667. courseList:[],
  668. videoList:[],
  669. //插件版
  670. sysQwSopAiContentType:[],
  671. sendMsgOpen:{
  672. title:'一键批量群发',
  673. open:false,
  674. ids:null,
  675. },
  676. // 表单参数
  677. form: {},
  678. updateLogsInfoFrom:{},
  679. setting:[{contentType:'1', value: '',}],
  680. msgForm:{
  681. videoId:null,
  682. courseId:null,
  683. courseType:null,
  684. userIdParam:null,
  685. setting:null,
  686. ids:null,
  687. sopId: null,
  688. startTime: null,
  689. },
  690. // 表单校验
  691. rules: {},
  692. batchRules:{
  693. paramTime: [
  694. { required: true, message: '选择的时间不能为空', trigger: 'blur' }
  695. ],
  696. },
  697. msgRules:{},
  698. liveList: [],
  699. };
  700. },
  701. created() {
  702. this.getDicts("sys_qw_allow_select").then((response) => {
  703. this.statusOptions = response.data;
  704. });
  705. this.getDicts("sys_qw_sop_rating_type").then(response => {
  706. this.ratingType = response.data;
  707. });
  708. this.getDicts("sys_qwSopAi_contentType").then(response => {
  709. this.sysQwSopAiContentType = response.data;
  710. });
  711. this.getDicts("sys_fs_sop_watch_status").then(response => {
  712. this.sysFsSopWatchStatus = response.data;
  713. });
  714. courseList().then(response => {
  715. this.courseList = response.list;
  716. });
  717. listToLiveNoEnd().then(response => {
  718. this.liveList = response.rows;
  719. });
  720. listReward(this.queryParams1).then(response => {
  721. this.luckyBagList = response.rows;
  722. });
  723. },
  724. methods: {
  725. getLuckyBagStatus(content) {
  726. const selectedLuckyBag = this.luckyBagList.find(item => item.id === content.luckyBagId);
  727. if (selectedLuckyBag) {
  728. content.luckyBagDataStatus = selectedLuckyBag.dataStatus; // 自动填充标题
  729. } else {
  730. // 若未找到对应直播间,清空标题和封面(可选)
  731. content.luckyBagDataStatus = null;
  732. }
  733. },
  734. liveChange(content) {
  735. // content.liveId 是选中的直播间 ID(liveId)
  736. const selectedLive = this.liveList.find(live => live.liveId === content.liveId);
  737. if (selectedLive) {
  738. // 从选中的直播间对象中提取标题和封面,赋值给当前内容的对应字段
  739. // 假设直播间对象中标题字段为 liveTitle,封面字段为 coverImg(根据实际接口字段调整)
  740. content.miniprogramTitle = selectedLive.liveName || ''; // 自动填充标题
  741. content.miniprogramPicUrl = selectedLive.liveImgUrl || ''; // 自动填充封面
  742. } else {
  743. // 若未找到对应直播间,清空标题和封面(可选)
  744. content.miniprogramTitle = '';
  745. content.miniprogramPicUrl = '';
  746. }
  747. },
  748. selectSopUserLogsInfo(val,externalUserName){
  749. this.loading = true;
  750. this.queryParams.sopId=val.sopId;
  751. this.queryParams.filterMode=val.filterMode;
  752. this.queryParams.userLogsId=val.id;
  753. this.queryParams.chatId=val.chatId;
  754. if (externalUserName!=null){
  755. this.queryParams.externalUserName = externalUserName;
  756. }
  757. listSopUserLogsInfo(this.queryParams).then(response => {
  758. this.sopUserLogsInfoList = response.rows;
  759. this.total = response.total;
  760. this.loading = false;
  761. });
  762. this.queryParams.qwUserId=val.qwUserId;
  763. this.queryParams.corpId=val.corpId;
  764. //用于一键群发
  765. this.queryParams.userIdParam=val.userId;
  766. this.queryParams.startTimeParam=val.startTime;
  767. this.queryParams.corpIdParam=val.corpId;
  768. },
  769. //搜索的标签
  770. hangleChangeTags(){
  771. this.changeTagDialog.title="搜索的标签"
  772. this.changeTagDialog.open=true;
  773. // 获取 tagListFormIndex 中的所有 tagId,用于快速查找
  774. const selectedTagIds = new Set(
  775. (this.selectTags || []).map(tagItem => tagItem?.tagId)
  776. );
  777. this.queryTagParams.name=null;
  778. this.getPageListTagGroup();
  779. setTimeout(() => {
  780. for (let i = 0; i < this.tagGroupList.length; i++) {
  781. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  782. this.tagGroupList[i].tag[x].isSelected = selectedTagIds.has(this.tagGroupList[i].tag[x].tagId);
  783. }
  784. }
  785. }, 200);
  786. },
  787. tagSelection(row){
  788. row.isSelected= !row.isSelected;
  789. this.$forceUpdate();
  790. },
  791. //确定选择标签
  792. tagSubmitForm(){
  793. for (let i = 0; i < this.tagGroupList.length; i++) {
  794. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  795. if (this.tagGroupList[i].tag[x].isSelected === true) {
  796. if (!this.selectTags) {
  797. this.selectTags = [];
  798. }
  799. // 检查当前 tag 是否已经存在于 tagListFormIndex[index] 中
  800. let tagExists = this.selectTags.some(
  801. tag => tag.id === this.tagGroupList[i].tag[x].id
  802. );
  803. // 如果 tag 不存在于 tagListFormIndex[index] 中,则新增
  804. if (!tagExists) {
  805. this.selectTags.push(this.tagGroupList[i].tag[x]);
  806. }
  807. }
  808. }
  809. }
  810. if (!this.selectTags || this.selectTags.length === 0) {
  811. return this.$message('请选择标签');
  812. }
  813. this.changeTagDialog.open = false;
  814. },
  815. //取消选择标签
  816. tagCancel(){
  817. this.changeTagDialog.open = false;
  818. },
  819. //删除一些选择的标签
  820. handleCloseTags(list){
  821. const ls = this.selectTags.findIndex(t => t.tagId === list.tagId);
  822. if (ls !== -1) {
  823. this.selectTags.splice(ls, 1);
  824. this.selectTags = [...this.selectTags];
  825. }
  826. if (this.selectTags!=null && this.selectTags.length>0){
  827. // 确保 this.form.tags 是数组
  828. if (!this.queryParams.tagIds) {
  829. this.queryParams.tagIds = []; // 如果未定义,初始化
  830. } else {
  831. this.queryParams.tagIds = []; // 清空已有数据
  832. }
  833. // 遍历并添加 tagId
  834. this.selectTags.forEach(tag => {
  835. if (tag.tagId) { // 确保 tagId 存在
  836. this.queryParams.tagIds.push(tag.tagId);
  837. }
  838. });
  839. this.queryParams.tagIds=this.queryParams.tagIds.join(",");
  840. }else {
  841. this.queryParams.tagIds=null;
  842. }
  843. },
  844. handleSearchTags(name){
  845. searchTags({name:name,corpId:this.queryParams.corpId}).then(response => {
  846. this.tagGroupList = response.rows;
  847. });
  848. },
  849. cancelSearchTags(){
  850. this.resetSearchQueryTag()
  851. this.getPageListTagGroup();
  852. },
  853. getPageListTagGroup(){
  854. this.queryTagParams.corpId=this.queryParams.corpId
  855. allListTagGroup(this.queryTagParams).then(response => {
  856. this.tagGroupList = response.rows;
  857. this.tagTotal = response.total;
  858. });
  859. },
  860. resetSearchQueryTag(){
  861. this.queryTagParams= {
  862. pageNum: 1,
  863. pageSize: 10,
  864. total:0,
  865. name:null,
  866. };
  867. },
  868. courseChange() {
  869. if (this.msgForm.courseId != null ) {
  870. const selectedCourse = this.courseList.find(course => parseInt(course.dictValue) === this.msgForm.courseId);
  871. for (let i = 0; i < this.setting.length; i++) {
  872. //响应式直接给链接的标题/封面上值
  873. if (selectedCourse && this.msgForm.courseId != null) {
  874. if ( this.setting[i].contentType == 3 || this.setting[i].contentType == 9 ){
  875. this.$set(this.setting[i], 'linkTitle', selectedCourse.dictLabel);
  876. this.$set(this.setting[i], 'linkImageUrl', selectedCourse.dictImgUrl);
  877. }
  878. if ( this.setting[i].contentType == 4 ){
  879. this.$set(this.setting[i], 'miniprogramPicUrl', selectedCourse.dictImgUrl);
  880. }
  881. }
  882. }
  883. }
  884. videoList(this.msgForm.courseId).then(response => {
  885. this.videoList=response.list;
  886. });
  887. this.msgForm.videoId = null
  888. },
  889. videoIdChange() {
  890. if (this.msgForm.videoId != null ) {
  891. // 查找选中的课节对应的 label
  892. const selectedVideo = this.videoList.find(course => parseInt(course.dictValue) === this.msgForm.videoId);
  893. for (let i = 0; i < this.setting.length; i++) {
  894. //响应式直接给链接的描述上值
  895. if (selectedVideo && this.msgForm.videoId != null) {
  896. if (this.setting[i].contentType == 3 || this.setting[i].contentType == 9 ){
  897. this.$set(this.setting[i], 'linkDescribe', selectedVideo.dictLabel);
  898. if (this.projectFrom == 'sxjz' && selectedVideo.dictImgUrl) {
  899. this.$set(this.setting[i], 'linkImageUrl', selectedVideo.dictImgUrl);
  900. }
  901. }
  902. if (this.setting[i].contentType == 4){
  903. this.$set(this.setting[i], 'miniprogramTitle', selectedVideo.dictLabel);
  904. if (this.projectFrom == 'sxjz' && selectedVideo.dictImgUrl) {
  905. this.$set(this.setting[i], 'miniprogramPicUrl', selectedVideo.dictImgUrl);
  906. }
  907. }
  908. }
  909. }
  910. }
  911. },
  912. handleAvatarSuccessFile(res, file, item) {
  913. if (res.code === 200) {
  914. // 使用 $set 确保响应式更新
  915. this.$set(item, 'fileUrl', res.url);
  916. } else {
  917. this.msgError(res.msg);
  918. }
  919. },
  920. beforeAvatarUploadFile(file){
  921. const isLt1M = file.size / 1024 / 1024 < 10;
  922. if (!isLt1M) {
  923. this.$message.error('上传大小不能超过 10MB!');
  924. }
  925. return isLt1M;
  926. },
  927. //下载文件
  928. downloadUrl(materialUrl) {
  929. // 直接返回文件 URL
  930. return materialUrl;
  931. },
  932. handleAvatarSuccessVideo(res, file, item) {
  933. if(res.code==200){
  934. // 使用 $set 确保响应式更新
  935. this.$set(item, 'videoUrl', res.url);
  936. }
  937. else{
  938. this.msgError(res.msg);
  939. }
  940. },
  941. beforeAvatarUploadVideo(file){
  942. const isLt30M = file.size / 1024 / 1024 < 10;
  943. const isMP4 = file.type === 'video/mp4';
  944. if (!isMP4) {
  945. this.$message.error('仅支持上传 MP4 格式的视频文件!');
  946. return false;
  947. }
  948. if (!isLt30M) {
  949. this.$message.error('上传大小不能超过 10MB!');
  950. return false;
  951. }
  952. return true;
  953. },
  954. handleInputVideoText(value,content){
  955. // 允许的字符:中文、英文(大小写)、数字和指定标点符号(,。!?)
  956. const regex = /^[\u4e00-\u9fa5,。!?,!?]+$/;
  957. // 删除不符合条件的字符
  958. const filteredValue = value.split('').filter(char => regex.test(char)).join('');
  959. this.$set(content, 'value', filteredValue);
  960. },
  961. delSetList(index){
  962. this.setting.splice(index,1)
  963. },
  964. addSetList(){
  965. const newSetting = {
  966. contentType:'1',
  967. value: '',
  968. };
  969. // 将新设置项添加到 content.setting 数组中
  970. this.setting.push(newSetting);
  971. },
  972. handleKeydown(event, index) {
  973. const item = this.setting[index];
  974. const textarea = this.$refs[`textarea-${index}`][0].$refs.textarea;
  975. const cursorPosition = textarea.selectionStart;
  976. // 检查是否按下了 Backspace 或 Delete 键
  977. if (event.key === 'Backspace' || event.key === 'Delete') {
  978. const tags = ['#客服称呼#', '#客户称呼#']; // 需要检查的标签
  979. const value = item.value;
  980. // 遍历标签,检查是否需要删除
  981. for (const tag of tags) {
  982. let start, end;
  983. if (event.key === 'Backspace') {
  984. // 检查光标前是否是当前标签的一部分
  985. start = cursorPosition - tag.length;
  986. if (start >= 0 && value.slice(start, cursorPosition) === tag) {
  987. // 删除整个标签
  988. item.value = value.slice(0, start) + value.slice(cursorPosition);
  989. // 更新光标位置
  990. this.$nextTick(() => {
  991. textarea.setSelectionRange(start, start);
  992. });
  993. // 更新状态
  994. if (tag === '#客服称呼#') item.isSalesCallAdded = false;
  995. if (tag === '#客户称呼#') item.isSalesCallCustomerAdded = false;
  996. event.preventDefault(); // 阻止默认删除行为
  997. break; // 找到匹配的标签后退出循环
  998. }
  999. } else if (event.key === 'Delete') {
  1000. // 检查光标后是否是当前标签的一部分
  1001. end = cursorPosition + tag.length;
  1002. if (end <= value.length && value.slice(cursorPosition, end) === tag) {
  1003. // 删除整个标签
  1004. item.value = value.slice(0, cursorPosition) + value.slice(end);
  1005. // 更新状态
  1006. if (tag === '#客服称呼#') item.isSalesCallAdded = false;
  1007. if (tag === '#客户称呼#') item.isSalesCallCustomerAdded = false;
  1008. event.preventDefault(); // 阻止默认删除行为
  1009. break; // 找到匹配的标签后退出循环
  1010. }
  1011. }
  1012. // 检查光标是否位于标签的中间
  1013. for (let i = 0; i <= tag.length; i++) {
  1014. const tagStart = cursorPosition - i;
  1015. const tagEnd = tagStart + tag.length;
  1016. if (
  1017. tagStart >= 0 &&
  1018. tagEnd <= value.length &&
  1019. value.slice(tagStart, tagEnd) === tag
  1020. ) {
  1021. // 删除整个标签
  1022. item.value = value.slice(0, tagStart) + value.slice(tagEnd);
  1023. // 更新光标位置
  1024. this.$nextTick(() => {
  1025. textarea.setSelectionRange(tagStart, tagStart);
  1026. });
  1027. // 更新状态
  1028. if (tag === '#客服称呼#') item.isSalesCallAdded = false;
  1029. if (tag === '#客户称呼#') item.isSalesCallCustomerAdded = false;
  1030. event.preventDefault(); // 阻止默认删除行为
  1031. break; // 找到匹配的标签后退出循环
  1032. }
  1033. }
  1034. }
  1035. }
  1036. },
  1037. // 切换添加客服称呼按钮点击事件
  1038. toggleSalesCall(index) {
  1039. const item = this.setting[index];
  1040. const salesCall = '#客服称呼#';
  1041. const textarea = this.$refs[`textarea-${index}`][0].$refs.textarea;
  1042. // 获取当前光标位置
  1043. const cursorPosition = textarea.selectionStart;
  1044. if (item.isSalesCallAdded) {
  1045. // 移除所有的 #客服称呼#
  1046. item.value = item.value.replace(new RegExp(salesCall, 'g'), '');
  1047. } else {
  1048. // 添加 #客服称呼#
  1049. item.value = item.value.slice(0, cursorPosition) + salesCall + item.value.slice(cursorPosition);
  1050. }
  1051. // 切换状态
  1052. item.isSalesCallAdded = !item.isSalesCallAdded;
  1053. // 保持光标位置
  1054. this.$nextTick(() => {
  1055. textarea.setSelectionRange(cursorPosition, cursorPosition);
  1056. });
  1057. },
  1058. toggleSalesCallCustomer(index) {
  1059. const item = this.setting[index];
  1060. const salesCall = '#客户称呼#';
  1061. const textarea = this.$refs[`textarea-${index}`][0].$refs.textarea;
  1062. // 获取当前光标位置
  1063. const cursorPosition = textarea.selectionStart;
  1064. if (item.isSalesCallCustomerAdded) {
  1065. // 移除所有的 #客服称呼#
  1066. item.value = item.value.replace(new RegExp(salesCall, 'g'), '');
  1067. } else {
  1068. // 添加 #客户称呼#
  1069. item.value = item.value.slice(0, cursorPosition) + salesCall + item.value.slice(cursorPosition);
  1070. }
  1071. // 切换状态
  1072. item.isSalesCallCustomerAdded = !item.isSalesCallCustomerAdded;
  1073. // 保持光标位置
  1074. this.$nextTick(() => {
  1075. textarea.setSelectionRange(cursorPosition, cursorPosition);
  1076. });
  1077. },
  1078. handleContentTypeChange() {
  1079. //如果是链接的才上
  1080. if (this.msgForm.courseId != null ) {
  1081. const selectedCourse = this.courseList.find(course => parseInt(course.dictValue) === this.msgForm.courseId);
  1082. for (let i = 0; i < this.setting.length; i++) {
  1083. //响应式直接给链接的标题/封面上值
  1084. if (selectedCourse && this.msgForm.courseId != null) {
  1085. if (this.setting[i].contentType == 3 || this.setting[i].contentType == 9){
  1086. this.$set(this.setting[i], 'linkTitle', selectedCourse.dictLabel);
  1087. this.$set(this.setting[i], 'linkImageUrl', selectedCourse.dictImgUrl);
  1088. }
  1089. if (this.setting[i].contentType == 4){
  1090. this.$set(this.setting[i], 'miniprogramPicUrl', selectedCourse.dictImgUrl);
  1091. }
  1092. }
  1093. }
  1094. }
  1095. if (this.msgForm.videoId != null ) {
  1096. // 查找选中的课节对应的 label
  1097. const selectedVideo = this.videoList.find(course => parseInt(course.dictValue) === this.msgForm.videoId);
  1098. for (let i = 0; i < this.setting.length; i++) {
  1099. //响应式直接给链接的描述上值
  1100. if (selectedVideo && this.msgForm.videoId != null) {
  1101. if (this.setting[i].contentType == 3 || this.setting[i].contentType == 9){
  1102. this.$set(this.setting[i], 'linkDescribe', selectedVideo.dictLabel);
  1103. if (this.msgForm.videoId != null) {
  1104. const selectedVideo = this.videoList.find(course => parseInt(course.dictValue) === this.msgForm.videoId);
  1105. if (this.projectFrom == 'sxjz' && selectedVideo.dictImgUrl) {
  1106. this.$set(this.setting[i], 'linkImageUrl', selectedVideo.dictImgUrl);
  1107. }
  1108. }
  1109. }
  1110. if (this.setting[i].contentType == 4){
  1111. this.$set(this.setting[i], 'miniprogramTitle', selectedVideo.dictLabel);
  1112. if (this.msgForm.videoId != null) {
  1113. const selectedVideo = this.videoList.find(course => parseInt(course.dictValue) === this.msgForm.videoId);
  1114. if (this.projectFrom == 'sxjz' && selectedVideo.dictImgUrl) {
  1115. this.$set(this.setting[i], 'miniprogramPicUrl', selectedVideo.dictImgUrl);
  1116. }
  1117. }
  1118. }
  1119. }
  1120. }
  1121. }
  1122. },
  1123. /** 查询sopUserLogsInfo列表 */
  1124. getList() {
  1125. this.loading = true;
  1126. listSopUserLogsInfo(this.queryParams).then(response => {
  1127. this.sopUserLogsInfoList = response.rows;
  1128. this.total = response.total;
  1129. this.loading = false;
  1130. });
  1131. },
  1132. // 取消按钮
  1133. cancel() {
  1134. this.updateOpen = false;
  1135. this.reset();
  1136. },
  1137. // 表单重置
  1138. reset() {
  1139. this.form = {
  1140. id: null,
  1141. sopId: null,
  1142. userLogsId: null,
  1143. externalContactId: null,
  1144. qwUserId: null,
  1145. corpId: null,
  1146. externalId: null,
  1147. fsUserId: null,
  1148. externalUserName: null,
  1149. createTime: null,
  1150. crtTime: null,
  1151. updateTime: null
  1152. };
  1153. this.resetForm("form");
  1154. },
  1155. resetSendMsgSop() {
  1156. this.msgForm = {
  1157. videoId:null,
  1158. courseId:null,
  1159. courseType:null,
  1160. setting:null,
  1161. ids:null,
  1162. };
  1163. this.resetForm("msgForm");
  1164. },
  1165. /** 搜索按钮操作 */
  1166. handleQuery() {
  1167. if (this.selectTags!=null && this.selectTags.length>0){
  1168. // 确保 this.form.tags 是数组
  1169. if (!this.queryParams.tagIds) {
  1170. this.queryParams.tagIds = []; // 如果未定义,初始化
  1171. } else {
  1172. this.queryParams.tagIds = []; // 清空已有数据
  1173. }
  1174. // 遍历并添加 tagId
  1175. this.selectTags.forEach(tag => {
  1176. if (tag.tagId) { // 确保 tagId 存在
  1177. this.queryParams.tagIds.push(tag.tagId);
  1178. }
  1179. });
  1180. this.queryParams.tagIds=this.queryParams.tagIds.join(",");
  1181. }else {
  1182. this.queryParams.tagIds=null;
  1183. }
  1184. this.getList();
  1185. },
  1186. /** 重置按钮操作 */
  1187. resetQuery() {
  1188. this.selectTags=[];
  1189. this.resetForm("queryForm");
  1190. this.handleQuery();
  1191. },
  1192. // 多选框选中数据
  1193. handleSelectionChange(selection) {
  1194. this.ids = selection.map(item => item.id)
  1195. this.single = selection.length!==1
  1196. this.multiple = !selection.length
  1197. },
  1198. /** 新增按钮操作 */
  1199. handleAdd() {
  1200. this.reset();
  1201. this.open = true;
  1202. this.title = "添加客户营期";
  1203. },
  1204. /**
  1205. * 一键群发
  1206. */
  1207. handleSendMsg(){
  1208. this.sendMsgOpen.open=true;
  1209. this.sendMsgOpen.ids=this.ids;
  1210. },
  1211. /** 修改按钮操作 */
  1212. handleUpdate() {
  1213. this.updateOpen= true;
  1214. },
  1215. submitMsgForm(){
  1216. this.$refs["msgForm"].validate(valid => {
  1217. if (valid) {
  1218. this.msgForm.setting=JSON.stringify(this.setting)
  1219. this.msgForm.ids=this.ids;
  1220. this.msgForm.sopId=this.queryParams.sopId;
  1221. this.msgForm.userIdParam=this.queryParams.userIdParam;
  1222. this.msgForm.startTime=this.queryParams.startTimeParam;
  1223. this.msgForm.corpId=this.queryParams.corpIdParam;
  1224. this.msgForm.filterMode=this.queryParams.filterMode;
  1225. if (this.setting.length <= 0) {
  1226. return this.$message.error("请添加规则")
  1227. }
  1228. if (this.msgForm.courseId===null || this.msgForm.courseId===''){
  1229. return this.$message.error("课程不能为空")
  1230. }
  1231. if (this.msgForm.videoId===null || this.msgForm.videoId===''){
  1232. return this.$message.error("课节不能为空")
  1233. }
  1234. if (this.msgForm.courseType===null || this.msgForm.courseType===''){
  1235. return this.$message.error("消息类型不能为空")
  1236. }
  1237. for (let i = 0; i < this.setting.length; i++) {
  1238. if (this.setting[i].contentType == 1 && (this.setting[i].value == null || this.setting[i].value == "")) {
  1239. return this.$message.error("内容不能为空")
  1240. }
  1241. if (this.setting[i].contentType == 2 && (this.setting[i].imgUrl == null || this.setting[i].imgUrl == "")) {
  1242. return this.$message.error("图片不能为空")
  1243. }
  1244. if ((this.setting[i].contentType == 3 || this.setting[i].contentType == 9 ) && (this.setting[i].linkTitle == null || this.setting[i].linkTitle == "")) {
  1245. return this.$message.error("链接标题不能为空")
  1246. }
  1247. if ((this.setting[i].contentType == 3 || this.setting[i].contentType == 9 ) && (this.setting[i].linkDescribe == null || this.setting[i].linkDescribe == "")) {
  1248. return this.$message.error("链接描述不能为空")
  1249. }
  1250. if ((this.setting[i].contentType == 3 || this.setting[i].contentType == 9 ) && (this.setting[i].linkImageUrl == null || this.setting[i].linkImageUrl == "")) {
  1251. return this.$message.error("链接图片不能为空")
  1252. }
  1253. 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 == "")) {
  1254. return this.$message.error("链接地址不能为空")
  1255. }
  1256. if (this.setting[i].contentType == 4 && (this.setting[i].miniprogramTitle == null || this.setting[i].miniprogramTitle == "")) {
  1257. return this.$message.error("小程序消息标题不能为空")
  1258. }
  1259. if (this.setting[i].contentType == 4 && (this.setting[i].miniprogramPicUrl == null || this.setting[i].miniprogramPicUrl == "")) {
  1260. return this.$message.error("小程序封面地址不能为空")
  1261. }
  1262. if (this.setting[i].contentType == 5 && (this.setting[i].fileUrl == null || this.setting[i].fileUrl == "")) {
  1263. return this.$message.error("文件不能为空")
  1264. }
  1265. if (this.setting[i].contentType == 6 && (this.setting[i].videoUrl == null || this.setting[i].videoUrl == "")) {
  1266. return this.$message.error("视频不能为空")
  1267. }
  1268. if (this.setting[i].contentType == 7 && (this.setting[i].value == null || this.setting[i].value == "")) {
  1269. return this.$message.error("语音不能为空")
  1270. }
  1271. }
  1272. this.sendMsgOpen.open = false;
  1273. const loading = this.$loading({
  1274. lock: true,
  1275. text: '正在执行中请稍后~~请不要刷新页面!!',
  1276. spinner: 'el-icon-loading',
  1277. background: 'rgba(0, 0, 0, 0.7)'
  1278. });
  1279. sendMsgSop(this.msgForm).then(response => {
  1280. this.msgSuccess("一键群发成功");
  1281. loading.close();
  1282. this.setting=[];
  1283. this.msgForm = {
  1284. videoId:null,
  1285. courseId:null,
  1286. courseType:null,
  1287. setting:null,
  1288. }
  1289. this.getList();
  1290. }).finally(()=>{
  1291. loading.close();
  1292. });
  1293. }
  1294. });
  1295. },
  1296. cancelMsgForm(){
  1297. this.sendMsgOpen.open = false;
  1298. this.resetSendMsgSop();
  1299. },
  1300. /** 提交按钮 */
  1301. submitForm() {
  1302. this.$refs["updateLogsInfoFrom"].validate(valid => {
  1303. if (valid) {
  1304. this.updateLogsInfoFrom.ids=this.ids;
  1305. this.updateLogsInfoFrom.sopId= this.queryParams.sopId
  1306. this.updateLogsInfoFrom.qwUserId=this.queryParams.qwUserId
  1307. this.updateLogsInfoFrom.corpId= this.queryParams.corpId
  1308. let loadingRock = this.$loading({
  1309. lock: true,
  1310. text: '正在执行中请稍后~~请不要刷新页面!!',
  1311. spinner: 'el-icon-loading',
  1312. background: 'rgba(0, 0, 0, 0.7)'
  1313. });
  1314. batchUpdateSopUserLogsInfoToTime(this.updateLogsInfoFrom).then(response => {
  1315. this.msgSuccess("修改成功");
  1316. this.open = false;
  1317. this.updateOpen=false;
  1318. this.getList();
  1319. this.$emit('flashNotify')
  1320. loadingRock.close();
  1321. }).finally(res=>{
  1322. loadingRock.close();
  1323. })
  1324. }
  1325. });
  1326. },
  1327. /** 删除按钮操作 */
  1328. handleDelete(row) {
  1329. const ids = row.id || this.ids;
  1330. this.$confirm('是否确认删除sopUserLogsInfo编号为"' + ids + '"的数据项?', "警告", {
  1331. confirmButtonText: "确定",
  1332. cancelButtonText: "取消",
  1333. type: "warning"
  1334. }).then(function() {
  1335. return delSopUserLogsInfo(ids);
  1336. }).then(() => {
  1337. this.getList();
  1338. this.msgSuccess("删除成功");
  1339. }).catch(() => {});
  1340. },
  1341. /** 导出按钮操作 */
  1342. handleExport() {
  1343. const queryParams = this.queryParams;
  1344. this.$confirm('是否确认导出所有营期数据项?', "警告", {
  1345. confirmButtonText: "确定",
  1346. cancelButtonText: "取消",
  1347. type: "warning"
  1348. }).then(() => {
  1349. this.exportLoading = true;
  1350. return exportSopUserLogsInfo(queryParams);
  1351. }).then(response => {
  1352. this.download(response.msg);
  1353. this.exportLoading = false;
  1354. }).catch(() => {});
  1355. },
  1356. //选择视频号
  1357. hanldeSelectVideoNum(content, index) {
  1358. this.videoNumOptions.content = content;
  1359. this.videoNumOptions.contentIndex = index;
  1360. this.videoNumOptions.open = true;
  1361. },
  1362. qwUserVideoResult(val) {
  1363. // 根据选中的内容,将返回的数据更新到相应的表单项
  1364. const content = this.videoNumOptions.content;
  1365. const setList = content[this.videoNumOptions.contentIndex];
  1366. setList.nickname = val.nickname;
  1367. setList.avatar = val.avatar;
  1368. setList.coverUrl = val.coverUrl;
  1369. setList.thumbUrl = val.thumbUrl;
  1370. setList.desc = val.desc;
  1371. setList.url = val.url;
  1372. setList.extras = val.extras;
  1373. setList.videoId = val.id;
  1374. console.info(setList)
  1375. this.videoNumOptions.open = false;
  1376. },
  1377. }
  1378. };
  1379. </script>
  1380. <style scoped>
  1381. /* CSS 样式 */
  1382. .tag-container {
  1383. display: flex;
  1384. flex-wrap: wrap; /* 超出宽度时自动换行 */
  1385. gap: 8px; /* 设置标签之间的间距 */
  1386. }
  1387. .name-background {
  1388. display: inline-block;
  1389. background-color: #abece6; /* 背景颜色 */
  1390. padding: 4px 8px; /* 调整内边距,让背景包裹文字 */
  1391. border-radius: 4px; /* 可选:设置圆角 */
  1392. }
  1393. .tag-box {
  1394. padding: 8px 12px;
  1395. border: 1px solid #989797;
  1396. border-radius: 4px;
  1397. cursor: pointer;
  1398. display: inline-block;
  1399. }
  1400. .tag-selected {
  1401. background-color: #00bc98;
  1402. color: #fff;
  1403. border-color: #00bc98;
  1404. }
  1405. .el-tag + .el-tag {
  1406. margin-left: 10px;
  1407. }
  1408. .button-new-tag {
  1409. margin-left: 10px;
  1410. height: 32px;
  1411. line-height: 30px;
  1412. padding-top: 0;
  1413. padding-bottom: 0;
  1414. }
  1415. .input-new-tag {
  1416. width: 90px;
  1417. margin-left: 10px;
  1418. vertical-align: bottom;
  1419. }
  1420. </style>