|
@@ -385,6 +385,49 @@ const getDict = () => {
|
|
|
};
|
|
|
// getDict();
|
|
|
|
|
|
+const getContractData = (businessId) => {
|
|
|
+ proxy.post("/contract/detail", { id: businessId }).then((res) => {
|
|
|
+ formData.data.contractId = res.id;
|
|
|
+ formData.data.currency = res.currency;
|
|
|
+ if (res.contractProductList && res.contractProductList.length > 0) {
|
|
|
+ formData.data.afterSalesDetailList = res.contractProductList.map(
|
|
|
+ (row) => ({
|
|
|
+ contractProductId: row.id,
|
|
|
+ productId: row.productId,
|
|
|
+ contractCode: res.code,
|
|
|
+ productName: row.productName,
|
|
|
+ productCode: row.productCode,
|
|
|
+ productModel: row.productModel,
|
|
|
+ fileUrl: "",
|
|
|
+ contractQuantity: row.quantity,
|
|
|
+ price: row.price,
|
|
|
+ quantity: null,
|
|
|
+ remark: "",
|
|
|
+ amount: "",
|
|
|
+ })
|
|
|
+ );
|
|
|
+ let ids = formData.data.afterSalesDetailList.map((x) => x.productId);
|
|
|
+ proxy
|
|
|
+ .post("/fileInfo/getList", {
|
|
|
+ businessIdList: ids,
|
|
|
+ })
|
|
|
+ .then((fileObj) => {
|
|
|
+ for (let i = 0; i < formData.data.afterSalesDetailList.length; i++) {
|
|
|
+ const e = formData.data.afterSalesDetailList[i];
|
|
|
+ for (const key in fileObj) {
|
|
|
+ if (e.productId === key) {
|
|
|
+ e.fileList = fileObj[key] || [];
|
|
|
+ if (e.fileList && e.fileList.length > 0) {
|
|
|
+ e.fileUrl = e.fileList[0].fileUrl;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
const getAllData = (businessId) => {
|
|
|
if (businessId) {
|
|
|
proxy.post("/afterSales/detail", { id: businessId }).then((res) => {
|
|
@@ -425,6 +468,9 @@ const getAllData = (businessId) => {
|
|
|
|
|
|
onMounted(() => {
|
|
|
formOption.disabled = judgeStatus();
|
|
|
+ if (route.query.contractId) {
|
|
|
+ getContractData(route.query.contractId);
|
|
|
+ }
|
|
|
if (route.query.businessId) {
|
|
|
getAllData(route.query.businessId);
|
|
|
}
|