From 29d9bdd91b75a4dfbecfc368aefd8ed0155481d5 Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期六, 11 五月 2024 12:04:07 +0800
Subject: [PATCH] 1.生产排单日期类型多选实现

---
 src/icons/svg/clock.svg                  |    1 
 package.json                             |    1 
 src/views/workOrder/produceOrderList.vue |  402 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 3 files changed, 385 insertions(+), 19 deletions(-)

diff --git a/package.json b/package.json
index e68cccf..e8d61a9 100644
--- a/package.json
+++ b/package.json
@@ -27,6 +27,7 @@
     "jsonwebtoken": "^9.0.1",
     "lib-flexible": "^0.3.2",
     "lib-flexible-computer": "^1.0.2",
+    "moment": "^2.30.1",
     "nanoid": "^4.0.2",
     "normalize.css": "7.0.0",
     "nprogress": "0.2.0",
diff --git a/src/icons/svg/clock.svg b/src/icons/svg/clock.svg
new file mode 100644
index 0000000..f6734f6
--- /dev/null
+++ b/src/icons/svg/clock.svg
@@ -0,0 +1 @@
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1715385909852" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4382" xmlns:xlink="http://www.w3.org/1999/xlink" width="64" height="64"><path d="M511.913993 63.989249c-247.012263 0-447.924744 200.912481-447.924744 447.924744s200.912481 447.924744 447.924744 447.924744 447.924744-200.912481 447.924744-447.924744S758.926256 63.989249 511.913993 63.989249zM511.913993 895.677474c-211.577356 0-383.763481-172.186125-383.763481-383.763481 0-211.577356 172.014111-383.763481 383.763481-383.763481s383.763481 172.014111 383.763481 383.763481S723.491349 895.677474 511.913993 895.677474z" fill="#a7a7a7" p-id="4383"></path><path d="M672.05913 511.913993l-159.973123 0L512.086007 288.123635c0-17.717453-14.277171-32.166639-31.994625-32.166639-17.717453 0-31.994625 14.449185-31.994625 32.166639l0 255.956996c0 17.717453 14.277171 31.994625 31.994625 31.994625l191.967747 0c17.717453 0 32.166639-14.277171 32.166639-31.994625C704.053754 526.191164 689.604569 511.913993 672.05913 511.913993z" fill="#a7a7a7" p-id="4384"></path></svg>
\ No newline at end of file
diff --git a/src/views/workOrder/produceOrderList.vue b/src/views/workOrder/produceOrderList.vue
index 65c40f0..f6009d5 100644
--- a/src/views/workOrder/produceOrderList.vue
+++ b/src/views/workOrder/produceOrderList.vue
@@ -81,6 +81,149 @@
               <el-input v-model="form.partspec" style="width: 200px" placeholder="璇疯緭鍏�" />
             </el-form-item>
 
