watchLog.vue 55 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750
  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, myListCourseRedPacketLog, videoList} 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. courseList().then(response => {
  828. this.courseLists = response.list;
  829. });
  830. this.getDicts("sys_course_watch_log_type_new").then(response => {
  831. this.logTypeOptions = response.data;
  832. });
  833. this.getDicts("sys_company_or").then(response => {
  834. this.sysCompanyOr = response.data;
  835. });
  836. this.getDicts("sys_course_project").then(response => {
  837. this.projectOptions = response.data;
  838. });
  839. // 设置默认当天时间 xgb 防止频繁查询大量数据
  840. this.setToday();
  841. this.getList();
  842. getMyQwUserList().then(response => {
  843. this.myQwUserList = response.data;
  844. });
  845. },
  846. methods: {
  847. setToday(){
  848. const today = new Date();
  849. const todayStart = new Date(today);
  850. todayStart.setHours(0, 0, 0, 0);
  851. const todayEnd = new Date(today);
  852. todayEnd.setHours(23, 59, 59, 999);
  853. this.createTimeText = [this.formatDate(todayStart), this.formatDate(todayEnd)];
  854. this.queryParams.sTime = this.formatDate(todayStart);
  855. this.queryParams.eTime = this.formatDate(todayEnd);
  856. },
  857. handleSendTypeChange() {
  858. // 重置相关参数
  859. this.queryParams.qwUserId = null;
  860. this.queryParams.qwExternalContactId = null;
  861. this.queryParams.userId = null;
  862. this.queryParams.nickName = null;
  863. this.queryParams.externalUserName = null;
  864. this.queryParams.corpId = null;
  865. this.queryParams.project = null;
  866. this.queryParams.courseId = null;
  867. this.queryParams.videoId = null;
  868. // 重置选择
  869. this.ids = [];
  870. this.courseWatchLogList = []; // 清空表格数据
  871. // 重置分页
  872. this.queryParams.pageNum = 1;
  873. // 强制重新渲染表格
  874. this.tableKey += 1;
  875. this.getList();
  876. },
  877. // 重置日历组件
  878. resetCalendars() {
  879. this.scheduleTime = [];
  880. this.createTime = [];
  881. this.updateTime = [];
  882. this.qecCreateTime = [];
  883. this.periodTime = [];
  884. this.scheduleTimeText = [];
  885. this.createTimeText = [];
  886. this.updateTimeText = [];
  887. this.qecCreateTimeText = [];
  888. this.periodTimeText = [];
  889. // 强制刷新日历组件
  890. this.scheduleCalendarKey++;
  891. this.createCalendarKey++;
  892. this.updateCalendarKey++;
  893. this.qecCalendarKey++;
  894. this.periodTimeKey++;
  895. },
  896. formatDateRange(dates) {
  897. if (!dates || dates.length < 2) return '';
  898. return dates.map(date => date.format('YYYY-MM-DD')).join(' ~ ');
  899. },
  900. courseChange(row) {
  901. this.queryParams.videoId = null;
  902. if (row === '') {
  903. this.videoList = [];
  904. return
  905. }
  906. videoList(row).then(response => {
  907. this.videoList = response.list
  908. });
  909. },
  910. updateQwuser() {
  911. for (const user of this.myQwUserList) {
  912. if (user.dictValue == this.queryParams.qwUserId) {
  913. this.queryParams.corpId = user.corpId;
  914. break;
  915. }
  916. }
  917. this.getList();
  918. },
  919. handleClickX(tab) {
  920. this.activeName=tab.name;
  921. if(tab.name=="00"){
  922. this.queryParams.logType=null;
  923. }else{
  924. this.queryParams.logType=tab.name;
  925. }
  926. this.getList()
  927. },
  928. // 营期时间
  929. handleScheduleTimeChange(scheduleTime) {
  930. if (scheduleTime && scheduleTime.length >= 2) {
  931. if(!this.checkDateRangeLimit(scheduleTime)){
  932. this.scheduleTimeText = null;
  933. this.queryParams.scheduleStartTime=null;
  934. this.queryParams.scheduleStartTime=null;
  935. return;
  936. }
  937. // this.scheduleTimeText = this.formatDateRange(scheduleTime);
  938. this.queryParams.scheduleStartTime = scheduleTime[0] || null;
  939. this.queryParams.scheduleEndTime = scheduleTime[1] || null;
  940. } else {
  941. this.scheduleTimeText = [];
  942. this.queryParams.scheduleStartTime = null;
  943. this.queryParams.scheduleEndTime = null;
  944. }
  945. },
  946. checkDateRangeLimit(dateRange) {
  947. if (dateRange && dateRange.length >= 2) {
  948. const startDate = new Date(dateRange[0]);
  949. const endDate = new Date(dateRange[1]);
  950. // 设置时间为当天开始,避免时间部分影响计算
  951. startDate.setHours(0, 0, 0, 0);
  952. endDate.setHours(0, 0, 0, 0);
  953. const timeDiff = Math.abs(endDate - startDate);
  954. const diffDays = Math.ceil(timeDiff / (1000 * 60 * 60 * 24));
  955. if (diffDays > 31) { // maxDays-1 因为包含起始日
  956. this.$message.warning('时间区间不能超过一个月');
  957. return false;
  958. }
  959. }
  960. return true;
  961. },
  962. // 创建时间
  963. createChange(createTime) {
  964. if (createTime && createTime.length >= 2) {
  965. if(!this.checkDateRangeLimit(createTime)){
  966. this.createTimeText = null;
  967. this.queryParams.sTime=null;
  968. this.queryParams.eTime=null;
  969. return;
  970. }
  971. // this.createTimeText = this.formatDateRange(createTime);
  972. this.queryParams.sTime = this.formatDate(createTime[0]) || null;
  973. this.queryParams.eTime = this.formatDate(createTime[1]) || null;
  974. } else {
  975. this.createTimeText = [];
  976. this.queryParams.sTime = null;
  977. this.queryParams.eTime = null;
  978. }
  979. },
  980. // 更新时间
  981. updateChange(updateTime) {
  982. if (updateTime && updateTime.length >= 2) {
  983. if(!this.checkDateRangeLimit(updateTime)){
  984. this.updateTimeText = null;
  985. this.queryParams.upSTime=null;
  986. this.queryParams.upETime=null;
  987. return;
  988. }
  989. // this.updateTimeText = this.formatDateRange(updateTime);
  990. this.queryParams.upSTime = updateTime[0] || null;
  991. this.queryParams.upETime = updateTime[1] || null;
  992. } else {
  993. this.updateTimeText = [];
  994. this.queryParams.upSTime = null;
  995. this.queryParams.upETime = null;
  996. }
  997. },
  998. // 进线时间
  999. qecCreateTimeChange(qecCreateTime) {
  1000. if (qecCreateTime && qecCreateTime.length >= 2) {
  1001. // 检查选择的日期范围是否超过7天(包括起始和结束日期)
  1002. const startDate = new Date(qecCreateTime[0]);
  1003. const endDate = new Date(qecCreateTime[1]);
  1004. // 设置时间为当天开始,避免时间部分影响计算
  1005. startDate.setHours(0, 0, 0, 0);
  1006. endDate.setHours(0, 0, 0, 0);
  1007. const timeDiff = Math.abs(endDate - startDate);
  1008. const diffDays = Math.ceil(timeDiff / (1000 * 60 * 60 * 24));
  1009. // 如果超过6天的范围(总共7天,包括起始日)
  1010. if (diffDays > 6) {
  1011. this.$message.error('进线时间选择范围不能超过7天');
  1012. // 清空选择
  1013. this.qecCreateTime = [];
  1014. this.qecCreateTimeText = [];
  1015. this.queryParams.qecSTime = null;
  1016. this.queryParams.qecETime = null;
  1017. this.qecCalendarKey++;
  1018. return;
  1019. }
  1020. this.qecCreateTimeText = this.formatDateRange(qecCreateTime);
  1021. this.queryParams.qecSTime = qecCreateTime[0] || null;
  1022. this.queryParams.qecETime = qecCreateTime[1] || null;
  1023. } else {
  1024. this.qecCreateTimeText = [];
  1025. this.queryParams.qecSTime = null;
  1026. this.queryParams.qecETime = null;
  1027. }
  1028. },
  1029. //营期课程时间
  1030. qecPeriodTimeChange(periodTime){
  1031. if (periodTime && periodTime.length >= 2) {
  1032. // 检查选择的日期范围是否超过7天(包括起始和结束日期)
  1033. const startDate = new Date(periodTime[0]);
  1034. const endDate = new Date(periodTime[1]);
  1035. // 设置时间为当天开始,避免时间部分影响计算
  1036. startDate.setHours(0, 0, 0, 0);
  1037. endDate.setHours(0, 0, 0, 0);
  1038. const timeDiff = Math.abs(endDate - startDate);
  1039. const diffDays = Math.ceil(timeDiff / (1000 * 60 * 60 * 24));
  1040. // 如果超过6天的范围(总共7天,包括起始日)
  1041. if (diffDays > 13) {
  1042. this.$message.error('时间选择范围不能超过14天');
  1043. // 清空选择
  1044. this.periodTime = [];
  1045. this.periodTimeText = [];
  1046. this.queryParams.periodSTime = null;
  1047. this.queryParams.periodETime = null;
  1048. this.periodTimeKey++;
  1049. return;
  1050. }
  1051. this.queryParams.periodSTime = this.formatDate(periodTime[0]) || null;
  1052. this.queryParams.periodETime = this.formatDate(periodTime[1]) || null;
  1053. } else {
  1054. this.periodTimeText = '';
  1055. this.queryParams.periodSTime = null;
  1056. this.queryParams.periodETime = null;
  1057. }
  1058. },
  1059. formatDate(date) {
  1060. if (!date) return ''
  1061. // 确保 date 是 Date 对象
  1062. let dateObj = date
  1063. if (typeof date === 'string') {
  1064. dateObj = new Date(date)
  1065. }
  1066. // 如果转换失败,返回空字符串
  1067. if (!(dateObj instanceof Date) || isNaN(dateObj.getTime())) {
  1068. return ''
  1069. }
  1070. // 使用更安全的格式化方法
  1071. const year = dateObj.getFullYear()
  1072. const month = String(dateObj.getMonth() + 1).padStart(2, '0')
  1073. const day = String(dateObj.getDate()).padStart(2, '0')
  1074. const hours = String(dateObj.getHours()).padStart(2, '0')
  1075. const minutes = String(dateObj.getMinutes()).padStart(2, '0')
  1076. const seconds = String(dateObj.getSeconds()).padStart(2, '0')
  1077. return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
  1078. },
  1079. /** 查询短链课程看课记录列表 */
  1080. getList() {
  1081. // xgb 看课数据量太大必须限制时间if (this.isEmptyArray(this.createTimeText) &&
  1082. if (this.isEmptyArray(this.createTimeText) &&
  1083. this.isEmptyArray(this.updateTimeText) &&
  1084. this.isEmptyArray(this.scheduleTimeText)) {
  1085. this.$message.warning('请选择创建时间或营期时间或最新更新时间');
  1086. return;
  1087. }
  1088. this.loading = true;
  1089. let param = JSON.parse(JSON.stringify(this.queryParams));
  1090. if (param.logType == "10") {
  1091. param.logType = null;
  1092. }
  1093. myListCourseWatchLog(param).then(response => {
  1094. this.courseWatchLogList = response.rows;
  1095. this.total = response.total;
  1096. this.loading = false;
  1097. }).catch(() => {
  1098. this.loading = false;
  1099. });
  1100. },
  1101. // 取消按钮
  1102. cancel() {
  1103. this.open = false;
  1104. this.reset();
  1105. },
  1106. // 表单重置
  1107. reset() {
  1108. this.form = {
  1109. logId: null,
  1110. userId: null,
  1111. videoId: null,
  1112. logType: null,
  1113. createTime: null,
  1114. updateTime: null,
  1115. qwExternalContactId: null,
  1116. externalUserName:null,
  1117. duration: null,
  1118. qwUserId: null,
  1119. companyUserId: null,
  1120. companyId: null,
  1121. courseId: null,
  1122. sTime:null,
  1123. eTime:null,
  1124. upSTime:null,
  1125. upETime:null,
  1126. qecSTime:null,
  1127. qecETime:null,
  1128. scheduleStartTime: null,
  1129. scheduleEndTime: null,
  1130. };
  1131. // 统一重置日历组件
  1132. this.resetCalendars();
  1133. this.resetForm("form");
  1134. },
  1135. /** 搜索按钮操作 */
  1136. handleQuery() {
  1137. this.queryParams.pageNum = 1;
  1138. this.getList();
  1139. },
  1140. /** 重置按钮操作 */
  1141. resetQuery() {
  1142. this.resetForm("queryForm");
  1143. this.queryParams.sTime = null;
  1144. this.queryParams.eTime = null;
  1145. this.queryParams.project = null;
  1146. this.queryParams.upSTime = null;
  1147. this.queryParams.upETime = null;
  1148. this.queryParams.qecSTime = null;
  1149. this.queryParams.qecETime = null;
  1150. this.queryParams.periodSTime = null;
  1151. this.queryParams.periodDTime = null;
  1152. this.queryParams.scheduleStartTime = null;
  1153. this.queryParams.scheduleEndTime = null;
  1154. this.queryParams.sopId = null; // 重置SOP ID
  1155. this.queryParams.isVip = null; // 重置 isVip 状态
  1156. this.queryParams.qwUserId = null; // 重置 qwUserId
  1157. this.queryParams.externalUserName=null;
  1158. // 重置SOP搜索
  1159. this.handleSopClear();
  1160. // 统一重置日历组件
  1161. this.resetCalendars();
  1162. this.setToday();
  1163. this.handleQuery();
  1164. },
  1165. // 多选框选中数据
  1166. handleSelectionChange(selection) {
  1167. this.ids = selection.map(item => item.logId)
  1168. this.single = selection.length !== 1
  1169. this.multiple = !selection.length
  1170. },
  1171. /** 新增按钮操作 */
  1172. handleAdd() {
  1173. this.reset();
  1174. this.open = true;
  1175. this.title = "添加短链课程看课记录";
  1176. },
  1177. /** 修改按钮操作 */
  1178. handleUpdate(row) {
  1179. this.reset();
  1180. const logId = row.logId || this.ids
  1181. getCourseWatchLog(logId).then(response => {
  1182. this.form = response.data;
  1183. this.open = true;
  1184. this.title = "修改短链课程看课记录";
  1185. });
  1186. },
  1187. /** 提交按钮 */
  1188. submitForm() {
  1189. this.$refs["form"].validate(valid => {
  1190. if (valid) {
  1191. if (this.form.logId != null) {
  1192. updateCourseWatchLog(this.form).then(response => {
  1193. this.msgSuccess("修改成功");
  1194. this.open = false;
  1195. this.getList();
  1196. });
  1197. } else {
  1198. addCourseWatchLog(this.form).then(response => {
  1199. this.msgSuccess("新增成功");
  1200. this.open = false;
  1201. this.getList();
  1202. });
  1203. }
  1204. }
  1205. });
  1206. },
  1207. /** 删除按钮操作 */
  1208. handleDelete(row) {
  1209. const logIds = row.logId || this.ids;
  1210. this.$confirm('是否确认删除短链课程看课记录编号为"' + logIds + '"的数据项?', "警告", {
  1211. confirmButtonText: "确定",
  1212. cancelButtonText: "取消",
  1213. type: "warning"
  1214. }).then(function () {
  1215. return delCourseWatchLog(logIds);
  1216. }).then(() => {
  1217. this.getList();
  1218. this.msgSuccess("删除成功");
  1219. }).catch(() => {
  1220. });
  1221. },
  1222. // 添加辅助方法
  1223. isEmptyArray(arr) {
  1224. return !arr || arr.length === 0;
  1225. },
  1226. /** 导出按钮操作 */
  1227. handleExport() {
  1228. // xgb 看课数据量太大必须限制时间
  1229. if (this.isEmptyArray(this.createTimeText) &&
  1230. this.isEmptyArray(this.updateTimeText) &&
  1231. this.isEmptyArray(this.scheduleTimeText)) {
  1232. this.$message.warning('请选择创建时间或营期时间或最新更新时间');
  1233. return;
  1234. }
  1235. const queryParams = this.queryParams;
  1236. this.$confirm('是否确认导出所有短链课程看课记录数据项?', "警告", {
  1237. confirmButtonText: "确定",
  1238. cancelButtonText: "取消",
  1239. type: "warning"
  1240. }).then(() => {
  1241. this.exportLoading = true;
  1242. return myExportCourseWatchLog(queryParams);
  1243. }).then(response => {
  1244. this.download(response.msg);
  1245. this.exportLoading = false;
  1246. }).catch(() => {
  1247. });
  1248. },
  1249. openAnswerLogFun(row) {
  1250. this.openAnswerLog = true;
  1251. this.answerLogQueryParams.watchLogId = row.logId;
  1252. this.answerLogList();
  1253. },
  1254. answerLogList() {
  1255. this.loadingAnswerLog = true;
  1256. myListLogs(this.answerLogQueryParams).then(e => {
  1257. this.answerLogsList = e.rows;
  1258. this.answerLogTotal = e.total;
  1259. this.loadingAnswerLog = false;
  1260. })
  1261. },
  1262. openRedLogFun(row) {
  1263. this.openRedLog = true;
  1264. this.redLogQueryParams.watchLogId = row.logId;
  1265. this.redLogList();
  1266. },
  1267. redLogList() {
  1268. this.loadingRedLog = true;
  1269. console.info("-----watch",this.redLogQueryParams)
  1270. myListCourseRedPacketLog(this.redLogQueryParams).then(e => {
  1271. this.redLogsList = e.rows;
  1272. this.redLogTotal = e.total;
  1273. this.loadingRedLog = false;
  1274. })
  1275. },
  1276. addUserTag(){
  1277. if(this.ids==null||this.ids==""){
  1278. return this.$message('请选择需要添加标签的客户');
  1279. }
  1280. this.getPageListTagGroup();
  1281. setTimeout(() => {
  1282. for (let i = 0; i < this.tagGroupList.length; i++) {
  1283. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  1284. this.tagGroupList[i].tag[x].isSelected=false;
  1285. }
  1286. }
  1287. }, 200);
  1288. this.tagOpen = true;
  1289. },
  1290. delUserTag(){
  1291. if(this.ids==null||this.ids==""){
  1292. return this.$message('请选择需要移除标签的客户');
  1293. }
  1294. this.getPageListTagGroup();
  1295. setTimeout(() => {
  1296. for (let i = 0; i < this.tagGroupList.length; i++) {
  1297. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  1298. this.tagGroupList[i].tag[x].isSelected=false;
  1299. }
  1300. }
  1301. }, 200);
  1302. this.tagDelOpen = true;
  1303. },
  1304. getPageListTagGroup(){
  1305. this.queryTagParams.corpId=this.queryParams.corpId
  1306. allListTagGroup(this.queryTagParams).then(response => {
  1307. this.tagGroupList = response.rows;
  1308. this.tagTotal = response.total;
  1309. });
  1310. },
  1311. tagSelection(row){
  1312. row.isSelected= !row.isSelected;
  1313. this.$forceUpdate();
  1314. },
  1315. handleSearchTags(name){
  1316. if (!name){
  1317. return this.$message.error("请输入要搜索的标签")
  1318. }
  1319. this.queryTagParams.name=name;
  1320. this.queryTagParams.corpId=this.queryParams.corpId;
  1321. searchTags(this.queryTagParams).then(response => {
  1322. this.tagGroupList = response.rows;
  1323. this.tagTotal = response.total;
  1324. });
  1325. // searchTags({name:name,corpId:this.queryParams.corpId}).then(response => {
  1326. // this.tagGroupList = response.rows;
  1327. // });
  1328. },
  1329. cancelSearchTags(){
  1330. this.resetSearchQueryTag()
  1331. this.getPageListTagGroup();
  1332. },
  1333. resetSearchQueryTag(){
  1334. this.queryTagParams= {
  1335. pageNum: 1,
  1336. pageSize: 5,
  1337. total:0,
  1338. name:null,
  1339. };
  1340. },
  1341. addTagSubmitForm(){
  1342. for (let i = 0; i < this.tagGroupList.length; i++) {
  1343. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  1344. if(this.tagGroupList[i].tag[x].isSelected==true){
  1345. this.addTagFormByWatch.tagIds.push(this.tagGroupList[i].tag[x].tagId)
  1346. }
  1347. }
  1348. }
  1349. if(this.addTagFormByWatch.tagIds==[]||this.addTagFormByWatch.tagIds==null||this.addTagFormByWatch.tagIds==""){
  1350. return this.$message('请选择标签');
  1351. }
  1352. this.addTagFormByWatch.logIds=this.ids;
  1353. let loadingRock = this.$loading({
  1354. lock: true,
  1355. text: '正在执行中请稍后~~请不要刷新页面!!',
  1356. spinner: 'el-icon-loading',
  1357. background: 'rgba(0, 0, 0, 0.7)'
  1358. });
  1359. addTagByWatch(this.addTagFormByWatch).then(response => {
  1360. // this.msgSuccess(response.msg);
  1361. this.resultMessage = response.msg;
  1362. this.resultDialogVisible = true; // 显示弹窗
  1363. this.resultTitle = '批量添加标签结果';
  1364. this.tagOpen = false;
  1365. loadingRock.close();
  1366. this.addTagFormByWatch={
  1367. logIds:[],
  1368. tagIds:[]
  1369. };
  1370. this.getList()
  1371. }).finally(res=>{
  1372. loadingRock.close();
  1373. });
  1374. },
  1375. tagDelSubmitForm(){
  1376. for (let i = 0; i < this.tagGroupList.length; i++) {
  1377. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  1378. if(this.tagGroupList[i].tag[x].isSelected==true){
  1379. this.addTagFormByWatch.tagIds.push(this.tagGroupList[i].tag[x].tagId)
  1380. }
  1381. }
  1382. }
  1383. if(this.addTagFormByWatch.tagIds==[]||this.addTagFormByWatch.tagIds==null||this.addTagFormByWatch.tagIds==""){
  1384. return this.$message('请选择标签');
  1385. }
  1386. this.addTagFormByWatch.corpId=this.queryParams.corpId
  1387. this.addTagFormByWatch.logIds=this.ids;
  1388. let loadingRock = this.$loading({
  1389. lock: true,
  1390. text: '正在执行中请稍后~~请不要刷新页面!!',
  1391. spinner: 'el-icon-loading',
  1392. background: 'rgba(0, 0, 0, 0.7)'
  1393. });
  1394. delTagByWatch(this.addTagFormByWatch).then(response => {
  1395. // this.msgSuccess(response.msg);
  1396. this.resultMessage = response.msg;
  1397. this.resultDialogVisible = true; // 显示弹窗
  1398. this.resultTitle = '批量移除标签结果';
  1399. this.tagDelOpen = false;
  1400. loadingRock.close();
  1401. this.addTagFormByWatch={
  1402. userIds:[],
  1403. tagIds:[]
  1404. };
  1405. this.getList()
  1406. }).finally(res=>{
  1407. loadingRock.close();
  1408. });
  1409. },
  1410. addTagCancel() {
  1411. this.tagOpen = false;
  1412. this.addTagFormByWatch={
  1413. logIds:[],
  1414. tagIds:[]
  1415. };
  1416. },
  1417. DelTagCancel() {
  1418. this.tagDelOpen = false;
  1419. this.addTagFormByWatch={
  1420. logIds:[],
  1421. tagIds:[]
  1422. };
  1423. },
  1424. /**
  1425. * 异步查询SOP列表
  1426. * @param {string} queryString - 查询字符串
  1427. * @param {function} callback - 回调函数
  1428. */
  1429. querySopAsync(queryString, callback) {
  1430. if (!queryString) {
  1431. callback([]);
  1432. return;
  1433. }
  1434. infoSop({ name: queryString }).then(response => {
  1435. if (response && response.rows) {
  1436. const suggestions = response.rows.map(item => ({
  1437. value: item.name,
  1438. id: item.id,
  1439. name: item.name
  1440. }));
  1441. callback(suggestions);
  1442. } else {
  1443. callback([]);
  1444. }
  1445. }).catch(error => {
  1446. console.error('通过sop查询失败:', error);
  1447. callback([]);
  1448. });
  1449. },
  1450. /**
  1451. * 选择SOP
  1452. * @param {object} item - 选中的SOP项
  1453. */
  1454. handleSopSelect(item) {
  1455. this.selectedSopId = item.id;
  1456. this.queryParams.sopId = item.id;
  1457. this.sopSearchText = item.name;
  1458. },
  1459. /**
  1460. * 清空SOP选择
  1461. */
  1462. handleSopClear() {
  1463. this.selectedSopId = null;
  1464. this.queryParams.sopId = null;
  1465. this.sopSearchText = '';
  1466. },
  1467. handleBatchUpdateNotesFilter() {
  1468. this.notesOpen.open = true;
  1469. this.notesOpen.filter = true;
  1470. },
  1471. handleBatchUpdateNotes() {
  1472. if (this.ids == null || this.ids == "") {
  1473. return this.$message('请选择需要添加备注的客户');
  1474. }
  1475. this.notesOpen.open = true;
  1476. this.notesOpen.filter = false;
  1477. },
  1478. notesCancel(){
  1479. this.notesOpen={
  1480. open: false,
  1481. notes: null,
  1482. type: 1,
  1483. nameType:3,
  1484. }
  1485. },
  1486. notesSubmitForm() {
  1487. if (this.notesOpen.notes == null || this.notesOpen.notes == "") {
  1488. return this.$message.error("请输入备注内容");
  1489. }
  1490. // let loadingRock = this.$loading({
  1491. // lock: true,
  1492. // text: '正在执行中请稍后~~请不要刷新页面!!',
  1493. // spinner: 'el-icon-loading',
  1494. // background: 'rgba(0, 0, 0, 0.7)'
  1495. // });
  1496. let obj = JSON.parse(JSON.stringify(this.queryParams))
  1497. console.log(obj);
  1498. if(obj.tagIds !== null && obj.tagIds !== undefined && obj.tagIds !== ''){
  1499. obj.tagIds = obj.tagIds.split(",");
  1500. }
  1501. batchUpdateExternalContactNotesByWatchLog({
  1502. // addType: 0,
  1503. watchLogIds: this.ids,
  1504. notes: this.notesOpen.notes,
  1505. type: this.notesOpen.type,
  1506. nameType: this.notesOpen.nameType,
  1507. filter: this.notesOpen.filter,
  1508. watchLogParam: obj,
  1509. fromMyList:1
  1510. }).then(res => {
  1511. this.resultMessage = res.msg;
  1512. this.$message.success("正在执行中...");
  1513. // this.resultDialogVisible = true; // 显示弹窗
  1514. // this.resultTitle = '批量修改备注结果';
  1515. }).finally(res => {
  1516. this.getList();
  1517. // loadingRock.close();
  1518. this.notesCancel();
  1519. })
  1520. },
  1521. }
  1522. };
  1523. </script>
  1524. <style scoped>
  1525. /* CSS 样式 */
  1526. .tag-container {
  1527. display: flex;
  1528. flex-wrap: wrap; /* 超出宽度时自动换行 */
  1529. gap: 8px; /* 设置标签之间的间距 */
  1530. }
  1531. .name-background {
  1532. display: inline-block;
  1533. background-color: #abece6; /* 背景颜色 */
  1534. padding: 4px 8px; /* 调整内边距,让背景包裹文字 */
  1535. border-radius: 4px; /* 可选:设置圆角 */
  1536. }
  1537. /* CSS 样式 */
  1538. .tag-container {
  1539. display: flex;
  1540. flex-wrap: wrap; /* 超出宽度时自动换行 */
  1541. gap: 8px; /* 设置标签之间的间距 */
  1542. }
  1543. .name-background {
  1544. display: inline-block;
  1545. background-color: #abece6; /* 背景颜色 */
  1546. padding: 4px 8px; /* 调整内边距,让背景包裹文字 */
  1547. border-radius: 4px; /* 可选:设置圆角 */
  1548. }
  1549. .tag-box {
  1550. padding: 8px 12px;
  1551. border: 1px solid #989797;
  1552. border-radius: 4px;
  1553. cursor: pointer;
  1554. display: inline-block;
  1555. }
  1556. .tag-selected {
  1557. background-color: #00bc98;
  1558. color: #fff;
  1559. border-color: #00bc98;
  1560. }
  1561. .el-tag + .el-tag {
  1562. margin-left: 10px;
  1563. }
  1564. .button-new-tag {
  1565. margin-left: 10px;
  1566. height: 32px;
  1567. line-height: 30px;
  1568. padding-top: 0;
  1569. padding-bottom: 0;
  1570. }
  1571. .input-new-tag {
  1572. width: 90px;
  1573. margin-left: 10px;
  1574. vertical-align: bottom;
  1575. }
  1576. /* 新增的滚动容器样式(不影响原有样式) */
  1577. .scroll-wrapper {
  1578. max-height: 130px; /* 大约三行的高度 */
  1579. overflow-y: auto; /* 垂直滚动 */
  1580. padding-right: 5px; /* 为滚动条留出空间 */
  1581. }
  1582. /* 美化滚动条(可选) */
  1583. .scroll-wrapper::-webkit-scrollbar {
  1584. width: 6px;
  1585. }
  1586. .scroll-wrapper::-webkit-scrollbar-thumb {
  1587. background: rgba(0, 0, 0, 0.2);
  1588. border-radius: 3px;
  1589. }
  1590. /* SOP搜索框样式 */
  1591. .sop-item {
  1592. display: flex;
  1593. align-items: center;
  1594. }
  1595. .sop-name {
  1596. font-size: 14px;
  1597. color: #606266;
  1598. }
  1599. </style>