index.vue 53 KB

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