From d3129c5d9af88192c43e7d2a529adf68f7433d9e Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期一, 17 十月 2022 09:11:34 +0800
Subject: [PATCH] 1.产能规划日历部分实现

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

diff --git a/src/components/DatePicker/index.vue b/src/components/DatePicker/index.vue
index 475fa71..b9a67bb 100644
--- a/src/components/DatePicker/index.vue
+++ b/src/components/DatePicker/index.vue
@@ -127,6 +127,7 @@
   CapacityPlanningOnclickSelect,
   CapacityPlanningSetupSearch
 } from '@/api/scgl'
+
 var time = null
 export default {
   directives: {
@@ -168,6 +169,7 @@
       type: Function,
       default: null
     }
+
   },
 
   data() {
@@ -198,6 +200,7 @@
         page: 1
       },
       projectDef: []
+
     }
   },
   computed: {
@@ -218,7 +221,8 @@
       return `${year}-${month + 1}-${day}`
     }
   },
-  mounted() {},
+  mounted() {
+  },
   methods: {
     getDblTime() {
       const { year, month, day } = funsdates.getYearMonthDay(this.dblDate)
@@ -297,7 +301,7 @@
     focus() {
       this.isVisible = true
 
-      this.CapacityPlanningCalendar()
+      this.getCapacityPlanningCalendar()
       this.getHeight()
       this.CapacityPlanningSetupSearch()
       this.CapacityPlanningSearch()
@@ -332,6 +336,9 @@
         // 鍙互鐐瑰嚮鐨勬棩鏈�
         if (!this.isPastDue(date)) {
           if ((this.value.indexOf(this.handleDatetime(date)) < 0 && this.value !== '') || this.value === '') { // 鏁扮粍娣诲姞
+            if (typeof this.value === 'string') {
+              this.value = this.value.split(',')
+            }
             this.value.push(this.handleDatetime(date)) // 鏂板鍒癷nput閲�
             const data = {
               name: this.handleDatetime(date),
@@ -340,6 +347,9 @@
             this.defArr.push(data) // 鏂板鍒� 榛樿鏁扮粍閲�
           } else if (this.value.indexOf(this.handleDatetime(date)) >= 0) { // 鏁扮粍鍑忓幓
             const indexV = this.value.indexOf(this.handleDatetime(date))
+            if (typeof this.value === 'string') {
+              this.value = this.value.split(',')
+            }
             this.value.splice(indexV, 1)
             for (const i in this.defArr) {
               if (this.defArr[i].name === this.handleDatetime(date)) {
@@ -358,7 +368,11 @@
         this.isDbl = true
         this.changeTime = this.handleDatetime(date)
 
-        this.CapacityPlanningOnclickSelect({ CaptPlanWorkShiftCode: this.rowData.CaptPlanWorkShiftCode, captplanid: this.rowData.CaptPlanId, datetime: this.handleDatetime(date) })
+        this.CapacityPlanningOnclickSelect({
+          CaptPlanWorkShiftCode: this.rowData.CaptPlanWorkShiftCode,
+          captplanid: this.rowData.CaptPlanId,
+          datetime: this.handleDatetime(date)
+        })
         this.getDblTime()
       }
     },
@@ -443,19 +457,15 @@
     // 宸ヤ綔鏃ュ巻鎻愪氦
     CapacityPlanningGivePlanSubmit() {
       const formData = new FormData()
-      formData.append('CaptPlanId', this.rowData.CaptPlanId)// 浜ц兘璧勬簮id
-      formData.append('WkshopCode', this.rowData.CaptPlanWorkShopid)// 杞﹂棿缂栫爜
-      formData.append('CapUnitCode', this.rowData.CaptPlanDeviceTypeid)// 鐢熶骇鍗曞厓锛堜骇绾跨紪鐮侊級
-      formData.append('CaptSetupCode', '')
-      formData.append('CaptPlanType', this.rowData.CaptPlanType)// 浜ц兘绫诲瀷
-      console.log(this.defArr, 555)
-      formData.append('WorkList', JSON.stringify(this.defArr))
-      console.log(formData, 666)
-
-      for (const [a, b] of formData.entries()) {
-        console.log(a, ':', b)
-      }
-
+      formData.append('wkshopcode', this.rowData.CaptPlanWorkShopid)// 杞﹂棿缂栫爜
+      formData.append('capunitcode', this.rowData.CaptPlanDeviceTypeid)// 鐢熶骇鍗曞厓缂栫爜锛堜骇绾跨紪鐮侊級
+      formData.append('captplanid', this.rowData.CaptPlanId)// 浜ц兘璧勬簮id
+      formData.append('capsetupcode', this.rowData.CaptPlanWorkShiftCode) // 榛樿鏂规缂栫爜
+      formData.append('captplantype', this.rowData.CaptPlanType)// 璧勬簮绫诲瀷
+      formData.append('worklist', JSON.stringify(this.defArr))// 宸ヤ綔鏃ュ巻鏁版嵁闆�
+      // for (const [a, b] of formData.entries()) {
+      //   console.log(a, ':', b)
+      // }
       CapacityPlanningGivePlanSubmit(formData).then(res => {
         if (res.code === '200') {
           this.$message.success('淇濆瓨鎴愬姛锛�')
@@ -464,15 +474,9 @@
         }
       })
     },
-    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() {

--
Gitblit v1.9.3