gaoluyang
2025-02-19 7e35455e4bbad2edfe64bf6f56beff105c94eb94
src/views/business/materialOrderComponents/materialOrder/dataLookVisible.vue
@@ -4,10 +4,10 @@
      <ul class="tab">
        <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>
@@ -17,11 +17,13 @@
<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, ValueTable},
  props: {
    dataDialogVisible: {
      type: Boolean,
@@ -35,7 +37,71 @@
  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 ''
            }
          },
          formatType: (params) => {
            if (params == 1) {
              return 'success'
            } else if (params == 0) {
              return 'danger'
            } else if (params == 3) {
              return ''
            }  else {
              return ''
            }
          }
        },
        {
          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: [
        {
@@ -48,48 +114,8 @@
        },
      ],
      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: []
@@ -106,20 +132,31 @@
      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}
      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({insProductId: row.insProductId}).then(res => {
        this.retestVisible = true
        this.retestInfo = res.data
      })
@@ -135,7 +172,8 @@
.tab {
  list-style-type: none;
  display: flex;
  margin-bottom: 12px;
  margin-top: 0 !important;
  padding-left: 0 !important;
}
.tab li {