src/views/standard/model/index.vue
@@ -41,6 +41,9 @@
        <el-form-item label="备注" prop="remark">
          <el-input v-model="copyForm.remark" clearable size="small"></el-input>
        </el-form-item>
        <el-form-item label="标准要求值" prop="standardRequirement">
          <el-input v-model="copyForm.standardRequirement" clearable size="small"></el-input>
        </el-form-item>
        <el-form-item label="价格(元)" prop="price">
          <el-input v-model="copyForm.price" clearable size="small"></el-input>
        </el-form-item>
@@ -64,6 +67,7 @@
  delStandardTemplate,
  getEditTemplatePreparation,
} from "@/api/standard/model";
import { validateInspectionValueAnnotation } from "@/utils/inspectionValueFormat";
export default {
  name: 'Model',
  components: {
@@ -87,6 +91,7 @@
        number: "",
        name: "",
        remark: "",
        standardRequirement: "",
        price: "",
        id: "",
      },
@@ -102,6 +107,7 @@
        { label: "检验依据", prop: "number" },
        { label: "检验项目", prop: "name" },
        { label: "备注", prop: "remark" },
        { label: "标准要求值", prop: "standardRequirement" },
        { label: "价格(元)", prop: "price" },
        { label: "创建用户", prop: "createUserName" },
        { label: "创建时间", prop: "createTime", width: "160" },
@@ -162,7 +168,7 @@
      page: {
        total: 0,
        size: 10,
        current: 0,
        current: 1,
      },
      tableLoading: false,
    };
@@ -215,7 +221,7 @@
    copyTemplate(row) {
      this.title = "复制模版";
      this.isShowCopyTem = true;
      this.copyForm.id = row.id;
      this.copyForm = this.HaveJson(row);
    },
    // 新增/编辑/复制模板
    submitCopyInfo() {
@@ -227,6 +233,7 @@
            name: this.copyForm.name,
            number: this.copyForm.number,
            remark: this.copyForm.remark,
            standardRequirement: this.copyForm.standardRequirement,
            price: this.copyForm.price === "" || this.copyForm.price == null ? null : this.copyForm.price,
          };
          switch (this.title) {
@@ -246,6 +253,8 @@
              break;
            case "编辑":
              params.thing = this.copyForm.thing ? this.copyForm.thing : "";
              // 价格留空仍按 0 保存;模板编制保存不传价格,需由后端保持原值
              params.price = params.price == null ? 0 : params.price;
              upStandardTemplate(params)
                .then((res) => {
                  this.isShowCopyTem = false;
@@ -349,7 +358,12 @@
          }
        }
      }
      let annotationError = null;
      data.data[0].celldata.forEach((a) => {
        if (a.v && a.v.ps && typeof a.v.ps.value === "string") {
          const error = validateInspectionValueAnnotation(a.v.ps.value);
          if (!annotationError && error) annotationError = `单元格(${a.r + 1}行${a.c + 1}列):${error}`;
        }
        if (
          a.v.ps != undefined &&
          (a.v.ps.value === "检验值" ||
@@ -362,6 +376,11 @@
          }
        }
      });
      if (annotationError) {
        this.loading = false;
        this.$message.error(annotationError);
        return;
      }
      upStandardTemplate({
        id: this.row.id,
        thing: JSON.stringify(data),
@@ -370,6 +389,9 @@
        this.loading = false;
        this.$message.success("已保存");
        this.isShow = false;
      }).catch((error) => {
        this.loading = false;
        this.$message.error(error.message || "模板保存失败");
      });
    },
    isClose(done) {
@@ -409,7 +431,7 @@
  width: 88px;
  font-size: 14px;
  font-weight: 700;
  color: #606266;
  color: var(--lims-text-2);
}
.search_button {
  line-height: 26px;