update at 2026-02-13 23:06:13

This commit is contained in:
douboer@gmail.com
2026-02-13 23:06:13 +08:00
parent fa492ac3f8
commit 43ec2cc96f
2 changed files with 22 additions and 5 deletions

View File

@@ -221,6 +221,17 @@ function normalizeColumnIndexArray(indices) {
.sort((a, b) => a - b);
}
/**
* 将列索引数组转换为布尔映射,供 WXML 直接按下标判断选中态。
*/
function buildColumnSelectedMap(indices) {
const map = {};
normalizeColumnIndexArray(indices).forEach((index) => {
map[index] = true;
});
return map;
}
/**
* 统一错误文案:
* - xlsx 解析能力缺失时,固定提示用户去“构建 npm”
@@ -530,6 +541,8 @@ Page({
sourceDataColumn: null,
sourceDescriptionColumns: [],
targetDescriptionColumns: [],
sourceDescSelectedMap: {},
targetDescSelectedMap: {},
sectionVisibleSourceData: true,
sectionVisibleSourceDesc: true,
sectionVisibleTargetDesc: true,
@@ -950,7 +963,9 @@ Page({
tableRows: rows,
sourceDataColumn,
sourceDescriptionColumns,
targetDescriptionColumns
targetDescriptionColumns,
sourceDescSelectedMap: buildColumnSelectedMap(sourceDescriptionColumns),
targetDescSelectedMap: buildColumnSelectedMap(targetDescriptionColumns)
},
() => {
this.rebuildSankey();
@@ -982,7 +997,8 @@ Page({
: normalizeColumnIndexArray(current.concat(index));
this.setData(
{
sourceDescriptionColumns: next
sourceDescriptionColumns: next,
sourceDescSelectedMap: buildColumnSelectedMap(next)
},
() => {
this.rebuildSankey();
@@ -1002,7 +1018,8 @@ Page({
: normalizeColumnIndexArray(current.concat(index));
this.setData(
{
targetDescriptionColumns: next
targetDescriptionColumns: next,
targetDescSelectedMap: buildColumnSelectedMap(next)
},
() => {
this.rebuildSankey();