Forráskód Böngészése

1124_招聘数据接口联调

1027077952@qq.com 7 hónapja
szülő
commit
f8dd45f5dc

+ 94 - 19
pages/recruitmentData/dataCenter.vue

@@ -16,14 +16,26 @@
     <!-- Filter Section -->
     <view class="filter-section">
       <view class="filter-buttons">
-        <view class="filter-btn" @click="selectDateRange">
+        <!-- <view class="filter-btn" @click="selectDateRange">
           <text class="filter-text">2025.07.30-08.06</text>
           <u-icon name="arrow-down" color="#016BF6" size="16"></u-icon>
-        </view>
-        <view class="filter-btn" @click="selectPosition">
+        </view> -->
+        <!-- <view class="filter-btn" @click="selectPosition">
           <text class="filter-text">亚马逊运营总监</text>
           <u-icon name="arrow-down" color="#016BF6" size="16"></u-icon>
-        </view>
+        </view> -->
+        <picker @change="changeDate" :value="weekIndex" :range="weekList" :range-key="'name'">
+          <view class="filter-btn" >
+            <text class="filter-text">{{weekList.length?weekList[weekIndex].name:'/'}}</text>
+            <u-icon name="arrow-down" color="#016BF6" size="16"></u-icon>
+          </view>
+		    </picker>
+        <picker @change="changeZw" :value="zwIndex" :range="zwList" :range-key="'name'">
+			    <view class="filter-btn">
+			    	<text class="filter-text">{{zwList.length?zwList[zwIndex].name:'/'}}</text>
+			    	<u-icon name="arrow-down" color="#016BF6" size="16"></u-icon>
+			    </view>
+		    </picker>
       </view>
     </view>
 
@@ -49,14 +61,14 @@
              <view class="data-item">
                <text class="data-label">我看过</text>
                <view class="data-value-wrapper">
-                 <text class="data-value">1120</text>
+                 <text class="data-value">{{dataStatics.iSaw}}</text>
                  <text class="data-unit">人</text>
                </view>
              </view>
              <view class="data-item">
                <text class="data-label">看过我</text>
                <view class="data-value-wrapper">
-                 <text class="data-value">2120</text>
+                 <text class="data-value">{{dataStatics.sawMe}}</text>
                  <text class="data-unit">人</text>
                </view>
              </view>
@@ -78,14 +90,14 @@
              <view class="data-item">
                <text class="data-label">我沟通</text>
                <view class="data-value-wrapper">
-                 <text class="data-value">1120</text>
+                 <text class="data-value">{{ dataStatics.iCommunicated }}</text>
                  <text class="data-unit">人</text>
                </view>
              </view>
              <view class="data-item">
                <text class="data-label">求职者</text>
                <view class="data-value-wrapper">
-                 <text class="data-value">2120</text>
+                 <text class="data-value">{{ dataStatics.candidateCommunicated }}</text>
                  <text class="data-unit">人</text>
                </view>
              </view>
@@ -107,31 +119,31 @@
              <view class="data-item">
                <text class="data-label">合计</text>
                <view class="data-value-wrapper">
-                 <text class="data-value">1120</text>
+                 <text class="data-value">{{dataStatics.receivedResumes+dataStatics.exchangedContact}}</text>
                  <text class="data-unit">人</text>
                </view>
              </view>
              <view class="data-item">
                <text class="data-label">获取简历</text>
                <view class="data-value-wrapper">
-                 <text class="data-value">2120</text>
+                 <text class="data-value">{{dataStatics.receivedResumes}}</text>
                  <text class="data-unit">人</text>
                </view>
              </view>
              <view class="data-item">
-               <text class="data-label">交换电话</text>
+               <text class="data-label">交换电话/微信</text>
                <view class="data-value-wrapper">
-                 <text class="data-value">2120</text>
+                 <text class="data-value">{{dataStatics.exchangedContact}}</text>
                  <text class="data-unit">人</text>
                </view>
              </view>
-             <view class="data-item">
+             <!-- <view class="data-item">
                <text class="data-label">交换微信</text>
                <view class="data-value-wrapper">
                  <text class="data-value">2120</text>
                  <text class="data-unit">人</text>
                </view>
-             </view>
+             </view> -->
            </view>
          </view>
        </view>
@@ -150,14 +162,14 @@
              <view class="data-item">
                <text class="data-label">邀约面试</text>
                <view class="data-value-wrapper">
