update at 2026-02-13 23:03:33
This commit is contained in:
@@ -203,6 +203,24 @@ function getThemeListScrollTopByIndex(index, totalCount) {
|
||||
return safeIndex * THEME_ROW_HEIGHT_PX;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将列索引数组归一化为升序数字数组,避免数字/字符串混用导致 UI 判断失效。
|
||||
*/
|
||||
function normalizeColumnIndexArray(indices) {
|
||||
const source = Array.isArray(indices) ? indices : [];
|
||||
const uniqueMap = {};
|
||||
source.forEach((item) => {
|
||||
const numeric = Number(item);
|
||||
if (!Number.isNaN(numeric) && Number.isFinite(numeric)) {
|
||||
uniqueMap[numeric] = true;
|
||||
}
|
||||
});
|
||||
|
||||
return Object.keys(uniqueMap)
|
||||
.map((item) => Number(item))
|
||||
.sort((a, b) => a - b);
|
||||
}
|
||||
|
||||
/**
|
||||
* 统一错误文案:
|
||||
* - xlsx 解析能力缺失时,固定提示用户去“构建 npm”
|
||||
@@ -957,11 +975,11 @@ Page({
|
||||
if (Number.isNaN(index)) {
|
||||
return;
|
||||
}
|
||||
const current = this.data.sourceDescriptionColumns || [];
|
||||
const current = normalizeColumnIndexArray(this.data.sourceDescriptionColumns);
|
||||
const exists = current.indexOf(index) >= 0;
|
||||
const next = exists
|
||||
? current.filter((item) => item !== index)
|
||||
: current.concat(index).sort((a, b) => a - b);
|
||||
: normalizeColumnIndexArray(current.concat(index));
|
||||
this.setData(
|
||||
{
|
||||
sourceDescriptionColumns: next
|
||||
@@ -977,11 +995,11 @@ Page({
|
||||
if (Number.isNaN(index)) {
|
||||
return;
|
||||
}
|
||||
const current = this.data.targetDescriptionColumns || [];
|
||||
const current = normalizeColumnIndexArray(this.data.targetDescriptionColumns);
|
||||
const exists = current.indexOf(index) >= 0;
|
||||
const next = exists
|
||||
? current.filter((item) => item !== index)
|
||||
: current.concat(index).sort((a, b) => a - b);
|
||||
: normalizeColumnIndexArray(current.concat(index));
|
||||
this.setData(
|
||||
{
|
||||
targetDescriptionColumns: next
|
||||
@@ -1021,8 +1039,8 @@ Page({
|
||||
},
|
||||
{
|
||||
sourceDataColumn: this.data.sourceDataColumn,
|
||||
sourceDescriptionColumns: this.data.sourceDescriptionColumns || [],
|
||||
targetDescriptionColumns: this.data.targetDescriptionColumns || [],
|
||||
sourceDescriptionColumns: normalizeColumnIndexArray(this.data.sourceDescriptionColumns),
|
||||
targetDescriptionColumns: normalizeColumnIndexArray(this.data.targetDescriptionColumns),
|
||||
delimiter: '-'
|
||||
}
|
||||
);
|
||||
|
||||
@@ -106,7 +106,7 @@
|
||||
</view>
|
||||
<view class="column-list" wx:if="{{sectionVisibleSourceData}}">
|
||||
<view class="column-list-line" />
|
||||
<view class="row" wx:for="{{columnHeaders}}" wx:key="*this" data-index="{{index}}" bindtap="onSelectSourceData">
|
||||
<view class="row" wx:for="{{columnHeaders}}" wx:key="index" data-index="{{index}}" bindtap="onSelectSourceData">
|
||||
<view class="row-link" />
|
||||
<image src="../../assets/icons/data.svg" mode="aspectFit" />
|
||||
<text class="label">{{item}}</text>
|
||||
@@ -128,12 +128,12 @@
|
||||
</view>
|
||||
<view class="column-list" wx:if="{{sectionVisibleSourceDesc}}">
|
||||
<view class="column-list-line" />
|
||||
<view class="row" wx:for="{{columnHeaders}}" wx:key="*this" data-index="{{index}}" bindtap="onToggleSourceDesc">
|
||||
<view class="row" wx:for="{{columnHeaders}}" wx:key="index" data-index="{{index}}" bindtap="onToggleSourceDesc">
|
||||
<view class="row-link" />
|
||||
<image src="../../assets/icons/description.svg" mode="aspectFit" />
|
||||
<text class="label">{{item}}</text>
|
||||
<image
|
||||
src="{{sourceDescriptionColumns.indexOf(index) > -1 ? '../../assets/icons/checkbox.svg' : '../../assets/icons/checkbox-no.svg'}}"
|
||||
src="{{(sourceDescriptionColumns.indexOf(index) > -1 || sourceDescriptionColumns.indexOf(index + '') > -1) ? '../../assets/icons/checkbox.svg' : '../../assets/icons/checkbox-no.svg'}}"
|
||||
mode="aspectFit"
|
||||
/>
|
||||
</view>
|
||||
@@ -150,12 +150,12 @@
|
||||
</view>
|
||||
<view class="column-list" wx:if="{{sectionVisibleTargetDesc}}">
|
||||
<view class="column-list-line" />
|
||||
<view class="row" wx:for="{{columnHeaders}}" wx:key="*this" data-index="{{index}}" bindtap="onToggleTargetDesc">
|
||||
<view class="row" wx:for="{{columnHeaders}}" wx:key="index" data-index="{{index}}" bindtap="onToggleTargetDesc">
|
||||
<view class="row-link" />
|
||||
<image src="../../assets/icons/description.svg" mode="aspectFit" />
|
||||
<text class="label">{{item}}</text>
|
||||
<image
|
||||
src="{{targetDescriptionColumns.indexOf(index) > -1 ? '../../assets/icons/checkbox.svg' : '../../assets/icons/checkbox-no.svg'}}"
|
||||
src="{{(targetDescriptionColumns.indexOf(index) > -1 || targetDescriptionColumns.indexOf(index + '') > -1) ? '../../assets/icons/checkbox.svg' : '../../assets/icons/checkbox-no.svg'}}"
|
||||
mode="aspectFit"
|
||||
/>
|
||||
</view>
|
||||
|
||||
Reference in New Issue
Block a user