hbchen 1 rok temu
rodzic
commit
32098f3814

+ 8 - 0
src/api/modules/semanticsApi.js

@@ -441,6 +441,14 @@ const asrInterface = {
   getConvertList:params=>{
     return http.get('/speech_recognition/convert_list',params)
   },
+  /**
+   * 校验文件是否重命
+   * @param {} 
+   * MenuId Files:[{FileName,ResourceUrl}] 
+  */ 
+  speechFlieRepetitionCheck:params=>{
+    return http.post('/speech_recognition/convert/check_name',params)
+  },
   /**
    * 新建 - 批量转写
    * @param {} 

+ 3 - 10
src/views/semantics_manage/asr/ASR.vue

@@ -482,7 +482,6 @@ export default {
     getTreeData(getDetail) {
       asrInterface.getCatalogueList({ParentId:0}).then(res=>{
         if(res.Ret == 200){
-          console.log(res,'res');
           this.treeData=res.Data || []
           // 默认选中第一个一级分类
           this.select_node_key = this.select_node_key||this.treeData[0].UniqueCode
@@ -515,7 +514,6 @@ export default {
     getArticleCatalogue(){
       asrInterface.getCatalogueTree().then(res=>{
         if(res.Ret == 200){
-          console.log(res,'ressss');
           this.articleCatalogue=res.Data || []
         }
       })
@@ -533,7 +531,6 @@ export default {
       asrInterface.getTagsList().then(res=>{
         if(res.Ret == 200){
           this.tagsList=res.Data || []
-          console.log(this.tagsList,'this.tagsList');
           if(this.makeTagsDiaShow){
             setTimeout(()=>{
               this.$refs.makeTagsRef.updateTagsList()
@@ -553,7 +550,6 @@ export default {
       dataAuthInterface.userSearch().then(res=>{
         if(res.Ret == 200){
           this.authorsList = res.Data||[];
-          console.log(this.authorsList,'this.authorsList');
         }
       })
 
@@ -876,7 +872,7 @@ export default {
     /* 拖拽完成 */
     dropOverHandle(b, a, i, e) {
       // 被拖拽节点对应的 Node、结束拖拽时最后进入的节点、被拖拽节点的放置位置
-      console.log(b,a,i);
+      // console.log(b,a,i);
 			let elementKey = this.leftShowLabel=="目录"?"SpeechRecognitionId":"TagId"
 
 			const isEDB=b.data[elementKey]?true:false
@@ -1061,7 +1057,6 @@ export default {
       }
       asrInterface.getSpeechList(params).then(res=>{
         if(res.Ret == 200){
-          console.log(res);
           let arr = res.Data.List||[]
           let paging = res.Data.Paging || {}
           this.articleList=this.page==1?arr:[...this.articleList,...arr]
@@ -1140,12 +1135,12 @@ export default {
     },
     makeTagsDiaOpen(row){
       this.currentRow=row || this.articleDetail
-      console.log(this.currentRow,'this.currentRow');
+      // console.log(this.currentRow,'this.currentRow');
       this.getTagsList()
       this.getTagCatalogue()
       this.makeTagsData={
         id:this.currentRow.SpeechRecognitionId,
-        tagsArr:this.currentRow.Tags.map(item => item.TagId),
+        tagsArr:this.currentRow.Tags?this.currentRow.Tags.map(item => item.TagId):[],
       }
       this.makeTagsDiaShow=true
     },
@@ -1157,7 +1152,6 @@ export default {
     },
     updateTagsTree(codeSet){
       let arr = [...codeSet]
-      console.log(arr,'arr');
       arr.map(code =>{
         if(code && (!this.tagDefaultShowNodes.some(item => item === code))){
           this.tagDefaultShowNodes.push(code)
@@ -1401,7 +1395,6 @@ export default {
       this.highlightDom[this.num-1].style.borderBottom="none"
     },
     updateData(e,row,index){
-      // console.log("updateData");
       // 这种方法在有关键词高亮的段落会出问题,因高亮改变了html结构 有解决方案请替换
       // row.Content=e.target.textContent
 

+ 1 - 2
src/views/semantics_manage/asr/components/catalogueDia.vue

@@ -50,7 +50,6 @@ import {asrInterface} from '@/api/modules/semanticsApi.js';
     watch:{
       diaShow(value){
         if(value){
-          console.log(this.formData,'formData');
           this.diaTitle = this.formData.code?"编辑":"添加"
           this.$refs.diaForm && this.$nextTick(()=>{
             this.$refs.diaForm.clearValidate()
@@ -71,7 +70,7 @@ import {asrInterface} from '@/api/modules/semanticsApi.js';
       saveHandle(){
         this.$refs.diaForm.validate(valid=>{
           if(valid){
-            console.log(this.formData,'formData');
+            // console.log(this.formData,'formData');
             let apiName = ""
             if(this.formData.mId){
               if(this.formData.type == "目录"){

+ 25 - 15
src/views/semantics_manage/asr/components/mediaUpload.vue

@@ -34,9 +34,9 @@
                   <span class="table-span">{{ row.name }}</span>
                 </template>
               </el-table-column>
-              <el-table-column label="大小" prop="size" width="120">
+              <el-table-column label="大小" prop="sizeText" width="120">
                 <template slot-scope="{row}" >
-                  <span class="table-span">{{ row.size }}</span>
+                  <span class="table-span">{{ row.sizeText }}</span>
                 </template>
               </el-table-column>
               <el-table-column label="音/视频" prop="type" width="100">
@@ -149,8 +149,10 @@ import MD5 from "js-md5";
         })
       },
       async uploadMedia(file){
-        console.log(file);
-        if(this.uploadingFileNames.some(item=> item.split('.')[0] == file.name.split('.')[0])){
+        // console.log(file,this.uploadingFileNames,'this.uploadingFileNames');
+        let fileFront=file.name.split('.')[0]
+  
+        if(this.uploadingFileNames.some(item=> item == fileFront)){
           return this.$message.error(file.name+'同名文件正在上传,请稍后重试')
         }
         if(!(this.fileExp.test(file.name))){
@@ -164,11 +166,17 @@ import MD5 from "js-md5";
         if(!res.flag){
           return this.$message.error(res.msg);
         }
+        
+        let audioDuration = res.duration
 
         if(!( (this.fileList.length+this.uploadingFileNames.length) < this.fileLimit)){
           return this.$message.error(`上传文件已超过${this.fileLimit}个,${file.name}上传失败`)
         } 
-        // TODO: 调用接口判断是否与数据库的文件重复
+        // 判断于 在库的文件名是否重名
+        let flag=true
+        let checkRes = await asrInterface.speechFlieRepetitionCheck({FileName:fileFront})
+        if(checkRes.Ret == 200) flag=false
+        if(flag) return 
 
         if(!this.uploadHint){
           this.uploadHint = this.$message({
@@ -179,7 +187,6 @@ import MD5 from "js-md5";
           })
         }
         // 上传
-        let fileFront=file.name.split('.')[0]
         this.uploadingFileNames.push(fileFront)
 
         const t = new Date().getTime().toString();
@@ -190,8 +197,8 @@ import MD5 from "js-md5";
                   this.$store.state.dynamicOutLinks.ObjectStorageClient ||
                   JSON.parse(localStorage.getItem('dynamicOutLinks')).ObjectStorageClient
         let options={}
-        if((file.size/1024/1024 > 200)){
-          // 大于200MB,分片上传
+        if((file.size/1024/1024 > 100)){
+          // 大于100MB,分片上传
           console.log("切片上传");
           // 上传的配置
           options={
@@ -215,13 +222,14 @@ import MD5 from "js-md5";
         }
         let windowNum=this.current
         uploadFileDirect(clientType,file.raw,temName,options).then(res=>{
-          console.log(windowNum,this.current,'this.current');
           if(!this.diaShow || (this.current!=windowNum)) return 
           let item = {
             name:fileFront,
             fileUrl:res,
-            size:this.sizeFormat(file.size),
-            type:this.videoExp.test(res)?"视频":"音频"
+            sizeText:this.sizeFormat(file.size),
+            size:file.size,
+            type:this.videoExp.test(res)?"视频":"音频",
+            duration:audioDuration || 0
           }
           this.fileList.push(item)
         }).finally(()=>{
@@ -252,10 +260,11 @@ import MD5 from "js-md5";
             let audioElement = new Audio(url);
             audioElement.addEventListener('loadeddata', () => {
               if(audioElement.duration>(60*60*5+1)){
-                resolve({flag:false,msg:file.name+'时长已超限'})
+                resolve({flag:false,msg:file.name+'时长已超限',duration:audioElement.duration})
               }else{
-                resolve({flag:true,msg:''})
+                resolve({flag:true,msg:'',duration:audioElement.duration})
               }
+              URL.revokeObjectURL(url);
             });
             setTimeout(()=>{
               resolve({flag:false,msg:file.name+"获取不到时长,请重试"})
@@ -282,7 +291,9 @@ import MD5 from "js-md5";
           Files:this.fileList.map(f =>{
             return {
               FileName:f.name,
-              ResourceUrl:f.fileUrl
+              ResourceUrl:f.fileUrl,
+              FileSecond:Math.round(f.duration),
+              FileSize:f.size
             }
           })
         }
@@ -295,7 +306,6 @@ import MD5 from "js-md5";
                 this.$emit("update:diaShow",false)
               }
             })
-
           }
         })
       },