liding
2026-09-28 f03cf23f3acbd5582a16c263aa6bf83b260ec906
src/views/business/inspectionTask/index.vue
@@ -13,6 +13,13 @@
                         :value="a.value"></el-option>
            </el-select>
          </el-form-item>
<!--          <el-form-item label="物料属性" prop="materialProp">-->
<!--            <el-select clearable size="small" v-model="queryParams.materialProp" style="width: 100%">-->
<!--              <el-option v-for="dict in dict.type.material_prop_type" :key="dict.value" :label="dict.label"-->
<!--                         :value="dict.value">-->
<!--              </el-option>-->
<!--            </el-select>-->
<!--          </el-form-item>-->
          <el-form-item>
            <el-button size="mini" type="primary" @click="refreshTable()">查询</el-button>
            <el-button size="mini" @click="refresh()">重置</el-button>
@@ -22,7 +29,7 @@
      <div class="center" v-loading="tableLoading">
        <div class="center-options">
          <div style="display: flex; align-items: center">
            <span style="font-size: 14px">试验室种类:</span>
            <span style="font-size: 14px">试验室:</span>
            <ul class="tab">
              <li v-for="(m, i) in tabList" :key="i" :class="{ active: i == tabIndex }" @click="handleTab(m, i)">
                {{ m.label.replace("试验室", "") }}
@@ -42,7 +49,6 @@
          :rowClassName="rowClassName" :height="'calc(100vh - 300px)'" @pagination="pagination"
          key="tableData0">
          <div slot="action" slot-scope="scope">
            <el-button size="small" type="text" @click="handleDataLook(scope.row)">数据查看</el-button>
            <el-button type="text" size="small"
                       :disabled="(scope.row.userName == null || scope.row.insState == 3 || scope.row.insState == 5) && checkPermi(['update:product:onPlan'])"
                       @click="editInspection(scope.row)">修改检验值</el-button>
@@ -61,9 +67,10 @@
                )"
                       @click="handleConnect(scope.row)">交接</el-button>
            <el-button type="text" size="small" @click="viewInspectInfo(scope.row)">原始记录</el-button>
            <el-popover placement="bottom" trigger="hover" style="margin-left: 6px">
            <el-popover placement="bottom" trigger="hover" style="margin-left: 6px" :disabled="(scope.row.insState != 3 || scope.row.userName == null ||(scope.row.userName && !scope.row.userName.includes(nickName)))">
              <template #reference>
                <el-button link type="text" size="small">更多</el-button>
                <el-button link type="text" size="small" :disabled="(scope.row.insState != 3 || scope.row.userName == null ||
                  (scope.row.userName && !scope.row.userName.includes(nickName)))">更多</el-button>
              </template>
              <div>
                <el-button :disabled="(scope.row.insState != 3 || scope.row.userName == null ||
@@ -126,22 +133,6 @@
        <el-button @click="connectVisible = false">取 消</el-button>
        <el-button :loading="loading" type="primary" @click="confirmConnect">确 定</el-button>
      </span>
    </el-dialog>
    <el-dialog :visible.sync="dataDialogVisible" title="数据查看" width="80%">
      <div v-if="dataDialogVisible" style="height: 74vh; overflow-y: auto">
        <div>
          <el-form :model="entity" :inline="true">
            <el-form-item label="检验项" prop="outputWorkTime">
              <el-input v-model="entity.inspectionItem" clearable size="small"></el-input>
            </el-form-item>
            <el-form-item>
              <el-button size="small" type="primary" @click="getLookList">查询</el-button>
            </el-form-item>
          </el-form>
        </div>
        <lims-table :tableData="lookTableData" :column="lookColumn" :page="lookPage" :tableLoading="lookTableLoading"
          :height="'60vh'" @pagination="lookPagination" key="tableData1"></lims-table>
      </div>
    </el-dialog>
    <el-dialog :visible.sync="bindDialogVisible" title="检验项绑定" width="600px">
      <div slot="title" style="
@@ -226,7 +217,6 @@
import UnPassRetestResult from "@/components/rawMaterialInspection/unPassRetestResult.vue"
import {
  claimInsOrderPlan,
  upPlanUser2,
  upPlanUser,
  selectUserCondition,
  getBindingProductByProductId,
@@ -234,8 +224,8 @@
  bindingProductTreeByProductId,
  delProductTreeByProductId,
  selectInsOrderPlanList,
  selectSampleAndProductByOrderId,
} from "@/api/business/inspectionTask.js";
import { treeDevice } from "@/api/cnas/resourceDemand/device.js";
import { mapGetters } from "vuex";
import {getRetestResult} from "@/api/business/rawMaterialOrder";
import {upReportUrl} from "@/api/business/insReport";
@@ -250,7 +240,7 @@
    viewManHourDia,
    UnPassRetestResult
  },
  dicts: ["urgency_level", "inspection_task_state"],
  dicts: ["urgency_level", "inspection_task_state","material_prop_type"],
  computed: {
    ...mapGetters(["nickName", "userId"]),
  },
