deptWatchLog.vue 37 KB

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