| | |
| | | import { computed, ref, watch } from 'vue'; |
| | | |
| | | import { useVbenModal } from '@vben/common-ui'; |
| | | import { useAccess } from '@vben/access'; |
| | | import { DICT_TYPE } from '@vben/constants'; |
| | | import { getDictLabel } from '@vben/hooks'; |
| | | |
| | | import { message } from 'ant-design-vue'; |
| | | import { message, Radio } from 'ant-design-vue'; |
| | | |
| | | import { TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | | import { |
| | | deleteRouteProduct, |
| | | getRouteProductListByRoute, |
| | | setRouteProductTemplateReference, |
| | | } from '#/api/mes/pro/route/product'; |
| | | import { $t } from '#/locales'; |
| | | |
| | |
| | | |
| | | const emit = defineEmits<{ |
| | | change: [list: MesProRouteProductApi.RouteProduct[]]; |
| | | referenceChange: []; |
| | | }>(); |
| | | |
| | | const { hasAccessByCodes } = useAccess(); |
| | | const canSetTemplateReference = hasAccessByCodes(['mes:pro-route:update']); |
| | | const isEditable = computed(() => props.formType !== 'detail'); // 是否可编辑 |
| | | const list = ref<MesProRouteProductApi.RouteProduct[]>([]); // 工艺路线产品列表 |
| | | |
| | |
| | | productFormModalApi.setData({ id: row.id, routeId: props.routeId }).open(); |
| | | } |
| | | |
| | | /** 每条路线使用一个产出产品作为导入模板参考。 */ |
| | | async function handleTemplateReference(row: MesProRouteProductApi.RouteProduct) { |
| | | if (!canSetTemplateReference || !row.id || row.templateReference) return; |
| | | await setRouteProductTemplateReference(row.id); |
| | | message.success('已设置模板引用产品'); |
| | | await getList(); |
| | | emit('referenceChange'); |
| | | } |
| | | |
| | | /** 删除工艺路线产品 */ |
| | | async function handleDelete(row: MesProRouteProductApi.RouteProduct) { |
| | | await deleteRouteProduct(row.id!); |
| | |
| | | /> |
| | | </div> |
| | | <Grid class="w-full" table-title="产出产品及报工入库位置"> |
| | | <template #templateReference="{ row }"> |
| | | <Radio :checked="!!row.templateReference" :disabled="!canSetTemplateReference" @change="handleTemplateReference(row)"> |
| | | {{ row.templateReference ? '已选' : '选择' }} |
| | | </Radio> |
| | | </template> |
| | | <template #productionTime="{ row }"> |
| | | <span v-if="row.productionTime"> |
| | | {{ row.productionTime }} |