watchLog.vue 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px">
  4. <el-form-item label="看课方式" prop="sendType">
  5. <el-select v-model="queryParams.sendType" placeholder="选择看课方式" clearable size="small" @change="handleSendTypeChange">
  6. <el-option
  7. v-for="dict in sendTypeOptions"
  8. :key="dict.dictValue"
  9. :label="dict.dictLabel"
  10. :value="dict.dictValue"
  11. />
  12. </el-select>
  13. </el-form-item>
  14. <el-form-item label="企微账号" prop="qwUserId">
  15. <el-select v-model="queryParams.qwUserId" placeholder="企微账号" clearable size="small"
  16. @change="updateQwuser()">
  17. <el-option
  18. v-for="dict in myQwUserList"
  19. :key="dict.dictValue"
  20. :label="dict.dictLabel + '('+dict.corpName+')'"
  21. :value="dict.dictValue"
  22. />
  23. </el-select>
  24. </el-form-item>
  25. <el-form-item label="客户ID" prop="qwExternalContactId">
  26. <el-input
  27. v-model="queryParams.qwExternalContactId"
  28. placeholder="请输入会员ID"
  29. clearable
  30. size="small"
  31. @keyup.enter.native="handleQuery"
  32. />
  33. </el-form-item>
  34. <!-- <el-form-item label="会员ID" prop="userId">-->
  35. <!-- <el-input-->
  36. <!-- v-model="queryParams.userId"-->
  37. <!-- placeholder="请输入会员ID"-->
  38. <!-- clearable-->
  39. <!-- size="small"-->
  40. <!-- @keyup.enter.native="handleQuery"-->
  41. <!-- />-->
  42. <!-- </el-form-item>-->
  43. <!-- <el-form-item label="会员昵称" prop="nickName">-->
  44. <!-- <el-input-->
  45. <!-- v-model="queryParams.nickName"-->
  46. <!-- placeholder="请输入会员昵称"-->
  47. <!-- clearable-->
  48. <!-- size="small"-->
  49. <!-- @keyup.enter.native="handleQuery"-->
  50. <!-- />-->
  51. <!-- </el-form-item>-->
  52. <el-form-item label="企微客户昵称" prop="nickName">
  53. <el-input
  54. v-model="queryParams.externalUserName"
  55. placeholder="请输入企微客户昵称"
  56. clearable
  57. size="small"
  58. @keyup.enter.native="handleQuery"
  59. />
  60. </el-form-item>
  61. <el-form-item label="课程" prop="courseId">
  62. <el-select filterable v-model="queryParams.courseId" placeholder="请选择课程" clearable size="small"
  63. @change="courseChange(queryParams.courseId)">
  64. <el-option
  65. v-for="dict in courseLists"
  66. :key="dict.dictValue"
  67. :label="dict.dictLabel"
  68. :value="dict.dictValue"
  69. />
  70. </el-select>
  71. </el-form-item>
  72. <el-form-item label="小节" prop="videoId">
  73. <el-select filterable v-model="queryParams.videoId" placeholder="请选择小节" clearable size="small">
  74. <el-option
  75. v-for="dict in videoList"
  76. :key="dict.dictValue"
  77. :label="dict.dictLabel"
  78. :value="dict.dictValue"
  79. />
  80. </el-select>
  81. </el-form-item>
  82. <el-form-item label="营期时间" prop="scheduleTime">
  83. <el-date-picker
  84. v-model="scheduleTime"
  85. type="daterange"
  86. size="small"
  87. style="width: 240px"
  88. value-format="yyyy-MM-dd"
  89. range-separator="-"
  90. start-placeholder="开始日期"
  91. end-placeholder="结束日期"
  92. @change="handleScheduleTimeChange">
  93. </el-date-picker>
  94. </el-form-item>
  95. <el-form-item label="创建时间" prop="createTime">
  96. <el-date-picker v-model="createTime" size="small" style="width: 220px" value-format="yyyy-MM-dd"
  97. type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"
  98. @change="createChange"></el-date-picker>
  99. </el-form-item>
  100. <el-form-item label="最新更新时间" prop="updateTime">
  101. <el-date-picker v-model="updateTime" size="small" style="width: 220px" value-format="yyyy-MM-dd" type="daterange"
  102. range-separator="-" start-placeholder="开始日期"
  103. end-placeholder="结束日期" @change="updateChange"></el-date-picker>
  104. </el-form-item>
  105. <el-form-item>
  106. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  107. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  108. </el-form-item>
  109. </el-form>
  110. <el-row :gutter="10" class="mb8">
  111. <el-col :span="1.5">
  112. <el-button
  113. type="warning"
  114. plain
  115. icon="el-icon-download"
  116. size="mini"
  117. :loading="exportLoading"
  118. @click="handleExport"
  119. v-hasPermi="['course:courseWatchLog:myExport']"
  120. >导出
  121. </el-button>
  122. <el-col :span="1.5">
  123. <el-button
  124. type="primary"
  125. plain
  126. size="mini"
  127. @click="addUserTag"
  128. v-hasPermi="['qw:externalContact:addTag']"
  129. >批量添加标签</el-button>
  130. </el-col>
  131. <el-col :span="1.5">
  132. <el-button
  133. type="primary"
  134. plain
  135. size="mini"
  136. @click="delUserTag"
  137. v-hasPermi="['qw:externalContact:delTag']"
  138. >批量移除标签</el-button>
  139. </el-col>
  140. </el-col>
  141. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  142. </el-row>
  143. <el-tabs type="card" v-model="activeName" @tab-click="handleClickX">
  144. <el-tab-pane label="全部" name="00"></el-tab-pane>
  145. <el-tab-pane v-for="(item,index) in logTypeOptions" :label="item.dictLabel" :name="item.dictValue"></el-tab-pane>
  146. </el-tabs>
  147. <el-table border v-loading="loading" :data="courseWatchLogList" @selection-change="handleSelectionChange">
  148. <el-table-column type="selection" width="55" align="center"/>
  149. <el-table-column label="记录编号" align="center" prop="logId"/>
  150. <!-- <el-table-column label="客户昵称" align="center" prop="externalUserName"/>-->
  151. <!--&lt;!&ndash; <el-table-column label="会员ID" align="center" prop="userId"/>&ndash;&gt;-->
  152. <!-- <el-table-column label="客户头像" align="center" prop="externalUserAvatar">-->
  153. <!-- <template slot-scope="scope">-->
  154. <!-- <el-popover-->
  155. <!-- placement="right"-->
  156. <!-- title=""-->
  157. <!-- trigger="hover">-->
  158. <!-- <img slot="reference" :src="scope.row.externalUserAvatar" style="width: 50px;height: 50px">-->
  159. <!-- <img :src="scope.row.externalUserAvatar" style="max-width: 200px;max-height: 200px">-->
  160. <!-- </el-popover>-->
  161. <!-- </template>-->
  162. <!-- </el-table-column>-->
  163. <el-table-column label="用户昵称" align="center">
  164. <template slot-scope="scope">
  165. {{ queryParams.sendType=='1' ? scope.row.fsNickName : scope.row.externalUserName }}
  166. </template>
  167. </el-table-column>
  168. <el-table-column label="头像" align="center">
  169. <template slot-scope="scope">
  170. <img v-if="queryParams.sendType=='1'" :src="scope.row.fsAvatar" style="width:50px;height:50px" />
  171. <img v-else :src="scope.row.externalUserAvatar" style="width:50px;height:50px" />
  172. </template>
  173. </el-table-column>
  174. <el-table-column label="课程名称" align="center" prop="courseName"/>
  175. <el-table-column label="小节名称" align="center" prop="videoName"/>
  176. <el-table-column label="记录类型" align="center" prop="logType">
  177. <template slot-scope="scope">
  178. <dict-tag :options="logTypeOptions" :value="scope.row.logType"/>
  179. </template>
  180. </el-table-column>
  181. <el-table-column label="播放时长" align="center" prop="duration"/>
  182. <!-- <el-table-column label="所属销售" align="center" prop="companyUserName"/>-->
  183. <!-- <el-table-column label="所属公司" align="center" prop="companyName"/>-->
  184. <!-- <el-table-column label="企微员工名称" align="center" prop="qwUserName"/>-->
  185. <el-table-column label="所属企微" align="center" prop="qwUserName" v-if="queryParams.sendType==2" />
  186. <!-- <el-table-column label="所属发送方式" align="center" prop="sendType"/>-->
  187. <el-table-column label="创建时间" align="center" prop="createTime" width="100px"/>
  188. <el-table-column label="更新时间" align="center" prop="updateTime" width="100px" />
  189. <el-table-column label="完课时间" align="center" prop="finishTime" width="100px" />
  190. <el-table-column label="营期时间" align="center" prop="campPeriodTime" />
  191. <el-table-column
  192. fixed="right"
  193. label="操作"
  194. width="100">
  195. <template slot-scope="scope">
  196. <el-button @click="openAnswerLogFun(scope.row)" type="text" size="small">答题记录</el-button>
  197. <el-button @click="openRedLogFun(scope.row)" type="text" size="small">红包记录</el-button>
  198. </template>
  199. </el-table-column>
  200. </el-table>
  201. <pagination
  202. v-show="total>0"
  203. :total="total"
  204. :page.sync="queryParams.pageNum"
  205. :limit.sync="queryParams.pageSize"
  206. @pagination="getList"
  207. />
  208. <el-drawer title="答题记录" :visible.sync="openAnswerLog" size="70%" append-to-body>
  209. <el-table border v-loading="" :data="answerLogsList">
  210. <el-table-column label="会员用户" align="center" prop="userName">
  211. <template slot-scope="scope">
  212. <div style="display: flex;white-space: nowrap">
  213. <div style="margin: auto">
  214. {{ scope.row.userName }}
  215. </div>
  216. <el-popover
  217. placement="right"
  218. title=""
  219. trigger="hover">
  220. <img slot="reference" :src="scope.row.fsAvatar" style="width: 30px;height: 30px">
  221. <img :src="scope.row.fsAvatar" style="max-width: 200px;max-height: 200px">
  222. </el-popover>
  223. </div>
  224. </template>
  225. </el-table-column>
  226. <el-table-column label="课程名称" align="center" prop="courseName"/>
  227. <el-table-column label="小节名称" align="center" prop="videoName"/>
  228. <el-table-column label="是否全部正确" align="center" prop="isRight">
  229. <template slot-scope="scope">
  230. <dict-tag :options="sysCompanyOr" :value="scope.row.isRight"></dict-tag>
  231. </template>
  232. </el-table-column>
  233. <el-table-column label="销售名称" align="center" prop="companyUserName"/>
  234. <el-table-column label="企微员工名称" align="center" prop="qwUserName"/>
  235. <el-table-column label="公司名称" align="center" prop="companyName"/>
  236. <el-table-column label="创建时间" align="center" prop="createTime"/>
  237. </el-table>
  238. <pagination
  239. v-show="answerLogTotal>0"
  240. :total="answerLogTotal"
  241. :page.sync="answerLogQueryParams.pageNum"
  242. :limit.sync="answerLogQueryParams.pageSize"
  243. @pagination="answerLogList"
  244. />
  245. </el-drawer>
  246. <el-drawer title="红包记录" :visible.sync="openRedLog" size="70%" append-to-body>
  247. <el-table border v-loading="" :data="redLogsList">
  248. <el-table-column type="selection" width="55" align="center" />
  249. <el-table-column label="记录编号" align="center" prop="logId" />
  250. <el-table-column label="批次单号" align="center" prop="outBatchNo" />
  251. <el-table-column label="课程名称" align="center" prop="courseId" >
  252. <template slot-scope="scope">
  253. <span prop="status" v-for="(item, index) in courseLists" v-if="scope.row.courseId==item.dictValue">{{item.dictLabel}}</span>
  254. </template>
  255. </el-table-column>
  256. <el-table-column label="小节名称" align="center" prop="title" />
  257. <!-- <el-table-column label="会员id" align="center" prop="userId" />-->
  258. <el-table-column label="会员用户" align="center" prop="fsNickName">
  259. <template slot-scope="scope">
  260. <div style="display: flex;white-space: nowrap">
  261. <div style="margin: auto">
  262. {{scope.row.fsNickName}}
  263. </div>
  264. <el-popover
  265. placement="right"
  266. title=""
  267. trigger="hover">
  268. <img slot="reference" :src="scope.row.fsAvatar" style="width: 30px;height: 30px">
  269. <img :src="scope.row.fsAvatar" style="max-width: 200px;max-height: 200px">
  270. </el-popover>
  271. </div>
  272. </template>
  273. </el-table-column>
  274. <!-- <el-table-column label="会员电话" align="center" prop="phone" />-->
  275. <!-- <el-table-column label="所属销售" align="center" prop="companyUserName" />-->
  276. <!-- <el-table-column label="所属公司" align="center" prop="companyName" />-->
  277. <el-table-column label="转帐金额" align="center" prop="amount" />
  278. <el-table-column label="状态" align="center" prop="status" >
  279. <template slot-scope="scope">
  280. <el-tag>
  281. {{
  282. scope.row.status === 0 ? "发送中" :
  283. scope.row.status === 2 ? "待补发" :
  284. "已完成"
  285. }}
  286. </el-tag>
  287. </template>
  288. </el-table-column>
  289. <el-table-column label="所属企微" align="center" prop="qwUserName" />
  290. <el-table-column label="创建时间" align="center" prop="createTime" />
  291. </el-table>
  292. <pagination
  293. v-show="redLogTotal>0"
  294. :total="redLogTotal"
  295. :page.sync="redLogQueryParams.pageNum"
  296. :limit.sync="redLogQueryParams.pageSize"
  297. @pagination="redLogList"
  298. />
  299. </el-drawer>
  300. <el-dialog title="批量添加标签" :visible.sync="tagOpen" width="800px" append-to-body>
  301. <div>搜索标签:
  302. <el-input v-model="tagChange.tagName" placeholder="请输入标签名称" clearable size="small" style="width: 200px;margin-right: 10px" />
  303. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleSearchTags(tagChange.tagName)">搜索</el-button>
  304. <el-button type="primary" icon="el-icon-plus" size="mini" @click="cancelSearchTags">重置</el-button>
  305. </div>
  306. <el-form ref="form" :model="addTagFormByWatch" label-width="80px">
  307. <div v-for="item in tagGroupList" :key="item.id" >
  308. <div style="font-size: 20px;margin-top: 20px;margin-bottom: 20px;">
  309. <span class="name-background">{{ item.name }}</span>
  310. </div>
  311. <div class="tag-container">
  312. <a
  313. v-for="tagItem in item.tag"
  314. class="tag-box"
  315. @click="tagSelection(tagItem)"
  316. :class="{ 'tag-selected': tagItem.isSelected }"
  317. >
  318. {{ tagItem.name }}
  319. </a>
  320. </div>
  321. </div>
  322. </el-form>
  323. <pagination
  324. v-show="tagTotal>0"
  325. :total="tagTotal"
  326. :page.sync="queryTagParams.pageNum"
  327. :limit.sync="queryTagParams.pageSize"
  328. @pagination="getPageListTagGroup"
  329. />
  330. <div slot="footer" class="dialog-footer">
  331. <el-button type="primary" @click="addTagSubmitForm()">确 定</el-button>
  332. <el-button @click="addTagCancel">取 消</el-button>
  333. </div>
  334. </el-dialog>
  335. <el-dialog title="批量移除标签" :visible.sync="tagDelOpen" width="800px" append-to-body>
  336. <div>搜索标签:
  337. <el-input v-model="tagChange.tagName" placeholder="请输入标签名称" clearable size="small" style="width: 200px;margin-right: 10px" />
  338. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleSearchTags(tagChange.tagName)">搜索</el-button>
  339. <el-button type="primary" icon="el-icon-plus" size="mini" @click="cancelSearchTags">重置</el-button>
  340. </div>
  341. <el-form ref="form" :model="addTagFormByWatch" label-width="80px">
  342. <div v-for="item in tagGroupList" :key="item.id" >
  343. <div style="font-size: 20px;margin-top: 20px;margin-bottom: 20px;">
  344. <span class="name-background">{{ item.name }}</span>
  345. </div>
  346. <div class="tag-container">
  347. <a
  348. v-for="tagItem in item.tag"
  349. class="tag-box"
  350. @click="tagSelection(tagItem)"
  351. :class="{ 'tag-selected': tagItem.isSelected }"
  352. >
  353. {{ tagItem.name }}
  354. </a>
  355. </div>
  356. </div>
  357. </el-form>
  358. <pagination
  359. v-show="tagTotal>0"
  360. :total="tagTotal"
  361. :page.sync="queryTagParams.pageNum"
  362. :limit.sync="queryTagParams.pageSize"
  363. @pagination="getPageListTagGroup"
  364. />
  365. <div slot="footer" class="dialog-footer">
  366. <el-button type="primary" @click="tagDelSubmitForm()">确 定</el-button>
  367. <el-button @click="DelTagCancel">取 消</el-button>
  368. </div>
  369. </el-dialog>
  370. <el-dialog
  371. :title="resultTitle"
  372. :visible.sync="resultDialogVisible"
  373. width="50%"
  374. custom-class="feedback-dialog"
  375. >
  376. <pre style="white-space: pre-wrap; font-family: inherit;">{{ resultMessage }}</pre>
  377. <span slot="footer" class="dialog-footer">
  378. <el-button @click="resultDialogVisible = false">关闭</el-button>
  379. </span>
  380. </el-dialog>
  381. </div>
  382. </template>
  383. <script>
  384. import {
  385. addCourseWatchLog,
  386. delCourseWatchLog,
  387. exportCourseWatchLog,
  388. getCourseWatchLog,
  389. myListCourseWatchLog,
  390. updateCourseWatchLog
  391. } from "@/api/course/courseWatchLog";
  392. import {courseList, myListCourseRedPacketLog, videoList} from '@/api/course/courseRedPacketLog'
  393. import {myListLogs} from "@/api/course/courseAnswerlogs";
  394. import {getMyQwUserList} from "@/api/qw/user";
  395. import {searchTags} from "../../../api/qw/tag";
  396. import {addTagByWatch, delTagByWatch} from "../../../api/qw/externalContact";
  397. import {allListTagGroup} from "../../../api/qw/tagGroup";
  398. export default {
  399. name: "CourseWatchLog",
  400. data() {
  401. return {
  402. resultDialogVisible: false,
  403. resultMessage: '',
  404. resultTitle:'',
  405. activeName:"2",
  406. createTime: null,
  407. updateTime:null,
  408. courseLists: [],
  409. videoList: [],
  410. myQwUserList: [],
  411. logTypeOptions: [],
  412. // 遮罩层
  413. loading: true,
  414. // 导出遮罩层
  415. exportLoading: false,
  416. // 选中数组
  417. ids: [],
  418. // 非单个禁用
  419. single: true,
  420. scheduleTime: null,
  421. // 非多个禁用
  422. multiple: true,
  423. // 显示搜索条件
  424. showSearch: true,
  425. sysCompanyOr: [],
  426. // 总条数
  427. total: 0,
  428. // 短链课程看课记录表格数据
  429. courseWatchLogList: [],
  430. openAnswerLog: false,
  431. loadingAnswerLog: true,
  432. answerLogsList: [],
  433. answerLogTotal: 0,
  434. answerLogQueryParams: {
  435. pageNum: 1,
  436. pageSize: 10,
  437. },
  438. sendTypeOptions:[{
  439. dictLabel:"会员",dictValue:'1'
  440. },
  441. {
  442. dictLabel:"企微",dictValue:'2'
  443. }
  444. ],
  445. openRedLog: false,
  446. loadingRedLog: true,
  447. redLogsList: [],
  448. redLogTotal: 0,
  449. redLogQueryParams: {
  450. pageNum: 1,
  451. pageSize: 10,
  452. },
  453. // 弹出层标题
  454. title: "",
  455. // 是否显示弹出层
  456. open: false,
  457. tagOpen:false,
  458. //标签弹窗选择
  459. tagChange:{
  460. open:false,
  461. index:null,
  462. },
  463. addTagFormByWatch:{
  464. logId:[],
  465. tagIds:[]
  466. },
  467. tagGroupList: [],
  468. tagTotal:0,
  469. tagDelOpen:false,
  470. queryTagParams:{
  471. pageNum: 1,
  472. pageSize: 10,
  473. total:0,
  474. name:null,
  475. corpId:null,
  476. },
  477. // 查询参数
  478. queryParams: {
  479. pageNum: 1,
  480. pageSize: 10,
  481. userId: null,
  482. videoId: null,
  483. nickName: null,
  484. logType: 2,
  485. qwExternalContactId: null,
  486. externalUserName:null,
  487. duration: null,
  488. qwUserId: null,
  489. companyUserId: null,
  490. companyId: null,
  491. courseId: null,
  492. sTime: null,
  493. eTime: null,
  494. upSTime:null,
  495. upETime:null,
  496. scheduleStartTime: null,
  497. scheduleEndTime: null,
  498. sendType:process.env.VUE_APP_COURSE_DEFAULT,
  499. },
  500. // 表单参数
  501. form: {},
  502. // 表单校验
  503. rules: {}
  504. };
  505. },
  506. created() {
  507. courseList().then(response => {
  508. this.courseLists = response.list;
  509. });
  510. this.getList();
  511. this.getDicts("sys_course_watch_log_type").then(response => {
  512. this.logTypeOptions = response.data;
  513. });
  514. this.getDicts("sys_company_or").then(response => {
  515. this.sysCompanyOr = response.data;
  516. });
  517. getMyQwUserList().then(response => {
  518. this.myQwUserList = response.data;
  519. });
  520. },
  521. methods: {
  522. courseChange(row) {
  523. this.queryParams.videoId = null;
  524. if (row === '') {
  525. this.videoList = [];
  526. return
  527. }
  528. videoList(row).then(response => {
  529. this.videoList = response.list
  530. });
  531. },
  532. updateQwuser() {
  533. for (const user of this.myQwUserList) {
  534. if (user.dictValue == this.queryParams.qwUserId) {
  535. this.queryParams.corpId = user.corpId;
  536. break;
  537. }
  538. }
  539. this.getList();
  540. },
  541. createChange() {
  542. if (this.createTime != null) {
  543. this.queryParams.sTime = this.createTime[0];
  544. this.queryParams.eTime = this.createTime[1];
  545. } else {
  546. this.queryParams.sTime = null;
  547. this.queryParams.eTime = null;
  548. }
  549. },
  550. updateChange(){
  551. if (this.updateTime != null) {
  552. this.queryParams.upSTime = this.updateTime[0];
  553. this.queryParams.upETime = this.updateTime[1];
  554. } else {
  555. this.queryParams.upSTime = null;
  556. this.queryParams.upETime = null;
  557. }
  558. },
  559. handleClickX(tab) {
  560. this.activeName=tab.name;
  561. if(tab.name=="00"){
  562. this.queryParams.logType=null;
  563. }else{
  564. this.queryParams.logType=tab.name;
  565. }
  566. this.getList()
  567. },
  568. handleScheduleTimeChange(val) {
  569. if (val) {
  570. this.queryParams.scheduleStartTime = val[0];
  571. this.queryParams.scheduleEndTime = val[1];
  572. } else {
  573. this.queryParams.scheduleStartTime = null;
  574. this.queryParams.scheduleEndTime = null;
  575. }
  576. },
  577. /** 查询短链课程看课记录列表 */
  578. getList() {
  579. this.loading = true;
  580. let param = JSON.parse(JSON.stringify(this.queryParams));
  581. if (param.logType == "10") {
  582. param.logType = null;
  583. }
  584. myListCourseWatchLog(param).then(response => {
  585. this.courseWatchLogList = response.rows;
  586. this.total = response.total;
  587. this.loading = false;
  588. });
  589. },
  590. // 取消按钮
  591. cancel() {
  592. this.open = false;
  593. this.reset();
  594. },
  595. // 表单重置
  596. reset() {
  597. this.form = {
  598. logId: null,
  599. userId: null,
  600. videoId: null,
  601. logType: null,
  602. createTime: null,
  603. updateTime: null,
  604. qwExternalContactId: null,
  605. externalUserName:null,
  606. duration: null,
  607. qwUserId: null,
  608. companyUserId: null,
  609. companyId: null,
  610. courseId: null,
  611. scheduleStartTime: null,
  612. scheduleEndTime: null,
  613. };
  614. this.scheduleTime=null;
  615. this.resetForm("form");
  616. },
  617. /** 搜索按钮操作 */
  618. handleQuery() {
  619. this.queryParams.pageNum = 1;
  620. this.getList();
  621. },
  622. /** 重置按钮操作 */
  623. resetQuery() {
  624. this.resetForm("queryForm");
  625. this.createTime = null;
  626. this.queryParams.sTime = null;
  627. this.queryParams.eTime = null;
  628. this.queryParams.upSTime = null;
  629. this.queryParams.upETime = null;
  630. this.queryParams.scheduleStartTime = null;
  631. this.queryParams.scheduleEndTime = null;
  632. this.scheduleTime=null;
  633. this.updateTime=null;
  634. this.handleQuery();
  635. },
  636. // 多选框选中数据
  637. handleSelectionChange(selection) {
  638. this.ids = selection.map(item => item.logId)
  639. this.single = selection.length !== 1
  640. this.multiple = !selection.length
  641. },
  642. /** 新增按钮操作 */
  643. handleAdd() {
  644. this.reset();
  645. this.open = true;
  646. this.title = "添加短链课程看课记录";
  647. },
  648. /** 修改按钮操作 */
  649. handleUpdate(row) {
  650. this.reset();
  651. const logId = row.logId || this.ids
  652. getCourseWatchLog(logId).then(response => {
  653. this.form = response.data;
  654. this.open = true;
  655. this.title = "修改短链课程看课记录";
  656. });
  657. },
  658. /** 提交按钮 */
  659. submitForm() {
  660. this.$refs["form"].validate(valid => {
  661. if (valid) {
  662. if (this.form.logId != null) {
  663. updateCourseWatchLog(this.form).then(response => {
  664. this.msgSuccess("修改成功");
  665. this.open = false;
  666. this.getList();
  667. });
  668. } else {
  669. addCourseWatchLog(this.form).then(response => {
  670. this.msgSuccess("新增成功");
  671. this.open = false;
  672. this.getList();
  673. });
  674. }
  675. }
  676. });
  677. },
  678. /** 删除按钮操作 */
  679. handleDelete(row) {
  680. const logIds = row.logId || this.ids;
  681. this.$confirm('是否确认删除短链课程看课记录编号为"' + logIds + '"的数据项?', "警告", {
  682. confirmButtonText: "确定",
  683. cancelButtonText: "取消",
  684. type: "warning"
  685. }).then(function () {
  686. return delCourseWatchLog(logIds);
  687. }).then(() => {
  688. this.getList();
  689. this.msgSuccess("删除成功");
  690. }).catch(() => {
  691. });
  692. },
  693. /** 导出按钮操作 */
  694. handleExport() {
  695. const queryParams = this.queryParams;
  696. this.$confirm('是否确认导出所有短链课程看课记录数据项?', "警告", {
  697. confirmButtonText: "确定",
  698. cancelButtonText: "取消",
  699. type: "warning"
  700. }).then(() => {
  701. this.exportLoading = true;
  702. return exportCourseWatchLog(queryParams);
  703. }).then(response => {
  704. this.download(response.msg);
  705. this.exportLoading = false;
  706. }).catch(() => {
  707. });
  708. },
  709. openAnswerLogFun(row) {
  710. this.openAnswerLog = true;
  711. this.answerLogQueryParams.watchLogId = row.logId;
  712. this.answerLogList();
  713. },
  714. answerLogList() {
  715. this.loadingAnswerLog = true;
  716. myListLogs(this.answerLogQueryParams).then(e => {
  717. this.answerLogsList = e.rows;
  718. this.answerLogTotal = e.total;
  719. this.loadingAnswerLog = false;
  720. })
  721. },
  722. openRedLogFun(row) {
  723. this.openRedLog = true;
  724. this.redLogQueryParams.watchLogId = row.logId;
  725. this.redLogList();
  726. },
  727. redLogList() {
  728. this.loadingRedLog = true;
  729. console.info(this.redLogQueryParams)
  730. myListCourseRedPacketLog(this.redLogQueryParams).then(e => {
  731. this.redLogsList = e.rows;
  732. this.redLogTotal = e.total;
  733. this.loadingRedLog = false;
  734. })
  735. },
  736. addUserTag(){
  737. if(this.ids==null||this.ids==""){
  738. return this.$message('请选择需要添加标签的客户');
  739. }
  740. this.getPageListTagGroup();
  741. setTimeout(() => {
  742. for (let i = 0; i < this.tagGroupList.length; i++) {
  743. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  744. this.tagGroupList[i].tag[x].isSelected=false;
  745. }
  746. }
  747. }, 200);
  748. this.tagOpen = true;
  749. },
  750. delUserTag(){
  751. if(this.ids==null||this.ids==""){
  752. return this.$message('请选择需要移除标签的客户');
  753. }
  754. this.getPageListTagGroup();
  755. setTimeout(() => {
  756. for (let i = 0; i < this.tagGroupList.length; i++) {
  757. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  758. this.tagGroupList[i].tag[x].isSelected=false;
  759. }
  760. }
  761. }, 200);
  762. this.tagDelOpen = true;
  763. },
  764. getPageListTagGroup(){
  765. this.queryTagParams.corpId=this.queryParams.corpId
  766. allListTagGroup(this.queryTagParams).then(response => {
  767. this.tagGroupList = response.rows;
  768. this.tagTotal = response.total;
  769. });
  770. },
  771. tagSelection(row){
  772. row.isSelected= !row.isSelected;
  773. this.$forceUpdate();
  774. },
  775. handleSearchTags(name){
  776. searchTags({name:name,corpId:this.queryParams.corpId}).then(response => {
  777. this.tagGroupList = response.rows;
  778. });
  779. },
  780. cancelSearchTags(){
  781. this.resetSearchQueryTag()
  782. this.getPageListTagGroup();
  783. },
  784. resetSearchQueryTag(){
  785. this.queryTagParams= {
  786. pageNum: 1,
  787. pageSize: 10,
  788. total:0,
  789. name:null,
  790. };
  791. },
  792. addTagSubmitForm(){
  793. for (let i = 0; i < this.tagGroupList.length; i++) {
  794. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  795. if(this.tagGroupList[i].tag[x].isSelected==true){
  796. this.addTagFormByWatch.tagIds.push(this.tagGroupList[i].tag[x].tagId)
  797. }
  798. }
  799. }
  800. if(this.addTagFormByWatch.tagIds==[]||this.addTagFormByWatch.tagIds==null||this.addTagFormByWatch.tagIds==""){
  801. return this.$message('请选择标签');
  802. }
  803. this.addTagFormByWatch.logIds=this.ids;
  804. let loadingRock = this.$loading({
  805. lock: true,
  806. text: '正在执行中请稍后~~请不要刷新页面!!',
  807. spinner: 'el-icon-loading',
  808. background: 'rgba(0, 0, 0, 0.7)'
  809. });
  810. addTagByWatch(this.addTagFormByWatch).then(response => {
  811. // this.msgSuccess(response.msg);
  812. this.resultMessage = response.msg;
  813. this.resultDialogVisible = true; // 显示弹窗
  814. this.resultTitle = '批量添加标签结果';
  815. this.tagOpen = false;
  816. loadingRock.close();
  817. this.addTagFormByWatch={
  818. logIds:[],
  819. tagIds:[]
  820. };
  821. this.getList()
  822. }).finally(res=>{
  823. loadingRock.close();
  824. });
  825. },
  826. tagDelSubmitForm(){
  827. for (let i = 0; i < this.tagGroupList.length; i++) {
  828. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  829. if(this.tagGroupList[i].tag[x].isSelected==true){
  830. this.addTagFormByWatch.tagIds.push(this.tagGroupList[i].tag[x].tagId)
  831. }
  832. }
  833. }
  834. if(this.addTagFormByWatch.tagIds==[]||this.addTagFormByWatch.tagIds==null||this.addTagFormByWatch.tagIds==""){
  835. return this.$message('请选择标签');
  836. }
  837. this.addTagFormByWatch.corpId=this.queryParams.corpId
  838. this.addTagFormByWatch.logIds=this.ids;
  839. let loadingRock = this.$loading({
  840. lock: true,
  841. text: '正在执行中请稍后~~请不要刷新页面!!',
  842. spinner: 'el-icon-loading',
  843. background: 'rgba(0, 0, 0, 0.7)'
  844. });
  845. delTagByWatch(this.addTagFormByWatch).then(response => {
  846. // this.msgSuccess(response.msg);
  847. this.resultMessage = response.msg;
  848. this.resultDialogVisible = true; // 显示弹窗
  849. this.resultTitle = '批量移除标签结果';
  850. this.tagDelOpen = false;
  851. loadingRock.close();
  852. this.addTagFormByWatch={
  853. userIds:[],
  854. tagIds:[]
  855. };
  856. this.getList()
  857. }).finally(res=>{
  858. loadingRock.close();
  859. });
  860. },
  861. addTagCancel() {
  862. this.tagOpen = false;
  863. this.addTagFormByWatch={
  864. logIds:[],
  865. tagIds:[]
  866. };
  867. },
  868. DelTagCancel() {
  869. this.tagDelOpen = false;
  870. this.addTagFormByWatch={
  871. logIds:[],
  872. tagIds:[]
  873. };
  874. },
  875. }
  876. };
  877. </script>
  878. <style scoped>
  879. /* CSS 样式 */
  880. .tag-container {
  881. display: flex;
  882. flex-wrap: wrap; /* 超出宽度时自动换行 */
  883. gap: 8px; /* 设置标签之间的间距 */
  884. }
  885. .name-background {
  886. display: inline-block;
  887. background-color: #abece6; /* 背景颜色 */
  888. padding: 4px 8px; /* 调整内边距,让背景包裹文字 */
  889. border-radius: 4px; /* 可选:设置圆角 */
  890. }
  891. /* CSS 样式 */
  892. .tag-container {
  893. display: flex;
  894. flex-wrap: wrap; /* 超出宽度时自动换行 */
  895. gap: 8px; /* 设置标签之间的间距 */
  896. }
  897. .name-background {
  898. display: inline-block;
  899. background-color: #abece6; /* 背景颜色 */
  900. padding: 4px 8px; /* 调整内边距,让背景包裹文字 */
  901. border-radius: 4px; /* 可选:设置圆角 */
  902. }
  903. .tag-box {
  904. padding: 8px 12px;
  905. border: 1px solid #989797;
  906. border-radius: 4px;
  907. cursor: pointer;
  908. display: inline-block;
  909. }
  910. .tag-selected {
  911. background-color: #00bc98;
  912. color: #fff;
  913. border-color: #00bc98;
  914. }
  915. .el-tag + .el-tag {
  916. margin-left: 10px;
  917. }
  918. .button-new-tag {
  919. margin-left: 10px;
  920. height: 32px;
  921. line-height: 30px;
  922. padding-top: 0;
  923. padding-bottom: 0;
  924. }
  925. .input-new-tag {
  926. width: 90px;
  927. margin-left: 10px;
  928. vertical-align: bottom;
  929. }
  930. </style>