deptWatchLog.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831
  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="会员ID" prop="userId">
  5. <el-input
  6. v-model="queryParams.userId"
  7. placeholder="请输入会员ID"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="会员昵称" prop="nickName">
  14. <el-input
  15. v-model="queryParams.nickName"
  16. placeholder="请输入会员昵称"
  17. clearable
  18. size="small"
  19. @keyup.enter.native="handleQuery"
  20. />
  21. </el-form-item>
  22. <el-form-item label="企微客户昵称" prop="nickName" >
  23. <el-input
  24. v-model="queryParams.externalUserName"
  25. placeholder="请输入企微客户昵称"
  26. clearable
  27. size="small"
  28. @keyup.enter.native="handleQuery"
  29. />
  30. </el-form-item>
  31. <el-form-item label="所属销售" prop="companyUserId">
  32. <el-select v-model="queryParams.companyUserId" clearable filterable remote
  33. placeholder="请输入关键词" :remote-method="loadCompanyUserOptions"
  34. v-select-load-more="loadMoreCompanyUserOptions"
  35. :loading="companyUserOptionsLoading">
  36. <el-option
  37. v-for="item in companyUserOptions"
  38. :key="item.value"
  39. :label="item.label"
  40. :value="item.value">
  41. </el-option>
  42. </el-select>
  43. </el-form-item>
  44. <el-form-item label="课程" prop="courseId">
  45. <el-select filterable v-model="queryParams.courseId" placeholder="请选择课程" clearable size="small" @change="courseChange(queryParams.courseId)">
  46. <el-option
  47. v-for="dict in courseLists"
  48. :key="dict.dictValue"
  49. :label="dict.dictLabel"
  50. :value="dict.dictValue"
  51. />
  52. </el-select>
  53. </el-form-item>
  54. <el-form-item label="小节" prop="videoId">
  55. <el-select filterable v-model="queryParams.videoId" placeholder="请选择小节" clearable size="small">
  56. <el-option
  57. v-for="dict in videoList"
  58. :key="dict.dictValue"
  59. :label="dict.dictLabel"
  60. :value="dict.dictValue"
  61. />
  62. </el-select>
  63. </el-form-item>
  64. <el-form-item label="企微ID" prop="qwUserUserId">
  65. <el-input
  66. v-model="queryParams.qwUserUserId"
  67. placeholder="请输入所属企微ID"
  68. clearable
  69. size="small"
  70. @keyup.enter.native="handleQuery"
  71. />
  72. </el-form-item>
  73. <el-form-item label="企微员工名称" prop="qwUserName">
  74. <el-input
  75. v-model="queryParams.qwUserName"
  76. placeholder="请输入所属企微员工名称"
  77. clearable
  78. size="small"
  79. @keyup.enter.native="handleQuery"
  80. />
  81. </el-form-item>
  82. <!-- <el-form-item label="部门名称" prop="deptName">-->
  83. <!-- <el-input-->
  84. <!-- v-model="queryParams.deptName"-->
  85. <!-- placeholder="请输入部门名称"-->
  86. <!-- clearable-->
  87. <!-- size="small"-->
  88. <!-- @keyup.enter.native="handleQuery"-->
  89. <!-- />-->
  90. <!-- </el-form-item>-->
  91. <!-- 营期时间 -->
  92. <el-form-item label="营期时间" prop="scheduleTime">
  93. <el-input
  94. v-model="scheduleTimeText"
  95. placeholder="请选择营期时间"
  96. readonly
  97. @click.native="showScheduleCalendar = true"
  98. />
  99. <calendar
  100. v-model="scheduleTime"
  101. mode="during"
  102. :show.sync="showScheduleCalendar"
  103. @change="handleScheduleTimeChange"
  104. :key="scheduleCalendarKey"
  105. />
  106. </el-form-item>
  107. <!-- 创建时间 -->
  108. <el-form-item label="创建时间" prop="createTime">
  109. <el-input
  110. v-model="createTimeText"
  111. placeholder="请选择创建时间"
  112. readonly
  113. @click.native="showCreateCalendar = true"
  114. />
  115. <calendar
  116. v-model="createTime"
  117. mode="during"
  118. :show.sync="showCreateCalendar"
  119. @change="createChange"
  120. :key="createCalendarKey"
  121. />
  122. </el-form-item>
  123. <!-- 最新更新时间 -->
  124. <el-form-item label="最新更新时间" prop="updateTime">
  125. <el-input
  126. v-model="updateTimeText"
  127. placeholder="请选择更新时间"
  128. readonly
  129. @click.native="showUpdateCalendar = true"
  130. />
  131. <calendar
  132. v-model="updateTime"
  133. mode="during"
  134. :show.sync="showUpdateCalendar"
  135. @change="updateChange"
  136. :key="updateCalendarKey"
  137. />
  138. </el-form-item>
  139. <!-- 进线时间 -->
  140. <el-form-item label="进线时间" prop="qecCreateTime">
  141. <el-input
  142. v-model="qecCreateTimeText"
  143. placeholder="请选择进线时间"
  144. readonly
  145. @click.native="showQecCalendar = true"
  146. />
  147. <calendar
  148. v-model="qecCreateTime"
  149. mode="during"
  150. :show.sync="showQecCalendar"
  151. @change="qecCreateTimeChange"
  152. :key="qecCalendarKey"
  153. />
  154. </el-form-item>
  155. <el-form-item>
  156. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  157. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  158. </el-form-item>
  159. </el-form>
  160. <!-- <el-row :gutter="10" class="mb8">-->
  161. <!-- <el-col :span="1.5">-->
  162. <!-- <el-button-->
  163. <!-- type="warning"-->
  164. <!-- plain-->
  165. <!-- icon="el-icon-download"-->
  166. <!-- size="mini"-->
  167. <!-- :loading="exportLoading"-->
  168. <!-- @click="handleExport"-->
  169. <!-- v-hasPermi="['course:courseWatchLog:export']"-->
  170. <!-- >导出</el-button>-->
  171. <!-- </el-col>-->
  172. <!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>-->
  173. <!-- </el-row>-->
  174. <el-tabs type="card" v-model="activeName" @tab-click="handleClickX">
  175. <el-tab-pane label="全部" name="00"></el-tab-pane>
  176. <el-tab-pane v-for="(item,index) in logTypeOptions" :label="item.dictLabel" :name="item.dictValue"></el-tab-pane>
  177. </el-tabs>
  178. <el-table border v-loading="loading" :data="courseWatchLogList" @selection-change="handleSelectionChange">
  179. <el-table-column type="selection" width="55" align="center" />
  180. <el-table-column label="记录编号" align="center" prop="logId" />
  181. <el-table-column label="企微客户" align="center" prop="externalUserName"/>
  182. <el-table-column label="客户头像" align="center" prop="externalUserAvatar">
  183. <template slot-scope="scope">
  184. <el-popover
  185. placement="right"
  186. trigger="hover">
  187. <img slot="reference" :src="scope.row.externalUserAvatar" style="width: 40px;height: 40px">
  188. <img :src="scope.row.externalUserAvatar" style="max-width: 250px;max-height: 250px">
  189. </el-popover>
  190. </template>
  191. </el-table-column>
  192. <el-table-column label="会员ID" align="center" prop="userId" />
  193. <el-table-column label="会员昵称" align="center" prop="fsNickName">
  194. <template slot-scope="scope">
  195. <div style="display: flex;white-space: nowrap">
  196. <div style="margin: auto">
  197. {{scope.row.fsNickName}}
  198. </div>
  199. <el-popover
  200. placement="right"
  201. title=""
  202. trigger="hover">
  203. <img slot="reference" :src="scope.row.fsAvatar" style="width: 30px;height: 30px">
  204. <img :src="scope.row.fsAvatar" style="max-width: 200px;max-height: 200px">
  205. </el-popover>
  206. </div>
  207. </template>
  208. </el-table-column>
  209. <el-table-column label="课程名称" align="center" prop="courseName" />
  210. <el-table-column label="小节名称" align="center" prop="videoName" />
  211. <el-table-column label="记录类型" align="center" prop="logType">
  212. <template slot-scope="scope">
  213. <dict-tag :options="logTypeOptions" :value="scope.row.logType"/>
  214. </template>
  215. </el-table-column>
  216. <el-table-column label="播放时长" align="center" prop="duration" />
  217. <el-table-column label="所属销售" align="center" prop="companyUserName" />
  218. <!-- <el-table-column label="所属公司" align="center" prop="companyName" />-->
  219. <el-table-column label="企微员工名称" align="center" prop="qwUserName" />
  220. <!-- <el-table-column label="所属发送方式" align="center" prop="sendType" />-->
  221. <el-table-column label="创建时间" align="center" prop="createTime" />
  222. <el-table-column label="更新时间" align="center" prop="updateTime" />
  223. <el-table-column label="完课时间" align="center" prop="finishTime" />
  224. <el-table-column label="营期时间" align="center" prop="campPeriodTime" />
  225. <el-table-column label="进线时间" align="center" prop="qecCreateTime" />
  226. <el-table-column
  227. fixed="right"
  228. label="操作"
  229. width="100">
  230. <template slot-scope="scope">
  231. <el-button @click="openAnswerLogFun(scope.row)" type="text" size="small">答题记录</el-button>
  232. <el-button @click="openRedLogFun(scope.row)" type="text" size="small">红包记录</el-button>
  233. </template>
  234. </el-table-column>
  235. </el-table>
  236. <pagination
  237. v-show="total>0"
  238. :total="total"
  239. :page.sync="queryParams.pageNum"
  240. :limit.sync="queryParams.pageSize"
  241. @pagination="getList"
  242. />
  243. <el-drawer title="答题记录" :visible.sync="openAnswerLog" size="70%" append-to-body>
  244. <el-table border v-loading="" :data="answerLogsList">
  245. <el-table-column label="会员用户" align="center" prop="userName">
  246. <template slot-scope="scope">
  247. <div style="display: flex;white-space: nowrap">
  248. <div style="margin: auto">
  249. {{ scope.row.userName }}
  250. </div>
  251. <el-popover
  252. placement="right"
  253. title=""
  254. trigger="hover">
  255. <img slot="reference" :src="scope.row.fsAvatar" style="width: 30px;height: 30px">
  256. <img :src="scope.row.fsAvatar" style="max-width: 200px;max-height: 200px">
  257. </el-popover>
  258. </div>
  259. </template>
  260. </el-table-column>
  261. <el-table-column label="课程名称" align="center" prop="courseName"/>
  262. <el-table-column label="小节名称" align="center" prop="videoName"/>
  263. <el-table-column label="是否全部正确" align="center" prop="isRight">
  264. <template slot-scope="scope">
  265. <dict-tag :options="sysCompanyOr" :value="scope.row.isRight"></dict-tag>
  266. </template>
  267. </el-table-column>
  268. <el-table-column label="销售名称" align="center" prop="companyUserName"/>
  269. <el-table-column label="企微员工名称" align="center" prop="qwUserName"/>
  270. <el-table-column label="公司名称" align="center" prop="companyName"/>
  271. <el-table-column label="创建时间" align="center" prop="createTime"/>
  272. </el-table>
  273. <pagination
  274. v-show="answerLogTotal>0"
  275. :total="answerLogTotal"
  276. :page.sync="answerLogQueryParams.pageNum"
  277. :limit.sync="answerLogQueryParams.pageSize"
  278. @pagination="answerLogList"
  279. />
  280. </el-drawer>
  281. <el-drawer title="红包记录" :visible.sync="openRedLog" size="70%" append-to-body>
  282. <el-table border v-loading="" :data="redLogsList">
  283. <el-table-column type="selection" width="55" align="center" />
  284. <el-table-column label="记录编号" align="center" prop="logId" />
  285. <el-table-column label="批次单号" align="center" prop="outBatchNo" />
  286. <el-table-column label="课程名称" align="center" prop="courseId" >
  287. <template slot-scope="scope">
  288. <span prop="status" v-for="(item, index) in courseLists" v-if="scope.row.courseId==item.dictValue">{{item.dictLabel}}</span>
  289. </template>
  290. </el-table-column>
  291. <el-table-column label="小节名称" align="center" prop="title" />
  292. <!-- <el-table-column label="会员id" align="center" prop="userId" />-->
  293. <el-table-column label="会员用户" align="center" prop="fsNickName">
  294. <template slot-scope="scope">
  295. <div style="display: flex;white-space: nowrap">
  296. <div style="margin: auto">
  297. {{scope.row.fsNickName}}
  298. </div>
  299. <el-popover
  300. placement="right"
  301. title=""
  302. trigger="hover">
  303. <img slot="reference" :src="scope.row.fsAvatar" style="width: 30px;height: 30px">
  304. <img :src="scope.row.fsAvatar" style="max-width: 200px;max-height: 200px">
  305. </el-popover>
  306. </div>
  307. </template>
  308. </el-table-column>
  309. <!-- <el-table-column label="会员电话" align="center" prop="phone" />-->
  310. <!-- <el-table-column label="所属销售" align="center" prop="companyUserName" />-->
  311. <!-- <el-table-column label="所属公司" align="center" prop="companyName" />-->
  312. <el-table-column label="转帐金额" align="center" prop="amount" />
  313. <el-table-column label="状态" align="center" prop="status" >
  314. <template slot-scope="scope">
  315. <el-tag>
  316. {{
  317. scope.row.status === 0 ? "发送中" :
  318. scope.row.status === 2 ? "待补发" :
  319. "已完成"
  320. }}
  321. </el-tag>
  322. </template>
  323. </el-table-column>
  324. <el-table-column label="所属企微" align="center" prop="qwUserName" />
  325. <el-table-column label="创建时间" align="center" prop="createTime" />
  326. </el-table>
  327. <pagination
  328. v-show="redLogTotal>0"
  329. :total="redLogTotal"
  330. :page.sync="redLogQueryParams.pageNum"
  331. :limit.sync="redLogQueryParams.pageSize"
  332. @pagination="redLogList"
  333. />
  334. </el-drawer>
  335. </div>
  336. </template>
  337. <script>
  338. import { deptListCourseWatchLog, getCourseWatchLog, delCourseWatchLog, addCourseWatchLog, updateCourseWatchLog, exportCourseWatchLog } from "@/api/course/courseWatchLog";
  339. import {courseList, myListCourseRedPacketLog, videoList} from '@/api/course/courseRedPacketLog'
  340. import {myListLogs} from "@/api/course/courseAnswerlogs";
  341. import { getCompanyUserListLikeName } from "@/api/company/companyUser";
  342. import {getTask} from "@/api/common";
  343. import Vue from 'vue'
  344. import Calendar from 'vue-mobile-calendar'
  345. Vue.use(Calendar)
  346. export default {
  347. name: "CourseWatchLog",
  348. data() {
  349. return {
  350. // 日历 key 控制刷新
  351. scheduleCalendarKey: 0,
  352. createCalendarKey: 0,
  353. updateCalendarKey: 0,
  354. qecCalendarKey: 0,
  355. createTimeText: '',
  356. scheduleTimeText: '', // 新增
  357. updateTimeText: '', // 新增
  358. qecCreateTimeText: '', // 新增
  359. scheduleTime: [], // 改为数组
  360. createTime: [], // 改为数组
  361. updateTime: [], // 改为数组
  362. qecCreateTime: [], // 改为数组
  363. // 控制日历显隐
  364. showScheduleCalendar: false,
  365. showCreateCalendar: false,
  366. showUpdateCalendar: false,
  367. showQecCalendar: false,
  368. activeName:"00",
  369. courseLists:[],
  370. videoList:[],
  371. logTypeOptions:[],
  372. // 遮罩层
  373. loading: true,
  374. // 导出遮罩层
  375. exportLoading: false,
  376. // 选中数组
  377. ids: [],
  378. // 非单个禁用
  379. single: true,
  380. // 非多个禁用
  381. multiple: true,
  382. // 显示搜索条件
  383. showSearch: true,
  384. // 总条数
  385. total: 0,
  386. // 短链课程看课记录表格数据
  387. courseWatchLogList: [],
  388. // 弹出层标题
  389. title: "",
  390. // 是否显示弹出层
  391. open: false,
  392. //答题记录
  393. openAnswerLog: false,
  394. loadingAnswerLog: true,
  395. answerLogsList: [],
  396. answerLogTotal: 0,
  397. answerLogQueryParams: {
  398. pageNum: 1,
  399. pageSize: 10,
  400. },
  401. //红包记录
  402. openRedLog: false,
  403. loadingRedLog: true,
  404. redLogsList: [],
  405. redLogTotal: 0,
  406. redLogQueryParams: {
  407. pageNum: 1,
  408. pageSize: 10,
  409. },
  410. pickerOptions: {
  411. disabledDate(time) {
  412. // 获取6天前的日期(加上今天就是7天)
  413. const sixDaysAgo = new Date();
  414. sixDaysAgo.setDate(sixDaysAgo.getDate() - 6);
  415. sixDaysAgo.setHours(0, 0, 0, 0);
  416. // 获取明天的日期(不包括今天)
  417. const tomorrow = new Date();
  418. tomorrow.setDate(tomorrow.getDate() + 1);
  419. tomorrow.setHours(0, 0, 0, 0);
  420. return time.getTime() < sixDaysAgo.getTime() || time.getTime() >= tomorrow.getTime();
  421. }
  422. },
  423. // 查询参数
  424. queryParams: {
  425. pageNum: 1,
  426. pageSize: 10,
  427. userId: null,
  428. nickName: null,
  429. videoId: null,
  430. logType: null,
  431. qwExternalContactId: null,
  432. externalUserName:null,
  433. duration: null,
  434. qwUserId: null,
  435. qwUserName: null, //企微名称
  436. qwUserUserId: null, //企微id
  437. deptName: null, //部门名称
  438. companyUserId: null,
  439. companyId: null,
  440. courseId: null,
  441. sTime:null,
  442. eTime:null,
  443. upSTime:null,
  444. upETime:null,
  445. qecSTime:null,
  446. qecETime:null,
  447. scheduleStartTime: null,
  448. scheduleEndTime: null,
  449. },
  450. // 表单参数
  451. form: {},
  452. // 表单校验
  453. rules: {
  454. },
  455. // 员工选项列表
  456. companyUserOptionsParams: {
  457. name: undefined,
  458. hasNextPage: false,
  459. pageNum: 1,
  460. pageSize: 10
  461. },
  462. companyUserOptionsLoading: false,
  463. companyUserOptions: [],
  464. };
  465. },
  466. created() {
  467. courseList().then(response => {
  468. this.courseLists = response.list;
  469. });
  470. this.getList();
  471. this.getDicts("sys_course_watch_log_type").then(response => {
  472. this.logTypeOptions = response.data;
  473. });
  474. },
  475. methods: {
  476. // 重置日历组件
  477. resetCalendars() {
  478. this.scheduleTime = [];
  479. this.createTime = [];
  480. this.updateTime = [];
  481. this.qecCreateTime = [];
  482. this.scheduleTimeText = '';
  483. this.createTimeText = '';
  484. this.updateTimeText = '';
  485. this.qecCreateTimeText = '';
  486. // 强制刷新日历组件
  487. this.scheduleCalendarKey++;
  488. this.createCalendarKey++;
  489. this.updateCalendarKey++;
  490. this.qecCalendarKey++;
  491. },
  492. formatDateRange(dates) {
  493. if (!dates || dates.length < 2) return '';
  494. return dates.map(date => date.format('YYYY-MM-DD')).join(' ~ ');
  495. },
  496. courseChange(row){
  497. this.queryParams.videoId=null;
  498. if(row === ''){
  499. this.videoList=[];
  500. return
  501. }
  502. videoList(row).then(response => {
  503. this.videoList=response.list
  504. });
  505. },
  506. handleClickX(tab,event){
  507. this.activeName=tab.name;
  508. if(tab.name=="00"){
  509. this.queryParams.logType=null;
  510. }else{
  511. this.queryParams.logType=tab.name;
  512. }
  513. this.getList()
  514. },
  515. /** 查询短链课程看课记录列表 */
  516. getList() {
  517. this.loading = true;
  518. if(this.queryParams.logType == "10"){
  519. this.queryParams.logType = null;
  520. }
  521. deptListCourseWatchLog(this.queryParams).then(response => {
  522. this.courseWatchLogList = response.rows;
  523. this.total = response.total;
  524. this.loading = false;
  525. });
  526. },
  527. // 取消按钮
  528. cancel() {
  529. this.open = false;
  530. this.reset();
  531. },
  532. // 表单重置
  533. reset() {
  534. this.form = {
  535. logId: null,
  536. userId: null,
  537. videoId: null,
  538. logType: null,
  539. createTime: null,
  540. updateTime: null,
  541. qwExternalContactId: null,
  542. externalUserName:null,
  543. duration: null,
  544. qwUserId: null,
  545. companyUserId: null,
  546. companyId: null,
  547. courseId: null,
  548. scheduleStartTime: null,
  549. scheduleEndTime: null,
  550. };
  551. this.scheduleTime=null;
  552. this.resetForm("form");
  553. },
  554. /** 搜索按钮操作 */
  555. handleQuery() {
  556. this.queryParams.pageNum = 1;
  557. this.getList();
  558. },
  559. /** 重置按钮操作 */
  560. resetQuery() {
  561. this.resetForm("queryForm");
  562. this.createTime = null;
  563. this.scheduleTime = null;
  564. this.qecCreateTime=null;
  565. this.queryParams.sTime = null;
  566. this.queryParams.eTime = null;
  567. this.queryParams.upSTime = null;
  568. this.queryParams.upETime = null;
  569. this.queryParams.qecSTime = null;
  570. this.queryParams.qecETime = null;
  571. this.queryParams.scheduleStartTime = null;
  572. this.queryParams.scheduleEndTime = null;
  573. this.scheduleTime=null;
  574. this.updateTime=null;
  575. this.handleQuery();
  576. },
  577. // 多选框选中数据
  578. handleSelectionChange(selection) {
  579. this.ids = selection.map(item => item.logId)
  580. this.single = selection.length!==1
  581. this.multiple = !selection.length
  582. },
  583. /** 新增按钮操作 */
  584. handleAdd() {
  585. this.reset();
  586. this.open = true;
  587. this.title = "添加短链课程看课记录";
  588. },
  589. /** 修改按钮操作 */
  590. handleUpdate(row) {
  591. this.reset();
  592. const logId = row.logId || this.ids
  593. getCourseWatchLog(logId).then(response => {
  594. this.form = response.data;
  595. this.open = true;
  596. this.title = "修改短链课程看课记录";
  597. });
  598. },
  599. /** 提交按钮 */
  600. submitForm() {
  601. this.$refs["form"].validate(valid => {
  602. if (valid) {
  603. if (this.form.logId != null) {
  604. updateCourseWatchLog(this.form).then(response => {
  605. this.msgSuccess("修改成功");
  606. this.open = false;
  607. this.getList();
  608. });
  609. } else {
  610. addCourseWatchLog(this.form).then(response => {
  611. this.msgSuccess("新增成功");
  612. this.open = false;
  613. this.getList();
  614. });
  615. }
  616. }
  617. });
  618. },
  619. /** 删除按钮操作 */
  620. handleDelete(row) {
  621. const logIds = row.logId || this.ids;
  622. this.$confirm('是否确认删除短链课程看课记录编号为"' + logIds + '"的数据项?', "警告", {
  623. confirmButtonText: "确定",
  624. cancelButtonText: "取消",
  625. type: "warning"
  626. }).then(function() {
  627. return delCourseWatchLog(logIds);
  628. }).then(() => {
  629. this.getList();
  630. this.msgSuccess("删除成功");
  631. }).catch(() => {});
  632. },
  633. /** 导出按钮操作 */
  634. handleExport() {
  635. const that = this
  636. const queryParams = this.queryParams;
  637. this.$confirm('是否确认导出所有短链课程看课记录数据项?', "警告", {
  638. confirmButtonText: "确定",
  639. cancelButtonText: "取消",
  640. type: "warning"
  641. }).then(() => {
  642. this.exportLoading = true;
  643. return exportCourseWatchLog(queryParams);
  644. }).then(response => {
  645. if (response.code === 200){
  646. that.msgSuccess(response.msg);
  647. that.taskId = response.data;
  648. that.time = setInterval(function(){
  649. //查订单
  650. getTask(that.taskId).then(res => {
  651. if(res.data.status === 1){
  652. that.exportLoading = false;
  653. clearTimeout(that.time)
  654. that.time = null;
  655. that.download(res.data.fileUrl);
  656. }
  657. });
  658. },10000);
  659. } else {
  660. that.msgError(response.msg)
  661. that.exportLoading = false
  662. }
  663. }).catch(() => {});
  664. },
  665. openAnswerLogFun(row) {
  666. this.openAnswerLog = true;
  667. this.answerLogQueryParams.watchLogId = row.logId;
  668. this.answerLogList();
  669. },
  670. answerLogList() {
  671. this.loadingAnswerLog = true;
  672. myListLogs(this.answerLogQueryParams).then(e => {
  673. this.answerLogsList = e.rows;
  674. this.answerLogTotal = e.total;
  675. this.loadingAnswerLog = false;
  676. })
  677. },
  678. openRedLogFun(row) {
  679. this.openRedLog = true;
  680. this.redLogQueryParams.watchLogId = row.logId;
  681. this.redLogList();
  682. },
  683. redLogList() {
  684. this.loadingRedLog = true;
  685. console.info(this.redLogQueryParams)
  686. myListCourseRedPacketLog(this.redLogQueryParams).then(e => {
  687. this.redLogsList = e.rows;
  688. this.redLogTotal = e.total;
  689. this.loadingRedLog = false;
  690. })
  691. },
  692. // 营期时间
  693. handleScheduleTimeChange(scheduleTime) {
  694. if (scheduleTime && scheduleTime.length >= 2) {
  695. this.scheduleTimeText = this.formatDateRange(scheduleTime);
  696. this.queryParams.scheduleStartTime = scheduleTime.map(date => date.format('YYYY-MM-DD'))[0] || null;
  697. this.queryParams.scheduleEndTime = scheduleTime.map(date => date.format('YYYY-MM-DD'))[1] || null;
  698. } else {
  699. this.scheduleTimeText = '';
  700. this.queryParams.scheduleStartTime = null;
  701. this.queryParams.scheduleEndTime = null;
  702. }
  703. },
  704. // 创建时间
  705. createChange(createTime) {
  706. if (createTime && createTime.length >= 2) {
  707. this.createTimeText = this.formatDateRange(createTime);
  708. this.queryParams.sTime = createTime.map(date => date.format('YYYY-MM-DD'))[0] || null;
  709. this.queryParams.eTime = createTime.map(date => date.format('YYYY-MM-DD'))[1] || null;
  710. } else {
  711. this.createTimeText = '';
  712. this.queryParams.sTime = null;
  713. this.queryParams.eTime = null;
  714. }
  715. },
  716. // 更新时间
  717. updateChange(updateTime) {
  718. if (updateTime && updateTime.length >= 2) {
  719. this.updateTimeText = this.formatDateRange(updateTime);
  720. this.queryParams.upSTime = updateTime.map(date => date.format('YYYY-MM-DD'))[0] || null;
  721. this.queryParams.upETime = updateTime.map(date => date.format('YYYY-MM-DD'))[1] || null;
  722. } else {
  723. this.updateTimeText = '';
  724. this.queryParams.upSTime = null;
  725. this.queryParams.upETime = null;
  726. }
  727. },
  728. // 进线时间
  729. qecCreateTimeChange(qecCreateTime) {
  730. if (qecCreateTime && qecCreateTime.length >= 2) {
  731. // 检查选择的日期范围是否超过7天(包括起始和结束日期)
  732. const startDate = new Date(qecCreateTime[0]);
  733. const endDate = new Date(qecCreateTime[1]);
  734. // 设置时间为当天开始,避免时间部分影响计算
  735. startDate.setHours(0, 0, 0, 0);
  736. endDate.setHours(0, 0, 0, 0);
  737. const timeDiff = Math.abs(endDate - startDate);
  738. const diffDays = Math.ceil(timeDiff / (1000 * 60 * 60 * 24));
  739. // 如果超过6天的范围(总共7天,包括起始日)
  740. if (diffDays > 6) {
  741. this.$message.error('进线时间选择范围不能超过7天');
  742. // 清空选择
  743. this.qecCreateTime = [];
  744. this.qecCreateTimeText = '';
  745. this.queryParams.qecSTime = null;
  746. this.queryParams.qecETime = null;
  747. this.qecCalendarKey++;
  748. return;
  749. }
  750. this.qecCreateTimeText = this.formatDateRange(qecCreateTime);
  751. this.queryParams.qecSTime = qecCreateTime.map(date => date.format('YYYY-MM-DD'))[0] || null;
  752. this.queryParams.qecETime = qecCreateTime.map(date => date.format('YYYY-MM-DD'))[1] || null;
  753. } else {
  754. this.qecCreateTimeText = '';
  755. this.queryParams.qecSTime = null;
  756. this.queryParams.qecETime = null;
  757. }
  758. },
  759. /**
  760. * 根据名称模糊查询用户列表
  761. * @param query 参数
  762. */
  763. loadCompanyUserOptions(query) {
  764. this.companyUserOptions = [];
  765. if (query === '') {
  766. return;
  767. }
  768. this.companyUserOptionsParams.pageNum = 1
  769. this.companyUserOptionsParams.name = query
  770. this.companyUserOptionsLoading = true;
  771. this.getCompanyUserListLikeName()
  772. },
  773. /**
  774. * 获取员工列表
  775. */
  776. getCompanyUserListLikeName() {
  777. getCompanyUserListLikeName(this.companyUserOptionsParams).then(response => {
  778. this.companyUserOptions = [...this.companyUserOptions, ...response.data.list]
  779. this.companyUserOptionsParams.hasNextPage = response.data.hasNextPage
  780. this.companyUserOptionsLoading = false;
  781. });
  782. },
  783. /**
  784. * 加载更多员工选项
  785. */
  786. loadMoreCompanyUserOptions() {
  787. if (!this.companyUserOptionsParams.hasNextPage) {
  788. return;
  789. }
  790. this.companyUserOptionsParams.pageNum += 1
  791. this.getCompanyUserListLikeName()
  792. },
  793. }
  794. };
  795. </script>