|
|
@@ -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
|
|
|
}
|