✨(all): update
This commit is contained in:
parent
db2ffa68ef
commit
0eaac32664
@ -5,17 +5,15 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import "./index.less";
|
||||||
import { ref, watch, useSlots, withDefaults, onMounted } from "vue";
|
import { ref, watch, useSlots, withDefaults, onMounted } from "vue";
|
||||||
import { v4 as uuidv4 } from "../../utils/guidUtil";
|
import { v4 as uuidv4 } from "../../utils/guidUtil";
|
||||||
import { Recordable } from "../../types";
|
import { Recordable } from "../../types";
|
||||||
import LayCheckbox from "../checkbox/index.vue";
|
import LayCheckbox from "../checkbox/index.vue";
|
||||||
import LayDropdown from "../dropdown/index.vue";
|
import LayDropdown from "../dropdown/index.vue";
|
||||||
import LayPage from "../page/index.vue";
|
|
||||||
import { LayIcon } from "@layui/icons-vue";
|
|
||||||
import "./index.less";
|
|
||||||
import LayTooltip from "../tooltip/index.vue";
|
import LayTooltip from "../tooltip/index.vue";
|
||||||
|
import { LayIcon } from "@layui/icons-vue";
|
||||||
const tableId = uuidv4();
|
import LayPage from "../page/index.vue";
|
||||||
|
|
||||||
export interface LayTableProps {
|
export interface LayTableProps {
|
||||||
id?: string;
|
id?: string;
|
||||||
@ -36,6 +34,8 @@ const props = withDefaults(defineProps<LayTableProps>(), {
|
|||||||
selectedKeys: () => [],
|
selectedKeys: () => [],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const tableId = uuidv4();
|
||||||
|
|
||||||
const emit = defineEmits([
|
const emit = defineEmits([
|
||||||
"row",
|
"row",
|
||||||
"change",
|
"change",
|
||||||
@ -120,8 +120,8 @@ const print = function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const exportData = () => {
|
const exportData = () => {
|
||||||
const head = [];
|
const head: any = [];
|
||||||
const body = [];
|
const body: any = [];
|
||||||
tableColumns.value.forEach((item) => {
|
tableColumns.value.forEach((item) => {
|
||||||
try {
|
try {
|
||||||
tableDataSource.value.forEach((dataItem) => {
|
tableDataSource.value.forEach((dataItem) => {
|
||||||
@ -133,7 +133,7 @@ const exportData = () => {
|
|||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
});
|
});
|
||||||
tableDataSource.value.forEach((item) => {
|
tableDataSource.value.forEach((item) => {
|
||||||
let obj = [];
|
let obj: any = [];
|
||||||
tableColumns.value.forEach((tableColumn) => {
|
tableColumns.value.forEach((tableColumn) => {
|
||||||
Object.keys(item).forEach((name) => {
|
Object.keys(item).forEach((name) => {
|
||||||
if (tableColumn.key === name) {
|
if (tableColumn.key === name) {
|
||||||
@ -147,11 +147,11 @@ const exportData = () => {
|
|||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
function exportToExcel(headerList, bodyList) {
|
function exportToExcel(headerList: any, bodyList: any) {
|
||||||
let excelList = [];
|
let excelList = [];
|
||||||
excelList.push(headerList.join("\t,"));
|
excelList.push(headerList.join("\t,"));
|
||||||
excelList.push("\n");
|
excelList.push("\n");
|
||||||
bodyList.forEach((item) => {
|
bodyList.forEach((item: any) => {
|
||||||
excelList.push(item.join("\t,"));
|
excelList.push(item.join("\t,"));
|
||||||
excelList.push("\n");
|
excelList.push("\n");
|
||||||
});
|
});
|
||||||
@ -218,23 +218,23 @@ onMounted(() => {
|
|||||||
<slot name="toolbar"></slot>
|
<slot name="toolbar"></slot>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="defaultToolbar" class="layui-table-tool-self">
|
<div v-if="defaultToolbar" class="layui-table-tool-self">
|
||||||
<LayDropdown>
|
<lay-dropdown>
|
||||||
<div class="layui-inline" title="筛选列" lay-event="LAYTABLE_PRINT">
|
<div class="layui-inline" title="筛选列" lay-event="LAYTABLE_PRINT">
|
||||||
<i class="layui-icon layui-icon-cols"></i>
|
<i class="layui-icon layui-icon-cols"></i>
|
||||||
</div>
|
</div>
|
||||||
<template #content>
|
<template #content>
|
||||||
<div style="padding: 10px">
|
<div style="padding: 10px">
|
||||||
<LayCheckbox
|
<lay-checkbox
|
||||||
v-for="column in columns"
|
v-for="column in columns"
|
||||||
:key="column"
|
|
||||||
v-model="tableColumnKeys"
|
v-model="tableColumnKeys"
|
||||||
skin="primary"
|
skin="primary"
|
||||||
|
:key="column.key"
|
||||||
:label="column.key"
|
:label="column.key"
|
||||||
>{{ column.title }}</LayCheckbox
|
>{{ column.title }}</lay-checkbox
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</LayDropdown>
|
</lay-dropdown>
|
||||||
<div
|
<div
|
||||||
class="layui-inline"
|
class="layui-inline"
|
||||||
title="导出"
|
title="导出"
|
||||||
@ -262,7 +262,7 @@ onMounted(() => {
|
|||||||
<tr>
|
<tr>
|
||||||
<th v-if="checkbox" class="layui-table-col-special">
|
<th v-if="checkbox" class="layui-table-col-special">
|
||||||
<div class="layui-table-cell laytable-cell-checkbox">
|
<div class="layui-table-cell laytable-cell-checkbox">
|
||||||
<LayCheckbox
|
<lay-checkbox
|
||||||
v-model="allChecked"
|
v-model="allChecked"
|
||||||
skin="primary"
|
skin="primary"
|
||||||
label="all"
|
label="all"
|
||||||
@ -324,7 +324,7 @@ onMounted(() => {
|
|||||||
<!-- 复选框 -->
|
<!-- 复选框 -->
|
||||||
<td v-if="checkbox" class="layui-table-col-special">
|
<td v-if="checkbox" class="layui-table-col-special">
|
||||||
<div class="layui-table-cell laytable-cell-checkbox">
|
<div class="layui-table-cell laytable-cell-checkbox">
|
||||||
<LayCheckbox
|
<lay-checkbox
|
||||||
v-model="tableSelectedKeys"
|
v-model="tableSelectedKeys"
|
||||||
skin="primary"
|
skin="primary"
|
||||||
:label="data[id]"
|
:label="data[id]"
|
||||||
@ -401,7 +401,7 @@ onMounted(() => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="page" class="layui-table-page">
|
<div v-if="page" class="layui-table-page">
|
||||||
<LayPage
|
<lay-page
|
||||||
:total="page.total"
|
:total="page.total"
|
||||||
:limit="page.limit"
|
:limit="page.limit"
|
||||||
v-model="page.current"
|
v-model="page.current"
|
||||||
@ -410,10 +410,10 @@ onMounted(() => {
|
|||||||
show-skip
|
show-skip
|
||||||
@jump="change"
|
@jump="change"
|
||||||
>
|
>
|
||||||
<template #prev><LayIcon type="layui-icon-left" /></template>
|
<template #prev><lay-icon type="layui-icon-left" /></template>
|
||||||
<template #next><LayIcon type="layui-icon-right" /></template>
|
<template #next><lay-icon type="layui-icon-right" /></template>
|
||||||
</LayPage>
|
</lay-page>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
@ -1 +0,0 @@
|
|||||||
import { Recordable } from "../../types";
|
|
Loading…
x
Reference in New Issue
Block a user