index.vue 37 KB

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