index.vue 51 KB

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