Browse Source

上传设计稿: 刷新订单列表

lxf 1 year ago
parent
commit
f23a7f1354

+ 18 - 0
src/store/modules/refresh.js

@@ -0,0 +1,18 @@
+const refreshStore = defineStore("refresh_sd", {
+  state: () => ({
+    refresh: {},
+  }),
+  actions: {
+    setRefresh(label) {
+      let $chars = "ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678";
+      let maxPos = $chars.length;
+      let random = "";
+      for (let i = 0; i < 32; i++) {
+        random += $chars.charAt(Math.floor(Math.random() * maxPos));
+      }
+      this.refresh[label] = random;
+    },
+  },
+});
+
+export default refreshStore;

+ 2 - 0
src/views/subsidiary/order/management/add.vue

@@ -369,6 +369,7 @@ import SelectProduct from "/src/views/group/product/management/index";
 import SelectBOM from "/src/views/group/BOM/management/index";
 import useTagsViewStore from "/src/store/modules/tagsView";
 import SelectPicture from "/src/components/select-picture/index.vue";
+import refreshStore from "/src/store/modules/refresh";
 
 const { proxy } = getCurrentInstance();
 const router = useRouter();
@@ -573,6 +574,7 @@ const submitForm = (status) => {
           message: type == "add" ? "添加成功" : "编辑成功",
           type: "success",
         });
+        refreshStore().setRefresh("order");
         clickCancel();
       });
     } else {

+ 2 - 0
src/views/subsidiary/order/management/design.vue

@@ -276,6 +276,7 @@ import { useRouter, useRoute } from "vue-router";
 import useTagsViewStore from "/src/store/modules/tagsView";
 import SelectPicture from "/src/components/select-picture/index.vue";
 import SelectBOM from "/src/views/group/BOM/management/index";
+import refreshStore from "/src/store/modules/refresh";
 
 const { proxy } = getCurrentInstance();
 const router = useRouter();
@@ -443,6 +444,7 @@ const submitForm = (status) => {
           message: type == "add" ? "添加成功" : "编辑成功",
           type: "success",
         });
+        refreshStore().setRefresh("order");
         clickCancel();
       });
     } else {

+ 6 - 0
src/views/subsidiary/order/management/index.vue

@@ -35,6 +35,7 @@
 <script setup name="Subsidiary-order-management">
 import byTable from "/src/components/byTable/index";
 import { ElMessage, ElMessageBox } from "element-plus";
+import refreshStore from "/src/store/modules/refresh";
 
 const { proxy } = getCurrentInstance();
 const sourceList = ref({
@@ -386,6 +387,11 @@ const clickUpload = (row) => {
     },
   });
 };
+watch(refreshStore().refresh, (val) => {
+  if (val.order) {
+    getList();
+  }
+});
 </script>
 
 <style lang="scss" scoped>