From f1059dfc6323b092acb6b73d109926db071c4a4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=89=E8=99=B9=E7=9D=BF?= <297504645@qq.com> Date: Wed, 5 Jul 2023 13:32:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=9B=98=E7=82=B9=EF=BC=9A?= =?UTF-8?q?=E7=AD=9B=E9=80=89=E5=90=8C=E7=B1=BB=E5=9E=8B=EF=BC=9A=E5=A4=9A?= =?UTF-8?q?=E7=A7=8D=E6=9D=A1=E4=BB=B6=E4=B8=94=E5=A4=9A=E9=80=89=E6=8B=BC?= =?UTF-8?q?=E6=8E=A5=EF=BC=8C=E4=B8=8E=E9=80=89=E6=8B=A9=E6=9D=A1=E4=BB=B6?= =?UTF-8?q?=E9=9C=80=E8=A6=81=E5=90=8C=E6=AD=A5=E5=85=B1=E5=AD=98bug?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/StepsCountPlanForm/index.vue | 86 ++++++++----------- 1 file changed, 38 insertions(+), 48 deletions(-) diff --git a/fe/PC/src/components/StepsCountPlanForm/index.vue b/fe/PC/src/components/StepsCountPlanForm/index.vue index 4638f2a79..672d1c36f 100644 --- a/fe/PC/src/components/StepsCountPlanForm/index.vue +++ b/fe/PC/src/components/StepsCountPlanForm/index.vue @@ -388,7 +388,11 @@ export default { }, { value: '!=', label: '不等于' - }] + }], + // 用户筛选暂存(如果筛选是code:value值为数组的格式) + filterOptionCopyForMutiple:[], + // 库位筛选,默认去掉的库位代码 + filterCodeExclude:'INSPECT,HOLD,TRANSFERONTHEWAY', }; }, mounted() { @@ -436,28 +440,8 @@ export default { }, // 点击筛选按钮 20230704 sxBtnClickHandle(data){ - // 如果是code回显为一条数据处理 - let _values = [] - let _option = null - let _new = [] - data.forEach((item,key)=>{ - if(item.column == 'code' && (item.action == '==' || item.action == '!=')){ - _values.push(item.value) - _option = item - }else{ - _new.push(item) - } - }) - if(_option){ - let _item = { - action: _option.action, - column: _option.column, - logic: "And", - value: _values.join(','), - } - _new.push(_item) - this.$refs.searchTable.setScreenDataFilters(_new) - } + // 合并code多选,进行回显 20230705更新 + this.$refs.searchTable.setScreenDataFilters(this.filterOptionCopyForMutiple) }, //确定筛选 advancedFilter(url, list, TotalCount, data, oldSkipCount) { @@ -475,36 +459,42 @@ export default { value: type_value, hide:true } + // 库位筛选,默认去掉的库位代码 + let _filter_code = { + action: "!=", + column: "code", + logic: "And", + value: this.filterCodeExclude, + hide: true + } if(this.pageListLocation.condition.filters.length <= 0){ this.pageListLocation.condition.filters.push(_filter) + this.pageListLocation.condition.filters.push(_filter_code) } - let _code_value = [] - let _code_option = null - list.condition.filters.forEach((item,key)=>{ - // if(item.action == '!=' && item.column == 'type' && item.value == type_value){ - // item.hide = true - // } - // code多选(只针对与等于和不等于)20230704 - if(item.column == 'code'){ - _code_value = item.value.split(',') - _code_option = item - list.condition.filters.splice(key,1) - } - }) - // 拆分code多选,回传给接口 20230704 - _code_value.forEach((value,index)=>{ - // 不等于情况(And),等于情况(如果key等于0是 And,其余的是 Or) - let _logic = (_code_option.action == '!=') ? "And" : (index == 0 ? "And" : "Or") - if(value && value.length > 0){ - let _item = { - action: _code_option.action, - column: _code_option.column, - logic: _logic, - value: value, - } - list.condition.filters.push(_item) + // code多选处理 20230705更新 + this.filterOptionCopyForMutiple = JSON.parse(JSON.stringify(list.condition.filters)) + let _filters = [] + // 拆分code多选,回传给接口 + this.filterOptionCopyForMutiple.forEach((option)=>{ + if(option.column == 'code'){ + option.value.split(',').forEach((val,val_index)=>{ + // 如果是第一位 则是用户选择的条件 否则判断是否为!= (And) 还是 == (Or) + let _logic = val_index == 0 ? option.logic : (option.action == '!=' ? 'And' : 'Or') + if((val || val == 0) && val.length > 0){ + let _item = { + action: option.action, + column: option.column, + logic: _logic, + value: val, + } + _filters.push(_item) + } + }) + }else{ + _filters.push(option) } }) + list.condition.filters = _filters getPageList(list, url) .then((res) => { this[data] = res.items;