index.vue 57 KB

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