From b11d41acf7ba2449cac04982af7e4e58bc3080f1 Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期六, 15 十月 2022 14:03:16 +0800
Subject: [PATCH] 1.产能规划功能开发基本实现2.维修记录列表静态页面开发完成

---
 src/components/DatePicker/index.vue |  198 ++++++++++++++++++++++++++-----------------------
 1 files changed, 104 insertions(+), 94 deletions(-)

diff --git a/src/components/DatePicker/index.vue b/src/components/DatePicker/index.vue
index 71d22b0..475fa71 100644
--- a/src/components/DatePicker/index.vue
+++ b/src/components/DatePicker/index.vue
@@ -1,5 +1,5 @@
 <template>
-  <div v-click-outside onselectstart="return false" style="-moz-user-select : none">
+  <div v-click-outside onselectstart="return false" style="-moz-user-select : none;">
     <input type="text" :value="value" :rowData="rowData" class="input__inner">
     <div v-if="isVisible" :class="[{pannel:true},{top_yes:topStyle}]">
       <div class="pannel-nav">
@@ -64,6 +64,7 @@
         }}骞磠{ dblTime.month + 1 }}鏈�</span><span class="samllText">鏄熸湡{{ getweekday(handleDatetime(dblDate)) }}</span>
         </div>
         <div class="pannelTo_nav">
+
           <el-select v-model="schemeDate" size="small" style="width:240px;" @change="changeScheme">
             <el-option v-for="item in projectList" :key="item.CapCode" :value="item.CapCode" :label="item.CapName" />
           </el-select>
@@ -120,7 +121,12 @@
 </template>
 <script>
 import * as funsdates from '@/utils/funsdate'
