Explorar el Código

协议费用审核---费用起止日期拆分

@dongkboy hace 1 año
padre
commit
a6bd3dea99
Se han modificado 1 ficheros con 36 adiciones y 11 borrados
  1. 36 11
      src/views/AgreementManage/CarInsurance/ProductCostExamine.vue

+ 36 - 11
src/views/AgreementManage/CarInsurance/ProductCostExamine.vue

@@ -40,11 +40,17 @@
           default-first-option placeholder="费用描述">
         </el-select>
       </el-form-item>
-      <el-form-item label="费用起期">
-        <el-date-picker value-format="yyyy-MM-dd" v-model="date1" size="small" type="daterange" align="left"
-          range-separator="至" start-placeholder="费用起期" end-placeholder="费用止期">
+      <el-form-item label="费用起期">
+        <el-date-picker value-format="yyyy-MM-dd HH:mm:ss" v-model="productpageRequest.costStartDate" size="small" type="datetime" align="left"
+          range-separator="至" placeholder="费用起期">
         </el-date-picker>
       </el-form-item>
+      <el-form-item label="费用止期">
+        <el-date-picker value-format="yyyy-MM-dd HH:mm:ss" v-model="productpageRequest.costsEndDate" @change="costsEndDateChange" size="small" type="datetime" align="left"
+          range-separator="至" placeholder="费用止期">
+        </el-date-picker>
+      </el-form-item>
+
       <el-form-item>
         <el-button type="primary" @click="costQuery">查询</el-button>
       </el-form-item>
@@ -337,6 +343,8 @@ export default {
         agreementIdList: [],
         costsDescription: [],
         productCode: [],
+        costStartDate:"",
+        costsEndDate:"",
       },
       //保险公司列表
       InsCompanyList: [],
@@ -614,6 +622,30 @@ export default {
   },
   // 方法函数
   methods: {
+    costsEndDateChange(){
+      let tempStartDate = this.productpageRequest.costStartDate;
+      let tempEndDate = this.productpageRequest.costsEndDate;
+      if (!tempStartDate) {
+        this.productpageRequest.costsEndDate = null;
+        this.$message({
+          message: "请先选择费用起期!",
+          type: "error",
+        });
+      }
+      if (!this.validateEndDate(tempStartDate, tempEndDate)) {
+        this.productpageRequest.costsEndDate = null;
+        this.$message({
+          message: "费用止期不能小于/等于费用起期!",
+          type: "error",
+        });
+      }
+    },
+    //日期比较
+    validateEndDate(startDateStr, endDateStr) {
+      const startDate = new Date(startDateStr);
+      const endDate = new Date(endDateStr);
+      return endDate.getTime() > startDate.getTime();
+    },
     // 点击展开行
     handleExpandChange(row,rows) {
       if(rows.length>0) {
@@ -812,13 +844,6 @@ export default {
         this.productpageRequest.createStartTime = "";
         this.productpageRequest.createEndTime = "";
       }
-      if (this.date1 != null) {
-        this.productpageRequest.costStartDate = this.date1[0];
-        this.productpageRequest.costsEndDate = this.date1[1];
-      } else {
-        this.productpageRequest.costStartDate = "";
-        this.productpageRequest.costsEndDate = "";
-      }
       this.$api.insCompany
         .getCostsAuditList(this.productpageRequest)
         .then((res) => {
@@ -879,7 +904,7 @@ export default {
             this.$message.warning(res.msg)
           }
         });
-    }
+    },
   },
   // 计算属性
   computed: {},