From 5520c622ff56d8c09a881b8d2b8f210b33947e5e Mon Sep 17 00:00:00 2001 From: dengbf Date: Fri, 1 Dec 2023 14:34:39 +0800 Subject: [PATCH 1/2] =?UTF-8?q?-=20[=E4=BF=AE=E5=A4=8D]=20=E8=A1=A8?= =?UTF-8?q?=E5=8D=95=E8=81=94=E5=8A=A8=E4=B8=8D=E7=94=9F=E6=95=88=20=20=20?= =?UTF-8?q?=20-=20[=E5=85=B3=E8=81=94]=20#[1036195709026304]=E8=A1=A8?= =?UTF-8?q?=E5=8D=95=E7=BC=96=E8=BE=91-=E8=A1=A8=E5=8D=95=E8=81=94?= =?UTF-8?q?=E5=8A=A8=E6=B2=A1=E6=9C=89=E7=94=9F=E6=95=88=20http://192.168.?= =?UTF-8?q?0.96:8090/demo/rdm.html#/bug-detail/939050947543040/93905094754?= =?UTF-8?q?3057/1036195709026304?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TsSheet/form/conditionexpression/equal.js | 13 ++++++++++-- .../form/conditionexpression/exclude.js | 20 +++++++++++++++---- .../form/conditionexpression/include.js | 16 +++++++++++++-- .../form/conditionexpression/notequal.js | 12 +++++++++-- 4 files changed, 51 insertions(+), 10 deletions(-) diff --git a/src/resources/plugins/TsSheet/form/conditionexpression/equal.js b/src/resources/plugins/TsSheet/form/conditionexpression/equal.js index 2a607995c..f54202614 100644 --- a/src/resources/plugins/TsSheet/form/conditionexpression/equal.js +++ b/src/resources/plugins/TsSheet/form/conditionexpression/equal.js @@ -1,3 +1,4 @@ +import Vue from 'vue'; export default (currentValue, oldValue, conditionValue) => { let isEqual = false; if (currentValue == conditionValue) { @@ -8,13 +9,21 @@ export default (currentValue, oldValue, conditionValue) => { isEqual = false; } else if (currentValue instanceof Array) { if (currentValue.length === conditionValue.length) { - if (currentValue.every(cv => conditionValue.includes(cv)) && conditionValue.every(cv => currentValue.includes(cv))) { + let valueList = []; + currentValue.forEach(item => { + if (typeof item === 'object') { + valueList.push(item.value); + } else { + valueList.push(item); + } + }); + if (valueList.every(cv => conditionValue.includes(cv)) && conditionValue.every(cv => valueList.includes(cv))) { isEqual = true; } } } else { if (conditionValue.length == 1) { - if (currentValue == conditionValue[0]) { + if (currentValue == conditionValue[0] || ((typeof currentValue === 'object') && currentValue.value == conditionValue[0])) { isEqual = true; } } diff --git a/src/resources/plugins/TsSheet/form/conditionexpression/exclude.js b/src/resources/plugins/TsSheet/form/conditionexpression/exclude.js index 9287a3a90..4054cd558 100644 --- a/src/resources/plugins/TsSheet/form/conditionexpression/exclude.js +++ b/src/resources/plugins/TsSheet/form/conditionexpression/exclude.js @@ -1,13 +1,25 @@ export default (currentValue, oldValue, conditionValue) => { let isExclude = false; - if (currentValue == null || currentValue == '' || currentValue == []) { + if (currentValue == null || currentValue == '' || currentValue == [] || currentValue == {}) { isExclude = true; } else { - if (currentValue instanceof Array && conditionValue.filter(item => currentValue.some(c => c === item)).length == 0) { + if (currentValue instanceof Array) { + let valueList = []; + currentValue.forEach(item => { + if (typeof item === 'object') { + valueList.push(item.value); + } else { + valueList.push(item); + } + }); + if (conditionValue.filter(item => valueList.some(c => c === item)).length == 0) { + isExclude = true; + } + } else if (typeof currentValue == 'string' && conditionValue.indexOf(currentValue) == -1) { isExclude = true; - } else if (typeof currentValue == 'string' && conditionValue.indexOf(currentValue) != -1) { + } else if (typeof currentValue === 'object' && conditionValue.indexOf(currentValue.value) == -1) { isExclude = true; - } + } } return isExclude; }; diff --git a/src/resources/plugins/TsSheet/form/conditionexpression/include.js b/src/resources/plugins/TsSheet/form/conditionexpression/include.js index eff3863ce..2f8559fd6 100644 --- a/src/resources/plugins/TsSheet/form/conditionexpression/include.js +++ b/src/resources/plugins/TsSheet/form/conditionexpression/include.js @@ -1,10 +1,22 @@ export default (currentValue, oldValue, conditionValue) => { let isInclude = false; if (currentValue) { - if (currentValue instanceof Array && conditionValue.filter(item => currentValue.some(c => c === item)).length > 0) { - isInclude = true; + if (currentValue instanceof Array) { + let valueList = []; + currentValue.forEach(item => { + if (typeof item === 'object') { + valueList.push(item.value); + } else { + valueList.push(item); + } + }); + if (conditionValue.filter(item => valueList.some(c => c === item)).length > 0) { + isInclude = true; + } } else if (typeof currentValue == 'string' && conditionValue.indexOf(currentValue) > -1) { isInclude = true; + } else if (typeof item === 'object' && conditionValue.indexOf(currentValue.value) > -1) { + isInclude = true; } } return isInclude; diff --git a/src/resources/plugins/TsSheet/form/conditionexpression/notequal.js b/src/resources/plugins/TsSheet/form/conditionexpression/notequal.js index a024681fd..26eee2fce 100644 --- a/src/resources/plugins/TsSheet/form/conditionexpression/notequal.js +++ b/src/resources/plugins/TsSheet/form/conditionexpression/notequal.js @@ -3,16 +3,24 @@ export default (currentValue, oldValue, conditionValue) => { if (currentValue == conditionValue) { isNotEqual = false; } else if (currentValue instanceof Array) { + let valueList = []; + currentValue.forEach(item => { + if (typeof item === 'object') { + valueList.push(item.value); + } else { + valueList.push(item); + } + }); if (currentValue.length !== conditionValue.length) { isNotEqual = true; } else { - if (currentValue.some(cv => !conditionValue.includes(cv)) || conditionValue.some(cv => !currentValue.includes(cv))) { + if (valueList.some(cv => !conditionValue.includes(cv)) || conditionValue.some(cv => !valueList.includes(cv))) { isNotEqual = true; } } } else { if (conditionValue.length == 1) { - if (currentValue != conditionValue[0]) { + if (currentValue != conditionValue[0] || (typeof currentValue === 'object' && currentValue.value != conditionValue[0])) { isNotEqual = true; } } -- Gitee From b1b75ad2fa1099b096b5e955717e97f78f1c6138 Mon Sep 17 00:00:00 2001 From: dengbf Date: Fri, 1 Dec 2023 14:36:23 +0800 Subject: [PATCH 2/2] commit --- src/resources/plugins/TsSheet/form/conditionexpression/equal.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/resources/plugins/TsSheet/form/conditionexpression/equal.js b/src/resources/plugins/TsSheet/form/conditionexpression/equal.js index f54202614..2ea5729a3 100644 --- a/src/resources/plugins/TsSheet/form/conditionexpression/equal.js +++ b/src/resources/plugins/TsSheet/form/conditionexpression/equal.js @@ -1,4 +1,3 @@ -import Vue from 'vue'; export default (currentValue, oldValue, conditionValue) => { let isEqual = false; if (currentValue == conditionValue) { -- Gitee