Browse Source

介绍信添加判断是否在有效期内

xujie 1 year ago
parent
commit
7844c4e1aa
1 changed files with 9 additions and 1 deletions
  1. 9 1
      src/views/core/outIn/letter/dialog.addletter.vue

+ 9 - 1
src/views/core/outIn/letter/dialog.addletter.vue

@@ -57,7 +57,6 @@
                 <el-date-picker style="width:100%"
                   v-model="formData.startTime"
                   type="date"
-                  :picker-options="startDatepickerOptions"
                   placeholder="请选择开具日期"
                   >
                 </el-date-picker>
@@ -400,6 +399,15 @@ export default {
             this.$message.error("请添加人员");
             return;
           }
+          //判断介绍信是否过期
+          const inputDate = dayjs(this.formData.startTime);
+          const newDate = inputDate.add(this.formData.effectiveDays,'day').startOf('day');
+          const currentDate = dayjs();
+          if (!dayjs(newDate).isAfter(dayjs(currentDate))){
+            this.$message.error("介绍信已过有效期,请重新选择开具日期或有效天数!");
+            return;
+          }
+
           console.log("================", this.formData);
           if (this.formData.id != null) {
             updateLetter(this.formData).then((response) => {