spring
2025-03-21 9e0426e8e28dd530663cdbe80f258d1622cc9e7d
src/views/statisticalCharts/itemInspectionAnalysis/index.vue
@@ -3,16 +3,8 @@
    <div v-if="!isShowDataCom">
      <el-form ref="entity" size="small" :inline="true">
        <el-form-item style="width: 16%;">
          <el-date-picker
            v-model="datePicker"
            end-placeholder="结束日期"
            format="yyyy-MM-dd"
            placeholder="选择日期"
            range-separator="至"
            size="small"
            start-placeholder="开始日期"
            style="width: 100%;"
            type="daterange"
          <el-date-picker v-model="datePicker" end-placeholder="结束日期" format="yyyy-MM-dd" placeholder="选择日期"
            range-separator="至" size="small" start-placeholder="开始日期" style="width: 100%;" type="daterange"
            value-format="yyyy-MM-dd">
          </el-date-picker>
        </el-form-item>
@@ -26,13 +18,9 @@
          <el-input v-model="supplierName" clearable placeholder="请输入供应商名称" size="small"></el-input>
        </el-form-item>
        <el-form-item label="检验项名称" prop="supplierName">
          <el-select v-model="itemNames" :loading="selectLoading" clearable multiple placeholder="请选择"
                     size="small" style="width: 90%;" @focus="getItemList">
            <el-option
              v-for="item in itemNamesList"
              :key="item.value"
              :label="item.label"
              :value="item.value">
          <el-select v-model="itemNames" :loading="selectLoading" clearable multiple placeholder="请选择" size="small"
            style="width: 90%;" @focus="getItemList">
            <el-option v-for="item in itemNamesList" :key="item.value" :label="item.label" :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>
@@ -46,13 +34,11 @@
        <el-col :span="24">
          <div class="inspection-card">
            <div style="display: flex;align-items: center;margin-bottom: 10px;justify-content: space-between;">
              <div>原材料项检分析列表</div>
              <div>原辅料项检分析列表</div>
              <el-button size="small" type="primary" @click="openShowData">查看数据分析</el-button>
            </div>
            <lims-table :tableData="editTableData" :column="editColumn"
                        height="400" key="tableData" :isSelection="true"
                        :handleSelectionChange="handleSelectionChange"
                        :tableLoading="editLoading"></lims-table>
            <lims-table :tableData="editTableData" :column="editColumn" height="400" key="tableData" :isSelection="true"
              :handleSelectionChange="handleSelectionChange" :tableLoading="editLoading"></lims-table>
          </div>
        </el-col>
      </el-row>
@@ -60,14 +46,9 @@
        <el-col :span="6" style="padding-top: 14px">
          <div style="display: flex;margin-left: 10px;align-items: center">
            <span style="width: 100px">分组类型:</span>
            <el-select v-model="groupType" clearable placeholder="请选择"
                       size="small"
                       style="width: 90%;" @change="getBarInfo">
              <el-option
                v-for="item in groupTypeList"
                :key="item.value"
                :label="item.label"
                :value="item.value">
            <el-select v-model="groupType" clearable placeholder="请选择" size="small" style="width: 90%;"
              @change="getBarInfo">
              <el-option v-for="item in groupTypeList" :key="item.value" :label="item.label" :value="item.value">
              </el-option>
            </el-select>
          </div>
