index.vue 25 KB

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