-                 <text class="data-value">1120</text>
+                 <text class="data-value">{{dataStatics.acceptedInterview}}</text>
                  <text class="data-unit">人</text>
                </view>
              </view>
              <view class="data-item">
                <text class="data-label">接受面试</text>
                <view class="data-value-wrapper">
-                 <text class="data-value">2120</text>
+                 <text class="data-value">{{dataStatics.acceptedInterview}}</text>
                  <text class="data-unit">人</text>
                </view>
              </view>
@@ -170,21 +182,84 @@
 
 <script>
 import navBar from "@/components/nav-bar/index.vue";
-
+import { getPrevious8Weeks } from './dateFormate'
 export default {
   components: {
     navBar
   },
   data() {
     return {
-      statusBarHeight: 0
+      statusBarHeight: 0,
+      zwList:[],
+      zwIndex:0,
+      weekList:[],
+      weekIndex:0,
+      dataStatics:{}
     }
   },
   onLoad() {
     const systemInfo = uni.getSystemInfoSync()
-    this.statusBarHeight = systemInfo.statusBarHeight || 0
+    this.statusBarHeight = systemInfo.statusBarHeight || 0;
+    this.getZwList()
+    this.weekList=[]
+    getPrevious8Weeks(new Date()).forEach(it=>{
+      // this.weekList.push([
+      //   it[0],it[1],it.join('~')
+      // ]),
+      this.weekList.push({
+        start:it[0],
+        end:it[1],
+        name:it.join('~')
+      })
+    })
   },
   methods: {
+    changeDate(e){
+      this.weekIndex=e.detail.value;
+      this.getDataStatics()
+    },
+    getZwList(){
+	    this.$Request.getT("/app/postPush/getMyPostPush").then(res=>{
+		    res.data.records.forEach(item=>{
+		    	this.zwList.push({
+		    		name:item.ruleClassifyName,
+		    		id:item.postPushId
+		    	})
+		    })
+        this.getDataStatics()
+	    })
+	  },
+    changeZw(e){
+      this.zwIndex=e.detail.value;
+      this.getDataStatics()
+    },
+    getDataStatics(){
+		  let data = {
+		  	postPushId:this.zwList[this.zwIndex].id,
+		  	todayStart:this.formatDateRange(new Date(),new Date())[0],
+		  	todayEnd:this.formatDateRange(new Date(),new Date())[1],
+		  }
+		  this.$Request.getT("/app/user/userYesterdayData",data).then(res=>{
+        this.dataStatics=res.data;
+		  })
+	  },
+    formatDateRange(startDate, endDate) {
+	    // 格式化日期为 YYYY-MM-DD 格式
+	    const formatDate = (date) => {
+	        const year = date.getFullYear();
+	        const month = String(date.getMonth() + 1).padStart(2, '0');
+	        const day = String(date.getDate()).padStart(2, '0');
+	        return `${year}-${month}-${day}`;
+	    };
+	    
+	    // 创建开始日期的 00:00:00
+	    const startDateTime = `${formatDate(startDate)} 00:00:00`;
+	    
+	    // 创建结束日期的 23:59:59
+	    const endDateTime = `${formatDate(endDate)} 23:59:59`;
+	    
+	    return [startDateTime, endDateTime];
+	  },
     goBack() {
       uni.navigateBack()
     },

+ 40 - 0
pages/recruitmentData/dateFormate.js

@@ -0,0 +1,40 @@
+export function  getPrevious8Weeks(currentDate) {
+    // 确保传入的是Date对象
+    const date = new Date(currentDate);
+    
+    // 获取当前日期是星期几(0-6,0代表周日)
+    const currentDay = date.getDay();
+    
+    // 计算当前周的周一(将周日作为一周的最后一天)
+    const mondayOffset = currentDay === 0 ? -6 : 1 - currentDay;
+    const currentMonday = new Date(date);
+    currentMonday.setDate(date.getDate() + mondayOffset);
+    
+    const result = [];
+    
+    // 生成前8个自然周的日期范围(从上一周开始,不包含当前周)
+    for (let i = 1; i <= 8; i++) {
+      const weekStart = new Date(currentMonday);
+      weekStart.setDate(currentMonday.getDate() - i * 7);
+      
+      const weekEnd = new Date(weekStart);
+      weekEnd.setDate(weekStart.getDate() + 6);
+      
+      // 格式化日期为 YYYY-MM-DD
+      const startStr = formatDate(weekStart);
+      const endStr = formatDate(weekEnd);
+      
+      result.push([startStr, endStr]);
+    }
+    
+    return result;
+  }
+  
+  // 辅助函数:格式化日期为 YYYY-MM-DD
+  function formatDate(date) {
+    const year = date.getFullYear();
+    const month = String(date.getMonth() + 1).padStart(2, '0');
+    const day = String(date.getDate()).padStart(2, '0');
+    return `${year}-${month}-${day}`;
+  }
+  

+ 36 - 23
pages/recruitmentData/index.vue

@@ -111,46 +111,46 @@ export default {
     return {
       statusBarHeight: 0,
       todayData: [
-        { title: '我看过', number: 1120, change: -9 },
-        { title: '看过我', number: 1120, change: -9 },
-        { title: '我沟通', number: 1120, change: -9 },
-        { title: '求职者沟通', number: 1120, change: -9 },
-        { title: '收获简历', number: 1120, change: -9 },
-        { title: '交换电话微信', number: 1120, change: -9 },
-        { title: '接受面试', number: 1120, change: -9 }
+        { title: '我看过', number: 0, change: 0 },
+        { title: '看过我', number: 0, change: -9 },
+        { title: '我沟通', number: 0, change: -9 },
+        { title: '求职者沟通', number: 0, change:0 },
+        { title: '收获简历', number: 0, change: 0 },
+        { title: '交换电话微信', number: 0, change: 0 },
+        { title: '接受面试', number: 0, change: 0 }
       ],
       benefitsData: [
         {
           action: '查看',
           type: '招聘职位',
-          used: 4,
+          used: 0,
           total: 10,
           isUrgent: false
         },
         {
           action: '沟通',
           type: '招聘职位',
-          used: 4,
+          used: 0,
           total: 10,
           isUrgent: false
         },
         {
           action: '查看',
           type: '急聘职位',
-          used: 4,
+          used: 0,
           total: 10,
           isUrgent: true
         },
         {
           action: '沟通',
           type: '急聘职位',
-          used: 4,
+          used: 0,
           total: 10,
           isUrgent: true
         }
       ],
-	  zwList:[],
-	  zwIndex:0,
+	    zwList:[],
+	    zwIndex:0,
 	  
     }
   },
@@ -164,25 +164,38 @@ export default {
   methods: {
 	getZwList(){
 	  this.$Request.getT("/app/postPush/getMyPostPush").then(res=>{
-	  	console.log(res);
-		res.data.records.forEach(item=>{
-			this.zwList.push({
-				name:item.ruleClassifyName,
-				id:item.postPushId
-			})
+		  res.data.records.forEach(item=>{
+		  	this.zwList.push({
+		  		name:item.ruleClassifyName,
+		  		id:item.postPushId
+		  	})
+		  })
 			this.getDataStatics()
-		})
 	  })
 	},
 	getDataStatics(){
 		let data = {
-			postPushId:this.zwList[this.zwIndex].postPushId,
+			postPushId:this.zwList[this.zwIndex].id,
 			todayStart:this.formatDateRange(new Date(),new Date())[0],
 			todayEnd:this.formatDateRange(new Date(),new Date())[1],
 		}
 		this.$Request.getT("/app/user/userYesterdayData",data).then(res=>{
-			console.log(res);
-		})
+      this.todayData[0].number=res.data.iSaw;
+      this.todayData[0].change=res.data.tyIsaw;
+      this.todayData[1].number=res.data.sawMe;
+      this.todayData[1].change=res.data.tySawMe;
+      this.todayData[2].number=res.data.iCommunicated;
+      this.todayData[2].change=res.data.tyICommunicated;
+      this.todayData[3].number=res.data.tyCandidateCommunicated;
+      this.todayData[3].change=res.data.tyCandidateCommunicated;
+      this.todayData[4].number=res.data.receivedResumes;
+      this.todayData[4].change=res.data.tyReceivedResumes;
+      this.todayData[5].number=res.data.exchangedContact;
+      this.todayData[5].change=res.data.tyExchangedContact;
+      this.todayData[6].number=res.data.acceptedInterview;
+      this.todayData[6].change=res.data.tyAcceptedInterview;
+
+    })
 	},
 	formatDateRange(startDate, endDate) {
 	    // 格式化日期为 YYYY-MM-DD 格式