myCourseWatchLog.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854
  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="qwUserId">
  5. <el-select v-model="queryParams.qwUserId" placeholder="企微账号" clearable size="small" @change="updateQwuser()">
  6. <el-option
  7. v-for="dict in myQwUserList"
  8. :key="dict.dictValue"
  9. :label="dict.dictLabel + '('+dict.corpName+')'"
  10. :value="dict.dictValue"
  11. />
  12. </el-select>
  13. </el-form-item>
  14. <el-form-item label="客户ID" prop="qwExternalContactId">
  15. <el-input
  16. v-model="queryParams.qwExternalContactId"
  17. placeholder="请输入会员ID"
  18. clearable
  19. size="small"
  20. @keyup.enter.native="handleQuery"
  21. />
  22. </el-form-item>
  23. <el-form-item label="会员ID" prop="userId">
  24. <el-input
  25. v-model="queryParams.userId"
  26. placeholder="请输入会员ID"
  27. clearable
  28. size="small"
  29. @keyup.enter.native="handleQuery"
  30. />
  31. </el-form-item>
  32. <el-form-item label="会员昵称" prop="nickName">
  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="企微客户昵称" prop="nickName">
  42. <el-input
  43. v-model="queryParams.externalUserName"
  44. placeholder="请输入企微客户昵称"
  45. clearable
  46. size="small"
  47. @keyup.enter.native="handleQuery"
  48. />
  49. </el-form-item>
  50. <el-form-item label="课程" prop="courseId">
  51. <el-select filterable v-model="queryParams.courseId" placeholder="请选择课程" clearable size="small" @change="courseChange(queryParams.courseId)">
  52. <el-option
  53. v-for="dict in courseLists"
  54. :key="dict.dictValue"
  55. :label="dict.dictLabel"
  56. :value="dict.dictValue"
  57. />
  58. </el-select>
  59. </el-form-item>
  60. <el-form-item label="小节" prop="videoId">
  61. <el-select filterable v-model="queryParams.videoId" placeholder="请选择小节" clearable size="small">
  62. <el-option
  63. v-for="dict in videoList"
  64. :key="dict.dictValue"
  65. :label="dict.dictLabel"
  66. :value="dict.dictValue"
  67. />
  68. </el-select>
  69. </el-form-item>
  70. <el-form-item label="创建时间" prop="createTime">
  71. <el-date-picker v-model="createTime" size="small" style="width: 220px" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" @change="change"></el-date-picker>
  72. </el-form-item>
  73. <el-table-column label="完课时间" align="center" prop="finishTime" />
  74. <el-table-column label="营期时间" align="center" prop="campPeriodTime" />
  75. <el-form-item label="进线时间" prop="updateTime">
  76. <el-date-picker
  77. v-model="qecCreateTime"
  78. size="small"
  79. style="width: 220px"
  80. value-format="yyyy-MM-dd"
  81. type="daterange"
  82. range-separator="-"
  83. start-placeholder="开始日期"
  84. end-placeholder="结束日期"
  85. @change="qecCreateTimeChange"
  86. :picker-options="pickerOptions"
  87. ></el-date-picker>
  88. </el-form-item>
  89. <el-form-item>
  90. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  91. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  92. </el-form-item>
  93. </el-form>
  94. <el-row :gutter="10" class="mb8">
  95. <el-col :span="1.5">
  96. <el-button
  97. type="warning"
  98. plain
  99. icon="el-icon-download"
  100. size="mini"
  101. :loading="exportLoading"
  102. @click="handleExport"
  103. v-hasPermi="['course:courseWatchLog:myExport']"
  104. >导出</el-button>
  105. </el-col>
  106. <el-col :span="1.5">
  107. <el-button
  108. type="primary"
  109. plain
  110. size="mini"
  111. @click="addUserTag"
  112. v-hasPermi="['qw:externalContact:addTag']"
  113. >批量添加标签</el-button>
  114. </el-col>
  115. <el-col :span="1.5">
  116. <el-button
  117. type="primary"
  118. plain
  119. size="mini"
  120. @click="delUserTag"
  121. v-hasPermi="['qw:externalContact:delTag']"
  122. >批量移除标签</el-button>
  123. </el-col>
  124. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  125. </el-row>
  126. <el-tabs type="card" v-model="queryParams.logType" @tab-click="handleClickX">
  127. <el-tab-pane label="全部" name="10"></el-tab-pane>
  128. <el-tab-pane v-for="(item,index) in logTypeOptions" :label="item.dictLabel" :name="item.dictValue"></el-tab-pane>
  129. </el-tabs>
  130. <el-table border v-loading="loading" :data="courseWatchLogList" @selection-change="handleSelectionChange">
  131. <el-table-column type="selection" width="55" align="center" />
  132. <el-table-column label="记录编号" align="center" prop="logId" />
  133. <el-table-column label="企微客户" align="center" prop="externalUserName"/>
  134. <el-table-column label="客户头像" align="center" prop="externalUserAvatar">
  135. <template slot-scope="scope">
  136. <el-popover
  137. placement="right"
  138. trigger="hover">
  139. <img slot="reference" :src="scope.row.externalUserAvatar" style="width: 40px;height: 40px">
  140. <img :src="scope.row.externalUserAvatar" style="max-width: 250px;max-height: 250px">
  141. </el-popover>
  142. </template>
  143. </el-table-column>
  144. <el-table-column label="会员ID" align="center" prop="userId" />
  145. <el-table-column label="会员昵称" align="center" prop="fsNickName">
  146. <template slot-scope="scope">
  147. <div style="display: flex;white-space: nowrap">
  148. <div style="margin: auto">
  149. {{scope.row.fsNickName}}
  150. </div>
  151. <el-popover
  152. placement="right"
  153. title=""
  154. trigger="hover">
  155. <img slot="reference" :src="scope.row.fsAvatar" style="width: 30px;height: 30px">
  156. <img :src="scope.row.fsAvatar" style="max-width: 200px;max-height: 200px">
  157. </el-popover>
  158. </div>
  159. </template>
  160. </el-table-column>
  161. <el-table-column label="课程名称" align="center" prop="courseName" />
  162. <el-table-column label="小节名称" align="center" prop="videoName" />
  163. <el-table-column label="记录类型" align="center" prop="logType">
  164. <template slot-scope="scope">
  165. <dict-tag :options="logTypeOptions" :value="scope.row.logType"/>
  166. </template>
  167. </el-table-column>
  168. <el-table-column label="播放时长" align="center" prop="duration" />
  169. <el-table-column label="所属销售" align="center" prop="companyUserName" />
  170. <el-table-column label="所属公司" align="center" prop="companyName" />
  171. <el-table-column label="企微员工名称" align="center" prop="qwUserName" />
  172. <el-table-column label="企微账号" align="center" prop="qwUserName" />
  173. <el-table-column label="所属发送方式" align="center" prop="sendType" />
  174. <el-table-column label="创建时间" align="center" prop="createTime" />
  175. <!-- <el-table-column label="更新时间" align="center" prop="updateTime" />-->
  176. <el-table-column label="完课时间" align="center" prop="lastHeartbeatTime" />
  177. <el-table-column label="进线时间" align="center" prop="qecCreateTime" />
  178. </el-table>
  179. <pagination
  180. v-show="total>0"
  181. :total="total"
  182. :page.sync="queryParams.pageNum"
  183. :limit.sync="queryParams.pageSize"
  184. @pagination="getList"
  185. />
  186. <el-dialog title="批量添加标签" :visible.sync="tagOpen" width="800px" append-to-body>
  187. <div>搜索标签:
  188. <el-input v-model="tagChange.tagName" placeholder="请输入标签名称" clearable size="small" style="width: 200px;margin-right: 10px" />
  189. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleSearchTags(tagChange.tagName)">搜索</el-button>
  190. <el-button type="primary" icon="el-icon-plus" size="mini" @click="cancelSearchTags">重置</el-button>
  191. </div>
  192. <el-form ref="form" :model="addTagFormByWatch" label-width="80px">
  193. <div v-for="item in tagGroupList" :key="item.id" >
  194. <div style="font-size: 20px;margin-top: 20px;margin-bottom: 20px;">
  195. <span class="name-background">{{ item.name }}</span>
  196. </div>
  197. <!-- 添加外层滚动容器 -->
  198. <div class="scroll-wrapper">
  199. <div class="tag-container">
  200. <a
  201. v-for="tagItem in item.tag"
  202. class="tag-box"
  203. @click="tagSelection(tagItem)"
  204. :class="{ 'tag-selected': tagItem.isSelected }"
  205. >
  206. {{ tagItem.name }}
  207. </a>
  208. </div>
  209. </div>
  210. </div>
  211. </el-form>
  212. <pagination
  213. v-show="tagTotal>0"
  214. :total="tagTotal"
  215. :page.sync="queryTagParams.pageNum"
  216. :limit.sync="queryTagParams.pageSize"
  217. @pagination="getPageListTagGroup"
  218. />
  219. <div slot="footer" class="dialog-footer">
  220. <el-button type="primary" @click="addTagSubmitForm()">确 定</el-button>
  221. <el-button @click="addTagCancel">取 消</el-button>
  222. </div>
  223. </el-dialog>
  224. <el-dialog title="批量移除标签" :visible.sync="tagDelOpen" width="800px" append-to-body>
  225. <div>搜索标签:
  226. <el-input v-model="tagChange.tagName" placeholder="请输入标签名称" clearable size="small" style="width: 200px;margin-right: 10px" />
  227. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleSearchTags(tagChange.tagName)">搜索</el-button>
  228. <el-button type="primary" icon="el-icon-plus" size="mini" @click="cancelSearchTags">重置</el-button>
  229. </div>
  230. <el-form ref="form" :model="addTagFormByWatch" label-width="80px">
  231. <div v-for="item in tagGroupList" :key="item.id" >
  232. <div style="font-size: 20px;margin-top: 20px;margin-bottom: 20px;">
  233. <span class="name-background">{{ item.name }}</span>
  234. </div>
  235. <!-- 添加外层滚动容器 -->
  236. <div class="scroll-wrapper">
  237. <div class="tag-container">
  238. <a
  239. v-for="tagItem in item.tag"
  240. class="tag-box"
  241. @click="tagSelection(tagItem)"
  242. :class="{ 'tag-selected': tagItem.isSelected }"
  243. >
  244. {{ tagItem.name }}
  245. </a>
  246. </div>
  247. </div>
  248. </div>
  249. </el-form>
  250. <pagination
  251. v-show="tagTotal>0"
  252. :total="tagTotal"
  253. :page.sync="queryTagParams.pageNum"
  254. :limit.sync="queryTagParams.pageSize"
  255. @pagination="getPageListTagGroup"
  256. />
  257. <div slot="footer" class="dialog-footer">
  258. <el-button type="primary" @click="tagDelSubmitForm()">确 定</el-button>
  259. <el-button @click="DelTagCancel">取 消</el-button>
  260. </div>
  261. </el-dialog>
  262. <el-dialog
  263. :title="resultTitle"
  264. :visible.sync="resultDialogVisible"
  265. width="50%"
  266. custom-class="feedback-dialog"
  267. >
  268. <pre style="white-space: pre-wrap; font-family: inherit;">{{ resultMessage }}</pre>
  269. <span slot="footer" class="dialog-footer">
  270. <el-button @click="resultDialogVisible = false">关闭</el-button>
  271. </span>
  272. </el-dialog>
  273. </div>
  274. </template>
  275. <script>
  276. import { myListCourseWatchLog, getCourseWatchLog, delCourseWatchLog, addCourseWatchLog, updateCourseWatchLog, exportCourseWatchLog } from "@/api/course/courseWatchLog";
  277. import { courseList,videoList } from '@/api/course/courseRedPacketLog'
  278. import {getMyQwUserList} from "@/api/qw/user";
  279. import {allListTagGroup} from "../../../api/qw/tagGroup";
  280. import {searchTags} from "../../../api/qw/tag";
  281. import {addTagByWatch, delTagByWatch} from "../../../api/qw/externalContact";
  282. export default {
  283. name: "CourseWatchLog",
  284. data() {
  285. return {
  286. resultDialogVisible: false,
  287. resultMessage: '',
  288. resultTitle:'',
  289. createTime:null,
  290. qecCreateTime:null,
  291. pickerOptions: {
  292. disabledDate(time) {
  293. // 获取6天前的日期(加上今天就是7天)
  294. const sixDaysAgo = new Date();
  295. sixDaysAgo.setDate(sixDaysAgo.getDate() - 6);
  296. sixDaysAgo.setHours(0, 0, 0, 0);
  297. // 获取明天的日期(不包括今天)
  298. const tomorrow = new Date();
  299. tomorrow.setDate(tomorrow.getDate() + 1);
  300. tomorrow.setHours(0, 0, 0, 0);
  301. return time.getTime() < sixDaysAgo.getTime() || time.getTime() >= tomorrow.getTime();
  302. }
  303. },
  304. courseLists:[],
  305. videoList:[],
  306. myQwUserList:[],
  307. logTypeOptions:[],
  308. // 遮罩层
  309. loading: true,
  310. // 导出遮罩层
  311. exportLoading: false,
  312. // 选中数组
  313. ids: [],
  314. // 非单个禁用
  315. single: true,
  316. // 非多个禁用
  317. multiple: true,
  318. // 显示搜索条件
  319. showSearch: true,
  320. // 总条数
  321. total: 0,
  322. // 短链课程看课记录表格数据
  323. courseWatchLogList: [],
  324. // 弹出层标题
  325. title: "",
  326. // 是否显示弹出层
  327. open: false,
  328. tagOpen:false,
  329. //标签弹窗选择
  330. tagChange:{
  331. open:false,
  332. index:null,
  333. },
  334. addTagFormByWatch:{
  335. logId:[],
  336. tagIds:[]
  337. },
  338. tagGroupList: [],
  339. tagTotal:0,
  340. tagDelOpen:false,
  341. queryTagParams:{
  342. pageNum: 1,
  343. pageSize: 5,
  344. total:0,
  345. name:null,
  346. corpId:null,
  347. },
  348. // 查询参数
  349. queryParams: {
  350. pageNum: 1,
  351. pageSize: 10,
  352. userId: null,
  353. videoId: null,
  354. nickName:null,
  355. logType: "10",
  356. qwExternalContactId: null,
  357. externalUserName:null,
  358. duration: null,
  359. qwUserId: null,
  360. companyUserId: null,
  361. companyId: null,
  362. courseId: null,
  363. sTime:null,
  364. eTime:null,
  365. scheduleStartTime: null,
  366. scheduleEndTime: null,
  367. qecSTime:null,
  368. qecETime:null,
  369. },
  370. // 表单参数
  371. form: {},
  372. // 表单校验
  373. rules: {
  374. }
  375. };
  376. },
  377. created() {
  378. courseList().then(response => {
  379. this.courseLists = response.list;
  380. });
  381. this.getList();
  382. this.getDicts("sys_course_watch_log_type").then(response => {
  383. this.logTypeOptions = response.data;
  384. });
  385. getMyQwUserList().then(response => {
  386. this.myQwUserList = response.data;
  387. });
  388. },
  389. methods: {
  390. courseChange(row){
  391. this.queryParams.videoId=null;
  392. if(row === ''){
  393. this.videoList=[];
  394. return
  395. }
  396. videoList(row).then(response => {
  397. this.videoList=response.list
  398. });
  399. },
  400. updateQwuser(){
  401. for (const user of this.myQwUserList) {
  402. if (user.dictValue == this.queryParams.qwUserId) {
  403. this.queryParams.corpId=user.corpId;
  404. break;
  405. }
  406. }
  407. this.getList();
  408. },
  409. change() {
  410. if (this.createTime != null) {
  411. this.queryParams.sTime = this.createTime[0];
  412. this.queryParams.eTime = this.createTime[1];
  413. } else {
  414. this.queryParams.sTime = null;
  415. this.queryParams.eTime = null;
  416. }
  417. },
  418. qecCreateTimeChange(){
  419. if (this.qecCreateTime != null) {
  420. this.queryParams.qecSTime = this.qecCreateTime[0];
  421. this.queryParams.qecETime = this.qecCreateTime[1];
  422. } else {
  423. this.queryParams.qecSTime = null;
  424. this.queryParams.qecETime = null;
  425. }
  426. },
  427. handleClickX(tab){
  428. if(tab.name==="10"){
  429. this.queryParams.logType=null;
  430. }else{
  431. this.queryParams.logType=tab.name;
  432. }
  433. this.getList()
  434. },
  435. /** 查询短链课程看课记录列表 */
  436. getList() {
  437. this.loading = true;
  438. myListCourseWatchLog(this.queryParams).then(response => {
  439. this.courseWatchLogList = response.rows;
  440. this.total = response.total;
  441. this.loading = false;
  442. });
  443. },
  444. // 取消按钮
  445. cancel() {
  446. this.open = false;
  447. this.reset();
  448. },
  449. // 表单重置
  450. reset() {
  451. this.form = {
  452. logId: null,
  453. userId: null,
  454. videoId: null,
  455. logType: null,
  456. createTime: null,
  457. updateTime: null,
  458. qwExternalContactId: null,
  459. externalUserName:null,
  460. duration: null,
  461. qwUserId: null,
  462. companyUserId: null,
  463. companyId: null,
  464. courseId: null,
  465. scheduleStartTime: null,
  466. scheduleEndTime: null,
  467. };
  468. this.scheduleTime=null;
  469. this.resetForm("form");
  470. },
  471. /** 搜索按钮操作 */
  472. handleQuery() {
  473. this.queryParams.pageNum = 1;
  474. this.getList();
  475. },
  476. /** 重置按钮操作 */
  477. resetQuery() {
  478. this.resetForm("queryForm");
  479. this.createTime = null;
  480. this.qecCreateTime=null;
  481. this.queryParams.sTime = null;
  482. this.queryParams.eTime = null;
  483. this.queryParams.qecSTime = null;
  484. this.queryParams.qecETime = null;
  485. this.queryParams.scheduleStartTime = null;
  486. this.queryParams.scheduleEndTime = null;
  487. this.scheduleTime=null;
  488. this.handleQuery();
  489. },
  490. // 多选框选中数据
  491. handleSelectionChange(selection) {
  492. this.ids = selection.map(item => item.logId)
  493. this.single = selection.length!==1
  494. this.multiple = !selection.length
  495. },
  496. /** 新增按钮操作 */
  497. handleAdd() {
  498. this.reset();
  499. this.open = true;
  500. this.title = "添加短链课程看课记录";
  501. },
  502. /** 修改按钮操作 */
  503. handleUpdate(row) {
  504. this.reset();
  505. const logId = row.logId || this.ids
  506. getCourseWatchLog(logId).then(response => {
  507. this.form = response.data;
  508. this.open = true;
  509. this.title = "修改短链课程看课记录";
  510. });
  511. },
  512. /** 提交按钮 */
  513. submitForm() {
  514. this.$refs["form"].validate(valid => {
  515. if (valid) {
  516. if (this.form.logId != null) {
  517. updateCourseWatchLog(this.form).then(response => {
  518. this.msgSuccess("修改成功");
  519. this.open = false;
  520. this.getList();
  521. });
  522. } else {
  523. addCourseWatchLog(this.form).then(response => {
  524. this.msgSuccess("新增成功");
  525. this.open = false;
  526. this.getList();
  527. });
  528. }
  529. }
  530. });
  531. },
  532. /** 删除按钮操作 */
  533. handleDelete(row) {
  534. const logIds = row.logId || this.ids;
  535. this.$confirm('是否确认删除短链课程看课记录编号为"' + logIds + '"的数据项?', "警告", {
  536. confirmButtonText: "确定",
  537. cancelButtonText: "取消",
  538. type: "warning"
  539. }).then(function() {
  540. return delCourseWatchLog(logIds);
  541. }).then(() => {
  542. this.getList();
  543. this.msgSuccess("删除成功");
  544. }).catch(() => {});
  545. },
  546. /** 导出按钮操作 */
  547. handleExport() {
  548. const queryParams = this.queryParams;
  549. this.$confirm('是否确认导出所有短链课程看课记录数据项?', "警告", {
  550. confirmButtonText: "确定",
  551. cancelButtonText: "取消",
  552. type: "warning"
  553. }).then(() => {
  554. this.exportLoading = true;
  555. return exportCourseWatchLog(queryParams);
  556. }).then(response => {
  557. this.download(response.msg);
  558. this.exportLoading = false;
  559. }).catch(() => {});
  560. },
  561. addUserTag(){
  562. if(this.ids==null||this.ids==""){
  563. return this.$message('请选择需要添加标签的客户');
  564. }
  565. this.getPageListTagGroup();
  566. setTimeout(() => {
  567. for (let i = 0; i < this.tagGroupList.length; i++) {
  568. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  569. this.tagGroupList[i].tag[x].isSelected=false;
  570. }
  571. }
  572. }, 200);
  573. this.tagOpen = true;
  574. },
  575. delUserTag(){
  576. if(this.ids==null||this.ids==""){
  577. return this.$message('请选择需要移除标签的客户');
  578. }
  579. this.getPageListTagGroup();
  580. setTimeout(() => {
  581. for (let i = 0; i < this.tagGroupList.length; i++) {
  582. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  583. this.tagGroupList[i].tag[x].isSelected=false;
  584. }
  585. }
  586. }, 200);
  587. this.tagDelOpen = true;
  588. },
  589. getPageListTagGroup(){
  590. this.queryTagParams.corpId=this.queryParams.corpId
  591. allListTagGroup(this.queryTagParams).then(response => {
  592. this.tagGroupList = response.rows;
  593. this.tagTotal = response.total;
  594. });
  595. },
  596. tagSelection(row){
  597. row.isSelected= !row.isSelected;
  598. this.$forceUpdate();
  599. },
  600. handleSearchTags(name){
  601. if (!name){
  602. return this.$message.error("请输入要搜索的标签")
  603. }
  604. this.queryTagParams.name=name;
  605. this.queryTagParams.corpId=this.queryParams.corpId;
  606. searchTags(this.queryTagParams).then(response => {
  607. this.tagGroupList = response.rows;
  608. });
  609. // searchTags({name:name,corpId:this.queryParams.corpId}).then(response => {
  610. // this.tagGroupList = response.rows;
  611. // });
  612. },
  613. cancelSearchTags(){
  614. this.resetSearchQueryTag()
  615. this.getPageListTagGroup();
  616. },
  617. resetSearchQueryTag(){
  618. this.queryTagParams= {
  619. pageNum: 1,
  620. pageSize: 5,
  621. total:0,
  622. name:null,
  623. };
  624. },
  625. addTagSubmitForm(){
  626. for (let i = 0; i < this.tagGroupList.length; i++) {
  627. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  628. if(this.tagGroupList[i].tag[x].isSelected==true){
  629. this.addTagFormByWatch.tagIds.push(this.tagGroupList[i].tag[x].tagId)
  630. }
  631. }
  632. }
  633. if(this.addTagFormByWatch.tagIds==[]||this.addTagFormByWatch.tagIds==null||this.addTagFormByWatch.tagIds==""){
  634. return this.$message('请选择标签');
  635. }
  636. this.addTagFormByWatch.logIds=this.ids;
  637. let loadingRock = this.$loading({
  638. lock: true,
  639. text: '正在执行中请稍后~~请不要刷新页面!!',
  640. spinner: 'el-icon-loading',
  641. background: 'rgba(0, 0, 0, 0.7)'
  642. });
  643. addTagByWatch(this.addTagFormByWatch).then(response => {
  644. // this.msgSuccess(response.msg);
  645. this.resultMessage = response.msg;
  646. this.resultDialogVisible = true; // 显示弹窗
  647. this.resultTitle = '批量添加标签结果';
  648. this.tagOpen = false;
  649. loadingRock.close();
  650. this.addTagFormByWatch={
  651. logIds:[],
  652. tagIds:[]
  653. };
  654. this.getList()
  655. }).finally(res=>{
  656. loadingRock.close();
  657. });
  658. },
  659. tagDelSubmitForm(){
  660. for (let i = 0; i < this.tagGroupList.length; i++) {
  661. for (let x = 0; x < this.tagGroupList[i].tag.length; x++) {
  662. if(this.tagGroupList[i].tag[x].isSelected==true){
  663. this.addTagFormByWatch.tagIds.push(this.tagGroupList[i].tag[x].tagId)
  664. }
  665. }
  666. }
  667. if(this.addTagFormByWatch.tagIds==[]||this.addTagFormByWatch.tagIds==null||this.addTagFormByWatch.tagIds==""){
  668. return this.$message('请选择标签');
  669. }
  670. this.addTagFormByWatch.corpId=this.queryParams.corpId
  671. this.addTagFormByWatch.logIds=this.ids;
  672. let loadingRock = this.$loading({
  673. lock: true,
  674. text: '正在执行中请稍后~~请不要刷新页面!!',
  675. spinner: 'el-icon-loading',
  676. background: 'rgba(0, 0, 0, 0.7)'
  677. });
  678. delTagByWatch(this.addTagFormByWatch).then(response => {
  679. // this.msgSuccess(response.msg);
  680. this.resultMessage = response.msg;
  681. this.resultDialogVisible = true; // 显示弹窗
  682. this.resultTitle = '批量移除标签结果';
  683. this.tagDelOpen = false;
  684. loadingRock.close();
  685. this.addTagFormByWatch={
  686. userIds:[],
  687. tagIds:[]
  688. };
  689. this.getList()
  690. }).finally(res=>{
  691. loadingRock.close();
  692. });
  693. },
  694. addTagCancel() {
  695. this.tagOpen = false;
  696. this.addTagFormByWatch={
  697. logIds:[],
  698. tagIds:[]
  699. };
  700. },
  701. DelTagCancel() {
  702. this.tagDelOpen = false;
  703. this.addTagFormByWatch={
  704. logIds:[],
  705. tagIds:[]
  706. };
  707. },
  708. }
  709. };
  710. </script>
  711. <style scoped>
  712. /* CSS 样式 */
  713. .tag-container {
  714. display: flex;
  715. flex-wrap: wrap; /* 超出宽度时自动换行 */
  716. gap: 8px; /* 设置标签之间的间距 */
  717. }
  718. .name-background {
  719. display: inline-block;
  720. background-color: #abece6; /* 背景颜色 */
  721. padding: 4px 8px; /* 调整内边距,让背景包裹文字 */
  722. border-radius: 4px; /* 可选:设置圆角 */
  723. }
  724. /* CSS 样式 */
  725. .tag-container {
  726. display: flex;
  727. flex-wrap: wrap; /* 超出宽度时自动换行 */
  728. gap: 8px; /* 设置标签之间的间距 */
  729. }
  730. .name-background {
  731. display: inline-block;
  732. background-color: #abece6; /* 背景颜色 */
  733. padding: 4px 8px; /* 调整内边距,让背景包裹文字 */
  734. border-radius: 4px; /* 可选:设置圆角 */
  735. }
  736. .tag-box {
  737. padding: 8px 12px;
  738. border: 1px solid #989797;
  739. border-radius: 4px;
  740. cursor: pointer;
  741. display: inline-block;
  742. }
  743. .tag-selected {
  744. background-color: #00bc98;
  745. color: #fff;
  746. border-color: #00bc98;
  747. }
  748. .el-tag + .el-tag {
  749. margin-left: 10px;
  750. }
  751. .button-new-tag {
  752. margin-left: 10px;
  753. height: 32px;
  754. line-height: 30px;
  755. padding-top: 0;
  756. padding-bottom: 0;
  757. }
  758. .input-new-tag {
  759. width: 90px;
  760. margin-left: 10px;
  761. vertical-align: bottom;
  762. }
  763. /* 新增的滚动容器样式(不影响原有样式) */
  764. .scroll-wrapper {
  765. max-height: 130px; /* 大约三行的高度 */
  766. overflow-y: auto; /* 垂直滚动 */
  767. padding-right: 5px; /* 为滚动条留出空间 */
  768. }
  769. /* 美化滚动条(可选) */
  770. .scroll-wrapper::-webkit-scrollbar {
  771. width: 6px;
  772. }
  773. .scroll-wrapper::-webkit-scrollbar-thumb {
  774. background: rgba(0, 0, 0, 0.2);
  775. border-radius: 3px;
  776. }
  777. </style>