Parcourir la source

产品技术资料新增浏览量、下载量

qymljy il y a 10 mois
Parent
commit
236aefb73f

+ 15 - 14
src/HDrpManagement/prodectFileData/components/fileTable.vue

@@ -2,7 +2,10 @@
   <div>
     <table-new-layout :layout="tablecols" :data="list" :opwidth="200" :custom="true" :width="true" :height="tableHieght">
       <template v-slot:customcol="scope">
-        <p >{{$t(scope.column.data[scope.column.columnname])}}</p>
+        <p v-if="scope.column.columnname == 'downloadqty' || scope.column.columnname == 'readqty'">
+          {{scope.column.data[scope.column.columnname]?scope.column.data[scope.column.columnname]:'0'}}
+        </p>
+        <p v-else>{{$t(scope.column.data[scope.column.columnname])}}</p>
       </template>
       <template v-slot:opreation="scope">
         <div>
@@ -21,7 +24,15 @@ export default {
     return {
       tableHieght:'calc(100vh - 375px)',
       tablecols:[],
-      list:[]
+      list:[],
+      param:{
+        "id": 20241031151204,
+        "content": {
+          "ownerid": 773,
+          "ownertable": "plm_technicalinfo",
+          "usetype": "default"
+        }
+      }
     }
   },
   mounted() {
@@ -29,19 +40,9 @@ export default {
   },
   methods:{
     async listData(){
-      const res = await this.$api.requested({
-        "classname": "system.attachment.Attachment",
-        "method": "queryFileLink",
-        "content": {
-          "ownertable": "plm_technicalinfo",
-          "ownerid": this.id,
-          "usetype":"default"//传空返回有所
-        }
-      })
-
+      this.param.content.ownerid = this.id
+      const res = await this.$api.requested(this.param)
       this.list = res.data
-      console.log(this.list,'附件列表');
-
     }
   },
   created() {

+ 11 - 8
src/HDrpManagement/prodectFileData/index.vue

@@ -1,20 +1,23 @@
 <template>
   <div>
-    <basicLayout 
+    <basicLayout
       style="padding-top:0 !important"
-      ref="basicLayout" 
+      ref="basicLayout"
       :oldFormPath="{
         add:'HDrpManagement/prodectFileData/modules',
         edit:'HDrpManagement/prodectFileData/modules',
       }"
-      tableName="prodectFileTable" 
-      idName="plm_technicalinfoid" 
-      :apiId="{query:20220926095803,del:20220926095903}" 
+      tableName="prodectFileTable"
+      idName="plm_technicalinfoid"
+      :apiId="{query:20220926095803,del:20220926095903}"
       :options="options">
       <template #custom >
       </template>
       <template v-slot:tbList="scope">
-        <div>
+        <p v-if="scope.data.column.columnname == 'downloadqty' || scope.data.column.columnname == 'readqty'">
+          {{scope.data.column.data[scope.data.column.columnname]?scope.data.column.data[scope.data.column.columnname]:'0'}}
+        </p>
+        <div v-else>
           {{$t(scope.data.column.data[scope.data.column.columnname])}}
         </div>
       </template>
@@ -22,7 +25,7 @@
         <edit v-if="tool.checkAuth($route.name,'update')"  :data="scope.data.data"   :type="'text'" @updateSuccess="$refs.basicLayout.listData()"></edit>
         <darwerPanel :id="scope.data.data.plm_technicalinfoid" :title="$t(`关 联 商 品`)" :detailPath="{path:'/relation'}" class="inline-24"/>
         <file_del v-if="tool.checkAuth($route.name,'delete')" :data="scope.data.data" :type="'text'" @deleteSuccess="$refs.basicLayout.listData()"></file_del>
-          
+
       </template>
     </basicLayout>
   </div>
@@ -52,4 +55,4 @@ export default {
 
 <style scoped>
 
-</style>
+</style>

+ 16 - 3
src/SDrpManagement/ProductGroup/modules/GroupDetail/groupDetail.vue

@@ -254,7 +254,7 @@
           <p>{{ $t("相关链接") }}:&emsp;</p>
           <div>
             <div v-for="item in selectProduct.technicalinfo" :key="item.index">
-              <el-button type="text" size="mini" @click="downFile(item.url,item.document)">{{item.document}}</el-button>
+              <el-button type="text" size="mini" @click="downFile(item.url,item.document,item)">{{item.document}}</el-button>
             </div>
           </div>
         </div>
@@ -426,7 +426,6 @@ export default {
       this.tool.showMessage(res);
     },
     downloadFile(fileUrl,fileName) {
-      console.log('执行2221;超链接点击')
       const element = document.createElement('a');
       element.href = fileUrl;
       element.download = fileName;
@@ -434,7 +433,8 @@ export default {
       // 如果浏览器支持取消阻止默认事件,防止表单提交等意外情况
       element.removeEventListener('click', this.downloadFile);
     },
-    downFile(url, fileName) {
+    downFile(url, fileName,data) {
+      this.downRecord(data)
       const x = new XMLHttpRequest();
       x.open("GET", url, true);
       x.responseType = "blob";
@@ -446,7 +446,20 @@ export default {
         a.click();
       };
       x.send();
+
     },
+    async downRecord(data){
+      const res = await this.$api.requested({
+        "id": 10020701,
+        "content": {
+          "linksid": data.linksid,
+          "attachmentid": data.attachmentid
+        }
+      })
+      if (res.code == 0){
+        this.tool.showMessage(res,()=>{})
+      }
+    }
   },
 };
 </script>