Преглед на файлове

报价页面增加保司多选的全选

祁鹏飞 преди 1 месец
родител
ревизия
649e669035
променени са 1 файла, в които са добавени 20 реда и са изтрити 6 реда
  1. 20 6
      src/views/insurancePolicy/index.vue

+ 20 - 6
src/views/insurancePolicy/index.vue

@@ -916,8 +916,9 @@
               报价公司
               报价公司
             </span>
             </span>
           </template>
           </template>
-          <el-table :data="showQuoteData" style="width: calc(100% - 48px); margin: 0 24px" row-key="id"
-            :preserve-expanded-content="true" @row-click="handleClickRow" @expand-change="handelExpend">
+          <el-table ref="quoteDataRef" :data="showQuoteData" style="width: calc(100% - 48px); margin: 0 24px"
+            row-key="id" :preserve-expanded-content="true" @expand-change="handelExpend"
+            @selection-change="handleSelectionChange">
             <el-table-column type="expand">
             <el-table-column type="expand">
               <template #default="scope">
               <template #default="scope">
                 <div class="equities"
                 <div class="equities"
@@ -1149,6 +1150,10 @@
               </template>
               </template>
             </el-table-column>
             </el-table-column>
             <el-table-column prop="checked" align="center" width="55">
             <el-table-column prop="checked" align="center" width="55">
+              <template #header>
+                <el-checkbox v-model="selectAll" :indeterminate="showQuoteData.some(v => v.checked !== selectAll)"
+                  @change="handleSelectionChange" />
+              </template>
               <template #default="scope">
               <template #default="scope">
                 <el-checkbox v-model="scope.row.checked" @change="handleSelect(scope.row)" />
                 <el-checkbox v-model="scope.row.checked" @change="handleSelect(scope.row)" />
               </template>
               </template>
@@ -2748,6 +2753,7 @@ const handleEquitiesSave = (data: any) => {
 const getSchemeResult = (bool: false) => {
 const getSchemeResult = (bool: false) => {
   if (!insurancePolicyForm.value.order.insuranceCompanyCode) return
   if (!insurancePolicyForm.value.order.insuranceCompanyCode) return
   if (!insurancePolicyForm.value.productId) return
   if (!insurancePolicyForm.value.productId) return
+  const insuranceCompanyCode = insurancePolicyForm.value.order.insuranceCompanyCode
   api.insurancePolicyApi.getSchemeResult({
   api.insurancePolicyApi.getSchemeResult({
     companyId: insurancePolicyForm.value.order.insuranceCompanyCode,
     companyId: insurancePolicyForm.value.order.insuranceCompanyCode,
     productId: insurancePolicyForm.value.productId,
     productId: insurancePolicyForm.value.productId,
@@ -2768,7 +2774,7 @@ const getSchemeResult = (bool: false) => {
     }
     }
     // 方案信息
     // 方案信息
     quoteData.value.forEach((item: any) => {
     quoteData.value.forEach((item: any) => {
-      if (item.id === insurancePolicyForm.value.order.insuranceCompanyCode) {
+      if (item.id === insuranceCompanyCode) {
         list = list.map((item1: any) => {
         list = list.map((item1: any) => {
           return {
           return {
             ...item1,
             ...item1,
@@ -2822,6 +2828,16 @@ const getSchemeResult = (bool: false) => {
   })
   })
 }
 }
 
 
+const selectAll = ref(false)
+const handleSelectionChange = (val) => {
+  const bool = showQuoteData.value.some(v => v.checked !== selectAll.value)
+  if (bool) selectAll.value = true
+  for (let i = 0; i < showQuoteData.value.length; i++) {
+    const element = showQuoteData.value[i]
+    element.checked = bool || val
+    handleSelect(element)
+  }
+}
 const handleSelect = (row: any) => {
 const handleSelect = (row: any) => {
   insurancePolicyForm.value.order.insuranceCompanyCode = row.id
   insurancePolicyForm.value.order.insuranceCompanyCode = row.id
   getSchemeResult()
   getSchemeResult()
@@ -2831,9 +2847,6 @@ const handelExpend = (e: any) => {
   insurancePolicyForm.value.order.insuranceCompanyCode = e.id
   insurancePolicyForm.value.order.insuranceCompanyCode = e.id
   getSchemeResult()
   getSchemeResult()
 }
 }
-const handleClickRow = (a: any, b: any) => {
-
-}
 
 
 /**
 /**
  * 根据视图成功状态过滤报价数据
  * 根据视图成功状态过滤报价数据
@@ -3475,6 +3488,7 @@ const handleSubmit = async (InsurancePolicyRefs: FormInstance | undefined, scope
     }
     }
   })
   })
 }
 }
+
 /**
 /**
  * 批量报价
  * 批量报价
  */
  */