Browse Source

筛选保存

PrinceLee 5 years ago
parent
commit
612e854ecf
1 changed files with 46 additions and 2 deletions
  1. 46 2
      src/views/projectManage/bugList/bugindex.vue

+ 46 - 2
src/views/projectManage/bugList/bugindex.vue

@@ -367,6 +367,7 @@
                     </div>
                   </div>
                   <div align="right">
+                    <span class="save-search" @click="showSaveSearch = true">保存筛选项</span>
                     <el-button type="primary" size="mini" @click="curIndex = 1;getBugList()">筛 选</el-button>
                     <el-button size="mini" @click="resetQuery()">重 置</el-button>
                   </div>
@@ -469,12 +470,28 @@
         />
       </div>
     </el-drawer>
+    <normal-dialog
+      :show-dialog="showSaveSearch"
+      :title="'保存筛选项'"
+      :width="'35%'"
+      @confirm="saveSearch('searchForm')"
+      @cancel="showSaveSearch=false"
+    >
+      <div class="file-dialog">
+        <el-form ref="searchForm" :model="searchForm" :rules="searchFormRules" label-width="80px">
+          <el-form-item label="活动名称" prop="name">
+            <el-input v-model="searchForm.name" placeholder="不超过50个字符" />
+          </el-form-item>
+        </el-form>
+      </div>
+    </normal-dialog>
   </div>
 </template>
 
 <script>
 import BugDetails from './details/index'
 import createdBug from '@/views/projectManage/bugList/file/createdBug'
+import normalDialog from '@/components/dialog/normalDialog'
 import {
   bugList,
   bugSelfList,
@@ -490,7 +507,8 @@ import '@/views/projectManage/bugList/css/index.css'
 export default {
   components: {
     createdBug,
-    BugDetails
+    BugDetails,
+    normalDialog
   },
   filters: {
     oneA(value) {
@@ -583,7 +601,13 @@ export default {
       options: [],
       test: [], // 人员查询
       dialogImageUrl: '',
-      isBugNameClick: false
+      isBugNameClick: false,
+      showSaveSearch: false, // 显示保存筛选项对话框
+      searchForm: { searchObj: null }, // 筛选项obj
+      searchFormRules: { name: [
+        { required: true, message: '请输入筛选项名称', trigger: 'blur' },
+        { min: 1, max: 50, message: '长度在 1 到 50 个字符', trigger: 'blur' }
+      ] }
     }
   },
   computed: {
@@ -828,6 +852,19 @@ export default {
       aLink.download = '缺陷列表.xlsx'
       aLink.style.display = 'none'
       aLink.click()
+    },
+    saveSearch(formName) { // 保存筛选项
+      this.$refs[formName].validate((valid) => {
+        if (valid) {
+          this.stratAndEnd = this.stratAndEnd ? this.stratAndEnd : []
+          this.formInline.createStartTime = this.stratAndEnd[0] || null
+          this.formInline.createEndTime = this.stratAndEnd[1] || null
+          console.log(this.formInline)
+        } else {
+          this.$message({ showClose: true, message: '请按格式输入', type: 'error' })
+          return false
+        }
+      })
     }
   }
 }
@@ -842,5 +879,12 @@ export default {
 .low {
   background-color: #7ED321;
 }
+.save-search {
+  color: #909399;
+  font-size: 14px;
+  margin-right: 10px;
+  font-weight: 500;
+  cursor: pointer;
+}
 </style>