Przeglądaj źródła

保险公司方案增加排序

@dongkboy 1 rok temu
rodzic
commit
2bb6917b63
17 zmienionych plików z 2985 dodań i 2281 usunięć
  1. 3 0
      src/assets/css/common.css
  2. 285 241
      src/views/AgreementManage/InsuranceCompany/CargoTruck/BusinessOperation/Fuel/AddOrdinaryPlan.vue
  3. 89 46
      src/views/AgreementManage/InsuranceCompany/CargoTruck/BusinessOperation/Fuel/OrdinaryPlan.vue
  4. 285 241
      src/views/AgreementManage/InsuranceCompany/CargoTruck/BusinessOperation/NewEnergy/AddOrdinaryPlan.vue
  5. 90 47
      src/views/AgreementManage/InsuranceCompany/CargoTruck/BusinessOperation/NewEnergy/OrdinaryPlan.vue
  6. 285 241
      src/views/AgreementManage/InsuranceCompany/CargoTruck/NonBusiness/Fuel/AddOrdinaryPlan.vue
  7. 90 47
      src/views/AgreementManage/InsuranceCompany/CargoTruck/NonBusiness/Fuel/OrdinaryPlan.vue
  8. 285 241
      src/views/AgreementManage/InsuranceCompany/CargoTruck/NonBusiness/NewEnergy/AddOrdinaryPlan.vue
  9. 90 47
      src/views/AgreementManage/InsuranceCompany/CargoTruck/NonBusiness/NewEnergy/OrdinaryPlan.vue
  10. 289 243
      src/views/AgreementManage/InsuranceCompany/PassengerBus/BusinessOperation/Fuel/AddOrdinaryPlan.vue
  11. 90 47
      src/views/AgreementManage/InsuranceCompany/PassengerBus/BusinessOperation/Fuel/OrdinaryPlan.vue
  12. 262 217
      src/views/AgreementManage/InsuranceCompany/PassengerBus/BusinessOperation/NewEnergy/AddOrdinaryPlan.vue
  13. 90 47
      src/views/AgreementManage/InsuranceCompany/PassengerBus/BusinessOperation/NewEnergy/OrdinaryPlan.vue
  14. 286 241
      src/views/AgreementManage/InsuranceCompany/PassengerBus/NonBusiness/Fuel/AddOrdinaryPlan.vue
  15. 90 47
      src/views/AgreementManage/InsuranceCompany/PassengerBus/NonBusiness/Fuel/OrdinaryPlan.vue
  16. 286 241
      src/views/AgreementManage/InsuranceCompany/PassengerBus/NonBusiness/NewEnergy/AddOrdinaryPlan.vue
  17. 90 47
      src/views/AgreementManage/InsuranceCompany/PassengerBus/NonBusiness/NewEnergy/OrdinaryPlan.vue

+ 3 - 0
src/assets/css/common.css

@@ -139,6 +139,9 @@
 .ml-3{
   margin-left: 30px;
 }
+.mb-2{
+  margin-bottom: 20px;
+}
 .el-button:hover,
 .el-button:focus {
   color: var(--themeColor) ;

+ 285 - 241
src/views/AgreementManage/InsuranceCompany/CargoTruck/BusinessOperation/Fuel/AddOrdinaryPlan.vue

@@ -1,234 +1,240 @@
 <!-- 模板区域 -->
 <template>
   <div>
-      <div class="tab-panestyle">
-        <div class="tab-panecent">
-          <span>险种配置</span>
-          <el-radio-group :disabled="this.solutionDialogType == 'edit'" v-model="solutionData.productId"
-            @input="productInput" size="small" style="margin-left: 30px;">
-            <el-radio-button v-for="(productsitem, productsindex) in productsTypeoptions" :key="productsindex"
-              :label="productsitem.dictValue">{{
-                productsitem.dictTag }}</el-radio-button>
-          </el-radio-group>
+    <div class="tab-panestyle">
+      <div class="tab-panecent">
+        <span>险种配置</span>
+        <el-radio-group :disabled="this.solutionDialogType == 'edit'" v-model="solutionData.productId"
+          @input="productInput" size="small" style="margin-left: 30px;">
+          <el-radio-button v-for="(productsitem, productsindex) in productsTypeoptions" :key="productsindex"
+            :label="productsitem.dictValue">{{
+              productsitem.dictTag }}</el-radio-button>
+        </el-radio-group>
+      </div>
+      <div class="tab-panecent">
+        <div class=" flex j-s a-c">
+          <el-button type="primary" size="small" icon="el-icon-plus" class="planOption-btn"
+            @click="planOptionadd">方案新增</el-button>
         </div>
-        <div class="tab-panecent">
-          <div class=" flex j-s a-c">
-            <el-button type="primary" size="small" icon="el-icon-plus" class="planOption-btn"
-              @click="planOptionadd">方案新增</el-button>
+        <div v-for="(solutionitem, solutionindex) in solutionData.productList" :key="solutionindex">
+          <div class="flex j-s a-c " style="margin-top: 20px;font-size: 16px;color: #262626;">
+            <span>方案{{ solutionindex + 1 }}</span>
+            <el-button v-if="solutionindex > 0" type="primary" size="small" icon="el-icon-delete" class="planOption-del"
+              @click="planOptiondel(solutionindex)">方案删除</el-button>
           </div>
-          <div v-for="(solutionitem, solutionindex) in solutionData.productList" :key="solutionindex">
-            <div class="flex j-s a-c " style="margin-top: 20px;font-size: 16px;color: #262626;">
-              <span>方案{{ solutionindex + 1 }}</span>
-              <el-button v-if="solutionindex > 0" type="primary" size="small" icon="el-icon-delete" class="planOption-del"
-                @click="planOptiondel(solutionindex)">方案删除</el-button>
+          <el-form :ref="`solutionForm${solutionindex}`" :rules="solutionrules" :model="solutionitem"
+            label-width="120px" :size="overSize">
+            <el-row>
+              <el-col :span="8">
+                <el-form-item label="方案名称" prop="schemeName">
+                  <el-input type="text" v-model="solutionitem.schemeName" placeholder="输入方案名称"></el-input>
+                </el-form-item>
+              </el-col>
+              <el-col :span="4">
+                <el-form-item label="序号" prop="priorityLevel">
+                  <el-input type="text" v-model="solutionitem.priorityLevel" clearable :maxlength="2"></el-input>
+                </el-form-item>
+              </el-col>
+              <el-col :span="20">
+                <el-form-item label="方案描述">
+                  <el-input type="textarea" v-model="solutionitem.description" placeholder="输入方案描述" maxlength="100"
+                    show-word-limit></el-input>
+                </el-form-item>
+              </el-col>
+            </el-row>
+          </el-form>
+          <div v-if="['单商', '单三', '交三', '交商'].includes(solutionData.productName)">
+            <div class="flex j-s a-c">
+              <h4>商业险方案配置</h4>
             </div>
-            <el-form ref="solutionForm" :model="solutionitem" label-width="120px" :size="overSize">
-              <el-row>
-                <el-col :span="8">
-                  <el-form-item label="方案名称">
-                    <el-input type="text" v-model="solutionitem.schemeName" placeholder="输入方案名称"></el-input>
-                  </el-form-item>
-                </el-col>
-                <el-col :span="20">
-                  <el-form-item label="方案描述">
-                    <el-input type="textarea" v-model="solutionitem.description" placeholder="输入方案描述" maxlength="100"
-                      show-word-limit></el-input>
-                  </el-form-item>
-                </el-col>
-              </el-row>
-            </el-form>
-            <div v-if="['单商', '单三', '交三', '交商'].includes(solutionData.productName)">
-              <div class="flex j-s a-c">
-                <h4>商业险方案配置</h4>
-              </div>
-              <div class="flex j-start ">
-                <div class="Risk f-c" style="margin-right: 30px;">
-                  <section class="flex j-s a-c ">
-                    <div>
-                      全部险别
-                    </div>
-                    <div>
-                      投保保额
-                    </div>
-                  </section>
-                  <main class="flex j-s a-c" v-for="(insureitem, insureindex) in solutionitem.kinds" :key="insureindex">
-                    <div>
-                      <el-checkbox v-model="insureitem.switch" style="margin-right: 10px;" disabled></el-checkbox>
-                      <span>{{ insureitem.kindName }}</span>
-                    </div>
-                    <div>
-                      <el-select v-if="insureitem.amtList.length > 0" filterable v-model="insureitem.amount"
-                        placeholder="请选择"
-                        @change="(value) => amtListChange(value, insureitem.amtList, insureindex, solutionindex)"
-                        style="width: 200px;" clearable :size="overSize">
-                        <el-option v-for="(item, index) in insureitem.amtList" :key="index" :label="item.label"
-                          :value="item.value"></el-option>
-                      </el-select>
-                      <span v-else>
-                        <el-input-number @change="(value) => inputNumberChange(value, insureindex, solutionindex)"
-                          size="small" style="width:200px; margin-right: 10px;" v-model="insureitem.amount"
-                          :min="0"></el-input-number>次
-                      </span>
-                    </div>
-                  </main>
-                </div>
-                <div class="Risk">
-                  <section class="flex j-s a-c ">
-                    <span class="flex j-start">已选险别</span>
-                    <span class="flex j-c">投保保额</span>
-                    <span class="flex j-end">操作</span>
-                  </section>
-                  <main class="flex j-s a-c" v-for="(filteredInsureitem, filteredInsureindex) in solutionitem.kinds"
-                    :key="filteredInsureindex" v-if="filteredInsureitem.switch">
-                    <span class="flex j-start">{{ filteredInsureitem.kindName }}</span>
-                    <span class="flex j-c" v-if="['A'].includes(filteredInsureitem.kindCode)">{{
-                      filteredInsureitem.amountDesc }}</span>
-                    <span class="flex j-c"
-                      v-else-if="['MJ1', 'MJ2', 'MJ3', 'MJ4'].includes(filteredInsureitem.kindCode)">{{
-                        filteredInsureitem.amount }}%</span>
-                    <span class="flex j-c"
-                      v-else-if="['TY1', 'TY2', 'TY3', 'TY4'].includes(filteredInsureitem.kindCode)">{{
-                        filteredInsureitem.amount }}次</span>
-                    <span class="flex j-c" v-else>{{ convertedValue(filteredInsureitem.amount) }}</span>
-                    <span class="flex j-end">
-                      <i class="el-icon-delete" style="font-size: 20px;"
-                        @click="InsureDel(solutionindex, filteredInsureitem.kindCode)"></i>
+            <div class="flex j-start ">
+              <div class="Risk f-c" style="margin-right: 30px;">
+                <section class="flex j-s a-c ">
+                  <div>
+                    全部险别
+                  </div>
+                  <div>
+                    投保保额
+                  </div>
+                </section>
+                <main class="flex j-s a-c" v-for="(insureitem, insureindex) in solutionitem.kinds" :key="insureindex">
+                  <div>
+                    <el-checkbox v-model="insureitem.switch" style="margin-right: 10px;" disabled></el-checkbox>
+                    <span>{{ insureitem.kindName }}</span>
+                  </div>
+                  <div>
+                    <el-select v-if="insureitem.amtList.length > 0" filterable v-model="insureitem.amount"
+                      placeholder="请选择"
+                      @change="(value) => amtListChange(value, insureitem.amtList, insureindex, solutionindex)"
+                      style="width: 200px;" clearable :size="overSize">
+                      <el-option v-for="(item, index) in insureitem.amtList" :key="index" :label="item.label"
+                        :value="item.value"></el-option>
+                    </el-select>
+                    <span v-else>
+                      <el-input-number @change="(value) => inputNumberChange(value, insureindex, solutionindex)"
+                        size="small" style="width:200px; margin-right: 10px;" v-model="insureitem.amount"
+                        :min="0"></el-input-number>次
                     </span>
-                  </main>
-                </div>
-              </div>
-            </div>
-            <div>
-              <div class="flex a-c">
-                <h4>驾意险方案配置</h4>
-                <el-button size="mini"
-                  style="margin-left: 15px;background: #EAEDF1;border: 1px solid #D9D9D9;color: #2D4D89;"
-                  @click="AddDriverInsurancePlan(solutionindex)">添加配置</el-button>
-              </div>
-              <div v-for="(configureitem, configureindex) in solutionitem.drvingIntentions" :key="configureindex"
-                style="margin-bottom: 20px;">
-                <div class="flex j-s a-c">
-                  <div class="flex a-c " style="margin-bottom: 15px;" v-for="DriverTypeitem in configureitem.driverType"
-                    :key="DriverTypeitem.id">
-                    <span style="margin-right: 10px;color: #262626;font-size: 14px;font-weight: bold;">{{
-                      DriverTypeitem.typeName
-                    }}</span>
-                    <el-checkbox v-model="childrenitem.checked" v-for="childrenitem in DriverTypeitem.children"
-                      :key="childrenitem.id"
-                      @change="event => drvingcheckboxChange(event, childrenitem, solutionindex, configureindex)">{{
-                        childrenitem.typeName }}</el-checkbox>
                   </div>
+                </main>
+              </div>
+              <div class="Risk">
+                <section class="flex j-s a-c ">
+                  <span class="flex j-start">已选险别</span>
+                  <span class="flex j-c">投保保额</span>
+                  <span class="flex j-end">操作</span>
+                </section>
+                <main class="flex j-s a-c" v-for="(filteredInsureitem, filteredInsureindex) in solutionitem.kinds"
+                  :key="filteredInsureindex" v-if="filteredInsureitem.switch">
+                  <span class="flex j-start">{{ filteredInsureitem.kindName }}</span>
+                  <span class="flex j-c" v-if="['A'].includes(filteredInsureitem.kindCode)">{{
+                    filteredInsureitem.amountDesc }}</span>
+                  <span class="flex j-c"
+                    v-else-if="['MJ1', 'MJ2', 'MJ3', 'MJ4'].includes(filteredInsureitem.kindCode)">{{
+                      filteredInsureitem.amount }}%</span>
+                  <span class="flex j-c"
+                    v-else-if="['TY1', 'TY2', 'TY3', 'TY4'].includes(filteredInsureitem.kindCode)">{{
+                      filteredInsureitem.amount }}次</span>
+                  <span class="flex j-c" v-else>{{ convertedValue(filteredInsureitem.amount) }}</span>
                   <span class="flex j-end">
                     <i class="el-icon-delete" style="font-size: 20px;"
-                      @click="drvingDel(solutionindex, configureindex)"></i>
+                      @click="InsureDel(solutionindex, filteredInsureitem.kindCode)"></i>
                   </span>
+                </main>
+              </div>
+            </div>
+          </div>
+          <div>
+            <div class="flex a-c">
+              <h4>驾意险方案配置</h4>
+              <el-button size="mini"
+                style="margin-left: 15px;background: #EAEDF1;border: 1px solid #D9D9D9;color: #2D4D89;"
+                @click="AddDriverInsurancePlan(solutionindex)">添加配置</el-button>
+            </div>
+            <div v-for="(configureitem, configureindex) in solutionitem.drvingIntentions" :key="configureindex"
+              style="margin-bottom: 20px;">
+              <div class="flex j-s a-c">
+                <div class="flex a-c " style="margin-bottom: 15px;" v-for="DriverTypeitem in configureitem.driverType"
+                  :key="DriverTypeitem.id">
+                  <span style="margin-right: 10px;color: #262626;font-size: 14px;font-weight: bold;">{{
+                    DriverTypeitem.typeName
+                  }}</span>
+                  <el-checkbox v-model="childrenitem.checked" v-for="childrenitem in DriverTypeitem.children"
+                    :key="childrenitem.id"
+                    @change="event => drvingcheckboxChange(event, childrenitem, solutionindex, configureindex)">{{
+                      childrenitem.typeName }}</el-checkbox>
                 </div>
-                <el-form ref="form" :model="formitem" label-width="120px" size="small"
-                  v-for="(formitem, formindex) in configureitem.list" :key="formindex">
-                  <el-row>
-                    <el-col :span="24">
-                      <el-col :span="10">
-                        <el-form-item label="驾意选择:">
-                          <el-select
-                            v-if="formitem.isMultiple == 1 && !formitem.drvingList[0].insDrivingIntentionInsurances"
-                            filterable multiple v-model="formitem.drivingIntentionIds" placeholder="请选择" clearable
-                            :size="overSize" style="width: 250px;"
-                            @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
-                            <el-option :label="item.projectName" :value="item.id"
-                              v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
-                          </el-select>
-                          <el-select
-                            v-else-if="formitem.isMultiple == 1 && formitem.drvingList[0].insDrivingIntentionInsurances"
-                            filterable v-model="formitem.parentId" placeholder="请选择" clearable :size="overSize"
-                            style="width: 250px;"
-                            @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
-                            <el-option :label="item.projectName" :value="item.id"
-                              v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
-                          </el-select>
-                          <el-select
-                            v-else-if="formitem.isMultiple == 0 && !formitem.drvingList[0].insDrivingIntentionInsurances"
-                            filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable :size="overSize"
+                <span class="flex j-end">
+                  <i class="el-icon-delete" style="font-size: 20px;"
+                    @click="drvingDel(solutionindex, configureindex)"></i>
+                </span>
+              </div>
+              <el-form ref="form" :model="formitem" label-width="120px" size="small"
+                v-for="(formitem, formindex) in configureitem.list" :key="formindex">
+                <el-row>
+                  <el-col :span="24">
+                    <el-col :span="10">
+                      <el-form-item label="驾意选择:">
+                        <el-select
+                          v-if="formitem.isMultiple == 1 && !formitem.drvingList[0].insDrivingIntentionInsurances"
+                          filterable multiple v-model="formitem.drivingIntentionIds" placeholder="请选择" clearable
+                          :size="overSize" style="width: 250px;"
+                          @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
+                          <el-option :label="item.projectName" :value="item.id"
+                            v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
+                        </el-select>
+                        <el-select
+                          v-else-if="formitem.isMultiple == 1 && formitem.drvingList[0].insDrivingIntentionInsurances"
+                          filterable v-model="formitem.parentId" placeholder="请选择" clearable :size="overSize"
+                          style="width: 250px;"
+                          @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
+                          <el-option :label="item.projectName" :value="item.id"
+                            v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
+                        </el-select>
+                        <el-select
+                          v-else-if="formitem.isMultiple == 0 && !formitem.drvingList[0].insDrivingIntentionInsurances"
+                          filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable :size="overSize"
+                          style="width: 250px;"
+                          @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
+                          <el-option :label="item.projectName" :value="item.id"
+                            v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
+                        </el-select>
+                        <el-select
+                          v-else-if="formitem.isMultiple == 0 && formitem.drvingList[0].insDrivingIntentionInsurances"
+                          filterable v-model="formitem.parentId" placeholder="请选择" clearable :size="overSize"
+                          style="width: 250px;"
+                          @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
+                          <el-option :label="item.projectName" :value="item.id"
+                            v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
+                        </el-select>
+                        <template v-if="formitem.drvingChildren">
+                          <el-select v-if="formitem.isMultiple == 1" multiple filterable
+                            v-model="formitem.drivingIntentionIds" placeholder="请选择" clearable :size="overSize"
                             style="width: 250px;"
-                            @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
+                            @change="event => drivingChildrenChange(event, solutionindex, configureindex, formindex)">
                             <el-option :label="item.projectName" :value="item.id"
-                              v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
+                              v-for="(item, index) in formitem.drvingChildren" :key="index"></el-option>
                           </el-select>
-                          <el-select
-                            v-else-if="formitem.isMultiple == 0 && formitem.drvingList[0].insDrivingIntentionInsurances"
-                            filterable v-model="formitem.parentId" placeholder="请选择" clearable :size="overSize"
-                            style="width: 250px;"
-                            @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
+                          <el-select v-else filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable
+                            :size="overSize" style="width: 250px;"
+                            @change="event => drivingChildrenChange(event, solutionindex, configureindex, formindex)">
                             <el-option :label="item.projectName" :value="item.id"
-                              v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
+                              v-for="(item, index) in formitem.drvingChildren" :key="index"></el-option>
                           </el-select>
-                          <template v-if="formitem.drvingChildren">
-                            <el-select v-if="formitem.isMultiple == 1" multiple filterable
-                              v-model="formitem.drivingIntentionIds" placeholder="请选择" clearable :size="overSize"
-                              style="width: 250px;"
-                              @change="event => drivingChildrenChange(event, solutionindex, configureindex, formindex)">
-                              <el-option :label="item.projectName" :value="item.id"
-                                v-for="(item, index) in formitem.drvingChildren" :key="index"></el-option>
-                            </el-select>
-                            <el-select v-else filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable
-                              :size="overSize" style="width: 250px;"
-                              @change="event => drivingChildrenChange(event, solutionindex, configureindex, formindex)">
-                              <el-option :label="item.projectName" :value="item.id"
-                                v-for="(item, index) in formitem.drvingChildren" :key="index"></el-option>
-                            </el-select>
-                          </template>
-                        </el-form-item>
-                      </el-col>
-                      <el-col :span="4">
-                        <el-form-item label="别名:">
-                          <el-input v-model="formitem.alias" placeholder="驾意险别名"></el-input>
-                        </el-form-item>
-                      </el-col>
-                      <el-col :span="5">
-                        <el-form-item label="座位数:">
-                          <el-input-number v-model="formitem.seatNum" controls-position="right" :min="1"
-                            :max="10"></el-input-number>
-                          <span>座</span>
-                        </el-form-item>
-                      </el-col>
-                      <el-col :span="5">
-                        <el-form-item label="份数:">
-                          <el-input-number v-model="formitem.quantity" controls-position="right" :min="1"
-                            :max="10"></el-input-number>
-                          <span>份</span>
-                        </el-form-item>
-                      </el-col>
+                        </template>
+                      </el-form-item>
                     </el-col>
-                    <el-col :span="20">
-                      <div v-for="(LiabilityTermsitem, LiabilityTermsindex) in formitem.LiabilityTerms"
-                        :key="LiabilityTermsindex">
-                        <div style="font-weight: bold;margin-bottom: 10px;">{{ LiabilityTermsitem.projectName }}</div>
-                        <el-table :data="LiabilityTermsitem.LiabilityTerms" size="mini" :header-cell-style="{
-                          background: '#F7F7F9',
-                          fontWeight: '700',
-                          color: '#606266',
-                        }">
-                          <el-table-column prop="name" label="保险责任" align="center">
-                          </el-table-column>
-                          <el-table-column prop="amount" label="保险金额" width="180" align="center">
-                          </el-table-column>
-                          <el-table-column prop="premium" label="保费(元)" width="180" align="center">
-                          </el-table-column>
-                        </el-table>
-                      </div>
+                    <el-col :span="4">
+                      <el-form-item label="别名:">
+                        <el-input v-model="formitem.alias" placeholder="驾意险别名"></el-input>
+                      </el-form-item>
                     </el-col>
-                  </el-row>
-                </el-form>
-              </div>
+                    <el-col :span="5">
+                      <el-form-item label="座位数:">
+                        <el-input-number v-model="formitem.seatNum" controls-position="right" :min="1"
+                          :max="10"></el-input-number>
+                        <span>座</span>
+                      </el-form-item>
+                    </el-col>
+                    <el-col :span="5">
+                      <el-form-item label="份数:">
+                        <el-input-number v-model="formitem.quantity" controls-position="right" :min="1"
+                          :max="10"></el-input-number>
+                        <span>份</span>
+                      </el-form-item>
+                    </el-col>
+                  </el-col>
+                  <el-col :span="20">
+                    <div v-for="(LiabilityTermsitem, LiabilityTermsindex) in formitem.LiabilityTerms"
+                      :key="LiabilityTermsindex">
+                      <div style="font-weight: bold;margin-bottom: 10px;">{{ LiabilityTermsitem.projectName }}</div>
+                      <el-table :data="LiabilityTermsitem.LiabilityTerms" size="mini" :header-cell-style="{
+                        background: '#F7F7F9',
+                        fontWeight: '700',
+                        color: '#606266',
+                      }">
+                        <el-table-column prop="name" label="保险责任" align="center">
+                        </el-table-column>
+                        <el-table-column prop="amount" label="保险金额" width="180" align="center">
+                        </el-table-column>
+                        <el-table-column prop="premium" label="保费(元)" width="180" align="center">
+                        </el-table-column>
+                      </el-table>
+                    </div>
+                  </el-col>
+                </el-row>
+              </el-form>
             </div>
           </div>
         </div>
       </div>
-      <span slot="footer" class="dialog-footer">
-        <el-button :size="overSize" style="background: #EAEDF1;color: #2D4D89;" @click="ordinaryPlanCancel">取
-          消</el-button>
-        <el-button :size="overSize" style="background: #2D4D89;color: #fff;border-color: #2D4D89;" type="primary"
-          @click="solutionSubmit('solutionForm')">确 定</el-button>
-      </span>
+    </div>
+    <span slot="footer" class="dialog-footer">
+      <el-button :size="overSize" style="background: #EAEDF1;color: #2D4D89;" @click="ordinaryPlanCancel">取
+        消</el-button>
+      <el-button :size="overSize" style="background: #2D4D89;color: #fff;border-color: #2D4D89;" type="primary"
+        @click="solutionSubmit('solutionForm')">确 定</el-button>
+    </span>
   </div>
 </template>
 <!-- 行为区域 -->
@@ -250,6 +256,15 @@ export default {
         { prop: "companyId", label: "保险公司编码", minWidth: 160, },
         { prop: "productName", label: "方案险种", minWidth: 180, },
       ],
