index.vue 53 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674
  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.getList();
  784. this.getDicts("sys_course_watch_log_type_new").then(response => {
  785. this.logTypeOptions = response.data;
  786. });
  787. this.getDicts("sys_course_project").then(response => {
  788. this.projectOptions = response.data;
  789. });
  790. this.getCompanyUserListLikeName(true);
  791. },
  792. methods: {
  793. /**
  794. * 处理所属销售下拉框显示状态变化
  795. */
  796. handleCompanyUserDropdownVisible(visible) {
  797. this.companyUserDropdownVisible = visible;
  798. if (visible && this.companyUserFirstLoad) {
  799. // 首次展开下拉框时加载数据
  800. this.companyUserFirstLoad = false;
  801. this.loadCompanyUserOptions('');
  802. } else if (visible && this.companyUserOptions.length === 0) {
  803. // 下拉框显示但无数据时重新加载
  804. this.loadCompanyUserOptions('');
  805. }
  806. },
  807. /**
  808. * 处理所属企微下拉框显示状态变化
  809. */
  810. handleQwUserDropdownVisible(visible) {
  811. this.qwUserDropdownVisible = visible;
  812. if (visible && this.qwUserFirstLoad) {
  813. // 首次展开下拉框时加载数据
  814. this.qwUserFirstLoad = false;
  815. this.loadQwUserOptions('');
  816. } else if (visible && this.qwUserOptions.length === 0) {
  817. // 下拉框显示但无数据时重新加载
  818. this.loadQwUserOptions('');
  819. }
  820. },
  821. /**
  822. * 当销售被选择
  823. * 级联更新企微列表
  824. */
  825. handleCompanyUserChange(companyUserId){
  826. if (companyUserId) {
  827. // 清空当前企微选择
  828. this.queryParams.qwUserName = "";
  829. this.qwUserOptions = [];
  830. this.qwUserOptionsParams.pageNum = 1;
  831. // 重新加载企微列表,传入销售ID作为过滤条件
  832. this.getQwList();
  833. } else {
  834. // 清空销售时也清空企微
  835. this.queryParams.qwUserName = "";
  836. this.qwUserOptions = [];
  837. this.qwUserOptionsParams.pageNum = 1;
  838. }
  839. },
  840. /**
  841. * 根据名称模糊查询用户列表
  842. * @param query 参数
  843. */
  844. loadCompanyUserOptions(query) {
  845. this.companyUserOptions = [];
  846. this.companyUserOptionsParams.pageNum = 1
  847. this.companyUserOptionsParams.name = query
  848. this.companyUserOptionsLoading = true;
  849. this.getCompanyUserListLikeName()
  850. },
  851. /**
  852. * 根据条件查询企微列表
  853. * @param query 参数
  854. */
  855. loadQwUserOptions(query) {
  856. this.qwUserOptions = [];
  857. this.qwUserOptionsParams.pageNum = 1
  858. // 将搜索关键词设置到queryParams中
  859. this.queryParams.qwUserName = query
  860. this.qwUserOptionsLoading = true;
  861. this.getQwList()
  862. },
  863. /**
  864. * 加载更多员工选项
  865. */
  866. loadMoreCompanyUserOptions() {
  867. if (!this.companyUserOptionsParams.hasNextPage) {
  868. return;
  869. }
  870. this.companyUserOptionsParams.pageNum += 1
  871. this.getCompanyUserListLikeName()
  872. },
  873. /**
  874. * 获取员工列表
  875. */
  876. getCompanyUserListLikeName(isAll) {
  877. if (isAll){
  878. getCompanyUserListLikeName(this.companyUserOptionsParams).then(response => {
  879. this.companyUserOptionsByAll = [...this.companyUserOptions, ...response.data.list]
  880. this.companyUserOptionsParams.hasNextPage = response.data.hasNextPage
  881. this.companyUserOptionsLoading = false;
  882. });
  883. }else {
  884. getCompanyUserListLikeName(this.companyUserOptionsParams).then(response => {
  885. this.companyUserOptions = [...this.companyUserOptions, ...response.data.list]
  886. this.companyUserOptionsParams.hasNextPage = response.data.hasNextPage
  887. this.companyUserOptionsLoading = false;
  888. });
  889. }
  890. },
  891. getQwList() {
  892. const params = {
  893. name: this.qwUserOptionsParams.name,
  894. pageNum: this.qwUserOptionsParams.pageNum,
  895. pageSize: this.qwUserOptionsParams.pageSize,
  896. // 添加销售ID作为过滤条件
  897. companyUserId: this.queryParams.companyUserId || null,
  898. disableCompanyId: 1
  899. };
  900. console.log("企微参数", this.queryParams);
  901. getQwList(params).then(response => {
  902. if (this.qwUserOptionsParams.pageNum === 1) {
  903. this.qwUserOptions = response.rows || [];
  904. } else {
  905. this.qwUserOptions = [...this.qwUserOptions, ...(response.rows || [])];
  906. }
  907. this.qwUserOptionsParams.hasNextPage = response.rows && response.rows.length >= this.qwUserOptionsParams.pageSize;
  908. }).finally(()=>{
  909. this.qwUserOptionsLoading = false;
  910. })
  911. },
  912. /**
  913. * 加载更多员工选项
  914. */
  915. loadMoreQwUserOptions() {
  916. if (!this.qwUserOptionsParams.hasNextPage) {
  917. return;
  918. }
  919. this.qwUserOptionsParams.pageNum += 1
  920. this.getQwList()
  921. },
  922. // 重置日历组件
  923. resetCalendars() {
  924. this.scheduleTime = [];
  925. this.createTime = [];
  926. this.updateTime = [];
  927. this.qecCreateTime = [];
  928. this.periodTime = [];
  929. this.scheduleTimeText = [];
  930. this.createTimeText = [];
  931. this.updateTimeText = [];
  932. this.qecCreateTimeText = [];
  933. this.periodTimeText = [];
  934. // 强制刷新日历组件
  935. this.scheduleCalendarKey++;
  936. this.createCalendarKey++;
  937. this.updateCalendarKey++;
  938. this.qecCalendarKey++;
  939. this.periodTimeKey++;
  940. },
  941. formatDateRange(dates) {
  942. if (!dates || dates.length < 2) return '';
  943. return dates.map(date => date.format('YYYY-MM-DD')).join(' ~ ');
  944. },
  945. courseChange(row){
  946. this.queryParams.videoId=null;
  947. if(row === ''){
  948. this.videoList=[];
  949. return
  950. }
  951. videoList(row).then(response => {
  952. this.videoList=response.list
  953. });
  954. },
  955. // 营期时间
  956. handleScheduleTimeChange(scheduleTime) {
  957. if (scheduleTime && scheduleTime.length >= 2) {
  958. // this.scheduleTimeText = this.formatDateRange(scheduleTime);
  959. this.queryParams.scheduleStartTime = scheduleTime[0] || null;
  960. this.queryParams.scheduleEndTime = scheduleTime[1] || null;
  961. console.log(this.queryParams.scheduleStartTime)
  962. console.log(this.queryParams.scheduleEndTime)
  963. } else {
  964. this.scheduleTimeText = '';
  965. this.queryParams.scheduleStartTime = null;
  966. this.queryParams.scheduleEndTime = null;
  967. }
  968. },
  969. // 创建时间
  970. createChange(createTime) {
  971. if (createTime && createTime.length >= 2) {
  972. // this.createTimeText = this.formatDateRange(createTime);
  973. this.queryParams.sTime = this.formatDate(createTime[0]) || null;
  974. this.queryParams.eTime = this.formatDate(createTime[1]) || null;
  975. } else {
  976. this.createTimeText = '';
  977. this.queryParams.sTime = null;
  978. this.queryParams.eTime = null;
  979. }
  980. },
  981. // 更新时间
  982. updateChange(updateTime) {
  983. if (updateTime && updateTime.length >= 2) {
  984. // this.updateTimeText = this.formatDateRange(updateTime);
  985. this.queryParams.upSTime = updateTime[0] || null;
  986. this.queryParams.upETime = updateTime[1] || null;
  987. } else {
  988. this.updateTimeText = '';
  989. this.queryParams.upSTime = null;
  990. this.queryParams.upETime = null;
  991. }
  992. },
  993. // 进线时间
  994. qecCreateTimeChange(qecCreateTime) {
  995. if (qecCreateTime && qecCreateTime.length >= 2) {
  996. // 检查选择的日期范围是否超过7天(包括起始和结束日期)
  997. const startDate = new Date(qecCreateTime[0]);
  998. const endDate = new Date(qecCreateTime[1]);
  999. // 设置时间为当天开始,避免时间部分影响计算
  1000. startDate.setHours(0, 0, 0, 0);
  1001. endDate.setHours(0, 0, 0, 0);
  1002. const timeDiff = Math.abs(endDate - startDate);
  1003. const diffDays = Math.ceil(timeDiff / (1000 * 60 * 60 * 24));
  1004. // 如果超过6天的范围(总共7天,包括起始日)
  1005. if (diffDays > 6) {
  1006. this.$message.error('进线时间选择范围不能超过7天');
  1007. // 清空选择
  1008. this.qecCreateTime = [];
  1009. this.qecCreateTimeText = [];
  1010. this.queryParams.qecSTime = null;
  1011. this.queryParams.qecETime = null;
  1012. this.qecCalendarKey++;
  1013. return;
  1014. }
  1015. // this.qecCreateTimeText = this.formatDateRange(qecCreateTime);
  1016. this.queryParams.qecSTime = qecCreateTime[0] || null;
  1017. this.queryParams.qecETime = qecCreateTime[1] || null;
  1018. console.log(this.queryParams.qecSTime);
  1019. console.log(this.queryParams.qecETime);
  1020. } else {
  1021. this.qecCreateTimeText = '';
  1022. this.queryParams.qecSTime = null;
  1023. this.queryParams.qecETime = null;
  1024. }
  1025. },
  1026. //营期课程时间
  1027. qecPeriodTimeChange(periodTime){
  1028. if (periodTime && periodTime.length >= 2) {
  1029. // 检查选择的日期范围是否超过7天(包括起始和结束日期)
  1030. const startDate = new Date(periodTime[0]);
  1031. const endDate = new Date(periodTime[1]);
  1032. // 设置时间为当天开始,避免时间部分影响计算
  1033. startDate.setHours(0, 0, 0, 0);
  1034. endDate.setHours(0, 0, 0, 0);
  1035. const timeDiff = Math.abs(endDate - startDate);
  1036. const diffDays = Math.ceil(timeDiff / (1000 * 60 * 60 * 24));
  1037. // 如果超过6天的范围(总共7天,包括起始日)
  1038. if (diffDays > 13) {
  1039. this.$message.error('时间选择范围不能超过14天');
  1040. // 清空选择
  1041. this.periodTime = [];
  1042. this.periodTimeText = [];
  1043. this.queryParams.periodSTime = null;
  1044. this.queryParams.periodETime = null;
  1045. this.periodTimeKey++;
  1046. return;
  1047. }
  1048. this.queryParams.periodSTime = this.formatDate(periodTime[0]) || null;
  1049. this.queryParams.periodETime = this.formatDate(periodTime[1]) || null;
  1050. } else {
  1051. this.periodTimeText = '';
  1052. this.queryParams.periodSTime = null;
  1053. this.queryParams.periodETime = null;
  1054. }
  1055. },
  1056. formatDate(date) {
  1057. if (!date) return ''
  1058. // 确保 date 是 Date 对象
  1059. let dateObj = date
  1060. if (typeof date === 'string') {
  1061. dateObj = new Date(date)
  1062. }
  1063. // 如果转换失败,返回空字符串
  1064. if (!(dateObj instanceof Date) || isNaN(dateObj.getTime())) {
  1065. return ''
  1066. }
  1067. // 使用更安全的格式化方法
  1068. const year = dateObj.getFullYear()
  1069. const month = String(dateObj.getMonth() + 1).padStart(2, '0')
  1070. const day = String(dateObj.getDate()).padStart(2, '0')
  1071. const hours = String(dateObj.getHours()).padStart(2, '0')
  1072. const minutes = String(dateObj.getMinutes()).padStart(2, '0')
  1073. const seconds = String(dateObj.getSeconds()).padStart(2, '0')
  1074. return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
  1075. },
  1076. handleClickX(tab,event){
  1077. this.activeName=tab.name;
  1078. if(tab.name=="00"){
  1079. this.queryParams.logType=null;
  1080. }else{
  1081. this.queryParams.logType=tab.name;
  1082. }
  1083. this.getList()
  1084. },
  1085. /** 查询短链课程看课记录列表 */
  1086. getList() {
  1087. this.loading = true;
  1088. if(this.queryParams.logType == "10"){
  1089. this.queryParams.logType = null;
  1090. }
  1091. listCourseWatchLog(this.queryParams).then(response => {
  1092. this.courseWatchLogList = response.rows;
  1093. this.total = response.total;
  1094. this.loading = false;
  1095. });
  1096. },
  1097. // 取消按钮
  1098. cancel() {
  1099. this.open = false;
  1100. this.reset();
  1101. },
  1102. // 表单重置
  1103. reset() {
  1104. this.form = {
  1105. logId: null,
  1106. userId: null,
  1107. videoId: null,
  1108. logType: null,
  1109. createTime: null,
  1110. updateTime: null,
  1111. qwExternalContactId: null,
  1112. externalUserName:null,
  1113. duration: null,
  1114. qwUserId: null,
  1115. companyUserId: null,
  1116. companyId: null,
  1117. courseId: null,
  1118. sTime:null,
  1119. eTime:null,
  1120. upSTime:null,
  1121. upETime:null,
  1122. qecSTime:null,
  1123. qecETime:null,
  1124. scheduleStartTime: null,
  1125. scheduleEndTime: null,
  1126. };
  1127. // 统一重置日历组件
  1128. this.resetCalendars();
  1129. this.resetForm("form");
  1130. },
  1131. /** 搜索按钮操作 */
  1132. handleQuery() {
  1133. this.queryParams.pageNum = 1;
  1134. this.getList();
  1135. },
  1136. /** 重置按钮操作 */
  1137. resetQuery() {
  1138. this.resetForm("queryForm");
  1139. this.queryParams.sTime = null;
  1140. this.queryParams.project = null;
  1141. this.queryParams.eTime = null;
  1142. this.queryParams.upSTime = null;
  1143. this.queryParams.upETime = null;
  1144. this.queryParams.qecSTime = null;
  1145. this.queryParams.qecETime = null;
  1146. this.queryParams.periodSTime = null;
  1147. this.queryParams.periodDTime = null;
  1148. this.queryParams.externalUserName=null;
  1149. this.queryParams.scheduleStartTime = null;
  1150. this.queryParams.scheduleEndTime = null;
  1151. this.queryParams.sopId = null; // 重置SOP ID
  1152. // 重置SOP搜索
  1153. this.handleSopClear();
  1154. // 统一重置日历组件
  1155. this.resetCalendars();
  1156. this.handleQuery();
  1157. },
  1158. // 多选框选中数据
  1159. handleSelectionChange(selection) {
  1160. this.ids = selection.map(item => item.logId)
  1161. this.single = selection.length!==1
  1162. this.multiple = !selection.length
  1163. },
  1164. /** 新增按钮操作 */
  1165. handleAdd() {
  1166. this.reset();
  1167. this.open = true;
  1168. this.title = "添加短链课程看课记录";
  1169. },
  1170. /** 修改按钮操作 */
  1171. handleUpdate(row) {
  1172. this.reset();
  1173. const logId = row.logId || this.ids
  1174. getCourseWatchLog(logId).then(response => {
  1175. this.form = response.data;
  1176. this.open = true;
  1177. this.title = "修改短链课程看课记录";
  1178. });
  1179. },
  1180. /** 提交按钮 */
  1181. submitForm() {
  1182. this.$refs["form"].validate(valid => {
  1183. if (valid) {
  1184. if (this.form.logId != null) {
  1185. updateCourseWatchLog(this.form).then(response => {
  1186. this.msgSuccess("修改成功");
  1187. this.open = false;
  1188. this.getList();
  1189. });
  1190. } else {
  1191. addCourseWatchLog(this.form).then(response => {
  1192. this.msgSuccess("新增成功");
  1193. this.open = false;
  1194. this.getList();
  1195. });
  1196. }
  1197. }
  1198. });
  1199. },
  1200. /** 删除按钮操作 */
  1201. handleDelete(row) {
  1202. const logIds = row.logId || this.ids;
  1203. this.$confirm('是否确认删除短链课程看课记录编号为"' + logIds + '"的数据项?', "警告", {
  1204. confirmButtonText: "确定",
  1205. cancelButtonText: "取消",
  1206. type: "warning"
  1207. }).then(function() {
  1208. return delCourseWatchLog(logIds);
  1209. }).then(() => {
  1210. this.getList();
  1211. this.msgSuccess("删除成功");
  1212. }).catch(() => {});
  1213. },
  1214. /** 导出按钮操作 */
  1215. handleExport() {
  1216. const queryParams = this.queryParams;
  1217. this.$confirm('是否确认导出所有短链课程看课记录数据项?', "警告", {
  1218. confirmButtonText: "确定",
  1219. cancelButtonText: "取消",
  1220. type: "warning"
  1221. }).then(() => {
  1222. this.exportLoading = true;
  1223. return exportCourseWatchLog(queryParams);
  1224. }).then(response => {
  1225. this.download(response.msg);
  1226. this.exportLoading = false;
  1227. }).catch(() => {});
  1228. },
  1229. openAnswerLogFun(row) {
  1230. this.openAnswerLog = true;
  1231. this.answerLogQueryParams.watchLogId = row.logId;
  1232. this.answerLogList();
  1233. },
  1234. answerLogList() {
  1235. this.loadingAnswerLog = true;
  1236. listLogs(this.answerLogQueryParams).then(e => {
  1237. this.answerLogsList = e.rows;
  1238. this.answerLogTotal = e.total;
  1239. this.loadingAnswerLog = false;
  1240. })
  1241. },
  1242. openRedLogFun(row) {
  1243. this.openRedLog = true;
  1244. this.redLogQueryParams.watchLogId = row.logId;
  1245. this.redLogList();
  1246. },
  1247. redLogList() {
  1248. this.loadingRedLog = true;
  1249. console.info("-----index",this.redLogQueryParams)
  1250. listCourseRedPacketLog(this.redLogQueryParams).then(e => {
  1251. this.redLogsList = e.rows;
  1252. this.redLogTotal = e.total;
  1253. this.loadingRedLog = false;
  1254. })
  1255. },
  1256. handleSendTypeChange() {
  1257. // 如果是会员,清除一下选中的企微
  1258. if(this.queryParams.sendType == 1) {
  1259. this.queryParams.qwUserName = null;
  1260. }
  1261. this.handleQuery(); // 重新查询列表
  1262. },
  1263. addUserTag(){
  1264. if(this.ids==null||this.ids==""){
  1265. return this.$message('请选择需要添加标签的客户');
  1266. }
  1267. this.getPageListTagGroup();
  1268. setTimeout(() => {
  1269. for (let i = 0; i < this.tagGroupList.length; i++) {
  1270. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  1271. this.tagGroupList[i].tag[x].isSelected=false;
  1272. }
  1273. }
  1274. }, 200);
  1275. this.tagOpen = true;
  1276. },
  1277. delUserTag(){
  1278. if(this.ids==null||this.ids==""){
  1279. return this.$message('请选择需要移除标签的客户');
  1280. }
  1281. this.getPageListTagGroup();
  1282. setTimeout(() => {
  1283. for (let i = 0; i < this.tagGroupList.length; i++) {
  1284. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  1285. this.tagGroupList[i].tag[x].isSelected=false;
  1286. }
  1287. }
  1288. }, 200);
  1289. this.tagDelOpen = true;
  1290. },
  1291. getPageListTagGroup(){
  1292. this.queryTagParams.corpId=this.queryParams.corpId
  1293. allListTagGroup(this.queryTagParams).then(response => {
  1294. this.tagGroupList = response.rows;
  1295. this.tagTotal = response.total;
  1296. });
  1297. },
  1298. tagSelection(row){
  1299. row.isSelected= !row.isSelected;
  1300. this.$forceUpdate();
  1301. },
  1302. handleSearchTags(name){
  1303. if (!name){
  1304. return this.$message.error("请输入要搜索的标签")
  1305. }
  1306. this.queryTagParams.name=name;
  1307. this.queryTagParams.corpId=this.queryParams.corpId;
  1308. searchTags(this.queryTagParams).then(response => {
  1309. this.tagGroupList = response.rows;
  1310. this.tagTotal = response.total;
  1311. });
  1312. // searchTags({name:name,corpId:this.queryParams.corpId}).then(response => {
  1313. // this.tagGroupList = response.rows;
  1314. // });
  1315. },
  1316. cancelSearchTags(){
  1317. this.resetSearchQueryTag()
  1318. this.getPageListTagGroup();
  1319. },
  1320. resetSearchQueryTag(){
  1321. this.tagChange.tagName=null;
  1322. this.queryTagParams= {
  1323. pageNum: 1,
  1324. pageSize: 5,
  1325. total:0,
  1326. name:null,
  1327. };
  1328. },
  1329. addTagSubmitForm(){
  1330. for (let i = 0; i < this.tagGroupList.length; i++) {
  1331. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  1332. if(this.tagGroupList[i].tag[x].isSelected==true){
  1333. this.addTagFormByWatch.tagIds.push(this.tagGroupList[i].tag[x].tagId)
  1334. }
  1335. }
  1336. }
  1337. if(this.addTagFormByWatch.tagIds==[]||this.addTagFormByWatch.tagIds==null||this.addTagFormByWatch.tagIds==""){
  1338. return this.$message('请选择标签');
  1339. }
  1340. this.addTagFormByWatch.logIds=this.ids;
  1341. let loadingRock = this.$loading({
  1342. lock: true,
  1343. text: '正在执行中请稍后~~请不要刷新页面!!',
  1344. spinner: 'el-icon-loading',
  1345. background: 'rgba(0, 0, 0, 0.7)'
  1346. });
  1347. addTagByWatch(this.addTagFormByWatch).then(response => {
  1348. // this.msgSuccess(response.msg);
  1349. this.resultMessage = response.msg;
  1350. this.resultDialogVisible = true; // 显示弹窗
  1351. this.resultTitle = '批量添加标签结果';
  1352. this.tagOpen = false;
  1353. loadingRock.close();
  1354. this.addTagFormByWatch={
  1355. logIds:[],
  1356. tagIds:[]
  1357. };
  1358. this.getList()
  1359. }).finally(res=>{
  1360. loadingRock.close();
  1361. });
  1362. },
  1363. tagDelSubmitForm(){
  1364. for (let i = 0; i < this.tagGroupList.length; i++) {
  1365. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  1366. if(this.tagGroupList[i].tag[x].isSelected==true){
  1367. this.addTagFormByWatch.tagIds.push(this.tagGroupList[i].tag[x].tagId)
  1368. }
  1369. }
  1370. }
  1371. if(this.addTagFormByWatch.tagIds==[]||this.addTagFormByWatch.tagIds==null||this.addTagFormByWatch.tagIds==""){
  1372. return this.$message('请选择标签');
  1373. }
  1374. this.addTagFormByWatch.corpId=this.queryParams.corpId
  1375. this.addTagFormByWatch.logIds=this.ids;
  1376. let loadingRock = this.$loading({
  1377. lock: true,
  1378. text: '正在执行中请稍后~~请不要刷新页面!!',
  1379. spinner: 'el-icon-loading',
  1380. background: 'rgba(0, 0, 0, 0.7)'
  1381. });
  1382. delTagByWatch(this.addTagFormByWatch).then(response => {
  1383. // this.msgSuccess(response.msg);
  1384. this.resultMessage = response.msg;
  1385. this.resultDialogVisible = true; // 显示弹窗
  1386. this.resultTitle = '批量移除标签结果';
  1387. this.tagDelOpen = false;
  1388. loadingRock.close();
  1389. this.addTagFormByWatch={
  1390. userIds:[],
  1391. tagIds:[]
  1392. };
  1393. this.getList()
  1394. }).finally(res=>{
  1395. loadingRock.close();
  1396. });
  1397. },
  1398. addTagCancel() {
  1399. this.tagOpen = false;
  1400. this.addTagFormByWatch={
  1401. logIds:[],
  1402. tagIds:[]
  1403. };
  1404. },
  1405. DelTagCancel() {
  1406. this.tagDelOpen = false;
  1407. this.addTagFormByWatch={
  1408. logIds:[],
  1409. tagIds:[]
  1410. };
  1411. },
  1412. /**
  1413. * 异步查询SOP列表
  1414. * @param {string} queryString - 查询字符串
  1415. * @param {function} callback - 回调函数
  1416. */
  1417. querySopAsync(queryString, callback) {
  1418. if (!queryString) {
  1419. callback([]);
  1420. return;
  1421. }
  1422. infoSop({ name: queryString }).then(response => {
  1423. if (response && response.rows) {
  1424. const suggestions = response.rows.map(item => ({
  1425. value: item.name,
  1426. id: item.id,
  1427. name: item.name
  1428. }));
  1429. callback(suggestions);
  1430. } else {
  1431. callback([]);
  1432. }
  1433. }).catch(error => {
  1434. console.error('通过sop查询失败:', error);
  1435. callback([]);
  1436. });
  1437. },
  1438. /**
  1439. * 选择SOP
  1440. * @param {object} item - 选中的SOP项
  1441. */
  1442. handleSopSelect(item) {
  1443. this.selectedSopId = item.id;
  1444. this.queryParams.sopId = item.id;
  1445. this.sopSearchText = item.name;
  1446. },
  1447. /**
  1448. * 清空SOP选择
  1449. */
  1450. handleSopClear() {
  1451. this.selectedSopId = null;
  1452. this.queryParams.sopId = null;
  1453. this.sopSearchText = '';
  1454. },
  1455. }
  1456. };
  1457. </script>
  1458. <style scoped>
  1459. /* CSS 样式 */
  1460. .tag-container {
  1461. display: flex;
  1462. flex-wrap: wrap; /* 超出宽度时自动换行 */
  1463. gap: 8px; /* 设置标签之间的间距 */
  1464. }
  1465. .name-background {
  1466. display: inline-block;
  1467. background-color: #abece6; /* 背景颜色 */
  1468. padding: 4px 8px; /* 调整内边距,让背景包裹文字 */
  1469. border-radius: 4px; /* 可选:设置圆角 */
  1470. }
  1471. /* CSS 样式 */
  1472. .tag-container {
  1473. display: flex;
  1474. flex-wrap: wrap; /* 超出宽度时自动换行 */
  1475. gap: 8px; /* 设置标签之间的间距 */
  1476. }
  1477. .name-background {
  1478. display: inline-block;
  1479. background-color: #abece6; /* 背景颜色 */
  1480. padding: 4px 8px; /* 调整内边距,让背景包裹文字 */
  1481. border-radius: 4px; /* 可选:设置圆角 */
  1482. }
  1483. .tag-box {
  1484. padding: 8px 12px;
  1485. border: 1px solid #989797;
  1486. border-radius: 4px;
  1487. cursor: pointer;
  1488. display: inline-block;
  1489. }
  1490. .tag-selected {
  1491. background-color: #00bc98;
  1492. color: #fff;
  1493. border-color: #00bc98;
  1494. }
  1495. .el-tag + .el-tag {
  1496. margin-left: 10px;
  1497. }
  1498. /* SOP搜索框样式 */
  1499. .sop-item {
  1500. display: flex;
  1501. align-items: center;
  1502. }
  1503. .sop-name {
  1504. font-size: 14px;
  1505. color: #606266;
  1506. }
  1507. .button-new-tag {
  1508. margin-left: 10px;
  1509. height: 32px;
  1510. line-height: 30px;
  1511. padding-top: 0;
  1512. padding-bottom: 0;
  1513. }
  1514. .input-new-tag {
  1515. width: 90px;
  1516. margin-left: 10px;
  1517. vertical-align: bottom;
  1518. }
  1519. /* 新增的滚动容器样式(不影响原有样式) */
  1520. .scroll-wrapper {
  1521. max-height: 130px; /* 大约三行的高度 */
  1522. overflow-y: auto; /* 垂直滚动 */
  1523. padding-right: 5px; /* 为滚动条留出空间 */
  1524. }
  1525. /* 美化滚动条(可选) */
  1526. .scroll-wrapper::-webkit-scrollbar {
  1527. width: 6px;
  1528. }
  1529. .scroll-wrapper::-webkit-scrollbar-thumb {
  1530. background: rgba(0, 0, 0, 0.2);
  1531. border-radius: 3px;
  1532. }
  1533. </style>