index.vue 47 KB

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