Browse Source

app-企业信息页面功能代码,数据验证待修改

Liudijing 11 months ago
parent
commit
591c37b3c3

+ 40 - 2
h5app/src/api/company/index.ts

@@ -13,7 +13,6 @@ export function getSiteList(params: any) {
         },
         },
     );
     );
 }
 }
-
 //获取县区
 //获取县区
 export function getRegionList(params: any) {
 export function getRegionList(params: any) {
     return request<any>(
     return request<any>(
@@ -27,7 +26,6 @@ export function getRegionList(params: any) {
         },
         },
     );
     );
 }
 }
-
 //获取街道
 //获取街道
 export function getStreeList(params: any) {
 export function getStreeList(params: any) {
     return request<any>(
     return request<any>(
@@ -40,4 +38,44 @@ export function getStreeList(params: any) {
             isNew: true,
             isNew: true,
         },
         },
     );
     );
+}
+//提交添加
+export  function  saveCompanyPost(data:any){
+    return request(
+        {
+            url:'companyService/company/saveAppCompanyPost',
+            method:'post',
+            data
+        }
+    )
+}
+//获取企业信息
+export function getCompanyList(params:any){
+    return request({
+        url:'companyService/company/getList',
+        method:'get',
+        params
+    },{
+        isNew:true
+    })
+}
+//获取企业岗位信息
+export function getCompanyPostList(params:any){
+    return request({
+        url:'companyService/post/getList',
+        method:'get',
+        params
+    },{
+        isNew:true
+    })
+}
+
+export function getCompanyById(id: string) {
+    return request<object>({
+        url: 'companyService/company/getCompanyByID',
+        method: 'get',
+        params: {id}
+    }, {
+        isNew: true
+    })
 }
 }

+ 176 - 110
h5app/src/views/pages/company/edit.vue

@@ -32,124 +32,168 @@
             </div>
             </div>
           </ion-item>
           </ion-item>
           <ion-item mode="md" :class="[v$.dataModel.companyCode.$error?'ion-invalid':'ion-valid']">
           <ion-item mode="md" :class="[v$.dataModel.companyCode.$error?'ion-invalid':'ion-valid']">
-            <ion-label>统一信用代码<span class="danger">*</span></ion-label>
-            <ion-input placeholder="统一信用代码" label-placement="stacked" :clear-input="true"
+            <ion-label style="width: 100px;">统一信用代码<span class="danger">*</span></ion-label>
+            <ion-input placeholder="请输入统一信用代码" label-placement="stacked" :clear-input="true"
                        v-model="formState.dataModel.companyCode">
                        v-model="formState.dataModel.companyCode">
             </ion-input>
             </ion-input>
             <ion-note slot="error">统一信用代码不能为空</ion-note>
             <ion-note slot="error">统一信用代码不能为空</ion-note>
           </ion-item>
           </ion-item>
           <ion-item mode="md" :class="[v$.dataModel.companyName.$error?'ion-invalid':'ion-valid']">
           <ion-item mode="md" :class="[v$.dataModel.companyName.$error?'ion-invalid':'ion-valid']">
-            <ion-label>企业名称<span class="danger">*</span></ion-label>
-            <ion-input placeholder="企业名称" label-placement="stacked" :clear-input="true"
+            <ion-label style="width: 100px;">企业名称<span class="danger">*</span></ion-label>
+            <ion-input placeholder="请输入企业名称" label-placement="stacked" :clear-input="true"
                        v-model="formState.dataModel.companyName">
                        v-model="formState.dataModel.companyName">
             </ion-input>
             </ion-input>
             <ion-note slot="error">企业名称不能为空</ion-note>
             <ion-note slot="error">企业名称不能为空</ion-note>
           </ion-item>
           </ion-item>
           <ion-item mode="md" :class="[v$.dataModel.siteID.$error?'ion-invalid':'ion-valid']">
           <ion-item mode="md" :class="[v$.dataModel.siteID.$error?'ion-invalid':'ion-valid']">
-            <ion-label>服务驿站</ion-label>
-            <ion-select interface="action-sheet" placeholder="请选择服务驿站" cancel-text="取消"
-                        id="siteID" v-model="formState.dataModel.siteID">
-              <ion-select-option v-for="(record,key) in siteList" :key="key"
-                                 v-model:value="record.siteID">
-                {{ record.siteName }}
-              </ion-select-option>
-            </ion-select>
+            <div style="width: 27%;">
+              <ion-label style="width: 100px;">服务驿站<span class="danger">*</span></ion-label>
+            </div>
+            <div style="width: 73%;text-align: left;">
+              <ion-select interface="action-sheet" placeholder="请选择服务驿站" cancel-text="取消" style="max-width: 70%;"
+                          id="siteID" v-model="formState.dataModel.siteID">
+                <ion-select-option v-for="(record,key) in siteList" :key="key"
+                                   v-model:value="record.siteID">
+                  {{ record.siteName }}
+                </ion-select-option>
+              </ion-select>
+            </div>
             <ion-note slot="error">服务驿站不能为空</ion-note>
             <ion-note slot="error">服务驿站不能为空</ion-note>
           </ion-item>
           </ion-item>
           <ion-item mode="md" :class="[v$.dataModel.address.$error?'ion-invalid':'ion-valid']">
           <ion-item mode="md" :class="[v$.dataModel.address.$error?'ion-invalid':'ion-valid']">
-            <ion-input label="企业办公地址" label-placement="stacked" :clear-input="true"
+            <ion-label style="width: 100px;">企业办公地址<span class="danger">*</span></ion-label>
+            <ion-input placeholder="请输入企业办公地址" label-placement="stacked" :clear-input="true"
                        v-model="formState.dataModel.address">
                        v-model="formState.dataModel.address">
             </ion-input>
             </ion-input>
             <ion-note slot="error">企业办公地址不能为空</ion-note>
             <ion-note slot="error">企业办公地址不能为空</ion-note>
           </ion-item>
           </ion-item>
           <ion-item mode="md" :class="[v$.dataModel.address.$error?'ion-invalid':'ion-valid']">
           <ion-item mode="md" :class="[v$.dataModel.address.$error?'ion-invalid':'ion-valid']">
-            <ion-input label="企业联系人" label-placement="stacked" :clear-input="true"
+            <ion-label style="width: 100px;">企业联系人<span class="danger">*</span></ion-label>
+            <ion-input placeholder="请输入企业联系人" label-placement="stacked" :clear-input="true"
                        v-model="formState.dataModel.userName">
                        v-model="formState.dataModel.userName">
             </ion-input>
             </ion-input>
             <ion-note slot="error">企业联系人不能为空</ion-note>
             <ion-note slot="error">企业联系人不能为空</ion-note>
           </ion-item>
           </ion-item>
           <ion-item mode="md" :class="[v$.dataModel.userMobile.$error?'ion-invalid':'ion-valid']">
           <ion-item mode="md" :class="[v$.dataModel.userMobile.$error?'ion-invalid':'ion-valid']">
-            <ion-input label="企业联系电话" label-placement="stacked" :clear-input="true"
+            <ion-label style="width: 100px;">企业联系电话<span class="danger">*</span></ion-label>
+            <ion-input placeholder="请输入企业联系电话" label-placement="stacked" :clear-input="true"
                        v-model="formState.dataModel.userMobile">
                        v-model="formState.dataModel.userMobile">
             </ion-input>
             </ion-input>
             <ion-note slot="error">企业联系电话不能为空</ion-note>
             <ion-note slot="error">企业联系电话不能为空</ion-note>
           </ion-item>
           </ion-item>
+          <ion-item mode="md" :class="[v$.dataModel.insuredCount.$error?'ion-invalid':'ion-valid']">
+            <ion-label style="width: 100px;">参保人数<span class="danger">*</span></ion-label>
+            <ion-input placeholder="请输入参保人数" label-placement="stacked" :clear-input="true"
+                       v-model="formState.dataModel.insuredCount">
+            </ion-input>
+            <ion-note slot="error">参保人数不能为空</ion-note>
+          </ion-item>
           <ion-item mode="md" :class="[v$.dataModel.recordStatus.$error?'ion-invalid':'ion-valid']">
           <ion-item mode="md" :class="[v$.dataModel.recordStatus.$error?'ion-invalid':'ion-valid']">
