yuan
6 小时以前 56158a98729ba25b04f7c80d88aafa59cc41a504
feat(质量维护): 优化检测项目字段并移除内控值和默认值
已修改9个文件
845 ■■■■ 文件已修改
src/views/qualityManagement/finalInspection/components/formDia.vue 129 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/qualityManagement/finalInspection/components/inspectionFormDia.vue 135 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/qualityManagement/finalInspection/index.vue 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/qualityManagement/processInspection/components/formDia.vue 129 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/qualityManagement/processInspection/components/inspectionFormDia.vue 135 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/qualityManagement/processInspection/index.vue 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/qualityManagement/rawMaterialInspection/components/formDia.vue 128 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/qualityManagement/rawMaterialInspection/components/inspectionFormDia.vue 135 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/qualityManagement/rawMaterialInspection/index.vue 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/qualityManagement/finalInspection/components/formDia.vue
@@ -108,9 +108,42 @@
                :tableLoading="tableLoading"
                height="400"
            >
                <template #slot="{ row }">
                    <el-input v-model="row.testValue" clearable/>
                </template>
                <template #instrument="{ row }">
          <el-select
              v-model="row.instrument"
              placeholder="请选择或输入"
              filterable
              allow-create
              default-first-option
              clearable
              style="width: 100%"
              @change="handleInstrumentChange(row)"
          >
            <el-option label="目测" value="目测" />
            <el-option
                v-for="item in deviceList"
                :key="item.id"
                :label="item.deviceName + (item.deviceModel ? ' / ' + item.deviceModel : '')"
                :value="item.deviceName"
            />
          </el-select>
        </template>
        <template #deviceStatus="{ row }">
          <el-tag v-if="row.deviceStatus" :type="getDeviceStatusType(row.deviceStatus)">
            {{ row.deviceStatus }}
          </el-tag>
          <span v-else style="color: #999">-</span>
        </template>
        <template #result="{ row }">
          <el-input v-model="row.result" placeholder="请输入" clearable />
        </template>
        <template #resultJudgment="{ row }">
          <el-select v-model="row.resultJudgment" placeholder="请选择" clearable style="width: 100%">
            <el-option label="合格" value="合格" />
            <el-option label="不合格" value="不合格" />
            <el-option label="/" value="/" />
          </el-select>
        </template>
            </PIMTable>
      <template #footer>
        <div class="dialog-footer">
