watchLog.vue 56 KB

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