index.vue 58 KB

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