From a93255e0a0334b51ecbaf3d8f496ad0fae1ed747 Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期三, 07 六月 2023 10:38:00 +0800
Subject: [PATCH] 1.生产入库有源单提交测试OK

---
 src/components/DatePicker/index.vue |   67 ++++++++++++++++++++++++++++-----
 1 files changed, 56 insertions(+), 11 deletions(-)

diff --git a/src/components/DatePicker/index.vue b/src/components/DatePicker/index.vue
index ae8f1e7..ef96a55 100644
--- a/src/components/DatePicker/index.vue
+++ b/src/components/DatePicker/index.vue
@@ -49,6 +49,7 @@
                   slot="reference"
                   :class="[{select:isSelect(visibleDays[(i-1)*7+(j-1)])},
                            {dblDateStyle:isDblDate(visibleDays[(i-1)*7+(j-1)])}]"
+                  :style="{background: isSelect(visibleDays[(i-1)*7+(j-1)])?$store.state.settings.theme:''}"
                 >{{ visibleDays[(i - 1) * 7 + (j - 1)].getDate() }}</span>
               </el-popover>
 
@@ -128,7 +129,8 @@
   CapacityPlanningGivePlanSubmit,
   CapacityPlanningOnclickSelect,
   CapacityPlanningSetupSearch
-} from '@/api/scgl'
+} from '@/api/produceManager'
+import { handleDatetime } from '@/utils/global'
 
 var time = null
 export default {
@@ -361,15 +363,57 @@
     dblChooseDate(date) {
       if (!this.isPastDue(date)) {
         clearTimeout(time)
-        this.dblDate = date
-        this.isDbl = true
-        this.changeTime = 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()
+        time = setTimeout(() => {
+          this.time = funsdates.getYearMonthDay(date)
+          if (typeof this.value === 'string') {
+            this.value = this.value.split(',')
+          }
+          // 鍙互鐐瑰嚮鐨勬棩鏈�
+          if (!this.isPastDue(date)) {
+            if ((this.value.indexOf(this.handleDatetime(date)) < 0 && this.value !== '') || this.value === '') { // 鏁扮粍娣诲姞
+              this.value.push(this.handleDatetime(date)) // 鏂板鍒癷nput閲�
+              const data = {
+                name: this.handleDatetime(date),
+                key: this.rowData.CaptPlanWorkShiftCode
+              }
+              this.defArr.push(data) // 鏂板鍒� 榛樿鏁扮粍閲�
+              this.dblDate = date
+              this.isDbl = true // 鍙充晶灞曞紑
+
+              this.changeTime = this.handleDatetime(date)
+
+              const DATA = {
+                CaptPlanWorkShiftCode: this.defArr.find(item => item.name === this.changeTime).key,
+                captplanid: this.rowData.CaptPlanId,
+                datetime: this.handleDatetime(date)
+              }
+              this.getCapacityPlanningOnclickSelect(DATA)
+              this.getDblTime()
+            } else if (this.value.indexOf(this.handleDatetime(date)) >= 0) {
+              this.dblDate = date
+              this.isDbl = true // 鍙充晶灞曞紑
+
+              this.changeTime = this.handleDatetime(date)
+
+              const DATA = {
+                CaptPlanWorkShiftCode: this.defArr.find(item => item.name === this.changeTime).key,
+                captplanid: this.rowData.CaptPlanId,
+                datetime: this.handleDatetime(date)
+              }
+              this.getCapacityPlanningOnclickSelect(DATA)
+              this.getDblTime()
+
+              //   const indexV = this.value.indexOf(this.handleDatetime(date))
+              //   this.value.splice(indexV, 1)
+              //   for (const i in this.defArr) {
+              //     if (this.defArr[i].name === this.handleDatetime(date)) {
+              //       this.defArr.splice(i, 1)
+              //     }
+              //   }
+            }
+          }
+          this.$emit('input', this.value)
+        }, 300)
       }
     },
     isDblDate(date) {
@@ -472,7 +516,8 @@
     },
     getCapacityPlanningCalendar() {
       CapacityPlanningCalendar({ captplanid: this.rowData.CaptPlanId }).then((res) => {
-        this.defArr = res.data
+        const currentDate = handleDatetime(new Date())
+        this.defArr = res.data.filter(i => i.name >= currentDate)
       })
     },
     closeCapacityPlanningCalendar() {

--
Gitblit v1.9.3