watchLog.vue 38 KB

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