@@ -130,6 +163,7 @@
import {userListNoPage} from "@/api/system/user.js";
import {qualityInspectDetailByProductId, getQualityTestStandardParamByTestStandardId} from "@/api/qualityManagement/metricMaintenance.js";
import {qualityInspectParamInfo} from "@/api/qualityManagement/qualityInspectParam.js";
import {deviceList as qualityInspectParamDeviceList} from "@/api/energyManagement/index.js";
const { proxy } = getCurrentInstance()
const emit = defineEmits(['close'])
@@ -173,26 +207,47 @@
const productOptions = ref([]);
const tableColumn = ref([
    {
        label: "指标",
        label: "检测项目",
        prop: "parameterItem",
        width: 150
    },
    {
        label: "标准要求",
        prop: "standardValue",
        width: 180
    },
    {
        label: "单位",
        prop: "unit",
        width: 80
    },
    {
        label: "标准值",
        prop: "standardValue",
    },
    {
        label: "内控值",
        prop: "controlValue",
    },
    {
        label: "检验值",
        prop: "testValue",
        label: "检测器具",
        prop: "instrument",
        dataType: 'slot',
        slot: 'slot',
        slot: 'instrument',
        width: 220
    },
    {
        label: "设备状态",
        prop: "deviceStatus",
        dataType: 'slot',
        slot: 'deviceStatus',
        width: 120
    },
    {
        label: "检测结果",
        prop: "result",
        dataType: 'slot',
        slot: 'result',
        minWidth: 150
    },
    {
        label: "结果判断",
        prop: "resultJudgment",
        dataType: 'slot',
        slot: 'resultJudgment',
        width: 120
    },
]);
const tableData = ref([]);
@@ -201,6 +256,7 @@
const currentProductId = ref(0);
const testStandardOptions = ref([]); // 指标选择下拉框数据
const modelOptions = ref([]);
const deviceList = ref([]);
// 打开弹框
const openDialog = async (type, row) => {
@@ -209,6 +265,8 @@
  // 先清空表单验证状态,避免闪烁
  await nextTick();
  proxy.$refs.formRef?.clearValidate();
  // 加载设备台账列表
  loadDeviceList();
  
  // 并行加载基础数据
  const [userListsRes] = await Promise.all([
@@ -404,9 +462,48 @@
}
const getQualityInspectParamList = (id) => {
    qualityInspectParamInfo(id).then(res => {
        tableData.value = res.data;
        tableData.value = (res.data || []).map(item => ({...item}));
    })
}
// 获取设备台账列表
const loadDeviceList = () => {
    qualityInspectParamDeviceList().then(res => {
        deviceList.value = res.data || [];
    });
};
// 设备状态颜色映射
const getDeviceStatusType = (status) => {
    const map = {
        '正常': 'success',
        '运行': 'primary',
        '停机': 'warning',
        '维修': 'danger'
    };
    return map[status] || 'info';
};
// 检测器具变化时,自动填充设备状态
const handleInstrumentChange = (row) => {
    if (row.instrument === '【目测】') {
        row.deviceId = null;
        row.deviceName = '【目测】';
        row.deviceStatus = '';
        return;
    }
    const device = deviceList.value.find(d => d.deviceName === row.instrument);
    if (device) {
        row.deviceId = device.id;
        row.deviceName = device.deviceName;
        row.deviceStatus = device.status || '';
    } else {
        row.deviceId = null;
        row.deviceName = row.instrument || '';
        row.deviceStatus = '';
    }
};
// 关闭弹框
const closeDia = () => {
  proxy.resetForm("formRef");
src/views/qualityManagement/finalInspection/components/inspectionFormDia.vue
@@ -3,7 +3,7 @@
    <el-dialog
        v-model="dialogFormVisible"
        title="填写检验记录"
        width="70%"
        width="95%"
        @close="closeDia"
    >
      <div style="margin-bottom: 10px;text-align: right">
@@ -18,8 +18,41 @@
          @selection-change="handleSelectionChange"
          height="600"
      >
        <template #slot="{ row }">
          <el-input v-model="row.testValue" clearable/>
        <template #instrument="{ row }">
          <el-select
              v-model="row.instrument"
              placeholder="请选择或输入"
              filterable
              allow-create
              default-first-option
              clearable
              style="width: 100%"
              @change="handleInstrumentChange(row)"
          >
            <el-option label="【目测】" value="【目测】" />
            <el-option
                v-for="item in deviceList"
                :key="item.id"
                :label="item.deviceName + (item.deviceModel ? ' / ' + item.deviceModel : '')"
                :value="item.deviceName"
            />
          </el-select>
        </template>
        <template #deviceStatus="{ row }">
          <el-tag v-if="row.deviceStatus" :type="getDeviceStatusType(row.deviceStatus)">
            {{ row.deviceStatus }}
          </el-tag>
          <span v-else style="color: #999">-</span>
        </template>
        <template #result="{ row }">
          <el-input v-model="row.result" placeholder="请输入检测结果" clearable />
        </template>
        <template #resultJudgment="{ row }">
          <el-select v-model="row.resultJudgment" placeholder="请选择" clearable style="width: 100%">
            <el-option label="合格" value="合格" />
            <el-option label="不合格" value="不合格" />
            <el-option label="/" value="/" />
          </el-select>
        </template>
      </PIMTable>
      <template #footer>
@@ -34,12 +67,12 @@
<script setup>
import {ref} from "vue";
import {Search} from "@element-plus/icons-vue";
import {
  qualityInspectParamDel,
  qualityInspectParamInfo,
  qualityInspectParamUpdate
} from "@/api/qualityManagement/qualityInspectParam.js";
import {deviceList as qualityInspectParamDeviceList} from "@/api/energyManagement/index.js";
import {ElMessageBox} from "element-plus";
const { proxy } = getCurrentInstance()
const emit = defineEmits(['close'])
@@ -48,45 +81,111 @@
const operationType = ref('')
const currentId = ref('')
const selectedRows = ref([]);
const deviceList = ref([]);
const tableColumn = ref([
  {
    label: "指标",
    label: "检测项目",
    prop: "parameterItem",
    width: 150
  },
  {
    label: "标准要求",
    prop: "standardValue",
    width: 180
  },
  {
    label: "单位",
    prop: "unit",
    width: 80
  },
  {
    label: "标准值",
    prop: "standardValue",
  },
  {
    label: "内控值",
    prop: "controlValue",
  },
  {
    label: "检验值",
    prop: "testValue",
    label: "检测器具",
    prop: "instrument",
    dataType: 'slot',
    slot: 'slot',
    slot: 'instrument',
    width: 220
  },
  {
    label: "设备状态",
    prop: "deviceStatus",
    dataType: 'slot',
    slot: 'deviceStatus',
    width: 120
  },
  {
    label: "检测结果",
    prop: "result",
    dataType: 'slot',
    slot: 'result',
    minWidth: 150
  },
  {
    label: "结果判断",
    prop: "resultJudgment",
    dataType: 'slot',
    slot: 'resultJudgment',
    width: 120
  },
]);
const tableData = ref([]);
const tableLoading = ref(false);
// 获取设备台账列表
const loadDeviceList = () => {
  qualityInspectParamDeviceList().then(res => {
    deviceList.value = res.data || [];
  });
};
// 设备状态颜色映射
const getDeviceStatusType = (status) => {
  const map = {
    '正常': 'success',
    '运行': 'primary',
    '停机': 'warning',
    '维修': 'danger'
  };
  return map[status] || 'info';
};
// 检测器具变化时,自动填充设备状态
const handleInstrumentChange = (row) => {
  if (row.instrument === '【目测】') {
    row.deviceId = null;
    row.deviceName = '【目测】';
    row.deviceStatus = '';
    return;
  }
  const device = deviceList.value.find(d => d.deviceName === row.instrument);
  if (device) {
    row.deviceId = device.id;
    row.deviceName = device.deviceName;
    row.deviceStatus = device.status || '';
  } else {
    row.deviceId = null;
    row.deviceName = row.instrument || '';
    row.deviceStatus = '';
  }
};
// 打开弹框
const openDialog = (type, row) => {
  operationType.value = type;
  dialogFormVisible.value = true;
  loadDeviceList();
  if (operationType.value === 'edit') {
    currentId.value = row.id;
    getList()
  }
}
const getList = () => {
  tableLoading.value = true;
  qualityInspectParamInfo(currentId.value).then(res => {
    tableData.value = res.data;
    tableLoading.value = false;
    tableData.value = (res.data || []).map(item => ({...item}));
  }).catch(() => {
    tableLoading.value = false;
  })
}
// 表格选择数据
@@ -136,4 +235,4 @@
<style scoped>
</style>
</style>
src/views/qualityManagement/finalInspection/index.vue
@@ -172,7 +172,7 @@
    label: "操作",
    align: "center",
    fixed: "right",
    width: 280,
    width: 340,
    operation: [
      {
        name: "编辑",
@@ -191,6 +191,20 @@
                }
      },
      {
        name: "填写检验记录",
        type: "text",
        clickFun: (row) => {
          openInspectionForm("edit", row);
        },
                disabled: (row) => {
                    if (row.inspectState == 1) return true;
                    if (row.checkName) {
                        return row.checkName !== userStore.nickName;
                    }
                    return false;
                }
      },
      {
        name: "附件",
        type: "text",
        clickFun: (row) => {
src/views/qualityManagement/processInspection/components/formDia.vue
@@ -117,9 +117,42 @@
                :tableLoading="tableLoading"
                height="400"
            >
                <template #slot="{ row }">
                    <el-input v-model="row.testValue" clearable/>
                </template>
                <template #instrument="{ row }">
          <el-select
              v-model="row.instrument"
              placeholder="请选择或输入"
              filterable
              allow-create
              default-first-option
              clearable
              style="width: 100%"
              @change="handleInstrumentChange(row)"
          >
            <el-option label="【目测】" value="【目测】" />
            <el-option
                v-for="item in deviceList"
                :key="item.id"
                :label="item.deviceName + (item.deviceModel ? ' / ' + item.deviceModel : '')"
                :value="item.deviceName"
            />
          </el-select>
        </template>
        <template #deviceStatus="{ row }">
          <el-tag v-if="row.deviceStatus" :type="getDeviceStatusType(row.deviceStatus)">
            {{ row.deviceStatus }}
          </el-tag>
          <span v-else style="color: #999">-</span>
        </template>
        <template #result="{ row }">
          <el-input v-model="row.result" placeholder="请输入" clearable />
        </template>
        <template #resultJudgment="{ row }">
          <el-select v-model="row.resultJudgment" placeholder="请选择" clearable style="width: 100%">
            <el-option label="合格" value="合格" />
            <el-option label="不合格" value="不合格" />
            <el-option label="/" value="/" />
          </el-select>
        </template>
            </PIMTable>
      <template #footer>
        <div class="dialog-footer">
@@ -139,6 +172,7 @@
import {qualityInspectDetailByProductId, getQualityTestStandardParamByTestStandardId} from "@/api/qualityManagement/metricMaintenance.js";
import {userListNoPage} from "@/api/system/user.js";
import {qualityInspectParamInfo} from "@/api/qualityManagement/qualityInspectParam.js";
import {deviceList as qualityInspectParamDeviceList} from "@/api/energyManagement/index.js";
import { list } from "@/api/productionManagement/productionProcess";
const { proxy } = getCurrentInstance()
const emit = defineEmits(['close'])
@@ -187,26 +221,47 @@
const productOptions = ref([]);
const tableColumn = ref([
    {
        label: "指标",
        label: "检测项目",
        prop: "parameterItem",
        width: 150
    },
    {
        label: "标准要求",
        prop: "standardValue",
        width: 180
    },
    {
        label: "单位",
        prop: "unit",
        width: 80
    },
    {
        label: "标准值",
        prop: "standardValue",
    },
    {
        label: "内控值",
        prop: "controlValue",
    },
    {
        label: "检验值",
        prop: "testValue",
        label: "检测器具",
        prop: "instrument",
        dataType: 'slot',
        slot: 'slot',
        slot: 'instrument',
        width: 220
    },
    {
        label: "设备状态",
        prop: "deviceStatus",
        dataType: 'slot',
        slot: 'deviceStatus',
        width: 120
    },
    {
        label: "检测结果",
        prop: "result",
        dataType: 'slot',
        slot: 'result',
        minWidth: 150
    },
    {
        label: "结果判断",
        prop: "resultJudgment",
        dataType: 'slot',
        slot: 'resultJudgment',
        width: 120
    },
]);
const tableData = ref([]);
@@ -214,6 +269,7 @@
const currentProductId = ref(0);
const testStandardOptions = ref([]); // 指标选择下拉框数据
const modelOptions = ref([]);
const deviceList = ref([]);
// 打开弹框
const openDialog = async (type, row) => {
@@ -221,6 +277,8 @@
    getOptions().then((res) => {
        supplierList.value = res.data;
    });
    // 加载设备台账列表
    loadDeviceList();
    // 加载工序下拉列表
    try {
        const res = await list();
@@ -441,9 +499,48 @@
}
const getQualityInspectParamList = (id) => {
    qualityInspectParamInfo(id).then(res => {
        tableData.value = res.data;
        tableData.value = (res.data || []).map(item => ({...item}));
    })
}
// 获取设备台账列表
const loadDeviceList = () => {
    qualityInspectParamDeviceList().then(res => {
        deviceList.value = res.data || [];
    });
};
// 设备状态颜色映射
const getDeviceStatusType = (status) => {
    const map = {
        '正常': 'success',
        '运行': 'primary',
        '停机': 'warning',
        '维修': 'danger'
    };
    return map[status] || 'info';
};
// 检测器具变化时,自动填充设备状态
const handleInstrumentChange = (row) => {
    if (row.instrument === '【目测】') {
        row.deviceId = null;
        row.deviceName = '【目测】';
        row.deviceStatus = '';
        return;
    }
    const device = deviceList.value.find(d => d.deviceName === row.instrument);
    if (device) {
        row.deviceId = device.id;
        row.deviceName = device.deviceName;
        row.deviceStatus = device.status || '';
    } else {
        row.deviceId = null;
        row.deviceName = row.instrument || '';
        row.deviceStatus = '';
    }
};
// 关闭弹框
const closeDia = () => {
  proxy.resetForm("formRef");
src/views/qualityManagement/processInspection/components/inspectionFormDia.vue
@@ -3,7 +3,7 @@
    <el-dialog
        v-model="dialogFormVisible"
        title="填写检验记录"
        width="70%"
        width="95%"
        @close="closeDia"
    >
      <div style="margin-bottom: 10px;text-align: right">
@@ -18,8 +18,41 @@
          @selection-change="handleSelectionChange"
          height="600"
      >
        <template #slot="{ row }">
          <el-input v-model="row.testValue" clearable/>
        <template #instrument="{ row }">
          <el-select
              v-model="row.instrument"
              placeholder="请选择或输入"
              filterable
              allow-create
              default-first-option
              clearable
              style="width: 100%"
              @change="handleInstrumentChange(row)"
          >
            <el-option label="【目测】" value="【目测】" />
            <el-option
                v-for="item in deviceList"
                :key="item.id"
                :label="item.deviceName + (item.deviceModel ? ' / ' + item.deviceModel : '')"
                :value="item.deviceName"
            />
          </el-select>
        </template>
        <template #deviceStatus="{ row }">
          <el-tag v-if="row.deviceStatus" :type="getDeviceStatusType(row.deviceStatus)">
            {{ row.deviceStatus }}
          </el-tag>
          <span v-else style="color: #999">-</span>
        </template>
        <template #result="{ row }">
          <el-input v-model="row.result" placeholder="请输入检测结果" clearable />
        </template>
        <template #resultJudgment="{ row }">
          <el-select v-model="row.resultJudgment" placeholder="请选择" clearable style="width: 100%">
            <el-option label="合格" value="合格" />
            <el-option label="不合格" value="不合格" />
            <el-option label="/" value="/" />
          </el-select>
        </template>
      </PIMTable>
      <template #footer>
@@ -34,12 +67,12 @@
<script setup>
import {ref} from "vue";
import {Search} from "@element-plus/icons-vue";
import {
  qualityInspectParamDel,
  qualityInspectParamInfo,
  qualityInspectParamUpdate
} from "@/api/qualityManagement/qualityInspectParam.js";
import {deviceList as qualityInspectParamDeviceList} from "@/api/energyManagement/index.js";
import {ElMessageBox} from "element-plus";
const { proxy } = getCurrentInstance()
const emit = defineEmits(['close'])
@@ -48,45 +81,111 @@
const operationType = ref('')
const currentId = ref('')
const selectedRows = ref([]);
const deviceList = ref([]);
const tableColumn = ref([
  {
    label: "指标",
    label: "检测项目",
    prop: "parameterItem",
    width: 150
  },
  {
    label: "标准要求",
    prop: "standardValue",
    width: 180
  },
  {
    label: "单位",
    prop: "unit",
    width: 80
  },
  {
    label: "标准值",
    prop: "standardValue",
  },
  {
    label: "内控值",
    prop: "controlValue",
  },
  {
    label: "检验值",
    prop: "testValue",
    label: "检测器具",
    prop: "instrument",
    dataType: 'slot',
    slot: 'slot',
    slot: 'instrument',
    width: 220
  },
  {
    label: "设备状态",
    prop: "deviceStatus",
    dataType: 'slot',
    slot: 'deviceStatus',
    width: 120
  },
  {
    label: "检测结果",
    prop: "result",
    dataType: 'slot',
    slot: 'result',
    minWidth: 150
  },
  {
    label: "结果判断",
    prop: "resultJudgment",
    dataType: 'slot',
    slot: 'resultJudgment',
    width: 120
  },
]);
const tableData = ref([]);
const tableLoading = ref(false);
// 获取设备台账列表
const loadDeviceList = () => {
  qualityInspectParamDeviceList().then(res => {
    deviceList.value = res.data || [];
  });
};
// 设备状态颜色映射
const getDeviceStatusType = (status) => {
  const map = {
    '正常': 'success',
    '运行': 'primary',
    '停机': 'warning',
    '维修': 'danger'
  };
  return map[status] || 'info';
};
// 检测器具变化时,自动填充设备状态
const handleInstrumentChange = (row) => {
  if (row.instrument === '【目测】') {
    row.deviceId = null;
    row.deviceName = '【目测】';
    row.deviceStatus = '';
    return;
  }
  const device = deviceList.value.find(d => d.deviceName === row.instrument);
  if (device) {
    row.deviceId = device.id;
    row.deviceName = device.deviceName;
    row.deviceStatus = device.status || '';
  } else {
    row.deviceId = null;
    row.deviceName = row.instrument || '';
    row.deviceStatus = '';
  }
};
// 打开弹框
const openDialog = (type, row) => {
  operationType.value = type;
  dialogFormVisible.value = true;
  loadDeviceList();
  if (operationType.value === 'edit') {
    currentId.value = row.id;
    getList()
  }
}
const getList = () => {
  tableLoading.value = true;
  qualityInspectParamInfo(currentId.value).then(res => {
    tableData.value = res.data;
    tableLoading.value = false;
    tableData.value = (res.data || []).map(item => ({...item}));
  }).catch(() => {
    tableLoading.value = false;
  })
}
// 表格选择数据
@@ -136,4 +235,4 @@
<style scoped>
</style>
</style>
src/views/qualityManagement/processInspection/index.vue
@@ -165,7 +165,7 @@
    label: "操作",
    align: "center",
    fixed: "right",
    width: 280,
    width: 340,
    operation: [
      {
        name: "编辑",
@@ -184,6 +184,20 @@
                }
      },
      {
        name: "填写检验记录",
        type: "text",
        clickFun: (row) => {
          openInspectionForm("edit", row);
        },
                disabled: (row) => {
                    if (row.inspectState == 1) return true;
                    if (row.checkName) {
                        return row.checkName !== userStore.nickName;
                    }
                    return false;
                }
      },
      {
        name: "附件",
        type: "text",
        clickFun: (row) => {
src/views/qualityManagement/rawMaterialInspection/components/formDia.vue
@@ -130,8 +130,41 @@
          :tableLoading="tableLoading"
          height="400"
      >
        <template #slot="{ row }">
          <el-input v-model="row.testValue" clearable/>
        <template #instrument="{ row }">
          <el-select
              v-model="row.instrument"
              placeholder="请选择或输入"
              filterable
              allow-create
              default-first-option
              clearable
              style="width: 100%"
              @change="handleInstrumentChange(row)"
          >
            <el-option label="【目测】" value="【目测】" />
            <el-option
                v-for="item in deviceList"
                :key="item.id"
                :label="item.deviceName + (item.deviceModel ? ' / ' + item.deviceModel : '')"
                :value="item.deviceName"
            />
          </el-select>
        </template>
        <template #deviceStatus="{ row }">
          <el-tag v-if="row.deviceStatus" :type="getDeviceStatusType(row.deviceStatus)">
            {{ row.deviceStatus }}
          </el-tag>
          <span v-else style="color: #999">-</span>
        </template>
        <template #result="{ row }">
          <el-input v-model="row.result" placeholder="请输入" clearable />
        </template>
        <template #resultJudgment="{ row }">
          <el-select v-model="row.resultJudgment" placeholder="请选择" clearable style="width: 100%">
            <el-option label="合格" value="合格" />
            <el-option label="不合格" value="不合格" />
            <el-option label="/" value="/" />
          </el-select>
        </template>
      </PIMTable>
      <template #footer>
@@ -151,6 +184,7 @@
import {qualityInspectAdd, qualityInspectUpdate} from "@/api/qualityManagement/rawMaterialInspection.js";
import {qualityInspectParamDel, qualityInspectParamInfo} from "@/api/qualityManagement/qualityInspectParam.js";
import {qualityInspectDetailByProductId, getQualityTestStandardParamByTestStandardId} from "@/api/qualityManagement/metricMaintenance.js";
import {deviceList as qualityInspectParamDeviceList} from "@/api/energyManagement/index.js";
import {userListNoPage} from "@/api/system/user.js";
const {proxy} = getCurrentInstance()
@@ -188,26 +222,47 @@
});
const tableColumn = ref([
  {
    label: "指标",
    label: "检测项目",
    prop: "parameterItem",
    width: 150
  },
  {
    label: "标准要求",
    prop: "standardValue",
    width: 180
  },
  {
    label: "单位",
    prop: "unit",
    width: 80
  },
  {
    label: "标准值",
    prop: "standardValue",
  },
  {
    label: "内控值",
    prop: "controlValue",
  },
  {
    label: "检验值",
    prop: "testValue",
    label: "检测器具",
    prop: "instrument",
    dataType: 'slot',
    slot: 'slot',
    slot: 'instrument',
    width: 220
  },
  {
    label: "设备状态",
    prop: "deviceStatus",
    dataType: 'slot',
    slot: 'deviceStatus',
    width: 120
  },
  {
    label: "检测结果",
    prop: "result",
    dataType: 'slot',
    slot: 'result',
    minWidth: 150
  },
  {
    label: "结果判断",
    prop: "resultJudgment",
    dataType: 'slot',
    slot: 'resultJudgment',
    width: 120
  },
]);
const tableData = ref([]);
@@ -220,6 +275,7 @@
const testStandardOptions = ref([]); // 指标选择下拉框数据
const modelOptions = ref([]);
const userList = ref([]); // 检验员下拉列表
const deviceList = ref([]);
// 编辑时:productMainId 或 purchaseLedgerId 任一有值则供应商、数量置灰
const supplierQuantityDisabled = computed(() => {
@@ -241,6 +297,9 @@
    console.error("加载检验员列表失败", e);
    userList.value = [];
  }
  // 加载设备台账列表
  loadDeviceList();
  // 先重置表单数据(保持字段完整,避免弹窗首次渲染时触发必填红框“闪一下”)
    form.value = {
    checkTime: "",
@@ -445,9 +504,48 @@
const getQualityInspectParamList = (id) => {
  qualityInspectParamInfo(id).then(res => {
    tableData.value = res.data;
    tableData.value = (res.data || []).map(item => ({...item}));
  })
}
// 获取设备台账列表
const loadDeviceList = () => {
  qualityInspectParamDeviceList().then(res => {
    deviceList.value = res.data || [];
  });
};
// 设备状态颜色映射
const getDeviceStatusType = (status) => {
  const map = {
    '正常': 'success',
    '运行': 'primary',
    '停机': 'warning',
    '维修': 'danger'
  };
  return map[status] || 'info';
};
// 检测器具变化时,自动填充设备状态
const handleInstrumentChange = (row) => {
  if (row.instrument === '【目测】') {
    row.deviceId = null;
    row.deviceName = '【目测】';
    row.deviceStatus = '';
    return;
  }
  const device = deviceList.value.find(d => d.deviceName === row.instrument);
  if (device) {
    row.deviceId = device.id;
    row.deviceName = device.deviceName;
    row.deviceStatus = device.status || '';
  } else {
    row.deviceId = null;
    row.deviceName = row.instrument || '';
    row.deviceStatus = '';
  }
};
// 关闭弹框
const closeDia = () => {
  proxy.resetForm("formRef");
src/views/qualityManagement/rawMaterialInspection/components/inspectionFormDia.vue
@@ -3,7 +3,7 @@
    <el-dialog
        v-model="dialogFormVisible"
        title="填写检验记录"
        width="70%"
        width="95%"
        @close="closeDia"
    >
      <div style="margin-bottom: 10px;text-align: right">
@@ -18,8 +18,41 @@
          @selection-change="handleSelectionChange"
          height="600"
      >
        <template #slot="{ row }">
          <el-input v-model="row.testValue" clearable/>
        <template #instrument="{ row }">
          <el-select
              v-model="row.instrument"
              placeholder="请选择或输入"
              filterable
              allow-create
              default-first-option
              clearable
              style="width: 100%"
              @change="handleInstrumentChange(row)"
          >
            <el-option label="【目测】" value="【目测】" />
            <el-option
                v-for="item in deviceList"
                :key="item.id"
                :label="item.deviceName + (item.deviceModel ? ' / ' + item.deviceModel : '')"
                :value="item.deviceName"
            />
          </el-select>
        </template>
        <template #deviceStatus="{ row }">
          <el-tag v-if="row.deviceStatus" :type="getDeviceStatusType(row.deviceStatus)">
            {{ row.deviceStatus }}
          </el-tag>
          <span v-else style="color: #999">-</span>
        </template>
        <template #result="{ row }">
          <el-input v-model="row.result" placeholder="请输入检测结果" clearable />
        </template>
        <template #resultJudgment="{ row }">
          <el-select v-model="row.resultJudgment" placeholder="请选择" clearable style="width: 100%">
            <el-option label="合格" value="合格" />
            <el-option label="不合格" value="不合格" />
            <el-option label="/" value="/" />
          </el-select>
        </template>
      </PIMTable>
      <template #footer>
@@ -34,12 +67,12 @@
<script setup>
import {ref} from "vue";
import {Search} from "@element-plus/icons-vue";
import {
  qualityInspectParamDel,
  qualityInspectParamInfo,
  qualityInspectParamUpdate
} from "@/api/qualityManagement/qualityInspectParam.js";
import {deviceList as qualityInspectParamDeviceList} from "@/api/energyManagement/index.js";
import {ElMessageBox} from "element-plus";
const { proxy } = getCurrentInstance()
const emit = defineEmits(['close'])
@@ -48,45 +81,111 @@
const operationType = ref('')
const currentId = ref('')
const selectedRows = ref([]);
const deviceList = ref([]);
const tableColumn = ref([
  {
    label: "指标",
    label: "检测项目",
    prop: "parameterItem",
    width: 150
  },
  {
    label: "标准要求",
    prop: "standardValue",
    width: 180
  },
  {
    label: "单位",
    prop: "unit",
    width: 80
  },
  {
    label: "标准值",
    prop: "standardValue",
  },
  {
    label: "内控值",
    prop: "controlValue",
  },
  {
    label: "检验值",
    prop: "testValue",
    label: "检测器具",
    prop: "instrument",
    dataType: 'slot',
    slot: 'slot',
    slot: 'instrument',
    width: 220
  },
  {
    label: "设备状态",
    prop: "deviceStatus",
    dataType: 'slot',
    slot: 'deviceStatus',
    width: 120
  },
  {
    label: "检测结果",
    prop: "result",
    dataType: 'slot',
    slot: 'result',
    minWidth: 150
  },
  {
    label: "结果判断",
    prop: "resultJudgment",
    dataType: 'slot',
    slot: 'resultJudgment',
    width: 120
  },
]);
const tableData = ref([]);
const tableLoading = ref(false);
// 获取设备台账列表
const loadDeviceList = () => {
  qualityInspectParamDeviceList().then(res => {
    deviceList.value = res.data || [];
  });
};
// 设备状态颜色映射
const getDeviceStatusType = (status) => {
  const map = {
    '正常': 'success',
    '运行': 'primary',
    '停机': 'warning',
    '维修': 'danger'
  };
  return map[status] || 'info';
};
// 检测器具变化时,自动填充设备状态
const handleInstrumentChange = (row) => {
  if (row.instrument === '【目测】') {
    row.deviceId = null;
    row.deviceName = '【目测】';
    row.deviceStatus = '';
    return;
  }
  const device = deviceList.value.find(d => d.deviceName === row.instrument);
  if (device) {
    row.deviceId = device.id;
    row.deviceName = device.deviceName;
    row.deviceStatus = device.status || '';
  } else {
    row.deviceId = null;
    row.deviceName = row.instrument || '';
    row.deviceStatus = '';
  }
};
// 打开弹框
const openDialog = (type, row) => {
  operationType.value = type;
  dialogFormVisible.value = true;
  loadDeviceList();
  if (operationType.value === 'edit') {
    currentId.value = row.id;
    getList()
  }
}
const getList = () => {
  tableLoading.value = true;
  qualityInspectParamInfo(currentId.value).then(res => {
    tableData.value = res.data;
    tableLoading.value = false;
    tableData.value = (res.data || []).map(item => ({...item}));
  }).catch(() => {
    tableLoading.value = false;
  })
}
// 表格选择数据
@@ -136,4 +235,4 @@
<style scoped>
</style>
</style>
src/views/qualityManagement/rawMaterialInspection/index.vue
@@ -167,7 +167,7 @@
    label: "操作",
    align: "center",
    fixed: "right",
    width: 280,
    width: 340,
    operation: [
      {
        name: "编辑",
@@ -179,6 +179,20 @@
                    // 已提交则禁用
                    if (row.inspectState == 1) return true;
                    // 如果检验员有值,只有当前登录用户能编辑
                    if (row.checkName) {
                        return row.checkName !== userStore.nickName;
                    }
                    return false;
                }
      },
      {
        name: "填写检验记录",
        type: "text",
        clickFun: (row) => {
          openInspectionForm("edit", row);
        },
                disabled: (row) => {
                    if (row.inspectState == 1) return true;
                    if (row.checkName) {
                        return row.checkName !== userStore.nickName;
                    }
@@ -294,6 +308,12 @@
    formDia.value?.openDialog(type, row)
  })
};
// 打开新增检验弹框
const openInspectionForm = (type, row) => {
  nextTick(() => {
    inspectionFormDia.value?.openDialog(type, row)
  })
};
// 打开附件弹框
const openFilesFormDia = (type, row) => {
  nextTick(() => {