wujingjing
2024-11-04 943c2f5d3358fb7839d3a208c12359b02be0faa9
Merge branch 'test' of http://47.103.154.90:83/r/WI/Web.V1.0 into test
已修改1个文件
34 ■■■■ 文件已修改
src/components/chat/chatComponents/summaryCom/components/recordSetTable/RecordSetTable.vue 34 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/chat/chatComponents/summaryCom/components/recordSetTable/RecordSetTable.vue
@@ -113,6 +113,7 @@
import { PATH_ICON } from '../../../common';
import { ChartTypeEnum } from '../../../types';
import { axisLabelFormatter } from '/@/utils/chart';
import { Local } from '/@/utils/storage';
const props = defineProps({
    data: {
@@ -146,8 +147,10 @@
};
const isTotalTable = computed(() => checkIsTotalTable(props.data));
const getTableCols = (propsData) => {
    const current = propsData?.cols ?? [];
    if (checkIsTotalTable(propsData)) {
        current.push({
            title: '比例',
@@ -219,6 +222,20 @@
const tableValues = ref(getTableValues(props.data));
const colList = ref([]);
const storeCols = (originCols: any[]) => {
    let isStored = false;
    if (originCols.length === 0) return [isStored, originCols];
    const key = originCols.map((item) => item.title).join(',');
    if (!key) return [isStored, originCols];
    const storeValue = Local.get(key);
    if (!storeValue) {
        Local.set(key, originCols);
    }
    return [!!storeValue, storeValue];
};
watchEffect(() => {
    colList.value =
        tableCols.value?.map((item, index) => {
@@ -291,9 +308,7 @@
        return values;
    }
    const groupData = getItemMap(values,curGroupIndex,true)
    const groupData = getItemMap(values, curGroupIndex, true);
    // 顺延下一个分组
    i++;
    // 重新排布一下位置,保证 group 相邻,同时打上 rowspan
@@ -311,7 +326,7 @@
    return result;
};
 const getItemMap = <T>(arr: T[], defaultProps = 'ID', isMultiple = false) => {
const getItemMap = <T>(arr: T[], defaultProps = 'ID', isMultiple = false) => {
    if (!arr || arr.length === 0) return {};
    const result = arr.reduce((acc, curr) => {
@@ -319,7 +334,9 @@
            if (!acc.get(curr[defaultProps])) {
                acc.set(curr[defaultProps], [curr]);
            } else {
                {/* acc[curr[defaultProps]].push(curr); */}
                {
                    /* acc[curr[defaultProps]].push(curr); */
                }
                acc.get(curr[defaultProps]).push(curr);
            }
        } else {
@@ -359,7 +376,7 @@
    for (const item of tableValues.value) {
        item.map((subItem, index) => {
            // subItem 可能是 数字
            const subItemLen = (subItem +'')?.gblen();
            const subItemLen = (subItem + '')?.gblen();
            if (maxLenList[index] < subItemLen) {
                maxLenList[index] = subItemLen;
                maxStrList[index] = subItem;
@@ -523,18 +540,19 @@
    tableRef.value.doLayout();
    // pager.index = 1;
    chunkTableData.value = (_.chunk(tableValues.value ?? [], pager.size));
    chunkTableData.value = _.chunk(tableValues.value ?? [], pager.size);
};
//#endregion
const tableData = computed(()=>buildGroupData(chunkTableData.value[pager.index - 1]))
const tableData = computed(() => buildGroupData(chunkTableData.value[pager.index - 1]));
const reloadTable = () => {
    // 重新计算宽度
    resizeEvent({ width: containerRef.value.clientWidth, height: containerRef.value.clientHeight });
};
const colFilterChange = () => {
    // 重新计算宽度
    reloadTable();