| | |
| | | :tableData="standardTableData" |
| | | :page="page" |
| | | :isSelection="false" |
| | | :rowClassName="rowClassNameCenter" |
| | | :tableLoading="tableLoading" |
| | | @pagination="handlePagination" |
| | | :total="page.total" |
| | |
| | | import { |
| | | qualityTestStandardListPage |
| | | } from '@/api/qualityManagement/metricMaintenance.js' |
| | | import { productProcessListPage } from '@/api/basicData/productProcess.js' |
| | | import { |
| | | qualityTestStandardBindingList, |
| | | qualityTestStandardBindingAdd, |
| | |
| | | } from '@/api/qualityManagement/qualityTestStandardBinding.js' |
| | | |
| | | const { proxy } = getCurrentInstance() |
| | | |
| | | // 左侧标准列表:整行内容居中(配合样式) |
| | | const rowClassNameCenter = () => 'row-center' |
| | | |
| | | const data = reactive({ |
| | | searchForm: { |
| | |
| | | const tableLoading = ref(false) |
| | | const page = reactive({ current: 1, size: 10, total: 0 }) |
| | | |
| | | // 工序下拉(用于列表回显) |
| | | const processOptions = ref([]) |
| | | |
| | | const getProcessList = async () => { |
| | | try { |
| | | const res = await productProcessListPage({ current: 1, size: 1000 }) |
| | | if (res?.code === 200) { |
| | | const records = res?.data?.records || [] |
| | | processOptions.value = records.map((item) => ({ |
| | | label: item.processName || item.name || item.label, |
| | | value: item.id || item.processId || item.value |
| | | })) |
| | | } |
| | | } catch (error) { |
| | | console.error('获取工序列表失败:', error) |
| | | } |
| | | } |
| | | |
| | | const standardColumns = ref([ |
| | | { label: '标准编号', prop: 'standardNo', dataType: 'slot', slot: 'standardNoCell', minWidth: 160, headerSlot: 'standardNoHeader' }, |
| | | { label: '标准名称', prop: 'standardName', minWidth: 180, headerSlot: 'standardNameHeader' }, |
| | | { |
| | | label: '检测类型', |
| | | label: '类别', |
| | | prop: 'inspectType', |
| | | headerSlot: 'inspectTypeHeader', |
| | | dataType: 'tag', |
| | |
| | | return map[val] || val |
| | | } |
| | | }, |
| | | { |
| | | label: '工序', |
| | | prop: 'processId', |
| | | dataType: 'tag', |
| | | formatData: (val) => { |
| | | const target = processOptions.value.find( |
| | | (item) => String(item.value) === String(val) |
| | | ) |
| | | return target?.label || val |
| | | } |
| | | }, |
| | | { |
| | | label: '备注', |
| | | prop: 'remark', |
| | | minWidth: 160 |
| | | } |
| | | // { |
| | | // label: '状态', |
| | | // prop: 'state', |
| | |
| | | bindingLoading.value = true |
| | | qualityTestStandardBindingList({ testStandardId: currentStandard.value.id }) |
| | | .then((res) => { |
| | | bindingTableData.value = res?.data || [] |
| | | const base = res?.data || [] |
| | | // 将当前标准的工序和备注带到绑定列表中展示 |
| | | bindingTableData.value = base.map((item) => ({ |
| | | ...item, |
| | | processId: currentStandard.value?.processId, |
| | | remark: currentStandard.value?.remark |
| | | })) |
| | | }) |
| | | .finally(() => { |
| | | bindingLoading.value = false |
| | |
| | | |
| | | onMounted(() => { |
| | | getStandardList() |
| | | getProcessList() |
| | | }) |
| | | </script> |
| | | |