index-old.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659
  1. <template>
  2. <div class="el-container-md">
  3. <!-- 数据统计指标展示区域 -->
  4. <el-card class="statistics-card" shadow="never">
  5. <el-row :gutter="20">
  6. <el-col :span="4">
  7. <div class="statistics-item">
  8. <div class="statistics-title">累计观看人数</div>
  9. <div class="statistics-value">{{ statisticsData.totalViewers || 0 }}</div>
  10. </div>
  11. </el-col>
  12. <el-col :span="4">
  13. <div class="statistics-item">
  14. <div class="statistics-title">
  15. 累计完课人数
  16. <el-popover placement="top" width="200" trigger="click">
  17. <div>
  18. <el-input-number v-model="completeWatchTime" :min="0" :precision="0" placeholder="看课时长(分钟)" style="width: 100%;"></el-input-number>
  19. <el-button type="primary" size="mini" style="width: 100%; margin-top: 10px;" @click="updateCompleteWatchTime('total')">确定</el-button>
  20. </div>
  21. <el-button slot="reference" size="mini" type="text" icon="el-icon-setting" style="margin-left: 5px;">设置</el-button>
  22. </el-popover>
  23. </div>
  24. <div class="statistics-value">{{ statisticsData.totalCompletedCourses || 0 }}</div>
  25. </div>
  26. </el-col>
  27. <el-col :span="4">
  28. <div class="statistics-item">
  29. <div class="statistics-title">直播观看人数</div>
  30. <div class="statistics-value">{{ statisticsData.liveViewers || 0 }}</div>
  31. </div>
  32. </el-col>
  33. <el-col :span="4">
  34. <div class="statistics-item">
  35. <div class="statistics-title">
  36. 直播完课人数
  37. <el-popover placement="top" width="200" trigger="click">
  38. <div>
  39. <el-input-number v-model="liveCompleteWatchTime" :min="0" :precision="0" placeholder="看课时长(分钟)" style="width: 100%;"></el-input-number>
  40. <el-button type="primary" size="mini" style="width: 100%; margin-top: 10px;" @click="updateCompleteWatchTime('live')">确定</el-button>
  41. </div>
  42. <el-button slot="reference" size="mini" type="text" icon="el-icon-setting" style="margin-left: 5px;">设置</el-button>
  43. </el-popover>
  44. </div>
  45. <div class="statistics-value">{{ statisticsData.liveCompletedCourses || 0 }}</div>
  46. </div>
  47. </el-col>
  48. <el-col :span="4">
  49. <div class="statistics-item">
  50. <div class="statistics-title">回放观看人数</div>
  51. <div class="statistics-value">{{ statisticsData.playbackViewers || 0 }}</div>
  52. </div>
  53. </el-col>
  54. <el-col :span="4">
  55. <div class="statistics-item">
  56. <div class="statistics-title">
  57. 回放完课人数
  58. <el-popover placement="top" width="200" trigger="click">
  59. <div>
  60. <el-input-number v-model="replayCompleteWatchTime" :min="0" :precision="0" placeholder="看课时长(分钟)" style="width: 100%;"></el-input-number>
  61. <el-button type="primary" size="mini" style="width: 100%; margin-top: 10px;" @click="updateCompleteWatchTime('replay')">确定</el-button>
  62. </div>
  63. <el-button slot="reference" size="mini" type="text" icon="el-icon-setting" style="margin-left: 5px;">设置</el-button>
  64. </el-popover>
  65. </div>
  66. <div class="statistics-value">{{ statisticsData.playbackCompletedCourses || 0 }}</div>
  67. </div>
  68. </el-col>
  69. </el-row>
  70. <el-row :gutter="20" style="margin-top: 20px;">
  71. <el-col :span="4">
  72. <div class="statistics-item">
  73. <div class="statistics-title">直播峰值</div>
  74. <div class="statistics-value">{{ statisticsData.livePeak || 0 }}</div>
  75. </div>
  76. </el-col>
  77. <el-col :span="4">
  78. <div class="statistics-item">
  79. <div class="statistics-title">直播平均时长</div>
  80. <div class="statistics-value">{{ formatDuration(statisticsData.liveAvgDuration) }}</div>
  81. </div>
  82. </el-col>
  83. <el-col :span="4">
  84. <div class="statistics-item">
  85. <div class="statistics-title">回放平均时长</div>
  86. <div class="statistics-value">{{ formatDuration(statisticsData.playbackAvgDuration) }}</div>
  87. </div>
  88. </el-col>
  89. <el-col :span="4">
  90. <div class="statistics-item">
  91. <div class="statistics-title">GMV</div>
  92. <div class="statistics-value">¥{{ statisticsData.gmv || 0 }}</div>
  93. </div>
  94. </el-col>
  95. <el-col :span="4">
  96. <div class="statistics-item">
  97. <div class="statistics-title">付费人数</div>
  98. <div class="statistics-value">{{ statisticsData.paidUsers || 0 }}</div>
  99. </div>
  100. </el-col>
  101. <el-col :span="4">
  102. <div class="statistics-item">
  103. <div class="statistics-title">付费单数</div>
  104. <div class="statistics-value">{{ statisticsData.paidOrders || 0 }}</div>
  105. </div>
  106. </el-col>
  107. </el-row>
  108. <el-row :gutter="20" style="margin-top: 20px;">
  109. <el-col :span="4">
  110. <div class="statistics-item">
  111. <div class="statistics-title">销量统计</div>
  112. <div class="statistics-value">{{ statisticsData.salesCount || 0 }}</div>
  113. </div>
  114. </el-col>
  115. </el-row>
  116. </el-card>
  117. <!-- 筛选条件区域 -->
  118. <el-form :model="queryParams" class="live-data-css" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px">
  119. <el-form-item label="直播名称" prop="liveName">
  120. <el-input
  121. v-model="queryParams.liveName"
  122. placeholder="请输入直播名称"
  123. clearable
  124. size="small"
  125. @keyup.enter.native="handleQuery"
  126. />
  127. </el-form-item>
  128. <el-form-item label="观看类型" prop="watchType">
  129. <el-select v-model="queryParams.watchType" placeholder="请选择观看类型" clearable size="small">
  130. <el-option label="直播" value="live"></el-option>
  131. <el-option label="回放" value="replay"></el-option>
  132. </el-select>
  133. </el-form-item>
  134. <el-form-item label="完课状态" prop="completeStatus">
  135. <el-select v-model="queryParams.completeStatus" placeholder="请选择完课状态" clearable size="small">
  136. <el-option label="已完课" value="1"></el-option>
  137. <el-option label="未完课" value="0"></el-option>
  138. </el-select>
  139. </el-form-item>
  140. <el-form-item label="付费状态" prop="payStatus">
  141. <el-select v-model="queryParams.payStatus" placeholder="请选择付费状态" clearable size="small">
  142. <el-option label="已付费" value="1"></el-option>
  143. <el-option label="未付费" value="0"></el-option>
  144. </el-select>
  145. </el-form-item>
  146. <el-form-item label="观看时长" prop="watchDuration">
  147. <el-input-number
  148. v-model="queryParams.watchDuration"
  149. :min="0"
  150. :precision="0"
  151. placeholder="观看时长(分钟)"
  152. size="small"
  153. ></el-input-number>
  154. </el-form-item>
  155. <el-form-item label="时间范围" prop="dateRange">
  156. <el-date-picker
  157. v-model="dateRange"
  158. type="datetimerange"
  159. range-separator="至"
  160. start-placeholder="开始日期"
  161. end-placeholder="结束日期"
  162. size="small"
  163. value-format="yyyy-MM-dd HH:mm:ss"
  164. ></el-date-picker>
  165. </el-form-item>
  166. <el-form-item>
  167. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  168. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  169. </el-form-item>
  170. </el-form>
  171. <!-- 操作工具栏 -->
  172. <div class="selection-toolbar">
  173. <el-checkbox :indeterminate="isIndeterminate" v-model="allChecked" @change="toggleSelectAll">
  174. {{ multipleSelection.length > 0 ? `已选 ${multipleSelection.length} 条` : '选中本页' }}
  175. </el-checkbox>
  176. <!-- <el-button plain size="mini" @click="handleAutoTag">自动打标签</el-button>-->
  177. <!-- <el-button plain size="mini" @click="handleAutoRemark">自动备注</el-button>-->
  178. <el-button plain type="primary" size="mini" icon="el-icon-download" :loading="exportLoading" @click="handleExport">导出</el-button>
  179. </div>
  180. <!-- 数据表格 -->
  181. <el-table
  182. ref="dataTable"
  183. :data="dataList"
  184. style="width: 100%"
  185. v-loading="loading"
  186. @selection-change="handleSelectionChange"
  187. >
  188. <el-table-column type="selection" width="55"></el-table-column>
  189. <el-table-column type="index" label="序号" width="55" align="center"></el-table-column>
  190. <el-table-column prop="liveName" label="直播间名称" min-width="160" show-overflow-tooltip></el-table-column>
  191. <el-table-column prop="liveType" label="直播类型" width="100" align="center">
  192. <template slot-scope="scope">
  193. <el-tag type="danger" v-if="scope.row.liveType == 1">直播</el-tag>
  194. <el-tag type="success" v-else-if="scope.row.liveType == 2">录播</el-tag>
  195. <el-tag v-else-if="scope.row.liveType == 3">直播回放</el-tag>
  196. <span v-else>-</span>
  197. </template>
  198. </el-table-column>
  199. <el-table-column prop="status" label="状态" width="100" align="center">
  200. <template slot-scope="scope">
  201. <el-tag type="info" v-if="scope.row.status == 1">未开始</el-tag>
  202. <el-tag type="warning" v-else-if="scope.row.status == 2">进行中</el-tag>
  203. <el-tag type="success" v-else-if="scope.row.status == 3">已结束</el-tag>
  204. <span v-else>-</span>
  205. </template>
  206. </el-table-column>
  207. <el-table-column prop="startTime" label="开始时间" width="180" align="center"></el-table-column>
  208. <el-table-column prop="finishTime" label="结束时间" width="180" align="center"></el-table-column>
  209. <el-table-column prop="totalViewers" label="累计观看" width="110" align="center"></el-table-column>
  210. <el-table-column prop="liveViewers" label="直播观看" width="110" align="center"></el-table-column>
  211. <el-table-column prop="playbackViewers" label="回放观看" width="110" align="center"></el-table-column>
  212. <el-table-column prop="liveAvgDuration" label="直播平均时长" width="140" align="center">
  213. <template slot-scope="scope">{{ formatDuration(scope.row.liveAvgDuration) }}</template>
  214. </el-table-column>
  215. <el-table-column prop="playbackAvgDuration" label="回放平均时长" width="140" align="center">
  216. <template slot-scope="scope">{{ formatDuration(scope.row.playbackAvgDuration) }}</template>
  217. </el-table-column>
  218. <el-table-column prop="totalCompletedCourses" label="累计完课" width="110" align="center"></el-table-column>
  219. <el-table-column prop="liveCompletedCourses" label="直播完课" width="110" align="center"></el-table-column>
  220. <el-table-column prop="playbackCompletedCourses" label="回放完课" width="110" align="center"></el-table-column>
  221. <el-table-column prop="gmv" label="GMV" width="120" align="center">
  222. <template slot-scope="scope">¥{{ scope.row.gmv || 0 }}</template>
  223. </el-table-column>
  224. <el-table-column prop="paidUsers" label="付费人数" width="100" align="center"></el-table-column>
  225. <el-table-column prop="paidOrders" label="付费单数" width="100" align="center"></el-table-column>
  226. <el-table-column prop="salesCount" label="销量统计" width="100" align="center"></el-table-column>
  227. <el-table-column label="操作" width="120" fixed="right">
  228. <template slot-scope="scope">
  229. <el-button type="text" size="small" @click="handleViewDetail(scope.row)">查看详情</el-button>
  230. </template>
  231. </el-table-column>
  232. </el-table>
  233. <!-- 分页组件 -->
  234. <pagination
  235. v-show="total > 0"
  236. :total="total"
  237. :page.sync="queryParams.pageNum"
  238. :limit.sync="queryParams.pageSize"
  239. @pagination="getList"
  240. style="margin-top: 20px;"
  241. />
  242. <!-- 自动打标签弹窗 -->
  243. <el-dialog
  244. title="自动打标签"
  245. :visible.sync="tagDialogVisible"
  246. width="600px"
  247. :close-on-click-modal="false"
  248. >
  249. <el-form :model="tagForm" label-width="120px">
  250. <el-form-item label="打标签规则">
  251. <el-checkbox-group v-model="tagForm.rules">
  252. <el-checkbox label="liveComplete">直播完课</el-checkbox>
  253. <el-checkbox label="replayComplete">回放完课</el-checkbox>
  254. <el-checkbox label="pay">付费行为</el-checkbox>
  255. </el-checkbox-group>
  256. </el-form-item>
  257. <el-form-item label="标签名称">
  258. <el-input v-model="tagForm.tagName" placeholder="请输入标签名称"></el-input>
  259. </el-form-item>
  260. <el-form-item label="备注格式">
  261. <el-radio-group v-model="tagForm.remarkFormat">
  262. <el-radio label="time">时间—行为(如:2024-01-01—直播完课)</el-radio>
  263. <el-radio label="simple">仅行为(如:直播完课)</el-radio>
  264. </el-radio-group>
  265. </el-form-item>
  266. </el-form>
  267. <div slot="footer" class="dialog-footer">
  268. <el-button @click="tagDialogVisible = false">取 消</el-button>
  269. <el-button type="primary" @click="confirmAutoTag">确 定</el-button>
  270. </div>
  271. </el-dialog>
  272. <!-- 自动备注弹窗 -->
  273. <el-dialog
  274. title="自动备注"
  275. :visible.sync="remarkDialogVisible"
  276. width="600px"
  277. :close-on-click-modal="false"
  278. >
  279. <el-form :model="remarkForm" label-width="120px">
  280. <el-form-item label="备注规则">
  281. <el-checkbox-group v-model="remarkForm.rules">
  282. <el-checkbox label="liveComplete">直播完课</el-checkbox>
  283. <el-checkbox label="replayComplete">回放完课</el-checkbox>
  284. <el-checkbox label="pay">付费行为</el-checkbox>
  285. </el-checkbox-group>
  286. </el-form-item>
  287. <el-form-item label="备注格式">
  288. <el-radio-group v-model="remarkForm.remarkFormat">
  289. <el-radio label="time">时间—行为(如:2024-01-01—直播完课)</el-radio>
  290. <el-radio label="simple">仅行为(如:直播完课)</el-radio>
  291. </el-radio-group>
  292. </el-form-item>
  293. <el-form-item label="备注位置">
  294. <el-radio-group v-model="remarkForm.position">
  295. <el-radio :label="1">添加在最前面</el-radio>
  296. <el-radio :label="2">添加在最后面</el-radio>
  297. <el-radio :label="3">替换所有备注</el-radio>
  298. </el-radio-group>
  299. </el-form-item>
  300. </el-form>
  301. <div slot="footer" class="dialog-footer">
  302. <el-button @click="remarkDialogVisible = false">取 消</el-button>
  303. <el-button type="primary" @click="confirmAutoRemark">确 定</el-button>
  304. </div>
  305. </el-dialog>
  306. </div>
  307. </template>
  308. <script>
  309. import { listLiveData, exportLiveData, autoTagAndRemark, dashboardData } from "@/api/live/liveData";
  310. import { batchUpdateExternalContactNotes } from "@/api/qw/externalContact";
  311. import { addTag } from "@/api/qw/externalContact";
  312. export default {
  313. name: "LiveData",
  314. data() {
  315. return {
  316. liveId: '',
  317. loading: true,
  318. exportLoading: false,
  319. showSearch: true,
  320. dataList: [],
  321. total: 0,
  322. multipleSelection: [],
  323. allChecked: false,
  324. isIndeterminate: false,
  325. dateRange: [],
  326. // 统计数据
  327. statisticsData: {
  328. gmv: 0,
  329. liveAvgDuration: 0,
  330. liveCompletedCourses: 0,
  331. livePeak: 0,
  332. liveViewers: 0,
  333. paidOrders: 0,
  334. paidUsers: 0,
  335. playbackAvgDuration: 0,
  336. playbackCompletedCourses: 0,
  337. playbackViewers: 0,
  338. salesCount: 0,
  339. totalCompletedCourses: 0,
  340. totalViewers: 1
  341. },
  342. // 完课时长设置
  343. completeWatchTime: 0,
  344. liveCompleteWatchTime: 0,
  345. replayCompleteWatchTime: 0,
  346. // 查询参数
  347. queryParams: {
  348. pageNum: 1,
  349. pageSize: 10,
  350. liveId: null,
  351. liveName: null,
  352. watchType: null,
  353. completeStatus: null,
  354. payStatus: null,
  355. watchDuration: null,
  356. startTime: null,
  357. endTime: null
  358. },
  359. // 打标签弹窗
  360. tagDialogVisible: false,
  361. tagForm: {
  362. rules: [],
  363. tagName: '',
  364. remarkFormat: 'time'
  365. },
  366. // 备注弹窗
  367. remarkDialogVisible: false,
  368. remarkForm: {
  369. rules: [],
  370. remarkFormat: 'time',
  371. position: 1
  372. }
  373. };
  374. },
  375. created() {
  376. this.liveId = this.$route.query.liveId;
  377. this.queryParams.liveId = this.liveId;
  378. this.getList();
  379. },
  380. methods: {
  381. /** 获取统计数据 */
  382. getStatistics() {
  383. if (!this.liveId) return;
  384. dashboardData(this.liveId).then(response => {
  385. if (response.code === 200) {
  386. this.statisticsData = response.data || {};
  387. }
  388. });
  389. },
  390. /** 获取列表数据 */
  391. getList() {
  392. this.loading = true;
  393. // 处理时间范围
  394. if (this.dateRange && this.dateRange.length === 2) {
  395. this.queryParams.startTime = this.dateRange[0];
  396. this.queryParams.endTime = this.dateRange[1];
  397. } else {
  398. this.queryParams.startTime = null;
  399. this.queryParams.endTime = null;
  400. }
  401. listLiveData(this.queryParams).then(response => {
  402. if (response.code === 200) {
  403. this.statisticsData = response.data || {};
  404. this.dataList = response.list || [];
  405. this.total = response.total || 0;
  406. }
  407. this.loading = false;
  408. }).catch(() => {
  409. this.loading = false;
  410. });
  411. },
  412. /** 搜索按钮操作 */
  413. handleQuery() {
  414. this.queryParams.pageNum = 1;
  415. this.getList();
  416. },
  417. /** 重置按钮操作 */
  418. resetQuery() {
  419. this.dateRange = [];
  420. this.$refs.queryForm.resetFields();
  421. this.handleQuery();
  422. },
  423. /** 全选或取消全选 */
  424. toggleSelectAll(val) {
  425. if (val) {
  426. this.toggleSelection(this.dataList);
  427. } else {
  428. this.toggleSelection();
  429. }
  430. },
  431. toggleSelection(rows) {
  432. if (rows) {
  433. rows.forEach(row => {
  434. this.$refs.dataTable.toggleRowSelection(row);
  435. });
  436. } else {
  437. this.$refs.dataTable.clearSelection();
  438. }
  439. },
  440. /** 多选框选中数据 */
  441. handleSelectionChange(val) {
  442. this.multipleSelection = val;
  443. this.allChecked = val.length === this.dataList.length;
  444. this.isIndeterminate = val.length > 0 && val.length < this.dataList.length;
  445. },
  446. /** 导出按钮操作 */
  447. handleExport() {
  448. if (this.dateRange && this.dateRange.length === 2) {
  449. this.queryParams.startTime = this.dateRange[0];
  450. this.queryParams.endTime = this.dateRange[1];
  451. } else {
  452. this.queryParams.startTime = null;
  453. this.queryParams.endTime = null;
  454. }
  455. this.$confirm('是否确认导出所有直播数据?', "警告", {
  456. confirmButtonText: "确定",
  457. cancelButtonText: "取消",
  458. type: "warning"
  459. }).then(() => {
  460. this.exportLoading = true;
  461. return exportLiveData(this.queryParams);
  462. }).then(response => {
  463. if (response.code === 200) {
  464. this.download(response.msg);
  465. }
  466. this.exportLoading = false;
  467. }).catch(() => {
  468. this.exportLoading = false;
  469. });
  470. },
  471. /** 自动打标签 */
  472. // handleAutoTag() {
  473. // if (this.multipleSelection.length === 0) {
  474. // this.$message.warning('请选择要打标签的数据');
  475. // return;
  476. // }
  477. // this.tagDialogVisible = true;
  478. // },
  479. /** 确认自动打标签 */
  480. confirmAutoTag() {
  481. if (this.tagForm.rules.length === 0) {
  482. this.$message.warning('请选择打标签规则');
  483. return;
  484. }
  485. const userIds = this.multipleSelection.map(item => item.userId).filter(id => id);
  486. if (userIds.length === 0) {
  487. this.$message.warning('所选数据中没有有效的用户ID');
  488. return;
  489. }
  490. const data = {
  491. userIds: userIds,
  492. rules: this.tagForm.rules,
  493. tagName: this.tagForm.tagName,
  494. remarkFormat: this.tagForm.remarkFormat,
  495. liveId: this.liveId
  496. };
  497. autoTagAndRemark(data).then(response => {
  498. if (response.code === 200) {
  499. this.$message.success('打标签成功');
  500. this.tagDialogVisible = false;
  501. this.tagForm = {
  502. rules: [],
  503. tagName: '',
  504. remarkFormat: 'time'
  505. };
  506. this.getList();
  507. }
  508. });
  509. },
  510. /** 自动备注 */
  511. // handleAutoRemark() {
  512. // if (this.multipleSelection.length === 0) {
  513. // this.$message.warning('请选择要备注的数据');
  514. // return;
  515. // }
  516. // this.remarkDialogVisible = true;
  517. // },
  518. /** 确认自动备注 */
  519. confirmAutoRemark() {
  520. if (this.remarkForm.rules.length === 0) {
  521. this.$message.warning('请选择备注规则');
  522. return;
  523. }
  524. const userIds = this.multipleSelection.map(item => item.userId).filter(id => id);
  525. if (userIds.length === 0) {
  526. this.$message.warning('所选数据中没有有效的用户ID');
  527. return;
  528. }
  529. // 生成备注内容
  530. let notes = '';
  531. const now = new Date();
  532. const dateStr = now.getFullYear() + '-' +
  533. String(now.getMonth() + 1).padStart(2, '0') + '-' +
  534. String(now.getDate()).padStart(2, '0');
  535. this.remarkForm.rules.forEach((rule, index) => {
  536. let ruleText = '';
  537. if (rule === 'liveComplete') {
  538. ruleText = '直播完课';
  539. } else if (rule === 'replayComplete') {
  540. ruleText = '回放完课';
  541. } else if (rule === 'pay') {
  542. ruleText = '付费行为';
  543. }
  544. if (this.remarkForm.remarkFormat === 'time') {
  545. notes += (index > 0 ? ';' : '') + dateStr + '—' + ruleText;
  546. } else {
  547. notes += (index > 0 ? ';' : '') + ruleText;
  548. }
  549. });
  550. const data = {
  551. userIds: userIds,
  552. notes: notes,
  553. type: this.remarkForm.position,
  554. nameType: 3, // 不添加客户名称
  555. filter: false
  556. };
  557. batchUpdateExternalContactNotes(data).then(response => {
  558. if (response.code === 200) {
  559. this.$message.success('备注成功');
  560. this.remarkDialogVisible = false;
  561. this.remarkForm = {
  562. rules: [],
  563. remarkFormat: 'time',
  564. position: 1
  565. };
  566. this.getList();
  567. }
  568. });
  569. },
  570. /** 查看详情 */
  571. handleViewDetail(row) {
  572. // 可以跳转到详情页面或打开详情弹窗
  573. this.$message.info('查看详情功能待实现');
  574. },
  575. /** 格式化时长 */
  576. formatDuration(seconds) {
  577. if (!seconds) return '00:00:00';
  578. const hours = Math.floor(seconds / 3600);
  579. const minutes = Math.floor((seconds % 3600) / 60);
  580. const secs = seconds % 60;
  581. return `${String(hours).padStart(2, '0')}:${String(minutes).padStart(2, '0')}:${String(secs).padStart(2, '0')}`;
  582. },
  583. /** 更新完课时长设置 */
  584. updateCompleteWatchTime(type) {
  585. // 这里可以调用API保存设置
  586. let watchTime = 0;
  587. if (type === 'total') {
  588. watchTime = this.completeWatchTime;
  589. } else if (type === 'live') {
  590. watchTime = this.liveCompleteWatchTime;
  591. } else if (type === 'replay') {
  592. watchTime = this.replayCompleteWatchTime;
  593. }
  594. // 更新查询参数并重新获取数据
  595. this.queryParams.completeWatchTime = watchTime;
  596. // this.getStatistics();
  597. this.getList();
  598. this.$message.success('设置成功');
  599. }
  600. }
  601. };
  602. </script>
  603. <style scoped>
  604. .statistics-card {
  605. margin-bottom: 20px;
  606. }
  607. .statistics-item {
  608. text-align: center;
  609. padding: 15px;
  610. background: #f5f7fa;
  611. border-radius: 4px;
  612. }
  613. .statistics-title {
  614. font-size: 14px;
  615. color: #606266;
  616. margin-bottom: 10px;
  617. display: flex;
  618. align-items: center;
  619. justify-content: center;
  620. }
  621. .statistics-value {
  622. font-size: 24px;
  623. font-weight: bold;
  624. color: #303133;
  625. }
  626. .selection-toolbar {
  627. display: flex;
  628. align-items: center;
  629. margin-bottom: 10px;
  630. padding-left: 10px;
  631. }
  632. .selection-toolbar .el-checkbox {
  633. margin-right: 10px;
  634. }
  635. .live-data-css {
  636. padding-left: 10px;
  637. padding-top: 30px;
  638. }
  639. </style>