+            <div v-show="isExpandForm" style="display:flex;justify-content: center;align-items: center;position: relative">
+
+              <el-popover
+                v-model="cycleTimePopoverIsShow"
+                placement="bottom"
+                width="500"
+                trigger="hover"
+                @show="cycleTimePopoverIsShow=true"
+              >
+                <div class="popoverList">
+                  <div class="popoverListItem">
+                    <div style="width: 40px">鍛�</div>
+                    <el-button
+                      :class="cycleTime===1?'selectButton':''"
+                      @click="cycleTimeClick(1)"
+                    >鏈� 鍛�</el-button>
+                    <el-button
+                      :class="cycleTime===2?'selectButton':''"
+                      @click="cycleTimeClick(2)"
+                    >涓� 鍛�</el-button>
+                  </div>
+                  <div class="popoverListItem">
+                    <div style="width: 40px">鏈�</div>
+                    <el-button
+                      :class="cycleTime===3?'selectButton':''"
+                      @click="cycleTimeClick(3)"
+                    >鏈� 鏈�</el-button>
+                    <el-button
+                      :class="cycleTime===4?'selectButton':''"
+                      @click="cycleTimeClick(4)"
+                    >涓� 鏈�</el-button>
+                  </div>
+                  <div class="popoverListItem">
+                    <div style="width: 40px">瀛�</div>
+                    <el-button
+                      :class="cycleTime===5?'selectButton':''"
+                      @click="cycleTimeClick(5)"
+                    >鏈� 瀛�</el-button>
+                    <el-button
+                      :class="cycleTime===6?'selectButton':''"
+                      @click="cycleTimeClick(6)"
+                    >涓� 瀛�</el-button>
+                  </div>
+                  <div class="popoverListItem">
+                    <div style="width: 40px">骞�</div>
+                    <el-button
+                      :class="cycleTime===7?'selectButton':''"
+                      @click="cycleTimeClick(7)"
+                    >鏈� 骞�</el-button>
+                    <el-button
+                      :class="cycleTime===8?'selectButton':''"
+                      @click="cycleTimeClick(8)"
+                    >涓� 骞�</el-button>
+                  </div>
+                  <div class="popoverListItem">
+                    <div style="width: 40px">鍏朵粬</div>
+                    <el-button
+                      :class="cycleTime===9?'selectButton':''"
+                      @click="cycleTimeClick(9)"
+                    >杩�3澶�</el-button>
+                    <el-button
+                      :class="cycleTime===10?'selectButton':''"
+                      @click="cycleTimeClick(10)"
+                    >杩�7澶�</el-button>
+                    <el-button
+                      :class="cycleTime===11?'selectButton':''"
+                      @click="cycleTimeClick(11)"
+                    >杩�14澶�</el-button>
+                    <el-button
+                      :class="cycleTime===12?'selectButton':''"
+                      @click="cycleTimeClick(12)"
+                    >浠� 澶�</el-button>
+                    <el-button
+                      :class="cycleTime===13?'selectButton':''"
+                      @click="cycleTimeClick(13)"
+                    >鏄� 澶�</el-button>
+                  </div>
+
+                </div>
+
+                <div
+                  slot="reference"
+                  style="width:15px;height:15px;background:transparent;
+                  cursor: pointer;position:absolute;z-index: 100;left: 110px;top:13px"
+                />
+
+              </el-popover>
+
+              <el-popover
+                placement="bottom"
+                width="100"
+                trigger="hover"
+                :value="datatypePopoverIsShow"
+                @show="datatypePopoverIsShow=true"
+              >
+                <div class="popoverList">
+                  <div class="popoverListItem2">
+                    <el-button
+                      :class="form.datatype==='PS'?'selectButton':''"
+                      @click="form.datatype='PS';datatypePopoverIsShow=false"
+                    >棰勮寮�宸ユ棩鏈�</el-button>
+                  </div>
+                  <div class="popoverListItem2">
+                    <el-button
+                      :class="form.datatype==='PE'?'selectButton':''"
+                      @click="form.datatype='PE';datatypePopoverIsShow=false"
+                    >棰勮瀹屽伐鏃ユ湡</el-button>
+                  </div>
+                  <div class="popoverListItem2">
+                    <el-button
+                      :class="form.datatype==='ED'?'selectButton':''"
+                      @click="form.datatype='ED';datatypePopoverIsShow=false"
+                    >棰勮浜や粯鏃ユ湡</el-button>
+                  </div>
+                </div>
+
+                <div
+                  slot="reference"
+                  style="color: #a7a7a7;
+                  font-weight: 600;
+                font-family:'Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Arial, sans-serif';
+                font-size:14px;width: 100px;text-align: center"
+                > {{ form.datatype==='PS'? '棰勮寮�宸ユ棩鏈�':form.datatype==='PE'?'棰勮瀹屽伐鏃ユ湡':'棰勮浜や粯鏃ユ湡' }}
+                </div>
+
+              </el-popover>
+
+              <el-date-picker
+                v-model="form.timeValue"
+                type="daterange"
+                range-separator="~"
+                class="timeMini"
+                size="mini"
+                style="width: 200px;display: flex;line-height: 34px;height: 34px;margin-right: 10px"
+                :clearable="false"
+                start-placeholder="寮�濮嬫棩鏈�"
+                end-placeholder="缁撴潫鏃ユ湡"
+                value-format="yyyy-MM-dd"
+                @change="pickerChange"
+              />
+              <!--              :picker-options="pickerOptions"-->
+            </div>
+
             <!--            <el-form-item-->
             <!--              v-show="isExpandForm"-->
             <!--              label="棰勮寮�宸ユ椂闂�"-->
@@ -89,7 +232,7 @@
             <!--            >-->
             <!--              <el-date-picker-->
             <!--                v-model="form.paystartdate"-->
-            <!--                type="daterange"-->
+            <!--                type="datetimerange"-->
             <!--                range-separator="~"-->
             <!--                class="timeMini"-->
             <!--                size="mini"-->
