From 9ff9962d8d2d4cb1cd5d6abcb902e916c44cda03 Mon Sep 17 00:00:00 2001 From: gaoluyang <2820782392@qq.com> Date: 星期四, 08 五月 2025 14:28:29 +0800 Subject: [PATCH] 客户档案页面开发 --- src/components/PIMTable/PIMTable.vue | 66 +++++++------------------------- 1 files changed, 15 insertions(+), 51 deletions(-) diff --git a/src/components/PIMTable/PIMTable.vue b/src/components/PIMTable/PIMTable.vue index 747ef53..c76cf45 100644 --- a/src/components/PIMTable/PIMTable.vue +++ b/src/components/PIMTable/PIMTable.vue @@ -1,11 +1,11 @@ <template> <el-table ref="multipleTable" v-loading="tableLoading" :border="border" :data="tableData" - :header-cell-style="{ background: '#F0F1F5', color: '#333333' }" :height="height" + :header-cell-style="{ background: '#F0F1F5', color: '#333333' }" height="calc(100vh - 18.5em)" :highlight-current-row="highlightCurrentRow" :row-class-name="rowClassName" :row-style="rowStyle" - :row-key="rowKey" :span-method="spanMethod" stripe style="width: 100%" tooltip-effect="dark" @row-click="rowClick" + :row-key="rowKey" stripe style="width: 100%" tooltip-effect="dark" @row-click="rowClick" @current-change="currentChange" @selection-change="handleSelectionChange" class="lims-table"> - <el-table-column align="center" type="selection" width="55" v-if="isSelection" /> - <el-table-column align="center" label="搴忓彿" type="index" width="60" :index="indexMethod" /> + <el-table-column align="center" type="selection" width="55" /> + <el-table-column align="center" label="搴忓彿" type="index" width="60" /> <el-table-column v-for="(item, index) in column" :key="index" :column-key="item.columnKey" :filter-method="item.filterHandler" :filter-multiple="item.filterMultiple" :filtered-value="item.filteredValue" @@ -51,12 +51,11 @@ </div> <!-- 鎸夐挳 --> - <div v-else-if="item.dataType == 'action'" - :style="`min-width:${getWidth(item.operation, scope.row)}`"> + <div v-else-if="item.dataType == 'action'"> <template v-for="(o, key) in item.operation" :key="key"> <el-button v-show="o.type != 'upload'" size="small" v-if="o.showHide ? o.showHide(scope.row) : true" - :disabled="o.disabled ? o.disabled(scope.row) : false" :plain="o.plain" - :style="{ color: (o.name === '鍒犻櫎' || o.name === 'delete') ? '#f56c6c' : o.color }" :type="typeFn(o.type, scope.row)" + :disabled="o.disabled ? o.disabled(scope.row) : false" :plain="o.plain" type="primary" + :style="{ color: (o.name === '鍒犻櫎' || o.name === 'delete') ? '#f56c6c' : o.color }" link @click="o.clickFun(scope.row)" :key="key"> {{ o.name }} </el-button> @@ -71,7 +70,7 @@ :on-error="(error, file, fileList) => onError(error, file, fileList, scope.$index)" :on-success="(response, file, fileList) => handleSuccessUp(response, file, fileList, scope.$index)" :on-exceed="onExceed" :show-file-list="false"> - <el-button :size="o.size ? o.size : 'small'" type="text" + <el-button :size="o.size ? o.size : 'small'" link type="primary" :disabled="o.disabled ? o.disabled(scope.row) : false">{{ o.name }}</el-button> </el-upload> </template> @@ -89,7 +88,7 @@ </template> </el-table-column> </el-table> - <pagination v-show="page.total > 0" :total="page.total" :layout="page.layout" :page="page.current" + <pagination v-show="total > 0" :total="total" :layout="page.layout" :page="page.current" :limit="page.size" @pagination="paginationSearch" /> </template> @@ -103,6 +102,8 @@ const uploadHeader = proxy.uploadHeader const javaApi = proxy.javaApi +const emit = defineEmits(["pagination"]); + // Filters const typeFn = (val, row) => { return typeof val === 'function' ? val(row) : val @@ -114,14 +115,6 @@ // Props锛堜娇鐢� defineProps 鐨勯潪 TS 褰㈠紡锛� const props = defineProps({ - isSelection: { - type: Boolean, - default: false - }, - height: { - type: [String, null], - default: null - }, tableLoading: { type: Boolean, default: false @@ -178,50 +171,21 @@ size: 10, layout: 'total, sizes, prev, pager, next, jumper' }) + }, + total: { + type: Number, + default: 0 } }) // Data -const spanList = ref([]) const btnWidth = ref('120px') const uploadRefs = ref([]) const currentFiles = ref({}) const uploadKeys = ref({}) -// 鍚堝苟鍗曞厓鏍兼柟娉� -const spanMethod = ({ row, column, rowIndex, columnIndex }) => { - if (column.find((m) => m.mergeCol)) { - let i = Number(rowIndex) - const obj = spanList.value.find((item, index) => { - i = index - return item.index == columnIndex - }) - if (obj) { - const _row = spanList[i].arr[rowIndex] - const _col = _row > 0 ? 1 : 0 - return { - rowspan: _row, - colspan: _col - } - } - } -} - const indexMethod = (index) => { return (props.page.current - 1) * props.page.size + index + 1 -} - -const getWidth = (row, row0) => { - let count = 0 - row.forEach((a) => { - if (a.showHide !== undefined && a.showHide(row0)) { - count += a.name.length - } else if (!a.showHide) { - count += a.name.length - } - }) - btnWidth.value = count * 15 + 60 + "px" - return count * 15 + 60 + "px" } // 鐐瑰嚮 link 浜嬩欢 -- Gitblit v1.9.3