-            <ion-label>企业状态</ion-label>
-            <ion-select interface="action-sheet" placeholder="请选择企业状态" cancel-text="取消"
-                        id="recordStatus" v-model="formState.dataModel.recordStatus">
-              <ion-select-option v-for="(record,key) in companyStatuslist" :key="key"
-                                 v-model:value="record.value">
-                {{ record.name }}
-              </ion-select-option>
-            </ion-select>
+            <div style="width: 27%;">
+              <ion-label style="width: 100px;">企业状态</ion-label>
+            </div>
+            <div style="width: 73%;text-align: left;">
+              <ion-select interface="action-sheet" placeholder="请选择企业状态" cancel-text="取消" style="max-width: 70%;"
+                          id="recordStatus" v-model="formState.dataModel.recordStatus">
+                <ion-select-option v-for="(record,key) in companyStatuslist" :key="key"
+                                   v-model:value="record.value">
+                  {{ record.name }}
+                </ion-select-option>
+              </ion-select>
+            </div>
             <ion-note slot="error">企业状态不能为空</ion-note>
             <ion-note slot="error">企业状态不能为空</ion-note>
           </ion-item>
           </ion-item>
-          <ion-item>
-            <div class="panel-title2">
+          <ion-item mode="md" style="">
+            <div class="panel-title2" style="width: 25%;">
               <div class="item-flag"></div>
               <div class="item-flag"></div>
               其他信息
               其他信息
             </div>
             </div>
+            <div style="width: 75%;text-align: right;">
+              <ion-icon :icon="chevronDownOutline" @click="isShow=!isShow" v-show="!isShow"
+                        style="font-size: 24px;"></ion-icon>
+              <ion-icon :icon="chevronUpOutline" @click="isShow=!isShow" v-show="isShow"
+                        style="font-size: 24px;"></ion-icon>
+            </div>
           </ion-item>
           </ion-item>
-          <ion-item mode="md" :class="[v$.dataModel.regionCode.$error?'ion-invalid':'ion-valid']">
-            <ion-label>所属县区</ion-label>
-            <ion-select interface="action-sheet" placeholder="请选择所属县区" cancel-text="取消" @ionChange="changeCity"
-                        id="regionCode" v-model="formState.dataModel.regionCode">
-              <ion-select-option v-for="(record,key) in regionList" :key="key"
-                                 v-model:value="record.code">
-                {{ record.name }}
-              </ion-select-option>
-            </ion-select>
+          <ion-item v-show="isShow" mode="md" :class="[v$.dataModel.regionCode.$error?'ion-invalid':'ion-valid']">
+            <div style="width: 27%;">
+              <ion-label style="width: 100px;">所属县区<span class="danger">*</span></ion-label>
+            </div>
+            <div style="width: 73%;">
+              <ion-select interface="action-sheet" placeholder="请选择所属县区" cancel-text="取消" @ionChange="changeCity" style="max-width: 70%;"
+                          id="regionCode" v-model="formState.dataModel.regionCode">
+                <ion-select-option v-for="(record,key) in regionList" :key="key"
+                                   v-model:value="record.code">
+                  {{ record.name }}
+                </ion-select-option>
+              </ion-select>
+            </div>
             <ion-note slot="error">所属县区不能为空</ion-note>
             <ion-note slot="error">所属县区不能为空</ion-note>
           </ion-item>
           </ion-item>
-          <ion-item mode="md" :class="[v$.dataModel.streetCode.$error?'ion-invalid':'ion-valid']">
-            <ion-label>所属街道</ion-label>
-            <ion-select interface="action-sheet" placeholder="请选择所属街道" cancel-text="取消"
-                        id="streetCode" v-model="formState.dataModel.streetCode">
-              <ion-select-option v-for="(record,key) in streetList" :key="key"
-                                 v-model:value="record.code">
-                {{ record.name }}
-              </ion-select-option>
-            </ion-select>
+          <ion-item v-show="isShow" mode="md" :class="[v$.dataModel.streetCode.$error?'ion-invalid':'ion-valid']">
+            <div style="width: 27%;">
+              <ion-label style="width: 100px;">所属街道<span class="danger">*</span></ion-label>
+            </div>
+            <div style="width: 73%;">
+              <ion-select interface="action-sheet" placeholder="请选择所属街道" cancel-text="取消" style="max-width: 70%;"
+                          id="streetCode" v-model="formState.dataModel.streetCode">
+                <ion-select-option v-for="(record,key) in streetList" :key="key"
+                                   v-model:value="record.code">
+                  {{ record.name }}
+                </ion-select-option>
+              </ion-select>
+            </div>
             <ion-note slot="error">所属街道不能为空</ion-note>
             <ion-note slot="error">所属街道不能为空</ion-note>
           </ion-item>
           </ion-item>
-          <ion-item mode="md" :class="[v$.dataModel.companyModel.$error?'ion-invalid':'ion-valid']">
-            <ion-input label="企业规模" label-placement="stacked" :clear-input="true"
+          <ion-item v-show="isShow" mode="md" :class="[v$.dataModel.companyModel.$error?'ion-invalid':'ion-valid']">
+            <ion-label style="width: 100px;">企业规模<span class="danger">*</span></ion-label>
+            <ion-input placeholder="请输入企业规模" label-placement="stacked" :clear-input="true"
                        v-model="formState.dataModel.companyModel">
                        v-model="formState.dataModel.companyModel">
             </ion-input>
             </ion-input>
             <ion-note slot="error">企业规模不能为空</ion-note>
             <ion-note slot="error">企业规模不能为空</ion-note>
           </ion-item>
           </ion-item>
-          <ion-item>
-            <ion-label>企业归类</ion-label>
-            <ion-select interface="action-sheet" placeholder="" cancel-text="取消"
-                        id="companyType" v-model="formState.dataModel.companyType">
-              <ion-select-option v-for="(record,key) in studentStatuslist" :key="key"
-                                 v-model:value="record.code">
-                {{ record.name }}
-              </ion-select-option>
-            </ion-select>
+          <ion-item v-show="isShow">
+            <div style="width: 27%;">
+              <ion-label style="width: 100px;">企业归类</ion-label>
+            </div>
+            <div style="width: 73%;">
+              <ion-select interface="action-sheet" placeholder="请选择企业归类" cancel-text="取消" style="max-width: 70%;"
+                          id="companyType" v-model="formState.dataModel.companyType">
+                <ion-select-option v-for="(record,key) in studentStatuslist" :key="key"
+                                   v-model:value="record.code">
+                  {{ record.name }}
+                </ion-select-option>
+              </ion-select>
+            </div>
           </ion-item>
           </ion-item>
-          <ion-item mode="md" :class="[v$.dataModel.companyEmail.$error?'ion-invalid':'ion-valid']">
-            <ion-input label="企业邮箱" label-placement="stacked" :clear-input="true"
+          <ion-item v-show="isShow" mode="md" :class="[v$.dataModel.companyEmail.$error?'ion-invalid':'ion-valid']">
+            <ion-label style="width: 100px;">企业邮箱<span class="danger">*</span></ion-label>
+            <ion-input placeholder="请选择企业邮箱" label-placement="stacked" :clear-input="true"
                        v-model="formState.dataModel.companyEmail">
                        v-model="formState.dataModel.companyEmail">
             </ion-input>
             </ion-input>
             <ion-note slot="error">企业邮箱不能为空</ion-note>
             <ion-note slot="error">企业邮箱不能为空</ion-note>
           </ion-item>
           </ion-item>
-          <ion-item mode="md" :class="[v$.dataModel.frName.$error?'ion-invalid':'ion-valid']">
-            <ion-input label="法人代表" label-placement="stacked" :clear-input="true"
+          <ion-item v-show="isShow" mode="md" :class="[v$.dataModel.frName.$error?'ion-invalid':'ion-valid']">
+            <ion-label style="width: 100px;">法人代表<span class="danger">*</span></ion-label>
+            <ion-input placeholder="请选择法人代表" label-placement="stacked" :clear-input="true"
                        v-model="formState.dataModel.frName">
                        v-model="formState.dataModel.frName">
             </ion-input>
             </ion-input>
+            <ion-note slot="error">法人代表不能为空</ion-note>
           </ion-item>
           </ion-item>
-          <ion-item mode="md" :class="[v$.dataModel.validTime.$error?'ion-invalid':'ion-valid']">
-            <ion-label>营业执照有效期<span class="danger">*</span></ion-label>
-            <ion-datetime-button datetime="validTime"></ion-datetime-button>
-            <ion-modal :keep-contents-mounted="true">
-              <ion-datetime id="reportDate" placeholder="营业执照有效期"
-                            v-model="formState.dataModel.validTime"
-                            dataformatas="YYYY-MM-DD" presentation="date" cancel-text="取消" done-text="确定"
-                            :show-default-buttons="true">
-              </ion-datetime>
-            </ion-modal>
+          <ion-item v-show="isShow" mode="md" :class="[v$.dataModel.validTime.$error?'ion-invalid':'ion-valid']">
+            <div style="width: 40%;" >
+              <ion-label style="width: 150px;">营业执照有效期<span class="danger">*</span></ion-label>
+            </div>
+            <div style="width: 60%;">
+              <ion-datetime-button datetime="validTime"></ion-datetime-button>
+              <ion-modal :keep-contents-mounted="true" >
+                <ion-datetime id="validTime" placeholder="营业执照有效期"
+                              v-model="formState.dataModel.validTime"
+                              dataformatas="YYYY-MM-DD" presentation="date" cancel-text="取消" done-text="确定"
+                              :show-default-buttons="true">
+                </ion-datetime>
+              </ion-modal>
+            </div>
           </ion-item>
           </ion-item>
         </ion-list>
         </ion-list>
       </form>
       </form>
