liding
2025-03-28 a7dd838394ad36cadb74d6bdd379d4d098ab8d8c
src/views/business/outsourcedParts/index.vue
@@ -20,7 +20,7 @@
      </el-form>
      <div>
        <el-button size="mini" type="primary">获取订单</el-button>
        <el-button size="mini" type="primary" @click="openAdd('新增')">新增</el-button>
        <!-- <el-button size="mini" type="primary" @click="openAdd('新增')">新增</el-button> -->
      </div>
    </div>
    <lims-table :tableData="tableData" :column="column" :tableLoading="tableLoading" :height="'calc(100vh - 220px)'"
@@ -59,9 +59,17 @@
          </el-input>
        </el-form-item>
        <el-form-item label="检测结果" prop="result" v-if="title == '检验'">
          <el-switch v-model="addForm.result" active-text="合格" inactive-text="不合格" active-value="合格"
          <el-select v-model="addForm.result" placeholder="请选择">
            <el-option label="合格" value="合格">
            </el-option>
            <el-option label="不合格" value="不合格">
            </el-option>
            <el-option label="不判断" value="不判断">
            </el-option>
          </el-select>
          <!-- <el-switch v-model="addForm.result" active-text="合格" inactive-text="不合格" active-value="合格"
            inactive-value="不合格">
          </el-switch>
          </el-switch> -->
        </el-form-item>
        <el-form-item label="测试文件" prop="file" v-if="title == '检验'">
          <el-upload action="#" :auto-upload="false" :multiple="false"
@@ -80,13 +88,14 @@
<script>
import limsTable from "@/components/Table/lims-table.vue";
import { selectInspection, addOrUpdateInspection, delInspection } from '@/api/business/outsourcedParts.js'
import { selectInspection, addOrUpdateInspection, delInspection, updateInspection } from '@/api/business/outsourcedParts.js'
export default {
  components: { limsTable },
  data() {
    return {
      queryParams: {},
      tableData: [],
      value: '',
      column: [
        { label: "委托编号", prop: "entrustmentNo" },
        { label: "产品", prop: "name" },
@@ -120,23 +129,23 @@
          dataType: "action",
          label: "操作",
          operation: [
            {
              name: "编辑",
              type: "text",
              clickFun: (row) => {
                this.openAdd("编辑", row);
              },
            },
            {
              name: "删除",
              type: "text",
              clickFun: (row) => {
                this.handleDelete(row);
              },
              disabled: (row) => {
                return !!row.ratifyUser
              },
            },
            // {
            //   name: "编辑",
            //   type: "text",
            //   clickFun: (row) => {
            //     this.openAdd("编辑", row);
            //   },
            // },
            // {
            //   name: "删除",
            //   type: "text",
            //   clickFun: (row) => {
            //     this.handleDelete(row);
            //   },
            //   disabled: (row) => {
            //     return !!row.ratifyUser
            //   },
            // },
            {
              name: "检验",
              type: "text",
@@ -171,6 +180,9 @@
        inspectionItems: [
          { required: true, message: "请输入外观", trigger: "blur" },
        ],
        result: [
          { required: true, message: "请选择检测结果", trigger: "change" },
        ],
      },
      uploading: false,
      inspectionTaskState: []
@@ -180,6 +192,7 @@
    this.getDicts("inspection_task_state").then((response) => {
      this.inspectionTaskState = this.dictToValue(response.data);
    });
    this.getList()
  },
  methods: {
    getList() {
@@ -246,9 +259,24 @@
            // 检验
            let fd = new FormData();
            //文件信息中raw才是真的文件
            if (this.file) {
              fd.append("file", this.file.raw);
            if (this.addForm.file) {
              fd.append("file", this.addForm.file.raw);
            }
            fd.append("inspectionItems", this.addForm.inspectionItems);
            fd.append("result", this.addForm.result);
            fd.append("id", this.addForm.id);  // 添加id参数
            updateInspection(fd)
              .then(res => {
                this.uploading = false;
                if (res.code === 200) {
                  this.$message.success("检验提交成功");
                  this.refresh();
                  this.addDia = false;
                }
              })
              .catch(err => {
                this.uploading = false;
              });
          }
        } else {
          return false;