|
@@ -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,
|