index.vue 68 KB

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