Browse Source

发起审批后列表刷新

cz 10 months ago
parent
commit
09637a828e

+ 21 - 0
src/hooks/refreshTableData.js

@@ -0,0 +1,21 @@
+import {
+  onMounted,
+  onBeforeUnmount
+} from "vue";
+import $bus from "@/bus/index.js";
+
+function useRefreshTableData(fn) {
+
+  onMounted(() => {
+    $bus.on("refreshTableData", () => {
+      fn()
+    });
+  });
+
+  onBeforeUnmount(() => {
+    $bus.off("refreshTableData");
+  });
+
+}
+
+export default useRefreshTableData;

+ 11 - 44
src/views/EHSD/procurement/handoverSlipEHSD/index.vue

@@ -1,25 +1,16 @@
 <template>
   <div class="tenant">
     <div class="content">
-      <byTable
-        :source="sourceList.data"
-        :pagination="sourceList.pagination"
-        :config="config"
-        :loading="loading"
-        highlight-current-row
-        :table-events="{
+      <byTable :source="sourceList.data" :pagination="sourceList.pagination" :config="config" :loading="loading" highlight-current-row :table-events="{
           select: selectRow,
           'select-all': selectRow,
-        }"
-        :action-list="[
+        }" :action-list="[
           {
             text: '采购',
             disabled: selectData.length === 0,
             action: () => clickPurchase(),
           },
-        ]"
-        @get-list="getList"
-      >
+        ]" @get-list="getList">
         <template #claimTime="{ item }">
           <div style="width: 100%">
             <span v-if="item.claimTime">{{ item.claimTime }}</span>
@@ -34,45 +25,19 @@
       </byTable>
     </div>
 
-    <el-dialog
-      title="交接单"
-      v-if="openAllFile"
-      v-model="openAllFile"
-      width="600"
-    >
-      <byForm
-        :formConfig="formConfig"
-        :formOption="formOption"
-        v-model="rowData"
-        ref="fileState"
-      >
+    <el-dialog title="交接单" v-if="openAllFile" v-model="openAllFile" width="600">
+      <byForm :formConfig="formConfig" :formOption="formOption" v-model="rowData" ref="fileState">
         <template #file>
           <div>
-            <div
-              v-for="(file, index) in rowData.fileList"
-              :key="index"
-              style="padding: 4px 0"
-            >
-              <a
-                style="color: #409eff; cursor: pointer"
-                @click="openFile(file.fileUrl)"
-                >{{ file.fileName }}</a
-              >
+            <div v-for="(file, index) in rowData.fileList" :key="index" style="padding: 4px 0">
+              <a style="color: #409eff; cursor: pointer" @click="openFile(file.fileUrl)">{{ file.fileName }}</a>
             </div>
           </div>
         </template>
         <template #indication>
           <div>
-            <div
-              v-for="(file, index) in rowData.packageFileList"
-              :key="index"
-              style="padding: 4px 0"
-            >
-              <a
-                style="color: #409eff; cursor: pointer"
-                @click="openFile(file.fileUrl)"
-                >{{ file.fileName }}</a
-              >
+            <div v-for="(file, index) in rowData.packageFileList" :key="index" style="padding: 4px 0">
+              <a style="color: #409eff; cursor: pointer" @click="openFile(file.fileUrl)">{{ file.fileName }}</a>
             </div>
           </div>
         </template>
@@ -89,6 +54,7 @@ import { computed, ref } from "vue";
 import byTable from "@/components/byTable/index";
 import byForm from "@/components/byForm/index";
 import moment from "moment";
+import useRefreshTableData from "@/hooks/refreshTableData";
 
 const { proxy } = getCurrentInstance();
 const sourceList = ref({
@@ -373,6 +339,7 @@ const getTimeSpent = (item) => {
   }
   return text;
 };
+useRefreshTableData(getList);
 </script>
 
 <style lang="scss" scoped>

+ 1 - 0
src/views/process/processApproval/index.vue

@@ -676,6 +676,7 @@ const skipPage = () => {
       });
     }
   }
+  $bus.emit("refreshTableData");
 };
 let queryData = reactive({
   data: {},