@@ -97,8 +240,12 @@
             <!--                :clearable="false"-->
             <!--                start-placeholder="寮�濮嬫棩鏈�"-->
             <!--                end-placeholder="缁撴潫鏃ユ湡"-->
+            <!--                :picker-options="pickerOptions"-->
+            <!--                value-format="yyyy-MM-dd"-->
+            <!--                @change="pickerChange"-->
             <!--              />-->
             <!--            </el-form-item>-->
+
             <!--            <el-form-item-->
             <!--              v-show="isExpandForm"-->
             <!--              label="棰勮瀹屽伐鏃堕棿"-->
@@ -310,6 +457,32 @@
           <!--            </template>-->
           <!--          </el-table-column>-->
           <el-table-column
+            prop="planenddate"
+            label="棰勮寮�宸ユ棩鏈�"
+            sortable="custom"
+            show-tooltip-when-overflow
+            width="130"
+          >
+            <template slot-scope="{row}">
+              <div v-if="row.planenddate">{{ row.planenddate.substring(0, 11) }}</div>
+              <div v-else>/</div>
+            </template>
+          </el-table-column>
+
+          <el-table-column
+            prop="planstartdate"
+            label="棰勮瀹屽伐鏃ユ湡"
+            sortable="custom"
+            show-tooltip-when-overflow
+            width="130"
+          >
+            <template slot-scope="{row}">
+              <div v-if="row.planstartdate">{{ row.planstartdate.substring(0, 11) }}</div>
+              <div v-else>/</div>
+            </template>
+          </el-table-column>
+
+          <el-table-column
             prop="saleOrderDeliveryDate"
             label="棰勮浜や粯鏃ユ湡"
             sortable="custom"
@@ -321,6 +494,7 @@
               <div v-else>/</div>
             </template>
           </el-table-column>
+
           <el-table-column
             show-tooltip-when-overflow
             prop="createuser"
@@ -502,6 +676,7 @@
 } from '@/api/WorkOrder'
 import { SeaveSearchErpOrder } from '@/api/ErpSyncMes'
 import { PrentOrganizationNoCompany } from '@/api/GeneralBasicData'
+import moment from 'moment'
 
 const SER_HZ = /^[\u4e00-\u9fa5]+$/
 export default {
@@ -540,11 +715,18 @@
         paystartdate: '', // 棰勮寮�宸ユ椂闂�
         payenddate: '', // 棰勮瀹屽伐鏃堕棿
         createdate: '', // 鍒涘缓鏃堕棿
+
+        datatype: 'ED', // 鏃堕棿绫诲瀷
+        timeValue: [], // 鏃堕棿鍊�
+
         prop: 'wo', // 鎺掑簭瀛楁
         order: 'desc', // 鎺掑簭瀛楁
         page: 1, // 绗嚑椤�
         rows: 20 // 姣忛〉澶氬皯鏉�
       },
+      datatypePopoverIsShow: false,
+      cycleTime: null, // 鏃堕棿鍛ㄦ湡
+      cycleTimePopoverIsShow: false,
       erporderstusArr: [
         { code: 'NEW', name: '鏂拌鍗�' },
         { code: 'CREATING', name: '閮ㄥ垎涓嬭揪' },
@@ -601,9 +783,49 @@
 
       },
       pickerOptions: {
-        disabledDate(time) {
-          return time.getTime() < Date.now() - 8.64e7
-        }
+        shortcuts: [
+          {
+            text: '褰撳ぉ',
+            onClick(picker) {
+              const end = new Date()
+              const start = new Date()
+              start.setTime(start.getTime())
+              picker.$emit('pick', [start, end])
+            }
+          }, {
+            text: '杩戜笁澶�',
+            onClick(picker) {
+              const end = new Date()
+              const start = new Date()
+              start.setTime(start.getTime() - 3600 * 1000 * 24 * 3)
+              console.log([start, end], '[start, end]')
+              picker.$emit('pick', [start, end])
+            }
+          }, {
+            text: '杩戜竴鍛�',
+            onClick(picker) {
+              const end = new Date()
+              const start = new Date()
+              start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
+              picker.$emit('pick', [start, end])
+            }
+          }, {
+            text: '杩戜竴涓湀',
+            onClick(picker) {
+              const end = new Date()
+              const start = new Date()
+              start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
+              picker.$emit('pick', [start, end])
+            }
+          }, {
+            text: '杩戜笁涓湀',
+            onClick(picker) {
+              const end = new Date()
+              const start = new Date()
+              start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
+              picker.$emit('pick', [start, end])
+            }
+          }]
       },
       multipleSelection: []
 
