| | |
| | | function handleConfirm() { |
| | | const rows = multiple.value ? getMultipleSelectedRows() : selectedRows.value; |
| | | if (rows.length === 0) { |
| | | message.warning(multiple.value ? '请至少选择一条数据' : '请选择一条数据'); |
| | | message.warning(multiple.value ? '请至少选择一个品种' : '请选择一个品种'); |
| | | return; |
| | | } |
| | | emit('selected', multiple.value ? rows : [rows[0]!]); |
| | |
| | | <template> |
| | | <Modal |
| | | v-model:open="open" |
| | | title="物料选择" |
| | | title="品种选择" |
| | | width="80%" |
| | | :destroy-on-close="true" |
| | | @ok="handleConfirm" |
| | | @cancel="closeModal" |
| | | > |
| | | <Grid table-title="物料列表"> |
| | | <Grid table-title="品种列表"> |
| | | <template #categoryId="{ row }"> |
| | | <Tag v-if="getCategoryColor(row.categoryId)" :color="getCategoryColor(row.categoryId)">{{ getCategoryName(row.categoryId) }}</Tag> |
| | | <span v-else>{{ getCategoryName(row.categoryId) || '-' }}</span> |