watchLog.vue 57 KB

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