Compare commits

...

3 Commits

Author SHA1 Message Date
a19040aa60 格式化 2023-05-05 09:59:16 +08:00
1686971f8c add soultable 下载名称 自动隐藏 2023-05-05 09:58:29 +08:00
cb5a696c09 fix tree 2023-04-25 08:58:54 +08:00
12 changed files with 332 additions and 215 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -23,7 +23,8 @@ const _sfc_main$1 = defineComponent({
selectedKey: null,
checkStrictly: { type: [Boolean, String] },
collapseTransition: { type: Boolean },
onlyIconControl: { type: Boolean }
onlyIconControl: { type: Boolean },
hideicon: { type: Boolean }
},
emits: ["node-click"],
setup(__props, { emit }) {
@ -42,6 +43,9 @@ const _sfc_main$1 = defineComponent({
if (node.children.length !== 0) {
return !node.isLeaf ? "layui-icon-addition" : "layui-icon-subtraction";
}
if (props.hideicon) {
return "";
}
return "layui-icon-file";
};
function recursiveNodeClick(node) {
@ -161,6 +165,7 @@ const _sfc_main$1 = defineComponent({
"collapse-transition": __props.collapseTransition,
checkStrictly: __props.checkStrictly,
"only-icon-control": __props.onlyIconControl,
hideicon: props.hideicon,
onNodeClick: recursiveNodeClick
}, createSlots({ _: 2 }, [
_ctx.$slots.title ? {
@ -172,7 +177,7 @@ const _sfc_main$1 = defineComponent({
]),
key: "0"
} : void 0
]), 1032, ["tree", "node-list", "show-checkbox", "show-line", "selected-key", "collapse-transition", "checkStrictly", "only-icon-control"])
]), 1032, ["tree", "node-list", "show-checkbox", "show-line", "selected-key", "collapse-transition", "checkStrictly", "only-icon-control", "hideicon"])
])) : createCommentVNode("", true)
]),
_: 2
@ -377,7 +382,8 @@ const _sfc_main = defineComponent({
children: "children",
title: "title"
};
} }
} },
hideicon: { type: Boolean }
},
emits: ["update:checkedKeys", "update:expandKeys", "node-click"],
setup(__props, { emit }) {
@ -439,7 +445,8 @@ const _sfc_main = defineComponent({
"check-strictly": __props.checkStrictly,
"collapse-transition": __props.collapseTransition,
"only-icon-control": __props.onlyIconControl,
onNodeClick: handleClick
onNodeClick: handleClick,
hideicon: props.hideicon
}, createSlots({ _: 2 }, [
_ctx.$slots.title ? {
name: "title",
@ -448,7 +455,7 @@ const _sfc_main = defineComponent({
]),
key: "0"
} : void 0
]), 1032, ["tree", "node-list", "show-checkbox", "show-line", "selectedKey", "check-strictly", "collapse-transition", "only-icon-control"])
]), 1032, ["tree", "node-list", "show-checkbox", "show-line", "selectedKey", "check-strictly", "collapse-transition", "only-icon-control", "hideicon"])
], 2);
};
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -52,6 +52,7 @@ export interface TableProps {
loading?: boolean;
getCheckboxProps?: Function;
getRadioProps?: Function;
download?: string;
}
const props = withDefaults(defineProps<TableProps>(), {
@ -76,6 +77,7 @@ const props = withDefaults(defineProps<TableProps>(), {
loading: false,
getCheckboxProps: () => {},
getRadioProps: () => {},
download: "",
});
const emit = defineEmits([
@ -286,7 +288,7 @@ watch(
const changeAll = (isChecked: boolean) => {
if (isChecked) {
const datasources = props.dataSource.filter((item: any, index: number) => {
const datasources = datalist.value.filter((item: any, index: number) => {
return !props.getCheckboxProps(item, index)?.disabled;
});
const ids = datasources.map((item) => {
@ -387,7 +389,7 @@ const exportData = () => {
}
tableStr += "</tr>";
}
tableDataSource.value.forEach((item, rowIndex) => {
datalist.value.forEach((item, rowIndex) => {
tableStr += "<tr>";
tableBodyColumns.value.forEach((tableColumn, columnIndex) => {
Object.keys(item).forEach((name) => {
@ -421,7 +423,11 @@ const exportData = () => {
<table syle="table-layout: fixed;word-wrap: break-word; word-break: break-all;">${tableStr}</table>
</body>
</html>`;
window.location.href = uri + base64(exportTemplate);
let a = document.createElement("a");
a.href = uri + base64(exportTemplate);
a.download = (props.download || "下载文件") + ".xls";
a.click();
// window.location.href =
return;
};
@ -1133,9 +1139,11 @@ window.addEventListener("click", heddin);
:top="soultop"
:left="soulleft"
v-show="soulkey == column.key"
:show="soulkey == column.key"
@asc="asc"
@desc="desc"
:list="props.dataSource"
@daochu="exportData"
:list="datalist"
:soulkey="column.key"
@sx="sx"
></soultable>

View File

@ -6,7 +6,7 @@
position: absolute;
z-index: 2147483647;
min-width: 160px;
max-width: 300px;
max-width: 320px;
overflow-y: auto;
border: 1px solid #e6e6e6;
border-radius: 5px;

View File

@ -4,7 +4,7 @@
:style="`top: ${props.top}px;left:${props.left}px`"
@click.stop=""
>
<ul>
<ul @mouseover="shubiao">
<li @click="asc" class="soul-sort" data-value="asc" style="">
<i class="soul-icon soul-icon-asc"></i> 升序排列
</li>
@ -18,9 +18,21 @@
</li>
<!-- <li class="soul-column" style=""><i class="layui-icon layui-icon-table"></i> 表格列 <i
class="layui-icon layui-icon-right" style="float: right"></i></li> -->
<li class="soul-dropList" style="" @mouseover="selshow = true">
<i class="soul-icon soul-icon-drop-list"></i> 筛选数据
<i class="layui-icon layui-icon-right" style="float: right"></i>
<li class="soul-dropList" style="" show="select">
<i class="soul-icon soul-icon-drop-list" show="select"></i> 筛选数据
<i
class="layui-icon layui-icon-right"
style="float: right"
show="select"
></i>
</li>
<li
@click="daochu"
class="soul-sort"
data-value="desc"
style="border-bottom: 1px solid rgb(230, 230, 230)"
>
<i class="soul-icon soul-icon-download"></i> 导出excel
</li>
<!-- <li class="soul-condition" style=""><i class="soul-icon soul-icon-query"></i> 筛选条件 <i
class="layui-icon layui-icon-right" style="float: right"></i></li>
@ -35,7 +47,7 @@
placeholder="关键字搜索"
>
</lay-input>
<div class="check" style="min-width: 180px">
<div class="check" style="min-width: 190px">
<div class="multiOption" data-type="all" @click="select(1)">
<i class="soul-icon"></i> 全选
</div>
@ -46,7 +58,7 @@
<i class="soul-icon"></i>反选
</div>
</div>
<ul>
<ul style="max-height: 300px; overflow: auto">
<LayCheckboxGroup v-model="sel">
<li v-for="(i, j) in list">
<LayCheckbox skin="primary" :value="i"></LayCheckbox>{{ i }}
@ -68,34 +80,40 @@ export interface SoulTableProps {
top: number;
list: any;
soulkey: string;
show: boolean;
}
const props = withDefaults(defineProps<SoulTableProps>(), {
top: 10,
left: 10,
list: [],
soulkey: "",
show: false,
});
const emit = defineEmits(["asc", "desc", "sx"]);
const emit = defineEmits(["asc", "desc", "sx", "daochu"]);
function asc(event: any) {
emit("asc", event);
}
function desc(event: any) {
emit("desc", event);
}
function daochu() {
emit("daochu");
}
const sel: any = ref([]);
const list: any = ref([]);
const alllist: any = ref([]);
watch(
() => [props.list, props.soulkey],
() => [props.show],
() => {
let set = new Set();
for (let i of props.list) {
set.add(i[props.soulkey]);
console.log(i, i[props.soulkey]);
// console.log(i, i[props.soulkey]);
}
alllist.value = Array.from(set);
list.value = alllist.value;
console.log(list.value);
selshow.value = false;
// console.log(list.value);
},
{ deep: true }
);
@ -143,4 +161,12 @@ function select(type: number) {
}
}
const selshow = ref(false);
function shubiao(event: any) {
console.log(event, 160);
if (event.target.getAttribute("show") == "select") {
selshow.value = true;
} else {
selshow.value = false;
}
}
</script>

View File

@ -35,6 +35,7 @@ export interface TreeNodeProps {
checkStrictly: boolean | string;
collapseTransition: boolean;
onlyIconControl: boolean;
hideicon?: boolean;
}
interface TreeNodeEmits {
@ -69,6 +70,9 @@ const nodeIconType = (node: TreeData): string => {
if (node.children.length !== 0) {
return !node.isLeaf ? "layui-icon-addition" : "layui-icon-subtraction";
}
if (props.hideicon) {
return "";
}
return "layui-icon-file";
};
@ -193,6 +197,7 @@ const isChildAllSelected = computed(() => {
:collapse-transition="collapseTransition"
:checkStrictly="checkStrictly"
:only-icon-control="onlyIconControl"
:hideicon="props.hideicon"
@node-click="recursiveNodeClick"
>
<template v-if="$slots.title" v-slot:title="slotProp: { data: any }">

View File

@ -38,6 +38,7 @@ export interface TreeProps {
showLine?: boolean;
showCheckbox?: boolean;
replaceFields?: ReplaceFieldsOptions;
hideicon?: boolean;
}
interface TreeEmits {
@ -144,6 +145,7 @@ function handleClick(node: TreeData) {
:collapse-transition="collapseTransition"
:only-icon-control="onlyIconControl"
@node-click="handleClick"
:hideicon="props.hideicon"
>
<template v-if="$slots.title" v-slot:title="{ data }">
<slot name="title" :data="data"></slot>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long