@@ -168,10 +212,9 @@ import {defineComponent, ref, toRefs, reactive, computed} from "vue";
 import {getRegionList, getSiteList, getStreeList} from '@/api/company/index'
 import {getRegionList, getSiteList, getStreeList} from '@/api/company/index'
 import {useRoute, useRouter} from "vue-router";
 import {useRoute, useRouter} from "vue-router";
 import {alertController, onIonViewDidEnter} from "@ionic/vue";
 import {alertController, onIonViewDidEnter} from "@ionic/vue";
-import {arrowBackOutline} from 'ionicons/icons';
 import {useVuelidate} from "@vuelidate/core";
 import {useVuelidate} from "@vuelidate/core";
-import {required} from "@vuelidate/validators";
-
+import {chevronDownOutline, chevronUpOutline, arrowBackOutline} from 'ionicons/icons';
+import {minLength, required} from "@vuelidate/validators";
 interface FormState {
 interface FormState {
   dataModel: any;
   dataModel: any;
 }
 }
@@ -187,6 +230,7 @@ export default defineComponent({
       desc: '企业岗位信息',
       desc: '企业岗位信息',
       val: 2
       val: 2
     }]);
     }]);
+    const isShow = ref<any>(false);
     const regionList = ref<any>([]);
     const regionList = ref<any>([]);
     const streetList = ref<any>([]);
     const streetList = ref<any>([]);
     const siteList = ref<any>([]);
     const siteList = ref<any>([]);
@@ -196,20 +240,37 @@ export default defineComponent({
     ];
     ];
     const rules = computed(() => {
     const rules = computed(() => {
       return {
       return {
+        // dataModel: {
+        //   companyName: {required: true},
+        //   companyCode: {required: true},
+        //   siteID: {required: true},
+        //   regionCode: {required: true},
+        //   streetCode: {required: true},
+        //   address: {required: true},
+        //   companyModel: {required: true},
+        //   userName: {required: true},
+        //   userMobile: {required: true},
+        //   companyEmail: {required: true},
+        //   frName: {required: true},
+        //   validTime: {required: true},
+        //   recordStatus: {required: true},
+        //   insuredCount: {required: true},
+        // }
         dataModel: {
         dataModel: {
-          companyName: {required: false},
-          companyCode: {required: false},
-          siteID: {required: false},
-          regionCode: {required: false},
-          streetCode: {required: false},
-          address: {required: false},
-          companyModel: {required: false},
-          userName: {required: false},
-          userMobile: {required: false},
-          companyEmail: {required: false},
-          frName: {required: false},
-          validTime: {required: false},
-          recordStatus: {required: false},
+          companyName: {required},
+          companyCode: {required},
+          siteID: {required},
+          regionCode: {required},
+          streetCode: {required},
+          address: {required},
+          companyModel: {required},
+          userName: {required},
+          userMobile: {required},
+          companyEmail: {required},
+          frName: {required},
+          validTime: {required},
+          recordStatus: {required},
+          insuredCount: {required},
         }
         }
       }
       }
     });
     });
