🏬增加穿梭框双击选项事件

This commit is contained in:
KaneLeung 2024-10-04 17:31:17 +08:00
parent 8c4e6178a9
commit 1197e72538

View File

@ -17,6 +17,7 @@
:disabled="item[props.options.disabled]"
:validate-event="false"
class="transfer-panel__item"
@dblclick="dbClickToRight(item)"
>
</el-checkbox>
</el-checkbox-group>
@ -54,6 +55,7 @@
:disabled="item[props.options.disabled]"
:validate-event="false"
class="transfer-panel__item"
@dblclick="dbClickToLeft(item)"
>
</el-checkbox>
</el-checkbox-group>
@ -156,6 +158,20 @@ watch(
}
);
//
const dbClickToRight = (item: any) => {
if (item[props.options.value] && item[props.options.disabled] === false) {
//
let adds = props.leftData.filter((e: any) => item[props.options.value] == e[props.options.value]);
//
let cuts = props.leftData.filter((e: any) => item[props.options.value] != e[props.options.value]);
emits('update:leftData', cuts);
emits('update:rightData', props.rightData.concat(adds));
emits('right');
state.leftChecked = state.leftChecked.filter((e: any) => item[props.options.value] != e);
}
};
//
const toRight = () => {
if (state.leftChecked?.length > 0) {
@ -185,6 +201,20 @@ const allToRight = () => {
}
};
//
const dbClickToLeft = (item: any) => {
if (item[props.options.value] && item[props.options.disabled] === false) {
//
let adds = props.rightData.filter((e: any) => item[props.options.value] == e[props.options.value]);
//
let cuts = props.rightData.filter((e: any) => item[props.options.value] != e[props.options.value]);
emits('update:leftData', props.leftData.concat(adds));
emits('update:rightData', cuts);
emits('left');
state.rightChecked = state.rightChecked.filter((e: any) => item[props.options.value] != e);
}
};
//
const toLeft = () => {
if (state.rightChecked?.length > 0) {