-// import capacityPlanning from '@/api/capacityPlanning'
+import {
+  CapacityPlanningCalendar,
+  CapacityPlanningGivePlanSubmit,
+  CapacityPlanningOnclickSelect,
+  CapacityPlanningSetupSearch
+} from '@/api/scgl'
 var time = null
 export default {
   directives: {
@@ -147,13 +153,15 @@
   },
   props: {
     value: {
-      // type:Date,
-      // default:()=> new Date
-      type: String,
+      type: Array,
       default: null
     },
+    defArr: {
+      type: Array,
+      default: Array
+    },
     rowData: {
-      type: String,
+      type: Object,
       default: null
     },
     CapacityPlanningSearch: {
@@ -161,6 +169,7 @@
       default: null
     }
   },
+
   data() {
     const { year, month } = funsdates.getYearMonthDay(new Date())
     return {
@@ -181,11 +190,11 @@
       weekDays: ['鏃�', '涓�', '浜�', '涓�', '鍥�', '浜�', '鍏�'],
       changeTime: '',
       changeTimeArr: [],
-      defArr: [],
+      // defArr: [],
       dm_top: '',
       topStyle: false,
       form: {
-        rows: 100,
+        rows: 1000,
         page: 1
       },
       projectDef: []
@@ -209,9 +218,7 @@
       return `${year}-${month + 1}-${day}`
     }
   },
-  mounted() {
-
-  },
+  mounted() {},
   methods: {
     getDblTime() {
       const { year, month, day } = funsdates.getYearMonthDay(this.dblDate)
@@ -227,13 +234,13 @@
       let name = ''
       if (this.isDblDate(date)) {
         for (const i in this.defArr) {
-          if (this.defArr[i].name == this.handleDatetime(date)) {
+          if (this.defArr[i].name === this.handleDatetime(date)) {
             code = this.defArr[i].key
           }
         }
       }
       for (const i in this.projectDef) {
-        if (this.projectDef[i].CapSetupCode == code) {
+        if (this.projectDef[i].CapSetupCode === code) {
           name = this.projectDef[i].CapSetupName
         }
       }
@@ -249,6 +256,7 @@
       }
 
       const e = event || window.event
+      // console.log(e.clientY, 7)
       const nowHeigth = e.clientY
       if (nowHeigth >= 500) {
         this.topStyle = true
@@ -273,13 +281,13 @@
     changeScheme() {
       let toList = []
       for (const i in this.projectList) {
-        if (this.schemeDate == this.projectList[i].CapCode) {
+        if (this.schemeDate === this.projectList[i].CapCode) {
           toList = this.projectList[i].list
         }
       }
 
       for (const i in this.defArr) {
-        if (this.defArr[i].name == this.changeTime) {
+        if (this.defArr[i].name === this.changeTime) {
           this.defArr[i].key = this.schemeDate
         }
       }
@@ -288,13 +296,16 @@
     },
     focus() {
       this.isVisible = true
+
       this.CapacityPlanningCalendar()
       this.getHeight()
       this.CapacityPlanningSetupSearch()
       this.CapacityPlanningSearch()
     },
     blur() {
-      this.isVisible = false
+      this.isDbl = false // 鍙充晶闈㈡澘鍏抽棴
+      this.isVisible = false// 涓婚潰鏉垮叧闂�
+      this.$emit('over', true)// 缁欑埗缁勪欢鍙戝嚭璇锋眰锛屽憡璇変粬宸茬粡瀹屾垚鎿嶄綔锛屽彲璋冪敤鑾峰彇鍒楄〃鎺ュ彛
     },
     isCurrentMonth(date) {
       const { year, month } = funsdates.getYearMonthDay(new Date(this.time.year,
@@ -310,33 +321,28 @@
     // 杩囨湡鏃堕棿
     isPastDue(date) {
       const newDate = this.handleDatetime(new Date())
-      if (new Date(newDate) > date && this.handleDatetime(date) != newDate) {
-        return true
-      } else {
-        return false
-      }
+      return new Date(newDate) > date && this.handleDatetime(date) !== newDate
     },
     chooseDate(date) {
       clearTimeout(time) // 棣栧厛娓呴櫎璁℃椂鍣�
       time = setTimeout(() => {
         this.time = funsdates.getYearMonthDay(date)
-        const timeDate = ''
+        // const timeDate = ''
         this.isDbl = false
         // 鍙互鐐瑰嚮鐨勬棩鏈�
         if (!this.isPastDue(date)) {
-          if ((this.value.indexOf(this.handleDatetime(date)) < 0 && this.value != '') || this.value == '') { // 鏁扮粍娣诲姞
+          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) // 鏂板鍒� 榛樿鏁扮粍閲�
           } else if (this.value.indexOf(this.handleDatetime(date)) >= 0) { // 鏁扮粍鍑忓幓
             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)) {
+              if (this.defArr[i].name === this.handleDatetime(date)) {
                 this.defArr.splice(i, 1)
               }
             }
@@ -351,14 +357,15 @@
         this.dblDate = date
         this.isDbl = true
         this.changeTime = this.handleDatetime(date)
-        this.CapacityPlanningOnclickSelect({ CaptPlanId: this.rowData.CaptPlanId, DateTime: this.handleDatetime(date) })
+
+        this.CapacityPlanningOnclickSelect({ CaptPlanWorkShiftCode: this.rowData.CaptPlanWorkShiftCode, captplanid: this.rowData.CaptPlanId, datetime: this.handleDatetime(date) })
         this.getDblTime()
       }
     },
     isDblDate(date) {
       for (const i in this.defArr) {
-        if (this.defArr[i].key != '') {
-          if (this.defArr[i].name == this.handleDatetime(date) && this.defArr[i].key != this.rowData.CaptPlanWorkShiftCode) {
+        if (this.defArr[i].key !== '') {
+          if (this.defArr[i].name === this.handleDatetime(date) && this.defArr[i].key !== this.rowData.CaptPlanWorkShiftCode) {
             return true
           }
         }
@@ -418,75 +425,75 @@
     // },
     // 鍙屽嚮璇锋眰鏁版嵁
     CapacityPlanningOnclickSelect(data) {
-      // capacityPlanning.CapacityPlanningOnclickSelect(data).then((res) =>{
-      //     this.projectList = res.List
-      //     for(let i in this.defArr){
-      //         if(this.defArr[i].name == data.DateTime){
-      //             this.schemeDate = this.defArr[i].key
-      //         }
-      //     }
-      //     this.changeScheme()
-      // })
+      CapacityPlanningOnclickSelect(data).then((res) => {
+        this.projectList = res.data
+
+        // for (const i in this.defArr) {
+        //   console.log(this.defArr[i].name === data.DateTime, 6)
+        //   if (this.defArr[i].name === data.DateTime) {
+        //     this.schemeDate = this.defArr[i].key
+        //   }
+        // }
+
+        this.schemeDate = data.CaptPlanWorkShiftCode
+
+        this.changeScheme()
+      })
     },
+    // 宸ヤ綔鏃ュ巻鎻愪氦
     CapacityPlanningGivePlanSubmit() {
-      const data = {
-        CaptPlanId: this.rowData.CaptPlanId,
-        WkshopCode: this.rowData.CaptPlanWorkShopid,
-        CapUnitCode: this.rowData.CaptPlanDeviceTypeid,
-        CapSetupCode: this.rowData.CaptPlanWorkShiftCode,
-        CaptPlanType: this.rowData.CaptPlanType,
-        WorkList: JSON.stringify(this.defArr)
+      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)
       }
-      // capacityPlanning.CapacityPlanningGivePlanSubmit(data).then((res) =>{
-      //      if (res.statusCode == 300) {
-      //         this.$message({
-      //        showClose:true,
-      //             message: res.message,
-      //             type: "error"
-      //         });
-      //         } else {
-      //         this.$message({
-      //        showClose:true,
-      //             message: res.message,
-      //             type: "success"
-      //         });
-      //         this.blur()
-      //         this.CapacityPlanningSearch()
-      //         }
-      // })
+
+      CapacityPlanningGivePlanSubmit(formData).then(res => {
+        if (res.code === '200') {
+          this.$message.success('淇濆瓨鎴愬姛锛�')
+          this.blur()
+          this.CapacityPlanningSearch()
+        }
+      })
     },
     CapacityPlanningCalendar() {
-      // capacityPlanning.CapacityPlanningCalendar({CaptPlanId:this.rowData.CaptPlanId}).then((res) =>{
-      //
-      //     for(let i in res.List){
-      //
-      //         if(res.List[i].key == ''){
-      //             res.List[i].key = this.rowData.CaptPlanWorkShiftCode
-      //         }
-      //     }
-      //     this.defArr = res.List
-      // })
+      // const temp = JSON.parse(this.rowData)
+      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
+      })
     },
     closeCapacityPlanningCalendar() {
-      // capacityPlanning.CapacityPlanningCalendar({CaptPlanId:this.rowData.CaptPlanId}).then((res) =>{
-      //     let nameList = []
-      //     for(let i in res.List){
-      //          nameList.push(res.List[i].name)
-      //         if(res.List[i].key == ''){
-      //             res.List[i].key = this.rowData.CaptPlanWorkShiftCode
-      //         }
-      //     }
-      //     for(let i in this.defArr){
-      //         for(let 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
-      //         } else if(this.defArr[i].name == this.changeTime && nameList.indexOf(this.changeTime)==-1){
-      //             this.defArr[i].key = this.rowData.CaptPlanWorkShiftCode
-      //         }
-      //         }
-      //
-      //     }
-      // })
+      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 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
+            } else if (this.defArr[i].name === this.changeTime && nameList.indexOf(this.changeTime) === -1) {
+              this.defArr[i].key = this.rowData.CaptPlanWorkShiftCode
+            }
+          }
+        }
+      })
     },
     close() {
       setTimeout(() => {
@@ -495,9 +502,9 @@
       }, 300)
     },
     CapacityPlanningSetupSearch() {
-      // capacityPlanning.CapacityPlanningSetupSearch(this.form).then((res) => {
-      //   this.projectDef = res.rows
-      // })
+      CapacityPlanningSetupSearch(this.form).then((res) => {
+        this.projectDef = res.rows
+      })
     }
 
   }
@@ -572,6 +579,8 @@
   border-radius: 4px;
   line-height: 30px;
   margin: 5px 0;
+  //overflow: visible !important;
+  //box-sizing: border-box;
 
   .pannel-nav {
     position: relative;
@@ -643,7 +652,8 @@
     border-top: 1px solid #E7E7EA;
     padding: 10px;
     overflow: hidden;
-    height: 58px;;
+    height: 58px;
+
   }
 }
 

--
Gitblit v1.9.3