@@ -217,23 +278,16 @@ export default defineComponent({
 
 
     const next = async () => {
     const next = async () => {
       const isFormCorrect = await v$.value.$validate();
       const isFormCorrect = await v$.value.$validate();
-
       if (!isFormCorrect) {
       if (!isFormCorrect) {
+        await presentAlert('请输入完整信息!');
         return null;
         return null;
       }
       }
-      const jsonStr=JSON.stringify(formState.dataModel);
-      localStorage.setItem("companyData",jsonStr)
-      // router.push({path: './postList', query: {dataModel:jsonStr }});
-      router.push({path: './postList'});
+      console.log(formState.dataModel);
+      const jsonStr = JSON.stringify(formState.dataModel);
+      localStorage.removeItem('companyData');
+      localStorage.setItem("companyData", jsonStr);
+      await router.push({path: './postList', query: {pageStatus: 1}});
     }
     }
-
-    const onSave = () => {
-      // if (!dataModel.value.name) {
-      //   presentAlert("请填写姓名!");
-      //   return false;
-      // }
-    }
-
     const onCancel = () => {
     const onCancel = () => {
       router.push("./index");
       router.push("./index");
     }
     }
@@ -263,16 +317,15 @@ export default defineComponent({
     }
     }
 
 
     const initData = () => {
     const initData = () => {
-      // dataModel.value = {name: '', statusVal: 1};
-      // loadData(id);
-      formState.dataModel.statusVal = 1;
+
       getRegionListData();
       getRegionListData();
       getSitetListData();
       getSitetListData();
     };
     };
 
 
     onIonViewDidEnter(() => {
     onIonViewDidEnter(() => {
-      // if (route.query.reload)
       initData();
       initData();
+      formState.dataModel={recordStatus:1,statusVal:1};
+      formState.dataModel.validTime = getCurrentDate();
     });
     });
 
 
     const presentAlert = async (message: string) => {
     const presentAlert = async (message: string) => {
@@ -287,35 +340,46 @@ export default defineComponent({
       await alert.present();
       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}`;
+    }
+
     return {
     return {
       formState,
       formState,
       stepList,
       stepList,
       initData,
       initData,
-      onSave,
       onCancel,
       onCancel,
       next,
       next,
       route,
       route,
       arrowBackOutline,
       arrowBackOutline,
+      chevronDownOutline,
+      chevronUpOutline,
       router,
       router,
       regionList,
       regionList,
       streetList,
       streetList,
       companyStatuslist,
       companyStatuslist,
       changeCity,
       changeCity,
       v$,
       v$,
-      siteList
+      siteList,
+      isShow
     }
     }
   }
   }
 });
 });
 </script>
 </script>
 
 
 <style lang="less">
 <style lang="less">
-.next-btn {
-  width: 100%;
-  --border-radius: 0px;
-  --background: #f2f2f5;
-  margin: 20px 0 0 0;
-  color: #363432;
-  font-size: 14px;
+ion-item {
+  --border-width: 0;
+  --border-style: none;
+
+  ion-label, ion-input, ion-select, ion-datetime-button {
+    font-size: 14px !important;
+  }
 }
 }
 
 
 .stepFlex {
 .stepFlex {
@@ -395,6 +459,8 @@ export default defineComponent({
     left: calc(50% - 2px);
     left: calc(50% - 2px);
     position: absolute;
     position: absolute;
   }
   }
+
 }
 }
 
 
+
 </style>
 </style>

+ 126 - 124
h5app/src/views/pages/company/editPost.vue

@@ -3,7 +3,7 @@
     <ion-header class="header-theme2">
     <ion-header class="header-theme2">
       <ion-toolbar>
       <ion-toolbar>
         <ion-buttons slot="start">
         <ion-buttons slot="start">
-          <ion-icon :icon="arrowBackOutline" @click="()=>router.push('./postList')"></ion-icon>
+          <ion-icon :icon="arrowBackOutline" @click="back"></ion-icon>
         </ion-buttons>
         </ion-buttons>
         <ion-title>
         <ion-title>
           岗位信息收集
           岗位信息收集
@@ -13,22 +13,38 @@
     <ion-content>
     <ion-content>
       <form autocomplete="off">
       <form autocomplete="off">
         <ion-list>
         <ion-list>
-          <ion-item>
-            <ion-input label="岗位名称" label-placement="stacked" :clear-input="true">
+          <ion-item mode="md" :class="[v$.dataModel.postName.$error?'ion-invalid':'ion-valid']">
+            <ion-label style="width: 100px;">岗位名称<span class="danger">*</span></ion-label>
+            <ion-input placeholder="请输入岗位名称" label-placement="stacked" :clear-input="true"
+                       v-model="formState.dataModel.postName">
             </ion-input>
             </ion-input>
+            <ion-note slot="error">请输入岗位名称</ion-note>
           </ion-item>
           </ion-item>
-          <ion-item>
-            <ion-input label="招聘数量" label-placement="stacked" :clear-input="true"
+          <ion-item mode="md" :class="[v$.dataModel.recruitCount.$error?'ion-invalid':'ion-valid']">
+            <ion-label style="width: 100px;">招聘数量<span class="danger">*</span></ion-label>
+            <ion-input  placeholder="请输入招聘数量" label-placement="stacked" :clear-input="true"
+                       v-model="formState.dataModel.recruitCount"
             >
             >
             </ion-input>
             </ion-input>
+            <ion-note slot="error">请输入招聘数量</ion-note>
           </ion-item>
           </ion-item>
-          <ion-item>
-            <ion-input label="招聘日期" label-placement="stacked" :clear-input="true">
-            </ion-input>
+          <ion-item mode="md" >
+            <ion-label>招聘日期<span class="danger">*</span></ion-label>
+            <ion-datetime-button datetime="jobVacancyTime"></ion-datetime-button>
+            <ion-modal :keep-contents-mounted="true">
+              <ion-datetime placeholder="招聘日期" id="jobVacancyTime"
+                            v-model="jobVacancyTime"
+                            dataformatas="YYYY-MM-DD" presentation="date" cancel-text="取消" done-text="确定"
+                            :show-default-buttons="true">
+              </ion-datetime>
+            </ion-modal>
           </ion-item>
           </ion-item>
-          <ion-item>
-            <ion-input label="有效天数" label-placement="stacked" :clear-input="true">
+          <ion-item mode="md" :class="[v$.dataModel.validDay.$error?'ion-invalid':'ion-valid']">
+            <ion-label style="width: 100px;">有效天数<span class="danger">*</span></ion-label>
+            <ion-input  placeholder="请输入有效天数" label-placement="stacked" :clear-input="true"
+                       v-model="formState.dataModel.validDay">
             </ion-input>
             </ion-input>
+            <ion-note slot="error">请输入有效天数</ion-note>
           </ion-item>
           </ion-item>
         </ion-list>
         </ion-list>
       </form>
       </form>
@@ -43,59 +59,122 @@
   </ion-page>
   </ion-page>
 </template>
 </template>
 <script lang="ts">
 <script lang="ts">
-import {defineComponent, ref, watch} from "vue";
+import {computed, defineComponent, reactive, ref, watch} from "vue";
 import {useRoute, useRouter} from "vue-router";
 import {useRoute, useRouter} from "vue-router";
 import {alertController, onIonViewDidEnter} from "@ionic/vue";
 import {alertController, onIonViewDidEnter} from "@ionic/vue";
 import {arrowBackOutline} from 'ionicons/icons';
 import {arrowBackOutline} from 'ionicons/icons';
+import {useVuelidate} from "@vuelidate/core";
+import {post} from "@/api/common";
+import {minLength, required} from "@vuelidate/validators";
+interface FormState {
+  dataModel: {
+    postName?: string | null,
+    recruitCount?: number | null,
+    validTime?: string | null,
+    // jobVacancyTime?: string | null,
+    validDay?: number | null
+  };
+}
 
 
-interface DataModel {
-  name: string,
-  statusVal: number
+interface PostModel {
+  postName?: string | null,
+  recruitCount?: number | null,
+  validTime?: string | null,
+  validDay?: number | null
 }
 }
 
 
 export default defineComponent({
 export default defineComponent({
   name: 'editPost',
   name: 'editPost',
   setup() {
   setup() {
+    const jobVacancyTime = ref<string>();
     const router = useRouter();
     const router = useRouter();
     const route = useRoute();
     const route = useRoute();
-    const dataModel = ref<DataModel>({
-      name: '',
-      statusVal: 2
+    const isEdit = ref<any>(false);
+    const formState = reactive<FormState>({dataModel: {}});
+    const postList = ref<PostModel[]>([]);
+    const rules = computed(() => {
+      return {
+        dataModel: {
+          validDay: {required},
+          recruitCount: {required},
+          postName: {required},
+          // jobVacancyTime: {required},
+        }
+      }
     });
     });
-    const onSave = () => {
-      if (!dataModel.value.name) {
-        presentAlert("请填写姓名!");
-        return false;
+    const v$ = useVuelidate(rules, formState);
+
+    const onSave = async () => {
+      const isFormCorrect = await v$.value.$validate();
+      if (!isFormCorrect) {
+        await presentAlert('请输入完整信息!');
+        return null;
+      }
+      const indexToUpdate = postList.value.findIndex(post => post.postName === formState.dataModel.postName);
+      if (indexToUpdate != -1) {
+        postList.value[indexToUpdate].recruitCount = formState.dataModel.recruitCount;
+        postList.value[indexToUpdate].validTime =jobVacancyTime.value;
+        postList.value[indexToUpdate].validDay = formState.dataModel.validDay;
+      } else {
+        formState.dataModel.validTime=jobVacancyTime.value;
+        postList.value.push(formState.dataModel);
+      }
+      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: 2,id:route.query.id}});
+      }else{
+        await router.push({path: "./postList", query: {pageStatus: 2}});
       }
       }
 
 
-      /*save(dataModel.value as any).then(result => {
-        if (result) {
-          router.push({path: './index', query: {reload: 1}});
-        }
-      });*/
     }
     }
 
 
     const onCancel = () => {
     const onCancel = () => {
-      router.push("./index");
+      router.push({path: "./index"});
     }
     }
 
 
     const loadData = (practiceTaskStudentID: any) => {
     const loadData = (practiceTaskStudentID: any) => {
-      /*get(practiceTaskStudentID).then((result: any) => {
-        dataModel.value = result;
-
-        loadPracticeBaseList(dataModel.value.schoolYearID);
-        loadCityList();
-      });*/
+      const jsonPostList = localStorage.getItem("postData");
+      postList.value = JSON.parse(jsonPostList ?? "");
+      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) => {
-      dataModel.value = {name: '', statusVal: 1};
+      if (route.query.addStatus) {
+        formState.dataModel.recruitCount = null;
+        formState.dataModel.validTime = getCurrentDate();
+        jobVacancyTime.value = getCurrentDate();
+        formState.dataModel.validDay = null;
+        formState.dataModel.postName = null;
+      }
+      if (route.query.id){
+        isEdit.value=true;
+      }
       loadData(id);
       loadData(id);
     };
     };
 
 
+    const back = () => {
+      if (isEdit.value) {
+        router.push({path:'./postList',query: {pageStatus: 2,id:route.query.id}});
+      } else {
+        router.push({path:'./postList',query: {pageStatus: 2}});
+      }
+    }
+
     onIonViewDidEnter(() => {
     onIonViewDidEnter(() => {
-      if (route.query.reload)
-        initData(route.query.id);
+      initData(route.query.id);
     });
     });
 
 
     const presentAlert = async (message: string) => {
     const presentAlert = async (message: string) => {
@@ -106,110 +185,33 @@ export default defineComponent({
           '确定'
           '确定'
         ],
         ],
       });
       });
-
       await alert.present();
       await alert.present();
     }
     }
 
 
     return {
     return {
-      dataModel,
+      formState,
       initData,
       initData,
       onSave,
       onSave,
       onCancel,
       onCancel,
       route,
       route,
+      postList,
       arrowBackOutline,
       arrowBackOutline,
+      jobVacancyTime,
       router,
       router,
+      isEdit,
+      back,
+      v$
     }
     }
   }
   }
 });
 });
 </script>
 </script>
 
 
 <style lang="less">
 <style lang="less">
-.next-btn {
-  width: 100%;
-  --border-radius: 0px;
-  --background: #f2f2f5;
-  margin: 20px 0 0 0;
-  color: #363432;
-  font-size: 14px;
-}
-
-.stepFlex {
-  margin: 0;
-  display: flex;
-  width: 100%;
-
-  .stepFlex-item {
-    position: relative;
-    flex: 1;
-    text-align: center;
-    margin-top: -10px;
-
-    .stepFlex-item-label {
-      padding-top: 60px;
-      font-size: 14px;
-
-      .stepFlex-item-label-title {
-        margin-top: 30px;
-      }
-
-      .stepFlex-item-label-desc {
-        margin-top: 5px;
-        color: #b9b9bd;
-      }
-    }
-  }
-
-  .greenCircle {
-    top: calc(50% - 15px);
-    left: calc(50% - 4px);
-    position: absolute;
-    z-index: 2;
-    width: 10px;
-    height: 10px;
-    border-radius: 50%;
-    background-color: #31A2FE;
-  }
-
-  .now {
-    top: calc(50% - 18px);
-    left: calc(50% - 8px);
-    position: absolute;
-    z-index: 3;
-    width: 16px;
-    height: 16px;
-    border-radius: 50%;
-    background-color: #31A2FE;
-    border: 4px solid #c5e8f9;
-  }
-
-  .greyCircle {
-    top: calc(50% - 15px);
-    left: calc(50% - 4px);
-    position: absolute;
-    z-index: 2;
-    width: 10px;
-    height: 10px;
-    border-radius: 50%;
-    background-color: #ccc;
-  }
-
-  .greenline {
-    width: 100%;
-    top: calc(50% - 11px);
-    left: calc(50% - 2px);
-    height: 2px;
-    background-color: #31A2FE;
-    position: absolute;
-  }
-
-  .greyline {
-    height: 0;
-    border: 1px dashed #ccc;
-    width: 100%;
-    top: calc(50% - 11px);
-    left: calc(50% - 2px);
-    position: absolute;
+ion-item {
+  --border-width: 0;
+  --border-style: none;
+  ion-label,input,ion-select,ion-datetime {
+    font-size: 14px !important;
   }
   }
 }
 }
-
 </style>
 </style>

+ 53 - 21
h5app/src/views/pages/company/list.vue

@@ -13,20 +13,26 @@
     </ion-header>
     </ion-header>
     <ion-content>
     <ion-content>
       <ion-item style="margin: 10px 0;">
       <ion-item style="margin: 10px 0;">
-        <ion-input style="border: 1px solid #f2f2f5;border-radius: 14px;--padding-start: 10px;height: 35px;"></ion-input>
-        <ion-button slot="end" style="height: 33px;width: 70px;margin-left: 10px;--box-shadow: none;--border-radius: 14px;">搜索</ion-button>
+        <ion-input style="border: 1px solid #f2f2f5;border-radius: 14px;--padding-start: 10px;height: 35px;"
+                   v-model="searchParams.companyName"
+        ></ion-input>
+        <ion-button slot="end"
+                    style="height: 33px;width: 70px;margin-left: 10px;--box-shadow: none;--border-radius: 14px;"
+                    @click="search"
+        >搜索
+        </ion-button>
       </ion-item>
       </ion-item>
       <ion-list class="list-content">
       <ion-list class="list-content">
-        <ion-item v-for="(record,key) in dataList" :key="key"  detail>
+        <ion-item v-for="(record,key) in dataList" :key="key" detail @click="enterPost(record.companyID)">
           <ion-grid>
           <ion-grid>
             <ion-row>
             <ion-row>
               <ion-col>
               <ion-col>
                 <ion-label style="display: flex;justify-content: space-between;">
                 <ion-label style="display: flex;justify-content: space-between;">
                   <ion-text>
                   <ion-text>
-                    {{record.companyName}}
+                    {{ record.companyName }}
                   </ion-text>
                   </ion-text>
                   <p>
                   <p>
-                    {{record.statusName}}
+                    正在跟进
                   </p>
                   </p>
                 </ion-label>
                 </ion-label>
               </ion-col>
               </ion-col>
@@ -35,7 +41,7 @@
               <ion-col>
               <ion-col>
                 <ion-label>
                 <ion-label>
                   <p>
                   <p>
-                    最新跟进时间:{{record.updateTime}}
+                    最新跟进时间:{{ record.modifyTime }}
 
 
                   </p>
                   </p>
                 </ion-label>
                 </ion-label>
@@ -45,10 +51,10 @@
               <ion-col>
               <ion-col>
                 <ion-label style="display: flex;justify-content: space-between;">
                 <ion-label style="display: flex;justify-content: space-between;">
                   <p>
                   <p>
-                    参保人数:16
+                    参保人数:{{ record.insuredCount }}
                   </p>
                   </p>
                   <p>
                   <p>
-                    岗位数量:6
+                    岗位数量:{{ record.postCount }}
                   </p>
                   </p>
                 </ion-label>
                 </ion-label>
               </ion-col>
               </ion-col>
@@ -75,6 +81,7 @@ import {useRoute, useRouter} from "vue-router";
 import {arrowBackOutline, ellipse, addCircleOutline} from 'ionicons/icons';
 import {arrowBackOutline, ellipse, addCircleOutline} from 'ionicons/icons';
 import {IonIcon, onIonViewDidEnter} from '@ionic/vue';
 import {IonIcon, onIonViewDidEnter} from '@ionic/vue';
 import BEmpty from "@/components/empty.vue";
 import BEmpty from "@/components/empty.vue";
+import {getCompanyList} from '@/api/company/index'
 
 
 export default defineComponent({
 export default defineComponent({
   name: 'CompanyList',
   name: 'CompanyList',
@@ -83,32 +90,45 @@ export default defineComponent({
     const loading = ref(true);
     const loading = ref(true);
     const pagination = computed(() => ({
     const pagination = computed(() => ({
       total: total,
       total: total,
-      current: searchParamsState.page,
-      pageSize: searchParamsState.rows
+      current: searchParams.pageIndex,
+      pageSize: searchParams.pageSize
     }));
     }));
+    const searchParams = reactive({
+      pageIndex: 1,
+      pageSize: 20,
+      primaryKey: '',
+      companyName: '',
+      companyCode: '',
+      recordStatus: '',
+      regionCode: '',
+      streetCode: ''
+    });
     const dataList = ref<any>([]);
     const dataList = ref<any>([]);
     const router = useRouter();
     const router = useRouter();
     const route = useRoute();
     const route = useRoute();
     const total = ref(15);
     const total = ref(15);
     const colors = ref(["secondary", "tertiary", "success", "warning"]);
     const colors = ref(["secondary", "tertiary", "success", "warning"]);
 
 
-    const searchParamsState = reactive({page: 1, rows: 10, writeStatus: null})
-
     const loadData = async function () {
     const loadData = async function () {
       loading.value = true;
       loading.value = true;
+      getCompanyList(searchParams).then(data => {
+        dataList.value = data.list;
+        total.value = data.total;
+        dataList.value.map((item: any) => {
+          if (item.modifyTime)
+            item.modifyTime = dayjs(item.modifyTime).format("YYYY-MM-DD");
+        });
+        console.log(dataList.value);
+      })
 
 
-      /*const result: any = await getMyIntentionList(searchParamsState);
-      dataList.value = dataList.value.concat(result.list);
-      total.value = result.total;*/
-
-      dataList.value = [{companyName: '惠州市AA信息科技有限公司', statusName: "正在跟进",updateTime:'2023-12-11'},
-        {companyName: '惠州市BB信息科技有限公司', statusName: "正在跟进",updateTime:'2023-12-12'},{companyName: '惠州市CC信息科技有限公司', statusName: "正在跟进",updateTime:'2023-12-13'}];
+      // dataList.value = [{companyName: '惠州市AA信息科技有限公司', statusName: "正在跟进",updateTime:'2023-12-11'},
+      //   {companyName: '惠州市BB信息科技有限公司', statusName: "正在跟进",updateTime:'2023-12-12'},{companyName: '惠州市CC信息科技有限公司', statusName: "正在跟进",updateTime:'2023-12-13'}];
       loading.value = false;
       loading.value = false;
     }
     }
 
 
     const reload = () => {
     const reload = () => {
       dataList.value = [];
       dataList.value = [];
-      searchParamsState.page = 1;
+      searchParams.pageIndex = 1;
       loadData();
       loadData();
     }
     }
 
 
@@ -126,6 +146,14 @@ export default defineComponent({
       router.push({path: './edit', query: {reload: 1, id: ""}});
       router.push({path: './edit', query: {reload: 1, id: ""}});
     }
     }
 
 
+    const enterPost=(companyID:any)=>{
+      router.push({path: './postList', query: {id: companyID,pageStatus:1}});
+    }
+
+    const search = () => {
+      loadData();
+    }
+
     onIonViewDidEnter(() => {
     onIonViewDidEnter(() => {
       reload();
       reload();
     });
     });
@@ -136,7 +164,6 @@ export default defineComponent({
       colors,
       colors,
       reload,
       reload,
       loading,
       loading,
-      searchParamsState,
       dataList,
       dataList,
       total,
       total,
       dayjs,
       dayjs,
@@ -146,21 +173,26 @@ export default defineComponent({
       ellipse,
       ellipse,
       arrowBackOutline,
       arrowBackOutline,
       addCircleOutline,
       addCircleOutline,
+      searchParams,
+      enterPost,
+      search
     }
     }
   }
   }
 });
 });
 </script>
 </script>
 
 
 <style lang="less">
 <style lang="less">
-.company-list-page{
+.company-list-page {
   .list-content {
   .list-content {
     margin: 0px 15px !important;
     margin: 0px 15px !important;
     background-color: white !important;
     background-color: white !important;
     border-radius: 0 !important;
     border-radius: 0 !important;
+
     ion-item {
     ion-item {
       margin-top: 10px;
       margin-top: 10px;
       font-size: 14px;
       font-size: 14px;
       border: 1px solid rgb(242, 242, 245);
       border: 1px solid rgb(242, 242, 245);
+
       p {
       p {
         font-size: 12px;
         font-size: 12px;
       }
       }

+ 90 - 25
h5app/src/views/pages/company/postList.vue

@@ -3,7 +3,7 @@
     <ion-header class="header-theme2">
     <ion-header class="header-theme2">
       <ion-toolbar>
       <ion-toolbar>
         <ion-buttons slot="start">
         <ion-buttons slot="start">
-          <ion-icon :icon="arrowBackOutline" @click="()=>router.push('./edit')"></ion-icon>
+          <ion-icon :icon="arrowBackOutline" @click="back"></ion-icon>
         </ion-buttons>
         </ion-buttons>
         <ion-title>
         <ion-title>
           企业信息收集
           企业信息收集
@@ -11,12 +11,12 @@
       </ion-toolbar>
       </ion-toolbar>
     </ion-header>
     </ion-header>
     <ion-content>
     <ion-content>
-      <div class="stepFlex">
+      <div class="stepFlex" v-if="!isEdit">
         <div v-for="(record,key) in stepList" :key="key" class="stepFlex-item">
         <div v-for="(record,key) in stepList" :key="key" class="stepFlex-item">
           <div
           <div
-              :class="[(record.val < dataModel?.statusVal || dataModel?.statusVal==stepList[stepList.length-1].val) ? 'greenCircle' :record.val == dataModel?.statusVal ? 'now' : 'greyCircle']"></div>
+              :class="[(record.val < formState.dataModel?.statusVal || formState.dataModel?.statusVal==stepList[stepList.length-1].val) ? 'greenCircle' :record.val == formState.dataModel?.statusVal ? 'now' : 'greyCircle']"></div>
           <div v-if="key !== stepList.length - 1"
           <div v-if="key !== stepList.length - 1"
-               :class="[record.val < dataModel?.statusVal ? 'greenline' : 'greyline']"></div>
+               :class="[record.val < formState.dataModel?.statusVal ? 'greenline' : 'greyline']"></div>
           <div class="stepFlex-item-label">
           <div class="stepFlex-item-label">
             <p class="stepFlex-item-label-title">{{ record.title }}</p>
             <p class="stepFlex-item-label-title">{{ record.title }}</p>
             <p class="stepFlex-item-label-desc">{{ record.desc }}</p>
             <p class="stepFlex-item-label-desc">{{ record.desc }}</p>
@@ -49,9 +49,10 @@
               </ion-col>
               </ion-col>
             </ion-row>
             </ion-row>
             <ion-row>
             <ion-row>
-              <ion-col size="6">
+              <ion-col size="8">
                 <ion-label>
                 <ion-label>
                   <p>
                   <p>
+                    <!--                    {{ record.jobVacancyTime }}至{{ calculateEndDate(record.jobVacancyTime, record.validDay) }}-->
                     {{ record.validTime }}至{{ calculateEndDate(record.validTime, record.validDay) }}
                     {{ record.validTime }}至{{ calculateEndDate(record.validTime, record.validDay) }}
                   </p>
                   </p>
                 </ion-label>
                 </ion-label>
@@ -82,21 +83,28 @@ import {computed, defineComponent, reactive, ref, watch} from "vue";
 import {useRoute, useRouter} from "vue-router";
 import {useRoute, useRouter} from "vue-router";
 import {alertController, onIonViewDidEnter} from "@ionic/vue";
 import {alertController, onIonViewDidEnter} from "@ionic/vue";
 import {arrowBackOutline, addCircleOutline} from 'ionicons/icons';
 import {arrowBackOutline, addCircleOutline} from 'ionicons/icons';
+import {saveCompanyPost, getCompanyPostList, getCompanyById} from '@/api/company/index'
+import dayjs from "dayjs";
 
 
 interface FormState {
 interface FormState {
   dataModel: any;
   dataModel: any;
 }
 }
 
 
+interface PostModel {
+  postName?: string | null,
+  recruitCount?: number | null,
+  // jobVacancyTime?: string | null,
+  validTime?: string | null,
+  validDay: number | null
+}
+
 export default defineComponent({
 export default defineComponent({
   name: 'editPost',
   name: 'editPost',
   setup() {
   setup() {
     const router = useRouter();
     const router = useRouter();
     const route = useRoute();
     const route = useRoute();
-    const postList = ref<any>([
-      {postName: '岗位1', recruitCount: 20, validTime: '2023-12-1', validDay: 5},
-      {postName: '岗位2', recruitCount: 5, validTime: '2023-11-1', validDay: 3}
-    ]);
-
+    const isEdit = ref<any>();
+    const postList = ref<PostModel[]>([]);
     const formState = reactive<FormState>({dataModel: {}});
     const formState = reactive<FormState>({dataModel: {}});
     const stepList = ref([
     const stepList = ref([
       {
       {
@@ -111,39 +119,94 @@ export default defineComponent({
       }]);
       }]);
 
 
     const onSave = () => {
     const onSave = () => {
-      // if (!formState.dataModel.value.name) {
-      //   presentAlert("请填写姓名!");
-      //   return false;
-      // }
+      if (postList.value.length == 0) {
+        presentAlert('没有要提交的岗位信息!');
+        return null;
+      }
+      if (route.query.id) {
+        getCompanyById(route.query.id + "").then(data => {
+          formState.dataModel = data;
+          formState.dataModel.postData = postList.value;
+          saveCompanyPost(formState.dataModel).then(result => {
+            if (result) {
+              router.push({path: './list', query: {success: 1}});
+            }
+          })
+        })
+      } else {
+        const jsonDataModel = localStorage.getItem("companyData");
+        formState.dataModel = JSON.parse(jsonDataModel ?? "");
+        formState.dataModel.postData = postList.value;
+        saveCompanyPost(formState.dataModel).then(result => {
+          if (result) {
+            router.push({path: './list', query: {success: 1}});
+          }
+        })
+      }
     }
     }
 
 
     onIonViewDidEnter(() => {
     onIonViewDidEnter(() => {
-      const jsonStr = localStorage.getItem("companyData");
-      console.log(jsonStr);
-      formState.dataModel=JSON.parse(jsonStr??"");
-      // formState.dataModel=JSON.parse(JSON.stringify(route.query.dataModel));
-      // formState.dataModel.postData=postList.value;
-      formState.dataModel.postData=postList.value;
-      console.log(formState.dataModel);
+      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) {
+        isEdit.value = false;
+        formState.dataModel.statusVal = 2;
+        postList.value = [];
+      }
+      if(route.query.id){
+        isEdit.value = true;
+      }
+      if (route.query.pageStatus == "2") {
+        const jsonPostList = localStorage.getItem("postData");
+        postList.value = JSON.parse(jsonPostList ?? "");
+        formatDataList();
+        console.log(postList);
+      }
+
     });
     });
 
 
+    const formatDataList = () => {
+      postList.value.map(item => {
+        if (item.validTime)
+          item.validTime = dayjs(item.validTime).format("YYYY-MM-DD");
+      });
+    }
+
     const onAdd = () => {
     const onAdd = () => {
-      router.push('./editPost');
+      const jsonPostList = JSON.stringify(postList.value);
+      localStorage.removeItem("postData");
+      localStorage.setItem("postData", jsonPostList);
+      if (route.query.id) {
+        router.push({path: './editPost', query: {addStatus: 1, id: route.query.id}});
+      } else {
+        router.push({path: './editPost', query: {addStatus: 1}});
+      }
     }
     }
 
 
     // 计算截止日期的方法
     // 计算截止日期的方法
     const calculateEndDate = (validTime: any, validDay: any) => {
     const calculateEndDate = (validTime: any, validDay: any) => {
+      debugger;
       const validDate = new Date(validTime);
       const validDate = new Date(validTime);
-      validDate.setDate(validDate.getDate() + validDay);
-
+      validDate.setDate(validDate.getDate() + Number.parseInt(validDay));
       // 获取年月日
       // 获取年月日
       const year = validDate.getFullYear();
       const year = validDate.getFullYear();
       const month = validDate.getMonth() + 1; // 注意月份是从0开始的,需要加1
       const month = validDate.getMonth() + 1; // 注意月份是从0开始的,需要加1
       const day = validDate.getDate();
       const day = validDate.getDate();
-
       return `${year}-${month}-${day}`;
       return `${year}-${month}-${day}`;
     };
     };
 
 
+    const back = () => {
+      if (isEdit.value) {
+        router.push('./list');
+      } else {
+        router.push('./edit');
+      }
+    }
+
     const presentAlert = async (message: string) => {
     const presentAlert = async (message: string) => {
       const alert = await alertController.create({
       const alert = await alertController.create({
         header: '错误!',
         header: '错误!',
@@ -168,6 +231,8 @@ export default defineComponent({
       addCircleOutline,
       addCircleOutline,
       presentAlert,
       presentAlert,
       router,
       router,
+      isEdit,
+      back
     }
     }
   }
   }
 });
 });

+ 7 - 2
src/main/java/com/hz/employmentsite/controller/companyService/CompanyController.java

@@ -9,6 +9,7 @@ import com.hz.employmentsite.filter.exception.RespGenerstor;
 import com.hz.employmentsite.model.PcSite;
 import com.hz.employmentsite.model.PcSite;
 import com.hz.employmentsite.util.DateUtils;
 import com.hz.employmentsite.util.DateUtils;
 import com.hz.employmentsite.util.ExcelHelper;
 import com.hz.employmentsite.util.ExcelHelper;
+import com.hz.employmentsite.vo.companyService.AppCompanyPostVo;
 import com.hz.employmentsite.vo.taskAndLog.DotaskVo;
 import com.hz.employmentsite.vo.taskAndLog.DotaskVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
@@ -52,6 +53,7 @@ public class CompanyController {
         var data = companyService.getDataById(id);
         var data = companyService.getDataById(id);
         if (data == null) {
         if (data == null) {
             data = new CompanyVo();
             data = new CompanyVo();
+            data.companyID=UUID.randomUUID().toString();
         }
         }
         return RespGenerstor.success(data);
         return RespGenerstor.success(data);
     }
     }
@@ -123,9 +125,12 @@ public class CompanyController {
         } else {
         } else {
             return RespGenerstor.success(true);
             return RespGenerstor.success(true);
         }
         }
-
-
     }
     }
 
 
+    @PostMapping("/saveAppCompanyPost")
+    public  BaseResponse saveAppCompanyPost(@RequestBody AppCompanyPostVo companyPostVo){
+        var result = companyService.saveAppCompanyPost(companyPostVo, accountService.getLoginUserID());
+        return RespGenerstor.success(result);
+    }
 
 
 }
 }

+ 5 - 3
src/main/java/com/hz/employmentsite/controller/companyService/PostController.java

@@ -39,9 +39,11 @@ public class PostController {
                                 @RequestParam(required = false) Integer maxCount,
                                 @RequestParam(required = false) Integer maxCount,
                                 @RequestParam(required = false) String companyName,
                                 @RequestParam(required = false) String companyName,
                                 @RequestParam(required = false) String recordStatus,
                                 @RequestParam(required = false) String recordStatus,
-                                @RequestParam(required = false) String workName) {
+                                @RequestParam(required = false) String workName,
+                                @RequestParam(required = false) String companyID
+                                ) {
 
 
-        PageInfo<PostVo> result = postService.getList(pageIndex, pageSize, null, postName, minCount, maxCount, companyName, recordStatus, workName);
+        PageInfo<PostVo> result = postService.getList(pageIndex, pageSize, null, postName, minCount, maxCount, companyName, recordStatus, workName,companyID);
         return RespGenerstor.success(result);
         return RespGenerstor.success(result);
     }
     }
 
 
@@ -78,7 +80,7 @@ public class PostController {
                                @RequestParam(required = false) String companyName,
                                @RequestParam(required = false) String companyName,
                                @RequestParam(required = false) String recordStatus,
                                @RequestParam(required = false) String recordStatus,
                                @RequestParam(required = false) String workName) throws Exception {
                                @RequestParam(required = false) String workName) throws Exception {
-        PageInfo<PostVo> result = postService.getList(pageIndex, pageSize, null, postName, minCount, maxCount, companyName, recordStatus, workName);
+        PageInfo<PostVo> result = postService.getList(pageIndex, pageSize, null, postName, minCount, maxCount, companyName, recordStatus, workName,null);
 
 
         if (isExport == null || !isExport) {
         if (isExport == null || !isExport) {
             return RespGenerstor.success(result);
             return RespGenerstor.success(result);

+ 1 - 1
src/main/java/com/hz/employmentsite/mapper/cquery/PostCQuery.java

@@ -8,6 +8,6 @@ import java.util.List;
 
 
 public interface PostCQuery {
 public interface PostCQuery {
     List<PostVo> selectPostList(@Param("postID")String postID,@Param("postName") String postName, @Param("minCount")Integer minCount, @Param("maxCount")Integer maxCount,
     List<PostVo> selectPostList(@Param("postID")String postID,@Param("postName") String postName, @Param("minCount")Integer minCount, @Param("maxCount")Integer maxCount,
-                                @Param("companyName")String companyName, @Param("RecordStatus") String RecordStatus, @Param("WorkName")String WorkName);
+                                @Param("companyName")String companyName, @Param("RecordStatus") String RecordStatus, @Param("WorkName")String WorkName,@Param("companyID")String companyID);
     int insert(PcPost post);
     int insert(PcPost post);
 }
 }

+ 49 - 1
src/main/java/com/hz/employmentsite/services/impl/companyService/CompanyServiceImpl.java

@@ -5,16 +5,20 @@ import com.github.pagehelper.PageInfo;
 import com.hz.employmentsite.filter.exception.BaseException;
 import com.hz.employmentsite.filter.exception.BaseException;
 import com.hz.employmentsite.mapper.AreaCodeMapper;
 import com.hz.employmentsite.mapper.AreaCodeMapper;
 import com.hz.employmentsite.mapper.PcCompanyMapper;
 import com.hz.employmentsite.mapper.PcCompanyMapper;
+import com.hz.employmentsite.mapper.PcPostMapper;
 import com.hz.employmentsite.mapper.PcSiteMapper;
 import com.hz.employmentsite.mapper.PcSiteMapper;
 import com.hz.employmentsite.mapper.cquery.CompanyCQuery;
 import com.hz.employmentsite.mapper.cquery.CompanyCQuery;
 import com.hz.employmentsite.model.*;
 import com.hz.employmentsite.model.*;
 import com.hz.employmentsite.services.impl.system.DictionaryServiceImpl;
 import com.hz.employmentsite.services.impl.system.DictionaryServiceImpl;
 import com.hz.employmentsite.services.service.companyService.CompanyService;
 import com.hz.employmentsite.services.service.companyService.CompanyService;
 import com.hz.employmentsite.util.StringUtils;
 import com.hz.employmentsite.util.StringUtils;
+import com.hz.employmentsite.vo.companyService.AppCompanyPostVo;
 import com.hz.employmentsite.vo.companyService.CompanyVo;
 import com.hz.employmentsite.vo.companyService.CompanyVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.Date;
 import java.util.List;
 import java.util.List;
@@ -39,6 +43,9 @@ public class CompanyServiceImpl implements CompanyService {
     @Autowired
     @Autowired
     private PcSiteMapper siteMapper;
     private PcSiteMapper siteMapper;
 
 
+    @Autowired
+    private PcPostMapper pcPostMapper;
+
     @Override
     @Override
     public PageInfo<CompanyVo> getList(Integer pageIndex, Integer pageSize, String primaryKey, String companyName, String companyCode, String recordStatus, String regionCode, String streetCode) {
     public PageInfo<CompanyVo> getList(Integer pageIndex, Integer pageSize, String primaryKey, String companyName, String companyCode, String recordStatus, String regionCode, String streetCode) {
         PageHelper.startPage(pageIndex, pageSize);
         PageHelper.startPage(pageIndex, pageSize);
@@ -60,7 +67,8 @@ public class CompanyServiceImpl implements CompanyService {
         }
         }
         if (dbData == null) {
         if (dbData == null) {
             dbData = new PcCompanyWithBLOBs();
             dbData = new PcCompanyWithBLOBs();
-            dbData.setCompanyID(UUID.randomUUID().toString());
+//            dbData.setCompanyID(UUID.randomUUID().toString());
+            dbData.setCompanyID(data.getCompanyID());
             dbData.setCompanyName(data.getCompanyName());
             dbData.setCompanyName(data.getCompanyName());
             dbData.setCompanyCode(data.getCompanyCode());
             dbData.setCompanyCode(data.getCompanyCode());
             dbData.setSiteID(data.getSiteID());
             dbData.setSiteID(data.getSiteID());
@@ -81,6 +89,8 @@ public class CompanyServiceImpl implements CompanyService {
             dbData.setInsuredCount(data.getInsuredCount());
             dbData.setInsuredCount(data.getInsuredCount());
             dbData.setCreateTime(new Date());
             dbData.setCreateTime(new Date());
             dbData.setCreateUserID(userId);
             dbData.setCreateUserID(userId);
+            dbData.setModifyTime(new Date());
+            dbData.setModifyUserID(userId);
             result = pcCompanyMapper.insert(dbData);
             result = pcCompanyMapper.insert(dbData);
 
 
         } else {
         } else {
@@ -225,5 +235,43 @@ public class CompanyServiceImpl implements CompanyService {
         return siteList;
         return siteList;
     }
     }
 
 
+    @Override
+    public Integer saveAppCompanyPost(AppCompanyPostVo data, String userId) {
+        String pattern = "yyyy-MM-dd"; // 日期字符串的格式
+        SimpleDateFormat dateFormat = new SimpleDateFormat(pattern);
+        var companyID = UUID.randomUUID().toString();
+        if (stringUtils.IsNullOrEmpty(data.getCompanyID())) {
+            data.setCompanyID(companyID);
+        }
+        Integer rows = save(data, userId);
+        final int[] postRows = {0};
+        if (rows > 0) {
+            PcPostExample expPost = new PcPostExample();
+            PcPostExample.Criteria cro = expPost.or();
+            cro.andCompanyIDEqualTo(data.getCompanyID());
+            int delRows=pcPostMapper.deleteByExample(expPost);
+
+            data.getPostData().stream().forEach(x -> {
+                PcPost post = new PcPost();
+                post.setRecordStatus(1);
+                post.setPostID(UUID.randomUUID().toString());
+                post.setCompanyID(data.getCompanyID());
+                post.setPostName(x.get("postName").toString());
+                post.setRecruitCount(Integer.parseInt(x.get("recruitCount").toString()));
+                post.setValidDay(Integer.parseInt(x.get("validDay").toString()));
+                try {
+                    post.setValidTime(dateFormat.parse(x.get("validTime").toString()));
+                } catch (ParseException e) {
+                    e.printStackTrace();
+                }
+                int r=pcPostMapper.insert(post);
+                postRows[0] +=r;
+            });
+            return postRows[0];
+        }
+        return null;
+    }
+
+
 
 
 }
 }

+ 3 - 3
src/main/java/com/hz/employmentsite/services/impl/companyService/PostServiceImpl.java

@@ -38,8 +38,8 @@ public class PostServiceImpl implements PostService {
     private DictionaryService dictionaryService;
     private DictionaryService dictionaryService;
 
 
     @Override
     @Override
-    public PageInfo<PostVo> getList(Integer page, Integer rows, String postID, String postName, Integer minCount, Integer maxCount, String companyName, String recordStatus, String WorkName) {
-        List<PostVo> list = postCQuery.selectPostList(postID, postName, minCount, maxCount, companyName, recordStatus, WorkName);
+    public PageInfo<PostVo> getList(Integer page, Integer rows, String postID, String postName, Integer minCount, Integer maxCount, String companyName, String recordStatus, String WorkName,String companyID) {
+        List<PostVo> list = postCQuery.selectPostList(postID, postName, minCount, maxCount, companyName, recordStatus, WorkName,companyID);
         PageInfo<PostVo> result = new PageInfo(list);
         PageInfo<PostVo> result = new PageInfo(list);
         return result;
         return result;
 
 
@@ -135,7 +135,7 @@ public class PostServiceImpl implements PostService {
         if (stringUtils.IsNullOrEmpty(id)) {
         if (stringUtils.IsNullOrEmpty(id)) {
             return null;
             return null;
         }
         }
-        return postCQuery.selectPostList(id, null, null, null, null, null, null).stream().findFirst().orElse(null);
+        return postCQuery.selectPostList(id, null, null, null, null, null, null,null).stream().findFirst().orElse(null);
     }
     }
 
 
     @Override
     @Override

+ 4 - 1
src/main/java/com/hz/employmentsite/services/service/companyService/CompanyService.java

@@ -2,6 +2,7 @@ package com.hz.employmentsite.services.service.companyService;
 
 
 import com.github.pagehelper.PageInfo;
 import com.github.pagehelper.PageInfo;
 import com.hz.employmentsite.model.PcSite;
 import com.hz.employmentsite.model.PcSite;
+import com.hz.employmentsite.vo.companyService.AppCompanyPostVo;
 import com.hz.employmentsite.vo.companyService.CompanyVo;
 import com.hz.employmentsite.vo.companyService.CompanyVo;
 
 
 import java.util.List;
 import java.util.List;
@@ -10,7 +11,7 @@ public interface CompanyService {
 
 
     PageInfo<CompanyVo> getList(Integer pageIndex, Integer pageSize, String siteName, String companyName, String companyCode, String recordStatus, String regionCode, String streetCode);
     PageInfo<CompanyVo> getList(Integer pageIndex, Integer pageSize, String siteName, String companyName, String companyCode, String recordStatus, String regionCode, String streetCode);
 
 
-    Integer save(CompanyVo dat, String userId);
+    Integer save(CompanyVo data, String userId);
 
 
     Integer delete(String id);
     Integer delete(String id);
 
 
@@ -19,4 +20,6 @@ public interface CompanyService {
     List<CompanyVo> importCompany(List<CompanyVo> dataList, String userID);
     List<CompanyVo> importCompany(List<CompanyVo> dataList, String userID);
 
 
     List<PcSite> getSiteList();
     List<PcSite> getSiteList();
+
+    Integer saveAppCompanyPost(AppCompanyPostVo data, String userId);
 }
 }

+ 1 - 1
src/main/java/com/hz/employmentsite/services/service/companyService/PostService.java

@@ -7,7 +7,7 @@ import com.hz.employmentsite.vo.companyService.PostVo;
 import java.util.List;
 import java.util.List;
 
 
 public interface PostService {
 public interface PostService {
-    PageInfo<PostVo> getList(Integer page, Integer rows, String postID,String postName, Integer minCount, Integer maxCount, String companyName,String RecordStatus,String WorkNmae);
+    PageInfo<PostVo> getList(Integer page, Integer rows, String postID,String postName, Integer minCount, Integer maxCount, String companyName,String RecordStatus,String WorkNmae,String companyID);
     Integer save(PostVo data, String userId);
     Integer save(PostVo data, String userId);
     int delete(String id);
     int delete(String id);
     PostVo getDataById(String id);
     PostVo getDataById(String id);

+ 12 - 0
src/main/java/com/hz/employmentsite/vo/companyService/AppCompanyPostVo.java

@@ -0,0 +1,12 @@
+package com.hz.employmentsite.vo.companyService;
+
+import lombok.Data;
+
+import java.util.HashMap;
+import java.util.List;
+
+@Data
+public class AppCompanyPostVo extends CompanyVo{
+    public List<HashMap<String,Object>> postData;
+}
+

+ 1 - 0
src/main/resources/mapping/cquery/CompanyCQuery.xml

@@ -31,6 +31,7 @@
         <if test="streetCode!='' and regionCode!=null">
         <if test="streetCode!='' and regionCode!=null">
             and streetCode like Concat('%',#{streetCode},'%')
             and streetCode like Concat('%',#{streetCode},'%')
         </if>
         </if>
+        order by postCount desc,company.ModifyTime desc
     </select>
     </select>
 
 
 </mapper>
 </mapper>

+ 6 - 2
src/main/resources/mapping/cquery/PostCQuery.xml

@@ -6,8 +6,8 @@
         left join pc_company company
         left join pc_company company
         on post.CompanyID = company.CompanyID
         on post.CompanyID = company.CompanyID
         left join sys_dictionary_item item
         left join sys_dictionary_item item
-        on item.value=post.CultureRank
-        where item.DictionaryCode='CultureLevel'
+        on item.value=post.CultureRank and item.DictionaryCode='CultureLevel'
+        where 1=1
         <if test="postID != '' and postID != null">
         <if test="postID != '' and postID != null">
             and post.postID = #{postID}
             and post.postID = #{postID}
         </if>
         </if>
@@ -29,5 +29,9 @@
         <if test="WorkName != null and WorkName != ''">
         <if test="WorkName != null and WorkName != ''">
             and post.WorkName like Concat('%', #{WorkName},'%')
             and post.WorkName like Concat('%', #{WorkName},'%')
         </if>
         </if>
+        <if test="companyID != null and companyID != ''">
+            and post.CompanyID = #{companyID}
+        </if>
+
     </select>
     </select>
 </mapper>
 </mapper>

+ 1 - 1
vue/src/views/companyService/post/index.vue

@@ -188,7 +188,7 @@ export default defineComponent({
       {title: '文化程度', dataIndex: 'cultureLevelName', key: 'cultureLevelName', align: "center"},
       {title: '文化程度', dataIndex: 'cultureLevelName', key: 'cultureLevelName', align: "center"},
       {
       {
         title: '薪酬', dataIndex: 'siteCount', key: 'siteCount', align: "center", customRender: (item) => {
         title: '薪酬', dataIndex: 'siteCount', key: 'siteCount', align: "center", customRender: (item) => {
-          const salary = `${item.record.minSalary}~${item.record.maxSalary}`
+          const salary = `${item.record.minSalary??""}~${item.record.maxSalary??""}`
           return salary;
           return salary;
         }
         }
       },
       },