@@ -77,46 +58,30 @@
        <el-col :span="24">
          <div class="inspection-card">
            <div class="title">检验项数据对比</div>
            <Echarts ref="chart"
                     :chartStyle="chartStyle"
                     :dataset="dataset"
                     :grid="grid"
                     :options="echartsOptions"
                     :series="echartsSeries"
                     :tooltip="tooltip"
                     :xAxis="xAxis"
                     :yAxis="yAxis"
                     style="height: 40vh;"></Echarts>
            <Echarts ref="chart" :chartStyle="chartStyle" :dataset="dataset" :grid="grid" :options="echartsOptions"
              :series="echartsSeries" :tooltip="tooltip" :xAxis="xAxis" :yAxis="yAxis" style="height: 40vh;"></Echarts>
          </div>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="24">
          <div class="inspection-card">
            <div class="title">原材料项检合格率</div>
            <Echarts ref="chart"
                     :chartStyle="chartStyle"
                     :dataset="dataset1"
                     :grid="grid"
                     :options="echartsOptions1"
                     :series="echartsSeries1"
                     :tooltip="tooltip"
                     :xAxis="xAxis"
                     :yAxis="yAxis1"
                     style="height: 40vh;"></Echarts>
            <div class="title">原辅料项检合格率</div>
            <Echarts ref="chart" :chartStyle="chartStyle" :dataset="dataset1" :grid="grid" :options="echartsOptions1"
              :series="echartsSeries1" :tooltip="tooltip" :xAxis="xAxis" :yAxis="yAxis1" style="height: 40vh;">
            </Echarts>
          </div>
        </el-col>
      </el-row>
    </div>
    <el-dialog :visible.sync="dataDialogVisible" title="数据查看" width="80%">
      <div v-if="dataDialogVisible" style="height: 70vh;overflow-y: auto;">
        <lims-table :tableData="tableData" :column="column"
                    @pagination="pagination" key="tableData"
                    :page="page" :tableLoading="tableLoading"></lims-table>
        <lims-table :tableData="tableData" :column="column" @pagination="pagination" key="tableData" :page="page"
          :tableLoading="tableLoading"></lims-table>
      </div>
    </el-dialog>
    <DataComparison v-if="isShowDataCom" :comparisonData="comparisonData"
                    :selectRow="selectRow" @goBack="goBack"></DataComparison>
    <DataComparison v-if="isShowDataCom" :comparisonData="comparisonData" :selectRow="selectRow" @goBack="goBack">
    </DataComparison>
  </div>
