spring
2025-04-11 9508c11a63737b4b9e80e1223792f07d3151c2e8
src/views/business/inspectionTask/components/EditInspectionItem.vue
@@ -1,25 +1,19 @@
<template>
  <div>
    <el-dialog
      :visible.sync="editInspectionDia"
      title="修改检验项"
      width="80%"
      @close="editInspectionDia = false"
    >
      <TableCard :showTitle="false">
        <template v-slot:table>
          <lims-table
            :column="editColumn"
            :table-data="editTableData"
            :table-loading="editLoading"
            :page="page"
            height="600"
            style="padding: 0 15px"
            @pagination="pagination"
          >
          </lims-table>
        </template>
      </TableCard>
    <el-dialog :visible.sync="editInspectionDia" title="修改检验项" width="80%" @close="editInspectionDia = false">
      <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="getTableData">查询</el-button>
          </el-form-item>
        </el-form>
      </div>
      <lims-table :column="editColumn" :table-data="editTableData" :table-loading="editLoading" :page="page"
        height="560" @pagination="pagination">
      </lims-table>
    </el-dialog>
    <el-dialog :visible.sync="editAskDia" title="修改" width="50%">
      <el-form ref="form" :model="editForm" label-width="100px">
@@ -30,37 +24,22 @@
          <el-input v-model="editForm.tell" type="textarea"></el-input>
        </el-form-item>
        <el-form-item label="检验值类型">
          <el-select
            v-model="editForm.inspectionValueType"
            clearable
            placeholder="请选择"
            size="small"
            style="width: 100%"
          >
            <el-option
              v-for="item in inspectionValueTypeList"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            ></el-option>
          <el-select v-model="editForm.inspectionValueType" clearable placeholder="请选择" size="small"
            style="width: 100%">
            <el-option v-for="dict in inspectionValueType" :key="dict.value" :label="dict.label"
              :value="dict.value"></el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="editAskDia = false">取 消</el-button>
        <el-button
          :loading="handleEditLoading"
          type="primary"
          @click="handleEdit"
          >确 定</el-button
        >
        <el-button :loading="handleEditLoading" type="primary" @click="handleEdit">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
import TableCard from "@/components/TableCard/index.vue";
import limsTable from "@/components/Table/lims-table.vue";
import {
  selectSampleAndProductByOrderId,
@@ -69,15 +48,15 @@
export default {
  name: "EditInspectionItem",
  // import 引入的组件需要注入到对象中才能使用
  components: { TableCard, limsTable },
  components: { limsTable },
  data() {
    // 这里存放数据
    return {
      editInspectionDia: false,
      entity: {
        id: 0,
        inspectionItem: ''
      },
      inspectionValueTypeList: [], // 检验值类型下拉框
      editColumn: [
        {
          label: "样品编号",
@@ -105,7 +84,7 @@
          prop: "inspectionItemSubclass",
        },
        {
          label: "条件",
          label: "试验条件",
          minWidth: "120px",
          prop: "radius",
        },
@@ -133,6 +112,7 @@
          minWidth: "120px",
          prop: "model",
        },
        { label: "检验人", prop: "checkUserName" },
        {
          dataType: "action",
          width: "80px",
@@ -164,7 +144,13 @@
        inspectionValueType: "",
      },
      handleEditLoading: false,
      inspectionValueType: [],
    };
  },
  mounted() {
    this.getDicts("inspection_value_type").then((response) => {
      this.inspectionValueType = this.dictToValue(response.data);
    });
  },
  // 方法集合
  methods: {
@@ -182,9 +168,8 @@
      })
        .then((res) => {
          this.editLoading = false;
          if (res.code === 201) return;
          this.editTableData = res.data.body.records;
          this.page.total = res.data.body.total;
          this.editTableData = res.data.records;
          this.page.total = res.data.total;
        })
        .catch(() => {
          this.editLoading = false;
@@ -193,7 +178,6 @@
    // 修改弹框
    editIns(row) {
      this.editAskDia = true;
      this.selectEnumByCategoryForInspectionValueType();
      this.editForm = { ...row };
    },
    // 提交修改
@@ -208,7 +192,6 @@
      updateProductOnPlan(params)
        .then((res) => {
          this.handleEditLoading = false;
          if (res.code === 201) return;
          this.$message.success("修改成功");
          this.editAskDia = false;
          this.getTableData();
@@ -222,15 +205,6 @@
      this.page.current = page;
      this.page.size = limit;
      this.getTableData();
    },
    selectEnumByCategoryForInspectionValueType() {
      this.$axios
        .post(this.$api.enums.selectEnumByCategory, {
          category: "检验值类型",
        })
        .then((res) => {
          this.inspectionValueTypeList = res.data;
        });
    },
  },
};