Browse Source

协议费用方案匹配功能

li.pengfei 3 years ago
parent
commit
ceb691abaa
1 changed files with 42 additions and 68 deletions
  1. 42 68
      src/views/AgreementManage/CarInsurance/AgreementEntry.vue

+ 42 - 68
src/views/AgreementManage/CarInsurance/AgreementEntry.vue

@@ -245,28 +245,31 @@
                 </div>
                 <el-form ref="costform" :model="productCostsitem" label-width="130px" :size="overSize"
                   :rules="costformRules">
-                  <el-row v-if="['单交', '交三', '交商'].includes(schemeitem.name)">
-                    <h4 style="color: tomato;">交强险费用</h4>
+                  <el-row>
+                    <h4/>
                     <el-col :span="20" :offset="2">
                       <el-form-item label="费用描述">
-                        <el-input type="textarea" v-model="productCostsitem.jqCostsDescription"
-                          placeholder="输入费用描述内容"></el-input>
+                        <el-input type="textarea" v-model="productCostsitem.costsDescription"
+                                  placeholder="输入费用描述内容"></el-input>
                       </el-form-item>
                     </el-col>
                     <el-col :span="10" :offset="2">
-                      <el-form-item label="费用起期" prop="jqCostsStartDate">
-                        <el-date-picker style="width: 100%;" v-model="productCostsitem.jqCostsStartDate" type="datetime"
-                          placeholder="选择费用开始日期" value-format="yyyy-MM-dd HH:mm:ss" :picker-options="pickerOptions">
+                      <el-form-item label="费用起期" prop="costsStartDate">
+                        <el-date-picker style="width: 100%;" v-model="productCostsitem.costsStartDate" type="datetime"
+                                        placeholder="选择费用开始日期" value-format="yyyy-MM-dd HH:mm:ss" :picker-options="pickerOptions" @change="cleanEndDate(schemeindex,productCostsindex)">
                         </el-date-picker>
                       </el-form-item>
                     </el-col>
                     <el-col :span="10">
-                      <el-form-item label="费用止期" prop="jqCostsEndDate">
-                        <el-date-picker style="width: 100%;" v-model="productCostsitem.jqCostsEndDate" type="datetime"
-                          placeholder="选择费用结束日期" value-format="yyyy-MM-dd HH:mm:ss" :picker-options="jqpickerOptions1" @focus="vm => timefocus(vm, schemeindex, productCostsindex)">
+                      <el-form-item label="费用止期" prop="costsEndDate">
+                        <el-date-picker style="width: 100%;" v-model="productCostsitem.costsEndDate" type="datetime"
+                                        placeholder="选择费用结束日期" value-format="yyyy-MM-dd HH:mm:ss" :picker-options="pickerOptions1" @focus="vm => timefocus(vm, schemeindex, productCostsindex)"  @change="checkStartDate(schemeindex,productCostsindex)">
                         </el-date-picker>
                       </el-form-item>
                     </el-col>
+                  </el-row>
+                  <el-row v-if="['单交', '交三', '交商'].includes(schemeitem.name)">
+                    <h4 style="color: tomato;">交强险费用</h4>
                     <el-col :span="10" :offset="2">
                       <el-form-item label="溢出保费" prop="jqSpilloverPremiums">
                         <el-input v-model="productCostsitem.jqSpilloverPremiums" placeholder="请输入溢出保费"></el-input>
@@ -319,27 +322,6 @@
                   </el-row>
                   <el-row v-if="['单商', '单三', '交商', '交三'].includes(schemeitem.name)">
                     <h4 style="color: tomato;">商业险费用</h4>
-                    <el-col :span="20" :offset="2">
-                      <el-form-item label="费用描述">
-                        <el-input type="textarea" v-model="productCostsitem.syCostsDescription"
-                          placeholder="输入费用描述内容"></el-input>
-                      </el-form-item>
-                    </el-col>
-                    <el-col :span="10" :offset="2">
-                      <el-form-item label="费用起期" prop="syCostsStartDate">
-                        <el-date-picker style="width: 100%;" v-model="productCostsitem.syCostsStartDate" type="datetime"
-                           placeholder="选择费用开始日期" value-format="yyyy-MM-dd HH:mm:ss" :picker-options="pickerOptions">
-                        </el-date-picker>
-                      </el-form-item>
-                    </el-col>
-                    <el-col :span="10">
-                      <el-form-item label="费用止期" prop="syCostsEndDate">
-                        <el-date-picker style="width: 100%;" v-model="productCostsitem.syCostsEndDate" type="datetime"
-                        :picker-options="sypickerOptions1" @focus="vm => timefocus(vm, schemeindex, productCostsindex)" placeholder="选择费用结束日期"
-                          value-format="yyyy-MM-dd HH:mm:ss" >
-                        </el-date-picker>
-                      </el-form-item>
-                    </el-col>
                     <el-col :span="10" :offset="2">
                       <el-form-item label="溢出保费" prop="sySpilloverPremiums">
                         <el-input v-model="productCostsitem.sySpilloverPremiums" placeholder="请输入溢出保费"></el-input>
