index.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803
  1. <template>
  2. <div class="app-container">
  3. <el-form
  4. :model="queryParams"
  5. ref="queryForm"
  6. :inline="true"
  7. v-show="showSearch"
  8. label-width="68px"
  9. >
  10. <el-form-item label="部门" prop="type">
  11. <treeselect
  12. style="width: 220px"
  13. :clearable="false"
  14. v-model="queryParams.deptIds"
  15. multiple
  16. :options="deptOptions"
  17. clearable
  18. :show-count="true"
  19. placeholder="请选择归属部门"
  20. />
  21. </el-form-item>
  22. <el-form-item label="所属客服" prop="companyUserId">
  23. <el-select
  24. v-model="queryParams.companyUserId"
  25. clearable
  26. filterable
  27. remote
  28. placeholder="请输入关键词"
  29. :remote-method="loadCompanyUserOptions"
  30. v-select-load-more="loadMoreCompanyUserOptions"
  31. :loading="companyUserOptionsLoading"
  32. >
  33. <el-option
  34. v-for="item in companyUserOptions"
  35. :key="item.dictValue"
  36. :label="item.dictLabel"
  37. :value="item.dictValue"
  38. >
  39. </el-option>
  40. </el-select>
  41. </el-form-item>
  42. <el-form-item label="企微昵称" prop="nickName">
  43. <el-input
  44. v-model="queryParams.nickName"
  45. placeholder="请输入企微昵称"
  46. clearable
  47. size="small"
  48. @keyup.enter.native="handleQuery"
  49. />
  50. </el-form-item>
  51. <!--企微主体选择框 -->
  52. <el-form-item label="企微主体" prop="corpId">
  53. <el-select v-model="queryParams.corpId" placeholder="企微主体" size="small" @change="updateCorpId()" clearable>
  54. <el-option
  55. v-for="dict in myQwCompanyList"
  56. :key="dict.dictValue"
  57. :label="dict.dictLabel"
  58. :value="dict.dictValue"
  59. />
  60. </el-select>
  61. </el-form-item>
  62. <el-form-item label="添加时间" prop="createTime">
  63. <el-date-picker
  64. v-model="createTime"
  65. size="small"
  66. style="width: 220px"
  67. value-format="yyyy-MM-dd"
  68. type="daterange"
  69. range-separator="-"
  70. start-placeholder="开始日期"
  71. end-placeholder="结束日期"
  72. @change="change"
  73. ></el-date-picker>
  74. </el-form-item>
  75. <el-form-item label="添加方式" prop="addWays" v-if="showCompanyField">
  76. <el-select v-model="addWays" placeholder="请选择添加方式" size="small" multiple
  77. collapse-tags
  78. style="width: 100%;" clearable>
  79. <el-option
  80. v-for="dict in myAddWayList"
  81. :key="dict.dictValue"
  82. :label="dict.dictLabel"
  83. :value="dict.dictValue"
  84. />
  85. </el-select>
  86. </el-form-item>
  87. <el-form-item>
  88. <el-button
  89. type="primary"
  90. icon="el-icon-search"
  91. size="mini"
  92. @click="handleQuery"
  93. >搜索</el-button
  94. >
  95. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
  96. >重置</el-button
  97. >
  98. </el-form-item>
  99. </el-form>
  100. <el-row :gutter="10" class="mb8">
  101. <el-col :span="1.5">
  102. <el-button
  103. type="warning"
  104. plain
  105. icon="el-icon-download"
  106. size="mini"
  107. :loading="exportLoading"
  108. @click="handleExport"
  109. v-hasPermi="['course:courseWatchLog:export']"
  110. >导出</el-button
  111. >
  112. </el-col>
  113. <right-toolbar
  114. :showSearch.sync="showSearch"
  115. @queryTable="getList"
  116. ></right-toolbar>
  117. </el-row>
  118. <el-table
  119. border
  120. v-loading="loading"
  121. :data="courseWatchLogList"
  122. @selection-change="handleSelectionChange"
  123. show-summary
  124. :summary-method="getSummaries"
  125. ref="table1"
  126. >
  127. <el-table-column type="selection" width="55" align="center" />
  128. <el-table-column label="企微员工名称" align="center" prop="qwUserName" />
  129. <!-- 发课时间 -->
  130. <el-table-column label="进线时间" align="center" prop="createTime" />
  131. <!-- 进线数 -->
  132. <el-table-column label="进线数" align="center" prop="line" />
  133. <!-- 先导课上线 -->
  134. <el-table-column label="先导课上线" align="center" prop="firstOnline">
  135. <template slot-scope="scope">
  136. <span>{{ scope.row.firstOnline }}</span>
  137. <span
  138. :style="{
  139. 'font-size': '12px',
  140. 'margin-left': '5px',
  141. color: getPercentageColor(
  142. (scope.row.firstOnline / scope.row.line) * 100
  143. ),
  144. }"
  145. >
  146. ({{ ((scope.row.firstOnline / scope.row.line) * 100).toFixed(2) }}%)
  147. </span>
  148. </template>
  149. </el-table-column>
  150. <!-- 先导课完课 -->
  151. <el-table-column label="先导课完课" align="center" prop="firstOver">
  152. <template slot-scope="scope">
  153. <span>{{ scope.row.firstOver }}</span>
  154. <span
  155. :style="{
  156. 'font-size': '12px',
  157. 'margin-left': '5px',
  158. color: getPercentageColor(
  159. (scope.row.firstOver / scope.row.line) * 100
  160. ),
  161. }"
  162. >
  163. ({{ ((scope.row.firstOver / scope.row.line) * 100).toFixed(2) }}%)
  164. </span>
  165. </template>
  166. </el-table-column>
  167. <!-- 首日上线 -->
  168. <el-table-column label="首日上线" align="center" prop="d1Online">
  169. <template slot-scope="scope">
  170. <span>{{ scope.row.d1Online }}</span>
  171. <span
  172. :style="{
  173. 'font-size': '12px',
  174. 'margin-left': '5px',
  175. color: getPercentageColor(
  176. (scope.row.d1Online / scope.row.line) * 100
  177. ),
  178. }"
  179. >
  180. ({{ ((scope.row.d1Online / scope.row.line) * 100).toFixed(2) }}%)
  181. </span>
  182. </template>
  183. </el-table-column>
  184. <!-- 首日完课 -->
  185. <el-table-column label="首日完课" align="center" prop="d1Over">
  186. <template slot-scope="scope">
  187. <span>{{ scope.row.d1Over }}</span>
  188. <span
  189. :style="{
  190. 'font-size': '12px',
  191. 'margin-left': '5px',
  192. color: getPercentageColor(
  193. (scope.row.d1Over / scope.row.line) * 100
  194. ),
  195. }"
  196. >
  197. ({{ ((scope.row.d1Over / scope.row.line) * 100).toFixed(2) }}%)
  198. </span>
  199. </template>
  200. </el-table-column>
  201. <!-- 综合报名数 -->
  202. <el-table-column label="综合报名数" align="center" prop="sign">
  203. <template slot-scope="scope">
  204. <span>{{ scope.row.sign }}</span>
  205. <span
  206. :style="{
  207. 'font-size': '12px',
  208. 'margin-left': '5px',
  209. color: getPercentageColor(
  210. (scope.row.sign / scope.row.line) * 100
  211. ),
  212. }"
  213. >
  214. ({{ ((scope.row.sign / scope.row.line) * 100).toFixed(2) }}%)
  215. </span>
  216. </template>
  217. </el-table-column>
  218. <!-- 互动数 -->
  219. <el-table-column label="互动数" align="center" prop="interact">
  220. <template slot-scope="scope">
  221. <span>{{ scope.row.interact }}</span>
  222. <span
  223. :style="{
  224. 'font-size': '12px',
  225. 'margin-left': '5px',
  226. color: getPercentageColor(
  227. (scope.row.interact / scope.row.line) * 100
  228. ),
  229. }"
  230. >
  231. ({{ ((scope.row.interact / scope.row.line) * 100).toFixed(2) }}%)
  232. </span>
  233. </template>
  234. </el-table-column>
  235. <!-- A级客户 -->
  236. <el-table-column label="A级客户" align="center" prop="a">
  237. <template slot-scope="scope">
  238. <span>{{ scope.row.a }}</span>
  239. <span
  240. :style="{
  241. 'font-size': '12px',
  242. 'margin-left': '5px',
  243. color: getPercentageColor((scope.row.a / scope.row.line) * 100),
  244. }"
  245. >
  246. ({{ ((scope.row.a / scope.row.line) * 100).toFixed(2) }}%)
  247. </span>
  248. </template>
  249. </el-table-column>
  250. <!-- B级客户 -->
  251. <el-table-column label="B级客户" align="center" prop="b">
  252. <template slot-scope="scope">
  253. <span>{{ scope.row.b }}</span>
  254. <span
  255. :style="{
  256. 'font-size': '12px',
  257. 'margin-left': '5px',
  258. color: getPercentageColor((scope.row.b / scope.row.line) * 100),
  259. }"
  260. >
  261. ({{ ((scope.row.b / scope.row.line) * 100).toFixed(2) }}%)
  262. </span>
  263. </template>
  264. </el-table-column>
  265. <!-- C级客户 -->
  266. <el-table-column label="C级客户" align="center" prop="c">
  267. <template slot-scope="scope">
  268. <span>{{ scope.row.c }}</span>
  269. <span
  270. :style="{
  271. 'font-size': '12px',
  272. 'margin-left': '5px',
  273. color: getPercentageColor((scope.row.c / scope.row.line) * 100),
  274. }"
  275. >
  276. ({{ ((scope.row.c / scope.row.line) * 100).toFixed(2) }}%)
  277. </span>
  278. </template>
  279. </el-table-column>
  280. <!-- D级客户 -->
  281. <el-table-column label="D级客户" align="center" prop="d">
  282. <template slot-scope="scope">
  283. <span>{{ scope.row.d }}</span>
  284. <span
  285. :style="{
  286. 'font-size': '12px',
  287. 'margin-left': '5px',
  288. color: getPercentageColor((scope.row.d / scope.row.line) * 100),
  289. }"
  290. >
  291. ({{ ((scope.row.d / scope.row.line) * 100).toFixed(2) }}%)
  292. </span>
  293. </template>
  294. </el-table-column>
  295. <!-- E级客户 -->
  296. <el-table-column label="E级客户" align="center" prop="e">
  297. <template slot-scope="scope">
  298. <span>{{ scope.row.e }}</span>
  299. <span
  300. :style="{
  301. 'font-size': '12px',
  302. 'margin-left': '5px',
  303. color: getPercentageColor((scope.row.e / scope.row.line) * 100),
  304. }"
  305. >
  306. ({{ ((scope.row.e / scope.row.line) * 100).toFixed(2) }}%)
  307. </span>
  308. </template>
  309. </el-table-column>
  310. <!-- 流失数 -->
  311. <el-table-column label="拉黑数" align="center" prop="black">
  312. <template slot-scope="scope">
  313. <span>{{ scope.row.black }}</span>
  314. <span
  315. :style="{
  316. 'font-size': '12px',
  317. 'margin-left': '5px',
  318. color: getPercentageColor((scope.row.black / scope.row.line) * 100),
  319. }"
  320. >
  321. ({{ ((scope.row.black / scope.row.line) * 100).toFixed(2) }}%)
  322. </span>
  323. </template>
  324. </el-table-column>
  325. <!-- 流失数 -->
  326. <!--<el-table-column label="流失数" align="center" prop="los">
  327. <template slot-scope="scope">
  328. <span>{{ scope.row.los }}</span>
  329. <span
  330. :style="{
  331. 'font-size': '12px',
  332. 'margin-left': '5px',
  333. color: getPercentageColor((scope.row.los / scope.row.line) * 100),
  334. }"
  335. >
  336. ({{ ((scope.row.los / scope.row.line) * 100).toFixed(2) }}%)
  337. </span>
  338. </template>
  339. </el-table-column>-->
  340. <!-- 删除数 -->
  341. <el-table-column label="删除数" align="center" prop="del">
  342. <template slot-scope="scope">
  343. <span>{{ scope.row.del }}</span>
  344. <span
  345. :style="{
  346. 'font-size': '12px',
  347. 'margin-left': '5px',
  348. color: getPercentageColor((scope.row.del / scope.row.line) * 100),
  349. }"
  350. >
  351. ({{ ((scope.row.del / scope.row.line) * 100).toFixed(2) }}%)
  352. </span>
  353. </template>
  354. </el-table-column>
  355. <!-- 重粉数 -->
  356. <el-table-column label="重粉数" align="center" prop="repeatCount">
  357. <template slot-scope="scope">
  358. <span>{{ scope.row.repeatCount }}</span>
  359. <span
  360. :style="{
  361. 'font-size': '12px',
  362. 'margin-left': '5px',
  363. color: getPercentageColor((scope.row.repeatCount / scope.row.line) * 100),
  364. }"
  365. >
  366. ({{ ((scope.row.repeatCount / scope.row.line) * 100).toFixed(2) }}%)
  367. </span>
  368. </template>
  369. </el-table-column>
  370. </el-table>
  371. <pagination-more
  372. v-show="total > 0"
  373. :total="total"
  374. :page.sync="queryParams.pageNum"
  375. :limit.sync="queryParams.pageSize"
  376. @pagination="getList"
  377. />
  378. </div>
  379. </template>
  380. <script>
  381. import {
  382. listCourseWatchLog,
  383. getCourseWatchLog,
  384. delCourseWatchLog,
  385. addCourseWatchLog,
  386. updateCourseWatchLog,
  387. exportCourseWatchLog,
  388. statisticsList,
  389. qwWatchLogStatisticsList,
  390. // exportWatchLogStatistics
  391. } from "@/api/course/qw/courseWatchLog";
  392. import { courseList, videoList } from "@/api/course/courseRedPacketLog";
  393. import { treeselect } from "@/api/company/companyDept";
  394. import Treeselect from "@riophae/vue-treeselect";
  395. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  396. import { getCompanyUserListLikeName } from "@/api/company/companyUser";
  397. import { getMyQwCompanyList } from '@/api/qw/user';
  398. import { getTask } from "@/api/common";
  399. import PaginationMore from "@/components/PaginationMore/index.vue";
  400. export default {
  401. name: "CourseWatchLog",
  402. components: {PaginationMore, Treeselect },
  403. data() {
  404. return {
  405. activeName: "00",
  406. createTime: null,
  407. courseLists: [],
  408. companyUserOptionsParams: {
  409. name: undefined,
  410. hasNextPage: false,
  411. pageNum: 1,
  412. pageSize: 10,
  413. },
  414. companyUserOptionsLoading: false,
  415. companyUserOptions: [],
  416. deptOptions: [],
  417. videoList: [],
  418. logTypeOptions: [],
  419. // 遮罩层
  420. loading: true,
  421. // 导出遮罩层
  422. exportLoading: false,
  423. // 选中数组
  424. ids: [],
  425. // 非单个禁用
  426. single: true,
  427. // 非多个禁用
  428. multiple: true,
  429. // 显示搜索条件
  430. showSearch: true,
  431. // 总条数
  432. total: 0,
  433. // 短链课程看课记录表格数据
  434. courseWatchLogList: [],
  435. // 弹出层标题
  436. title: "",
  437. // 是否显示弹出层
  438. open: false,
  439. // 查询参数
  440. queryParams: {
  441. pageNum: 1,
  442. pageSize: 10,
  443. userId: null,
  444. nickName: null,
  445. videoId: null,
  446. logType: null,
  447. qwExternalContactId: null,
  448. duration: null,
  449. qwUserId: null,
  450. companyUserId: null,
  451. companyId: null,
  452. courseId: null,
  453. sTime: null,
  454. eTime: null,
  455. scheduleStartTime: null,
  456. scheduleEndTime: null,
  457. corpId: null, // 企微主体ID
  458. addWays:[],
  459. },
  460. // 表单参数
  461. form: {},
  462. // 表单校验
  463. rules: {},
  464. scheduleTime: null,
  465. myQwCompanyList: [], // 存储企微主体选项列表
  466. myAddWayList:[],
  467. addWays:[],
  468. };
  469. },
  470. computed: {
  471. // 计算属性判断是否显示
  472. showCompanyField() {
  473. return process.env.VUE_APP_TITLE_INDEX === '恒春来';
  474. },
  475. },
  476. created() {
  477. courseList().then((response) => {
  478. this.courseLists = response.list;
  479. });
  480. this.getDicts("sys_course_watch_log_type").then((response) => {
  481. this.logTypeOptions = response.data;
  482. });
  483. this.getDicts("sys_qw_externalContact_addWay").then((response) => {
  484. this.myAddWayList = response.data;
  485. });
  486. this.getTreeselect();
  487. this.getList();
  488. // --- 获取企微主体列表 ---
  489. getMyQwCompanyList().then(response => {
  490. this.myQwCompanyList = response.data;
  491. });
  492. },
  493. methods: {
  494. updateCorpId() {
  495. this.queryParams.pageNum = 1;
  496. this.getList();
  497. },
  498. getSummaries(param) {
  499. let totalNum = 0;
  500. const { columns, data } = param;
  501. const sums = [];
  502. columns.forEach((column, index) => {
  503. if (index === 0) {
  504. sums[index] = "总计";
  505. return;
  506. }
  507. const values = data.map((item) => Number(item[column.property]));
  508. if (!values.every((value) => isNaN(value))) {
  509. sums[index] = values.reduce((prev, curr) => {
  510. const value = Number(curr);
  511. if (!isNaN(value)) {
  512. return prev + curr;
  513. } else {
  514. return prev;
  515. }
  516. }, 0);
  517. //第三列计数为进线数量和
  518. if(index === 3){
  519. totalNum = sums[index];
  520. }
  521. if(index > 3 && totalNum != 0){
  522. sums[index] = sums[index] + "("+ ((sums[index] / totalNum) * 100).toFixed(2) + "%)"
  523. }
  524. if (
  525. column.property === "firstOnline" ||
  526. column.property === "firstOver" ||
  527. column.property === "d1Online" ||
  528. column.property === "d1Over" ||
  529. column.property === "sign" ||
  530. column.property === "interact" ||
  531. column.property === "a" ||
  532. column.property === "b" ||
  533. column.property === "c" ||
  534. column.property === "d" ||
  535. column.property === "e" ||
  536. column.property === "black" ||
  537. column.property === "los" ||
  538. column.property === "del"
  539. ) {
  540. }
  541. } else {
  542. sums[index] = "";
  543. }
  544. });
  545. return sums;
  546. },
  547. getPercentageColor(percentage) {
  548. // HSL模式从黄色(60度)渐变到红色(0度)
  549. const percent = Math.min(100, Math.max(0, parseFloat(percentage)));
  550. // 调整色相范围:从深黄色(40°)渐变到红色(0°)
  551. const hue = 40 - 40 * (percent / 100); // 初始 hue=40(深黄),终点 hue=0(红)
  552. // 提高饱和度(100%),亮度保持 50%(鲜艳但不刺眼)
  553. return `hsl(${hue}, 100%, 50%)`;
  554. },
  555. courseChange(row) {
  556. this.queryParams.videoId = null;
  557. if (row === "") {
  558. this.videoList = [];
  559. return;
  560. }
  561. videoList(row).then((response) => {
  562. this.videoList = response.list;
  563. });
  564. },
  565. getTreeselect() {
  566. var that = this;
  567. var param = { companyId: this.companyId };
  568. treeselect(param).then((response) => {
  569. this.deptOptions = response.data;
  570. console.log(this.deptOptions);
  571. if (response.data != null && response.data.length > 0) {
  572. //this.queryParams.deptId=response.data[0].id;
  573. }
  574. });
  575. },
  576. loadCompanyUserOptions(query) {
  577. this.companyUserOptions = [];
  578. if (query === "") {
  579. return;
  580. }
  581. this.companyUserOptionsParams.pageNum = 1;
  582. this.companyUserOptionsParams.name = query;
  583. this.companyUserOptionsLoading = true;
  584. this.getCompanyUserListLikeName();
  585. },
  586. getCompanyUserListLikeName() {
  587. getCompanyUserListLikeName(this.companyUserOptionsParams).then(
  588. (response) => {
  589. this.companyUserOptions = [
  590. ...this.companyUserOptions,
  591. ...response.data.list,
  592. ];
  593. this.companyUserOptionsParams.hasNextPage = response.data.hasNextPage;
  594. this.companyUserOptionsLoading = false;
  595. }
  596. );
  597. },
  598. loadMoreCompanyUserOptions() {
  599. if (!this.companyUserOptionsParams.hasNextPage) {
  600. return;
  601. }
  602. this.companyUserOptionsParams.pageNum += 1;
  603. this.getCompanyUserListLikeName();
  604. },
  605. change() {
  606. if (this.createTime != null) {
  607. this.queryParams.sTime = this.createTime[0];
  608. this.queryParams.eTime = this.createTime[1];
  609. } else {
  610. this.queryParams.sTime = null;
  611. this.queryParams.eTime = null;
  612. }
  613. },
  614. handleClickX(tab, event) {
  615. this.activeName = tab.name;
  616. if (tab.name == "00") {
  617. this.queryParams.logType = null;
  618. } else {
  619. this.queryParams.logType = tab.name;
  620. }
  621. this.getList();
  622. },
  623. /** 查询短链课程看课记录列表 */
  624. getList() {
  625. this.loading = true;
  626. qwWatchLogStatisticsList(this.queryParams).then((response) => {
  627. this.courseWatchLogList = response.rows;
  628. this.total = response.total;
  629. this.loading = false;
  630. });
  631. this.$nextTick(() => {
  632. setTimeout(() => {
  633. this.$refs.table1?.doLayout();
  634. }, 2000);
  635. });
  636. },
  637. // 取消按钮
  638. cancel() {
  639. this.open = false;
  640. this.reset();
  641. },
  642. // 表单重置
  643. reset() {
  644. this.form = {
  645. logId: null,
  646. userId: null,
  647. videoId: null,
  648. logType: null,
  649. createTime: null,
  650. updateTime: null,
  651. qwExternalContactId: null,
  652. duration: null,
  653. qwUserId: null,
  654. companyUserId: null,
  655. companyId: null,
  656. courseId: null,
  657. };
  658. this.resetForm("form");
  659. },
  660. /** 搜索按钮操作 */
  661. handleQuery() {
  662. if (!this.queryParams.sTime || !this.queryParams.eTime) {
  663. this.$message.warning("请选择添加时间");
  664. return;
  665. }
  666. if( this.addWays.length>0){
  667. this.queryParams.addWays = this.addWays.join(',');
  668. }
  669. this.queryParams.pageNum = 1;
  670. this.getList();
  671. },
  672. /** 重置按钮操作 */
  673. resetQuery() {
  674. this.resetForm("queryForm");
  675. this.createTime = null;
  676. this.scheduleTime = null;
  677. this.queryParams.sTime = null;
  678. this.queryParams.eTime = null;
  679. this.queryParams.scheduleStartTime = null;
  680. this.queryParams.scheduleEndTime = null;
  681. this.queryParams.corpId = null; // 重置企微主体选择
  682. this.queryParams.addWays = [];
  683. this.addWays = [];
  684. this.handleQuery();
  685. },
  686. // 多选框选中数据
  687. handleSelectionChange(selection) {
  688. this.ids = selection.map((item) => item.logId);
  689. this.single = selection.length !== 1;
  690. this.multiple = !selection.length;
  691. },
  692. /** 新增按钮操作 */
  693. handleAdd() {
  694. this.reset();
  695. this.open = true;
  696. this.title = "添加短链课程看课记录";
  697. },
  698. /** 修改按钮操作 */
  699. handleUpdate(row) {
  700. this.reset();
  701. const logId = row.logId || this.ids;
  702. getCourseWatchLog(logId).then((response) => {
  703. this.form = response.data;
  704. this.open = true;
  705. this.title = "修改短链课程看课记录";
  706. });
  707. },
  708. /** 提交按钮 */
  709. submitForm() {
  710. this.$refs["form"].validate((valid) => {
  711. if (valid) {
  712. if (this.form.logId != null) {
  713. updateCourseWatchLog(this.form).then((response) => {
  714. this.msgSuccess("修改成功");
  715. this.open = false;
  716. this.getList();
  717. });
  718. } else {
  719. addCourseWatchLog(this.form).then((response) => {
  720. this.msgSuccess("新增成功");
  721. this.open = false;
  722. this.getList();
  723. });
  724. }
  725. }
  726. });
  727. },
  728. /** 删除按钮操作 */
  729. handleDelete(row) {
  730. const logIds = row.logId || this.ids;
  731. this.$confirm(
  732. '是否确认删除短链课程看课记录编号为"' + logIds + '"的数据项?',
  733. "警告",
  734. {
  735. confirmButtonText: "确定",
  736. cancelButtonText: "取消",
  737. type: "warning",
  738. }
  739. )
  740. .then(function () {
  741. return delCourseWatchLog(logIds);
  742. })
  743. .then(() => {
  744. this.getList();
  745. this.msgSuccess("删除成功");
  746. })
  747. .catch(() => {});
  748. },
  749. /** 导出按钮操作 */
  750. handleExport() {
  751. const queryParams = this.queryParams;
  752. this.$confirm('是否确认导出所有短链课程看课记录数据项?', "警告", {
  753. confirmButtonText: "确定",
  754. cancelButtonText: "取消",
  755. type: "warning"
  756. }).then(() => {
  757. this.exportLoading = true;
  758. return exportCourseWatchLog(queryParams);
  759. }).then(response => {
  760. this.download(response.msg);
  761. this.exportLoading = false;
  762. }).catch(() => {});
  763. },
  764. handleScheduleTimeChange(val) {
  765. if (val) {
  766. this.queryParams.scheduleStartTime = val[0];
  767. this.queryParams.scheduleEndTime = val[1];
  768. } else {
  769. this.queryParams.scheduleStartTime = null;
  770. this.queryParams.scheduleEndTime = null;
  771. }
  772. },
  773. },
  774. };
  775. </script>