gaoluyang
2025-03-31 80c915239301b1f0e3a732a6318e7743709e9489
src/views/statisticalCharts/inspectionItemWarning/index.vue
@@ -50,13 +50,12 @@
      tableLoading: false,
      column: [
        { label: '样品编号', prop: 'sampleCode',width: 150 },
        { label: '样品名称', prop: 'sampleName',width: 150 },
        { label: '型号', prop: 'sampleModel' },
        { label: '样品名称', prop: 'sampleName'},
        { label: '型号', prop: 'sampleModel',width: 150  },
        { label: '供应商名称', prop: 'supplierName',width: 150 },
        { label: '检验项名称', prop: 'inspectionItemName',width: 150 },
        { label: '供应商名称', prop: 'supplierName',width: 150 },
        { label: '检验项名称', prop: 'inspectionItemName'},
        {
          label: "偏差值",
          label: "偏差值%",
          prop: "deviationValue",
          width: 150,
          dataType: "tag",
@@ -89,7 +88,6 @@
      column1: [
        { label: '样品编号', prop: 'sampleCode'},
        { label: '供应商名称', prop: 'supplierName'},
        { label: '供应商名称', prop: 'supplierName'},
        {
          label: "检测值",
          prop: "testValue",
@@ -119,7 +117,7 @@
      echartsOptions: {},
      echartsSeries: [
        {
          name: '偏差值',
          name: '检测值',
          type: 'line',
          smooth: true,
          tooltip: {
@@ -197,9 +195,20 @@
        let xAxis = []
        let markAreas = []; // 存储 markArea 的数组
        let markPoints = [];
        const sampleCodeCount = {};
        res.data.forEach((item, index) => {
          lineData.push(item.testValue)
          xAxis.push(item.sampleCode)
          // 添加索引以确保唯一性
          // 检查是否需要区分 sampleCode
          if (!sampleCodeCount[item.sampleCode]) {
            sampleCodeCount[item.sampleCode] = 1; // 第一次出现
            xAxis.push(item.sampleCode); // 直接使用原始 sampleCode
          } else {
            sampleCodeCount[item.sampleCode]++; // 增加计数
            const uniqueSampleCode = `${item.sampleCode}-${sampleCodeCount[item.sampleCode]}`;
            xAxis.push(uniqueSampleCode); // 添加后缀以区分
          }
          // 如果 isIssue 为 1,则在此索引处添加一个 markArea
          if (item.isIssue == 1) {
            const startColumn = index > 0 ? xAxis[index - 1] : xAxis[index]; // 起点:前一列或当前列