watchLog.vue 48 KB

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