Browse Source

日期更改

jbb 2 years ago
parent
commit
310b0d5478
1 changed files with 43 additions and 13 deletions
  1. 43 13
      src/views/shipment-details/referOrderDataModal.vue

+ 43 - 13
src/views/shipment-details/referOrderDataModal.vue

@@ -118,7 +118,6 @@ import { JeecgListMixin } from '@/mixins/JeecgListMixin'
 import JEllipsis from '@/components/jeecg/JEllipsis'
 import moment from 'moment'
 import { randomUUID } from '@/utils/util'
-
 import { queryOrderData, confimOrderData } from '@api/document/shipmentList'
 
 export default {
@@ -442,7 +441,8 @@ export default {
       confimList: [], //勾选的订单数组
       propList: [], //需要给新增页的数据
       dateRange:[],
-      range:[],//预发货日期数组
+      range:["2022-08-02","2032-08-02"],//预发货日期数组
+      monthStartDate:'',
       dataRangeMode:['date','date'],
       rangeMode:['date','date'],
     }
@@ -451,9 +451,39 @@ export default {
   // props: {},
 
   created() {
-    // this.getOrderList()
+    // this.getOrderList()  	
+    this.defalutDate()
   },
   methods: {
+    moment,
+    //默认预发货日期
+    defalutDate(){
+     Date.prototype.format = function(fmt) { 
+        var o = { 
+           "M+" : this.getMonth()+1,                 //月份 
+           "d+" : this.getDate(),                    //日 
+           "h+" : this.getHours(),                   //小时 
+           "m+" : this.getMinutes(),                 //分 
+           "s+" : this.getSeconds(),                 //秒 
+           "q+" : Math.floor((this.getMonth()+3)/3), //季度 
+           "S"  : this.getMilliseconds()             //毫秒 
+        }; 
+        if(/(y+)/.test(fmt)) {
+            fmt=fmt.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length)); 
+        }
+        for(var k in o) {
+        if(new RegExp("("+ k +")").test(fmt)){
+             fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length)));
+         }
+        }
+        return fmt; 
+       }  
+        var now = new Date(); //当前日期 
+        var nowMonth = now.getMonth(); //当前月 
+        var nowYear = now.getFullYear(); //当前年 
+        //本月的开始时间
+        this.monthStartDate = new Date(nowYear, nowMonth, 1);         
+    },
     // 参照订单数据 查询
     getOrderList() {
       this.confirmLoading = true;
@@ -619,16 +649,16 @@ export default {
       }
     },
 
-    rangeSelectChange(value) {
-      this.range = value
-        if (value.length == 0){
-        this.queryParam.preDeliveryDateS = "";
-        this.queryParam.preDeliveryDateE = "";
-      }else{
-        this.queryParam.preDeliveryDateS = value[0].format('YYYY-MM-DD');
-        this.queryParam.preDeliveryDateE  = value[1].format('YYYY-MM-DD');
-      }
-    }
+    // rangeSelectChange(value) {
+    //   this.range = value
+    //     if (value.length == 0){
+    //     this.queryParam.preDeliveryDateS = "";
+    //     this.queryParam.preDeliveryDateE = "";
+    //   }else{
+    //     this.queryParam.preDeliveryDateS = value[0].format('YYYY-MM-DD');
+    //     this.queryParam.preDeliveryDateE  = value[1].format('YYYY-MM-DD');
+    //   }
+    // }
   },
   computed: {
     // 选中项