scorpio 2 年 前
コミット
e65c797089
2 ファイル変更27 行追加20 行削除
  1. 6 6
      src/layout/top.vue
  2. 21 14
      src/views/resource/component/xtable.vue

+ 6 - 6
src/layout/top.vue

@@ -28,12 +28,12 @@
             class="padding flex flex-align-center pointer"
             :class="dataType === 'project' ? 'black' : 'white'"
           >
-            <el-button
-              icon="Search"
-              circle
-              color="#C1C4CB"
-              @click="show = true"
-            />
+            <!--            <el-button-->
+            <!--              icon="Search"-->
+            <!--              circle-->
+            <!--              color="#C1C4CB"-->
+            <!--              @click="show = true"-->
+            <!--            />-->
 
             <el-badge
               :value="msgCount"

+ 21 - 14
src/views/resource/component/xtable.vue

@@ -222,6 +222,7 @@ export default {
     },
     selectedList: {
       handler(val) {
+        console.log(val)
         this.$emit('selected', this.selectedList)
       },
       immediate: true
@@ -256,24 +257,30 @@ export default {
         return
       }
       // filePicker 文件选择
-      if (this.selectedList.length === this.max) {
+      if (this.showMenu === false && this.selectedList.length === this.max) {
         this.$message.error('可选择文件数量最大为' + this.max)
         return
       }
-      // 点击的内容为文件
-      if (row.type === 1 && this.showCheckBox === false) {
-        return
-      }
-      this.$emit('row-click', row)
-      if (row.checked) {
-        const tmps = this.data.filter(ele => ele.checked)
-        tmps.forEach(ele => {
-          if (this.selectedList.findIndex(sub => sub.id === ele.id) === -1) {
-            this.selectedList.push(ele)
-          }
-        })
+      // 未显示选择按钮的情况下,点击调用row-click
+      if (this.showCheckBox === false) {
+        this.$emit('row-click', row)
       } else {
-        this.selectedList = this.selectedList.filter(ele => ele.id !== row.id)
+        if (this.showMenu === false && row.type === 2) {
+          this.$emit('row-click', row)
+          return
+        }
+        row.checked = !row.checked
+        if (row.checked) {
+          const tmps = this.data.filter(ele => ele.checked)
+          tmps.forEach(ele => {
+            if (this.selectedList.findIndex(sub => sub.id === ele.id) === -1) {
+              this.selectedList.push(ele)
+            }
+          })
+        } else {
+          this.selectedList = this.selectedList.filter(ele => ele.id !== row.id)
+        }
+        this.selectedList = this.selectedList.filter(ele => ele.checked)
       }
     },
     /**