diff --git a/src/views/publicService/proMaterials/index.vue b/src/views/publicService/proMaterials/index.vue index 073947b..e52b10e 100644 --- a/src/views/publicService/proMaterials/index.vue +++ b/src/views/publicService/proMaterials/index.vue @@ -150,16 +150,29 @@ export default { // 多选筛选逻辑 filterMaterials() { - console.log(this.selectedTypes) - if (this.selectedTypes.length === 0) { - this.showProMaterialsDuctList = this.proMaterialsListAll; - } else { - this.showProMaterialsDuctList = this.proMaterialsListAll.filter(item => { - return this.selectedTypes.includes(item.fileType.toString()); - }); - } + this.updateFilteredList() }, + // 统一的筛选方法 + updateFilteredList() { + let filtered = this.proMaterialsListAll; + + // 应用分类筛选 + if (this.activeTypeValue !== 'all') { + filtered = filtered.filter(item => item.typeId === Number(this.activeTypeValue)); + } + + // 应用类型筛选 + if (this.selectedTypes.length > 0) { + filtered = filtered.filter(item => + this.selectedTypes.includes(item.fileType.toString()) + ); + } + + this.showProMaterialsDuctList = filtered; + }, + + // 获取产品卡片宽度 getItemWidth() { this.itemWidth = (this.$refs.servicesGrid?.clientWidth - 120) / 4 @@ -283,14 +296,8 @@ export default { // 监听分类变化 watch: { - activeTypeValue(newVal) { - if (newVal === 'all') { - this.showProMaterialsDuctList = this.proMaterialsListAll - } else { - this.showProMaterialsDuctList = this.proMaterialsListAll.filter( - (item) => item.typeId === Number(newVal), - ) - } + activeTypeValue() { + this.updateFilteredList(); }, }, } diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue index 5ee2d0a..7c45525 100644 --- a/src/views/system/user/index.vue +++ b/src/views/system/user/index.vue @@ -577,6 +577,7 @@ export default { // 保存原始的 postIds 和 roleIds 值 const originalPostIds = this.form.postIds; const originalRoleIds = this.form.roleIds; + const originalPermissions = [...this.form.permissions]; // 保存原始权限数组 this.form.postIds = Array.isArray(this.form.postIds) ? this.form.postIds : [this.form.postIds]; this.form.roleIds = Array.isArray(this.form.roleIds) ? this.form.roleIds : [this.form.roleIds]; @@ -602,6 +603,7 @@ export default { // 如果更新失败,恢复原始值 this.form.postIds = originalPostIds; this.form.roleIds = originalRoleIds; + this.form.permissions = originalPermissions; // 恢复原始权限值 }) } else { addUser(this.form).then(response => { @@ -612,6 +614,7 @@ export default { // 如果更新失败,恢复原始值 this.form.postIds = originalPostIds; this.form.roleIds = originalRoleIds; + this.form.permissions = originalPermissions; // 恢复原始权限值 }) } }