@dongkboy 2 лет назад
Родитель
Сommit
a691b71059

+ 7 - 0
src/views/AgreementManage/CarInsurance/AgreementEntry.vue

@@ -160,6 +160,13 @@
                 scope.row.auditType == '1' ? "人工审核" : "自动审核" }}</span>
           </template>
         </el-table-column>
+        <el-table-column prop="isValid" label="是否有效" align="center" width="100">
+          <template slot-scope="scope">
+            <span
+              :style="{ background: scope.row.isValid == '1' ? 'linear-gradient( 180deg, #66CDBB 0%, #33A08D 100%)' : '#A6A6A6', borderRadius: '4px', padding: '4px 10px', color: '#fff' }">{{
+                scope.row.isValid == '1' ? "有效" : "无效" }}</span>
+          </template>
+        </el-table-column>
         <!-- <el-table-column prop="auditStatus" label="状态" align="center">
           <template slot-scope="scope">
             <span :style="'color:' + agreestatusStyle(scope.row.auditStatus)">

+ 110 - 81
src/views/AgreementManage/InsuranceCompany/CargoTruck/BusinessOperation/Fuel/OptionalsolutionConfig.vue

@@ -97,46 +97,67 @@
           <div>
             <div class="flex j-s a-c">
               <h4>驾意险方案配置</h4>
+              <el-button type="primary" size="small" @click="drvingadd">新增</el-button>
             </div>
-            <div class="flex j-start ">
-              <div class="Risk" style="margin-right: 30px;">
-                <section class="flex j-s a-c ">
-                  <div class=" flex a-c">
-                    <el-checkbox v-model="DriveSelectAll" style="margin-right: 20px;"
-                      @input="DriveSelectAllInput"></el-checkbox>
-                    <span class="flex j-start">全部意外险</span>
-                  </div>
-                  <span class="flex j-end">操作</span>
-                </section>
-                <div style="max-height: 400px;overflow-y: auto;">
-                  <main class="flex j-s a-c" v-for="(filteredInsureitem, filteredInsureindex) in drvingIntentionsList"
-                    :key="filteredInsureindex">
-                    <div>
-                      <el-checkbox v-model="filteredInsureitem.switch" style="margin-right: 20px;"></el-checkbox>
-                      <span>{{ filteredInsureitem.projectName }}</span>
+            <div class="flex f-c " style="margin-bottom: 20px;"
+              v-for="(drvingListitem, drvingListindex) in CustomPlanData.drvingList" :key="drvingListindex">
+              <div class="flex a-c">
+                <span>座位数:</span>
+                <el-input-number size="small" style="width:150px; margin-bottom: 10px;" v-model="drvingListitem.seatNum"
+                  :min="1"></el-input-number>
+              </div>
+              <div class="flex j-start ">
+                <div class="Risk" style="margin-right: 30px;">
+                  <section class="flex j-s a-c ">
+                    <div class=" flex a-c">
+                      <span class="flex j-start">全部意外险</span>
                     </div>
-                    <span style="color: #2D4D89;cursor: pointer;" @click="Drivedetails(filteredInsureitem)">详情</span>
-                  </main>
+                    <span class="flex j-end">操作</span>
+                  </section>
+                  <div style="max-height: 400px;overflow-y: auto;">
+                    <main class="flex j-s a-c"
+                      v-for="(undrvingListitem, undrvingListindex) in drvingListitem.undrvingList"
+                      :key="undrvingListindex">
+                      <div class="flex f-c ">
+                        <div style="width: 100%;">
+                          <el-checkbox v-model="undrvingListitem.switch" style="margin-right: 20px;"></el-checkbox>
+                          <span>{{ undrvingListitem.projectName }}</span>
+                          <span style="color: #2D4D89;cursor: pointer;text-align: right;"
+                            @click="Drivedetails(undrvingListitem)">详情</span>
+                        </div>
+                        <template v-if="undrvingListitem.switch">
+                          <div v-for="(Insurancesitem, Insurancesindex) in undrvingListitem.insDrivingIntentionInsurances"
+                            class="p-1 flex a-c j-start" :key="Insurancesindex" style="width: 100%;margin-left: 40px;">
+                            <el-checkbox v-model="Insurancesitem.switch"
+                              @change="event => drvingcheckboxChange(event, drvingListindex, Insurancesitem)"
+                              style="margin-right: 20px;"></el-checkbox>
+                            <div>{{ Insurancesitem.projectName }}</div>
+                          </div>
+                        </template>
+                      </div>
+                    </main>
+                  </div>
                 </div>
-
-              </div>
-              <div class="Risk">
-                <section class="flex j-s a-c ">
-                  <div class=" flex a-c">
-                    <span class="flex j-start">已选意外险</span>
+                <div class="Risk">
+                  <section class="flex j-s a-c ">
+                    <div class=" flex a-c">
+                      <span class="flex j-start">已选意外险</span>
+                    </div>
+                    <span class="flex j-end">操作</span>
+                  </section>
+                  <div style="max-height: 400px;overflow-y: auto;">
+                    <main class="flex j-s a-c" v-for="(isOptionstitem, isOptionsindex) in drvingListitem.isOptions"
+                      :key="isOptionsindex">
+                      <div class="flex f-c " style="width: 100%;">
+                        <h5>{{ isOptionstitem.title }}</h5>
+                        <div class="flex a-c j-c">
+                          <span style="width: 50px;">别名: </span>
+                          <el-input v-model="isOptionstitem.projectName" size="small" clearable
+                            placeholder="请输入别名"></el-input>
+                        </div>
+                      </div>
+                    </main>
                   </div>
-                  <span class="flex j-end">操作</span>
-                </section>
-                <div style="max-height: 400px;overflow-y: auto;">
-                  <main class="flex j-s a-c"
-                    v-for="(drvingIntentionsListitem, fdrvingIntentionsListindex) in drvingIntentionsfilter"
-                    :key="fdrvingIntentionsListindex">
-                    <span>{{ drvingIntentionsListitem.projectName }}</span>
-                    <span class="flex j-end">
-                      <i class="el-icon-delete" style="font-size: 20px;"
-                        @click="InsureDel(drvingIntentionsListitem.id)"></i>
-                    </span>
-                  </main>
                 </div>
               </div>
             </div>
