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

Merge branch 'dev' of http://39.101.143.165:8090/dong_k/tenant-Platform into dev

@dongkboy преди 1 седмица
родител
ревизия
7d639ea84a
променени са 2 файла, в които са добавени 106 реда и са изтрити 99 реда
  1. 98 93
      src/components/complexTable/index.vue
  2. 8 6
      src/views/quoteConfig/agreement/agreementDetails.vue

+ 98 - 93
src/components/complexTable/index.vue

@@ -11,103 +11,101 @@
           theme: 'my-theme',      // 自定义主题
         }
       }"> -->
-        <el-table ref="multipleTableRef" :row-key="rowKey"
-          :header-cell-style="{ 'background-color': '#F7F7F9', 'border-bottom': '1px solid #EEF1F6', 'font-size': '15px', 'color': '#333', 'padding': '10px 0' }"
-          :data="props.tableData" :height="tableHeight" :max-height="maxHeight" table-layout="fixed"
-          style="width: 100%;" @selection-change="selectionChange" @select-all="selectAllChange"
-          @cell-mouse-enter="handleMouseEnter" @cell-mouse-leave="handleMouseLeave"
-          :highlight-current-row="highlightCurrentRow" @current-change="currentChange" v-loading="loading"
-          :show-summary='props.showSummary' border>
-          <!-- 空内容自定义 -->
-          <template #empty>
-            <div class="flex f-c a-c ">
-              <img src="../../assets/images/empty.png" alt="">
-              <span style="font-size: 14px;color: #909399;">暂无数据</span>
-            </div>
-          </template>
-          <el-table-column type="selection" v-if="showSelect" :selectable="selectable" width="55" fixed="left" />
-          <el-table-column type="expand" v-if="secondaryTable">
-            <template #default="props">
-              <div>
-                <el-table :data="props.row.children">
-                  <el-table-column v-for="column in secondaryColumns" :key="column.prop" :prop="column.prop"
-                    :label="column.label" :sortable="column.sortable ? 'custom' : false" :width="column.width">
-                    <template #header>
-                      <slot name="search" :slotData="column"></slot>
-                    </template>
-                    <template #default="scope">
-                      <RouterLink v-if="column.component === 'RouterLink'" :to="getRouterLinkTo(scope.row, column)"
-                        class="custom-link">
-                        {{ scope.row[column.prop] }}
-                      </RouterLink>
-                      <el-tag v-else-if="column.component === 'Tag'" :type="getTagTypeAndText(scope.row, column).type">
-                        {{ getTagTypeAndText(scope.row, column).text }}
-                      </el-tag>
-                      <ImagePreview v-else-if="column.component === 'Image'" :src="getImgTo(scope.row, column)"
-                        width="50px" height="50px"></ImagePreview>
-                      <template v-else>
-                        {{ getDisplayText(scope.row, column) }}
-                      </template>
+      <el-table ref="multipleTableRef" :row-key="rowKey"
+        :header-cell-style="{ 'background-color': '#F7F7F9', 'border-bottom': '1px solid #EEF1F6', 'font-size': '15px', 'color': '#333', 'padding': '10px 0' }"
+        :data="props.tableData" :height="tableHeight" :max-height="maxHeight" table-layout="fixed" style="width: 100%;"
+        @selection-change="selectionChange" @select-all="selectAllChange" @cell-mouse-enter="handleMouseEnter"
+        @cell-mouse-leave="handleMouseLeave" :highlight-current-row="highlightCurrentRow"
+        @current-change="currentChange" v-loading="loading" :show-summary='props.showSummary' border>
+        <!-- 空内容自定义 -->
+        <template #empty>
+          <div class="flex f-c a-c ">
+            <img src="../../assets/images/empty.png" alt="">
+            <span style="font-size: 14px;color: #909399;">暂无数据</span>
+          </div>
+        </template>
+        <el-table-column type="selection" v-if="showSelect" :selectable="selectable" width="55" fixed="left" />
+        <el-table-column type="expand" v-if="secondaryTable">
+          <template #default="props">
+            <div>
+              <el-table :data="props.row.children">
+                <el-table-column v-for="column in secondaryColumns" :key="column.prop" :prop="column.prop"
+                  :label="column.label" :sortable="column.sortable ? 'custom' : false" :width="column.width">
+                  <template #header>
+                    <slot name="search" :slotData="column"></slot>
+                  </template>
+                  <template #default="scope">
+                    <RouterLink v-if="column.component === 'RouterLink'" :to="getRouterLinkTo(scope.row, column)"
+                      class="custom-link">
+                      {{ scope.row[column.prop] }}
+                    </RouterLink>
+                    <el-tag v-else-if="column.component === 'Tag'" :type="getTagTypeAndText(scope.row, column).type">
+                      {{ getTagTypeAndText(scope.row, column).text }}
+                    </el-tag>
+                    <ImagePreview v-else-if="column.component === 'Image'" :src="getImgTo(scope.row, column)"
+                      width="50px" height="50px"></ImagePreview>
+                    <template v-else>
+                      {{ getDisplayText(scope.row, column) }}
                     </template>
