import React, { useState } from "react";
import { history } from "umi";
import { Tabs } from "antd-mobile";
import commonConfig from "@/utils/config";
import * as commonServices from "@/services/services";
import * as commonFunc from "@/components/Common/commonFunc";
import { useEffect } from "react";
import styles from "./quotationDetail.less";
import SelectInput from "../components/SelectInput";
const QuotationAllprogressDetail = props => {
// const {state} = props.location
// console.log(JSON.parse(state), "QuotationAllprogressDetail");
console.log(props, "QuotationAllprogressDetail props");
return (
);
};
const QuotationDetail = props => {
const { location, app } = props;
const { token } = app;
const [state, setState] = useState(null);
// 初始化状态
const { formData = [] } = state || {};
const { quotationData } = JSON.parse(location.state) || {};
const [masterConfig, setMasterConfig] = useState(null);
useEffect(() => {
// 安全地解析 state
let parsedState = {};
try {
parsedState = JSON.parse(location.state || "{}");
} catch (error) {
console.error("Error parsing state:", error);
}
const { sModelsId } = parsedState;
// 构造请求 URL
const configUrl = `${commonConfig.server_host}business/getModelBysId/${"172129113112117428019179600"}?sModelsId=${"172129113112117428019179600"}`;
// 调用服务获取数据
commonServices
.getService(token, configUrl)
.then(({ data: configReturn }) => {
if (configReturn.code === 1) {
const formData = configReturn.dataset.rows[0]?.formData;
setMasterConfig(formData[0]);
setState(pre => ({ ...pre, formData }));
}
})
.catch(error => {
console.error("Error fetching data:", error);
});
}, [location, app]);
// 主表
const list = masterConfig?.gdsconfigformslave.filter(item => item.sName && item.bVisible);
console.log("🚀 ~ list:", list);
// 客户
const customer = list?.find(x => x.showName === "客户名称") || {};
// console.log("🚀 ~ ableConfigs:", masterConfig);
console.log("🚀 ~ customer:", customer);
return (
{quotationData?.showName || "Loading..."}
{/* {list&& list.length
? list.map((item, index) => {
return (
);
})
: ""} */}
);
};
export default QuotationAllprogressDetail;