lihongxiao 2 лет назад
Родитель
Сommit
93fe8f465e
1 измененных файлов с 164 добавлено и 70 удалено
  1. 164 70
      src/views/AgreementManage/CarInsurance/components/PremiumFactor.vue

+ 164 - 70
src/views/AgreementManage/CarInsurance/components/PremiumFactor.vue

@@ -43,6 +43,7 @@
               >
                 <template v-if="val.type === 'input'">
                   <el-input
+                    style="width: 100%"
                     v-model="formData[val.prop]"
                     size="small"
                     :placeholder="'请输入' + val.label"
@@ -76,6 +77,18 @@
                     ></el-option>
                   </el-select>
                 </template>
+                <!-- 日期 -->
+                <template v-if="val.type === 'date'">
+                  <el-date-picker
+                    v-dateFormat
+                    v-model="formData[val.prop]"
+                    :picker-options="pickerOptions"
+                    value-format="yyyy-MM-dd"
+                    type="date"
+                    :placeholder="'选择'+val.prop"
+                    placement="bottom-start"
+                  ></el-date-picker>
+                </template>
                 <!-- 带多选的select -->
                 <template v-if="val.type === 'selectmultiple'">
                   <el-select
@@ -306,9 +319,9 @@
             <el-checkbox
               class="often-content-child"
               v-for="city in cele.cities"
-              :label="city.name"
+              :label="city.label"
               :key="city.city"
-              >{{ city.name }}</el-checkbox
+              >{{ city.label }}</el-checkbox
             >
             <!-- <el-checkbox
               class="often-content-child"
@@ -365,9 +378,28 @@ import imgSrc2 from "../../../../assets/image/bfyz2.png";
 import imgSrc3 from "../../../../assets/image/bfyz3.png";
 import imgSrc4 from "../../../../assets/image/bfyz4.png";
 import imgSrc5 from "../../../../assets/image/bfyz5.png";