@@ -277,16 +267,16 @@
      },
      claimVisible: false,
      tabList: [
        { label: "委托", value: 0 },
        { label: "原材料", value: 1 },
        { label: "委托", value: -1 },
        // { label: "原材料", value: 1 },
        // { label: "外购", value: 0 },
      ],
      active: 1,
      tabIndex: 0,
      dataDialogVisible: false,
      planTotal: 0,
      insStateList: [],
      state: 0, // 0:台账页,1:检验页面,2检验页面(复核),默认为0,3数据查看
      typeSource: null, // 0:成品下单,1:原材料下单
      typeSource: -1, // 0:外购成品下单,1:原材料下单
      sonLaboratory: null, // 0:委托,1:原材料
      activeFace: 0, // 1:下单,2:查看,3:审核,默认为0
      currentId: null,
@@ -311,12 +301,29 @@
      retestInfo: [],
      isCopper: null,
      bindCurrentInfo: {},
      lookInfo: {},
      orderTypeList: [
        {
          value: "Customer-ordered test",
          label: "委托试验",
          label: "委托检验",
          type: "success",
          effect: "plain",
        },
        {
          value: "Commissioned testing",
          label: "委托检测",
          type: "success",
          effect: "plain",
        },
        {
          value: "Inter-laboratory comparison",
          label: "实验室间比对",
          type: "warning",
          effect: "plain",
        },
        {
          value: "Proficiency testing",
          label: "能力验证",
          type: "primary",
          effect: "plain",
        },
        {
@@ -357,36 +364,37 @@
          dataType: "tag",
          formatData: (params) => {
            if (params == 0) {
              return "成品下单";
            } else {
              return "外购下单";
            } else if(params==1) {
              return "原材料下单";
            }else{
              return "委托下单";
            }
          },
        },
        { label: "样品型号", prop: "sampleModel", width: "120px" },
        {
          label: "紧急程度",
          prop: "type",
          dataType: "tag",
          formatData: (params) => {
            if (params == 0) {
              return '普通'
            } else if (params == 1) {
              return '优先'
            } else {
              return '紧急'
            }
          },
          formatType: (params) => {
            if (params == 0) {
              return 'success'
            } else if (params == 1) {
              return 'warning'
            } else {
              return 'danger'
            }
          }
        },
        // {
        //   label: "紧急程度",
        //   prop: "type",
        //   dataType: "tag",
        //   formatData: (params) => {
        //     if (params == 0) {
        //       return '普通'
        //     } else if (params == 1) {
        //       return '优先'
        //     } else {
        //       return '紧急'
        //     }
        //   },
        //   formatType: (params) => {
        //     if (params == 0) {
        //       return 'success'
        //     } else if (params == 1) {
        //       return 'warning'
        //     } else {
        //       return 'danger'
        //     }
        //   }
        // },
        {
          label: "检验类型",
          prop: "orderType",
@@ -456,94 +464,15 @@
          type: "",
        },
      ],
      // 数据查看相关字段---开始
      entity: {
        inspectionItem: "",
      },
      lookTableData: [],
      lookColumn: [
        {
          label: "样品编号",
          prop: "sampleCode",
          width: "140px",
          mergeCol: true, //合并列
        },
        { label: "样品名称", prop: "sample", width: "140px", mergeCol: true },
        { label: "检验项分类", prop: "inspectionItemClass" },
        { label: "检验项", prop: "inspectionItem", width: "140px" },
        { label: "检验子项", prop: "inspectionItemSubclass" },
        { label: "单位", prop: "unit" },
        { label: "样品型号", prop: "model", mergeCol: true },
        { label: "条件", prop: "radius" },
        { label: "电缆标识", prop: "cableTag" },
        { label: "试验要求", prop: "tell" },
        { label: "检验结果", prop: "lastValue" },
        {
          label: "结果判定",
          prop: "insResult",
          dataType: "tag",
          formatData: (params) => {
            let obj = this.insResultList.find((m) => m.value == params)
            if (obj) {
              return this.insResultList.find((m) => m.value == params).label;
            } else {
              return null
            }
          },
          formatType: (params) => {
            let obj = this.insResultList.find((m) => m.value == params)
            if (obj) {
              return this.insResultList.find((m) => m.value == params).type;
            } else {
              return null
            }
          },
        },
        {
          dataType: "action",
          fixed: "right",
          label: "操作",
          operation: [
            {
              name: "不合格复测查看",
              type: "text",
              clickFun: (row) => {
                this.getRetestResultInfo(row);
              },
              disabled: (row) => {
                return row.insResult!=0
              },
            },
            {
              name: "检验项绑定",
              type: "text",
              clickFun: (row) => {
                this.getBinding(row);
              },
              disabled: (row) => {
                return (
                  this.lookInfo.userName == null ||
                  this.lookInfo.insState == 3 ||
                  this.lookInfo.insState == 5
                );
              },
            },
          ],
        },
      ],
      lookPage: {
        total: 0,
        size: 20,
        current: 0,
      },
      lookTableLoading: false,
      // 数据查看相关字段---结束
      retestVisible: false,
      upIndex: 0,
      tabLabel: ''
    };
  },
  mounted() {
    this.getAuthorizedPerson();
    this.queryParams.userId = this.userId;
    this.queryParams.typeSource = this.typeSource
    this.currentTime = getYearAndMonthAndDays();
    this.getDicts("urgency_level").then((response) => {
      this.urgencyLevel = this.dictToValue(response.data);
@@ -562,6 +491,7 @@
    this.getDicts("inspection_task_state").then((response) => {
      this.inspectionTaskState = this.dictToValue(response.data);
    });
    this.queryParams.typeSource = this.typeSource
    this.refreshTable();
  },
  methods: {
@@ -586,28 +516,6 @@
      this.page.size = limit;
      this.getList();
    },
    getLookList() {
      this.lookTableLoading = true;
      let param = { id: this.lookInfo.id, ...this.lookPage, inspectionItem: this.entity.inspectionItem };
      delete param.total;
      selectSampleAndProductByOrderId({ ...param })
        .then((res) => {
          this.lookTableLoading = false;
          if (res.code === 200) {
            this.lookTableData = res.data.records;
            this.lookPage.total = res.data.total;
            this.dataDialogVisible = true;
          }
        })
        .catch((err) => {
          this.lookTableLoading = false;
        });
    },
    lookPagination({ page, limit }) {
      this.lookPage.current = page;
      this.lookPage.size = limit;
      this.getLookList();
    },
    // 修改检验值
    editInspection(row) {
      this.$refs.editInspectionItem.showDialog(row.id);
@@ -615,11 +523,6 @@
    // 查看工时
    viewManHour(row) {
      this.$refs.viewManHourDia.showDialog(row.id, row.insState);
    },
    // 数据查看
    handleDataLook(row) {
      this.lookInfo = row;
      this.getLookList();
    },
    changeCheckBox(val) {
      this.queryParams.userId = val ? 0 : null;
@@ -633,7 +536,8 @@
    },
    refreshTable(e) {
      this.page.current = 1;
      this.queryParams.typeSource = this.tabIndex;
      this.queryParams.tabLabel = this.tabLabel;
      this.queryParams.typeSource = this.typeSource;
      this.getList();
    },
    // 下载报告
@@ -720,6 +624,7 @@
    },
    handleTab(m, i) {
      this.tabIndex = i;
      this.typeSource =m.value;
      this.queryParams.sonLaboratory = "";
      this.refreshTable();
    },
@@ -790,7 +695,7 @@
          sonLaboratory: this.sonLaboratory,
          state: this.state,
          typeSource: this.typeSource,
          orderId: this.orderId,
          orderId: this.orderId
        },
      });
    },
@@ -822,19 +727,29 @@
    },
    handleConnect(row) {
      this.orderId = row.id;
      this.connect = {};
      this.connect = {
        connectPerson: "",
        sonLaboratory: "",
      };
      this.sonLaboratoryList = [];
      this.connectVisible = true;
      upPlanUser2({ orderId: this.orderId }).then((res) => {
        if (res.code === 200 && res.data.length > 0) {
          this.sonLaboratoryList = [];
          res.data.forEach((m) => {
            this.sonLaboratoryList.push({
              value: m,
              label: m,
            });
          });
      treeDevice().then((res) => {
        if (res.code === 200) {
          const laboratoryNames = [
            ...new Set((res.data || []).map((item) => item && item.label).filter(Boolean)),
          ];
          this.sonLaboratoryList = laboratoryNames.map((laboratoryName) => ({
            value: laboratoryName,
            label: laboratoryName,
          }));
          if (this.sonLaboratoryList.length === 0) {
            this.$message.warning("暂无场所数据");
            return;
          }
          this.connect.sonLaboratory = this.sonLaboratoryList[0].value;
        }
      }).catch(() => {
        this.$message.error("场所数据加载失败");
      });
    },
    confirmConnect() {