zhuhao hace 2 años
padre
commit
01523fd5d9

+ 3 - 1
src/utils/model/index.js

@@ -4,12 +4,14 @@ import myCustomSvg from './svg/customSvg.vue';
 import myTree from './tree/index.vue';
 import myRichText from './RichText/index.vue';
 import mySearch from './retrieval/search.vue';
+import myMenu from './menu/index.vue';
 
 var models = {
   myCustomSvg,
   myTree,
   myRichText,
-  mySearch
+  mySearch,
+  myMenu,
 }
 export default {
   install(Vue) {

+ 264 - 0
src/utils/model/menu/index.vue

@@ -0,0 +1,264 @@
+<template>
+  <!-- 下载/预览/删除 -->
+  <div class="menuPopover" :class="menuStyle" @mouseover="mouseover" @mouseout="mouseout">
+
+    <el-popover placement="top-start" title="" trigger="hover" popper-class="popperClass"
+      >
+      <div class="menuList" >
+        <div v-for="item in menuList" :key="item.value"  @click="menuBtn(item)" class="menuListLi" v-show="item.show">
+          <i :class="item.icon"></i><span>{{item.label}}</span>
+        </div>
+      </div>
+      <div slot="reference" class="menu-button">
+        <div class="line-box">
+          <div class="line"></div>
+          <div class="line"></div>
+          <div class="line"></div>
+        </div>
+      </div>
+    </el-popover>
+
+  </div>
+</template>
+<script>
+
+import { File } from './mixins'
+export default {
+  props: {
+    data: {
+      type: Object,
+      default: () => {
+        return {}
+      }
+    },
+    deleted: {
+      type: Boolean,
+      default:true
+    }
+  },
+  mixins: [File],
+  data() {
+    return {
+      menuStyle: 'menu-box',
+      active: false,
+      menuList: [
+        {value:'downLoad',label:'下载',icon:'el-icon-download',show:true},
+        {value:'preview',label:'预览',icon:'el-icon-view',show:true},
+        {value:'delFile',label:'删除',icon:'el-icon-delete',show:this.deleted},
+      ]
+    }
+  },
+  watch: {
+    deleted(val) {
+      this.menuList.forEach(item => {
+        if (item.value == 'delFile') {
+          item.show = val
+          return false
+        }
+      })
+    }
+  },
+  methods: {
+    menuBtn(item) {
+      var data =this.data
+      switch (item.value) {
+        case 'downLoad':
+          this.downLoad(data)
+          break;
+        case 'preview':
+          this.preview(data)
+          break;
+        case 'delFile':
+          this.delFile(data)
+          break;
+      
+        default:
+          break;
+      }
+    },
+    mouseover() {
+      this.menuStyle = 'active'
+      this.active = true
+    },
+    mouseout() {
+      this.menuStyle = ''
+      this.active = false
+    },
+
+  }
+}
+</script>
+<style >
+.el-popover.popperClass {
+  min-width: 80px ;
+  border: 1px solid #ACA9A9;
+}
+.el-popper[x-placement^=top] .popper__arrow::after{
+  border-top-color: #7f7f7f;
+  bottom: 0px;
+}
+</style>
+<style lang="scss" scoped>
+.menuList :first-child{
+  padding-top: 0px;
+}
+.menuList :hover{
+  color: #5c67ff;
+  cursor: pointer;
+}
+
+.menuListLi{
+  border-bottom: 1px solid #e6e6e6;
+  padding: 10px 0 3px 0;
+}
+.menuListLi :first-child{
+  padding-right: 5px;
+}
+.menu-button {
+  width: 25px;
+  height: 25px;
+  background-color: white;
+  border-radius: 50%;
+  // box-shadow: 0 0 0 4px rgba(92,103,255,0.3);
+  color: #fff;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  position: relative;
+
+  cursor: pointer;
+  transition: 0.2s ease-in;
+}
+
+.menu-button:hover {
+  background-color: white;
+  z-index: 999;
+  // box-shadow: 0 0 0 8px rgba(92,103,255,0.3);
+}
+
+.menu-button .line-box {
+  width: 10px;
+  height: 10px;
+  display: flex;
+  flex-direction: column;
+  justify-content: space-between;
+  cursor: pointer;
+  transition: transform 0.3s ease-out;
+}
+
+.menu-button .line {
+  background-color: black;
+  width: 100%;
+  height: 2px;
+  border-radius: 2px;
+}
+
+.menu-button .line:first-child {
+  width: 50%;
+  transform-origin: right;
+  transition: transform 0.3s ease-in-out;
+}
+
+.menu-button .line:last-child {
+  width: 50%;
+  align-self: flex-end;
+  transform-origin: left;
+  transition: transform 0.3s ease-in-out;
+}
+
+// .menu-list1 {
+//   padding: 6px;
+//   transition: 0.3s ease;
+//   transition: delay 0.3s;
+
+// }
+
+// .menu-list1 li {
+//   display: flex;
+//   justify-content: center;
+//   align-items: center;
+//   padding: 10px;
+//   color: #343470;
+//   cursor: pointer;
+//   position: relative;
+//   opacity: 1;
+//   transform: translateX(-10px);
+//   transition: 0.2s ease-in;
+// }
+
+// .menu-list1 li:hover {
+//   color: #5c67ff;
+// }
+
+.menu-list1 li::before {
+  content: '';
+  width: calc(100% - 24px);
+  height: 1px;
+  background-color: rgba(92, 103, 255, 0.1);
+  position: absolute;
+  bottom: 0;
+  left: 12px;
+}
+
+.menu-list1 li:last-child::before {
+  display: none;
+}
+
+// .menu-list1 .fa {
+//   font-size: 18px;
+//   width: 18px;
+//   height: 18px;
+//   display: flex;
+//   justify-content: center;
+//   align-items: center;
+// }
+
+// .menu-list1 span {
+//   font-size: 14px;
+//   margin-left: 8px;
+// }
+
+.active {
+  position: relative;
+}
+
+.active .line-box {
+  transform: rotate(-45deg);
+}
+
+.active .line-box .line:first-child {
+  transform: rotate(-90deg) translateX(1px);
+}
+
+.active .line-box .line:last-child {
+  transform: rotate(-90deg) translateX(-1px);
+}
+
+.active .menu-list {
+  margin: 0;
+  opacity: 1;
+  transform: scale(1);
+}
+
+.active .menu-list li {
+  animation: fade-in-item 0.4s linear forwards;
+}
+
+.active .menu-list li:nth-child(1) {
+  animation-delay: 0.1s;
+}
+
+.active .menu-list li:nth-child(2) {
+  animation-delay: 0.2s;
+}
+
+.active .menu-list li:nth-child(3) {
+  animation-delay: 0.3s;
+}
+
+@keyframes fade-in-item {
+  100% {
+    transform: translateX(0);
+    opacity: 1;
+  }
+}</style>

+ 114 - 0
src/utils/model/menu/mixins.js

@@ -0,0 +1,114 @@
+import { downLoad2 } from '@/utils'
+export const File = {
+    methods: {
+        downLoad(item){
+            downLoad2(item.url) 
+        },
+        preview(row){
+            var item = JSON.parse(JSON.stringify(row))
+            var arr = ['png','jpeg','bmp','jpg']
+            if(arr.includes(item.suffix)){
+                var FileUrl = this.$p + item.url
+                var isPicture = 1
+            }else if(item.suffix == 'pdf'){
+                var FileUrl = this.$p + item.url
+                var isPicture = 0
+            }else{
+                var FileUrl =  `http://${this.$c.hostname}:8012/onlinePreview?url=`+ btoa(encodeURIComponent(this.$p + item.url))
+                var isPicture = 0
+            }
+            const router = this.$router.resolve({
+                path: '/checkFile',
+                query: {
+                    row: JSON.stringify(item),
+                    FileUrl: FileUrl,
+                    isPicture:isPicture
+                }
+            })
+            window.open(router.href, '_blank');
+        },
+        delFile(item){
+            this.$emit('delFile',item.id)
+        }
+    },
+}
+
+export const File2 = {
+  methods: {
+      downLoad(row){ 
+        var item = JSON.parse(JSON.stringify(row))
+        var href = ''
+        if(item.originalName){
+            href = `http://${this.$c.hostname}:8801/fileManager/downloadSystemFile?fileId=${item.id}`
+        }else{
+            href = `/api/report/api/download/downloadFile?url=${encodeURIComponent(item.url)}` 
+        }
+        const anchor = document.createElement('a');
+        const fileName = 'download';
+        if ('download' in anchor) {
+          anchor.href = href;
+          anchor.setAttribute("download", fileName);
+          anchor.className = "download-js-link";
+          anchor.innerHTML = "downloading...";
+          anchor.style.display = "none";
+          document.body.appendChild(anchor);
+          setTimeout(function () {
+            anchor.click();
+            document.body.removeChild(anchor);
+          }, 66);
+          return true;
+        }
+      },
+      preview(row){
+        var item = JSON.parse(JSON.stringify(row))
+        if(item.originalName){
+            item.url = `http://${this.$c.hostname}:8801/fileManager/downloadSystemFile?fileId=${item.id}`
+            var arr = ['png','jpeg','bmp','jpg']
+            if(arr.includes(item.suffix)){
+                var FileUrl = item.url
+                var isPicture = 1
+            }else if(item.suffix == 'pdf'){
+                var FileUrl = item.url
+                var isPicture = 0
+            }else{
+                var FileUrl =  `http://${this.$c.hostname}:8012/onlinePreview?url=`+ btoa(encodeURIComponent(item.url+ '&fullfilename=test.'+item.suffix))
+                var isPicture = 0
+            }
+            const router = this.$router.resolve({
+                path: '/checkFile',
+                query: {
+                    row: JSON.stringify(item),
+                    FileUrl: FileUrl,
+                    isPicture:isPicture
+                }
+            })
+            window.open(router.href, '_blank');
+            return false
+        }
+          var arr = ['png','jpeg','bmp','jpg']
+          if(arr.includes(item.suffix)){
+              var FileUrl = this.$rImg + item.url
+              var isPicture = 1
+          }else if(item.suffix == 'pdf'){
+              var FileUrl = this.$rImg + item.url
+              var isPicture = 0
+          }else{
+              var FileUrl =  `http://${this.$c.hostname}:8012/onlinePreview?url=`+ btoa(encodeURIComponent(this.$rImg + item.url))
+              var isPicture = 0
+          }
+          const router = this.$router.resolve({
+              path: '/checkFile',
+              query: {
+                  row: JSON.stringify(item),
+                  FileUrl: FileUrl,
+                  isPicture:isPicture,
+                  reportId:true
+              }
+          })
+          window.open(router.href, '_blank');
+      },
+      delFile(item){
+          this.$emit('delFile',item.id)
+      }
+  },
+}

+ 7 - 0
src/utils/model/retrieval/search.vue

@@ -18,6 +18,13 @@
           </el-option>
         </el-select>
       </div>
+      <div v-else-if="field.type == 4" style="width: 100%">
+        <el-select v-model="value" size="small" filterable :placeholder="getPlaceholder()"
+          style="width: 100%">
+          <el-option v-for="item in field.options || []" :key="item.value" :label="item.label" :value="item.value">
+          </el-option>
+        </el-select>
+      </div>
       <div v-else style="width: 100%">
         <el-input size="small" style="width: 100%" v-model="value" :placeholder="getPlaceholder()"></el-input>
       </div>

+ 46 - 5
src/views/workspace/folder/components/drawer/MergeApplicant.vue

@@ -3,7 +3,8 @@
     <el-drawer class="custom-drawer-form" title="合并申请人/权利人" size="1000px" :visible.sync="drawer" direction="rtl" :before-close="close" destroy-on-close>
       <el-container class="patent-applicant-merge">
         <el-header>
-          <el-form :inline="true" class="margin-left_20">
+          <mySearch :SearchFields="searchFiled" @search="search" :searchValue="searchOption"></mySearch>
+          <!-- <el-form :inline="true" class="margin-left_20">
             <el-form-item label="名称">
               <el-input v-model="queryParams.name" size="small" placeholder="请输入名称"></el-input>
             </el-form-item>
@@ -16,7 +17,7 @@
               <el-button type="" size="small" @click="getList">查询</el-button>
               <el-button type="primary" size="small" @click="handleAdd()" :disabled="!$permission('/workspace/folder/merge/applicationMerge/add')">新增</el-button>
             </el-form-item>
-          </el-form>
+          </el-form> -->
         </el-header>
         <el-main class="container-common-main">
           <el-table v-loading="loading" :data="tableData" border header-row-class-name="custom-table-header">
@@ -92,12 +93,47 @@ export default {
         from: 'merge'
       },
       addressIds: [],
-      areaTree: []
+      areaTree: [],
+      searchFiled:[
+        {
+          label:'名称',
+          value:'name',
+          type:1,
+          placeholder:'请输入名称'
+        },
+        {
+          label:'国家',
+          value:'country',
+          type:4,
+          placeholder: '请选择国家或地区',
+          options: [
+            
+          ]
+        },
+      ],
+      searchOption:{},
     }
   },
   mounted() {
   },
   methods: {
+    search(val) {
+      var params = {}
+      if(val.length>0){
+        val.forEach(item => {
+          if(item.type == 3){
+            params[item.value] = item.searchValue.map(item1=>{
+              return item1.value
+            }) 
+          }else{
+            params[item.value] = item.searchValue.label
+          }
+        });
+      }
+      this.searchOption = params
+      this.queryParams.current = 1
+      this.getList()
+    },
     open(id) {
       this.projectId = id
       this.queryParams.projectId = id
@@ -112,7 +148,11 @@ export default {
     },
     getList() {
       this.loading = true
-      this.$api.getPatentApplicantList(this.queryParams).then(response => {
+      let params = {
+        ...JSON.parse(JSON.stringify(this.queryParams)),
+        ...this.searchOption
+      }
+      this.$api.getPatentApplicantList(params).then(response => {
         this.tableData = response.data.records
         this.total = response.data.total
         this.loading = false
@@ -129,7 +169,8 @@ export default {
     },
     getCommonData() {
       this.$api.getCommonData({ keys: 'COUNTRIES' }).then(response => {
-        this.commonData = response.data
+        // this.commonData = response.data
+        this.searchFiled[1].options = response.data.COUNTRIES
       })
     },
     getAreaList() {

+ 1 - 1
src/views/workspace/folder/index.vue

@@ -704,7 +704,7 @@ export default {
       // let params = JSON.parse(JSON.stringify(this.queryParams))
       let params = {
           ...JSON.parse(JSON.stringify(this.queryParams)),
-          ...this.searchOption
+          ...this.searchOption.name
         }
       params.tree.map(tree => {
         let field = params.field.filter(item => item.key === tree.key)