From a33b64b8a7ad977cd7a78733426f1a7a4a3df4b8 Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期一, 17 十月 2022 10:12:48 +0800
Subject: [PATCH] 1.产能规划日历部分优化

---
 src/components/DatePicker/index.vue |   60 ++++++++++++++++++++++++++++++++----------------------------
 1 files changed, 32 insertions(+), 28 deletions(-)

diff --git a/src/components/DatePicker/index.vue b/src/components/DatePicker/index.vue
index 53eb8eb..ae8f1e7 100644
--- a/src/components/DatePicker/index.vue
+++ b/src/components/DatePicker/index.vue
@@ -42,7 +42,9 @@
 
                 :disabled="!isDblDate(visibleDays[(i-1)*7+(j-1)])"
               >
+
                 <div class="pop_style">{{ callbackTxt(visibleDays[(i - 1) * 7 + (j - 1)]) }}</div>
+                <!--                <div class="pop_style">123</div>-->
                 <span
                   slot="reference"
                   :class="[{select:isSelect(visibleDays[(i-1)*7+(j-1)])},
@@ -127,6 +129,7 @@
   CapacityPlanningOnclickSelect,
   CapacityPlanningSetupSearch
 } from '@/api/scgl'
+
 var time = null
 export default {
   directives: {
@@ -168,6 +171,7 @@
       type: Function,
       default: null
     }
+
   },
 
   data() {
@@ -198,6 +202,7 @@
         page: 1
       },
       projectDef: []
+
     }
   },
   computed: {
@@ -218,7 +223,8 @@
       return `${year}-${month + 1}-${day}`
     }
   },
-  mounted() {},
+  mounted() {
+  },
   methods: {
     getDblTime() {
       const { year, month, day } = funsdates.getYearMonthDay(this.dblDate)
@@ -240,11 +246,10 @@
         }
       }
       for (const i in this.projectDef) {
-        if (this.projectDef[i].CapSetupCode === code) {
-          name = this.projectDef[i].CapSetupName
+        if (this.projectDef[i].code === code) {
+          name = this.projectDef[i].name
         }
       }
-
       return name
     },
     getHeight() {
@@ -256,7 +261,7 @@
       }
 
       const e = event || window.event
-      // console.log(e.clientY, 7)
+
       const nowHeigth = e.clientY
       if (nowHeigth >= 500) {
         this.topStyle = true
@@ -297,9 +302,9 @@
     focus() {
       this.isVisible = true
 
-      this.CapacityPlanningCalendar()
+      this.getCapacityPlanningCalendar()
       this.getHeight()
-      this.CapacityPlanningSetupSearch()
+      this.getCapacityPlanningSetupSearch()
       this.CapacityPlanningSearch()
     },
     blur() {
@@ -327,7 +332,9 @@
       clearTimeout(time) // 棣栧厛娓呴櫎璁℃椂鍣�
       time = setTimeout(() => {
         this.time = funsdates.getYearMonthDay(date)
-        // const timeDate = ''
+        if (typeof this.value === 'string') {
+          this.value = this.value.split(',')
+        }
         this.isDbl = false
         // 鍙互鐐瑰嚮鐨勬棩鏈�
         if (!this.isPastDue(date)) {
@@ -357,8 +364,11 @@
         this.dblDate = date
         this.isDbl = true
         this.changeTime = this.handleDatetime(date)
-
-        this.CapacityPlanningOnclickSelect({ CaptPlanWorkShiftCode: this.rowData.CaptPlanWorkShiftCode, captplanid: this.rowData.CaptPlanId, datetime: this.handleDatetime(date) })
+        this.getCapacityPlanningOnclickSelect({
+          CaptPlanWorkShiftCode: this.defArr.find(item => item.name === this.changeTime).key,
+          captplanid: this.rowData.CaptPlanId,
+          datetime: this.handleDatetime(date)
+        })
         this.getDblTime()
       }
     },
@@ -424,7 +434,7 @@
     //         }
     // },
     // 鍙屽嚮璇锋眰鏁版嵁
-    CapacityPlanningOnclickSelect(data) {
+    getCapacityPlanningOnclickSelect(data) {
       CapacityPlanningOnclickSelect(data).then((res) => {
         this.projectList = res.data
 
@@ -460,30 +470,24 @@
         }
       })
     },
-    CapacityPlanningCalendar() {
-      // const temp = JSON.parse(this.rowData)
+    getCapacityPlanningCalendar() {
       CapacityPlanningCalendar({ captplanid: this.rowData.CaptPlanId }).then((res) => {
-        for (const i in res.List) {
-          if (res.List[i].key === '') {
-            res.List[i].key = this.rowData.CaptPlanWorkShiftCode
-          }
-        }
-        this.defArr = res.List
+        this.defArr = res.data
       })
     },
     closeCapacityPlanningCalendar() {
       CapacityPlanningCalendar({ captplanid: this.rowData.CaptPlanId }).then((res) => {
         const nameList = []
-        for (const i in res.List) {
-          nameList.push(res.List[i].name)
-          if (res.List[i].key === '') {
-            res.List[i].key = this.rowData.CaptPlanWorkShiftCode
+        for (const i in res.data) {
+          nameList.push(res.data[i].name)
+          if (res.data[i].key === '') {
+            res.data[i].key = this.rowData.CaptPlanWorkShiftCode
           }
         }
         for (const i in this.defArr) {
-          for (const j in res.List) {
-            if (this.defArr[i].name === this.changeTime && res.List[j].name === this.changeTime) {
-              this.defArr[i].key = res.List[j].key
+          for (const j in res.data) {
+            if (this.defArr[i].name === this.changeTime && res.data[j].name === this.changeTime) {
+              this.defArr[i].key = res.data[j].key
             } else if (this.defArr[i].name === this.changeTime && nameList.indexOf(this.changeTime) === -1) {
               this.defArr[i].key = this.rowData.CaptPlanWorkShiftCode
             }
@@ -497,9 +501,9 @@
         this.closeCapacityPlanningCalendar()
       }, 300)
     },
-    CapacityPlanningSetupSearch() {
+    getCapacityPlanningSetupSearch() {
       CapacityPlanningSetupSearch(this.form).then((res) => {
-        this.projectDef = res.rows
+        this.projectDef = res.data
       })
     }
 

--
Gitblit v1.9.3