add soultable 下载名称 自动隐藏
This commit is contained in:
@@ -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([
|
||||
@@ -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>
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,17 @@
|
||||
</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 +43,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 +54,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 +76,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 +157,14 @@ 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>
|
||||
|
||||
@@ -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 }">
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user