浏览代码

app-企业信息页面修改

Liudijing 11 月之前
父节点
当前提交
075ac196ba

+ 1 - 1
h5app/src/router/index.ts

@@ -49,7 +49,7 @@ const routes: Array<RouteRecordRaw> = [
                 component: () => import('@/views/pages/company/edit.vue')
             },
             {
-                path: 'tabMain/company/postList?',
+                path: 'tabMain/company/postList',
                 component: () => import('@/views/pages/company/postList.vue')
             },
             {

+ 10 - 2
h5app/src/views/pages/company/edit.vue

@@ -209,7 +209,7 @@
   </ion-page>
 </template>
 <script lang="ts">
-import {defineComponent, ref, toRefs, reactive, computed} from "vue";
+import {defineComponent, ref, toRefs, reactive, computed, watch} from "vue";
 import {getRegionList, getSiteList, getStreeList} from '@/api/company/index'
 import {useRoute, useRouter} from "vue-router";
 import {alertController, onIonViewDidEnter} from "@ionic/vue";
@@ -331,7 +331,15 @@ export default defineComponent({
       if (route.query.pageStatus == '1') {
         formState.dataModel = {recordStatus: 1, statusVal: 1};
         formState.dataModel.validTime = getCurrentDate();
-    
+      }
+    });
+
+    watch(() => route.query, () => {
+      if (route.query.date) {
+        if (route.query.pageStatus == '1') {
+          formState.dataModel = {recordStatus: 1, statusVal: 1};
+          formState.dataModel.validTime = getCurrentDate();
+        }
       }
     });
 

+ 3 - 3
h5app/src/views/pages/company/list.vue

@@ -140,11 +140,11 @@ export default defineComponent({
     }
 
     const onAdd = (item: any) => {
-      router.push({path: './edit', query: {pageStatus: 1, id: "", date:new Date().getTime()}});
+      router.push({path: './edit', query: {pageStatus: 1, id: "", date: new Date().getTime()}});
     }
 
     const enterPost = (companyID: any) => {
-      router.push({path: './postList', query: {id: companyID, pageStatus: 1}});
+      router.push({path: './postList', query: {id: companyID, pageStatus: 1, reload: 1}});
     }
 
     const search = () => {
@@ -152,7 +152,7 @@ export default defineComponent({
     }
 
     const back = () => {
-      router.push({path: '../', query: {reload: 1, date:new Date().getTime()}});
+      router.push({path: '../', query: {reload: 1, date: new Date().getTime()}});
     }
 
     onIonViewDidEnter(() => {

+ 30 - 13
h5app/src/views/pages/company/postList.vue

@@ -145,18 +145,16 @@ export default defineComponent({
       }
     }
 
-    onIonViewDidEnter(() => {
-      if (route.query.id && route.query.pageStatus == "1") {
-        getCompanyPostList({companyID: route.query.id, pageSize: 999, pageIndex: 1}).then(data => {
-          postList.value = data.list;
-          formatDataList();
-          console.log(postList.value);
-        });
-      } else if (!route.query.id && route.query.pageStatus == "1") {
-        isEdit.value = false;
-        formState.dataModel.statusVal = 2;
-        postList.value = [];
-      }
+    const loadData = () => {
+      postList.value = [];
+      getCompanyPostList({companyID: route.query.id, pageSize: 999, pageIndex: 1}).then(data => {
+        postList.value = data.list;
+        formatDataList();
+        console.log(postList.value);
+      });
+    }
+
+    const initData=()=>{
       if (route.query.id) {
         isEdit.value = true;
       }
@@ -166,7 +164,19 @@ export default defineComponent({
         formatDataList();
         console.log(postList);
       }
+      if (route.query.id && route.query.pageStatus == "1") {
+        loadData();
+      } else if (!route.query.id && route.query.pageStatus == "1") {
+        isEdit.value = false;
+        formState.dataModel.statusVal = 2;
+        postList.value = [];
+      }
+    }
 
+    onIonViewDidEnter(() => {
+      if(route.query.reload){
+        initData();
+      }
     });
 
     const formatDataList = () => {
@@ -203,7 +213,7 @@ export default defineComponent({
       if (isEdit.value) {
         router.push({path: './list'});
       } else {
-        router.push({path:'./edit', query: {pageStatus: 2}});
+        router.push({path: './edit', query: {pageStatus: 2}});
       }
     }
 
@@ -219,6 +229,13 @@ export default defineComponent({
       await alert.present();
     }
 
+    watch(() => route.query, () => {
+      if (route.query.date) {
+        if (route.query.id && route.query.pageStatus == "1")
+          loadData();
+      }
+    });
+
     return {
       formState,
       onAdd,