Jelajahi Sumber

app-企业信息收集页面调整

liudijing 10 bulan lalu
induk
melakukan
9e63bb7ba8

+ 11 - 1
h5app/src/api/company/index.ts

@@ -78,4 +78,14 @@ export function getCompanyById(id: string) {
     }, {
         isNew: true
     })
-}
+}
+
+export function getCurrentDate() {
+    const now = new Date();
+    const year = now.getFullYear();
+    const month = (now.getMonth() + 1).toString().padStart(2, '0');
+    const day = now.getDate().toString().padStart(2, '0');
+
+    const currentDate = `${year}-${month}-${day}`;
+    return currentDate;
+}

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

@@ -210,7 +210,7 @@
 </template>
 <script lang="ts">
 import {defineComponent, ref, toRefs, reactive, computed, watch} from "vue";
-import {getRegionList, getSiteList, getStreeList} from '@/api/company/index'
+import {getRegionList, getSiteList, getStreeList,getCurrentDate} from '@/api/company/index'
 import {useRoute, useRouter} from "vue-router";
 import {alertController, onIonViewDidEnter} from "@ionic/vue";
 import {useVuelidate} from "@vuelidate/core";
@@ -284,7 +284,6 @@ export default defineComponent({
         await presentAlert('请输入完整信息!');
         return null;
       }
-      console.log(formState.dataModel);
       const jsonStr = JSON.stringify(formState.dataModel);
       localStorage.removeItem('companyData');
       localStorage.setItem("companyData", jsonStr);
@@ -355,14 +354,14 @@ export default defineComponent({
       await alert.present();
     }
 
-    const getCurrentDate = () => {
-      const validDate = new Date();
-      // 获取年月日
-      const year = validDate.getFullYear();
-      const month = validDate.getMonth() + 1; // 注意月份是从0开始的,需要加1
-      const day = validDate.getDate();
-      return `${year}-${month}-${day}`;
-    }
+    // const getCurrentDate = () => {
+    //   const validDate = new Date();
+    //   // 获取年月日
+    //   const year = validDate.getFullYear();
+    //   const month = validDate.getMonth() + 1; // 注意月份是从0开始的,需要加1
+    //   const day = validDate.getDate();
+    //   return `${year}-${month}-${day}`;
+    // }
 
     const back=()=>{
       isShow.value=false;

+ 8 - 15
h5app/src/views/pages/company/editPost.vue

@@ -41,7 +41,7 @@
             </div>
             <div style="width: 80%;padding: 0;margin: 0;">
               <ion-datetime-button datetime="jobVacancyTime" style="width: 70%;"></ion-datetime-button>
-              <ion-modal :keep-contents-mounted="true" >
+              <ion-modal :keep-contents-mounted="true">
                 <ion-datetime placeholder="招聘日期" id="jobVacancyTime"
                               v-model="jobVacancyTime"
                               dataformatas="YYYY-MM-DD" presentation="date" cancel-text="取消" done-text="确定"
@@ -68,8 +68,9 @@ import {useRoute, useRouter} from "vue-router";
 import {alertController, onIonViewDidEnter} from "@ionic/vue";
 import {arrowBackOutline} from 'ionicons/icons';
 import {useVuelidate} from "@vuelidate/core";
-import {post} from "@/api/common";
+import {getCurrentDate} from "@/api/company";
 import {minLength, required} from "@vuelidate/validators";
+import PostList from "@/views/pages/company/postList.vue";
 
 interface FormState {
   dataModel: {
@@ -96,6 +97,7 @@ export default defineComponent({
     const route = useRoute();
     const isEdit = ref<any>(false);
     const formState = reactive<FormState>({dataModel: {}});
+    const oldDataModel= reactive<FormState>({dataModel: {}});
     const postList = ref<PostModel[]>([]);
     const rules = computed(() => {
       return {
@@ -127,10 +129,8 @@ export default defineComponent({
       const jsonPostList = JSON.stringify(postList.value);
       localStorage.removeItem("postData");
       localStorage.setItem("postData", jsonPostList);
-      console.log(formState.dataModel);
-      console.log(postList.value);
       if (route.query.id) {
-        await router.push({path: "./postList", query: {pageStatus: 3, id: route.query.id}});
+        await router.push({path: "./postList", query: {pageStatus: 3, id: route.query.id,editPostStatus:1}});
       } else {
         await router.push({path: "./postList", query: {pageStatus: 3}});
       }
@@ -147,16 +147,7 @@ export default defineComponent({
       console.log(postList);
     };
 
-    const getCurrentDate = () => {
-      const validDate = new Date();
-      // 获取年月日
-      const year = validDate.getFullYear();
-      const month = validDate.getMonth() + 1; // 注意月份是从0开始的,需要加1
-      const day = validDate.getDate();
-      return `${year}-${month}-${day}`;
-    }
-
-    const initData = (id: any) => {
+     const initData = (id: any) => {
       if (route.query.addStatus) {
         formState.dataModel.recruitCount = null;
         formState.dataModel.validTime = getCurrentDate();
@@ -168,6 +159,7 @@ export default defineComponent({
         isEdit.value = true;
       }
       loadData(id);
+      console.log(jobVacancyTime.value);
     };
 
     const back = () => {
@@ -205,6 +197,7 @@ export default defineComponent({
       router,
       isEdit,
       back,
+      oldDataModel,
       v$
     }
   }

+ 9 - 7
h5app/src/views/pages/company/postList.vue

@@ -81,7 +81,7 @@
 <script lang="ts">
 import {computed, defineComponent, reactive, ref, watch} from "vue";
 import {useRoute, useRouter} from "vue-router";
-import {alertController, onIonViewDidEnter} from "@ionic/vue";
+import {alertController, onIonViewDidEnter, loadingController} from "@ionic/vue";
 import {arrowBackOutline, addCircleOutline} from 'ionicons/icons';
 import {saveCompanyPost, getCompanyPostList, getCompanyById} from '@/api/company/index'
 import dayjs from "dayjs";
@@ -101,6 +101,7 @@ interface PostModel {
 export default defineComponent({
   name: 'editPost',
   setup() {
+    const loading = ref(false);
     const router = useRouter();
     const route = useRoute();
     const isEdit = ref<any>();
@@ -132,7 +133,7 @@ export default defineComponent({
               router.push({path: './list', query: {success: 1}});
             }
           })
-        })
+        });
       } else {
         const jsonDataModel = localStorage.getItem("companyData");
         formState.dataModel = JSON.parse(jsonDataModel ?? "");
@@ -146,15 +147,17 @@ export default defineComponent({
     }
 
     const loadData = () => {
+      loading.value = true;
       postList.value = [];
       getCompanyPostList({companyID: route.query.id, pageSize: 999, pageIndex: 1}).then(data => {
         postList.value = data.list;
         formatDataList();
+        loading.value = false;
         console.log(postList.value);
       });
     }
 
-    const initData=()=>{
+    const initData = () => {
       if (route.query.id) {
         isEdit.value = true;
       }
@@ -174,9 +177,7 @@ export default defineComponent({
     }
 
     onIonViewDidEnter(() => {
-      if(route.query.reload){
-        initData();
-      }
+      initData();
     });
 
     const formatDataList = () => {
@@ -249,7 +250,8 @@ export default defineComponent({
       presentAlert,
       router,
       isEdit,
-      back
+      back,
+      loading
     }
   }
 });