watchLog.vue 56 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774
  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="project">-->
  15. <!-- <el-select v-model="queryParams.project" placeholder="请选择项目" clearable size="small" >-->
  16. <!-- <el-option-->
  17. <!-- v-for="item in projectOptions"-->
  18. <!-- :key="item.dictValue"-->
  19. <!-- :label="item.dictLabel"-->
  20. <!-- :value="item.dictValue"-->
  21. <!-- />-->
  22. <!-- </el-select>-->
  23. <!-- </el-form-item>-->
  24. <el-form-item label="企微账号" prop="qwUserId" v-if="queryParams.sendType == 2">
  25. <el-select v-model="queryParams.qwUserId" placeholder="企微账号" clearable size="small"
  26. @change="updateQwuser()">
  27. <el-option
  28. v-for="dict in myQwUserList"
  29. :key="dict.dictValue"
  30. :label="dict.dictLabel + '('+dict.corpName+')'"
  31. :value="dict.dictValue"
  32. />
  33. </el-select>
  34. </el-form-item>
  35. <el-form-item label="客户ID" prop="qwExternalContactId" v-if="queryParams.sendType == 2">
  36. <el-input
  37. v-model="queryParams.qwExternalContactId"
  38. placeholder="请输入客户ID"
  39. clearable
  40. size="small"
  41. @keyup.enter.native="handleQuery"
  42. />
  43. </el-form-item>
  44. <el-form-item label="会员ID" prop="userId" v-if="queryParams.sendType == 1">
  45. <el-input
  46. v-model="queryParams.userId"
  47. placeholder="请输入会员ID"
  48. clearable
  49. size="small"
  50. @keyup.enter.native="handleQuery"
  51. />
  52. </el-form-item>
  53. <el-form-item label="会员昵称" prop="nickName" v-if="queryParams.sendType == 1">
  54. <el-input
  55. v-model="queryParams.nickName"
  56. placeholder="请输入会员昵称"
  57. clearable
  58. size="small"
  59. @keyup.enter.native="handleQuery"
  60. />
  61. </el-form-item>
  62. <el-form-item label="企微客户昵称" prop="nickName" v-if="queryParams.sendType == 2">
  63. <el-input
  64. v-model="queryParams.externalUserName"
  65. placeholder="请输入企微客户昵称"
  66. clearable
  67. size="small"
  68. @keyup.enter.native="handleQuery"
  69. />
  70. </el-form-item>
  71. <!-- 营期名称 periodIds-->
  72. <el-form-item label="营期名称" prop="periodId">
  73. <el-select filterable v-model="queryParams.periodId" placeholder="请选择营期名称" clearable size="small">
  74. <el-option
  75. v-for="dict in scheduleLists"
  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="courseId">
  83. <el-select filterable v-model="queryParams.courseId" placeholder="请选择课程" clearable size="small"
  84. @change="courseChange(queryParams.courseId)">
  85. <el-option
  86. v-for="dict in courseLists"
  87. :key="dict.dictValue"
  88. :label="dict.dictLabel"
  89. :value="dict.dictValue"
  90. />
  91. </el-select>
  92. </el-form-item>
  93. <el-form-item label="小节" prop="videoId">
  94. <el-select filterable v-model="queryParams.videoId" placeholder="请选择小节" clearable size="small">
  95. <el-option
  96. v-for="dict in videoList"
  97. :key="dict.dictValue"
  98. :label="dict.dictLabel"
  99. :value="dict.dictValue"
  100. />
  101. </el-select>
  102. </el-form-item>
  103. <!-- sop名称 -->
  104. <el-form-item label="SOP名称" prop="sopId" v-if="queryParams.sendType == 2">
  105. <el-autocomplete
  106. v-model="sopSearchText"
  107. :fetch-suggestions="querySopAsync"
  108. placeholder="请输入SOP名称"
  109. clearable
  110. size="small"
  111. style="width: 200px"
  112. @select="handleSopSelect"
  113. @clear="handleSopClear"
  114. :trigger-on-focus="false"
  115. >
  116. <template slot-scope="{ item }">
  117. <div class="sop-item">
  118. <span class="sop-name">{{ item.name }}</span>
  119. </div>
  120. </template>
  121. </el-autocomplete>
  122. </el-form-item>
  123. <!-- 营期时间 -->
  124. <!-- <el-form-item label="营期时间" prop="scheduleTime">
  125. <el-input
  126. v-model="scheduleTimeText"
  127. placeholder="请选择营期时间"
  128. readonly
  129. @click.native="showScheduleCalendar = true"
  130. />
  131. <calendar
  132. v-model="scheduleTime"
  133. mode="during"
  134. :show.sync="showScheduleCalendar"
  135. @change="handleScheduleTimeChange"
  136. :key="scheduleCalendarKey"
  137. />
  138. </el-form-item> -->
  139. <el-form-item label="营期时间" prop="scheduleTime">
  140. <el-date-picker
  141. v-model="scheduleTimeText"
  142. type="daterange"
  143. range-separator="至"
  144. start-placeholder="开始日期"
  145. end-placeholder="结束日期"
  146. value-format="yyyy-MM-dd"
  147. style="width: 240px"
  148. @change="handleScheduleTimeChange"
  149. />
  150. </el-form-item>
  151. <!-- 创建时间 -->
  152. <!-- <el-form-item label="创建时间" prop="createTime">
  153. <el-input
  154. v-model="createTimeText"
  155. placeholder="请选择创建时间"
  156. readonly
  157. @click.native="showCreateCalendar = true"
  158. />
  159. <calendar
  160. v-model="createTime"
  161. mode="during"
  162. :show.sync="showCreateCalendar"
  163. @change="createChange"
  164. :key="createCalendarKey"
  165. />
  166. </el-form-item> -->
  167. <el-form-item label="创建时间" prop="createTime">
  168. <el-date-picker
  169. v-model="createTimeText"
  170. type="datetimerange"
  171. range-separator="至"
  172. start-placeholder="开始日期"
  173. end-placeholder="结束日期"
  174. value-format="yyyy-MM-dd HH:mm:ss"
  175. @change="createChange"
  176. :default-time="['00:00:00', '23:59:59']"
  177. />
  178. </el-form-item>
  179. <!-- 最新更新时间 -->
  180. <!-- <el-form-item label="最新更新时间" prop="updateTime">
  181. <el-input
  182. v-model="updateTimeText"
  183. placeholder="请选择更新时间"
  184. readonly
  185. @click.native="showUpdateCalendar = true"
  186. />
  187. <calendar
  188. v-model="updateTime"
  189. mode="during"
  190. :show.sync="showUpdateCalendar"
  191. @change="updateChange"
  192. :key="updateCalendarKey"
  193. />
  194. </el-form-item> -->
  195. <el-form-item label="最新更新时间" prop="updateTime">
  196. <el-date-picker
  197. v-model="updateTimeText"
  198. type="daterange"
  199. range-separator="至"
  200. start-placeholder="开始日期"
  201. end-placeholder="结束日期"
  202. value-format="yyyy-MM-dd"
  203. style="width: 240px"
  204. @change="updateChange"
  205. />
  206. </el-form-item>
  207. <!-- 进线时间 -->
  208. <!-- <el-form-item label="进线时间" prop="qecCreateTime">
  209. <el-input
  210. v-model="qecCreateTimeText"
  211. placeholder="请选择进线时间"
  212. readonly
  213. @click.native="showQecCalendar = true"
  214. />
  215. <calendar
  216. v-model="qecCreateTime"
  217. mode="during"
  218. :show.sync="showQecCalendar"
  219. @change="qecCreateTimeChange"
  220. :key="qecCalendarKey"
  221. />
  222. </el-form-item> -->
  223. <el-form-item label="进线时间" prop="qecCreateTime">
  224. <el-date-picker
  225. v-model="qecCreateTimeText"
  226. type="daterange"
  227. range-separator="至"
  228. start-placeholder="开始日期"
  229. end-placeholder="结束日期"
  230. value-format="yyyy-MM-dd"
  231. style="width: 240px"
  232. @change="qecCreateTimeChange"
  233. />
  234. </el-form-item>
  235. <el-form-item label="营期课程时间" prop="periodTime" v-if="queryParams.sendType==1">
  236. <el-date-picker
  237. v-model="periodTimeText"
  238. type="datetimerange"
  239. align="right"
  240. unlink-panels
  241. value-format="yyyy-MM-dd HH:mm:ss"
  242. range-separator="至"
  243. start-placeholder="开始日期"
  244. end-placeholder="结束日期"
  245. :picker-options="pickerOptions"
  246. @change="qecPeriodTimeChange"
  247. :default-time="['00:00:00', '23:59:59']">
  248. </el-date-picker>
  249. </el-form-item>
  250. <!-- <el-form-item label="是否注册" prop="isVip">-->
  251. <!-- <el-select-->
  252. <!-- filterable-->
  253. <!-- v-model="queryParams.isVip"-->
  254. <!-- placeholder="请选择是否注册"-->
  255. <!-- clearable size="small">-->
  256. <!-- <el-option-->
  257. <!-- v-for="dict in isVipList"-->
  258. <!-- :key="dict.dictValue"-->
  259. <!-- :label="dict.dictLabel"-->
  260. <!-- :value="dict.dictValue"-->
  261. <!-- />-->
  262. <!-- </el-select>-->
  263. <!-- </el-form-item>-->
  264. <el-form-item>
  265. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  266. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  267. </el-form-item>
  268. </el-form>
  269. <el-row :gutter="10" class="mb8">
  270. <el-col :span="1.5">
  271. <el-button
  272. type="warning"
  273. plain
  274. icon="el-icon-download"
  275. size="mini"
  276. :loading="exportLoading"
  277. @click="handleExport"
  278. v-hasPermi="['course:courseWatchLog:myExport']"
  279. >导出
  280. </el-button>
  281. <el-col :span="1.5" v-if="queryParams.sendType == 2">
  282. <el-button
  283. type="primary"
  284. plain
  285. size="mini"
  286. @click="addUserTag"
  287. v-hasPermi="['qw:externalContact:addTag']"
  288. >批量添加标签</el-button>
  289. </el-col>
  290. <el-col :span="1.5" v-if="queryParams.sendType == 2">
  291. <el-button
  292. type="primary"
  293. plain
  294. size="mini"
  295. @click="delUserTag"
  296. v-hasPermi="['qw:externalContact:delTag']"
  297. >批量移除标签</el-button>
  298. </el-col>
  299. </el-col>
  300. <el-col :span="1.5" v-if="queryParams.sendType == 2">
  301. <el-button
  302. type="success"
  303. plain
  304. icon="el-icon-edit"
  305. size="mini"
  306. @click="handleBatchUpdateNotes"
  307. v-hasPermi="['qw:externalContact:edit']"
  308. >批量修改备注
  309. </el-button>
  310. </el-col>
  311. <el-col :span="1.5" v-if="queryParams.sendType == 2">
  312. <el-button
  313. type="success"
  314. plain
  315. icon="el-icon-edit"
  316. size="mini"
  317. @click="handleBatchUpdateNotesFilter"
  318. v-hasPermi="['qw:externalContact:edit']"
  319. >批量修改备注(筛选条件)
  320. </el-button>
  321. </el-col>
  322. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  323. </el-row>
  324. <el-tabs type="card" v-model="activeName" @tab-click="handleClickX">
  325. <el-tab-pane label="全部" name="00"></el-tab-pane>
  326. <el-tab-pane v-for="(item,index) in logTypeOptions" :label="item.dictLabel" :name="item.dictValue"></el-tab-pane>
  327. </el-tabs>
  328. <!-- <el-table border v-loading="loading" :data="courseWatchLogList" @selection-change="handleSelectionChange">-->
  329. <el-table
  330. border
  331. v-loading="loading"
  332. :data="courseWatchLogList"
  333. @selection-change="handleSelectionChange"
  334. :key="tableKey">
  335. <el-table-column type="selection" width="55" align="center"/>
  336. <el-table-column label="记录编号" align="center" prop="logId"/>
  337. <el-table-column label="客户昵称" align="center" prop="externalUserName" v-if="queryParams.sendType == 2"/>
  338. &lt;!&ndash;
  339. <el-table-column label="会员ID" align="center" prop="userId" v-if="queryParams.sendType == 1"/>
  340. &ndash;&gt;
  341. <!-- <el-table-column label="客户头像" align="center" prop="externalUserAvatar" v-if="queryParams.sendType == 2">-->
  342. <!-- <template slot-scope="scope">-->
  343. <!-- <el-popover-->
  344. <!-- placement="right"-->
  345. <!-- title=""-->
  346. <!-- trigger="hover">-->
  347. <!-- <img slot="reference" :src="scope.row.externalUserAvatar" style="width: 50px;height: 50px">-->
  348. <!-- <img :src="scope.row.externalUserAvatar" style="max-width: 200px;max-height: 200px">-->
  349. <!-- </el-popover>-->
  350. <!-- </template>-->
  351. <!-- </el-table-column>-->
  352. <el-table-column label="头像" align="center">
  353. <template slot-scope="scope">
  354. <img
  355. v-if="queryParams.sendType == 1"
  356. :src="scope.row.fsAvatar"
  357. style="width:50px;height:50px"
  358. />
  359. <img
  360. v-else-if="queryParams.sendType == 2"
  361. :src="scope.row.externalUserAvatar"
  362. style="width:50px;height:50px"
  363. />
  364. </template>
  365. </el-table-column>
  366. <el-table-column label="用户昵称" align="center" v-if="queryParams.sendType == 1">
  367. <template slot-scope="scope">
  368. {{ queryParams.sendType=='1' ? scope.row.fsNickName : scope.row.externalUserName }}
  369. </template>
  370. </el-table-column>
  371. <el-table-column label="头像" align="center" v-if="queryParams.sendType == 1">
  372. <template slot-scope="scope">
  373. <img v-if="queryParams.sendType=='1'" :src="scope.row.fsAvatar" style="width:50px;height:50px" />
  374. <img v-else :src="scope.row.externalUserAvatar" style="width:50px;height:50px" />
  375. </template>
  376. </el-table-column>
  377. <el-table-column label="营期名称" align="center" prop="periodIdName" v-if="this.queryParams.sendType==1" />
  378. <el-table-column label="课程名称" align="center" prop="courseName"/>
  379. <el-table-column label="小节名称" align="center" prop="videoName"/>
  380. <el-table-column label="记录类型" align="center" prop="logType">
  381. <template slot-scope="scope">
  382. <dict-tag :options="logTypeOptions" :value="scope.row.logType"/>
  383. </template>
  384. </el-table-column>
  385. <el-table-column label="播放时长" align="center" prop="duration"/>
  386. <!-- <el-table-column label="所属销售" align="center" prop="companyUserName"/>-->
  387. <!-- <el-table-column label="所属公司" align="center" prop="companyName"/>-->
  388. <!-- <el-table-column label="企微员工名称" align="center" prop="qwUserName"/>-->
  389. <!-- 所属企微列 -->
  390. <el-table-column
  391. label="所属企微"
  392. align="center"
  393. prop="qwUserName"
  394. v-if="queryParams.sendType == 2"
  395. />
  396. <!-- <el-table-column label="所属发送方式" align="center" prop="sendType"/>-->
  397. <el-table-column label="创建时间" align="center" prop="createTime" width="100px"/>
  398. <el-table-column label="更新时间" align="center" prop="updateTime" width="100px" />
  399. <el-table-column label="完课时间" align="center" prop="finishTime" width="100px" />
  400. <el-table-column label="营期时间" align="center" prop="campPeriodTime" />
  401. <el-table-column label="进线时间" align="center" prop="qecCreateTime" />
  402. <el-table-column label="是否领奖" align="center" prop="rewardType" >
  403. <template slot-scope="scope">
  404. <el-tag
  405. :type="scope.row.rewardType ? 'success' : 'info'"
  406. effect="plain"
  407. >
  408. {{ scope.row.rewardType ? '已领取' : '未领取' }}
  409. </el-tag>
  410. </template>
  411. </el-table-column>
  412. <el-table-column
  413. fixed="right"
  414. label="操作"
  415. width="100">
  416. <template slot-scope="scope">
  417. <el-button @click="openAnswerLogFun(scope.row)" type="text" size="small">答题记录</el-button>
  418. <el-button @click="openRedLogFun(scope.row)" type="text" size="small">红包记录</el-button>
  419. </template>
  420. </el-table-column>
  421. </el-table>
  422. <pagination
  423. v-show="total>0"
  424. :total="total"
  425. :page.sync="queryParams.pageNum"
  426. :limit.sync="queryParams.pageSize"
  427. @pagination="getList"
  428. />
  429. <el-drawer title="答题记录" :visible.sync="openAnswerLog" size="70%" append-to-body>
  430. <el-table border v-loading="" :data="answerLogsList">
  431. <el-table-column label="会员用户" align="center" prop="userName">
  432. <template slot-scope="scope">
  433. <div style="display: flex;white-space: nowrap">
  434. <div style="margin: auto">
  435. {{ scope.row.userName }}
  436. </div>
  437. <el-popover
  438. placement="right"
  439. title=""
  440. trigger="hover">
  441. <img slot="reference" :src="scope.row.fsAvatar" style="width: 30px;height: 30px">
  442. <img :src="scope.row.fsAvatar" style="max-width: 200px;max-height: 200px">
  443. </el-popover>
  444. </div>
  445. </template>
  446. </el-table-column>
  447. <el-table-column label="课程名称" align="center" prop="courseName"/>
  448. <el-table-column label="小节名称" align="center" prop="videoName"/>
  449. <el-table-column label="是否全部正确" align="center" prop="isRight">
  450. <template slot-scope="scope">
  451. <dict-tag :options="sysCompanyOr" :value="scope.row.isRight"></dict-tag>
  452. </template>
  453. </el-table-column>
  454. <el-table-column label="销售名称" align="center" prop="companyUserName"/>
  455. <el-table-column label="企微员工名称" align="center" prop="qwUserName"/>
  456. <el-table-column label="公司名称" align="center" prop="companyName"/>
  457. <el-table-column label="创建时间" align="center" prop="createTime"/>
  458. </el-table>
  459. <pagination
  460. v-show="answerLogTotal>0"
  461. :total="answerLogTotal"
  462. :page.sync="answerLogQueryParams.pageNum"
  463. :limit.sync="answerLogQueryParams.pageSize"
  464. @pagination="answerLogList"
  465. />
  466. </el-drawer>
  467. <el-drawer title="红包记录" :visible.sync="openRedLog" size="70%" append-to-body>
  468. <el-table border v-loading="" :data="redLogsList">
  469. <el-table-column type="selection" width="55" align="center" />
  470. <el-table-column label="记录编号" align="center" prop="logId" />
  471. <el-table-column label="批次单号" align="center" prop="outBatchNo" />
  472. <el-table-column label="课程名称" align="center" prop="courseId" >
  473. <template slot-scope="scope">
  474. <span prop="status" v-for="(item, index) in courseLists" v-if="scope.row.courseId==item.dictValue">{{item.dictLabel}}</span>
  475. </template>
  476. </el-table-column>
  477. <el-table-column label="小节名称" align="center" prop="title" />
  478. <!-- <el-table-column label="会员id" align="center" prop="userId" />-->
  479. <el-table-column label="会员用户" align="center" prop="fsNickName">
  480. <template slot-scope="scope">
  481. <div style="display: flex;white-space: nowrap">
  482. <div style="margin: auto">
  483. {{scope.row.fsNickName}}
  484. </div>
  485. <el-popover
  486. placement="right"
  487. title=""
  488. trigger="hover">
  489. <img slot="reference" :src="scope.row.fsAvatar" style="width: 30px;height: 30px">
  490. <img :src="scope.row.fsAvatar" style="max-width: 200px;max-height: 200px">
  491. </el-popover>
  492. </div>
  493. </template>
  494. </el-table-column>
  495. <!-- <el-table-column label="会员电话" align="center" prop="phone" />-->
  496. <!-- <el-table-column label="所属销售" align="center" prop="companyUserName" />-->
  497. <!-- <el-table-column label="所属公司" align="center" prop="companyName" />-->
  498. <el-table-column label="转账金额" align="center" prop="amount" />
  499. <el-table-column label="状态" align="center" prop="status" >
  500. <template slot-scope="scope">
  501. <el-tag>
  502. {{
  503. scope.row.status === 0 ? "发送中" :
  504. scope.row.status === 2 ? "待补发" :
  505. "已完成"
  506. }}
  507. </el-tag>
  508. </template>
  509. </el-table-column>
  510. <el-table-column label="所属企微" align="center" prop="qwUserName" />
  511. <el-table-column label="创建时间" align="center" prop="createTime" />
  512. </el-table>
  513. <pagination
  514. v-show="redLogTotal>0"
  515. :total="redLogTotal"
  516. :page.sync="redLogQueryParams.pageNum"
  517. :limit.sync="redLogQueryParams.pageSize"
  518. @pagination="redLogList"
  519. />
  520. </el-drawer>
  521. <el-dialog title="批量添加标签" :visible.sync="tagOpen" width="800px" append-to-body>
  522. <div>搜索标签:
  523. <el-input v-model="tagChange.tagName" placeholder="请输入标签名称" clearable size="small" style="width: 200px;margin-right: 10px" />
  524. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleSearchTags(tagChange.tagName)">搜索</el-button>
  525. <el-button type="primary" icon="el-icon-plus" size="mini" @click="cancelSearchTags">重置</el-button>
  526. </div>
  527. <el-form ref="form" :model="addTagFormByWatch" label-width="80px">
  528. <div v-for="item in tagGroupList" :key="item.id" >
  529. <div style="font-size: 20px;margin-top: 20px;margin-bottom: 20px;">
  530. <span class="name-background">{{ item.name }}</span>
  531. </div>
  532. <!-- 添加外层滚动容器 -->
  533. <div class="scroll-wrapper">
  534. <div class="tag-container">
  535. <a
  536. v-for="tagItem in item.tag"
  537. class="tag-box"
  538. @click="tagSelection(tagItem)"
  539. :class="{ 'tag-selected': tagItem.isSelected }"
  540. >
  541. {{ tagItem.name }} 【{{tagItem.corpName}}】
  542. </a>
  543. </div>
  544. </div>
  545. </div>
  546. </el-form>
  547. <pagination
  548. v-show="tagTotal>0"
  549. :total="tagTotal"
  550. :page.sync="queryTagParams.pageNum"
  551. :limit.sync="queryTagParams.pageSize"
  552. @pagination="getPageListTagGroup"
  553. />
  554. <div slot="footer" class="dialog-footer">
  555. <el-button type="primary" @click="addTagSubmitForm()">确 定</el-button>
  556. <el-button @click="addTagCancel">取 消</el-button>
  557. </div>
  558. </el-dialog>
  559. <el-dialog title="批量移除标签" :visible.sync="tagDelOpen" width="800px" append-to-body>
  560. <div>搜索标签:
  561. <el-input v-model="tagChange.tagName" placeholder="请输入标签名称" clearable size="small" style="width: 200px;margin-right: 10px" />
  562. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleSearchTags(tagChange.tagName)">搜索</el-button>
  563. <el-button type="primary" icon="el-icon-plus" size="mini" @click="cancelSearchTags">重置</el-button>
  564. </div>
  565. <el-form ref="form" :model="addTagFormByWatch" label-width="80px">
  566. <div v-for="item in tagGroupList" :key="item.id" >
  567. <div style="font-size: 20px;margin-top: 20px;margin-bottom: 20px;">
  568. <span class="name-background">{{ item.name }}</span>
  569. </div>
  570. <!-- 添加外层滚动容器 -->
  571. <div class="scroll-wrapper">
  572. <div class="tag-container">
  573. <a
  574. v-for="tagItem in item.tag"
  575. class="tag-box"
  576. @click="tagSelection(tagItem)"
  577. :class="{ 'tag-selected': tagItem.isSelected }"
  578. >
  579. {{ tagItem.name }}
  580. </a>
  581. </div>
  582. </div>
  583. </div>
  584. </el-form>
  585. <pagination
  586. v-show="tagTotal>0"
  587. :total="tagTotal"
  588. :page.sync="queryTagParams.pageNum"
  589. :limit.sync="queryTagParams.pageSize"
  590. @pagination="getPageListTagGroup"
  591. />
  592. <div slot="footer" class="dialog-footer">
  593. <el-button type="primary" @click="tagDelSubmitForm()">确 定</el-button>
  594. <el-button @click="DelTagCancel">取 消</el-button>
  595. </div>
  596. </el-dialog>
  597. <el-dialog
  598. :title="resultTitle"
  599. :visible.sync="resultDialogVisible"
  600. width="50%"
  601. custom-class="feedback-dialog"
  602. >
  603. <pre style="white-space: pre-wrap; font-family: inherit;">{{ resultMessage }}</pre>
  604. <span slot="footer" class="dialog-footer">
  605. <el-button @click="resultDialogVisible = false">关闭</el-button>
  606. </span>
  607. </el-dialog>
  608. <el-dialog title="批量添加客户备注" :visible.sync="notesOpen.open" width="800px" append-to-body>
  609. <el-card>
  610. <el-row>
  611. <el-col>
  612. <el-radio-group v-model="notesOpen.nameType" style="margin-bottom: 2%">
  613. <el-radio :label="1">
  614. 客户名称添加在【新备注】【前】
  615. </el-radio>
  616. <el-radio :label="2">
  617. 客户名称添加在【新备注】【后】
  618. </el-radio>
  619. <el-radio :label="3">
  620. 不添加客户名称
  621. </el-radio>
  622. </el-radio-group>
  623. </el-col>
  624. <el-col>
  625. <el-radio-group v-model="notesOpen.type">
  626. <el-radio
  627. :label="1"
  628. >添加【新备注】在最【前】面
  629. </el-radio>
  630. <el-radio
  631. :label="2"
  632. >添加【新备注】在最【后】面
  633. </el-radio>
  634. <el-radio
  635. :label="3"
  636. >替换所有备注
  637. </el-radio>
  638. </el-radio-group>
  639. </el-col>
  640. <el-col>
  641. <el-input v-model="notesOpen.notes" placeholder="请输入客户备注(最多20个字,含已有的)" clearable size="small"
  642. maxlength="20" show-word-limit style="width: 500px;margin-top: 3%"/>
  643. <div style="color: #999;font-size: 14px;display: flex;align-items: center;">
  644. <i class="el-icon-info"></i>
  645. 由于企业微信官方限制,备注最多20个字,且自动会去除末尾超出的字
  646. </div>
  647. </el-col>
  648. </el-row>
  649. </el-card>
  650. <div slot="footer" class="dialog-footer">
  651. <el-button type="primary" @click="notesSubmitForm()">确 定</el-button>
  652. <el-button @click="notesCancel()">取消</el-button>
  653. </div>
  654. </el-dialog>
  655. </div>
  656. </template>
  657. <script>
  658. import {
  659. addCourseWatchLog,
  660. delCourseWatchLog,
  661. exportCourseWatchLog,
  662. getCourseWatchLog, myExportCourseWatchLog,
  663. myListCourseWatchLog,
  664. updateCourseWatchLog
  665. } from "@/api/course/courseWatchLog";
  666. import {courseList, myListCourseRedPacketLog, videoList} from '@/api/course/courseRedPacketLog'
  667. import {listPeriodLabel} from "@/api/course/userCoursePeriod";
  668. import {myListLogs} from "@/api/course/courseAnswerlogs";
  669. import {getMyQwUserList} from "@/api/qw/user";
  670. import {searchTags} from "../../../api/qw/tag";
  671. import {addTagByWatch, delTagByWatch,batchUpdateExternalContactNotes,batchUpdateExternalContactNotesByWatchLog} from "../../../api/qw/externalContact";
  672. import {allListTagGroup} from "../../../api/qw/tagGroup";
  673. import Vue from 'vue'
  674. import Calendar from 'vue-mobile-calendar'
  675. import {infoSop} from "@/api/qw/sop";
  676. Vue.use(Calendar)
  677. export default {
  678. name: "CourseWatchLog",
  679. data() {
  680. return {
  681. tableKey: 0,
  682. // 日历 key 控制刷新
  683. scheduleCalendarKey: 0,
  684. createCalendarKey: 0,
  685. updateCalendarKey: 0,
  686. qecCalendarKey: 0,
  687. periodTimeKey: 0,
  688. createTimeText: '',
  689. scheduleTimeText: '', // 新增
  690. updateTimeText: '', // 新增
  691. qecCreateTimeText: [], // 新增
  692. periodTimeText: '', // 营期课程时间
  693. scheduleTime: [], // 改为数组
  694. createTime: [], // 改为数组
  695. updateTime: [], // 改为数组
  696. qecCreateTime: [], // 改为数组
  697. periodTime: [], // 改为数组
  698. // 控制日历显隐
  699. showScheduleCalendar: false,
  700. showCreateCalendar: false,
  701. showUpdateCalendar: false,
  702. showQecCalendar: false,
  703. resultDialogVisible: false,
  704. resultMessage: '',
  705. resultTitle:'',
  706. activeName:"2",
  707. pickerOptions: {
  708. disabledDate(time) {
  709. // 获取13天前的日期(加上今天就是14天)
  710. const sixDaysAgo = new Date();
  711. sixDaysAgo.setDate(sixDaysAgo.getDate() - 13);
  712. sixDaysAgo.setHours(0, 0, 0, 0);
  713. // 获取明天的日期(不包括今天)
  714. const tomorrow = new Date();
  715. tomorrow.setDate(tomorrow.getDate() + 1);
  716. tomorrow.setHours(0, 0, 0, 0);
  717. return time.getTime() < sixDaysAgo.getTime() || time.getTime() >= tomorrow.getTime();
  718. }
  719. },
  720. courseLists: [],
  721. scheduleLists:[], // 营期名称
  722. videoList: [],
  723. myQwUserList: [],
  724. logTypeOptions: [],
  725. // 遮罩层
  726. loading: true,
  727. // 导出遮罩层
  728. exportLoading: false,
  729. // 选中数组
  730. ids: [],
  731. // 非单个禁用
  732. single: true,
  733. // 非多个禁用
  734. multiple: true,
  735. // 显示搜索条件
  736. showSearch: true,
  737. sysCompanyOr: [],
  738. // 总条数
  739. total: 0,
  740. // 短链课程看课记录表格数据
  741. courseWatchLogList: [],
  742. openAnswerLog: false,
  743. loadingAnswerLog: true,
  744. answerLogsList: [],
  745. answerLogTotal: 0,
  746. answerLogQueryParams: {
  747. pageNum: 1,
  748. pageSize: 10,
  749. },
  750. projectOptions:[],
  751. sendTypeOptions:[{
  752. dictLabel:'会员',dictValue:'1'
  753. },
  754. {
  755. dictLabel:'企微',dictValue:'2'
  756. }
  757. ],
  758. openRedLog: false,
  759. loadingRedLog: true,
  760. redLogsList: [],
  761. redLogTotal: 0,
  762. redLogQueryParams: {
  763. pageNum: 1,
  764. pageSize: 10,
  765. },
  766. // 弹出层标题
  767. title: "",
  768. // 是否显示弹出层
  769. open: false,
  770. tagOpen:false,
  771. //标签弹窗选择
  772. tagChange:{
  773. open:false,
  774. index:null,
  775. },
  776. addTagFormByWatch:{
  777. logId:[],
  778. tagIds:[]
  779. },
  780. tagGroupList: [],
  781. tagTotal:0,
  782. tagDelOpen:false,
  783. queryTagParams:{
  784. pageNum: 1,
  785. pageSize: 5,
  786. total:0,
  787. name:null,
  788. corpId:null,
  789. },
  790. isVipList: [
  791. { dictLabel: '是', dictValue: 1 },
  792. { dictLabel: '否', dictValue: 0 }
  793. ],
  794. // SOP搜索相关
  795. sopSearchText: '', // SOP搜索框显示的文本
  796. selectedSopId: null, // 选中的SOP ID
  797. // 查询参数
  798. queryParams: {
  799. pageNum: 1,
  800. project: null,
  801. pageSize: 10,
  802. userId: null,
  803. videoId: null,
  804. nickName: null,
  805. logType: 2,
  806. qwExternalContactId: null,
  807. externalUserName:null,
  808. duration: null,
  809. qwUserId: null,
  810. companyUserId: null,
  811. companyId: null,
  812. courseId: null,
  813. periodId:null,
  814. sTime: null,
  815. eTime: null,
  816. upSTime:null,
  817. upETime:null,
  818. qecSTime:null,
  819. qecETime:null,
  820. periodSTime:null,
  821. periodETime:null,
  822. scheduleStartTime: null,
  823. scheduleEndTime: null,
  824. sendType:process.env.VUE_APP_COURSE_DEFAULT,
  825. isVip: null,
  826. sopId: null, // sopId
  827. },
  828. // 表单参数
  829. form: {},
  830. // 表单校验
  831. rules: {},
  832. notesOpen: {
  833. type: 1,
  834. nameType: 3,
  835. addType: 0,
  836. filter: false,
  837. open: false,
  838. notes: null,
  839. },
  840. };
  841. },
  842. created() {
  843. courseList().then(response => {
  844. this.courseLists = response.list;
  845. });
  846. this.getDicts("sys_course_watch_log_type_new").then(response => {
  847. this.logTypeOptions = response.data;
  848. });
  849. this.getDicts("sys_company_or").then(response => {
  850. this.sysCompanyOr = response.data;
  851. });
  852. this.getDicts("sys_course_project").then(response => {
  853. this.projectOptions = response.data;
  854. });
  855. // 查询营期名称
  856. listPeriodLabel().then(response => {
  857. this.scheduleLists = response.rows;
  858. });
  859. // 设置默认当天时间 xgb 防止频繁查询大量数据
  860. this.setToday();
  861. this.getList();
  862. getMyQwUserList().then(response => {
  863. this.myQwUserList = response.data;
  864. });
  865. },
  866. methods: {
  867. setToday(){
  868. const today = new Date();
  869. const todayStart = new Date(today - 60*60*24*7*1000) ;
  870. todayStart.setHours(0, 0, 0, 0);
  871. const todayEnd = new Date(today);
  872. todayEnd.setHours(23, 59, 59, 999);
  873. this.createTimeText = [this.formatDate(todayStart), this.formatDate(todayEnd)];
  874. this.queryParams.sTime = this.formatDate(todayStart);
  875. this.queryParams.eTime = this.formatDate(todayEnd);
  876. },
  877. handleSendTypeChange() {
  878. // 重置相关参数
  879. this.queryParams.qwUserId = null;
  880. this.queryParams.qwExternalContactId = null;
  881. this.queryParams.userId = null;
  882. this.queryParams.nickName = null;
  883. this.queryParams.externalUserName = null;
  884. this.queryParams.corpId = null;
  885. this.queryParams.project = null;
  886. this.queryParams.courseId = null;
  887. this.queryParams.videoId = null;
  888. // 重置选择
  889. this.ids = [];
  890. this.courseWatchLogList = []; // 清空表格数据
  891. // 重置分页
  892. this.queryParams.pageNum = 1;
  893. // 强制重新渲染表格
  894. this.tableKey += 1;
  895. setTimeout(() => {
  896. this.getList();
  897. }, 200);
  898. },
  899. // 重置日历组件
  900. resetCalendars() {
  901. this.scheduleTime = [];
  902. this.createTime = [];
  903. this.updateTime = [];
  904. this.qecCreateTime = [];
  905. this.periodTime = [];
  906. this.scheduleTimeText = [];
  907. this.createTimeText = [];
  908. this.updateTimeText = [];
  909. this.qecCreateTimeText = [];
  910. this.periodTimeText = [];
  911. // 强制刷新日历组件
  912. this.scheduleCalendarKey++;
  913. this.createCalendarKey++;
  914. this.updateCalendarKey++;
  915. this.qecCalendarKey++;
  916. this.periodTimeKey++;
  917. },
  918. formatDateRange(dates) {
  919. if (!dates || dates.length < 2) return '';
  920. return dates.map(date => date.format('YYYY-MM-DD')).join(' ~ ');
  921. },
  922. courseChange(row) {
  923. this.queryParams.videoId = null;
  924. if (row === '') {
  925. this.videoList = [];
  926. return
  927. }
  928. videoList(row).then(response => {
  929. this.videoList = response.list
  930. });
  931. },
  932. updateQwuser() {
  933. for (const user of this.myQwUserList) {
  934. if (user.dictValue == this.queryParams.qwUserId) {
  935. this.queryParams.corpId = user.corpId;
  936. break;
  937. }
  938. }
  939. this.getList();
  940. },
  941. handleClickX(tab) {
  942. this.activeName=tab.name;
  943. if(tab.name=="00"){
  944. this.queryParams.logType=null;
  945. }else{
  946. this.queryParams.logType=tab.name;
  947. }
  948. this.getList()
  949. },
  950. // 营期时间
  951. handleScheduleTimeChange(scheduleTime) {
  952. if (scheduleTime && scheduleTime.length >= 2) {
  953. if(!this.checkDateRangeLimit(scheduleTime)){
  954. this.scheduleTimeText = null;
  955. this.queryParams.scheduleStartTime=null;
  956. this.queryParams.scheduleStartTime=null;
  957. return;
  958. }
  959. // this.scheduleTimeText = this.formatDateRange(scheduleTime);
  960. this.queryParams.scheduleStartTime = scheduleTime[0] || null;
  961. this.queryParams.scheduleEndTime = scheduleTime[1] || null;
  962. } else {
  963. this.scheduleTimeText = [];
  964. this.queryParams.scheduleStartTime = null;
  965. this.queryParams.scheduleEndTime = null;
  966. }
  967. },
  968. checkDateRangeLimit(dateRange) {
  969. if (dateRange && dateRange.length >= 2) {
  970. const startDate = new Date(dateRange[0]);
  971. const endDate = new Date(dateRange[1]);
  972. // 设置时间为当天开始,避免时间部分影响计算
  973. startDate.setHours(0, 0, 0, 0);
  974. endDate.setHours(0, 0, 0, 0);
  975. const timeDiff = Math.abs(endDate - startDate);
  976. const diffDays = Math.ceil(timeDiff / (1000 * 60 * 60 * 24));
  977. if (diffDays > 31) { // maxDays-1 因为包含起始日
  978. this.$message.warning('时间区间不能超过一个月');
  979. return false;
  980. }
  981. }
  982. return true;
  983. },
  984. // 创建时间
  985. createChange(createTime) {
  986. if (createTime && createTime.length >= 2) {
  987. if(!this.checkDateRangeLimit(createTime)){
  988. this.createTimeText = null;
  989. this.queryParams.sTime=null;
  990. this.queryParams.eTime=null;
  991. return;
  992. }
  993. // this.createTimeText = this.formatDateRange(createTime);
  994. this.queryParams.sTime = this.formatDate(createTime[0]) || null;
  995. this.queryParams.eTime = this.formatDate(createTime[1]) || null;
  996. } else {
  997. this.createTimeText = [];
  998. this.queryParams.sTime = null;
  999. this.queryParams.eTime = null;
  1000. }
  1001. },
  1002. // 更新时间
  1003. updateChange(updateTime) {
  1004. if (updateTime && updateTime.length >= 2) {
  1005. if(!this.checkDateRangeLimit(updateTime)){
  1006. this.updateTimeText = null;
  1007. this.queryParams.upSTime=null;
  1008. this.queryParams.upETime=null;
  1009. return;
  1010. }
  1011. // this.updateTimeText = this.formatDateRange(updateTime);
  1012. this.queryParams.upSTime = updateTime[0] || null;
  1013. this.queryParams.upETime = updateTime[1] || null;
  1014. } else {
  1015. this.updateTimeText = [];
  1016. this.queryParams.upSTime = null;
  1017. this.queryParams.upETime = null;
  1018. }
  1019. },
  1020. // 进线时间
  1021. qecCreateTimeChange(qecCreateTime) {
  1022. if (qecCreateTime && qecCreateTime.length >= 2) {
  1023. // 检查选择的日期范围是否超过7天(包括起始和结束日期)
  1024. const startDate = new Date(qecCreateTime[0]);
  1025. const endDate = new Date(qecCreateTime[1]);
  1026. // 设置时间为当天开始,避免时间部分影响计算
  1027. startDate.setHours(0, 0, 0, 0);
  1028. endDate.setHours(0, 0, 0, 0);
  1029. const timeDiff = Math.abs(endDate - startDate);
  1030. const diffDays = Math.ceil(timeDiff / (1000 * 60 * 60 * 24));
  1031. // 如果超过6天的范围(总共7天,包括起始日)
  1032. if (diffDays > 6) {
  1033. this.$message.error('进线时间选择范围不能超过7天');
  1034. // 清空选择
  1035. this.qecCreateTime = [];
  1036. this.qecCreateTimeText = [];
  1037. this.queryParams.qecSTime = null;
  1038. this.queryParams.qecETime = null;
  1039. this.qecCalendarKey++;
  1040. return;
  1041. }
  1042. // this.qecCreateTimeText = this.formatDateRange(qecCreateTime);
  1043. this.queryParams.qecSTime = qecCreateTime[0] || null;
  1044. this.queryParams.qecETime = qecCreateTime[1] || null;
  1045. } else {
  1046. this.qecCreateTimeText = [];
  1047. this.queryParams.qecSTime = null;
  1048. this.queryParams.qecETime = null;
  1049. }
  1050. },
  1051. //营期课程时间
  1052. qecPeriodTimeChange(periodTime){
  1053. if (periodTime && periodTime.length >= 2) {
  1054. // 检查选择的日期范围是否超过7天(包括起始和结束日期)
  1055. const startDate = new Date(periodTime[0]);
  1056. const endDate = new Date(periodTime[1]);
  1057. // 设置时间为当天开始,避免时间部分影响计算
  1058. startDate.setHours(0, 0, 0, 0);
  1059. endDate.setHours(0, 0, 0, 0);
  1060. const timeDiff = Math.abs(endDate - startDate);
  1061. const diffDays = Math.ceil(timeDiff / (1000 * 60 * 60 * 24));
  1062. // 如果超过6天的范围(总共7天,包括起始日)
  1063. if (diffDays > 13) {
  1064. this.$message.error('时间选择范围不能超过14天');
  1065. // 清空选择
  1066. this.periodTime = [];
  1067. this.periodTimeText = [];
  1068. this.queryParams.periodSTime = null;
  1069. this.queryParams.periodETime = null;
  1070. this.periodTimeKey++;
  1071. return;
  1072. }
  1073. this.queryParams.periodSTime = this.formatDate(periodTime[0]) || null;
  1074. this.queryParams.periodETime = this.formatDate(periodTime[1]) || null;
  1075. } else {
  1076. this.periodTimeText = '';
  1077. this.queryParams.periodSTime = null;
  1078. this.queryParams.periodETime = null;
  1079. }
  1080. },
  1081. formatDate(date) {
  1082. if (!date) return ''
  1083. // 确保 date 是 Date 对象
  1084. let dateObj = date
  1085. if (typeof date === 'string') {
  1086. dateObj = new Date(date)
  1087. }
  1088. // 如果转换失败,返回空字符串
  1089. if (!(dateObj instanceof Date) || isNaN(dateObj.getTime())) {
  1090. return ''
  1091. }
  1092. // 使用更安全的格式化方法
  1093. const year = dateObj.getFullYear()
  1094. const month = String(dateObj.getMonth() + 1).padStart(2, '0')
  1095. const day = String(dateObj.getDate()).padStart(2, '0')
  1096. const hours = String(dateObj.getHours()).padStart(2, '0')
  1097. const minutes = String(dateObj.getMinutes()).padStart(2, '0')
  1098. const seconds = String(dateObj.getSeconds()).padStart(2, '0')
  1099. return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
  1100. },
  1101. /** 查询短链课程看课记录列表 */
  1102. getList() {
  1103. // xgb 看课数据量太大必须限制时间if (this.isEmptyArray(this.createTimeText) &&
  1104. if (this.isEmptyArray(this.createTimeText) &&
  1105. this.isEmptyArray(this.updateTimeText) &&
  1106. this.isEmptyArray(this.scheduleTimeText)) {
  1107. this.$message.warning('请选择创建时间或营期时间或最新更新时间');
  1108. return;
  1109. }
  1110. this.loading = true;
  1111. let param = JSON.parse(JSON.stringify(this.queryParams));
  1112. if (param.logType == "10") {
  1113. param.logType = null;
  1114. }
  1115. myListCourseWatchLog(param).then(response => {
  1116. this.courseWatchLogList = response.rows;
  1117. this.total = response.total;
  1118. this.loading = false;
  1119. }).catch(() => {
  1120. this.loading = false;
  1121. });
  1122. },
  1123. // 取消按钮
  1124. cancel() {
  1125. this.open = false;
  1126. this.reset();
  1127. },
  1128. // 表单重置
  1129. reset() {
  1130. this.form = {
  1131. logId: null,
  1132. userId: null,
  1133. videoId: null,
  1134. logType: null,
  1135. createTime: null,
  1136. updateTime: null,
  1137. qwExternalContactId: null,
  1138. externalUserName:null,
  1139. duration: null,
  1140. qwUserId: null,
  1141. companyUserId: null,
  1142. companyId: null,
  1143. courseId: null,
  1144. periodId:null,
  1145. sTime:null,
  1146. eTime:null,
  1147. upSTime:null,
  1148. upETime:null,
  1149. qecSTime:null,
  1150. qecETime:null,
  1151. scheduleStartTime: null,
  1152. scheduleEndTime: null,
  1153. };
  1154. // 统一重置日历组件
  1155. this.resetCalendars();
  1156. this.resetForm("form");
  1157. },
  1158. /** 搜索按钮操作 */
  1159. handleQuery() {
  1160. this.queryParams.pageNum = 1;
  1161. this.getList();
  1162. },
  1163. /** 重置按钮操作 */
  1164. resetQuery() {
  1165. this.resetForm("queryForm");
  1166. this.queryParams.sTime = null;
  1167. this.queryParams.eTime = null;
  1168. this.queryParams.project = null;
  1169. this.queryParams.upSTime = null;
  1170. this.queryParams.upETime = null;
  1171. this.queryParams.qecSTime = null;
  1172. this.queryParams.qecETime = null;
  1173. this.queryParams.periodSTime = null;
  1174. this.queryParams.periodDTime = null;
  1175. this.queryParams.scheduleStartTime = null;
  1176. this.queryParams.scheduleEndTime = null;
  1177. this.queryParams.sopId = null; // 重置SOP ID
  1178. this.queryParams.isVip = null; // 重置 isVip 状态
  1179. this.queryParams.qwUserId = null; // 重置 qwUserId
  1180. this.queryParams.externalUserName=null;
  1181. // 重置SOP搜索
  1182. this.handleSopClear();
  1183. // 统一重置日历组件
  1184. this.resetCalendars();
  1185. this.setToday();
  1186. this.handleQuery();
  1187. },
  1188. // 多选框选中数据
  1189. handleSelectionChange(selection) {
  1190. this.ids = selection.map(item => item.logId)
  1191. this.single = selection.length !== 1
  1192. this.multiple = !selection.length
  1193. },
  1194. /** 新增按钮操作 */
  1195. handleAdd() {
  1196. this.reset();
  1197. this.open = true;
  1198. this.title = "添加短链课程看课记录";
  1199. },
  1200. /** 修改按钮操作 */
  1201. handleUpdate(row) {
  1202. this.reset();
  1203. const logId = row.logId || this.ids
  1204. getCourseWatchLog(logId).then(response => {
  1205. this.form = response.data;
  1206. this.open = true;
  1207. this.title = "修改短链课程看课记录";
  1208. });
  1209. },
  1210. /** 提交按钮 */
  1211. submitForm() {
  1212. this.$refs["form"].validate(valid => {
  1213. if (valid) {
  1214. if (this.form.logId != null) {
  1215. updateCourseWatchLog(this.form).then(response => {
  1216. this.msgSuccess("修改成功");
  1217. this.open = false;
  1218. this.getList();
  1219. });
  1220. } else {
  1221. addCourseWatchLog(this.form).then(response => {
  1222. this.msgSuccess("新增成功");
  1223. this.open = false;
  1224. this.getList();
  1225. });
  1226. }
  1227. }
  1228. });
  1229. },
  1230. /** 删除按钮操作 */
  1231. handleDelete(row) {
  1232. const logIds = row.logId || this.ids;
  1233. this.$confirm('是否确认删除短链课程看课记录编号为"' + logIds + '"的数据项?', "警告", {
  1234. confirmButtonText: "确定",
  1235. cancelButtonText: "取消",
  1236. type: "warning"
  1237. }).then(function () {
  1238. return delCourseWatchLog(logIds);
  1239. }).then(() => {
  1240. this.getList();
  1241. this.msgSuccess("删除成功");
  1242. }).catch(() => {
  1243. });
  1244. },
  1245. // 添加辅助方法
  1246. isEmptyArray(arr) {
  1247. return !arr || arr.length === 0;
  1248. },
  1249. /** 导出按钮操作 */
  1250. handleExport() {
  1251. // xgb 看课数据量太大必须限制时间
  1252. if (this.isEmptyArray(this.createTimeText) &&
  1253. this.isEmptyArray(this.updateTimeText) &&
  1254. this.isEmptyArray(this.scheduleTimeText)) {
  1255. this.$message.warning('请选择创建时间或营期时间或最新更新时间');
  1256. return;
  1257. }
  1258. const queryParams = this.queryParams;
  1259. this.$confirm('是否确认导出所有短链课程看课记录数据项?', "警告", {
  1260. confirmButtonText: "确定",
  1261. cancelButtonText: "取消",
  1262. type: "warning"
  1263. }).then(() => {
  1264. this.exportLoading = true;
  1265. return myExportCourseWatchLog(queryParams);
  1266. }).then(response => {
  1267. this.download(response.msg);
  1268. this.exportLoading = false;
  1269. }).catch(() => {
  1270. });
  1271. },
  1272. openAnswerLogFun(row) {
  1273. this.openAnswerLog = true;
  1274. this.answerLogQueryParams.watchLogId = row.logId;
  1275. this.answerLogList();
  1276. },
  1277. answerLogList() {
  1278. this.loadingAnswerLog = true;
  1279. myListLogs(this.answerLogQueryParams).then(e => {
  1280. this.answerLogsList = e.rows;
  1281. this.answerLogTotal = e.total;
  1282. this.loadingAnswerLog = false;
  1283. })
  1284. },
  1285. openRedLogFun(row) {
  1286. this.openRedLog = true;
  1287. this.redLogQueryParams.watchLogId = row.logId;
  1288. this.redLogList();
  1289. },
  1290. redLogList() {
  1291. this.loadingRedLog = true;
  1292. console.info("-----watch",this.redLogQueryParams)
  1293. myListCourseRedPacketLog(this.redLogQueryParams).then(e => {
  1294. this.redLogsList = e.rows;
  1295. this.redLogTotal = e.total;
  1296. this.loadingRedLog = false;
  1297. })
  1298. },
  1299. addUserTag(){
  1300. if(this.ids==null||this.ids==""){
  1301. return this.$message('请选择需要添加标签的客户');
  1302. }
  1303. this.getPageListTagGroup();
  1304. setTimeout(() => {
  1305. for (let i = 0; i < this.tagGroupList.length; i++) {
  1306. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  1307. this.tagGroupList[i].tag[x].isSelected=false;
  1308. }
  1309. }
  1310. }, 200);
  1311. this.tagOpen = true;
  1312. },
  1313. delUserTag(){
  1314. if(this.ids==null||this.ids==""){
  1315. return this.$message('请选择需要移除标签的客户');
  1316. }
  1317. this.getPageListTagGroup();
  1318. setTimeout(() => {
  1319. for (let i = 0; i < this.tagGroupList.length; i++) {
  1320. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  1321. this.tagGroupList[i].tag[x].isSelected=false;
  1322. }
  1323. }
  1324. }, 200);
  1325. this.tagDelOpen = true;
  1326. },
  1327. getPageListTagGroup(){
  1328. this.queryTagParams.corpId=this.queryParams.corpId
  1329. allListTagGroup(this.queryTagParams).then(response => {
  1330. this.tagGroupList = response.rows;
  1331. this.tagTotal = response.total;
  1332. });
  1333. },
  1334. tagSelection(row){
  1335. row.isSelected= !row.isSelected;
  1336. this.$forceUpdate();
  1337. },
  1338. handleSearchTags(name){
  1339. if (!name){
  1340. return this.$message.error("请输入要搜索的标签")
  1341. }
  1342. this.queryTagParams.name=name;
  1343. this.queryTagParams.corpId=this.queryParams.corpId;
  1344. searchTags(this.queryTagParams).then(response => {
  1345. this.tagGroupList = response.rows;
  1346. this.tagTotal = response.total;
  1347. });
  1348. // searchTags({name:name,corpId:this.queryParams.corpId}).then(response => {
  1349. // this.tagGroupList = response.rows;
  1350. // });
  1351. },
  1352. cancelSearchTags(){
  1353. this.resetSearchQueryTag()
  1354. this.getPageListTagGroup();
  1355. },
  1356. resetSearchQueryTag(){
  1357. this.queryTagParams= {
  1358. pageNum: 1,
  1359. pageSize: 5,
  1360. total:0,
  1361. name:null,
  1362. };
  1363. },
  1364. addTagSubmitForm(){
  1365. for (let i = 0; i < this.tagGroupList.length; i++) {
  1366. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  1367. if(this.tagGroupList[i].tag[x].isSelected==true){
  1368. this.addTagFormByWatch.tagIds.push(this.tagGroupList[i].tag[x].tagId)
  1369. }
  1370. }
  1371. }
  1372. if(this.addTagFormByWatch.tagIds==[]||this.addTagFormByWatch.tagIds==null||this.addTagFormByWatch.tagIds==""){
  1373. return this.$message('请选择标签');
  1374. }
  1375. this.addTagFormByWatch.logIds=this.ids;
  1376. let loadingRock = this.$loading({
  1377. lock: true,
  1378. text: '正在执行中请稍后~~请不要刷新页面!!',
  1379. spinner: 'el-icon-loading',
  1380. background: 'rgba(0, 0, 0, 0.7)'
  1381. });
  1382. addTagByWatch(this.addTagFormByWatch).then(response => {
  1383. // this.msgSuccess(response.msg);
  1384. this.resultMessage = response.msg;
  1385. this.resultDialogVisible = true; // 显示弹窗
  1386. this.resultTitle = '批量添加标签结果';
  1387. this.tagOpen = false;
  1388. loadingRock.close();
  1389. this.addTagFormByWatch={
  1390. logIds:[],
  1391. tagIds:[]
  1392. };
  1393. this.getList()
  1394. }).finally(res=>{
  1395. loadingRock.close();
  1396. });
  1397. },
  1398. tagDelSubmitForm(){
  1399. for (let i = 0; i < this.tagGroupList.length; i++) {
  1400. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  1401. if(this.tagGroupList[i].tag[x].isSelected==true){
  1402. this.addTagFormByWatch.tagIds.push(this.tagGroupList[i].tag[x].tagId)
  1403. }
  1404. }
  1405. }
  1406. if(this.addTagFormByWatch.tagIds==[]||this.addTagFormByWatch.tagIds==null||this.addTagFormByWatch.tagIds==""){
  1407. return this.$message('请选择标签');
  1408. }
  1409. this.addTagFormByWatch.corpId=this.queryParams.corpId
  1410. this.addTagFormByWatch.logIds=this.ids;
  1411. let loadingRock = this.$loading({
  1412. lock: true,
  1413. text: '正在执行中请稍后~~请不要刷新页面!!',
  1414. spinner: 'el-icon-loading',
  1415. background: 'rgba(0, 0, 0, 0.7)'
  1416. });
  1417. delTagByWatch(this.addTagFormByWatch).then(response => {
  1418. // this.msgSuccess(response.msg);
  1419. this.resultMessage = response.msg;
  1420. this.resultDialogVisible = true; // 显示弹窗
  1421. this.resultTitle = '批量移除标签结果';
  1422. this.tagDelOpen = false;
  1423. loadingRock.close();
  1424. this.addTagFormByWatch={
  1425. userIds:[],
  1426. tagIds:[]
  1427. };
  1428. this.getList()
  1429. }).finally(res=>{
  1430. loadingRock.close();
  1431. });
  1432. },
  1433. addTagCancel() {
  1434. this.tagOpen = false;
  1435. this.addTagFormByWatch={
  1436. logIds:[],
  1437. tagIds:[]
  1438. };
  1439. },
  1440. DelTagCancel() {
  1441. this.tagDelOpen = false;
  1442. this.addTagFormByWatch={
  1443. logIds:[],
  1444. tagIds:[]
  1445. };
  1446. },
  1447. /**
  1448. * 异步查询SOP列表
  1449. * @param {string} queryString - 查询字符串
  1450. * @param {function} callback - 回调函数
  1451. */
  1452. querySopAsync(queryString, callback) {
  1453. if (!queryString) {
  1454. callback([]);
  1455. return;
  1456. }
  1457. infoSop({ name: queryString }).then(response => {
  1458. if (response && response.rows) {
  1459. const suggestions = response.rows.map(item => ({
  1460. value: item.name,
  1461. id: item.id,
  1462. name: item.name
  1463. }));
  1464. callback(suggestions);
  1465. } else {
  1466. callback([]);
  1467. }
  1468. }).catch(error => {
  1469. console.error('通过sop查询失败:', error);
  1470. callback([]);
  1471. });
  1472. },
  1473. /**
  1474. * 选择SOP
  1475. * @param {object} item - 选中的SOP项
  1476. */
  1477. handleSopSelect(item) {
  1478. this.selectedSopId = item.id;
  1479. this.queryParams.sopId = item.id;
  1480. this.sopSearchText = item.name;
  1481. },
  1482. /**
  1483. * 清空SOP选择
  1484. */
  1485. handleSopClear() {
  1486. this.selectedSopId = null;
  1487. this.queryParams.sopId = null;
  1488. this.sopSearchText = '';
  1489. },
  1490. handleBatchUpdateNotesFilter() {
  1491. this.notesOpen.open = true;
  1492. this.notesOpen.filter = true;
  1493. },
  1494. handleBatchUpdateNotes() {
  1495. if (this.ids == null || this.ids == "") {
  1496. return this.$message('请选择需要添加备注的客户');
  1497. }
  1498. this.notesOpen.open = true;
  1499. this.notesOpen.filter = false;
  1500. },
  1501. notesCancel(){
  1502. this.notesOpen={
  1503. open: false,
  1504. notes: null,
  1505. type: 1,
  1506. nameType:3,
  1507. }
  1508. },
  1509. notesSubmitForm() {
  1510. if (this.notesOpen.notes == null || this.notesOpen.notes == "") {
  1511. return this.$message.error("请输入备注内容");
  1512. }
  1513. // let loadingRock = this.$loading({
  1514. // lock: true,
  1515. // text: '正在执行中请稍后~~请不要刷新页面!!',
  1516. // spinner: 'el-icon-loading',
  1517. // background: 'rgba(0, 0, 0, 0.7)'
  1518. // });
  1519. let obj = JSON.parse(JSON.stringify(this.queryParams))
  1520. console.log(obj);
  1521. if(obj.tagIds !== null && obj.tagIds !== undefined && obj.tagIds !== ''){
  1522. obj.tagIds = obj.tagIds.split(",");
  1523. }
  1524. batchUpdateExternalContactNotesByWatchLog({
  1525. // addType: 0,
  1526. watchLogIds: this.ids,
  1527. notes: this.notesOpen.notes,
  1528. type: this.notesOpen.type,
  1529. nameType: this.notesOpen.nameType,
  1530. filter: this.notesOpen.filter,
  1531. watchLogParam: obj,
  1532. fromMyList:1
  1533. }).then(res => {
  1534. this.resultMessage = res.msg;
  1535. this.$message.success("正在执行中...");
  1536. // this.resultDialogVisible = true; // 显示弹窗
  1537. // this.resultTitle = '批量修改备注结果';
  1538. }).finally(res => {
  1539. this.getList();
  1540. // loadingRock.close();
  1541. this.notesCancel();
  1542. })
  1543. },
  1544. }
  1545. };
  1546. </script>
  1547. <style scoped>
  1548. /* CSS 样式 */
  1549. .tag-container {
  1550. display: flex;
  1551. flex-wrap: wrap; /* 超出宽度时自动换行 */
  1552. gap: 8px; /* 设置标签之间的间距 */
  1553. }
  1554. .name-background {
  1555. display: inline-block;
  1556. background-color: #abece6; /* 背景颜色 */
  1557. padding: 4px 8px; /* 调整内边距,让背景包裹文字 */
  1558. border-radius: 4px; /* 可选:设置圆角 */
  1559. }
  1560. /* CSS 样式 */
  1561. .tag-container {
  1562. display: flex;
  1563. flex-wrap: wrap; /* 超出宽度时自动换行 */
  1564. gap: 8px; /* 设置标签之间的间距 */
  1565. }
  1566. .name-background {
  1567. display: inline-block;
  1568. background-color: #abece6; /* 背景颜色 */
  1569. padding: 4px 8px; /* 调整内边距,让背景包裹文字 */
  1570. border-radius: 4px; /* 可选:设置圆角 */
  1571. }
  1572. .tag-box {
  1573. padding: 8px 12px;
  1574. border: 1px solid #989797;
  1575. border-radius: 4px;
  1576. cursor: pointer;
  1577. display: inline-block;
  1578. }
  1579. .tag-selected {
  1580. background-color: #00bc98;
  1581. color: #fff;
  1582. border-color: #00bc98;
  1583. }
  1584. .el-tag + .el-tag {
  1585. margin-left: 10px;
  1586. }
  1587. .button-new-tag {
  1588. margin-left: 10px;
  1589. height: 32px;
  1590. line-height: 30px;
  1591. padding-top: 0;
  1592. padding-bottom: 0;
  1593. }
  1594. .input-new-tag {
  1595. width: 90px;
  1596. margin-left: 10px;
  1597. vertical-align: bottom;
  1598. }
  1599. /* 新增的滚动容器样式(不影响原有样式) */
  1600. .scroll-wrapper {
  1601. max-height: 130px; /* 大约三行的高度 */
  1602. overflow-y: auto; /* 垂直滚动 */
  1603. padding-right: 5px; /* 为滚动条留出空间 */
  1604. }
  1605. /* 美化滚动条(可选) */
  1606. .scroll-wrapper::-webkit-scrollbar {
  1607. width: 6px;
  1608. }
  1609. .scroll-wrapper::-webkit-scrollbar-thumb {
  1610. background: rgba(0, 0, 0, 0.2);
  1611. border-radius: 3px;
  1612. }
  1613. /* SOP搜索框样式 */
  1614. .sop-item {
  1615. display: flex;
  1616. align-items: center;
  1617. }
  1618. .sop-name {
  1619. font-size: 14px;
  1620. color: #606266;
  1621. }
  1622. </style>