@@ -1466,7 +1448,6 @@ export default {
   },
   data() {
     return {
-
       supplierType: "1",//协议类型
       //===========================================
       licenseNo1: "",
@@ -1894,10 +1875,10 @@ export default {
       },
       costformRules: {
 
-        jqCostsStartDate: [
+        costsStartDate: [
           { required: true, message: "请选择费用起期", trigger: "change" },
         ],
-        jqCostsEndDate: [
+        costsEndDate: [
           { required: true, message: "请选择费用止期", trigger: "change" },
         ],
         jqSpilloverPremiums: [
@@ -1943,12 +1924,6 @@ export default {
         jqCostsLevel: [
           { required: true, message: "请选择费用级别", trigger: "change" },
         ],
-        syCostsStartDate: [
-          { required: true, message: "请选择费用起期", trigger: "change" },
-        ],
-        syCostsEndDate: [
-          { required: true, message: "请选择费用止期", trigger: "change" },
-        ],
         sySpilloverPremiums: [
           { required: true, message: "请输入溢出保费", trigger: "blur" },
           {
@@ -2091,19 +2066,12 @@ export default {
       }
     },
 
-    jqpickerOptions1() {
-      return {
-        disabledDate: this.jqdisabledDate1,
-      }
-
-    },
-    sypickerOptions1() {
+    pickerOptions1() {
       return {
-        disabledDate: this.sydisabledDate1,
+        disabledDate: this.disabledDate1,
       }
 
     },
-
   },
   created() {
     this.peopleid = Cookies.get("user");
@@ -2144,6 +2112,22 @@ export default {
     this.changeTreeWidth(250); // 初始化树的宽度
   },
   methods: {
+    //改变费用起期时,同步清空对应费用止期,重新填写
+    cleanEndDate(schemeindex, productCostsindex){
+      this.costform.scheme[schemeindex].productCosts[productCostsindex].costsEndDate=null;
+    },
+    //改变费用止期时,校验必须先填费用起期
+    checkStartDate(schemeindex, productCostsindex){
+      let tempStartDate=this.costform.scheme[schemeindex].productCosts[productCostsindex].costsStartDate;
+      if(!tempStartDate){
+        this.costform.scheme[schemeindex].productCosts[productCostsindex].costsEndDate=null;
+        this.$message({
+          message: "请先选择费用起期!",
+          type: 'error'
+        });
+      }
+    },
+
     disabledDate(time) {
       if (this.operType == 'EDIT') {
         return time.getTime() < Date.now() - 8.64e7;
@@ -2153,13 +2137,8 @@ export default {
       this.schemeindex=schemeindex;
       this.productCostsindex=productCostsindex;
     },
-    jqdisabledDate1(time) {
-      let datetime=this.costform.scheme[this.schemeindex].productCosts[this.productCostsindex].jqCostsStartDate
-      const disabledTime = new Date(datetime).getTime()+8.64e7;
-      return time.getTime() < disabledTime;
-    },
-    sydisabledDate1(time) {
-      let datetime=this.costform.scheme[this.schemeindex].productCosts[this.productCostsindex].syCostsStartDate
+    disabledDate1(time) {
+      let datetime=this.costform.scheme[this.schemeindex].productCosts[this.productCostsindex].costsStartDate;
       const disabledTime = new Date(datetime).getTime()+8.64e7;
       return time.getTime() < disabledTime;
     },
@@ -2261,22 +2240,19 @@ export default {
       let params = this.costform.scheme;
       params.map(ele => {
         ele.productCosts.push({
-          jqCostsDescription: "",//费用描述(交强)
-          jqCostsEndDate: "",//费用止期(交强)
+          costsDescription: "",//费用描述
+          costsStartDate:"",//费用起期
+          costsEndDate: "",//费用止期
           jqCostsLevel: "",//费用级别(交强)
           jqCostsProportion: "",//总费用比例(交强)
-          jqCostsStartDate: "",//费用起期(交强)
           jqNewCarCostsProportion: "4",//新车费用比例(交强)
           jqNewCarOtherCostsProportion: "",//新车其他费用比例(交强)
           jqOldCarCostsProportion: "4",//旧车费用比例(交强)
           jqOldCarOtherCostsProportion: "",//旧车其他费用比例(交强)
           jqSpilloverPremiums: "",//溢出保费(交强)
           jqSpilloverProportion: "",//溢出比例(交强)
-          syCostsDescription: "",//费用描述(商业)
-          syCostsEndDate: "",//费用止期(商业)
           syCostsLevel: "",//费用级别(商业)
           syCostsProportion: "",//总费用比例(商业)
-          syCostsStartDate: "",//费用起期(商业)
           syNewCarCostsProportion: "",//新车费用比例(商业)
           syNewCarOtherCostsProportion: "",//新车其他费用比例(商业)
           syOldCarCostsProportion: "",//旧车费用比例(商业)
@@ -2293,22 +2269,19 @@ export default {
           name: item.dictTag,
           productId: item.dictValue,
           productCosts: [{
-            jqCostsDescription: "",//费用描述(交强)
-            jqCostsEndDate: "",//费用止期(交强)
+            costsDescription: "",//费用描述
+            costsStartDate: "",//费用起期
+            costsEndDate: "",//费用止期
             jqCostsLevel: "",//费用级别(交强)
             jqCostsProportion: "",//总费用比例(交强)
-            jqCostsStartDate: "",//费用起期(交强)
             jqNewCarCostsProportion: "4",//新车费用比例(交强)
             jqNewCarOtherCostsProportion: "",//新车其他费用比例(交强)
             jqOldCarCostsProportion: "4",//旧车费用比例(交强)
             jqOldCarOtherCostsProportion: "",//旧车其他费用比例(交强)
             jqSpilloverPremiums: "",//溢出保费(交强)
             jqSpilloverProportion: "",//溢出比例(交强)
-            syCostsDescription: "",//费用描述(商业)
-            syCostsEndDate: "",//费用止期(商业)
             syCostsLevel: "",//费用级别(商业)
             syCostsProportion: "",//总费用比例(商业)
-            syCostsStartDate: "",//费用起期(商业)
             syNewCarCostsProportion: "",//新车费用比例(商业)
             syNewCarOtherCostsProportion: "",//新车其他费用比例(商业)
             syOldCarCostsProportion: "",//旧车费用比例(商业)
@@ -2810,3 +2783,4 @@ export default {
   }
 }
 </style>
+