index.vue 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152
  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. this.qecCreateTimeText = this.formatDateRange(qecCreateTime);
  653. this.queryParams.qecSTime = qecCreateTime.map(date => date.format('YYYY-MM-DD'))[0] || null;
  654. this.queryParams.qecETime = qecCreateTime.map(date => date.format('YYYY-MM-DD'))[1] || null;
  655. } else {
  656. this.qecCreateTimeText = '';
  657. this.queryParams.qecSTime = null;
  658. this.queryParams.qecETime = null;
  659. }
  660. },
  661. handleClickX(tab,event){
  662. this.activeName=tab.name;
  663. if(tab.name=="00"){
  664. this.queryParams.logType=null;
  665. }else{
  666. this.queryParams.logType=tab.name;
  667. }
  668. this.getList()
  669. },
  670. /** 查询短链课程看课记录列表 */
  671. getList() {
  672. this.loading = true;
  673. if(this.queryParams.logType == "10"){
  674. this.queryParams.logType = null;
  675. }
  676. listCourseWatchLog(this.queryParams).then(response => {
  677. this.courseWatchLogList = response.rows;
  678. this.total = response.total;
  679. this.loading = false;
  680. });
  681. },
  682. // 取消按钮
  683. cancel() {
  684. this.open = false;
  685. this.reset();
  686. },
  687. // 表单重置
  688. reset() {
  689. this.form = {
  690. logId: null,
  691. userId: null,
  692. videoId: null,
  693. logType: null,
  694. createTime: null,
  695. updateTime: null,
  696. qwExternalContactId: null,
  697. externalUserName:null,
  698. duration: null,
  699. qwUserId: null,
  700. companyUserId: null,
  701. companyId: null,
  702. courseId: null,
  703. sTime:null,
  704. eTime:null,
  705. upSTime:null,
  706. upETime:null,
  707. qecSTime:null,
  708. qecETime:null,
  709. scheduleStartTime: null,
  710. scheduleEndTime: null,
  711. };
  712. // 统一重置日历组件
  713. this.resetCalendars();
  714. this.resetForm("form");
  715. },
  716. /** 搜索按钮操作 */
  717. handleQuery() {
  718. this.queryParams.pageNum = 1;
  719. this.getList();
  720. },
  721. /** 重置按钮操作 */
  722. resetQuery() {
  723. this.resetForm("queryForm");
  724. this.queryParams.sTime = null;
  725. this.queryParams.eTime = null;
  726. this.queryParams.upSTime = null;
  727. this.queryParams.upETime = null;
  728. this.queryParams.qecSTime = null;
  729. this.queryParams.qecETime = null;
  730. this.queryParams.scheduleStartTime = null;
  731. this.queryParams.scheduleEndTime = null;
  732. // 统一重置日历组件
  733. this.resetCalendars();
  734. this.handleQuery();
  735. },
  736. // 多选框选中数据
  737. handleSelectionChange(selection) {
  738. this.ids = selection.map(item => item.logId)
  739. this.single = selection.length!==1
  740. this.multiple = !selection.length
  741. },
  742. /** 新增按钮操作 */
  743. handleAdd() {
  744. this.reset();
  745. this.open = true;
  746. this.title = "添加短链课程看课记录";
  747. },
  748. /** 修改按钮操作 */
  749. handleUpdate(row) {
  750. this.reset();
  751. const logId = row.logId || this.ids
  752. getCourseWatchLog(logId).then(response => {
  753. this.form = response.data;
  754. this.open = true;
  755. this.title = "修改短链课程看课记录";
  756. });
  757. },
  758. /** 提交按钮 */
  759. submitForm() {
  760. this.$refs["form"].validate(valid => {
  761. if (valid) {
  762. if (this.form.logId != null) {
  763. updateCourseWatchLog(this.form).then(response => {
  764. this.msgSuccess("修改成功");
  765. this.open = false;
  766. this.getList();
  767. });
  768. } else {
  769. addCourseWatchLog(this.form).then(response => {
  770. this.msgSuccess("新增成功");
  771. this.open = false;
  772. this.getList();
  773. });
  774. }
  775. }
  776. });
  777. },
  778. /** 删除按钮操作 */
  779. handleDelete(row) {
  780. const logIds = row.logId || this.ids;
  781. this.$confirm('是否确认删除短链课程看课记录编号为"' + logIds + '"的数据项?', "警告", {
  782. confirmButtonText: "确定",
  783. cancelButtonText: "取消",
  784. type: "warning"
  785. }).then(function() {
  786. return delCourseWatchLog(logIds);
  787. }).then(() => {
  788. this.getList();
  789. this.msgSuccess("删除成功");
  790. }).catch(() => {});
  791. },
  792. /** 导出按钮操作 */
  793. handleExport() {
  794. const queryParams = this.queryParams;
  795. this.$confirm('是否确认导出所有短链课程看课记录数据项?', "警告", {
  796. confirmButtonText: "确定",
  797. cancelButtonText: "取消",
  798. type: "warning"
  799. }).then(() => {
  800. this.exportLoading = true;
  801. return exportCourseWatchLog(queryParams);
  802. }).then(response => {
  803. this.download(response.msg);
  804. this.exportLoading = false;
  805. }).catch(() => {});
  806. },
  807. openAnswerLogFun(row) {
  808. this.openAnswerLog = true;
  809. this.answerLogQueryParams.watchLogId = row.logId;
  810. this.answerLogList();
  811. },
  812. answerLogList() {
  813. this.loadingAnswerLog = true;
  814. myListLogs(this.answerLogQueryParams).then(e => {
  815. this.answerLogsList = e.rows;
  816. this.answerLogTotal = e.total;
  817. this.loadingAnswerLog = false;
  818. })
  819. },
  820. openRedLogFun(row) {
  821. this.openRedLog = true;
  822. this.redLogQueryParams.watchLogId = row.logId;
  823. this.redLogList();
  824. },
  825. redLogList() {
  826. this.loadingRedLog = true;
  827. console.info(this.redLogQueryParams)
  828. myListCourseRedPacketLog(this.redLogQueryParams).then(e => {
  829. this.redLogsList = e.rows;
  830. this.redLogTotal = e.total;
  831. this.loadingRedLog = false;
  832. })
  833. },
  834. handleSendTypeChange() {
  835. this.handleQuery(); // 重新查询列表
  836. },
  837. addUserTag(){
  838. if(this.ids==null||this.ids==""){
  839. return this.$message('请选择需要添加标签的客户');
  840. }
  841. this.getPageListTagGroup();
  842. setTimeout(() => {
  843. for (let i = 0; i < this.tagGroupList.length; i++) {
  844. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  845. this.tagGroupList[i].tag[x].isSelected=false;
  846. }
  847. }
  848. }, 200);
  849. this.tagOpen = true;
  850. },
  851. delUserTag(){
  852. if(this.ids==null||this.ids==""){
  853. return this.$message('请选择需要移除标签的客户');
  854. }
  855. this.getPageListTagGroup();
  856. setTimeout(() => {
  857. for (let i = 0; i < this.tagGroupList.length; i++) {
  858. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  859. this.tagGroupList[i].tag[x].isSelected=false;
  860. }
  861. }
  862. }, 200);
  863. this.tagDelOpen = true;
  864. },
  865. getPageListTagGroup(){
  866. this.queryTagParams.corpId=this.queryParams.corpId
  867. allListTagGroup(this.queryTagParams).then(response => {
  868. this.tagGroupList = response.rows;
  869. this.tagTotal = response.total;
  870. });
  871. },
  872. tagSelection(row){
  873. row.isSelected= !row.isSelected;
  874. this.$forceUpdate();
  875. },
  876. handleSearchTags(name){
  877. if (!name){
  878. return this.$message.error("请输入要搜索的标签")
  879. }
  880. this.queryTagParams.name=name;
  881. this.queryTagParams.corpId=this.queryParams.corpId;
  882. searchTags(this.queryTagParams).then(response => {
  883. this.tagGroupList = response.rows;
  884. });
  885. // searchTags({name:name,corpId:this.queryParams.corpId}).then(response => {
  886. // this.tagGroupList = response.rows;
  887. // });
  888. },
  889. cancelSearchTags(){
  890. this.resetSearchQueryTag()
  891. this.getPageListTagGroup();
  892. },
  893. resetSearchQueryTag(){
  894. this.queryTagParams= {
  895. pageNum: 1,
  896. pageSize: 5,
  897. total:0,
  898. name:null,
  899. };
  900. },
  901. addTagSubmitForm(){
  902. for (let i = 0; i < this.tagGroupList.length; i++) {
  903. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  904. if(this.tagGroupList[i].tag[x].isSelected==true){
  905. this.addTagFormByWatch.tagIds.push(this.tagGroupList[i].tag[x].tagId)
  906. }
  907. }
  908. }
  909. if(this.addTagFormByWatch.tagIds==[]||this.addTagFormByWatch.tagIds==null||this.addTagFormByWatch.tagIds==""){
  910. return this.$message('请选择标签');
  911. }
  912. this.addTagFormByWatch.logIds=this.ids;
  913. let loadingRock = this.$loading({
  914. lock: true,
  915. text: '正在执行中请稍后~~请不要刷新页面!!',
  916. spinner: 'el-icon-loading',
  917. background: 'rgba(0, 0, 0, 0.7)'
  918. });
  919. addTagByWatch(this.addTagFormByWatch).then(response => {
  920. // this.msgSuccess(response.msg);
  921. this.resultMessage = response.msg;
  922. this.resultDialogVisible = true; // 显示弹窗
  923. this.resultTitle = '批量添加标签结果';
  924. this.tagOpen = false;
  925. loadingRock.close();
  926. this.addTagFormByWatch={
  927. logIds:[],
  928. tagIds:[]
  929. };
  930. this.getList()
  931. }).finally(res=>{
  932. loadingRock.close();
  933. });
  934. },
  935. tagDelSubmitForm(){
  936. for (let i = 0; i < this.tagGroupList.length; i++) {
  937. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  938. if(this.tagGroupList[i].tag[x].isSelected==true){
  939. this.addTagFormByWatch.tagIds.push(this.tagGroupList[i].tag[x].tagId)
  940. }
  941. }
  942. }
  943. if(this.addTagFormByWatch.tagIds==[]||this.addTagFormByWatch.tagIds==null||this.addTagFormByWatch.tagIds==""){
  944. return this.$message('请选择标签');
  945. }
  946. this.addTagFormByWatch.corpId=this.queryParams.corpId
  947. this.addTagFormByWatch.logIds=this.ids;
  948. let loadingRock = this.$loading({
  949. lock: true,
  950. text: '正在执行中请稍后~~请不要刷新页面!!',
  951. spinner: 'el-icon-loading',
  952. background: 'rgba(0, 0, 0, 0.7)'
  953. });
  954. delTagByWatch(this.addTagFormByWatch).then(response => {
  955. // this.msgSuccess(response.msg);
  956. this.resultMessage = response.msg;
  957. this.resultDialogVisible = true; // 显示弹窗
  958. this.resultTitle = '批量移除标签结果';
  959. this.tagDelOpen = false;
  960. loadingRock.close();
  961. this.addTagFormByWatch={
  962. userIds:[],
  963. tagIds:[]
  964. };
  965. this.getList()
  966. }).finally(res=>{
  967. loadingRock.close();
  968. });
  969. },
  970. addTagCancel() {
  971. this.tagOpen = false;
  972. this.addTagFormByWatch={
  973. logIds:[],
  974. tagIds:[]
  975. };
  976. },
  977. DelTagCancel() {
  978. this.tagDelOpen = false;
  979. this.addTagFormByWatch={
  980. logIds:[],
  981. tagIds:[]
  982. };
  983. },
  984. }
  985. };
  986. </script>
  987. <style scoped>
  988. /* CSS 样式 */
  989. .tag-container {
  990. display: flex;
  991. flex-wrap: wrap; /* 超出宽度时自动换行 */
  992. gap: 8px; /* 设置标签之间的间距 */
  993. }
  994. .name-background {
  995. display: inline-block;
  996. background-color: #abece6; /* 背景颜色 */
  997. padding: 4px 8px; /* 调整内边距,让背景包裹文字 */
  998. border-radius: 4px; /* 可选:设置圆角 */
  999. }
  1000. /* CSS 样式 */
  1001. .tag-container {
  1002. display: flex;
  1003. flex-wrap: wrap; /* 超出宽度时自动换行 */
  1004. gap: 8px; /* 设置标签之间的间距 */
  1005. }
  1006. .name-background {
  1007. display: inline-block;
  1008. background-color: #abece6; /* 背景颜色 */
  1009. padding: 4px 8px; /* 调整内边距,让背景包裹文字 */
  1010. border-radius: 4px; /* 可选:设置圆角 */
  1011. }
  1012. .tag-box {
  1013. padding: 8px 12px;
  1014. border: 1px solid #989797;
  1015. border-radius: 4px;
  1016. cursor: pointer;
  1017. display: inline-block;
  1018. }
  1019. .tag-selected {
  1020. background-color: #00bc98;
  1021. color: #fff;
  1022. border-color: #00bc98;
  1023. }
  1024. .el-tag + .el-tag {
  1025. margin-left: 10px;
  1026. }
  1027. .button-new-tag {
  1028. margin-left: 10px;
  1029. height: 32px;
  1030. line-height: 30px;
  1031. padding-top: 0;
  1032. padding-bottom: 0;
  1033. }
  1034. .input-new-tag {
  1035. width: 90px;
  1036. margin-left: 10px;
  1037. vertical-align: bottom;
  1038. }
  1039. /* 新增的滚动容器样式(不影响原有样式) */
  1040. .scroll-wrapper {
  1041. max-height: 130px; /* 大约三行的高度 */
  1042. overflow-y: auto; /* 垂直滚动 */
  1043. padding-right: 5px; /* 为滚动条留出空间 */
  1044. }
  1045. /* 美化滚动条(可选) */
  1046. .scroll-wrapper::-webkit-scrollbar {
  1047. width: 6px;
  1048. }
  1049. .scroll-wrapper::-webkit-scrollbar-thumb {
  1050. background: rgba(0, 0, 0, 0.2);
  1051. border-radius: 3px;
  1052. }
  1053. </style>