| | |
| | | <el-table-column align="center" label="序号" type="index" width="60" /> |
| | | |
| | | <el-table-column |
| | | v-for="(item, index) in column" |
| | | v-for="(item, index) in visibleColumns" |
| | | :key="index" |
| | | :column-key="item.columnKey" |
| | | :filter-method="item.filterHandler" |
| | |
| | | :sortable="!!item.sortable" |
| | | :type="item.type" |
| | | :width="item.width" |
| | | :minWidth="item.minWidth" |
| | | > |
| | | <template #header="scope"> |
| | | <div class="pim-table-header-cell"> |
| | |
| | | </div> |
| | | |
| | | <!-- 按钮 --> |
| | | <div v-else-if="item.dataType == 'action'"> |
| | | <div v-else-if="item.dataType == 'action'" @click.stop> |
| | | <template v-for="(o, key) in item.operation" :key="key"> |
| | | <el-button |
| | | v-show="o.type != 'upload'" |
| | |
| | | : o.color, |
| | | }" |
| | | link |
| | | @click="o.clickFun(scope.row)" |
| | | @click.stop="o.clickFun(scope.row)" |
| | | :key="key" |
| | | > |
| | | {{ o.name }} |
| | |
| | | |
| | | <script setup> |
| | | import pagination from "./Pagination.vue"; |
| | | import { ref, inject, getCurrentInstance } from "vue"; |
| | | import { ref, inject, getCurrentInstance, computed, unref } from "vue"; |
| | | import { ElMessage } from "element-plus"; |
| | | |
| | | // 获取全局的 uploadHeader |
| | |
| | | const uploadHeader = proxy.uploadHeader; |
| | | const javaApi = proxy.javaApi; |
| | | |
| | | const emit = defineEmits(["pagination", "expand-change", "selection-change"]); |
| | | const emit = defineEmits(["pagination", "expand-change", "selection-change", "row-click"]); |
| | | |
| | | // Filters |
| | | const typeFn = (val, row) => { |
| | |
| | | }, |
| | | }); |
| | | |
| | | const resolveColumnVisible = (visible) => { |
| | | if (visible === undefined) return true; |
| | | if (typeof visible === "function") { |
| | | try { |
| | | return !!visible(); |
| | | } catch (error) { |
| | | console.warn("PIMTable column visible function error:", error); |
| | | return true; |
| | | } |
| | | } |
| | | return !!unref(visible); |
| | | }; |
| | | |
| | | const visibleColumns = computed(() => { |
| | | return (props.column || []).filter((item) => resolveColumnVisible(item?.visible)); |
| | | }); |
| | | |
| | | // Data |
| | | const uploadRefs = ref([]); |
| | | const currentFiles = ref({}); |
| | |
| | | emit("pagination", { page: page, limit: limit }); |
| | | }; |
| | | |
| | | const rowClick = (row) => { |
| | | emit("row-click", row); |
| | | }; |
| | | |
| | | const expandChange = (row, expandedRows) => { |
| | | emit("expand-change", row, expandedRows); |
| | | }; |