+      solutionrules: {
+        schemeName: [
+          { required: true, message: '方案名称必填', trigger: 'blur' }
+        ],
+        priorityLevel: [
+          { required: true, message: '序号必填', trigger: 'blur' },
+          { validator: this.validatePriority, trigger: 'blur' },
+        ],
+      },
       solutionResult: [],
       //操作符字典
       pageRequest: {
@@ -264,6 +279,7 @@ export default {
         productList: [
           {
             schemeName: "",
+            priorityLevel: "",//方案序号
             description: "",
             kinds: [],
             drvingIntentions: [
@@ -301,6 +317,15 @@ export default {
   },
   // 方法函数
   methods: {
+    validatePriority(rule, value, callback) {
+      if (!value) {
+        callback(new Error('请输入序号'));
+      } else if (!/^[1-9][0-9]?$/.test(value)) {
+        callback(new Error('请输入 1-99 的整数'));
+      } else {
+        callback();
+      }
+    },
     // drivingChange(event, solutionindex, configureindex, formindex) {
     //   if (event) {
     //     if (event instanceof Array) {
@@ -493,6 +518,7 @@ export default {
       })
       this.solutionData.productList.push({
         schemeName: "",
+        priorityLevel: "",//方案序号
         description: "",
         kinds: this.solutionData.productName !== '单交' ? list : [],
         drvingIntentions: [
@@ -532,43 +558,61 @@ export default {
         seatNum: ""//座位数
       });
     },
-    ordinaryPlanCancel () {
+    ordinaryPlanCancel() {
       this.$emit('ordinaryPlanCancel')
     },
-    solutionSubmit(formName) {
-      if (this.solutionDialogType == 'add') {
-        this.$api.insCompany.shcemeAdd({...this.solutionData,carnature:"01",vehicleType:"A1",energyType:"0"}).then((res) => {
-          if (res.code == '200') {
-            this.$message({
-              type: 'success',
-              message: res.msg,
-            });
-            this.solutionFindPage();
-            this.$emit('ordinaryPlanSubmit')
-          } else {
-            this.$message({
-              type: 'error',
-              message: res.msg,
-            });
-          }
+    solutionSubmit() {
+      const promises = this.solutionData.productList.map((_, index) => {
+        const formName = `solutionForm${index}`;
+        return new Promise((resolve, reject) => {
+          this.$refs[formName][0].validate((valid) => {
+            if (valid) {
+              resolve();
+            } else {
+              reject(`方案 ${index + 1} 校验失败!`);
+            }
+          });
         });
-      } else {
-        this.$api.insCompany.schemeUpdate({...this.solutionData,carnature:"01",vehicleType:"A1",energyType:"0"}).then((res) => {
-          if (res.code == '200') {
-            this.$message({
-              type: 'success',
-              message: res.msg,
+      });
+      Promise.all(promises)
+        .then(() => {
+          if (this.solutionDialogType == 'add') {
+            this.$api.insCompany.shcemeAdd({ ...this.solutionData, carnature: "01", vehicleType: "A1", energyType: "0" }).then((res) => {
+              if (res.code == '200') {
+                this.$message({
+                  type: 'success',
+                  message: res.msg,
+                });
+                this.solutionFindPage();
+                this.$emit('ordinaryPlanSubmit')
+              } else {
+                this.$message({
+                  type: 'error',
+                  message: res.msg,
+                });
+              }
             });
-            this.solutionFindPage();
-            this.$emit('ordinaryPlanSubmit')
           } else {
-            this.$message({
-              type: 'error',
-              message: res.msg,
+            this.$api.insCompany.schemeUpdate({ ...this.solutionData, carnature: "01", vehicleType: "A1", energyType: "0" }).then((res) => {
+              if (res.code == '200') {
+                this.$message({
+                  type: 'success',
+                  message: res.msg,
+                });
+                this.solutionFindPage();
+                this.$emit('ordinaryPlanSubmit')
+              } else {
+                this.$message({
+                  type: 'error',
+                  message: res.msg,
+                });
+              }
             });
           }
+        })
+        .catch((error) => {
+          console.log(error);
         });
-      }
     },
     getDicType(type) {
       this.$api.insCompany.dicType(type).then((res) => {
@@ -582,7 +626,7 @@ export default {
       this.solutionDialogTitle = '添加方案'
     },
     solutionFindPage() {
-      this.$api.insCompany.schemeList({ ...this.pageRequest, companyId: this.companyId,carnature:"01",vehicleType:"A1",energyType:"0" }).then((res) => {
+      this.$api.insCompany.schemeList({ ...this.pageRequest, companyId: this.companyId, carnature: "01", vehicleType: "A1", energyType: "0" }).then((res) => {
         if (res.code == '200') {
           let pageList = {
             content: res.data.records,
@@ -603,7 +647,7 @@ export default {
     solutionUpdate({ row, column }) {
       this.solutionDialogType = 'edit';
       this.solutionDialogTitle = '编辑方案'
-      this.$api.insCompany.schemedetails(row.companyId, row.productId,"01",'A1','0').then((res) => {
+      this.$api.insCompany.schemedetails(row.companyId, row.productId, "01", 'A1', '0').then((res) => {
         if (res.code == '200') {
           res.data.productList.map(valA => {
             valA.kinds.map(valB => {
@@ -616,7 +660,7 @@ export default {
               data.list.map(val => {
                 if (val.parentId != '0') {
                   let obj = val.drvingList.find(item => item.id == val.parentId)
-                    val.drvingChildren = obj.insDrivingIntentionInsurances;
+                  val.drvingChildren = obj.insDrivingIntentionInsurances;
                 }
               })
               const listCodes = data.list.map(item => item.code); // 获取当前 data 的所有 code
@@ -675,6 +719,7 @@ export default {
   align-items: flex-end;
   justify-content: flex-end;
 }
+
 /deep/ {
   .el-radio__input.is-checked .el-radio__inner,
   .el-checkbox__input.is-checked .el-checkbox__inner,
@@ -805,4 +850,3 @@ export default {
   background: #F2F2F2;
 }
 </style>
-

+ 89 - 46
src/views/AgreementManage/InsuranceCompany/CargoTruck/BusinessOperation/Fuel/OrdinaryPlan.vue

@@ -7,8 +7,8 @@
     <!-- @findPage="solutionFindPage" -->
     <kt-common-table :tableHeights="700" :SerialShow="false" :operationWidth="200" :showOperation="true"
       :showBatchDelete="false" :showBatchSettled="false" :showBatchPrint="false" :data="solutionResult" button2Name="编辑"
-      button2Type="text" @findPage="solutionFindPage" @handleButton2="solutionUpdate" button3Name="删除" button3Type="text" @handleButton3="solutionDel"
-      :columns="solutionColumns">
+      button2Type="text" @findPage="solutionFindPage" @handleButton2="solutionUpdate" button3Name="删除"
+      button3Type="text" @handleButton3="solutionDel" :columns="solutionColumns">
     </kt-common-table>
     <el-dialog v-dialogDrag :title="solutionDialogTitle" :visible.sync="solutionVisible" width="90%" top="2vh"
       @close="solutioncloseDialog">
@@ -30,16 +30,22 @@
           <div v-for="(solutionitem, solutionindex) in solutionData.productList" :key="solutionindex">
             <div class="flex j-s a-c " style="margin-top: 20px;font-size: 16px;color: #262626;">
               <span>方案{{ solutionindex + 1 }}</span>
-              <el-button v-if="solutionindex > 0" type="primary" size="small" icon="el-icon-delete" class="planOption-del"
-                @click="planOptiondel(solutionindex)">方案删除</el-button>
+              <el-button v-if="solutionindex > 0" type="primary" size="small" icon="el-icon-delete"
+                class="planOption-del" @click="planOptiondel(solutionindex)">方案删除</el-button>
             </div>
-            <el-form ref="solutionForm" :model="solutionitem" label-width="120px" :size="overSize">
+            <el-form :ref="`solutionForm${solutionindex}`" :rules="solutionrules" :model="solutionitem"
+              label-width="120px" :size="overSize">
               <el-row>
                 <el-col :span="8">
-                  <el-form-item label="方案名称">
+                  <el-form-item label="方案名称" prop="schemeName">
                     <el-input type="text" v-model="solutionitem.schemeName" placeholder="输入方案名称"></el-input>
                   </el-form-item>
                 </el-col>
+                <el-col :span="4">
+                  <el-form-item label="序号" prop="priorityLevel">
+                    <el-input type="text" v-model="solutionitem.priorityLevel" clearable :maxlength="2"></el-input>
+                  </el-form-item>
+                </el-col>
                 <el-col :span="20">
                   <el-form-item label="方案描述">
                     <el-input type="textarea" v-model="solutionitem.description" placeholder="输入方案描述" maxlength="100"
@@ -158,8 +164,8 @@
                           </el-select>
                           <el-select
                             v-else-if="formitem.isMultiple == 0 && !formitem.drvingList[0].insDrivingIntentionInsurances"
-                            filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable :size="overSize"
-                            style="width: 250px;"
+                            filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable
+                            :size="overSize" style="width: 250px;"
                             @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
                             <el-option :label="item.projectName" :value="item.id"
                               v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
@@ -180,8 +186,8 @@
                               <el-option :label="item.projectName" :value="item.id"
                                 v-for="(item, index) in formitem.drvingChildren" :key="index"></el-option>
                             </el-select>
-                            <el-select v-else filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable
-                              :size="overSize" style="width: 250px;"
+                            <el-select v-else filterable v-model="formitem.drivingIntentionId" placeholder="请选择"
+                              clearable :size="overSize" style="width: 250px;"
                               @change="event => drivingChildrenChange(event, solutionindex, configureindex, formindex)">
                               <el-option :label="item.projectName" :value="item.id"
                                 v-for="(item, index) in formitem.drvingChildren" :key="index"></el-option>
@@ -275,6 +281,15 @@ export default {
         { prop: "companyId", label: "保险公司编码", minWidth: 160, },
         { prop: "productName", label: "方案险种", minWidth: 180, },
       ],
+      solutionrules: {
+        schemeName: [
+          { required: true, message: '方案名称必填', trigger: 'blur' }
+        ],
+        priorityLevel: [
+          { required: true, message: '序号必填', trigger: 'blur' },
+          { validator: this.validatePriority, trigger: 'blur' },
+        ],
+      },
       solutionResult: [],
       //操作符字典
       pageRequest: {
@@ -289,6 +304,7 @@ export default {
         productList: [
           {
             schemeName: "",
+            priorityLevel: "",//方案序号
             description: "",
             kinds: [],
             drvingIntentions: [
@@ -308,12 +324,12 @@ export default {
     }
   },
   watch: {
-    activeIndex (newVal) {
+    activeIndex(newVal) {
       if (newVal === 0) {
         this.initData()
       }
     },
-    ordinaryIndex (newVal) {
+    ordinaryIndex(newVal) {
       if (newVal) {
         this.initData()
       }
@@ -321,13 +337,13 @@ export default {
   },
   // 生命周期函数
   created() {
-    if (this.$route.query.type*1 === 0) {
+    if (this.$route.query.type * 1 === 0) {
       this.initData()
     }
   },
   // 方法函数
   methods: {
-    initData () {
+    initData() {
       this.companyId = this.$route.query.companyId;
       this.solutionData.companyId = this.$route.query.companyId;
       this.getDicType("productsType"); //车险产品
@@ -344,6 +360,15 @@ export default {
       });
       localStorage.setItem("insureList", JSON.stringify(this.insureList));
     },
+    validatePriority(rule, value, callback) {
+      if (!value) {
+        callback(new Error('请输入序号'));
+      } else if (!/^[1-9][0-9]?$/.test(value)) {
+        callback(new Error('请输入 1-99 的整数'));
+      } else {
+        callback();
+      }
+    },
     // drivingChange(event, solutionindex, configureindex, formindex) {
     //   if (event) {
     //     if (event instanceof Array) {
@@ -536,6 +561,7 @@ export default {
       })
       this.solutionData.productList.push({
         schemeName: "",
+        priorityLevel: "",//方案序号
         description: "",
         kinds: this.solutionData.productName !== '单交' ? list : [],
         drvingIntentions: [
@@ -575,40 +601,58 @@ export default {
         seatNum: ""//座位数
       });
     },
-    solutionSubmit(formName) {
-      if (this.solutionDialogType == 'add') {
-        this.$api.insCompany.shcemeAdd({...this.solutionData,carnature:"01",vehicleType:"A1",energyType:"0"}).then((res) => {
-          if (res.code == '200') {
-            this.$message({
-              type: 'success',
-              message: res.msg,
-            });
-            this.solutionVisible = false;
-            this.solutionFindPage();
-          } else {
-            this.$message({
-              type: 'error',
-              message: res.msg,
-            });
-          }
+    solutionSubmit() {
+      const promises = this.solutionData.productList.map((_, index) => {
+        const formName = `solutionForm${index}`;
+        return new Promise((resolve, reject) => {
+          this.$refs[formName][0].validate((valid) => {
+            if (valid) {
+              resolve();
+            } else {
+              reject(`方案 ${index + 1} 校验失败!`);
+            }
+          });
         });
-      } else {
-        this.$api.insCompany.schemeUpdate({...this.solutionData,carnature:"01",vehicleType:"A1",energyType:"0"}).then((res) => {
-          if (res.code == '200') {
-            this.$message({
-              type: 'success',
-              message: res.msg,
+      });
+      Promise.all(promises)
+        .then(() => {
+          if (this.solutionDialogType == 'add') {
+            this.$api.insCompany.shcemeAdd({ ...this.solutionData, carnature: "01", vehicleType: "A1", energyType: "0" }).then((res) => {
+              if (res.code == '200') {
+                this.$message({
+                  type: 'success',
+                  message: res.msg,
+                });
+                this.solutionVisible = false;
+                this.solutionFindPage();
+              } else {
+                this.$message({
+                  type: 'error',
+                  message: res.msg,
+                });
+              }
             });
-            this.solutionVisible = false;
-            this.solutionFindPage();
           } else {
-            this.$message({
-              type: 'error',
-              message: res.msg,
+            this.$api.insCompany.schemeUpdate({ ...this.solutionData, carnature: "01", vehicleType: "A1", energyType: "0" }).then((res) => {
+              if (res.code == '200') {
+                this.$message({
+                  type: 'success',
+                  message: res.msg,
+                });
+                this.solutionVisible = false;
+                this.solutionFindPage();
+              } else {
+                this.$message({
+                  type: 'error',
+                  message: res.msg,
+                });
+              }
             });
           }
+        })
+        .catch((error) => {
+          console.log(error);
         });
-      }
     },
     getDicType(type) {
       this.$api.insCompany.dicType(type).then((res) => {
@@ -623,7 +667,7 @@ export default {
       this.solutionVisible = true;
     },
     solutionFindPage() {
-      this.$api.insCompany.schemeList({ ...this.pageRequest, companyId: this.companyId,carnature:"01",vehicleType:"A1",energyType:"0" }).then((res) => {
+      this.$api.insCompany.schemeList({ ...this.pageRequest, companyId: this.companyId, carnature: "01", vehicleType: "A1", energyType: "0" }).then((res) => {
         if (res.code == '200') {
           let pageList = {
             content: res.data.records,
@@ -644,7 +688,7 @@ export default {
     solutionUpdate({ row, column }) {
       this.solutionDialogType = 'edit';
       this.solutionDialogTitle = '编辑方案'
-      this.$api.insCompany.schemedetails(row.companyId, row.productId,"01",'A1','0').then((res) => {
+      this.$api.insCompany.schemedetails(row.companyId, row.productId, "01", 'A1', '0').then((res) => {
         if (res.code == '200') {
           res.data.productList.map(valA => {
             valA.kinds.map(valB => {
@@ -657,7 +701,7 @@ export default {
               data.list.map(val => {
                 if (val.parentId != '0') {
                   let obj = val.drvingList.find(item => item.id == val.parentId)
-                    val.drvingChildren = obj.insDrivingIntentionInsurances;
+                  val.drvingChildren = obj.insDrivingIntentionInsurances;
                 }
               })
               const listCodes = data.list.map(item => item.code); // 获取当前 data 的所有 code
@@ -839,4 +883,3 @@ export default {
   background: #F2F2F2;
 }
 </style>
-

+ 285 - 241
src/views/AgreementManage/InsuranceCompany/CargoTruck/BusinessOperation/NewEnergy/AddOrdinaryPlan.vue

@@ -1,234 +1,240 @@
 <!-- 模板区域 -->
 <template>
   <div>
-      <div class="tab-panestyle">
-        <div class="tab-panecent">
-          <span>险种配置</span>
-          <el-radio-group :disabled="this.solutionDialogType == 'edit'" v-model="solutionData.productId"
-            @input="productInput" size="small" style="margin-left: 30px;">
-            <el-radio-button v-for="(productsitem, productsindex) in productsTypeoptions" :key="productsindex"
-              :label="productsitem.dictValue">{{
-                productsitem.dictTag }}</el-radio-button>
-          </el-radio-group>
+    <div class="tab-panestyle">
+      <div class="tab-panecent">
+        <span>险种配置</span>
+        <el-radio-group :disabled="this.solutionDialogType == 'edit'" v-model="solutionData.productId"
+          @input="productInput" size="small" style="margin-left: 30px;">
+          <el-radio-button v-for="(productsitem, productsindex) in productsTypeoptions" :key="productsindex"
+            :label="productsitem.dictValue">{{
+              productsitem.dictTag }}</el-radio-button>
+        </el-radio-group>
+      </div>
+      <div class="tab-panecent">
+        <div class=" flex j-s a-c">
+          <el-button type="primary" size="small" icon="el-icon-plus" class="planOption-btn"
+            @click="planOptionadd">方案新增</el-button>
         </div>
-        <div class="tab-panecent">
-          <div class=" flex j-s a-c">
-            <el-button type="primary" size="small" icon="el-icon-plus" class="planOption-btn"
-              @click="planOptionadd">方案新增</el-button>
+        <div v-for="(solutionitem, solutionindex) in solutionData.productList" :key="solutionindex">
+          <div class="flex j-s a-c " style="margin-top: 20px;font-size: 16px;color: #262626;">
+            <span>方案{{ solutionindex + 1 }}</span>
+            <el-button v-if="solutionindex > 0" type="primary" size="small" icon="el-icon-delete" class="planOption-del"
+              @click="planOptiondel(solutionindex)">方案删除</el-button>
           </div>
-          <div v-for="(solutionitem, solutionindex) in solutionData.productList" :key="solutionindex">
-            <div class="flex j-s a-c " style="margin-top: 20px;font-size: 16px;color: #262626;">
-              <span>方案{{ solutionindex + 1 }}</span>
-              <el-button v-if="solutionindex > 0" type="primary" size="small" icon="el-icon-delete" class="planOption-del"
-                @click="planOptiondel(solutionindex)">方案删除</el-button>
+          <el-form :ref="`solutionForm${solutionindex}`" :rules="solutionrules" :model="solutionitem"
+            label-width="120px" :size="overSize">
+            <el-row>
+              <el-col :span="8">
+                <el-form-item label="方案名称" prop="schemeName">
+                  <el-input type="text" v-model="solutionitem.schemeName" placeholder="输入方案名称"></el-input>
+                </el-form-item>
+              </el-col>
+              <el-col :span="4">
+                <el-form-item label="序号" prop="priorityLevel">
+                  <el-input type="text" v-model="solutionitem.priorityLevel" clearable :maxlength="2"></el-input>
+                </el-form-item>
+              </el-col>
+              <el-col :span="20">
+                <el-form-item label="方案描述">
+                  <el-input type="textarea" v-model="solutionitem.description" placeholder="输入方案描述" maxlength="100"
+                    show-word-limit></el-input>
+                </el-form-item>
+              </el-col>
+            </el-row>
+          </el-form>
+          <div v-if="['单商', '单三', '交三', '交商'].includes(solutionData.productName)">
+            <div class="flex j-s a-c">
+              <h4>商业险方案配置</h4>
             </div>
-            <el-form ref="solutionForm" :model="solutionitem" label-width="120px" :size="overSize">
-              <el-row>
-                <el-col :span="8">
-                  <el-form-item label="方案名称">
-                    <el-input type="text" v-model="solutionitem.schemeName" placeholder="输入方案名称"></el-input>
-                  </el-form-item>
-                </el-col>
-                <el-col :span="20">
-                  <el-form-item label="方案描述">
-                    <el-input type="textarea" v-model="solutionitem.description" placeholder="输入方案描述" maxlength="100"
-                      show-word-limit></el-input>
-                  </el-form-item>
-                </el-col>
-              </el-row>
-            </el-form>
-            <div v-if="['单商', '单三', '交三', '交商'].includes(solutionData.productName)">
-              <div class="flex j-s a-c">
-                <h4>商业险方案配置</h4>
-              </div>
-              <div class="flex j-start ">
-                <div class="Risk f-c" style="margin-right: 30px;">
-                  <section class="flex j-s a-c ">
-                    <div>
-                      全部险别
-                    </div>
-                    <div>
-                      投保保额
-                    </div>
-                  </section>
-                  <main class="flex j-s a-c" v-for="(insureitem, insureindex) in solutionitem.kinds" :key="insureindex">
-                    <div>
-                      <el-checkbox v-model="insureitem.switch" style="margin-right: 10px;" disabled></el-checkbox>
-                      <span>{{ insureitem.kindName }}</span>
-                    </div>
-                    <div>
-                      <el-select v-if="insureitem.amtList.length > 0" filterable v-model="insureitem.amount"
-                        placeholder="请选择"
-                        @change="(value) => amtListChange(value, insureitem.amtList, insureindex, solutionindex)"
-                        style="width: 200px;" clearable :size="overSize">
-                        <el-option v-for="(item, index) in insureitem.amtList" :key="index" :label="item.label"
-                          :value="item.value"></el-option>
-                      </el-select>
-                      <span v-else>
-                        <el-input-number @change="(value) => inputNumberChange(value, insureindex, solutionindex)"
-                          size="small" style="width:200px; margin-right: 10px;" v-model="insureitem.amount"
-                          :min="0"></el-input-number>次
-                      </span>
-                    </div>
-                  </main>
-                </div>
-                <div class="Risk">
-                  <section class="flex j-s a-c ">
-                    <span class="flex j-start">已选险别</span>
-                    <span class="flex j-c">投保保额</span>
-                    <span class="flex j-end">操作</span>
-                  </section>
-                  <main class="flex j-s a-c" v-for="(filteredInsureitem, filteredInsureindex) in solutionitem.kinds"
-                    :key="filteredInsureindex" v-if="filteredInsureitem.switch">
-                    <span class="flex j-start">{{ filteredInsureitem.kindName }}</span>
-                    <span class="flex j-c" v-if="['A'].includes(filteredInsureitem.kindCode)">{{
-                      filteredInsureitem.amountDesc }}</span>
-                    <span class="flex j-c"
-                      v-else-if="['MJ1', 'MJ2', 'MJ3', 'MJ4'].includes(filteredInsureitem.kindCode)">{{
-                        filteredInsureitem.amount }}%</span>
-                    <span class="flex j-c"
-                      v-else-if="['TY1', 'TY2', 'TY3', 'TY4'].includes(filteredInsureitem.kindCode)">{{
-                        filteredInsureitem.amount }}次</span>
-                    <span class="flex j-c" v-else>{{ convertedValue(filteredInsureitem.amount) }}</span>
-                    <span class="flex j-end">
-                      <i class="el-icon-delete" style="font-size: 20px;"
-                        @click="InsureDel(solutionindex, filteredInsureitem.kindCode)"></i>
+            <div class="flex j-start ">
+              <div class="Risk f-c" style="margin-right: 30px;">
+                <section class="flex j-s a-c ">
+                  <div>
+                    全部险别
+                  </div>
+                  <div>
+                    投保保额
+                  </div>
+                </section>
+                <main class="flex j-s a-c" v-for="(insureitem, insureindex) in solutionitem.kinds" :key="insureindex">
+                  <div>
+                    <el-checkbox v-model="insureitem.switch" style="margin-right: 10px;" disabled></el-checkbox>
+                    <span>{{ insureitem.kindName }}</span>
+                  </div>
+                  <div>
+                    <el-select v-if="insureitem.amtList.length > 0" filterable v-model="insureitem.amount"
+                      placeholder="请选择"
+                      @change="(value) => amtListChange(value, insureitem.amtList, insureindex, solutionindex)"
+                      style="width: 200px;" clearable :size="overSize">
+                      <el-option v-for="(item, index) in insureitem.amtList" :key="index" :label="item.label"
+                        :value="item.value"></el-option>
+                    </el-select>
+                    <span v-else>
+                      <el-input-number @change="(value) => inputNumberChange(value, insureindex, solutionindex)"
+                        size="small" style="width:200px; margin-right: 10px;" v-model="insureitem.amount"
+                        :min="0"></el-input-number>次
                     </span>
-                  </main>
-                </div>
-              </div>
-            </div>
-            <div>
-              <div class="flex a-c">
-                <h4>驾意险方案配置</h4>
-                <el-button size="mini"
-                  style="margin-left: 15px;background: #EAEDF1;border: 1px solid #D9D9D9;color: #2D4D89;"
-                  @click="AddDriverInsurancePlan(solutionindex)">添加配置</el-button>
-              </div>
-              <div v-for="(configureitem, configureindex) in solutionitem.drvingIntentions" :key="configureindex"
-                style="margin-bottom: 20px;">
-                <div class="flex j-s a-c">
-                  <div class="flex a-c " style="margin-bottom: 15px;" v-for="DriverTypeitem in configureitem.driverType"
-                    :key="DriverTypeitem.id">
-                    <span style="margin-right: 10px;color: #262626;font-size: 14px;font-weight: bold;">{{
-                      DriverTypeitem.typeName
-                    }}</span>
-                    <el-checkbox v-model="childrenitem.checked" v-for="childrenitem in DriverTypeitem.children"
-                      :key="childrenitem.id"
-                      @change="event => drvingcheckboxChange(event, childrenitem, solutionindex, configureindex)">{{
-                        childrenitem.typeName }}</el-checkbox>
                   </div>
+                </main>
+              </div>
+              <div class="Risk">
+                <section class="flex j-s a-c ">
+                  <span class="flex j-start">已选险别</span>
+                  <span class="flex j-c">投保保额</span>
+                  <span class="flex j-end">操作</span>
+                </section>
+                <main class="flex j-s a-c" v-for="(filteredInsureitem, filteredInsureindex) in solutionitem.kinds"
+                  :key="filteredInsureindex" v-if="filteredInsureitem.switch">
+                  <span class="flex j-start">{{ filteredInsureitem.kindName }}</span>
+                  <span class="flex j-c" v-if="['A'].includes(filteredInsureitem.kindCode)">{{
+                    filteredInsureitem.amountDesc }}</span>
+                  <span class="flex j-c"
+                    v-else-if="['MJ1', 'MJ2', 'MJ3', 'MJ4'].includes(filteredInsureitem.kindCode)">{{
+                      filteredInsureitem.amount }}%</span>
+                  <span class="flex j-c"
+                    v-else-if="['TY1', 'TY2', 'TY3', 'TY4'].includes(filteredInsureitem.kindCode)">{{
+                      filteredInsureitem.amount }}次</span>
+                  <span class="flex j-c" v-else>{{ convertedValue(filteredInsureitem.amount) }}</span>
                   <span class="flex j-end">
                     <i class="el-icon-delete" style="font-size: 20px;"
-                      @click="drvingDel(solutionindex, configureindex)"></i>
+                      @click="InsureDel(solutionindex, filteredInsureitem.kindCode)"></i>
                   </span>
+                </main>
+              </div>
+            </div>
+          </div>
+          <div>
+            <div class="flex a-c">
+              <h4>驾意险方案配置</h4>
+              <el-button size="mini"
+                style="margin-left: 15px;background: #EAEDF1;border: 1px solid #D9D9D9;color: #2D4D89;"
+                @click="AddDriverInsurancePlan(solutionindex)">添加配置</el-button>
+            </div>
+            <div v-for="(configureitem, configureindex) in solutionitem.drvingIntentions" :key="configureindex"
+              style="margin-bottom: 20px;">
+              <div class="flex j-s a-c">
+                <div class="flex a-c " style="margin-bottom: 15px;" v-for="DriverTypeitem in configureitem.driverType"
+                  :key="DriverTypeitem.id">
+                  <span style="margin-right: 10px;color: #262626;font-size: 14px;font-weight: bold;">{{
+                    DriverTypeitem.typeName
+                    }}</span>
+                  <el-checkbox v-model="childrenitem.checked" v-for="childrenitem in DriverTypeitem.children"
+                    :key="childrenitem.id"
+                    @change="event => drvingcheckboxChange(event, childrenitem, solutionindex, configureindex)">{{
+                      childrenitem.typeName }}</el-checkbox>
                 </div>
-                <el-form ref="form" :model="formitem" label-width="120px" size="small"
-                  v-for="(formitem, formindex) in configureitem.list" :key="formindex">
-                  <el-row>
-                    <el-col :span="24">
-                      <el-col :span="10">
-                        <el-form-item label="驾意选择:">
-                          <el-select
-                            v-if="formitem.isMultiple == 1 && !formitem.drvingList[0].insDrivingIntentionInsurances"
-                            filterable multiple v-model="formitem.drivingIntentionIds" placeholder="请选择" clearable
-                            :size="overSize" style="width: 250px;"
-                            @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
-                            <el-option :label="item.projectName" :value="item.id"
-                              v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
-                          </el-select>
-                          <el-select
-                            v-else-if="formitem.isMultiple == 1 && formitem.drvingList[0].insDrivingIntentionInsurances"
-                            filterable v-model="formitem.parentId" placeholder="请选择" clearable :size="overSize"
-                            style="width: 250px;"
-                            @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
-                            <el-option :label="item.projectName" :value="item.id"
-                              v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
-                          </el-select>
-                          <el-select
-                            v-else-if="formitem.isMultiple == 0 && !formitem.drvingList[0].insDrivingIntentionInsurances"
-                            filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable :size="overSize"
+                <span class="flex j-end">
+                  <i class="el-icon-delete" style="font-size: 20px;"
+                    @click="drvingDel(solutionindex, configureindex)"></i>
+                </span>
+              </div>
+              <el-form ref="form" :model="formitem" label-width="120px" size="small"
+                v-for="(formitem, formindex) in configureitem.list" :key="formindex">
+                <el-row>
+                  <el-col :span="24">
+                    <el-col :span="10">
+                      <el-form-item label="驾意选择:">
+                        <el-select
+                          v-if="formitem.isMultiple == 1 && !formitem.drvingList[0].insDrivingIntentionInsurances"
+                          filterable multiple v-model="formitem.drivingIntentionIds" placeholder="请选择" clearable
+                          :size="overSize" style="width: 250px;"
+                          @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
+                          <el-option :label="item.projectName" :value="item.id"
+                            v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
+                        </el-select>
+                        <el-select
+                          v-else-if="formitem.isMultiple == 1 && formitem.drvingList[0].insDrivingIntentionInsurances"
+                          filterable v-model="formitem.parentId" placeholder="请选择" clearable :size="overSize"
+                          style="width: 250px;"
+                          @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
+                          <el-option :label="item.projectName" :value="item.id"
+                            v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
+                        </el-select>
+                        <el-select
+                          v-else-if="formitem.isMultiple == 0 && !formitem.drvingList[0].insDrivingIntentionInsurances"
+                          filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable :size="overSize"
+                          style="width: 250px;"
+                          @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
+                          <el-option :label="item.projectName" :value="item.id"
+                            v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
+                        </el-select>
+                        <el-select
+                          v-else-if="formitem.isMultiple == 0 && formitem.drvingList[0].insDrivingIntentionInsurances"
+                          filterable v-model="formitem.parentId" placeholder="请选择" clearable :size="overSize"
+                          style="width: 250px;"
+                          @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
+                          <el-option :label="item.projectName" :value="item.id"
+                            v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
+                        </el-select>
+                        <template v-if="formitem.drvingChildren">
+                          <el-select v-if="formitem.isMultiple == 1" multiple filterable
+                            v-model="formitem.drivingIntentionIds" placeholder="请选择" clearable :size="overSize"
                             style="width: 250px;"
-                            @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
+                            @change="event => drivingChildrenChange(event, solutionindex, configureindex, formindex)">
                             <el-option :label="item.projectName" :value="item.id"
-                              v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
+                              v-for="(item, index) in formitem.drvingChildren" :key="index"></el-option>
                           </el-select>
-                          <el-select
-                            v-else-if="formitem.isMultiple == 0 && formitem.drvingList[0].insDrivingIntentionInsurances"
-                            filterable v-model="formitem.parentId" placeholder="请选择" clearable :size="overSize"
-                            style="width: 250px;"
-                            @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
+                          <el-select v-else filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable
+                            :size="overSize" style="width: 250px;"
+                            @change="event => drivingChildrenChange(event, solutionindex, configureindex, formindex)">
                             <el-option :label="item.projectName" :value="item.id"
-                              v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
+                              v-for="(item, index) in formitem.drvingChildren" :key="index"></el-option>
                           </el-select>
-                          <template v-if="formitem.drvingChildren">
-                            <el-select v-if="formitem.isMultiple == 1" multiple filterable
-                              v-model="formitem.drivingIntentionIds" placeholder="请选择" clearable :size="overSize"
-                              style="width: 250px;"
-                              @change="event => drivingChildrenChange(event, solutionindex, configureindex, formindex)">
-                              <el-option :label="item.projectName" :value="item.id"
-                                v-for="(item, index) in formitem.drvingChildren" :key="index"></el-option>
-                            </el-select>
-                            <el-select v-else filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable
-                              :size="overSize" style="width: 250px;"
-                              @change="event => drivingChildrenChange(event, solutionindex, configureindex, formindex)">
-                              <el-option :label="item.projectName" :value="item.id"
-                                v-for="(item, index) in formitem.drvingChildren" :key="index"></el-option>
-                            </el-select>
-                          </template>
-                        </el-form-item>
-                      </el-col>
-                      <el-col :span="4">
-                        <el-form-item label="别名:">
-                          <el-input v-model="formitem.alias" placeholder="驾意险别名"></el-input>
-                        </el-form-item>
-                      </el-col>
-                      <el-col :span="5">
-                        <el-form-item label="座位数:">
-                          <el-input-number v-model="formitem.seatNum" controls-position="right" :min="1"
-                            :max="10"></el-input-number>
-                          <span>座</span>
-                        </el-form-item>
-                      </el-col>
-                      <el-col :span="5">
-                        <el-form-item label="份数:">
-                          <el-input-number v-model="formitem.quantity" controls-position="right" :min="1"
-                            :max="10"></el-input-number>
-                          <span>份</span>
-                        </el-form-item>
-                      </el-col>
+                        </template>
+                      </el-form-item>
                     </el-col>
-                    <el-col :span="20">
-                      <div v-for="(LiabilityTermsitem, LiabilityTermsindex) in formitem.LiabilityTerms"
-                        :key="LiabilityTermsindex">
-                        <div style="font-weight: bold;margin-bottom: 10px;">{{ LiabilityTermsitem.projectName }}</div>
-                        <el-table :data="LiabilityTermsitem.LiabilityTerms" size="mini" :header-cell-style="{
-                          background: '#F7F7F9',
-                          fontWeight: '700',
-                          color: '#606266',
-                        }">
-                          <el-table-column prop="name" label="保险责任" align="center">
-                          </el-table-column>
-                          <el-table-column prop="amount" label="保险金额" width="180" align="center">
-                          </el-table-column>
-                          <el-table-column prop="premium" label="保费(元)" width="180" align="center">
-                          </el-table-column>
-                        </el-table>
-                      </div>
+                    <el-col :span="4">
+                      <el-form-item label="别名:">
+                        <el-input v-model="formitem.alias" placeholder="驾意险别名"></el-input>
+                      </el-form-item>
                     </el-col>
-                  </el-row>
-                </el-form>
-              </div>
+                    <el-col :span="5">
+                      <el-form-item label="座位数:">
+                        <el-input-number v-model="formitem.seatNum" controls-position="right" :min="1"
+                          :max="10"></el-input-number>
+                        <span>座</span>
+                      </el-form-item>
+                    </el-col>
+                    <el-col :span="5">
+                      <el-form-item label="份数:">
+                        <el-input-number v-model="formitem.quantity" controls-position="right" :min="1"
+                          :max="10"></el-input-number>
+                        <span>份</span>
+                      </el-form-item>
+                    </el-col>
+                  </el-col>
+                  <el-col :span="20">
+                    <div v-for="(LiabilityTermsitem, LiabilityTermsindex) in formitem.LiabilityTerms"
+                      :key="LiabilityTermsindex">
+                      <div style="font-weight: bold;margin-bottom: 10px;">{{ LiabilityTermsitem.projectName }}</div>
+                      <el-table :data="LiabilityTermsitem.LiabilityTerms" size="mini" :header-cell-style="{
+                        background: '#F7F7F9',
+                        fontWeight: '700',
+                        color: '#606266',
+                      }">
+                        <el-table-column prop="name" label="保险责任" align="center">
+                        </el-table-column>
+                        <el-table-column prop="amount" label="保险金额" width="180" align="center">
+                        </el-table-column>
+                        <el-table-column prop="premium" label="保费(元)" width="180" align="center">
+                        </el-table-column>
+                      </el-table>
+                    </div>
+                  </el-col>
+                </el-row>
+              </el-form>
             </div>
           </div>
         </div>
       </div>
-      <span slot="footer" class="dialog-footer">
-        <el-button :size="overSize" style="background: #EAEDF1;color: #2D4D89;" @click="ordinaryPlanCancel">取
-          消</el-button>
-        <el-button :size="overSize" style="background: #2D4D89;color: #fff;border-color: #2D4D89;" type="primary"
-          @click="solutionSubmit('solutionForm')">确 定</el-button>
-      </span>
+    </div>
+    <span slot="footer" class="dialog-footer">
+      <el-button :size="overSize" style="background: #EAEDF1;color: #2D4D89;" @click="ordinaryPlanCancel">取
+        消</el-button>
+      <el-button :size="overSize" style="background: #2D4D89;color: #fff;border-color: #2D4D89;" type="primary"
+        @click="solutionSubmit('solutionForm')">确 定</el-button>
+    </span>
   </div>
 </template>
 <!-- 行为区域 -->
@@ -250,6 +256,15 @@ export default {
         { prop: "companyId", label: "保险公司编码", minWidth: 160, },
         { prop: "productName", label: "方案险种", minWidth: 180, },
       ],
+      solutionrules: {
+        schemeName: [
+          { required: true, message: '方案名称必填', trigger: 'blur' }
+        ],
+        priorityLevel: [
+          { required: true, message: '序号必填', trigger: 'blur' },
+          { validator: this.validatePriority, trigger: 'blur' },
+        ],
+      },
       solutionResult: [],
       //操作符字典
       pageRequest: {
@@ -264,6 +279,7 @@ export default {
         productList: [
           {
             schemeName: "",
+            priorityLevel: "",//方案序号
             description: "",
             kinds: [],
             drvingIntentions: [
@@ -301,6 +317,15 @@ export default {
   },
   // 方法函数
   methods: {
+    validatePriority(rule, value, callback) {
+      if (!value) {
+        callback(new Error('请输入序号'));
+      } else if (!/^[1-9][0-9]?$/.test(value)) {
+        callback(new Error('请输入 1-99 的整数'));
+      } else {
+        callback();
+      }
+    },
     // drivingChange(event, solutionindex, configureindex, formindex) {
     //   if (event) {
     //     if (event instanceof Array) {
@@ -493,6 +518,7 @@ export default {
       })
       this.solutionData.productList.push({
         schemeName: "",
+        priorityLevel: "",//方案序号
         description: "",
         kinds: this.solutionData.productName !== '单交' ? list : [],
         drvingIntentions: [
@@ -532,43 +558,61 @@ export default {
         seatNum: ""//座位数
       });
     },
-    ordinaryPlanCancel () {
+    ordinaryPlanCancel() {
       this.$emit('ordinaryPlanCancel')
     },
-    solutionSubmit(formName) {
-      if (this.solutionDialogType == 'add') {
-        this.$api.insCompany.shcemeAdd({...this.solutionData,carnature:"01",vehicleType:"A1",energyType:"1"}).then((res) => {
-          if (res.code == '200') {
-            this.$message({
-              type: 'success',
-              message: res.msg,
-            });
-            this.solutionFindPage();
-            this.$emit('ordinaryPlanSubmit')
-          } else {
-            this.$message({
-              type: 'error',
-              message: res.msg,
-            });
-          }
+    solutionSubmit() {
+      const promises = this.solutionData.productList.map((_, index) => {
+        const formName = `solutionForm${index}`;
+        return new Promise((resolve, reject) => {
+          this.$refs[formName][0].validate((valid) => {
+            if (valid) {
+              resolve();
+            } else {
+              reject(`方案 ${index + 1} 校验失败!`);
+            }
+          });
         });
-      } else {
-        this.$api.insCompany.schemeUpdate({...this.solutionData,carnature:"01",vehicleType:"A1",energyType:"1"}).then((res) => {
-          if (res.code == '200') {
-            this.$message({
-              type: 'success',
-              message: res.msg,
+      });
+      Promise.all(promises)
+        .then(() => {
+          if (this.solutionDialogType == 'add') {
+            this.$api.insCompany.shcemeAdd({ ...this.solutionData, carnature: "01", vehicleType: "A1", energyType: "1" }).then((res) => {
+              if (res.code == '200') {
+                this.$message({
+                  type: 'success',
+                  message: res.msg,
+                });
+                this.solutionFindPage();
+                this.$emit('ordinaryPlanSubmit')
+              } else {
+                this.$message({
+                  type: 'error',
+                  message: res.msg,
+                });
+              }
             });
-            this.solutionFindPage();
-            this.$emit('ordinaryPlanSubmit')
           } else {
-            this.$message({
-              type: 'error',
-              message: res.msg,
+            this.$api.insCompany.schemeUpdate({ ...this.solutionData, carnature: "01", vehicleType: "A1", energyType: "1" }).then((res) => {
+              if (res.code == '200') {
+                this.$message({
+                  type: 'success',
+                  message: res.msg,
+                });
+                this.solutionFindPage();
+                this.$emit('ordinaryPlanSubmit')
+              } else {
+                this.$message({
+                  type: 'error',
+                  message: res.msg,
+                });
+              }
             });
           }
+        })
+        .catch((error) => {
+          console.log(error);
         });
-      }
     },
     getDicType(type) {
       this.$api.insCompany.dicType(type).then((res) => {
@@ -582,7 +626,7 @@ export default {
       this.solutionDialogTitle = '添加方案'
     },
     solutionFindPage() {
-      this.$api.insCompany.schemeList({ ...this.pageRequest, companyId: this.companyId,carnature:"01",vehicleType:"A1",energyType:"1" }).then((res) => {
+      this.$api.insCompany.schemeList({ ...this.pageRequest, companyId: this.companyId, carnature: "01", vehicleType: "A1", energyType: "1" }).then((res) => {
         if (res.code == '200') {
           let pageList = {
             content: res.data.records,
@@ -603,7 +647,7 @@ export default {
     solutionUpdate({ row, column }) {
       this.solutionDialogType = 'edit';
       this.solutionDialogTitle = '编辑方案'
-      this.$api.insCompany.schemedetails(row.companyId, row.productId,"01",'A1','1').then((res) => {
+      this.$api.insCompany.schemedetails(row.companyId, row.productId, "01", 'A1', '1').then((res) => {
         if (res.code == '200') {
           res.data.productList.map(valA => {
             valA.kinds.map(valB => {
@@ -616,7 +660,7 @@ export default {
               data.list.map(val => {
                 if (val.parentId != '0') {
                   let obj = val.drvingList.find(item => item.id == val.parentId)
-                    val.drvingChildren = obj.insDrivingIntentionInsurances;
+                  val.drvingChildren = obj.insDrivingIntentionInsurances;
                 }
               })
               const listCodes = data.list.map(item => item.code); // 获取当前 data 的所有 code
@@ -675,6 +719,7 @@ export default {
   align-items: flex-end;
   justify-content: flex-end;
 }
+
 /deep/ {
   .el-radio__input.is-checked .el-radio__inner,
   .el-checkbox__input.is-checked .el-checkbox__inner,
@@ -805,4 +850,3 @@ export default {
   background: #F2F2F2;
 }
 </style>
-

+ 90 - 47
src/views/AgreementManage/InsuranceCompany/CargoTruck/BusinessOperation/NewEnergy/OrdinaryPlan.vue

@@ -7,8 +7,8 @@
     <!-- @findPage="solutionFindPage" -->
     <kt-common-table :tableHeights="700" :SerialShow="false" :operationWidth="200" :showOperation="true"
       :showBatchDelete="false" :showBatchSettled="false" :showBatchPrint="false" :data="solutionResult" button2Name="编辑"
-      button2Type="text" @findPage="solutionFindPage" @handleButton2="solutionUpdate" button3Name="删除" button3Type="text" @handleButton3="solutionDel"
-      :columns="solutionColumns">
+      button2Type="text" @findPage="solutionFindPage" @handleButton2="solutionUpdate" button3Name="删除"
+      button3Type="text" @handleButton3="solutionDel" :columns="solutionColumns">
     </kt-common-table>
     <el-dialog v-dialogDrag :title="solutionDialogTitle" :visible.sync="solutionVisible" width="90%" top="2vh"
       @close="solutioncloseDialog">
@@ -30,16 +30,22 @@
           <div v-for="(solutionitem, solutionindex) in solutionData.productList" :key="solutionindex">
             <div class="flex j-s a-c " style="margin-top: 20px;font-size: 16px;color: #262626;">
               <span>方案{{ solutionindex + 1 }}</span>
-              <el-button v-if="solutionindex > 0" type="primary" size="small" icon="el-icon-delete" class="planOption-del"
-                @click="planOptiondel(solutionindex)">方案删除</el-button>
+              <el-button v-if="solutionindex > 0" type="primary" size="small" icon="el-icon-delete"
+                class="planOption-del" @click="planOptiondel(solutionindex)">方案删除</el-button>
             </div>
-            <el-form ref="solutionForm" :model="solutionitem" label-width="120px" :size="overSize">
+            <el-form :ref="`solutionForm${solutionindex}`" :rules="solutionrules" :model="solutionitem"
+              label-width="120px" :size="overSize">
               <el-row>
                 <el-col :span="8">
-                  <el-form-item label="方案名称">
+                  <el-form-item label="方案名称" prop="schemeName">
                     <el-input type="text" v-model="solutionitem.schemeName" placeholder="输入方案名称"></el-input>
                   </el-form-item>
                 </el-col>
+                <el-col :span="4">
+                  <el-form-item label="序号" prop="priorityLevel">
+                    <el-input type="text" v-model="solutionitem.priorityLevel" clearable :maxlength="2"></el-input>
+                  </el-form-item>
+                </el-col>
                 <el-col :span="20">
                   <el-form-item label="方案描述">
                     <el-input type="textarea" v-model="solutionitem.description" placeholder="输入方案描述" maxlength="100"
@@ -123,7 +129,7 @@
                     :key="DriverTypeitem.id">
                     <span style="margin-right: 10px;color: #262626;font-size: 14px;font-weight: bold;">{{
                       DriverTypeitem.typeName
-                    }}</span>
+                      }}</span>
                     <el-checkbox v-model="childrenitem.checked" v-for="childrenitem in DriverTypeitem.children"
                       :key="childrenitem.id"
                       @change="event => drvingcheckboxChange(event, childrenitem, solutionindex, configureindex)">{{
@@ -158,8 +164,8 @@
                           </el-select>
                           <el-select
                             v-else-if="formitem.isMultiple == 0 && !formitem.drvingList[0].insDrivingIntentionInsurances"
-                            filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable :size="overSize"
-                            style="width: 250px;"
+                            filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable
+                            :size="overSize" style="width: 250px;"
                             @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
                             <el-option :label="item.projectName" :value="item.id"
                               v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
@@ -180,8 +186,8 @@
                               <el-option :label="item.projectName" :value="item.id"
                                 v-for="(item, index) in formitem.drvingChildren" :key="index"></el-option>
                             </el-select>
-                            <el-select v-else filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable
-                              :size="overSize" style="width: 250px;"
+                            <el-select v-else filterable v-model="formitem.drivingIntentionId" placeholder="请选择"
+                              clearable :size="overSize" style="width: 250px;"
                               @change="event => drivingChildrenChange(event, solutionindex, configureindex, formindex)">
                               <el-option :label="item.projectName" :value="item.id"
                                 v-for="(item, index) in formitem.drvingChildren" :key="index"></el-option>
@@ -275,6 +281,15 @@ export default {
         { prop: "companyId", label: "保险公司编码", minWidth: 160, },
         { prop: "productName", label: "方案险种", minWidth: 180, },
       ],
+      solutionrules: {
+        schemeName: [
+          { required: true, message: '方案名称必填', trigger: 'blur' }
+        ],
+        priorityLevel: [
+          { required: true, message: '序号必填', trigger: 'blur' },
+          { validator: this.validatePriority, trigger: 'blur' },
+        ],
+      },
       solutionResult: [],
       //操作符字典
       pageRequest: {
@@ -289,6 +304,7 @@ export default {
         productList: [
           {
             schemeName: "",
+            priorityLevel: "",//方案序号
             description: "",
             kinds: [],
             drvingIntentions: [
@@ -308,12 +324,12 @@ export default {
     }
   },
   watch: {
-    activeIndex (newVal) {
+    activeIndex(newVal) {
       if (newVal === 0) {
         this.initData()
       }
     },
-    ordinaryIndex (newVal) {
+    ordinaryIndex(newVal) {
       if (newVal) {
         this.initData()
       }
@@ -321,13 +337,13 @@ export default {
   },
   // 生命周期函数
   created() {
-    if (this.$route.query.type*1 === 0) {
+    if (this.$route.query.type * 1 === 0) {
       this.initData()
     }
   },
   // 方法函数
   methods: {
-    initData () {
+    initData() {
       this.companyId = this.$route.query.companyId;
       this.solutionData.companyId = this.$route.query.companyId;
       this.getDicType("productsType"); //车险产品
@@ -344,6 +360,15 @@ export default {
       });
       localStorage.setItem("insureList", JSON.stringify(this.insureList));
     },
+    validatePriority(rule, value, callback) {
+      if (!value) {
+        callback(new Error('请输入序号'));
+      } else if (!/^[1-9][0-9]?$/.test(value)) {
+        callback(new Error('请输入 1-99 的整数'));
+      } else {
+        callback();
+      }
+    },
     // drivingChange(event, solutionindex, configureindex, formindex) {
     //   if (event) {
     //     if (event instanceof Array) {
@@ -536,6 +561,7 @@ export default {
       })
       this.solutionData.productList.push({
         schemeName: "",
+        priorityLevel: "",//方案序号
         description: "",
         kinds: this.solutionData.productName !== '单交' ? list : [],
         drvingIntentions: [
@@ -575,40 +601,58 @@ export default {
         seatNum: ""//座位数
       });
     },
-    solutionSubmit(formName) {
-      if (this.solutionDialogType == 'add') {
-        this.$api.insCompany.shcemeAdd({...this.solutionData,carnature:"01",vehicleType:"A1",energyType:"1"}).then((res) => {
-          if (res.code == '200') {
-            this.$message({
-              type: 'success',
-              message: res.msg,
-            });
-            this.solutionVisible = false;
-            this.solutionFindPage();
-          } else {
-            this.$message({
-              type: 'error',
-              message: res.msg,
-            });
-          }
+    solutionSubmit() {
+      const promises = this.solutionData.productList.map((_, index) => {
+        const formName = `solutionForm${index}`;
+        return new Promise((resolve, reject) => {
+          this.$refs[formName][0].validate((valid) => {
+            if (valid) {
+              resolve();
+            } else {
+              reject(`方案 ${index + 1} 校验失败!`);
+            }
+          });
         });
-      } else {
-        this.$api.insCompany.schemeUpdate({...this.solutionData,carnature:"01",vehicleType:"A1",energyType:"1"}).then((res) => {
-          if (res.code == '200') {
-            this.$message({
-              type: 'success',
-              message: res.msg,
+      });
+      Promise.all(promises)
+        .then(() => {
+          if (this.solutionDialogType == 'add') {
+            this.$api.insCompany.shcemeAdd({ ...this.solutionData, carnature: "01", vehicleType: "A1", energyType: "1" }).then((res) => {
+              if (res.code == '200') {
+                this.$message({
+                  type: 'success',
+                  message: res.msg,
+                });
+                this.solutionVisible = false;
+                this.solutionFindPage();
+              } else {
+                this.$message({
+                  type: 'error',
+                  message: res.msg,
+                });
+              }
             });
-            this.solutionVisible = false;
-            this.solutionFindPage();
           } else {
-            this.$message({
-              type: 'error',
-              message: res.msg,
+            this.$api.insCompany.schemeUpdate({ ...this.solutionData, carnature: "01", vehicleType: "A1", energyType: "1" }).then((res) => {
+              if (res.code == '200') {
+                this.$message({
+                  type: 'success',
+                  message: res.msg,
+                });
+                this.solutionVisible = false;
+                this.solutionFindPage();
+              } else {
+                this.$message({
+                  type: 'error',
+                  message: res.msg,
+                });
+              }
             });
           }
+        })
+        .catch((error) => {
+          console.log(error);
         });
-      }
     },
     getDicType(type) {
       this.$api.insCompany.dicType(type).then((res) => {
@@ -623,7 +667,7 @@ export default {
       this.solutionVisible = true;
     },
     solutionFindPage() {
-      this.$api.insCompany.schemeList({ ...this.pageRequest, companyId: this.companyId,carnature:"01",vehicleType:"A1",energyType:"1" }).then((res) => {
+      this.$api.insCompany.schemeList({ ...this.pageRequest, companyId: this.companyId, carnature: "01", vehicleType: "A1", energyType: "1" }).then((res) => {
         if (res.code == '200') {
           let pageList = {
             content: res.data.records,
@@ -644,7 +688,7 @@ export default {
     solutionUpdate({ row, column }) {
       this.solutionDialogType = 'edit';
       this.solutionDialogTitle = '编辑方案'
-      this.$api.insCompany.schemedetails(row.companyId, row.productId,"01",'A1','1').then((res) => {
+      this.$api.insCompany.schemedetails(row.companyId, row.productId, "01", 'A1', '1').then((res) => {
         if (res.code == '200') {
           res.data.productList.map(valA => {
             valA.kinds.map(valB => {
@@ -657,7 +701,7 @@ export default {
               data.list.map(val => {
                 if (val.parentId != '0') {
                   let obj = val.drvingList.find(item => item.id == val.parentId)
-                    val.drvingChildren = obj.insDrivingIntentionInsurances;
+                  val.drvingChildren = obj.insDrivingIntentionInsurances;
                 }
               })
               const listCodes = data.list.map(item => item.code); // 获取当前 data 的所有 code
@@ -839,4 +883,3 @@ export default {
   background: #F2F2F2;
 }
 </style>
-

+ 285 - 241
src/views/AgreementManage/InsuranceCompany/CargoTruck/NonBusiness/Fuel/AddOrdinaryPlan.vue

@@ -1,234 +1,240 @@
 <!-- 模板区域 -->
 <template>
   <div>
-      <div class="tab-panestyle">
-        <div class="tab-panecent">
-          <span>险种配置</span>
-          <el-radio-group :disabled="this.solutionDialogType == 'edit'" v-model="solutionData.productId"
-            @input="productInput" size="small" style="margin-left: 30px;">
-            <el-radio-button v-for="(productsitem, productsindex) in productsTypeoptions" :key="productsindex"
-              :label="productsitem.dictValue">{{
-                productsitem.dictTag }}</el-radio-button>
-          </el-radio-group>
+    <div class="tab-panestyle">
+      <div class="tab-panecent">
+        <span>险种配置</span>
+        <el-radio-group :disabled="this.solutionDialogType == 'edit'" v-model="solutionData.productId"
+          @input="productInput" size="small" style="margin-left: 30px;">
+          <el-radio-button v-for="(productsitem, productsindex) in productsTypeoptions" :key="productsindex"
+            :label="productsitem.dictValue">{{
+              productsitem.dictTag }}</el-radio-button>
+        </el-radio-group>
+      </div>
+      <div class="tab-panecent">
+        <div class=" flex j-s a-c">
+          <el-button type="primary" size="small" icon="el-icon-plus" class="planOption-btn"
+            @click="planOptionadd">方案新增</el-button>
         </div>
-        <div class="tab-panecent">
-          <div class=" flex j-s a-c">
-            <el-button type="primary" size="small" icon="el-icon-plus" class="planOption-btn"
-              @click="planOptionadd">方案新增</el-button>
+        <div v-for="(solutionitem, solutionindex) in solutionData.productList" :key="solutionindex">
+          <div class="flex j-s a-c " style="margin-top: 20px;font-size: 16px;color: #262626;">
+            <span>方案{{ solutionindex + 1 }}</span>
+            <el-button v-if="solutionindex > 0" type="primary" size="small" icon="el-icon-delete" class="planOption-del"
+              @click="planOptiondel(solutionindex)">方案删除</el-button>
           </div>
-          <div v-for="(solutionitem, solutionindex) in solutionData.productList" :key="solutionindex">
-            <div class="flex j-s a-c " style="margin-top: 20px;font-size: 16px;color: #262626;">
-              <span>方案{{ solutionindex + 1 }}</span>
-              <el-button v-if="solutionindex > 0" type="primary" size="small" icon="el-icon-delete" class="planOption-del"
-                @click="planOptiondel(solutionindex)">方案删除</el-button>
+          <el-form :ref="`solutionForm${solutionindex}`" :rules="solutionrules" :model="solutionitem"
+            label-width="120px" :size="overSize">
+            <el-row>
+              <el-col :span="8">
+                <el-form-item label="方案名称" prop="schemeName">
+                  <el-input type="text" v-model="solutionitem.schemeName" placeholder="输入方案名称"></el-input>
+                </el-form-item>
+              </el-col>
+              <el-col :span="4">
+                <el-form-item label="序号" prop="priorityLevel">
+                  <el-input type="text" v-model="solutionitem.priorityLevel" clearable :maxlength="2"></el-input>
+                </el-form-item>
+              </el-col>
+              <el-col :span="20">
+                <el-form-item label="方案描述">
+                  <el-input type="textarea" v-model="solutionitem.description" placeholder="输入方案描述" maxlength="100"
+                    show-word-limit></el-input>
+                </el-form-item>
+              </el-col>
+            </el-row>
+          </el-form>
+          <div v-if="['单商', '单三', '交三', '交商'].includes(solutionData.productName)">
+            <div class="flex j-s a-c">
+              <h4>商业险方案配置</h4>
             </div>
-            <el-form ref="solutionForm" :model="solutionitem" label-width="120px" :size="overSize">
-              <el-row>
-                <el-col :span="8">
-                  <el-form-item label="方案名称">
-                    <el-input type="text" v-model="solutionitem.schemeName" placeholder="输入方案名称"></el-input>
-                  </el-form-item>
-                </el-col>
-                <el-col :span="20">
-                  <el-form-item label="方案描述">
-                    <el-input type="textarea" v-model="solutionitem.description" placeholder="输入方案描述" maxlength="100"
-                      show-word-limit></el-input>
-                  </el-form-item>
-                </el-col>
-              </el-row>
-            </el-form>
-            <div v-if="['单商', '单三', '交三', '交商'].includes(solutionData.productName)">
-              <div class="flex j-s a-c">
-                <h4>商业险方案配置</h4>
-              </div>
-              <div class="flex j-start ">
-                <div class="Risk f-c" style="margin-right: 30px;">
-                  <section class="flex j-s a-c ">
-                    <div>
-                      全部险别
-                    </div>
-                    <div>
-                      投保保额
-                    </div>
-                  </section>
-                  <main class="flex j-s a-c" v-for="(insureitem, insureindex) in solutionitem.kinds" :key="insureindex">
-                    <div>
-                      <el-checkbox v-model="insureitem.switch" style="margin-right: 10px;" disabled></el-checkbox>
-                      <span>{{ insureitem.kindName }}</span>
-                    </div>
-                    <div>
-                      <el-select v-if="insureitem.amtList.length > 0" filterable v-model="insureitem.amount"
-                        placeholder="请选择"
-                        @change="(value) => amtListChange(value, insureitem.amtList, insureindex, solutionindex)"
-                        style="width: 200px;" clearable :size="overSize">
-                        <el-option v-for="(item, index) in insureitem.amtList" :key="index" :label="item.label"
-                          :value="item.value"></el-option>
-                      </el-select>
-                      <span v-else>
-                        <el-input-number @change="(value) => inputNumberChange(value, insureindex, solutionindex)"
-                          size="small" style="width:200px; margin-right: 10px;" v-model="insureitem.amount"
-                          :min="0"></el-input-number>次
-                      </span>
-                    </div>
-                  </main>
-                </div>
-                <div class="Risk">
-                  <section class="flex j-s a-c ">
-                    <span class="flex j-start">已选险别</span>
-                    <span class="flex j-c">投保保额</span>
-                    <span class="flex j-end">操作</span>
-                  </section>
-                  <main class="flex j-s a-c" v-for="(filteredInsureitem, filteredInsureindex) in solutionitem.kinds"
-                    :key="filteredInsureindex" v-if="filteredInsureitem.switch">
-                    <span class="flex j-start">{{ filteredInsureitem.kindName }}</span>
-                    <span class="flex j-c" v-if="['A'].includes(filteredInsureitem.kindCode)">{{
-                      filteredInsureitem.amountDesc }}</span>
-                    <span class="flex j-c"
-                      v-else-if="['MJ1', 'MJ2', 'MJ3', 'MJ4'].includes(filteredInsureitem.kindCode)">{{
-                        filteredInsureitem.amount }}%</span>
-                    <span class="flex j-c"
-                      v-else-if="['TY1', 'TY2', 'TY3', 'TY4'].includes(filteredInsureitem.kindCode)">{{
-                        filteredInsureitem.amount }}次</span>
-                    <span class="flex j-c" v-else>{{ convertedValue(filteredInsureitem.amount) }}</span>
-                    <span class="flex j-end">
-                      <i class="el-icon-delete" style="font-size: 20px;"
-                        @click="InsureDel(solutionindex, filteredInsureitem.kindCode)"></i>
+            <div class="flex j-start ">
+              <div class="Risk f-c" style="margin-right: 30px;">
+                <section class="flex j-s a-c ">
+                  <div>
+                    全部险别
+                  </div>
+                  <div>
+                    投保保额
+                  </div>
+                </section>
+                <main class="flex j-s a-c" v-for="(insureitem, insureindex) in solutionitem.kinds" :key="insureindex">
+                  <div>
+                    <el-checkbox v-model="insureitem.switch" style="margin-right: 10px;" disabled></el-checkbox>
+                    <span>{{ insureitem.kindName }}</span>
+                  </div>
+                  <div>
+                    <el-select v-if="insureitem.amtList.length > 0" filterable v-model="insureitem.amount"
+                      placeholder="请选择"
+                      @change="(value) => amtListChange(value, insureitem.amtList, insureindex, solutionindex)"
+                      style="width: 200px;" clearable :size="overSize">
+                      <el-option v-for="(item, index) in insureitem.amtList" :key="index" :label="item.label"
+                        :value="item.value"></el-option>
+                    </el-select>
+                    <span v-else>
+                      <el-input-number @change="(value) => inputNumberChange(value, insureindex, solutionindex)"
+                        size="small" style="width:200px; margin-right: 10px;" v-model="insureitem.amount"
+                        :min="0"></el-input-number>次
                     </span>
-                  </main>
-                </div>
-              </div>
-            </div>
-            <div>
-              <div class="flex a-c">
-                <h4>驾意险方案配置</h4>
-                <el-button size="mini"
-                  style="margin-left: 15px;background: #EAEDF1;border: 1px solid #D9D9D9;color: #2D4D89;"
-                  @click="AddDriverInsurancePlan(solutionindex)">添加配置</el-button>
-              </div>
-              <div v-for="(configureitem, configureindex) in solutionitem.drvingIntentions" :key="configureindex"
-                style="margin-bottom: 20px;">
-                <div class="flex j-s a-c">
-                  <div class="flex a-c " style="margin-bottom: 15px;" v-for="DriverTypeitem in configureitem.driverType"
-                    :key="DriverTypeitem.id">
-                    <span style="margin-right: 10px;color: #262626;font-size: 14px;font-weight: bold;">{{
-                      DriverTypeitem.typeName
-                    }}</span>
-                    <el-checkbox v-model="childrenitem.checked" v-for="childrenitem in DriverTypeitem.children"
-                      :key="childrenitem.id"
-                      @change="event => drvingcheckboxChange(event, childrenitem, solutionindex, configureindex)">{{
-                        childrenitem.typeName }}</el-checkbox>
                   </div>
+                </main>
+              </div>
+              <div class="Risk">
+                <section class="flex j-s a-c ">
+                  <span class="flex j-start">已选险别</span>
+                  <span class="flex j-c">投保保额</span>
+                  <span class="flex j-end">操作</span>
+                </section>
+                <main class="flex j-s a-c" v-for="(filteredInsureitem, filteredInsureindex) in solutionitem.kinds"
+                  :key="filteredInsureindex" v-if="filteredInsureitem.switch">
+                  <span class="flex j-start">{{ filteredInsureitem.kindName }}</span>
+                  <span class="flex j-c" v-if="['A'].includes(filteredInsureitem.kindCode)">{{
+                    filteredInsureitem.amountDesc }}</span>
+                  <span class="flex j-c"
+                    v-else-if="['MJ1', 'MJ2', 'MJ3', 'MJ4'].includes(filteredInsureitem.kindCode)">{{
+                      filteredInsureitem.amount }}%</span>
+                  <span class="flex j-c"
+                    v-else-if="['TY1', 'TY2', 'TY3', 'TY4'].includes(filteredInsureitem.kindCode)">{{
+                      filteredInsureitem.amount }}次</span>
+                  <span class="flex j-c" v-else>{{ convertedValue(filteredInsureitem.amount) }}</span>
                   <span class="flex j-end">
                     <i class="el-icon-delete" style="font-size: 20px;"
-                      @click="drvingDel(solutionindex, configureindex)"></i>
+                      @click="InsureDel(solutionindex, filteredInsureitem.kindCode)"></i>
                   </span>
+                </main>
+              </div>
+            </div>
+          </div>
+          <div>
+            <div class="flex a-c">
+              <h4>驾意险方案配置</h4>
+              <el-button size="mini"
+                style="margin-left: 15px;background: #EAEDF1;border: 1px solid #D9D9D9;color: #2D4D89;"
+                @click="AddDriverInsurancePlan(solutionindex)">添加配置</el-button>
+            </div>
+            <div v-for="(configureitem, configureindex) in solutionitem.drvingIntentions" :key="configureindex"
+              style="margin-bottom: 20px;">
+              <div class="flex j-s a-c">
+                <div class="flex a-c " style="margin-bottom: 15px;" v-for="DriverTypeitem in configureitem.driverType"
+                  :key="DriverTypeitem.id">
+                  <span style="margin-right: 10px;color: #262626;font-size: 14px;font-weight: bold;">{{
+                    DriverTypeitem.typeName
+                    }}</span>
+                  <el-checkbox v-model="childrenitem.checked" v-for="childrenitem in DriverTypeitem.children"
+                    :key="childrenitem.id"
+                    @change="event => drvingcheckboxChange(event, childrenitem, solutionindex, configureindex)">{{
+                      childrenitem.typeName }}</el-checkbox>
                 </div>
-                <el-form ref="form" :model="formitem" label-width="120px" size="small"
-                  v-for="(formitem, formindex) in configureitem.list" :key="formindex">
-                  <el-row>
-                    <el-col :span="24">
-                      <el-col :span="10">
-                        <el-form-item label="驾意选择:">
-                          <el-select
-                            v-if="formitem.isMultiple == 1 && !formitem.drvingList[0].insDrivingIntentionInsurances"
-                            filterable multiple v-model="formitem.drivingIntentionIds" placeholder="请选择" clearable
-                            :size="overSize" style="width: 250px;"
-                            @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
-                            <el-option :label="item.projectName" :value="item.id"
-                              v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
-                          </el-select>
-                          <el-select
-                            v-else-if="formitem.isMultiple == 1 && formitem.drvingList[0].insDrivingIntentionInsurances"
-                            filterable v-model="formitem.parentId" placeholder="请选择" clearable :size="overSize"
-                            style="width: 250px;"
-                            @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
-                            <el-option :label="item.projectName" :value="item.id"
-                              v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
-                          </el-select>
-                          <el-select
-                            v-else-if="formitem.isMultiple == 0 && !formitem.drvingList[0].insDrivingIntentionInsurances"
-                            filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable :size="overSize"
+                <span class="flex j-end">
+                  <i class="el-icon-delete" style="font-size: 20px;"
+                    @click="drvingDel(solutionindex, configureindex)"></i>
+                </span>
+              </div>
+              <el-form ref="form" :model="formitem" label-width="120px" size="small"
+                v-for="(formitem, formindex) in configureitem.list" :key="formindex">
+                <el-row>
+                  <el-col :span="24">
+                    <el-col :span="10">
+                      <el-form-item label="驾意选择:">
+                        <el-select
+                          v-if="formitem.isMultiple == 1 && !formitem.drvingList[0].insDrivingIntentionInsurances"
+                          filterable multiple v-model="formitem.drivingIntentionIds" placeholder="请选择" clearable
+                          :size="overSize" style="width: 250px;"
+                          @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
+                          <el-option :label="item.projectName" :value="item.id"
+                            v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
+                        </el-select>
+                        <el-select
+                          v-else-if="formitem.isMultiple == 1 && formitem.drvingList[0].insDrivingIntentionInsurances"
+                          filterable v-model="formitem.parentId" placeholder="请选择" clearable :size="overSize"
+                          style="width: 250px;"
+                          @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
+                          <el-option :label="item.projectName" :value="item.id"
+                            v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
+                        </el-select>
+                        <el-select
+                          v-else-if="formitem.isMultiple == 0 && !formitem.drvingList[0].insDrivingIntentionInsurances"
+                          filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable :size="overSize"
+                          style="width: 250px;"
+                          @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
+                          <el-option :label="item.projectName" :value="item.id"
+                            v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
+                        </el-select>
+                        <el-select
+                          v-else-if="formitem.isMultiple == 0 && formitem.drvingList[0].insDrivingIntentionInsurances"
+                          filterable v-model="formitem.parentId" placeholder="请选择" clearable :size="overSize"
+                          style="width: 250px;"
+                          @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
+                          <el-option :label="item.projectName" :value="item.id"
+                            v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
+                        </el-select>
+                        <template v-if="formitem.drvingChildren">
+                          <el-select v-if="formitem.isMultiple == 1" multiple filterable
+                            v-model="formitem.drivingIntentionIds" placeholder="请选择" clearable :size="overSize"
                             style="width: 250px;"
-                            @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
+                            @change="event => drivingChildrenChange(event, solutionindex, configureindex, formindex)">
                             <el-option :label="item.projectName" :value="item.id"
-                              v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
+                              v-for="(item, index) in formitem.drvingChildren" :key="index"></el-option>
                           </el-select>
-                          <el-select
-                            v-else-if="formitem.isMultiple == 0 && formitem.drvingList[0].insDrivingIntentionInsurances"
-                            filterable v-model="formitem.parentId" placeholder="请选择" clearable :size="overSize"
-                            style="width: 250px;"
-                            @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
+                          <el-select v-else filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable
+                            :size="overSize" style="width: 250px;"
+                            @change="event => drivingChildrenChange(event, solutionindex, configureindex, formindex)">
                             <el-option :label="item.projectName" :value="item.id"
-                              v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
+                              v-for="(item, index) in formitem.drvingChildren" :key="index"></el-option>
                           </el-select>
-                          <template v-if="formitem.drvingChildren">
-                            <el-select v-if="formitem.isMultiple == 1" multiple filterable
-                              v-model="formitem.drivingIntentionIds" placeholder="请选择" clearable :size="overSize"
-                              style="width: 250px;"
-                              @change="event => drivingChildrenChange(event, solutionindex, configureindex, formindex)">
-                              <el-option :label="item.projectName" :value="item.id"
-                                v-for="(item, index) in formitem.drvingChildren" :key="index"></el-option>
-                            </el-select>
-                            <el-select v-else filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable
-                              :size="overSize" style="width: 250px;"
-                              @change="event => drivingChildrenChange(event, solutionindex, configureindex, formindex)">
-                              <el-option :label="item.projectName" :value="item.id"
-                                v-for="(item, index) in formitem.drvingChildren" :key="index"></el-option>
-                            </el-select>
-                          </template>
-                        </el-form-item>
-                      </el-col>
-                      <el-col :span="4">
-                        <el-form-item label="别名:">
-                          <el-input v-model="formitem.alias" placeholder="驾意险别名"></el-input>
-                        </el-form-item>
-                      </el-col>
-                      <el-col :span="5">
-                        <el-form-item label="座位数:">
-                          <el-input-number v-model="formitem.seatNum" controls-position="right" :min="1"
-                            :max="10"></el-input-number>
-                          <span>座</span>
-                        </el-form-item>
-                      </el-col>
-                      <el-col :span="5">
-                        <el-form-item label="份数:">
-                          <el-input-number v-model="formitem.quantity" controls-position="right" :min="1"
-                            :max="10"></el-input-number>
-                          <span>份</span>
-                        </el-form-item>
-                      </el-col>
+                        </template>
+                      </el-form-item>
                     </el-col>
-                    <el-col :span="20">
-                      <div v-for="(LiabilityTermsitem, LiabilityTermsindex) in formitem.LiabilityTerms"
-                        :key="LiabilityTermsindex">
-                        <div style="font-weight: bold;margin-bottom: 10px;">{{ LiabilityTermsitem.projectName }}</div>
-                        <el-table :data="LiabilityTermsitem.LiabilityTerms" size="mini" :header-cell-style="{
-                          background: '#F7F7F9',
-                          fontWeight: '700',
-                          color: '#606266',
-                        }">
-                          <el-table-column prop="name" label="保险责任" align="center">
-                          </el-table-column>
-                          <el-table-column prop="amount" label="保险金额" width="180" align="center">
-                          </el-table-column>
-                          <el-table-column prop="premium" label="保费(元)" width="180" align="center">
-                          </el-table-column>
-                        </el-table>
-                      </div>
+                    <el-col :span="4">
+                      <el-form-item label="别名:">
+                        <el-input v-model="formitem.alias" placeholder="驾意险别名"></el-input>
+                      </el-form-item>
                     </el-col>
-                  </el-row>
-                </el-form>
-              </div>
+                    <el-col :span="5">
+                      <el-form-item label="座位数:">
+                        <el-input-number v-model="formitem.seatNum" controls-position="right" :min="1"
+                          :max="10"></el-input-number>
+                        <span>座</span>
+                      </el-form-item>
+                    </el-col>
+                    <el-col :span="5">
+                      <el-form-item label="份数:">
+                        <el-input-number v-model="formitem.quantity" controls-position="right" :min="1"
+                          :max="10"></el-input-number>
+                        <span>份</span>
+                      </el-form-item>
+                    </el-col>
+                  </el-col>
+                  <el-col :span="20">
+                    <div v-for="(LiabilityTermsitem, LiabilityTermsindex) in formitem.LiabilityTerms"
+                      :key="LiabilityTermsindex">
+                      <div style="font-weight: bold;margin-bottom: 10px;">{{ LiabilityTermsitem.projectName }}</div>
+                      <el-table :data="LiabilityTermsitem.LiabilityTerms" size="mini" :header-cell-style="{
+                        background: '#F7F7F9',
+                        fontWeight: '700',
+                        color: '#606266',
+                      }">
+                        <el-table-column prop="name" label="保险责任" align="center">
+                        </el-table-column>
+                        <el-table-column prop="amount" label="保险金额" width="180" align="center">
+                        </el-table-column>
+                        <el-table-column prop="premium" label="保费(元)" width="180" align="center">
+                        </el-table-column>
+                      </el-table>
+                    </div>
+                  </el-col>
+                </el-row>
+              </el-form>
             </div>
           </div>
         </div>
       </div>
-      <span slot="footer" class="dialog-footer">
-        <el-button :size="overSize" style="background: #EAEDF1;color: #2D4D89;" @click="ordinaryPlanCancel">取
-          消</el-button>
-        <el-button :size="overSize" style="background: #2D4D89;color: #fff;border-color: #2D4D89;" type="primary"
-          @click="solutionSubmit('solutionForm')">确 定</el-button>
-      </span>
+    </div>
+    <span slot="footer" class="dialog-footer">
+      <el-button :size="overSize" style="background: #EAEDF1;color: #2D4D89;" @click="ordinaryPlanCancel">取
+        消</el-button>
+      <el-button :size="overSize" style="background: #2D4D89;color: #fff;border-color: #2D4D89;" type="primary"
+        @click="solutionSubmit('solutionForm')">确 定</el-button>
+    </span>
   </div>
 </template>
 <!-- 行为区域 -->
@@ -250,6 +256,15 @@ export default {
         { prop: "companyId", label: "保险公司编码", minWidth: 160, },
         { prop: "productName", label: "方案险种", minWidth: 180, },
       ],
+      solutionrules: {
+        schemeName: [
+          { required: true, message: '方案名称必填', trigger: 'blur' }
+        ],
+        priorityLevel: [
+          { required: true, message: '序号必填', trigger: 'blur' },
+          { validator: this.validatePriority, trigger: 'blur' },
+        ],
+      },
       solutionResult: [],
       //操作符字典
       pageRequest: {
@@ -264,6 +279,7 @@ export default {
         productList: [
           {
             schemeName: "",
+            priorityLevel: "",//方案序号
             description: "",
             kinds: [],
             drvingIntentions: [
@@ -301,6 +317,15 @@ export default {
   },
   // 方法函数
   methods: {
+    validatePriority(rule, value, callback) {
+      if (!value) {
+        callback(new Error('请输入序号'));
+      } else if (!/^[1-9][0-9]?$/.test(value)) {
+        callback(new Error('请输入 1-99 的整数'));
+      } else {
+        callback();
+      }
+    },
     // drivingChange(event, solutionindex, configureindex, formindex) {
     //   if (event) {
     //     if (event instanceof Array) {
@@ -493,6 +518,7 @@ export default {
       })
       this.solutionData.productList.push({
         schemeName: "",
+        priorityLevel: "",//方案序号
         description: "",
         kinds: this.solutionData.productName !== '单交' ? list : [],
         drvingIntentions: [
@@ -532,43 +558,61 @@ export default {
         seatNum: ""//座位数
       });
     },
-    ordinaryPlanCancel () {
+    ordinaryPlanCancel() {
       this.$emit('ordinaryPlanCancel')
     },
-    solutionSubmit(formName) {
-      if (this.solutionDialogType == 'add') {
-        this.$api.insCompany.shcemeAdd({...this.solutionData,carnature:"02",vehicleType:"A1",energyType:"0"}).then((res) => {
-          if (res.code == '200') {
-            this.$message({
-              type: 'success',
-              message: res.msg,
-            });
-            this.solutionFindPage();
-            this.$emit('ordinaryPlanSubmit')
-          } else {
-            this.$message({
-              type: 'error',
-              message: res.msg,
-            });
-          }
+    solutionSubmit() {
+      const promises = this.solutionData.productList.map((_, index) => {
+        const formName = `solutionForm${index}`;
+        return new Promise((resolve, reject) => {
+          this.$refs[formName][0].validate((valid) => {
+            if (valid) {
+              resolve();
+            } else {
+              reject(`方案 ${index + 1} 校验失败!`);
+            }
+          });
         });
-      } else {
-        this.$api.insCompany.schemeUpdate({...this.solutionData,carnature:"02",vehicleType:"A1",energyType:"0"}).then((res) => {
-          if (res.code == '200') {
-            this.$message({
-              type: 'success',
-              message: res.msg,
+      });
+      Promise.all(promises)
+        .then(() => {
+          if (this.solutionDialogType == 'add') {
+            this.$api.insCompany.shcemeAdd({ ...this.solutionData, carnature: "02", vehicleType: "A1", energyType: "0" }).then((res) => {
+              if (res.code == '200') {
+                this.$message({
+                  type: 'success',
+                  message: res.msg,
+                });
+                this.solutionFindPage();
+                this.$emit('ordinaryPlanSubmit')
+              } else {
+                this.$message({
+                  type: 'error',
+                  message: res.msg,
+                });
+              }
             });
-            this.solutionFindPage();
-            this.$emit('ordinaryPlanSubmit')
           } else {
-            this.$message({
-              type: 'error',
-              message: res.msg,
+            this.$api.insCompany.schemeUpdate({ ...this.solutionData, carnature: "02", vehicleType: "A1", energyType: "0" }).then((res) => {
+              if (res.code == '200') {
+                this.$message({
+                  type: 'success',
+                  message: res.msg,
+                });
+                this.solutionFindPage();
+                this.$emit('ordinaryPlanSubmit')
+              } else {
+                this.$message({
+                  type: 'error',
+                  message: res.msg,
+                });
+              }
             });
           }
+        })
+        .catch((error) => {
+          console.log(error);
         });
-      }
     },
     getDicType(type) {
       this.$api.insCompany.dicType(type).then((res) => {
@@ -582,7 +626,7 @@ export default {
       this.solutionDialogTitle = '添加方案'
     },
     solutionFindPage() {
-      this.$api.insCompany.schemeList({ ...this.pageRequest, companyId: this.companyId,carnature:"02",vehicleType:"A1",energyType:"0" }).then((res) => {
+      this.$api.insCompany.schemeList({ ...this.pageRequest, companyId: this.companyId, carnature: "02", vehicleType: "A1", energyType: "0" }).then((res) => {
         if (res.code == '200') {
           let pageList = {
             content: res.data.records,
@@ -603,7 +647,7 @@ export default {
     solutionUpdate({ row, column }) {
       this.solutionDialogType = 'edit';
       this.solutionDialogTitle = '编辑方案'
-      this.$api.insCompany.schemedetails(row.companyId, row.productId,"02",'A1','0').then((res) => {
+      this.$api.insCompany.schemedetails(row.companyId, row.productId, "02", 'A1', '0').then((res) => {
         if (res.code == '200') {
           res.data.productList.map(valA => {
             valA.kinds.map(valB => {
@@ -616,7 +660,7 @@ export default {
               data.list.map(val => {
                 if (val.parentId != '0') {
                   let obj = val.drvingList.find(item => item.id == val.parentId)
-                    val.drvingChildren = obj.insDrivingIntentionInsurances;
+                  val.drvingChildren = obj.insDrivingIntentionInsurances;
                 }
               })
               const listCodes = data.list.map(item => item.code); // 获取当前 data 的所有 code
@@ -675,6 +719,7 @@ export default {
   align-items: flex-end;
   justify-content: flex-end;
 }
+
 /deep/ {
   .el-radio__input.is-checked .el-radio__inner,
   .el-checkbox__input.is-checked .el-checkbox__inner,
@@ -805,4 +850,3 @@ export default {
   background: #F2F2F2;
 }
 </style>
-

+ 90 - 47
src/views/AgreementManage/InsuranceCompany/CargoTruck/NonBusiness/Fuel/OrdinaryPlan.vue

@@ -7,8 +7,8 @@
     <!-- @findPage="solutionFindPage" -->
     <kt-common-table :tableHeights="700" :SerialShow="false" :operationWidth="200" :showOperation="true"
       :showBatchDelete="false" :showBatchSettled="false" :showBatchPrint="false" :data="solutionResult" button2Name="编辑"
-      button2Type="text" @findPage="solutionFindPage" @handleButton2="solutionUpdate" button3Name="删除" button3Type="text" @handleButton3="solutionDel"
-      :columns="solutionColumns">
+      button2Type="text" @findPage="solutionFindPage" @handleButton2="solutionUpdate" button3Name="删除"
+      button3Type="text" @handleButton3="solutionDel" :columns="solutionColumns">
     </kt-common-table>
     <el-dialog v-dialogDrag :title="solutionDialogTitle" :visible.sync="solutionVisible" width="90%" top="2vh"
       @close="solutioncloseDialog">
@@ -30,16 +30,22 @@
           <div v-for="(solutionitem, solutionindex) in solutionData.productList" :key="solutionindex">
             <div class="flex j-s a-c " style="margin-top: 20px;font-size: 16px;color: #262626;">
               <span>方案{{ solutionindex + 1 }}</span>
-              <el-button v-if="solutionindex > 0" type="primary" size="small" icon="el-icon-delete" class="planOption-del"
-                @click="planOptiondel(solutionindex)">方案删除</el-button>
+              <el-button v-if="solutionindex > 0" type="primary" size="small" icon="el-icon-delete"
+                class="planOption-del" @click="planOptiondel(solutionindex)">方案删除</el-button>
             </div>
-            <el-form ref="solutionForm" :model="solutionitem" label-width="120px" :size="overSize">
+            <el-form :ref="`solutionForm${solutionindex}`" :rules="solutionrules" :model="solutionitem"
+              label-width="120px" :size="overSize">
               <el-row>
                 <el-col :span="8">
-                  <el-form-item label="方案名称">
+                  <el-form-item label="方案名称" prop="schemeName">
                     <el-input type="text" v-model="solutionitem.schemeName" placeholder="输入方案名称"></el-input>
                   </el-form-item>
                 </el-col>
+                <el-col :span="4">
+                  <el-form-item label="序号" prop="priorityLevel">
+                    <el-input type="text" v-model="solutionitem.priorityLevel" clearable :maxlength="2"></el-input>
+                  </el-form-item>
+                </el-col>
                 <el-col :span="20">
                   <el-form-item label="方案描述">
                     <el-input type="textarea" v-model="solutionitem.description" placeholder="输入方案描述" maxlength="100"
@@ -123,7 +129,7 @@
                     :key="DriverTypeitem.id">
                     <span style="margin-right: 10px;color: #262626;font-size: 14px;font-weight: bold;">{{
                       DriverTypeitem.typeName
-                    }}</span>
+                      }}</span>
                     <el-checkbox v-model="childrenitem.checked" v-for="childrenitem in DriverTypeitem.children"
                       :key="childrenitem.id"
                       @change="event => drvingcheckboxChange(event, childrenitem, solutionindex, configureindex)">{{
@@ -158,8 +164,8 @@
                           </el-select>
                           <el-select
                             v-else-if="formitem.isMultiple == 0 && !formitem.drvingList[0].insDrivingIntentionInsurances"
-                            filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable :size="overSize"
-                            style="width: 250px;"
+                            filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable
+                            :size="overSize" style="width: 250px;"
                             @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
                             <el-option :label="item.projectName" :value="item.id"
                               v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
@@ -180,8 +186,8 @@
                               <el-option :label="item.projectName" :value="item.id"
                                 v-for="(item, index) in formitem.drvingChildren" :key="index"></el-option>
                             </el-select>
-                            <el-select v-else filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable
-                              :size="overSize" style="width: 250px;"
+                            <el-select v-else filterable v-model="formitem.drivingIntentionId" placeholder="请选择"
+                              clearable :size="overSize" style="width: 250px;"
                               @change="event => drivingChildrenChange(event, solutionindex, configureindex, formindex)">
                               <el-option :label="item.projectName" :value="item.id"
                                 v-for="(item, index) in formitem.drvingChildren" :key="index"></el-option>
@@ -275,6 +281,15 @@ export default {
         { prop: "companyId", label: "保险公司编码", minWidth: 160, },
         { prop: "productName", label: "方案险种", minWidth: 180, },
       ],
+      solutionrules: {
+        schemeName: [
+          { required: true, message: '方案名称必填', trigger: 'blur' }
+        ],
+        priorityLevel: [
+          { required: true, message: '序号必填', trigger: 'blur' },
+          { validator: this.validatePriority, trigger: 'blur' },
+        ],
+      },
       solutionResult: [],
       //操作符字典
       pageRequest: {
@@ -289,6 +304,7 @@ export default {
         productList: [
           {
             schemeName: "",
+            priorityLevel: "",
             description: "",
             kinds: [],
             drvingIntentions: [
@@ -308,12 +324,12 @@ export default {
     }
   },
   watch: {
-    activeIndex (newVal) {
+    activeIndex(newVal) {
       if (newVal === 0) {
         this.initData()
       }
     },
-    ordinaryIndex (newVal) {
+    ordinaryIndex(newVal) {
       if (newVal) {
         this.initData()
       }
@@ -321,13 +337,13 @@ export default {
   },
   // 生命周期函数
   created() {
-    if (this.$route.query.type*1 === 0) {
+    if (this.$route.query.type * 1 === 0) {
       this.initData()
     }
   },
   // 方法函数
   methods: {
-    initData () {
+    initData() {
       this.companyId = this.$route.query.companyId;
       this.solutionData.companyId = this.$route.query.companyId;
       this.getDicType("productsType"); //车险产品
@@ -344,6 +360,15 @@ export default {
       });
       localStorage.setItem("insureList", JSON.stringify(this.insureList));
     },
+    validatePriority(rule, value, callback) {
+      if (!value) {
+        callback(new Error('请输入序号'));
+      } else if (!/^[1-9][0-9]?$/.test(value)) {
+        callback(new Error('请输入 1-99 的整数'));
+      } else {
+        callback();
+      }
+    },
     // drivingChange(event, solutionindex, configureindex, formindex) {
     //   if (event) {
     //     if (event instanceof Array) {
@@ -536,6 +561,7 @@ export default {
       })
       this.solutionData.productList.push({
         schemeName: "",
+        priorityLevel: "",
         description: "",
         kinds: this.solutionData.productName !== '单交' ? list : [],
         drvingIntentions: [
@@ -575,40 +601,58 @@ export default {
         seatNum: ""//座位数
       });
     },
-    solutionSubmit(formName) {
-      if (this.solutionDialogType == 'add') {
-        this.$api.insCompany.shcemeAdd({...this.solutionData,carnature:"02",vehicleType:"A1",energyType:"0"}).then((res) => {
-          if (res.code == '200') {
-            this.$message({
-              type: 'success',
-              message: res.msg,
-            });
-            this.solutionVisible = false;
-            this.solutionFindPage();
-          } else {
-            this.$message({
-              type: 'error',
-              message: res.msg,
-            });
-          }
+    solutionSubmit() {
+      const promises = this.solutionData.productList.map((_, index) => {
+        const formName = `solutionForm${index}`;
+        return new Promise((resolve, reject) => {
+          this.$refs[formName][0].validate((valid) => {
+            if (valid) {
+              resolve();
+            } else {
+              reject(`方案 ${index + 1} 校验失败!`);
+            }
+          });
         });
-      } else {
-        this.$api.insCompany.schemeUpdate({...this.solutionData,carnature:"02",vehicleType:"A1",energyType:"0"}).then((res) => {
-          if (res.code == '200') {
-            this.$message({
-              type: 'success',
-              message: res.msg,
+      });
+      Promise.all(promises)
+        .then(() => {
+          if (this.solutionDialogType == 'add') {
+            this.$api.insCompany.shcemeAdd({ ...this.solutionData, carnature: "02", vehicleType: "A1", energyType: "0" }).then((res) => {
+              if (res.code == '200') {
+                this.$message({
+                  type: 'success',
+                  message: res.msg,
+                });
+                this.solutionVisible = false;
+                this.solutionFindPage();
+              } else {
+                this.$message({
+                  type: 'error',
+                  message: res.msg,
+                });
+              }
             });
-            this.solutionVisible = false;
-            this.solutionFindPage();
           } else {
-            this.$message({
-              type: 'error',
-              message: res.msg,
+            this.$api.insCompany.schemeUpdate({ ...this.solutionData, carnature: "02", vehicleType: "A1", energyType: "0" }).then((res) => {
+              if (res.code == '200') {
+                this.$message({
+                  type: 'success',
+                  message: res.msg,
+                });
+                this.solutionVisible = false;
+                this.solutionFindPage();
+              } else {
+                this.$message({
+                  type: 'error',
+                  message: res.msg,
+                });
+              }
             });
           }
+        })
+        .catch((error) => {
+          console.log(error);
         });
-      }
     },
     getDicType(type) {
       this.$api.insCompany.dicType(type).then((res) => {
@@ -623,7 +667,7 @@ export default {
       this.solutionVisible = true;
     },
     solutionFindPage() {
-      this.$api.insCompany.schemeList({ ...this.pageRequest, companyId: this.companyId,carnature:"02",vehicleType:"A1",energyType:"0" }).then((res) => {
+      this.$api.insCompany.schemeList({ ...this.pageRequest, companyId: this.companyId, carnature: "02", vehicleType: "A1", energyType: "0" }).then((res) => {
         if (res.code == '200') {
           let pageList = {
             content: res.data.records,
@@ -644,7 +688,7 @@ export default {
     solutionUpdate({ row, column }) {
       this.solutionDialogType = 'edit';
       this.solutionDialogTitle = '编辑方案'
-      this.$api.insCompany.schemedetails(row.companyId, row.productId,"02",'A1','0').then((res) => {
+      this.$api.insCompany.schemedetails(row.companyId, row.productId, "02", 'A1', '0').then((res) => {
         if (res.code == '200') {
           res.data.productList.map(valA => {
             valA.kinds.map(valB => {
@@ -657,7 +701,7 @@ export default {
               data.list.map(val => {
                 if (val.parentId != '0') {
                   let obj = val.drvingList.find(item => item.id == val.parentId)
-                    val.drvingChildren = obj.insDrivingIntentionInsurances;
+                  val.drvingChildren = obj.insDrivingIntentionInsurances;
                 }
               })
               const listCodes = data.list.map(item => item.code); // 获取当前 data 的所有 code
@@ -839,4 +883,3 @@ export default {
   background: #F2F2F2;
 }
 </style>
-

+ 285 - 241
src/views/AgreementManage/InsuranceCompany/CargoTruck/NonBusiness/NewEnergy/AddOrdinaryPlan.vue

@@ -1,234 +1,240 @@
 <!-- 模板区域 -->
 <template>
   <div>
-      <div class="tab-panestyle">
-        <div class="tab-panecent">
-          <span>险种配置</span>
-          <el-radio-group :disabled="this.solutionDialogType == 'edit'" v-model="solutionData.productId"
-            @input="productInput" size="small" style="margin-left: 30px;">
-            <el-radio-button v-for="(productsitem, productsindex) in productsTypeoptions" :key="productsindex"
-              :label="productsitem.dictValue">{{
-                productsitem.dictTag }}</el-radio-button>
-          </el-radio-group>
+    <div class="tab-panestyle">
+      <div class="tab-panecent">
+        <span>险种配置</span>
+        <el-radio-group :disabled="this.solutionDialogType == 'edit'" v-model="solutionData.productId"
+          @input="productInput" size="small" style="margin-left: 30px;">
+          <el-radio-button v-for="(productsitem, productsindex) in productsTypeoptions" :key="productsindex"
+            :label="productsitem.dictValue">{{
+              productsitem.dictTag }}</el-radio-button>
+        </el-radio-group>
+      </div>
+      <div class="tab-panecent">
+        <div class=" flex j-s a-c">
+          <el-button type="primary" size="small" icon="el-icon-plus" class="planOption-btn"
+            @click="planOptionadd">方案新增</el-button>
         </div>
-        <div class="tab-panecent">
-          <div class=" flex j-s a-c">
-            <el-button type="primary" size="small" icon="el-icon-plus" class="planOption-btn"
-              @click="planOptionadd">方案新增</el-button>
+        <div v-for="(solutionitem, solutionindex) in solutionData.productList" :key="solutionindex">
+          <div class="flex j-s a-c " style="margin-top: 20px;font-size: 16px;color: #262626;">
+            <span>方案{{ solutionindex + 1 }}</span>
+            <el-button v-if="solutionindex > 0" type="primary" size="small" icon="el-icon-delete" class="planOption-del"
+              @click="planOptiondel(solutionindex)">方案删除</el-button>
           </div>
-          <div v-for="(solutionitem, solutionindex) in solutionData.productList" :key="solutionindex">
-            <div class="flex j-s a-c " style="margin-top: 20px;font-size: 16px;color: #262626;">
-              <span>方案{{ solutionindex + 1 }}</span>
-              <el-button v-if="solutionindex > 0" type="primary" size="small" icon="el-icon-delete" class="planOption-del"
-                @click="planOptiondel(solutionindex)">方案删除</el-button>
+          <el-form :ref="`solutionForm${solutionindex}`" :rules="solutionrules" :model="solutionitem"
+            label-width="120px" :size="overSize">
+            <el-row>
+              <el-col :span="8">
+                <el-form-item label="方案名称" prop="schemeName">
+                  <el-input type="text" v-model="solutionitem.schemeName" placeholder="输入方案名称"></el-input>
+                </el-form-item>
+              </el-col>
+              <el-col :span="4">
+                <el-form-item label="序号" prop="priorityLevel">
+                  <el-input type="text" v-model="solutionitem.priorityLevel" clearable :maxlength="2"></el-input>
+                </el-form-item>
+              </el-col>
+              <el-col :span="20">
+                <el-form-item label="方案描述">
+                  <el-input type="textarea" v-model="solutionitem.description" placeholder="输入方案描述" maxlength="100"
+                    show-word-limit></el-input>
+                </el-form-item>
+              </el-col>
+            </el-row>
+          </el-form>
+          <div v-if="['单商', '单三', '交三', '交商'].includes(solutionData.productName)">
+            <div class="flex j-s a-c">
+              <h4>商业险方案配置</h4>
             </div>
-            <el-form ref="solutionForm" :model="solutionitem" label-width="120px" :size="overSize">
-              <el-row>
-                <el-col :span="8">
-                  <el-form-item label="方案名称">
-                    <el-input type="text" v-model="solutionitem.schemeName" placeholder="输入方案名称"></el-input>
-                  </el-form-item>
-                </el-col>
-                <el-col :span="20">
-                  <el-form-item label="方案描述">
-                    <el-input type="textarea" v-model="solutionitem.description" placeholder="输入方案描述" maxlength="100"
-                      show-word-limit></el-input>
-                  </el-form-item>
-                </el-col>
-              </el-row>
-            </el-form>
-            <div v-if="['单商', '单三', '交三', '交商'].includes(solutionData.productName)">
-              <div class="flex j-s a-c">
-                <h4>商业险方案配置</h4>
-              </div>
-              <div class="flex j-start ">
-                <div class="Risk f-c" style="margin-right: 30px;">
-                  <section class="flex j-s a-c ">
-                    <div>
-                      全部险别
-                    </div>
-                    <div>
-                      投保保额
-                    </div>
-                  </section>
-                  <main class="flex j-s a-c" v-for="(insureitem, insureindex) in solutionitem.kinds" :key="insureindex">
-                    <div>
-                      <el-checkbox v-model="insureitem.switch" style="margin-right: 10px;" disabled></el-checkbox>
-                      <span>{{ insureitem.kindName }}</span>
-                    </div>
-                    <div>
-                      <el-select v-if="insureitem.amtList.length > 0" filterable v-model="insureitem.amount"
-                        placeholder="请选择"
-                        @change="(value) => amtListChange(value, insureitem.amtList, insureindex, solutionindex)"
-                        style="width: 200px;" clearable :size="overSize">
-                        <el-option v-for="(item, index) in insureitem.amtList" :key="index" :label="item.label"
-                          :value="item.value"></el-option>
-                      </el-select>
-                      <span v-else>
-                        <el-input-number @change="(value) => inputNumberChange(value, insureindex, solutionindex)"
-                          size="small" style="width:200px; margin-right: 10px;" v-model="insureitem.amount"
-                          :min="0"></el-input-number>次
-                      </span>
-                    </div>
-                  </main>
-                </div>
-                <div class="Risk">
-                  <section class="flex j-s a-c ">
-                    <span class="flex j-start">已选险别</span>
-                    <span class="flex j-c">投保保额</span>
-                    <span class="flex j-end">操作</span>
-                  </section>
-                  <main class="flex j-s a-c" v-for="(filteredInsureitem, filteredInsureindex) in solutionitem.kinds"
-                    :key="filteredInsureindex" v-if="filteredInsureitem.switch">
-                    <span class="flex j-start">{{ filteredInsureitem.kindName }}</span>
-                    <span class="flex j-c" v-if="['A'].includes(filteredInsureitem.kindCode)">{{
-                      filteredInsureitem.amountDesc }}</span>
-                    <span class="flex j-c"
-                      v-else-if="['MJ1', 'MJ2', 'MJ3', 'MJ4'].includes(filteredInsureitem.kindCode)">{{
-                        filteredInsureitem.amount }}%</span>
-                    <span class="flex j-c"
-                      v-else-if="['TY1', 'TY2', 'TY3', 'TY4'].includes(filteredInsureitem.kindCode)">{{
-                        filteredInsureitem.amount }}次</span>
-                    <span class="flex j-c" v-else>{{ convertedValue(filteredInsureitem.amount) }}</span>
-                    <span class="flex j-end">
-                      <i class="el-icon-delete" style="font-size: 20px;"
-                        @click="InsureDel(solutionindex, filteredInsureitem.kindCode)"></i>
+            <div class="flex j-start ">
+              <div class="Risk f-c" style="margin-right: 30px;">
+                <section class="flex j-s a-c ">
+                  <div>
+                    全部险别
+                  </div>
+                  <div>
+                    投保保额
+                  </div>
+                </section>
+                <main class="flex j-s a-c" v-for="(insureitem, insureindex) in solutionitem.kinds" :key="insureindex">
+                  <div>
+                    <el-checkbox v-model="insureitem.switch" style="margin-right: 10px;" disabled></el-checkbox>
+                    <span>{{ insureitem.kindName }}</span>
+                  </div>
+                  <div>
+                    <el-select v-if="insureitem.amtList.length > 0" filterable v-model="insureitem.amount"
+                      placeholder="请选择"
+                      @change="(value) => amtListChange(value, insureitem.amtList, insureindex, solutionindex)"
+                      style="width: 200px;" clearable :size="overSize">
+                      <el-option v-for="(item, index) in insureitem.amtList" :key="index" :label="item.label"
+                        :value="item.value"></el-option>
+                    </el-select>
+                    <span v-else>
+                      <el-input-number @change="(value) => inputNumberChange(value, insureindex, solutionindex)"
+                        size="small" style="width:200px; margin-right: 10px;" v-model="insureitem.amount"
+                        :min="0"></el-input-number>次
                     </span>
-                  </main>
-                </div>
-              </div>
-            </div>
-            <div>
-              <div class="flex a-c">
-                <h4>驾意险方案配置</h4>
-                <el-button size="mini"
-                  style="margin-left: 15px;background: #EAEDF1;border: 1px solid #D9D9D9;color: #2D4D89;"
-                  @click="AddDriverInsurancePlan(solutionindex)">添加配置</el-button>
-              </div>
-              <div v-for="(configureitem, configureindex) in solutionitem.drvingIntentions" :key="configureindex"
-                style="margin-bottom: 20px;">
-                <div class="flex j-s a-c">
-                  <div class="flex a-c " style="margin-bottom: 15px;" v-for="DriverTypeitem in configureitem.driverType"
-                    :key="DriverTypeitem.id">
-                    <span style="margin-right: 10px;color: #262626;font-size: 14px;font-weight: bold;">{{
-                      DriverTypeitem.typeName
-                    }}</span>
-                    <el-checkbox v-model="childrenitem.checked" v-for="childrenitem in DriverTypeitem.children"
-                      :key="childrenitem.id"
-                      @change="event => drvingcheckboxChange(event, childrenitem, solutionindex, configureindex)">{{
-                        childrenitem.typeName }}</el-checkbox>
                   </div>
+                </main>
+              </div>
+              <div class="Risk">
+                <section class="flex j-s a-c ">
+                  <span class="flex j-start">已选险别</span>
+                  <span class="flex j-c">投保保额</span>
+                  <span class="flex j-end">操作</span>
+                </section>
+                <main class="flex j-s a-c" v-for="(filteredInsureitem, filteredInsureindex) in solutionitem.kinds"
+                  :key="filteredInsureindex" v-if="filteredInsureitem.switch">
+                  <span class="flex j-start">{{ filteredInsureitem.kindName }}</span>
+                  <span class="flex j-c" v-if="['A'].includes(filteredInsureitem.kindCode)">{{
+                    filteredInsureitem.amountDesc }}</span>
+                  <span class="flex j-c"
+                    v-else-if="['MJ1', 'MJ2', 'MJ3', 'MJ4'].includes(filteredInsureitem.kindCode)">{{
+                      filteredInsureitem.amount }}%</span>
+                  <span class="flex j-c"
+                    v-else-if="['TY1', 'TY2', 'TY3', 'TY4'].includes(filteredInsureitem.kindCode)">{{
+                      filteredInsureitem.amount }}次</span>
+                  <span class="flex j-c" v-else>{{ convertedValue(filteredInsureitem.amount) }}</span>
                   <span class="flex j-end">
                     <i class="el-icon-delete" style="font-size: 20px;"
-                      @click="drvingDel(solutionindex, configureindex)"></i>
+                      @click="InsureDel(solutionindex, filteredInsureitem.kindCode)"></i>
                   </span>
+                </main>
+              </div>
+            </div>
+          </div>
+          <div>
+            <div class="flex a-c">
+              <h4>驾意险方案配置</h4>
+              <el-button size="mini"
+                style="margin-left: 15px;background: #EAEDF1;border: 1px solid #D9D9D9;color: #2D4D89;"
+                @click="AddDriverInsurancePlan(solutionindex)">添加配置</el-button>
+            </div>
+            <div v-for="(configureitem, configureindex) in solutionitem.drvingIntentions" :key="configureindex"
+              style="margin-bottom: 20px;">
+              <div class="flex j-s a-c">
+                <div class="flex a-c " style="margin-bottom: 15px;" v-for="DriverTypeitem in configureitem.driverType"
+                  :key="DriverTypeitem.id">
+                  <span style="margin-right: 10px;color: #262626;font-size: 14px;font-weight: bold;">{{
+                    DriverTypeitem.typeName
+                    }}</span>
+                  <el-checkbox v-model="childrenitem.checked" v-for="childrenitem in DriverTypeitem.children"
+                    :key="childrenitem.id"
+                    @change="event => drvingcheckboxChange(event, childrenitem, solutionindex, configureindex)">{{
+                      childrenitem.typeName }}</el-checkbox>
                 </div>
-                <el-form ref="form" :model="formitem" label-width="120px" size="small"
-                  v-for="(formitem, formindex) in configureitem.list" :key="formindex">
-                  <el-row>
-                    <el-col :span="24">
-                      <el-col :span="10">
-                        <el-form-item label="驾意选择:">
-                          <el-select
-                            v-if="formitem.isMultiple == 1 && !formitem.drvingList[0].insDrivingIntentionInsurances"
-                            filterable multiple v-model="formitem.drivingIntentionIds" placeholder="请选择" clearable
-                            :size="overSize" style="width: 250px;"
-                            @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
-                            <el-option :label="item.projectName" :value="item.id"
-                              v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
-                          </el-select>
-                          <el-select
-                            v-else-if="formitem.isMultiple == 1 && formitem.drvingList[0].insDrivingIntentionInsurances"
-                            filterable v-model="formitem.parentId" placeholder="请选择" clearable :size="overSize"
-                            style="width: 250px;"
-                            @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
-                            <el-option :label="item.projectName" :value="item.id"
-                              v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
-                          </el-select>
-                          <el-select
-                            v-else-if="formitem.isMultiple == 0 && !formitem.drvingList[0].insDrivingIntentionInsurances"
-                            filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable :size="overSize"
+                <span class="flex j-end">
+                  <i class="el-icon-delete" style="font-size: 20px;"
+                    @click="drvingDel(solutionindex, configureindex)"></i>
+                </span>
+              </div>
+              <el-form ref="form" :model="formitem" label-width="120px" size="small"
+                v-for="(formitem, formindex) in configureitem.list" :key="formindex">
+                <el-row>
+                  <el-col :span="24">
+                    <el-col :span="10">
+                      <el-form-item label="驾意选择:">
+                        <el-select
+                          v-if="formitem.isMultiple == 1 && !formitem.drvingList[0].insDrivingIntentionInsurances"
+                          filterable multiple v-model="formitem.drivingIntentionIds" placeholder="请选择" clearable
+                          :size="overSize" style="width: 250px;"
+                          @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
+                          <el-option :label="item.projectName" :value="item.id"
+                            v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
+                        </el-select>
+                        <el-select
+                          v-else-if="formitem.isMultiple == 1 && formitem.drvingList[0].insDrivingIntentionInsurances"
+                          filterable v-model="formitem.parentId" placeholder="请选择" clearable :size="overSize"
+                          style="width: 250px;"
+                          @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
+                          <el-option :label="item.projectName" :value="item.id"
+                            v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
+                        </el-select>
+                        <el-select
+                          v-else-if="formitem.isMultiple == 0 && !formitem.drvingList[0].insDrivingIntentionInsurances"
+                          filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable :size="overSize"
+                          style="width: 250px;"
+                          @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
+                          <el-option :label="item.projectName" :value="item.id"
+                            v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
+                        </el-select>
+                        <el-select
+                          v-else-if="formitem.isMultiple == 0 && formitem.drvingList[0].insDrivingIntentionInsurances"
+                          filterable v-model="formitem.parentId" placeholder="请选择" clearable :size="overSize"
+                          style="width: 250px;"
+                          @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
+                          <el-option :label="item.projectName" :value="item.id"
+                            v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
+                        </el-select>
+                        <template v-if="formitem.drvingChildren">
+                          <el-select v-if="formitem.isMultiple == 1" multiple filterable
+                            v-model="formitem.drivingIntentionIds" placeholder="请选择" clearable :size="overSize"
                             style="width: 250px;"
-                            @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
+                            @change="event => drivingChildrenChange(event, solutionindex, configureindex, formindex)">
                             <el-option :label="item.projectName" :value="item.id"
-                              v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
+                              v-for="(item, index) in formitem.drvingChildren" :key="index"></el-option>
                           </el-select>
-                          <el-select
-                            v-else-if="formitem.isMultiple == 0 && formitem.drvingList[0].insDrivingIntentionInsurances"
-                            filterable v-model="formitem.parentId" placeholder="请选择" clearable :size="overSize"
-                            style="width: 250px;"
-                            @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
+                          <el-select v-else filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable
+                            :size="overSize" style="width: 250px;"
+                            @change="event => drivingChildrenChange(event, solutionindex, configureindex, formindex)">
                             <el-option :label="item.projectName" :value="item.id"
-                              v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
+                              v-for="(item, index) in formitem.drvingChildren" :key="index"></el-option>
                           </el-select>
-                          <template v-if="formitem.drvingChildren">
-                            <el-select v-if="formitem.isMultiple == 1" multiple filterable
-                              v-model="formitem.drivingIntentionIds" placeholder="请选择" clearable :size="overSize"
-                              style="width: 250px;"
-                              @change="event => drivingChildrenChange(event, solutionindex, configureindex, formindex)">
-                              <el-option :label="item.projectName" :value="item.id"
-                                v-for="(item, index) in formitem.drvingChildren" :key="index"></el-option>
-                            </el-select>
-                            <el-select v-else filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable
-                              :size="overSize" style="width: 250px;"
-                              @change="event => drivingChildrenChange(event, solutionindex, configureindex, formindex)">
-                              <el-option :label="item.projectName" :value="item.id"
-                                v-for="(item, index) in formitem.drvingChildren" :key="index"></el-option>
-                            </el-select>
-                          </template>
-                        </el-form-item>
-                      </el-col>
-                      <el-col :span="4">
-                        <el-form-item label="别名:">
-                          <el-input v-model="formitem.alias" placeholder="驾意险别名"></el-input>
-                        </el-form-item>
-                      </el-col>
-                      <el-col :span="5">
-                        <el-form-item label="座位数:">
-                          <el-input-number v-model="formitem.seatNum" controls-position="right" :min="1"
-                            :max="10"></el-input-number>
-                          <span>座</span>
-                        </el-form-item>
-                      </el-col>
-                      <el-col :span="5">
-                        <el-form-item label="份数:">
-                          <el-input-number v-model="formitem.quantity" controls-position="right" :min="1"
-                            :max="10"></el-input-number>
-                          <span>份</span>
-                        </el-form-item>
-                      </el-col>
+                        </template>
+                      </el-form-item>
                     </el-col>
-                    <el-col :span="20">
-                      <div v-for="(LiabilityTermsitem, LiabilityTermsindex) in formitem.LiabilityTerms"
-                        :key="LiabilityTermsindex">
-                        <div style="font-weight: bold;margin-bottom: 10px;">{{ LiabilityTermsitem.projectName }}</div>
-                        <el-table :data="LiabilityTermsitem.LiabilityTerms" size="mini" :header-cell-style="{
-                          background: '#F7F7F9',
-                          fontWeight: '700',
-                          color: '#606266',
-                        }">
-                          <el-table-column prop="name" label="保险责任" align="center">
-                          </el-table-column>
-                          <el-table-column prop="amount" label="保险金额" width="180" align="center">
-                          </el-table-column>
-                          <el-table-column prop="premium" label="保费(元)" width="180" align="center">
-                          </el-table-column>
-                        </el-table>
-                      </div>
+                    <el-col :span="4">
+                      <el-form-item label="别名:">
+                        <el-input v-model="formitem.alias" placeholder="驾意险别名"></el-input>
+                      </el-form-item>
                     </el-col>
-                  </el-row>
-                </el-form>
-              </div>
+                    <el-col :span="5">
+                      <el-form-item label="座位数:">
+                        <el-input-number v-model="formitem.seatNum" controls-position="right" :min="1"
+                          :max="10"></el-input-number>
+                        <span>座</span>
+                      </el-form-item>
+                    </el-col>
+                    <el-col :span="5">
+                      <el-form-item label="份数:">
+                        <el-input-number v-model="formitem.quantity" controls-position="right" :min="1"
+                          :max="10"></el-input-number>
+                        <span>份</span>
+                      </el-form-item>
+                    </el-col>
+                  </el-col>
+                  <el-col :span="20">
+                    <div v-for="(LiabilityTermsitem, LiabilityTermsindex) in formitem.LiabilityTerms"
+                      :key="LiabilityTermsindex">
+                      <div style="font-weight: bold;margin-bottom: 10px;">{{ LiabilityTermsitem.projectName }}</div>
+                      <el-table :data="LiabilityTermsitem.LiabilityTerms" size="mini" :header-cell-style="{
+                        background: '#F7F7F9',
+                        fontWeight: '700',
+                        color: '#606266',
+                      }">
+                        <el-table-column prop="name" label="保险责任" align="center">
+                        </el-table-column>
+                        <el-table-column prop="amount" label="保险金额" width="180" align="center">
+                        </el-table-column>
+                        <el-table-column prop="premium" label="保费(元)" width="180" align="center">
+                        </el-table-column>
+                      </el-table>
+                    </div>
+                  </el-col>
+                </el-row>
+              </el-form>
             </div>
           </div>
         </div>
       </div>
-      <span slot="footer" class="dialog-footer">
-        <el-button :size="overSize" style="background: #EAEDF1;color: #2D4D89;" @click="ordinaryPlanCancel">取
-          消</el-button>
-        <el-button :size="overSize" style="background: #2D4D89;color: #fff;border-color: #2D4D89;" type="primary"
-          @click="solutionSubmit('solutionForm')">确 定</el-button>
-      </span>
+    </div>
+    <span slot="footer" class="dialog-footer">
+      <el-button :size="overSize" style="background: #EAEDF1;color: #2D4D89;" @click="ordinaryPlanCancel">取
+        消</el-button>
+      <el-button :size="overSize" style="background: #2D4D89;color: #fff;border-color: #2D4D89;" type="primary"
+        @click="solutionSubmit('solutionForm')">确 定</el-button>
+    </span>
   </div>
 </template>
 <!-- 行为区域 -->
@@ -250,6 +256,15 @@ export default {
         { prop: "companyId", label: "保险公司编码", minWidth: 160, },
         { prop: "productName", label: "方案险种", minWidth: 180, },
       ],
+      solutionrules: {
+        schemeName: [
+          { required: true, message: '方案名称必填', trigger: 'blur' }
+        ],
+        priorityLevel: [
+          { required: true, message: '序号必填', trigger: 'blur' },
+          { validator: this.validatePriority, trigger: 'blur' },
+        ],
+      },
       solutionResult: [],
       //操作符字典
       pageRequest: {
@@ -264,6 +279,7 @@ export default {
         productList: [
           {
             schemeName: "",
+            priorityLevel: "",//方案序号
             description: "",
             kinds: [],
             drvingIntentions: [
@@ -301,6 +317,15 @@ export default {
   },
   // 方法函数
   methods: {
+    validatePriority(rule, value, callback) {
+      if (!value) {
+        callback(new Error('请输入序号'));
+      } else if (!/^[1-9][0-9]?$/.test(value)) {
+        callback(new Error('请输入 1-99 的整数'));
+      } else {
+        callback();
+      }
+    },
     // drivingChange(event, solutionindex, configureindex, formindex) {
     //   if (event) {
     //     if (event instanceof Array) {
@@ -493,6 +518,7 @@ export default {
       })
       this.solutionData.productList.push({
         schemeName: "",
+        priorityLevel: "",//方案序号
         description: "",
         kinds: this.solutionData.productName !== '单交' ? list : [],
         drvingIntentions: [
@@ -532,43 +558,61 @@ export default {
         seatNum: ""//座位数
       });
     },
-    ordinaryPlanCancel () {
+    ordinaryPlanCancel() {
       this.$emit('ordinaryPlanCancel')
     },
-    solutionSubmit(formName) {
-      if (this.solutionDialogType == 'add') {
-        this.$api.insCompany.shcemeAdd({...this.solutionData,carnature:"02",vehicleType:"A1",energyType:"1"}).then((res) => {
-          if (res.code == '200') {
-            this.$message({
-              type: 'success',
-              message: res.msg,
-            });
-            this.solutionFindPage();
-            this.$emit('ordinaryPlanSubmit')
-          } else {
-            this.$message({
-              type: 'error',
-              message: res.msg,
-            });
-          }
+    solutionSubmit() {
+      const promises = this.solutionData.productList.map((_, index) => {
+        const formName = `solutionForm${index}`;
+        return new Promise((resolve, reject) => {
+          this.$refs[formName][0].validate((valid) => {
+            if (valid) {
+              resolve();
+            } else {
+              reject(`方案 ${index + 1} 校验失败!`);
+            }
+          });
         });
-      } else {
-        this.$api.insCompany.schemeUpdate({...this.solutionData,carnature:"02",vehicleType:"A1",energyType:"1"}).then((res) => {
-          if (res.code == '200') {
-            this.$message({
-              type: 'success',
-              message: res.msg,
+      });
+      Promise.all(promises)
+        .then(() => {
+          if (this.solutionDialogType == 'add') {
+            this.$api.insCompany.shcemeAdd({ ...this.solutionData, carnature: "02", vehicleType: "A1", energyType: "1" }).then((res) => {
+              if (res.code == '200') {
+                this.$message({
+                  type: 'success',
+                  message: res.msg,
+                });
+                this.solutionFindPage();
+                this.$emit('ordinaryPlanSubmit')
+              } else {
+                this.$message({
+                  type: 'error',
+                  message: res.msg,
+                });
+              }
             });
-            this.solutionFindPage();
-            this.$emit('ordinaryPlanSubmit')
           } else {
-            this.$message({
-              type: 'error',
-              message: res.msg,
+            this.$api.insCompany.schemeUpdate({ ...this.solutionData, carnature: "02", vehicleType: "A1", energyType: "1" }).then((res) => {
+              if (res.code == '200') {
+                this.$message({
+                  type: 'success',
+                  message: res.msg,
+                });
+                this.solutionFindPage();
+                this.$emit('ordinaryPlanSubmit')
+              } else {
+                this.$message({
+                  type: 'error',
+                  message: res.msg,
+                });
+              }
             });
           }
+        })
+        .catch((error) => {
+          console.log(error);
         });
-      }
     },
     getDicType(type) {
       this.$api.insCompany.dicType(type).then((res) => {
@@ -582,7 +626,7 @@ export default {
       this.solutionDialogTitle = '添加方案'
     },
     solutionFindPage() {
-      this.$api.insCompany.schemeList({ ...this.pageRequest, companyId: this.companyId,carnature:"02",vehicleType:"A1",energyType:"1" }).then((res) => {
+      this.$api.insCompany.schemeList({ ...this.pageRequest, companyId: this.companyId, carnature: "02", vehicleType: "A1", energyType: "1" }).then((res) => {
         if (res.code == '200') {
           let pageList = {
             content: res.data.records,
@@ -603,7 +647,7 @@ export default {
     solutionUpdate({ row, column }) {
       this.solutionDialogType = 'edit';
       this.solutionDialogTitle = '编辑方案'
-      this.$api.insCompany.schemedetails(row.companyId, row.productId,"02",'A1','1').then((res) => {
+      this.$api.insCompany.schemedetails(row.companyId, row.productId, "02", 'A1', '1').then((res) => {
         if (res.code == '200') {
           res.data.productList.map(valA => {
             valA.kinds.map(valB => {
@@ -616,7 +660,7 @@ export default {
               data.list.map(val => {
                 if (val.parentId != '0') {
                   let obj = val.drvingList.find(item => item.id == val.parentId)
-                    val.drvingChildren = obj.insDrivingIntentionInsurances;
+                  val.drvingChildren = obj.insDrivingIntentionInsurances;
                 }
               })
               const listCodes = data.list.map(item => item.code); // 获取当前 data 的所有 code
@@ -675,6 +719,7 @@ export default {
   align-items: flex-end;
   justify-content: flex-end;
 }
+
 /deep/ {
   .el-radio__input.is-checked .el-radio__inner,
   .el-checkbox__input.is-checked .el-checkbox__inner,
@@ -805,4 +850,3 @@ export default {
   background: #F2F2F2;
 }
 </style>
-

+ 90 - 47
src/views/AgreementManage/InsuranceCompany/CargoTruck/NonBusiness/NewEnergy/OrdinaryPlan.vue

@@ -7,8 +7,8 @@
     <!-- @findPage="solutionFindPage" -->
     <kt-common-table :tableHeights="700" :SerialShow="false" :operationWidth="200" :showOperation="true"
       :showBatchDelete="false" :showBatchSettled="false" :showBatchPrint="false" :data="solutionResult" button2Name="编辑"
-      button2Type="text" @findPage="solutionFindPage" @handleButton2="solutionUpdate" button3Name="删除" button3Type="text" @handleButton3="solutionDel"
-      :columns="solutionColumns">
+      button2Type="text" @findPage="solutionFindPage" @handleButton2="solutionUpdate" button3Name="删除"
+      button3Type="text" @handleButton3="solutionDel" :columns="solutionColumns">
     </kt-common-table>
     <el-dialog v-dialogDrag :title="solutionDialogTitle" :visible.sync="solutionVisible" width="90%" top="2vh"
       @close="solutioncloseDialog">
@@ -30,16 +30,22 @@
           <div v-for="(solutionitem, solutionindex) in solutionData.productList" :key="solutionindex">
             <div class="flex j-s a-c " style="margin-top: 20px;font-size: 16px;color: #262626;">
               <span>方案{{ solutionindex + 1 }}</span>
-              <el-button v-if="solutionindex > 0" type="primary" size="small" icon="el-icon-delete" class="planOption-del"
-                @click="planOptiondel(solutionindex)">方案删除</el-button>
+              <el-button v-if="solutionindex > 0" type="primary" size="small" icon="el-icon-delete"
+                class="planOption-del" @click="planOptiondel(solutionindex)">方案删除</el-button>
             </div>
-            <el-form ref="solutionForm" :model="solutionitem" label-width="120px" :size="overSize">
+            <el-form :ref="`solutionForm${solutionindex}`" :rules="solutionrules" :model="solutionitem"
+              label-width="120px" :size="overSize">
               <el-row>
                 <el-col :span="8">
-                  <el-form-item label="方案名称">
+                  <el-form-item label="方案名称" prop="schemeName">
                     <el-input type="text" v-model="solutionitem.schemeName" placeholder="输入方案名称"></el-input>
                   </el-form-item>
                 </el-col>
+                <el-col :span="4">
+                  <el-form-item label="序号" prop="priorityLevel">
+                    <el-input type="text" v-model="solutionitem.priorityLevel" clearable :maxlength="2"></el-input>
+                  </el-form-item>
+                </el-col>
                 <el-col :span="20">
                   <el-form-item label="方案描述">
                     <el-input type="textarea" v-model="solutionitem.description" placeholder="输入方案描述" maxlength="100"
@@ -123,7 +129,7 @@
                     :key="DriverTypeitem.id">
                     <span style="margin-right: 10px;color: #262626;font-size: 14px;font-weight: bold;">{{
                       DriverTypeitem.typeName
-                    }}</span>
+                      }}</span>
                     <el-checkbox v-model="childrenitem.checked" v-for="childrenitem in DriverTypeitem.children"
                       :key="childrenitem.id"
                       @change="event => drvingcheckboxChange(event, childrenitem, solutionindex, configureindex)">{{
@@ -158,8 +164,8 @@
                           </el-select>
                           <el-select
                             v-else-if="formitem.isMultiple == 0 && !formitem.drvingList[0].insDrivingIntentionInsurances"
-                            filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable :size="overSize"
-                            style="width: 250px;"
+                            filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable
+                            :size="overSize" style="width: 250px;"
                             @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
                             <el-option :label="item.projectName" :value="item.id"
                               v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
@@ -180,8 +186,8 @@
                               <el-option :label="item.projectName" :value="item.id"
                                 v-for="(item, index) in formitem.drvingChildren" :key="index"></el-option>
                             </el-select>
-                            <el-select v-else filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable
-                              :size="overSize" style="width: 250px;"
+                            <el-select v-else filterable v-model="formitem.drivingIntentionId" placeholder="请选择"
+                              clearable :size="overSize" style="width: 250px;"
                               @change="event => drivingChildrenChange(event, solutionindex, configureindex, formindex)">
                               <el-option :label="item.projectName" :value="item.id"
                                 v-for="(item, index) in formitem.drvingChildren" :key="index"></el-option>
@@ -275,6 +281,15 @@ export default {
         { prop: "companyId", label: "保险公司编码", minWidth: 160, },
         { prop: "productName", label: "方案险种", minWidth: 180, },
       ],
+      solutionrules: {
+        schemeName: [
+          { required: true, message: '方案名称必填', trigger: 'blur' }
+        ],
+        priorityLevel: [
+          { required: true, message: '序号必填', trigger: 'blur' },
+          { validator: this.validatePriority, trigger: 'blur' },
+        ],
+      },
       solutionResult: [],
       //操作符字典
       pageRequest: {
@@ -289,6 +304,7 @@ export default {
         productList: [
           {
             schemeName: "",
+            priorityLevel: "",
             description: "",
             kinds: [],
             drvingIntentions: [
@@ -308,12 +324,12 @@ export default {
     }
   },
   watch: {
-    activeIndex (newVal) {
+    activeIndex(newVal) {
       if (newVal === 0) {
         this.initData()
       }
     },
-    ordinaryIndex (newVal) {
+    ordinaryIndex(newVal) {
       if (newVal) {
         this.initData()
       }
@@ -321,13 +337,13 @@ export default {
   },
   // 生命周期函数
   created() {
-    if (this.$route.query.type*1 === 0) {
+    if (this.$route.query.type * 1 === 0) {
       this.initData()
     }
   },
   // 方法函数
   methods: {
-    initData () {
+    initData() {
       this.companyId = this.$route.query.companyId;
       this.solutionData.companyId = this.$route.query.companyId;
       this.getDicType("productsType"); //车险产品
@@ -344,6 +360,15 @@ export default {
       });
       localStorage.setItem("insureList", JSON.stringify(this.insureList));
     },
+    validatePriority(rule, value, callback) {
+      if (!value) {
+        callback(new Error('请输入序号'));
+      } else if (!/^[1-9][0-9]?$/.test(value)) {
+        callback(new Error('请输入 1-99 的整数'));
+      } else {
+        callback();
+      }
+    },
     // drivingChange(event, solutionindex, configureindex, formindex) {
     //   if (event) {
     //     if (event instanceof Array) {
@@ -536,6 +561,7 @@ export default {
       })
       this.solutionData.productList.push({
         schemeName: "",
+        priorityLevel: "",
         description: "",
         kinds: this.solutionData.productName !== '单交' ? list : [],
         drvingIntentions: [
@@ -575,40 +601,58 @@ export default {
         seatNum: ""//座位数
       });
     },
-    solutionSubmit(formName) {
-      if (this.solutionDialogType == 'add') {
-        this.$api.insCompany.shcemeAdd({...this.solutionData,carnature:"02",vehicleType:"A1",energyType:"1"}).then((res) => {
-          if (res.code == '200') {
-            this.$message({
-              type: 'success',
-              message: res.msg,
-            });
-            this.solutionVisible = false;
-            this.solutionFindPage();
-          } else {
-            this.$message({
-              type: 'error',
-              message: res.msg,
-            });
-          }
+    solutionSubmit() {
+      const promises = this.solutionData.productList.map((_, index) => {
+        const formName = `solutionForm${index}`;
+        return new Promise((resolve, reject) => {
+          this.$refs[formName][0].validate((valid) => {
+            if (valid) {
+              resolve();
+            } else {
+              reject(`方案 ${index + 1} 校验失败!`);
+            }
+          });
         });
-      } else {
-        this.$api.insCompany.schemeUpdate({...this.solutionData,carnature:"02",vehicleType:"A1",energyType:"1"}).then((res) => {
-          if (res.code == '200') {
-            this.$message({
-              type: 'success',
-              message: res.msg,
+      });
+      Promise.all(promises)
+        .then(() => {
+          if (this.solutionDialogType == 'add') {
+            this.$api.insCompany.shcemeAdd({ ...this.solutionData, carnature: "02", vehicleType: "A1", energyType: "1" }).then((res) => {
+              if (res.code == '200') {
+                this.$message({
+                  type: 'success',
+                  message: res.msg,
+                });
+                this.solutionVisible = false;
+                this.solutionFindPage();
+              } else {
+                this.$message({
+                  type: 'error',
+                  message: res.msg,
+                });
+              }
             });
-            this.solutionVisible = false;
-            this.solutionFindPage();
           } else {
-            this.$message({
-              type: 'error',
-              message: res.msg,
+            this.$api.insCompany.schemeUpdate({ ...this.solutionData, carnature: "02", vehicleType: "A1", energyType: "1" }).then((res) => {
+              if (res.code == '200') {
+                this.$message({
+                  type: 'success',
+                  message: res.msg,
+                });
+                this.solutionVisible = false;
+                this.solutionFindPage();
+              } else {
+                this.$message({
+                  type: 'error',
+                  message: res.msg,
+                });
+              }
             });
           }
+        })
+        .catch((error) => {
+          console.log(error);
         });
-      }
     },
     getDicType(type) {
       this.$api.insCompany.dicType(type).then((res) => {
@@ -623,7 +667,7 @@ export default {
       this.solutionVisible = true;
     },
     solutionFindPage() {
-      this.$api.insCompany.schemeList({ ...this.pageRequest, companyId: this.companyId,carnature:"02",vehicleType:"A1",energyType:"1" }).then((res) => {
+      this.$api.insCompany.schemeList({ ...this.pageRequest, companyId: this.companyId, carnature: "02", vehicleType: "A1", energyType: "1" }).then((res) => {
         if (res.code == '200') {
           let pageList = {
             content: res.data.records,
@@ -644,7 +688,7 @@ export default {
     solutionUpdate({ row, column }) {
       this.solutionDialogType = 'edit';
       this.solutionDialogTitle = '编辑方案'
-      this.$api.insCompany.schemedetails(row.companyId, row.productId,"02",'A1','1').then((res) => {
+      this.$api.insCompany.schemedetails(row.companyId, row.productId, "02", 'A1', '1').then((res) => {
         if (res.code == '200') {
           res.data.productList.map(valA => {
             valA.kinds.map(valB => {
@@ -657,7 +701,7 @@ export default {
               data.list.map(val => {
                 if (val.parentId != '0') {
                   let obj = val.drvingList.find(item => item.id == val.parentId)
-                    val.drvingChildren = obj.insDrivingIntentionInsurances;
+                  val.drvingChildren = obj.insDrivingIntentionInsurances;
                 }
               })
               const listCodes = data.list.map(item => item.code); // 获取当前 data 的所有 code
@@ -839,4 +883,3 @@ export default {
   background: #F2F2F2;
 }
 </style>
-

+ 289 - 243
src/views/AgreementManage/InsuranceCompany/PassengerBus/BusinessOperation/Fuel/AddOrdinaryPlan.vue

@@ -1,234 +1,240 @@
 <!-- 模板区域 -->
 <template>
   <div>
-      <div class="tab-panestyle">
-        <div class="tab-panecent">
-          <span>险种配置</span>
-          <el-radio-group :disabled="this.solutionDialogType == 'edit'" v-model="solutionData.productId"
-            @input="productInput" size="small" style="margin-left: 30px;">
-            <el-radio-button v-for="(productsitem, productsindex) in productsTypeoptions" :key="productsindex"
-              :label="productsitem.dictValue">{{
-                productsitem.dictTag }}</el-radio-button>
-          </el-radio-group>
+    <div class="tab-panestyle">
+      <div class="tab-panecent">
+        <span>险种配置</span>
+        <el-radio-group :disabled="this.solutionDialogType == 'edit'" v-model="solutionData.productId"
+          @input="productInput" size="small" style="margin-left: 30px;">
+          <el-radio-button v-for="(productsitem, productsindex) in productsTypeoptions" :key="productsindex"
+            :label="productsitem.dictValue">{{
+              productsitem.dictTag }}</el-radio-button>
+        </el-radio-group>
+      </div>
+      <div class="tab-panecent">
+        <div class=" flex j-s a-c">
+          <el-button type="primary" size="small" icon="el-icon-plus" class="planOption-btn"
+            @click="planOptionadd">方案新增</el-button>
         </div>
-        <div class="tab-panecent">
-          <div class=" flex j-s a-c">
-            <el-button type="primary" size="small" icon="el-icon-plus" class="planOption-btn"
-              @click="planOptionadd">方案新增</el-button>
+        <div v-for="(solutionitem, solutionindex) in solutionData.productList" :key="solutionindex">
+          <div class="flex j-s a-c " style="margin-top: 20px;font-size: 16px;color: #262626;">
+            <span>方案{{ solutionindex + 1 }}</span>
+            <el-button v-if="solutionindex > 0" type="primary" size="small" icon="el-icon-delete" class="planOption-del"
+              @click="planOptiondel(solutionindex)">方案删除</el-button>
           </div>
-          <div v-for="(solutionitem, solutionindex) in solutionData.productList" :key="solutionindex">
-            <div class="flex j-s a-c " style="margin-top: 20px;font-size: 16px;color: #262626;">
-              <span>方案{{ solutionindex + 1 }}</span>
-              <el-button v-if="solutionindex > 0" type="primary" size="small" icon="el-icon-delete" class="planOption-del"
-                @click="planOptiondel(solutionindex)">方案删除</el-button>
+          <el-form :ref="`solutionForm${solutionindex}`" :model="solutionitem" label-width="120px"
+            :rules="solutionrules" :size="overSize">
+            <el-row>
+              <el-col :span="8">
+                <el-form-item label="方案名称" prop="schemeName">
+                  <el-input type="text" v-model="solutionitem.schemeName" placeholder="输入方案名称"></el-input>
+                </el-form-item>
+              </el-col>
+              <el-col :span="4">
+                <el-form-item label="序号" prop="priorityLevel">
+                  <el-input type="text" v-model="solutionitem.priorityLevel" clearable :maxlength="2"></el-input>
+                </el-form-item>
+              </el-col>
+              <el-col :span="20">
+                <el-form-item label="方案描述">
+                  <el-input type="textarea" v-model="solutionitem.description" placeholder="输入方案描述" maxlength="100"
+                    show-word-limit></el-input>
+                </el-form-item>
+              </el-col>
+            </el-row>
+          </el-form>
+          <div v-if="['单商', '单三', '交三', '交商'].includes(solutionData.productName)">
+            <div class="flex j-s a-c">
+              <h4>商业险方案配置</h4>
             </div>
-            <el-form ref="solutionForm" :model="solutionitem" label-width="120px" :size="overSize">
-              <el-row>
-                <el-col :span="8">
-                  <el-form-item label="方案名称">
-                    <el-input type="text" v-model="solutionitem.schemeName" placeholder="输入方案名称"></el-input>
-                  </el-form-item>
-                </el-col>
-                <el-col :span="20">
-                  <el-form-item label="方案描述">
-                    <el-input type="textarea" v-model="solutionitem.description" placeholder="输入方案描述" maxlength="100"
-                      show-word-limit></el-input>
-                  </el-form-item>
-                </el-col>
-              </el-row>
-            </el-form>
-            <div v-if="['单商', '单三', '交三', '交商'].includes(solutionData.productName)">
-              <div class="flex j-s a-c">
-                <h4>商业险方案配置</h4>
-              </div>
-              <div class="flex j-start ">
-                <div class="Risk f-c" style="margin-right: 30px;">
-                  <section class="flex j-s a-c ">
-                    <div>
-                      全部险别
-                    </div>
-                    <div>
-                      投保保额
-                    </div>
-                  </section>
-                  <main class="flex j-s a-c" v-for="(insureitem, insureindex) in solutionitem.kinds" :key="insureindex">
-                    <div>
-                      <el-checkbox v-model="insureitem.switch" style="margin-right: 10px;" disabled></el-checkbox>
-                      <span>{{ insureitem.kindName }}</span>
-                    </div>
-                    <div>
-                      <el-select v-if="insureitem.amtList.length > 0" filterable v-model="insureitem.amount"
-                        placeholder="请选择"
-                        @change="(value) => amtListChange(value, insureitem.amtList, insureindex, solutionindex)"
-                        style="width: 200px;" clearable :size="overSize">
-                        <el-option v-for="(item, index) in insureitem.amtList" :key="index" :label="item.label"
-                          :value="item.value"></el-option>
-                      </el-select>
-                      <span v-else>
-                        <el-input-number @change="(value) => inputNumberChange(value, insureindex, solutionindex)"
-                          size="small" style="width:200px; margin-right: 10px;" v-model="insureitem.amount"
-                          :min="0"></el-input-number>次
-                      </span>
-                    </div>
-                  </main>
-                </div>
-                <div class="Risk">
-                  <section class="flex j-s a-c ">
-                    <span class="flex j-start">已选险别</span>
-                    <span class="flex j-c">投保保额</span>
-                    <span class="flex j-end">操作</span>
-                  </section>
-                  <main class="flex j-s a-c" v-for="(filteredInsureitem, filteredInsureindex) in solutionitem.kinds"
-                    :key="filteredInsureindex" v-if="filteredInsureitem.switch">
-                    <span class="flex j-start">{{ filteredInsureitem.kindName }}</span>
-                    <span class="flex j-c" v-if="['A'].includes(filteredInsureitem.kindCode)">{{
-                      filteredInsureitem.amountDesc }}</span>
-                    <span class="flex j-c"
-                      v-else-if="['MJ1', 'MJ2', 'MJ3', 'MJ4'].includes(filteredInsureitem.kindCode)">{{
-                        filteredInsureitem.amount }}%</span>
-                    <span class="flex j-c"
-                      v-else-if="['TY1', 'TY2', 'TY3', 'TY4'].includes(filteredInsureitem.kindCode)">{{
-                        filteredInsureitem.amount }}次</span>
-                    <span class="flex j-c" v-else>{{ convertedValue(filteredInsureitem.amount) }}</span>
-                    <span class="flex j-end">
-                      <i class="el-icon-delete" style="font-size: 20px;"
-                        @click="InsureDel(solutionindex, filteredInsureitem.kindCode)"></i>
+            <div class="flex j-start ">
+              <div class="Risk f-c" style="margin-right: 30px;">
+                <section class="flex j-s a-c ">
+                  <div>
+                    全部险别
+                  </div>
+                  <div>
+                    投保保额
+                  </div>
+                </section>
+                <main class="flex j-s a-c" v-for="(insureitem, insureindex) in solutionitem.kinds" :key="insureindex">
+                  <div>
+                    <el-checkbox v-model="insureitem.switch" style="margin-right: 10px;" disabled></el-checkbox>
+                    <span>{{ insureitem.kindName }}</span>
+                  </div>
+                  <div>
+                    <el-select v-if="insureitem.amtList.length > 0" filterable v-model="insureitem.amount"
+                      placeholder="请选择"
+                      @change="(value) => amtListChange(value, insureitem.amtList, insureindex, solutionindex)"
+                      style="width: 200px;" clearable :size="overSize">
+                      <el-option v-for="(item, index) in insureitem.amtList" :key="index" :label="item.label"
+                        :value="item.value"></el-option>
+                    </el-select>
+                    <span v-else>
+                      <el-input-number @change="(value) => inputNumberChange(value, insureindex, solutionindex)"
+                        size="small" style="width:200px; margin-right: 10px;" v-model="insureitem.amount"
+                        :min="0"></el-input-number>次
                     </span>
-                  </main>
-                </div>
-              </div>
-            </div>
-            <div>
-              <div class="flex a-c">
-                <h4>驾意险方案配置</h4>
-                <el-button size="mini"
-                  style="margin-left: 15px;background: #EAEDF1;border: 1px solid #D9D9D9;color: #2D4D89;"
-                  @click="AddDriverInsurancePlan(solutionindex)">添加配置</el-button>
-              </div>
-              <div v-for="(configureitem, configureindex) in solutionitem.drvingIntentions" :key="configureindex"
-                style="margin-bottom: 20px;">
-                <div class="flex j-s a-c">
-                  <div class="flex a-c " style="margin-bottom: 15px;" v-for="DriverTypeitem in configureitem.driverType"
-                    :key="DriverTypeitem.id">
-                    <span style="margin-right: 10px;color: #262626;font-size: 14px;font-weight: bold;">{{
-                      DriverTypeitem.typeName
-                    }}</span>
-                    <el-checkbox v-model="childrenitem.checked" v-for="childrenitem in DriverTypeitem.children"
-                      :key="childrenitem.id"
-                      @change="event => drvingcheckboxChange(event, childrenitem, solutionindex, configureindex)">{{
-                        childrenitem.typeName }}</el-checkbox>
                   </div>
+                </main>
+              </div>
+              <div class="Risk">
+                <section class="flex j-s a-c ">
+                  <span class="flex j-start">已选险别</span>
+                  <span class="flex j-c">投保保额</span>
+                  <span class="flex j-end">操作</span>
+                </section>
+                <main class="flex j-s a-c" v-for="(filteredInsureitem, filteredInsureindex) in solutionitem.kinds"
+                  :key="filteredInsureindex" v-if="filteredInsureitem.switch">
+                  <span class="flex j-start">{{ filteredInsureitem.kindName }}</span>
+                  <span class="flex j-c" v-if="['A'].includes(filteredInsureitem.kindCode)">{{
+                    filteredInsureitem.amountDesc }}</span>
+                  <span class="flex j-c"
+                    v-else-if="['MJ1', 'MJ2', 'MJ3', 'MJ4'].includes(filteredInsureitem.kindCode)">{{
+                      filteredInsureitem.amount }}%</span>
+                  <span class="flex j-c"
+                    v-else-if="['TY1', 'TY2', 'TY3', 'TY4'].includes(filteredInsureitem.kindCode)">{{
+                      filteredInsureitem.amount }}次</span>
+                  <span class="flex j-c" v-else>{{ convertedValue(filteredInsureitem.amount) }}</span>
                   <span class="flex j-end">
                     <i class="el-icon-delete" style="font-size: 20px;"
-                      @click="drvingDel(solutionindex, configureindex)"></i>
+                      @click="InsureDel(solutionindex, filteredInsureitem.kindCode)"></i>
                   </span>
+                </main>
+              </div>
+            </div>
+          </div>
+          <div>
+            <div class="flex a-c">
+              <h4>驾意险方案配置</h4>
+              <el-button size="mini"
+                style="margin-left: 15px;background: #EAEDF1;border: 1px solid #D9D9D9;color: #2D4D89;"
+                @click="AddDriverInsurancePlan(solutionindex)">添加配置</el-button>
+            </div>
+            <div v-for="(configureitem, configureindex) in solutionitem.drvingIntentions" :key="configureindex"
+              style="margin-bottom: 20px;">
+              <div class="flex j-s a-c">
+                <div class="flex a-c " style="margin-bottom: 15px;" v-for="DriverTypeitem in configureitem.driverType"
+                  :key="DriverTypeitem.id">
+                  <span style="margin-right: 10px;color: #262626;font-size: 14px;font-weight: bold;">{{
+                    DriverTypeitem.typeName
+                  }}</span>
+                  <el-checkbox v-model="childrenitem.checked" v-for="childrenitem in DriverTypeitem.children"
+                    :key="childrenitem.id"
+                    @change="event => drvingcheckboxChange(event, childrenitem, solutionindex, configureindex)">{{
+                      childrenitem.typeName }}</el-checkbox>
                 </div>
-                <el-form ref="form" :model="formitem" label-width="120px" size="small"
-                  v-for="(formitem, formindex) in configureitem.list" :key="formindex">
-                  <el-row>
-                    <el-col :span="24">
-                      <el-col :span="10">
-                        <el-form-item label="驾意选择:">
-                          <el-select
-                            v-if="formitem.isMultiple == 1 && !formitem.drvingList[0].insDrivingIntentionInsurances"
-                            filterable multiple v-model="formitem.drivingIntentionIds" placeholder="请选择" clearable
-                            :size="overSize" style="width: 250px;"
-                            @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
-                            <el-option :label="item.projectName" :value="item.id"
-                              v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
-                          </el-select>
-                          <el-select
-                            v-else-if="formitem.isMultiple == 1 && formitem.drvingList[0].insDrivingIntentionInsurances"
-                            filterable v-model="formitem.parentId" placeholder="请选择" clearable :size="overSize"
-                            style="width: 250px;"
-                            @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
-                            <el-option :label="item.projectName" :value="item.id"
-                              v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
-                          </el-select>
-                          <el-select
-                            v-else-if="formitem.isMultiple == 0 && !formitem.drvingList[0].insDrivingIntentionInsurances"
-                            filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable :size="overSize"
+                <span class="flex j-end">
+                  <i class="el-icon-delete" style="font-size: 20px;"
+                    @click="drvingDel(solutionindex, configureindex)"></i>
+                </span>
+              </div>
+              <el-form ref="form" :model="formitem" label-width="120px" size="small"
+                v-for="(formitem, formindex) in configureitem.list" :key="formindex">
+                <el-row>
+                  <el-col :span="24">
+                    <el-col :span="10">
+                      <el-form-item label="驾意选择:">
+                        <el-select
+                          v-if="formitem.isMultiple == 1 && !formitem.drvingList[0].insDrivingIntentionInsurances"
+                          filterable multiple v-model="formitem.drivingIntentionIds" placeholder="请选择" clearable
+                          :size="overSize" style="width: 250px;"
+                          @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
+                          <el-option :label="item.projectName" :value="item.id"
+                            v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
+                        </el-select>
+                        <el-select
+                          v-else-if="formitem.isMultiple == 1 && formitem.drvingList[0].insDrivingIntentionInsurances"
+                          filterable v-model="formitem.parentId" placeholder="请选择" clearable :size="overSize"
+                          style="width: 250px;"
+                          @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
+                          <el-option :label="item.projectName" :value="item.id"
+                            v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
+                        </el-select>
+                        <el-select
+                          v-else-if="formitem.isMultiple == 0 && !formitem.drvingList[0].insDrivingIntentionInsurances"
+                          filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable :size="overSize"
+                          style="width: 250px;"
+                          @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
+                          <el-option :label="item.projectName" :value="item.id"
+                            v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
+                        </el-select>
+                        <el-select
+                          v-else-if="formitem.isMultiple == 0 && formitem.drvingList[0].insDrivingIntentionInsurances"
+                          filterable v-model="formitem.parentId" placeholder="请选择" clearable :size="overSize"
+                          style="width: 250px;"
+                          @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
+                          <el-option :label="item.projectName" :value="item.id"
+                            v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
+                        </el-select>
+                        <template v-if="formitem.drvingChildren">
+                          <el-select v-if="formitem.isMultiple == 1" multiple filterable
+                            v-model="formitem.drivingIntentionIds" placeholder="请选择" clearable :size="overSize"
                             style="width: 250px;"
-                            @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
+                            @change="event => drivingChildrenChange(event, solutionindex, configureindex, formindex)">
                             <el-option :label="item.projectName" :value="item.id"
-                              v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
+                              v-for="(item, index) in formitem.drvingChildren" :key="index"></el-option>
                           </el-select>
-                          <el-select
-                            v-else-if="formitem.isMultiple == 0 && formitem.drvingList[0].insDrivingIntentionInsurances"
-                            filterable v-model="formitem.parentId" placeholder="请选择" clearable :size="overSize"
-                            style="width: 250px;"
-                            @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
+                          <el-select v-else filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable
+                            :size="overSize" style="width: 250px;"
+                            @change="event => drivingChildrenChange(event, solutionindex, configureindex, formindex)">
                             <el-option :label="item.projectName" :value="item.id"
-                              v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
+                              v-for="(item, index) in formitem.drvingChildren" :key="index"></el-option>
                           </el-select>
-                          <template v-if="formitem.drvingChildren">
-                            <el-select v-if="formitem.isMultiple == 1" multiple filterable
-                              v-model="formitem.drivingIntentionIds" placeholder="请选择" clearable :size="overSize"
-                              style="width: 250px;"
-                              @change="event => drivingChildrenChange(event, solutionindex, configureindex, formindex)">
-                              <el-option :label="item.projectName" :value="item.id"
-                                v-for="(item, index) in formitem.drvingChildren" :key="index"></el-option>
-                            </el-select>
-                            <el-select v-else filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable
-                              :size="overSize" style="width: 250px;"
-                              @change="event => drivingChildrenChange(event, solutionindex, configureindex, formindex)">
-                              <el-option :label="item.projectName" :value="item.id"
-                                v-for="(item, index) in formitem.drvingChildren" :key="index"></el-option>
-                            </el-select>
-                          </template>
-                        </el-form-item>
-                      </el-col>
-                      <el-col :span="4">
-                        <el-form-item label="别名:">
-                          <el-input v-model="formitem.alias" placeholder="驾意险别名"></el-input>
-                        </el-form-item>
-                      </el-col>
-                      <el-col :span="5">
-                        <el-form-item label="座位数:">
-                          <el-input-number v-model="formitem.seatNum" controls-position="right" :min="1"
-                            :max="10"></el-input-number>
-                          <span>座</span>
-                        </el-form-item>
-                      </el-col>
-                      <el-col :span="5">
-                        <el-form-item label="份数:">
-                          <el-input-number v-model="formitem.quantity" controls-position="right" :min="1"
-                            :max="10"></el-input-number>
-                          <span>份</span>
-                        </el-form-item>
-                      </el-col>
+                        </template>
+                      </el-form-item>
                     </el-col>
-                    <el-col :span="20">
-                      <div v-for="(LiabilityTermsitem, LiabilityTermsindex) in formitem.LiabilityTerms"
-                        :key="LiabilityTermsindex">
-                        <div style="font-weight: bold;margin-bottom: 10px;">{{ LiabilityTermsitem.projectName }}</div>
-                        <el-table :data="LiabilityTermsitem.LiabilityTerms" size="mini" :header-cell-style="{
-                          background: '#F7F7F9',
-                          fontWeight: '700',
-                          color: '#606266',
-                        }">
-                          <el-table-column prop="name" label="保险责任" align="center">
-                          </el-table-column>
-                          <el-table-column prop="amount" label="保险金额" width="180" align="center">
-                          </el-table-column>
-                          <el-table-column prop="premium" label="保费(元)" width="180" align="center">
-                          </el-table-column>
-                        </el-table>
-                      </div>
+                    <el-col :span="4">
+                      <el-form-item label="别名:">
+                        <el-input v-model="formitem.alias" placeholder="驾意险别名"></el-input>
+                      </el-form-item>
                     </el-col>
-                  </el-row>
-                </el-form>
-              </div>
+                    <el-col :span="5">
+                      <el-form-item label="座位数:">
+                        <el-input-number v-model="formitem.seatNum" controls-position="right" :min="1"
+                          :max="10"></el-input-number>
+                        <span>座</span>
+                      </el-form-item>
+                    </el-col>
+                    <el-col :span="5">
+                      <el-form-item label="份数:">
+                        <el-input-number v-model="formitem.quantity" controls-position="right" :min="1"
+                          :max="10"></el-input-number>
+                        <span>份</span>
+                      </el-form-item>
+                    </el-col>
+                  </el-col>
+                  <el-col :span="20">
+                    <div v-for="(LiabilityTermsitem, LiabilityTermsindex) in formitem.LiabilityTerms"
+                      :key="LiabilityTermsindex">
+                      <div style="font-weight: bold;margin-bottom: 10px;">{{ LiabilityTermsitem.projectName }}</div>
+                      <el-table :data="LiabilityTermsitem.LiabilityTerms" size="mini" :header-cell-style="{
+                        background: '#F7F7F9',
+                        fontWeight: '700',
+                        color: '#606266',
+                      }">
+                        <el-table-column prop="name" label="保险责任" align="center">
+                        </el-table-column>
+                        <el-table-column prop="amount" label="保险金额" width="180" align="center">
+                        </el-table-column>
+                        <el-table-column prop="premium" label="保费(元)" width="180" align="center">
+                        </el-table-column>
+                      </el-table>
+                    </div>
+                  </el-col>
+                </el-row>
+              </el-form>
             </div>
           </div>
         </div>
       </div>
-      <span slot="footer" class="dialog-footer">
-        <el-button :size="overSize" style="background: #EAEDF1;color: #2D4D89;" @click="ordinaryPlanCancel">取
-          消</el-button>
-        <el-button :size="overSize" style="background: #2D4D89;color: #fff;border-color: #2D4D89;" type="primary"
-          @click="solutionSubmit('solutionForm')">确 定</el-button>
-      </span>
+    </div>
+    <span slot="footer" class="dialog-footer">
+      <el-button :size="overSize" style="background: #EAEDF1;color: #2D4D89;" @click="ordinaryPlanCancel">取
+        消</el-button>
+      <el-button :size="overSize" style="background: #2D4D89;color: #fff;border-color: #2D4D89;" type="primary"
+        @click="solutionSubmit('solutionForm')">确 定</el-button>
+    </span>
   </div>
 </template>
 <!-- 行为区域 -->
@@ -241,6 +247,7 @@ export default {
   },
   data() {
     return {
+
       DriveSelectAll: false,
       checkedall: false,
       insureList: [],
@@ -250,6 +257,15 @@ export default {
         { prop: "companyId", label: "保险公司编码", minWidth: 160, },
         { prop: "productName", label: "方案险种", minWidth: 180, },
       ],
+      solutionrules: {
+        schemeName: [
+          { required: true, message: '方案名称必填', trigger: 'blur' }
+        ],
+        priorityLevel: [
+          { required: true, message: '序号必填', trigger: 'blur' },
+          { validator: this.validatePriority, trigger: 'blur' },
+        ],
+      },
       solutionResult: [],
       //操作符字典
       pageRequest: {
@@ -263,8 +279,9 @@ export default {
         productName: "",
         productList: [
           {
-            schemeName: "",
-            description: "",
+            schemeName: "",//方案名称
+            priorityLevel: "",//方案序号
+            description: "",//方案描述
             kinds: [],
             drvingIntentions: [
               {
@@ -301,6 +318,15 @@ export default {
   },
   // 方法函数
   methods: {
+    validatePriority(rule, value, callback) {
+      if (!value) {
+        callback(new Error('请输入序号'));
+      } else if (!/^[1-9][0-9]?$/.test(value)) {
+        callback(new Error('请输入 1-99 的整数'));
+      } else {
+        callback();
+      }
+    },
     // drivingChange(event, solutionindex, configureindex, formindex) {
     //   if (event) {
     //     if (event instanceof Array) {
@@ -493,6 +519,7 @@ export default {
       })
       this.solutionData.productList.push({
         schemeName: "",
+        priorityLevel: "",//方案序号
         description: "",
         kinds: this.solutionData.productName !== '单交' ? list : [],
         drvingIntentions: [
@@ -532,43 +559,62 @@ export default {
         seatNum: ""//座位数
       });
     },
-    ordinaryPlanCancel () {
+    ordinaryPlanCancel() {
       this.$emit('ordinaryPlanCancel')
     },
-    solutionSubmit(formName) {
-      if (this.solutionDialogType == 'add') {
-        this.$api.insCompany.shcemeAdd({...this.solutionData,carnature:"01",vehicleType:"A0",energyType:"0"}).then((res) => {
-          if (res.code == '200') {
-            this.$message({
-              type: 'success',
-              message: res.msg,
-            });
-            this.solutionFindPage();
-            this.$emit('ordinaryPlanSubmit')
-          } else {
-            this.$message({
-              type: 'error',
-              message: res.msg,
-            });
-          }
+    solutionSubmit() {
+      const promises = this.solutionData.productList.map((_, index) => {
+        const formName = `solutionForm${index}`;
+        return new Promise((resolve, reject) => {
+          this.$refs[formName][0].validate((valid) => {
+            if (valid) {
+              resolve();
+            } else {
+              reject(`方案 ${index + 1} 校验失败!`);
+            }
+          });
         });
-      } else {
-        this.$api.insCompany.schemeUpdate({...this.solutionData,carnature:"01",vehicleType:"A0",energyType:"0"}).then((res) => {
-          if (res.code == '200') {
-            this.$message({
-              type: 'success',
-              message: res.msg,
+      });
+      Promise.all(promises)
+        .then(() => {
+          if (this.solutionDialogType == 'add') {
+            this.$api.insCompany.shcemeAdd({ ...this.solutionData, carnature: "01", vehicleType: "A0", energyType: "0" }).then((res) => {
+              if (res.code == '200') {
+                this.$message({
+                  type: 'success',
+                  message: res.msg,
+                });
+                this.solutionFindPage();
+                this.$emit('ordinaryPlanSubmit')
+              } else {
+                this.$message({
+                  type: 'error',
+                  message: res.msg,
+                });
+              }
             });
-            this.solutionFindPage();
-            this.$emit('ordinaryPlanSubmit')
           } else {
-            this.$message({
-              type: 'error',
-              message: res.msg,
+            this.$api.insCompany.schemeUpdate({ ...this.solutionData, carnature: "01", vehicleType: "A0", energyType: "0" }).then((res) => {
+              if (res.code == '200') {
+                this.$message({
+                  type: 'success',
+                  message: res.msg,
+                });
+                this.solutionFindPage();
+                this.$emit('ordinaryPlanSubmit')
+              } else {
+                this.$message({
+                  type: 'error',
+                  message: res.msg,
+                });
+              }
             });
           }
+        })
+        .catch((error) => {
+          console.log(error);
         });
-      }
+
     },
     getDicType(type) {
       this.$api.insCompany.dicType(type).then((res) => {
@@ -582,7 +628,7 @@ export default {
       this.solutionDialogTitle = '添加方案'
     },
     solutionFindPage() {
-      this.$api.insCompany.schemeList({ ...this.pageRequest, companyId: this.companyId,carnature:"01",vehicleType:"A0",energyType:"0" }).then((res) => {
+      this.$api.insCompany.schemeList({ ...this.pageRequest, companyId: this.companyId, carnature: "01", vehicleType: "A0", energyType: "0" }).then((res) => {
         if (res.code == '200') {
           let pageList = {
             content: res.data.records,
@@ -603,7 +649,7 @@ export default {
     solutionUpdate({ row, column }) {
       this.solutionDialogType = 'edit';
       this.solutionDialogTitle = '编辑方案'
-      this.$api.insCompany.schemedetails(row.companyId, row.productId,"01",'A0','0').then((res) => {
+      this.$api.insCompany.schemedetails(row.companyId, row.productId, "01", 'A0', '0').then((res) => {
         if (res.code == '200') {
           res.data.productList.map(valA => {
             valA.kinds.map(valB => {
@@ -616,7 +662,7 @@ export default {
               data.list.map(val => {
                 if (val.parentId != '0') {
                   let obj = val.drvingList.find(item => item.id == val.parentId)
-                    val.drvingChildren = obj.insDrivingIntentionInsurances;
+                  val.drvingChildren = obj.insDrivingIntentionInsurances;
                 }
               })
               const listCodes = data.list.map(item => item.code); // 获取当前 data 的所有 code
@@ -675,6 +721,7 @@ export default {
   align-items: flex-end;
   justify-content: flex-end;
 }
+
 /deep/ {
   .el-radio__input.is-checked .el-radio__inner,
   .el-checkbox__input.is-checked .el-checkbox__inner,
@@ -805,4 +852,3 @@ export default {
   background: #F2F2F2;
 }
 </style>
-

+ 90 - 47
src/views/AgreementManage/InsuranceCompany/PassengerBus/BusinessOperation/Fuel/OrdinaryPlan.vue

@@ -7,8 +7,8 @@
     <!-- @findPage="solutionFindPage" -->
     <kt-common-table :tableHeights="700" :SerialShow="false" :operationWidth="200" :showOperation="true"
       :showBatchDelete="false" :showBatchSettled="false" :showBatchPrint="false" :data="solutionResult" button2Name="编辑"
-      button2Type="text" @findPage="solutionFindPage" @handleButton2="solutionUpdate" button3Name="删除" button3Type="text" @handleButton3="solutionDel"
-      :columns="solutionColumns">
+      button2Type="text" @findPage="solutionFindPage" @handleButton2="solutionUpdate" button3Name="删除"
+      button3Type="text" @handleButton3="solutionDel" :columns="solutionColumns">
     </kt-common-table>
     <el-dialog v-dialogDrag :title="solutionDialogTitle" :visible.sync="solutionVisible" width="90%" top="2vh"
       @close="solutioncloseDialog">
@@ -30,16 +30,22 @@
           <div v-for="(solutionitem, solutionindex) in solutionData.productList" :key="solutionindex">
             <div class="flex j-s a-c " style="margin-top: 20px;font-size: 16px;color: #262626;">
               <span>方案{{ solutionindex + 1 }}</span>
-              <el-button v-if="solutionindex > 0" type="primary" size="small" icon="el-icon-delete" class="planOption-del"
-                @click="planOptiondel(solutionindex)">方案删除</el-button>
+              <el-button v-if="solutionindex > 0" type="primary" size="small" icon="el-icon-delete"
+                class="planOption-del" @click="planOptiondel(solutionindex)">方案删除</el-button>
             </div>
-            <el-form ref="solutionForm" :model="solutionitem" label-width="120px" :size="overSize">
+            <el-form :ref="`solutionForm${solutionindex}`" :rules="solutionrules" :model="solutionitem"
+              label-width="120px" :size="overSize">
               <el-row>
                 <el-col :span="8">
-                  <el-form-item label="方案名称">
+                  <el-form-item label="方案名称" prop="schemeName">
                     <el-input type="text" v-model="solutionitem.schemeName" placeholder="输入方案名称"></el-input>
                   </el-form-item>
                 </el-col>
+                <el-col :span="4">
+                  <el-form-item label="序号" prop="priorityLevel">
+                    <el-input type="text" v-model="solutionitem.priorityLevel" clearable :maxlength="2"></el-input>
+                  </el-form-item>
+                </el-col>
                 <el-col :span="20">
                   <el-form-item label="方案描述">
                     <el-input type="textarea" v-model="solutionitem.description" placeholder="输入方案描述" maxlength="100"
@@ -123,7 +129,7 @@
                     :key="DriverTypeitem.id">
                     <span style="margin-right: 10px;color: #262626;font-size: 14px;font-weight: bold;">{{
                       DriverTypeitem.typeName
-                    }}</span>
+                      }}</span>
                     <el-checkbox v-model="childrenitem.checked" v-for="childrenitem in DriverTypeitem.children"
                       :key="childrenitem.id"
                       @change="event => drvingcheckboxChange(event, childrenitem, solutionindex, configureindex)">{{
@@ -158,8 +164,8 @@
                           </el-select>
                           <el-select
                             v-else-if="formitem.isMultiple == 0 && !formitem.drvingList[0].insDrivingIntentionInsurances"
-                            filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable :size="overSize"
-                            style="width: 250px;"
+                            filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable
+                            :size="overSize" style="width: 250px;"
                             @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
                             <el-option :label="item.projectName" :value="item.id"
                               v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
@@ -180,8 +186,8 @@
                               <el-option :label="item.projectName" :value="item.id"
                                 v-for="(item, index) in formitem.drvingChildren" :key="index"></el-option>
                             </el-select>
-                            <el-select v-else filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable
-                              :size="overSize" style="width: 250px;"
+                            <el-select v-else filterable v-model="formitem.drivingIntentionId" placeholder="请选择"
+                              clearable :size="overSize" style="width: 250px;"
                               @change="event => drivingChildrenChange(event, solutionindex, configureindex, formindex)">
                               <el-option :label="item.projectName" :value="item.id"
                                 v-for="(item, index) in formitem.drvingChildren" :key="index"></el-option>
@@ -275,6 +281,15 @@ export default {
         { prop: "companyId", label: "保险公司编码", minWidth: 160, },
         { prop: "productName", label: "方案险种", minWidth: 180, },
       ],
+      solutionrules: {
+        schemeName: [
+          { required: true, message: '方案名称必填', trigger: 'blur' }
+        ],
+        priorityLevel: [
+          { required: true, message: '序号必填', trigger: 'blur' },
+          { validator: this.validatePriority, trigger: 'blur' },
+        ],
+      },
       solutionResult: [],
       //操作符字典
       pageRequest: {
@@ -289,6 +304,7 @@ export default {
         productList: [
           {
             schemeName: "",
+            priorityLevel: "",
             description: "",
             kinds: [],
             drvingIntentions: [
@@ -308,12 +324,12 @@ export default {
     }
   },
   watch: {
-    activeIndex (newVal) {
+    activeIndex(newVal) {
       if (newVal === 0) {
         this.initData()
       }
     },
-    ordinaryIndex (newVal) {
+    ordinaryIndex(newVal) {
       if (newVal) {
         this.initData()
       }
@@ -321,13 +337,13 @@ export default {
   },
   // 生命周期函数
   created() {
-    if (this.$route.query.type*1 === 0) {
+    if (this.$route.query.type * 1 === 0) {
       this.initData()
     }
   },
   // 方法函数
   methods: {
-    initData () {
+    initData() {
       this.companyId = this.$route.query.companyId;
       this.solutionData.companyId = this.$route.query.companyId;
       this.getDicType("productsType"); //车险产品
@@ -344,6 +360,15 @@ export default {
       });
       localStorage.setItem("insureList", JSON.stringify(this.insureList));
     },
+    validatePriority(rule, value, callback) {
+      if (!value) {
+        callback(new Error('请输入序号'));
+      } else if (!/^[1-9][0-9]?$/.test(value)) {
+        callback(new Error('请输入 1-99 的整数'));
+      } else {
+        callback();
+      }
+    },
     // drivingChange(event, solutionindex, configureindex, formindex) {
     //   if (event) {
     //     if (event instanceof Array) {
@@ -536,6 +561,7 @@ export default {
       })
       this.solutionData.productList.push({
         schemeName: "",
+        priorityLevel: "",
         description: "",
         kinds: this.solutionData.productName !== '单交' ? list : [],
         drvingIntentions: [
@@ -575,40 +601,58 @@ export default {
         seatNum: ""//座位数
       });
     },
-    solutionSubmit(formName) {
-      if (this.solutionDialogType == 'add') {
-        this.$api.insCompany.shcemeAdd({...this.solutionData,carnature:"01",vehicleType:"A0",energyType:"0"}).then((res) => {
-          if (res.code == '200') {
-            this.$message({
-              type: 'success',
-              message: res.msg,
-            });
-            this.solutionVisible = false;
-            this.solutionFindPage();
-          } else {
-            this.$message({
-              type: 'error',
-              message: res.msg,
-            });
-          }
+    solutionSubmit() {
+      const promises = this.solutionData.productList.map((_, index) => {
+        const formName = `solutionForm${index}`;
+        return new Promise((resolve, reject) => {
+          this.$refs[formName][0].validate((valid) => {
+            if (valid) {
+              resolve();
+            } else {
+              reject(`方案 ${index + 1} 校验失败!`);
+            }
+          });
         });
-      } else {
-        this.$api.insCompany.schemeUpdate({...this.solutionData,carnature:"01",vehicleType:"A0",energyType:"0"}).then((res) => {
-          if (res.code == '200') {
-            this.$message({
-              type: 'success',
-              message: res.msg,
+      });
+      Promise.all(promises)
+        .then(() => {
+          if (this.solutionDialogType == 'add') {
+            this.$api.insCompany.shcemeAdd({ ...this.solutionData, carnature: "01", vehicleType: "A0", energyType: "0" }).then((res) => {
+              if (res.code == '200') {
+                this.$message({
+                  type: 'success',
+                  message: res.msg,
+                });
+                this.solutionVisible = false;
+                this.solutionFindPage();
+              } else {
+                this.$message({
+                  type: 'error',
+                  message: res.msg,
+                });
+              }
             });
-            this.solutionVisible = false;
-            this.solutionFindPage();
           } else {
-            this.$message({
-              type: 'error',
-              message: res.msg,
+            this.$api.insCompany.schemeUpdate({ ...this.solutionData, carnature: "01", vehicleType: "A0", energyType: "0" }).then((res) => {
+              if (res.code == '200') {
+                this.$message({
+                  type: 'success',
+                  message: res.msg,
+                });
+                this.solutionVisible = false;
+                this.solutionFindPage();
+              } else {
+                this.$message({
+                  type: 'error',
+                  message: res.msg,
+                });
+              }
             });
           }
+        })
+        .catch((error) => {
+          console.log(error);
         });
-      }
     },
     getDicType(type) {
       this.$api.insCompany.dicType(type).then((res) => {
@@ -623,7 +667,7 @@ export default {
       this.solutionVisible = true;
     },
     solutionFindPage() {
-      this.$api.insCompany.schemeList({ ...this.pageRequest, companyId: this.companyId,carnature:"01",vehicleType:"A0",energyType:"0" }).then((res) => {
+      this.$api.insCompany.schemeList({ ...this.pageRequest, companyId: this.companyId, carnature: "01", vehicleType: "A0", energyType: "0" }).then((res) => {
         if (res.code == '200') {
           let pageList = {
             content: res.data.records,
@@ -644,7 +688,7 @@ export default {
     solutionUpdate({ row, column }) {
       this.solutionDialogType = 'edit';
       this.solutionDialogTitle = '编辑方案'
-      this.$api.insCompany.schemedetails(row.companyId, row.productId,"01",'A0','0').then((res) => {
+      this.$api.insCompany.schemedetails(row.companyId, row.productId, "01", 'A0', '0').then((res) => {
         if (res.code == '200') {
           res.data.productList.map(valA => {
             valA.kinds.map(valB => {
@@ -657,7 +701,7 @@ export default {
               data.list.map(val => {
                 if (val.parentId != '0') {
                   let obj = val.drvingList.find(item => item.id == val.parentId)
-                    val.drvingChildren = obj.insDrivingIntentionInsurances;
+                  val.drvingChildren = obj.insDrivingIntentionInsurances;
                 }
               })
               const listCodes = data.list.map(item => item.code); // 获取当前 data 的所有 code
@@ -839,4 +883,3 @@ export default {
   background: #F2F2F2;
 }
 </style>
-

+ 262 - 217
src/views/AgreementManage/InsuranceCompany/PassengerBus/BusinessOperation/NewEnergy/AddOrdinaryPlan.vue

@@ -1,234 +1,240 @@
 <!-- 模板区域 -->
 <template>
   <div>
-      <div class="tab-panestyle">
-        <div class="tab-panecent">
-          <span>险种配置</span>
-          <el-radio-group :disabled="this.solutionDialogType == 'edit'" v-model="solutionData.productId"
-            @input="productInput" size="small" style="margin-left: 30px;">
-            <el-radio-button v-for="(productsitem, productsindex) in productsTypeoptions" :key="productsindex"
-              :label="productsitem.dictValue">{{
-                productsitem.dictTag }}</el-radio-button>
-          </el-radio-group>
+    <div class="tab-panestyle">
+      <div class="tab-panecent">
+        <span>险种配置</span>
+        <el-radio-group :disabled="this.solutionDialogType == 'edit'" v-model="solutionData.productId"
+          @input="productInput" size="small" style="margin-left: 30px;">
+          <el-radio-button v-for="(productsitem, productsindex) in productsTypeoptions" :key="productsindex"
+            :label="productsitem.dictValue">{{
+              productsitem.dictTag }}</el-radio-button>
+        </el-radio-group>
+      </div>
+      <div class="tab-panecent">
+        <div class=" flex j-s a-c">
+          <el-button type="primary" size="small" icon="el-icon-plus" class="planOption-btn"
+            @click="planOptionadd">方案新增</el-button>
         </div>
-        <div class="tab-panecent">
-          <div class=" flex j-s a-c">
-            <el-button type="primary" size="small" icon="el-icon-plus" class="planOption-btn"
-              @click="planOptionadd">方案新增</el-button>
+        <div v-for="(solutionitem, solutionindex) in solutionData.productList" :key="solutionindex">
+          <div class="flex j-s a-c " style="margin-top: 20px;font-size: 16px;color: #262626;">
+            <span>方案{{ solutionindex + 1 }}</span>
+            <el-button v-if="solutionindex > 0" type="primary" size="small" icon="el-icon-delete" class="planOption-del"
+              @click="planOptiondel(solutionindex)">方案删除</el-button>
           </div>
-          <div v-for="(solutionitem, solutionindex) in solutionData.productList" :key="solutionindex">
-            <div class="flex j-s a-c " style="margin-top: 20px;font-size: 16px;color: #262626;">
-              <span>方案{{ solutionindex + 1 }}</span>
-              <el-button v-if="solutionindex > 0" type="primary" size="small" icon="el-icon-delete" class="planOption-del"
-                @click="planOptiondel(solutionindex)">方案删除</el-button>
+          <el-form :ref="`solutionForm${solutionindex}`" :model="solutionitem" label-width="120px"
+            :rules="solutionrules" :size="overSize">
+            <el-row>
+              <el-col :span="8">
+                <el-form-item label="方案名称" prop="schemeName">
+                  <el-input type="text" v-model="solutionitem.schemeName" placeholder="输入方案名称"></el-input>
+                </el-form-item>
+              </el-col>
+              <el-col :span="4">
+                <el-form-item label="序号" prop="priorityLevel">
+                  <el-input type="text" v-model="solutionitem.priorityLevel" clearable :maxlength="2"></el-input>
+                </el-form-item>
+              </el-col>
+              <el-col :span="20">
+                <el-form-item label="方案描述">
+                  <el-input type="textarea" v-model="solutionitem.description" placeholder="输入方案描述" maxlength="100"
+                    show-word-limit></el-input>
+                </el-form-item>
+              </el-col>
+            </el-row>
+          </el-form>
+          <div v-if="['单商', '单三', '交三', '交商'].includes(solutionData.productName)">
+            <div class="flex j-s a-c">
+              <h4>商业险方案配置</h4>
             </div>
-            <el-form ref="solutionForm" :model="solutionitem" label-width="120px" :size="overSize">
-              <el-row>
-                <el-col :span="8">
-                  <el-form-item label="方案名称">
-                    <el-input type="text" v-model="solutionitem.schemeName" placeholder="输入方案名称"></el-input>
-                  </el-form-item>
-                </el-col>
-                <el-col :span="20">
-                  <el-form-item label="方案描述">
-                    <el-input type="textarea" v-model="solutionitem.description" placeholder="输入方案描述" maxlength="100"
-                      show-word-limit></el-input>
-                  </el-form-item>
-                </el-col>
-              </el-row>
-            </el-form>
-            <div v-if="['单商', '单三', '交三', '交商'].includes(solutionData.productName)">
-              <div class="flex j-s a-c">
-                <h4>商业险方案配置</h4>
-              </div>
-              <div class="flex j-start ">
-                <div class="Risk f-c" style="margin-right: 30px;">
-                  <section class="flex j-s a-c ">
-                    <div>
-                      全部险别
-                    </div>
-                    <div>
-                      投保保额
-                    </div>
-                  </section>
-                  <main class="flex j-s a-c" v-for="(insureitem, insureindex) in solutionitem.kinds" :key="insureindex">
-                    <div>
-                      <el-checkbox v-model="insureitem.switch" style="margin-right: 10px;" disabled></el-checkbox>
-                      <span>{{ insureitem.kindName }}</span>
-                    </div>
-                    <div>
-                      <el-select v-if="insureitem.amtList.length > 0" filterable v-model="insureitem.amount"
-                        placeholder="请选择"
-                        @change="(value) => amtListChange(value, insureitem.amtList, insureindex, solutionindex)"
-                        style="width: 200px;" clearable :size="overSize">
-                        <el-option v-for="(item, index) in insureitem.amtList" :key="index" :label="item.label"
-                          :value="item.value"></el-option>
-                      </el-select>
-                      <span v-else>
-                        <el-input-number @change="(value) => inputNumberChange(value, insureindex, solutionindex)"
-                          size="small" style="width:200px; margin-right: 10px;" v-model="insureitem.amount"
-                          :min="0"></el-input-number>次
-                      </span>
-                    </div>
-                  </main>
-                </div>
-                <div class="Risk">
-                  <section class="flex j-s a-c ">
-                    <span class="flex j-start">已选险别</span>
-                    <span class="flex j-c">投保保额</span>
-                    <span class="flex j-end">操作</span>
-                  </section>
-                  <main class="flex j-s a-c" v-for="(filteredInsureitem, filteredInsureindex) in solutionitem.kinds"
-                    :key="filteredInsureindex" v-if="filteredInsureitem.switch">
-                    <span class="flex j-start">{{ filteredInsureitem.kindName }}</span>
-                    <span class="flex j-c" v-if="['A'].includes(filteredInsureitem.kindCode)">{{
-                      filteredInsureitem.amountDesc }}</span>
-                    <span class="flex j-c"
-                      v-else-if="['MJ1', 'MJ2', 'MJ3', 'MJ4'].includes(filteredInsureitem.kindCode)">{{
-                        filteredInsureitem.amount }}%</span>
-                    <span class="flex j-c"
-                      v-else-if="['TY1', 'TY2', 'TY3', 'TY4'].includes(filteredInsureitem.kindCode)">{{
-                        filteredInsureitem.amount }}次</span>
-                    <span class="flex j-c" v-else>{{ convertedValue(filteredInsureitem.amount) }}</span>
-                    <span class="flex j-end">
-                      <i class="el-icon-delete" style="font-size: 20px;"
-                        @click="InsureDel(solutionindex, filteredInsureitem.kindCode)"></i>
+            <div class="flex j-start ">
+              <div class="Risk f-c" style="margin-right: 30px;">
+                <section class="flex j-s a-c ">
+                  <div>
+                    全部险别
+                  </div>
+                  <div>
+                    投保保额
+                  </div>
+                </section>
+                <main class="flex j-s a-c" v-for="(insureitem, insureindex) in solutionitem.kinds" :key="insureindex">
+                  <div>
+                    <el-checkbox v-model="insureitem.switch" style="margin-right: 10px;" disabled></el-checkbox>
+                    <span>{{ insureitem.kindName }}</span>
+                  </div>
+                  <div>
+                    <el-select v-if="insureitem.amtList.length > 0" filterable v-model="insureitem.amount"
+                      placeholder="请选择"
+                      @change="(value) => amtListChange(value, insureitem.amtList, insureindex, solutionindex)"
+                      style="width: 200px;" clearable :size="overSize">
+                      <el-option v-for="(item, index) in insureitem.amtList" :key="index" :label="item.label"
+                        :value="item.value"></el-option>
+                    </el-select>
+                    <span v-else>
+                      <el-input-number @change="(value) => inputNumberChange(value, insureindex, solutionindex)"
+                        size="small" style="width:200px; margin-right: 10px;" v-model="insureitem.amount"
+                        :min="0"></el-input-number>次
                     </span>
-                  </main>
-                </div>
-              </div>
-            </div>
-            <div>
-              <div class="flex a-c">
-                <h4>驾意险方案配置</h4>
-                <el-button size="mini"
-                  style="margin-left: 15px;background: #EAEDF1;border: 1px solid #D9D9D9;color: #2D4D89;"
-                  @click="AddDriverInsurancePlan(solutionindex)">添加配置</el-button>
-              </div>
-              <div v-for="(configureitem, configureindex) in solutionitem.drvingIntentions" :key="configureindex"
-                style="margin-bottom: 20px;">
-                <div class="flex j-s a-c">
-                  <div class="flex a-c " style="margin-bottom: 15px;" v-for="DriverTypeitem in configureitem.driverType"
-                    :key="DriverTypeitem.id">
-                    <span style="margin-right: 10px;color: #262626;font-size: 14px;font-weight: bold;">{{
-                      DriverTypeitem.typeName
-                    }}</span>
-                    <el-checkbox v-model="childrenitem.checked" v-for="childrenitem in DriverTypeitem.children"
-                      :key="childrenitem.id"
-                      @change="event => drvingcheckboxChange(event, childrenitem, solutionindex, configureindex)">{{
-                        childrenitem.typeName }}</el-checkbox>
                   </div>
+                </main>
+              </div>
+              <div class="Risk">
+                <section class="flex j-s a-c ">
+                  <span class="flex j-start">已选险别</span>
+                  <span class="flex j-c">投保保额</span>
+                  <span class="flex j-end">操作</span>
+                </section>
+                <main class="flex j-s a-c" v-for="(filteredInsureitem, filteredInsureindex) in solutionitem.kinds"
+                  :key="filteredInsureindex" v-if="filteredInsureitem.switch">
+                  <span class="flex j-start">{{ filteredInsureitem.kindName }}</span>
+                  <span class="flex j-c" v-if="['A'].includes(filteredInsureitem.kindCode)">{{
+                    filteredInsureitem.amountDesc }}</span>
+                  <span class="flex j-c"
+                    v-else-if="['MJ1', 'MJ2', 'MJ3', 'MJ4'].includes(filteredInsureitem.kindCode)">{{
+                      filteredInsureitem.amount }}%</span>
+                  <span class="flex j-c"
+                    v-else-if="['TY1', 'TY2', 'TY3', 'TY4'].includes(filteredInsureitem.kindCode)">{{
+                      filteredInsureitem.amount }}次</span>
+                  <span class="flex j-c" v-else>{{ convertedValue(filteredInsureitem.amount) }}</span>
                   <span class="flex j-end">
                     <i class="el-icon-delete" style="font-size: 20px;"
-                      @click="drvingDel(solutionindex, configureindex)"></i>
+                      @click="InsureDel(solutionindex, filteredInsureitem.kindCode)"></i>
                   </span>
+                </main>
+              </div>
+            </div>
+          </div>
+          <div>
+            <div class="flex a-c">
+              <h4>驾意险方案配置</h4>
+              <el-button size="mini"
+                style="margin-left: 15px;background: #EAEDF1;border: 1px solid #D9D9D9;color: #2D4D89;"
+                @click="AddDriverInsurancePlan(solutionindex)">添加配置</el-button>
+            </div>
+            <div v-for="(configureitem, configureindex) in solutionitem.drvingIntentions" :key="configureindex"
+              style="margin-bottom: 20px;">
+              <div class="flex j-s a-c">
+                <div class="flex a-c " style="margin-bottom: 15px;" v-for="DriverTypeitem in configureitem.driverType"
+                  :key="DriverTypeitem.id">
+                  <span style="margin-right: 10px;color: #262626;font-size: 14px;font-weight: bold;">{{
+                    DriverTypeitem.typeName
+                  }}</span>
+                  <el-checkbox v-model="childrenitem.checked" v-for="childrenitem in DriverTypeitem.children"
+                    :key="childrenitem.id"
+                    @change="event => drvingcheckboxChange(event, childrenitem, solutionindex, configureindex)">{{
+                      childrenitem.typeName }}</el-checkbox>
                 </div>
-                <el-form ref="form" :model="formitem" label-width="120px" size="small"
-                  v-for="(formitem, formindex) in configureitem.list" :key="formindex">
-                  <el-row>
-                    <el-col :span="24">
-                      <el-col :span="10">
-                        <el-form-item label="驾意选择:">
-                          <el-select
-                            v-if="formitem.isMultiple == 1 && !formitem.drvingList[0].insDrivingIntentionInsurances"
-                            filterable multiple v-model="formitem.drivingIntentionIds" placeholder="请选择" clearable
-                            :size="overSize" style="width: 250px;"
-                            @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
-                            <el-option :label="item.projectName" :value="item.id"
-                              v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
-                          </el-select>
-                          <el-select
-                            v-else-if="formitem.isMultiple == 1 && formitem.drvingList[0].insDrivingIntentionInsurances"
-                            filterable v-model="formitem.parentId" placeholder="请选择" clearable :size="overSize"
-                            style="width: 250px;"
-                            @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
-                            <el-option :label="item.projectName" :value="item.id"
-                              v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
-                          </el-select>
-                          <el-select
-                            v-else-if="formitem.isMultiple == 0 && !formitem.drvingList[0].insDrivingIntentionInsurances"
-                            filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable :size="overSize"
+                <span class="flex j-end">
+                  <i class="el-icon-delete" style="font-size: 20px;"
+                    @click="drvingDel(solutionindex, configureindex)"></i>
+                </span>
+              </div>
+              <el-form ref="form" :model="formitem" label-width="120px" size="small"
+                v-for="(formitem, formindex) in configureitem.list" :key="formindex">
+                <el-row>
+                  <el-col :span="24">
+                    <el-col :span="10">
+                      <el-form-item label="驾意选择:">
+                        <el-select
+                          v-if="formitem.isMultiple == 1 && !formitem.drvingList[0].insDrivingIntentionInsurances"
+                          filterable multiple v-model="formitem.drivingIntentionIds" placeholder="请选择" clearable
+                          :size="overSize" style="width: 250px;"
+                          @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
+                          <el-option :label="item.projectName" :value="item.id"
+                            v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
+                        </el-select>
+                        <el-select
+                          v-else-if="formitem.isMultiple == 1 && formitem.drvingList[0].insDrivingIntentionInsurances"
+                          filterable v-model="formitem.parentId" placeholder="请选择" clearable :size="overSize"
+                          style="width: 250px;"
+                          @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
+                          <el-option :label="item.projectName" :value="item.id"
+                            v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
+                        </el-select>
+                        <el-select
+                          v-else-if="formitem.isMultiple == 0 && !formitem.drvingList[0].insDrivingIntentionInsurances"
+                          filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable :size="overSize"
+                          style="width: 250px;"
+                          @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
+                          <el-option :label="item.projectName" :value="item.id"
+                            v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
+                        </el-select>
+                        <el-select
+                          v-else-if="formitem.isMultiple == 0 && formitem.drvingList[0].insDrivingIntentionInsurances"
+                          filterable v-model="formitem.parentId" placeholder="请选择" clearable :size="overSize"
+                          style="width: 250px;"
+                          @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
+                          <el-option :label="item.projectName" :value="item.id"
+                            v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
+                        </el-select>
+                        <template v-if="formitem.drvingChildren">
+                          <el-select v-if="formitem.isMultiple == 1" multiple filterable
+                            v-model="formitem.drivingIntentionIds" placeholder="请选择" clearable :size="overSize"
                             style="width: 250px;"
-                            @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
+                            @change="event => drivingChildrenChange(event, solutionindex, configureindex, formindex)">
                             <el-option :label="item.projectName" :value="item.id"
-                              v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
+                              v-for="(item, index) in formitem.drvingChildren" :key="index"></el-option>
                           </el-select>
-                          <el-select
-                            v-else-if="formitem.isMultiple == 0 && formitem.drvingList[0].insDrivingIntentionInsurances"
-                            filterable v-model="formitem.parentId" placeholder="请选择" clearable :size="overSize"
-                            style="width: 250px;"
-                            @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
+                          <el-select v-else filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable
+                            :size="overSize" style="width: 250px;"
+                            @change="event => drivingChildrenChange(event, solutionindex, configureindex, formindex)">
                             <el-option :label="item.projectName" :value="item.id"
-                              v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
+                              v-for="(item, index) in formitem.drvingChildren" :key="index"></el-option>
                           </el-select>
-                          <template v-if="formitem.drvingChildren">
-                            <el-select v-if="formitem.isMultiple == 1" multiple filterable
-                              v-model="formitem.drivingIntentionIds" placeholder="请选择" clearable :size="overSize"
-                              style="width: 250px;"
-                              @change="event => drivingChildrenChange(event, solutionindex, configureindex, formindex)">
-                              <el-option :label="item.projectName" :value="item.id"
-                                v-for="(item, index) in formitem.drvingChildren" :key="index"></el-option>
-                            </el-select>
-                            <el-select v-else filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable
-                              :size="overSize" style="width: 250px;"
-                              @change="event => drivingChildrenChange(event, solutionindex, configureindex, formindex)">
-                              <el-option :label="item.projectName" :value="item.id"
-                                v-for="(item, index) in formitem.drvingChildren" :key="index"></el-option>
-                            </el-select>
-                          </template>
-                        </el-form-item>
-                      </el-col>
-                      <el-col :span="4">
-                        <el-form-item label="别名:">
-                          <el-input v-model="formitem.alias" placeholder="驾意险别名"></el-input>
-                        </el-form-item>
-                      </el-col>
-                      <el-col :span="5">
-                        <el-form-item label="座位数:">
-                          <el-input-number v-model="formitem.seatNum" controls-position="right" :min="1"
-                            :max="10"></el-input-number>
-                          <span>座</span>
-                        </el-form-item>
-                      </el-col>
-                      <el-col :span="5">
-                        <el-form-item label="份数:">
-                          <el-input-number v-model="formitem.quantity" controls-position="right" :min="1"
-                            :max="10"></el-input-number>
-                          <span>份</span>
-                        </el-form-item>
-                      </el-col>
+                        </template>
+                      </el-form-item>
                     </el-col>
-                    <el-col :span="20">
-                      <div v-for="(LiabilityTermsitem, LiabilityTermsindex) in formitem.LiabilityTerms"
-                        :key="LiabilityTermsindex">
-                        <div style="font-weight: bold;margin-bottom: 10px;">{{ LiabilityTermsitem.projectName }}</div>
-                        <el-table :data="LiabilityTermsitem.LiabilityTerms" size="mini" :header-cell-style="{
-                          background: '#F7F7F9',
-                          fontWeight: '700',
-                          color: '#606266',
-                        }">
-                          <el-table-column prop="name" label="保险责任" align="center">
-                          </el-table-column>
-                          <el-table-column prop="amount" label="保险金额" width="180" align="center">
-                          </el-table-column>
-                          <el-table-column prop="premium" label="保费(元)" width="180" align="center">
-                          </el-table-column>
-                        </el-table>
-                      </div>
+                    <el-col :span="4">
+                      <el-form-item label="别名:">
+                        <el-input v-model="formitem.alias" placeholder="驾意险别名"></el-input>
+                      </el-form-item>
                     </el-col>
-                  </el-row>
-                </el-form>
-              </div>
+                    <el-col :span="5">
+                      <el-form-item label="座位数:">
+                        <el-input-number v-model="formitem.seatNum" controls-position="right" :min="1"
+                          :max="10"></el-input-number>
+                        <span>座</span>
+                      </el-form-item>
+                    </el-col>
+                    <el-col :span="5">
+                      <el-form-item label="份数:">
+                        <el-input-number v-model="formitem.quantity" controls-position="right" :min="1"
+                          :max="10"></el-input-number>
+                        <span>份</span>
+                      </el-form-item>
+                    </el-col>
+                  </el-col>
+                  <el-col :span="20">
+                    <div v-for="(LiabilityTermsitem, LiabilityTermsindex) in formitem.LiabilityTerms"
+                      :key="LiabilityTermsindex">
+                      <div style="font-weight: bold;margin-bottom: 10px;">{{ LiabilityTermsitem.projectName }}</div>
+                      <el-table :data="LiabilityTermsitem.LiabilityTerms" size="mini" :header-cell-style="{
+                        background: '#F7F7F9',
+                        fontWeight: '700',
+                        color: '#606266',
+                      }">
+                        <el-table-column prop="name" label="保险责任" align="center">
+                        </el-table-column>
+                        <el-table-column prop="amount" label="保险金额" width="180" align="center">
+                        </el-table-column>
+                        <el-table-column prop="premium" label="保费(元)" width="180" align="center">
+                        </el-table-column>
+                      </el-table>
+                    </div>
+                  </el-col>
+                </el-row>
+              </el-form>
             </div>
           </div>
         </div>
       </div>
-      <span slot="footer" class="dialog-footer">
-        <el-button :size="overSize" style="background: #EAEDF1;color: #2D4D89;" @click="ordinaryPlanCancel">取
-          消</el-button>
-        <el-button :size="overSize" style="background: #2D4D89;color: #fff;border-color: #2D4D89;" type="primary"
-          @click="solutionSubmit('solutionForm')">确 定</el-button>
-      </span>
+    </div>
+    <span slot="footer" class="dialog-footer">
+      <el-button :size="overSize" style="background: #EAEDF1;color: #2D4D89;" @click="ordinaryPlanCancel">取
+        消</el-button>
+      <el-button :size="overSize" style="background: #2D4D89;color: #fff;border-color: #2D4D89;" type="primary"
+        @click="solutionSubmit('solutionForm')">确 定</el-button>
+    </span>
   </div>
 </template>
 <!-- 行为区域 -->
@@ -250,6 +256,15 @@ export default {
         { prop: "companyId", label: "保险公司编码", minWidth: 160, },
         { prop: "productName", label: "方案险种", minWidth: 180, },
       ],
+      solutionrules: {
+        schemeName: [
+          { required: true, message: '方案名称必填', trigger: 'blur' }
+        ],
+        priorityLevel: [
+          { required: true, message: '序号必填', trigger: 'blur' },
+          { validator: this.validatePriority, trigger: 'blur' },
+        ],
+      },
       solutionResult: [],
       //操作符字典
       pageRequest: {
@@ -264,6 +279,7 @@ export default {
         productList: [
           {
             schemeName: "",
+            priorityLevel: "",//方案序号
             description: "",
             kinds: [],
             drvingIntentions: [
@@ -301,6 +317,15 @@ export default {
   },
   // 方法函数
   methods: {
+    validatePriority(rule, value, callback) {
+      if (!value) {
+        callback(new Error('请输入序号'));
+      } else if (!/^[1-9][0-9]?$/.test(value)) {
+        callback(new Error('请输入 1-99 的整数'));
+      } else {
+        callback();
+      }
+    },
     // drivingChange(event, solutionindex, configureindex, formindex) {
     //   if (event) {
     //     if (event instanceof Array) {
@@ -493,6 +518,7 @@ export default {
       })
       this.solutionData.productList.push({
         schemeName: "",
+        priorityLevel: "",//方案序号
         description: "",
         kinds: this.solutionData.productName !== '单交' ? list : [],
         drvingIntentions: [
@@ -532,12 +558,26 @@ export default {
         seatNum: ""//座位数
       });
     },
-    ordinaryPlanCancel () {
+    ordinaryPlanCancel() {
       this.$emit('ordinaryPlanCancel')
     },
-    solutionSubmit(formName) {
-      if (this.solutionDialogType == 'add') {
-        this.$api.insCompany.shcemeAdd({...this.solutionData,carnature:"01",vehicleType:"A0",energyType:"1"}).then((res) => {
+    solutionSubmit() {
+      const promises = this.solutionData.productList.map((_, index) => {
+      const formName = `solutionForm${index}`;
+      return new Promise((resolve, reject) => {
+        this.$refs[formName][0].validate((valid) => {
+          if (valid) {
+            resolve();
+          } else {
+            reject(`方案 ${index + 1} 校验失败!`);
+          }
+        });
+      });
+    });
+    Promise.all(promises)
+      .then(() => {
+        if (this.solutionDialogType == 'add') {
+        this.$api.insCompany.shcemeAdd({ ...this.solutionData, carnature: "01", vehicleType: "A0", energyType: "1" }).then((res) => {
           if (res.code == '200') {
             this.$message({
               type: 'success',
@@ -553,7 +593,7 @@ export default {
           }
         });
       } else {
-        this.$api.insCompany.schemeUpdate({...this.solutionData,carnature:"01",vehicleType:"A0",energyType:"1"}).then((res) => {
+        this.$api.insCompany.schemeUpdate({ ...this.solutionData, carnature: "01", vehicleType: "A0", energyType: "1" }).then((res) => {
           if (res.code == '200') {
             this.$message({
               type: 'success',
@@ -569,6 +609,11 @@ export default {
           }
         });
       }
+      })
+      .catch((error) => {
+        console.log(error);
+      });
+
     },
     getDicType(type) {
       this.$api.insCompany.dicType(type).then((res) => {
@@ -582,7 +627,7 @@ export default {
       this.solutionDialogTitle = '添加方案'
     },
     solutionFindPage() {
-      this.$api.insCompany.schemeList({ ...this.pageRequest, companyId: this.companyId,carnature:"01",vehicleType:"A0",energyType:"1" }).then((res) => {
+      this.$api.insCompany.schemeList({ ...this.pageRequest, companyId: this.companyId, carnature: "01", vehicleType: "A0", energyType: "1" }).then((res) => {
         if (res.code == '200') {
           let pageList = {
             content: res.data.records,
@@ -603,7 +648,7 @@ export default {
     solutionUpdate({ row, column }) {
       this.solutionDialogType = 'edit';
       this.solutionDialogTitle = '编辑方案'
-      this.$api.insCompany.schemedetails(row.companyId, row.productId,"01",'A0','1').then((res) => {
+      this.$api.insCompany.schemedetails(row.companyId, row.productId, "01", 'A0', '1').then((res) => {
         if (res.code == '200') {
           res.data.productList.map(valA => {
             valA.kinds.map(valB => {
@@ -616,7 +661,7 @@ export default {
               data.list.map(val => {
                 if (val.parentId != '0') {
                   let obj = val.drvingList.find(item => item.id == val.parentId)
-                    val.drvingChildren = obj.insDrivingIntentionInsurances;
+                  val.drvingChildren = obj.insDrivingIntentionInsurances;
                 }
               })
               const listCodes = data.list.map(item => item.code); // 获取当前 data 的所有 code
@@ -675,6 +720,7 @@ export default {
   align-items: flex-end;
   justify-content: flex-end;
 }
+
 /deep/ {
   .el-radio__input.is-checked .el-radio__inner,
   .el-checkbox__input.is-checked .el-checkbox__inner,
@@ -805,4 +851,3 @@ export default {
   background: #F2F2F2;
 }
 </style>
-

+ 90 - 47
src/views/AgreementManage/InsuranceCompany/PassengerBus/BusinessOperation/NewEnergy/OrdinaryPlan.vue

@@ -7,8 +7,8 @@
     <!-- @findPage="solutionFindPage" -->
     <kt-common-table :tableHeights="700" :SerialShow="false" :operationWidth="200" :showOperation="true"
       :showBatchDelete="false" :showBatchSettled="false" :showBatchPrint="false" :data="solutionResult" button2Name="编辑"
-      button2Type="text" @findPage="solutionFindPage" @handleButton2="solutionUpdate" button3Name="删除" button3Type="text" @handleButton3="solutionDel"
-      :columns="solutionColumns">
+      button2Type="text" @findPage="solutionFindPage" @handleButton2="solutionUpdate" button3Name="删除"
+      button3Type="text" @handleButton3="solutionDel" :columns="solutionColumns">
     </kt-common-table>
     <el-dialog v-dialogDrag :title="solutionDialogTitle" :visible.sync="solutionVisible" width="90%" top="2vh"
       @close="solutioncloseDialog">
@@ -30,16 +30,22 @@
           <div v-for="(solutionitem, solutionindex) in solutionData.productList" :key="solutionindex">
             <div class="flex j-s a-c " style="margin-top: 20px;font-size: 16px;color: #262626;">
               <span>方案{{ solutionindex + 1 }}</span>
-              <el-button v-if="solutionindex > 0" type="primary" size="small" icon="el-icon-delete" class="planOption-del"
-                @click="planOptiondel(solutionindex)">方案删除</el-button>
+              <el-button v-if="solutionindex > 0" type="primary" size="small" icon="el-icon-delete"
+                class="planOption-del" @click="planOptiondel(solutionindex)">方案删除</el-button>
             </div>
-            <el-form ref="solutionForm" :model="solutionitem" label-width="120px" :size="overSize">
+            <el-form :ref="`solutionForm${solutionindex}`" :rules="solutionrules" :model="solutionitem"
+              label-width="120px" :size="overSize">
               <el-row>
                 <el-col :span="8">
-                  <el-form-item label="方案名称">
+                  <el-form-item label="方案名称" prop="schemeName">
                     <el-input type="text" v-model="solutionitem.schemeName" placeholder="输入方案名称"></el-input>
                   </el-form-item>
                 </el-col>
+                <el-col :span="4">
+                  <el-form-item label="序号" prop="priorityLevel">
+                    <el-input type="text" v-model="solutionitem.priorityLevel" clearable :maxlength="2"></el-input>
+                  </el-form-item>
+                </el-col>
                 <el-col :span="20">
                   <el-form-item label="方案描述">
                     <el-input type="textarea" v-model="solutionitem.description" placeholder="输入方案描述" maxlength="100"
@@ -123,7 +129,7 @@
                     :key="DriverTypeitem.id">
                     <span style="margin-right: 10px;color: #262626;font-size: 14px;font-weight: bold;">{{
                       DriverTypeitem.typeName
-                    }}</span>
+                      }}</span>
                     <el-checkbox v-model="childrenitem.checked" v-for="childrenitem in DriverTypeitem.children"
                       :key="childrenitem.id"
                       @change="event => drvingcheckboxChange(event, childrenitem, solutionindex, configureindex)">{{
@@ -158,8 +164,8 @@
                           </el-select>
                           <el-select
                             v-else-if="formitem.isMultiple == 0 && !formitem.drvingList[0].insDrivingIntentionInsurances"
-                            filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable :size="overSize"
-                            style="width: 250px;"
+                            filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable
+                            :size="overSize" style="width: 250px;"
                             @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
                             <el-option :label="item.projectName" :value="item.id"
                               v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
@@ -180,8 +186,8 @@
                               <el-option :label="item.projectName" :value="item.id"
                                 v-for="(item, index) in formitem.drvingChildren" :key="index"></el-option>
                             </el-select>
-                            <el-select v-else filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable
-                              :size="overSize" style="width: 250px;"
+                            <el-select v-else filterable v-model="formitem.drivingIntentionId" placeholder="请选择"
+                              clearable :size="overSize" style="width: 250px;"
                               @change="event => drivingChildrenChange(event, solutionindex, configureindex, formindex)">
                               <el-option :label="item.projectName" :value="item.id"
                                 v-for="(item, index) in formitem.drvingChildren" :key="index"></el-option>
@@ -275,6 +281,15 @@ export default {
         { prop: "companyId", label: "保险公司编码", minWidth: 160, },
         { prop: "productName", label: "方案险种", minWidth: 180, },
       ],
+      solutionrules: {
+        schemeName: [
+          { required: true, message: '方案名称必填', trigger: 'blur' }
+        ],
+        priorityLevel: [
+          { required: true, message: '序号必填', trigger: 'blur' },
+          { validator: this.validatePriority, trigger: 'blur' },
+        ],
+      },
       solutionResult: [],
       //操作符字典
       pageRequest: {
@@ -289,6 +304,7 @@ export default {
         productList: [
           {
             schemeName: "",
+            priorityLevel: "",
             description: "",
             kinds: [],
             drvingIntentions: [
@@ -308,12 +324,12 @@ export default {
     }
   },
   watch: {
-    activeIndex (newVal) {
+    activeIndex(newVal) {
       if (newVal === 0) {
         this.initData()
       }
     },
-    ordinaryIndex (newVal) {
+    ordinaryIndex(newVal) {
       if (newVal) {
         this.initData()
       }
@@ -321,13 +337,13 @@ export default {
   },
   // 生命周期函数
   created() {
-    if (this.$route.query.type*1 === 0) {
+    if (this.$route.query.type * 1 === 0) {
       this.initData()
     }
   },
   // 方法函数
   methods: {
-    initData () {
+    initData() {
       this.companyId = this.$route.query.companyId;
       this.solutionData.companyId = this.$route.query.companyId;
       this.getDicType("productsType"); //车险产品
@@ -344,6 +360,15 @@ export default {
       });
       localStorage.setItem("insureList", JSON.stringify(this.insureList));
     },
+    validatePriority(rule, value, callback) {
+      if (!value) {
+        callback(new Error('请输入序号'));
+      } else if (!/^[1-9][0-9]?$/.test(value)) {
+        callback(new Error('请输入 1-99 的整数'));
+      } else {
+        callback();
+      }
+    },
     // drivingChange(event, solutionindex, configureindex, formindex) {
     //   if (event) {
     //     if (event instanceof Array) {
@@ -536,6 +561,7 @@ export default {
       })
       this.solutionData.productList.push({
         schemeName: "",
+        priorityLevel: "",
         description: "",
         kinds: this.solutionData.productName !== '单交' ? list : [],
         drvingIntentions: [
@@ -575,40 +601,58 @@ export default {
         seatNum: ""//座位数
       });
     },
-    solutionSubmit(formName) {
-      if (this.solutionDialogType == 'add') {
-        this.$api.insCompany.shcemeAdd({...this.solutionData,carnature:"01",vehicleType:"A0",energyType:"1"}).then((res) => {
-          if (res.code == '200') {
-            this.$message({
-              type: 'success',
-              message: res.msg,
-            });
-            this.solutionVisible = false;
-            this.solutionFindPage();
-          } else {
-            this.$message({
-              type: 'error',
-              message: res.msg,
-            });
-          }
+    solutionSubmit() {
+      const promises = this.solutionData.productList.map((_, index) => {
+        const formName = `solutionForm${index}`;
+        return new Promise((resolve, reject) => {
+          this.$refs[formName][0].validate((valid) => {
+            if (valid) {
+              resolve();
+            } else {
+              reject(`方案 ${index + 1} 校验失败!`);
+            }
+          });
         });
-      } else {
-        this.$api.insCompany.schemeUpdate({...this.solutionData,carnature:"01",vehicleType:"A0",energyType:"1"}).then((res) => {
-          if (res.code == '200') {
-            this.$message({
-              type: 'success',
-              message: res.msg,
+      });
+      Promise.all(promises)
+        .then(() => {
+          if (this.solutionDialogType == 'add') {
+            this.$api.insCompany.shcemeAdd({ ...this.solutionData, carnature: "01", vehicleType: "A0", energyType: "1" }).then((res) => {
+              if (res.code == '200') {
+                this.$message({
+                  type: 'success',
+                  message: res.msg,
+                });
+                this.solutionVisible = false;
+                this.solutionFindPage();
+              } else {
+                this.$message({
+                  type: 'error',
+                  message: res.msg,
+                });
+              }
             });
-            this.solutionVisible = false;
-            this.solutionFindPage();
           } else {
-            this.$message({
-              type: 'error',
-              message: res.msg,
+            this.$api.insCompany.schemeUpdate({ ...this.solutionData, carnature: "01", vehicleType: "A0", energyType: "1" }).then((res) => {
+              if (res.code == '200') {
+                this.$message({
+                  type: 'success',
+                  message: res.msg,
+                });
+                this.solutionVisible = false;
+                this.solutionFindPage();
+              } else {
+                this.$message({
+                  type: 'error',
+                  message: res.msg,
+                });
+              }
             });
           }
+        })
+        .catch((error) => {
+          console.log(error);
         });
-      }
     },
     getDicType(type) {
       this.$api.insCompany.dicType(type).then((res) => {
@@ -623,7 +667,7 @@ export default {
       this.solutionVisible = true;
     },
     solutionFindPage() {
-      this.$api.insCompany.schemeList({ ...this.pageRequest, companyId: this.companyId,carnature:"01",vehicleType:"A0",energyType:"1" }).then((res) => {
+      this.$api.insCompany.schemeList({ ...this.pageRequest, companyId: this.companyId, carnature: "01", vehicleType: "A0", energyType: "1" }).then((res) => {
         if (res.code == '200') {
           let pageList = {
             content: res.data.records,
@@ -644,7 +688,7 @@ export default {
     solutionUpdate({ row, column }) {
       this.solutionDialogType = 'edit';
       this.solutionDialogTitle = '编辑方案'
-      this.$api.insCompany.schemedetails(row.companyId, row.productId,"01",'A0','1').then((res) => {
+      this.$api.insCompany.schemedetails(row.companyId, row.productId, "01", 'A0', '1').then((res) => {
         if (res.code == '200') {
           res.data.productList.map(valA => {
             valA.kinds.map(valB => {
@@ -657,7 +701,7 @@ export default {
               data.list.map(val => {
                 if (val.parentId != '0') {
                   let obj = val.drvingList.find(item => item.id == val.parentId)
-                    val.drvingChildren = obj.insDrivingIntentionInsurances;
+                  val.drvingChildren = obj.insDrivingIntentionInsurances;
                 }
               })
               const listCodes = data.list.map(item => item.code); // 获取当前 data 的所有 code
@@ -839,4 +883,3 @@ export default {
   background: #F2F2F2;
 }
 </style>
-

+ 286 - 241
src/views/AgreementManage/InsuranceCompany/PassengerBus/NonBusiness/Fuel/AddOrdinaryPlan.vue

@@ -1,234 +1,240 @@
 <!-- 模板区域 -->
 <template>
   <div>
-      <div class="tab-panestyle">
-        <div class="tab-panecent">
-          <span>险种配置</span>
-          <el-radio-group :disabled="this.solutionDialogType == 'edit'" v-model="solutionData.productId"
-            @input="productInput" size="small" style="margin-left: 30px;">
-            <el-radio-button v-for="(productsitem, productsindex) in productsTypeoptions" :key="productsindex"
-              :label="productsitem.dictValue">{{
-                productsitem.dictTag }}</el-radio-button>
-          </el-radio-group>
+    <div class="tab-panestyle">
+      <div class="tab-panecent">
+        <span>险种配置</span>
+        <el-radio-group :disabled="this.solutionDialogType == 'edit'" v-model="solutionData.productId"
+          @input="productInput" size="small" style="margin-left: 30px;">
+          <el-radio-button v-for="(productsitem, productsindex) in productsTypeoptions" :key="productsindex"
+            :label="productsitem.dictValue">{{
+              productsitem.dictTag }}</el-radio-button>
+        </el-radio-group>
+      </div>
+      <div class="tab-panecent">
+        <div class=" flex j-s a-c">
+          <el-button type="primary" size="small" icon="el-icon-plus" class="planOption-btn"
+            @click="planOptionadd">方案新增</el-button>
         </div>
-        <div class="tab-panecent">
-          <div class=" flex j-s a-c">
-            <el-button type="primary" size="small" icon="el-icon-plus" class="planOption-btn"
-              @click="planOptionadd">方案新增</el-button>
+        <div v-for="(solutionitem, solutionindex) in solutionData.productList" :key="solutionindex">
+          <div class="flex j-s a-c " style="margin-top: 20px;font-size: 16px;color: #262626;">
+            <span>方案{{ solutionindex + 1 }}</span>
+            <el-button v-if="solutionindex > 0" type="primary" size="small" icon="el-icon-delete" class="planOption-del"
+              @click="planOptiondel(solutionindex)">方案删除</el-button>
           </div>
-          <div v-for="(solutionitem, solutionindex) in solutionData.productList" :key="solutionindex">
-            <div class="flex j-s a-c " style="margin-top: 20px;font-size: 16px;color: #262626;">
-              <span>方案{{ solutionindex + 1 }}</span>
-              <el-button v-if="solutionindex > 0" type="primary" size="small" icon="el-icon-delete" class="planOption-del"
-                @click="planOptiondel(solutionindex)">方案删除</el-button>
+          <el-form :ref="`solutionForm${solutionindex}`" :rules="solutionrules" :model="solutionitem"
+            label-width="120px" :size="overSize">
+            <el-row>
+              <el-col :span="8">
+                <el-form-item label="方案名称" prop="schemeName">
+                  <el-input type="text" v-model="solutionitem.schemeName" placeholder="输入方案名称"></el-input>
+                </el-form-item>
+              </el-col>
+              <el-col :span="4">
+                <el-form-item label="序号" prop="priorityLevel">
+                  <el-input type="text" v-model="solutionitem.priorityLevel" clearable :maxlength="2"></el-input>
+                </el-form-item>
+              </el-col>
+              <el-col :span="20">
+                <el-form-item label="方案描述">
+                  <el-input type="textarea" v-model="solutionitem.description" placeholder="输入方案描述" maxlength="100"
+                    show-word-limit></el-input>
+                </el-form-item>
+              </el-col>
+            </el-row>
+          </el-form>
+          <div v-if="['单商', '单三', '交三', '交商'].includes(solutionData.productName)">
+            <div class="flex j-s a-c">
+              <h4>商业险方案配置</h4>
             </div>
-            <el-form ref="solutionForm" :model="solutionitem" label-width="120px" :size="overSize">
-              <el-row>
-                <el-col :span="8">
-                  <el-form-item label="方案名称">
-                    <el-input type="text" v-model="solutionitem.schemeName" placeholder="输入方案名称"></el-input>
-                  </el-form-item>
-                </el-col>
-                <el-col :span="20">
-                  <el-form-item label="方案描述">
-                    <el-input type="textarea" v-model="solutionitem.description" placeholder="输入方案描述" maxlength="100"
-                      show-word-limit></el-input>
-                  </el-form-item>
-                </el-col>
-              </el-row>
-            </el-form>
-            <div v-if="['单商', '单三', '交三', '交商'].includes(solutionData.productName)">
-              <div class="flex j-s a-c">
-                <h4>商业险方案配置</h4>
-              </div>
-              <div class="flex j-start ">
-                <div class="Risk f-c" style="margin-right: 30px;">
-                  <section class="flex j-s a-c ">
-                    <div>
-                      全部险别
-                    </div>
-                    <div>
-                      投保保额
-                    </div>
-                  </section>
-                  <main class="flex j-s a-c" v-for="(insureitem, insureindex) in solutionitem.kinds" :key="insureindex">
-                    <div>
-                      <el-checkbox v-model="insureitem.switch" style="margin-right: 10px;" disabled></el-checkbox>
-                      <span>{{ insureitem.kindName }}</span>
-                    </div>
-                    <div>
-                      <el-select v-if="insureitem.amtList.length > 0" filterable v-model="insureitem.amount"
-                        placeholder="请选择"
-                        @change="(value) => amtListChange(value, insureitem.amtList, insureindex, solutionindex)"
-                        style="width: 200px;" clearable :size="overSize">
-                        <el-option v-for="(item, index) in insureitem.amtList" :key="index" :label="item.label"
-                          :value="item.value"></el-option>
-                      </el-select>
-                      <span v-else>
-                        <el-input-number @change="(value) => inputNumberChange(value, insureindex, solutionindex)"
-                          size="small" style="width:200px; margin-right: 10px;" v-model="insureitem.amount"
-                          :min="0"></el-input-number>次
-                      </span>
-                    </div>
-                  </main>
-                </div>
-                <div class="Risk">
-                  <section class="flex j-s a-c ">
-                    <span class="flex j-start">已选险别</span>
-                    <span class="flex j-c">投保保额</span>
-                    <span class="flex j-end">操作</span>
-                  </section>
-                  <main class="flex j-s a-c" v-for="(filteredInsureitem, filteredInsureindex) in solutionitem.kinds"
-                    :key="filteredInsureindex" v-if="filteredInsureitem.switch">
-                    <span class="flex j-start">{{ filteredInsureitem.kindName }}</span>
-                    <span class="flex j-c" v-if="['A'].includes(filteredInsureitem.kindCode)">{{
-                      filteredInsureitem.amountDesc }}</span>
-                    <span class="flex j-c"
-                      v-else-if="['MJ1', 'MJ2', 'MJ3', 'MJ4'].includes(filteredInsureitem.kindCode)">{{
-                        filteredInsureitem.amount }}%</span>
-                    <span class="flex j-c"
-                      v-else-if="['TY1', 'TY2', 'TY3', 'TY4'].includes(filteredInsureitem.kindCode)">{{
-                        filteredInsureitem.amount }}次</span>
-                    <span class="flex j-c" v-else>{{ convertedValue(filteredInsureitem.amount) }}</span>
-                    <span class="flex j-end">
-                      <i class="el-icon-delete" style="font-size: 20px;"
-                        @click="InsureDel(solutionindex, filteredInsureitem.kindCode)"></i>
+            <div class="flex j-start ">
+              <div class="Risk f-c" style="margin-right: 30px;">
+                <section class="flex j-s a-c ">
+                  <div>
+                    全部险别
+                  </div>
+                  <div>
+                    投保保额
+                  </div>
+                </section>
+                <main class="flex j-s a-c" v-for="(insureitem, insureindex) in solutionitem.kinds" :key="insureindex">
+                  <div>
+                    <el-checkbox v-model="insureitem.switch" style="margin-right: 10px;" disabled></el-checkbox>
+                    <span>{{ insureitem.kindName }}</span>
+                  </div>
+                  <div>
+                    <el-select v-if="insureitem.amtList.length > 0" filterable v-model="insureitem.amount"
+                      placeholder="请选择"
+                      @change="(value) => amtListChange(value, insureitem.amtList, insureindex, solutionindex)"
+                      style="width: 200px;" clearable :size="overSize">
+                      <el-option v-for="(item, index) in insureitem.amtList" :key="index" :label="item.label"
+                        :value="item.value"></el-option>
+                    </el-select>
+                    <span v-else>
+                      <el-input-number @change="(value) => inputNumberChange(value, insureindex, solutionindex)"
+                        size="small" style="width:200px; margin-right: 10px;" v-model="insureitem.amount"
+                        :min="0"></el-input-number>次
                     </span>
-                  </main>
-                </div>
-              </div>
-            </div>
-            <div>
-              <div class="flex a-c">
-                <h4>驾意险方案配置</h4>
-                <el-button size="mini"
-                  style="margin-left: 15px;background: #EAEDF1;border: 1px solid #D9D9D9;color: #2D4D89;"
-                  @click="AddDriverInsurancePlan(solutionindex)">添加配置</el-button>
-              </div>
-              <div v-for="(configureitem, configureindex) in solutionitem.drvingIntentions" :key="configureindex"
-                style="margin-bottom: 20px;">
-                <div class="flex j-s a-c">
-                  <div class="flex a-c " style="margin-bottom: 15px;" v-for="DriverTypeitem in configureitem.driverType"
-                    :key="DriverTypeitem.id">
-                    <span style="margin-right: 10px;color: #262626;font-size: 14px;font-weight: bold;">{{
-                      DriverTypeitem.typeName
-                    }}</span>
-                    <el-checkbox v-model="childrenitem.checked" v-for="childrenitem in DriverTypeitem.children"
-                      :key="childrenitem.id"
-                      @change="event => drvingcheckboxChange(event, childrenitem, solutionindex, configureindex)">{{
-                        childrenitem.typeName }}</el-checkbox>
                   </div>
+                </main>
+              </div>
+              <div class="Risk">
+                <section class="flex j-s a-c ">
+                  <span class="flex j-start">已选险别</span>
+                  <span class="flex j-c">投保保额</span>
+                  <span class="flex j-end">操作</span>
+                </section>
+                <main class="flex j-s a-c" v-for="(filteredInsureitem, filteredInsureindex) in solutionitem.kinds"
+                  :key="filteredInsureindex" v-if="filteredInsureitem.switch">
+                  <span class="flex j-start">{{ filteredInsureitem.kindName }}</span>
+                  <span class="flex j-c" v-if="['A'].includes(filteredInsureitem.kindCode)">{{
+                    filteredInsureitem.amountDesc }}</span>
+                  <span class="flex j-c"
+                    v-else-if="['MJ1', 'MJ2', 'MJ3', 'MJ4'].includes(filteredInsureitem.kindCode)">{{
+                      filteredInsureitem.amount }}%</span>
+                  <span class="flex j-c"
+                    v-else-if="['TY1', 'TY2', 'TY3', 'TY4'].includes(filteredInsureitem.kindCode)">{{
+                      filteredInsureitem.amount }}次</span>
+                  <span class="flex j-c" v-else>{{ convertedValue(filteredInsureitem.amount) }}</span>
                   <span class="flex j-end">
                     <i class="el-icon-delete" style="font-size: 20px;"
-                      @click="drvingDel(solutionindex, configureindex)"></i>
+                      @click="InsureDel(solutionindex, filteredInsureitem.kindCode)"></i>
                   </span>
+                </main>
+              </div>
+            </div>
+          </div>
+          <div>
+            <div class="flex a-c">
+              <h4>驾意险方案配置</h4>
+              <el-button size="mini"
+                style="margin-left: 15px;background: #EAEDF1;border: 1px solid #D9D9D9;color: #2D4D89;"
+                @click="AddDriverInsurancePlan(solutionindex)">添加配置</el-button>
+            </div>
+            <div v-for="(configureitem, configureindex) in solutionitem.drvingIntentions" :key="configureindex"
+              style="margin-bottom: 20px;">
+              <div class="flex j-s a-c">
+                <div class="flex a-c " style="margin-bottom: 15px;" v-for="DriverTypeitem in configureitem.driverType"
+                  :key="DriverTypeitem.id">
+                  <span style="margin-right: 10px;color: #262626;font-size: 14px;font-weight: bold;">{{
+                    DriverTypeitem.typeName
+                  }}</span>
+                  <el-checkbox v-model="childrenitem.checked" v-for="childrenitem in DriverTypeitem.children"
+                    :key="childrenitem.id"
+                    @change="event => drvingcheckboxChange(event, childrenitem, solutionindex, configureindex)">{{
+                      childrenitem.typeName }}</el-checkbox>
                 </div>
-                <el-form ref="form" :model="formitem" label-width="120px" size="small"
-                  v-for="(formitem, formindex) in configureitem.list" :key="formindex">
-                  <el-row>
-                    <el-col :span="24">
-                      <el-col :span="10">
-                        <el-form-item label="驾意选择:">
-                          <el-select
-                            v-if="formitem.isMultiple == 1 && !formitem.drvingList[0].insDrivingIntentionInsurances"
-                            filterable multiple v-model="formitem.drivingIntentionIds" placeholder="请选择" clearable
-                            :size="overSize" style="width: 250px;"
-                            @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
-                            <el-option :label="item.projectName" :value="item.id"
-                              v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
-                          </el-select>
-                          <el-select
-                            v-else-if="formitem.isMultiple == 1 && formitem.drvingList[0].insDrivingIntentionInsurances"
-                            filterable v-model="formitem.parentId" placeholder="请选择" clearable :size="overSize"
-                            style="width: 250px;"
-                            @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
-                            <el-option :label="item.projectName" :value="item.id"
-                              v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
-                          </el-select>
-                          <el-select
-                            v-else-if="formitem.isMultiple == 0 && !formitem.drvingList[0].insDrivingIntentionInsurances"
-                            filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable :size="overSize"
+                <span class="flex j-end">
+                  <i class="el-icon-delete" style="font-size: 20px;"
+                    @click="drvingDel(solutionindex, configureindex)"></i>
+                </span>
+              </div>
+              <el-form ref="form" :model="formitem" label-width="120px" size="small"
+                v-for="(formitem, formindex) in configureitem.list" :key="formindex">
+                <el-row>
+                  <el-col :span="24">
+                    <el-col :span="10">
+                      <el-form-item label="驾意选择:">
+                        <el-select
+                          v-if="formitem.isMultiple == 1 && !formitem.drvingList[0].insDrivingIntentionInsurances"
+                          filterable multiple v-model="formitem.drivingIntentionIds" placeholder="请选择" clearable
+                          :size="overSize" style="width: 250px;"
+                          @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
+                          <el-option :label="item.projectName" :value="item.id"
+                            v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
+                        </el-select>
+                        <el-select
+                          v-else-if="formitem.isMultiple == 1 && formitem.drvingList[0].insDrivingIntentionInsurances"
+                          filterable v-model="formitem.parentId" placeholder="请选择" clearable :size="overSize"
+                          style="width: 250px;"
+                          @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
+                          <el-option :label="item.projectName" :value="item.id"
+                            v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
+                        </el-select>
+                        <el-select
+                          v-else-if="formitem.isMultiple == 0 && !formitem.drvingList[0].insDrivingIntentionInsurances"
+                          filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable :size="overSize"
+                          style="width: 250px;"
+                          @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
+                          <el-option :label="item.projectName" :value="item.id"
+                            v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
+                        </el-select>
+                        <el-select
+                          v-else-if="formitem.isMultiple == 0 && formitem.drvingList[0].insDrivingIntentionInsurances"
+                          filterable v-model="formitem.parentId" placeholder="请选择" clearable :size="overSize"
+                          style="width: 250px;"
+                          @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
+                          <el-option :label="item.projectName" :value="item.id"
+                            v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
+                        </el-select>
+                        <template v-if="formitem.drvingChildren">
+                          <el-select v-if="formitem.isMultiple == 1" multiple filterable
+                            v-model="formitem.drivingIntentionIds" placeholder="请选择" clearable :size="overSize"
                             style="width: 250px;"
-                            @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
+                            @change="event => drivingChildrenChange(event, solutionindex, configureindex, formindex)">
                             <el-option :label="item.projectName" :value="item.id"
-                              v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
+                              v-for="(item, index) in formitem.drvingChildren" :key="index"></el-option>
                           </el-select>
-                          <el-select
-                            v-else-if="formitem.isMultiple == 0 && formitem.drvingList[0].insDrivingIntentionInsurances"
-                            filterable v-model="formitem.parentId" placeholder="请选择" clearable :size="overSize"
-                            style="width: 250px;"
-                            @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
+                          <el-select v-else filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable
+                            :size="overSize" style="width: 250px;"
+                            @change="event => drivingChildrenChange(event, solutionindex, configureindex, formindex)">
                             <el-option :label="item.projectName" :value="item.id"
-                              v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
+                              v-for="(item, index) in formitem.drvingChildren" :key="index"></el-option>
                           </el-select>
-                          <template v-if="formitem.drvingChildren">
-                            <el-select v-if="formitem.isMultiple == 1" multiple filterable
-                              v-model="formitem.drivingIntentionIds" placeholder="请选择" clearable :size="overSize"
-                              style="width: 250px;"
-                              @change="event => drivingChildrenChange(event, solutionindex, configureindex, formindex)">
-                              <el-option :label="item.projectName" :value="item.id"
-                                v-for="(item, index) in formitem.drvingChildren" :key="index"></el-option>
-                            </el-select>
-                            <el-select v-else filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable
-                              :size="overSize" style="width: 250px;"
-                              @change="event => drivingChildrenChange(event, solutionindex, configureindex, formindex)">
-                              <el-option :label="item.projectName" :value="item.id"
-                                v-for="(item, index) in formitem.drvingChildren" :key="index"></el-option>
-                            </el-select>
-                          </template>
-                        </el-form-item>
-                      </el-col>
-                      <el-col :span="4">
-                        <el-form-item label="别名:">
-                          <el-input v-model="formitem.alias" placeholder="驾意险别名"></el-input>
-                        </el-form-item>
-                      </el-col>
-                      <el-col :span="5">
-                        <el-form-item label="座位数:">
-                          <el-input-number v-model="formitem.seatNum" controls-position="right" :min="1"
-                            :max="10"></el-input-number>
-                          <span>座</span>
-                        </el-form-item>
-                      </el-col>
-                      <el-col :span="5">
-                        <el-form-item label="份数:">
-                          <el-input-number v-model="formitem.quantity" controls-position="right" :min="1"
-                            :max="10"></el-input-number>
-                          <span>份</span>
-                        </el-form-item>
-                      </el-col>
+                        </template>
+                      </el-form-item>
                     </el-col>
-                    <el-col :span="20">
-                      <div v-for="(LiabilityTermsitem, LiabilityTermsindex) in formitem.LiabilityTerms"
-                        :key="LiabilityTermsindex">
-                        <div style="font-weight: bold;margin-bottom: 10px;">{{ LiabilityTermsitem.projectName }}</div>
-                        <el-table :data="LiabilityTermsitem.LiabilityTerms" size="mini" :header-cell-style="{
-                          background: '#F7F7F9',
-                          fontWeight: '700',
-                          color: '#606266',
-                        }">
-                          <el-table-column prop="name" label="保险责任" align="center">
-                          </el-table-column>
-                          <el-table-column prop="amount" label="保险金额" width="180" align="center">
-                          </el-table-column>
-                          <el-table-column prop="premium" label="保费(元)" width="180" align="center">
-                          </el-table-column>
-                        </el-table>
-                      </div>
+                    <el-col :span="4">
+                      <el-form-item label="别名:">
+                        <el-input v-model="formitem.alias" placeholder="驾意险别名"></el-input>
+                      </el-form-item>
                     </el-col>
-                  </el-row>
-                </el-form>
-              </div>
+                    <el-col :span="5">
+                      <el-form-item label="座位数:">
+                        <el-input-number v-model="formitem.seatNum" controls-position="right" :min="1"
+                          :max="10"></el-input-number>
+                        <span>座</span>
+                      </el-form-item>
+                    </el-col>
+                    <el-col :span="5">
+                      <el-form-item label="份数:">
+                        <el-input-number v-model="formitem.quantity" controls-position="right" :min="1"
+                          :max="10"></el-input-number>
+                        <span>份</span>
+                      </el-form-item>
+                    </el-col>
+                  </el-col>
+                  <el-col :span="20">
+                    <div v-for="(LiabilityTermsitem, LiabilityTermsindex) in formitem.LiabilityTerms"
+                      :key="LiabilityTermsindex">
+                      <div style="font-weight: bold;margin-bottom: 10px;">{{ LiabilityTermsitem.projectName }}</div>
+                      <el-table :data="LiabilityTermsitem.LiabilityTerms" size="mini" :header-cell-style="{
+                        background: '#F7F7F9',
+                        fontWeight: '700',
+                        color: '#606266',
+                      }">
+                        <el-table-column prop="name" label="保险责任" align="center">
+                        </el-table-column>
+                        <el-table-column prop="amount" label="保险金额" width="180" align="center">
+                        </el-table-column>
+                        <el-table-column prop="premium" label="保费(元)" width="180" align="center">
+                        </el-table-column>
+                      </el-table>
+                    </div>
+                  </el-col>
+                </el-row>
+              </el-form>
             </div>
           </div>
         </div>
       </div>
-      <span slot="footer" class="dialog-footer">
-        <el-button :size="overSize" style="background: #EAEDF1;color: #2D4D89;" @click="ordinaryPlanCancel">取
-          消</el-button>
-        <el-button :size="overSize" style="background: #2D4D89;color: #fff;border-color: #2D4D89;" type="primary"
-          @click="solutionSubmit('solutionForm')">确 定</el-button>
-      </span>
+    </div>
+    <span slot="footer" class="dialog-footer">
+      <el-button :size="overSize" style="background: #EAEDF1;color: #2D4D89;" @click="ordinaryPlanCancel">取
+        消</el-button>
+      <el-button :size="overSize" style="background: #2D4D89;color: #fff;border-color: #2D4D89;" type="primary"
+        @click="solutionSubmit('solutionForm')">确 定</el-button>
+    </span>
   </div>
 </template>
 <!-- 行为区域 -->
@@ -250,6 +256,15 @@ export default {
         { prop: "companyId", label: "保险公司编码", minWidth: 160, },
         { prop: "productName", label: "方案险种", minWidth: 180, },
       ],
+      solutionrules: {
+        schemeName: [
+          { required: true, message: '方案名称必填', trigger: 'blur' }
+        ],
+        priorityLevel: [
+          { required: true, message: '序号必填', trigger: 'blur' },
+          { validator: this.validatePriority, trigger: 'blur' },
+        ],
+      },
       solutionResult: [],
       //操作符字典
       pageRequest: {
@@ -264,6 +279,7 @@ export default {
         productList: [
           {
             schemeName: "",
+            priorityLevel: "",//方案序号
             description: "",
             kinds: [],
             drvingIntentions: [
@@ -301,6 +317,15 @@ export default {
   },
   // 方法函数
   methods: {
+    validatePriority(rule, value, callback) {
+      if (!value) {
+        callback(new Error('请输入序号'));
+      } else if (!/^[1-9][0-9]?$/.test(value)) {
+        callback(new Error('请输入 1-99 的整数'));
+      } else {
+        callback();
+      }
+    },
     // drivingChange(event, solutionindex, configureindex, formindex) {
     //   if (event) {
     //     if (event instanceof Array) {
@@ -493,6 +518,7 @@ export default {
       })
       this.solutionData.productList.push({
         schemeName: "",
+        priorityLevel: "",//方案序号
         description: "",
         kinds: this.solutionData.productName !== '单交' ? list : [],
         drvingIntentions: [
@@ -532,43 +558,62 @@ export default {
         seatNum: ""//座位数
       });
     },
-    ordinaryPlanCancel () {
+    ordinaryPlanCancel() {
       this.$emit('ordinaryPlanCancel')
     },
-    solutionSubmit(formName) {
-      if (this.solutionDialogType == 'add') {
-        this.$api.insCompany.shcemeAdd({...this.solutionData,carnature:"02",vehicleType:"A0",energyType:"0"}).then((res) => {
-          if (res.code == '200') {
-            this.$message({
-              type: 'success',
-              message: res.msg,
-            });
-            this.solutionFindPage();
-            this.$emit('ordinaryPlanSubmit')
-          } else {
-            this.$message({
-              type: 'error',
-              message: res.msg,
-            });
-          }
+    solutionSubmit() {
+      const promises = this.solutionData.productList.map((_, index) => {
+        const formName = `solutionForm${index}`;
+        return new Promise((resolve, reject) => {
+          this.$refs[formName][0].validate((valid) => {
+            if (valid) {
+              resolve();
+            } else {
+              reject(`方案 ${index + 1} 校验失败!`);
+            }
+          });
         });
-      } else {
-        this.$api.insCompany.schemeUpdate({...this.solutionData,carnature:"02",vehicleType:"A0",energyType:"0"}).then((res) => {
-          if (res.code == '200') {
-            this.$message({
-              type: 'success',
-              message: res.msg,
+      });
+      Promise.all(promises)
+        .then(() => {
+          if (this.solutionDialogType == 'add') {
+            this.$api.insCompany.shcemeAdd({ ...this.solutionData, carnature: "02", vehicleType: "A0", energyType: "0" }).then((res) => {
+              if (res.code == '200') {
+                this.$message({
+                  type: 'success',
+                  message: res.msg,
+                });
+                this.solutionFindPage();
+                this.$emit('ordinaryPlanSubmit')
+              } else {
+                this.$message({
+                  type: 'error',
+                  message: res.msg,
+                });
+              }
             });
-            this.solutionFindPage();
-            this.$emit('ordinaryPlanSubmit')
           } else {
-            this.$message({
-              type: 'error',
-              message: res.msg,
+            this.$api.insCompany.schemeUpdate({ ...this.solutionData, carnature: "02", vehicleType: "A0", energyType: "0" }).then((res) => {
+              if (res.code == '200') {
+                this.$message({
+                  type: 'success',
+                  message: res.msg,
+                });
+                this.solutionFindPage();
+                this.$emit('ordinaryPlanSubmit')
+              } else {
+                this.$message({
+                  type: 'error',
+                  message: res.msg,
+                });
+              }
             });
           }
+        })
+        .catch((error) => {
+          console.log(error);
         });
-      }
+
     },
     getDicType(type) {
       this.$api.insCompany.dicType(type).then((res) => {
@@ -582,7 +627,7 @@ export default {
       this.solutionDialogTitle = '添加方案'
     },
     solutionFindPage() {
-      this.$api.insCompany.schemeList({ ...this.pageRequest, companyId: this.companyId,carnature:"02",vehicleType:"A0",energyType:"0" }).then((res) => {
+      this.$api.insCompany.schemeList({ ...this.pageRequest, companyId: this.companyId, carnature: "02", vehicleType: "A0", energyType: "0" }).then((res) => {
         if (res.code == '200') {
           let pageList = {
             content: res.data.records,
@@ -603,7 +648,7 @@ export default {
     solutionUpdate({ row, column }) {
       this.solutionDialogType = 'edit';
       this.solutionDialogTitle = '编辑方案'
-      this.$api.insCompany.schemedetails(row.companyId, row.productId,"02",'A0','0').then((res) => {
+      this.$api.insCompany.schemedetails(row.companyId, row.productId, "02", 'A0', '0').then((res) => {
         if (res.code == '200') {
           res.data.productList.map(valA => {
             valA.kinds.map(valB => {
@@ -616,7 +661,7 @@ export default {
               data.list.map(val => {
                 if (val.parentId != '0') {
                   let obj = val.drvingList.find(item => item.id == val.parentId)
-                    val.drvingChildren = obj.insDrivingIntentionInsurances;
+                  val.drvingChildren = obj.insDrivingIntentionInsurances;
                 }
               })
               const listCodes = data.list.map(item => item.code); // 获取当前 data 的所有 code
@@ -675,6 +720,7 @@ export default {
   align-items: flex-end;
   justify-content: flex-end;
 }
+
 /deep/ {
   .el-radio__input.is-checked .el-radio__inner,
   .el-checkbox__input.is-checked .el-checkbox__inner,
@@ -805,4 +851,3 @@ export default {
   background: #F2F2F2;
 }
 </style>
-

+ 90 - 47
src/views/AgreementManage/InsuranceCompany/PassengerBus/NonBusiness/Fuel/OrdinaryPlan.vue

@@ -7,8 +7,8 @@
     <!-- @findPage="solutionFindPage" -->
     <kt-common-table :tableHeights="700" :SerialShow="false" :operationWidth="200" :showOperation="true"
       :showBatchDelete="false" :showBatchSettled="false" :showBatchPrint="false" :data="solutionResult" button2Name="编辑"
-      button2Type="text" @findPage="solutionFindPage" @handleButton2="solutionUpdate" button3Name="删除" button3Type="text" @handleButton3="solutionDel"
-      :columns="solutionColumns">
+      button2Type="text" @findPage="solutionFindPage" @handleButton2="solutionUpdate" button3Name="删除"
+      button3Type="text" @handleButton3="solutionDel" :columns="solutionColumns">
     </kt-common-table>
     <el-dialog v-dialogDrag :title="solutionDialogTitle" :visible.sync="solutionVisible" width="90%" top="2vh"
       @close="solutioncloseDialog">
@@ -30,16 +30,22 @@
           <div v-for="(solutionitem, solutionindex) in solutionData.productList" :key="solutionindex">
             <div class="flex j-s a-c " style="margin-top: 20px;font-size: 16px;color: #262626;">
               <span>方案{{ solutionindex + 1 }}</span>
-              <el-button v-if="solutionindex > 0" type="primary" size="small" icon="el-icon-delete" class="planOption-del"
-                @click="planOptiondel(solutionindex)">方案删除</el-button>
+              <el-button v-if="solutionindex > 0" type="primary" size="small" icon="el-icon-delete"
+                class="planOption-del" @click="planOptiondel(solutionindex)">方案删除</el-button>
             </div>
-            <el-form ref="solutionForm" :model="solutionitem" label-width="120px" :size="overSize">
+            <el-form :ref="`solutionForm${solutionindex}`" :rules="solutionrules" :model="solutionitem"
+              label-width="120px" :size="overSize">
               <el-row>
                 <el-col :span="8">
-                  <el-form-item label="方案名称">
+                  <el-form-item label="方案名称" prop="schemeName">
                     <el-input type="text" v-model="solutionitem.schemeName" placeholder="输入方案名称"></el-input>
                   </el-form-item>
                 </el-col>
+                <el-col :span="4">
+                  <el-form-item label="序号" prop="priorityLevel">
+                    <el-input type="text" v-model="solutionitem.priorityLevel" clearable :maxlength="2"></el-input>
+                  </el-form-item>
+                </el-col>
                 <el-col :span="20">
                   <el-form-item label="方案描述">
                     <el-input type="textarea" v-model="solutionitem.description" placeholder="输入方案描述" maxlength="100"
@@ -123,7 +129,7 @@
                     :key="DriverTypeitem.id">
                     <span style="margin-right: 10px;color: #262626;font-size: 14px;font-weight: bold;">{{
                       DriverTypeitem.typeName
-                    }}</span>
+                      }}</span>
                     <el-checkbox v-model="childrenitem.checked" v-for="childrenitem in DriverTypeitem.children"
                       :key="childrenitem.id"
                       @change="event => drvingcheckboxChange(event, childrenitem, solutionindex, configureindex)">{{
@@ -158,8 +164,8 @@
                           </el-select>
                           <el-select
                             v-else-if="formitem.isMultiple == 0 && !formitem.drvingList[0].insDrivingIntentionInsurances"
-                            filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable :size="overSize"
-                            style="width: 250px;"
+                            filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable
+                            :size="overSize" style="width: 250px;"
                             @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
                             <el-option :label="item.projectName" :value="item.id"
                               v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
@@ -180,8 +186,8 @@
                               <el-option :label="item.projectName" :value="item.id"
                                 v-for="(item, index) in formitem.drvingChildren" :key="index"></el-option>
                             </el-select>
-                            <el-select v-else filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable
-                              :size="overSize" style="width: 250px;"
+                            <el-select v-else filterable v-model="formitem.drivingIntentionId" placeholder="请选择"
+                              clearable :size="overSize" style="width: 250px;"
                               @change="event => drivingChildrenChange(event, solutionindex, configureindex, formindex)">
                               <el-option :label="item.projectName" :value="item.id"
                                 v-for="(item, index) in formitem.drvingChildren" :key="index"></el-option>
@@ -275,6 +281,15 @@ export default {
         { prop: "companyId", label: "保险公司编码", minWidth: 160, },
         { prop: "productName", label: "方案险种", minWidth: 180, },
       ],
+      solutionrules: {
+        schemeName: [
+          { required: true, message: '方案名称必填', trigger: 'blur' }
+        ],
+        priorityLevel: [
+          { required: true, message: '序号必填', trigger: 'blur' },
+          { validator: this.validatePriority, trigger: 'blur' },
+        ],
+      },
       solutionResult: [],
       //操作符字典
       pageRequest: {
@@ -289,6 +304,7 @@ export default {
         productList: [
           {
             schemeName: "",
+            priorityLevel: "",
             description: "",
             kinds: [],
             drvingIntentions: [
@@ -308,12 +324,12 @@ export default {
     }
   },
   watch: {
-    activeIndex (newVal) {
+    activeIndex(newVal) {
       if (newVal === 0) {
         this.initData()
       }
     },
-    ordinaryIndex (newVal) {
+    ordinaryIndex(newVal) {
       if (newVal) {
         this.initData()
       }
@@ -321,13 +337,13 @@ export default {
   },
   // 生命周期函数
   created() {
-    if (this.$route.query.type*1 === 0) {
+    if (this.$route.query.type * 1 === 0) {
       this.initData()
     }
   },
   // 方法函数
   methods: {
-    initData () {
+    initData() {
       this.companyId = this.$route.query.companyId;
       this.solutionData.companyId = this.$route.query.companyId;
       this.getDicType("productsType"); //车险产品
@@ -344,6 +360,15 @@ export default {
       });
       localStorage.setItem("insureList", JSON.stringify(this.insureList));
     },
+    validatePriority(rule, value, callback) {
+      if (!value) {
+        callback(new Error('请输入序号'));
+      } else if (!/^[1-9][0-9]?$/.test(value)) {
+        callback(new Error('请输入 1-99 的整数'));
+      } else {
+        callback();
+      }
+    },
     // drivingChange(event, solutionindex, configureindex, formindex) {
     //   if (event) {
     //     if (event instanceof Array) {
@@ -538,6 +563,7 @@ export default {
       })
       this.solutionData.productList.push({
         schemeName: "",
+        priorityLevel: "",
         description: "",
         kinds: this.solutionData.productName !== '单交' ? list : [],
         drvingIntentions: [
@@ -577,40 +603,58 @@ export default {
         seatNum: ""//座位数
       });
     },
-    solutionSubmit(formName) {
-      if (this.solutionDialogType == 'add') {
-        this.$api.insCompany.shcemeAdd({...this.solutionData,carnature:"02",vehicleType:"A0",energyType:"0"}).then((res) => {
-          if (res.code == '200') {
-            this.$message({
-              type: 'success',
-              message: res.msg,
-            });
-            this.solutionVisible = false;
-            this.solutionFindPage();
-          } else {
-            this.$message({
-              type: 'error',
-              message: res.msg,
-            });
-          }
+    solutionSubmit() {
+      const promises = this.solutionData.productList.map((_, index) => {
+        const formName = `solutionForm${index}`;
+        return new Promise((resolve, reject) => {
+          this.$refs[formName][0].validate((valid) => {
+            if (valid) {
+              resolve();
+            } else {
+              reject(`方案 ${index + 1} 校验失败!`);
+            }
+          });
         });
-      } else {
-        this.$api.insCompany.schemeUpdate({...this.solutionData,carnature:"02",vehicleType:"A0",energyType:"0"}).then((res) => {
-          if (res.code == '200') {
-            this.$message({
-              type: 'success',
-              message: res.msg,
+      });
+      Promise.all(promises)
+        .then(() => {
+          if (this.solutionDialogType == 'add') {
+            this.$api.insCompany.shcemeAdd({ ...this.solutionData, carnature: "02", vehicleType: "A0", energyType: "0" }).then((res) => {
+              if (res.code == '200') {
+                this.$message({
+                  type: 'success',
+                  message: res.msg,
+                });
+                this.solutionVisible = false;
+                this.solutionFindPage();
+              } else {
+                this.$message({
+                  type: 'error',
+                  message: res.msg,
+                });
+              }
             });
-            this.solutionVisible = false;
-            this.solutionFindPage();
           } else {
-            this.$message({
-              type: 'error',
-              message: res.msg,
+            this.$api.insCompany.schemeUpdate({ ...this.solutionData, carnature: "02", vehicleType: "A0", energyType: "0" }).then((res) => {
+              if (res.code == '200') {
+                this.$message({
+                  type: 'success',
+                  message: res.msg,
+                });
+                this.solutionVisible = false;
+                this.solutionFindPage();
+              } else {
+                this.$message({
+                  type: 'error',
+                  message: res.msg,
+                });
+              }
             });
           }
+        })
+        .catch((error) => {
+          console.log(error);
         });
-      }
     },
     getDicType(type) {
       this.$api.insCompany.dicType(type).then((res) => {
@@ -625,7 +669,7 @@ export default {
       this.solutionVisible = true;
     },
     solutionFindPage() {
-      this.$api.insCompany.schemeList({ ...this.pageRequest, companyId: this.companyId,carnature:"02",vehicleType:"A0",energyType:"0" }).then((res) => {
+      this.$api.insCompany.schemeList({ ...this.pageRequest, companyId: this.companyId, carnature: "02", vehicleType: "A0", energyType: "0" }).then((res) => {
         if (res.code == '200') {
           let pageList = {
             content: res.data.records,
@@ -646,7 +690,7 @@ export default {
     solutionUpdate({ row, column }) {
       this.solutionDialogType = 'edit';
       this.solutionDialogTitle = '编辑方案'
-      this.$api.insCompany.schemedetails(row.companyId, row.productId,"02",'A0','0').then((res) => {
+      this.$api.insCompany.schemedetails(row.companyId, row.productId, "02", 'A0', '0').then((res) => {
         if (res.code == '200') {
           res.data.productList.map(valA => {
             valA.kinds.map(valB => {
@@ -659,7 +703,7 @@ export default {
               data.list.map(val => {
                 if (val.parentId != '0') {
                   let obj = val.drvingList.find(item => item.id == val.parentId)
-                    val.drvingChildren = obj.insDrivingIntentionInsurances;
+                  val.drvingChildren = obj.insDrivingIntentionInsurances;
                 }
               })
               const listCodes = data.list.map(item => item.code); // 获取当前 data 的所有 code
@@ -841,4 +885,3 @@ export default {
   background: #F2F2F2;
 }
 </style>
-

+ 286 - 241
src/views/AgreementManage/InsuranceCompany/PassengerBus/NonBusiness/NewEnergy/AddOrdinaryPlan.vue

@@ -1,234 +1,240 @@
 <!-- 模板区域 -->
 <template>
   <div>
-      <div class="tab-panestyle">
-        <div class="tab-panecent">
-          <span>险种配置</span>
-          <el-radio-group :disabled="this.solutionDialogType == 'edit'" v-model="solutionData.productId"
-            @input="productInput" size="small" style="margin-left: 30px;">
-            <el-radio-button v-for="(productsitem, productsindex) in productsTypeoptions" :key="productsindex"
-              :label="productsitem.dictValue">{{
-                productsitem.dictTag }}</el-radio-button>
-          </el-radio-group>
+    <div class="tab-panestyle">
+      <div class="tab-panecent">
+        <span>险种配置</span>
+        <el-radio-group :disabled="this.solutionDialogType == 'edit'" v-model="solutionData.productId"
+          @input="productInput" size="small" style="margin-left: 30px;">
+          <el-radio-button v-for="(productsitem, productsindex) in productsTypeoptions" :key="productsindex"
+            :label="productsitem.dictValue">{{
+              productsitem.dictTag }}</el-radio-button>
+        </el-radio-group>
+      </div>
+      <div class="tab-panecent">
+        <div class=" flex j-s a-c">
+          <el-button type="primary" size="small" icon="el-icon-plus" class="planOption-btn"
+            @click="planOptionadd">方案新增</el-button>
         </div>
-        <div class="tab-panecent">
-          <div class=" flex j-s a-c">
-            <el-button type="primary" size="small" icon="el-icon-plus" class="planOption-btn"
-              @click="planOptionadd">方案新增</el-button>
+        <div v-for="(solutionitem, solutionindex) in solutionData.productList" :key="solutionindex">
+          <div class="flex j-s a-c " style="margin-top: 20px;font-size: 16px;color: #262626;">
+            <span>方案{{ solutionindex + 1 }}</span>
+            <el-button v-if="solutionindex > 0" type="primary" size="small" icon="el-icon-delete" class="planOption-del"
+              @click="planOptiondel(solutionindex)">方案删除</el-button>
           </div>
-          <div v-for="(solutionitem, solutionindex) in solutionData.productList" :key="solutionindex">
-            <div class="flex j-s a-c " style="margin-top: 20px;font-size: 16px;color: #262626;">
-              <span>方案{{ solutionindex + 1 }}</span>
-              <el-button v-if="solutionindex > 0" type="primary" size="small" icon="el-icon-delete" class="planOption-del"
-                @click="planOptiondel(solutionindex)">方案删除</el-button>
+          <el-form :ref="`solutionForm${solutionindex}`" :rules="solutionrules" :model="solutionitem"
+            label-width="120px" :size="overSize">
+            <el-row>
+              <el-col :span="8">
+                <el-form-item label="方案名称" prop="schemeName">
+                  <el-input type="text" v-model="solutionitem.schemeName" placeholder="输入方案名称"></el-input>
+                </el-form-item>
+              </el-col>
+              <el-col :span="4">
+                <el-form-item label="序号" prop="priorityLevel">
+                  <el-input type="text" v-model="solutionitem.priorityLevel" clearable :maxlength="2"></el-input>
+                </el-form-item>
+              </el-col>
+              <el-col :span="20">
+                <el-form-item label="方案描述">
+                  <el-input type="textarea" v-model="solutionitem.description" placeholder="输入方案描述" maxlength="100"
+                    show-word-limit></el-input>
+                </el-form-item>
+              </el-col>
+            </el-row>
+          </el-form>
+          <div v-if="['单商', '单三', '交三', '交商'].includes(solutionData.productName)">
+            <div class="flex j-s a-c">
+              <h4>商业险方案配置</h4>
             </div>
-            <el-form ref="solutionForm" :model="solutionitem" label-width="120px" :size="overSize">
-              <el-row>
-                <el-col :span="8">
-                  <el-form-item label="方案名称">
-                    <el-input type="text" v-model="solutionitem.schemeName" placeholder="输入方案名称"></el-input>
-                  </el-form-item>
-                </el-col>
-                <el-col :span="20">
-                  <el-form-item label="方案描述">
-                    <el-input type="textarea" v-model="solutionitem.description" placeholder="输入方案描述" maxlength="100"
-                      show-word-limit></el-input>
-                  </el-form-item>
-                </el-col>
-              </el-row>
-            </el-form>
-            <div v-if="['单商', '单三', '交三', '交商'].includes(solutionData.productName)">
-              <div class="flex j-s a-c">
-                <h4>商业险方案配置</h4>
-              </div>
-              <div class="flex j-start ">
-                <div class="Risk f-c" style="margin-right: 30px;">
-                  <section class="flex j-s a-c ">
-                    <div>
-                      全部险别
-                    </div>
-                    <div>
-                      投保保额
-                    </div>
-                  </section>
-                  <main class="flex j-s a-c" v-for="(insureitem, insureindex) in solutionitem.kinds" :key="insureindex">
-                    <div>
-                      <el-checkbox v-model="insureitem.switch" style="margin-right: 10px;" disabled></el-checkbox>
-                      <span>{{ insureitem.kindName }}</span>
-                    </div>
-                    <div>
-                      <el-select v-if="insureitem.amtList.length > 0" filterable v-model="insureitem.amount"
-                        placeholder="请选择"
-                        @change="(value) => amtListChange(value, insureitem.amtList, insureindex, solutionindex)"
-                        style="width: 200px;" clearable :size="overSize">
-                        <el-option v-for="(item, index) in insureitem.amtList" :key="index" :label="item.label"
-                          :value="item.value"></el-option>
-                      </el-select>
-                      <span v-else>
-                        <el-input-number @change="(value) => inputNumberChange(value, insureindex, solutionindex)"
-                          size="small" style="width:200px; margin-right: 10px;" v-model="insureitem.amount"
-                          :min="0"></el-input-number>次
-                      </span>
-                    </div>
-                  </main>
-                </div>
-                <div class="Risk">
-                  <section class="flex j-s a-c ">
-                    <span class="flex j-start">已选险别</span>
-                    <span class="flex j-c">投保保额</span>
-                    <span class="flex j-end">操作</span>
-                  </section>
-                  <main class="flex j-s a-c" v-for="(filteredInsureitem, filteredInsureindex) in solutionitem.kinds"
-                    :key="filteredInsureindex" v-if="filteredInsureitem.switch">
-                    <span class="flex j-start">{{ filteredInsureitem.kindName }}</span>
-                    <span class="flex j-c" v-if="['A'].includes(filteredInsureitem.kindCode)">{{
-                      filteredInsureitem.amountDesc }}</span>
-                    <span class="flex j-c"
-                      v-else-if="['MJ1', 'MJ2', 'MJ3', 'MJ4'].includes(filteredInsureitem.kindCode)">{{
-                        filteredInsureitem.amount }}%</span>
-                    <span class="flex j-c"
-                      v-else-if="['TY1', 'TY2', 'TY3', 'TY4'].includes(filteredInsureitem.kindCode)">{{
-                        filteredInsureitem.amount }}次</span>
-                    <span class="flex j-c" v-else>{{ convertedValue(filteredInsureitem.amount) }}</span>
-                    <span class="flex j-end">
-                      <i class="el-icon-delete" style="font-size: 20px;"
-                        @click="InsureDel(solutionindex, filteredInsureitem.kindCode)"></i>
+            <div class="flex j-start ">
+              <div class="Risk f-c" style="margin-right: 30px;">
+                <section class="flex j-s a-c ">
+                  <div>
+                    全部险别
+                  </div>
+                  <div>
+                    投保保额
+                  </div>
+                </section>
+                <main class="flex j-s a-c" v-for="(insureitem, insureindex) in solutionitem.kinds" :key="insureindex">
+                  <div>
+                    <el-checkbox v-model="insureitem.switch" style="margin-right: 10px;" disabled></el-checkbox>
+                    <span>{{ insureitem.kindName }}</span>
+                  </div>
+                  <div>
+                    <el-select v-if="insureitem.amtList.length > 0" filterable v-model="insureitem.amount"
+                      placeholder="请选择"
+                      @change="(value) => amtListChange(value, insureitem.amtList, insureindex, solutionindex)"
+                      style="width: 200px;" clearable :size="overSize">
+                      <el-option v-for="(item, index) in insureitem.amtList" :key="index" :label="item.label"
+                        :value="item.value"></el-option>
+                    </el-select>
+                    <span v-else>
+                      <el-input-number @change="(value) => inputNumberChange(value, insureindex, solutionindex)"
+                        size="small" style="width:200px; margin-right: 10px;" v-model="insureitem.amount"
+                        :min="0"></el-input-number>次
                     </span>
-                  </main>
-                </div>
-              </div>
-            </div>
-            <div>
-              <div class="flex a-c">
-                <h4>驾意险方案配置</h4>
-                <el-button size="mini"
-                  style="margin-left: 15px;background: #EAEDF1;border: 1px solid #D9D9D9;color: #2D4D89;"
-                  @click="AddDriverInsurancePlan(solutionindex)">添加配置</el-button>
-              </div>
-              <div v-for="(configureitem, configureindex) in solutionitem.drvingIntentions" :key="configureindex"
-                style="margin-bottom: 20px;">
-                <div class="flex j-s a-c">
-                  <div class="flex a-c " style="margin-bottom: 15px;" v-for="DriverTypeitem in configureitem.driverType"
-                    :key="DriverTypeitem.id">
-                    <span style="margin-right: 10px;color: #262626;font-size: 14px;font-weight: bold;">{{
-                      DriverTypeitem.typeName
-                    }}</span>
-                    <el-checkbox v-model="childrenitem.checked" v-for="childrenitem in DriverTypeitem.children"
-                      :key="childrenitem.id"
-                      @change="event => drvingcheckboxChange(event, childrenitem, solutionindex, configureindex)">{{
-                        childrenitem.typeName }}</el-checkbox>
                   </div>
+                </main>
+              </div>
+              <div class="Risk">
+                <section class="flex j-s a-c ">
+                  <span class="flex j-start">已选险别</span>
+                  <span class="flex j-c">投保保额</span>
+                  <span class="flex j-end">操作</span>
+                </section>
+                <main class="flex j-s a-c" v-for="(filteredInsureitem, filteredInsureindex) in solutionitem.kinds"
+                  :key="filteredInsureindex" v-if="filteredInsureitem.switch">
+                  <span class="flex j-start">{{ filteredInsureitem.kindName }}</span>
+                  <span class="flex j-c" v-if="['A'].includes(filteredInsureitem.kindCode)">{{
+                    filteredInsureitem.amountDesc }}</span>
+                  <span class="flex j-c"
+                    v-else-if="['MJ1', 'MJ2', 'MJ3', 'MJ4'].includes(filteredInsureitem.kindCode)">{{
+                      filteredInsureitem.amount }}%</span>
+                  <span class="flex j-c"
+                    v-else-if="['TY1', 'TY2', 'TY3', 'TY4'].includes(filteredInsureitem.kindCode)">{{
+                      filteredInsureitem.amount }}次</span>
+                  <span class="flex j-c" v-else>{{ convertedValue(filteredInsureitem.amount) }}</span>
                   <span class="flex j-end">
                     <i class="el-icon-delete" style="font-size: 20px;"
-                      @click="drvingDel(solutionindex, configureindex)"></i>
+                      @click="InsureDel(solutionindex, filteredInsureitem.kindCode)"></i>
                   </span>
+                </main>
+              </div>
+            </div>
+          </div>
+          <div>
+            <div class="flex a-c">
+              <h4>驾意险方案配置</h4>
+              <el-button size="mini"
+                style="margin-left: 15px;background: #EAEDF1;border: 1px solid #D9D9D9;color: #2D4D89;"
+                @click="AddDriverInsurancePlan(solutionindex)">添加配置</el-button>
+            </div>
+            <div v-for="(configureitem, configureindex) in solutionitem.drvingIntentions" :key="configureindex"
+              style="margin-bottom: 20px;">
+              <div class="flex j-s a-c">
+                <div class="flex a-c " style="margin-bottom: 15px;" v-for="DriverTypeitem in configureitem.driverType"
+                  :key="DriverTypeitem.id">
+                  <span style="margin-right: 10px;color: #262626;font-size: 14px;font-weight: bold;">{{
+                    DriverTypeitem.typeName
+                  }}</span>
+                  <el-checkbox v-model="childrenitem.checked" v-for="childrenitem in DriverTypeitem.children"
+                    :key="childrenitem.id"
+                    @change="event => drvingcheckboxChange(event, childrenitem, solutionindex, configureindex)">{{
+                      childrenitem.typeName }}</el-checkbox>
                 </div>
-                <el-form ref="form" :model="formitem" label-width="120px" size="small"
-                  v-for="(formitem, formindex) in configureitem.list" :key="formindex">
-                  <el-row>
-                    <el-col :span="24">
-                      <el-col :span="10">
-                        <el-form-item label="驾意选择:">
-                          <el-select
-                            v-if="formitem.isMultiple == 1 && !formitem.drvingList[0].insDrivingIntentionInsurances"
-                            filterable multiple v-model="formitem.drivingIntentionIds" placeholder="请选择" clearable
-                            :size="overSize" style="width: 250px;"
-                            @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
-                            <el-option :label="item.projectName" :value="item.id"
-                              v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
-                          </el-select>
-                          <el-select
-                            v-else-if="formitem.isMultiple == 1 && formitem.drvingList[0].insDrivingIntentionInsurances"
-                            filterable v-model="formitem.parentId" placeholder="请选择" clearable :size="overSize"
-                            style="width: 250px;"
-                            @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
-                            <el-option :label="item.projectName" :value="item.id"
-                              v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
-                          </el-select>
-                          <el-select
-                            v-else-if="formitem.isMultiple == 0 && !formitem.drvingList[0].insDrivingIntentionInsurances"
-                            filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable :size="overSize"
+                <span class="flex j-end">
+                  <i class="el-icon-delete" style="font-size: 20px;"
+                    @click="drvingDel(solutionindex, configureindex)"></i>
+                </span>
+              </div>
+              <el-form ref="form" :model="formitem" label-width="120px" size="small"
+                v-for="(formitem, formindex) in configureitem.list" :key="formindex">
+                <el-row>
+                  <el-col :span="24">
+                    <el-col :span="10">
+                      <el-form-item label="驾意选择:">
+                        <el-select
+                          v-if="formitem.isMultiple == 1 && !formitem.drvingList[0].insDrivingIntentionInsurances"
+                          filterable multiple v-model="formitem.drivingIntentionIds" placeholder="请选择" clearable
+                          :size="overSize" style="width: 250px;"
+                          @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
+                          <el-option :label="item.projectName" :value="item.id"
+                            v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
+                        </el-select>
+                        <el-select
+                          v-else-if="formitem.isMultiple == 1 && formitem.drvingList[0].insDrivingIntentionInsurances"
+                          filterable v-model="formitem.parentId" placeholder="请选择" clearable :size="overSize"
+                          style="width: 250px;"
+                          @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
+                          <el-option :label="item.projectName" :value="item.id"
+                            v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
+                        </el-select>
+                        <el-select
+                          v-else-if="formitem.isMultiple == 0 && !formitem.drvingList[0].insDrivingIntentionInsurances"
+                          filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable :size="overSize"
+                          style="width: 250px;"
+                          @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
+                          <el-option :label="item.projectName" :value="item.id"
+                            v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
+                        </el-select>
+                        <el-select
+                          v-else-if="formitem.isMultiple == 0 && formitem.drvingList[0].insDrivingIntentionInsurances"
+                          filterable v-model="formitem.parentId" placeholder="请选择" clearable :size="overSize"
+                          style="width: 250px;"
+                          @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
+                          <el-option :label="item.projectName" :value="item.id"
+                            v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
+                        </el-select>
+                        <template v-if="formitem.drvingChildren">
+                          <el-select v-if="formitem.isMultiple == 1" multiple filterable
+                            v-model="formitem.drivingIntentionIds" placeholder="请选择" clearable :size="overSize"
                             style="width: 250px;"
-                            @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
+                            @change="event => drivingChildrenChange(event, solutionindex, configureindex, formindex)">
                             <el-option :label="item.projectName" :value="item.id"
-                              v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
+                              v-for="(item, index) in formitem.drvingChildren" :key="index"></el-option>
                           </el-select>
-                          <el-select
-                            v-else-if="formitem.isMultiple == 0 && formitem.drvingList[0].insDrivingIntentionInsurances"
-                            filterable v-model="formitem.parentId" placeholder="请选择" clearable :size="overSize"
-                            style="width: 250px;"
-                            @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
+                          <el-select v-else filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable
+                            :size="overSize" style="width: 250px;"
+                            @change="event => drivingChildrenChange(event, solutionindex, configureindex, formindex)">
                             <el-option :label="item.projectName" :value="item.id"
-                              v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
+                              v-for="(item, index) in formitem.drvingChildren" :key="index"></el-option>
                           </el-select>
-                          <template v-if="formitem.drvingChildren">
-                            <el-select v-if="formitem.isMultiple == 1" multiple filterable
-                              v-model="formitem.drivingIntentionIds" placeholder="请选择" clearable :size="overSize"
-                              style="width: 250px;"
-                              @change="event => drivingChildrenChange(event, solutionindex, configureindex, formindex)">
-                              <el-option :label="item.projectName" :value="item.id"
-                                v-for="(item, index) in formitem.drvingChildren" :key="index"></el-option>
-                            </el-select>
-                            <el-select v-else filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable
-                              :size="overSize" style="width: 250px;"
-                              @change="event => drivingChildrenChange(event, solutionindex, configureindex, formindex)">
-                              <el-option :label="item.projectName" :value="item.id"
-                                v-for="(item, index) in formitem.drvingChildren" :key="index"></el-option>
-                            </el-select>
-                          </template>
-                        </el-form-item>
-                      </el-col>
-                      <el-col :span="4">
-                        <el-form-item label="别名:">
-                          <el-input v-model="formitem.alias" placeholder="驾意险别名"></el-input>
-                        </el-form-item>
-                      </el-col>
-                      <el-col :span="5">
-                        <el-form-item label="座位数:">
-                          <el-input-number v-model="formitem.seatNum" controls-position="right" :min="1"
-                            :max="10"></el-input-number>
-                          <span>座</span>
-                        </el-form-item>
-                      </el-col>
-                      <el-col :span="5">
-                        <el-form-item label="份数:">
-                          <el-input-number v-model="formitem.quantity" controls-position="right" :min="1"
-                            :max="10"></el-input-number>
-                          <span>份</span>
-                        </el-form-item>
-                      </el-col>
+                        </template>
+                      </el-form-item>
                     </el-col>
-                    <el-col :span="20">
-                      <div v-for="(LiabilityTermsitem, LiabilityTermsindex) in formitem.LiabilityTerms"
-                        :key="LiabilityTermsindex">
-                        <div style="font-weight: bold;margin-bottom: 10px;">{{ LiabilityTermsitem.projectName }}</div>
-                        <el-table :data="LiabilityTermsitem.LiabilityTerms" size="mini" :header-cell-style="{
-                          background: '#F7F7F9',
-                          fontWeight: '700',
-                          color: '#606266',
-                        }">
-                          <el-table-column prop="name" label="保险责任" align="center">
-                          </el-table-column>
-                          <el-table-column prop="amount" label="保险金额" width="180" align="center">
-                          </el-table-column>
-                          <el-table-column prop="premium" label="保费(元)" width="180" align="center">
-                          </el-table-column>
-                        </el-table>
-                      </div>
+                    <el-col :span="4">
+                      <el-form-item label="别名:">
+                        <el-input v-model="formitem.alias" placeholder="驾意险别名"></el-input>
+                      </el-form-item>
                     </el-col>
-                  </el-row>
-                </el-form>
-              </div>
+                    <el-col :span="5">
+                      <el-form-item label="座位数:">
+                        <el-input-number v-model="formitem.seatNum" controls-position="right" :min="1"
+                          :max="10"></el-input-number>
+                        <span>座</span>
+                      </el-form-item>
+                    </el-col>
+                    <el-col :span="5">
+                      <el-form-item label="份数:">
+                        <el-input-number v-model="formitem.quantity" controls-position="right" :min="1"
+                          :max="10"></el-input-number>
+                        <span>份</span>
+                      </el-form-item>
+                    </el-col>
+                  </el-col>
+                  <el-col :span="20">
+                    <div v-for="(LiabilityTermsitem, LiabilityTermsindex) in formitem.LiabilityTerms"
+                      :key="LiabilityTermsindex">
+                      <div style="font-weight: bold;margin-bottom: 10px;">{{ LiabilityTermsitem.projectName }}</div>
+                      <el-table :data="LiabilityTermsitem.LiabilityTerms" size="mini" :header-cell-style="{
+                        background: '#F7F7F9',
+                        fontWeight: '700',
+                        color: '#606266',
+                      }">
+                        <el-table-column prop="name" label="保险责任" align="center">
+                        </el-table-column>
+                        <el-table-column prop="amount" label="保险金额" width="180" align="center">
+                        </el-table-column>
+                        <el-table-column prop="premium" label="保费(元)" width="180" align="center">
+                        </el-table-column>
+                      </el-table>
+                    </div>
+                  </el-col>
+                </el-row>
+              </el-form>
             </div>
           </div>
         </div>
       </div>
-      <span slot="footer" class="dialog-footer">
-        <el-button :size="overSize" style="background: #EAEDF1;color: #2D4D89;" @click="ordinaryPlanCancel">取
-          消</el-button>
-        <el-button :size="overSize" style="background: #2D4D89;color: #fff;border-color: #2D4D89;" type="primary"
-          @click="solutionSubmit('solutionForm')">确 定</el-button>
-      </span>
+    </div>
+    <span slot="footer" class="dialog-footer">
+      <el-button :size="overSize" style="background: #EAEDF1;color: #2D4D89;" @click="ordinaryPlanCancel">取
+        消</el-button>
+      <el-button :size="overSize" style="background: #2D4D89;color: #fff;border-color: #2D4D89;" type="primary"
+        @click="solutionSubmit('solutionForm')">确 定</el-button>
+    </span>
   </div>
 </template>
 <!-- 行为区域 -->
@@ -250,6 +256,15 @@ export default {
         { prop: "companyId", label: "保险公司编码", minWidth: 160, },
         { prop: "productName", label: "方案险种", minWidth: 180, },
       ],
+      solutionrules: {
+        schemeName: [
+          { required: true, message: '方案名称必填', trigger: 'blur' }
+        ],
+        priorityLevel: [
+          { required: true, message: '序号必填', trigger: 'blur' },
+          { validator: this.validatePriority, trigger: 'blur' },
+        ],
+      },
       solutionResult: [],
       //操作符字典
       pageRequest: {
@@ -264,6 +279,7 @@ export default {
         productList: [
           {
             schemeName: "",
+            priorityLevel: "",//方案序号
             description: "",
             kinds: [],
             drvingIntentions: [
@@ -301,6 +317,15 @@ export default {
   },
   // 方法函数
   methods: {
+    validatePriority(rule, value, callback) {
+      if (!value) {
+        callback(new Error('请输入序号'));
+      } else if (!/^[1-9][0-9]?$/.test(value)) {
+        callback(new Error('请输入 1-99 的整数'));
+      } else {
+        callback();
+      }
+    },
     // drivingChange(event, solutionindex, configureindex, formindex) {
     //   if (event) {
     //     if (event instanceof Array) {
@@ -493,6 +518,7 @@ export default {
       })
       this.solutionData.productList.push({
         schemeName: "",
+        priorityLevel: "",//方案序号
         description: "",
         kinds: this.solutionData.productName !== '单交' ? list : [],
         drvingIntentions: [
@@ -532,43 +558,62 @@ export default {
         seatNum: ""//座位数
       });
     },
-    ordinaryPlanCancel () {
+    ordinaryPlanCancel() {
       this.$emit('ordinaryPlanCancel')
     },
-    solutionSubmit(formName) {
-      if (this.solutionDialogType == 'add') {
-        this.$api.insCompany.shcemeAdd({...this.solutionData,carnature:"02",vehicleType:"A0",energyType:"1"}).then((res) => {
-          if (res.code == '200') {
-            this.$message({
-              type: 'success',
-              message: res.msg,
-            });
-            this.solutionFindPage();
-            this.$emit('ordinaryPlanSubmit')
-          } else {
-            this.$message({
-              type: 'error',
-              message: res.msg,
-            });
-          }
+    solutionSubmit() {
+      const promises = this.solutionData.productList.map((_, index) => {
+        const formName = `solutionForm${index}`;
+        return new Promise((resolve, reject) => {
+          this.$refs[formName][0].validate((valid) => {
+            if (valid) {
+              resolve();
+            } else {
+              reject(`方案 ${index + 1} 校验失败!`);
+            }
+          });
         });
-      } else {
-        this.$api.insCompany.schemeUpdate({...this.solutionData,carnature:"02",vehicleType:"A0",energyType:"1"}).then((res) => {
-          if (res.code == '200') {
-            this.$message({
-              type: 'success',
-              message: res.msg,
+      });
+      Promise.all(promises)
+        .then(() => {
+          if (this.solutionDialogType == 'add') {
+            this.$api.insCompany.shcemeAdd({ ...this.solutionData, carnature: "02", vehicleType: "A0", energyType: "1" }).then((res) => {
+              if (res.code == '200') {
+                this.$message({
+                  type: 'success',
+                  message: res.msg,
+                });
+                this.solutionFindPage();
+                this.$emit('ordinaryPlanSubmit')
+              } else {
+                this.$message({
+                  type: 'error',
+                  message: res.msg,
+                });
+              }
             });
-            this.solutionFindPage();
-            this.$emit('ordinaryPlanSubmit')
           } else {
-            this.$message({
-              type: 'error',
-              message: res.msg,
+            this.$api.insCompany.schemeUpdate({ ...this.solutionData, carnature: "02", vehicleType: "A0", energyType: "1" }).then((res) => {
+              if (res.code == '200') {
+                this.$message({
+                  type: 'success',
+                  message: res.msg,
+                });
+                this.solutionFindPage();
+                this.$emit('ordinaryPlanSubmit')
+              } else {
+                this.$message({
+                  type: 'error',
+                  message: res.msg,
+                });
+              }
             });
           }
+        })
+        .catch((error) => {
+          console.log(error);
         });
-      }
+
     },
     getDicType(type) {
       this.$api.insCompany.dicType(type).then((res) => {
@@ -582,7 +627,7 @@ export default {
       this.solutionDialogTitle = '添加方案'
     },
     solutionFindPage() {
-      this.$api.insCompany.schemeList({ ...this.pageRequest, companyId: this.companyId,carnature:"02",vehicleType:"A0",energyType:"1" }).then((res) => {
+      this.$api.insCompany.schemeList({ ...this.pageRequest, companyId: this.companyId, carnature: "02", vehicleType: "A0", energyType: "1" }).then((res) => {
         if (res.code == '200') {
           let pageList = {
             content: res.data.records,
@@ -603,7 +648,7 @@ export default {
     solutionUpdate({ row, column }) {
       this.solutionDialogType = 'edit';
       this.solutionDialogTitle = '编辑方案'
-      this.$api.insCompany.schemedetails(row.companyId, row.productId,"02",'A0','1').then((res) => {
+      this.$api.insCompany.schemedetails(row.companyId, row.productId, "02", 'A0', '1').then((res) => {
         if (res.code == '200') {
           res.data.productList.map(valA => {
             valA.kinds.map(valB => {
@@ -616,7 +661,7 @@ export default {
               data.list.map(val => {
                 if (val.parentId != '0') {
                   let obj = val.drvingList.find(item => item.id == val.parentId)
-                    val.drvingChildren = obj.insDrivingIntentionInsurances;
+                  val.drvingChildren = obj.insDrivingIntentionInsurances;
                 }
               })
               const listCodes = data.list.map(item => item.code); // 获取当前 data 的所有 code
@@ -675,6 +720,7 @@ export default {
   align-items: flex-end;
   justify-content: flex-end;
 }
+
 /deep/ {
   .el-radio__input.is-checked .el-radio__inner,
   .el-checkbox__input.is-checked .el-checkbox__inner,
@@ -805,4 +851,3 @@ export default {
   background: #F2F2F2;
 }
 </style>
-

+ 90 - 47
src/views/AgreementManage/InsuranceCompany/PassengerBus/NonBusiness/NewEnergy/OrdinaryPlan.vue

@@ -7,8 +7,8 @@
     <!-- @findPage="solutionFindPage" -->
     <kt-common-table :tableHeights="700" :SerialShow="false" :operationWidth="200" :showOperation="true"
       :showBatchDelete="false" :showBatchSettled="false" :showBatchPrint="false" :data="solutionResult" button2Name="编辑"
-      button2Type="text" @findPage="solutionFindPage" @handleButton2="solutionUpdate" button3Name="删除" button3Type="text" @handleButton3="solutionDel"
-      :columns="solutionColumns">
+      button2Type="text" @findPage="solutionFindPage" @handleButton2="solutionUpdate" button3Name="删除"
+      button3Type="text" @handleButton3="solutionDel" :columns="solutionColumns">
     </kt-common-table>
     <el-dialog v-dialogDrag :title="solutionDialogTitle" :visible.sync="solutionVisible" width="90%" top="2vh"
       @close="solutioncloseDialog">
@@ -30,16 +30,22 @@
           <div v-for="(solutionitem, solutionindex) in solutionData.productList" :key="solutionindex">
             <div class="flex j-s a-c " style="margin-top: 20px;font-size: 16px;color: #262626;">
               <span>方案{{ solutionindex + 1 }}</span>
-              <el-button v-if="solutionindex > 0" type="primary" size="small" icon="el-icon-delete" class="planOption-del"
-                @click="planOptiondel(solutionindex)">方案删除</el-button>
+              <el-button v-if="solutionindex > 0" type="primary" size="small" icon="el-icon-delete"
+                class="planOption-del" @click="planOptiondel(solutionindex)">方案删除</el-button>
             </div>
-            <el-form ref="solutionForm" :model="solutionitem" label-width="120px" :size="overSize">
+            <el-form :ref="`solutionForm${solutionindex}`" :rules="solutionrules" :model="solutionitem"
+              label-width="120px" :size="overSize">
               <el-row>
                 <el-col :span="8">
-                  <el-form-item label="方案名称">
+                  <el-form-item label="方案名称" prop="schemeName">
                     <el-input type="text" v-model="solutionitem.schemeName" placeholder="输入方案名称"></el-input>
                   </el-form-item>
                 </el-col>
+                <el-col :span="4">
+                  <el-form-item label="序号" prop="priorityLevel">
+                    <el-input type="text" v-model="solutionitem.priorityLevel" clearable :maxlength="2"></el-input>
+                  </el-form-item>
+                </el-col>
                 <el-col :span="20">
                   <el-form-item label="方案描述">
                     <el-input type="textarea" v-model="solutionitem.description" placeholder="输入方案描述" maxlength="100"
@@ -123,7 +129,7 @@
                     :key="DriverTypeitem.id">
                     <span style="margin-right: 10px;color: #262626;font-size: 14px;font-weight: bold;">{{
                       DriverTypeitem.typeName
-                    }}</span>
+                      }}</span>
                     <el-checkbox v-model="childrenitem.checked" v-for="childrenitem in DriverTypeitem.children"
                       :key="childrenitem.id"
                       @change="event => drvingcheckboxChange(event, childrenitem, solutionindex, configureindex)">{{
@@ -158,8 +164,8 @@
                           </el-select>
                           <el-select
                             v-else-if="formitem.isMultiple == 0 && !formitem.drvingList[0].insDrivingIntentionInsurances"
-                            filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable :size="overSize"
-                            style="width: 250px;"
+                            filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable
+                            :size="overSize" style="width: 250px;"
                             @change="event => drivingChange(event, formitem, solutionindex, configureindex, formindex)">
                             <el-option :label="item.projectName" :value="item.id"
                               v-for="(item, index) in formitem.drvingList" :key="index"></el-option>
@@ -180,8 +186,8 @@
                               <el-option :label="item.projectName" :value="item.id"
                                 v-for="(item, index) in formitem.drvingChildren" :key="index"></el-option>
                             </el-select>
-                            <el-select v-else filterable v-model="formitem.drivingIntentionId" placeholder="请选择" clearable
-                              :size="overSize" style="width: 250px;"
+                            <el-select v-else filterable v-model="formitem.drivingIntentionId" placeholder="请选择"
+                              clearable :size="overSize" style="width: 250px;"
                               @change="event => drivingChildrenChange(event, solutionindex, configureindex, formindex)">
                               <el-option :label="item.projectName" :value="item.id"
                                 v-for="(item, index) in formitem.drvingChildren" :key="index"></el-option>
@@ -275,6 +281,15 @@ export default {
         { prop: "companyId", label: "保险公司编码", minWidth: 160, },
         { prop: "productName", label: "方案险种", minWidth: 180, },
       ],
+      solutionrules: {
+        schemeName: [
+          { required: true, message: '方案名称必填', trigger: 'blur' }
+        ],
+        priorityLevel: [
+          { required: true, message: '序号必填', trigger: 'blur' },
+          { validator: this.validatePriority, trigger: 'blur' },
+        ],
+      },
       solutionResult: [],
       //操作符字典
       pageRequest: {
@@ -289,6 +304,7 @@ export default {
         productList: [
           {
             schemeName: "",
+            priorityLevel: "",
             description: "",
             kinds: [],
             drvingIntentions: [
@@ -308,12 +324,12 @@ export default {
     }
   },
   watch: {
-    activeIndex (newVal) {
+    activeIndex(newVal) {
       if (newVal === 0) {
         this.initData()
       }
     },
-    ordinaryIndex (newVal) {
+    ordinaryIndex(newVal) {
       if (newVal) {
         this.initData()
       }
@@ -321,13 +337,13 @@ export default {
   },
   // 生命周期函数
   created() {
-    if (this.$route.query.type*1 === 0) {
+    if (this.$route.query.type * 1 === 0) {
       this.initData()
     }
   },
   // 方法函数
   methods: {
-    initData () {
+    initData() {
       this.companyId = this.$route.query.companyId;
       this.solutionData.companyId = this.$route.query.companyId;
       this.getDicType("productsType"); //车险产品
@@ -344,6 +360,15 @@ export default {
       });
       localStorage.setItem("insureList", JSON.stringify(this.insureList));
     },
+    validatePriority(rule, value, callback) {
+      if (!value) {
+        callback(new Error('请输入序号'));
+      } else if (!/^[1-9][0-9]?$/.test(value)) {
+        callback(new Error('请输入 1-99 的整数'));
+      } else {
+        callback();
+      }
+    },
     // drivingChange(event, solutionindex, configureindex, formindex) {
     //   if (event) {
     //     if (event instanceof Array) {
@@ -536,6 +561,7 @@ export default {
       })
       this.solutionData.productList.push({
         schemeName: "",
+        priorityLevel: "",
         description: "",
         kinds: this.solutionData.productName !== '单交' ? list : [],
         drvingIntentions: [
@@ -575,40 +601,58 @@ export default {
         seatNum: ""//座位数
       });
     },
-    solutionSubmit(formName) {
-      if (this.solutionDialogType == 'add') {
-        this.$api.insCompany.shcemeAdd({...this.solutionData,carnature:"02",vehicleType:"A0",energyType:"1"}).then((res) => {
-          if (res.code == '200') {
-            this.$message({
-              type: 'success',
-              message: res.msg,
-            });
-            this.solutionVisible = false;
-            this.solutionFindPage();
-          } else {
-            this.$message({
-              type: 'error',
-              message: res.msg,
-            });
-          }
+    solutionSubmit() {
+      const promises = this.solutionData.productList.map((_, index) => {
+        const formName = `solutionForm${index}`;
+        return new Promise((resolve, reject) => {
+          this.$refs[formName][0].validate((valid) => {
+            if (valid) {
+              resolve();
+            } else {
+              reject(`方案 ${index + 1} 校验失败!`);
+            }
+          });
         });
-      } else {
-        this.$api.insCompany.schemeUpdate({...this.solutionData,carnature:"02",vehicleType:"A0",energyType:"1"}).then((res) => {
-          if (res.code == '200') {
-            this.$message({
-              type: 'success',
-              message: res.msg,
+      });
+      Promise.all(promises)
+        .then(() => {
+          if (this.solutionDialogType == 'add') {
+            this.$api.insCompany.shcemeAdd({ ...this.solutionData, carnature: "02", vehicleType: "A0", energyType: "1" }).then((res) => {
+              if (res.code == '200') {
+                this.$message({
+                  type: 'success',
+                  message: res.msg,
+                });
+                this.solutionVisible = false;
+                this.solutionFindPage();
+              } else {
+                this.$message({
+                  type: 'error',
+                  message: res.msg,
+                });
+              }
             });
-            this.solutionVisible = false;
-            this.solutionFindPage();
           } else {
-            this.$message({
-              type: 'error',
-              message: res.msg,
+            this.$api.insCompany.schemeUpdate({ ...this.solutionData, carnature: "02", vehicleType: "A0", energyType: "1" }).then((res) => {
+              if (res.code == '200') {
+                this.$message({
+                  type: 'success',
+                  message: res.msg,
+                });
+                this.solutionVisible = false;
+                this.solutionFindPage();
+              } else {
+                this.$message({
+                  type: 'error',
+                  message: res.msg,
+                });
+              }
             });
           }
+        })
+        .catch((error) => {
+          console.log(error);
         });
-      }
     },
     getDicType(type) {
       this.$api.insCompany.dicType(type).then((res) => {
@@ -623,7 +667,7 @@ export default {
       this.solutionVisible = true;
     },
     solutionFindPage() {
-      this.$api.insCompany.schemeList({ ...this.pageRequest, companyId: this.companyId,carnature:"02",vehicleType:"A0",energyType:"1" }).then((res) => {
+      this.$api.insCompany.schemeList({ ...this.pageRequest, companyId: this.companyId, carnature: "02", vehicleType: "A0", energyType: "1" }).then((res) => {
         if (res.code == '200') {
           let pageList = {
             content: res.data.records,
@@ -644,7 +688,7 @@ export default {
     solutionUpdate({ row, column }) {
       this.solutionDialogType = 'edit';
       this.solutionDialogTitle = '编辑方案'
-      this.$api.insCompany.schemedetails(row.companyId, row.productId,"02",'A0','1').then((res) => {
+      this.$api.insCompany.schemedetails(row.companyId, row.productId, "02", 'A0', '1').then((res) => {
         if (res.code == '200') {
           res.data.productList.map(valA => {
             valA.kinds.map(valB => {
@@ -657,7 +701,7 @@ export default {
               data.list.map(val => {
                 if (val.parentId != '0') {
                   let obj = val.drvingList.find(item => item.id == val.parentId)
-                    val.drvingChildren = obj.insDrivingIntentionInsurances;
+                  val.drvingChildren = obj.insDrivingIntentionInsurances;
                 }
               })
               const listCodes = data.list.map(item => item.code); // 获取当前 data 的所有 code
@@ -839,4 +883,3 @@ export default {
   background: #F2F2F2;
 }
 </style>
-