-                  </el-table-column>
-                  <el-table-column label="操作" fixed="right" :width="props.columnwidth">
-                    <template #default="scope">
-                      <slot name="secondary" :secondaryData="scope.row"></slot>
-                    </template>
-                  </el-table-column>
-                </el-table>
-              </div>
+                  </template>
+                </el-table-column>
+                <el-table-column label="操作" fixed="right" :width="props.columnwidth">
+                  <template #default="scope">
+                    <slot name="secondary" :secondaryData="scope.row"></slot>
+                  </template>
+                </el-table-column>
+              </el-table>
+            </div>
 
-            </template>
-          </el-table-column>
-          <el-table-column v-if="showIndex" type="index" label="序号" width="55" />
-          <el-table-column v-for="column in columns" :key="column.prop" :prop="column.prop" :label="column.label"
-            :sortable="column.sortable ? 'custom' : false" :width="column.width" :filters="column.filters"
-            :filter-method="column.filters ? (value, row) => row[column.prop] === value : undefined"
-            :filtered-value="column.filteredValue ? column.filteredValue : undefined" :fixed="column.fixed || false"
-            :align="column.align ? column.align : 'center'" show-overflow-tooltip>
-            <template #header>
-              <slot name="search" :slotData="column"></slot>
-            </template>
-            <template #default="scope" v-if="column.component === 'customSlot'">
-              <slot name="customSlot" :data="scope.row" :bodyCell="{ scope, column }"></slot>
-              <slot :name="column.prop" :data="scope.row" :bodyCell="{ scope, column }"></slot>
-            </template>
-            <template #default="scope" v-else>
-              <RouterLink v-if="column.component === 'RouterLink'" :to="getRouterLinkTo(scope.row, column)"
-                class="custom-link">
-                {{ scope.row[column.prop] }}
-              </RouterLink>
-              <div v-else-if="column.component === 'html'">
-                <span v-html="htmlEvent(scope.row, column).html"></span>
+          </template>
+        </el-table-column>
+        <el-table-column v-if="showIndex" type="index" label="序号" width="55" />
+        <el-table-column v-for="column in columns" :key="column.prop" :prop="column.prop" :label="column.label"
+          :sortable="column.sortable ? 'custom' : false" :width="column.width" :filters="column.filters"
+          :filter-method="column.filters ? (value, row) => filterMethod(value, row, column) : undefined"
+          :filtered-value="column.filteredValue ? column.filteredValue : undefined" :fixed="column.fixed || false"
+          :align="column.align ? column.align : 'center'" show-overflow-tooltip>
+          <template #header>
+            <slot name="search" :slotData="column"></slot>
+          </template>
+          <template #default="scope" v-if="column.component === 'customSlot'">
+            <slot name="customSlot" :data="scope.row" :bodyCell="{ scope, column }"></slot>
+            <slot :name="column.prop" :data="scope.row" :bodyCell="{ scope, column }"></slot>
+          </template>
+          <template #default="scope" v-else>
+            <RouterLink v-if="column.component === 'RouterLink'" :to="getRouterLinkTo(scope.row, column)"
+              class="custom-link">
+              {{ scope.row[column.prop] }}
+            </RouterLink>
+            <div v-else-if="column.component === 'html'">
+              <span v-html="htmlEvent(scope.row, column).html"></span>
+            </div>
+            <el-tag v-else-if="column.component === 'Tag'" :type="getTagTypeAndText(scope.row, column).type">
+              {{ getTagTypeAndText(scope.row, column).text }}
+            </el-tag>
+            <ImagePreview v-else-if="column.component === 'Image'" :src="getImgTo(scope.row, column)" width="50px"
+              height="50px"></ImagePreview>
+            <span v-else>
+              <div
+                v-if="typeof getDisplayText(scope.row, column) === 'string' && getDisplayText(scope.row, column).includes('\n')"
+                class="flex f-c ">
+                <span v-for="(line, index) in getDisplayText(scope.row, column).split('\n')" :key="index">{{ line
+                  }}</span>
               </div>
