sopUserLogsInfoDetails.vue 62 KB

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