|
@@ -15,28 +15,42 @@ const mapDetailToTop = ref<Map<string, any>>(new Map());
|
|
|
|
|
|
const id = computed(() => query.id);
|
|
|
|
|
|
+const isDetail = (queryKey: string, report_data: Record<string, string>) => {
|
|
|
+ const responseKey = QUERY_MAP[queryKey].responseKey;
|
|
|
+
|
|
|
+ return (
|
|
|
+ report_data[responseKey] &&
|
|
|
+ QUERY_MAP[queryKey]?.detail &&
|
|
|
+ report_data[responseKey].length !== 0
|
|
|
+ );
|
|
|
+};
|
|
|
+
|
|
|
//获取该台账单可以查询到的详情
|
|
|
function getDetails(report_data) {
|
|
|
- const isDetail = (queryKey: string) => {
|
|
|
- const responseKey = QUERY_MAP[queryKey].responseKey;
|
|
|
-
|
|
|
- return (
|
|
|
- report_data[responseKey] &&
|
|
|
- QUERY_MAP[queryKey]?.detail &&
|
|
|
- report_data[responseKey].length !== 0
|
|
|
- );
|
|
|
- };
|
|
|
-
|
|
|
- const detail_keys = Object.keys(QUERY_MAP).filter(isDetail);
|
|
|
-
|
|
|
- return detail_keys.map(key => ({
|
|
|
- component: QUERY_MAP[key].component,
|
|
|
- prop: QUERY_MAP[key].requesetProp,
|
|
|
- title: QUERY_MAP[key].detail,
|
|
|
- api: QUERY_MAP[key].api,
|
|
|
- value: report_data[QUERY_MAP[key].responseKey],
|
|
|
- key
|
|
|
- }));
|
|
|
+ const filter_keys = Object.keys(QUERY_MAP).filter(queryKey =>
|
|
|
+ isDetail(queryKey, report_data)
|
|
|
+ );
|
|
|
+
|
|
|
+ return filter_keys.map(key => {
|
|
|
+ const {
|
|
|
+ api,
|
|
|
+ component,
|
|
|
+ requesetProp: prop,
|
|
|
+ responseKey,
|
|
|
+ detail: title
|
|
|
+ } = QUERY_MAP[key];
|
|
|
+
|
|
|
+ const value = report_data[responseKey];
|
|
|
+
|
|
|
+ return {
|
|
|
+ component,
|
|
|
+ prop,
|
|
|
+ title,
|
|
|
+ api,
|
|
|
+ value,
|
|
|
+ key
|
|
|
+ };
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
async function requesetReportDetail() {
|
|
@@ -92,10 +106,7 @@ onMounted(() => initalPageData());
|
|
|
>
|
|
|
<component
|
|
|
:is="detail.component"
|
|
|
- :api="detail.api"
|
|
|
- :prop="detail.prop"
|
|
|
- :value="detail.value"
|
|
|
- :title="detail.title"
|
|
|
+ v-bind="detail"
|
|
|
@map-offset-top="
|
|
|
({ top, title }) => handleSetMapDetailToTop(top, title)
|
|
|
"
|