-              <el-tag v-else-if="column.component === 'Tag'" :type="getTagTypeAndText(scope.row, column).type">
-                {{ getTagTypeAndText(scope.row, column).text }}
-              </el-tag>
-              <ImagePreview v-else-if="column.component === 'Image'" :src="getImgTo(scope.row, column)" width="50px"
-                height="50px"></ImagePreview>
               <span v-else>
-                <div
-                  v-if="typeof getDisplayText(scope.row, column) === 'string' && getDisplayText(scope.row, column).includes('\n')"
-                  class="flex f-c ">
-                  <span v-for="(line, index) in getDisplayText(scope.row, column).split('\n')" :key="index">{{ line
-                  }}</span>
-                </div>
-                <span v-else>
-                  {{ getDisplayText(scope.row, column) }}
-                </span>
+                {{ getDisplayText(scope.row, column) }}
               </span>
-            </template>
-          </el-table-column>
-          <el-table-column label="操作" fixed="right" :width="props.columnwidth" v-if="props.showOperation"
-            align="center">
-            <template #default="scope">
-              <div class="flex a-c j-c">
-                <slot name="operation" :operationData="scope.row"></slot>
-              </div>
-            </template>
-          </el-table-column>
-        </el-table>
+            </span>
+          </template>
+        </el-table-column>
+        <el-table-column label="操作" fixed="right" :width="props.columnwidth" v-if="props.showOperation" align="center">
+          <template #default="scope">
+            <div class="flex a-c j-c">
+              <slot name="operation" :operationData="scope.row"></slot>
+            </div>
+          </template>
+        </el-table-column>
+      </el-table>
       <!-- </OverlayScrollbarsComponent> -->
     </div>
     <div class="page_box" v-if="props.pageInfo">
@@ -127,7 +125,7 @@ import type { TableInstance } from "element-plus";
 interface TableRow {
   [key: string]: any;
 }
-const emit = defineEmits(['getList', 'selectAllChange', 'selectionChange', 'currentChange', 'handleMouseEnter', 'handleMouseLeave']);
+const emit = defineEmits(['getList', 'selectAllChange', 'selectionChange', 'currentChange', 'handleMouseEnter', 'handleMouseLeave', 'changeShowTotal']);
 interface Props {
   tableData: Array<TableRow>;
   columnwidth: number,//操作栏宽度
@@ -199,6 +197,13 @@ onMounted(() => {
   }));
   if (!props.tableheight) handleResize();
 });
+
+const filterMethod = (value: any, row: any, column: any) => {
+  const list = props.tableData.filter(v => v[column.prop] === value)
+  emit('changeShowTotal', list.length)
+  return row[column.prop] === value
+}
+
 function handleResize() {
   // 获取当前窗口的高度
   const height = window.innerHeight;

+ 8 - 6
src/views/quoteConfig/agreement/agreementDetails.vue

@@ -154,10 +154,11 @@
                     :label="costitem.productName" :name="costitem.productName">
                     <div class="flex justify-between items-center m-b-10px">
                       <div class="">
-                        <span class="strong">{{ costitem.productName }}费用({{
-                          showCostVoList(costitem.ptlAgreementCostVoList,
-                            item).length
-                        }}条)</span>
+                        <span class="strong">{{ costitem.productName }}费用(
+                          {{
+                            costitem.total ?? showCostVoList(costitem.ptlAgreementCostVoList,
+                              item).length
+                          }}条)</span>
                         <el-button type="primary" link @click="handleUpdateValidDate()"> 批量设置有效期
                         </el-button>
                         <el-button type="primary" link @click="handleUpdateCostRatio()"> 批量设置比例
@@ -174,7 +175,8 @@
                     </div>
                     <ComplexTable showSelect :tableData="showCostVoList(costitem.ptlAgreementCostVoList, item)"
                       :columns="columns" :showIndex="false" maxHeight="calc(100vh - 300px)" :columnwidth="200"
-                      @selectionChange="(arr) => costIds = arr" @select-all="(arr) => costIds = arr">
+                      @selectionChange="(arr) => costIds = arr" @select-all="(arr) => costIds = arr"
+                      @changeShowTotal="(total) => costitem.total = total">
                       <template #costDescribe="{ data, bodyCell }">
                         <div class="whitespace-normal">{{ data.costDescribe }}</div>
                       </template>
@@ -701,7 +703,7 @@ const showCostVoList = (list, item) => {
   let showList = list
   if (item.searchInput) {
     showList = showList.filter(v => {
-      return item.searchInput.every(k => v.costDescribe?.includes(k) || v.costRules?.includes(k))
+      return item.searchInput.every(k => v.costDescribe?.includes(k))
     })
   }
   if (item.date) {