+let insureOptions=[
+      {
+        label: "不投保",
+        value: "0"
+      },
+      {
+        label: "投保",
+        value: "1"
+      }
+    ]
 export default {
   data() {
     return {
+      pickerOptions: {
+        disabledDate(time) {
+          //若选择的日期小于当前日期(包含今天)
+          return time.getTime() > Date.now();
+          //若选择的日期大于当前日期(不包含今天): time.getTime() < Date.now()
+          //若选择的日期小于当前日期(不包含今天): time.getTime() > Date.now() - 8.64e7
+          //若选择的日期小于等于当前日期(包含今天): time.getTime() > Date.now()
+        }
+      },
       ImportdialogVisible: false,
       tableData: [
         {
@@ -397,29 +429,44 @@ export default {
           options: [
             {
               name: "险种",
+              // cities:['机动车损失险','第三者责任险']
               cities: [
                 {
-                  name:'机动车损失险',
-                  type:'select'
+                  label:'机动车损失险',
+                  type:'select',
+                  prop:'机动车损失险',
+                  options:insureOptions
                 },
                 {
-                  name:'第三者责任险',
-                  type:'select'
+                  label:'第三者责任险',
+                  type:'select',
+                  prop:'第三者责任险',
+                  options:insureOptions
                 },{
-                  name:'司机责任险',
-                  type:'select'
+                  label:'司机责任险',
+                  type:'select',
+                  prop:'司机责任险',
+                  options:insureOptions
                 },{
-                  name:'乘客责任险',
-                  type:'select'
+                  label:'乘客责任险',
+                  type:'select',
+                  prop:'乘客责任险',
+                  options:insureOptions
                 },{
-                  name:'附加医保-三者',
-                  type:'select'
+                  label:'附加医保-三者',
+                  type:'select',
+                  prop:'附加医保-三者',
+                  options:insureOptions
                 },{
-                  name:'附加医保-座位险(乘客)',
-                  type:'select'
+                  label:'附加医保-座位险(乘客)',
+                  type:'select',
+                  prop:'附加医保-座位险(乘客)',
+                  options:insureOptions
                 },{
-                  name:'附加医保-座位险(司机)',
-                  type:'select'
+                  label:'附加医保-座位险(司机)',
+                  type:'select',
+                  prop:'附加医保-座位险(司机)',
+                  options:insureOptions
                 },
               ],
             },
@@ -432,33 +479,72 @@ export default {
               name: "车辆",
               cities: [
                 {
-                  name:'车辆识别代码',
-                  type:'select'
+                  label:'车辆识别代码',
+                  prop:'车辆识别代码',
+                  type:'input',
                 },
                 {
-                  name:'品牌型号车辆类别码',
-                  type:'select'
-                },{
-                  name:'总质量(千克)',
-                  type:'select'
-                },{
-                  name:'乘客责任险',
-                  type:'select'
+                  label:'品牌型号',
+                  prop:'品牌型号',
+                  type:'input'
                 },{
-                  name:'附加医保-三者',
-                  type:'select'
+                  label:'新车购置价',
+                  prop:'新车购置价',
+                  type:'input'
                 },{
-                  name:'附加医保-座位险(乘客)',
-                  type:'select'
-                },{
-                  name:'附加医保-座位险(司机)',
-                  type:'select'
+                  label:'注册日期',
+                  prop:'注册日期',
+                  type:'date'
+                },
+                {
+                  label:'发证日期',
+                  prop:'发证日期',
+                  type:'date'
                 },
               ],
             },
           ],
-            
         },
+        {
+          title: "关系人信息",
+          options: [
+            {
+              name: "车主",
+              cities: [
+                {
+                  label:'车主性别',
+                  prop:'车主性别',
+                  type:'input',
+                  hide: true,
+                  name: "chezhu",
+                },
+              ],
+            }, {
+              name: "投保人",
+              cities: [
+                {
+                  label:'投保人性别',
+                  prop:'投保人性别',
+                  type:'input',
+                  hide: true,
+                  name: "toubaoren",
+                },
+              ],
+            }, {
+              name: "被保人",
+              cities: [
+                {
+                  label:'被保人性别',
+                  prop:'被保人性别',
+                  type:'input',
+                  hide: true,
+                  name: "beibaoren",
+                },
+              ],
+            },
+          ],
+        },
+        
       ],
       dialogVisible: false,
       dialogTitle: "添加其他条件",
@@ -912,33 +998,6 @@ export default {
           // return ele;
         });
       }
-
-      // this.circularContent[4].concant.forEach((ele) => {
-      //   if (val.includes("车主") && ele.name == "chezhu") {
-      //     ele.hide = false;
-      //   } else {
-      //     if (ele.name == "chezhu") {
-      //       ele.hide = true;
-      //     }
-      //   }
-
-      //   if (val.includes("投保人") && ele.name == "toubaoren") {
-      //       ele.hide = false;
-
-      //   } else {
-      //     if (ele.name == "toubaoren") {
-      //       ele.hide = true;
-      //     }
-      //   }
-      //   if (val.includes("被保人") && ele.name == "beibaoren") {
-      //     ele.hide = false;
-      //   } else {
-      //     if (ele.name == "beibaoren") {
-      //       ele.hide = true;
-      //     }
-      //   }
-      // });
-      console.log(this.circularContent[4].concant, 111111111);
     },
     // 投保人同车主功能
     isoOwnerFun(val) {
@@ -982,34 +1041,69 @@ export default {
         this.dialogTitle = "常用条件配置";
       }
     },
+    // 全选
     handleCheckAllChange(index) {
       let arr = [];
-      this.conditiondata[index].options.forEach((val) =>
-        arr.push(...val.cities)
-      );
+      this.conditiondata[index].options.forEach((val) =>{
+        this.checkedmData[index].option.push(...val.cities)
+        arr.push(...val.cities.map(ele=>ele.label))
+      });
+
       this.checkedmData[index].checkedCities = this.checkedmData[index].checkAll
         ? arr
         : [];
       this.checkedmData[index].isIndeterminate = false;
       this.checkedmData = [...this.checkedmData];
     },
+    // 单选
     handleCheckedCitiesChange(value,cities, index, cindex) {
       if(value.checkedCities.length>0){
+        this.checkedmData[index].option=[]
         value.checkedCities.forEach(ele=>{
-          this.checkedmData[index].option.push(cities.find(val=>val.name==ele)) 
+          this.checkedmData[index].option.push(cities.find(val=>val.label==ele)) 
         })
       }
-       
         let checkedCount = value.checkedCities.length;
-        this.checkedmData[index].checkAll =checkedCount === this.conditiondata[index].options[cindex].cities.length;
-        this.checkedmData[index].isIndeterminate =  checkedCount > 0 && checkedCount < this.conditiondata[index].options[cindex].cities.length;
+        // 全选按钮是否打勾
+        this.checkedmData[index].checkAll =checkedCount === this.conditiondata[index].options[cindex].cities.length||checkedCount === this.conditiondata[index].options.length;
+        this.checkedmData[index].isIndeterminate =  checkedCount > 0 && checkedCount < this.conditiondata[index].options[cindex].cities.length|| checkedCount < this.conditiondata[index].options.length;
         this.checkedmData = [...this.checkedmData];
-        console.log(value,this.checkedmData,1111111111111111)
-
     },
+    // 条件配置保存
     conditionSave() {
+      console.log( this.checkedmData,this.circularContent,6666666666666666)
       this.dialogVisible = false;
+      this.conditiondata.forEach((val,index)=>{
+        this.checkedmData[index].title=val.title
+      })
+      // 页面数据
+      let arr=[]
+      let arr1=[]
+      this.circularContent.forEach(ele=>{
+        // 条件配置返回数据
+        this.checkedmData.forEach(ele1=>{
+          if(ele.title==ele1.title){
+            // 将条件配置返回的数据插入到页面对应模块位置中
+            ele.concant.forEach((ele2,index2)=>ele1.option.find((ele3,index3)=>{
+              if(ele3.name==ele2.name && ele2.label==''){
+              // console.log(ele3,index2,900000000000)
+              arr.push(ele3)
+              arr1.push(index2)
+                  ele.concant.splice(index2,0,ele3)
+              }
+            }))
+           let aaa= ele.concant.find((ele2,index2)=>ele1.option.map((ele3,index3)=>ele3.name==ele2.name && ele2.label=='' ))
+           console.log(aaa,88888888888888)
+
+            // ele.concant.splice(ele.concant.findIndex(ele2=>ele1.option.find(ele3=>ele3.name==ele2.name && ele2.label==''))+1,0,ele1.option)
+          }
+        })
+      })
+              console.log(Array.from(new Set(arr)) ,arr1,900000000000)
+
+
     },
+
     // 另存为模板
     saveTemplate() {
       this.$prompt("请输入模板名称", "提示", {