appWatchLog.vue 60 KB

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