不活跃禁用按钮
This commit is contained in:
		| @@ -24,7 +24,7 @@ | ||||
|           </div> | ||||
|         </div> | ||||
|         <div class="batch-actions"> | ||||
|           <el-button size="small" type="primary" @click.stop="showAddPenDialog(batch)">增加猪栏</el-button> | ||||
|           <el-button size="small" type="primary" @click.stop="showAddPenDialog(batch)" :disabled="!batch.is_active">增加猪栏</el-button> | ||||
|           <el-button size="small" @click.stop="emitEditBatch(batch)">编辑</el-button> | ||||
|           <el-button size="small" type="danger" @click.stop="emitDeleteBatch(batch)">删除</el-button> | ||||
|         </div> | ||||
| @@ -35,6 +35,7 @@ | ||||
|             v-for="pen in batch.pens" | ||||
|             :key="pen.id" | ||||
|             :pen="pen" | ||||
|             :isBatchActive="batch.is_active" | ||||
|             @modify-pig-count="emitModifyPigCountPen" | ||||
|             @remove="emitRemovePen" | ||||
|           /> | ||||
|   | ||||
| @@ -10,8 +10,8 @@ | ||||
|       <div class="info-item border-left">存栏: {{ pen.current_pig_count || 0 }}</div> | ||||
|     </div> | ||||
|     <div class="actions-section"> | ||||
|       <el-button size="small" @click="emitModifyPigCount">修改猪只数量</el-button> | ||||
|       <el-button size="small" type="danger" @click="emitRemove">移除</el-button> | ||||
|       <el-button size="small" @click="emitModifyPigCount" :disabled="!isBatchActive">修改猪只数量</el-button> | ||||
|       <el-button size="small" type="danger" @click="emitRemove" :disabled="!isBatchActive">移除</el-button> | ||||
|     </div> | ||||
|   </div> | ||||
| </template> | ||||
| @@ -25,6 +25,10 @@ export default { | ||||
|     pen: { | ||||
|       type: Object, | ||||
|       required: true | ||||
|     }, | ||||
|     isBatchActive: { | ||||
|       type: Boolean, | ||||
|       default: true // 默认活跃,以防万一没有传递 | ||||
|     } | ||||
|   }, | ||||
|   emits: ['remove', 'modify-pig-count'], | ||||
|   | ||||
		Reference in New Issue
	
	Block a user