Browse Source

合同页面:字典接口替换

lxf 1 year ago
parent
commit
85c5c89f95

+ 22 - 86
src/components/process/Contract.vue

@@ -447,7 +447,6 @@
 
 <script setup>
 import byForm from "@/components/byForm/index";
-import useUserStore from "@/store/modules/user";
 import SelectGoods from "@/components/product/SelectGoods";
 import { ElMessage } from "element-plus";
 import Editor from "@/components/Editor/index.vue";
@@ -573,91 +572,28 @@ const rules = ref({
   remark: [{ required: true, message: "请输入付款条件", trigger: "blur" }],
 });
 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: "funds_payment_method",
-      tenantId: useUserStore().user.tenantId,
-    })
-    .then((res) => {
-      if (res.rows && res.rows.length > 0) {
-        fundsPaymentMethod.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
-    .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.getDictOne(["account_currency", "funds_payment_method", "trade_methods", "shipping_method", "contract_type"]).then((res) => {
+    accountCurrency.value = res["account_currency"].map((x) => ({
+      label: x.dictValue,
+      value: x.dictKey,
+    }));
+    fundsPaymentMethod.value = res["funds_payment_method"].map((x) => ({
+      label: x.dictValue,
+      value: x.dictKey,
+    }));
+    tradeMethods.value = res["trade_methods"].map((x) => ({
+      label: x.dictValue,
+      value: x.dictKey,
+    }));
+    shippingMethod.value = res["shipping_method"].map((x) => ({
+      label: x.dictValue,
+      value: x.dictKey,
+    }));
+    contractType.value = res["contract_type"].map((x) => ({
+      label: x.dictValue,
+      value: x.dictKey,
+    }));
+  });
   proxy.post("/contractTemplate/page", { pageNum: 1, pageSize: 999 }).then((res) => {
     templateList.value = res.rows.map((item) => {
       return {

+ 18 - 69
src/components/process/PriceSheet.vue

@@ -325,7 +325,6 @@
 
 <script setup>
 import byForm from "@/components/byForm/index";
-import useUserStore from "@/store/modules/user";
 import SelectGoods from "@/components/product/SelectGoods";
 import { ElMessage } from "element-plus";
 
@@ -430,74 +429,24 @@ const rules = ref({
   remark: [{ required: true, message: "请输入付款条件", trigger: "blur" }],
 });
 const getDict = () => {
-  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: "funds_payment_method",
-      tenantId: useUserStore().user.tenantId,
-    })
-    .then((res) => {
-      if (res.rows && res.rows.length > 0) {
-        fundsPaymentMethod.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
-    .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.getDictOne(["account_currency", "funds_payment_method", "trade_methods", "shipping_method"]).then((res) => {
+    accountCurrency.value = res["account_currency"].map((x) => ({
+      label: x.dictValue,
+      value: x.dictKey,
+    }));
+    fundsPaymentMethod.value = res["funds_payment_method"].map((x) => ({
+      label: x.dictValue,
+      value: x.dictKey,
+    }));
+    tradeMethods.value = res["trade_methods"].map((x) => ({
+      label: x.dictValue,
+      value: x.dictKey,
+    }));
+    shippingMethod.value = res["shipping_method"].map((x) => ({
+      label: x.dictValue,
+      value: x.dictKey,
+    }));
+  });
   proxy.post("/contractTemplate/page", { pageNum: 1, pageSize: 999 }).then((res) => {
     templateList.value = res.rows.map((item) => {
       return {

+ 10 - 35
src/components/process/ServiceContract.vue

@@ -320,7 +320,6 @@
 
 <script setup>
 import byForm from "@/components/byForm/index";
-import useUserStore from "@/store/modules/user";
 import SelectGoods from "@/components/product/SelectGoods";
 import { ElMessage } from "element-plus";
 import Editor from "@/components/Editor/index.vue";
@@ -421,40 +420,16 @@ const rules = ref({
   shroffAccountId: [{ required: true, message: "请选择收款账号", trigger: "change" }],
 });
 const getDict = () => {
-  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: "funds_payment_method",
-      tenantId: useUserStore().user.tenantId,
-    })
-    .then((res) => {
-      if (res.rows && res.rows.length > 0) {
-        fundsPaymentMethod.value = res.rows.map((item) => {
-          return {
-            label: item.dictValue,
-            value: item.dictKey,
-          };
-        });
-      }
-    });
+  proxy.getDictOne(["account_currency", "funds_payment_method"]).then((res) => {
+    accountCurrency.value = res["account_currency"].map((x) => ({
+      label: x.dictValue,
+      value: x.dictKey,
+    }));
+    fundsPaymentMethod.value = res["funds_payment_method"].map((x) => ({
+      label: x.dictValue,
+      value: x.dictKey,
+    }));
+  });
   proxy.post("/contractTemplate/page", { pageNum: 1, pageSize: 999 }).then((res) => {
     templateList.value = res.rows.map((item) => {
       return {