spring
2025-04-08 4f94a66bc8ad9a57295f161de9195d5528b1d181
src/views/business/materialOrderComponents/materialOrder/dataLookVisible.vue
@@ -2,26 +2,28 @@
  <div>
    <el-dialog title="数据查看" :visible.sync="isShow" width="80%" @closed="$emit('closeDataLook')">
      <ul class="tab">
        <li v-for="(m,i) in dataVisibleTitle" :key="i" :class="{active:i===dataVisibleIndex}" @click="handleDataVisibleTab(m,i)">{{m.label}}</li>
        <li v-for="(m, i) in dataVisibleTitle" :key="i" :class="{ active: i === dataVisibleIndex }"
          @click="handleDataVisibleTab(m, i)">{{ m.label }}</li>
      </ul>
      <div style="height: 70vh;overflow-y: auto;">
        <ValueTable ref="ValueTableDataLook" :url="$api.insOrder.selectSampleAndProductByOrderId"
                    :key="upIndex"
                    :componentData="componentDataDataLook"/>
      <div>
        <lims-table :tableData="tableData" :column="column" @pagination="pagination" height="500px" key="tableData"
          :page="page" :tableLoading="tableLoading"></lims-table>
      </div>
    </el-dialog>
    <un-pass-retest-result :retestVisible="retestVisible" :retestInfo="retestInfo" @closeRetestLook="closeRetestLook" v-if="retestVisible"></un-pass-retest-result>
    <un-pass-retest-result :retestVisible="retestVisible" :retestInfo="retestInfo" @closeRetestLook="closeRetestLook"
      v-if="retestVisible"></un-pass-retest-result>
  </div>
</template>
<script>
import ValueTable from "@/components/Table/value-table.vue";
import UnPassRetestResult from "./unPassRetestResult.vue";
import limsTable from "@/components/Table/lims-table.vue";
import { getRetestResult, selectSampleAndProductByOrderId } from "@/api/business/rawMaterialOrder";
export default {
  name: "dataLookVisible",
  // import 引入的组件需要注入到对象中才能使用
  components: {UnPassRetestResult, ValueTable},
  components: { limsTable, UnPassRetestResult },
  props: {
    dataDialogVisible: {
      type: Boolean,
@@ -29,13 +31,78 @@
    },
    dataLookInfo: {
      type: Object,
      default: () => {}
      default: () => { }
    },
  },
  data() {
    // 这里存放数据
    return {
      upIndex: 0,
      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' },
        {
          dataType: 'tag',
          label: '结果判定',
          prop: 'insResult',
          formatData: (params) => {
            if (params == 1) {
              return '合格'
            } else if (params == 0) {
              return '不合格'
            } else if (params == 3) {
              return '不判定'
            } else {
              return null
            }
          },
          formatType: (params) => {
            if (params == 1) {
              return 'success'
            } else if (params == 0) {
              return 'danger'
            } else if (params == 3) {
              return ''
            } else {
              return null
            }
          }
        },
        { label: "检验人", prop: "checkUserName" },
        {
          dataType: 'action',
          fixed: 'right',
          label: '操作',
          width: '170px',
          operation: [
            {
              name: '不合格复测查看',
              type: 'text',
              clickFun: (row) => {
                this.getRetestResult(row);
              },
              disabled: (row, index) => {
                return row.insResult != 0
              }
            },
          ]
        }
      ],
      page: {
        total: 0,
        size: 10,
        current: 1
      },
      isShow: this.dataDialogVisible,
      dataVisibleTitle: [
        {
@@ -43,53 +110,13 @@
          value: 0
        },
        {
          label: '季度检验',
          label: '可靠性检验',
          value: 1
        },
      ],
      dataVisibleIndex: 0, // 数据查看tab栏选择值
      // 表格数据
      componentDataDataLook: { // 数组查看的table数据
        entity: {
          id: null,
        },
        isIndex: false,
        showSelect: false,
        select: false,
        do: [
          {
            id: '',
            font: '不合格复测查看',
            type: 'text',
            method: 'getRetestResult',
            disabFun: (row, index) =>  {
              return row.insResult!=0
            }
          }
        ],
        tagField: {
          insState: {
            select: []
          },
          insResult: {
            select: [{
              value: 1,
              label: '合格',
              type: 'success'
            },{
              value: 0,
              label: '不合格',
              type: 'danger'
            },{
              value: 3,
              label: '不判定',
              type: ''
            }]
          }
        },
        selectField: {},
        requiredAdd: [],
        requiredUp: []
      entity: {
        id: null,
      },
      retestVisible: false,
      retestInfo: []
@@ -101,30 +128,41 @@
  // 方法集合
  methods: {
    // 切换数据查看tab栏
    handleDataVisibleTab (m, i) {
    handleDataVisibleTab(m, i) {
      this.dataVisibleIndex = i
      this.refreshTable()
    },
    // 查询回调
    refreshTable(e) {
    refreshTable() {
      if (this.dataVisibleIndex === 0) {
        this.componentDataDataLook.entity.id = this.dataLookInfo.enterOrderId
        this.entity.id = this.dataLookInfo.enterOrderId
      } else {
        this.componentDataDataLook.entity.id = this.dataLookInfo.quarterOrderId
        this.entity.id = this.dataLookInfo.quarterOrderId
      }
      this.$nextTick(() => {
        this.$refs['ValueTableDataLook'].selectList(e)
      this.tableLoading = true
      const params = { ...this.entity, ...this.page }
      selectSampleAndProductByOrderId(params).then(res => {
        this.tableLoading = false
        if (res.code === 200) {
          this.tableData = res.data.records
          this.page.total = res.data.total
        }
      }).catch(err => {
        this.tableLoading = false
      })
    },
    pagination(page) {
      this.page.size = page.limit
      this.refreshTable()
    },
    // 查看不合格复测结果
    getRetestResult (row) {
      this.$axios.get(this.$api.insOrder.getRetestResult+'?insProductId='+row.insProductId).then(res => {
        if (res.code == 201) return
    getRetestResult(row) {
      getRetestResult({ insProductId: row.insProductId }).then(res => {
        this.retestVisible = true
        this.retestInfo = res.data
      })
    },
    closeRetestLook () {
    closeRetestLook() {
      this.retestVisible = false
    },
  },
@@ -135,7 +173,8 @@
.tab {
  list-style-type: none;
  display: flex;
  margin-bottom: 12px;
  margin-top: 0 !important;
  padding-left: 0 !important;
}
.tab li {