@@ -178,7 +199,6 @@ export default {
   },
   data() {
     return {
-      DriveSelectAll: false,
       customsolutionVisible: false,
       insDrivingIntentionInsuranceSondialogVisible: false,
       overSize: "small",
@@ -189,7 +209,11 @@ export default {
         schemeName: "自选方案",
         description: "",
         kinds: [],
-        drvingIntentions: [],
+        drvingList: [{
+          seatNum: 1,
+          undrvingList: [],
+          isOptions: []
+        }],
       },
       productsTypeoptions: [],
       companyId: "",
@@ -217,23 +241,36 @@ export default {
     this.getDicType("productsType"); //车险产品
     this.Insurance();
     this.drvingget();
-
   },
   // 方法函数
   methods: {
-    customsolutioncloseDialog() {
-      for (const key in this.CustomPlanData) {
-        if (key !== "companyId" && key !== 'kinds' && key !== 'schemeName') {
-          this.CustomPlanData[key] = "";
-        }
+    drvingcheckboxChange(e, drvingListindex, Insurancesitem) {
+      if (e) {
+        this.CustomPlanData.drvingList[drvingListindex].isOptions.push({
+          title: Insurancesitem.projectName,
+          id: Insurancesitem.id,//id
+          projectName: Insurancesitem.projectName,
+        })
+      } else {
+        let list = this.CustomPlanData.drvingList[drvingListindex].isOptions.filter(val => val.id !== Insurancesitem.id)
+        this.CustomPlanData.drvingList[drvingListindex].isOptions = list;
       }
-      this.CustomPlanData.kinds = JSON.parse(localStorage.getItem("InsuranceList"));
-      this.drvingIntentionsList = JSON.parse(localStorage.getItem("drvingIntentionsList"));
+    },
+    drvingadd() {
+      let list = JSON.parse(JSON.stringify(this.drvingIntentionsList));
+      this.CustomPlanData.drvingList.push({
+        seatNum: 1,
+        undrvingList: list,
+        isOptions: []
+      })
+    },
+    customsolutioncloseDialog() {
+      this.CustomPlanData = JSON.parse(localStorage.getItem("CustomPlanData"));
     },
     customsolutionUpdate({ row, column }) {
       this.customsolutionType = 'edit';
       this.customsolutionTitle = '自选方案修改';
-      this.$api.insCompany.optionalSchemeInfo(row.companyId, row.productId,'01',"A1","0").then((res) => {
+      this.$api.insCompany.optionalSchemeInfo(row.companyId, row.productId, "01", 'A1', '0').then((res) => {
         if (res.code == '200') {
           res.data.kinds.map(val => {
             if (val.amount.length > 0) {
@@ -253,13 +290,22 @@ export default {
             }
             return val;
           })
-          res.data.drvingIntentions.map(val => {
-            this.drvingIntentionsList.map(insureitem => {
-              if (val == insureitem.id) {
-                insureitem.switch = true;
-              }
-              return insureitem
-            });
+          res.data.drvingList.map(val => {
+            const list = val.isOptions.map(item => { return item.id });
+            val.undrvingList.map(undrvingList => {
+              undrvingList.switch = false;
+              undrvingList.insDrivingIntentionInsurances.map(Insurances => {
+                if (list.includes(Insurances.id)) {
+                  undrvingList.switch = true;
+                  Insurances.switch = true
+                } else {
+                  Insurances.switch = false;
+                }
+                return Insurances;
+              })
+              return undrvingList;
+            })
+            return val;
           })
           this.CustomPlanData = res.data;
           this.customsolutionVisible = true;
@@ -287,7 +333,7 @@ export default {
       });
     },
     customsolutionFindPage() {
-      this.$api.insCompany.optionalShcemeList({ companyId: this.companyId,carnature:"01", energyType:"0",vehicleType:"A1"}).then((res) => {
+      this.$api.insCompany.optionalShcemeList({ companyId: this.companyId, carnature: "01", vehicleType: "A1", energyType: "0" }).then((res) => {
         if (res.code == '200') {
           let pageList = {
             content: res.data,
@@ -302,15 +348,8 @@ export default {
       });
     },
     customsolutionSubmit() {
-      let list = [];
-      this.drvingIntentionsList.map(insureitem => {
-        if (insureitem.switch) {
-          list.push(insureitem.id)
-        }
-      });
-      this.CustomPlanData.drvingIntentions = list;
       if (this.customsolutionType == 'add') {
-        this.$api.insCompany.addOptionalScheme({...this.CustomPlanData,carnature:"01",vehicleType:"A1",energyType:"0"}).then((res) => {
+        this.$api.insCompany.addOptionalScheme({ ...this.CustomPlanData, carnature: "01", vehicleType: "A1", energyType: "0" }).then((res) => {
           if (res.code == '200') {
             this.$message({
               type: 'success',
@@ -326,7 +365,7 @@ export default {
           }
         });
       } else {
-        this.$api.insCompany.updateOptionalScheme({...this.CustomPlanData,carnature:"01",vehicleType:"A1",energyType:"0"}).then((res) => {
+        this.$api.insCompany.updateOptionalScheme({ ...this.CustomPlanData, carnature: "01", vehicleType: "A1", energyType: "0" }).then((res) => {
           if (res.code == '200') {
             this.$message({
               type: 'success',
@@ -344,19 +383,7 @@ export default {
       }
 
     },
-    DriveSelectAllInput(e) {
-      if (e) {
-        this.drvingIntentionsList.map(val => {
-          val.switch = true;
-          return val;
-        })
-      } else {
-        this.drvingIntentionsList.map(val => {
-          val.switch = false;
-          return val;
-        })
-      }
-    },
+
     InsureDel(id) {
       this.drvingIntentionsList.map(val => {
         if (val.id == id) {
@@ -372,11 +399,16 @@ export default {
         if (res.code == '200') {
           res.data.map(val => {
             val.switch = false;
+            val.insDrivingIntentionInsurances.map(val2 => {
+              val2.switch = false;
+              return val2;
+            })
             return val;
           })
           this.drvingIntentionsList = res.data;
           localStorage.setItem("drvingIntentionsList", JSON.stringify(this.drvingIntentionsList));
-
+          this.CustomPlanData.drvingList[0].undrvingList = JSON.parse(localStorage.getItem("drvingIntentionsList"));
+          localStorage.setItem("CustomPlanData", JSON.stringify(this.CustomPlanData));
         } else {
           this.$message({
             type: 'error',
@@ -442,9 +474,6 @@ export default {
     filteredInsureList() {
       return this.CustomPlanData.kinds.filter(insureitem => insureitem.switch);
     },
-    drvingIntentionsfilter() {
-      return this.drvingIntentionsList.filter(insureitem => insureitem.switch);
-    },
   }
 }
 </script>

+ 110 - 81
src/views/AgreementManage/InsuranceCompany/CargoTruck/BusinessOperation/NewEnergy/OptionalsolutionConfig.vue

@@ -97,46 +97,67 @@
           <div>
             <div class="flex j-s a-c">
               <h4>驾意险方案配置</h4>
+              <el-button type="primary" size="small" @click="drvingadd">新增</el-button>
             </div>
-            <div class="flex j-start ">
-              <div class="Risk" style="margin-right: 30px;">
-                <section class="flex j-s a-c ">
-                  <div class=" flex a-c">
-                    <el-checkbox v-model="DriveSelectAll" style="margin-right: 20px;"
-                      @input="DriveSelectAllInput"></el-checkbox>
-                    <span class="flex j-start">全部意外险</span>
-                  </div>
-                  <span class="flex j-end">操作</span>
-                </section>
-                <div style="max-height: 400px;overflow-y: auto;">
-                  <main class="flex j-s a-c" v-for="(filteredInsureitem, filteredInsureindex) in drvingIntentionsList"
-                    :key="filteredInsureindex">
-                    <div>
-                      <el-checkbox v-model="filteredInsureitem.switch" style="margin-right: 20px;"></el-checkbox>
-                      <span>{{ filteredInsureitem.projectName }}</span>
+            <div class="flex f-c " style="margin-bottom: 20px;"
+              v-for="(drvingListitem, drvingListindex) in CustomPlanData.drvingList" :key="drvingListindex">
+              <div class="flex a-c">
+                <span>座位数:</span>
+                <el-input-number size="small" style="width:150px; margin-bottom: 10px;" v-model="drvingListitem.seatNum"
+                  :min="1"></el-input-number>
+              </div>
+              <div class="flex j-start ">
+                <div class="Risk" style="margin-right: 30px;">
+                  <section class="flex j-s a-c ">
+                    <div class=" flex a-c">
+                      <span class="flex j-start">全部意外险</span>
                     </div>
-                    <span style="color: #2D4D89;cursor: pointer;" @click="Drivedetails(filteredInsureitem)">详情</span>
-                  </main>
+                    <span class="flex j-end">操作</span>
+                  </section>
+                  <div style="max-height: 400px;overflow-y: auto;">
+                    <main class="flex j-s a-c"
+                      v-for="(undrvingListitem, undrvingListindex) in drvingListitem.undrvingList"
+                      :key="undrvingListindex">
+                      <div class="flex f-c ">
+                        <div style="width: 100%;">
+                          <el-checkbox v-model="undrvingListitem.switch" style="margin-right: 20px;"></el-checkbox>
+                          <span>{{ undrvingListitem.projectName }}</span>
+                          <span style="color: #2D4D89;cursor: pointer;text-align: right;"
+                            @click="Drivedetails(undrvingListitem)">详情</span>
+                        </div>
+                        <template v-if="undrvingListitem.switch">
+                          <div v-for="(Insurancesitem, Insurancesindex) in undrvingListitem.insDrivingIntentionInsurances"
+                            class="p-1 flex a-c j-start" :key="Insurancesindex" style="width: 100%;margin-left: 40px;">
+                            <el-checkbox v-model="Insurancesitem.switch"
+                              @change="event => drvingcheckboxChange(event, drvingListindex, Insurancesitem)"
+                              style="margin-right: 20px;"></el-checkbox>
+                            <div>{{ Insurancesitem.projectName }}</div>
+                          </div>
+                        </template>
+                      </div>
+                    </main>
+                  </div>
                 </div>
-
-              </div>
-              <div class="Risk">
-                <section class="flex j-s a-c ">
-                  <div class=" flex a-c">
-                    <span class="flex j-start">已选意外险</span>
+                <div class="Risk">
+                  <section class="flex j-s a-c ">
+                    <div class=" flex a-c">
+                      <span class="flex j-start">已选意外险</span>
+                    </div>
+                    <span class="flex j-end">操作</span>
+                  </section>
+                  <div style="max-height: 400px;overflow-y: auto;">
+                    <main class="flex j-s a-c" v-for="(isOptionstitem, isOptionsindex) in drvingListitem.isOptions"
+                      :key="isOptionsindex">
+                      <div class="flex f-c " style="width: 100%;">
+                        <h5>{{ isOptionstitem.title }}</h5>
+                        <div class="flex a-c j-c">
+                          <span style="width: 50px;">别名: </span>
+                          <el-input v-model="isOptionstitem.projectName" size="small" clearable
+                            placeholder="请输入别名"></el-input>
+                        </div>
+                      </div>
+                    </main>
                   </div>
-                  <span class="flex j-end">操作</span>
-                </section>
-                <div style="max-height: 400px;overflow-y: auto;">
-                  <main class="flex j-s a-c"
-                    v-for="(drvingIntentionsListitem, fdrvingIntentionsListindex) in drvingIntentionsfilter"
-                    :key="fdrvingIntentionsListindex">
-                    <span>{{ drvingIntentionsListitem.projectName }}</span>
-                    <span class="flex j-end">
-                      <i class="el-icon-delete" style="font-size: 20px;"
-                        @click="InsureDel(drvingIntentionsListitem.id)"></i>
-                    </span>
-                  </main>
                 </div>
               </div>
             </div>
@@ -178,7 +199,6 @@ export default {
   },
   data() {
     return {
-      DriveSelectAll: false,
       customsolutionVisible: false,
       insDrivingIntentionInsuranceSondialogVisible: false,
       overSize: "small",
@@ -189,7 +209,11 @@ export default {
         schemeName: "自选方案",
         description: "",
         kinds: [],
-        drvingIntentions: [],
+        drvingList: [{
+          seatNum: 1,
+          undrvingList: [],
+          isOptions: []
+        }],
       },
       productsTypeoptions: [],
       companyId: "",
@@ -217,23 +241,36 @@ export default {
     this.getDicType("productsType"); //车险产品
     this.Insurance();
     this.drvingget();
-
   },
   // 方法函数
   methods: {
-    customsolutioncloseDialog() {
-      for (const key in this.CustomPlanData) {
-        if (key !== "companyId" && key !== 'kinds' && key !== 'schemeName') {
-          this.CustomPlanData[key] = "";
-        }
+    drvingcheckboxChange(e, drvingListindex, Insurancesitem) {
+      if (e) {
+        this.CustomPlanData.drvingList[drvingListindex].isOptions.push({
+          title: Insurancesitem.projectName,
+          id: Insurancesitem.id,//id
+          projectName: Insurancesitem.projectName,
+        })
+      } else {
+        let list = this.CustomPlanData.drvingList[drvingListindex].isOptions.filter(val => val.id !== Insurancesitem.id)
+        this.CustomPlanData.drvingList[drvingListindex].isOptions = list;
       }
-      this.CustomPlanData.kinds = JSON.parse(localStorage.getItem("InsuranceList"));
-      this.drvingIntentionsList = JSON.parse(localStorage.getItem("drvingIntentionsList"));
+    },
+    drvingadd() {
+      let list = JSON.parse(JSON.stringify(this.drvingIntentionsList));
+      this.CustomPlanData.drvingList.push({
+        seatNum: 1,
+        undrvingList: list,
+        isOptions: []
+      })
+    },
+    customsolutioncloseDialog() {
+      this.CustomPlanData = JSON.parse(localStorage.getItem("CustomPlanData"));
     },
     customsolutionUpdate({ row, column }) {
       this.customsolutionType = 'edit';
       this.customsolutionTitle = '自选方案修改';
-      this.$api.insCompany.optionalSchemeInfo(row.companyId, row.productId,'01','A1','1').then((res) => {
+      this.$api.insCompany.optionalSchemeInfo(row.companyId, row.productId, "01", 'A1', '1').then((res) => {
         if (res.code == '200') {
           res.data.kinds.map(val => {
             if (val.amount.length > 0) {
@@ -253,13 +290,22 @@ export default {
             }
             return val;
           })
-          res.data.drvingIntentions.map(val => {
-            this.drvingIntentionsList.map(insureitem => {
-              if (val == insureitem.id) {
-                insureitem.switch = true;
-              }
-              return insureitem
-            });
+          res.data.drvingList.map(val => {
+            const list = val.isOptions.map(item => { return item.id });
+            val.undrvingList.map(undrvingList => {
+              undrvingList.switch = false;
+              undrvingList.insDrivingIntentionInsurances.map(Insurances => {
+                if (list.includes(Insurances.id)) {
+                  undrvingList.switch = true;
+                  Insurances.switch = true
+                } else {
+                  Insurances.switch = false;
+                }
+                return Insurances;
+              })
+              return undrvingList;
+            })
+            return val;
           })
           this.CustomPlanData = res.data;
           this.customsolutionVisible = true;
@@ -287,7 +333,7 @@ export default {
       });
     },
     customsolutionFindPage() {
-      this.$api.insCompany.optionalShcemeList({ companyId: this.companyId,carnature:"01",vehicleType:"A1",energyType:"1" }).then((res) => {
+      this.$api.insCompany.optionalShcemeList({ companyId: this.companyId, carnature: "01", vehicleType: "A1", energyType: "1" }).then((res) => {
         if (res.code == '200') {
           let pageList = {
             content: res.data,
@@ -302,15 +348,8 @@ export default {
       });
     },
     customsolutionSubmit() {
-      let list = [];
-      this.drvingIntentionsList.map(insureitem => {
-        if (insureitem.switch) {
-          list.push(insureitem.id)
-        }
-      });
-      this.CustomPlanData.drvingIntentions = list;
       if (this.customsolutionType == 'add') {
-        this.$api.insCompany.addOptionalScheme({...this.CustomPlanData,carnature:"01",vehicleType:"A1",energyType:"1"}).then((res) => {
+        this.$api.insCompany.addOptionalScheme({ ...this.CustomPlanData, carnature: "01", vehicleType: "A1", energyType: "1" }).then((res) => {
           if (res.code == '200') {
             this.$message({
               type: 'success',
@@ -326,7 +365,7 @@ export default {
           }
         });
       } else {
-        this.$api.insCompany.updateOptionalScheme({...this.CustomPlanData,carnature:"01",vehicleType:"A1",energyType:"1"}).then((res) => {
+        this.$api.insCompany.updateOptionalScheme({ ...this.CustomPlanData, carnature: "01", vehicleType: "A1", energyType: "1" }).then((res) => {
           if (res.code == '200') {
             this.$message({
               type: 'success',
@@ -344,19 +383,7 @@ export default {
       }
 
     },
-    DriveSelectAllInput(e) {
-      if (e) {
-        this.drvingIntentionsList.map(val => {
-          val.switch = true;
-          return val;
-        })
-      } else {
-        this.drvingIntentionsList.map(val => {
-          val.switch = false;
-          return val;
-        })
-      }
-    },
+
     InsureDel(id) {
       this.drvingIntentionsList.map(val => {
         if (val.id == id) {
@@ -372,11 +399,16 @@ export default {
         if (res.code == '200') {
           res.data.map(val => {
             val.switch = false;
+            val.insDrivingIntentionInsurances.map(val2 => {
+              val2.switch = false;
+              return val2;
+            })
             return val;
           })
           this.drvingIntentionsList = res.data;
           localStorage.setItem("drvingIntentionsList", JSON.stringify(this.drvingIntentionsList));
-
+          this.CustomPlanData.drvingList[0].undrvingList = JSON.parse(localStorage.getItem("drvingIntentionsList"));
+          localStorage.setItem("CustomPlanData", JSON.stringify(this.CustomPlanData));
         } else {
           this.$message({
             type: 'error',
@@ -442,9 +474,6 @@ export default {
     filteredInsureList() {
       return this.CustomPlanData.kinds.filter(insureitem => insureitem.switch);
     },
-    drvingIntentionsfilter() {
-      return this.drvingIntentionsList.filter(insureitem => insureitem.switch);
-    },
   }
 }
 </script>

+ 110 - 81
src/views/AgreementManage/InsuranceCompany/CargoTruck/NonBusiness/Fuel/OptionalsolutionConfig.vue

@@ -97,46 +97,67 @@
           <div>
             <div class="flex j-s a-c">
               <h4>驾意险方案配置</h4>
+              <el-button type="primary" size="small" @click="drvingadd">新增</el-button>
             </div>
-            <div class="flex j-start ">
-              <div class="Risk" style="margin-right: 30px;">
-                <section class="flex j-s a-c ">
-                  <div class=" flex a-c">
-                    <el-checkbox v-model="DriveSelectAll" style="margin-right: 20px;"
-                      @input="DriveSelectAllInput"></el-checkbox>
-                    <span class="flex j-start">全部意外险</span>
-                  </div>
-                  <span class="flex j-end">操作</span>
-                </section>
-                <div style="max-height: 400px;overflow-y: auto;">
-                  <main class="flex j-s a-c" v-for="(filteredInsureitem, filteredInsureindex) in drvingIntentionsList"
-                    :key="filteredInsureindex">
-                    <div>
-                      <el-checkbox v-model="filteredInsureitem.switch" style="margin-right: 20px;"></el-checkbox>
-                      <span>{{ filteredInsureitem.projectName }}</span>
+            <div class="flex f-c " style="margin-bottom: 20px;"
+              v-for="(drvingListitem, drvingListindex) in CustomPlanData.drvingList" :key="drvingListindex">
+              <div class="flex a-c">
+                <span>座位数:</span>
+                <el-input-number size="small" style="width:150px; margin-bottom: 10px;" v-model="drvingListitem.seatNum"
+                  :min="1"></el-input-number>
+              </div>
+              <div class="flex j-start ">
+                <div class="Risk" style="margin-right: 30px;">
+                  <section class="flex j-s a-c ">
+                    <div class=" flex a-c">
+                      <span class="flex j-start">全部意外险</span>
                     </div>
-                    <span style="color: #2D4D89;cursor: pointer;" @click="Drivedetails(filteredInsureitem)">详情</span>
-                  </main>
+                    <span class="flex j-end">操作</span>
+                  </section>
+                  <div style="max-height: 400px;overflow-y: auto;">
+                    <main class="flex j-s a-c"
+                      v-for="(undrvingListitem, undrvingListindex) in drvingListitem.undrvingList"
+                      :key="undrvingListindex">
+                      <div class="flex f-c ">
+                        <div style="width: 100%;">
+                          <el-checkbox v-model="undrvingListitem.switch" style="margin-right: 20px;"></el-checkbox>
+                          <span>{{ undrvingListitem.projectName }}</span>
+                          <span style="color: #2D4D89;cursor: pointer;text-align: right;"
+                            @click="Drivedetails(undrvingListitem)">详情</span>
+                        </div>
+                        <template v-if="undrvingListitem.switch">
+                          <div v-for="(Insurancesitem, Insurancesindex) in undrvingListitem.insDrivingIntentionInsurances"
+                            class="p-1 flex a-c j-start" :key="Insurancesindex" style="width: 100%;margin-left: 40px;">
+                            <el-checkbox v-model="Insurancesitem.switch"
+                              @change="event => drvingcheckboxChange(event, drvingListindex, Insurancesitem)"
+                              style="margin-right: 20px;"></el-checkbox>
+                            <div>{{ Insurancesitem.projectName }}</div>
+                          </div>
+                        </template>
+                      </div>
+                    </main>
+                  </div>
                 </div>
-
-              </div>
-              <div class="Risk">
-                <section class="flex j-s a-c ">
-                  <div class=" flex a-c">
-                    <span class="flex j-start">已选意外险</span>
+                <div class="Risk">
+                  <section class="flex j-s a-c ">
+                    <div class=" flex a-c">
+                      <span class="flex j-start">已选意外险</span>
+                    </div>
+                    <span class="flex j-end">操作</span>
+                  </section>
+                  <div style="max-height: 400px;overflow-y: auto;">
+                    <main class="flex j-s a-c" v-for="(isOptionstitem, isOptionsindex) in drvingListitem.isOptions"
+                      :key="isOptionsindex">
+                      <div class="flex f-c " style="width: 100%;">
+                        <h5>{{ isOptionstitem.title }}</h5>
+                        <div class="flex a-c j-c">
+                          <span style="width: 50px;">别名: </span>
+                          <el-input v-model="isOptionstitem.projectName" size="small" clearable
+                            placeholder="请输入别名"></el-input>
+                        </div>
+                      </div>
+                    </main>
                   </div>
-                  <span class="flex j-end">操作</span>
-                </section>
-                <div style="max-height: 400px;overflow-y: auto;">
-                  <main class="flex j-s a-c"
-                    v-for="(drvingIntentionsListitem, fdrvingIntentionsListindex) in drvingIntentionsfilter"
-                    :key="fdrvingIntentionsListindex">
-                    <span>{{ drvingIntentionsListitem.projectName }}</span>
-                    <span class="flex j-end">
-                      <i class="el-icon-delete" style="font-size: 20px;"
-                        @click="InsureDel(drvingIntentionsListitem.id)"></i>
-                    </span>
-                  </main>
                 </div>
               </div>
             </div>
@@ -178,7 +199,6 @@ export default {
   },
   data() {
     return {
-      DriveSelectAll: false,
       customsolutionVisible: false,
       insDrivingIntentionInsuranceSondialogVisible: false,
       overSize: "small",
@@ -189,7 +209,11 @@ export default {
         schemeName: "自选方案",
         description: "",
         kinds: [],
-        drvingIntentions: [],
+        drvingList: [{
+          seatNum: 1,
+          undrvingList: [],
+          isOptions: []
+        }],
       },
       productsTypeoptions: [],
       companyId: "",
@@ -217,23 +241,36 @@ export default {
     this.getDicType("productsType"); //车险产品
     this.Insurance();
     this.drvingget();
-
   },
   // 方法函数
   methods: {
-    customsolutioncloseDialog() {
-      for (const key in this.CustomPlanData) {
-        if (key !== "companyId" && key !== 'kinds' && key !== 'schemeName') {
-          this.CustomPlanData[key] = "";
-        }
+    drvingcheckboxChange(e, drvingListindex, Insurancesitem) {
+      if (e) {
+        this.CustomPlanData.drvingList[drvingListindex].isOptions.push({
+          title: Insurancesitem.projectName,
+          id: Insurancesitem.id,//id
+          projectName: Insurancesitem.projectName,
+        })
+      } else {
+        let list = this.CustomPlanData.drvingList[drvingListindex].isOptions.filter(val => val.id !== Insurancesitem.id)
+        this.CustomPlanData.drvingList[drvingListindex].isOptions = list;
       }
-      this.CustomPlanData.kinds = JSON.parse(localStorage.getItem("InsuranceList"));
-      this.drvingIntentionsList = JSON.parse(localStorage.getItem("drvingIntentionsList"));
+    },
+    drvingadd() {
+      let list = JSON.parse(JSON.stringify(this.drvingIntentionsList));
+      this.CustomPlanData.drvingList.push({
+        seatNum: 1,
+        undrvingList: list,
+        isOptions: []
+      })
+    },
+    customsolutioncloseDialog() {
+      this.CustomPlanData = JSON.parse(localStorage.getItem("CustomPlanData"));
     },
     customsolutionUpdate({ row, column }) {
       this.customsolutionType = 'edit';
       this.customsolutionTitle = '自选方案修改';
-      this.$api.insCompany.optionalSchemeInfo(row.companyId, row.productId,"02","A1","0").then((res) => {
+      this.$api.insCompany.optionalSchemeInfo(row.companyId, row.productId, "02", 'A1', '0').then((res) => {
         if (res.code == '200') {
           res.data.kinds.map(val => {
             if (val.amount.length > 0) {
@@ -253,13 +290,22 @@ export default {
             }
             return val;
           })
-          res.data.drvingIntentions.map(val => {
-            this.drvingIntentionsList.map(insureitem => {
-              if (val == insureitem.id) {
-                insureitem.switch = true;
-              }
-              return insureitem
-            });
+          res.data.drvingList.map(val => {
+            const list = val.isOptions.map(item => { return item.id });
+            val.undrvingList.map(undrvingList => {
+              undrvingList.switch = false;
+              undrvingList.insDrivingIntentionInsurances.map(Insurances => {
+                if (list.includes(Insurances.id)) {
+                  undrvingList.switch = true;
+                  Insurances.switch = true
+                } else {
+                  Insurances.switch = false;
+                }
+                return Insurances;
+              })
+              return undrvingList;
+            })
+            return val;
           })
           this.CustomPlanData = res.data;
           this.customsolutionVisible = true;
@@ -287,7 +333,7 @@ export default {
       });
     },
     customsolutionFindPage() {
-      this.$api.insCompany.optionalShcemeList({ companyId: this.companyId,carnature:"02", energyType:"0",vehicleType:"A1"}).then((res) => {
+      this.$api.insCompany.optionalShcemeList({ companyId: this.companyId, carnature: "02", vehicleType: "A1", energyType: "0" }).then((res) => {
         if (res.code == '200') {
           let pageList = {
             content: res.data,
@@ -302,15 +348,8 @@ export default {
       });
     },
     customsolutionSubmit() {
-      let list = [];
-      this.drvingIntentionsList.map(insureitem => {
-        if (insureitem.switch) {
-          list.push(insureitem.id)
-        }
-      });
-      this.CustomPlanData.drvingIntentions = list;
       if (this.customsolutionType == 'add') {
-        this.$api.insCompany.addOptionalScheme({...this.CustomPlanData,carnature:"02",vehicleType:"A1",energyType:"0"}).then((res) => {
+        this.$api.insCompany.addOptionalScheme({ ...this.CustomPlanData, carnature: "02", vehicleType: "A1", energyType: "0" }).then((res) => {
           if (res.code == '200') {
             this.$message({
               type: 'success',
@@ -326,7 +365,7 @@ export default {
           }
         });
       } else {
-        this.$api.insCompany.updateOptionalScheme({...this.CustomPlanData,carnature:"02",vehicleType:"A1",energyType:"0"}).then((res) => {
+        this.$api.insCompany.updateOptionalScheme({ ...this.CustomPlanData, carnature: "02", vehicleType: "A1", energyType: "0" }).then((res) => {
           if (res.code == '200') {
             this.$message({
               type: 'success',
@@ -344,19 +383,7 @@ export default {
       }
 
     },
-    DriveSelectAllInput(e) {
-      if (e) {
-        this.drvingIntentionsList.map(val => {
-          val.switch = true;
-          return val;
-        })
-      } else {
-        this.drvingIntentionsList.map(val => {
-          val.switch = false;
-          return val;
-        })
-      }
-    },
+
     InsureDel(id) {
       this.drvingIntentionsList.map(val => {
         if (val.id == id) {
@@ -372,11 +399,16 @@ export default {
         if (res.code == '200') {
           res.data.map(val => {
             val.switch = false;
+            val.insDrivingIntentionInsurances.map(val2 => {
+              val2.switch = false;
+              return val2;
+            })
             return val;
           })
           this.drvingIntentionsList = res.data;
           localStorage.setItem("drvingIntentionsList", JSON.stringify(this.drvingIntentionsList));
-
+          this.CustomPlanData.drvingList[0].undrvingList = JSON.parse(localStorage.getItem("drvingIntentionsList"));
+          localStorage.setItem("CustomPlanData", JSON.stringify(this.CustomPlanData));
         } else {
           this.$message({
             type: 'error',
@@ -442,9 +474,6 @@ export default {
     filteredInsureList() {
       return this.CustomPlanData.kinds.filter(insureitem => insureitem.switch);
     },
-    drvingIntentionsfilter() {
-      return this.drvingIntentionsList.filter(insureitem => insureitem.switch);
-    },
   }
 }
 </script>

+ 110 - 81
src/views/AgreementManage/InsuranceCompany/CargoTruck/NonBusiness/NewEnergy/OptionalsolutionConfig.vue

@@ -97,46 +97,67 @@
           <div>
             <div class="flex j-s a-c">
               <h4>驾意险方案配置</h4>
+              <el-button type="primary" size="small" @click="drvingadd">新增</el-button>
             </div>
-            <div class="flex j-start ">
-              <div class="Risk" style="margin-right: 30px;">
-                <section class="flex j-s a-c ">
-                  <div class=" flex a-c">
-                    <el-checkbox v-model="DriveSelectAll" style="margin-right: 20px;"
-                      @input="DriveSelectAllInput"></el-checkbox>
-                    <span class="flex j-start">全部意外险</span>
-                  </div>
-                  <span class="flex j-end">操作</span>
-                </section>
-                <div style="max-height: 400px;overflow-y: auto;">
-                  <main class="flex j-s a-c" v-for="(filteredInsureitem, filteredInsureindex) in drvingIntentionsList"
-                    :key="filteredInsureindex">
-                    <div>
-                      <el-checkbox v-model="filteredInsureitem.switch" style="margin-right: 20px;"></el-checkbox>
-                      <span>{{ filteredInsureitem.projectName }}</span>
+            <div class="flex f-c " style="margin-bottom: 20px;"
+              v-for="(drvingListitem, drvingListindex) in CustomPlanData.drvingList" :key="drvingListindex">
+              <div class="flex a-c">
+                <span>座位数:</span>
+                <el-input-number size="small" style="width:150px; margin-bottom: 10px;" v-model="drvingListitem.seatNum"
+                  :min="1"></el-input-number>
+              </div>
+              <div class="flex j-start ">
+                <div class="Risk" style="margin-right: 30px;">
+                  <section class="flex j-s a-c ">
+                    <div class=" flex a-c">
+                      <span class="flex j-start">全部意外险</span>
                     </div>
-                    <span style="color: #2D4D89;cursor: pointer;" @click="Drivedetails(filteredInsureitem)">详情</span>
-                  </main>
+                    <span class="flex j-end">操作</span>
+                  </section>
+                  <div style="max-height: 400px;overflow-y: auto;">
+                    <main class="flex j-s a-c"
+                      v-for="(undrvingListitem, undrvingListindex) in drvingListitem.undrvingList"
+                      :key="undrvingListindex">
+                      <div class="flex f-c ">
+                        <div style="width: 100%;">
+                          <el-checkbox v-model="undrvingListitem.switch" style="margin-right: 20px;"></el-checkbox>
+                          <span>{{ undrvingListitem.projectName }}</span>
+                          <span style="color: #2D4D89;cursor: pointer;text-align: right;"
+                            @click="Drivedetails(undrvingListitem)">详情</span>
+                        </div>
+                        <template v-if="undrvingListitem.switch">
+                          <div v-for="(Insurancesitem, Insurancesindex) in undrvingListitem.insDrivingIntentionInsurances"
+                            class="p-1 flex a-c j-start" :key="Insurancesindex" style="width: 100%;margin-left: 40px;">
+                            <el-checkbox v-model="Insurancesitem.switch"
+                              @change="event => drvingcheckboxChange(event, drvingListindex, Insurancesitem)"
+                              style="margin-right: 20px;"></el-checkbox>
+                            <div>{{ Insurancesitem.projectName }}</div>
+                          </div>
+                        </template>
+                      </div>
+                    </main>
+                  </div>
                 </div>
-
-              </div>
-              <div class="Risk">
-                <section class="flex j-s a-c ">
-                  <div class=" flex a-c">
-                    <span class="flex j-start">已选意外险</span>
+                <div class="Risk">
+                  <section class="flex j-s a-c ">
+                    <div class=" flex a-c">
+                      <span class="flex j-start">已选意外险</span>
+                    </div>
+                    <span class="flex j-end">操作</span>
+                  </section>
+                  <div style="max-height: 400px;overflow-y: auto;">
+                    <main class="flex j-s a-c" v-for="(isOptionstitem, isOptionsindex) in drvingListitem.isOptions"
+                      :key="isOptionsindex">
+                      <div class="flex f-c " style="width: 100%;">
+                        <h5>{{ isOptionstitem.title }}</h5>
+                        <div class="flex a-c j-c">
+                          <span style="width: 50px;">别名: </span>
+                          <el-input v-model="isOptionstitem.projectName" size="small" clearable
+                            placeholder="请输入别名"></el-input>
+                        </div>
+                      </div>
+                    </main>
                   </div>
-                  <span class="flex j-end">操作</span>
-                </section>
-                <div style="max-height: 400px;overflow-y: auto;">
-                  <main class="flex j-s a-c"
-                    v-for="(drvingIntentionsListitem, fdrvingIntentionsListindex) in drvingIntentionsfilter"
-                    :key="fdrvingIntentionsListindex">
-                    <span>{{ drvingIntentionsListitem.projectName }}</span>
-                    <span class="flex j-end">
-                      <i class="el-icon-delete" style="font-size: 20px;"
-                        @click="InsureDel(drvingIntentionsListitem.id)"></i>
-                    </span>
-                  </main>
                 </div>
               </div>
             </div>
@@ -178,7 +199,6 @@ export default {
   },
   data() {
     return {
-      DriveSelectAll: false,
       customsolutionVisible: false,
       insDrivingIntentionInsuranceSondialogVisible: false,
       overSize: "small",
@@ -189,7 +209,11 @@ export default {
         schemeName: "自选方案",
         description: "",
         kinds: [],
-        drvingIntentions: [],
+        drvingList: [{
+          seatNum: 1,
+          undrvingList: [],
+          isOptions: []
+        }],
       },
       productsTypeoptions: [],
       companyId: "",
@@ -217,23 +241,36 @@ export default {
     this.getDicType("productsType"); //车险产品
     this.Insurance();
     this.drvingget();
-
   },
   // 方法函数
   methods: {
-    customsolutioncloseDialog() {
-      for (const key in this.CustomPlanData) {
-        if (key !== "companyId" && key !== 'kinds' && key !== 'schemeName') {
-          this.CustomPlanData[key] = "";
-        }
+    drvingcheckboxChange(e, drvingListindex, Insurancesitem) {
+      if (e) {
+        this.CustomPlanData.drvingList[drvingListindex].isOptions.push({
+          title: Insurancesitem.projectName,
+          id: Insurancesitem.id,//id
+          projectName: Insurancesitem.projectName,
+        })
+      } else {
+        let list = this.CustomPlanData.drvingList[drvingListindex].isOptions.filter(val => val.id !== Insurancesitem.id)
+        this.CustomPlanData.drvingList[drvingListindex].isOptions = list;
       }
-      this.CustomPlanData.kinds = JSON.parse(localStorage.getItem("InsuranceList"));
-      this.drvingIntentionsList = JSON.parse(localStorage.getItem("drvingIntentionsList"));
+    },
+    drvingadd() {
+      let list = JSON.parse(JSON.stringify(this.drvingIntentionsList));
+      this.CustomPlanData.drvingList.push({
+        seatNum: 1,
+        undrvingList: list,
+        isOptions: []
+      })
+    },
+    customsolutioncloseDialog() {
+      this.CustomPlanData = JSON.parse(localStorage.getItem("CustomPlanData"));
     },
     customsolutionUpdate({ row, column }) {
       this.customsolutionType = 'edit';
       this.customsolutionTitle = '自选方案修改';
-      this.$api.insCompany.optionalSchemeInfo(row.companyId, row.productId,"02",'A1','1').then((res) => {
+      this.$api.insCompany.optionalSchemeInfo(row.companyId, row.productId, "02", 'A1', '1').then((res) => {
         if (res.code == '200') {
           res.data.kinds.map(val => {
             if (val.amount.length > 0) {
@@ -253,13 +290,22 @@ export default {
             }
             return val;
           })
-          res.data.drvingIntentions.map(val => {
-            this.drvingIntentionsList.map(insureitem => {
-              if (val == insureitem.id) {
-                insureitem.switch = true;
-              }
-              return insureitem
-            });
+          res.data.drvingList.map(val => {
+            const list = val.isOptions.map(item => { return item.id });
+            val.undrvingList.map(undrvingList => {
+              undrvingList.switch = false;
+              undrvingList.insDrivingIntentionInsurances.map(Insurances => {
+                if (list.includes(Insurances.id)) {
+                  undrvingList.switch = true;
+                  Insurances.switch = true
+                } else {
+                  Insurances.switch = false;
+                }
+                return Insurances;
+              })
+              return undrvingList;
+            })
+            return val;
           })
           this.CustomPlanData = res.data;
           this.customsolutionVisible = true;
@@ -287,7 +333,7 @@ export default {
       });
     },
     customsolutionFindPage() {
-      this.$api.insCompany.optionalShcemeList({ companyId: this.companyId,carnature:"02",vehicleType:"A1",energyType:"1" }).then((res) => {
+      this.$api.insCompany.optionalShcemeList({ companyId: this.companyId, carnature: "02", vehicleType: "A1", energyType: "1" }).then((res) => {
         if (res.code == '200') {
           let pageList = {
             content: res.data,
@@ -302,15 +348,8 @@ export default {
       });
     },
     customsolutionSubmit() {
-      let list = [];
-      this.drvingIntentionsList.map(insureitem => {
-        if (insureitem.switch) {
-          list.push(insureitem.id)
-        }
-      });
-      this.CustomPlanData.drvingIntentions = list;
       if (this.customsolutionType == 'add') {
-        this.$api.insCompany.addOptionalScheme({...this.CustomPlanData,carnature:"02",vehicleType:"A1",energyType:"1"}).then((res) => {
+        this.$api.insCompany.addOptionalScheme({ ...this.CustomPlanData, carnature: "02", vehicleType: "A1", energyType: "1" }).then((res) => {
           if (res.code == '200') {
             this.$message({
               type: 'success',
@@ -326,7 +365,7 @@ export default {
           }
         });
       } else {
-        this.$api.insCompany.updateOptionalScheme({...this.CustomPlanData,carnature:"02",vehicleType:"A1",energyType:"1"}).then((res) => {
+        this.$api.insCompany.updateOptionalScheme({ ...this.CustomPlanData, carnature: "02", vehicleType: "A1", energyType: "1" }).then((res) => {
           if (res.code == '200') {
             this.$message({
               type: 'success',
@@ -344,19 +383,7 @@ export default {
       }
 
     },
-    DriveSelectAllInput(e) {
-      if (e) {
-        this.drvingIntentionsList.map(val => {
-          val.switch = true;
-          return val;
-        })
-      } else {
-        this.drvingIntentionsList.map(val => {
-          val.switch = false;
-          return val;
-        })
-      }
-    },
+
     InsureDel(id) {
       this.drvingIntentionsList.map(val => {
         if (val.id == id) {
@@ -372,11 +399,16 @@ export default {
         if (res.code == '200') {
           res.data.map(val => {
             val.switch = false;
+            val.insDrivingIntentionInsurances.map(val2 => {
+              val2.switch = false;
+              return val2;
+            })
             return val;
           })
           this.drvingIntentionsList = res.data;
           localStorage.setItem("drvingIntentionsList", JSON.stringify(this.drvingIntentionsList));
-
+          this.CustomPlanData.drvingList[0].undrvingList = JSON.parse(localStorage.getItem("drvingIntentionsList"));
+          localStorage.setItem("CustomPlanData", JSON.stringify(this.CustomPlanData));
         } else {
           this.$message({
             type: 'error',
@@ -442,9 +474,6 @@ export default {
     filteredInsureList() {
       return this.CustomPlanData.kinds.filter(insureitem => insureitem.switch);
     },
-    drvingIntentionsfilter() {
-      return this.drvingIntentionsList.filter(insureitem => insureitem.switch);
-    },
   }
 }
 </script>

+ 110 - 81
src/views/AgreementManage/InsuranceCompany/PassengerBus/BusinessOperation/Fuel/OptionalsolutionConfig.vue

@@ -97,46 +97,67 @@
           <div>
             <div class="flex j-s a-c">
               <h4>驾意险方案配置</h4>
+              <el-button type="primary" size="small" @click="drvingadd">新增</el-button>
             </div>
-            <div class="flex j-start ">
-              <div class="Risk" style="margin-right: 30px;">
-                <section class="flex j-s a-c ">
-                  <div class=" flex a-c">
-                    <el-checkbox v-model="DriveSelectAll" style="margin-right: 20px;"
-                      @input="DriveSelectAllInput"></el-checkbox>
-                    <span class="flex j-start">全部意外险</span>
-                  </div>
-                  <span class="flex j-end">操作</span>
-                </section>
-                <div style="max-height: 400px;overflow-y: auto;">
-                  <main class="flex j-s a-c" v-for="(filteredInsureitem, filteredInsureindex) in drvingIntentionsList"
-                    :key="filteredInsureindex">
-                    <div>
-                      <el-checkbox v-model="filteredInsureitem.switch" style="margin-right: 20px;"></el-checkbox>
-                      <span>{{ filteredInsureitem.projectName }}</span>
+            <div class="flex f-c " style="margin-bottom: 20px;"
+              v-for="(drvingListitem, drvingListindex) in CustomPlanData.drvingList" :key="drvingListindex">
+              <div class="flex a-c">
+                <span>座位数:</span>
+                <el-input-number size="small" style="width:150px; margin-bottom: 10px;" v-model="drvingListitem.seatNum"
+                  :min="1"></el-input-number>
+              </div>
+              <div class="flex j-start ">
+                <div class="Risk" style="margin-right: 30px;">
+                  <section class="flex j-s a-c ">
+                    <div class=" flex a-c">
+                      <span class="flex j-start">全部意外险</span>
                     </div>
-                    <span style="color: #2D4D89;cursor: pointer;" @click="Drivedetails(filteredInsureitem)">详情</span>
-                  </main>
+                    <span class="flex j-end">操作</span>
+                  </section>
+                  <div style="max-height: 400px;overflow-y: auto;">
+                    <main class="flex j-s a-c"
+                      v-for="(undrvingListitem, undrvingListindex) in drvingListitem.undrvingList"
+                      :key="undrvingListindex">
+                      <div class="flex f-c ">
+                        <div style="width: 100%;">
+                          <el-checkbox v-model="undrvingListitem.switch" style="margin-right: 20px;"></el-checkbox>
+                          <span>{{ undrvingListitem.projectName }}</span>
+                          <span style="color: #2D4D89;cursor: pointer;text-align: right;"
+                            @click="Drivedetails(undrvingListitem)">详情</span>
+                        </div>
+                        <template v-if="undrvingListitem.switch">
+                          <div v-for="(Insurancesitem, Insurancesindex) in undrvingListitem.insDrivingIntentionInsurances"
+                            class="p-1 flex a-c j-start" :key="Insurancesindex" style="width: 100%;margin-left: 40px;">
+                            <el-checkbox v-model="Insurancesitem.switch"
+                              @change="event => drvingcheckboxChange(event, drvingListindex, Insurancesitem)"
+                              style="margin-right: 20px;"></el-checkbox>
+                            <div>{{ Insurancesitem.projectName }}</div>
+                          </div>
+                        </template>
+                      </div>
+                    </main>
+                  </div>
                 </div>
-
-              </div>
-              <div class="Risk">
-                <section class="flex j-s a-c ">
-                  <div class=" flex a-c">
-                    <span class="flex j-start">已选意外险</span>
+                <div class="Risk">
+                  <section class="flex j-s a-c ">
+                    <div class=" flex a-c">
+                      <span class="flex j-start">已选意外险</span>
+                    </div>
+                    <span class="flex j-end">操作</span>
+                  </section>
+                  <div style="max-height: 400px;overflow-y: auto;">
+                    <main class="flex j-s a-c" v-for="(isOptionstitem, isOptionsindex) in drvingListitem.isOptions"
+                      :key="isOptionsindex">
+                      <div class="flex f-c " style="width: 100%;">
+                        <h5>{{ isOptionstitem.title }}</h5>
+                        <div class="flex a-c j-c">
+                          <span style="width: 50px;">别名: </span>
+                          <el-input v-model="isOptionstitem.projectName" size="small" clearable
+                            placeholder="请输入别名"></el-input>
+                        </div>
+                      </div>
+                    </main>
                   </div>
-                  <span class="flex j-end">操作</span>
-                </section>
-                <div style="max-height: 400px;overflow-y: auto;">
-                  <main class="flex j-s a-c"
-                    v-for="(drvingIntentionsListitem, fdrvingIntentionsListindex) in drvingIntentionsfilter"
-                    :key="fdrvingIntentionsListindex">
-                    <span>{{ drvingIntentionsListitem.projectName }}</span>
-                    <span class="flex j-end">
-                      <i class="el-icon-delete" style="font-size: 20px;"
-                        @click="InsureDel(drvingIntentionsListitem.id)"></i>
-                    </span>
-                  </main>
                 </div>
               </div>
             </div>
@@ -178,7 +199,6 @@ export default {
   },
   data() {
     return {
-      DriveSelectAll: false,
       customsolutionVisible: false,
       insDrivingIntentionInsuranceSondialogVisible: false,
       overSize: "small",
@@ -189,7 +209,11 @@ export default {
         schemeName: "自选方案",
         description: "",
         kinds: [],
-        drvingIntentions: [],
+        drvingList: [{
+          seatNum: 1,
+          undrvingList: [],
+          isOptions: []
+        }],
       },
       productsTypeoptions: [],
       companyId: "",
@@ -217,23 +241,36 @@ export default {
     this.getDicType("productsType"); //车险产品
     this.Insurance();
     this.drvingget();
-
   },
   // 方法函数
   methods: {
-    customsolutioncloseDialog() {
-      for (const key in this.CustomPlanData) {
-        if (key !== "companyId" && key !== 'kinds' && key !== 'schemeName') {
-          this.CustomPlanData[key] = "";
-        }
+    drvingcheckboxChange(e, drvingListindex, Insurancesitem) {
+      if (e) {
+        this.CustomPlanData.drvingList[drvingListindex].isOptions.push({
+          title: Insurancesitem.projectName,
+          id: Insurancesitem.id,//id
+          projectName: Insurancesitem.projectName,
+        })
+      } else {
+        let list = this.CustomPlanData.drvingList[drvingListindex].isOptions.filter(val => val.id !== Insurancesitem.id)
+        this.CustomPlanData.drvingList[drvingListindex].isOptions = list;
       }
-      this.CustomPlanData.kinds = JSON.parse(localStorage.getItem("InsuranceList"));
-      this.drvingIntentionsList = JSON.parse(localStorage.getItem("drvingIntentionsList"));
+    },
+    drvingadd() {
+      let list = JSON.parse(JSON.stringify(this.drvingIntentionsList));
+      this.CustomPlanData.drvingList.push({
+        seatNum: 1,
+        undrvingList: list,
+        isOptions: []
+      })
+    },
+    customsolutioncloseDialog() {
+      this.CustomPlanData = JSON.parse(localStorage.getItem("CustomPlanData"));
     },
     customsolutionUpdate({ row, column }) {
       this.customsolutionType = 'edit';
       this.customsolutionTitle = '自选方案修改';
-      this.$api.insCompany.optionalSchemeInfo(row.companyId, row.productId,"01",'A0','0').then((res) => {
+      this.$api.insCompany.optionalSchemeInfo(row.companyId, row.productId, "01", 'A0', '0').then((res) => {
         if (res.code == '200') {
           res.data.kinds.map(val => {
             if (val.amount.length > 0) {
@@ -253,13 +290,22 @@ export default {
             }
             return val;
           })
-          res.data.drvingIntentions.map(val => {
-            this.drvingIntentionsList.map(insureitem => {
-              if (val == insureitem.id) {
-                insureitem.switch = true;
-              }
-              return insureitem
-            });
+          res.data.drvingList.map(val => {
+            const list = val.isOptions.map(item => { return item.id });
+            val.undrvingList.map(undrvingList => {
+              undrvingList.switch = false;
+              undrvingList.insDrivingIntentionInsurances.map(Insurances => {
+                if (list.includes(Insurances.id)) {
+                  undrvingList.switch = true;
+                  Insurances.switch = true
+                } else {
+                  Insurances.switch = false;
+                }
+                return Insurances;
+              })
+              return undrvingList;
+            })
+            return val;
           })
           this.CustomPlanData = res.data;
           this.customsolutionVisible = true;
@@ -287,7 +333,7 @@ export default {
       });
     },
     customsolutionFindPage() {
-      this.$api.insCompany.optionalShcemeList({ companyId: this.companyId,carnature:"01",vehicleType:"A0",energyType:"0" }).then((res) => {
+      this.$api.insCompany.optionalShcemeList({ companyId: this.companyId, carnature: "01", vehicleType: "A0", energyType: "0" }).then((res) => {
         if (res.code == '200') {
           let pageList = {
             content: res.data,
@@ -302,15 +348,8 @@ export default {
       });
     },
     customsolutionSubmit() {
-      let list = [];
-      this.drvingIntentionsList.map(insureitem => {
-        if (insureitem.switch) {
-          list.push(insureitem.id)
-        }
-      });
-      this.CustomPlanData.drvingIntentions = list;
       if (this.customsolutionType == 'add') {
-        this.$api.insCompany.addOptionalScheme({...this.CustomPlanData,carnature:"01",vehicleType:"A0",energyType:"0"}).then((res) => {
+        this.$api.insCompany.addOptionalScheme({ ...this.CustomPlanData, carnature: "01", vehicleType: "A0", energyType: "0" }).then((res) => {
           if (res.code == '200') {
             this.$message({
               type: 'success',
@@ -326,7 +365,7 @@ export default {
           }
         });
       } else {
-        this.$api.insCompany.updateOptionalScheme({...this.CustomPlanData,carnature:"01",vehicleType:"A0",energyType:"0"}).then((res) => {
+        this.$api.insCompany.updateOptionalScheme({ ...this.CustomPlanData, carnature: "01", vehicleType: "A0", energyType: "0" }).then((res) => {
           if (res.code == '200') {
             this.$message({
               type: 'success',
@@ -344,19 +383,7 @@ export default {
       }
 
     },
-    DriveSelectAllInput(e) {
-      if (e) {
-        this.drvingIntentionsList.map(val => {
-          val.switch = true;
-          return val;
-        })
-      } else {
-        this.drvingIntentionsList.map(val => {
-          val.switch = false;
-          return val;
-        })
-      }
-    },
+
     InsureDel(id) {
       this.drvingIntentionsList.map(val => {
         if (val.id == id) {
@@ -372,11 +399,16 @@ export default {
         if (res.code == '200') {
           res.data.map(val => {
             val.switch = false;
+            val.insDrivingIntentionInsurances.map(val2 => {
+              val2.switch = false;
+              return val2;
+            })
             return val;
           })
           this.drvingIntentionsList = res.data;
           localStorage.setItem("drvingIntentionsList", JSON.stringify(this.drvingIntentionsList));
-
+          this.CustomPlanData.drvingList[0].undrvingList = JSON.parse(localStorage.getItem("drvingIntentionsList"));
+          localStorage.setItem("CustomPlanData", JSON.stringify(this.CustomPlanData));
         } else {
           this.$message({
             type: 'error',
@@ -442,9 +474,6 @@ export default {
     filteredInsureList() {
       return this.CustomPlanData.kinds.filter(insureitem => insureitem.switch);
     },
-    drvingIntentionsfilter() {
-      return this.drvingIntentionsList.filter(insureitem => insureitem.switch);
-    },
   }
 }
 </script>

+ 110 - 81
src/views/AgreementManage/InsuranceCompany/PassengerBus/BusinessOperation/NewEnergy/OptionalsolutionConfig.vue

@@ -97,46 +97,67 @@
           <div>
             <div class="flex j-s a-c">
               <h4>驾意险方案配置</h4>
+              <el-button type="primary" size="small" @click="drvingadd">新增</el-button>
             </div>
-            <div class="flex j-start ">
-              <div class="Risk" style="margin-right: 30px;">
-                <section class="flex j-s a-c ">
-                  <div class=" flex a-c">
-                    <el-checkbox v-model="DriveSelectAll" style="margin-right: 20px;"
-                      @input="DriveSelectAllInput"></el-checkbox>
-                    <span class="flex j-start">全部意外险</span>
-                  </div>
-                  <span class="flex j-end">操作</span>
-                </section>
-                <div style="max-height: 400px;overflow-y: auto;">
-                  <main class="flex j-s a-c" v-for="(filteredInsureitem, filteredInsureindex) in drvingIntentionsList"
-                    :key="filteredInsureindex">
-                    <div>
-                      <el-checkbox v-model="filteredInsureitem.switch" style="margin-right: 20px;"></el-checkbox>
-                      <span>{{ filteredInsureitem.projectName }}</span>
+            <div class="flex f-c " style="margin-bottom: 20px;"
+              v-for="(drvingListitem, drvingListindex) in CustomPlanData.drvingList" :key="drvingListindex">
+              <div class="flex a-c">
+                <span>座位数:</span>
+                <el-input-number size="small" style="width:150px; margin-bottom: 10px;" v-model="drvingListitem.seatNum"
+                  :min="1"></el-input-number>
+              </div>
+              <div class="flex j-start ">
+                <div class="Risk" style="margin-right: 30px;">
+                  <section class="flex j-s a-c ">
+                    <div class=" flex a-c">
+                      <span class="flex j-start">全部意外险</span>
                     </div>
-                    <span style="color: #2D4D89;cursor: pointer;" @click="Drivedetails(filteredInsureitem)">详情</span>
-                  </main>
+                    <span class="flex j-end">操作</span>
+                  </section>
+                  <div style="max-height: 400px;overflow-y: auto;">
+                    <main class="flex j-s a-c"
+                      v-for="(undrvingListitem, undrvingListindex) in drvingListitem.undrvingList"
+                      :key="undrvingListindex">
+                      <div class="flex f-c ">
+                        <div style="width: 100%;">
+                          <el-checkbox v-model="undrvingListitem.switch" style="margin-right: 20px;"></el-checkbox>
+                          <span>{{ undrvingListitem.projectName }}</span>
+                          <span style="color: #2D4D89;cursor: pointer;text-align: right;"
+                            @click="Drivedetails(undrvingListitem)">详情</span>
+                        </div>
+                        <template v-if="undrvingListitem.switch">
+                          <div v-for="(Insurancesitem, Insurancesindex) in undrvingListitem.insDrivingIntentionInsurances"
+                            class="p-1 flex a-c j-start" :key="Insurancesindex" style="width: 100%;margin-left: 40px;">
+                            <el-checkbox v-model="Insurancesitem.switch"
+                              @change="event => drvingcheckboxChange(event, drvingListindex, Insurancesitem)"
+                              style="margin-right: 20px;"></el-checkbox>
+                            <div>{{ Insurancesitem.projectName }}</div>
+                          </div>
+                        </template>
+                      </div>
+                    </main>
+                  </div>
                 </div>
-
-              </div>
-              <div class="Risk">
-                <section class="flex j-s a-c ">
-                  <div class=" flex a-c">
-                    <span class="flex j-start">已选意外险</span>
+                <div class="Risk">
+                  <section class="flex j-s a-c ">
+                    <div class=" flex a-c">
+                      <span class="flex j-start">已选意外险</span>
+                    </div>
+                    <span class="flex j-end">操作</span>
+                  </section>
+                  <div style="max-height: 400px;overflow-y: auto;">
+                    <main class="flex j-s a-c" v-for="(isOptionstitem, isOptionsindex) in drvingListitem.isOptions"
+                      :key="isOptionsindex">
+                      <div class="flex f-c " style="width: 100%;">
+                        <h5>{{ isOptionstitem.title }}</h5>
+                        <div class="flex a-c j-c">
+                          <span style="width: 50px;">别名: </span>
+                          <el-input v-model="isOptionstitem.projectName" size="small" clearable
+                            placeholder="请输入别名"></el-input>
+                        </div>
+                      </div>
+                    </main>
                   </div>
-                  <span class="flex j-end">操作</span>
-                </section>
-                <div style="max-height: 400px;overflow-y: auto;">
-                  <main class="flex j-s a-c"
-                    v-for="(drvingIntentionsListitem, fdrvingIntentionsListindex) in drvingIntentionsfilter"
-                    :key="fdrvingIntentionsListindex">
-                    <span>{{ drvingIntentionsListitem.projectName }}</span>
-                    <span class="flex j-end">
-                      <i class="el-icon-delete" style="font-size: 20px;"
-                        @click="InsureDel(drvingIntentionsListitem.id)"></i>
-                    </span>
-                  </main>
                 </div>
               </div>
             </div>
@@ -178,7 +199,6 @@ export default {
   },
   data() {
     return {
-      DriveSelectAll: false,
       customsolutionVisible: false,
       insDrivingIntentionInsuranceSondialogVisible: false,
       overSize: "small",
@@ -189,7 +209,11 @@ export default {
         schemeName: "自选方案",
         description: "",
         kinds: [],
-        drvingIntentions: [],
+        drvingList: [{
+          seatNum: 1,
+          undrvingList: [],
+          isOptions: []
+        }],
       },
       productsTypeoptions: [],
       companyId: "",
@@ -217,23 +241,36 @@ export default {
     this.getDicType("productsType"); //车险产品
     this.Insurance();
     this.drvingget();
-
   },
   // 方法函数
   methods: {
-    customsolutioncloseDialog() {
-      for (const key in this.CustomPlanData) {
-        if (key !== "companyId" && key !== 'kinds' && key !== 'schemeName') {
-          this.CustomPlanData[key] = "";
-        }
+    drvingcheckboxChange(e, drvingListindex, Insurancesitem) {
+      if (e) {
+        this.CustomPlanData.drvingList[drvingListindex].isOptions.push({
+          title: Insurancesitem.projectName,
+          id: Insurancesitem.id,//id
+          projectName: Insurancesitem.projectName,
+        })
+      } else {
+        let list = this.CustomPlanData.drvingList[drvingListindex].isOptions.filter(val => val.id !== Insurancesitem.id)
+        this.CustomPlanData.drvingList[drvingListindex].isOptions = list;
       }
-      this.CustomPlanData.kinds = JSON.parse(localStorage.getItem("InsuranceList"));
-      this.drvingIntentionsList = JSON.parse(localStorage.getItem("drvingIntentionsList"));
+    },
+    drvingadd() {
+      let list = JSON.parse(JSON.stringify(this.drvingIntentionsList));
+      this.CustomPlanData.drvingList.push({
+        seatNum: 1,
+        undrvingList: list,
+        isOptions: []
+      })
+    },
+    customsolutioncloseDialog() {
+      this.CustomPlanData = JSON.parse(localStorage.getItem("CustomPlanData"));
     },
     customsolutionUpdate({ row, column }) {
       this.customsolutionType = 'edit';
       this.customsolutionTitle = '自选方案修改';
-      this.$api.insCompany.optionalSchemeInfo(row.companyId, row.productId,"01","A0","1" ).then((res) => {
+      this.$api.insCompany.optionalSchemeInfo(row.companyId, row.productId, "01", 'A0', '1').then((res) => {
         if (res.code == '200') {
           res.data.kinds.map(val => {
             if (val.amount.length > 0) {
@@ -253,13 +290,22 @@ export default {
             }
             return val;
           })
-          res.data.drvingIntentions.map(val => {
-            this.drvingIntentionsList.map(insureitem => {
-              if (val == insureitem.id) {
-                insureitem.switch = true;
-              }
-              return insureitem
-            });
+          res.data.drvingList.map(val => {
+            const list = val.isOptions.map(item => { return item.id });
+            val.undrvingList.map(undrvingList => {
+              undrvingList.switch = false;
+              undrvingList.insDrivingIntentionInsurances.map(Insurances => {
+                if (list.includes(Insurances.id)) {
+                  undrvingList.switch = true;
+                  Insurances.switch = true
+                } else {
+                  Insurances.switch = false;
+                }
+                return Insurances;
+              })
+              return undrvingList;
+            })
+            return val;
           })
           this.CustomPlanData = res.data;
           this.customsolutionVisible = true;
@@ -287,7 +333,7 @@ export default {
       });
     },
     customsolutionFindPage() {
-      this.$api.insCompany.optionalShcemeList({ companyId: this.companyId,carnature:"01",vehicleType:"A0",energyType:"1" }).then((res) => {
+      this.$api.insCompany.optionalShcemeList({ companyId: this.companyId, carnature: "01", vehicleType: "A0", energyType: "1" }).then((res) => {
         if (res.code == '200') {
           let pageList = {
             content: res.data,
@@ -302,15 +348,8 @@ export default {
       });
     },
     customsolutionSubmit() {
-      let list = [];
-      this.drvingIntentionsList.map(insureitem => {
-        if (insureitem.switch) {
-          list.push(insureitem.id)
-        }
-      });
-      this.CustomPlanData.drvingIntentions = list;
       if (this.customsolutionType == 'add') {
-        this.$api.insCompany.addOptionalScheme({...this.CustomPlanData,carnature:"01",vehicleType:"A0",energyType:"1"}).then((res) => {
+        this.$api.insCompany.addOptionalScheme({ ...this.CustomPlanData, carnature: "01", vehicleType: "A0", energyType: "1" }).then((res) => {
           if (res.code == '200') {
             this.$message({
               type: 'success',
@@ -326,7 +365,7 @@ export default {
           }
         });
       } else {
-        this.$api.insCompany.updateOptionalScheme({...this.CustomPlanData,carnature:"01",vehicleType:"A0",energyType:"1"}).then((res) => {
+        this.$api.insCompany.updateOptionalScheme({ ...this.CustomPlanData, carnature: "01", vehicleType: "A0", energyType: "1" }).then((res) => {
           if (res.code == '200') {
             this.$message({
               type: 'success',
@@ -344,19 +383,7 @@ export default {
       }
 
     },
-    DriveSelectAllInput(e) {
-      if (e) {
-        this.drvingIntentionsList.map(val => {
-          val.switch = true;
-          return val;
-        })
-      } else {
-        this.drvingIntentionsList.map(val => {
-          val.switch = false;
-          return val;
-        })
-      }
-    },
+
     InsureDel(id) {
       this.drvingIntentionsList.map(val => {
         if (val.id == id) {
@@ -372,11 +399,16 @@ export default {
         if (res.code == '200') {
           res.data.map(val => {
             val.switch = false;
+            val.insDrivingIntentionInsurances.map(val2 => {
+              val2.switch = false;
+              return val2;
+            })
             return val;
           })
           this.drvingIntentionsList = res.data;
           localStorage.setItem("drvingIntentionsList", JSON.stringify(this.drvingIntentionsList));
-
+          this.CustomPlanData.drvingList[0].undrvingList = JSON.parse(localStorage.getItem("drvingIntentionsList"));
+          localStorage.setItem("CustomPlanData", JSON.stringify(this.CustomPlanData));
         } else {
           this.$message({
             type: 'error',
@@ -442,9 +474,6 @@ export default {
     filteredInsureList() {
       return this.CustomPlanData.kinds.filter(insureitem => insureitem.switch);
     },
-    drvingIntentionsfilter() {
-      return this.drvingIntentionsList.filter(insureitem => insureitem.switch);
-    },
   }
 }
 </script>

+ 110 - 81
src/views/AgreementManage/InsuranceCompany/PassengerBus/NonBusiness/Fuel/OptionalsolutionConfig.vue

@@ -97,46 +97,67 @@
           <div>
             <div class="flex j-s a-c">
               <h4>驾意险方案配置</h4>
+              <el-button type="primary" size="small" @click="drvingadd">新增</el-button>
             </div>
-            <div class="flex j-start ">
-              <div class="Risk" style="margin-right: 30px;">
-                <section class="flex j-s a-c ">
-                  <div class=" flex a-c">
-                    <el-checkbox v-model="DriveSelectAll" style="margin-right: 20px;"
-                      @input="DriveSelectAllInput"></el-checkbox>
-                    <span class="flex j-start">全部意外险</span>
-                  </div>
-                  <span class="flex j-end">操作</span>
-                </section>
-                <div style="max-height: 400px;overflow-y: auto;">
-                  <main class="flex j-s a-c" v-for="(filteredInsureitem, filteredInsureindex) in drvingIntentionsList"
-                    :key="filteredInsureindex">
-                    <div>
-                      <el-checkbox v-model="filteredInsureitem.switch" style="margin-right: 20px;"></el-checkbox>
-                      <span>{{ filteredInsureitem.projectName }}</span>
+            <div class="flex f-c " style="margin-bottom: 20px;"
+              v-for="(drvingListitem, drvingListindex) in CustomPlanData.drvingList" :key="drvingListindex">
+              <div class="flex a-c">
+                <span>座位数:</span>
+                <el-input-number size="small" style="width:150px; margin-bottom: 10px;" v-model="drvingListitem.seatNum"
+                  :min="1"></el-input-number>
+              </div>
+              <div class="flex j-start ">
+                <div class="Risk" style="margin-right: 30px;">
+                  <section class="flex j-s a-c ">
+                    <div class=" flex a-c">
+                      <span class="flex j-start">全部意外险</span>
                     </div>
-                    <span style="color: #2D4D89;cursor: pointer;" @click="Drivedetails(filteredInsureitem)">详情</span>
-                  </main>
+                    <span class="flex j-end">操作</span>
+                  </section>
+                  <div style="max-height: 400px;overflow-y: auto;">
+                    <main class="flex j-s a-c"
+                      v-for="(undrvingListitem, undrvingListindex) in drvingListitem.undrvingList"
+                      :key="undrvingListindex">
+                      <div class="flex f-c ">
+                        <div style="width: 100%;">
+                          <el-checkbox v-model="undrvingListitem.switch" style="margin-right: 20px;"></el-checkbox>
+                          <span>{{ undrvingListitem.projectName }}</span>
+                          <span style="color: #2D4D89;cursor: pointer;text-align: right;"
+                            @click="Drivedetails(undrvingListitem)">详情</span>
+                        </div>
+                        <template v-if="undrvingListitem.switch">
+                          <div v-for="(Insurancesitem, Insurancesindex) in undrvingListitem.insDrivingIntentionInsurances"
+                            class="p-1 flex a-c j-start" :key="Insurancesindex" style="width: 100%;margin-left: 40px;">
+                            <el-checkbox v-model="Insurancesitem.switch"
+                              @change="event => drvingcheckboxChange(event, drvingListindex, Insurancesitem)"
+                              style="margin-right: 20px;"></el-checkbox>
+                            <div>{{ Insurancesitem.projectName }}</div>
+                          </div>
+                        </template>
+                      </div>
+                    </main>
+                  </div>
                 </div>
-
-              </div>
-              <div class="Risk">
-                <section class="flex j-s a-c ">
-                  <div class=" flex a-c">
-                    <span class="flex j-start">已选意外险</span>
+                <div class="Risk">
+                  <section class="flex j-s a-c ">
+                    <div class=" flex a-c">
+                      <span class="flex j-start">已选意外险</span>
+                    </div>
+                    <span class="flex j-end">操作</span>
+                  </section>
+                  <div style="max-height: 400px;overflow-y: auto;">
+                    <main class="flex j-s a-c" v-for="(isOptionstitem, isOptionsindex) in drvingListitem.isOptions"
+                      :key="isOptionsindex">
+                      <div class="flex f-c " style="width: 100%;">
+                        <h5>{{ isOptionstitem.title }}</h5>
+                        <div class="flex a-c j-c">
+                          <span style="width: 50px;">别名: </span>
+                          <el-input v-model="isOptionstitem.projectName" size="small" clearable
+                            placeholder="请输入别名"></el-input>
+                        </div>
+                      </div>
+                    </main>
                   </div>
-                  <span class="flex j-end">操作</span>
-                </section>
-                <div style="max-height: 400px;overflow-y: auto;">
-                  <main class="flex j-s a-c"
-                    v-for="(drvingIntentionsListitem, fdrvingIntentionsListindex) in drvingIntentionsfilter"
-                    :key="fdrvingIntentionsListindex">
-                    <span>{{ drvingIntentionsListitem.projectName }}</span>
-                    <span class="flex j-end">
-                      <i class="el-icon-delete" style="font-size: 20px;"
-                        @click="InsureDel(drvingIntentionsListitem.id)"></i>
-                    </span>
-                  </main>
                 </div>
               </div>
             </div>
@@ -178,7 +199,6 @@ export default {
   },
   data() {
     return {
-      DriveSelectAll: false,
       customsolutionVisible: false,
       insDrivingIntentionInsuranceSondialogVisible: false,
       overSize: "small",
@@ -189,7 +209,11 @@ export default {
         schemeName: "自选方案",
         description: "",
         kinds: [],
-        drvingIntentions: [],
+        drvingList: [{
+          seatNum: 1,
+          undrvingList: [],
+          isOptions: []
+        }],
       },
       productsTypeoptions: [],
       companyId: "",
@@ -217,23 +241,36 @@ export default {
     this.getDicType("productsType"); //车险产品
     this.Insurance();
     this.drvingget();
-
   },
   // 方法函数
   methods: {
-    customsolutioncloseDialog() {
-      for (const key in this.CustomPlanData) {
-        if (key !== "companyId" && key !== 'kinds' && key !== 'schemeName') {
-          this.CustomPlanData[key] = "";
-        }
+    drvingcheckboxChange(e, drvingListindex, Insurancesitem) {
+      if (e) {
+        this.CustomPlanData.drvingList[drvingListindex].isOptions.push({
+          title: Insurancesitem.projectName,
+          id: Insurancesitem.id,//id
+          projectName: Insurancesitem.projectName,
+        })
+      } else {
+        let list = this.CustomPlanData.drvingList[drvingListindex].isOptions.filter(val => val.id !== Insurancesitem.id)
+        this.CustomPlanData.drvingList[drvingListindex].isOptions = list;
       }
-      this.CustomPlanData.kinds = JSON.parse(localStorage.getItem("InsuranceList"));
-      this.drvingIntentionsList = JSON.parse(localStorage.getItem("drvingIntentionsList"));
+    },
+    drvingadd() {
+      let list = JSON.parse(JSON.stringify(this.drvingIntentionsList));
+      this.CustomPlanData.drvingList.push({
+        seatNum: 1,
+        undrvingList: list,
+        isOptions: []
+      })
+    },
+    customsolutioncloseDialog() {
+      this.CustomPlanData = JSON.parse(localStorage.getItem("CustomPlanData"));
     },
     customsolutionUpdate({ row, column }) {
       this.customsolutionType = 'edit';
       this.customsolutionTitle = '自选方案修改';
-      this.$api.insCompany.optionalSchemeInfo(row.companyId, row.productId,"02",'A0','0').then((res) => {
+      this.$api.insCompany.optionalSchemeInfo(row.companyId, row.productId, "02", 'A0', '0').then((res) => {
         if (res.code == '200') {
           res.data.kinds.map(val => {
             if (val.amount.length > 0) {
@@ -253,13 +290,22 @@ export default {
             }
             return val;
           })
-          res.data.drvingIntentions.map(val => {
-            this.drvingIntentionsList.map(insureitem => {
-              if (val == insureitem.id) {
-                insureitem.switch = true;
-              }
-              return insureitem
-            });
+          res.data.drvingList.map(val => {
+            const list = val.isOptions.map(item => { return item.id });
+            val.undrvingList.map(undrvingList => {
+              undrvingList.switch = false;
+              undrvingList.insDrivingIntentionInsurances.map(Insurances => {
+                if (list.includes(Insurances.id)) {
+                  undrvingList.switch = true;
+                  Insurances.switch = true
+                } else {
+                  Insurances.switch = false;
+                }
+                return Insurances;
+              })
+              return undrvingList;
+            })
+            return val;
           })
           this.CustomPlanData = res.data;
           this.customsolutionVisible = true;
@@ -287,7 +333,7 @@ export default {
       });
     },
     customsolutionFindPage() {
-      this.$api.insCompany.optionalShcemeList({ companyId: this.companyId,carnature:"02",vehicleType:"A0",energyType:"0" }).then((res) => {
+      this.$api.insCompany.optionalShcemeList({ companyId: this.companyId, carnature: "02", vehicleType: "A0", energyType: "0" }).then((res) => {
         if (res.code == '200') {
           let pageList = {
             content: res.data,
@@ -302,15 +348,8 @@ export default {
       });
     },
     customsolutionSubmit() {
-      let list = [];
-      this.drvingIntentionsList.map(insureitem => {
-        if (insureitem.switch) {
-          list.push(insureitem.id)
-        }
-      });
-      this.CustomPlanData.drvingIntentions = list;
       if (this.customsolutionType == 'add') {
-        this.$api.insCompany.addOptionalScheme({...this.CustomPlanData,carnature:"02",vehicleType:"A0",energyType:"0"}).then((res) => {
+        this.$api.insCompany.addOptionalScheme({ ...this.CustomPlanData, carnature: "02", vehicleType: "A0", energyType: "0" }).then((res) => {
           if (res.code == '200') {
             this.$message({
               type: 'success',
@@ -326,7 +365,7 @@ export default {
           }
         });
       } else {
-        this.$api.insCompany.updateOptionalScheme({...this.CustomPlanData,carnature:"02",vehicleType:"A0",energyType:"0"}).then((res) => {
+        this.$api.insCompany.updateOptionalScheme({ ...this.CustomPlanData, carnature: "02", vehicleType: "A0", energyType: "0" }).then((res) => {
           if (res.code == '200') {
             this.$message({
               type: 'success',
@@ -344,19 +383,7 @@ export default {
       }
 
     },
-    DriveSelectAllInput(e) {
-      if (e) {
-        this.drvingIntentionsList.map(val => {
-          val.switch = true;
-          return val;
-        })
-      } else {
-        this.drvingIntentionsList.map(val => {
-          val.switch = false;
-          return val;
-        })
-      }
-    },
+
     InsureDel(id) {
       this.drvingIntentionsList.map(val => {
         if (val.id == id) {
@@ -372,11 +399,16 @@ export default {
         if (res.code == '200') {
           res.data.map(val => {
             val.switch = false;
+            val.insDrivingIntentionInsurances.map(val2 => {
+              val2.switch = false;
+              return val2;
+            })
             return val;
           })
           this.drvingIntentionsList = res.data;
           localStorage.setItem("drvingIntentionsList", JSON.stringify(this.drvingIntentionsList));
-
+          this.CustomPlanData.drvingList[0].undrvingList = JSON.parse(localStorage.getItem("drvingIntentionsList"));
+          localStorage.setItem("CustomPlanData", JSON.stringify(this.CustomPlanData));
         } else {
           this.$message({
             type: 'error',
@@ -442,9 +474,6 @@ export default {
     filteredInsureList() {
       return this.CustomPlanData.kinds.filter(insureitem => insureitem.switch);
     },
-    drvingIntentionsfilter() {
-      return this.drvingIntentionsList.filter(insureitem => insureitem.switch);
-    },
   }
 }
 </script>

+ 110 - 81
src/views/AgreementManage/InsuranceCompany/PassengerBus/NonBusiness/NewEnergy/OptionalsolutionConfig.vue

@@ -97,46 +97,67 @@
           <div>
             <div class="flex j-s a-c">
               <h4>驾意险方案配置</h4>
+              <el-button type="primary" size="small" @click="drvingadd">新增</el-button>
             </div>
-            <div class="flex j-start ">
-              <div class="Risk" style="margin-right: 30px;">
-                <section class="flex j-s a-c ">
-                  <div class=" flex a-c">
-                    <el-checkbox v-model="DriveSelectAll" style="margin-right: 20px;"
-                      @input="DriveSelectAllInput"></el-checkbox>
-                    <span class="flex j-start">全部意外险</span>
-                  </div>
-                  <span class="flex j-end">操作</span>
-                </section>
-                <div style="max-height: 400px;overflow-y: auto;">
-                  <main class="flex j-s a-c" v-for="(filteredInsureitem, filteredInsureindex) in drvingIntentionsList"
-                    :key="filteredInsureindex">
-                    <div>
-                      <el-checkbox v-model="filteredInsureitem.switch" style="margin-right: 20px;"></el-checkbox>
-                      <span>{{ filteredInsureitem.projectName }}</span>
+            <div class="flex f-c " style="margin-bottom: 20px;"
+              v-for="(drvingListitem, drvingListindex) in CustomPlanData.drvingList" :key="drvingListindex">
+              <div class="flex a-c">
+                <span>座位数:</span>
+                <el-input-number size="small" style="width:150px; margin-bottom: 10px;" v-model="drvingListitem.seatNum"
+                  :min="1"></el-input-number>
+              </div>
+              <div class="flex j-start ">
+                <div class="Risk" style="margin-right: 30px;">
+                  <section class="flex j-s a-c ">
+                    <div class=" flex a-c">
+                      <span class="flex j-start">全部意外险</span>
                     </div>
-                    <span style="color: #2D4D89;cursor: pointer;" @click="Drivedetails(filteredInsureitem)">详情</span>
-                  </main>
+                    <span class="flex j-end">操作</span>
+                  </section>
+                  <div style="max-height: 400px;overflow-y: auto;">
+                    <main class="flex j-s a-c"
+                      v-for="(undrvingListitem, undrvingListindex) in drvingListitem.undrvingList"
+                      :key="undrvingListindex">
+                      <div class="flex f-c ">
+                        <div style="width: 100%;">
+                          <el-checkbox v-model="undrvingListitem.switch" style="margin-right: 20px;"></el-checkbox>
+                          <span>{{ undrvingListitem.projectName }}</span>
+                          <span style="color: #2D4D89;cursor: pointer;text-align: right;"
+                            @click="Drivedetails(undrvingListitem)">详情</span>
+                        </div>
+                        <template v-if="undrvingListitem.switch">
+                          <div v-for="(Insurancesitem, Insurancesindex) in undrvingListitem.insDrivingIntentionInsurances"
+                            class="p-1 flex a-c j-start" :key="Insurancesindex" style="width: 100%;margin-left: 40px;">
+                            <el-checkbox v-model="Insurancesitem.switch"
+                              @change="event => drvingcheckboxChange(event, drvingListindex, Insurancesitem)"
+                              style="margin-right: 20px;"></el-checkbox>
+                            <div>{{ Insurancesitem.projectName }}</div>
+                          </div>
+                        </template>
+                      </div>
+                    </main>
+                  </div>
                 </div>
-
-              </div>
-              <div class="Risk">
-                <section class="flex j-s a-c ">
-                  <div class=" flex a-c">
-                    <span class="flex j-start">已选意外险</span>
+                <div class="Risk">
+                  <section class="flex j-s a-c ">
+                    <div class=" flex a-c">
+                      <span class="flex j-start">已选意外险</span>
+                    </div>
+                    <span class="flex j-end">操作</span>
+                  </section>
+                  <div style="max-height: 400px;overflow-y: auto;">
+                    <main class="flex j-s a-c" v-for="(isOptionstitem, isOptionsindex) in drvingListitem.isOptions"
+                      :key="isOptionsindex">
+                      <div class="flex f-c " style="width: 100%;">
+                        <h5>{{ isOptionstitem.title }}</h5>
+                        <div class="flex a-c j-c">
+                          <span style="width: 50px;">别名: </span>
+                          <el-input v-model="isOptionstitem.projectName" size="small" clearable
+                            placeholder="请输入别名"></el-input>
+                        </div>
+                      </div>
+                    </main>
                   </div>
-                  <span class="flex j-end">操作</span>
-                </section>
-                <div style="max-height: 400px;overflow-y: auto;">
-                  <main class="flex j-s a-c"
-                    v-for="(drvingIntentionsListitem, fdrvingIntentionsListindex) in drvingIntentionsfilter"
-                    :key="fdrvingIntentionsListindex">
-                    <span>{{ drvingIntentionsListitem.projectName }}</span>
-                    <span class="flex j-end">
-                      <i class="el-icon-delete" style="font-size: 20px;"
-                        @click="InsureDel(drvingIntentionsListitem.id)"></i>
-                    </span>
-                  </main>
                 </div>
               </div>
             </div>
@@ -178,7 +199,6 @@ export default {
   },
   data() {
     return {
-      DriveSelectAll: false,
       customsolutionVisible: false,
       insDrivingIntentionInsuranceSondialogVisible: false,
       overSize: "small",
@@ -189,7 +209,11 @@ export default {
         schemeName: "自选方案",
         description: "",
         kinds: [],
-        drvingIntentions: [],
+        drvingList: [{
+          seatNum: 1,
+          undrvingList: [],
+          isOptions: []
+        }],
       },
       productsTypeoptions: [],
       companyId: "",
@@ -217,23 +241,36 @@ export default {
     this.getDicType("productsType"); //车险产品
     this.Insurance();
     this.drvingget();
-
   },
   // 方法函数
   methods: {
-    customsolutioncloseDialog() {
-      for (const key in this.CustomPlanData) {
-        if (key !== "companyId" && key !== 'kinds' && key !== 'schemeName') {
-          this.CustomPlanData[key] = "";
-        }
+    drvingcheckboxChange(e, drvingListindex, Insurancesitem) {
+      if (e) {
+        this.CustomPlanData.drvingList[drvingListindex].isOptions.push({
+          title: Insurancesitem.projectName,
+          id: Insurancesitem.id,//id
+          projectName: Insurancesitem.projectName,
+        })
+      } else {
+        let list = this.CustomPlanData.drvingList[drvingListindex].isOptions.filter(val => val.id !== Insurancesitem.id)
+        this.CustomPlanData.drvingList[drvingListindex].isOptions = list;
       }
-      this.CustomPlanData.kinds = JSON.parse(localStorage.getItem("InsuranceList"));
-      this.drvingIntentionsList = JSON.parse(localStorage.getItem("drvingIntentionsList"));
+    },
+    drvingadd() {
+      let list = JSON.parse(JSON.stringify(this.drvingIntentionsList));
+      this.CustomPlanData.drvingList.push({
+        seatNum: 1,
+        undrvingList: list,
+        isOptions: []
+      })
+    },
+    customsolutioncloseDialog() {
+      this.CustomPlanData = JSON.parse(localStorage.getItem("CustomPlanData"));
     },
     customsolutionUpdate({ row, column }) {
       this.customsolutionType = 'edit';
       this.customsolutionTitle = '自选方案修改';
-      this.$api.insCompany.optionalSchemeInfo(row.companyId, row.productId,"02","A0","1" ).then((res) => {
+      this.$api.insCompany.optionalSchemeInfo(row.companyId, row.productId, "02", 'A0', '1').then((res) => {
         if (res.code == '200') {
           res.data.kinds.map(val => {
             if (val.amount.length > 0) {
@@ -253,13 +290,22 @@ export default {
             }
             return val;
           })
-          res.data.drvingIntentions.map(val => {
-            this.drvingIntentionsList.map(insureitem => {
-              if (val == insureitem.id) {
-                insureitem.switch = true;
-              }
-              return insureitem
-            });
+          res.data.drvingList.map(val => {
+            const list = val.isOptions.map(item => { return item.id });
+            val.undrvingList.map(undrvingList => {
+              undrvingList.switch = false;
+              undrvingList.insDrivingIntentionInsurances.map(Insurances => {
+                if (list.includes(Insurances.id)) {
+                  undrvingList.switch = true;
+                  Insurances.switch = true
+                } else {
+                  Insurances.switch = false;
+                }
+                return Insurances;
+              })
+              return undrvingList;
+            })
+            return val;
           })
           this.CustomPlanData = res.data;
           this.customsolutionVisible = true;
@@ -287,7 +333,7 @@ export default {
       });
     },
     customsolutionFindPage() {
-      this.$api.insCompany.optionalShcemeList({ companyId: this.companyId,carnature:"02",vehicleType:"A0",energyType:"1" }).then((res) => {
+      this.$api.insCompany.optionalShcemeList({ companyId: this.companyId, carnature: "02", vehicleType: "A0", energyType: "1" }).then((res) => {
         if (res.code == '200') {
           let pageList = {
             content: res.data,
@@ -302,15 +348,8 @@ export default {
       });
     },
     customsolutionSubmit() {
-      let list = [];
-      this.drvingIntentionsList.map(insureitem => {
-        if (insureitem.switch) {
-          list.push(insureitem.id)
-        }
-      });
-      this.CustomPlanData.drvingIntentions = list;
       if (this.customsolutionType == 'add') {
-        this.$api.insCompany.addOptionalScheme({...this.CustomPlanData,carnature:"02",vehicleType:"A0",energyType:"1"}).then((res) => {
+        this.$api.insCompany.addOptionalScheme({ ...this.CustomPlanData, carnature: "02", vehicleType: "A0", energyType: "1" }).then((res) => {
           if (res.code == '200') {
             this.$message({
               type: 'success',
@@ -326,7 +365,7 @@ export default {
           }
         });
       } else {
-        this.$api.insCompany.updateOptionalScheme({...this.CustomPlanData,carnature:"02",vehicleType:"A0",energyType:"1"}).then((res) => {
+        this.$api.insCompany.updateOptionalScheme({ ...this.CustomPlanData, carnature: "02", vehicleType: "A0", energyType: "1" }).then((res) => {
           if (res.code == '200') {
             this.$message({
               type: 'success',
@@ -344,19 +383,7 @@ export default {
       }
 
     },
-    DriveSelectAllInput(e) {
-      if (e) {
-        this.drvingIntentionsList.map(val => {
-          val.switch = true;
-          return val;
-        })
-      } else {
-        this.drvingIntentionsList.map(val => {
-          val.switch = false;
-          return val;
-        })
-      }
-    },
+
     InsureDel(id) {
       this.drvingIntentionsList.map(val => {
         if (val.id == id) {
@@ -372,11 +399,16 @@ export default {
         if (res.code == '200') {
           res.data.map(val => {
             val.switch = false;
+            val.insDrivingIntentionInsurances.map(val2 => {
+              val2.switch = false;
+              return val2;
+            })
             return val;
           })
           this.drvingIntentionsList = res.data;
           localStorage.setItem("drvingIntentionsList", JSON.stringify(this.drvingIntentionsList));
-
+          this.CustomPlanData.drvingList[0].undrvingList = JSON.parse(localStorage.getItem("drvingIntentionsList"));
+          localStorage.setItem("CustomPlanData", JSON.stringify(this.CustomPlanData));
         } else {
           this.$message({
             type: 'error',
@@ -442,9 +474,6 @@ export default {
     filteredInsureList() {
       return this.CustomPlanData.kinds.filter(insureitem => insureitem.switch);
     },
-    drvingIntentionsfilter() {
-      return this.drvingIntentionsList.filter(insureitem => insureitem.switch);
-    },
   }
 }
 </script>