Kaynağa Gözat

直播视频添加文件大小 还有 流量统计页面

yuhongqi 1 hafta önce
ebeveyn
işleme
1330288462

+ 53 - 0
src/api/live/liveTrafficLog.js

@@ -0,0 +1,53 @@
+import request from '@/utils/request'
+
+// 查询短链课程流量记录列表
+export function listCourseTrafficLog(query) {
+  return request({
+    url: '/live/trafficLog/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询短链课程流量记录详细
+export function getCourseTrafficLog(logId) {
+  return request({
+    url: '/live/trafficLog/' + logId,
+    method: 'get'
+  })
+}
+
+// 新增短链课程流量记录
+export function addCourseTrafficLog(data) {
+  return request({
+    url: '/live/trafficLog',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改短链课程流量记录
+export function updateCourseTrafficLog(data) {
+  return request({
+    url: '/live/trafficLog',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除短链课程流量记录
+export function delCourseTrafficLog(logId) {
+  return request({
+    url: '/live/trafficLog/' + logId,
+    method: 'delete'
+  })
+}
+
+// 导出短链课程流量记录
+export function exportCourseTrafficLog(query) {
+  return request({
+    url: '/live/trafficLog/export',
+    method: 'get',
+    params: query
+  })
+}

+ 3 - 1
src/components/VideoUpload/index.vue

@@ -108,7 +108,7 @@
         :total="libraryTotal"
         :page.sync="libraryQueryParams.pageNum"
         :limit.sync="libraryQueryParams.pageSize"
-        @pagination="getLibraryList"
+        @pagination="getList"
       />
 
       <div slot="footer" class="dialog-footer">
@@ -394,6 +394,8 @@ export default {
         this.$message.warning("请选择一个视频");
         return;
       }
+      console.log("confirmVideoSelection")
+      console.log(this.selectedVideo)
 
       // 更新组件内部数据
       this.$emit("update:fileName", this.selectedVideo.fileName);

+ 2 - 0
src/views/live/liveConfig/preview.vue

@@ -152,6 +152,7 @@ export default {
         videoUrl: this.videoUrl,
         videoType: 3,
         duration: this.form.duration,
+        fileSize: this.form.fileSize,
        }
       addLiveVideo(doParam).then(response => {
         if (response.code == 200) {
@@ -259,6 +260,7 @@ export default {
         isTranscode:0,
         transcodeFileKey:null,
         videoUrl: null,
+        fileSize: null,
       };
       setTimeout(() => {
         this.$refs.videoUpload.reset();

+ 8 - 2
src/views/live/liveRewardRecord/index.vue

@@ -98,8 +98,6 @@ export default {
   created() {
     getCompanyList().then(response => {
       this.companys = response.data;
-      this.companys.push({companyId:0,companyName:"全部公司"})
-      console.log(this.companys)
       this.companyId=this.companys[0].companyId;
       this.queryParams.companyId=this.companyId;
       this.initData()
@@ -107,6 +105,10 @@ export default {
   },
   methods: {
     handleExport(){
+      if(this.queryParams.companyId == null) {
+        this.$message.error('请选择公司名')
+        return
+      }
       if(this.selectedTimeStep == null || this.selectedTimeStep.length < 1) {
         this.$message.error('请选择导出月份')
         return
@@ -137,6 +139,10 @@ export default {
 
     },
     initData() {
+      if(this.queryParams.companyId == null) {
+        this.$message.error('请选择公司名')
+        return
+      }
       this.queryParams.step=[]
       this.queryParams.step.push(this.selectedTimeStep);
       statistics(this.queryParams).then(res => {

+ 267 - 0
src/views/live/liveTrafficLog/index.vue

@@ -0,0 +1,267 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="技术主体" prop="companyId" >
+        <el-select v-model="queryParams.companyId" placeholder="请选择技术主体" filterable clearable size="small">
+          <el-option
+            v-for="item in companyList"
+            :key="item.companyId"
+            :label="item.companyName"
+            :value="item.companyId"
+          />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="年月" prop="time">
+        <el-date-picker
+          v-model="queryParams.time"
+          type="month"
+          placeholder="选择年月"
+          :picker-options="pickerOptions"
+          :value-format="'yyyy-MM'"
+        ></el-date-picker>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          plain
+          icon="el-icon-download"
+          size="mini"
+          :loading="exportLoading"
+          @click="handleExport"
+          v-hasPermi="['course:courseTrafficLog:export']"
+        >导出</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table border v-loading="loading" :data="courseTrafficLogList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="技术主体" align="center" prop="companyName" />
+      <el-table-column label="月份" align="center" prop="month" />
+      <el-table-column label="使用流量" align="center">
+        <template slot-scope="scope">
+          <span>{{ formatTrafficData(scope.row.totalInternetTraffic) }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="费用" align="center">
+        <template slot-scope="scope">
+          <span>{{ formatTrafficMoney(scope.row.totalInternetTraffic) }}</span>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+  </div>
+</template>
+
+<script>
+import { listCourseTrafficLog, getCourseTrafficLog, delCourseTrafficLog, addCourseTrafficLog, updateCourseTrafficLog, exportCourseTrafficLog } from "@/api/live/liveTrafficLog";
+import {getCompanyList} from "@/api/company/company";
+
+export default {
+  name: "LiveTrafficLog",
+  data() {
+    return {
+      companyList:[],
+      pickerOptions: {
+        shortcuts: [{ text: '本月', onClick: () => this.handleShortcut() }],
+      },
+      // 遮罩层
+      loading: true,
+      // 导出遮罩层
+      exportLoading: false,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 短链课程流量记录表格数据
+      courseTrafficLogList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        userId: null,
+        liveId: null,
+        qwExternalContactId: null,
+        internetTraffic: null,
+        qwUserId: null,
+        companyUserId: null,
+        companyId: null,
+        courseId: null,
+        time:new Date().toISOString().slice(0, 7)
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+      }
+    };
+  },
+  created() {
+    this.getList();
+    this.getAllCompany();
+  },
+  methods: {
+    getAllCompany() {
+      getCompanyList().then(response => {
+        this.companyList = response.data;
+      });
+    },
+    formatTrafficData(traffic) {
+
+        if (traffic < 1024) { // Less than 1 KB
+          return traffic + ' B';
+        } else if (traffic < 1024 * 1024) { // Less than 1 MB
+          return (traffic / 1024).toFixed(2) + ' KB';
+        } else if (traffic < 1024 * 1024 * 1024) { // Less than 1 GB
+          return (traffic / (1024 * 1024)).toFixed(2) + ' MB';
+        } else { // More than 1 GB
+          return (traffic / (1024 * 1024 * 1024)).toFixed(2) + ' GB';
+        }
+
+    },
+    formatTrafficMoney(traffic){
+      return (traffic / (1024 * 1024 * 1024) * 0.095).toFixed(2) + ' 元'
+    },
+
+    handleShortcut() {
+      this.queryParams.time = new Date().toISOString().slice(0, 7);
+    },
+    /** 查询短链课程流量记录列表 */
+    getList() {
+      this.loading = true;
+      listCourseTrafficLog(this.queryParams).then(response => {
+        this.courseTrafficLogList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        logId: null,
+        userId: null,
+        videoId: null,
+        createTime: null,
+        qwExternalContactId: null,
+        internetTraffic: null,
+        qwUserId: null,
+        companyUserId: null,
+        companyId: null,
+        courseId: null
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.logId)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加短链课程流量记录";
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      const logId = row.logId || this.ids
+      getCourseTrafficLog(logId).then(response => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "修改短链课程流量记录";
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.logId != null) {
+            updateCourseTrafficLog(this.form).then(response => {
+              this.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addCourseTrafficLog(this.form).then(response => {
+              this.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const logIds = row.logId || this.ids;
+      this.$confirm('是否确认删除短链课程流量记录编号为"' + logIds + '"的数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return delCourseTrafficLog(logIds);
+        }).then(() => {
+          this.getList();
+          this.msgSuccess("删除成功");
+        }).catch(() => {});
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      const queryParams = this.queryParams;
+      this.$confirm('是否确认导出所有短链课程流量记录数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(() => {
+          this.exportLoading = true;
+          return exportCourseTrafficLog(queryParams);
+        }).then(response => {
+          this.download(response.msg);
+          this.exportLoading = false;
+        }).catch(() => {});
+    }
+  }
+};
+</script>