Просмотр исходного кода

合同新建设置签约日期默认为当前日期

qymljy 3 месяцев назад
Родитель
Сommit
370e350477
1 измененных файлов с 11 добавлено и 3 удалено
  1. 11 3
      src/HDrpManagement/contractManage/components/addContract.vue

+ 11 - 3
src/HDrpManagement/contractManage/components/addContract.vue

@@ -1247,7 +1247,7 @@ export default {
         discountrate: "", //可选
         /*"saler_hrid": JSON.parse(window.sessionStorage.getItem('active_account')).hrid, //可选*/
         saler_hrid: "",
-        signdate: "", //可选
+        signdate: new Date().getFullYear() + '-' + (new Date().getMonth() + 1) + new Date().getDate() , //可选
         signby: "", //可选
         remarks: "", //可选
         title: "",
@@ -1461,7 +1461,7 @@ export default {
       discountrate: "", //可选
       /*"saler_hrid": JSON.parse(window.sessionStorage.getItem('active_account')).hrid, //可选*/
       saler_hrid: "",
-      signdate: "", //可选
+      signdate: new Date().getFullYear() + '-' + (new Date().getMonth() + 1) + new Date().getDate() , //可选
       signby: "", //可选
       remarks: "", //可选
       title: "",
@@ -1608,7 +1608,7 @@ export default {
         discountrate: "", //可选
         /*"saler_hrid": JSON.parse(window.sessionStorage.getItem('active_account')).hrid, //可选*/
         saler_hrid: "",
-        signdate: "", //可选
+        signdate: new Date().getFullYear() + '-' + (new Date().getMonth() + 1) + new Date().getDate() , //可选
         signby: "", //可选
         remarks: "", //可选
         title: "",
@@ -1847,6 +1847,14 @@ export default {
           this.form.paytype = item.label;
         }
       });
+      this.form.signdate = this.getTodayDate()
+    },
+    getTodayDate() {
+      const today = new Date();
+      const year = today.getFullYear();
+      const month = String(today.getMonth() + 1).padStart(2, '0'); // 月份从0开始,需+1
+      const day = String(today.getDate()).padStart(2, '0');
+      return `${year}-${month}-${day}`;
     },
     discountrateChange() {
       let discountrate = parseFloat(this.form.discountrate);