watchLog.vue 51 KB

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