Procházet zdrojové kódy

入账时间默认当前时间,不设置默认值,直接赋值

ZhangWenQiang před 6 roky
rodič
revize
da5eb011a9

+ 5 - 5
src/views/hwpayment/modules/HwPaymentRecordModal.vue

@@ -27,7 +27,7 @@
 
         <a-form-item label="入账时间" :labelCol="labelCol" :wrapperCol="wrapperCol">
           <a-date-picker placeholder="请选择入账时间" v-decorator="[ 'businessTime', validatorRules.businessTime]"
-                  style="width: 100%" :showTime="true" dateFormat="YYYY-MM-DD HH:mm:ss" :defaultValue="businessDate"/>
+                  style="width: 100%" :showTime="true" dateFormat="YYYY-MM-DD HH:mm:ss"/>
         </a-form-item>
 
         <template v-if="model.subcontractType">
@@ -45,7 +45,7 @@
 
           <a-form-item label="入账时间" :labelCol="labelCol" :wrapperCol="wrapperCol">
             <a-date-picker placeholder="请选择入账时间" v-decorator="[ 'subBusinessTime', validatorRules.subBusinessTime]"
-                    style="width: 100%" :showTime="true" dateFormat="YYYY-MM-DD HH:mm:ss" :defaultValue="businessDate"/>
+                    style="width: 100%" :showTime="true" dateFormat="YYYY-MM-DD HH:mm:ss"/>
           </a-form-item>
         </template>
 
@@ -85,7 +85,6 @@
         show:true,//动态显示隐藏表单元素
         routeSwitch:true, //是否通过平台
         isThroughPlatform:1,//是否通过平台(0:否 1:是)
-        businessDate:new Date(),
         confirmLoading: false,
         validatorRules:{
           amount:{rules: [{ required: true, message: '请输入项目金额!' }]},
@@ -119,6 +118,9 @@
         this.visible = true;
         this.$nextTick(() => {
           this.form.setFieldsValue(pick(this.model,'paymentId','subId','paymentCompanyId','requirementId','subcontractType'));
+          //入账时间默认当前时间
+          this.form.setFieldsValue({businessTime: moment(new Date(), 'YYYY-MM-DD HH:mm:ss')}) //时间格式化
+          this.form.setFieldsValue({subBusinessTime: moment(new Date(), 'YYYY-MM-DD HH:mm:ss')}) //时间格式化
         });
         if (record.subcontractType) {
           this.isThroughPlatform = 1;
@@ -127,8 +129,6 @@
           this.isThroughPlatform = 0;
           this.comTitle = '企业转入服务商';
         }
-        //入账时间默认当前时间
-        this.businessDate = moment(new Date(), 'YYYY-MM-DD HH:mm:ss')
         console.log("dfg",this.model)
       },
       close () {