deptWatchLog.vue 41 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226
  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="handleExport1"
  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="isRightText"/>
  380. <!-- <el-table-column label="是否全部正确" align="center" prop="isRight">-->
  381. <!-- <template slot-scope="scope">-->
  382. <!-- <dict-tag :options="sysCompanyOr" :value="scope.row.isRight"></dict-tag>-->
  383. <!-- </template>-->
  384. <!-- </el-table-column>-->
  385. <el-table-column label="销售名称" align="center" prop="companyUserName"/>
  386. <el-table-column label="企微员工名称" align="center" prop="qwUserName"/>
  387. <el-table-column label="公司名称" align="center" prop="companyName"/>
  388. <el-table-column label="创建时间" align="center" prop="createTime"/>
  389. </el-table>
  390. <pagination
  391. v-show="answerLogTotal>0"
  392. :total="answerLogTotal"
  393. :page.sync="answerLogQueryParams.pageNum"
  394. :limit.sync="answerLogQueryParams.pageSize"
  395. @pagination="answerLogList"
  396. />
  397. </el-drawer>
  398. <el-drawer title="红包记录" :visible.sync="openRedLog" size="70%" append-to-body>
  399. <el-table border v-loading="" :data="redLogsList">
  400. <el-table-column type="selection" width="55" align="center" />
  401. <el-table-column label="记录编号" align="center" prop="logId" />
  402. <el-table-column label="批次单号" align="center" prop="outBatchNo" />
  403. <el-table-column label="课程名称" align="center" prop="courseId" >
  404. <template slot-scope="scope">
  405. <span prop="status" v-for="(item, index) in courseLists" v-if="scope.row.courseId==item.dictValue">{{item.dictLabel}}</span>
  406. </template>
  407. </el-table-column>
  408. <el-table-column label="小节名称" align="center" prop="title" />
  409. <!-- <el-table-column label="会员id" align="center" prop="userId" />-->
  410. <el-table-column label="会员用户" align="center" prop="fsNickName">
  411. <template slot-scope="scope">
  412. <div style="display: flex;white-space: nowrap">
  413. <div style="margin: auto">
  414. {{scope.row.fsNickName}}
  415. </div>
  416. <el-popover
  417. placement="right"
  418. title=""
  419. trigger="hover">
  420. <img slot="reference" :src="scope.row.fsAvatar" style="width: 30px;height: 30px">
  421. <img :src="scope.row.fsAvatar" style="max-width: 200px;max-height: 200px">
  422. </el-popover>
  423. </div>
  424. </template>
  425. </el-table-column>
  426. <!-- <el-table-column label="会员电话" align="center" prop="phone" />-->
  427. <!-- <el-table-column label="所属销售" align="center" prop="companyUserName" />-->
  428. <!-- <el-table-column label="所属公司" align="center" prop="companyName" />-->
  429. <el-table-column label="转账金额" align="center" prop="amount" />
  430. <el-table-column label="状态" align="center" prop="status" >
  431. <template slot-scope="scope">
  432. <el-tag>
  433. {{
  434. scope.row.status === 0 ? "发送中" :
  435. scope.row.status === 2 ? "待补发" :
  436. "已完成"
  437. }}
  438. </el-tag>
  439. </template>
  440. </el-table-column>
  441. <el-table-column label="所属企微" align="center" prop="qwUserName" />
  442. <el-table-column label="创建时间" align="center" prop="createTime" />
  443. </el-table>
  444. <pagination
  445. v-show="redLogTotal>0"
  446. :total="redLogTotal"
  447. :page.sync="redLogQueryParams.pageNum"
  448. :limit.sync="redLogQueryParams.pageSize"
  449. @pagination="redLogList"
  450. />
  451. </el-drawer>
  452. </div>
  453. </template>
  454. <script>
  455. import {
  456. deptListCourseWatchLog,
  457. getCourseWatchLog,
  458. delCourseWatchLog,
  459. addCourseWatchLog,
  460. updateCourseWatchLog,
  461. exportCourseWatchLog,
  462. statisticsExport
  463. } from "@/api/course/courseWatchLog";
  464. import {courseList, myListCourseRedPacketLog, videoList} from '@/api/course/courseRedPacketLog'
  465. import {myListLogs} from "@/api/course/courseAnswerlogs";
  466. import { getCompanyUserListLikeName } from "@/api/company/companyUser";
  467. import {getTask} from "@/api/common";
  468. import Vue from 'vue'
  469. import Calendar from 'vue-mobile-calendar'
  470. import {infoSop} from "@/api/qw/sop";
  471. import {getMyQwUserList} from "@/api/qw/user";
  472. Vue.use(Calendar)
  473. export default {
  474. name: "CourseWatchLog",
  475. data() {
  476. return {
  477. companyName:process.env.VUE_APP_COURSE_COMPANY_NAME,
  478. sopSearchText: '', // SOP搜索框显示的文本
  479. selectedSopId: null, // 选中的SOP ID
  480. sendTypeOptions:[{
  481. dictLabel:"会员",dictValue:'1'
  482. },
  483. {
  484. dictLabel:"企微",dictValue:'2'
  485. }
  486. ],
  487. // 日历 key 控制刷新
  488. scheduleCalendarKey: 0,
  489. createCalendarKey: 0,
  490. updateCalendarKey: 0,
  491. qecCalendarKey: 0,
  492. periodTimeKey: 0,
  493. createTimeText: '',
  494. scheduleTimeText: '', // 新增
  495. updateTimeText: '', // 新增
  496. qecCreateTimeText: '', // 新增
  497. periodTimeText: '', // 营期课程时间
  498. scheduleTime: [], // 改为数组
  499. createTime: [], // 改为数组
  500. updateTime: [], // 改为数组
  501. qecCreateTime: [], // 改为数组
  502. periodTime: [], // 改为数组
  503. // 控制日历显隐
  504. showScheduleCalendar: false,
  505. showCreateCalendar: false,
  506. showUpdateCalendar: false,
  507. showQecCalendar: false,
  508. activeName:"00",
  509. courseLists:[],
  510. videoList:[],
  511. logTypeOptions:[],
  512. // 遮罩层
  513. loading: true,
  514. // 导出遮罩层
  515. exportLoading: false,
  516. // 选中数组
  517. ids: [],
  518. // 非单个禁用
  519. single: true,
  520. // 非多个禁用
  521. multiple: true,
  522. // 显示搜索条件
  523. showSearch: true,
  524. // 总条数
  525. total: 0,
  526. // 短链课程看课记录表格数据
  527. courseWatchLogList: [],
  528. // 弹出层标题
  529. title: "",
  530. // 是否显示弹出层
  531. open: false,
  532. //答题记录
  533. openAnswerLog: false,
  534. loadingAnswerLog: true,
  535. answerLogsList: [],
  536. answerLogTotal: 0,
  537. answerLogQueryParams: {
  538. pageNum: 1,
  539. pageSize: 10,
  540. },
  541. //红包记录
  542. openRedLog: false,
  543. loadingRedLog: true,
  544. redLogsList: [],
  545. redLogTotal: 0,
  546. redLogQueryParams: {
  547. pageNum: 1,
  548. pageSize: 10,
  549. },
  550. pickerOptions: {
  551. disabledDate(time) {
  552. // 获取13天前的日期(加上今天就是14天)
  553. const sixDaysAgo = new Date();
  554. sixDaysAgo.setDate(sixDaysAgo.getDate() - 13);
  555. sixDaysAgo.setHours(0, 0, 0, 0);
  556. // 获取明天的日期(不包括今天)
  557. const tomorrow = new Date();
  558. tomorrow.setDate(tomorrow.getDate() + 1);
  559. tomorrow.setHours(0, 0, 0, 0);
  560. return time.getTime() < sixDaysAgo.getTime() || time.getTime() >= tomorrow.getTime();
  561. }
  562. },
  563. // 查询参数
  564. queryParams: {
  565. pageNum: 1,
  566. pageSize: 10,
  567. userId: null,
  568. nickName: null,
  569. videoId: null,
  570. logType: null,
  571. qwExternalContactId: null,
  572. externalUserName:null,
  573. duration: null,
  574. qwUserId: null,
  575. qwUserName: null, //企微名称
  576. qwUserUserId: null, //企微id
  577. deptName: null, //部门名称
  578. companyUserId: null,
  579. companyId: null,
  580. courseId: null,
  581. sTime:null,
  582. eTime:null,
  583. upSTime:null,
  584. upETime:null,
  585. qecSTime:null,
  586. qecETime:null,
  587. periodSTime:null,
  588. periodETime:null,
  589. scheduleStartTime: null,
  590. scheduleEndTime: null,
  591. sendType:process.env.VUE_APP_COURSE_DEFAULT,
  592. sopId: null, // sopId
  593. },
  594. // 表单参数
  595. form: {},
  596. // 表单校验
  597. rules: {
  598. },
  599. // 员工选项列表
  600. companyUserOptionsParams: {
  601. name: undefined,
  602. hasNextPage: false,
  603. pageNum: 1,
  604. pageSize: 200
  605. },
  606. companyUserOptionsLoading: false,
  607. companyUserOptions: [],
  608. companyUserOptionsByAll: [],
  609. };
  610. },
  611. created() {
  612. courseList().then(response => {
  613. this.courseLists = response.list;
  614. });
  615. this.getDicts("sys_course_watch_log_type").then(response => {
  616. this.logTypeOptions = response.data;
  617. });
  618. // 设置默认当天时间 xgb 防止频繁查询大量数据
  619. this.setToday();
  620. this.getList();
  621. this.getCompanyUserListLikeName(true);
  622. this.loading=false;
  623. },
  624. methods: {
  625. setToday(){
  626. const today = new Date();
  627. const todayStart = new Date(today);
  628. todayStart.setHours(0, 0, 0, 0);
  629. const todayEnd = new Date(today);
  630. todayEnd.setHours(23, 59, 59, 999);
  631. this.createTimeText = [this.formatDate(todayStart), this.formatDate(todayEnd)];
  632. this.queryParams.sTime = this.formatDate(todayStart);
  633. this.queryParams.eTime = this.formatDate(todayEnd);
  634. },
  635. handleSendTypeChange() {
  636. this.handleQuery(); // 重新查询列表
  637. },
  638. // 重置日历组件
  639. resetCalendars() {
  640. this.scheduleTime = [];
  641. this.createTime = [];
  642. this.updateTime = [];
  643. this.qecCreateTime = [];
  644. this.periodTime = [];
  645. this.scheduleTimeText = '';
  646. this.createTimeText = '';
  647. this.updateTimeText = '';
  648. this.qecCreateTimeText = '';
  649. this.periodTimeText = [];
  650. // 强制刷新日历组件
  651. this.scheduleCalendarKey++;
  652. this.createCalendarKey++;
  653. this.updateCalendarKey++;
  654. this.qecCalendarKey++;
  655. this.periodTimeKey++;
  656. },
  657. formatDateRange(dates) {
  658. if (!dates || dates.length < 2) return '';
  659. return dates.map(date => date.format('YYYY-MM-DD')).join(' ~ ');
  660. },
  661. courseChange(row){
  662. this.queryParams.videoId=null;
  663. if(row === ''){
  664. this.videoList=[];
  665. return
  666. }
  667. videoList(row).then(response => {
  668. this.videoList=response.list
  669. });
  670. },
  671. handleClickX(tab,event){
  672. this.activeName=tab.name;
  673. if(tab.name=="00"){
  674. this.queryParams.logType=null;
  675. }else{
  676. this.queryParams.logType=tab.name;
  677. }
  678. this.getList()
  679. },
  680. /** 查询短链课程看课记录列表 */
  681. getList() {
  682. // xgb 看课数据量太大必须限制时间if (this.isEmptyArray(this.createTimeText) &&
  683. if (this.isEmptyArray(this.createTimeText) &&
  684. this.isEmptyArray(this.updateTimeText) &&
  685. this.isEmptyArray(this.scheduleTimeText)) {
  686. this.$message.warning('请选择创建时间或营期时间或最新更新时间');
  687. return;
  688. }
  689. this.loading = true;
  690. if(this.queryParams.logType == "10"){
  691. this.queryParams.logType = null;
  692. }
  693. deptListCourseWatchLog(this.queryParams).then(response => {
  694. this.courseWatchLogList = response.rows;
  695. this.total = response.total;
  696. this.loading = false;
  697. }).catch(() => {
  698. this.loading = false;
  699. }
  700. );
  701. },
  702. // 添加辅助方法
  703. isEmptyArray(arr) {
  704. return !arr || arr.length === 0;
  705. },
  706. // 取消按钮
  707. cancel() {
  708. this.open = false;
  709. this.reset();
  710. },
  711. // 表单重置
  712. reset() {
  713. this.form = {
  714. logId: null,
  715. userId: null,
  716. videoId: null,
  717. logType: null,
  718. createTime: null,
  719. updateTime: null,
  720. qwExternalContactId: null,
  721. externalUserName:null,
  722. duration: null,
  723. qwUserId: null,
  724. companyUserId: null,
  725. companyId: null,
  726. courseId: null,
  727. scheduleStartTime: null,
  728. scheduleEndTime: null,
  729. };
  730. this.scheduleTime=null;
  731. this.resetForm("form");
  732. },
  733. /** 搜索按钮操作 */
  734. handleQuery() {
  735. this.queryParams.pageNum = 1;
  736. this.getList();
  737. },
  738. /** 重置按钮操作 */
  739. resetQuery() {
  740. this.resetForm("queryForm");
  741. this.createTime = null;
  742. this.scheduleTime = null;
  743. this.qecCreateTime=null;
  744. this.queryParams.sTime = null;
  745. this.queryParams.eTime = null;
  746. this.queryParams.upSTime = null;
  747. this.queryParams.upETime = null;
  748. this.queryParams.qecSTime = null;
  749. this.queryParams.qecETime = null;
  750. this.queryParams.periodSTime = null;
  751. this.queryParams.periodDTime = null;
  752. this.queryParams.scheduleStartTime = null;
  753. this.queryParams.scheduleEndTime = null;
  754. this.queryParams.sopId = null; // 重置SOP ID
  755. this.scheduleTime=null;
  756. this.updateTime=null;
  757. this.queryParams.externalUserName=null;
  758. // 重置SOP搜索
  759. this.handleSopClear();
  760. // 统一重置日历组件
  761. this.resetCalendars();
  762. this.setToday();
  763. this.handleQuery();
  764. },
  765. // 多选框选中数据
  766. handleSelectionChange(selection) {
  767. this.ids = selection.map(item => item.logId)
  768. this.single = selection.length!==1
  769. this.multiple = !selection.length
  770. },
  771. /** 新增按钮操作 */
  772. handleAdd() {
  773. this.reset();
  774. this.open = true;
  775. this.title = "添加短链课程看课记录";
  776. },
  777. /** 修改按钮操作 */
  778. handleUpdate(row) {
  779. this.reset();
  780. const logId = row.logId || this.ids
  781. getCourseWatchLog(logId).then(response => {
  782. this.form = response.data;
  783. this.open = true;
  784. this.title = "修改短链课程看课记录";
  785. });
  786. },
  787. /** 提交按钮 */
  788. submitForm() {
  789. this.$refs["form"].validate(valid => {
  790. if (valid) {
  791. if (this.form.logId != null) {
  792. updateCourseWatchLog(this.form).then(response => {
  793. this.msgSuccess("修改成功");
  794. this.open = false;
  795. this.getList();
  796. });
  797. } else {
  798. addCourseWatchLog(this.form).then(response => {
  799. this.msgSuccess("新增成功");
  800. this.open = false;
  801. this.getList();
  802. });
  803. }
  804. }
  805. });
  806. },
  807. /** 删除按钮操作 */
  808. handleDelete(row) {
  809. const logIds = row.logId || this.ids;
  810. this.$confirm('是否确认删除短链课程看课记录编号为"' + logIds + '"的数据项?', "警告", {
  811. confirmButtonText: "确定",
  812. cancelButtonText: "取消",
  813. type: "warning"
  814. }).then(function() {
  815. return delCourseWatchLog(logIds);
  816. }).then(() => {
  817. this.getList();
  818. this.msgSuccess("删除成功");
  819. }).catch(() => {});
  820. },
  821. /** 导出按钮操作 */
  822. handleExport() {
  823. // xgb 看课数据量太大必须限制时间
  824. if (this.isEmptyArray(this.createTimeText) &&
  825. this.isEmptyArray(this.updateTimeText) &&
  826. this.isEmptyArray(this.scheduleTimeText)) {
  827. this.$message.warning('请选择创建时间或营期时间或最新更新时间');
  828. return;
  829. }
  830. const that = this
  831. const queryParams = this.queryParams;
  832. this.$confirm('是否确认导出所有短链课程看课记录数据项?', "警告", {
  833. confirmButtonText: "确定",
  834. cancelButtonText: "取消",
  835. type: "warning"
  836. }).then(() => {
  837. this.exportLoading = true;
  838. return exportCourseWatchLog(queryParams);
  839. }).then(response => {
  840. if (response.code === 200){
  841. that.msgSuccess(response.msg);
  842. that.taskId = response.data;
  843. that.time = setInterval(function(){
  844. //查订单
  845. getTask(that.taskId).then(res => {
  846. if(res.data.status === 1){
  847. that.exportLoading = false;
  848. clearTimeout(that.time)
  849. that.time = null;
  850. that.download(res.data.fileUrl);
  851. }
  852. });
  853. },10000);
  854. } else {
  855. that.msgError(response.msg)
  856. that.exportLoading = false
  857. }
  858. }).catch(() => {});
  859. },
  860. handleExport1() {
  861. if (this.isEmptyArray(this.createTimeText) &&
  862. this.isEmptyArray(this.updateTimeText) &&
  863. this.isEmptyArray(this.scheduleTimeText)) {
  864. this.$message.warning('请选择创建时间或营期时间或最新更新时间');
  865. return;
  866. }
  867. const queryParams = this.queryParams;
  868. this.$confirm('是否确认导出所有短链课程看课记录数据项?', "警告", {
  869. confirmButtonText: "确定",
  870. cancelButtonText: "取消",
  871. type: "warning"
  872. }).then(() => {
  873. this.exportLoading = true;
  874. return exportCourseWatchLog(queryParams);
  875. }).then(response => {
  876. this.download(response.msg);
  877. this.exportLoading = false;
  878. }).catch(() => {});
  879. },
  880. openAnswerLogFun(row) {
  881. this.openAnswerLog = true;
  882. this.answerLogQueryParams.watchLogId = row.logId;
  883. this.answerLogList();
  884. },
  885. answerLogList() {
  886. this.loadingAnswerLog = true;
  887. myListLogs(this.answerLogQueryParams).then(e => {
  888. this.answerLogsList = e.rows;
  889. this.answerLogTotal = e.total;
  890. this.loadingAnswerLog = false;
  891. })
  892. },
  893. openRedLogFun(row) {
  894. this.openRedLog = true;
  895. this.redLogQueryParams.watchLogId = row.logId;
  896. this.redLogList();
  897. },
  898. redLogList() {
  899. this.loadingRedLog = true;
  900. console.info("------------dept",this.redLogQueryParams)
  901. myListCourseRedPacketLog(this.redLogQueryParams).then(e => {
  902. this.redLogsList = e.rows;
  903. this.redLogTotal = e.total;
  904. this.loadingRedLog = false;
  905. })
  906. },
  907. // 营期时间
  908. handleScheduleTimeChange(scheduleTime) {
  909. if (scheduleTime && scheduleTime.length >= 2) {
  910. if(!this.checkDateRangeLimit(scheduleTime)){
  911. this.scheduleTimeText = null;
  912. this.queryParams.scheduleStartTime=null;
  913. this.queryParams.scheduleStartTime=null;
  914. return;
  915. }
  916. // this.scheduleTimeText = this.formatDateRange(scheduleTime);
  917. this.queryParams.scheduleStartTime = scheduleTime[0] || null;
  918. this.queryParams.scheduleEndTime = scheduleTime[1] || null;
  919. } else {
  920. this.scheduleTimeText = [];
  921. this.queryParams.scheduleStartTime = null;
  922. this.queryParams.scheduleEndTime = null;
  923. }
  924. },
  925. checkDateRangeLimit(dateRange) {
  926. if (dateRange && dateRange.length >= 2) {
  927. const startDate = new Date(dateRange[0]);
  928. const endDate = new Date(dateRange[1]);
  929. // 设置时间为当天开始,避免时间部分影响计算
  930. startDate.setHours(0, 0, 0, 0);
  931. endDate.setHours(0, 0, 0, 0);
  932. const timeDiff = Math.abs(endDate - startDate);
  933. const diffDays = Math.ceil(timeDiff / (1000 * 60 * 60 * 24));
  934. if (diffDays > 31) { // maxDays-1 因为包含起始日
  935. this.$message.warning('时间区间不能超过一个月');
  936. return false;
  937. }
  938. }
  939. return true;
  940. },
  941. // 创建时间
  942. createChange(createTime) {
  943. if (createTime && createTime.length >= 2) {
  944. if(!this.checkDateRangeLimit(createTime)){
  945. this.createTimeText = null;
  946. this.queryParams.sTime=null;
  947. this.queryParams.eTime=null;
  948. return;
  949. }
  950. // this.createTimeText = this.formatDateRange(createTime);
  951. this.queryParams.sTime = this.formatDate(createTime[0]) || null;
  952. this.queryParams.eTime = this.formatDate(createTime[1]) || null;
  953. } else {
  954. this.createTimeText = '';
  955. this.queryParams.sTime = null;
  956. this.queryParams.eTime = null;
  957. }
  958. },
  959. // 更新时间
  960. updateChange(updateTime) {
  961. if (updateTime && updateTime.length >= 2) {
  962. if(!this.checkDateRangeLimit(updateTime)){
  963. this.updateTimeText = null;
  964. this.queryParams.upSTime=null;
  965. this.queryParams.upETime=null;
  966. return;
  967. }
  968. this.updateTimeText = this.formatDateRange(updateTime);
  969. this.queryParams.upSTime = updateTime[0] || null;
  970. this.queryParams.upETime = updateTime[1] || null;
  971. } else {
  972. this.updateTimeText = '';
  973. this.queryParams.upSTime = null;
  974. this.queryParams.upETime = null;
  975. }
  976. },
  977. // 进线时间
  978. qecCreateTimeChange(qecCreateTime) {
  979. if (qecCreateTime && qecCreateTime.length >= 2) {
  980. // 检查选择的日期范围是否超过7天(包括起始和结束日期)
  981. const startDate = new Date(qecCreateTime[0]);
  982. const endDate = new Date(qecCreateTime[1]);
  983. // 设置时间为当天开始,避免时间部分影响计算
  984. startDate.setHours(0, 0, 0, 0);
  985. endDate.setHours(0, 0, 0, 0);
  986. const timeDiff = Math.abs(endDate - startDate);
  987. const diffDays = Math.ceil(timeDiff / (1000 * 60 * 60 * 24));
  988. // 如果超过6天的范围(总共7天,包括起始日)
  989. if (diffDays > 6) {
  990. this.$message.error('进线时间选择范围不能超过7天');
  991. // 清空选择
  992. this.qecCreateTime = [];
  993. this.qecCreateTimeText = [];
  994. this.queryParams.qecSTime = null;
  995. this.queryParams.qecETime = null;
  996. this.qecCalendarKey++;
  997. return;
  998. }
  999. // this.qecCreateTimeText = this.formatDateRange(qecCreateTime);
  1000. this.queryParams.qecSTime = qecCreateTime[0] || null;
  1001. this.queryParams.qecETime = qecCreateTime[1] || null;
  1002. } else {
  1003. this.qecCreateTimeText = '';
  1004. this.queryParams.qecSTime = null;
  1005. this.queryParams.qecETime = null;
  1006. }
  1007. },
  1008. //营期课程时间
  1009. qecPeriodTimeChange(periodTime){
  1010. if (periodTime && periodTime.length >= 2) {
  1011. // 检查选择的日期范围是否超过7天(包括起始和结束日期)
  1012. const startDate = new Date(periodTime[0]);
  1013. const endDate = new Date(periodTime[1]);
  1014. // 设置时间为当天开始,避免时间部分影响计算
  1015. startDate.setHours(0, 0, 0, 0);
  1016. endDate.setHours(0, 0, 0, 0);
  1017. const timeDiff = Math.abs(endDate - startDate);
  1018. const diffDays = Math.ceil(timeDiff / (1000 * 60 * 60 * 24));
  1019. // 如果超过6天的范围(总共7天,包括起始日)
  1020. if (diffDays > 13) {
  1021. this.$message.error('时间选择范围不能超过14天');
  1022. // 清空选择
  1023. this.periodTime = [];
  1024. this.periodTimeText = [];
  1025. this.queryParams.periodSTime = null;
  1026. this.queryParams.periodETime = null;
  1027. this.periodTimeKey++;
  1028. return;
  1029. }
  1030. this.queryParams.periodSTime = this.formatDate(periodTime[0]) || null;
  1031. this.queryParams.periodETime = this.formatDate(periodTime[1]) || null;
  1032. } else {
  1033. this.periodTimeText = '';
  1034. this.queryParams.periodSTime = null;
  1035. this.queryParams.periodETime = null;
  1036. }
  1037. },
  1038. formatDate(date) {
  1039. if (!date) return ''
  1040. // 确保 date 是 Date 对象
  1041. let dateObj = date
  1042. if (typeof date === 'string') {
  1043. dateObj = new Date(date)
  1044. }
  1045. // 如果转换失败,返回空字符串
  1046. if (!(dateObj instanceof Date) || isNaN(dateObj.getTime())) {
  1047. return ''
  1048. }
  1049. // 使用更安全的格式化方法
  1050. const year = dateObj.getFullYear()
  1051. const month = String(dateObj.getMonth() + 1).padStart(2, '0')
  1052. const day = String(dateObj.getDate()).padStart(2, '0')
  1053. const hours = String(dateObj.getHours()).padStart(2, '0')
  1054. const minutes = String(dateObj.getMinutes()).padStart(2, '0')
  1055. const seconds = String(dateObj.getSeconds()).padStart(2, '0')
  1056. return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
  1057. },
  1058. /**
  1059. * 根据名称模糊查询用户列表
  1060. * @param query 参数
  1061. */
  1062. loadCompanyUserOptions(query) {
  1063. this.companyUserOptions = [];
  1064. if (query === '') {
  1065. return;
  1066. }
  1067. this.companyUserOptionsParams.pageNum = 1
  1068. this.companyUserOptionsParams.name = query
  1069. this.companyUserOptionsLoading = true;
  1070. this.getCompanyUserListLikeName()
  1071. },
  1072. /**
  1073. * 获取员工列表
  1074. */
  1075. getCompanyUserListLikeName(isAll) {
  1076. if (isAll){
  1077. getCompanyUserListLikeName(this.companyUserOptionsParams).then(response => {
  1078. this.companyUserOptionsByAll = [...this.companyUserOptions, ...response.data.list]
  1079. this.companyUserOptionsParams.hasNextPage = response.data.hasNextPage
  1080. this.companyUserOptionsLoading = false;
  1081. });
  1082. }else {
  1083. this.companyUserOptionsParams.pageSize=10;
  1084. getCompanyUserListLikeName(this.companyUserOptionsParams).then(response => {
  1085. this.companyUserOptions = [...this.companyUserOptions, ...response.data.list]
  1086. this.companyUserOptionsParams.hasNextPage = response.data.hasNextPage
  1087. this.companyUserOptionsLoading = false;
  1088. });
  1089. }
  1090. },
  1091. /**
  1092. * 加载更多员工选项
  1093. */
  1094. loadMoreCompanyUserOptions() {
  1095. if (!this.companyUserOptionsParams.hasNextPage) {
  1096. return;
  1097. }
  1098. this.companyUserOptionsParams.pageNum += 1
  1099. this.getCompanyUserListLikeName()
  1100. },
  1101. /**
  1102. * 选择SOP
  1103. * @param {object} item - 选中的SOP项
  1104. */
  1105. handleSopSelect(item) {
  1106. this.selectedSopId = item.id;
  1107. this.queryParams.sopId = item.id;
  1108. this.sopSearchText = item.name;
  1109. },
  1110. /**
  1111. * 清空SOP选择
  1112. */
  1113. handleSopClear() {
  1114. this.selectedSopId = null;
  1115. this.queryParams.sopId = null;
  1116. this.sopSearchText = '';
  1117. },
  1118. /**
  1119. * 异步查询SOP列表
  1120. * @param {string} queryString - 查询字符串
  1121. * @param {function} callback - 回调函数
  1122. */
  1123. querySopAsync(queryString, callback) {
  1124. if (!queryString) {
  1125. callback([]);
  1126. return;
  1127. }
  1128. infoSop({ name: queryString }).then(response => {
  1129. if (response && response.rows) {
  1130. const suggestions = response.rows.map(item => ({
  1131. value: item.name,
  1132. id: item.id,
  1133. name: item.name
  1134. }));
  1135. callback(suggestions);
  1136. } else {
  1137. callback([]);
  1138. }
  1139. }).catch(error => {
  1140. console.error('通过sop查询失败:', error);
  1141. callback([]);
  1142. });
  1143. },
  1144. updateQwuser() {
  1145. for (const user of this.myQwUserList) {
  1146. if (user.dictValue == this.queryParams.qwUserId) {
  1147. this.queryParams.corpId = user.corpId;
  1148. break;
  1149. }
  1150. }
  1151. this.getList();
  1152. },
  1153. }
  1154. };
  1155. </script>