Browse Source

fix:销售类目名称无法修改

snow 2 years ago
parent
commit
710a1d31c6

+ 0 - 1
src/components/PageSearch/src/hooks/use-page-search.ts

@@ -59,7 +59,6 @@ export function usePageSearch(
 
   function handleResetClick(params?: any) {
     const { result } = searchCallback ? searchCallback(params) : { result: {} };
-
     pageContentRef.value?.getPageData(resetEmpty ? {} : result);
     resetCallback && resetCallback();
   }

+ 39 - 31
src/views/InvoiceSaleSettings/basic-settings.vue

@@ -1,6 +1,6 @@
 <script setup lang="ts">
 import { ElForm } from "element-plus";
-import { computed, reactive, ref, watchEffect, nextTick } from "vue";
+import { computed, reactive, ref, watchEffect, nextTick, watch } from "vue";
 import { cost_rules, inv_tag, add_tax } from "./commodityCost/config/configs";
 import RemoteSelect from "/@/components/RemoteSelect";
 import { useResponseHandle } from "/@/hooks";
@@ -67,6 +67,9 @@ function handleSelectCategory(category) {
   }
 
   const { tax, cat_name } = category;
+
+  console.log(tax);
+
   taxs.value = tax;
   formData.tax = tax[0];
   formData.cat_name = cat_name;
@@ -89,39 +92,44 @@ watchEffect(() => {
   inv_tag_options.value = inv_tag.filter(i => tags.includes(i.value));
 });
 
-watchEffect(() => {
-  if (!props.detail) return;
-
-  const {
-    good_name,
-    inv_good_name,
-    inv_tax,
-    inv_cat_code,
-    is_discount,
-    inv_tag,
-    addTax
-  } = props.detail;
-
-  formData.inv_good_name = inv_good_name ? inv_good_name : good_name;
-  formData.tax = inv_tax ? inv_tax * 100 + "%" : "";
-  formData.is_discount = String(is_discount);
-
-  if (formData.inv_good_name.length > 70) {
-    formData.inv_good_name = formData.inv_good_name.slice(0, 70);
-  }
+watch(
+  () => props.detail,
+  () => {
+    if (!props.detail) return;
 
-  nextTick(() => {
-    formData.inv_tag = String(inv_tag);
-    formData.addTax = addTax;
-  });
+    console.log(props.detail);
+
+    const {
+      good_name,
+      inv_good_name,
+      inv_tax,
+      inv_cat_code,
+      is_discount,
+      inv_tag,
+      addTax
+    } = props.detail;
 
-  if (inv_cat_code) {
-    remoteSelectRef.value &&
-      (remoteSelectRef.value as any).initalData({
-        cat_code: inv_cat_code
-      });
+    formData.inv_good_name = inv_good_name ? inv_good_name : good_name;
+    formData.tax = inv_tax ? inv_tax * 100 + "%" : "";
+    formData.is_discount = String(is_discount);
+
+    if (formData.inv_good_name.length > 70) {
+      formData.inv_good_name = formData.inv_good_name.slice(0, 70);
+    }
+
+    nextTick(() => {
+      formData.inv_tag = String(inv_tag);
+      formData.addTax = addTax;
+    });
+
+    if (inv_cat_code) {
+      remoteSelectRef.value &&
+        (remoteSelectRef.value as any).initalData({
+          cat_code: inv_cat_code
+        });
+    }
   }
-});
+);
 </script>
 
 <template>