@@ -626,34 +848,143 @@
     this.getHeight()
   },
   methods: {
+
+    cycleTimeClick(value) {
+      this.cycleTimePopoverIsShow = false
+
+      const date = new Date()
+      const cWeek = moment(date).format('E')
+      let newDate = []
+      switch (value) {
+        case 1:// 鏈懆
+          newDate = [
+            moment(date).subtract(Number(cWeek) - 1, 'days').format('YYYY-MM-DD'),
+            moment(moment().week(moment().week()).endOf('week').valueOf()).format('YYYY-MM-DD')
+          ]
+          break
+        case 2:// 涓婂懆
+          newDate = [
+            moment(moment().add(-13, 'days').startOf('day').valueOf()).format('YYYY-MM-DD'),
+            moment(moment().add(-6, 'days').startOf('day').valueOf()).format('YYYY-MM-DD')
+          ]
+          break
+
+        case 3:// 鏈湀
+          newDate = [
+            moment(moment().month(moment().month()).startOf('month').valueOf()).format('YYYY-MM-DD'),
+            moment(moment().month(moment().month()).endOf('month').valueOf()).format('YYYY-MM-DD')
+          ]
+          break
+
+        case 4:// 涓婃湀
+          newDate = [
+            moment(moment().month(moment().month() - 1).startOf('month').valueOf()).format('YYYY-MM-DD'),
+            moment(moment().month(moment().month()).startOf('month').valueOf()).add(-1, 'days').format('YYYY-MM-DD')
+          ]
+          break
+
+        case 5:// 鏈搴�
+          newDate = [
+            moment(moment().quarter(moment().quarter()).startOf('quarter').valueOf()).format('YYYY-MM-DD'),
+            moment(moment().quarter(moment().quarter()).endOf('quarter').valueOf()).format('YYYY-MM-DD')
+          ]
+          break
+
+        case 6:// 涓婂搴�
+          newDate = [
+            moment(moment().quarter(moment().quarter() - 1).startOf('quarter').valueOf()).format('YYYY-MM-DD'),
+            moment(moment().quarter(moment().quarter() - 1).endOf('quarter').valueOf()).format('YYYY-MM-DD')
+          ]
+          break
+
+        case 7:// 鏈勾
+          newDate = [
+            moment(moment().year(moment().year()).startOf('year').valueOf()).format('YYYY-MM-DD'),
+            moment(moment().year(moment().year()).endOf('year').valueOf()).format('YYYY-MM-DD')
+          ]
+          break
+
+        case 8:// 鍘诲勾
+          newDate = [
+            moment(moment().year(moment().year() - 1).startOf('year').valueOf()).format('YYYY-MM-DD'),
+            moment(moment().year(moment().year() - 1).endOf('year').valueOf()).format('YYYY-MM-DD')
+          ]
+          break
+
+        case 9:// 杩�3澶�
+          newDate = [
+            moment(moment().add(-2, 'days').startOf('day').valueOf()).format('YYYY-MM-DD'),
+            moment(moment().startOf('day').valueOf()).format('YYYY-MM-DD')
+          ]
+          break
+        case 10:// 杩�7澶�
+          newDate = [
+            moment(moment().add(-6, 'days').startOf('day').valueOf()).format('YYYY-MM-DD'),
+            moment(moment().startOf('day').valueOf()).format('YYYY-MM-DD')
+          ]
+          break
+        case 11:// 杩�14澶�
+          newDate = [
+            moment(moment().add(-13, 'days').startOf('day').valueOf()).format('YYYY-MM-DD'),
+            moment(moment().startOf('day').valueOf()).format('YYYY-MM-DD')
+          ]
+          break
+        case 12:// 浠婂ぉ
+          newDate = [
+            moment(moment().startOf('day').valueOf()).format('YYYY-MM-DD'),
+            moment(moment().startOf('day').valueOf()).format('YYYY-MM-DD')
+          ]
+          break
+        case 13:// 鏄ㄥぉ
+          newDate = [
+            moment(moment().add(-1, 'days').startOf('day').valueOf()).format('YYYY-MM-DD'),
+            moment(moment().startOf('day').valueOf()).format('YYYY-MM-DD')
+          ]
+          break
+      }
+
+      this.form.timeValue = newDate
+      this.cycleTime = value
+    },
+
+    pickerChange(value) {
+      console.log(value, 123)
+      this.cycleTime = null
+    },
+
     async getPrentOrganizationNoCompany() {
       const { data: res } = await PrentOrganizationNoCompany()
       this.wkshopcodeArr = res
     },
     async getErpOrderSearch() {
       console.log(this.form, 1)
-      let tempDate2 = this.form.paystartdate
-      if (tempDate2.length > 0) {
-        tempDate2 = handleDatetime(tempDate2[0]) + '~' + handleDatetime(tempDate2[1])
-      }
-
-      let tempDate = this.form.payenddate
-      if (tempDate.length > 0) {
-        tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1])
-      }
+      // let tempDate2 = this.form.paystartdate
+      // if (tempDate2.length > 0) {
+      //   tempDate2 = handleDatetime(tempDate2[0]) + '~' + handleDatetime(tempDate2[1])
+      // }
+      //
+      // let tempDate = this.form.payenddate
+      // if (tempDate.length > 0) {
+      //   tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1])
+      // }
 
       const data = {
-        wkshopcode: this.form.wkshopcode,
+
         erporderstus: this.form.erporderstus, // 璁㈠崟鐘舵�佺爜
+        wkshopcode: this.form.wkshopcode, // 杞﹂棿缂栫爜
         erpordercode: this.form.erpordercode, // 璁㈠崟缂栧彿
+        saleordercode: this.form.saleordercode, // 閿�鍞崟鍙�
+
         partcode: this.form.partcode, // 浜у搧缂栫爜
         partname: this.form.partname, // 浜у搧鍚嶇О
         partspec: this.form.partspec, // 浜у搧瑙勬牸
-        paystartdate: tempDate2, // 浜や粯鏃堕棿
-        payenddate: tempDate, // 浜や粯鏃堕棿
-        saleordercode: this.form.saleordercode,
+
+        datatype: this.form.datatype, // 鏃ユ湡绫诲瀷(璁″垝寮�宸�(PS)銆佽鍒掑畬宸�(PE)銆侀璁′氦浠�(ED))
+        searchdate: this.form.timeValue.join('~'), // 鏃堕棿娈�
+        // paystartdate: tempDate2, // 浜や粯鏃堕棿
+        // payenddate: tempDate, // 浜や粯鏃堕棿
+
         creatuser: this.form.creatuser, // 鍒涘缓浜哄憳
-        // createdate: this.form.createdate.toString().length > 0 ? handleDatetime(this.form.createdate) : '', // 鍒涘缓鏃堕棿
 
         prop: this.form.prop, // 鎺掑簭瀛楁
         order: this.form.order, // 鎺掑簭瀛楁
@@ -725,6 +1056,9 @@
       this.form.creatuser = ''
       this.form.erpordercode = ''
       this.form.createdate = ''
+
+      this.form.timeValue = []
+      this.cycleTime = null
       this.getErpOrderSearch()
     },
     // 鍗曢�夋閫変腑鑾峰彇褰撳墠琛屼俊鎭�
@@ -970,6 +1304,29 @@
 <style lang="scss" scoped>
 $main_color: #42b983;
 
+.popoverList {
+  display: flex;
+  flex-direction: column;
+}
+
+.popoverListItem {
+  height: 50px;
+  display: flex;
+  align-items: center;
+  justify-content: flex-start;
+}
+
+.popoverListItem2 {
+  height: 40px;
+  display: flex;
+  align-items: center;
+  justify-content: flex-start;
+}
+
+.selectButton {
+  color: #42B983;
+}
+
 ::v-deep .el-range__icon {
   line-height: 28px !important;
 }
@@ -1106,7 +1463,8 @@
     margin-top: -3px;
   }
 }
-::v-deep .el-icon-delete  {
+
+::v-deep .el-icon-delete {
   cursor: pointer;
   margin-right: 0px !important;
 }
@@ -1123,5 +1481,11 @@
 .el-loading-text {
   font-size: 26px !important;
 }
+
+.el-picker-panel__footer {
+  display: flex !important;
+  justify-content: flex-end !important;
+}
+
 </style>
 

--
Gitblit v1.9.3