From bb09cd7dac7098189f5f82609eb86ed9064d908b Mon Sep 17 00:00:00 2001 From: lion <120344285@qq.com> Date: Tue, 19 Aug 2025 16:50:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/maintenance/maintenance_rules.vue | 31 +++++++++++---------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/views/maintenance/maintenance_rules.vue b/src/views/maintenance/maintenance_rules.vue index 24687fc..b046190 100644 --- a/src/views/maintenance/maintenance_rules.vue +++ b/src/views/maintenance/maintenance_rules.vue @@ -244,6 +244,7 @@ export default { total: 0, list: [], cycleOptions: [ + { value: '0.5', label: '每半月' }, { value: '1', label: '每月' }, { value: '3', label: '每季度' }, { value: '6', label: '每半年' }, @@ -264,10 +265,10 @@ export default { { label: '起始日期设定', prop: 'start_standard', minWidth: 160, formatter: row => this.startStandardOptions.find(opt => opt.value == row.start_standard)?.label || row.start_standard }, // { label: '生成计划时机(天)', prop: 'advance_days', minWidth: 120 }, // { label: '生成计划时机(天)', prop: 'advance_days', minWidth: 120 }, - { - label: '已用于物资数', - prop: 'equipment_maintain_config_material_infos', - minWidth: 120, + { + label: '已用于物资数', + prop: 'equipment_maintain_config_material_infos', + minWidth: 120, formatter: row => row.equipment_maintain_config_material_infos ? row.equipment_maintain_config_material_infos.length : 0 }, { label: '未完成时下次计划', prop: 'next_plan_type', minWidth: 160, formatter: row => this.nextPlanOptions.find(opt => opt.value == row.next_plan_type)?.label || row.next_plan_type } @@ -324,7 +325,7 @@ export default { if (!relations || relations.length === 0) { return h('span', '-') } - + // 如果有多个规则,每行显示一个 if (relations.length === 1) { const rule = relations[0] @@ -677,7 +678,7 @@ export default { // 'filter[1][op]': 'eq', // 'filter[1][value]': '一物一码' } - + // 如果选择了分类,添加分类筛选 if (this.associateFenlei) { data['filter[1][key]'] = 'fenlei' @@ -811,7 +812,7 @@ export default { if (this.selectionTimer) { clearTimeout(this.selectionTimer) } - + this.selectionTimer = setTimeout(() => { this.selectedItems = selection this.hasSelectedItems = selection.length > 0 @@ -822,11 +823,11 @@ export default { this.$message.warning('请先选择需要关联的物资') return } - + this.isAssociating = true try { let equipment_maintain_config_material_infos = [...(this.currentRule.equipment_maintain_config_material_infos || [])] - + // 批量添加选中的物资 this.selectedItems.forEach(item => { const existingIndex = equipment_maintain_config_material_infos.findIndex( @@ -839,12 +840,12 @@ export default { }) } }) - + await saveMaintainConfig({ id: this.currentRule.id, equipment_maintain_config_material_infos: equipment_maintain_config_material_infos }) - + this.$message.success(`批量关联成功,共关联 ${this.selectedItems.length} 项物资`) this.selectedItems = [] this.hasSelectedItems = false @@ -861,11 +862,11 @@ export default { this.$message.warning('请先选择需要取消关联的物资') return } - + this.isDisassociating = true try { let equipment_maintain_config_material_infos = [...(this.currentRule.equipment_maintain_config_material_infos || [])] - + // 批量移除选中的物资 this.selectedItems.forEach(item => { const existingIndex = equipment_maintain_config_material_infos.findIndex( @@ -875,12 +876,12 @@ export default { equipment_maintain_config_material_infos.splice(existingIndex, 1) } }) - + await saveMaintainConfig({ id: this.currentRule.id, equipment_maintain_config_material_infos: equipment_maintain_config_material_infos }) - + this.$message.success(`批量取消关联成功,共取消关联 ${this.selectedItems.length} 项物资`) this.selectedItems = [] this.hasSelectedItems = false