代码格式化
This commit is contained in:
parent
d2f4a1b2be
commit
9184185de2
@ -48,14 +48,16 @@ const emit = defineEmits([
|
|||||||
"update:selectedKey",
|
"update:selectedKey",
|
||||||
]);
|
]);
|
||||||
function toThousands(num: number | string) {
|
function toThousands(num: number | string) {
|
||||||
if(typeof num == "string"){
|
if (typeof num == "string") {
|
||||||
num = parseFloat(num || '0')
|
num = parseFloat(num || "0");
|
||||||
}
|
}
|
||||||
let xs = num.toString().split(".")[1]
|
let xs = num.toString().split(".")[1];
|
||||||
let zs = num.toString().split(".")[0]
|
let zs = num.toString().split(".")[0];
|
||||||
let jg = (zs || 0).toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') + (xs ? "." + xs : "");
|
let jg =
|
||||||
console.log(jg)
|
(zs || 0).toString().replace(/(\d)(?=(?:\d{3})+$)/g, "$1,") +
|
||||||
return jg;
|
(xs ? "." + xs : "");
|
||||||
|
console.log(jg);
|
||||||
|
return jg;
|
||||||
}
|
}
|
||||||
const props = withDefaults(defineProps<TableRowProps>(), {
|
const props = withDefaults(defineProps<TableRowProps>(), {
|
||||||
checkbox: false,
|
checkbox: false,
|
||||||
@ -615,13 +617,20 @@ const radioProps = props.getRadioProps(props.data, props.index);
|
|||||||
:content="data[column.key]"
|
:content="data[column.key]"
|
||||||
:isAutoShow="true"
|
:isAutoShow="true"
|
||||||
>
|
>
|
||||||
|
{{
|
||||||
{{ column.qfw ? toThousands(data[column.key]) : 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]">
|
||||||
{{ column.qfw ? toThousands(data[column.key]) : data[column.key] }}
|
{{
|
||||||
|
column.qfw
|
||||||
|
? toThousands(data[column.key])
|
||||||
|
: data[column.key]
|
||||||
|
}}
|
||||||
</span>
|
</span>
|
||||||
<lay-input
|
<lay-input
|
||||||
:autofocus="true"
|
:autofocus="true"
|
||||||
@ -631,7 +640,13 @@ 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> {{ column.qfw ? toThousands(data[column.key]) : data[column.key] }} </span>
|
<span v-else>
|
||||||
|
{{
|
||||||
|
column.qfw
|
||||||
|
? toThousands(data[column.key])
|
||||||
|
: data[column.key]
|
||||||
|
}}
|
||||||
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
@ -273,7 +273,7 @@ const tableSelectedKey: WritableComputedRef<string> = computed({
|
|||||||
watch(
|
watch(
|
||||||
() => props.dataSource,
|
() => props.dataSource,
|
||||||
() => {
|
() => {
|
||||||
console.log("table数据更新")
|
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,10 +346,10 @@ 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 = []
|
sxlist.value = [];
|
||||||
change({
|
change({
|
||||||
limit: props.page.limit,
|
limit: props.page.limit,
|
||||||
current: pagecurrent || props.page.current
|
current: pagecurrent || props.page.current,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -783,16 +783,16 @@ 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,()=>{
|
watch(sxlist, () => {
|
||||||
console.log("sxlist更新")
|
console.log("sxlist更新");
|
||||||
})
|
});
|
||||||
watch(
|
watch(
|
||||||
[sxlist,()=>props.dataSource],
|
[sxlist, () => props.dataSource],
|
||||||
(old,new1) => {
|
(old, new1) => {
|
||||||
// tableDataSource
|
// tableDataSource
|
||||||
// console.log(JSON.stringify(sxlist.value),JSON.stringify(props.dataSource),old[0] == new1[0],old[1] == new1[1])
|
// console.log(JSON.stringify(sxlist.value),JSON.stringify(props.dataSource),old[0] == new1[0],old[1] == new1[1])
|
||||||
if(sxlist.value.length == 0){
|
if (sxlist.value.length == 0) {
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
let list: any = [...props.dataSource];
|
let list: any = [...props.dataSource];
|
||||||
let endlist: any = [];
|
let endlist: any = [];
|
||||||
@ -811,19 +811,20 @@ watch(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!props.page || props.serverpage) {
|
if (!props.page || props.serverpage) {
|
||||||
nextTick(()=>{
|
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
|
isReload: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},{
|
},
|
||||||
deep: true
|
{
|
||||||
|
deep: true,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
window.addEventListener("click", heddin);
|
window.addEventListener("click", heddin);
|
||||||
|
@ -169,5 +169,4 @@ function shubiao(event: any) {
|
|||||||
selshow.value = false;
|
selshow.value = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user