index.vue 53 KB

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