index.vue 56 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px">
  4. <el-form-item label="看课方式" prop="sendType">
  5. <el-select v-model="queryParams.sendType" placeholder="选择看课方式" size="small" @change="handleSendTypeChange">
  6. <el-option
  7. v-for="dict in sendTypeOptions"
  8. :key="dict.dictValue"
  9. :label="dict.dictLabel"
  10. :value="dict.dictValue"
  11. />
  12. </el-select>
  13. </el-form-item>
  14. <!-- <el-form-item label="项目" prop="project">-->
  15. <!-- <el-select v-model="queryParams.project" placeholder="请选择项目" clearable size="small" >-->
  16. <!-- <el-option-->
  17. <!-- v-for="item in projectOptions"-->
  18. <!-- :key="item.dictValue"-->
  19. <!-- :label="item.dictLabel"-->
  20. <!-- :value="item.dictValue"-->
  21. <!-- />-->
  22. <!-- </el-select>-->
  23. <!-- </el-form-item>-->
  24. <el-form-item label="会员昵称" prop="nickName" v-if="queryParams.sendType == 1">
  25. <el-input
  26. v-model="queryParams.nickName"
  27. placeholder="请输入会员昵称"
  28. clearable
  29. size="small"
  30. @keyup.enter.native="handleQuery"
  31. />
  32. </el-form-item>
  33. <el-form-item label="会员id" prop="userId" v-if="queryParams.sendType == 1">
  34. <el-input
  35. v-model="queryParams.userId"
  36. placeholder="请输入会员昵称"
  37. clearable
  38. size="small"
  39. @keyup.enter.native="handleQuery"
  40. />
  41. </el-form-item>
  42. <el-form-item label="企微客户昵称" prop="nickName" v-if="queryParams.sendType == 2">
  43. <el-input
  44. v-model="queryParams.externalUserName"
  45. placeholder="请输入企微客户昵称"
  46. clearable
  47. size="small"
  48. @keyup.enter.native="handleQuery"
  49. />
  50. </el-form-item>
  51. <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" v-if="queryParams.companyUserId && (queryParams.sendType == 2)">
  103. <el-select v-model="queryParams.qwUserName"
  104. clearable filterable
  105. placeholder="请输入关键词"
  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="datetimerange"
  184. range-separator="至"
  185. start-placeholder="开始日期"
  186. end-placeholder="结束日期"
  187. value-format="yyyy-MM-dd HH:mm:ss"
  188. @change="createChange"
  189. :default-time="['00:00:00', '23:59:59']"
  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 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 class="tag-container">-->
  511. <!-- <a-->
  512. <!-- v-for="tagItem in item.tag"-->
  513. <!-- class="tag-box"-->
  514. <!-- @click="tagSelection(tagItem)"-->
  515. <!-- :class="{ 'tag-selected': tagItem.isSelected }"-->
  516. <!-- >-->
  517. <!-- {{ tagItem.name }}-->
  518. <!-- </a>-->
  519. <!-- </div>-->
  520. </div>
  521. </el-form>
  522. <pagination
  523. v-show="tagTotal>0"
  524. :total="tagTotal"
  525. :page.sync="queryTagParams.pageNum"
  526. :limit.sync="queryTagParams.pageSize"
  527. @pagination="getPageListTagGroup"
  528. />
  529. <div slot="footer" class="dialog-footer">
  530. <el-button type="primary" @click="addTagSubmitForm()">确 定</el-button>
  531. <el-button @click="addTagCancel">取 消</el-button>
  532. </div>
  533. </el-dialog>
  534. <el-dialog title="批量移除标签" :visible.sync="tagDelOpen" width="800px" append-to-body>
  535. <div>搜索标签:
  536. <el-input v-model="tagChange.tagName" placeholder="请输入标签名称" clearable size="small" style="width: 200px;margin-right: 10px" />
  537. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleSearchTags(tagChange.tagName)">搜索</el-button>
  538. <el-button type="primary" icon="el-icon-plus" size="mini" @click="cancelSearchTags">重置</el-button>
  539. </div>
  540. <el-form ref="form" :model="addTagFormByWatch" label-width="80px">
  541. <div v-for="item in tagGroupList" :key="item.id" >
  542. <div style="font-size: 20px;margin-top: 20px;margin-bottom: 20px;">
  543. <span class="name-background">{{ item.name }}</span>
  544. </div>
  545. <!-- 添加外层滚动容器 -->
  546. <div class="scroll-wrapper">
  547. <div class="tag-container">
  548. <a
  549. v-for="tagItem in item.tag"
  550. class="tag-box"
  551. @click="tagSelection(tagItem)"
  552. :class="{ 'tag-selected': tagItem.isSelected }"
  553. >
  554. {{ tagItem.name }}
  555. </a>
  556. </div>
  557. </div>
  558. </div>
  559. </el-form>
  560. <pagination
  561. v-show="tagTotal>0"
  562. :total="tagTotal"
  563. :page.sync="queryTagParams.pageNum"
  564. :limit.sync="queryTagParams.pageSize"
  565. @pagination="getPageListTagGroup"
  566. />
  567. <div slot="footer" class="dialog-footer">
  568. <el-button type="primary" @click="tagDelSubmitForm()">确 定</el-button>
  569. <el-button @click="DelTagCancel">取 消</el-button>
  570. </div>
  571. </el-dialog>
  572. <el-dialog
  573. :title="resultTitle"
  574. :visible.sync="resultDialogVisible"
  575. width="50%"
  576. custom-class="feedback-dialog"
  577. >
  578. <pre style="white-space: pre-wrap; font-family: inherit;">{{ resultMessage }}</pre>
  579. <span slot="footer" class="dialog-footer">
  580. <el-button @click="resultDialogVisible = false">关闭</el-button>
  581. </span>
  582. </el-dialog>
  583. </div>
  584. </template>
  585. <script>
  586. import { listCourseWatchLog, getCourseWatchLog, delCourseWatchLog, addCourseWatchLog, updateCourseWatchLog, exportCourseWatchLog } from "@/api/course/courseWatchLog";
  587. import {courseList, listCourseRedPacketLog, videoList} from '@/api/course/courseRedPacketLog'
  588. import {listLogs} from "@/api/course/courseAnswerlogs";
  589. import {allListTagGroup} from "../../../api/qw/tagGroup";
  590. import {searchTags} from "../../../api/qw/tag";
  591. import {addTagByWatch, delTagByWatch} from "../../../api/qw/externalContact";
  592. import Vue from 'vue'
  593. import Calendar from 'vue-mobile-calendar'
  594. import {infoSop} from "@/api/qw/sop";
  595. import {getCompanyUserListLikeName} from "../../../api/company/companyUser";
  596. import {getQwList} from "@/api/qw/qwUser";
  597. Vue.use(Calendar)
  598. export default {
  599. name: "CourseWatchLog",
  600. data() {
  601. return {
  602. companyUserFirstLoad: true, // 首次加载标志
  603. qwUserFirstLoad: true, // 首次加载标志
  604. companyUserDropdownVisible: false, // 下拉框显示状态
  605. qwUserDropdownVisible: false, // 下拉框显示状态
  606. companyName:process.env.VUE_APP_COURSE_COMPANY_NAME,
  607. // 日历 key 控制刷新
  608. scheduleCalendarKey: 0,
  609. createCalendarKey: 0,
  610. updateCalendarKey: 0,
  611. qecCalendarKey: 0,
  612. periodTimeKey: 0,
  613. createTimeText: '',
  614. scheduleTimeText: '', // 新增
  615. updateTimeText: '', // 新增
  616. qecCreateTimeText: '', // 新增
  617. periodTimeText: '', // 营期课程时间
  618. scheduleTime: [], // 改为数组
  619. createTime: [], // 改为数组
  620. updateTime: [], // 改为数组
  621. qecCreateTime: [], // 改为数组
  622. periodTime: [], // 改为数组
  623. // 控制日历显隐
  624. showScheduleCalendar: false,
  625. showCreateCalendar: false,
  626. showUpdateCalendar: false,
  627. showQecCalendar: false,
  628. resultDialogVisible: false,
  629. resultMessage: '',
  630. resultTitle:'',
  631. activeName:"2",
  632. pickerOptions: {
  633. disabledDate(time) {
  634. // 获取13天前的日期(加上今天就是14天)
  635. const sixDaysAgo = new Date();
  636. sixDaysAgo.setDate(sixDaysAgo.getDate() - 13);
  637. sixDaysAgo.setHours(0, 0, 0, 0);
  638. // 获取明天的日期(不包括今天)
  639. const tomorrow = new Date();
  640. tomorrow.setDate(tomorrow.getDate() + 1);
  641. tomorrow.setHours(0, 0, 0, 0);
  642. return time.getTime() < sixDaysAgo.getTime() || time.getTime() >= tomorrow.getTime();
  643. }
  644. },
  645. courseLists:[],
  646. videoList:[],
  647. logTypeOptions:[],
  648. projectOptions:[],
  649. sendTypeOptions:[{
  650. dictLabel:"会员",dictValue:'1'
  651. },
  652. {
  653. dictLabel:"企微",dictValue:'2'
  654. }
  655. ],
  656. // 遮罩层
  657. loading: true,
  658. // 导出遮罩层
  659. exportLoading: false,
  660. // 选中数组
  661. ids: [],
  662. // 非单个禁用
  663. single: true,
  664. // 非多个禁用
  665. multiple: true,
  666. // 显示搜索条件
  667. showSearch: true,
  668. // 总条数
  669. total: 0,
  670. // 短链课程看课记录表格数据
  671. courseWatchLogList: [],
  672. // 弹出层标题
  673. title: "",
  674. // 是否显示弹出层
  675. open: false,
  676. tagOpen:false,
  677. //标签弹窗选择
  678. tagChange:{
  679. open:false,
  680. index:null,
  681. },
  682. addTagFormByWatch:{
  683. logId:[],
  684. tagIds:[]
  685. },
  686. tagGroupList: [],
  687. tagTotal:0,
  688. tagDelOpen:false,
  689. queryTagParams:{
  690. pageNum: 1,
  691. pageSize: 5,
  692. total:0,
  693. name:null,
  694. corpId:null,
  695. },
  696. //答题记录
  697. openAnswerLog: false,
  698. loadingAnswerLog: true,
  699. answerLogsList: [],
  700. answerLogTotal: 0,
  701. answerLogQueryParams: {
  702. pageNum: 1,
  703. pageSize: 10,
  704. },
  705. //红包记录
  706. openRedLog: false,
  707. loadingRedLog: true,
  708. redLogsList: [],
  709. redLogTotal: 0,
  710. redLogQueryParams: {
  711. pageNum: 1,
  712. pageSize: 10,
  713. },
  714. isVipList: [
  715. { dictLabel: '是', dictValue: 1 },
  716. { dictLabel: '否', dictValue: 0 }
  717. ],
  718. // SOP搜索相关
  719. sopSearchText: '', // SOP搜索框显示的文本
  720. selectedSopId: null, // 选中的SOP ID
  721. // 查询参数
  722. queryParams: {
  723. pageNum: 1,
  724. pageSize: 10,
  725. project: null,
  726. userId: null,
  727. nickName: null,
  728. videoId: null,
  729. logType: 2,
  730. qwExternalContactId: null,
  731. externalUserName:null,
  732. duration: null,
  733. qwUserId: null,
  734. qwUserName: null,
  735. companyUserId: null,
  736. companyId: null,
  737. courseId: null,
  738. sTime:null,
  739. eTime:null,
  740. upSTime:null,
  741. upETime:null,
  742. qecSTime:null,
  743. qecETime:null,
  744. periodSTime:null,
  745. periodETime:null,
  746. scheduleStartTime: null,
  747. scheduleEndTime: null,
  748. sendType:process.env.VUE_APP_COURSE_DEFAULT,
  749. isVip: null,
  750. sopId: null, // sopId
  751. },
  752. // 表单参数
  753. form: {},
  754. // 表单校验
  755. rules: {
  756. },
  757. // 员工选项列表
  758. companyUserOptionsParams: {
  759. name: undefined,
  760. hasNextPage: false,
  761. pageNum: 1,
  762. pageSize: 10
  763. },
  764. companyUserOptions: [],
  765. companyUserOptionsByAll: [],
  766. companyUserOptionsLoading: false,
  767. // 企微信息
  768. qwUserOptions: [],
  769. // 员工选项列表
  770. qwUserOptionsParams: {
  771. name: undefined,
  772. hasNextPage: false,
  773. pageNum: 1,
  774. pageSize: 10
  775. },
  776. qwUserOptionsLoading: false,
  777. };
  778. },
  779. created() {
  780. courseList().then(response => {
  781. this.courseLists = response.list;
  782. });
  783. this.getDicts("sys_course_watch_log_type_new").then(response => {
  784. this.logTypeOptions = response.data;
  785. });
  786. this.getDicts("sys_course_project").then(response => {
  787. this.projectOptions = response.data;
  788. });
  789. // 设置默认当天时间 xgb 防止频繁查询大量数据
  790. this.setToday();
  791. this.getList();
  792. this.getCompanyUserListLikeName(true);
  793. this.loading=false;
  794. },
  795. methods: {
  796. // 添加辅助方法
  797. isEmptyArray(arr) {
  798. return !arr || arr.length === 0;
  799. },
  800. setToday(){
  801. const today = new Date();
  802. const todayStart = new Date(today - 60*60*24*7*1000) ;
  803. todayStart.setHours(0, 0, 0, 0);
  804. const todayEnd = new Date(today);
  805. todayEnd.setHours(23, 59, 59, 999);
  806. this.createTimeText = [this.formatDate(todayStart), this.formatDate(todayEnd)];
  807. this.queryParams.sTime = this.formatDate(todayStart);
  808. this.queryParams.eTime = this.formatDate(todayEnd);
  809. },
  810. /**
  811. * 处理所属销售下拉框显示状态变化
  812. */
  813. handleCompanyUserDropdownVisible(visible) {
  814. this.companyUserDropdownVisible = visible;
  815. if (visible && this.companyUserFirstLoad) {
  816. // 首次展开下拉框时加载数据
  817. this.companyUserFirstLoad = false;
  818. this.loadCompanyUserOptions('');
  819. } else if (visible && this.companyUserOptions.length === 0) {
  820. // 下拉框显示但无数据时重新加载
  821. this.loadCompanyUserOptions('');
  822. }
  823. },
  824. /**
  825. * 处理所属企微下拉框显示状态变化
  826. */
  827. handleQwUserDropdownVisible(visible) {
  828. this.qwUserDropdownVisible = visible;
  829. if (visible && this.qwUserFirstLoad) {
  830. // 首次展开下拉框时加载数据
  831. this.qwUserFirstLoad = false;
  832. this.loadQwUserOptions('');
  833. } else if (visible && this.qwUserOptions.length === 0) {
  834. // 下拉框显示但无数据时重新加载
  835. this.loadQwUserOptions('');
  836. }
  837. },
  838. /**
  839. * 当销售被选择
  840. * 级联更新企微列表
  841. */
  842. handleCompanyUserChange(companyUserId){
  843. if (companyUserId) {
  844. // 清空当前企微选择
  845. this.queryParams.qwUserName = "";
  846. this.qwUserOptions = [];
  847. this.qwUserOptionsParams.pageNum = 1;
  848. // 重新加载企微列表,传入销售ID作为过滤条件
  849. this.getQwList();
  850. } else {
  851. // 清空销售时也清空企微
  852. this.queryParams.qwUserName = "";
  853. this.qwUserOptions = [];
  854. this.qwUserOptionsParams.pageNum = 1;
  855. }
  856. },
  857. /**
  858. * 根据名称模糊查询用户列表
  859. * @param query 参数
  860. */
  861. loadCompanyUserOptions(query) {
  862. this.companyUserOptions = [];
  863. this.companyUserOptionsParams.pageNum = 1
  864. this.companyUserOptionsParams.name = query
  865. this.companyUserOptionsLoading = true;
  866. this.getCompanyUserListLikeName()
  867. },
  868. /**
  869. * 根据条件查询企微列表
  870. * @param query 参数
  871. */
  872. loadQwUserOptions(query) {
  873. this.qwUserOptions = [];
  874. this.qwUserOptionsParams.pageNum = 1
  875. // 将搜索关键词设置到queryParams中
  876. this.queryParams.qwUserName = query
  877. this.qwUserOptionsLoading = true;
  878. this.getQwList()
  879. },
  880. /**
  881. * 加载更多员工选项
  882. */
  883. loadMoreCompanyUserOptions() {
  884. if (!this.companyUserOptionsParams.hasNextPage) {
  885. return;
  886. }
  887. this.companyUserOptionsParams.pageNum += 1
  888. this.getCompanyUserListLikeName()
  889. },
  890. /**
  891. * 获取员工列表
  892. */
  893. getCompanyUserListLikeName(isAll) {
  894. if (isAll){
  895. this.companyUserOptionsParams.pageSize = 200;
  896. getCompanyUserListLikeName(this.companyUserOptionsParams).then(response => {
  897. this.companyUserOptionsByAll = [...this.companyUserOptions, ...response.data.list]
  898. this.companyUserOptionsParams.hasNextPage = response.data.hasNextPage
  899. this.companyUserOptionsLoading = false;
  900. });
  901. }else {
  902. this.companyUserOptionsParams.pageSize = 10;
  903. getCompanyUserListLikeName(this.companyUserOptionsParams).then(response => {
  904. this.companyUserOptions = [...this.companyUserOptions, ...response.data.list]
  905. this.companyUserOptionsParams.hasNextPage = response.data.hasNextPage
  906. this.companyUserOptionsLoading = false;
  907. });
  908. }
  909. },
  910. getQwList() {
  911. const params = {
  912. name: this.qwUserOptionsParams.name,
  913. pageNum: this.qwUserOptionsParams.pageNum,
  914. pageSize: this.qwUserOptionsParams.pageSize,
  915. // 添加销售ID作为过滤条件
  916. companyUserId: this.queryParams.companyUserId || null,
  917. disableCompanyId: 1
  918. };
  919. console.log("企微参数", this.queryParams);
  920. getQwList(params).then(response => {
  921. if (this.qwUserOptionsParams.pageNum === 1) {
  922. this.qwUserOptions = response.rows || [];
  923. } else {
  924. this.qwUserOptions = [...this.qwUserOptions, ...(response.rows || [])];
  925. }
  926. this.qwUserOptionsParams.hasNextPage = response.rows && response.rows.length >= this.qwUserOptionsParams.pageSize;
  927. }).finally(()=>{
  928. this.qwUserOptionsLoading = false;
  929. })
  930. },
  931. /**
  932. * 加载更多员工选项
  933. */
  934. loadMoreQwUserOptions() {
  935. if (!this.qwUserOptionsParams.hasNextPage) {
  936. return;
  937. }
  938. this.qwUserOptionsParams.pageNum += 1
  939. this.getQwList()
  940. },
  941. // 重置日历组件
  942. resetCalendars() {
  943. this.scheduleTime = [];
  944. this.createTime = [];
  945. this.updateTime = [];
  946. this.qecCreateTime = [];
  947. this.periodTime = [];
  948. this.scheduleTimeText = [];
  949. this.createTimeText = [];
  950. this.updateTimeText = [];
  951. this.qecCreateTimeText = [];
  952. this.periodTimeText = [];
  953. // 强制刷新日历组件
  954. this.scheduleCalendarKey++;
  955. this.createCalendarKey++;
  956. this.updateCalendarKey++;
  957. this.qecCalendarKey++;
  958. this.periodTimeKey++;
  959. },
  960. formatDateRange(dates) {
  961. if (!dates || dates.length < 2) return '';
  962. return dates.map(date => date.format('YYYY-MM-DD')).join(' ~ ');
  963. },
  964. courseChange(row){
  965. this.queryParams.videoId=null;
  966. if(row === ''){
  967. this.videoList=[];
  968. return
  969. }
  970. videoList(row).then(response => {
  971. this.videoList=response.list
  972. });
  973. },
  974. checkDateRangeLimit(dateRange) {
  975. if (dateRange && dateRange.length >= 2) {
  976. const startDate = new Date(dateRange[0]);
  977. const endDate = new Date(dateRange[1]);
  978. // 设置时间为当天开始,避免时间部分影响计算
  979. startDate.setHours(0, 0, 0, 0);
  980. endDate.setHours(0, 0, 0, 0);
  981. const timeDiff = Math.abs(endDate - startDate);
  982. const diffDays = Math.ceil(timeDiff / (1000 * 60 * 60 * 24));
  983. if (diffDays > 31) { // maxDays-1 因为包含起始日
  984. this.$message.warning('时间区间不能超过一个月');
  985. return false;
  986. }
  987. }
  988. return true;
  989. },
  990. // 营期时间
  991. handleScheduleTimeChange(scheduleTime) {
  992. if (scheduleTime && scheduleTime.length >= 2) {
  993. if(!this.checkDateRangeLimit(scheduleTime)){
  994. this.scheduleTimeText = null;
  995. this.queryParams.scheduleStartTime=null;
  996. this.queryParams.scheduleStartTime=null;
  997. return;
  998. }
  999. // this.scheduleTimeText = this.formatDateRange(scheduleTime);
  1000. this.queryParams.scheduleStartTime = scheduleTime[0] || null;
  1001. this.queryParams.scheduleEndTime = scheduleTime[1] || null;
  1002. console.log(this.queryParams.scheduleStartTime)
  1003. console.log(this.queryParams.scheduleEndTime)
  1004. } else {
  1005. this.scheduleTimeText = '';
  1006. this.queryParams.scheduleStartTime = null;
  1007. this.queryParams.scheduleEndTime = null;
  1008. }
  1009. },
  1010. // 创建时间
  1011. createChange(createTime) {
  1012. if (createTime && createTime.length >= 2) {
  1013. if(!this.checkDateRangeLimit(createTime)){
  1014. this.createTimeText = null;
  1015. this.queryParams.sTime=null;
  1016. this.queryParams.eTime=null;
  1017. return;
  1018. }
  1019. // this.createTimeText = this.formatDateRange(createTime);
  1020. this.queryParams.sTime = this.formatDate(createTime[0]) || null;
  1021. this.queryParams.eTime = this.formatDate(createTime[1]) || null;
  1022. } else {
  1023. this.createTimeText = '';
  1024. this.queryParams.sTime = null;
  1025. this.queryParams.eTime = null;
  1026. }
  1027. },
  1028. // 更新时间
  1029. updateChange(updateTime) {
  1030. if (updateTime && updateTime.length >= 2) {
  1031. if(!this.checkDateRangeLimit(updateTime)){
  1032. this.updateTimeText = null;
  1033. this.queryParams.upSTime=null;
  1034. this.queryParams.upETime=null;
  1035. return;
  1036. }
  1037. // this.updateTimeText = this.formatDateRange(updateTime);
  1038. this.queryParams.upSTime = updateTime[0] || null;
  1039. this.queryParams.upETime = updateTime[1] || null;
  1040. } else {
  1041. this.updateTimeText = '';
  1042. this.queryParams.upSTime = null;
  1043. this.queryParams.upETime = null;
  1044. }
  1045. },
  1046. // 进线时间
  1047. qecCreateTimeChange(qecCreateTime) {
  1048. if (qecCreateTime && qecCreateTime.length >= 2) {
  1049. // 检查选择的日期范围是否超过7天(包括起始和结束日期)
  1050. const startDate = new Date(qecCreateTime[0]);
  1051. const endDate = new Date(qecCreateTime[1]);
  1052. // 设置时间为当天开始,避免时间部分影响计算
  1053. startDate.setHours(0, 0, 0, 0);
  1054. endDate.setHours(0, 0, 0, 0);
  1055. const timeDiff = Math.abs(endDate - startDate);
  1056. const diffDays = Math.ceil(timeDiff / (1000 * 60 * 60 * 24));
  1057. // 如果超过6天的范围(总共7天,包括起始日)
  1058. if (diffDays > 6) {
  1059. this.$message.error('进线时间选择范围不能超过7天');
  1060. // 清空选择
  1061. this.qecCreateTime = [];
  1062. this.qecCreateTimeText = [];
  1063. this.queryParams.qecSTime = null;
  1064. this.queryParams.qecETime = null;
  1065. this.qecCalendarKey++;
  1066. return;
  1067. }
  1068. // this.qecCreateTimeText = this.formatDateRange(qecCreateTime);
  1069. this.queryParams.qecSTime = qecCreateTime[0] || null;
  1070. this.queryParams.qecETime = qecCreateTime[1] || null;
  1071. console.log(this.queryParams.qecSTime);
  1072. console.log(this.queryParams.qecETime);
  1073. } else {
  1074. this.qecCreateTimeText = '';
  1075. this.queryParams.qecSTime = null;
  1076. this.queryParams.qecETime = null;
  1077. }
  1078. },
  1079. //营期课程时间
  1080. qecPeriodTimeChange(periodTime){
  1081. if (periodTime && periodTime.length >= 2) {
  1082. // 检查选择的日期范围是否超过7天(包括起始和结束日期)
  1083. const startDate = new Date(periodTime[0]);
  1084. const endDate = new Date(periodTime[1]);
  1085. // 设置时间为当天开始,避免时间部分影响计算
  1086. startDate.setHours(0, 0, 0, 0);
  1087. endDate.setHours(0, 0, 0, 0);
  1088. const timeDiff = Math.abs(endDate - startDate);
  1089. const diffDays = Math.ceil(timeDiff / (1000 * 60 * 60 * 24));
  1090. // 如果超过6天的范围(总共7天,包括起始日)
  1091. if (diffDays > 13) {
  1092. this.$message.error('时间选择范围不能超过14天');
  1093. // 清空选择
  1094. this.periodTime = [];
  1095. this.periodTimeText = [];
  1096. this.queryParams.periodSTime = null;
  1097. this.queryParams.periodETime = null;
  1098. this.periodTimeKey++;
  1099. return;
  1100. }
  1101. this.queryParams.periodSTime = this.formatDate(periodTime[0]) || null;
  1102. this.queryParams.periodETime = this.formatDate(periodTime[1]) || null;
  1103. } else {
  1104. this.periodTimeText = '';
  1105. this.queryParams.periodSTime = null;
  1106. this.queryParams.periodETime = null;
  1107. }
  1108. },
  1109. formatDate(date) {
  1110. if (!date) return ''
  1111. // 确保 date 是 Date 对象
  1112. let dateObj = date
  1113. if (typeof date === 'string') {
  1114. dateObj = new Date(date)
  1115. }
  1116. // 如果转换失败,返回空字符串
  1117. if (!(dateObj instanceof Date) || isNaN(dateObj.getTime())) {
  1118. return ''
  1119. }
  1120. // 使用更安全的格式化方法
  1121. const year = dateObj.getFullYear()
  1122. const month = String(dateObj.getMonth() + 1).padStart(2, '0')
  1123. const day = String(dateObj.getDate()).padStart(2, '0')
  1124. const hours = String(dateObj.getHours()).padStart(2, '0')
  1125. const minutes = String(dateObj.getMinutes()).padStart(2, '0')
  1126. const seconds = String(dateObj.getSeconds()).padStart(2, '0')
  1127. return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
  1128. },
  1129. handleClickX(tab,event){
  1130. this.activeName=tab.name;
  1131. if(tab.name=="00"){
  1132. this.queryParams.logType=null;
  1133. }else{
  1134. this.queryParams.logType=tab.name;
  1135. }
  1136. this.getList()
  1137. },
  1138. /** 查询短链课程看课记录列表 */
  1139. getList() {
  1140. // xgb 看课数据量太大必须限制时间
  1141. if (this.isEmptyArray(this.createTimeText) &&
  1142. this.isEmptyArray(this.updateTimeText) &&
  1143. this.isEmptyArray(this.scheduleTimeText)) {
  1144. this.$message.warning('请选择创建时间或营期时间或最新更新时间');
  1145. return;
  1146. }
  1147. this.loading = true;
  1148. if(this.queryParams.logType == "10"){
  1149. this.queryParams.logType = null;
  1150. }
  1151. listCourseWatchLog(this.queryParams).then(response => {
  1152. this.courseWatchLogList = response.rows;
  1153. this.total = response.total;
  1154. this.loading = false;
  1155. }).catch(() => {
  1156. this.loading = false;
  1157. });
  1158. },
  1159. // 取消按钮
  1160. cancel() {
  1161. this.open = false;
  1162. this.reset();
  1163. },
  1164. // 表单重置
  1165. reset() {
  1166. this.form = {
  1167. logId: null,
  1168. userId: null,
  1169. videoId: null,
  1170. logType: null,
  1171. createTime: null,
  1172. updateTime: null,
  1173. qwExternalContactId: null,
  1174. externalUserName:null,
  1175. duration: null,
  1176. qwUserId: null,
  1177. companyUserId: null,
  1178. companyId: null,
  1179. courseId: null,
  1180. sTime:null,
  1181. eTime:null,
  1182. upSTime:null,
  1183. upETime:null,
  1184. qecSTime:null,
  1185. qecETime:null,
  1186. scheduleStartTime: null,
  1187. scheduleEndTime: null,
  1188. };
  1189. // 统一重置日历组件
  1190. this.resetCalendars();
  1191. this.resetForm("form");
  1192. },
  1193. /** 搜索按钮操作 */
  1194. handleQuery() {
  1195. this.queryParams.pageNum = 1;
  1196. this.getList();
  1197. },
  1198. /** 重置按钮操作 */
  1199. resetQuery() {
  1200. this.resetForm("queryForm");
  1201. this.queryParams.sTime = null;
  1202. this.queryParams.project = null;
  1203. this.queryParams.eTime = null;
  1204. this.queryParams.upSTime = null;
  1205. this.queryParams.upETime = null;
  1206. this.queryParams.qecSTime = null;
  1207. this.queryParams.qecETime = null;
  1208. this.queryParams.periodSTime = null;
  1209. this.queryParams.periodDTime = null;
  1210. this.queryParams.externalUserName=null;
  1211. this.queryParams.scheduleStartTime = null;
  1212. this.queryParams.scheduleEndTime = null;
  1213. this.queryParams.sopId = null; // 重置SOP ID
  1214. // 重置SOP搜索
  1215. this.handleSopClear();
  1216. // 统一重置日历组件
  1217. this.resetCalendars();
  1218. this.setToday();
  1219. this.handleQuery();
  1220. },
  1221. // 多选框选中数据
  1222. handleSelectionChange(selection) {
  1223. this.ids = selection.map(item => item.logId)
  1224. this.single = selection.length!==1
  1225. this.multiple = !selection.length
  1226. },
  1227. /** 新增按钮操作 */
  1228. handleAdd() {
  1229. this.reset();
  1230. this.open = true;
  1231. this.title = "添加短链课程看课记录";
  1232. },
  1233. /** 修改按钮操作 */
  1234. handleUpdate(row) {
  1235. this.reset();
  1236. const logId = row.logId || this.ids
  1237. getCourseWatchLog(logId).then(response => {
  1238. this.form = response.data;
  1239. this.open = true;
  1240. this.title = "修改短链课程看课记录";
  1241. });
  1242. },
  1243. /** 提交按钮 */
  1244. submitForm() {
  1245. this.$refs["form"].validate(valid => {
  1246. if (valid) {
  1247. if (this.form.logId != null) {
  1248. updateCourseWatchLog(this.form).then(response => {
  1249. this.msgSuccess("修改成功");
  1250. this.open = false;
  1251. this.getList();
  1252. });
  1253. } else {
  1254. addCourseWatchLog(this.form).then(response => {
  1255. this.msgSuccess("新增成功");
  1256. this.open = false;
  1257. this.getList();
  1258. });
  1259. }
  1260. }
  1261. });
  1262. },
  1263. /** 删除按钮操作 */
  1264. handleDelete(row) {
  1265. const logIds = row.logId || this.ids;
  1266. this.$confirm('是否确认删除短链课程看课记录编号为"' + logIds + '"的数据项?', "警告", {
  1267. confirmButtonText: "确定",
  1268. cancelButtonText: "取消",
  1269. type: "warning"
  1270. }).then(function() {
  1271. return delCourseWatchLog(logIds);
  1272. }).then(() => {
  1273. this.getList();
  1274. this.msgSuccess("删除成功");
  1275. }).catch(() => {});
  1276. },
  1277. /** 导出按钮操作 */
  1278. handleExport() {
  1279. // xgb 看课数据量太大必须限制时间
  1280. if (this.isEmptyArray(this.createTimeText) &&
  1281. this.isEmptyArray(this.updateTimeText) &&
  1282. this.isEmptyArray(this.scheduleTimeText)) {
  1283. this.$message.warning('请选择创建时间或营期时间或最新更新时间');
  1284. return;
  1285. }
  1286. const queryParams = this.queryParams;
  1287. this.$confirm('是否确认导出所有短链课程看课记录数据项?', "警告", {
  1288. confirmButtonText: "确定",
  1289. cancelButtonText: "取消",
  1290. type: "warning"
  1291. }).then(() => {
  1292. this.exportLoading = true;
  1293. return exportCourseWatchLog(queryParams);
  1294. }).then(response => {
  1295. this.download(response.msg);
  1296. this.exportLoading = false;
  1297. }).catch(() => {});
  1298. },
  1299. openAnswerLogFun(row) {
  1300. this.openAnswerLog = true;
  1301. this.answerLogQueryParams.watchLogId = row.logId;
  1302. this.answerLogList();
  1303. },
  1304. answerLogList() {
  1305. this.loadingAnswerLog = true;
  1306. listLogs(this.answerLogQueryParams).then(e => {
  1307. this.answerLogsList = e.rows;
  1308. this.answerLogTotal = e.total;
  1309. this.loadingAnswerLog = false;
  1310. })
  1311. },
  1312. openRedLogFun(row) {
  1313. this.openRedLog = true;
  1314. this.redLogQueryParams.watchLogId = row.logId;
  1315. this.redLogList();
  1316. },
  1317. redLogList() {
  1318. this.loadingRedLog = true;
  1319. console.info("-----index",this.redLogQueryParams)
  1320. listCourseRedPacketLog(this.redLogQueryParams).then(e => {
  1321. this.redLogsList = e.rows;
  1322. this.redLogTotal = e.total;
  1323. this.loadingRedLog = false;
  1324. })
  1325. },
  1326. handleSendTypeChange() {
  1327. // 如果是会员,清除一下选中的企微
  1328. if(this.queryParams.sendType == 1) {
  1329. this.queryParams.qwUserName = null;
  1330. }
  1331. this.handleQuery(); // 重新查询列表
  1332. },
  1333. addUserTag(){
  1334. if(this.ids==null||this.ids==""){
  1335. return this.$message('请选择需要添加标签的客户');
  1336. }
  1337. this.getPageListTagGroup();
  1338. setTimeout(() => {
  1339. for (let i = 0; i < this.tagGroupList.length; i++) {
  1340. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  1341. this.tagGroupList[i].tag[x].isSelected=false;
  1342. }
  1343. }
  1344. }, 200);
  1345. this.tagOpen = true;
  1346. },
  1347. delUserTag(){
  1348. if(this.ids==null||this.ids==""){
  1349. return this.$message('请选择需要移除标签的客户');
  1350. }
  1351. this.getPageListTagGroup();
  1352. setTimeout(() => {
  1353. for (let i = 0; i < this.tagGroupList.length; i++) {
  1354. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  1355. this.tagGroupList[i].tag[x].isSelected=false;
  1356. }
  1357. }
  1358. }, 200);
  1359. this.tagDelOpen = true;
  1360. },
  1361. getPageListTagGroup(){
  1362. this.queryTagParams.corpId=this.queryParams.corpId
  1363. allListTagGroup(this.queryTagParams).then(response => {
  1364. this.tagGroupList = response.rows;
  1365. this.tagTotal = response.total;
  1366. });
  1367. },
  1368. tagSelection(row){
  1369. row.isSelected= !row.isSelected;
  1370. this.$forceUpdate();
  1371. },
  1372. handleSearchTags(name){
  1373. if (!name){
  1374. return this.$message.error("请输入要搜索的标签")
  1375. }
  1376. this.queryTagParams.name=name;
  1377. this.queryTagParams.corpId=this.queryParams.corpId;
  1378. searchTags(this.queryTagParams).then(response => {
  1379. this.tagGroupList = response.rows;
  1380. this.tagTotal = response.total;
  1381. });
  1382. // searchTags({name:name,corpId:this.queryParams.corpId}).then(response => {
  1383. // this.tagGroupList = response.rows;
  1384. // });
  1385. },
  1386. cancelSearchTags(){
  1387. this.resetSearchQueryTag()
  1388. this.getPageListTagGroup();
  1389. },
  1390. resetSearchQueryTag(){
  1391. this.tagChange.tagName=null;
  1392. this.queryTagParams= {
  1393. pageNum: 1,
  1394. pageSize: 5,
  1395. total:0,
  1396. name:null,
  1397. };
  1398. },
  1399. addTagSubmitForm(){
  1400. for (let i = 0; i < this.tagGroupList.length; i++) {
  1401. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  1402. if(this.tagGroupList[i].tag[x].isSelected==true){
  1403. this.addTagFormByWatch.tagIds.push(this.tagGroupList[i].tag[x].tagId)
  1404. }
  1405. }
  1406. }
  1407. if(this.addTagFormByWatch.tagIds==[]||this.addTagFormByWatch.tagIds==null||this.addTagFormByWatch.tagIds==""){
  1408. return this.$message('请选择标签');
  1409. }
  1410. this.addTagFormByWatch.logIds=this.ids;
  1411. let loadingRock = this.$loading({
  1412. lock: true,
  1413. text: '正在执行中请稍后~~请不要刷新页面!!',
  1414. spinner: 'el-icon-loading',
  1415. background: 'rgba(0, 0, 0, 0.7)'
  1416. });
  1417. addTagByWatch(this.addTagFormByWatch).then(response => {
  1418. // this.msgSuccess(response.msg);
  1419. this.resultMessage = response.msg;
  1420. this.resultDialogVisible = true; // 显示弹窗
  1421. this.resultTitle = '批量添加标签结果';
  1422. this.tagOpen = false;
  1423. loadingRock.close();
  1424. this.addTagFormByWatch={
  1425. logIds:[],
  1426. tagIds:[]
  1427. };
  1428. this.getList()
  1429. }).finally(res=>{
  1430. loadingRock.close();
  1431. });
  1432. },
  1433. tagDelSubmitForm(){
  1434. for (let i = 0; i < this.tagGroupList.length; i++) {
  1435. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  1436. if(this.tagGroupList[i].tag[x].isSelected==true){
  1437. this.addTagFormByWatch.tagIds.push(this.tagGroupList[i].tag[x].tagId)
  1438. }
  1439. }
  1440. }
  1441. if(this.addTagFormByWatch.tagIds==[]||this.addTagFormByWatch.tagIds==null||this.addTagFormByWatch.tagIds==""){
  1442. return this.$message('请选择标签');
  1443. }
  1444. this.addTagFormByWatch.corpId=this.queryParams.corpId
  1445. this.addTagFormByWatch.logIds=this.ids;
  1446. let loadingRock = this.$loading({
  1447. lock: true,
  1448. text: '正在执行中请稍后~~请不要刷新页面!!',
  1449. spinner: 'el-icon-loading',
  1450. background: 'rgba(0, 0, 0, 0.7)'
  1451. });
  1452. delTagByWatch(this.addTagFormByWatch).then(response => {
  1453. // this.msgSuccess(response.msg);
  1454. this.resultMessage = response.msg;
  1455. this.resultDialogVisible = true; // 显示弹窗
  1456. this.resultTitle = '批量移除标签结果';
  1457. this.tagDelOpen = false;
  1458. loadingRock.close();
  1459. this.addTagFormByWatch={
  1460. userIds:[],
  1461. tagIds:[]
  1462. };
  1463. this.getList()
  1464. }).finally(res=>{
  1465. loadingRock.close();
  1466. });
  1467. },
  1468. addTagCancel() {
  1469. this.tagOpen = false;
  1470. this.addTagFormByWatch={
  1471. logIds:[],
  1472. tagIds:[]
  1473. };
  1474. },
  1475. DelTagCancel() {
  1476. this.tagDelOpen = false;
  1477. this.addTagFormByWatch={
  1478. logIds:[],
  1479. tagIds:[]
  1480. };
  1481. },
  1482. /**
  1483. * 异步查询SOP列表
  1484. * @param {string} queryString - 查询字符串
  1485. * @param {function} callback - 回调函数
  1486. */
  1487. querySopAsync(queryString, callback) {
  1488. if (!queryString) {
  1489. callback([]);
  1490. return;
  1491. }
  1492. infoSop({ name: queryString }).then(response => {
  1493. if (response && response.rows) {
  1494. const suggestions = response.rows.map(item => ({
  1495. value: item.name,
  1496. id: item.id,
  1497. name: item.name
  1498. }));
  1499. callback(suggestions);
  1500. } else {
  1501. callback([]);
  1502. }
  1503. }).catch(error => {
  1504. console.error('通过sop查询失败:', error);
  1505. callback([]);
  1506. });
  1507. },
  1508. /**
  1509. * 选择SOP
  1510. * @param {object} item - 选中的SOP项
  1511. */
  1512. handleSopSelect(item) {
  1513. this.selectedSopId = item.id;
  1514. this.queryParams.sopId = item.id;
  1515. this.sopSearchText = item.name;
  1516. },
  1517. /**
  1518. * 清空SOP选择
  1519. */
  1520. handleSopClear() {
  1521. this.selectedSopId = null;
  1522. this.queryParams.sopId = null;
  1523. this.sopSearchText = '';
  1524. },
  1525. }
  1526. };
  1527. </script>
  1528. <style scoped>
  1529. /* CSS 样式 */
  1530. .tag-container {
  1531. display: flex;
  1532. flex-wrap: wrap; /* 超出宽度时自动换行 */
  1533. gap: 8px; /* 设置标签之间的间距 */
  1534. }
  1535. .name-background {
  1536. display: inline-block;
  1537. background-color: #abece6; /* 背景颜色 */
  1538. padding: 4px 8px; /* 调整内边距,让背景包裹文字 */
  1539. border-radius: 4px; /* 可选:设置圆角 */
  1540. }
  1541. /* CSS 样式 */
  1542. .tag-container {
  1543. display: flex;
  1544. flex-wrap: wrap; /* 超出宽度时自动换行 */
  1545. gap: 8px; /* 设置标签之间的间距 */
  1546. }
  1547. .name-background {
  1548. display: inline-block;
  1549. background-color: #abece6; /* 背景颜色 */
  1550. padding: 4px 8px; /* 调整内边距,让背景包裹文字 */
  1551. border-radius: 4px; /* 可选:设置圆角 */
  1552. }
  1553. .tag-box {
  1554. padding: 8px 12px;
  1555. border: 1px solid #989797;
  1556. border-radius: 4px;
  1557. cursor: pointer;
  1558. display: inline-block;
  1559. }
  1560. .tag-selected {
  1561. background-color: #00bc98;
  1562. color: #fff;
  1563. border-color: #00bc98;
  1564. }
  1565. .el-tag + .el-tag {
  1566. margin-left: 10px;
  1567. }
  1568. /* SOP搜索框样式 */
  1569. .sop-item {
  1570. display: flex;
  1571. align-items: center;
  1572. }
  1573. .sop-name {
  1574. font-size: 14px;
  1575. color: #606266;
  1576. }
  1577. .button-new-tag {
  1578. margin-left: 10px;
  1579. height: 32px;
  1580. line-height: 30px;
  1581. padding-top: 0;
  1582. padding-bottom: 0;
  1583. }
  1584. .input-new-tag {
  1585. width: 90px;
  1586. margin-left: 10px;
  1587. vertical-align: bottom;
  1588. }
  1589. /* 新增的滚动容器样式(不影响原有样式) */
  1590. .scroll-wrapper {
  1591. max-height: 130px; /* 大约三行的高度 */
  1592. overflow-y: auto; /* 垂直滚动 */
  1593. padding-right: 5px; /* 为滚动条留出空间 */
  1594. }
  1595. /* 美化滚动条(可选) */
  1596. .scroll-wrapper::-webkit-scrollbar {
  1597. width: 6px;
  1598. }
  1599. .scroll-wrapper::-webkit-scrollbar-thumb {
  1600. background: rgba(0, 0, 0, 0.2);
  1601. border-radius: 3px;
  1602. }
  1603. </style>