Browse Source

获取过滤器

PrinceLee 5 years ago
parent
commit
eec54bbb82
2 changed files with 47 additions and 4 deletions
  1. 17 0
      src/api/defectManage.js
  2. 30 4
      src/views/projectManage/bugList/bugindex.vue

+ 17 - 0
src/api/defectManage.js

@@ -131,3 +131,20 @@ export function bugDownload(data) {
     responseType: 'blob' // 表明返回服务器返回的数据类型
     responseType: 'blob' // 表明返回服务器返回的数据类型
   })
   })
 }
 }
+
+// 创建过滤器
+export function createFilter(data) {
+  return request({
+    url: TeamManagement + `/bug/createFilter`,
+    method: 'post',
+    data
+  })
+}
+
+// 获取过滤器
+export function getFilterList() {
+  return request({
+    url: TeamManagement + '/bug/getFilterList',
+    method: 'get'
+  })
+}

+ 30 - 4
src/views/projectManage/bugList/bugindex.vue

@@ -375,6 +375,10 @@
               </el-row>
               </el-row>
             </el-form>
             </el-form>
           </el-col>
           </el-col>
+          <el-row type="flex" justify="space-between" class="filter">
+            <el-col :span="12" class="mine-filter">我的过滤器</el-col>
+            <el-col :span="2" align="end">管理过滤器</el-col>
+          </el-row>
         </el-row>
         </el-row>
       </el-header>
       </el-header>
       <el-main :style="type === 'page'?{padding: '1%'}:{padding: '0'}">
       <el-main :style="type === 'page'?{padding: '1%'}:{padding: '0'}">
@@ -500,7 +504,9 @@ import {
   taskListCreate,
   taskListCreate,
   releaseList,
   releaseList,
   settingQueryBizModuleList,
   settingQueryBizModuleList,
-  bugDownload
+  bugDownload,
+  createFilter,
+  getFilterList
 } from '@/api/defectManage'
 } from '@/api/defectManage'
 import { memberQueryMemberInfoByIDAPorName } from '@/api/projectIndex'
 import { memberQueryMemberInfoByIDAPorName } from '@/api/projectIndex'
 import '@/views/projectManage/bugList/css/index.css'
 import '@/views/projectManage/bugList/css/index.css'
@@ -632,6 +638,7 @@ export default {
       this.getBugSelfList(2, 10)
       this.getBugSelfList(2, 10)
     }
     }
     this.bugListSelect()
     this.bugListSelect()
+    this.getFilterList()
     this.$store.state.data.status = true
     this.$store.state.data.status = true
   },
   },
   destroyed() {
   destroyed() {
@@ -645,6 +652,10 @@ export default {
         this.$router.push({ path: this.$route.path })
         this.$router.push({ path: this.$route.path })
       }
       }
     },
     },
+    async getFilterList() { // 获取过滤器列表
+      const res = await getFilterList()
+      console.log(res)
+    },
     async getBugList() {
     async getBugList() {
       if (!this.stratAndEnd) {
       if (!this.stratAndEnd) {
         this.stratAndEnd = []
         this.stratAndEnd = []
@@ -853,18 +864,23 @@ export default {
       aLink.style.display = 'none'
       aLink.style.display = 'none'
       aLink.click()
       aLink.click()
     },
     },
-    saveSearch(formName) { // 保存筛选项
+    async saveSearch(formName) { // 保存筛选项
       this.$refs[formName].validate((valid) => {
       this.$refs[formName].validate((valid) => {
         if (valid) {
         if (valid) {
           this.stratAndEnd = this.stratAndEnd ? this.stratAndEnd : []
           this.stratAndEnd = this.stratAndEnd ? this.stratAndEnd : []
           this.formInline.createStartTime = this.stratAndEnd[0] || null
           this.formInline.createStartTime = this.stratAndEnd[0] || null
           this.formInline.createEndTime = this.stratAndEnd[1] || null
           this.formInline.createEndTime = this.stratAndEnd[1] || null
-          console.log(this.formInline)
         } else {
         } else {
           this.$message({ showClose: true, message: '请按格式输入', type: 'error' })
           this.$message({ showClose: true, message: '请按格式输入', type: 'error' })
           return false
           return false
         }
         }
       })
       })
+      const res = await createFilter({ name: this.searchForm.name, content: JSON.stringify(this.formInline) })
+      console.log(res)
+      if (res.code === 200) {
+        this.$message({ showClose: true, message: '保存成功', type: 'success' })
+        this.showSaveSearch = false
+      }
     }
     }
   }
   }
 }
 }
@@ -886,5 +902,15 @@ export default {
   font-weight: 500;
   font-weight: 500;
   cursor: pointer;
   cursor: pointer;
 }
 }
+.filter {
+  font-size: 14px;
+  width: 100%;
+  padding: 0 11px 15px 15px;
+  color: #606266;
+  .mine-filter {
+    overflow: hidden;
+    text-overflow:ellipsis;
+    white-space: nowrap;
+  }
+}
 </style>
 </style>
-