</template>
@@ -130,20 +95,20 @@
  getRawProductAnalysisAllList,
  getRawProductAnalysisRawPass, getRawSupplierCompare
} from "@/api/statisticalCharts/dataAnalysis";
import {selectSampleAndProductByOrderId} from "@/api/business/rawMaterialOrder";
import { selectSampleAndProductByOrderId } from "@/api/business/rawMaterialOrder";
export default {
  name: "ItemInspectionAnalysis",
  // import 引入的组件需要注入到对象中才能使用
  components: {limsTable, Echarts, DataComparison},
  components: { limsTable, Echarts, DataComparison },
  data() {
    // 这里存放数据
    return {
      selectChangeRows: [], // 选中的数据
      groupTypeList: [
        {label: '样品', value: '0'},
        {label: '同一厂家, 同一型号, 不同批次', value: '1'},
        {label: '同一型号, 不同厂家', value: '2'},
        { label: '样品', value: '0' },
        { label: '同一厂家, 同一型号, 不同批次', value: '1' },
        { label: '同一型号, 不同厂家', value: '2' },
      ],
      itemNames: [], // 检验项名称
      itemNamesList: [],
@@ -241,15 +206,15 @@
          label: '样品型号',
          minWidth: '300px',
          prop: 'sampleModel'
        },{
        }, {
          label: '下发时间',
          minWidth: '120px',
          prop: 'sendTime'
        },{
        }, {
          label: '抵达的采购数量',
          minWidth: '130px',
          prop: 'qtyArrived'
        },{
        }, {
          label: '单位',
          minWidth: '120px',
          prop: 'buyUnitMeas'
@@ -276,17 +241,17 @@
      tableData: [],
      tableLoading: false,
      column: [
        {label: '样品编号', prop: 'sampleCode'},
        {label: '样品名称', prop: 'sample'},
        {label: '检验项分类', prop: 'inspectionItemClass'},
        {label: '检验项', prop: 'inspectionItem'},
        {label: '检验子项', prop: 'inspectionItemSubclass'},
        {label: '单位', prop: 'unit'},
        {label: '样品型号', prop: 'model'},
        {label: '条件', prop: 'radius'},
        {label: '电缆标识', prop: 'cableTag'},
        {label: '试验要求', prop: 'tell'},
        {label: '检验结果', prop: 'lastValue'},
        { label: '样品编号', prop: 'sampleCode' },
        { label: '样品名称', prop: 'sample' },
        { label: '检验项分类', prop: 'inspectionItemClass' },
        { label: '检验项', prop: 'inspectionItem' },
        { label: '检验子项', prop: 'inspectionItemSubclass' },
        { label: '单位', prop: 'unit' },
        { label: '样品型号', prop: 'model' },
        { label: '条件', prop: 'radius' },
        { label: '电缆标识', prop: 'cableTag' },
        { label: '试验要求', prop: 'tell' },
        { label: '检验结果', prop: 'lastValue' },
        {
          dataType: 'tag',
          label: '结果判定',
@@ -309,16 +274,16 @@
              return 'danger'
            } else if (params == 3) {
              return ''
            }  else {
            } else {
              return null
            }
          }
        }
      ],
      page: {
        total:0,
        size:10,
        current:1
        total: 0,
        size: 10,
        current: 1
      },
      currentRow: {},
      isShowDataCom: false,
@@ -331,7 +296,7 @@
  },
  // 方法集合
  methods: {
    getBarInfo (val) {
    getBarInfo(val) {
      if (val === '1') {
        if (!this.modelName || !this.supplierName) {
          this.$message.warning('型号或供应商不能为空')
@@ -371,10 +336,12 @@
          return
        }
        for (let i = 0; i < res.data.itemNames.length; i++) {
          this.echartsSeries.push({type: 'line', label: {
          this.echartsSeries.push({
            type: 'line', label: {
              show: true,
              position: 'top'
            },})
            },
          })
        }
        this.dataset.dimensions = this.HaveJson(res.data.itemNames)
        this.dataset.dimensions.unshift('product')
@@ -399,15 +366,17 @@
          return
        }
        for (let i = 0; i < res.data.itemNames.length; i++) {
          this.echartsSeries1.push({type: 'line',tooltip: {
          this.echartsSeries1.push({
            type: 'line', tooltip: {
              valueFormatter: function (value) {
                return value + '%';
              }
            },label: {
            }, label: {
              show: true,
              position: 'top',
              formatter: (params) => params.value[params.dimensionNames[params.encode.y[0]]] + '%'
            },})
            },
          })
        }
        this.dataset1.dimensions = this.HaveJson(res.data.itemNames)
        this.dataset1.dimensions.unshift('product')
@@ -423,7 +392,7 @@
    },
    // 查询回调
    refreshTable(row) {
      selectSampleAndProductByOrderId({id: row.id, ...this.page}).then(res => {
      selectSampleAndProductByOrderId({ id: row.id, ...this.page }).then(res => {
        this.tableLoading = false
        if (res.code === 200) {
          this.tableData = res.data.records
@@ -433,11 +402,11 @@
        this.tableLoading = false
      })
    },
    pagination (page) {
    pagination(page) {
      this.page.size = page.limit
      this.refreshTable(this.currentRow)
    },
    changeData () {
    changeData() {
      if (this.datePicker !== null && this.datePicker.length > 0) {
        this.beginDate = this.datePicker[0] + ' 00:00:00'
        this.endDate = this.datePicker[1] + ' 23:59:59'
@@ -449,7 +418,7 @@
      this.getBar1()
      this.getTableData()
    },
    getTableData () {
    getTableData() {
      this.editLoading = true
      const params = {
        beginDate: this.beginDate,
@@ -467,7 +436,7 @@
      })
    },
    // 获取检验项下拉框
    getItemList () {
    getItemList() {
      this.selectLoading = true
      this.itemNamesList = []
      const params = {
@@ -490,10 +459,10 @@
        this.selectLoading = false
      })
    },
    goBack () {
    goBack() {
      this.isShowDataCom = false
    },
    openShowData () {
    openShowData() {
      if (this.selectChangeRows.length !== 5) {
        this.$message.warning('请选择5条数据')
        return
@@ -520,7 +489,7 @@
        this.isShowDataCom = true
      })
    },
    handleSelectionChange (val) {
    handleSelectionChange(val) {
      this.selectChangeRows = val
    },
  },
@@ -528,7 +497,7 @@
</script>
<style scoped>
.inspection-card{
.inspection-card {
  width: 100%;
  margin-top: 10px;
}