Parcourir la source

fix:股东信息升降序修改

贾宇博 il y a 5 mois
Parent
commit
c3d7b0ecaf
1 fichiers modifiés avec 21 ajouts et 1 suppressions
  1. 21 1
      src/views/Shareholders/Information/index.vue

+ 21 - 1
src/views/Shareholders/Information/index.vue

@@ -63,7 +63,8 @@
                     <dict-tag :options="e_shareholder_type" :value="scope.row.shareholderType" />
                 </template>
             </el-table-column>
-            <el-table-column label="股份占比" align="center" prop="shareholdingRatio" />
+            <el-table-column label="股份占比" align="center" prop="shareholdingRatio" sortable
+                :sort-method="sortShareholdingRatio" />
             <el-table-column label="公司" align="center" prop="companyName" />
             <el-table-column label="公司估值" align="center" prop="companyValuation" />
             <el-table-column label="是否为主体公司" align="center" prop="isSubject">
@@ -386,6 +387,25 @@ function handWithdrawal(row) {
         }
     });
 }
+
+
+// 自定义股份占比排序方法
+const sortShareholdingRatio = (a, b) => {
+  // 处理可能的数字或字符串类型
+  const getValue = (value) => {
+    if (typeof value === 'string') {
+      return parseFloat(value.replace('%', '')) || 0;
+    } else if (typeof value === 'number') {
+      return value;
+    }
+    return 0;
+  };
+  
+  const numA = getValue(a.shareholdingRatio);
+  const numB = getValue(b.shareholdingRatio);
+  return numA - numB;  // 升序排序
+};
+
 onMounted(() => {
     getList();
     getCompany();