huangbin 4 년 전
부모
커밋
a60913293a
2개의 변경된 파일20개의 추가작업 그리고 0개의 파일을 삭제
  1. 3 0
      src/views/report/exposure-report/list/exposure_report/index.vue
  2. 17 0
      src/views/report/setup.ts

+ 3 - 0
src/views/report/exposure-report/list/exposure_report/index.vue

@@ -12,6 +12,9 @@
                rowKey="key"
                :data-source="tableList"
                :scroll="{ x: '100%', y: 'calc(100vh - 163px)' }">
+        <!-- 额外的展开行 -->
+        <template #expandedRowRender="{  }">
+        </template>
       </a-table>
     </contextMenu>
   </div>

+ 17 - 0
src/views/report/setup.ts

@@ -101,10 +101,27 @@ export function queryTableList<T>(fn: Function) {
         }
         queryResultLoadingAndInfo(fn, loading, param).then(res => {
             const result = res?.map((e: T, i: number) => {
+                for (const item in e) {
+                    console.log(e[item])
+                    e[item] = getDecimalsNum(e[item])
+                }
                 return { ...e, key: String(i) };
             });
             tableList.value = result ? result : []
         })
     }
     return { loading, tableList, queryTable }
+}
+
+function getDecimalsNum(val: any) {
+    let result = val
+    if (typeof val === 'number') {
+        const str = val.toString();
+        const num = str.indexOf('.') + 1;
+        const count = str.length - num;
+        if (count > 4) {
+            result = val.toFixed(2)
+        }
+    }
+    return result
 }