Browse Source

资产管理模块可点击、可操作的元素鼠标移动上去为手势,同时有鼠标移上去显示下划线

yanshichao 1 year ago
parent
commit
46aade47b5
2 changed files with 41 additions and 8 deletions
  1. 21 4
      src/views/material/asset.vue
  2. 20 4
      src/views/material/myReceive.vue

+ 21 - 4
src/views/material/asset.vue

@@ -73,7 +73,9 @@
         </div>
 
         <el-table :data="assetList"
-                  @row-click="rowClick"
+                  @cell-click="cellClick"
+                  @cell-mouse-enter="cellMouseEnter"
+                  @cell-mouse-leave="cellMouseLeave"
                   stripe
                   height="calc(100vh - 180px)"
                   size="mini">
@@ -574,8 +576,8 @@ export default {
         this.categoryOptions = response.data;
       });
     },
-    rowClick(row, column, event) {
-      if (column.label === '操作') {
+    cellClick(row, column, cell, event) {
+      if (column.property != 'assetName') {
         return
       }
       getAsset(row.id).then(res => {
@@ -701,7 +703,22 @@ export default {
       this.transferOpen = false
       this.transferForm = {}
       this.resetForm("transferForm");
-    }
+    },
+    cellMouseEnter(row, column, cell, event) {
+      if (column.property != 'assetName') {
+        return
+      }
+      cell.style.color = '#306FB1';
+      cell.style.cursor = 'pointer';
+      cell.style.textDecoration = 'underline';
+    },
+    cellMouseLeave(row, column, cell, event) {
+      if (column.property != 'assetName') {
+        return
+      }
+      cell.style.color = '#606266';
+      cell.style.textDecoration = 'none';
+    },
 
   }
 }

+ 20 - 4
src/views/material/myReceive.vue

@@ -39,7 +39,9 @@
 
 
     <el-table :data="assetList"
-              @row-click="rowClick"
+              @cell-click="cellClick"
+              @cell-mouse-enter="cellMouseEnter"
+              @cell-mouse-leave="cellMouseLeave"
               size="mini"
               row-key="id"
               :row-class-name="rowClassName"
@@ -245,7 +247,6 @@ export default {
   },
   watch: {
     selectUser(val) {
-      console.log(val);
       if (!val) {
         this.$set(this.queryParams, 'receiveUserId', null)
       }
@@ -350,8 +351,8 @@ export default {
       this.detailOpen = false;
       this.toConfirmTransferId = undefined
     },
-    rowClick(row, column, event) {
-      if (column.label === '操作') {
+    cellClick(row, column, event) {
+      if (column.property != 'assetName') {
         return
       }
       getAsset(row.id).then(res => {
@@ -366,6 +367,21 @@ export default {
       }
       return '';
     },
+    cellMouseEnter(row, column, cell, event) {
+      if (column.property != 'assetName') {
+        return
+      }
+      cell.style.color = '#306FB1';
+      cell.style.cursor = 'pointer';
+      cell.style.textDecoration = 'underline';
+    },
+    cellMouseLeave(row, column, cell, event) {
+      if (column.property != 'assetName') {
+        return
+      }
+      cell.style.color = '#606266';
+      cell.style.textDecoration = 'none';
+    },
     selectReceiveUserId(val) {
       this.$set(this.transferForm, 'receiveUserId', val)
     },