Sfoglia il codice sorgente

收支流水:关联销售合同详情bug

lxf 1 anno fa
parent
commit
285bc91a3d
1 ha cambiato i file con 12 aggiunte e 10 eliminazioni
  1. 12 10
      src/components/PDF/contractPDF.vue

+ 12 - 10
src/components/PDF/contractPDF.vue

@@ -195,8 +195,8 @@ const printDetails = ref({});
 const props = defineProps({
   rowData: Object,
 });
-const getPdfData = (row) => {
-  proxy.post("/contract/getContractPdfInfo", { id: row.id }).then((res) => {
+const getPdfData = (query) => {
+  proxy.post("/contract/getContractPdfInfo", query).then((res) => {
     printDetails.value = res;
   });
 };
@@ -223,10 +223,6 @@ const statisticsTwo = (label, index) => {
   return num;
 };
 
-if (props.rowData && props.rowData.id) {
-  getPdfData(props.rowData);
-}
-
 const productUnit = ref([]);
 const tradeMethods = ref([]);
 const shippingMethod = ref([]);
@@ -249,11 +245,17 @@ const getDict = () => {
 };
 getDict();
 watch(
-  () => props.rowData.id,
-  (val) => {
-    if (props.rowData && props.rowData.id) {
-      getPdfData(props.rowData);
+  props.rowData,
+  () => {
+    if (props.rowData.id) {
+      getPdfData({ id: props.rowData.id });
+    } else if (props.rowData.code) {
+      getPdfData({ code: props.rowData.code });
     }
+  },
+  {
+    immediate: true,
+    deep: true,
   }
 );
 </script>