🏬增加穿梭框双击选项事件
This commit is contained in:
parent
8c4e6178a9
commit
1197e72538
@ -17,6 +17,7 @@
|
|||||||
:disabled="item[props.options.disabled]"
|
:disabled="item[props.options.disabled]"
|
||||||
:validate-event="false"
|
:validate-event="false"
|
||||||
class="transfer-panel__item"
|
class="transfer-panel__item"
|
||||||
|
@dblclick="dbClickToRight(item)"
|
||||||
>
|
>
|
||||||
</el-checkbox>
|
</el-checkbox>
|
||||||
</el-checkbox-group>
|
</el-checkbox-group>
|
||||||
@ -54,6 +55,7 @@
|
|||||||
:disabled="item[props.options.disabled]"
|
:disabled="item[props.options.disabled]"
|
||||||
:validate-event="false"
|
:validate-event="false"
|
||||||
class="transfer-panel__item"
|
class="transfer-panel__item"
|
||||||
|
@dblclick="dbClickToLeft(item)"
|
||||||
>
|
>
|
||||||
</el-checkbox>
|
</el-checkbox>
|
||||||
</el-checkbox-group>
|
</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 = () => {
|
const toRight = () => {
|
||||||
if (state.leftChecked?.length > 0) {
|
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 = () => {
|
const toLeft = () => {
|
||||||
if (state.rightChecked?.length > 0) {
|
if (state.rightChecked?.length > 0) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user