watchLog.vue 39 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px">
  4. <el-form-item label="看课方式" prop="sendType">
  5. <el-select v-model="queryParams.sendType" placeholder="选择看课方式" clearable size="small" @change="handleSendTypeChange">
  6. <el-option
  7. v-for="dict in sendTypeOptions"
  8. :key="dict.dictValue"
  9. :label="dict.dictLabel"
  10. :value="dict.dictValue"
  11. />
  12. </el-select>
  13. </el-form-item>
  14. <el-form-item label="企微账号" prop="qwUserId" v-if="queryParams.sendType == 2">
  15. <el-select v-model="queryParams.qwUserId" placeholder="企微账号" clearable size="small"
  16. @change="updateQwuser()">
  17. <el-option
  18. v-for="dict in myQwUserList"
  19. :key="dict.dictValue"
  20. :label="dict.dictLabel + '('+dict.corpName+')'"
  21. :value="dict.dictValue"
  22. />
  23. </el-select>
  24. </el-form-item>
  25. <el-form-item label="客户ID" prop="qwExternalContactId" v-if="queryParams.sendType == 2">
  26. <el-input
  27. v-model="queryParams.qwExternalContactId"
  28. placeholder="请输入客户ID"
  29. clearable
  30. size="small"
  31. @keyup.enter.native="handleQuery"
  32. />
  33. </el-form-item>
  34. <el-form-item label="会员ID" prop="userId" v-if="queryParams.sendType == 1">
  35. <el-input
  36. v-model="queryParams.userId"
  37. placeholder="请输入会员ID"
  38. clearable
  39. size="small"
  40. @keyup.enter.native="handleQuery"
  41. />
  42. </el-form-item>
  43. <el-form-item label="会员昵称" prop="nickName" v-if="queryParams.sendType == 1">
  44. <el-input
  45. v-model="queryParams.nickName"
  46. placeholder="请输入会员昵称"
  47. clearable
  48. size="small"
  49. @keyup.enter.native="handleQuery"
  50. />
  51. </el-form-item>
  52. <el-form-item label="企微客户昵称" prop="nickName" v-if="queryParams.sendType == 2">
  53. <el-input
  54. v-model="queryParams.externalUserName"
  55. placeholder="请输入企微客户昵称"
  56. clearable
  57. size="small"
  58. @keyup.enter.native="handleQuery"
  59. />
  60. </el-form-item>
  61. <el-form-item label="课程" prop="courseId">
  62. <el-select filterable v-model="queryParams.courseId" placeholder="请选择课程" clearable size="small"
  63. @change="courseChange(queryParams.courseId)">
  64. <el-option
  65. v-for="dict in courseLists"
  66. :key="dict.dictValue"
  67. :label="dict.dictLabel"
  68. :value="dict.dictValue"
  69. />
  70. </el-select>
  71. </el-form-item>
  72. <el-form-item label="小节" prop="videoId">
  73. <el-select filterable v-model="queryParams.videoId" placeholder="请选择小节" clearable size="small">
  74. <el-option
  75. v-for="dict in videoList"
  76. :key="dict.dictValue"
  77. :label="dict.dictLabel"
  78. :value="dict.dictValue"
  79. />
  80. </el-select>
  81. </el-form-item>
  82. <!-- 营期时间 -->
  83. <el-form-item label="营期时间" prop="scheduleTime">
  84. <el-input
  85. v-model="scheduleTimeText"
  86. placeholder="请选择营期时间"
  87. readonly
  88. @click.native="showScheduleCalendar = true"
  89. />
  90. <calendar
  91. v-model="scheduleTime"
  92. mode="during"
  93. :show.sync="showScheduleCalendar"
  94. @change="handleScheduleTimeChange"
  95. :key="scheduleCalendarKey"
  96. />
  97. </el-form-item>
  98. <!-- 创建时间 -->
  99. <el-form-item label="创建时间" prop="createTime">
  100. <el-input
  101. v-model="createTimeText"
  102. placeholder="请选择创建时间"
  103. readonly
  104. @click.native="showCreateCalendar = true"
  105. />
  106. <calendar
  107. v-model="createTime"
  108. mode="during"
  109. :show.sync="showCreateCalendar"
  110. @change="createChange"
  111. :key="createCalendarKey"
  112. />
  113. </el-form-item>
  114. <!-- 最新更新时间 -->
  115. <el-form-item label="最新更新时间" prop="updateTime">
  116. <el-input
  117. v-model="updateTimeText"
  118. placeholder="请选择更新时间"
  119. readonly
  120. @click.native="showUpdateCalendar = true"
  121. />
  122. <calendar
  123. v-model="updateTime"
  124. mode="during"
  125. :show.sync="showUpdateCalendar"
  126. @change="updateChange"
  127. :key="updateCalendarKey"
  128. />
  129. </el-form-item>
  130. <!-- 进线时间 -->
  131. <el-form-item label="进线时间" prop="qecCreateTime">
  132. <el-input
  133. v-model="qecCreateTimeText"
  134. placeholder="请选择进线时间"
  135. readonly
  136. @click.native="showQecCalendar = true"
  137. />
  138. <calendar
  139. v-model="qecCreateTime"
  140. mode="during"
  141. :show.sync="showQecCalendar"
  142. @change="qecCreateTimeChange"
  143. :key="qecCalendarKey"
  144. />
  145. </el-form-item>
  146. <el-form-item label="是否为会员" prop="isVip">
  147. <el-select
  148. filterable
  149. v-model="queryParams.isVip"
  150. placeholder="请选择是否为会员"
  151. clearable size="small">
  152. <el-option
  153. v-for="dict in isVipList"
  154. :key="dict.dictValue"
  155. :label="dict.dictLabel"
  156. :value="dict.dictValue"
  157. />
  158. </el-select>
  159. </el-form-item>
  160. <el-form-item>
  161. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  162. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  163. </el-form-item>
  164. </el-form>
  165. <el-row :gutter="10" class="mb8">
  166. <el-col :span="1.5">
  167. <el-button
  168. type="warning"
  169. plain
  170. icon="el-icon-download"
  171. size="mini"
  172. :loading="exportLoading"
  173. @click="handleExport"
  174. v-hasPermi="['course:courseWatchLog:myExport']"
  175. >导出
  176. </el-button>
  177. <el-col :span="1.5">
  178. <el-button
  179. type="primary"
  180. plain
  181. size="mini"
  182. @click="addUserTag"
  183. v-hasPermi="['qw:externalContact:addTag']"
  184. >批量添加标签</el-button>
  185. </el-col>
  186. <el-col :span="1.5">
  187. <el-button
  188. type="primary"
  189. plain
  190. size="mini"
  191. @click="delUserTag"
  192. v-hasPermi="['qw:externalContact:delTag']"
  193. >批量移除标签</el-button>
  194. </el-col>
  195. </el-col>
  196. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  197. </el-row>
  198. <el-tabs type="card" v-model="activeName" @tab-click="handleClickX">
  199. <el-tab-pane label="全部" name="00"></el-tab-pane>
  200. <el-tab-pane v-for="(item,index) in logTypeOptions" :label="item.dictLabel" :name="item.dictValue"></el-tab-pane>
  201. </el-tabs>
  202. <el-table border v-loading="loading" :data="courseWatchLogList" @selection-change="handleSelectionChange">
  203. <el-table-column type="selection" width="55" align="center"/>
  204. <el-table-column label="记录编号" align="center" prop="logId"/>
  205. <el-table-column label="客户昵称" align="center" prop="externalUserName" v-if="queryParams.sendType == 2"/>
  206. &lt;!&ndash;
  207. <el-table-column label="会员ID" align="center" prop="userId" v-if="queryParams.sendType == 1"/>
  208. &ndash;&gt;
  209. <el-table-column label="客户头像" align="center" prop="externalUserAvatar" v-if="queryParams.sendType == 2">
  210. <template slot-scope="scope">
  211. <el-popover
  212. placement="right"
  213. title=""
  214. trigger="hover">
  215. <img slot="reference" :src="scope.row.externalUserAvatar" style="width: 50px;height: 50px">
  216. <img :src="scope.row.externalUserAvatar" style="max-width: 200px;max-height: 200px">
  217. </el-popover>
  218. </template>
  219. </el-table-column>
  220. <el-table-column label="用户昵称" align="center" v-if="queryParams.sendType == 1">
  221. <template slot-scope="scope">
  222. {{ queryParams.sendType=='1' ? scope.row.fsNickName : scope.row.externalUserName }}
  223. </template>
  224. </el-table-column>
  225. <el-table-column label="头像" align="center" v-if="queryParams.sendType == 1">
  226. <template slot-scope="scope">
  227. <img v-if="queryParams.sendType=='1'" :src="scope.row.fsAvatar" style="width:50px;height:50px" />
  228. <img v-else :src="scope.row.externalUserAvatar" style="width:50px;height:50px" />
  229. </template>
  230. </el-table-column>
  231. <el-table-column label="课程名称" align="center" prop="courseName"/>
  232. <el-table-column label="小节名称" align="center" prop="videoName"/>
  233. <el-table-column label="记录类型" align="center" prop="logType">
  234. <template slot-scope="scope">
  235. <dict-tag :options="logTypeOptions" :value="scope.row.logType"/>
  236. </template>
  237. </el-table-column>
  238. <el-table-column label="播放时长" align="center" prop="duration"/>
  239. <!-- <el-table-column label="所属销售" align="center" prop="companyUserName"/>-->
  240. <!-- <el-table-column label="所属公司" align="center" prop="companyName"/>-->
  241. <!-- <el-table-column label="企微员工名称" align="center" prop="qwUserName"/>-->
  242. <el-table-column label="所属企微" align="center" prop="qwUserName" v-if="queryParams.sendType==2" />
  243. <!-- <el-table-column label="所属发送方式" align="center" prop="sendType"/>-->
  244. <el-table-column label="创建时间" align="center" prop="createTime" width="100px"/>
  245. <el-table-column label="更新时间" align="center" prop="updateTime" width="100px" />
  246. <el-table-column label="完课时间" align="center" prop="finishTime" width="100px" />
  247. <el-table-column label="营期时间" align="center" prop="campPeriodTime" />
  248. <el-table-column
  249. fixed="right"
  250. label="操作"
  251. width="100">
  252. <template slot-scope="scope">
  253. <el-button @click="openAnswerLogFun(scope.row)" type="text" size="small">答题记录</el-button>
  254. <el-button @click="openRedLogFun(scope.row)" type="text" size="small">红包记录</el-button>
  255. </template>
  256. </el-table-column>
  257. </el-table>
  258. <pagination
  259. v-show="total>0"
  260. :total="total"
  261. :page.sync="queryParams.pageNum"
  262. :limit.sync="queryParams.pageSize"
  263. @pagination="getList"
  264. />
  265. <el-drawer title="答题记录" :visible.sync="openAnswerLog" size="70%" append-to-body>
  266. <el-table border v-loading="" :data="answerLogsList">
  267. <el-table-column label="会员用户" align="center" prop="userName">
  268. <template slot-scope="scope">
  269. <div style="display: flex;white-space: nowrap">
  270. <div style="margin: auto">
  271. {{ scope.row.userName }}
  272. </div>
  273. <el-popover
  274. placement="right"
  275. title=""
  276. trigger="hover">
  277. <img slot="reference" :src="scope.row.fsAvatar" style="width: 30px;height: 30px">
  278. <img :src="scope.row.fsAvatar" style="max-width: 200px;max-height: 200px">
  279. </el-popover>
  280. </div>
  281. </template>
  282. </el-table-column>
  283. <el-table-column label="课程名称" align="center" prop="courseName"/>
  284. <el-table-column label="小节名称" align="center" prop="videoName"/>
  285. <el-table-column label="是否全部正确" align="center" prop="isRight">
  286. <template slot-scope="scope">
  287. <dict-tag :options="sysCompanyOr" :value="scope.row.isRight"></dict-tag>
  288. </template>
  289. </el-table-column>
  290. <el-table-column label="销售名称" align="center" prop="companyUserName"/>
  291. <el-table-column label="企微员工名称" align="center" prop="qwUserName"/>
  292. <el-table-column label="公司名称" align="center" prop="companyName"/>
  293. <el-table-column label="创建时间" align="center" prop="createTime"/>
  294. </el-table>
  295. <pagination
  296. v-show="answerLogTotal>0"
  297. :total="answerLogTotal"
  298. :page.sync="answerLogQueryParams.pageNum"
  299. :limit.sync="answerLogQueryParams.pageSize"
  300. @pagination="answerLogList"
  301. />
  302. </el-drawer>
  303. <el-drawer title="红包记录" :visible.sync="openRedLog" size="70%" append-to-body>
  304. <el-table border v-loading="" :data="redLogsList">
  305. <el-table-column type="selection" width="55" align="center" />
  306. <el-table-column label="记录编号" align="center" prop="logId" />
  307. <el-table-column label="批次单号" align="center" prop="outBatchNo" />
  308. <el-table-column label="课程名称" align="center" prop="courseId" >
  309. <template slot-scope="scope">
  310. <span prop="status" v-for="(item, index) in courseLists" v-if="scope.row.courseId==item.dictValue">{{item.dictLabel}}</span>
  311. </template>
  312. </el-table-column>
  313. <el-table-column label="小节名称" align="center" prop="title" />
  314. <!-- <el-table-column label="会员id" align="center" prop="userId" />-->
  315. <el-table-column label="会员用户" align="center" prop="fsNickName">
  316. <template slot-scope="scope">
  317. <div style="display: flex;white-space: nowrap">
  318. <div style="margin: auto">
  319. {{scope.row.fsNickName}}
  320. </div>
  321. <el-popover
  322. placement="right"
  323. title=""
  324. trigger="hover">
  325. <img slot="reference" :src="scope.row.fsAvatar" style="width: 30px;height: 30px">
  326. <img :src="scope.row.fsAvatar" style="max-width: 200px;max-height: 200px">
  327. </el-popover>
  328. </div>
  329. </template>
  330. </el-table-column>
  331. <!-- <el-table-column label="会员电话" align="center" prop="phone" />-->
  332. <!-- <el-table-column label="所属销售" align="center" prop="companyUserName" />-->
  333. <!-- <el-table-column label="所属公司" align="center" prop="companyName" />-->
  334. <el-table-column label="转帐金额" align="center" prop="amount" />
  335. <el-table-column label="状态" align="center" prop="status" >
  336. <template slot-scope="scope">
  337. <el-tag>
  338. {{
  339. scope.row.status === 0 ? "发送中" :
  340. scope.row.status === 2 ? "待补发" :
  341. "已完成"
  342. }}
  343. </el-tag>
  344. </template>
  345. </el-table-column>
  346. <el-table-column label="所属企微" align="center" prop="qwUserName" />
  347. <el-table-column label="创建时间" align="center" prop="createTime" />
  348. </el-table>
  349. <pagination
  350. v-show="redLogTotal>0"
  351. :total="redLogTotal"
  352. :page.sync="redLogQueryParams.pageNum"
  353. :limit.sync="redLogQueryParams.pageSize"
  354. @pagination="redLogList"
  355. />
  356. </el-drawer>
  357. <el-dialog title="批量添加标签" :visible.sync="tagOpen" width="800px" append-to-body>
  358. <div>搜索标签:
  359. <el-input v-model="tagChange.tagName" placeholder="请输入标签名称" clearable size="small" style="width: 200px;margin-right: 10px" />
  360. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleSearchTags(tagChange.tagName)">搜索</el-button>
  361. <el-button type="primary" icon="el-icon-plus" size="mini" @click="cancelSearchTags">重置</el-button>
  362. </div>
  363. <el-form ref="form" :model="addTagFormByWatch" label-width="80px">
  364. <div v-for="item in tagGroupList" :key="item.id" >
  365. <div style="font-size: 20px;margin-top: 20px;margin-bottom: 20px;">
  366. <span class="name-background">{{ item.name }}</span>
  367. </div>
  368. <!-- 添加外层滚动容器 -->
  369. <div class="scroll-wrapper">
  370. <div class="tag-container">
  371. <a
  372. v-for="tagItem in item.tag"
  373. class="tag-box"
  374. @click="tagSelection(tagItem)"
  375. :class="{ 'tag-selected': tagItem.isSelected }"
  376. >
  377. {{ tagItem.name }}
  378. </a>
  379. </div>
  380. </div>
  381. </div>
  382. </el-form>
  383. <pagination
  384. v-show="tagTotal>0"
  385. :total="tagTotal"
  386. :page.sync="queryTagParams.pageNum"
  387. :limit.sync="queryTagParams.pageSize"
  388. @pagination="getPageListTagGroup"
  389. />
  390. <div slot="footer" class="dialog-footer">
  391. <el-button type="primary" @click="addTagSubmitForm()">确 定</el-button>
  392. <el-button @click="addTagCancel">取 消</el-button>
  393. </div>
  394. </el-dialog>
  395. <el-dialog title="批量移除标签" :visible.sync="tagDelOpen" width="800px" append-to-body>
  396. <div>搜索标签:
  397. <el-input v-model="tagChange.tagName" placeholder="请输入标签名称" clearable size="small" style="width: 200px;margin-right: 10px" />
  398. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleSearchTags(tagChange.tagName)">搜索</el-button>
  399. <el-button type="primary" icon="el-icon-plus" size="mini" @click="cancelSearchTags">重置</el-button>
  400. </div>
  401. <el-form ref="form" :model="addTagFormByWatch" label-width="80px">
  402. <div v-for="item in tagGroupList" :key="item.id" >
  403. <div style="font-size: 20px;margin-top: 20px;margin-bottom: 20px;">
  404. <span class="name-background">{{ item.name }}</span>
  405. </div>
  406. <!-- 添加外层滚动容器 -->
  407. <div class="scroll-wrapper">
  408. <div class="tag-container">
  409. <a
  410. v-for="tagItem in item.tag"
  411. class="tag-box"
  412. @click="tagSelection(tagItem)"
  413. :class="{ 'tag-selected': tagItem.isSelected }"
  414. >
  415. {{ tagItem.name }}
  416. </a>
  417. </div>
  418. </div>
  419. </div>
  420. </el-form>
  421. <pagination
  422. v-show="tagTotal>0"
  423. :total="tagTotal"
  424. :page.sync="queryTagParams.pageNum"
  425. :limit.sync="queryTagParams.pageSize"
  426. @pagination="getPageListTagGroup"
  427. />
  428. <div slot="footer" class="dialog-footer">
  429. <el-button type="primary" @click="tagDelSubmitForm()">确 定</el-button>
  430. <el-button @click="DelTagCancel">取 消</el-button>
  431. </div>
  432. </el-dialog>
  433. <el-dialog
  434. :title="resultTitle"
  435. :visible.sync="resultDialogVisible"
  436. width="50%"
  437. custom-class="feedback-dialog"
  438. >
  439. <pre style="white-space: pre-wrap; font-family: inherit;">{{ resultMessage }}</pre>
  440. <span slot="footer" class="dialog-footer">
  441. <el-button @click="resultDialogVisible = false">关闭</el-button>
  442. </span>
  443. </el-dialog>
  444. </div>
  445. </template>
  446. <script>
  447. import {
  448. addCourseWatchLog,
  449. delCourseWatchLog,
  450. exportCourseWatchLog,
  451. getCourseWatchLog, myExportCourseWatchLog,
  452. myListCourseWatchLog,
  453. updateCourseWatchLog
  454. } from "@/api/course/courseWatchLog";
  455. import {courseList, myListCourseRedPacketLog, videoList} from '@/api/course/courseRedPacketLog'
  456. import {myListLogs} from "@/api/course/courseAnswerlogs";
  457. import {getMyQwUserList} from "@/api/qw/user";
  458. import {searchTags} from "../../../api/qw/tag";
  459. import {addTagByWatch, delTagByWatch} from "../../../api/qw/externalContact";
  460. import {allListTagGroup} from "../../../api/qw/tagGroup";
  461. import Vue from 'vue'
  462. import Calendar from 'vue-mobile-calendar'
  463. Vue.use(Calendar)
  464. export default {
  465. name: "CourseWatchLog",
  466. data() {
  467. return {
  468. // 日历 key 控制刷新
  469. scheduleCalendarKey: 0,
  470. createCalendarKey: 0,
  471. updateCalendarKey: 0,
  472. qecCalendarKey: 0,
  473. createTimeText: '',
  474. scheduleTimeText: '', // 新增
  475. updateTimeText: '', // 新增
  476. qecCreateTimeText: '', // 新增
  477. scheduleTime: [], // 改为数组
  478. createTime: [], // 改为数组
  479. updateTime: [], // 改为数组
  480. qecCreateTime: [], // 改为数组
  481. // 控制日历显隐
  482. showScheduleCalendar: false,
  483. showCreateCalendar: false,
  484. showUpdateCalendar: false,
  485. showQecCalendar: false,
  486. resultDialogVisible: false,
  487. resultMessage: '',
  488. resultTitle:'',
  489. activeName:"2",
  490. pickerOptions: {
  491. disabledDate(time) {
  492. // 获取6天前的日期(加上今天就是7天)
  493. const sixDaysAgo = new Date();
  494. sixDaysAgo.setDate(sixDaysAgo.getDate() - 6);
  495. sixDaysAgo.setHours(0, 0, 0, 0);
  496. // 获取明天的日期(不包括今天)
  497. const tomorrow = new Date();
  498. tomorrow.setDate(tomorrow.getDate() + 1);
  499. tomorrow.setHours(0, 0, 0, 0);
  500. return time.getTime() < sixDaysAgo.getTime() || time.getTime() >= tomorrow.getTime();
  501. }
  502. },
  503. courseLists: [],
  504. videoList: [],
  505. myQwUserList: [],
  506. logTypeOptions: [],
  507. // 遮罩层
  508. loading: true,
  509. // 导出遮罩层
  510. exportLoading: false,
  511. // 选中数组
  512. ids: [],
  513. // 非单个禁用
  514. single: true,
  515. // 非多个禁用
  516. multiple: true,
  517. // 显示搜索条件
  518. showSearch: true,
  519. sysCompanyOr: [],
  520. // 总条数
  521. total: 0,
  522. // 短链课程看课记录表格数据
  523. courseWatchLogList: [],
  524. openAnswerLog: false,
  525. loadingAnswerLog: true,
  526. answerLogsList: [],
  527. answerLogTotal: 0,
  528. answerLogQueryParams: {
  529. pageNum: 1,
  530. pageSize: 10,
  531. },
  532. sendTypeOptions:[{
  533. dictLabel:"会员",dictValue:'1'
  534. },
  535. {
  536. dictLabel:"企微",dictValue:'2'
  537. }
  538. ],
  539. openRedLog: false,
  540. loadingRedLog: true,
  541. redLogsList: [],
  542. redLogTotal: 0,
  543. redLogQueryParams: {
  544. pageNum: 1,
  545. pageSize: 10,
  546. },
  547. // 弹出层标题
  548. title: "",
  549. // 是否显示弹出层
  550. open: false,
  551. tagOpen:false,
  552. //标签弹窗选择
  553. tagChange:{
  554. open:false,
  555. index:null,
  556. },
  557. addTagFormByWatch:{
  558. logId:[],
  559. tagIds:[]
  560. },
  561. tagGroupList: [],
  562. tagTotal:0,
  563. tagDelOpen:false,
  564. queryTagParams:{
  565. pageNum: 1,
  566. pageSize: 5,
  567. total:0,
  568. name:null,
  569. corpId:null,
  570. },
  571. isVipList: [
  572. { dictLabel: '是', dictValue: 1 },
  573. { dictLabel: '否', dictValue: 0 }
  574. ],
  575. // 查询参数
  576. queryParams: {
  577. pageNum: 1,
  578. pageSize: 10,
  579. userId: null,
  580. videoId: null,
  581. nickName: null,
  582. logType: 2,
  583. qwExternalContactId: null,
  584. externalUserName:null,
  585. duration: null,
  586. qwUserId: null,
  587. companyUserId: null,
  588. companyId: null,
  589. courseId: null,
  590. sTime: null,
  591. eTime: null,
  592. upSTime:null,
  593. upETime:null,
  594. qecSTime:null,
  595. qecETime:null,
  596. scheduleStartTime: null,
  597. scheduleEndTime: null,
  598. sendType:process.env.VUE_APP_COURSE_DEFAULT,
  599. isVip: null,
  600. },
  601. // 表单参数
  602. form: {},
  603. // 表单校验
  604. rules: {}
  605. };
  606. },
  607. created() {
  608. courseList().then(response => {
  609. this.courseLists = response.list;
  610. });
  611. this.getList();
  612. this.getDicts("sys_course_watch_log_type").then(response => {
  613. this.logTypeOptions = response.data;
  614. });
  615. this.getDicts("sys_company_or").then(response => {
  616. this.sysCompanyOr = response.data;
  617. });
  618. getMyQwUserList().then(response => {
  619. this.myQwUserList = response.data;
  620. });
  621. },
  622. methods: {
  623. // 重置日历组件
  624. resetCalendars() {
  625. this.scheduleTime = [];
  626. this.createTime = [];
  627. this.updateTime = [];
  628. this.qecCreateTime = [];
  629. this.scheduleTimeText = '';
  630. this.createTimeText = '';
  631. this.updateTimeText = '';
  632. this.qecCreateTimeText = '';
  633. // 强制刷新日历组件
  634. this.scheduleCalendarKey++;
  635. this.createCalendarKey++;
  636. this.updateCalendarKey++;
  637. this.qecCalendarKey++;
  638. },
  639. formatDateRange(dates) {
  640. if (!dates || dates.length < 2) return '';
  641. return dates.map(date => date.format('YYYY-MM-DD')).join(' ~ ');
  642. },
  643. courseChange(row) {
  644. this.queryParams.videoId = null;
  645. if (row === '') {
  646. this.videoList = [];
  647. return
  648. }
  649. videoList(row).then(response => {
  650. this.videoList = response.list
  651. });
  652. },
  653. updateQwuser() {
  654. for (const user of this.myQwUserList) {
  655. if (user.dictValue == this.queryParams.qwUserId) {
  656. this.queryParams.corpId = user.corpId;
  657. break;
  658. }
  659. }
  660. this.getList();
  661. },
  662. handleClickX(tab) {
  663. this.activeName=tab.name;
  664. if(tab.name=="00"){
  665. this.queryParams.logType=null;
  666. }else{
  667. this.queryParams.logType=tab.name;
  668. }
  669. this.getList()
  670. },
  671. // 营期时间
  672. handleScheduleTimeChange(scheduleTime) {
  673. if (scheduleTime && scheduleTime.length >= 2) {
  674. this.scheduleTimeText = this.formatDateRange(scheduleTime);
  675. this.queryParams.scheduleStartTime = scheduleTime.map(date => date.format('YYYY-MM-DD'))[0] || null;
  676. this.queryParams.scheduleEndTime = scheduleTime.map(date => date.format('YYYY-MM-DD'))[1] || null;
  677. console.log(this.queryParams.scheduleStartTime)
  678. console.log(this.queryParams.scheduleEndTime)
  679. } else {
  680. this.scheduleTimeText = '';
  681. this.queryParams.scheduleStartTime = null;
  682. this.queryParams.scheduleEndTime = null;
  683. }
  684. },
  685. // 创建时间
  686. createChange(createTime) {
  687. if (createTime && createTime.length >= 2) {
  688. this.createTimeText = this.formatDateRange(createTime);
  689. this.queryParams.sTime = createTime.map(date => date.format('YYYY-MM-DD'))[0] || null;
  690. this.queryParams.eTime = createTime.map(date => date.format('YYYY-MM-DD'))[1] || null;
  691. } else {
  692. this.createTimeText = '';
  693. this.queryParams.sTime = null;
  694. this.queryParams.eTime = null;
  695. }
  696. },
  697. // 更新时间
  698. updateChange(updateTime) {
  699. if (updateTime && updateTime.length >= 2) {
  700. this.updateTimeText = this.formatDateRange(updateTime);
  701. this.queryParams.upSTime = updateTime.map(date => date.format('YYYY-MM-DD'))[0] || null;
  702. this.queryParams.upETime = updateTime.map(date => date.format('YYYY-MM-DD'))[1] || null;
  703. } else {
  704. this.updateTimeText = '';
  705. this.queryParams.upSTime = null;
  706. this.queryParams.upETime = null;
  707. }
  708. },
  709. // 进线时间
  710. qecCreateTimeChange(qecCreateTime) {
  711. if (qecCreateTime && qecCreateTime.length >= 2) {
  712. // 检查选择的日期范围是否超过7天(包括起始和结束日期)
  713. const startDate = new Date(qecCreateTime[0]);
  714. const endDate = new Date(qecCreateTime[1]);
  715. // 设置时间为当天开始,避免时间部分影响计算
  716. startDate.setHours(0, 0, 0, 0);
  717. endDate.setHours(0, 0, 0, 0);
  718. const timeDiff = Math.abs(endDate - startDate);
  719. const diffDays = Math.ceil(timeDiff / (1000 * 60 * 60 * 24));
  720. // 如果超过6天的范围(总共7天,包括起始日)
  721. if (diffDays > 6) {
  722. this.$message.error('进线时间选择范围不能超过7天');
  723. // 清空选择
  724. this.qecCreateTime = [];
  725. this.qecCreateTimeText = '';
  726. this.queryParams.qecSTime = null;
  727. this.queryParams.qecETime = null;
  728. this.qecCalendarKey++;
  729. return;
  730. }
  731. this.qecCreateTimeText = this.formatDateRange(qecCreateTime);
  732. this.queryParams.qecSTime = qecCreateTime.map(date => date.format('YYYY-MM-DD'))[0] || null;
  733. this.queryParams.qecETime = qecCreateTime.map(date => date.format('YYYY-MM-DD'))[1] || null;
  734. } else {
  735. this.qecCreateTimeText = '';
  736. this.queryParams.qecSTime = null;
  737. this.queryParams.qecETime = null;
  738. }
  739. },
  740. /** 查询短链课程看课记录列表 */
  741. getList() {
  742. this.loading = true;
  743. let param = JSON.parse(JSON.stringify(this.queryParams));
  744. if (param.logType == "10") {
  745. param.logType = null;
  746. }
  747. myListCourseWatchLog(param).then(response => {
  748. this.courseWatchLogList = response.rows;
  749. this.total = response.total;
  750. this.loading = false;
  751. });
  752. },
  753. // 取消按钮
  754. cancel() {
  755. this.open = false;
  756. this.reset();
  757. },
  758. // 表单重置
  759. reset() {
  760. this.form = {
  761. logId: null,
  762. userId: null,
  763. videoId: null,
  764. logType: null,
  765. createTime: null,
  766. updateTime: null,
  767. qwExternalContactId: null,
  768. externalUserName:null,
  769. duration: null,
  770. qwUserId: null,
  771. companyUserId: null,
  772. companyId: null,
  773. courseId: null,
  774. sTime:null,
  775. eTime:null,
  776. upSTime:null,
  777. upETime:null,
  778. qecSTime:null,
  779. qecETime:null,
  780. scheduleStartTime: null,
  781. scheduleEndTime: null,
  782. };
  783. // 统一重置日历组件
  784. this.resetCalendars();
  785. this.resetForm("form");
  786. },
  787. /** 搜索按钮操作 */
  788. handleQuery() {
  789. this.queryParams.pageNum = 1;
  790. this.getList();
  791. },
  792. /** 重置按钮操作 */
  793. resetQuery() {
  794. this.resetForm("queryForm");
  795. this.queryParams.sTime = null;
  796. this.queryParams.eTime = null;
  797. this.queryParams.upSTime = null;
  798. this.queryParams.upETime = null;
  799. this.queryParams.qecSTime = null;
  800. this.queryParams.qecETime = null;
  801. this.queryParams.scheduleStartTime = null;
  802. this.queryParams.scheduleEndTime = null;
  803. // 统一重置日历组件
  804. this.resetCalendars();
  805. this.handleQuery();
  806. },
  807. // 多选框选中数据
  808. handleSelectionChange(selection) {
  809. this.ids = selection.map(item => item.logId)
  810. this.single = selection.length !== 1
  811. this.multiple = !selection.length
  812. },
  813. /** 新增按钮操作 */
  814. handleAdd() {
  815. this.reset();
  816. this.open = true;
  817. this.title = "添加短链课程看课记录";
  818. },
  819. /** 修改按钮操作 */
  820. handleUpdate(row) {
  821. this.reset();
  822. const logId = row.logId || this.ids
  823. getCourseWatchLog(logId).then(response => {
  824. this.form = response.data;
  825. this.open = true;
  826. this.title = "修改短链课程看课记录";
  827. });
  828. },
  829. /** 提交按钮 */
  830. submitForm() {
  831. this.$refs["form"].validate(valid => {
  832. if (valid) {
  833. if (this.form.logId != null) {
  834. updateCourseWatchLog(this.form).then(response => {
  835. this.msgSuccess("修改成功");
  836. this.open = false;
  837. this.getList();
  838. });
  839. } else {
  840. addCourseWatchLog(this.form).then(response => {
  841. this.msgSuccess("新增成功");
  842. this.open = false;
  843. this.getList();
  844. });
  845. }
  846. }
  847. });
  848. },
  849. /** 删除按钮操作 */
  850. handleDelete(row) {
  851. const logIds = row.logId || this.ids;
  852. this.$confirm('是否确认删除短链课程看课记录编号为"' + logIds + '"的数据项?', "警告", {
  853. confirmButtonText: "确定",
  854. cancelButtonText: "取消",
  855. type: "warning"
  856. }).then(function () {
  857. return delCourseWatchLog(logIds);
  858. }).then(() => {
  859. this.getList();
  860. this.msgSuccess("删除成功");
  861. }).catch(() => {
  862. });
  863. },
  864. /** 导出按钮操作 */
  865. handleExport() {
  866. const queryParams = this.queryParams;
  867. this.$confirm('是否确认导出所有短链课程看课记录数据项?', "警告", {
  868. confirmButtonText: "确定",
  869. cancelButtonText: "取消",
  870. type: "warning"
  871. }).then(() => {
  872. this.exportLoading = true;
  873. return myExportCourseWatchLog(queryParams);
  874. }).then(response => {
  875. this.download(response.msg);
  876. this.exportLoading = false;
  877. }).catch(() => {
  878. });
  879. },
  880. openAnswerLogFun(row) {
  881. this.openAnswerLog = true;
  882. this.answerLogQueryParams.watchLogId = row.logId;
  883. this.answerLogList();
  884. },
  885. answerLogList() {
  886. this.loadingAnswerLog = true;
  887. myListLogs(this.answerLogQueryParams).then(e => {
  888. this.answerLogsList = e.rows;
  889. this.answerLogTotal = e.total;
  890. this.loadingAnswerLog = false;
  891. })
  892. },
  893. openRedLogFun(row) {
  894. this.openRedLog = true;
  895. this.redLogQueryParams.watchLogId = row.logId;
  896. this.redLogList();
  897. },
  898. redLogList() {
  899. this.loadingRedLog = true;
  900. console.info(this.redLogQueryParams)
  901. myListCourseRedPacketLog(this.redLogQueryParams).then(e => {
  902. this.redLogsList = e.rows;
  903. this.redLogTotal = e.total;
  904. this.loadingRedLog = false;
  905. })
  906. },
  907. addUserTag(){
  908. if(this.ids==null||this.ids==""){
  909. return this.$message('请选择需要添加标签的客户');
  910. }
  911. this.getPageListTagGroup();
  912. setTimeout(() => {
  913. for (let i = 0; i < this.tagGroupList.length; i++) {
  914. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  915. this.tagGroupList[i].tag[x].isSelected=false;
  916. }
  917. }
  918. }, 200);
  919. this.tagOpen = true;
  920. },
  921. delUserTag(){
  922. if(this.ids==null||this.ids==""){
  923. return this.$message('请选择需要移除标签的客户');
  924. }
  925. this.getPageListTagGroup();
  926. setTimeout(() => {
  927. for (let i = 0; i < this.tagGroupList.length; i++) {
  928. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  929. this.tagGroupList[i].tag[x].isSelected=false;
  930. }
  931. }
  932. }, 200);
  933. this.tagDelOpen = true;
  934. },
  935. getPageListTagGroup(){
  936. this.queryTagParams.corpId=this.queryParams.corpId
  937. allListTagGroup(this.queryTagParams).then(response => {
  938. this.tagGroupList = response.rows;
  939. this.tagTotal = response.total;
  940. });
  941. },
  942. tagSelection(row){
  943. row.isSelected= !row.isSelected;
  944. this.$forceUpdate();
  945. },
  946. handleSearchTags(name){
  947. if (!name){
  948. return this.$message.error("请输入要搜索的标签")
  949. }
  950. this.queryTagParams.name=name;
  951. this.queryTagParams.corpId=this.queryParams.corpId;
  952. searchTags(this.queryTagParams).then(response => {
  953. this.tagGroupList = response.rows;
  954. });
  955. // searchTags({name:name,corpId:this.queryParams.corpId}).then(response => {
  956. // this.tagGroupList = response.rows;
  957. // });
  958. },
  959. cancelSearchTags(){
  960. this.resetSearchQueryTag()
  961. this.getPageListTagGroup();
  962. },
  963. resetSearchQueryTag(){
  964. this.queryTagParams= {
  965. pageNum: 1,
  966. pageSize: 5,
  967. total:0,
  968. name:null,
  969. };
  970. },
  971. addTagSubmitForm(){
  972. for (let i = 0; i < this.tagGroupList.length; i++) {
  973. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  974. if(this.tagGroupList[i].tag[x].isSelected==true){
  975. this.addTagFormByWatch.tagIds.push(this.tagGroupList[i].tag[x].tagId)
  976. }
  977. }
  978. }
  979. if(this.addTagFormByWatch.tagIds==[]||this.addTagFormByWatch.tagIds==null||this.addTagFormByWatch.tagIds==""){
  980. return this.$message('请选择标签');
  981. }
  982. this.addTagFormByWatch.logIds=this.ids;
  983. let loadingRock = this.$loading({
  984. lock: true,
  985. text: '正在执行中请稍后~~请不要刷新页面!!',
  986. spinner: 'el-icon-loading',
  987. background: 'rgba(0, 0, 0, 0.7)'
  988. });
  989. addTagByWatch(this.addTagFormByWatch).then(response => {
  990. // this.msgSuccess(response.msg);
  991. this.resultMessage = response.msg;
  992. this.resultDialogVisible = true; // 显示弹窗
  993. this.resultTitle = '批量添加标签结果';
  994. this.tagOpen = false;
  995. loadingRock.close();
  996. this.addTagFormByWatch={
  997. logIds:[],
  998. tagIds:[]
  999. };
  1000. this.getList()
  1001. }).finally(res=>{
  1002. loadingRock.close();
  1003. });
  1004. },
  1005. tagDelSubmitForm(){
  1006. for (let i = 0; i < this.tagGroupList.length; i++) {
  1007. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  1008. if(this.tagGroupList[i].tag[x].isSelected==true){
  1009. this.addTagFormByWatch.tagIds.push(this.tagGroupList[i].tag[x].tagId)
  1010. }
  1011. }
  1012. }
  1013. if(this.addTagFormByWatch.tagIds==[]||this.addTagFormByWatch.tagIds==null||this.addTagFormByWatch.tagIds==""){
  1014. return this.$message('请选择标签');
  1015. }
  1016. this.addTagFormByWatch.corpId=this.queryParams.corpId
  1017. this.addTagFormByWatch.logIds=this.ids;
  1018. let loadingRock = this.$loading({
  1019. lock: true,
  1020. text: '正在执行中请稍后~~请不要刷新页面!!',
  1021. spinner: 'el-icon-loading',
  1022. background: 'rgba(0, 0, 0, 0.7)'
  1023. });
  1024. delTagByWatch(this.addTagFormByWatch).then(response => {
  1025. // this.msgSuccess(response.msg);
  1026. this.resultMessage = response.msg;
  1027. this.resultDialogVisible = true; // 显示弹窗
  1028. this.resultTitle = '批量移除标签结果';
  1029. this.tagDelOpen = false;
  1030. loadingRock.close();
  1031. this.addTagFormByWatch={
  1032. userIds:[],
  1033. tagIds:[]
  1034. };
  1035. this.getList()
  1036. }).finally(res=>{
  1037. loadingRock.close();
  1038. });
  1039. },
  1040. addTagCancel() {
  1041. this.tagOpen = false;
  1042. this.addTagFormByWatch={
  1043. logIds:[],
  1044. tagIds:[]
  1045. };
  1046. },
  1047. DelTagCancel() {
  1048. this.tagDelOpen = false;
  1049. this.addTagFormByWatch={
  1050. logIds:[],
  1051. tagIds:[]
  1052. };
  1053. },
  1054. }
  1055. };
  1056. </script>
  1057. <style scoped>
  1058. /* CSS 样式 */
  1059. .tag-container {
  1060. display: flex;
  1061. flex-wrap: wrap; /* 超出宽度时自动换行 */
  1062. gap: 8px; /* 设置标签之间的间距 */
  1063. }
  1064. .name-background {
  1065. display: inline-block;
  1066. background-color: #abece6; /* 背景颜色 */
  1067. padding: 4px 8px; /* 调整内边距,让背景包裹文字 */
  1068. border-radius: 4px; /* 可选:设置圆角 */
  1069. }
  1070. /* CSS 样式 */
  1071. .tag-container {
  1072. display: flex;
  1073. flex-wrap: wrap; /* 超出宽度时自动换行 */
  1074. gap: 8px; /* 设置标签之间的间距 */
  1075. }
  1076. .name-background {
  1077. display: inline-block;
  1078. background-color: #abece6; /* 背景颜色 */
  1079. padding: 4px 8px; /* 调整内边距,让背景包裹文字 */
  1080. border-radius: 4px; /* 可选:设置圆角 */
  1081. }
  1082. .tag-box {
  1083. padding: 8px 12px;
  1084. border: 1px solid #989797;
  1085. border-radius: 4px;
  1086. cursor: pointer;
  1087. display: inline-block;
  1088. }
  1089. .tag-selected {
  1090. background-color: #00bc98;
  1091. color: #fff;
  1092. border-color: #00bc98;
  1093. }
  1094. .el-tag + .el-tag {
  1095. margin-left: 10px;
  1096. }
  1097. .button-new-tag {
  1098. margin-left: 10px;
  1099. height: 32px;
  1100. line-height: 30px;
  1101. padding-top: 0;
  1102. padding-bottom: 0;
  1103. }
  1104. .input-new-tag {
  1105. width: 90px;
  1106. margin-left: 10px;
  1107. vertical-align: bottom;
  1108. }
  1109. /* 新增的滚动容器样式(不影响原有样式) */
  1110. .scroll-wrapper {
  1111. max-height: 130px; /* 大约三行的高度 */
  1112. overflow-y: auto; /* 垂直滚动 */
  1113. padding-right: 5px; /* 为滚动条留出空间 */
  1114. }
  1115. /* 美化滚动条(可选) */
  1116. .scroll-wrapper::-webkit-scrollbar {
  1117. width: 6px;
  1118. }
  1119. .scroll-wrapper::-webkit-scrollbar-thumb {
  1120. background: rgba(0, 0, 0, 0.2);
  1121. border-radius: 3px;
  1122. }
  1123. </style>