Browse Source

销售合同-打印-产品单位

lxf 1 year ago
parent
commit
1a1704b363
1 changed files with 34 additions and 69 deletions
  1. 34 69
      src/views/salesMange/saleContract/contract/index.vue

+ 34 - 69
src/views/salesMange/saleContract/contract/index.vue

@@ -141,7 +141,7 @@
               {{ item.productName }}
             </div>
             <div class="contentRow" style="width: 100px; text-align: center">
-              {{ item.productUnit }}
+              {{ dictValueLabel(item.productUnit, productUnit) }}
             </div>
             <div class="contentRow" style="width: 100px; text-align: center">
               {{ item.productQuantity }}
@@ -245,6 +245,7 @@ const tradeMethods = ref([]);
 const corporationList = ref([]);
 const customerList = ref([]);
 const shippingMethod = ref([]);
+const productUnit = ref([]);
 const userList = ref([]);
 const status = ref([
   {
@@ -519,57 +520,38 @@ const config = computed(() => {
   ];
 });
 const getDict = () => {
-  proxy
-    .post("/dictTenantData/page", {
-      pageNum: 1,
-      pageSize: 999,
-      dictCode: "contract_type",
-      tenantId: useUserStore().user.tenantId,
-    })
-    .then((res) => {
-      if (res.rows && res.rows.length > 0) {
-        contractType.value = res.rows.map((item) => {
-          return {
-            label: item.dictValue,
-            value: item.dictKey,
-          };
-        });
-      }
-    });
-  proxy
-    .post("/dictTenantData/page", {
-      pageNum: 1,
-      pageSize: 999,
-      dictCode: "account_currency",
-      tenantId: useUserStore().user.tenantId,
-    })
-    .then((res) => {
-      if (res.rows && res.rows.length > 0) {
-        accountCurrency.value = res.rows.map((item) => {
-          return {
-            label: item.dictValue,
-            value: item.dictKey,
-          };
-        });
-      }
-    });
-  proxy
-    .post("/dictTenantData/page", {
-      pageNum: 1,
-      pageSize: 999,
-      dictCode: "trade_methods",
-      tenantId: useUserStore().user.tenantId,
-    })
-    .then((res) => {
-      if (res.rows && res.rows.length > 0) {
-        tradeMethods.value = res.rows.map((item) => {
-          return {
-            label: item.dictValue,
-            value: item.dictKey,
-          };
-        });
-      }
-    });
+  proxy.getDictOne(["contract_type", "account_currency", "trade_methods", "shipping_method", "unit"]).then((res) => {
+    if (res.contract_type && res.contract_type.length > 0) {
+      contractType.value = res.contract_type.map((x) => ({
+        label: x.dictValue,
+        value: x.dictKey,
+      }));
+    }
+    if (res.account_currency && res.account_currency.length > 0) {
+      accountCurrency.value = res.account_currency.map((x) => ({
+        label: x.dictValue,
+        value: x.dictKey,
+      }));
+    }
+    if (res.trade_methods && res.trade_methods.length > 0) {
+      tradeMethods.value = res.trade_methods.map((x) => ({
+        label: x.dictValue,
+        value: x.dictKey,
+      }));
+    }
+    if (res.shipping_method && res.shipping_method.length > 0) {
+      shippingMethod.value = res.shipping_method.map((x) => ({
+        label: x.dictValue,
+        value: x.dictKey,
+      }));
+    }
+    if (res.unit && res.unit.length > 0) {
+      productUnit.value = res.unit.map((x) => ({
+        label: x.dictValue,
+        value: x.dictKey,
+      }));
+    }
+  });
   proxy.post("/corporation/page", { pageNum: 1, pageSize: 999 }).then((res) => {
     corporationList.value = res.rows.map((item) => {
       return {
@@ -589,23 +571,6 @@ const getDict = () => {
     });
   });
   proxy
-    .post("/dictTenantData/page", {
-      pageNum: 1,
-      pageSize: 999,
-      dictCode: "shipping_method",
-      tenantId: useUserStore().user.tenantId,
-    })
-    .then((res) => {
-      if (res.rows && res.rows.length > 0) {
-        shippingMethod.value = res.rows.map((item) => {
-          return {
-            label: item.dictValue,
-            value: item.dictKey,
-          };
-        });
-      }
-    });
-  proxy
     .get("/tenantUser/list", {
       pageNum: 1,
       pageSize: 10000,