Compare commits

..

No commits in common. "9184185de25c5e300ee1f63ba8e55786da4055e3" and "d9127dfd420187490f159404d0cdd44cefc4c7c2" have entirely different histories.

8 changed files with 134 additions and 201 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -47,18 +47,7 @@ const emit = defineEmits([
"update:selectedKeys", "update:selectedKeys",
"update:selectedKey", "update:selectedKey",
]); ]);
function toThousands(num: number | string) {
if (typeof num == "string") {
num = parseFloat(num || "0");
}
let xs = num.toString().split(".")[1];
let zs = num.toString().split(".")[0];
let jg =
(zs || 0).toString().replace(/(\d)(?=(?:\d{3})+$)/g, "$1,") +
(xs ? "." + xs : "");
console.log(jg);
return jg;
}
const props = withDefaults(defineProps<TableRowProps>(), { const props = withDefaults(defineProps<TableRowProps>(), {
checkbox: false, checkbox: false,
childrenColumnName: "children", childrenColumnName: "children",
@ -617,20 +606,12 @@ const radioProps = props.getRadioProps(props.data, props.index);
:content="data[column.key]" :content="data[column.key]"
:isAutoShow="true" :isAutoShow="true"
> >
{{ {{ data[column.key] }}
column.qfw
? toThousands(data[column.key])
: data[column.key]
}}
</lay-tooltip> </lay-tooltip>
<template v-else> <template v-else>
<template v-if="column.edit"> <template v-if="column.edit">
<span v-if="!editIndex[columnIndex]"> <span v-if="!editIndex[columnIndex]">
{{ {{ data[column.key] }}
column.qfw
? toThousands(data[column.key])
: data[column.key]
}}
</span> </span>
<lay-input <lay-input
:autofocus="true" :autofocus="true"
@ -640,13 +621,7 @@ const radioProps = props.getRadioProps(props.data, props.index);
@blur="editIndex[columnIndex] = false" @blur="editIndex[columnIndex] = false"
></lay-input> ></lay-input>
</template> </template>
<span v-else> <span v-else> {{ data[column.key] }} </span>
{{
column.qfw
? toThousands(data[column.key])
: data[column.key]
}}
</span>
</template> </template>
</div> </div>
</td> </td>

View File

@ -99,7 +99,6 @@ const tableRef = ref();
const datalist = ref([...props.dataSource]); const datalist = ref([...props.dataSource]);
console.log(datalist.value, 97); console.log(datalist.value, 97);
console.log("表格初始化", 97);
const s = ""; const s = "";
const allChecked = ref(false); const allChecked = ref(false);
const hasChecked = ref(false); const hasChecked = ref(false);
@ -273,7 +272,6 @@ const tableSelectedKey: WritableComputedRef<string> = computed({
watch( watch(
() => props.dataSource, () => props.dataSource,
() => { () => {
console.log("table数据更新");
tableDataSource.value = [...props.dataSource]; tableDataSource.value = [...props.dataSource];
// if(!props.page){ // if(!props.page){
// datalist.value = [...props.dataSource] // datalist.value = [...props.dataSource]
@ -346,13 +344,18 @@ watch(tableDataSource, () => {
tmp.total = tableDataSource.value.length; tmp.total = tableDataSource.value.length;
emit("update:page", tmp); emit("update:page", tmp);
// tableDataSource.value = endlist // tableDataSource.value = endlist
sxlist.value = [];
change({ change({
limit: props.page.limit, limit: props.page.limit,
current: pagecurrent || props.page.current, current: pagecurrent || props.page.current,
}); });
} }
}); });
watch(
() => props.page,
() => {
console.log(props.page, 342);
}
);
let pagecurrent: number; let pagecurrent: number;
const change = function (page: any) { const change = function (page: any) {
if (props.serverpage) { if (props.serverpage) {
@ -759,7 +762,7 @@ const soultop = ref(0);
const soulleft = ref(0); const soulleft = ref(0);
const selcolumn = ref<any>({}); const selcolumn = ref<any>({});
const soulkey = ref(""); const soulkey = ref("");
const sxlist: any = ref([]); const sxlist: any = ref({});
function showsoul(event: MouseEvent, column: any, key: string) { function showsoul(event: MouseEvent, column: any, key: string) {
console.log(event); console.log(event);
soulleft.value = event.pageX; soulleft.value = event.pageX;
@ -783,17 +786,10 @@ function desc(event: any) {
function sx(e: any) { function sx(e: any) {
sxlist.value[e.key] = e.list; sxlist.value[e.key] = e.list;
} }
watch(sxlist, () => {
console.log("sxlist更新");
});
watch( watch(
[sxlist, () => props.dataSource], sxlist,
(old, new1) => { () => {
// tableDataSource // tableDataSource
// console.log(JSON.stringify(sxlist.value),JSON.stringify(props.dataSource),old[0] == new1[0],old[1] == new1[1])
if (sxlist.value.length == 0) {
return;
}
let list: any = [...props.dataSource]; let list: any = [...props.dataSource];
let endlist: any = []; let endlist: any = [];
for (let i in sxlist.value) { for (let i in sxlist.value) {
@ -810,18 +806,16 @@ watch(
endlist.push(i); endlist.push(i);
} }
} }
if (!props.page || props.serverpage) { if (!props.page) {
nextTick(() => { datalist.value = endlist;
datalist.value = endlist;
});
} else { } else {
tableDataSource.value = endlist; tableDataSource.value = endlist;
change({ change({
limit: props.page.limit, limit: props.page.limit,
current: pagecurrent || props.page.current, current: pagecurrent || props.page.current,
isReload: true,
}); });
} }
console.log("筛选", endlist);
}, },
{ {
deep: true, deep: true,

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long